OpenWalnut  1.5.0dev
Public Slots | Signals | Public Member Functions | Static Public Member Functions | Private Types | Private Slots | Private Member Functions | Private Attributes | List of all members
WQtModuleConfig Class Reference

A class which acts as a binary predicate to check exclusion of modules by name using a whitelist and a blacklist. More...

#include <WQtModuleConfig.h>

+ Inheritance diagram for WQtModuleConfig:
+ Collaboration diagram for WQtModuleConfig:

Public Slots

void configure ()
 Uses a modal dialog to allow the user modifying it. More...
 
virtual void accept ()
 Hides the dialog, updates the internal lists and emits updated-signal. More...
 
virtual void reject ()
 Hides the dialog, does not update the internal lists. More...
 
virtual void addModulePath ()
 Add a path to m_pathList;. More...
 
virtual void removeModulePath ()
 Remove the selected item from m_pathList;. More...
 

Signals

void updated ()
 Signal getting emitted if the exclusion-lists changes. More...
 

Public Member Functions

 WQtModuleConfig (QWidget *parent=0, Qt::WindowFlags f=Qt::WindowFlags())
 Constructs excluder dialog and loads needed settings. More...
 
virtual ~WQtModuleConfig ()
 Destructor. More...
 
bool operator() (std::string const &name) const
 Checks exclusion by name. More...
 
bool operator() (WModule::ConstSPtr module) const
 Checks exclusion by name. More...
 
QActiongetConfigureAction () const
 Creates an action instance allowing the configuration. More...
 

Static Public Member Functions

static void initPathHelper ()
 This function initializes the path helper by loading the module path settings. More...
 

Private Types

typedef std::map< std::string, QCheckBox * > ModuleItemMapType
 Maps between a name and a checkbox widget. More...
 
typedef std::vector< std::string > AllowedModuleList
 List for all allowed/active modules. More...
 

Private Slots

virtual void pathListSelectionChanged ()
 Call this notify the remove button whether something is selected in m_pathList or not. More...
 
void resetAllModuleCheckboxes ()
 Call this to reset all checkboxes in the list of modules. More...
 
void refreshModuleCheckboxes ()
 Call this to refresh the list of selected modules, e.g. More...
 
void toggleComboboxVisibility (int)
 Call this to show or hide the preset combobox. More...
 
void showThemAllUpdated ()
 Triggered by the m_showThemAll checkbox. More...
 
void reset ()
 called by the reset button More...
 

Private Member Functions

void loadListsFromSettings (bool defaultModulePaths=false)
 Reloads the whitelist and the blacklist from the QSettings. More...
 
void refreshComboboxItems ()
 Call this to refresh the combobox items. More...
 
void saveListToSettings ()
 Saves the whitelist and the blacklist to the settings. More...
 

Private Attributes

std::vector< WModule::ConstSPtrm_moduleList
 The list of available modules. More...
 
ModuleItemMapType m_moduleItemMap
 Maps between module name and item. More...
 
AllowedModuleList m_allowedModules
 The list of modules that are allowed. More...
 
QListWidget * m_list
 This widget contains the allowed module list. More...
 
QListWidget * m_pathList
 This list widget contains all additional search paths. More...
 
QCheckBox * m_showThemAll
 Checkbox controlling whether all modules should be shown all the time. More...
 
QCheckBox * m_asBlackList
 Control whether the list is interpreted as black list. More...
 
QCheckBox * m_usePreset
 Check if you want to use a preset module list. More...
 
QComboBox * m_selectPresetBlacklist
 Combobox to select a black list. More...
 
QPushButton * m_removePathButton
 Button responsible for removing the currently selected path in m_pathList. More...
 

Detailed Description

A class which acts as a binary predicate to check exclusion of modules by name using a whitelist and a blacklist.

It automatically handles the settings for it and provides proper QActions.

Definition at line 44 of file WQtModuleConfig.h.

Member Typedef Documentation

◆ AllowedModuleList

typedef std::vector< std::string > WQtModuleConfig::AllowedModuleList
private

List for all allowed/active modules.

Definition at line 161 of file WQtModuleConfig.h.

◆ ModuleItemMapType

typedef std::map< std::string, QCheckBox* > WQtModuleConfig::ModuleItemMapType
private

Maps between a name and a checkbox widget.

Definition at line 156 of file WQtModuleConfig.h.

Constructor & Destructor Documentation

◆ WQtModuleConfig()

WQtModuleConfig::WQtModuleConfig ( QWidget *  parent = 0,
Qt::WindowFlags  f = Qt::WindowFlags() 
)

◆ ~WQtModuleConfig()

WQtModuleConfig::~WQtModuleConfig ( )
virtual

Destructor.

Definition at line 259 of file WQtModuleConfig.cpp.

