summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrangelina <contact@frangelina.fr>2018-05-25 23:20:04 +0200
committerFrangelina <contact@frangelina.fr>2018-05-25 23:20:04 +0200
commitf49a2a61a9c291e41902d15e6bceee02867b7ea4 (patch)
tree8aaed5b10e56961305d9deea32c084fdc9b8628a
parent3b5223afb4c384a11cca4d497d9a4a50312aed54 (diff)
Update Appli Qt du 25 mai
-rw-r--r--.gitignore4
-rw-r--r--[-rwxr-xr-x]Appli.pro105
-rw-r--r--[-rwxr-xr-x]Appli.pro.user24
-rw-r--r--[-rwxr-xr-x]img/FamilleModif.pngbin557896 -> 557896 bytes
-rw-r--r--[-rwxr-xr-x]img/background.JPGbin200936 -> 200936 bytes
-rw-r--r--[-rwxr-xr-x]img/background2.jpgbin328207 -> 328207 bytes
-rw-r--r--[-rwxr-xr-x]img/immeuble.pngbin596737 -> 596737 bytes
-rw-r--r--[-rwxr-xr-x]img/logo WES.gifbin4181 -> 4181 bytes
-rw-r--r--[-rwxr-xr-x]img/logo.pngbin55809 -> 55809 bytes
-rw-r--r--[-rwxr-xr-x]img/tarif.jpegbin8591 -> 8591 bytes
-rw-r--r--[-rwxr-xr-x]main.cpp3
-rw-r--r--[-rwxr-xr-x]mainwindow.cpp17
-rw-r--r--[-rwxr-xr-x]mainwindow.h10
-rw-r--r--[-rwxr-xr-x]mainwindow.ui168
-rw-r--r--[-rwxr-xr-x]resources.qrc28
-rw-r--r--[-rwxr-xr-x]secdialog.cpp136
-rw-r--r--[-rwxr-xr-x]secdialog.h30
-rw-r--r--[-rwxr-xr-x]secdialog.ui395
18 files changed, 787 insertions, 133 deletions
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index d900888..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-.DS_Store
-Appli.pro.user.*
-*.cpp.*
-*.autosave*
diff --git a/Appli.pro b/Appli.pro
index 8dc1a95..65d5a96 100755..100644
--- a/Appli.pro
+++ b/Appli.pro
@@ -1,48 +1,57 @@
-#-------------------------------------------------
-#
-# Project created by QtCreator 2018-03-29T17:19:47
-#
-#-------------------------------------------------
-
-QT += core
-QT += sql
-QT -= gui
-
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
-
-TARGET = Appli
-TEMPLATE = app
-
-# The following define makes your compiler emit warnings if you use
-# any feature of Qt which has been marked as deprecated (the exact warnings
-# depend on your compiler). Please consult the documentation of the
-# deprecated API in order to know how to port your code away from it.
-DEFINES += QT_DEPRECATED_WARNINGS
-
-# You can also make your code fail to compile if you use deprecated APIs.
-# In order to do so, uncomment the following line.
-# You can also select to disable deprecated APIs only up to a certain version of Qt.
-#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
-
-
-SOURCES += \
- main.cpp \
- mainwindow.cpp \
- secdialog.cpp
-
-HEADERS += \
- mainwindow.h \
- secdialog.h
-
-FORMS += \
- mainwindow.ui \
- secdialog.ui
-
-RESOURCES += \
- resources.qrc
-
-DISTFILES += \
- img/logo WES.gif
-
-INCLUDEPATH += $$PWD/.
-DEPENDPATH += $$PWD/.
+#-------------------------------------------------
+#
+# Project created by QtCreator 2018-03-29T17:19:47
+#
+#-------------------------------------------------
+
+QT += core
+QT += sql
+QT -= gui
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+TARGET = Appli
+TEMPLATE = app
+
+# The following define makes your compiler emit warnings if you use
+# any feature of Qt which has been marked as deprecated (the exact warnings
+# depend on your compiler). Please consult the documentation of the
+# deprecated API in order to know how to port your code away from it.
+DEFINES += QT_DEPRECATED_WARNINGS
+
+# You can also make your code fail to compile if you use deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
+
+
+SOURCES += \
+ main.cpp \
+ mainwindow.cpp \
+ secdialog.cpp \
+ deploiement.cpp \
+ seuil.cpp \
+ majprix.cpp \
+ ajoutsite.cpp
+
+HEADERS += \
+ mainwindow.h \
+ secdialog.h \
+ deploiement.h \
+ seuil.h \
+ majprix.h \
+ ajoutsite.h
+
+FORMS += \
+ mainwindow.ui \
+ secdialog.ui \
+ deploiement.ui \
+ seuil.ui \
+ majprix.ui \
+ ajoutsite.ui
+
+RESOURCES += \
+ resources.qrc
+
+INCLUDEPATH += $$PWD/.
+DEPENDPATH += $$PWD/.
diff --git a/Appli.pro.user b/Appli.pro.user
index 72da5d6..bdbb287 100755..100644
--- a/Appli.pro.user
+++ b/Appli.pro.user
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.5.0, 2018-04-17T08:54:56. -->
+<!-- Written by QtCreator 4.2.1, 2018-05-25T17:31:22. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
- <value type="QByteArray">{fbe249e6-0aae-4ce7-a0c6-f2115a2206e3}</value>
+ <value type="QByteArray">{3b68c95e-1fee-4ccb-b5c7-79367176b545}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -54,21 +54,19 @@
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
- <valuemap type="QVariantMap">
- <valuelist type="QVariantList" key="ClangStaticAnalyzer.SuppressedDiagnostics"/>
- </valuemap>
+ <valuemap type="QVariantMap"/>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.10.0 MinGW 32bit</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.10.0 MinGW 32bit</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5100.win32_mingw53_kit</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.8.0 MinGW 32bit</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.8.0 MinGW 32bit</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.58.win32_mingw53_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
- <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/Dropbox/PROJET/Appliv2/build-Appli-Desktop_Qt_5_10_0_MinGW_32bit-Debug</value>
+ <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/Angie/Dropbox/PROJET/build-Appli-Desktop_Qt_5_8_0_MinGW_32bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@@ -122,7 +120,7 @@
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
- <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/Dropbox/PROJET/Appliv2/build-Appli-Desktop_Qt_5_10_0_MinGW_32bit-Release</value>
+ <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/Angie/Dropbox/PROJET/build-Appli-Desktop_Qt_5_8_0_MinGW_32bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@@ -176,7 +174,7 @@
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
- <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/Dropbox/PROJET/Appliv2/build-Appli-Desktop_Qt_5_10_0_MinGW_32bit-Profile</value>
+ <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/Angie/Dropbox/PROJET/build-Appli-Desktop_Qt_5_8_0_MinGW_32bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@@ -288,13 +286,13 @@
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Appli</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/Dropbox/PROJET/Appliv2/Appli/Appli.pro</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/Angie/Dropbox/PROJET/Appli2/Appli.pro</value>
<value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">Appli.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
- <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">D:/Dropbox/PROJET/Appliv2/build-Appli-Desktop_Qt_5_10_0_MinGW_32bit-Debug</value>
+ <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">C:/Users/Angie/Dropbox/PROJET/build-Appli-Desktop_Qt_5_8_0_MinGW_32bit-Debug</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
diff --git a/img/FamilleModif.png b/img/FamilleModif.png
index d08252c..d08252c 100755..100644
--- a/img/FamilleModif.png
+++ b/img/FamilleModif.png
Binary files differ
diff --git a/img/background.JPG b/img/background.JPG
index 52d9f70..52d9f70 100755..100644
--- a/img/background.JPG
+++ b/img/background.JPG
Binary files differ
diff --git a/img/background2.jpg b/img/background2.jpg
index 4ba135b..4ba135b 100755..100644
--- a/img/background2.jpg
+++ b/img/background2.jpg
Binary files differ
diff --git a/img/immeuble.png b/img/immeuble.png
index 6bc7a5c..6bc7a5c 100755..100644
--- a/img/immeuble.png
+++ b/img/immeuble.png
Binary files differ
diff --git a/img/logo WES.gif b/img/logo WES.gif
index 9668c9d..9668c9d 100755..100644
--- a/img/logo WES.gif
+++ b/img/logo WES.gif
Binary files differ
diff --git a/img/logo.png b/img/logo.png
index 9d1cbe8..9d1cbe8 100755..100644
--- a/img/logo.png
+++ b/img/logo.png
Binary files differ
diff --git a/img/tarif.jpeg b/img/tarif.jpeg
index 1e3599e..1e3599e 100755..100644
--- a/img/tarif.jpeg
+++ b/img/tarif.jpeg
Binary files differ
diff --git a/main.cpp b/main.cpp
index 38d9d3d..8d45019 100755..100644
--- a/main.cpp
+++ b/main.cpp
@@ -6,8 +6,9 @@ int main(int argc, char *argv[])
{
QApplication a(argc, argv);
+ //a.setQuitOnLastWindowClosed(false); //Empeche la fermeture du prog apres la fin d'une MsgBox
MainWindow w;
- w.show();
+ w.show();
return a.exec();
}
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 7015c7c..36f86e3 100755..100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -13,10 +13,6 @@ MainWindow::MainWindow(QWidget *parent) :
{
ui->setupUi(this);
connectToDb();
- QPixmap pix(":/resources/img/logo.png");
- int w = ui->label_pic->width();
- int h = ui ->label_pic->height();
- ui->label_pic->setPixmap(pix.scaled(w,h,Qt::KeepAspectRatio));
}
MainWindow::~MainWindow()
@@ -25,6 +21,11 @@ MainWindow::~MainWindow()
delete ui;
}
+QSqlDatabase MainWindow::getDb()
+{
+ return this->db;
+}
+
void MainWindow::closeDb()
{
QString connection;
@@ -36,15 +37,18 @@ void MainWindow::closeDb()
bool MainWindow::connectToDb()
{
+ if (!db.isOpen()){
this->db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("127.0.0.1");
db.setDatabaseName("SuiviConso");
db.setUserName("root");
db.setPassword("");
return db.open();
+ }
+ return false;
}
-void MainWindow::on_pushButton_clicked()
+void MainWindow::on_Button_connect_clicked()
{
QString username = ui->lineEdit_id->text();
QString password = ui->lineEdit_pass->text();
@@ -66,10 +70,11 @@ void MainWindow::on_pushButton_clicked()
{
if (query.value(fieldNo).toBool())
{
- ui->statusBar->showMessage("Connexion en cours...", 9000);
+ ui->statusBar->showMessage("Connexion en cours...", 2000);
SecDialog = new secDialog(this);
SecDialog->show();
hide();
+
}
else
QMessageBox::warning(this,"Login","Nom d'utilisateur ou mot de passe incorrecte");
diff --git a/mainwindow.h b/mainwindow.h
index eb89d07..04f2078 100755..100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -4,6 +4,7 @@
#include <QMainWindow>
#include "secdialog.h"
#include <QtSql>
+#include <QtDebug>
namespace Ui {
class MainWindow;
@@ -16,9 +17,16 @@ class MainWindow : public QMainWindow
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
+ QSqlDatabase getDb();
+ //lineEdit_id();
+ //lineEdit_pass();
private slots:
- void on_pushButton_clicked();
+ void on_Button_connect_clicked();
+
+ // void on_lineEdit_id_windowIconChanged(const QIcon &icon);
+
+ // void on_lineEdit_id_cursorPositionChanged(int arg1, int arg2);
private:
Ui::MainWindow *ui;
diff --git a/mainwindow.ui b/mainwindow.ui
index 219a649..b411653 100755..100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -6,17 +6,35 @@
<rect>
<x>0</x>
<y>0</y>
- <width>837</width>
- <height>749</height>
+ <width>1018</width>
+ <height>669</height>
</rect>
</property>
<property name="windowTitle">
- <string>MainWindow</string>
+ <string>Authentification</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">Frame {
+border:2px solid #008080;
+border-radius:8px;
+ }</string>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout">
- <item>
+ <item alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="QFrame" name="frame">
+ <property name="minimumSize">
+ <size>
+ <width>1000</width>
+ <height>600</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">frame{background-image: url(:/resources/img/background.JPG);}</string>
+ </property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
@@ -26,88 +44,126 @@
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
- <x>180</x>
- <y>170</y>
+ <x>290</x>
+ <y>60</y>
<width>431</width>
<height>501</height>
</rect>
</property>
+ <property name="contextMenuPolicy">
+ <enum>Qt::NoContextMenu</enum>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">QGroupBox {
+border:2px solid #008080;
+border-radius:8px;
+ }</string>
+ </property>
<property name="title">
<string/>
</property>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
- <x>60</x>
- <y>300</y>
- <width>81</width>
- <height>31</height>
+ <x>70</x>
+ <y>310</y>
+ <width>41</width>
+ <height>21</height>
</rect>
</property>
+ <property name="styleSheet">
+ <string notr="true">image: url(:/resources/img/log.jpg);</string>
+ </property>
<property name="text">
- <string>Identifiant</string>
+ <string/>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
- <x>60</x>
+ <x>70</x>
<y>360</y>
- <width>81</width>
- <height>16</height>
+ <width>41</width>
+ <height>21</height>
</rect>
</property>
+ <property name="styleSheet">
+ <string notr="true">image: url(:/resources/img/password.jpg);</string>
+ </property>
<property name="text">
- <string>Mot de passe</string>
+ <string/>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_id">
<property name="geometry">
<rect>
- <x>140</x>
+ <x>70</x>
<y>300</y>
- <width>171</width>
- <height>31</height>
- </rect>
- </property>
- </widget>
- <widget class="QPushButton" name="pushButton">
- <property name="geometry">
- <rect>
- <x>140</x>
- <y>440</y>
- <width>161</width>
+ <width>281</width>
<height>41</height>
</rect>
</property>
+ <property name="styleSheet">
+ <string notr="true">border:2px solid #008080;
+border-radius:8px;</string>
+ </property>
<property name="text">
- <string>Se connecter</string>
+ <string>a</string>
+ </property>
+ <property name="cursorPosition">
+ <number>1</number>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="readOnly">
+ <bool>false</bool>
+ </property>
+ <property name="placeholderText">
+ <string>Identifiant</string>
+ </property>
+ <property name="cursorMoveStyle">
+ <enum>Qt::VisualMoveStyle</enum>
</property>
</widget>
- <widget class="QCheckBox" name="checkBox_2">
+ <widget class="QPushButton" name="Button_connect">
<property name="geometry">
<rect>
- <x>140</x>
+ <x>70</x>
<y>400</y>
- <width>86</width>
- <height>20</height>
+ <width>281</width>
+ <height>41</height>
</rect>
</property>
+ <property name="styleSheet">
+ <string notr="true">border:none;
+ padding:6px 0 6px 0;
+ border-radius:8px;
+ background:#008080;
+ font:bold 13px Arial;
+ color:#F8F8FF;</string>
+ </property>
<property name="text">
- <string>Mémoriser</string>
+ <string>Se connecter</string>
</property>
</widget>
<widget class="QLabel" name="label_pic">
<property name="geometry">
<rect>
- <x>150</x>
- <y>90</y>
- <width>131</width>
+ <x>140</x>
+ <y>100</y>
+ <width>151</width>
<height>151</height>
</rect>
</property>
+ <property name="styleSheet">
+ <string notr="true">image: url(:/resources/img/logo.png);</string>
+ </property>
<property name="text">
- <string/>
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
@@ -125,22 +181,45 @@
</font>
</property>
<property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:18pt; font-weight:600;&quot;&gt;Interface de Configuration&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:14pt; font-weight:600; color:#020202;&quot;&gt;Connexion à l'interface de configuration&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_pass">
<property name="geometry">
<rect>
- <x>140</x>
+ <x>70</x>
<y>350</y>
- <width>171</width>
- <height>31</height>
+ <width>281</width>
+ <height>41</height>
</rect>
</property>
+ <property name="styleSheet">
+ <string notr="true">border:2px solid #008080;
+border-radius:8px;</string>
+ </property>
+ <property name="text">
+ <string>a</string>
+ </property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
+ <property name="cursorPosition">
+ <number>1</number>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="placeholderText">
+ <string>Mot de passe</string>
+ </property>
</widget>
+ <zorder>lineEdit_id</zorder>
+ <zorder>Button_connect</zorder>
+ <zorder>label_pic</zorder>
+ <zorder>label_3</zorder>
+ <zorder>lineEdit_pass</zorder>
+ <zorder>label_4</zorder>
+ <zorder>label_5</zorder>
</widget>
</widget>
</item>
@@ -151,7 +230,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>837</width>
+ <width>1018</width>
<height>21</height>
</rect>
</property>
@@ -167,6 +246,11 @@
<widget class="QStatusBar" name="statusBar"/>
</widget>
<layoutdefault spacing="6" margin="11"/>
+ <tabstops>
+ <tabstop>lineEdit_id</tabstop>
+ <tabstop>lineEdit_pass</tabstop>
+ <tabstop>Button_connect</tabstop>
+ </tabstops>
<resources/>
<connections/>
</ui>
diff --git a/resources.qrc b/resources.qrc
index 11e641b..d3fc1f1 100755..100644
--- a/resources.qrc
+++ b/resources.qrc
@@ -3,10 +3,34 @@
<file>img/background.JPG</file>
<file>img/FamilleModif.png</file>
<file>img/logo WES.gif</file>
- <file>img/logo.png</file>
<file>img/background2.jpg</file>
<file>img/immeuble.png</file>
<file>img/tarif.jpeg</file>
+ <file>img/Background.jpg</file>
+ <file>img/tarif3.png</file>
+ <file>img/logo.png</file>
+ <file>img/password.jpg</file>
+ <file>img/log.jpg</file>
+ <file>img/prog.png</file>
+ <file>img/seuil.jpg</file>
+ <file>img/accueil.png</file>
+ <file>img/construction.jpg</file>
+ <file>img/gestionnaire.jpg</file>
+ <file>img/quitter.PNG</file>
+ <file>img/exit.PNG</file>
+ <file>img/connecte.png</file>
+ <file>img/_moins.png</file>
+ <file>img/alerte.png</file>
+ <file>img/config.png</file>
+ <file>img/connect.png</file>
+ <file>img/euros.png</file>
+ <file>img/log.png</file>
+ <file>img/login.png</file>
+ <file>img/moins.png</file>
+ <file>img/next.png</file>
+ <file>img/plus.png</file>
+ <file>img/previous.png</file>
+ <file>img/quit2.PNG</file>
+ <file>img/refresh.png</file>
</qresource>
- <qresource prefix="/"/>
</RCC>
diff --git a/secdialog.cpp b/secdialog.cpp
index 50d9856..4d31b39 100755..100644
--- a/secdialog.cpp
+++ b/secdialog.cpp
@@ -1,19 +1,151 @@
#include "secdialog.h"
#include "ui_secdialog.h"
+#include "mainwindow.h"
+#include "deploiement.h"
+#include "seuil.h"
+#include "majprix.h"
+
secDialog::secDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::secDialog)
{
ui->setupUi(this);
+ ui->pushButton_add->setToolTip("Ajouter un nouveau site");
+ ui->pushButton_delete->setToolTip("Supprimer un site");
+ query = new QSqlQuery(db);
+ modal = new QSqlQueryModel();
+
+ query->prepare("SELECT sit_Id, sit_adresse AS Adresse, sit_ville AS Ville, sit_telephone AS Telephone FROM site");
+ query->exec();
+ modal->setQuery(*query);
+
+ //ui->tablesites->setSelectionMode(QAbstractItemView::SingleSelection);
+ ui->tablesites->setModel(modal);
+ ui->tablesites->setColumnHidden(0, true);
}
secDialog::~secDialog()
{
delete ui;
+ closeDb();
+}
+
+bool secDialog::refreshTable()
+{
+ if (modal->rowCount() > 0)
+ modal->removeRows(0, modal->rowCount());
+
+ query->prepare("SELECT sit_Id, sit_adresse AS Adresse, sit_ville AS Ville, sit_telephone AS Telephone FROM site");
+ query->exec();
+ modal->setQuery(*query);
+
+ //ui->tablesites->setSelectionMode(QAbstractItemView::SingleSelection);
+ ui->tablesites->setModel(modal);
+ ui->tablesites->setColumnHidden(0,true);
+ return true;
+}
+
+void secDialog::closeDb()
+{
+ QString connection;
+ connection = db.connectionName();
+ db.close();
+ db = QSqlDatabase();
+ db.removeDatabase(connection);
+}
+
+bool secDialog::connectToDb()
+{
+ if (!db.isOpen()){
+ this->db = QSqlDatabase::addDatabase("QMYSQL");
+ db.setHostName("127.0.0.1");
+ db.setDatabaseName("SuiviConso");
+ db.setUserName("root");
+ db.setPassword("");
+ return db.open();
+ }
+ return false;
+}
+
+void secDialog::on_butQuitter_clicked()
+{
+ ((QWidget *)parent())->show();
+ close();
+}
+
+void secDialog::on_tabWidget_tabCloseRequested(int index)
+{
+ ui->tabWidget->removeTab (index);
+}
+
+void secDialog::on_pushButton_deploiement_clicked()
+{
+ int ligne = ui->tablesites->currentIndex().row(); //.value("sit_Id").toInt();
+ //int id=18;
+ int id= modal->record(ligne).value("sit_id").toInt();
+ //modal->data(ui->tablesites->currentIndex());
+ ui->tabWidget->addTab(new Deploiement(id), "Deploiement");
+ ui->tabWidget->setCurrentIndex(ui->tabWidget->count() -1);
+}
+
+void secDialog::on_pushButton_seuil_clicked()
+{
+ ui->tabWidget->addTab(new seuil(), "Configuration seuil");
+ ui->tabWidget->setCurrentIndex(ui->tabWidget->count() -1);
+}
+
+void secDialog::on_pushButton_alarme_clicked()
+{
+ ui->tabWidget->addTab(new majPrix(), "Maj Prix Energies");
+ ui->tabWidget->setCurrentIndex(ui->tabWidget->count() -1);
+}
+
+void secDialog::on_tablesites_activated(const QModelIndex &index)
+{
+ QString val=ui->tablesites->model()->data(index).toString();
+}
+
+void secDialog::on_pushButton_delete_clicked()
+{
+ QItemSelectionModel *select = ui->tablesites->selectionModel();
+
+ if (select->hasSelection())
+ {
+ QModelIndexList selected = select->selectedRows();
+ QModelIndex index = selected.first();
+ QVariant id = index.data();
+ QSqlQuery *query = new QSqlQuery(db);
+ query->prepare("DELETE FROM site WHERE sit_Id= :id");
+ query->bindValue(":id", id.toInt());
+ QMessageBox *msgBox = new QMessageBox(this);
+ msgBox->setText("Attention");
+ msgBox->setInformativeText("Voulez vous vraiment supprimer cette ligne");
+ msgBox->setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
+ msgBox->setDefaultButton(QMessageBox::Cancel);
+ int ret = msgBox->exec();
+ if (ret == QMessageBox::Ok)
+ {
+ bool ret2 = query->exec();
+ if (ret2)
+ {
+ refreshTable();
+ }
+ }
+ delete msgBox;
+ }
}
-void secDialog::on_pushButton_clicked()
+void secDialog::on_pushButton_add_clicked()
{
-close();
+ ajoutSite * ajout = new ajoutSite(this);
+ ajout->exec();
+ refreshTable();
+ //query->prepare("SELECT sit_Id, sit_adresse AS Adresse, sit_ville AS Ville, sit_telephone AS Telephone FROM site");
+ //query->exec(); //rafraichissement
+ //modal->setQuery(*query);
+ //ui->tablesites->setModel(modal);
+ //ui->tablesites->setColumnHidden(0,true);
+ //ui->tablesites->setSelectionMode(QAbstractItemView::SingleSelection);
+ //ui->tablesites->repaint();
}
diff --git a/secdialog.h b/secdialog.h
index a266904..e5ce280 100755..100644
--- a/secdialog.h
+++ b/secdialog.h
@@ -2,6 +2,9 @@
#define SECDIALOG_H
#include <QDialog>
+#include <QtSql>
+#include <QMessageBox>
+#include "ajoutsite.h"
namespace Ui {
class secDialog;
@@ -16,10 +19,35 @@ public:
~secDialog();
private slots:
- void on_pushButton_clicked();
+
+ void on_butQuitter_clicked();
+
+ void on_tabWidget_tabCloseRequested(int index);
+
+ void on_pushButton_deploiement_clicked();
+
+ void on_pushButton_seuil_clicked();
+
+ void on_pushButton_alarme_clicked();
+
+
+ void on_tablesites_activated(const QModelIndex &index);
+
+ void on_pushButton_delete_clicked();
+
+ void on_pushButton_add_clicked();
private:
+
Ui::secDialog *ui;
+ QSqlQueryModel *model;
+ QSqlDatabase db;
+ QSqlQueryModel * modal;
+ QSqlQuery *query;
+
+ bool connectToDb();
+ void closeDb();
+ bool refreshTable();
};
#endif // SECDIALOG_H
diff --git a/secdialog.ui b/secdialog.ui
index 59d587e..ce1ea3b 100755..100644
--- a/secdialog.ui
+++ b/secdialog.ui
@@ -6,19 +6,25 @@
<rect>
<x>0</x>
<y>0</y>
- <width>954</width>
- <height>512</height>
+ <width>970</width>
+ <height>581</height>
</rect>
</property>
<property name="windowTitle">
- <string>Dialog</string>
+ <string>Interface de configuration</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>false</bool>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
- <x>400</x>
+ <x>0</x>
<y>0</y>
- <width>151</width>
+ <width>981</width>
<height>41</height>
</rect>
</property>
@@ -30,23 +36,386 @@
</font>
</property>
<property name="text">
- <string>Choix du site</string>
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Gestion des sites&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>40</y>
+ <width>981</width>
+ <height>551</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <property name="tabShape">
+ <enum>QTabWidget::Rounded</enum>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>15</width>
+ <height>17</height>
+ </size>
+ </property>
+ <property name="documentMode">
+ <bool>false</bool>
+ </property>
+ <property name="tabsClosable">
+ <bool>true</bool>
+ </property>
+ <property name="movable">
+ <bool>true</bool>
+ </property>
+ <property name="tabBarAutoHide">
+ <bool>true</bool>
+ </property>
+ <widget class="QWidget" name="tab">
+ <attribute name="icon">
+ <iconset resource="resources.qrc">
+ <normaloff>:/resources/img/accueil.png</normaloff>:/resources/img/accueil.png</iconset>
+ </attribute>
+ <attribute name="title">
+ <string>Accueil</string>
+ </attribute>
+ <widget class="QTableView" name="tablesites">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>30</y>
+ <width>941</width>
+ <height>341</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="mouseTracking">
+ <bool>false</bool>
+ </property>
+ <property name="contextMenuPolicy">
+ <enum>Qt::DefaultContextMenu</enum>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <property name="inputMethodHints">
+ <set>Qt::ImhNone</set>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Sunken</enum>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <property name="midLineWidth">
+ <number>1</number>
+ </property>
+ <property name="verticalScrollBarPolicy">
+ <enum>Qt::ScrollBarAsNeeded</enum>
+ </property>
+ <property name="horizontalScrollBarPolicy">
+ <enum>Qt::ScrollBarAlwaysOff</enum>
+ </property>
+ <property name="sizeAdjustPolicy">
+ <enum>QAbstractScrollArea::AdjustToContents</enum>
+ </property>
+ <property name="autoScroll">
+ <bool>true</bool>
+ </property>
+ <property name="tabKeyNavigation">
+ <bool>true</bool>
+ </property>
+ <property name="dragDropOverwriteMode">
+ <bool>false</bool>
+ </property>
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ <property name="selectionMode">
+ <enum>QAbstractItemView::SingleSelection</enum>
+ </property>
+ <property name="selectionBehavior">
+ <enum>QAbstractItemView::SelectRows</enum>
+ </property>
+ <property name="textElideMode">
+ <enum>Qt::ElideNone</enum>
+ </property>
+ <property name="verticalScrollMode">
+ <enum>QAbstractItemView::ScrollPerItem</enum>
+ </property>
+ <property name="horizontalScrollMode">
+ <enum>QAbstractItemView::ScrollPerItem</enum>
+ </property>
+ <property name="showGrid">
+ <bool>true</bool>
+ </property>
+ <property name="gridStyle">
+ <enum>Qt::SolidLine</enum>
+ </property>
+ <property name="sortingEnabled">
+ <bool>true</bool>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ <property name="cornerButtonEnabled">
+ <bool>false</bool>
+ </property>
+ <attribute name="horizontalHeaderVisible">
+ <bool>true</bool>
+ </attribute>
+ <attribute name="horizontalHeaderCascadingSectionResizes">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="horizontalHeaderDefaultSectionSize">
+ <number>306</number>
+ </attribute>
+ <attribute name="horizontalHeaderHighlightSections">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="horizontalHeaderMinimumSectionSize">
+ <number>40</number>
+ </attribute>
+ <attribute name="horizontalHeaderShowSortIndicator" stdset="0">
+ <bool>true</bool>
+ </attribute>
+ <attribute name="horizontalHeaderStretchLastSection">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="verticalHeaderVisible">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="verticalHeaderHighlightSections">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="verticalHeaderMinimumSectionSize">
+ <number>20</number>
+ </attribute>
+ </widget>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>380</y>
+ <width>941</width>
+ <height>111</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>Actions</string>
+ </property>
+ <widget class="QPushButton" name="pushButton_alarme">
+ <property name="geometry">
+ <rect>
+ <x>290</x>
+ <y>50</y>
+ <width>111</width>
+ <height>24</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Maj Prix Energies</string>
+ </property>
+ <property name="icon">
+ <iconset resource="resources.qrc">
+ <normaloff>:/resources/img/euros.png</normaloff>:/resources/img/euros.png</iconset>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_seuil">
+ <property name="geometry">
+ <rect>
+ <x>560</x>
+ <y>50</y>
+ <width>131</width>
+ <height>24</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Configuration Seuil</string>
+ </property>
+ <property name="icon">
+ <iconset resource="resources.qrc">
+ <normaloff>:/resources/img/alerte.png</normaloff>:/resources/img/alerte.png</iconset>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_deploiement">
+ <property name="geometry">
+ <rect>
+ <x>430</x>
+ <y>50</y>
+ <width>101</width>
+ <height>24</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Déploiement</string>
+ </property>
+ <property name="icon">
+ <iconset resource="resources.qrc">
+ <normaloff>:/resources/img/config.png</normaloff>:/resources/img/config.png</iconset>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_delete">
+ <property name="geometry">
+ <rect>
+ <x>450</x>
+ <y>10</y>
+ <width>31</width>
+ <height>23</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="resources.qrc">
+ <normaloff>:/resources/img/moins.png</normaloff>:/resources/img/moins.png</iconset>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_add">
+ <property name="geometry">
+ <rect>
+ <x>490</x>
+ <y>10</y>
+ <width>31</width>
+ <height>23</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="resources.qrc">
+ <normaloff>:/resources/img/plus.png</normaloff>:/resources/img/plus.png</iconset>
+ </property>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+ <widget class="QPushButton" name="butQuitter">
+ <property name="geometry">
+ <rect>
+ <x>930</x>
+ <y>10</y>
+ <width>31</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="font">
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
+ <property name="contextMenuPolicy">
+ <enum>Qt::NoContextMenu</enum>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">border-image: url(:/resources/img/exit.PNG);</string>
+ </property>
+ <property name="text">
+ <string/>
</property>
</widget>
- <widget class="QPushButton" name="pushButton">
+ <widget class="QLabel" name="sessionIdLabel_2">
<property name="geometry">
<rect>
- <x>420</x>
- <y>450</y>
- <width>111</width>
- <height>51</height>
+ <x>10</x>
+ <y>10</y>
+ <width>16</width>
+ <height>16</height>
</rect>
</property>
+ <property name="styleSheet">
+ <string notr="true">image: url(:/resources/img/connecte.png);</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ <widget class="QWidget" name="layoutWidget">
+ <property name="geometry">
+ <rect>
+ <x>30</x>
+ <y>10</y>
+ <width>55</width>
+ <height>15</height>
+ </rect>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="sessionIdLabel">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <property name="text">
+ <string>Connecté:</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QLabel" name="sessionId">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>90</x>
+ <y>10</y>
+ <width>42</width>
+ <height>13</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="text">
- <string>Deconnexion</string>
+ <string>Stagiaire</string>
</property>
</widget>
</widget>
- <resources/>
+ <resources>
+ <include location="resources.qrc"/>
+ </resources>
<connections/>
</ui>