瀏覽代碼

Version 0.1

tags/0.7
Jérôme Deuchnord 10 年之前
當前提交
89f03e1f1c
共有 23 個文件被更改,包括 2252 次插入0 次删除
  1. +25
    -0
      aboutdialog.cpp
  2. +25
    -0
      aboutdialog.h
  3. +123
    -0
      aboutdialog.ui
  4. +38
    -0
      deuchnord-hermes.pro
  5. +260
    -0
      deuchnord-hermes.pro.user
  6. +260
    -0
      deuchnord-hermes.pro.user.81ef902
  7. +86
    -0
      gestionmagasinsdialog.cpp
  8. +28
    -0
      gestionmagasinsdialog.h
  9. +114
    -0
      gestionmagasinsdialog.ui
  10. 二進制
      icon-hermes.png
  11. +213
    -0
      infosproduitdialog.cpp
  12. +51
    -0
      infosproduitdialog.h
  13. +338
    -0
      infosproduitdialog.ui
  14. +19
    -0
      main.cpp
  15. +159
    -0
      mainwindow.cpp
  16. +38
    -0
      mainwindow.h
  17. +113
    -0
      mainwindow.ui
  18. 二進制
      no-picture.jpg
  19. 二進制
      no-picture.xcf
  20. +170
    -0
      produititem.cpp
  21. +86
    -0
      produititem.h
  22. +100
    -0
      produititem.ui
  23. +6
    -0
      resources.qrc

+ 25
- 0
aboutdialog.cpp 查看文件

@@ -0,0 +1,25 @@
#include "aboutdialog.h"
#include "ui_aboutdialog.h"

#include <QMessageBox>

AboutDialog::AboutDialog(QWidget *parent, QString version) :
QDialog(parent),
ui(new Ui::AboutDialog)
{
ui->setupUi(this);
ui->version->setText("Version "+version);
ui->btnFermer->setFocus();
}

void AboutDialog::on_btnQt_clicked()
{
QMessageBox::aboutQt(this, "À propos de Qt");
}

AboutDialog::~AboutDialog()
{
delete ui;
}



+ 25
- 0
aboutdialog.h 查看文件

@@ -0,0 +1,25 @@
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H

#include <QDialog>

namespace Ui {
class AboutDialog;
}

class AboutDialog : public QDialog
{
Q_OBJECT

public:
explicit AboutDialog(QWidget *parent, QString version);
~AboutDialog();

private slots:
void on_btnQt_clicked();

private:
Ui::AboutDialog *ui;
};

#endif // ABOUTDIALOG_H

+ 123
- 0
aboutdialog.ui 查看文件

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutDialog</class>
<widget class="QDialog" name="AboutDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>283</width>
<height>173</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>283</width>
<height>173</height>
</size>
</property>
<property name="windowTitle">
<string>À propos de Hermès</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;h1&gt;Deuchnord Hermès&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="version">
<property name="text">
<string>Version</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Hermès est un logiciel libre distribué sous la licence &lt;a href=&quot;http://www.cecill.info/licences/Licence_CeCILL_V2.1-fr.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;CeCILL 2.1&lt;/span&gt;&lt;/a&gt; par Jérôme Deuchnord.&lt;/p&gt;&lt;p&gt;Basé sur Qt 5.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnQt">
<property name="text">
<string>À propos de Qt</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnFermer">
<property name="text">
<string>Fermer</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>btnFermer</sender>
<signal>clicked()</signal>
<receiver>AboutDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>641</x>
<y>401</y>
</hint>
<hint type="destinationlabel">
<x>691</x>
<y>379</y>
</hint>
</hints>
</connection>
</connections>
</ui>

+ 38
- 0
deuchnord-hermes.pro 查看文件

@@ -0,0 +1,38 @@
#-------------------------------------------------
#
# 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

+ 260
- 0
deuchnord-hermes.pro.user 查看文件

@@ -0,0 +1,260 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.0.1, 2014-05-22T09:30:43. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap"/>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{8a6bac83-397a-433b-b12b-aaf345693483}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</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">/home/jerome/Dropbox/Git/Hermes/build-deuchnord-hermes-Desktop-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>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<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">/home/jerome/Dropbox/Git/Hermes/build-deuchnord-hermes-Desktop-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>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">deuchnord-hermes</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/jerome/Dropbox/Git/Hermes/deuchnord-hermes/deuchnord-hermes.pro</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">deuchnord-hermes.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
<value type="QByteArray">{44abd538-5b46-4276-b819-6072e04c10d4}</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">15</value>
</data>
</qtcreator>

+ 260
- 0
deuchnord-hermes.pro.user.81ef902 查看文件

