COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
BrowserDialog Class Reference

#include <BrowserDialog.hpp>

Inherits QDialog.

Public Member Functions

 BrowserDialog (QWidget *parent=0)
 
bool show (bool multi_select, QVariant &selected)
 Shows the dialog. More...
 

Protected Member Functions

virtual void keyPressEvent (QKeyEvent *event)
 Method called when user presses a key or a combination of keys. More...
 
virtual bool focusNextPrevChild (bool next)
 Method called when user presses "Tab" key. More...
 

Private Slots

void filter_edited (const QString &new_text)
 
void double_clicked (const QModelIndex &index)
 
void current_path_changed (const QString &path)
 
void completer_activated (const QString &text)
 
void path_edited (const QString &text)
 
void message (const QString &message, uiCommon::LogMessage::Type type)
 Slot called when has been added to the log. More...
 
void add_favorite ()
 Add the current path as a favorite. More...
 
void remove_favorite ()
 Remove the currently selected favorite. More...
 
void favorite_selected (const QModelIndex &index)
 Slot called when user clicks on a favorite directory to go to that place. More...
 

Private Member Functions

void init_gui ()
 Inits the GUI. More...
 

Private Attributes

boost::shared_ptr< core::NRemoteFSBrowserm_model
 The underlying model. More...
 
FileFilterm_filter_model
 
QListView * m_view
 The view. More...
 
QDialogButtonBox * m_buttons
 The box that displays the dialog buttons. More...
 
QGridLayout * m_main_layout
 Main layout of the dialog. More...
 
QListView * m_favorites_view
 View for the favorite places. More...
 
FavoritesModelm_favorites_model
 Model for the favorite places. More...
 
QHBoxLayout * m_path_layout
 Top layout for the graphical components related to the path. More...
 
QLabel * m_lab_path
 Label for the path. More...
 
QLineEdit * m_edit_path
 Line edit for the path. More...
 
QHBoxLayout * m_fav_buttons_layout
 Layout for buttons related to favorites. More...
 
QPushButton * m_bt_add_fav
 Button for adding a favorite. More...
 
QPushButton * m_bt_remove_fav
 Button for removing a favorite. More...
 
QHBoxLayout * m_filter_layout
 Layout for the graphical components related to the filter. More...
 
QLabel * m_lab_filter
 Label for the filter. More...
 
QLineEdit * m_edit_filter
 Line edit for the filter. More...
 
QCompleter * m_completer
 Completer for the path completion. More...
 
QString m_old_path
 Old path. More...
 
bool m_updating_completer
 If true, the completer is currently being updated. More...
 

Detailed Description

Provides graphical services for browsing a remote filesystem based by using and instance of #NRemoteFSBrowser class.

Author
Quentin Gasper.

Definition at line 46 of file BrowserDialog.hpp.

Constructor & Destructor Documentation

BrowserDialog ( QWidget *  parent = 0)

Contructor.

Parameters
parentParent object. Can be null.

Definition at line 43 of file BrowserDialog.cpp.

Member Function Documentation

void add_favorite ( )
privateslot

Add the current path as a favorite.

Definition at line 255 of file BrowserDialog.cpp.

void completer_activated ( const QString &  text)
privateslot

Slot called when an element has been selected in the completer.

Parameters
textThe selected text.

Definition at line 91 of file BrowserDialog.cpp.

void current_path_changed ( const QString &  path)
privateslot

Slot called when the current path in the underlying model has changed.

Parameters
pathThe new current path.

Definition at line 81 of file BrowserDialog.cpp.

void double_clicked ( const QModelIndex &  index)
privateslot

Slot called when user double-clicks on an item in the view.

Parameters
indexThe index of the item that was double=clicked.

Definition at line 69 of file BrowserDialog.cpp.

void favorite_selected ( const QModelIndex &  index)
privateslot

Slot called when user clicks on a favorite directory to go to that place.

Parameters
indexIndex selected.

Definition at line 284 of file BrowserDialog.cpp.

void filter_edited ( const QString &  new_text)
privateslot

Slot called when user edits the filter.

Parameters
new_textThe new text.

Definition at line 61 of file BrowserDialog.cpp.

bool focusNextPrevChild ( bool  next)
protectedvirtual

Method called when user presses "Tab" key.

This methods overrides base class method. If the path text edit has the focus, the completer is displayed, the first item is selected and appended to the path. If the path text edit does not have the focus, the base method is called.

Definition at line 180 of file BrowserDialog.cpp.

