QElectroTech  0.70
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
ElementDialog Class Reference

#include <elementdialog.h>

Public Member Functions

 ElementDialog (uint=ElementDialog::OpenElement, QWidget *parent=nullptr)
 ElementDialog::ElementDialog. More...
 
ElementsLocation location () const
 ElementDialog::location. More...
 

Static Public Member Functions

static ElementsLocation getOpenElementLocation (QWidget *parent=nullptr)
 ElementDialog::getOpenElementLocation Display a dialog for open an element through her location. More...
 
static ElementsLocation getSaveElementLocation (QWidget *parent=nullptr)
 ElementDialog::getSaveElementLocation Display a dialog that allow to user to select an element (existing or not) who he want to save. More...
 

Private Types

enum  { OpenElement = 0, SaveElement = 1, OpenCategory = 2, SaveCategory = 3 }
 

Private Member Functions

 ElementDialog (const ElementDialog &)
 
void setUpWidget ()
 ElementDialog::setUpWidget Build and setup the widgets of this dialog. More...
 
void setUpConnection ()
 ElementDialog::setUpConnection Setup connection of this dialog. More...
 
void indexClicked (const QModelIndex &index)
 ElementDialog::indexClicked. More...
 
void updateWidget ()
 
void checkCurrentLocation ()
 ElementDialog::checkCurrentLocation Update this dialog according to the current selected location and the current mode. More...
 
void checkAccept ()
 

Static Private Member Functions

static ElementsLocation execConfiguredDialog (int, QWidget *parent=nullptr)
 ElementDialog::execConfiguredDialog launch a dialog with the chosen mode. More...
 

Private Attributes

uint m_mode
 
ElementsLocation m_location
 
QDialogButtonBox * m_buttons_box = nullptr
 
QFileNameEditm_text_field = nullptr
 
QTreeView * m_tree_view = nullptr
 
ElementsCollectionModelm_model = nullptr
 

Detailed Description

This class provides several dialogs to select an element or a category (e.g. new or existing, for opening or for saving...).

Definition at line 33 of file elementdialog.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

This enum represents the available configurations for the required dialog

Enumerator
OpenElement 

The dialog should open an element.

SaveElement 

The dialog should select an element for saving.

OpenCategory 

The dialog should open a category.

SaveCategory 

The dialog should select a category for saving.

Definition at line 40 of file elementdialog.h.

Constructor & Destructor Documentation

◆ ElementDialog() [1/2]

ElementDialog::ElementDialog ( uint  mode = ElementDialog::OpenElement,
QWidget *  parent = nullptr 
)

ElementDialog::ElementDialog.

Parameters
mode
parent

Definition at line 37 of file elementdialog.cpp.

References setUpConnection(), and setUpWidget().

Referenced by execConfiguredDialog().

◆ ElementDialog() [2/2]

ElementDialog::ElementDialog ( const ElementDialog )
private

Member Function Documentation

◆ checkAccept()

void ElementDialog::checkAccept ( )
private

◆ checkCurrentLocation()

void ElementDialog::checkCurrentLocation ( )
private

◆ execConfiguredDialog()

ElementsLocation ElementDialog::execConfiguredDialog ( int  mode,
QWidget *  parentWidget = nullptr 
)
staticprivate

ElementDialog::execConfiguredDialog launch a dialog with the chosen mode.

Parameters
mode: mode of the dialog
parentWidget: parent widget of the dialog
Returns
the chosen location

Definition at line 301 of file elementdialog.cpp.

References ElementDialog(), and location().

Referenced by getOpenElementLocation(), and getSaveElementLocation().

◆ getOpenElementLocation()

ElementsLocation ElementDialog::getOpenElementLocation ( QWidget *  parentWidget = nullptr)
static

ElementDialog::getOpenElementLocation Display a dialog for open an element through her location.

Parameters
parentWidget
Returns
The location of the selected element

Definition at line 280 of file elementdialog.cpp.

References execConfiguredDialog(), and OpenElement.

Referenced by QETElementEditor::pasteFromElement(), and QETElementEditor::slot_open().

◆ getSaveElementLocation()

ElementsLocation ElementDialog::getSaveElementLocation ( QWidget *  parentWidget = nullptr)
static

ElementDialog::getSaveElementLocation Display a dialog that allow to user to select an element (existing or not) who he want to save.

Parameters
parentWidget
Returns
The location where the element must be save

Definition at line 290 of file elementdialog.cpp.

References execConfiguredDialog(), and SaveElement.

Referenced by QETElementEditor::slot_saveAs().

◆ indexClicked()

void ElementDialog::indexClicked ( const QModelIndex &  index)
private

◆ location()

ElementsLocation ElementDialog::location ( ) const

ElementDialog::location.

Returns
The selected location or a null location if user has selected nothing or selection isn't compatible with the curent mode

Definition at line 243 of file elementdialog.cpp.

References ElementsLocation::addToPath(), ElementsLocation::isDirectory(), ElementsLocation::isElement(), m_location, m_mode, m_text_field, OpenElement, and SaveElement.

Referenced by checkAccept(), and execConfiguredDialog().

◆ setUpConnection()

void ElementDialog::setUpConnection ( )
private

ElementDialog::setUpConnection Setup connection of this dialog.

Definition at line 130 of file elementdialog.cpp.

References checkAccept(), checkCurrentLocation(), indexClicked(), m_buttons_box, m_text_field, and m_tree_view.

Referenced by ElementDialog().

◆ setUpWidget()

void ElementDialog::setUpWidget ( )
private

◆ updateWidget()

void ElementDialog::updateWidget ( )
private

Member Data Documentation

◆ m_buttons_box

QDialogButtonBox* ElementDialog::m_buttons_box = nullptr
private

Definition at line 68 of file elementdialog.h.

Referenced by checkCurrentLocation(), setUpConnection(), and setUpWidget().

◆ m_location

ElementsLocation ElementDialog::m_location
private

Definition at line 67 of file elementdialog.h.

Referenced by checkCurrentLocation(), indexClicked(), and location().

◆ m_mode

uint ElementDialog::m_mode
private

Definition at line 66 of file elementdialog.h.

Referenced by checkAccept(), checkCurrentLocation(), location(), and setUpWidget().

◆ m_model

ElementsCollectionModel* ElementDialog::m_model = nullptr
private

Definition at line 71 of file elementdialog.h.

Referenced by indexClicked(), and setUpWidget().

◆ m_text_field

QFileNameEdit* ElementDialog::m_text_field = nullptr
private

Definition at line 69 of file elementdialog.h.

Referenced by checkCurrentLocation(), location(), setUpConnection(), and setUpWidget().

◆ m_tree_view

QTreeView* ElementDialog::m_tree_view = nullptr
private

Definition at line 70 of file elementdialog.h.

Referenced by setUpConnection(), and setUpWidget().


The documentation for this class was generated from the following files: