]> Shamusworld >> Repos - schematic/commitdiff
Added new classes, lots of new functionality.
authorShamus Hammons <jlhamm@acm.org>
Thu, 27 Sep 2012 23:36:04 +0000 (18:36 -0500)
committerShamus Hammons <jlhamm@acm.org>
Thu, 27 Sep 2012 23:36:04 +0000 (18:36 -0500)
21 files changed:
database-schema.txt
phase1.ui
schematic-schema.sql
schematic.pro
src/addresseditwidget.cpp [new file with mode: 0644]
src/addresseditwidget.h [new file with mode: 0644]
src/addresswidget.cpp [new file with mode: 0644]
src/addresswidget.h [new file with mode: 0644]
src/contacteditwidget.cpp [new file with mode: 0644]
src/contacteditwidget.h [new file with mode: 0644]
src/contactwidget.cpp [new file with mode: 0644]
src/contactwidget.h [new file with mode: 0644]
src/mainwin.cpp
src/mainwin.h
src/newvendordialog.cpp
src/newvendordialog.h
src/scmwidget.cpp [new file with mode: 0644]
src/scmwidget.h [new file with mode: 0644]
src/vendorclassdialog.cpp
src/vendorlevelwidget.cpp [new file with mode: 0644]
src/vendorlevelwidget.h [new file with mode: 0644]

index 3b5a34bafb70a1671cf2d6f6cd77f2d35f746cbb..7bfb70953ab31d1d28db97791570a7c876b20a5f 100644 (file)
@@ -8,7 +8,7 @@ VID (P-key) | VLID | signedNDA | Name
 CREATE TABLE Vendor (vid INT NOT NULL PRIMARY KEY AUTO_INCREMENT, vlid INT, signedNDA TINYINT(1) NOT NULL DEFAULT 0, name VARCHAR(100), FOREIGN KEY (vlid) REFERENCES VendorLevel(vlid)) ENGINE=INNODB;
 
 VendorLevel
-VLID (P-key) | VendorUseable | Color | Description
+VLID (P-key) | VendorUsable | Color | Description
 CREATE TABLE VendorLevel (vlid INT NOT NULL PRIMARY KEY AUTO_INCREMENT, vendorUsable TINYINT(1) NOT NULL DEFAULT 0, color INT(4), description VARCHAR(100)) ENGINE=INNODB;
 
 VendorType
index 380c1156112a103b4cad5c57df14421fa5753b17..2ee39d86173da76155410283522388844cd89c62 100644 (file)
--- a/phase1.ui
+++ b/phase1.ui
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>932</width>
-    <height>826</height>
+    <width>1023</width>
+    <height>883</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -17,8 +17,8 @@
    <widget class="QTextBrowser" name="textBrowser">
     <property name="geometry">
      <rect>
-      <x>790</x>
-      <y>230</y>
+      <x>870</x>
+      <y>720</y>
       <width>141</width>
       <height>111</height>
      </rect>
@@ -52,7 +52,7 @@ p, li { white-space: pre-wrap; }
    <widget class="QLabel" name="label_2">
     <property name="geometry">
      <rect>
-      <x>240</x>
+      <x>750</x>
       <y>10</y>
       <width>51</width>
       <height>16</height>
@@ -65,7 +65,7 @@ p, li { white-space: pre-wrap; }
    <widget class="QLineEdit" name="lineEdit">
     <property name="geometry">
      <rect>
-      <x>290</x>
+      <x>800</x>
       <y>10</y>
       <width>191</width>
       <height>22</height>
@@ -77,7 +77,7 @@ p, li { white-space: pre-wrap; }
      <rect>
       <x>10</x>
       <y>30</y>
-      <width>731</width>
+      <width>1001</width>
       <height>16</height>
      </rect>
     </property>
@@ -116,7 +116,7 @@ p, li { white-space: pre-wrap; }
      <rect>
       <x>20</x>
       <y>570</y>
-      <width>901</width>
+      <width>981</width>
       <height>192</height>
      </rect>
     </property>
@@ -159,8 +159,8 @@ p, li { white-space: pre-wrap; }
    <widget class="QGroupBox" name="groupBox">
     <property name="geometry">
      <rect>
-      <x>600</x>
-      <y>370</y>
+      <x>740</x>
+      <y>710</y>
       <width>121</width>
       <height>121</height>
      </rect>
@@ -212,7 +212,7 @@ p, li { white-space: pre-wrap; }
     <property name="geometry">
      <rect>
       <x>290</x>
-      <y>370</y>
+      <y>380</y>
       <width>131</width>
       <height>121</height>
      </rect>
@@ -409,8 +409,8 @@ p, li { white-space: pre-wrap; }
     <property name="geometry">
      <rect>
       <x>290</x>
-      <y>100</y>
-      <width>481</width>
+      <y>110</y>
+      <width>321</width>
       <height>241</height>
      </rect>
     </property>
@@ -426,7 +426,7 @@ p, li { white-space: pre-wrap; }
        <rect>
         <x>0</x>
         <y>10</y>
-        <width>471</width>
+        <width>311</width>
         <height>201</height>
        </rect>
       </property>
@@ -556,18 +556,18 @@ p, li { white-space: pre-wrap; }
    <widget class="QListView" name="listView">
     <property name="geometry">
      <rect>
-      <x>740</x>
-      <y>360</y>
-      <width>171</width>
-      <height>161</height>
+      <x>770</x>
+      <y>80</y>
+      <width>231</width>
+      <height>271</height>
      </rect>
     </property>
    </widget>
    <widget class="QLabel" name="label_17">
     <property name="geometry">
      <rect>
-      <x>297</x>
-      <y>350</y>
+      <x>290</x>
+      <y>360</y>
       <width>121</width>
       <height>20</height>
      </rect>
@@ -580,7 +580,7 @@ p, li { white-space: pre-wrap; }
     <property name="geometry">
      <rect>
       <x>440</x>
-      <y>370</y>
+      <y>360</y>
       <width>141</width>
       <height>121</height>
      </rect>
