2 // newvendordialog.cpp: Create New Vendor dialog
4 // Part of the SCheMatic Project
5 // (C) 2012 Underground Software
7 // JLH = James Hammons <jlhamm@acm.org>
10 // --- ---------- ------------------------------------------------------------
11 // JLH 09/21/2012 Created this file
13 // NOTE: This can also be used as a vendor editing dialog. It's up to the caller
14 // to change the window title and populate fields in that case. :-)
16 #include "newvendordialog.h"
19 NewVendorDialog::NewVendorDialog(QWidget * parent/*= 0*/): QDialog(parent),
20 buttonBox(new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel)),
22 combo1(new QComboBox),
23 checkbox1(new QCheckBox(tr("NDA Signed"))),
24 list(new QListWidget),
25 address(new AddressEditWidget(this)),
26 contact(new ContactEditWidget(this))
28 connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
29 connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
31 QVBoxLayout * vbox1 = new QVBoxLayout;
32 QVBoxLayout * vbox2 = new QVBoxLayout;
33 QVBoxLayout * vbox3 = new QVBoxLayout;
34 QHBoxLayout * hbox1 = new QHBoxLayout;
36 QGroupBox * gb1 = new QGroupBox(tr("Vendor"));
37 QGroupBox * gb2 = new QGroupBox(tr("Primary Location"));
38 QGroupBox * gb3 = new QGroupBox(tr("Primary Contact"));
39 QGroupBox * gb4 = new QGroupBox(tr("Vendor Classes"));
41 QFormLayout * form1 = new QFormLayout;
42 QVBoxLayout * form2 = new QVBoxLayout;
43 QVBoxLayout * form3 = new QVBoxLayout;
45 form1->addRow(tr("Name:"), edit1);
46 form1->addRow(tr("Level:"), combo1);
47 form2->addWidget(address);
48 form3->addWidget(contact);
50 vbox1->addLayout(form1);
51 vbox1->addWidget(checkbox1);
52 gb1->setLayout(vbox1);
54 gb2->setLayout(form2);
56 gb3->setLayout(form3);
58 vbox2->addWidget(gb1);
59 vbox2->addWidget(gb2);
60 vbox2->addWidget(gb3);
62 vbox3->addWidget(list);
63 gb4->setLayout(vbox3);
65 hbox1->addLayout(vbox2);
66 hbox1->addWidget(gb4);
68 QVBoxLayout * mainLayout = new QVBoxLayout;
69 mainLayout->addLayout(hbox1);
70 mainLayout->addWidget(buttonBox);
71 setLayout(mainLayout);
73 setWindowTitle(tr("New Vendor"));
76 NewVendorDialog::~NewVendorDialog()