23 #include <qmessagebox.h>
24 #include <qpushbutton.h>
25 #include <qlineedit.h>
28 #include <QGridLayout>
30 #include <QHBoxLayout>
33 #include "Tympan/core/config.h"
40 #define TR(id) OLocalizator::getString("TYAddLibraryDialog", (id))
43 : QDialog(parent, f), _element(0)
46 setWindowTitle(
TR(
"id_caption"));
49 QGridLayout* pLayout =
new QGridLayout();
57 QBoxLayout* pNameLayout =
new QHBoxLayout(
this);
58 pNameLayout->setContentsMargins(5, 5, 5, 5);
59 pNameLayout->setSpacing(5);
60 pLayout->addLayout(pNameLayout, 1, 0);
61 pNameLayout->setAlignment(Qt::AlignLeft);
72 QBoxLayout* pBtnLayout =
new QHBoxLayout();
73 pLayout->addLayout(pBtnLayout, 2, 0);
74 pBtnLayout->addStretch(1);
81 QPushButton* pCloseBtn =
new QPushButton(
TR(
"id_cancel_btn"),
this);
82 pCloseBtn->setShortcut(Qt::Key_Escape);
83 QObject::connect(pCloseBtn, &QPushButton::clicked,
this, &TYAddLibraryDialog::reject);
84 pBtnLayout->addWidget(pCloseBtn);
118 if (
name.section(
".", -1, -1) ==
"xml")
125 int i = eltsList.indexOf(
name);
128 if (QMessageBox::question(
this,
TR(
"id_box_caption"),
TR(
"id_box_text").arg(
name),
TR(
"id_box_yes"),
129 TR(
"id_box_no"), QString(), 0, 1))
135 TYApplication::setOverrideCursor(Qt::WaitCursor);
141 QString version(TY_PRODUCT_VERSION_);
142 QString tiret(
" - ");
143 QString licencie(TY_CUSTOMER_);
144 QString licenceNumber(TY_LICENCE_NUMBER_);
146 QString messageVersion = version + tiret + licencie + tiret + licenceNumber;
148 xmlManager.
createDoc(TY_PRODUCT_XMLTAG_, messageVersion);
151 if (xmlManager.
save(filename) == 0)
153 QMessageBox::information(
this,
"Tympan",
TR(
"id_export_ok").arg(
name));
157 QMessageBox::warning(
this,
"Tympan",
TR(
"id_export_failed").arg(
name));
160 TYApplication::restoreOverrideCursor();
Boite de dialogue pour l'ajout d'un element dans la bibliotheque (fichier header)
pour l'application Tympan (fichier header)
TYAddLibraryDialog(QWidget *parent=0, const char *name=0, Qt::WindowFlags f=QFlag(0))
Constructeur par defaut.
QPushButton * _pSaveBtn
Le bouton de sauvegarde.
QLineEdit * _lineEditName
Le nom de sauvegarde.
LPTYElement _element
Element a sauvegarder.
void setElement(LPTYElement element)
Acces a l'element.
virtual ~TYAddLibraryDialog()
Destructeur.
TYLibraryWidget * _pLibrary
La librarie.
void setEnableButton(const QString &)
Active ou non le bouton _pSaveBtn.
int save(QString fileName)
void createDoc(QString docName, QString version)
int addElement(TYElement *pElt)