@@ -588,45 +588,6 @@ p, li { white-space: pre-wrap; }
     <property name="title">
      <string>Vendor Actions</string>
     </property>
-    <widget class="QPushButton" name="pushButton_8">
-     <property name="geometry">
-      <rect>
-       <x>20</x>
-       <y>90</y>
-       <width>106</width>
-       <height>25</height>
-      </rect>
-     </property>
-     <property name="text">
-      <string>Add Location</string>
-     </property>
-    </widget>
-    <widget class="QPushButton" name="pushButton_7">
-     <property name="geometry">
-      <rect>
-       <x>20</x>
-       <y>60</y>
-       <width>106</width>
-       <height>25</height>
-      </rect>
-     </property>
-     <property name="text">
-      <string>Add Contact</string>
-     </property>
-    </widget>
-    <widget class="QPushButton" name="pushButton_6">
-     <property name="geometry">
-      <rect>
-       <x>20</x>
-       <y>30</y>
-       <width>106</width>
-       <height>25</height>
-      </rect>
-     </property>
-     <property name="text">
-      <string>Add Vendor</string>
-     </property>
-    </widget>
    </widget>
    <widget class="QLabel" name="label_18">
     <property name="geometry">
@@ -699,13 +660,187 @@ p, li { white-space: pre-wrap; }
      <enum>Qt::Horizontal</enum>
     </property>
    </widget>
+   <widget class="QPushButton" name="pushButton_9">
+    <property name="geometry">
+     <rect>
+      <x>460</x>
+      <y>470</y>
+      <width>61</width>
+      <height>25</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Edit</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_19">
+    <property name="geometry">
+     <rect>
+      <x>770</x>
+      <y>60</y>
+      <width>51</width>
+      <height>16</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Alerts</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_20">
+    <property name="geometry">
+     <rect>
+      <x>770</x>
+      <y>370</y>
+      <width>51</width>
+      <height>16</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Notes</string>
+    </property>
+   </widget>
+   <widget class="QListView" name="listView_2">
+    <property name="geometry">
+     <rect>
+      <x>770</x>
+      <y>390</y>
+      <width>231</width>
+      <height>161</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="Line" name="line_3">
+    <property name="geometry">
+     <rect>
+      <x>730</x>
+      <y>60</y>
+      <width>20</width>
+      <height>501</height>
+     </rect>
+    </property>
+    <property name="orientation">
+     <enum>Qt::Vertical</enum>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton_10">
+    <property name="geometry">
+     <rect>
+      <x>935</x>
+      <y>50</y>
+      <width>61</width>
+      <height>25</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Create</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton_11">
+    <property name="geometry">
+     <rect>
+      <x>930</x>
+      <y>360</y>
+      <width>61</width>
+      <height>25</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Create</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton_12">
+    <property name="geometry">
+     <rect>
+      <x>670</x>
+      <y>540</y>
+      <width>61</width>
+      <height>25</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Create</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton_6">
+    <property name="geometry">
+     <rect>
+      <x>460</x>
+      <y>380</y>
+      <width>106</width>
+      <height>25</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Add Vendor</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton_7">
+    <property name="geometry">
+     <rect>
+      <x>460</x>
+      <y>410</y>
+      <width>106</width>
+      <height>25</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Add Contact</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton_8">
+    <property name="geometry">
+     <rect>
+      <x>460</x>
+      <y>440</y>
+      <width>106</width>
+      <height>25</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Add Location</string>
+    </property>
+   </widget>
+   <zorder>label</zorder>
+   <zorder>label_2</zorder>
+   <zorder>lineEdit</zorder>
+   <zorder>line</zorder>
+   <zorder>checkBox</zorder>
+   <zorder>label_9</zorder>
+   <zorder>tableWidget</zorder>
+   <zorder>groupBox</zorder>
+   <zorder>frame</zorder>
+   <zorder>treeWidget</zorder>
+   <zorder>tabWidget</zorder>
+   <zorder>tabWidget_2</zorder>
+   <zorder>pushButton_4</zorder>
+   <zorder>pushButton_5</zorder>
+   <zorder>listView</zorder>
+   <zorder>label_17</zorder>
+   <zorder>groupBox_2</zorder>
+   <zorder>label_18</zorder>
+   <zorder>toolButton</zorder>
+   <zorder>toolButton_2</zorder>
+   <zorder>toolButton_3</zorder>
+   <zorder>line_2</zorder>
+   <zorder>pushButton_9</zorder>
+   <zorder>label_19</zorder>
+   <zorder>textBrowser</zorder>
+   <zorder>label_20</zorder>
+   <zorder>listView_2</zorder>
+   <zorder>line_3</zorder>
+   <zorder>pushButton_10</zorder>
+   <zorder>pushButton_11</zorder>
+   <zorder>pushButton_12</zorder>
+   <zorder>pushButton_6</zorder>
+   <zorder>pushButton_7</zorder>
+   <zorder>pushButton_8</zorder>
   </widget>
   <widget class="QMenuBar" name="menubar">
    <property name="geometry">
     <rect>
      <x>0</x>
      <y>0</y>
-     <width>932</width>
+     <width>1023</width>
      <height>22</height>
     </rect>
    </property>
