ConfigPage Class Referenceabstract

Base class for configuration pages. More...

#include <configpage.h>

+ Inheritance diagram for ConfigPage:

Public Types

enum  Validation { VALIDATION_OK, VALIDATION_ERROR }
 Result of validate() More...
 

Signals

void appearanceChanged ()
 Emit to tell Doomseeker to redraw certain widgets. More...
 
void restartNeeded ()
 Emit to tell Doomseeker to ask the user for a restart. More...
 
void validationRequested ()
 Request that the page should be (re-)validated. More...
 

Public Member Functions

 ConfigPage (QWidget *parent=NULL)
 
bool allowSave ()
 Does this page allow to save the new settings? More...
 
bool areSettingsAlreadyRead ()
 true if settings for this page have already been loaded at least once. More...
 
virtual QIcon icon () const =0
 Reimplement this to return a displayable icon for the ConfigPage. More...
 
virtual QString name () const =0
 Reimplement this to return a list-displayable name for this ConfigPage. More...
 
void read ()
 Read configuration from persistence to page contents. More...
 
void reject ()
 
bool save ()
 Save configuration from page contents to persistence. More...
 
void setAllowSave (bool b)
 Change whether settings on this page can be stored in persisting configuration. More...
 
virtual QString title () const
 Page title, by default returns the same string as name(). More...
 
virtual Validation validate ()
 Validate settings on this page. More...
 

Protected Member Functions

 POLYMORPHIC_SETTER_DECLARE (void, ConfigPage, reject,())
 
virtual void readSettings ()=0
 Reimplement this to read settings from config into widgets. More...
 
void reject_default ()
 
virtual void saveSettings ()=0
 Reimplement this to write settings to config from widgets. More...
 

Detailed Description

Base class for configuration pages.

Subclassed pages contain actual widgets allowing user input in order to configure program's modules. Specific settings are read and saved through virtual methods: saveSettings() and readSettings().

Plugins should rather inherit from EngineConfigPage as this provides some default, common behavior, like executable path or custom program parameters configuration.

Definition at line 44 of file configpage.h.

Member Enumeration Documentation

Result of validate()

Enumerator
VALIDATION_OK 

Validation detected no problems.

VALIDATION_ERROR 

Validation detected at least one problem.

Definition at line 50 of file configpage.h.

Member Function Documentation

bool ConfigPage::allowSave ( )

Does this page allow to save the new settings?

See also
setAllowSave()

Definition at line 51 of file configpage.cpp.

void ConfigPage::appearanceChanged ( )
signal

Emit to tell Doomseeker to redraw certain widgets.

This will send a request to Doomseeker to redraw some graphics. This should be emitted if settings on current page change program's appearance so that program can redraw affected widgets.

bool ConfigPage::areSettingsAlreadyRead ( )

true if settings for this page have already been loaded at least once.

Definition at line 56 of file configpage.cpp.

virtual QIcon ConfigPage::icon ( ) const
pure virtual

Reimplement this to return a displayable icon for the ConfigPage.

If there is no QIcon associated with this page just return a QIcon object with argument-less constructor.

Implemented in EngineConfigPage, CFGFilePaths, CFGCustomServers, CFGIRCNetworks, CFGServerPasswords, CFGWadAlias, CFGWadseekerSites, CfgChatLogsPage, CFGIRCSounds, CFGAppearance, CFGQuery, CFGAutoUpdates, CFGWadseekerAppearance, CFGWadseekerGeneral, CFGWadseekerIdgames, and CFGIRCAppearance.

virtual QString ConfigPage::name ( ) const
pure virtual
void ConfigPage::read ( )

Read configuration from persistence to page contents.

Definition at line 66 of file configpage.cpp.

virtual void ConfigPage::readSettings ( )
protectedpure virtual
void ConfigPage::reject ( )

[Virtual] Called when the config box is discarded without accepting the settings.

The default implementation does nothing.

void ConfigPage::restartNeeded ( )
signal

Emit to tell Doomseeker to ask the user for a restart.

bool ConfigPage::save ( )

Save configuration from page contents to persistence.

Returns
true if save completes successfully, false on error.

Definition at line 72 of file configpage.cpp.

virtual void ConfigPage::saveSettings ( )
protectedpure virtual
void ConfigPage::setAllowSave ( bool  b)

Change whether settings on this page can be stored in persisting configuration.

Definition at line 85 of file configpage.cpp.

QString ConfigPage::title ( ) const
virtual

Page title, by default returns the same string as name().

Reimplemented in EngineConfigPage, CFGIRCNetworks, CFGWadseekerSites, CfgChatLogsPage, CFGIRCSounds, CFGWadseekerAppearance, CFGWadseekerIdgames, CFGIRCAppearance, and CFGWadseekerGeneral.

Definition at line 90 of file configpage.cpp.

ConfigPage::Validation ConfigPage::validate ( )
virtual

Validate settings on this page.

If settings seem to be configured incorrectly (paths point to missing directories or files, data is missing, etc.), the page can decide to notify the user about a problem. Validation result determines how the problem notification will be displayed by Doomseeker in the configuration dialog box. Still, the page itself must also take care to precisely pinpoint the reason of the failure. When user navigates to the page, it must be immediatelly visible what caused the problem and why.

This is used purely for notification purposes. User should not be blocked from saving the configuration even if validation fails spectacularly.

This method can be called at any time by Doomseeker and must not block. It's expected that all checks will be light-weight.

A page can also decide to validate itself at any time. This is done by emitting the validationRequested() signal, upon which Doomseeker will call validate().

Returns
Return result of validation. Default implementation always returns VALIDATION_OK.

Reimplemented in EngineConfigPage, CfgChatLogsPage, CFGIRCSounds, CFGFilePaths, and CFGWadseekerGeneral.

Definition at line 95 of file configpage.cpp.

void ConfigPage::validationRequested ( )
signal

Request that the page should be (re-)validated.

Emit this whenever page data changes and you wish Doomseeker to re-evaluate the validity of the configuration.


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