void init_gui ( )
private

Inits the GUI.

Definition at line 299 of file BrowserDialog.cpp.

void keyPressEvent ( QKeyEvent *  event)
protectedvirtual

Method called when user presses a key or a combination of keys.

This method overrides base class method and calls it before any other treatement. Depending on what is pressed, the method has 3 working modes:

  • If Enter key is pressed and one of the buttons has the focus, it is like if user clicked on this button;
  • If either no modifier key (such as ctrl, shift, alt, etc...) is pressed or shift key and another key are pressed, the combination is appended to the filter and #editFilter is focused in. To avoid confusion, list m_view is focused out.
  • In all other cases, nothing is done. The method calls base class method.
    Parameters
    eventEvent that occured.

Definition at line 129 of file BrowserDialog.cpp.

void message ( const QString &  message,
uiCommon::LogMessage::Type  type 
)
privateslot

Slot called when has been added to the log.

A messaged box is showed with the message.

Parameters
messageThe message.
typeThe message type.

Definition at line 243 of file BrowserDialog.cpp.

void path_edited ( const QString &  text)
privateslot

Slot called when user edits the path.

Parameters
pathThe new path.

Definition at line 98 of file BrowserDialog.cpp.

void remove_favorite ( )
privateslot

Remove the currently selected favorite.

Definition at line 270 of file BrowserDialog.cpp.

bool show ( bool  multi_select,
QVariant &  selected 
)

Shows the dialog.

This is a blocking method. It will not return until the dialog is hidden.

Parameters
multi_selectIf true, user will be able to select multiple items at the same time.
selectedAfter the method returns, if multi_select was false, contains a QString with the path to the selected file. If multi_select was true, contains a QStringList with the paths to selected files. If user cancels the diolog, the parameter is not modified.
Returns
Returns true if user clicked on "OK" button; otherwise, returns false.

Definition at line 197 of file BrowserDialog.cpp.

Member Data Documentation

QPushButton* m_bt_add_fav
private

Button for adding a favorite.

Definition at line 171 of file BrowserDialog.hpp.

QPushButton* m_bt_remove_fav
private

Button for removing a favorite.

Definition at line 174 of file BrowserDialog.hpp.

QDialogButtonBox* m_buttons
private

The box that displays the dialog buttons.

Definition at line 147 of file BrowserDialog.hpp.

QCompleter* m_completer
private

Completer for the path completion.

Definition at line 186 of file BrowserDialog.hpp.

QLineEdit* m_edit_filter
private

Line edit for the filter.

Definition at line 183 of file BrowserDialog.hpp.

QLineEdit* m_edit_path
private

Line edit for the path.

Definition at line 165 of file BrowserDialog.hpp.

QHBoxLayout* m_fav_buttons_layout
private

Layout for buttons related to favorites.

Definition at line 168 of file BrowserDialog.hpp.

FavoritesModel* m_favorites_model
private

Model for the favorite places.

Definition at line 156 of file BrowserDialog.hpp.

QListView* m_favorites_view
private

View for the favorite places.

Definition at line 153 of file BrowserDialog.hpp.

QHBoxLayout* m_filter_layout
private

Layout for the graphical components related to the filter.

Definition at line 177 of file BrowserDialog.hpp.

FileFilter* m_filter_model
private

The filtering model. It lies between the model and the view and adds the icons management besides the filtering.

Definition at line 141 of file BrowserDialog.hpp.

QLabel* m_lab_filter
private

Label for the filter.

Definition at line 180 of file BrowserDialog.hpp.

QLabel* m_lab_path
private

Label for the path.

Definition at line 162 of file BrowserDialog.hpp.

QGridLayout* m_main_layout
private

Main layout of the dialog.

Definition at line 150 of file BrowserDialog.hpp.

boost::shared_ptr<core::NRemoteFSBrowser> m_model
private

The underlying model.

Definition at line 137 of file BrowserDialog.hpp.

QString m_old_path
private

Old path.

Definition at line 189 of file BrowserDialog.hpp.

QHBoxLayout* m_path_layout
private

Top layout for the graphical components related to the path.

Definition at line 159 of file BrowserDialog.hpp.

bool m_updating_completer
private

If true, the completer is currently being updated.

Definition at line 192 of file BrowserDialog.hpp.

QListView* m_view
private

The view.

Definition at line 144 of file BrowserDialog.hpp.


The documentation for this class was generated from the following files:
Send comments to:
COOLFluiD Web Admin