Kaynağa Gözat

Version 0.6 finale

* Les magasins sont maintenant supprimés automatiquement lorsque plus aucun produit ne l'utilise
- Suppression du gestionnaire de magasins
tags/0.7
Jérôme Deuchnord 10 yıl önce
ebeveyn
işleme
592d51c949
10 değiştirilmiş dosya ile 272 ekleme ve 2547 silme
  1. +0
    -3
      deuchnord-hermes.pro
  2. +260
    -0
      deuchnord-hermes.pro.user
  3. +0
    -111
      gestionmagasinsdialog.cpp
  4. +0
    -34
      gestionmagasinsdialog.h
  5. +0
    -121
      gestionmagasinsdialog.ui
  6. +10
    -28
      mainwindow.cpp
  7. +0
    -2
      mainwindow.h
  8. +0
    -8
      mainwindow.ui
  9. +2
    -2
      manufacturersmanager.cpp
  10. +0
    -2238
      twain.h~

+ 0
- 3
deuchnord-hermes.pro Dosyayı Görüntüle

@@ -19,7 +19,6 @@ SOURCES += main.cpp\
mainwindow.cpp \
produititem.cpp \
infosproduitdialog.cpp \
gestionmagasinsdialog.cpp \
aboutdialog.cpp \
scannerdialog.cpp \
settingsdialog.cpp \
@@ -28,7 +27,6 @@ SOURCES += main.cpp\
HEADERS += mainwindow.h \
produititem.h \
infosproduitdialog.h \
gestionmagasinsdialog.h \
aboutdialog.h \
scannerdialog.h \
settingsdialog.h \
@@ -37,7 +35,6 @@ HEADERS += mainwindow.h \
FORMS += mainwindow.ui \
produititem.ui \
infosproduitdialog.ui \
gestionmagasinsdialog.ui \
aboutdialog.ui \
scannerdialog.ui \
settingsdialog.ui


+ 260
- 0
deuchnord-hermes.pro.user Dosyayı Görüntüle

@@ -0,0 +1,260 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.0.1, 2014-10-25T08:24:30. -->
<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">{2157df79-1791-47ad-9a95-001dcb0085a2}</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/workspace/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/workspace/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/workspace/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">{53b8b60b-5d09-48ff-a525-dac66a55b740}</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">15</value>
</data>
</qtcreator>

+ 0
- 111
gestionmagasinsdialog.cpp Dosyayı Görüntüle

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

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

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

settings = new QSettings("Deuchnord", "Hermes");
placeSave = settings->value("placeSave").toString();

QFile fichierMagasins(placeSave+"/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()
{
QString nom = QInputDialog::getText(this, tr("Ajouter un magasin"), tr("Veuillez entrer le nom du nouveau magasin :"));
if(nom != "")
{
int nb = ui->listMagasins->count();
bool alreadyHere = false;
for(int i = 0; i < nb; i++)
{
QString magasin = ui->listMagasins->item(i)->text();
if(magasin.toLower() == nom.toLower())
alreadyHere = true;
}

if(alreadyHere)
QMessageBox::warning(this, tr("Ajout impossible"), tr("Le magasin est déjà présent dans la liste !"));
else
ui->listMagasins->addItem(nom);
}
}

void GestionMagasinsDialog::on_btnSupprMagasin_clicked()
{
if(QMessageBox::question(this, tr("Suppression"), tr("Voulez-vous vraiment supprimer ce magasin ?<br />Tous les produits associés perdront cette information, <em>même si vous cliquez sur Annuler plus tard</em>."), QMessageBox::Yes|QMessageBox::No) == QMessageBox::Yes)
{
int row = ui->listMagasins->currentRow();
delete ui->listMagasins->currentItem();
emit magasinDeleted(row);
}
}

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(placeSave+"/deuchnord-hermes/manufacturers.xml");
if(fileManu.open(QFile::WriteOnly))
{
fileManu.write(dom.toString().toUtf8());
fileManu.close();
}
}

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

+ 0
- 34
gestionmagasinsdialog.h Dosyayı Görüntüle

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

#include <QDialog>
#include <QSettings>

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();

signals:
void magasinDeleted(int indexMagasin);

private:
Ui::GestionMagasinsDialog *ui;
QSettings *settings;
QString placeSave;
};

#endif // GESTIONMAGASINSDIALOG_H

+ 0
- 121
gestionmagasinsdialog.ui Dosyayı Görüntüle

@@ -1,121 +0,0 @@
<?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="toolTip">
<string>Ajouter</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/add.png</normaloff>:/icons/add.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnSupprMagasin">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Supprimer</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/remove.png</normaloff>:/icons/remove.png</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>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="resources.qrc"/>
</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>

+ 10
- 28
mainwindow.cpp Dosyayı Görüntüle

@@ -1,9 +1,9 @@
#include "mainwindow.h"
#include "produititem.h"
#include "gestionmagasinsdialog.h"
#include "aboutdialog.h"
#include "settingsdialog.h"
#include "ui_mainwindow.h"
#include "manufacturersmanager.h"

