summaryrefslogtreecommitdiff
path: root/productinventory.h
diff options
context:
space:
mode:
authorDaniel Jones <admin@danieljon.es>2019-04-07 11:07:57 +0930
committerDaniel Jones <admin@danieljon.es>2019-04-07 11:07:57 +0930
commite38858efb7c8904352f9c4c1dea403b53a7a99f4 (patch)
tree5577b93bf7c530cf40a84036adba90ec2d1db9b7 /productinventory.h
downloadproductinventory-e38858efb7c8904352f9c4c1dea403b53a7a99f4.tar.gz
productinventory-e38858efb7c8904352f9c4c1dea403b53a7a99f4.zip
first code, basic program works
Diffstat (limited to 'productinventory.h')
-rw-r--r--productinventory.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/productinventory.h b/productinventory.h
new file mode 100644
index 0000000..34df6c4
--- /dev/null
+++ b/productinventory.h
@@ -0,0 +1,77 @@
+/*
+ * productinventory.h a part of ProductInventory
+ * An inventory system designed for makeup and related things
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef PRODUCTINVENTORY_H
+#define PRODUCTINVENTORY_H
+
+#include <QMainWindow>
+#include <QStatusBar>
+#include <QSqlDatabase>
+#include <QSqlQuery>
+#include <QSqlError>
+#include <QMessageBox>
+#include <QTableWidgetItem>
+#include <QDebug>
+
+namespace Ui {
+class ProductInventory;
+}
+
+class ProductInventory : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ explicit ProductInventory(QWidget *parent = nullptr);
+ ~ProductInventory();
+ bool getConnectionStatus(); // get database connection status
+
+ void statusMessage(QString msg, int ms); // overload, show message in status bar for ms milliseconds
+ void statusMessage(QString msg, QString color, int ms); // show message in status bar for ms milliseconds
+ void genericMessageBox(QString msg, QString title); // display a generic message box
+ QSqlQuery *genericQuery(QString query); // run generic query and return a pointer to the new object
+
+private slots:
+ void statusChanged(QString msg); // called when the status bar value is changed
+ void on_connectButton_clicked(); // called when the connect button is pressed
+
+ void on_mustHaveImagesCheckBox_clicked(); // called when must have images filter selected
+ void on_mustNotHaveImagesCheckBox_clicked(); // called when must not have images filter selected
+
+private:
+ Ui::ProductInventory *ui;
+ QString conStatus; // connection status text
+ QString conColor; // color of current connection status
+ bool isConnected; // store our conection status
+
+ bool dbConnect(); // connect to database
+ bool dbDisconnect(); // disconnect from database
+ QSqlDatabase db; // database object
+ void resizeEvent(QResizeEvent *event); // called when the window is resized
+ void populateInterface(); // called when we want to populate interface elements
+ void addItemToTable(QTableWidget *table,
+ QList<QString> *values); // add item to the specified table with the provided values
+ void clearTables(); // clear and delete every QTabeWidgetItem in each table
+ QList<QTableWidget *> tables; // store our tables
+ int createTable(QString category); // create a table and add it to our tables list with a header, returns index in list or -1
+ QStringList headerLabels; // labels used for table headers
+ QList<QLabel *> labels; // labels used for table names
+
+};
+
+#endif // PRODUCTINVENTORY_H