EngineConfigPage Class Reference

Base for configuration pages for plugins; provides some default behavior. More...

#include <engineconfigpage.h>

+ Inheritance diagram for EngineConfigPage:

Public Member Functions

 EngineConfigPage (EnginePlugin *plugin, IniSection &cfg, QWidget *parent=nullptr)
 
QIcon icon () const override
 Reimplement this to return a displayable icon for the ConfigPage.
 
QString name () const override
 Reimplement this to return a list-displayable name for this ConfigPage.
 
const EnginePluginplugin () const
 Parent plugin handled by this page.
 
QString title () const override
 Page title, by default returns the same string as name().
 
Validation validate () override
 Validate settings on this page.
 
- Public Member Functions inherited from ConfigPage
 ConfigPage (QWidget *parent=nullptr)
 
bool allowSave ()
 Does this page allow to save the new settings?
 
bool areSettingsAlreadyRead ()
 true if settings for this page have already been loaded at least once.
 
void read ()
 Read configuration from persistence to page contents.
 
void reject ()
 
bool save ()
 Save configuration from page contents to persistence.
 
void setAllowSave (bool b)
 Change whether settings on this page can be stored in persisting configuration.
 

Protected Member Functions

void addWidget (QWidget *widget)
 Add a new, custom widget below the standard ones.
 
void readSettings () override
 Reimplement this to read settings from config into widgets.
 
void saveSettings () override
 Reimplement this to write settings to config from widgets.
 
- Protected Member Functions inherited from ConfigPage
void reject_default ()
 

Friends

class PrivData< EngineConfigPage >
 

Additional Inherited Members

- Public Types inherited from ConfigPage
enum  Validation { VALIDATION_OK, VALIDATION_ERROR }
 Result of validate() More...
 
- Signals inherited from ConfigPage
void appearanceChanged ()
 Emit to tell Doomseeker to redraw certain widgets.
 
void restartNeeded ()
 Emit to tell Doomseeker to ask the user for a restart.
 
void validationRequested ()
 Request that the page should be (re-)validated.
 

Detailed Description

Base for configuration pages for plugins; provides some default behavior.

An extension of ConfigPage. This class is already prepared to support most common and basic settings which include paths to the game's client and server executables, custom parameters and master server address. Plugins can reimplement this widget to benefit from this default behavior and also extend the page with additional widgets.

New subclassed instances of this configuration page can be created and returned in a reimplementation of the EnginePlugin::configuration() method.

Definition at line 48 of file engineconfigpage.h.

Constructor & Destructor Documentation

EngineConfigPage::EngineConfigPage ( EnginePlugin plugin,
IniSection cfg,
QWidget *  parent = nullptr 
)
Parameters
pluginParent plugin handled by this page.
cfgIniSection which handles configuration for this plugin. Usually this should be set to whatever EnginePlugin::data()->pConfig points to.
parentParent widget, most likely configuration dialog box.

Member Function Documentation

void EngineConfigPage::addWidget ( QWidget *  widget)
protected

Add a new, custom widget below the standard ones.

Definition at line 107 of file engineconfigpage.cpp.

QIcon EngineConfigPage::icon ( ) const
overridevirtual

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.

Implements ConfigPage.

Definition at line 149 of file engineconfigpage.cpp.

QString EngineConfigPage::name ( ) const
overridevirtual

Reimplement this to return a list-displayable name for this ConfigPage.

Implements ConfigPage.

Definition at line 173 of file engineconfigpage.cpp.

const EnginePlugin * EngineConfigPage::plugin ( ) const

Parent plugin handled by this page.

Definition at line 178 of file engineconfigpage.cpp.

void EngineConfigPage::readSettings ( )
overrideprotectedvirtual

Reimplement this to read settings from config into widgets.

Implements ConfigPage.

Definition at line 183 of file engineconfigpage.cpp.

void EngineConfigPage::saveSettings ( )
overrideprotectedvirtual

Reimplement this to write settings to config from widgets.

Implements ConfigPage.

Definition at line 238 of file engineconfigpage.cpp.

QString EngineConfigPage::title ( ) const
overridevirtual

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

Reimplemented from ConfigPage.

Definition at line 261 of file engineconfigpage.cpp.

ConfigPage::Validation EngineConfigPage::validate ( )
overridevirtual

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 immediately 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 from ConfigPage.

Definition at line 274 of file engineconfigpage.cpp.


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