Member Function Documentation

◆ accept

void WQtModuleConfig::accept ( )
virtualslot

Hides the dialog, updates the internal lists and emits updated-signal.

Definition at line 369 of file WQtModuleConfig.cpp.

References refreshComboboxItems(), saveListToSettings(), and updated().

Referenced by WQtModuleConfig().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addModulePath

void WQtModuleConfig::addModulePath ( )
virtualslot

Add a path to m_pathList;.

Definition at line 411 of file WQtModuleConfig.cpp.

References WPathHelper::getHomePath(), and m_pathList.

Referenced by WQtModuleConfig().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ configure

void WQtModuleConfig::configure ( )
slot

Uses a modal dialog to allow the user modifying it.

Definition at line 356 of file WQtModuleConfig.cpp.

Referenced by getConfigureAction().

+ Here is the caller graph for this function:

◆ getConfigureAction()

QAction * WQtModuleConfig::getConfigureAction ( ) const

Creates an action instance allowing the configuration.

Returns
the action which triggers this dialog

Definition at line 361 of file WQtModuleConfig.cpp.

References configure().

Referenced by WMainWindow::setupGUI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initPathHelper()

void WQtModuleConfig::initPathHelper ( )
static

This function initializes the path helper by loading the module path settings.

This is needed since the pathhelper needs to know all paths before the GUI really shows up.

Definition at line 264 of file WQtModuleConfig.cpp.

References WPathHelper::getPathHelper(), and WQtGui::getSettings().

Referenced by WQtGui::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadListsFromSettings()

void WQtModuleConfig::loadListsFromSettings ( bool  defaultModulePaths = false)
private

Reloads the whitelist and the blacklist from the QSettings.

Parameters
defaultModulePathsif true, the module path list is set to default too.

Definition at line 276 of file WQtModuleConfig.cpp.

References WQtGui::getSettings(), m_asBlackList, m_pathList, m_showThemAll, and m_usePreset.

Referenced by reject(), reset(), and WQtModuleConfig().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator()() [1/2]

bool WQtModuleConfig::operator() ( std::string const &  name) const

Checks exclusion by name.

Parameters
namethe name of the module.
Returns
true if it should be excluded.

Definition at line 342 of file WQtModuleConfig.cpp.

References m_allowedModules, m_asBlackList, and m_showThemAll.

Referenced by operator()().

+ Here is the caller graph for this function:

◆ operator()() [2/2]

bool WQtModuleConfig::operator() ( WModule::ConstSPtr  module) const

Checks exclusion by name.

Parameters
modulethe module to check. Internally, the name is used.
Returns
true if it should be excluded.

Definition at line 351 of file WQtModuleConfig.cpp.

References operator()().

+ Here is the call graph for this function:

◆ pathListSelectionChanged

void WQtModuleConfig::pathListSelectionChanged ( )
privatevirtualslot

Call this notify the remove button whether something is selected in m_pathList or not.

Definition at line 424 of file WQtModuleConfig.cpp.

References m_pathList, and m_removePathButton.

Referenced by WQtModuleConfig().

+ Here is the caller graph for this function:

◆ refreshComboboxItems()

void WQtModuleConfig::refreshComboboxItems ( )
private

Call this to refresh the combobox items.

Definition at line 485 of file WQtModuleConfig.cpp.

References WQtGui::getSettings(), and m_selectPresetBlacklist.

Referenced by accept(), and WQtModuleConfig().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ refreshModuleCheckboxes

void WQtModuleConfig::refreshModuleCheckboxes ( )
privateslot

Call this to refresh the list of selected modules, e.g.

Definition at line 445 of file WQtModuleConfig.cpp.

References WQtGui::getSettings(), m_allowedModules, m_moduleItemMap, m_selectPresetBlacklist, m_usePreset, resetAllModuleCheckboxes(), and string_utils::tokenize().

Referenced by WQtModuleConfig().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reject

void WQtModuleConfig::reject ( )
virtualslot

Hides the dialog, does not update the internal lists.

Definition at line 377 of file WQtModuleConfig.cpp.

References loadListsFromSettings().

Referenced by WQtModuleConfig().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeModulePath

void WQtModuleConfig::removeModulePath ( )
virtualslot

Remove the selected item from m_pathList;.

Definition at line 419 of file WQtModuleConfig.cpp.

References m_pathList.

Referenced by WQtModuleConfig().

+ Here is the caller graph for this function:

◆ reset

void WQtModuleConfig::reset ( )
privateslot

called by the reset button

Definition at line 397 of file WQtModuleConfig.cpp.

References loadListsFromSettings(), m_asBlackList, m_list, m_pathList, m_showThemAll, m_usePreset, and resetAllModuleCheckboxes().

