aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/ui_dbconnector.h163
-rw-r--r--client/ui_mainwindow.h110
-rw-r--r--scripts/db-init.sql20
-rw-r--r--scripts/db-privileges.sql1
4 files changed, 285 insertions, 9 deletions
diff --git a/client/ui_dbconnector.h b/client/ui_dbconnector.h
new file mode 100644
index 0000000..dec4d7b
--- /dev/null
+++ b/client/ui_dbconnector.h
@@ -0,0 +1,163 @@
+/********************************************************************************
+** Form generated from reading UI file 'dbconnector.ui'
+**
+** Created by: Qt User Interface Compiler version 5.15.6
+**
+** WARNING! All changes made in this file will be lost when recompiling UI file!
+********************************************************************************/
+
+#ifndef UI_DBCONNECTOR_H
+#define UI_DBCONNECTOR_H
+
+#include <QtCore/QVariant>
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QDialog>
+#include <QtWidgets/QFormLayout>
+#include <QtWidgets/QFrame>
+#include <QtWidgets/QHBoxLayout>
+#include <QtWidgets/QLabel>
+#include <QtWidgets/QLineEdit>
+#include <QtWidgets/QPushButton>
+#include <QtWidgets/QWidget>
+
+QT_BEGIN_NAMESPACE
+
+class Ui_dbConnector
+{
+public:
+ QWidget *formLayoutWidget;
+ QFormLayout *formLayout;
+ QLabel *label_3;
+ QLineEdit *lineEdit_adress;
+ QLabel *label_4;
+ QLineEdit *lineEdit_database;
+ QFrame *line;
+ QLabel *label;
+ QLineEdit *lineEdit_username;
+ QLabel *label_2;
+ QLineEdit *lineEdit_password;
+ QLabel *connectLabel;
+ QHBoxLayout *horizontalLayout;
+ QPushButton *pushButton_login;
+ QPushButton *pushButton_cancel;
+
+ void setupUi(QDialog *dbConnector)
+ {
+ if (dbConnector->objectName().isEmpty())
+ dbConnector->setObjectName(QString::fromUtf8("dbConnector"));
+ dbConnector->resize(362, 273);
+ formLayoutWidget = new QWidget(dbConnector);
+ formLayoutWidget->setObjectName(QString::fromUtf8("formLayoutWidget"));
+ formLayoutWidget->setGeometry(QRect(60, 60, 241, 173));
+ formLayout = new QFormLayout(formLayoutWidget);
+ formLayout->setObjectName(QString::fromUtf8("formLayout"));
+ formLayout->setContentsMargins(0, 0, 0, 0);
+ label_3 = new QLabel(formLayoutWidget);
+ label_3->setObjectName(QString::fromUtf8("label_3"));
+
+ formLayout->setWidget(0, QFormLayout::LabelRole, label_3);
+
+ lineEdit_adress = new QLineEdit(formLayoutWidget);
+ lineEdit_adress->setObjectName(QString::fromUtf8("lineEdit_adress"));
+
+ formLayout->setWidget(0, QFormLayout::FieldRole, lineEdit_adress);
+
+ label_4 = new QLabel(formLayoutWidget);
+ label_4->setObjectName(QString::fromUtf8("label_4"));
+
+ formLayout->setWidget(1, QFormLayout::LabelRole, label_4);
+
+ lineEdit_database = new QLineEdit(formLayoutWidget);
+ lineEdit_database->setObjectName(QString::fromUtf8("lineEdit_database"));
+
+ formLayout->setWidget(1, QFormLayout::FieldRole, lineEdit_database);
+
+ line = new QFrame(formLayoutWidget);
+ line->setObjectName(QString::fromUtf8("line"));
+ line->setFrameShape(QFrame::HLine);
+ line->setFrameShadow(QFrame::Sunken);
+
+ formLayout->setWidget(2, QFormLayout::SpanningRole, line);
+
+ label = new QLabel(formLayoutWidget);
+ label->setObjectName(QString::fromUtf8("label"));
+
+ formLayout->setWidget(3, QFormLayout::LabelRole, label);
+
+ lineEdit_username = new QLineEdit(formLayoutWidget);
+ lineEdit_username->setObjectName(QString::fromUtf8("lineEdit_username"));
+ lineEdit_username->setEchoMode(QLineEdit::PasswordEchoOnEdit);
+
+ formLayout->setWidget(3, QFormLayout::FieldRole, lineEdit_username);
+
+ label_2 = new QLabel(formLayoutWidget);
+ label_2->setObjectName(QString::fromUtf8("label_2"));
+
+ formLayout->setWidget(4, QFormLayout::LabelRole, label_2);
+
+ lineEdit_password = new QLineEdit(formLayoutWidget);
+ lineEdit_password->setObjectName(QString::fromUtf8("lineEdit_password"));
+ QFont font;
+ font.setUnderline(false);
+ font.setStrikeOut(false);
+ font.setKerning(true);
+ lineEdit_password->setFont(font);
+ lineEdit_password->setEchoMode(QLineEdit::Password);
+
+ formLayout->setWidget(4, QFormLayout::FieldRole, lineEdit_password);
+
+ connectLabel = new QLabel(formLayoutWidget);
+ connectLabel->setObjectName(QString::fromUtf8("connectLabel"));
+
+ formLayout->setWidget(5, QFormLayout::LabelRole, connectLabel);
+
+ horizontalLayout = new QHBoxLayout();
+ horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
+ pushButton_login = new QPushButton(formLayoutWidget);
+ pushButton_login->setObjectName(QString::fromUtf8("pushButton_login"));
+
+ horizontalLayout->addWidget(pushButton_login);
+
+ pushButton_cancel = new QPushButton(formLayoutWidget);
+ pushButton_cancel->setObjectName(QString::fromUtf8("pushButton_cancel"));
+
+ horizontalLayout->addWidget(pushButton_cancel);
+
+
+ formLayout->setLayout(5, QFormLayout::FieldRole, horizontalLayout);
+
+
+ retranslateUi(dbConnector);
+
+ QMetaObject::connectSlotsByName(dbConnector);
+ } // setupUi
+
+ void retranslateUi(QDialog *dbConnector)
+ {
+ dbConnector->setWindowTitle(QCoreApplication::translate("dbConnector", "Dialog", nullptr));
+ label_3->setText(QCoreApplication::translate("dbConnector", "Adress", nullptr));
+ lineEdit_adress->setText(QCoreApplication::translate("dbConnector", "localhost", nullptr));
+ lineEdit_adress->setPlaceholderText(QCoreApplication::translate("dbConnector", "Hostname/IP-Adress", nullptr));
+ label_4->setText(QCoreApplication::translate("dbConnector", "Database", nullptr));
+ lineEdit_database->setText(QCoreApplication::translate("dbConnector", "WSdb", nullptr));
+ lineEdit_database->setPlaceholderText(QCoreApplication::translate("dbConnector", "Database name", nullptr));
+ label->setText(QCoreApplication::translate("dbConnector", "Username", nullptr));
+ lineEdit_username->setText(QCoreApplication::translate("dbConnector", "root", nullptr));
+ lineEdit_username->setPlaceholderText(QCoreApplication::translate("dbConnector", "Username", nullptr));
+ label_2->setText(QCoreApplication::translate("dbConnector", "Password", nullptr));
+ lineEdit_password->setText(QCoreApplication::translate("dbConnector", "Ab12345!", nullptr));
+ lineEdit_password->setPlaceholderText(QCoreApplication::translate("dbConnector", "Password", nullptr));
+ connectLabel->setText(QCoreApplication::translate("dbConnector", "Connect", nullptr));
+ pushButton_login->setText(QCoreApplication::translate("dbConnector", "Login", nullptr));
+ pushButton_cancel->setText(QCoreApplication::translate("dbConnector", "Cancel", nullptr));
+ } // retranslateUi
+
+};
+
+namespace Ui {
+ class dbConnector: public Ui_dbConnector {};
+} // namespace Ui
+
+QT_END_NAMESPACE
+
+#endif // UI_DBCONNECTOR_H
diff --git a/client/ui_mainwindow.h b/client/ui_mainwindow.h
new file mode 100644
index 0000000..46bb29a
--- /dev/null
+++ b/client/ui_mainwindow.h
@@ -0,0 +1,110 @@
+/********************************************************************************
+** Form generated from reading UI file 'mainwindow.ui'
+**
+** Created by: Qt User Interface Compiler version 5.15.6
+**
+** WARNING! All changes made in this file will be lost when recompiling UI file!
+********************************************************************************/
+
+#ifndef UI_MAINWINDOW_H
+#define UI_MAINWINDOW_H
+
+#include <QtCore/QVariant>
+#include <QtWidgets/QAction>
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QLabel>
+#include <QtWidgets/QMainWindow>
+#include <QtWidgets/QMenu>
+#include <QtWidgets/QMenuBar>
+#include <QtWidgets/QStatusBar>
+#include <QtWidgets/QWidget>
+
+QT_BEGIN_NAMESPACE
+
+class Ui_MainWindow
+{
+public:
+ QAction *actionRefresh;
+ QAction *actionLOAD;
+ QAction *actionQuerry;
+ QAction *actionConnection;
+ QAction *actionDisconnenct;
+ QWidget *centralwidget;
+ QLabel *label;
+ QMenuBar *menubar;
+ QMenu *menuAbouy;
+ QMenu *menuDatabase;
+ QStatusBar *statusbar;
+
+ void setupUi(QMainWindow *MainWindow)
+ {
+ if (MainWindow->objectName().isEmpty())
+ MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
+ MainWindow->resize(800, 600);
+ actionRefresh = new QAction(MainWindow);
+ actionRefresh->setObjectName(QString::fromUtf8("actionRefresh"));
+ actionLOAD = new QAction(MainWindow);
+ actionLOAD->setObjectName(QString::fromUtf8("actionLOAD"));
+ actionQuerry = new QAction(MainWindow);
+ actionQuerry->setObjectName(QString::fromUtf8("actionQuerry"));
+ actionConnection = new QAction(MainWindow);
+ actionConnection->setObjectName(QString::fromUtf8("actionConnection"));
+ actionDisconnenct = new QAction(MainWindow);
+ actionDisconnenct->setObjectName(QString::fromUtf8("actionDisconnenct"));
+ centralwidget = new QWidget(MainWindow);
+ centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
+ label = new QLabel(centralwidget);
+ label->setObjectName(QString::fromUtf8("label"));
+ label->setGeometry(QRect(270, 190, 181, 51));
+ MainWindow->setCentralWidget(centralwidget);
+ menubar = new QMenuBar(MainWindow);
+ menubar->setObjectName(QString::fromUtf8("menubar"));
+ menubar->setGeometry(QRect(0, 0, 800, 24));
+ menuAbouy = new QMenu(menubar);
+ menuAbouy->setObjectName(QString::fromUtf8("menuAbouy"));
+ menuDatabase = new QMenu(menubar);
+ menuDatabase->setObjectName(QString::fromUtf8("menuDatabase"));
+ MainWindow->setMenuBar(menubar);
+ statusbar = new QStatusBar(MainWindow);
+ statusbar->setObjectName(QString::fromUtf8("statusbar"));
+ MainWindow->setStatusBar(statusbar);
+
+ menubar->addAction(menuAbouy->menuAction());
+ menubar->addAction(menuDatabase->menuAction());
+ menuAbouy->addAction(actionRefresh);
+ menuDatabase->addAction(actionConnection);
+ menuDatabase->addAction(actionDisconnenct);
+
+ retranslateUi(MainWindow);
+
+ QMetaObject::connectSlotsByName(MainWindow);
+ } // setupUi
+
+ void retranslateUi(QMainWindow *MainWindow)
+ {
+ MainWindow->setWindowTitle(QCoreApplication::translate("MainWindow", "MainWindow", nullptr));
+ actionRefresh->setText(QCoreApplication::translate("MainWindow", "Refresh", nullptr));
+#if QT_CONFIG(shortcut)
+ actionRefresh->setShortcut(QCoreApplication::translate("MainWindow", "Ctrl+R", nullptr));
+#endif // QT_CONFIG(shortcut)
+ actionLOAD->setText(QCoreApplication::translate("MainWindow", "Load", nullptr));
+ actionQuerry->setText(QCoreApplication::translate("MainWindow", "Query", nullptr));
+ actionConnection->setText(QCoreApplication::translate("MainWindow", "Connect", nullptr));
+#if QT_CONFIG(shortcut)
+ actionConnection->setShortcut(QCoreApplication::translate("MainWindow", "Ctrl+O", nullptr));
+#endif // QT_CONFIG(shortcut)
+ actionDisconnenct->setText(QCoreApplication::translate("MainWindow", "Disconnenct", nullptr));
+ label->setText(QCoreApplication::translate("MainWindow", "Please load data first", nullptr));
+ menuAbouy->setTitle(QCoreApplication::translate("MainWindow", "Home", nullptr));
+ menuDatabase->setTitle(QCoreApplication::translate("MainWindow", "Database", nullptr));
+ } // retranslateUi
+
+};
+
+namespace Ui {
+ class MainWindow: public Ui_MainWindow {};
+} // namespace Ui
+
+QT_END_NAMESPACE
+
+#endif // UI_MAINWINDOW_H
diff --git a/scripts/db-init.sql b/scripts/db-init.sql
index 4c4c4d4..2b0581c 100644
--- a/scripts/db-init.sql
+++ b/scripts/db-init.sql
@@ -1,9 +1,11 @@
-CREATE SCHEMA `WSdb`;
-CREATE TABLE `DAB1Pract1`.`tblMain` (
- `ID` INT GENERATED ALWAYS AS (),
- `temperature` DECIMAL(5,2) NULL,
- `humidity` DECIMAL(5,2) NULL,
- `pressure` DECIMAL(5,2) NULL,
- `time` DATETIME NULL,
- PRIMARY KEY (`ID`),
- UNIQUE INDEX `ID_UNIQUE` (`ID` ASC) VISIBLE);
+drop schema if exists `WSdb`;
+create schema if not exists `WSdb`;
+drop table if exists `WSdb`.`tblMain`;
+create table if not exists `WSdb`.`tblMain` (
+ id int unsigned not null auto_increment,
+ temperature decimal(5,2) null,
+ humidity decimal(5,2) null,
+ pressure decimal(5,2) null,
+ time datetime null,
+ primary key (id)
+);
diff --git a/scripts/db-privileges.sql b/scripts/db-privileges.sql
new file mode 100644
index 0000000..75f8fcc
--- /dev/null
+++ b/scripts/db-privileges.sql
@@ -0,0 +1 @@
+grant all privileges on WSdb.* to 'user'@'localhost';