File: netdialog.cpp

package info (click to toggle)
xdrawchem 1.0-0.1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,820 kB
  • ctags: 2,389
  • sloc: cpp: 17,801; makefile: 263; ansic: 168
file content (88 lines) | stat: -rw-r--r-- 2,398 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include <qwidget.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qdialog.h>
#include <qcolor.h>
#include <qfont.h>
#include <qnamespace.h>
#include <qpixmap.h>
#include <qcombobox.h>
#include <qvbox.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qdir.h>
#include <qstringlist.h>
#include <qcheckbox.h>
#include <iostream.h>
#include <stdlib.h>

#include <qstring.h>
#include <qurloperator.h>
#include <qcstring.h>
#include <qnetworkprotocol.h>

#include "netdialog.h"
#include "defs.h"
#include "http.h"

NetDialog::NetDialog(QWidget *parent, QString name):
  QDialog(parent, name, TRUE)
{
  QString serverName;

  serverName = getenv("XDC_SERVER");

  if (serverName.length() < 2)
    serverName = XDC_SERVER;

  QPushButton *ok, *dismiss;
  QLabel *cap1, *caption, *l1;
  setBackgroundColor(lightGray);
  setCaption( tr("Find structure via Internet") );

  QGridLayout *mygrid = new QGridLayout(this,8,5,5);

  cap1 = new QLabel( tr("XDC database server:"), this);
  cap1->setBackgroundColor(lightGray);
  mygrid->addMultiCellWidget(cap1, 0, 0, 0, 4);

  serverkey = new QLineEdit(this);
  serverkey->setText(serverName);
  mygrid->addMultiCellWidget(serverkey, 1, 1, 0, 4);

  caption = new QLabel( tr("Search type:"), this);
  caption->setBackgroundColor(lightGray);
  mygrid->addMultiCellWidget(caption, 2, 2, 0, 4);

  keylist = new QComboBox(FALSE, this);
  keylist->insertItem(tr("CAS Number"));
  keylist->insertItem(tr("Formula"));
  keylist->insertItem(tr("Chemical name"));
  mygrid->addMultiCellWidget(keylist, 3, 3, 0, 4);

  l1 = new QLabel(tr("Look for:"), this);
  l1->setBackgroundColor(lightGray);
  mygrid->addMultiCellWidget(l1, 4, 4, 0, 4);
  
  searchkey = new QLineEdit(this);
  mygrid->addMultiCellWidget(searchkey, 5, 5, 0, 4);
  connect(searchkey, SIGNAL(returnPressed()), this, SLOT(accept()) );

  emcheck = new QCheckBox(tr("Exact matches only"), this);
  mygrid->addMultiCellWidget(emcheck, 6, 6, 0, 4);

  ok = new QPushButton( tr("Search"), this);
  ok->setPalette(QPalette(lightGray));
  connect(ok, SIGNAL(clicked()), SLOT(OK()) );
  mygrid->addMultiCellWidget(ok, 7, 7, 1, 1);

  dismiss = new QPushButton( tr("Cancel"), this);
  dismiss->setPalette(QPalette(lightGray));
  connect(dismiss, SIGNAL(clicked()), SLOT(reject()) );
  mygrid->addMultiCellWidget(dismiss, 7, 7, 3, 3);
}

void NetDialog::OK() {
  accept();
}