#include <QSpacerItem>
#include <QWidget>
@@ -168,16 +168,16 @@ void MainWindow::on_actionSupprimerProduit_triggered(bool dontAskConfirm)
ui->listeProduits->setCurrentRow(ui->listeProduits->row(item));

// Étape 1 : on vérifie si le magasin du produit est encore utilisé par d'autres produits
ProduitItem prodToRemove = ((ProduitItem) ui->listeProduits->itemWidget(item));
int manufacturer = prodToRemove.getMagasin();
ProduitItem *prodToRemove = ((ProduitItem*) ui->listeProduits->itemWidget(item));
int manufacturer = prodToRemove->getMagasin();
bool manufacturerIsUsedByAnotherProduct = false;
for(int i = 0; i < ui->listeProduits->count(); i++) {

if(i != ui->listeProduits->currentRow()) {

QListWidgetItem *itemProd = ui->listeProduits->item(i);
ProduitItem prod = (ProduitItem) ui->listeProduits->itemWidget(itemProd);
if(prod.getMagasin() == manufacturer)
ProduitItem *prod = (ProduitItem*) ui->listeProduits->itemWidget(itemProd);
if(prod->getMagasin() == manufacturer)
manufacturerIsUsedByAnotherProduct = true;

}
@@ -185,7 +185,11 @@ void MainWindow::on_actionSupprimerProduit_triggered(bool dontAskConfirm)
}

// Si le magasin n'est plus utilisé, on le supprime
// TODO écrire le code correspondant
if(!manufacturerIsUsedByAnotherProduct) {
ManufacturersManager mg;
mg.deleteManufacturer(manufacturer);
mg.save();
}

// Étae 2 : on suppprime le produit
ui->listeProduits->removeItemWidget(item);
@@ -200,28 +204,6 @@ void MainWindow::on_actionSupprimerProduit_triggered(bool dontAskConfirm)
}
}

void MainWindow::on_actionGererMagasins_triggered()
{
GestionMagasinsDialog *dialog = new GestionMagasinsDialog(this);
dialog->setModal(true);
dialog->show();
connect(dialog, SIGNAL(magasinDeleted(int)), SLOT(magasinDeleted(int)));
}

void MainWindow::magasinDeleted(int indexMagasin)
{
// Si un magasin a été supprimé, on change le magasin pour une valeur vide.

for(int i = 0; i < ui->listeProduits->count(); i++)
{
ProduitItem* item = (ProduitItem*) ui->listeProduits->itemWidget(ui->listeProduits->item(i));
if(item->getMagasin() == indexMagasin)
item->setMagasin(-1);
if(item->getMagasin() > indexMagasin)
item->setMagasin(item->getMagasin()-1);
}
}

QListWidgetItem* MainWindow::ajouterProduit(ProduitItem *produit)
{
QListWidgetItem *widgetItem = new QListWidgetItem();


+ 0
- 2
mainwindow.h Dosyayı Görüntüle

@@ -29,8 +29,6 @@ public slots:
void searchProduit(QString search);
void on_actionNouveauProduit_triggered();
void on_actionSupprimerProduit_triggered(bool dontAskConfirm = true);
void on_actionGererMagasins_triggered();
void magasinDeleted(int indexMagasin);
void on_actionAPropos_triggered();
void on_actionAide_triggered();
void on_actionReportBug_triggered();


+ 0
- 8
mainwindow.ui Dosyayı Görüntüle

@@ -43,7 +43,6 @@
<addaction name="actionNouveauProduit"/>
<addaction name="actionSupprimerProduit"/>
<addaction name="separator"/>
<addaction name="actionGererMagasins"/>
</widget>
<widget class="QMenu" name="menuAide">
<property name="title">
@@ -75,8 +74,6 @@
</attribute>
<addaction name="actionNouveauProduit"/>
<addaction name="actionSupprimerProduit"/>
<addaction name="separator"/>
<addaction name="actionGererMagasins"/>
</widget>
<widget class="QStatusBar" name="statusBar">
<property name="sizeGripEnabled">
@@ -99,11 +96,6 @@
<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>


+ 2
- 2
manufacturersmanager.cpp Dosyayı Görüntüle

@@ -51,7 +51,7 @@ void ManufacturersManager::deleteManufacturer(int manufacturerToDelete) {

}

ManufacturersManager::save() {
void ManufacturersManager::save() {

QDomDocument dom("manufacturers");
QDomElement rootElement = dom.createElement("manufacturers");
@@ -60,7 +60,7 @@ ManufacturersManager::save() {
for(QString manufacturer : manufacturers) {

QDomElement domManufacturer = dom.createElement("manufacturer");
root.appendChild(domManufacturer);
rootElement.appendChild(domManufacturer);
QDomText textManufacturer = dom.createTextNode(manufacturer);
domManufacturer.appendChild(textManufacturer);



+ 0
- 2238
twain.h~
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


Yükleniyor…
İptal
Kaydet