]> Shamusworld >> Repos - schematic/blob - src/newvendordialog.cpp
Move DB access to NoteDialog class, new AlertDialog class.
[schematic] / src / newvendordialog.cpp
1 //
2 // newvendordialog.cpp: Create New Vendor dialog
3 //
4 // Part of the SCheMatic Project
5 // (C) 2012 Underground Software
6 //
7 // JLH = James Hammons <jlhamm@acm.org>
8 //
9 // WHO  WHEN        WHAT
10 // ---  ----------  ------------------------------------------------------------
11 // JLH  09/21/2012  Created this file
12
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. :-)
15
16 #include "newvendordialog.h"
17
18
19 NewVendorDialog::NewVendorDialog(QWidget * parent/*= 0*/): QDialog(parent),
20         buttonBox(new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel)),
21         edit1(new QLineEdit),
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))
27 {
28         connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
29         connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
30
31         QVBoxLayout * vbox1 = new QVBoxLayout;
32         QVBoxLayout * vbox2 = new QVBoxLayout;
33         QVBoxLayout * vbox3 = new QVBoxLayout;
34         QHBoxLayout * hbox1 = new QHBoxLayout;
35
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"));
40
41         QFormLayout * form1 = new QFormLayout;
42         QVBoxLayout * form2 = new QVBoxLayout;
43         QVBoxLayout * form3 = new QVBoxLayout;
44
45         form1->addRow(tr("Name:"), edit1);
46         form1->addRow(tr("Level:"), combo1);
47         form2->addWidget(address);
48         form3->addWidget(contact);
49
50         vbox1->addLayout(form1);
51         vbox1->addWidget(checkbox1);
52         gb1->setLayout(vbox1);
53
54         gb2->setLayout(form2);
55
56         gb3->setLayout(form3);
57
58         vbox2->addWidget(gb1);
59         vbox2->addWidget(gb2);
60         vbox2->addWidget(gb3);
61
62         vbox3->addWidget(list);
63         gb4->setLayout(vbox3);
64
65         hbox1->addLayout(vbox2);
66         hbox1->addWidget(gb4);
67
68         QVBoxLayout * mainLayout = new QVBoxLayout;
69         mainLayout->addLayout(hbox1);
70         mainLayout->addWidget(buttonBox);
71         setLayout(mainLayout);
72
73         setWindowTitle(tr("New Vendor"));
74 }
75
76 NewVendorDialog::~NewVendorDialog()
77 {
78 }
79