Referenced by WQtModuleConfig().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetAllModuleCheckboxes

void WQtModuleConfig::resetAllModuleCheckboxes ( )
privateslot

Call this to reset all checkboxes in the list of modules.

Definition at line 436 of file WQtModuleConfig.cpp.

References m_moduleItemMap, and m_moduleList.

Referenced by refreshModuleCheckboxes(), and reset().

+ Here is the caller graph for this function:

◆ saveListToSettings()

void WQtModuleConfig::saveListToSettings ( )
private

Saves the whitelist and the blacklist to the settings.

Definition at line 302 of file WQtModuleConfig.cpp.

References WQtGui::getSettings(), m_allowedModules, m_asBlackList, m_moduleItemMap, m_pathList, m_selectPresetBlacklist, m_showThemAll, and m_usePreset.

Referenced by accept().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showThemAllUpdated

void WQtModuleConfig::showThemAllUpdated ( )
privateslot

Triggered by the m_showThemAll checkbox.

Definition at line 385 of file WQtModuleConfig.cpp.

References m_list, and m_showThemAll.

Referenced by WQtModuleConfig().

+ Here is the caller graph for this function:

◆ toggleComboboxVisibility

void WQtModuleConfig::toggleComboboxVisibility ( int  usePresetState)
privateslot

Call this to show or hide the preset combobox.

Definition at line 472 of file WQtModuleConfig.cpp.

References m_selectPresetBlacklist.

Referenced by WQtModuleConfig().

+ Here is the caller graph for this function:

◆ updated

void WQtModuleConfig::updated ( )
signal

Signal getting emitted if the exclusion-lists changes.

Referenced by accept().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_allowedModules

AllowedModuleList WQtModuleConfig::m_allowedModules
private

The list of modules that are allowed.

Definition at line 171 of file WQtModuleConfig.h.

Referenced by operator()(), refreshModuleCheckboxes(), and saveListToSettings().

◆ m_asBlackList

QCheckBox* WQtModuleConfig::m_asBlackList
private

Control whether the list is interpreted as black list.

Definition at line 208 of file WQtModuleConfig.h.

Referenced by loadListsFromSettings(), operator()(), reset(), saveListToSettings(), and WQtModuleConfig().

◆ m_list

QListWidget* WQtModuleConfig::m_list
private

This widget contains the allowed module list.

Definition at line 193 of file WQtModuleConfig.h.

Referenced by reset(), showThemAllUpdated(), and WQtModuleConfig().

◆ m_moduleItemMap

ModuleItemMapType WQtModuleConfig::m_moduleItemMap
private

Maps between module name and item.

Definition at line 166 of file WQtModuleConfig.h.

Referenced by refreshModuleCheckboxes(), resetAllModuleCheckboxes(), saveListToSettings(), and WQtModuleConfig().

◆ m_moduleList

std::vector< WModule::ConstSPtr > WQtModuleConfig::m_moduleList
private

The list of available modules.

Definition at line 151 of file WQtModuleConfig.h.

Referenced by resetAllModuleCheckboxes(), and WQtModuleConfig().

◆ m_pathList

QListWidget* WQtModuleConfig::m_pathList
private

This list widget contains all additional search paths.

Definition at line 198 of file WQtModuleConfig.h.

Referenced by addModulePath(), loadListsFromSettings(), pathListSelectionChanged(), removeModulePath(), reset(), saveListToSettings(), and WQtModuleConfig().

◆ m_removePathButton

QPushButton* WQtModuleConfig::m_removePathButton
private

Button responsible for removing the currently selected path in m_pathList.

Definition at line 223 of file WQtModuleConfig.h.

Referenced by pathListSelectionChanged(), and WQtModuleConfig().

◆ m_selectPresetBlacklist

QComboBox* WQtModuleConfig::m_selectPresetBlacklist
private

Combobox to select a black list.

Definition at line 218 of file WQtModuleConfig.h.

Referenced by refreshComboboxItems(), refreshModuleCheckboxes(), saveListToSettings(), toggleComboboxVisibility(), and WQtModuleConfig().

◆ m_showThemAll

QCheckBox* WQtModuleConfig::m_showThemAll
private

Checkbox controlling whether all modules should be shown all the time.

Definition at line 203 of file WQtModuleConfig.h.

Referenced by loadListsFromSettings(), operator()(), reset(), saveListToSettings(), showThemAllUpdated(), and WQtModuleConfig().

◆ m_usePreset

QCheckBox* WQtModuleConfig::m_usePreset
private

Check if you want to use a preset module list.

Definition at line 213 of file WQtModuleConfig.h.

Referenced by loadListsFromSettings(), refreshModuleCheckboxes(), reset(), saveListToSettings(), and WQtModuleConfig().


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