diff --git a/deuchnord-hermes.pro b/deuchnord-hermes.pro
index a5e7e5a..fb7fe5d 100644
--- a/deuchnord-hermes.pro
+++ b/deuchnord-hermes.pro
@@ -1,43 +1,43 @@
-#-------------------------------------------------
-#
-# Project created by QtCreator 2014-05-07T19:11:58
-#
-#-------------------------------------------------
-
-CONFIG += c++11
-
-QT += core gui
-QT += xml
-
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
-
-TARGET = deuchnord-hermes
-TEMPLATE = app
-
-
-SOURCES += main.cpp\
- mainwindow.cpp \
- produititem.cpp \
- infosproduitdialog.cpp \
- gestionmagasinsdialog.cpp \
- aboutdialog.cpp
-
-HEADERS += mainwindow.h \
- produititem.h \
- infosproduitdialog.h \
- gestionmagasinsdialog.h \
- aboutdialog.h
-
-FORMS += mainwindow.ui \
- produititem.ui \
- infosproduitdialog.ui \
- gestionmagasinsdialog.ui \
- aboutdialog.ui
-
-RESOURCES += \
- resources.qrc
-
-OTHER_FILES += \
- resources.rc
-
-RC_FILE = resources.rc
+#-------------------------------------------------
+#
+# Project created by QtCreator 2014-05-07T19:11:58
+#
+#-------------------------------------------------
+
+CONFIG += c++11
+
+QT += core gui
+QT += xml network
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+TARGET = deuchnord-hermes
+TEMPLATE = app
+
+
+SOURCES += main.cpp\
+ mainwindow.cpp \
+ produititem.cpp \
+ infosproduitdialog.cpp \
+ gestionmagasinsdialog.cpp \
+ aboutdialog.cpp
+
+HEADERS += mainwindow.h \
+ produititem.h \
+ infosproduitdialog.h \
+ gestionmagasinsdialog.h \
+ aboutdialog.h
+
+FORMS += mainwindow.ui \
+ produititem.ui \
+ infosproduitdialog.ui \
+ gestionmagasinsdialog.ui \
+ aboutdialog.ui
+
+RESOURCES += \
+ resources.qrc
+
+OTHER_FILES += \
+ resources.rc
+
+RC_FILE = resources.rc
diff --git a/deuchnord-hermes.pro.user b/deuchnord-hermes.pro.user
index 2eaa3b5..1068efc 100644
--- a/deuchnord-hermes.pro.user
+++ b/deuchnord-hermes.pro.user
@@ -1,260 +1,251 @@
-
-
-
-
-
- ProjectExplorer.Project.ActiveTarget
- 0
-
-
- ProjectExplorer.Project.EditorSettings
-
- true
- false
- true
-
- Cpp
-
- CppGlobal
-
-
-
- QmlJS
-
- QmlJSGlobal
-
-
- 2
- UTF-8
- false
- 4
- false
- true
- 1
- true
- 0
- true
- 0
- 8
- true
- 1
- true
- true
- true
- false
-
-
-
- ProjectExplorer.Project.PluginSettings
-
-
-
- ProjectExplorer.Project.Target.0
-
- Desktop
- Desktop
- {8a6bac83-397a-433b-b12b-aaf345693483}
- 1
- 0
- 0
-
- /home/jerome/Dropbox/Git/Hermes/build-deuchnord-hermes-Desktop-Debug
-
-
- true
- qmake
-
- QtProjectManager.QMakeBuildStep
- false
- true
-
- false
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- -w
- -r
-
- false
-
-
-
- 2
- Build
-
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- -w
- -r
-
- true
- clean
-
-
- 1
- Clean
-
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
- Debug
-
- Qt4ProjectManager.Qt4BuildConfiguration
- 2
- true
-
-
- /home/jerome/Dropbox/Git/Hermes/build-deuchnord-hermes-Desktop-Release
-
-
- true
- qmake
-
- QtProjectManager.QMakeBuildStep
- false
- true
-
- false
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- -w
- -r
-
- false
-
-
-
- 2
- Build
-
- ProjectExplorer.BuildSteps.Build
-
-
-
- true
- Make
-
- Qt4ProjectManager.MakeStep
-
- -w
- -r
-
- true
- clean
-
-
- 1
- Clean
-
- ProjectExplorer.BuildSteps.Clean
-
- 2
- false
-
- Release
-
- Qt4ProjectManager.Qt4BuildConfiguration
- 0
- true
-
- 2
-
-
- 0
- Deploy
-
- ProjectExplorer.BuildSteps.Deploy
-
- 1
- Deploy locally
-
- ProjectExplorer.DefaultDeployConfiguration
-
- 1
-
-
-
- false
- false
- false
- false
- true
- 0.01
- 10
- true
- 1
- 25
-
- 1
- true
- false
- true
- valgrind
-
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
-
- 2
-
- deuchnord-hermes
-
- Qt4ProjectManager.Qt4RunConfiguration:/home/jerome/Dropbox/Git/Hermes/deuchnord-hermes/deuchnord-hermes.pro
-
- deuchnord-hermes.pro
- false
- false
-
- 3768
- true
- false
- false
- false
- true
-
- 1
-
-
-
- ProjectExplorer.Project.TargetCount
- 1
-
-
- ProjectExplorer.Project.Updater.EnvironmentId
- {44abd538-5b46-4276-b819-6072e04c10d4}
-
-
- ProjectExplorer.Project.Updater.FileVersion
- 15
-
-
+
+
+
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ false
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 80
+ true
+ true
+ 1
+ true
+ false
+ 0
+ true
+ 0
+ 8
+ true
+ 1
+ true
+ true
+ true
+ false
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ Desktop Qt 5.2.1 MinGW 32bit
+ Desktop Qt 5.2.1 MinGW 32bit
+ qt.521.win32_mingw48.essentials_kit
+ 1
+ 0
+ 0
+
+ C:/Users/Jérôme/Dropbox/Git/Hermes/build-deuchnord-hermes-Desktop_Qt_5_2_1_MinGW_32bit-Debug
+
+
+ true
+ qmake
+
+ QtProjectManager.QMakeBuildStep
+ false
+ true
+
+ false
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+
+ 2
+ Compiler
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+
+ 1
+ Nettoyer
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Debug
+
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+ true
+
+
+ C:/Users/Jérôme/Dropbox/Git/Hermes/build-deuchnord-hermes-Desktop_Qt_5_2_1_MinGW_32bit-Release
+
+
+ true
+ qmake
+
+ QtProjectManager.QMakeBuildStep
+ false
+ true
+
+ false
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+
+ 2
+ Compiler
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+
+ 1
+ Nettoyer
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Release
+
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ true
+
+ 2
+
+
+ 0
+ Déploiement
+
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+ Déployer localement
+
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ 2
+
+ deuchnord-hermes
+
+ Qt4ProjectManager.Qt4RunConfiguration:C:/Users/Jérôme/Dropbox/Git/Hermes/deuchnord-hermes/deuchnord-hermes.pro
+
+ deuchnord-hermes.pro
+ false
+ false
+
+ 3768
+ false
+ true
+ false
+ false
+ true
+
+ 1
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 1
+
+
+ ProjectExplorer.Project.Updater.EnvironmentId
+ {60f16766-9e87-40cf-8f8f-b733441f2614}
+
+
+ ProjectExplorer.Project.Updater.FileVersion
+ 15
+
+
diff --git a/icon-search.png b/icon-search.png
new file mode 100644
index 0000000..d2e70fa
Binary files /dev/null and b/icon-search.png differ
diff --git a/infosproduitdialog.cpp b/infosproduitdialog.cpp
index 8ae203c..1d0cc9c 100644
--- a/infosproduitdialog.cpp
+++ b/infosproduitdialog.cpp
@@ -46,7 +46,15 @@ InfosProduitDialog::InfosProduitDialog(QWidget *parent, QWidget *mainWindow, QSt
// Remplissage des données
ui->txtNom->setText(nomProduit);
ui->dateAchat->setDate(dateAchat);
- ui->dateFinGarantie->setDate(dateFinGarantie);
+
+ if(dateFinGarantie != QDate(1970, 1, 1))
+ ui->dateFinGarantie->setDate(dateFinGarantie);
+ else
+ {
+ ui->dateFinGarantie->setDate(QDate::currentDate().addYears(1));
+ ui->checkGarantieAVie->setChecked(true);
+ }
+
ui->comboMagasin->setCurrentIndex(indexMagasin);
ui->checkSAV->setChecked(enSAV);
ui->image->setPixmap(image);
@@ -190,7 +198,12 @@ void InfosProduitDialog::on_buttonBox_accepted()
{
getParentItem()->setNomProduit(ui->txtNom->text());
getParentItem()->setDateAchat(ui->dateAchat->date());
- getParentItem()->setDateFinGarantie(ui->dateFinGarantie->date());
+
+ if(!ui->checkGarantieAVie->isChecked())
+ getParentItem()->setDateFinGarantie(ui->dateFinGarantie->date());
+ else
+ getParentItem()->setDateFinGarantie(QDate(1970, 1, 1));
+
getParentItem()->setImage(this->image);
getParentItem()->setMagasin(ui->comboMagasin->currentIndex());
getParentItem()->setEnSAV(ui->checkSAV->isChecked());
@@ -207,3 +220,11 @@ InfosProduitDialog::~InfosProduitDialog()
{
delete ui;
}
+
+void InfosProduitDialog::on_checkGarantieAVie_toggled(bool checked)
+{
+ if(checked)
+ ui->dateFinGarantie->setEnabled(false);
+ else
+ ui->dateFinGarantie->setEnabled(true);
+}
diff --git a/infosproduitdialog.h b/infosproduitdialog.h
index d9c9afe..52f1a19 100644
--- a/infosproduitdialog.h
+++ b/infosproduitdialog.h
@@ -39,6 +39,9 @@ public slots:
// Boutons du bas
void on_buttonBox_accepted();
+private slots:
+ void on_checkGarantieAVie_toggled(bool checked);
+
private:
QPixmap image;
Ui::InfosProduitDialog *ui;
diff --git a/infosproduitdialog.ui b/infosproduitdialog.ui
index 6d3c437..50e5661 100644
--- a/infosproduitdialog.ui
+++ b/infosproduitdialog.ui
@@ -51,31 +51,31 @@
- -
+
-
Fin de la garantie :
- -
+
-
+
+
+ 1975
+ 1
+ 1
+
+
true
- -
-
-
- Magasin :
-
-
-
- -
+
-
- -
+
-
Cochez cette case si vous avez envoyé le produit en SAV.
@@ -85,14 +85,14 @@
- -
+
-
Image à afficher :
- -
+
-
-
@@ -136,6 +136,20 @@
+ -
+
+
+ Ce produit bénéficie d'une garantie à vie
+
+
+
+ -
+
+
+ Magasin :
+
+
+
diff --git a/mainwindow.cpp b/mainwindow.cpp
index d0b4ee5..7f73507 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -20,6 +20,9 @@
#include
#include
#include
+#include
+#include
+#include
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
@@ -27,9 +30,10 @@ MainWindow::MainWindow(QWidget *parent) :
{
ui->setupUi(this);
- version = "0.1";
+ version = "0.2";
searchBox = new QLineEdit(this);
+ searchBox->addAction(QIcon(":/icons/icon-search.png"), QLineEdit::LeadingPosition);
searchBox->setPlaceholderText("Rechercher...");
searchBox->setToolTip("Recherchez un produit à partir de son nom.\nLa casse n'est pas prise en compte.");
searchBox->setClearButtonEnabled(true);
@@ -59,7 +63,35 @@ MainWindow::MainWindow(QWidget *parent) :
else
ui->actionSupprimerProduit->setEnabled(false);
- ui->statusBar->hide();
+ // Recherche de nouvelle version :
+ QNetworkAccessManager *manager = new QNetworkAccessManager(this);
+ connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(dlVersionFinished(QNetworkReply*)));
+
+#ifdef Q_OS_LINUX
+ QString os = "linux";
+#endif
+#ifdef Q_OS_WIN32
+ QString os = "windows";
+#endif
+
+ manager->get(QNetworkRequest(QUrl("http://hermes.deuchnord.tk/version.php?os="+os)));
+}
+
+void MainWindow::dlVersionFinished(QNetworkReply *reply)
+{
+ QString versionAvailable = reply->readAll();
+ if(versionAvailable != "" && version != versionAvailable)
+ {
+ ui->statusBar->showMessage("Une nouvelle version ("+versionAvailable+") est disponible !");
+ QPushButton* btnUpdate = new QPushButton("Télécharger la nouvelle version");
+ connect(btnUpdate, SIGNAL(clicked()), this, SLOT(dlNewVersionBtnClicked()));
+ ui->statusBar->addPermanentWidget(btnUpdate);
+ }
+}
+
+void MainWindow::dlNewVersionBtnClicked()
+{
+ QDesktopServices::openUrl(QUrl("http://hermes.deuchnord.tk"));
}
void MainWindow::searchProduit(QString search)
@@ -84,6 +116,8 @@ void MainWindow::searchProduit(QString search)
for(int i = 0; i < ui->listeProduits->count(); i++)
ui->listeProduits->item(i)->setHidden(false);
}
+
+ updateStatusMessage();
}
void MainWindow::on_actionNouveauProduit_triggered()
@@ -155,6 +189,8 @@ void MainWindow::on_actionSupprimerProduit_triggered(bool dontAskConfirm)
if(ui->listeProduits->count() == 0)
ui->actionSupprimerProduit->setEnabled(false);
+
+ updateStatusMessage();
}
}
}
@@ -173,7 +209,7 @@ QListWidgetItem* MainWindow::ajouterProduit(ProduitItem *produit)
ui->listeProduits->addItem(widgetItem);
ui->listeProduits->setItemWidget(widgetItem, produit);
- //ui->statusBar->showMessage(QString::number(ui->listeProduits->count())+" produits affichés.");
+ updateStatusMessage();
return widgetItem;
}
@@ -185,6 +221,11 @@ void MainWindow::on_actionAPropos_triggered()
dialog->show();
}
+void MainWindow::on_actionReportBug_triggered()
+{
+ QDesktopServices::openUrl(QUrl("https://sourceforge.net/p/deuchnord-hermes/bugs/"));
+}
+
void MainWindow::on_actionAide_triggered()
{
QDesktopServices::openUrl(QUrl("http://hermes.deuchnord.tk/help/"));
@@ -195,6 +236,16 @@ Ui::MainWindow *MainWindow::getUI()
return ui;
}
+void MainWindow::updateStatusMessage()
+{
+ int nb = 0;
+ for(int i = 0; i < ui->listeProduits->count(); i++)
+ if(!ui->listeProduits->item(i)->isHidden())
+ nb++;
+
+ ui->statusBar->showMessage(QString::number(nb)+" produit(s) affiché(s).");
+}
+
MainWindow::~MainWindow()
{
// Enregistrement de la configuration
diff --git a/mainwindow.h b/mainwindow.h
index 9c808e5..28fa896 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -4,6 +4,7 @@
#include
#include
#include
+#include
#include "produititem.h"
@@ -21,12 +22,18 @@ public:
~MainWindow();
public slots:
+ void dlVersionFinished(QNetworkReply* reply);
+ void dlNewVersionBtnClicked();
+
void searchProduit(QString search);
void on_actionNouveauProduit_triggered();
void on_actionSupprimerProduit_triggered(bool dontAskConfirm = true);
void on_actionGererMagasins_triggered();
void on_actionAPropos_triggered();
void on_actionAide_triggered();
+ void on_actionReportBug_triggered();
+
+ void updateStatusMessage();
void deleteAsked();
diff --git a/mainwindow.ui b/mainwindow.ui
index 5009368..5c3abc3 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -50,6 +50,7 @@
Aide
+
@@ -98,7 +99,7 @@
- Centre d'aide
+ Centre d'aide...
F1
@@ -109,6 +110,11 @@
À propos...
+
+
+ Signaler un bug...
+
+
diff --git a/produititem.cpp b/produititem.cpp
index 4199b77..c08e707 100644
--- a/produititem.cpp
+++ b/produititem.cpp
@@ -134,10 +134,15 @@ void ProduitItem::updateDescription()
if(dateFinGarantie.month() < 10)
moisFinGarantie = "0"+moisFinGarantie;
- if(QDate::currentDate() < dateFinGarantie)
- descriptionListe += "fin de la garantie le "+jourFinGarantie+"/"+moisFinGarantie+"/"+QString::number(dateFinGarantie.year());
+ if(dateFinGarantie != QDate(1970, 1, 1))
+ {
+ if(QDate::currentDate() < dateFinGarantie)
+ descriptionListe += "fin de la garantie le "+jourFinGarantie+"/"+moisFinGarantie+"/"+QString::number(dateFinGarantie.year());
+ else
+ descriptionListe += "garantie expirée";
+ }
else
- descriptionListe += "garantie expirée";
+ descriptionListe += "garantie à vie";
if(this->enSAV)
descriptionListe += "\nParti en SAV";
diff --git a/resources.qrc b/resources.qrc
index 077ec8d..20de7e0 100644
--- a/resources.qrc
+++ b/resources.qrc
@@ -6,5 +6,6 @@
remove.png
add.png
+ icon-search.png