mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
Conversion de NewElementWizard en QWizard
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@115 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
BIN
lang/qet_en.qm
BIN
lang/qet_en.qm
Binary file not shown.
@@ -949,12 +949,12 @@ Please check rights of the directory </translation>
|
|||||||
<translation type="obsolete">Abscissa :</translation>
|
<translation type="obsolete">Abscissa :</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../newelementwizard.cpp" line="32"/>
|
<location filename="../newelementwizard.cpp" line="17"/>
|
||||||
<source>Créer un nouvel élément : Assistant</source>
|
<source>Créer un nouvel élément : Assistant</source>
|
||||||
<translation>Create a new element : wizard</translation>
|
<translation>Create a new element : wizard</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../newelementwizard.cpp" line="254"/>
|
<location filename="../newelementwizard.cpp" line="171"/>
|
||||||
<source>Erreur</source>
|
<source>Erreur</source>
|
||||||
<translation>Error</translation>
|
<translation>Error</translation>
|
||||||
</message>
|
</message>
|
||||||
@@ -966,27 +966,27 @@ Please check rights of the directory </translation>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../newelementwizard.cpp" line="143"/>
|
<location filename="../newelementwizard.cpp" line="143"/>
|
||||||
<source>Étape 1/5 : Sélectionnez une catégorie dans laquelle enregistrer le nouvel élément.</source>
|
<source>Étape 1/5 : Sélectionnez une catégorie dans laquelle enregistrer le nouvel élément.</source>
|
||||||
<translation>Step 1 of 5 : Please select a category in which to save the new element.</translation>
|
<translation type="obsolete">Step 1 of 5 : Please select a category in which to save the new element.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../newelementwizard.cpp" line="158"/>
|
<location filename="../newelementwizard.cpp" line="158"/>
|
||||||
<source>Étape 2/5 : Indiquez le nom du fichier dans lequel enregistrer le nouvel élément.</source>
|
<source>Étape 2/5 : Indiquez le nom du fichier dans lequel enregistrer le nouvel élément.</source>
|
||||||
<translation>Step 2 of 5 : Enter the filename for the new element.</translation>
|
<translation type="obsolete">Step 2 of 5 : Enter the filename for the new element.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../newelementwizard.cpp" line="179"/>
|
<location filename="../newelementwizard.cpp" line="179"/>
|
||||||
<source>Étape 3/5 : Indiquez le ou les noms de l'élément.</source>
|
<source>Étape 3/5 : Indiquez le ou les noms de l'élément.</source>
|
||||||
<translation>Step 3 of 5 : Enter the new element name(s).</translation>
|
<translation type="obsolete">Step 3 of 5 : Enter the new element name(s).</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../newelementwizard.cpp" line="197"/>
|
<location filename="../newelementwizard.cpp" line="197"/>
|
||||||
<source>Étape 4/5 : Saisissez les dimensions du nouvel élément ainsi que la position du hotspot (point de saisie de l'élément à la souris) en considérant que l'élément est dans son orientation par défaut.</source>
|
<source>Étape 4/5 : Saisissez les dimensions du nouvel élément ainsi que la position du hotspot (point de saisie de l'élément à la souris) en considérant que l'élément est dans son orientation par défaut.</source>
|
||||||
<translation>Step 4 of 5 : Enter the new element size and its hotspot position (i.e. the spot used to drag the element). Consider the element aims its default orientation.</translation>
|
<translation type="obsolete">Step 4 of 5 : Enter the new element size and its hotspot position (i.e. the spot used to drag the element). Consider the element aims its default orientation.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../newelementwizard.cpp" line="212"/>
|
<location filename="../newelementwizard.cpp" line="212"/>
|
||||||
<source>Étape 5/5 : Indiquez les orientations possibles pour le nouvel élément.</source>
|
<source>Étape 5/5 : Indiquez les orientations possibles pour le nouvel élément.</source>
|
||||||
<translation>Step 5 of 5 : Specify the the new element allowed orientations.</translation>
|
<translation type="obsolete">Step 5 of 5 : Specify the the new element allowed orientations.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../newelementwizard.cpp" line="234"/>
|
<location filename="../newelementwizard.cpp" line="234"/>
|
||||||
@@ -1009,7 +1009,7 @@ Please check rights of the directory </translation>
|
|||||||
<translation type="obsolete">Width :</translation>
|
<translation type="obsolete">Width :</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../newelementwizard.cpp" line="185"/>
|
<location filename="../newelementwizard.cpp" line="85"/>
|
||||||
<source>Nom du nouvel élément</source>
|
<source>Nom du nouvel élément</source>
|
||||||
<translation>New element name</translation>
|
<translation>New element name</translation>
|
||||||
</message>
|
</message>
|
||||||
@@ -1041,7 +1041,7 @@ Please check rights of the directory </translation>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../newelementwizard.cpp" line="22"/>
|
<location filename="../newelementwizard.cpp" line="22"/>
|
||||||
<source>Précédent</source>
|
<source>Précédent</source>
|
||||||
<translation>Back</translation>
|
<translation type="obsolete">Back</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../newelementwizard.cpp" line="204"/>
|
<location filename="../newelementwizard.cpp" line="204"/>
|
||||||
@@ -1066,33 +1066,88 @@ Please check rights of the directory </translation>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../newelementwizard.cpp" line="21"/>
|
<location filename="../newelementwizard.cpp" line="21"/>
|
||||||
<source>Suivant</source>
|
<source>Suivant</source>
|
||||||
<translation>Next</translation>
|
<translation type="obsolete">Next</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../newelementwizard.cpp" line="23"/>
|
<location filename="../newelementwizard.cpp" line="23"/>
|
||||||
<source>Valider</source>
|
<source>Valider</source>
|
||||||
<translation>Finish</translation>
|
<translation type="obsolete">Finish</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../newelementwizard.cpp" line="256"/>
|
<location filename="../newelementwizard.cpp" line="173"/>
|
||||||
<source>Vous devez entrer un nom de fichier</source>
|
<source>Vous devez entrer un nom de fichier</source>
|
||||||
<translation>You must enter a filename</translation>
|
<translation>You must enter a filename</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../newelementwizard.cpp" line="237"/>
|
<location filename="../newelementwizard.cpp" line="154"/>
|
||||||
<source>Vous devez sélectionner une catégorie.</source>
|
<source>Vous devez sélectionner une catégorie.</source>
|
||||||
<translation>You must select a category.</translation>
|
<translation>You must select a category.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../newelementwizard.cpp" line="161"/>
|
<location filename="../newelementwizard.cpp" line="62"/>
|
||||||
<source>Vous n'êtes pas obligé de préciser l'extension *.elmt. Elle sera ajoutée automatiquement.</source>
|
<source>Vous n'êtes pas obligé de préciser l'extension *.elmt. Elle sera ajoutée automatiquement.</source>
|
||||||
<translation>You don't have to specify the *.elmt extension. It will be added automatically.</translation>
|
<translation>You don't have to specify the *.elmt extension. It will be added automatically.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../newelementwizard.cpp" line="165"/>
|
<location filename="../newelementwizard.cpp" line="60"/>
|
||||||
<source>nouvel_element</source>
|
<source>nouvel_element</source>
|
||||||
<translation>new_element</translation>
|
<translation>new_element</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../newelementwizard.cpp" line="18"/>
|
||||||
|
<source>&Suivant ></source>
|
||||||
|
<translation>&Next ></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../newelementwizard.cpp" line="39"/>
|
||||||
|
<source>Étape 1/5 : Catégorie parente</source>
|
||||||
|
<translation>Step 1 of 5 : Parent Category</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../newelementwizard.cpp" line="40"/>
|
||||||
|
<source>Sélectionnez une catégorie dans laquelle enregistrer le nouvel élément.</source>
|
||||||
|
<translation>Select a category which to save the new element in.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../newelementwizard.cpp" line="56"/>
|
||||||
|
<source>Étape 2/5 : Nom du fichier</source>
|
||||||
|
<translation>Step 2 of 5 : Filename</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../newelementwizard.cpp" line="57"/>
|
||||||
|
<source>Indiquez le nom du fichier dans lequel enregistrer le nouvel élément.</source>
|
||||||
|
<translation type="unfinished">Enter the name of the file for the new element.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../newelementwizard.cpp" line="79"/>
|
||||||
|
<source>Étape 3/5 : Noms de l'élément</source>
|
||||||
|
<translation>Step 3 of 5 : Element names</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../newelementwizard.cpp" line="80"/>
|
||||||
|
<source>Indiquez le ou les noms de l'élément.</source>
|
||||||
|
<translation>Enter one or more names for the element.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../newelementwizard.cpp" line="99"/>
|
||||||
|
<source>Étape 4/5 : Dimensions et point de saisie</source>
|
||||||
|
<translation>Step 4 of 5 : Size and hotspot</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../newelementwizard.cpp" line="100"/>
|
||||||
|
<source>Saisissez les dimensions du nouvel élément ainsi que la position du hotspot (point de saisie de l'élément à la souris) en considérant que l'élément est dans son orientation par défaut.</source>
|
||||||
|
<translation>Enter the new element size and its hotspot, considering the element is default-oriented.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../newelementwizard.cpp" line="117"/>
|
||||||
|
<source>Étape 5/5 : Orientations</source>
|
||||||
|
<translation>Step 5 of 5 : Orientations</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../newelementwizard.cpp" line="118"/>
|
||||||
|
<source>Indiquez les orientations possibles pour le nouvel élément.</source>
|
||||||
|
<translation>Enter the allowed and forbidden orientations for the new element.</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>OrientationSetWidget</name>
|
<name>OrientationSetWidget</name>
|
||||||
|
|||||||
@@ -12,48 +12,16 @@
|
|||||||
@param parent QWidget parent de ce dialogue
|
@param parent QWidget parent de ce dialogue
|
||||||
@param f flags pour le dialogue
|
@param f flags pour le dialogue
|
||||||
*/
|
*/
|
||||||
NewElementWizard::NewElementWizard(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) {
|
NewElementWizard::NewElementWizard(QWidget *parent, Qt::WindowFlags f) : QWizard(parent, f) {
|
||||||
setFixedSize(480, 280);
|
setPixmap(LogoPixmap, QPixmap(":/ico/qelectrotech.png").scaled(64, 64, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||||
QVBoxLayout *dialog_layout = new QVBoxLayout();
|
|
||||||
setLayout(dialog_layout);
|
|
||||||
|
|
||||||
// chaines de caracteres utilisees sur les boutons
|
|
||||||
str_next = QString(tr("Suivant"));
|
|
||||||
str_previous = QString(tr("Pr\351c\351dent"));
|
|
||||||
str_finish = QString(tr("Valider"));
|
|
||||||
|
|
||||||
buildStep1();
|
|
||||||
buildStep2();
|
|
||||||
buildStep3();
|
|
||||||
buildStep4();
|
|
||||||
buildStep5();
|
|
||||||
|
|
||||||
// dialogue itself
|
|
||||||
setWindowTitle(tr("Cr\351er un nouvel \351l\351ment : Assistant"));
|
setWindowTitle(tr("Cr\351er un nouvel \351l\351ment : Assistant"));
|
||||||
|
setButtonText(QWizard::NextButton, tr("&Suivant >"));
|
||||||
dialog_layout -> addWidget(step1);
|
addPage(buildStep1());
|
||||||
dialog_layout -> addWidget(step2);
|
addPage(buildStep2());
|
||||||
dialog_layout -> addWidget(step3);
|
addPage(buildStep3());
|
||||||
dialog_layout -> addWidget(step4);
|
addPage(buildStep4());
|
||||||
dialog_layout -> addWidget(step5);
|
addPage(buildStep5());
|
||||||
step2 -> hide();
|
setFixedSize(705, 325);
|
||||||
step3 -> hide();
|
|
||||||
step4 -> hide();
|
|
||||||
step5 -> hide();
|
|
||||||
|
|
||||||
// boutons
|
|
||||||
QDialogButtonBox *boutons = new QDialogButtonBox(QDialogButtonBox::Cancel);
|
|
||||||
button_previous = new QPushButton(str_previous, this);
|
|
||||||
button_previous -> setEnabled(false);
|
|
||||||
button_next = new QPushButton(str_next, this);
|
|
||||||
boutons -> addButton(button_previous, QDialogButtonBox::ActionRole);
|
|
||||||
boutons -> addButton(button_next, QDialogButtonBox::ActionRole);
|
|
||||||
connect(button_previous, SIGNAL(released()), this, SLOT(previous()));
|
|
||||||
connect(button_next, SIGNAL(released()), this, SLOT(next()));
|
|
||||||
connect(boutons, SIGNAL(rejected()), this, SLOT(accept()));
|
|
||||||
dialog_layout -> addWidget(boutons);
|
|
||||||
current_state = Category;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -62,164 +30,113 @@ NewElementWizard::NewElementWizard(QWidget *parent, Qt::WindowFlags f) : QDialog
|
|||||||
NewElementWizard::~NewElementWizard() {
|
NewElementWizard::~NewElementWizard() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Passe a l'etape precedente
|
|
||||||
*/
|
|
||||||
void NewElementWizard::previous() {
|
|
||||||
switch(current_state) {
|
|
||||||
case Category:
|
|
||||||
return;
|
|
||||||
case Filename:
|
|
||||||
current_state = Category;
|
|
||||||
step1 -> show();
|
|
||||||
step2 -> hide();
|
|
||||||
button_previous -> setEnabled(false);
|
|
||||||
break;
|
|
||||||
case Names:
|
|
||||||
current_state = Filename;
|
|
||||||
step2 -> show();
|
|
||||||
qle_filename -> setFocus();
|
|
||||||
step3 -> hide();
|
|
||||||
break;
|
|
||||||
case Dimensions:
|
|
||||||
current_state = Names;
|
|
||||||
step3 -> show();
|
|
||||||
step4 -> hide();
|
|
||||||
button_next -> setText(str_next);
|
|
||||||
break;
|
|
||||||
case Orientations:
|
|
||||||
current_state = Dimensions;
|
|
||||||
step4 -> show();
|
|
||||||
step5 -> hide();
|
|
||||||
button_next -> setText(str_next);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Passe a l'etape suivante
|
|
||||||
*/
|
|
||||||
void NewElementWizard::next() {
|
|
||||||
switch(current_state) {
|
|
||||||
case Category:
|
|
||||||
if (!validStep1()) return;
|
|
||||||
current_state = Filename;
|
|
||||||
step1 -> hide();
|
|
||||||
step2 -> show();
|
|
||||||
qle_filename -> setFocus();
|
|
||||||
button_previous -> setEnabled(true);
|
|
||||||
break;
|
|
||||||
case Filename:
|
|
||||||
if (!validStep2()) return;
|
|
||||||
current_state = Names;
|
|
||||||
step2 -> hide();
|
|
||||||
step3 -> show();
|
|
||||||
break;
|
|
||||||
case Names:
|
|
||||||
if (!validStep3()) return;
|
|
||||||
current_state = Dimensions;
|
|
||||||
step3 -> hide();
|
|
||||||
step4 -> show();
|
|
||||||
break;
|
|
||||||
case Dimensions:
|
|
||||||
if (!validStep4()) return;
|
|
||||||
current_state = Orientations;
|
|
||||||
step4 -> hide();
|
|
||||||
step5 -> show();
|
|
||||||
button_next -> setText(str_finish);
|
|
||||||
button_previous -> setEnabled(true);
|
|
||||||
break;
|
|
||||||
case Orientations:
|
|
||||||
if (!validStep5()) return;
|
|
||||||
createNewElement();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Met en place l'etape 1 : Categorie
|
Met en place l'etape 1 : Categorie
|
||||||
*/
|
*/
|
||||||
void NewElementWizard::buildStep1() {
|
QWizardPage *NewElementWizard::buildStep1() {
|
||||||
step1 = new QWidget(this);
|
QWizardPage *page = new QWizardPage();
|
||||||
QVBoxLayout *step1_layout = new QVBoxLayout();
|
page -> setProperty("WizardState", Category);
|
||||||
QLabel *explication = new QLabel(tr("\311tape 1/5 : S\351lectionnez une cat\351gorie dans laquelle enregistrer le nouvel \351l\351ment."));
|
page -> setTitle(tr("\311tape 1/5 : Cat\351gorie parente"));
|
||||||
explication -> setAlignment(Qt::AlignJustify | Qt::AlignVCenter);
|
page -> setSubTitle(tr("S\351lectionnez une cat\351gorie dans laquelle enregistrer le nouvel \351l\351ment."));
|
||||||
explication -> setWordWrap(true);
|
QVBoxLayout *layout = new QVBoxLayout();
|
||||||
step1_layout -> addWidget(explication);
|
|
||||||
categories_list = new ElementsCategoriesWidget();
|
categories_list = new ElementsCategoriesWidget();
|
||||||
step1_layout -> addWidget(categories_list);
|
layout -> addWidget(categories_list);
|
||||||
step1 -> setLayout(step1_layout);
|
|
||||||
|
page -> setLayout(layout);
|
||||||
|
return(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Met en place l'etape 2 : Nom du fichier
|
Met en place l'etape 2 : Nom du fichier
|
||||||
*/
|
*/
|
||||||
void NewElementWizard::buildStep2() {
|
QWizardPage *NewElementWizard::buildStep2() {
|
||||||
step2 = new QWidget(this);
|
QWizardPage *page = new QWizardPage();
|
||||||
QVBoxLayout *step2_layout = new QVBoxLayout();
|
page -> setProperty("WizardState", Filename);
|
||||||
QLabel *explication1 = new QLabel(tr("\311tape 2/5 : Indiquez le nom du fichier dans lequel enregistrer le nouvel \351l\351ment."));
|
page -> setTitle(tr("\311tape 2/5 : Nom du fichier"));
|
||||||
explication1 -> setAlignment(Qt::AlignJustify | Qt::AlignVCenter);
|
page -> setSubTitle(tr("Indiquez le nom du fichier dans lequel enregistrer le nouvel \351l\351ment."));
|
||||||
explication1 -> setWordWrap(true);
|
QVBoxLayout *layout = new QVBoxLayout();
|
||||||
|
|
||||||
|
qle_filename = new QLineEdit(tr("nouvel_element"));
|
||||||
|
qle_filename -> selectAll();
|
||||||
QLabel *explication2 = new QLabel(tr("Vous n'\352tes pas oblig\351 de pr\351ciser l'extension *.elmt. Elle sera ajout\351e automatiquement."));
|
QLabel *explication2 = new QLabel(tr("Vous n'\352tes pas oblig\351 de pr\351ciser l'extension *.elmt. Elle sera ajout\351e automatiquement."));
|
||||||
explication2 -> setAlignment(Qt::AlignJustify | Qt::AlignVCenter);
|
explication2 -> setAlignment(Qt::AlignJustify | Qt::AlignVCenter);
|
||||||
explication2 -> setWordWrap(true);
|
explication2 -> setWordWrap(true);
|
||||||
step2_layout -> addWidget(explication1);
|
layout -> addWidget(qle_filename);
|
||||||
qle_filename = new QLineEdit(tr("nouvel_element"));
|
layout -> addWidget(explication2);
|
||||||
qle_filename -> selectAll();
|
layout -> addSpacing(100);
|
||||||
step2_layout -> addWidget(qle_filename);
|
|
||||||
step2_layout -> addWidget(explication2);
|
page -> setLayout(layout);
|
||||||
step2_layout -> addSpacing(100);
|
return(page);
|
||||||
step2 -> setLayout(step2_layout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Met en place l'etape 3 : Noms de l'element
|
Met en place l'etape 3 : Noms de l'element
|
||||||
*/
|
*/
|
||||||
void NewElementWizard::buildStep3() {
|
QWizardPage *NewElementWizard::buildStep3() {
|
||||||
step3 = new QWidget(this);
|
QWizardPage *page = new QWizardPage();
|
||||||
QVBoxLayout *step3_layout = new QVBoxLayout();
|
page -> setProperty("WizardState", Names);
|
||||||
QLabel *explication = new QLabel(tr("\311tape 3/5 : Indiquez le ou les noms de l'\351l\351ment."));
|
page -> setTitle(tr("\311tape 3/5 : Noms de l'\351l\351ment"));
|
||||||
explication -> setAlignment(Qt::AlignJustify | Qt::AlignVCenter);
|
page -> setSubTitle(tr("Indiquez le ou les noms de l'\351l\351ment."));
|
||||||
explication -> setWordWrap(true);
|
QVBoxLayout *layout = new QVBoxLayout();
|
||||||
step3_layout -> addWidget(explication);
|
|
||||||
element_names = new NamesListWidget();
|
element_names = new NamesListWidget();
|
||||||
NamesList hash_name;
|
NamesList hash_name;
|
||||||
hash_name.addName(QLocale::system().name().left(2), tr("Nom du nouvel \351l\351ment"));
|
hash_name.addName(QLocale::system().name().left(2), tr("Nom du nouvel \351l\351ment"));
|
||||||
element_names -> setNames(hash_name);
|
element_names -> setNames(hash_name);
|
||||||
step3_layout -> addWidget(element_names);
|
layout -> addWidget(element_names);
|
||||||
step3 -> setLayout(step3_layout);
|
|
||||||
|
page -> setLayout(layout);
|
||||||
|
return(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Met en place l'etape 4 : Dimensions et Hotspot
|
Met en place l'etape 4 : Dimensions et Hotspot
|
||||||
*/
|
*/
|
||||||
void NewElementWizard::buildStep4() {
|
QWizardPage *NewElementWizard::buildStep4() {
|
||||||
step4 = new QWidget(this);
|
QWizardPage *page = new QWizardPage();
|
||||||
QVBoxLayout *step4_layout = new QVBoxLayout(step4);
|
page -> setProperty("WizardState", Dimensions);
|
||||||
QLabel *explication = new QLabel(tr("\311tape 4/5 : Saisissez les dimensions du nouvel \351l\351ment ainsi que la position du hotspot (point de saisie de l'\351l\351ment \340 la souris) en consid\351rant que l'\351l\351ment est dans son orientation par d\351faut."));
|
page -> setTitle(tr("\311tape 4/5 : Dimensions et point de saisie"));
|
||||||
explication -> setAlignment(Qt::AlignJustify | Qt::AlignVCenter);
|
page -> setSubTitle(tr("Saisissez les dimensions du nouvel \351l\351ment ainsi que la position du hotspot (point de saisie de l'\351l\351ment \340 la souris) en consid\351rant que l'\351l\351ment est dans son orientation par d\351faut."));
|
||||||
explication -> setWordWrap(true);
|
QVBoxLayout *layout = new QVBoxLayout();
|
||||||
step4_layout -> addWidget(explication);
|
|
||||||
hotspot_editor = new HotspotEditor();
|
hotspot_editor = new HotspotEditor();
|
||||||
step4_layout -> addWidget(hotspot_editor, 0);
|
layout -> addWidget(hotspot_editor, 0);
|
||||||
step4_layout -> setSpacing(0);
|
layout -> setSpacing(0);
|
||||||
|
|
||||||
|
page -> setLayout(layout);
|
||||||
|
return(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Met en place l'etape 5 : orientations possibles pour le nouvel element
|
Met en place l'etape 5 : orientations possibles pour le nouvel element
|
||||||
*/
|
*/
|
||||||
void NewElementWizard::buildStep5() {
|
QWizardPage *NewElementWizard::buildStep5() {
|
||||||
step5 = new QWidget(this);
|
QWizardPage *page = new QWizardPage();
|
||||||
|
page -> setProperty("WizardState", Orientations);
|
||||||
QLabel *explication = new QLabel(tr("\311tape 5/5 : Indiquez les orientations possibles pour le nouvel \351l\351ment."));
|
page -> setTitle(tr("\311tape 5/5 : Orientations"));
|
||||||
explication -> setAlignment(Qt::AlignJustify | Qt::AlignVCenter);
|
page -> setSubTitle(tr("Indiquez les orientations possibles pour le nouvel \351l\351ment."));
|
||||||
explication -> setWordWrap(true);
|
QVBoxLayout *layout = new QVBoxLayout();
|
||||||
|
|
||||||
orientation_set = new OrientationSetWidget();
|
orientation_set = new OrientationSetWidget();
|
||||||
|
layout -> addWidget(orientation_set);
|
||||||
|
layout -> addSpacing(25);
|
||||||
|
|
||||||
QVBoxLayout *step5_layout = new QVBoxLayout();
|
page -> setLayout(layout);
|
||||||
step5_layout -> addWidget(explication);
|
return(page);
|
||||||
step5_layout -> addWidget(orientation_set);
|
}
|
||||||
step5_layout -> addSpacing(25);
|
|
||||||
step5 -> setLayout(step5_layout);
|
/// @return true si l'etape en cours est validee, false sinon
|
||||||
|
bool NewElementWizard::validateCurrentPage() {
|
||||||
|
WizardState wizard_state = static_cast<WizardState>(currentPage() -> property("WizardState").toInt());
|
||||||
|
if (wizard_state == Category) return(validStep1());
|
||||||
|
else if (wizard_state == Filename) return(validStep2());
|
||||||
|
else if (wizard_state == Names) return(element_names -> checkOneName()); // il doit y avoir au moins un nom
|
||||||
|
else if (wizard_state == Orientations) {
|
||||||
|
createNewElement();
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
else return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -275,35 +192,6 @@ bool NewElementWizard::validStep2() {
|
|||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Valide l'etape 3
|
|
||||||
@return true si l'etape est validee, false sinon
|
|
||||||
*/
|
|
||||||
bool NewElementWizard::validStep3() {
|
|
||||||
// il doit y avoir au moins un nom
|
|
||||||
return(element_names -> checkOneName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Valide l'etape 4
|
|
||||||
@return true si l'etape est validee, false sinon
|
|
||||||
*/
|
|
||||||
bool NewElementWizard::validStep4() {
|
|
||||||
// l'editeur de hotspot se charge deja de valider tout ca
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Valide l'etape 5
|
|
||||||
Cette fonction s'assure qu'il y ait toujours exactement une orientation
|
|
||||||
"par defaut"
|
|
||||||
@return true si l'etape est validee, false sinon
|
|
||||||
*/
|
|
||||||
bool NewElementWizard::validStep5() {
|
|
||||||
// l'editeur d'orientations se charge deja de valider tout ca
|
|
||||||
return(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Cree le nouvel element
|
Cree le nouvel element
|
||||||
*/
|
*/
|
||||||
@@ -315,5 +203,4 @@ void NewElementWizard::createNewElement() {
|
|||||||
edit_new_element -> setOrientations(orientation_set -> orientationSet());
|
edit_new_element -> setOrientations(orientation_set -> orientationSet());
|
||||||
edit_new_element -> setFileName(chosen_file);
|
edit_new_element -> setFileName(chosen_file);
|
||||||
edit_new_element -> show();
|
edit_new_element -> show();
|
||||||
accept();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class ElementsCategoriesWidget;
|
|||||||
class NamesListWidget;
|
class NamesListWidget;
|
||||||
class OrientationSetWidget;
|
class OrientationSetWidget;
|
||||||
class HotspotEditor;
|
class HotspotEditor;
|
||||||
class NewElementWizard : public QDialog {
|
class NewElementWizard : public QWizard {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
// constructeurs, destructeur
|
// constructeurs, destructeur
|
||||||
@@ -30,34 +30,24 @@ class NewElementWizard : public QDialog {
|
|||||||
// attributs
|
// attributs
|
||||||
private:
|
private:
|
||||||
enum WizardState { Category, Filename, Names, Dimensions, Orientations };
|
enum WizardState { Category, Filename, Names, Dimensions, Orientations };
|
||||||
QString str_next, str_previous, str_finish;
|
|
||||||
QWidget *step1, *step2, *step3, *step4, *step5;
|
|
||||||
ElementsCategoriesWidget* categories_list;
|
ElementsCategoriesWidget* categories_list;
|
||||||
QLineEdit *qle_filename;
|
QLineEdit *qle_filename;
|
||||||
NamesListWidget *element_names;
|
NamesListWidget *element_names;
|
||||||
OrientationSetWidget *orientation_set;
|
OrientationSetWidget *orientation_set;
|
||||||
HotspotEditor *hotspot_editor;
|
HotspotEditor *hotspot_editor;
|
||||||
QPushButton *button_previous;
|
|
||||||
QPushButton *button_next;
|
|
||||||
WizardState current_state;
|
WizardState current_state;
|
||||||
QString chosen_file;
|
QString chosen_file;
|
||||||
|
|
||||||
// methodes
|
// methodes
|
||||||
private:
|
private:
|
||||||
void buildStep1();
|
QWizardPage *buildStep1();
|
||||||
void buildStep2();
|
QWizardPage *buildStep2();
|
||||||
void buildStep3();
|
QWizardPage *buildStep3();
|
||||||
void buildStep4();
|
QWizardPage *buildStep4();
|
||||||
void buildStep5();
|
QWizardPage *buildStep5();
|
||||||
bool validStep1();
|
bool validStep1();
|
||||||
bool validStep2();
|
bool validStep2();
|
||||||
bool validStep3();
|
bool validateCurrentPage();
|
||||||
bool validStep4();
|
|
||||||
bool validStep5();
|
|
||||||
void createNewElement();
|
void createNewElement();
|
||||||
|
|
||||||
public slots:
|
|
||||||
void previous();
|
|
||||||
void next();
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user