@@ -0,0 +1,260 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.0.1, 2014-05-12T10:08:17. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap"/>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{8a6bac83-397a-433b-b12b-aaf345693483}</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">/home/jerome/Dropbox/Git/Hermes/build-deuchnord-hermes-Desktop-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>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<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">/home/jerome/Dropbox/Git/Hermes/build-deuchnord-hermes-Desktop-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>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">deuchnord-hermes</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/jerome/Dropbox/Git/Hermes/deuchnord-hermes/deuchnord-hermes.pro</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">deuchnord-hermes.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
<value type="QByteArray">{81ef902a-0963-4a87-b37c-5a785cdf71d5}</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">15</value>
</data>
</qtcreator>

+ 86
- 0
gestionmagasinsdialog.cpp 查看文件

@@ -0,0 +1,86 @@
#include "gestionmagasinsdialog.h"
#include "ui_gestionmagasinsdialog.h"

#include <QDir>
#include <QFile>
#include <QtXml>
#include <QInputDialog>

GestionMagasinsDialog::GestionMagasinsDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::GestionMagasinsDialog)
{
ui->setupUi(this);

QFile fichierMagasins(QDir::homePath()+"/.deuchnord-hermes/manufacturers.xml");
fichierMagasins.open(QFile::ReadOnly);
if(fichierMagasins.isOpen())
{
QString contenuFichier = fichierMagasins.readAll();
fichierMagasins.close();

QDomDocument dom;
dom.setContent(contenuFichier);
QDomElement root = dom.firstChildElement();
QDomElement manufacturer;
QDomNode node = root.firstChild();

while(!node.isNull())
{
manufacturer = node.toElement();
if(manufacturer.tagName() == "manufacturer")
ui->listMagasins->addItem(manufacturer.firstChild().toText().data());

node = node.nextSibling();
}

fichierMagasins.close();
}

ui->listMagasins->setCurrentItem(ui->listMagasins->item(0));
}

void GestionMagasinsDialog::on_btnAjoutMagasin_clicked()
{
ui->listMagasins->addItem(QInputDialog::getText(this, "Ajouter un magasin", "Veuillez entrer le nom du nouveau magasin :"));
}

void GestionMagasinsDialog::on_btnSupprMagasin_clicked()
{
delete ui->listMagasins->currentItem();
}

void GestionMagasinsDialog::on_listMagasins_currentRowChanged()
{
ui->btnSupprMagasin->setEnabled(true);
}

void GestionMagasinsDialog::on_buttonBox_accepted()
{
QDomDocument dom("manufacturers");
QDomElement rootElement = dom.createElement("manufacturers");
dom.appendChild(rootElement);

for(int i = 0; i < ui->listMagasins->count(); i++)
{
QDomElement manufacturer = dom.createElement("manufacturer");
rootElement.appendChild(manufacturer);

QListWidgetItem *item = ui->listMagasins->item(i);

QDomText nomMagasin = dom.createTextNode(item->text());
manufacturer.appendChild(nomMagasin);
}

QFile fileManu(QDir::homePath()+"/.deuchnord-hermes/manufacturers.xml");
if(fileManu.open(QFile::WriteOnly))
{
fileManu.write(dom.toString().toUtf8());
fileManu.close();
}
}

GestionMagasinsDialog::~GestionMagasinsDialog()
{
delete ui;
}

+ 28
- 0
gestionmagasinsdialog.h 查看文件

@@ -0,0 +1,28 @@
#ifndef GESTIONMAGASINSDIALOG_H
#define GESTIONMAGASINSDIALOG_H

#include <QDialog>

namespace Ui {
class GestionMagasinsDialog;
}

class GestionMagasinsDialog : public QDialog
{
Q_OBJECT

public:
explicit GestionMagasinsDialog(QWidget *parent = 0);
~GestionMagasinsDialog();

public slots:
void on_btnAjoutMagasin_clicked();
void on_btnSupprMagasin_clicked();
void on_listMagasins_currentRowChanged();
void on_buttonBox_accepted();

private:
Ui::GestionMagasinsDialog *ui;
};

#endif // GESTIONMAGASINSDIALOG_H

+ 114
- 0
gestionmagasinsdialog.ui 查看文件

@@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GestionMagasinsDialog</class>
<widget class="QDialog" name="GestionMagasinsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>655</width>
<height>383</height>
</rect>
</property>
<property name="windowTitle">
<string>Gérer les magasins</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QListWidget" name="listMagasins"/>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="btnAjoutMagasin">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="add"/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnSupprMagasin">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="remove"/>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>GestionMagasinsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>GestionMagasinsDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

二進制
icon-hermes.png 查看文件

Before After
Width: 628  |  Height: 627  |  Size: 504 KiB

+ 213
- 0
infosproduitdialog.cpp 查看文件

@@ -0,0 +1,213 @@
#include "infosproduitdialog.h"
#include "ui_infosproduitdialog.h"

