QElectroTech  0.8-dev
elementdialog.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2020 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef ELEMENT_DIALOG_H
19 #define ELEMENT_DIALOG_H
20 
21 #include <QDialog>
22 #include "elementslocation.h"
23 
24 class QDialogButtonBox;
25 class QFileNameEdit;
26 class QTreeView;
28 
33 class ElementDialog : public QDialog
34 {
35  Q_OBJECT
36  // enumerations
40  enum {
44  SaveCategory = 3
45  };
46 
47  // constructors, destructor
48  public:
49  ElementDialog(uint = ElementDialog::OpenElement, QWidget *parent = nullptr);
50  private:
52 
53  public:
54  ElementsLocation location() const;
55 
56  private:
57  void setUpWidget();
58  void setUpConnection();
59  void indexClicked(const QModelIndex &index);
60  void updateWidget();
61  void checkCurrentLocation();
62  void checkAccept();
63 
64  // attributes
65  private:
66  uint m_mode;
68  QDialogButtonBox *m_buttons_box = nullptr;
70  QTreeView *m_tree_view = nullptr;
72 
73  public:
74  static ElementsLocation getOpenElementLocation(QWidget *parent = nullptr);
75  static ElementsLocation getSaveElementLocation(QWidget *parent = nullptr);
76  private:
77  static ElementsLocation execConfiguredDialog(int, QWidget *parent = nullptr);
78 
79 };
80 #endif
ElementsLocation::exist
bool exist() const
ElementsLocation::exist.
Definition: elementslocation.cpp:472
qfilenameedit.h
ElementDialog::ElementDialog
ElementDialog(const ElementDialog &)
ElementsCollectionModel::loadCollections
void loadCollections(bool common_collection, bool custom_collection, QList< QETProject * > projects)
ElementsCollectionModel::loadCollections Load the several collections in this model....
Definition: elementscollectionmodel.cpp:259
elementscollectionmodel.h
ElementDialog::indexClicked
void indexClicked(const QModelIndex &index)
ElementDialog::indexClicked.
Definition: elementdialog.cpp:143
QFileNameEdit
Definition: qfilenameedit.h:32
ElementCollectionItem::collectionPath
virtual QString collectionPath() const =0
elementcollectionitem.h
qetmessagebox.h
ElementCollectionItem
The ElementCollectionItem class This class represent a item (a directory or an element) in a element ...
Definition: elementcollectionitem.h:30
ElementDialog::SaveCategory
@ SaveCategory
The dialog should select a category for saving.
Definition: elementdialog.h:44
ElementDialog::OpenCategory
@ OpenCategory
The dialog should open a category.
Definition: elementdialog.h:43
ElementDialog::getOpenElementLocation
static ElementsLocation getOpenElementLocation(QWidget *parent=nullptr)
ElementDialog::getOpenElementLocation Display a dialog for open an element through her location.
Definition: elementdialog.cpp:280
qetapp.h
ElementsLocation::isElement
bool isElement() const
ElementsLocation::isElement.
Definition: elementslocation.cpp:412
ElementDialog::setUpConnection
void setUpConnection()
ElementDialog::setUpConnection Setup connection of this dialog.
Definition: elementdialog.cpp:130
ElementDialog::updateWidget
void updateWidget()
ElementDialog::m_mode
uint m_mode
Definition: elementdialog.h:66
QET::QetMessageBox::question
QMessageBox::StandardButton question(QWidget *, const QString &, const QString &, QMessageBox::StandardButtons=QMessageBox::Ok, QMessageBox::StandardButton=QMessageBox::NoButton)
Definition: qetmessagebox.cpp:53
ElementDialog::m_text_field
QFileNameEdit * m_text_field
Definition: elementdialog.h:69
ElementsLocation::addToPath
bool addToPath(const QString &)
ElementsLocation::addToPath Add a string to the actual path of this location.
Definition: elementslocation.cpp:320
elementslocation.h
ElementsLocation::isDirectory
bool isDirectory() const
ElementsLocation::isDirectory.
Definition: elementslocation.cpp:420
ElementDialog::m_location
ElementsLocation m_location
Definition: elementdialog.h:67
ElementDialog::m_model
ElementsCollectionModel * m_model
Definition: elementdialog.h:71
QETApp::registeredProjects
static QMap< uint, QETProject * > registeredProjects()
QETApp::registeredProjects.
Definition: qetapp.cpp:2353
ElementDialog::execConfiguredDialog
static ElementsLocation execConfiguredDialog(int, QWidget *parent=nullptr)
ElementDialog::execConfiguredDialog launch a dialog with the chosen mode.
Definition: elementdialog.cpp:301
ElementDialog::checkCurrentLocation
void checkCurrentLocation()
ElementDialog::checkCurrentLocation Update this dialog according to the current selected location and...
Definition: elementdialog.cpp:154
ElementsLocation
The ElementsLocation class This class represents the location, the location of an element or of a cat...
Definition: elementslocation.h:46
QETProject
Definition: qetproject.h:51
ElementDialog::location
ElementsLocation location() const
ElementDialog::location.
Definition: elementdialog.cpp:243
ElementDialog::m_tree_view
QTreeView * m_tree_view
Definition: elementdialog.h:70
ElementDialog
Definition: elementdialog.h:34
QFileNameEdit::isEmpty
bool isEmpty()
Definition: qfilenameedit.cpp:53
ElementsCollectionModel
Definition: elementscollectionmodel.h:32
ElementDialog::getSaveElementLocation
static ElementsLocation getSaveElementLocation(QWidget *parent=nullptr)
ElementDialog::getSaveElementLocation Display a dialog that allow to user to select an element (exist...
Definition: elementdialog.cpp:290
ElementDialog::SaveElement
@ SaveElement
The dialog should select an element for saving.
Definition: elementdialog.h:42
QET::QetMessageBox::critical
QMessageBox::StandardButton critical(QWidget *, const QString &, const QString &, QMessageBox::StandardButtons=QMessageBox::Ok, QMessageBox::StandardButton=QMessageBox::NoButton)
Definition: qetmessagebox.cpp:23
ElementDialog::m_buttons_box
QDialogButtonBox * m_buttons_box
Definition: elementdialog.h:68
elementdialog.h
ElementDialog::OpenElement
@ OpenElement
The dialog should open an element.
Definition: elementdialog.h:41
QET::Icons::tr
QIcon tr
Definition: qeticons.cpp:206
QET::Icons::Cancel
QIcon Cancel
Definition: qeticons.cpp:34
ElementDialog::setUpWidget
void setUpWidget()
ElementDialog::setUpWidget Build and setup the widgets of this dialog.
Definition: elementdialog.cpp:49
ElementDialog::ElementDialog
ElementDialog(uint=ElementDialog::OpenElement, QWidget *parent=nullptr)
ElementDialog::ElementDialog.
Definition: elementdialog.cpp:37
ElementDialog::checkAccept
void checkAccept()
Definition: elementdialog.cpp:190