OpenWalnut
1.5.0dev
|
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>
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... | |
QAction * | getConfigureAction () 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::ConstSPtr > | m_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... | |
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.
|
private |
List for all allowed/active modules.
Definition at line 161 of file WQtModuleConfig.h.
|
private |
Maps between a name and a checkbox widget.
Definition at line 156 of file WQtModuleConfig.h.
WQtModuleConfig::WQtModuleConfig | ( | QWidget * | parent = 0 , |
Qt::WindowFlags | f = Qt::WindowFlags() |
||
) |
Constructs excluder dialog and loads needed settings.
parent | parent widget |
f | window flags |
Definition at line 56 of file WQtModuleConfig.cpp.
References accept(), addModulePath(), WIconManager::getIcon(), WMainWindow::getIconManager(), WQtGui::getMainWindow(), WModuleFactory::getModuleFactory(), WQtGui::getSettings(), loadListsFromSettings(), m_asBlackList, m_list, m_moduleItemMap, m_moduleList, m_pathList, m_removePathButton, m_selectPresetBlacklist, m_showThemAll, m_usePreset, pathListSelectionChanged(), refreshComboboxItems(), refreshModuleCheckboxes(), reject(), removeModulePath(), reset(), showThemAllUpdated(), and toggleComboboxVisibility().
|
virtual |
Destructor.
Definition at line 259 of file WQtModuleConfig.cpp.
|
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().
|
virtualslot |
Add a path to m_pathList;.
Definition at line 411 of file WQtModuleConfig.cpp.
References WPathHelper::getHomePath(), and m_pathList.
Referenced by WQtModuleConfig().
|
slot |
Uses a modal dialog to allow the user modifying it.
Definition at line 356 of file WQtModuleConfig.cpp.
Referenced by getConfigureAction().
QAction * WQtModuleConfig::getConfigureAction | ( | ) | const |
Creates an action instance allowing the configuration.
Definition at line 361 of file WQtModuleConfig.cpp.
References configure().
Referenced by WMainWindow::setupGUI().
|
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().
|
private |
Reloads the whitelist and the blacklist from the QSettings.
defaultModulePaths | if 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().
bool WQtModuleConfig::operator() | ( | std::string const & | name | ) | const |
Checks exclusion by name.
name | the name of the module. |
Definition at line 342 of file WQtModuleConfig.cpp.
References m_allowedModules, m_asBlackList, and m_showThemAll.
Referenced by operator()().
bool WQtModuleConfig::operator() | ( | WModule::ConstSPtr | module | ) | const |
Checks exclusion by name.
module | the module to check. Internally, the name is used. |
Definition at line 351 of file WQtModuleConfig.cpp.
References operator()().
|
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().
|
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().
|
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().
|
virtualslot |
Hides the dialog, does not update the internal lists.
Definition at line 377 of file WQtModuleConfig.cpp.
References loadListsFromSettings().
Referenced by WQtModuleConfig().
|
virtualslot |
Remove the selected item from m_pathList;.
Definition at line 419 of file WQtModuleConfig.cpp.
References m_pathList.
Referenced by WQtModuleConfig().
|
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().
|
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().
|
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().
|
privateslot |
Triggered by the m_showThemAll checkbox.
Definition at line 385 of file WQtModuleConfig.cpp.
References m_list, and m_showThemAll.
Referenced by WQtModuleConfig().
|
privateslot |
Call this to show or hide the preset combobox.
Definition at line 472 of file WQtModuleConfig.cpp.
References m_selectPresetBlacklist.
Referenced by WQtModuleConfig().
|
signal |
Signal getting emitted if the exclusion-lists changes.
Referenced by accept().
|
private |
The list of modules that are allowed.
Definition at line 171 of file WQtModuleConfig.h.
Referenced by operator()(), refreshModuleCheckboxes(), and saveListToSettings().
|
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().
|
private |
This widget contains the allowed module list.
Definition at line 193 of file WQtModuleConfig.h.
Referenced by reset(), showThemAllUpdated(), and WQtModuleConfig().
|
private |
Maps between module name and item.
Definition at line 166 of file WQtModuleConfig.h.
Referenced by refreshModuleCheckboxes(), resetAllModuleCheckboxes(), saveListToSettings(), and WQtModuleConfig().
|
private |
The list of available modules.
Definition at line 151 of file WQtModuleConfig.h.
Referenced by resetAllModuleCheckboxes(), and WQtModuleConfig().
|
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().
|
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().
|
private |
Combobox to select a black list.
Definition at line 218 of file WQtModuleConfig.h.
Referenced by refreshComboboxItems(), refreshModuleCheckboxes(), saveListToSettings(), toggleComboboxVisibility(), and WQtModuleConfig().
|
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().
|
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().