#include <QDate>
#include <QDir>
#include <QFile>
#include <QtXml/QDomDocument>
#include <QMessageBox>
#include <QFileDialog>
#include <QFileInfo>
#include <QDesktopServices>
#include <QUrl>
#include <QTransform>

InfosProduitDialog::InfosProduitDialog(QWidget *parent, QString nomProduit, QDate dateAchat, QDate dateFinGarantie, QPixmap image, int indexMagasin, bool enSAV, QHash<QString, QByteArray> facturePDF, QHash<QString, QByteArray> garantiePDF) :
QDialog(parent),
ui(new Ui::InfosProduitDialog)
{
ui->setupUi(this);
parentWidget = parent;

// Récupération de la liste des magasins enregistrés
QFile fichierMagasins(QDir::homePath()+"/.deuchnord-hermes/manufacturers.xml");
fichierMagasins.open(QFile::ReadOnly);
if(fichierMagasins.isOpen())
{
QString contenuFichier = fichierMagasins.readAll();
fichierMagasins.close();

QDomDocument dom;
dom.setContent(contenuFichier);
QDomElement root = dom.firstChildElement();
QDomElement manufacturer;
QDomNode node = root.firstChild();

while(!node.isNull())
{
manufacturer = node.toElement();
if(manufacturer.tagName() == "manufacturer")
ui->comboMagasin->addItem(manufacturer.firstChild().toText().data());

node = node.nextSibling();
}
}
else
{
QMessageBox::critical(this, "Erreur", "Impossible de récupérer la liste des magasins.\nLes avez-vous enregistrés ?");
}

// Remplissage des données
ui->txtNom->setText(nomProduit);
ui->dateAchat->setDate(dateAchat);
ui->dateFinGarantie->setDate(dateFinGarantie);
ui->comboMagasin->setCurrentIndex(indexMagasin);
ui->checkSAV->setChecked(enSAV);
ui->image->setPixmap(image);
this->image = image;

// Factures & garanties
this->facturePDF = facturePDF;
this->garantiePDF = garantiePDF;
for(QString i : this->facturePDF.keys())
{
ui->listFactures->addItem(i);
}
for(QString i : this->garantiePDF.keys())
{
ui->listGaranties->addItem(i);
}

ui->txtNom->setFocus();
ui->listFactures->setCurrentItem(ui->listFactures->item(0));
ui->listGaranties->setCurrentItem(ui->listGaranties->item(0));
}

void InfosProduitDialog::on_btnImageParcourir_clicked()
{
QString filename = QFileDialog::getOpenFileName(this, "Sélectionnez une image", "", "Images supportées (*.bmp *.gif *.jpg *.jpeg *.png *.pbm *.pgm *.ppm *.xbm *.xpm)");
if(filename != "")
{
image = QPixmap(filename);
image = image.scaled(QSize(128, 128), Qt::KeepAspectRatio);
ui->image->setPixmap(image);
}
}

void InfosProduitDialog::on_btnImageSupprimer_clicked()
{
image = QPixmap(":/images/no-picture.jpg");
ui->image->setPixmap(image);
}

void InfosProduitDialog::on_btnAjoutFacture_clicked()
{
QString fileName = QFileDialog::getOpenFileName(this, "Sélectionnez une facture", "", "Fichiers PDF (*.pdf);;Image (*.jpg *.jpeg *.png)");
if(fileName != "")
{
QFile fichier(fileName);
QFileInfo infoFile(fichier.fileName());
fichier.open(QFile::ReadOnly);
if(fichier.isReadable())
{
QByteArray contenuFichier = fichier.readAll();
fichier.close();

facturePDF.insert(infoFile.fileName(), contenuFichier);
ui->listFactures->addItem(infoFile.fileName());
}
else
QMessageBox::critical(this, "Erreur", "Impossible de lire le fichier "+fichier.fileName()+"\nVérifiez qu'il est bien accessible en lecture et réessayez.");
}
}

void InfosProduitDialog::on_listFactures_currentRowChanged()
{
ui->btnSupprFacture->setEnabled(true);
}

void InfosProduitDialog::on_listFactures_itemDoubleClicked(QListWidgetItem *item)
{
QByteArray contentFile = facturePDF.value(item->text());
QFile tempFile(QDir::tempPath()+"/"+item->text());
tempFile.open(QFile::WriteOnly);
tempFile.write(contentFile);
tempFile.close();
QDesktopServices::openUrl(QUrl(tempFile.fileName()));
}

