18 #include <QVBoxLayout> 21 #include <QDialogButtonBox> 22 #include <QPushButton> 23 #include <QtConcurrent> 51 setWindowModality(Qt::WindowModal);
53 setWindowFlags(Qt::Sheet);
56 QVBoxLayout *layout =
new QVBoxLayout(
this);
58 QString title_, label_;
62 title_ =
tr(
"Ouvrir un élément",
"dialog title");
63 label_ =
tr(
"Choisissez l'élément que vous souhaitez ouvrir.",
"dialog content");
66 title_ =
tr(
"Enregistrer un élément",
"dialog title");
67 label_ =
tr(
"Choisissez l'élément dans lequel vous souhaitez enregistrer votre définition.",
"dialog content");
70 title_ =
tr(
"Ouvrir une catégorie",
"dialog title");
71 label_ =
tr(
"Choisissez une catégorie.",
"dialog content");
74 title_ =
tr(
"Enregistrer une catégorie",
"dialog title");
75 label_ =
tr(
"Choisissez une catégorie.",
"dialog content");
82 setWindowTitle(title_);
84 layout->addWidget(
new QLabel(label_));
91 QList <QETProject *> prjs;
109 m_buttons_box->button(QDialogButtonBox::Save)->setDisabled(
true);
120 m_buttons_box->button(QDialogButtonBox::Open)->setDisabled(
true);
134 connect(
m_buttons_box, &QDialogButtonBox::rejected,
this, &QDialog::reject);
161 m_buttons_box->button(QDialogButtonBox::Save)->setDisabled(
true);
169 m_buttons_box->button(QDialogButtonBox::Save)->setEnabled(
true);
180 if (!new_path.endsWith(
".elmt")) new_path +=
".elmt";
185 m_buttons_box->button(QDialogButtonBox::Save)->setDisabled(loc.
exist() ? true :
false);
200 tr(
"Sélection inexistante",
"message box title"),
201 tr(
"La sélection n'existe pas.",
"message box content"));
207 tr(
"Sélection incorrecte",
"message box title"),
208 tr(
"La sélection n'est pas un élément.",
"message box content"));
219 tr(
"Écraser l'élément ?",
"message box title"),
220 tr(
"L'élément existe déjà. Voulez-vous l'écraser ?",
"message box content"),
221 QMessageBox::Yes | QMessageBox::No,
223 if (answer == QMessageBox::Yes) {accept();}
231 tr(
"Sélection incorrecte",
"message box title"),
232 tr(
"Vous devez sélectionner un élément ou une catégorie avec un nom pour l'élément.",
"message box content"));
263 if (!new_path.endsWith(
".elmt")) { new_path +=
".elmt"; }
304 element_dialog->exec();
306 delete element_dialog;
The ElementCollectionItem class This class represent a item (a directory or an element) in a element ...
QDialogButtonBox * m_buttons_box
void checkCurrentLocation()
ElementDialog::checkCurrentLocation Update this dialog according to the current selected location and...
QFileNameEdit * m_text_field
static QMap< uint, QETProject * > registeredProjects()
ElementDialog(uint=ElementDialog::OpenElement, QWidget *parent=nullptr)
ElementDialog::ElementDialog.
static ElementsLocation execConfiguredDialog(int, QWidget *parent=nullptr)
ElementDialog::execConfiguredDialog launch a dialog with the chosen mode.
ElementsLocation location() const
ElementDialog::location.
bool addToPath(const QString &)
ElementsLocation::addToPath Add a string to the actual path of this location.
void loadCollections(bool common_collection, bool custom_collection, QList< QETProject *> projects)
ElementsCollectionModel::loadCollections Load the several collections in this model. Prefer use this method instead of addCommonCollection, addCustomCollection and addProject, because it use multithreading to speed up the loading. This method emit loadingMaxValue(int) for know the maximum progress value This method emit loadingProgressValue(int) for know the current progress value.
void setUpWidget()
ElementDialog::setUpWidget Build and setup the widgets of this dialog.
The dialog should select an element for saving.
The dialog should open an element.
ElementsCollectionModel * m_model
The dialog should select a category for saving.
void setUpConnection()
ElementDialog::setUpConnection Setup connection of this dialog.
bool exist() const
ElementsLocation::exist.
bool isDirectory() const
ElementsLocation::isDirectory.
virtual QString collectionPath() const =0
void indexClicked(const QModelIndex &index)
ElementDialog::indexClicked.
QMessageBox::StandardButton question(QWidget *, const QString &, const QString &, QMessageBox::StandardButtons=QMessageBox::Ok, QMessageBox::StandardButton=QMessageBox::NoButton)
bool isElement() const
ElementsLocation::isElement.
QMessageBox::StandardButton critical(QWidget *, const QString &, const QString &, QMessageBox::StandardButtons=QMessageBox::Ok, QMessageBox::StandardButton=QMessageBox::NoButton)
static ElementsLocation getOpenElementLocation(QWidget *parent=nullptr)
ElementDialog::getOpenElementLocation Display a dialog for open an element through her location...
The dialog should open a category.
ElementsLocation m_location
static ElementsLocation getSaveElementLocation(QWidget *parent=nullptr)
ElementDialog::getSaveElementLocation Display a dialog that allow to user to select an element (exist...