index 4d1a59d9d70e1153d4474a5a7020b7153de1659c..d632f3b107a870526cc58ee6d889ce1a7943a7a9 100644 (file)
@@ -390,6 +390,9 @@ CREATE TABLE `VendorLevel` (
 
 LOCK TABLES `VendorLevel` WRITE;
 /*!40000 ALTER TABLE `VendorLevel` DISABLE KEYS */;
+INSERT INTO `VendorLevel` VALUES (1,1,65280,'1;Trusted');
+INSERT INTO `VendorLevel` VALUES (2,1,255,'2;Caution Advised');
+INSERT INTO `VendorLevel` VALUES (3,0,16719904,'X;DO NOT USE');
 /*!40000 ALTER TABLE `VendorLevel` ENABLE KEYS */;
 UNLOCK TABLES;
 
index ffee4fbc59ebb16c4b286f0cc5a6595ec0818d36..150bd0c6dbfb3dd91eae943e663058f60bb1a3c7 100644 (file)
@@ -23,22 +23,34 @@ RESOURCES += schematic.qrc
 # Source files
 
 HEADERS += src/about.h \
+       src/addresseditwidget.h \
+       src/addresswidget.h \
        src/configdialog.h \
+       src/contacteditwidget.h \
+       src/contactwidget.h \
        src/generaltab.h \
        src/logindialog.h \
        src/main.h \
        src/mainwin.h \
        src/newvendordialog.h \
+       src/scmwidget.h \
        src/sqlsettingsdialog.h \
-       src/vendorclassdialog.h
+       src/vendorclassdialog.h \
+       src/vendorlevelWidget.h
 
 SOURCES += src/about.cpp \
+       src/addresseditwidget.cpp \
+       src/addresswidget.cpp \
        src/configdialog.cpp \
+       src/contacteditwidget.cpp \
+       src/contactwidget.cpp \
        src/generaltab.cpp \
        src/logindialog.cpp \
        src/main.cpp \
        src/mainwin.cpp \
        src/newvendordialog.cpp \
+       src/scmwidget.cpp \
        src/sqlsettingsdialog.cpp \
-       src/vendorclassdialog.cpp
+       src/vendorclassdialog.cpp \
+       src/vendorlevelWidget.cpp
 
diff --git a/src/addresseditwidget.cpp b/src/addresseditwidget.cpp
new file mode 100644 (file)
index 0000000..15c3703
--- /dev/null
@@ -0,0 +1,33 @@
+//
+// addresseditwidget.cpp - Editable vendor address display
+//
+// by James Hammons
+// (C) 2012 Underground Software
+//
+// JLH = James Hammons <jlhamm@acm.org>
+//
+// Who  When        What
+// ---  ----------  -------------------------------------------------------------
+// JLH  09/24/2012  Created this file
+//
+
+#include "addresseditwidget.h"
+
+AddressEditWidget::AddressEditWidget(QWidget * parent/*= 0*/): QWidget(parent),
+       field1(new QLineEdit),
+       field2(new QLineEdit),
+       field3(new QLineEdit),
+       field4(new QLineEdit),
+       field5(new QLineEdit)
+{
+       QFormLayout * form = new QFormLayout;
+
+       form->addRow(tr("Address:"), field1);
+       form->addRow(tr("City:"), field2);
+       form->addRow(tr("State:"), field3);
+       form->addRow(tr("Country:"), field4);
+       form->addRow(tr("Postal Code:"), field5);
+
+       setLayout(form);
+}
+
diff --git a/src/addresseditwidget.h b/src/addresseditwidget.h
new file mode 100644 (file)
index 0000000..5ac1a27
--- /dev/null
@@ -0,0 +1,27 @@
+//
+// addresseditwidget.h: Editable vendor address
+//
+// by James Hammons
+// (C) 2012 Underground Software
+//
+
+#ifndef __ADDRESSEDITWIDGET_H__
+#define __ADDRESSEDITWIDGET_H__
+
+#include <QtGui>
+
+class AddressEditWidget: public QWidget
+{
+       public:
+               AddressEditWidget(QWidget * parent = 0);
+
+       public:
+               QLineEdit * field1;
+               QLineEdit * field2;
+               QLineEdit * field3;
+               QLineEdit * field4;
+               QLineEdit * field5;
+};
+
+#endif // __ADDRESSEDITWIDGET_H__
+
diff --git a/src/addresswidget.cpp b/src/addresswidget.cpp
new file mode 100644 (file)
index 0000000..6f3c20e
--- /dev/null
@@ -0,0 +1,43 @@
+//
+// addresswidget.cpp - Vendor address display
+//
+// by James Hammons
+// (C) 2012 Underground Software
+//
+// JLH = James Hammons <jlhamm@acm.org>
+//
+// Who  When        What
+// ---  ----------  -------------------------------------------------------------
+// JLH  09/24/2012  Created this file
+//
+
+#include "addresswidget.h"
+
+AddressWidget::AddressWidget(QWidget * parent/*= 0*/): QWidget(parent),
+       field1(new QLabel),
+       field2(new QLabel),
+       field3(new QLabel),
+       field4(new QLabel),
+       field5(new QLabel)
+{
+       QFormLayout * form = new QFormLayout;
+
+       form->addRow(tr("Address:"), field1);
+       form->addRow(tr("City:"), field2);
+       form->addRow(tr("State:"), field3);
+       form->addRow(tr("Country:"), field4);
+       form->addRow(tr("Postal Code:"), field5);
+
+       setLayout(form);
+}
+
+
+void AddressWidget::SetFields(QString s1, QString s2, QString s3, QString s4, QString s5)
+{
+       field1->setText(s1);
+       field2->setText(s2);
+       field3->setText(s3);
+       field4->setText(s4);
+       field5->setText(s5);
+}
+
diff --git a/src/addresswidget.h b/src/addresswidget.h
new file mode 100644 (file)
index 0000000..afb477c
--- /dev/null
@@ -0,0 +1,29 @@
+//
+// addresswidget.h: Vendor address display
+//
+// by James Hammons
+// (C) 2012 Underground Software
+//
+
+#ifndef __ADDRESSWIDGET_H__
+#define __ADDRESSWIDGET_H__
+
+#include <QtGui>
+
+class AddressWidget: public QWidget
+{
+       public:
+               AddressWidget(QWidget * parent = 0);
+
+               void SetFields(QString, QString, QString, QString, QString);
+
+       public:
+               QLabel * field1;
+               QLabel * field2;
+               QLabel * field3;
+               QLabel * field4;
+               QLabel * field5;
+};
+
+#endif // __ADDRESSWIDGET_H__
+
diff --git a/src/contacteditwidget.cpp b/src/contacteditwidget.cpp
new file mode 100644 (file)
index 0000000..110a8c7
--- /dev/null
@@ -0,0 +1,37 @@
+//
+// contacteditwidget.cpp - Vendor contact display
+//
+// by James Hammons
+// (C) 2012 Underground Software
+//
+// JLH = James Hammons <jlhamm@acm.org>
+//
+// Who  When        What
+// ---  ----------  -------------------------------------------------------------
+// JLH  09/24/2012  Created this file
+//
+
+#include "contacteditwidget.h"
+
+ContactEditWidget::ContactEditWidget(QWidget * parent/*= 0*/): QWidget(parent),
+       field1(new QComboBox),
+       field2(new QLineEdit),
+       field3(new QLineEdit),
+       field4(new QLineEdit),
+       field5(new QLineEdit),
+       field6(new QLineEdit),
+       field7(new QLineEdit)
+{
+       QFormLayout * form = new QFormLayout;
+
+       form->addRow(tr("Type:"), field1);
+       form->addRow(tr("Name:"), field2);
+       form->addRow(tr("Email:"), field3);
+       form->addRow(tr("Address:"), field4);
+       form->addRow(tr("Phone 1:"), field5);
+       form->addRow(tr("Phone 2:"), field6);
+       form->addRow(tr("Fax:"), field7);
+
+       setLayout(form);
+}
+
diff --git a/src/contacteditwidget.h b/src/contacteditwidget.h
new file mode 100644 (file)
index 0000000..d9e1c46
--- /dev/null
@@ -0,0 +1,29 @@
+//
+// contacteditwidget.h: Editable vendor contact
+//
+// by James Hammons
+// (C) 2012 Underground Software
+//
+
+#ifndef __CONTACTEDITWIDGET_H__
+#define __CONTACTEDITWIDGET_H__
+
+#include <QtGui>
+
+class ContactEditWidget: public QWidget
+{
+       public:
+               ContactEditWidget(QWidget * parent = 0);
+
+       public:
+               QComboBox * field1;
+               QLineEdit * field2;
+               QLineEdit * field3;
+               QLineEdit * field4;
+               QLineEdit * field5;
+               QLineEdit * field6;
+               QLineEdit * field7;
+};
+
+#endif // __CONTACTEDITWIDGET_H__
+
diff --git a/src/contactwidget.cpp b/src/contactwidget.cpp
new file mode 100644 (file)
index 0000000..b9c43e4
--- /dev/null
@@ -0,0 +1,51 @@
+//
+// contactwidget.cpp - Vendor contact display
+//
+// by James Hammons
+// (C) 2012 Underground Software
+//
+// JLH = James Hammons <jlhamm@acm.org>
+//
+// Who  When        What
+// ---  ----------  -------------------------------------------------------------
+// JLH  09/24/2012  Created this file
+//
+
+#include "contactwidget.h"
+
+
+ContactWidget::ContactWidget(QWidget * parent/*= 0*/): QWidget(parent),
+       field1(new QLabel),
+       field2(new QLabel),
+       field3(new QLabel),
+       field4(new QLabel),
+       field5(new QLabel),
+       field6(new QLabel),
+       field7(new QLabel)
+{
+       QFormLayout * form = new QFormLayout;
+
+       form->addRow(tr("Type:"), field1);
+       form->addRow(tr("Name:"), field2);
+       form->addRow(tr("Email:"), field3);
+       form->addRow(tr("Address:"), field4);
+       form->addRow(tr("Phone 1:"), field5);
+       form->addRow(tr("Phone 2:"), field6);
+       form->addRow(tr("Fax:"), field7);
+
+       setLayout(form);
+}
+
+
+void ContactWidget::SetFields(QString s1, QString s2, QString s3, QString s4,
+       QString s5, QString s6, QString s7)
+{
+       field1->setText(s1);
+       field2->setText(s2);
+       field3->setText(s3);
+       field4->setText(s4);
+       field5->setText(s5);
+       field6->setText(s6);
+       field7->setText(s7);
+}
+
diff --git a/src/contactwidget.h b/src/contactwidget.h
new file mode 100644 (file)
index 0000000..2336452
--- /dev/null
@@ -0,0 +1,31 @@
+//
+// contactwidget.h: Vendor contact display
+//
+// by James Hammons
+// (C) 2012 Underground Software
+//
+
+#ifndef __CONTACTWIDGET_H__
+#define __CONTACTWIDGET_H__
+
+#include <QtGui>
+
+class ContactWidget: public QWidget
+{
+       public:
+               ContactWidget(QWidget * parent = 0);
+
+               void SetFields(QString, QString, QString, QString, QString, QString, QString);
+
+       public:
+               QLabel * field1;
+               QLabel * field2;
+               QLabel * field3;
+               QLabel * field4;
+               QLabel * field5;
+               QLabel * field6;
+               QLabel * field7;
+};
+
+#endif // __CONTACTWIDGET_H__
+
index 44161ba81c6f6deec3bfffd6e7a82c9c21f2f870..fe7931f6e6b7964cda186a3e8d17a187fa23c243 100644 (file)
 #include "configdialog.h"
 #include "logindialog.h"
 #include "newvendordialog.h"
+#include "scmwidget.h"
 #include "sqlsettingsdialog.h"
 #include "vendorclassdialog.h"
 
 
 MainWindow::MainWindow(): aboutWin(new AboutWindow(this)),
+       scmWidget(new SCMWidget(this)),
+       boldFont(new QFont),
        loggedInUID(0)
 {
        setWindowIcon(QIcon(":/res/schematic.png"));
@@ -99,6 +102,7 @@ MainWindow::MainWindow(): aboutWin(new AboutWindow(this)),
        statusBar()->showMessage(tr("Ready"));
 
        ReadSettings();
+       boldFont->setBold(true);
 
        // Finally, set up database connection
 
@@ -122,6 +126,9 @@ MainWindow::MainWindow(): aboutWin(new AboutWindow(this)),
                db.setPassword(dbPassword);
                ok = db.open();
 
+//printf("Error: %s\n", db.lastError().databaseText().toAscii().data());
+//printf("Error: %s\n", db.lastError().driverText().toAscii().data());
+
                // If unsuccessful, run the SQL settings/test dialog
                if (!ok)
                {
@@ -141,12 +148,12 @@ MainWindow::MainWindow(): aboutWin(new AboutWindow(this)),
        while (!ok);
 
        // Do Login dialog
-       LoginDialog login;
+       LoginDialog loginDlg;
        bool done = false;
 
        do
        {
-               bool accept = login.exec();
+               bool accept = loginDlg.exec();
 
                // Check to see if user cancelled out
                if (!accept)
@@ -154,20 +161,26 @@ MainWindow::MainWindow(): aboutWin(new AboutWindow(this)),
                else
                {
                        // Search DB for this username/login pair
-                       QSqlQuery query("SELECT UID FROM User WHERE Login=? AND Password=?");
-                       query.addBindValue(login.edit1->text());
-                       query.addBindValue(login.edit2->text());
+                       QSqlQuery query("SELECT UID, name, login FROM User WHERE Login=? AND Password=?");
+                       query.addBindValue(loginDlg.edit1->text());
+                       query.addBindValue(loginDlg.edit2->text());
                        query.exec();
 
                        while (query.next())
                        {
                                // We have a winner!
                                loggedInUID = query.value(0).toInt();
+                               fullName = query.value(1).toString();
+                               login = query.value(2).toString();
                                done = true;
                        }
                }
        }
        while (!done);
+
+       QString s = QString("User: %1 (%2)").arg(fullName).arg(login);
+       scmWidget->username->setText(s);
+       setCentralWidget(scmWidget);
 }
 
 
@@ -208,9 +221,97 @@ void MainWindow::HandleVendorClassDialog(void)
 void MainWindow::HandleNewVendorDialog(void)
 {
        NewVendorDialog dialog(this);
+       FillVendorLevelCombo(dialog.combo1);
+       FillContactTypeCombo(dialog.contact->field1);
+       FillVendorClassList(dialog.list);
 
        if (!dialog.exec())
                return;
+
+       // Presumably, the user has given us good data, so we try to populate the
+       // database with this new vendor data.
+       QSqlQuery query1("INSERT INTO  VALUES (?, ?, ?)");
+
+       
+}
+
+
+void MainWindow::FillVendorLevelCombo(QComboBox * combo)
+{
+       QSqlQuery query("SELECT VLID, Description FROM VendorLevel");
+       query.exec();
+
+       while (query.next())
+       {
+               int vlid = query.value(0).toInt();
+               QString description = query.value(1).toString();
+
+               combo->addItem(description, vlid);
+       }
+}
+
+
+void MainWindow::FillContactTypeCombo(QComboBox * combo)
+{
+       QSqlQuery query("SELECT CTID, Description FROM ContactType");
+       query.exec();
+
+       while (query.next())
+       {
+               int ctid = query.value(0).toInt();
+               QString description = query.value(1).toString();
+
+               combo->addItem(description, ctid);
+       }
+}
+
+
+void MainWindow::FillVendorClassList(QListWidget * list)
+{
+       std::vector<VendorType> groupList;
+
+       // Pull in definitions from DB for Vendor Classes/Groups
+       QSqlQuery query1("SELECT vgid, description FROM VendorGroup ORDER BY seqNo");
+       query1.exec();
+
+       while (query1.next())
+       {
+               VendorType v;
+               v.key         = query1.value(0).toInt();
+               v.description = query1.value(1).toString();
+               groupList.push_back(v);
+       }
+
+       QSqlQuery query2("SELECT vtid, vgid, description FROM VendorType ORDER BY seqNo");
+       query2.exec();
+
+       int previousID = -1, groupListIndex = 0;
+       QListWidgetItem * item;
+
+       while (query2.next())
+       {
+//             VendorType v;
+               int vtid            = query2.value(0).toInt();
+               int vgid            = query2.value(1).toInt();
+               QString description = query2.value(2).toString();
+
+               // Check to see if we need to insert new header yet.
+               // If we're not still in same group, push the next group header into the list
+               // and continue
+               if (previousID != vgid)
+               {
+                       item  = new QListWidgetItem(groupList[groupListIndex].description);
+                       item->setData(Qt::UserRole, groupList[groupListIndex++].key);
+                       item->setFont(*boldFont);
+                       list->addItem(item);
+                       previousID = vgid;
+               }
+
+               item  = new QListWidgetItem(description);
+               item->setData(Qt::UserRole, vtid);
+               item->setCheckState(Qt::Unchecked);
+               list->addItem(item);
+       }
 }
 
 
index 5be8fd6f02273dae3dac3a34bcece3a7b3bf3cb5..c277591cf75c5c91a670074ce2360b35dbdef06c 100644 (file)
@@ -12,6 +12,7 @@
 #include <QtSql>
 
 class AboutWindow;
+class SCMWidget;
 
 class MainWindow: public QMainWindow
 {
@@ -32,10 +33,14 @@ class MainWindow: public QMainWindow
                void HandleNewVendorDialog(void);
 
        private:
+               void FillVendorLevelCombo(QComboBox *);
+               void FillContactTypeCombo(QComboBox *);
+               void FillVendorClassList(QListWidget *);
                void ReadSettings(void);
                void WriteSettings(void);
 
                AboutWindow * aboutWin;
+               SCMWidget * scmWidget;
 
                QAction * quitAppAct;
                QAction * aboutAct;
@@ -49,9 +54,12 @@ class MainWindow: public QMainWindow
                QString dbPassword;
 
                QSqlDatabase db;
+               QFont * boldFont;
 
        public:
                int loggedInUID;
+               QString login;
+               QString fullName;
 };
 
 #endif // __MAINWINDOW_H__
index 8737af3f3ac1914c9fc0d0f668a2b83393218144..5db3d7dce5c18fcbff79b5c7d8c2a8e3fd84a18b 100644 (file)
@@ -10,6 +10,9 @@
 // ---  ----------  ------------------------------------------------------------
 // JLH  09/21/2012  Created this file
 
+// NOTE: This can also be used as a vendor editing dialog. It's up to the caller
+//       to change the window title and populate fields in that case. :-)
+
 #include "newvendordialog.h"
 
 
@@ -18,19 +21,9 @@ NewVendorDialog::NewVendorDialog(QWidget * parent/*= 0*/): QDialog(parent),
        edit1(new QLineEdit),
        combo1(new QComboBox),
        checkbox1(new QCheckBox(tr("NDA Signed"))),
-       edit2(new QLineEdit),
-       edit3(new QLineEdit),
-       edit4(new QLineEdit),
-       edit5(new QLineEdit),
-       edit6(new QLineEdit),
-       combo2(new QComboBox),
-       edit7(new QLineEdit),
-       edit8(new QLineEdit),
-       edit9(new QLineEdit),
-       edit10(new QLineEdit),
-       edit11(new QLineEdit),
-       edit12(new QLineEdit),
-       list(new QListWidget)
+       list(new QListWidget),
+       address(new AddressEditWidget(this)),
+       contact(new ContactEditWidget(this))
 {
        connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
        connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
@@ -46,25 +39,13 @@ NewVendorDialog::NewVendorDialog(QWidget * parent/*= 0*/): QDialog(parent),
        QGroupBox * gb4 = new QGroupBox(tr("Vendor Classes"));
 
        QFormLayout * form1 = new QFormLayout;
-       QFormLayout * form2 = new QFormLayout;
-       QFormLayout * form3 = new QFormLayout;
+       QVBoxLayout * form2 = new QVBoxLayout;
+       QVBoxLayout * form3 = new QVBoxLayout;
 
        form1->addRow(tr("Name:"), edit1);
        form1->addRow(tr("Level:"), combo1);
-
-       form2->addRow(tr("Address:"), edit2);
-       form2->addRow(tr("City:"), edit3);
-       form2->addRow(tr("State:"), edit4);
-       form2->addRow(tr("Country:"), edit5);
-       form2->addRow(tr("Postal Code:"), edit6);
-
-       form3->addRow(tr("Type:"), combo2);
-       form3->addRow(tr("Name:"), edit7);
-       form3->addRow(tr("Email:"), edit8);
-       form3->addRow(tr("Address:"), edit9);
-       form3->addRow(tr("Phone 1:"), edit10);
-       form3->addRow(tr("Phone 2:"), edit11);
-       form3->addRow(tr("Fax:"), edit12);
+       form2->addWidget(address);
+       form3->addWidget(contact);
 
        vbox1->addLayout(form1);
        vbox1->addWidget(checkbox1);
index e224bb170982eb2b8449767ed3fa717c9832eb1a..e9fc177a1922c8bf14142bbbc26d8847a2b8326e 100644 (file)
@@ -2,6 +2,8 @@
 #define __NEWVENDORDIALOG_H__
 
 #include <QtGui>
+#include "addresseditwidget.h"
+#include "contacteditwidget.h"
 
 class NewVendorDialog: public QDialog
 {
@@ -19,21 +21,9 @@ class NewVendorDialog: public QDialog
                QComboBox * combo1;
                QCheckBox * checkbox1;
 
-               QLineEdit * edit2;
-               QLineEdit * edit3;
-               QLineEdit * edit4;
-               QLineEdit * edit5;
-               QLineEdit * edit6;
-
-               QComboBox * combo2;
-               QLineEdit * edit7;
-               QLineEdit * edit8;
-               QLineEdit * edit9;
-               QLineEdit * edit10;
-               QLineEdit * edit11;
-               QLineEdit * edit12;
-
                QListWidget * list;
+               AddressEditWidget * address;
+               ContactEditWidget * contact;
 };
 
 #endif // __NEWVENDORDIALOG_H__
diff --git a/src/scmwidget.cpp b/src/scmwidget.cpp
new file mode 100644 (file)
index 0000000..78f757f
--- /dev/null
@@ -0,0 +1,204 @@
+//
+// scmwidget.cpp - Main widget container
+//
+// by James Hammons
+// (C) 2012 Underground Software
+//
+// JLH = James Hammons <jlhamm@acm.org>
+//
+// Who  When        What
+// ---  ----------  -------------------------------------------------------------
+// JLH  09/24/2012  Created this file
+//
+
+#include "scmwidget.h"
+#include "addresswidget.h"
+#include "contactwidget.h"
+
+
+SCMWidget::SCMWidget(QWidget * parent/*= 0*/): QWidget(parent),
+       purchaseOrders(new QTreeView),
+       vendorName(new QLabel),
+       ndaSigned(new QLabel),
+       vendorAddress(new QTabWidget),
+       vendorContact(new QTabWidget),
+       vendorClass(new QListWidget),
+       username(new QLabel),
+       vendorLevel(new VendorLevelWidget),
+       alerts(new QListWidget),
+       notes(new QListWidget),
+       nextVendorButton(new QToolButton),
+       previousVendorButton(new QToolButton),
+       editVendor(new QPushButton("Edit Vendor")),
+       addVendor(new QPushButton("Add Vendor")),
+       addLocation(new QPushButton("Add Location")),
+       addContact(new QPushButton("Add Contact")),
+       createAlert(new QPushButton("Create")),
+       createNote(new QPushButton("Create")),
+       showOpen(new QPushButton("Open")),
+       showClosed(new QPushButton("Closed")),
+       showAll(new QPushButton("All")),
+       createPO(new QPushButton("Create"))
+{
+       // Create main page widgets & layout
+
+       purchaseOrders->setRootIsDecorated(false);
+       purchaseOrders->setAlternatingRowColors(true);
+
+       QAbstractItemModel * model = new QStandardItemModel(0, 7);
+       model->setHeaderData(0, Qt::Horizontal, tr("PO #"));
+       model->setHeaderData(1, Qt::Horizontal, tr("Vendor"));
+       model->setHeaderData(2, Qt::Horizontal, tr("Desc."));
+       model->setHeaderData(3, Qt::Horizontal, tr("OAD"));
+       model->setHeaderData(4, Qt::Horizontal, tr("UAD"));
+       model->setHeaderData(5, Qt::Horizontal, tr("Docs"));
+       model->setHeaderData(6, Qt::Horizontal, tr("FAI"));
+
+       model->insertRow(0);
+       model->setData(model->index(0, 0), "FE823724");
+       model->setData(model->index(0, 1), "Sanford & Sons");
+       model->setData(model->index(0, 2), "Misc. Junk");
+       model->setData(model->index(0, 3), "09/30/2012");
+       model->setData(model->index(0, 4), "");
+       model->setData(model->index(0, 5), "");
+       model->setData(model->index(0, 6), "");
+
+       model->insertRow(0);
+       model->setData(model->index(0, 0), "89237923-123");
+       model->setData(model->index(0, 1), "Digikey");
+       model->setData(model->index(0, 2), "Small capacitors");
+       model->setData(model->index(0, 3), "10/08/2012");
+       model->setData(model->index(0, 4), "11/30/2012");
+       model->setData(model->index(0, 5), "1");
+       model->setData(model->index(0, 6), "Yes");
+
+       model->insertRow(0);
+       model->setData(model->index(0, 0), "T9234CS32");
+       model->setData(model->index(0, 1), "Big, Faceless Company");
+       model->setData(model->index(0, 2), "Important Stuff you need RIGHT NOW");
+       model->setData(model->index(0, 3), "09/28/2012");
+       model->setData(model->index(0, 4), "09/29/2012");
+       model->setData(model->index(0, 5), "5");
+       model->setData(model->index(0, 6), "Yes");
+
+       purchaseOrders->setModel(model);
+
+       nextVendorButton->setArrowType(Qt::RightArrow);
+       nextVendorButton->setToolTip(tr("Move to next Vendor in Database."));
+       previousVendorButton->setArrowType(Qt::LeftArrow);
+       previousVendorButton->setToolTip(tr("Move to previous Vendor in Database."));
+
+       QFont * vendorFont = new QFont;
+       vendorFont->setPointSize(12);
+       vendorName->setFont(*vendorFont);
+       vendorName->setText("Vendor Name");
+
+       QHBoxLayout * hbox1 = new QHBoxLayout;
+       hbox1->addWidget(previousVendorButton);
+       hbox1->addWidget(nextVendorButton);
+       hbox1->addWidget(vendorName);
+
+       // Vendor address widgets
+
+       AddressWidget * vaw1 = new AddressWidget(this);
+       vaw1->SetFields("123 Any Street", "Any City", "Anywhere", "USA", "01234");
+       vendorAddress->addTab(vaw1, tr("Primary"));
+       vendorAddress->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
+
+       // Vendor contact widgets
+
+       ContactWidget * vcw1 = new ContactWidget(this);
+       vcw1->SetFields("Sales", "Joe Blow", "joe.blow@widget.com", "Singapore", "512-222-2222", "", "512-122-2123");
+       vendorContact->addTab(vcw1, tr("Contact #1"));
+       vendorContact->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
+
+       // Vendor class list
+
+       QVBoxLayout * vbox1 = new QVBoxLayout;
+       vbox1->addWidget(vendorClass);
+       QGroupBox * gb1 = new QGroupBox(tr("Vendor Classes"));
+       gb1->setLayout(vbox1);
+
+       // Vendor action push buttons
+
+       QVBoxLayout * vbox4 = new QVBoxLayout;
+       QHBoxLayout * hbox3 = new QHBoxLayout;
+       QGroupBox * gb2 = new QGroupBox(tr("Vendor Actions"));
+
+       vbox4->addWidget(editVendor);
+       vbox4->addWidget(addVendor);
+       vbox4->addWidget(addLocation);
+       vbox4->addWidget(addContact);
+       gb2->setLayout(vbox4);
+
+       hbox3->addWidget(vendorLevel);
+       hbox3->addWidget(gb2);
+
+       // Alerts & notes
+
+       QVBoxLayout * vbox5 = new QVBoxLayout;
+       QHBoxLayout * hbox4 = new QHBoxLayout;
+       QHBoxLayout * hbox5 = new QHBoxLayout;
+
+       QLabel * label1 = new QLabel(tr("Alerts"));
+       QLabel * label2 = new QLabel(tr("Notes"));
+       hbox4->addWidget(label1);
+       hbox4->addStretch();
+       hbox4->addWidget(createAlert);
+       hbox5->addWidget(label2);
+       hbox5->addStretch();
+       hbox5->addWidget(createNote);
+
+       vbox5->addLayout(hbox4);
+       vbox5->addWidget(alerts);
+       vbox5->addLayout(hbox5);
+       vbox5->addWidget(notes);
+
+       // Purchase Order headers
+
+       QHBoxLayout * hbox6 = new QHBoxLayout;
+       QLabel * label3 = new QLabel(tr("Purchase Orders"));
+       hbox6->addWidget(label3);
+       hbox6->addSpacing(32);
+       hbox6->addWidget(showOpen);
+       hbox6->addWidget(showClosed);
+       hbox6->addWidget(showAll);
+       hbox6->addStretch();
+       hbox6->addWidget(createPO);
+
+       // Horizontal line
+
+       QFrame * hline = new QFrame(this);
+       hline->setFrameShape(QFrame::HLine);
+       hline->setFrameShadow(QFrame::Sunken);
+
+       QFrame * hline2 = new QFrame(this);
+       hline2->setFrameShape(QFrame::HLine);
+       hline2->setFrameShadow(QFrame::Sunken);
+
+       QHBoxLayout * hbox2 = new QHBoxLayout;
+       QVBoxLayout * vbox2 = new QVBoxLayout;
+       QVBoxLayout * vbox3 = new QVBoxLayout;
+
+       vbox3->addWidget(vendorContact);
+//     vbox3->addWidget(vendorLevel);
+       vbox3->addLayout(hbox3);
+
+       vbox2->addWidget(vendorAddress);
+       vbox2->addWidget(gb1);
+
+       hbox2->addLayout(vbox2);
+       hbox2->addLayout(vbox3);
+       hbox2->addLayout(vbox5);
+
+       QVBoxLayout * mainLayout = new QVBoxLayout;
+       mainLayout->addWidget(username);
+       mainLayout->addWidget(hline);
+       mainLayout->addLayout(hbox1);
+       mainLayout->addLayout(hbox2);
+       mainLayout->addWidget(hline2);
+       mainLayout->addLayout(hbox6);
+       mainLayout->addWidget(purchaseOrders);
+       setLayout(mainLayout);
+}
+
diff --git a/src/scmwidget.h b/src/scmwidget.h
new file mode 100644 (file)
index 0000000..6081f71
--- /dev/null
@@ -0,0 +1,49 @@
+//
+// scmwidget.h: Main widget page container
+//
+// by James Hammons
+// (C) 2012 Underground Software
+//
+
+#ifndef __SCMWIDGET_H__
+#define __SCMWIDGET_H__
+
+#include <QtGui>
+#include "vendorlevelwidget.h"
+
+class SCMWidget: public QWidget
+{
+       public:
+               SCMWidget(QWidget * parent = 0);
+
+//     protected:
+//             void keyPressEvent(QKeyEvent *);
+
+       public:
+               QTreeView * purchaseOrders;
+               QLabel * vendorName;
+               QLabel * ndaSigned;
+               QTabWidget * vendorAddress;
+               QTabWidget * vendorContact;
+               QListWidget * vendorClass;
+               QLabel * username;
+               VendorLevelWidget * vendorLevel;
+               QListWidget * alerts;
+               QListWidget * notes;
+
+       private:
+               QToolButton * nextVendorButton;
+               QToolButton * previousVendorButton;
+               QPushButton * editVendor;
+               QPushButton * addVendor;
+               QPushButton * addLocation;
+               QPushButton * addContact;
+               QPushButton * createAlert;
+               QPushButton * createNote;
+               QPushButton * showOpen;
+               QPushButton * showClosed;
+               QPushButton * showAll;
+               QPushButton * createPO;
+};
+
+#endif // __SCMWIDGET_H__
index aef142bd13bd8a4fa43eae837f97dc0555ee3903..d39a5a0f19b3fb1122485079937987aeac6cc7b5 100644 (file)
@@ -24,7 +24,6 @@ VendorClassDialog::VendorClassDialog(QWidget * parent/*= 0*/): QDialog(parent),
        normalFont(new QFont),
        boldFont(new QFont),
        list(new QListWidget)
-//     dbRef(db)
 {
        addItem->setToolButtonStyle(Qt::ToolButtonTextOnly);
        addItem->setText("+");
diff --git a/src/vendorlevelwidget.cpp b/src/vendorlevelwidget.cpp
new file mode 100644 (file)
index 0000000..fde3ab1
--- /dev/null
@@ -0,0 +1,79 @@
+//
+// vendorlevelwidget.cpp - Vendor level display
+//
+// by James Hammons
+// (C) 2012 Underground Software
+//
+// JLH = James Hammons <jlhamm@acm.org>
+//
+// Who  When        What
+// ---  ----------  -------------------------------------------------------------
+// JLH  09/24/2012  Created this file
+//
+
+#include "vendorlevelwidget.h"
+#include <QtSql>
+
+
+VendorLevelWidget::VendorLevelWidget(QWidget * parent/*= 0*/): QWidget(parent),
+       topLine(new QLabel),
+       level(new QLabel),
+       color(0xFFFF00),
+       description("?;Unknown"),
+       usable(false)
+{
+       QVBoxLayout * layout = new QVBoxLayout;
+
+       QFont * font = new QFont;
+       font->setPointSize(48);
+       level->setFont(*font);
+//     level->setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
+       level->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
+       level->setAlignment(Qt::AlignCenter);
+//     level->setStyleSheet("QLabel { background-color: yellow; color: blue; }");
+       level->setStyleSheet("QLabel { background-color: yellow; }");
+
+       topLine->setAlignment(Qt::AlignCenter);
+       topLine->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
+       topLine->setMargin(0);
+
+       layout->addStretch();
+       layout->addWidget(topLine);
+       layout->addWidget(level);
+
+       setLayout(layout);
+
+       ParseDescription();
+}
+
+
+void VendorLevelWidget::DoQuery(int key)
+{
+       QSqlQuery query("SELECT vendorUsable, color, description FROM VendorLevel WHERE VLID=?");
+       query.addBindValue(key);
+       query.exec();
+
+       if (query.next())
+       {
+               // We have a winner!
+               usable = query.value(0).toBool();
+               color = query.value(1).toInt();
+               description = query.value(2).toString();
+       }
+       else
+       {
+               usable = false;
+               color = 0xFFFF00;
+               description = "?;Unknown";
+       }
+
+       ParseDescription();
+}
+
+
+void VendorLevelWidget::ParseDescription(void)
+{
+       level->setText(description.left(1));
+       topLine->setText(description.mid(2));
+}
+
diff --git a/src/vendorlevelwidget.h b/src/vendorlevelwidget.h
new file mode 100644 (file)
index 0000000..124eed9
--- /dev/null
@@ -0,0 +1,34 @@
+//
+// addresswidget.h: Vendor address display
+//
+// by James Hammons
+// (C) 2012 Underground Software
+//
+
+#ifndef __VENDORLEVELWIDGET_H__
+#define __VENDORLEVELWIDGET_H__
+
+#include <QtGui>
+
+class VendorLevelWidget: public QWidget
+{
+       public:
+               VendorLevelWidget(QWidget * parent = 0);
+
+               void DoQuery(int key);
+
+       private:
+               void ParseDescription(void);
+
+       private:
+               QLabel * topLine;
+               QLabel * level;
+               int color;
+               QString description;
+
+       public:
+               bool usable;
+};
+
+#endif // __VENDORLEVELWIDGET_H__
+