void InfosProduitDialog::on_btnSupprFacture_clicked()
{
if(QMessageBox::question(this, "Hermès", "Voulez-vous vraiment supprimer cette facture ?\nCette action n'est pas réversible.", QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
{
QListWidgetItem *item = ui->listFactures->selectedItems().value(0);
facturePDF.remove(item->text());
delete item;
}

if(ui->listFactures->count() == 0)
ui->btnSupprFacture->setEnabled(false);
}

void InfosProduitDialog::on_btnAjoutGarantie_clicked()
{
QString fileName = QFileDialog::getOpenFileName(this, "Sélectionnez une fiche garantie", "", "Fichiers PDF (*.pdf);;Image (*.jpg *.jpeg *.png)");
if(fileName != "")
{
QFile fichier(fileName);
QFileInfo infoFile(fichier.fileName());
fichier.open(QFile::ReadOnly);
if(fichier.isReadable())
{
QByteArray contenuFichier = fichier.readAll();
fichier.close();

garantiePDF.insert(infoFile.fileName(), contenuFichier);
ui->listGaranties->addItem(infoFile.fileName());
}
else
QMessageBox::critical(this, "Erreur", "Impossible de lire le fichier "+fichier.fileName()+"\nVérifiez qu'il est bien accessible en lecture et réessayez.");
}
}

void InfosProduitDialog::on_listGaranties_currentRowChanged()
{
ui->btnSupprGarantie->setEnabled(true);
}

void InfosProduitDialog::on_listGaranties_itemDoubleClicked(QListWidgetItem *item)
{
QByteArray contentFile = garantiePDF.value(item->text());
QFile tempFile(QDir::tempPath()+"/"+item->text());
tempFile.open(QFile::WriteOnly);
tempFile.write(contentFile);
tempFile.close();
QDesktopServices::openUrl(QUrl(tempFile.fileName()));
}

void InfosProduitDialog::on_btnSupprGarantie_clicked()
{
if(QMessageBox::question(this, "Hermès", "Voulez-vous vraiment supprimer cette fiche garantie ?\nCette action n'est pas réversible.", QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
{
QListWidgetItem *item = ui->listGaranties->selectedItems().value(0);
garantiePDF.remove(item->text());
delete item;
}

if(ui->listGaranties->count() == 0)
ui->btnSupprGarantie->setEnabled(false);
}

// Bouton "OK"

void InfosProduitDialog::on_buttonBox_accepted()
{
getParentItem()->setNomProduit(ui->txtNom->text());
getParentItem()->setDateAchat(ui->dateAchat->date());
getParentItem()->setDateFinGarantie(ui->dateFinGarantie->date());
getParentItem()->setImage(this->image);
getParentItem()->setMagasin(ui->comboMagasin->currentIndex());
getParentItem()->setEnSAV(ui->checkSAV->isChecked());
getParentItem()->setFactures(this->facturePDF);
getParentItem()->setGaranties(this->garantiePDF);
}

ProduitItem* InfosProduitDialog::getParentItem()
{
return static_cast<ProduitItem*>(this->parentWidget);
}

InfosProduitDialog::~InfosProduitDialog()
{
delete ui;
}

+ 51
- 0
infosproduitdialog.h 查看文件

@@ -0,0 +1,51 @@
#ifndef INFOSPRODUITDIALOG_H
#define INFOSPRODUITDIALOG_H

#include <QDialog>
#include <QDate>
#include <QHash>
#include <QListWidget>
#include <QPixmap>
#include "produititem.h"

namespace Ui {
class InfosProduitDialog;
}

class ProduitItem;

class InfosProduitDialog : public QDialog
{
Q_OBJECT

public:
explicit InfosProduitDialog(QWidget *parent, QString nomProduit = "", QDate dateAchat = QDate::currentDate(), QDate dateFinGarantie = QDate::currentDate().addYears(1), QPixmap image = QPixmap(), int indexMagasin = 0, bool enSAV = false, QHash<QString, QByteArray> facturePDF = QHash<QString, QByteArray>(), QHash<QString, QByteArray> garantiePDF = QHash<QString, QByteArray>());
~InfosProduitDialog();

public slots:
// Image
void on_btnImageParcourir_clicked();
void on_btnImageSupprimer_clicked();
// Factures
void on_btnAjoutFacture_clicked();
void on_listFactures_currentRowChanged();
void on_listFactures_itemDoubleClicked(QListWidgetItem *item);
void on_btnSupprFacture_clicked();
// Garanties
void on_btnAjoutGarantie_clicked();
void on_listGaranties_currentRowChanged();
void on_listGaranties_itemDoubleClicked(QListWidgetItem *item);
void on_btnSupprGarantie_clicked();
// Boutons du bas
void on_buttonBox_accepted();

private:
QPixmap image;
Ui::InfosProduitDialog *ui;
QHash<QString, QByteArray> facturePDF;
QHash<QString, QByteArray> garantiePDF;
QWidget *parentWidget;
ProduitItem *getParentItem();
};

#endif // INFOSPRODUITDIALOG_H

+ 338
- 0
infosproduitdialog.ui 查看文件

@@ -0,0 +1,338 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>InfosProduitDialog</class>
<widget class="QDialog" name="InfosProduitDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>694</width>
<height>427</height>
</rect>
</property>
<property name="windowTitle">
<string>Informations sur le produit</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tabProduit">
<attribute name="title">
<string>Produit</string>
</attribute>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Nom :</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="txtNom"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Date d'achat :</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDateEdit" name="dateAchat">
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Fin de la garantie :</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDateEdit" name="dateFinGarantie">
<property name="calendarPopup">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Magasin :</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="comboMagasin"/>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="checkSAV">
<property name="toolTip">
<string>Cochez cette case si vous avez envoyé le produit en SAV.</string>
</property>
<property name="text">
<string>Actuellement en SAV</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Image à afficher :</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QWidget" name="widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QLabel" name="image">
<property name="text">
<string>Image</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="btnImageParcourir">
<property name="text">
<string>Parcourir...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnImageSupprimer">
<property name="text">
<string>Supprimer</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Taille conseillée : 128px de hauteur</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabFactures">
<attribute name="title">
<string>Factures &amp;&amp; garanties</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Cet onglet permet de conserver des versions numérisées de vos factures et garanties, afin de vous délester de papiers encombrants. Un scanner de bonne qualité est toutefois requis, ces pièces devant être imprimées en cas de retour du produit en SAV.
Vous pouvez ouvrir une facture ou une garantie en double-cliquant dessus.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Factures</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QListWidget" name="listFactures"/>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="btnAjoutFacture">
<property name="toolTip">
<string>Ajouter une facture</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="list-add">
<normaloff/>
</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnSupprFacture">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Supprimer la facture</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="list-remove">
<normaloff/>
</iconset>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Garanties</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QListWidget" name="listGaranties"/>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="btnAjoutGarantie">
<property name="toolTip">
<string>Ajouter une garantie</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="list-add">
<normaloff/>
</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnSupprGarantie">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Supprimer la garantie</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="list-remove">
<normaloff/>
</iconset>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>InfosProduitDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>257</x>
<y>417</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>InfosProduitDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>325</x>
<y>417</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

+ 19
- 0
main.cpp 查看文件

@@ -0,0 +1,19 @@
#include "mainwindow.h"
#include <QApplication>
#include <QTranslator>
#include <QLocale>
#include <QLibraryInfo>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;

QString locale = QLocale::system().name().section('_', 0, 0);
QTranslator translator;
translator.load(QString("qt_") + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
a.installTranslator(&translator);
w.show();

return a.exec();
}

+ 159
- 0
mainwindow.cpp 查看文件

@@ -0,0 +1,159 @@
#include "mainwindow.h"
#include "produititem.h"
#include "gestionmagasinsdialog.h"
#include "aboutdialog.h"
#include "ui_mainwindow.h"

#include <QWidget>
#include <QListWidgetItem>
#include <QPixmap>
#include <QSpacerItem>
#include <QDate>
#include <QMessageBox>
#include <QListWidget>
#include <QListWidgetItem>
#include <QDir>
#include <QFile>
#include <QDataStream>
#include <QList>
#include <QDesktopServices>
#include <QUrl>

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);

version = "0.1";

searchBox = new QLineEdit(this);
searchBox->setPlaceholderText("Rechercher...");
searchBox->setToolTip("Recherchez un produit à partir de son nom.\nLa casse n'est pas prise en compte.");
searchBox->setClearButtonEnabled(true);

connect(searchBox, SIGNAL(textChanged(QString)), SLOT(searchProduit(QString)));

ui->mainToolBar->addSeparator();
ui->mainToolBar->addWidget(searchBox);

// Récupération de la configuration

QFile saveFile(QDir::homePath()+"/hermes.hrms");
QDataStream content(&saveFile);
content.setVersion(QDataStream::Qt_5_0);

if(saveFile.open(QFile::ReadOnly))
{
QList<ProduitInfo> listInfoProd;
content >> listInfoProd;

//QMessageBox::information(this, "test", QString::number(listInfoProd.count()));
for(ProduitInfo i : listInfoProd)
ajouterProduit(new ProduitItem(i.nomProduit, i.dateAchat, i.dateFinGarantie, i.image, i.indexMagasin, i.enSAV, i.factures, i.garanties));
}

ui->actionSupprimerProduit->setEnabled(false);
}

void MainWindow::searchProduit(QString search)
{
if(search != "")
{
for(int i = 0; i < ui->listeProduits->count(); i++)
{
ProduitItem* item = (ProduitItem*) ui->listeProduits->itemWidget(ui->listeProduits->item(i));
ProduitInfo prod = item->getProduitInfo();

// On cache les produits qui ne correspondent pas
if(prod.nomProduit.contains(search, Qt::CaseInsensitive))
ui->listeProduits->item(i)->setHidden(false);
else
ui->listeProduits->item(i)->setHidden(true);
}
}
else
{
// Si la zone de recherche est vide, on affiche tout
for(int i = 0; i < ui->listeProduits->count(); i++)
ui->listeProduits->item(i)->setHidden(false);
}
}

void MainWindow::on_actionNouveauProduit_triggered()
{
ProduitItem *prod = new ProduitItem("Nouveau produit", QDate::currentDate(), QDate::currentDate().addYears(1));
prod->openDialog();
ajouterProduit(prod);
}

void MainWindow::on_actionSupprimerProduit_triggered()
{
if(ui->listeProduits->selectedItems().count() == 1)
{
QListWidgetItem *item = ui->listeProduits->selectedItems()[0];
if(QMessageBox::question(this, "Supprimer le produit", "Êtes-vous sûr de vouloir supprimer ce produit ?\nCette action n'est pas réversible.", QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
{
ui->listeProduits->removeItemWidget(item);
delete item;
}
}
}

void MainWindow::on_actionGererMagasins_triggered()
{
GestionMagasinsDialog *dialog = new GestionMagasinsDialog(this);
dialog->setModal(true);
dialog->show();
}

void MainWindow::ajouterProduit(ProduitItem *produit)
{
QListWidgetItem *widgetItem = new QListWidgetItem();
widgetItem->setSizeHint(produit->getImage().size());
ui->listeProduits->addItem(widgetItem);
ui->listeProduits->setItemWidget(widgetItem, produit);
}

void MainWindow::on_listeProduits_currentRowChanged()
{
ui->actionSupprimerProduit->setEnabled(true);
}

void MainWindow::on_actionAPropos_triggered()
{
AboutDialog *dialog = new AboutDialog(this, version);
dialog->setModal(true);
dialog->show();
}

void MainWindow::on_actionAide_triggered()
{
QDesktopServices::openUrl(QUrl("http://hermes.deuchnord.tk/help/"));
}

MainWindow::~MainWindow()
{
// Enregistrement de la configuration
QFile saveFile(QDir::homePath()+"/hermes.hrms");
QDataStream content(&saveFile);
content.setVersion(QDataStream::Qt_5_0);
QList<ProduitInfo> listProd;

if(saveFile.open(QFile::WriteOnly))
{
for(int i = 0; i < ui->listeProduits->count(); i++)
{
ProduitItem* item = (ProduitItem*) ui->listeProduits->itemWidget(ui->listeProduits->item(i));
ProduitInfo prod = item->getProduitInfo();
listProd << prod;
}
}

content << listProd;

saveFile.close();

delete ui;
}


+ 38
- 0
mainwindow.h 查看文件

@@ -0,0 +1,38 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QLineEdit>
#include <QList>

#include "produititem.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
Q_OBJECT

public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();

public slots:
void searchProduit(QString search);
void on_actionNouveauProduit_triggered();
void on_actionSupprimerProduit_triggered();
void on_actionGererMagasins_triggered();
void on_listeProduits_currentRowChanged();
void on_actionAPropos_triggered();
void on_actionAide_triggered();

private:
Ui::MainWindow *ui;
void ajouterProduit(ProduitItem *produit);
QLineEdit *searchBox;
QString version;
};

#endif // MAINWINDOW_H

+ 113
- 0
mainwindow.ui 查看文件

@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>707</width>
<height>471</height>
</rect>
</property>
<property name="windowTitle">
<string>Gestionnaire de garanties Hermès</string>
</property>
<property name="windowIcon">
<iconset resource="resources.qrc">
<normaloff>:/images/icon-hermes.png</normaloff>:/images/icon-hermes.png</iconset>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QListWidget" name="listeProduits"/>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>707</width>
<height>25</height>
</rect>
</property>
<property name="nativeMenuBar">
<bool>true</bool>
</property>
<widget class="QMenu" name="menuFichier">
<property name="title">
<string>Fichier</string>
</property>
<addaction name="actionNouveauProduit"/>
<addaction name="actionSupprimerProduit"/>
<addaction name="separator"/>
<addaction name="actionGererMagasins"/>
</widget>
<widget class="QMenu" name="menuAide">
<property name="title">
<string>Aide</string>
</property>
<addaction name="actionAide"/>
<addaction name="actionAPropos"/>
</widget>
<addaction name="menuFichier"/>
<addaction name="menuAide"/>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="actionNouveauProduit"/>
<addaction name="actionSupprimerProduit"/>
<addaction name="separator"/>
<addaction name="actionGererMagasins"/>
</widget>
<action name="actionNouveauProduit">
<property name="text">
<string>Nouveau produit...</string>
</property>
<property name="shortcut">
<string>Ctrl+N</string>
</property>
</action>
<action name="actionSupprimerProduit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Supprimer le produit</string>
</property>
<property name="shortcut">
<string>Ctrl+D</string>
</property>
</action>
<action name="actionGererMagasins">
<property name="text">
<string>Gérer les magasins...</string>
</property>
</action>
<action name="actionAide">
<property name="text">
<string>Centre d'aide</string>
</property>
<property name="shortcut">
<string>F1</string>
</property>
</action>
<action name="actionAPropos">
<property name="text">
<string>À propos...</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
<include location="resources.qrc"/>
</resources>
<connections/>
</ui>

二進制
no-picture.jpg 查看文件

Before After
Width: 128  |  Height: 128  |  Size: 1.8 KiB

二進制
no-picture.xcf 查看文件


+ 170
- 0
produititem.cpp 查看文件

@@ -0,0 +1,170 @@
#include "produititem.h"
#include "ui_produititem.h"

#include <QMessageBox>

QDataStream &operator <<(QDataStream &out, const ProduitInfo &prod)
{
out << prod.nomProduit << prod.dateAchat << prod.dateFinGarantie << prod.image << prod.indexMagasin << prod.enSAV << prod.factures << prod.garanties;

return out;
}

QDataStream &operator >>(QDataStream &in, ProduitInfo &prod)
{
in >> prod.nomProduit >> prod.dateAchat >> prod.dateFinGarantie >> prod.image >> prod.indexMagasin >> prod.enSAV >> prod.factures >> prod.garanties;

return in;
}

ProduitItem::ProduitItem(QString nomProduit, QDate dateAchat, QDate dateFinGarantie, QPixmap image, int magasin,
bool enSAV, QHash<QString, QByteArray> factures, QHash<QString, QByteArray> garanties) :
QWidget(),
ui(new Ui::ProduitItem)
{
ui->setupUi(this);

this->nomProduit = nomProduit;
this->dateAchat = dateAchat;
this->dateFinGarantie = dateFinGarantie;
this->indexMagasin = magasin;
this->enSAV = enSAV;
this->factures = factures;
this->garanties = garanties;

ui->nomProduit->setText("<h1>"+nomProduit+"</h1>");
updateDescription();
this->image = image;
this->image.scaled(QSize(128, 128), Qt::KeepAspectRatio);
ui->image->setPixmap(this->image);
ui->btnMoreInfo->setToolTip("Ouvre une fenêtre contenant toutes les informations\nsur votre "+nomProduit+".");
}

ProduitItem::ProduitItem(ProduitInfo prod) :
QWidget(),
ui(new Ui::ProduitItem)
{
ProduitItem(prod.nomProduit, prod.dateAchat, prod.dateFinGarantie, prod.image, prod.indexMagasin, prod.enSAV, prod.factures, prod.garanties);
ui->setupUi(this);
}

void ProduitItem::on_btnMoreInfo_clicked()
{
InfosProduitDialog *winInfoProd = new InfosProduitDialog(this, nomProduit, dateAchat, dateFinGarantie, image, indexMagasin, enSAV, factures, garanties);
winInfoProd->setModal(true);
winInfoProd->show();
}

// Accesseurs
QPixmap ProduitItem::getImage()
{
return this->image;
}

void ProduitItem::setNomProduit(QString nomProduit)
{
this->nomProduit = nomProduit;
ui->nomProduit->setText("<h1>"+nomProduit+"</h1>");
}

void ProduitItem::setDateAchat(QDate dateAchat)
{
this->dateAchat = dateAchat;
updateDescription();
}

void ProduitItem::setDateFinGarantie(QDate dateFinGarantie)
{
this->dateFinGarantie = dateFinGarantie;
updateDescription();
}

void ProduitItem::setImage(QPixmap image)
{
this->image = image;
ui->image->setPixmap(image);
}

void ProduitItem::setMagasin(int index)
{
this->indexMagasin = index;
}

void ProduitItem::setEnSAV(bool y)
{
this->enSAV = y;
updateDescription();
}

void ProduitItem::setFactures(QHash<QString, QByteArray> factures)
{
this->factures = factures;
}

void ProduitItem::setGaranties(QHash<QString, QByteArray> garanties)
{
this->garanties = garanties;
}

// Permet de mettre à jour le petit texte en-dessous du nom du produit
void ProduitItem::updateDescription()
{
QString jourAchat = QString::number(dateAchat.day());

if(dateAchat.day() < 10)
jourAchat = "0"+jourAchat;

QString moisAchat = QString::number(dateAchat.month());

if(dateAchat.month() < 10)
moisAchat = "0"+moisAchat;

descriptionListe = "Acheté le "+jourAchat+"/"+moisAchat+"/"+QString::number(dateAchat.year())+", ";

QString jourFinGarantie = QString::number(dateFinGarantie.day());

if(dateFinGarantie.day() < 10)
jourFinGarantie = "0"+jourFinGarantie;

QString moisFinGarantie = QString::number(dateFinGarantie.month());

if(dateFinGarantie.month() < 10)
moisFinGarantie = "0"+moisFinGarantie;

if(QDate::currentDate() < dateFinGarantie)
descriptionListe += "fin de la garantie le "+jourFinGarantie+"/"+moisFinGarantie+"/"+QString::number(dateFinGarantie.year());
else
descriptionListe += "garantie expirée";

if(this->enSAV)
descriptionListe += "\nParti en SAV";

ui->infosProduit->setText(descriptionListe);
}

void ProduitItem::openDialog()
{
ui->btnMoreInfo->click();
}

// Pour la sérialisation

ProduitInfo ProduitItem::getProduitInfo()
{
ProduitInfo i;
i.nomProduit = this->nomProduit;
i.dateAchat = this->dateAchat;
i.dateFinGarantie = this->dateFinGarantie;
i.image = this->image;
i.indexMagasin = this->indexMagasin;
i.enSAV = this->enSAV;
i.factures = this->factures;
i.garanties = this->garanties;

return i;
}

ProduitItem::~ProduitItem()
{
delete ui;
}

+ 86
- 0
produititem.h 查看文件

@@ -0,0 +1,86 @@
#ifndef PRODUITITEM_H
#define PRODUITITEM_H

#include <QWidget>
#include <QPixmap>
#include <QDate>
#include <QByteArray>
#include <QHash>
#include <QDataStream>

#include "infosproduitdialog.h"

namespace Ui {
class ProduitItem;
}

struct ProduitInfo {
QString nomProduit;
QDate dateAchat, dateFinGarantie;
QPixmap image;
qint32 indexMagasin;
bool enSAV;
QHash<QString, QByteArray> factures, garanties;
};

QDataStream &operator <<(QDataStream &out, const ProduitInfo &prod);
QDataStream &operator >>(QDataStream &in, ProduitInfo &prod);


class ProduitItem : public QWidget
{
Q_OBJECT

public:
explicit ProduitItem(QString nomProduit, QDate dateAchat, QDate dateFinGarantie, QPixmap image = QPixmap(":/images/no-picture.jpg"), int magasin = 0,
bool enSAV = false, QHash<QString, QByteArray> factures = QHash<QString, QByteArray>(), QHash<QString, QByteArray> garanties = QHash<QString, QByteArray>());
explicit ProduitItem(ProduitInfo prod);
explicit ProduitItem();

/*QVector<ProduitItem*> items;

ProduitInfo info();
QVector<ProduitItem> extractInfo(QVector<ProduitItem*> const& v);
static void save(QDataStream & out, QVector<ProduitInfo> const& v);
ProduitItem* create(ProduitInfo const& info);
QVector<ProduitItem*> load(QDataStream & in);*/

// Pour la sérialisation
ProduitInfo getProduitInfo();

// Getters
QPixmap getImage();

// Setters
void setNomProduit(QString nomProduit);
void setDateAchat(QDate dateAchat);
void setDateFinGarantie(QDate dateFinGarantie);
void setImage(QPixmap image);
void setMagasin(int index); // le QString ne sert qu'à l'affichage, c'est l'index qui est utilisé par la boîte de dialogue
void setEnSAV(bool y);
void setFactures(QHash<QString, QByteArray> factures);
void setGaranties(QHash<QString, QByteArray> garanties);

void updateDescription();
void openDialog();

// Destructeur
~ProduitItem();

public slots:
void on_btnMoreInfo_clicked();

private:
Ui::ProduitItem *ui;

QString nomProduit;
QDate dateAchat, dateFinGarantie;
QString descriptionListe;
QPixmap image;
int indexMagasin;
bool enSAV;
QHash<QString, QByteArray> factures;
QHash<QString, QByteArray> garanties;
};

#endif // PRODUITITEM_H

+ 100
- 0
produititem.ui 查看文件

@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ProduitItem</class>
<widget class="QWidget" name="ProduitItem">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>717</width>
<height>195</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="image">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;img src=&quot;~/Images/sw2.jpg&quot; /&gt;</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="nomProduit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;h1&gt;Nom produit&lt;/h1&gt;</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnMoreInfo">
<property name="text">
<string>Plus d'infos...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="infosProduit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TextLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

+ 6
- 0
resources.qrc 查看文件

@@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/images">
<file>icon-hermes.png</file>
<file>no-picture.jpg</file>
</qresource>
</RCC>

Loading…
取消
儲存