engineconfigpage.h
1 //------------------------------------------------------------------------------
2 // engineconfigpage.h
3 //------------------------------------------------------------------------------
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301, USA.
19 //
20 //------------------------------------------------------------------------------
21 // Copyright (C) 2010 "Blzut3" <admin@maniacsvault.net>
22 //------------------------------------------------------------------------------
23 
24 #ifndef __ENGINECONFIGBASE_H__
25 #define __ENGINECONFIGBASE_H__
26 
27 #include "gui/configuration/configpage.h"
28 #include "dptr.h"
29 
30 class EnginePlugin;
31 class IniSection;
32 class QLineEdit;
33 
48 class MAIN_EXPORT EngineConfigPage : public ConfigPage
49 {
50  Q_OBJECT
51 
52  public:
63  EngineConfigPage(EnginePlugin *plugin, IniSection &cfg, QWidget *parent=NULL);
64  virtual ~EngineConfigPage();
65 
66  QIcon icon() const;
67  QString name() const;
71  const EnginePlugin *plugin() const;
72  QString title() const;
73  virtual Validation validate();
74 
75  protected:
79  void addWidget(QWidget *widget);
80  void readSettings();
81  void saveSettings();
82 
83  private:
85  friend class PrivData<EngineConfigPage>;
86 
87 #if __GNUC__ == 4 && __GNUC_MINOR__ == 0
88  // [QT_VERSION] Remove me when Qt4 is dropped since there won't be a real reason to support GCC 4.0
89  // which doesn't support the TR1 nested class visibility change.
90  public:
91 #endif
92  QStringList collectKnownGameFilePaths() const;
93 #if __GNUC__ == 4 && __GNUC_MINOR__ == 0
94  private:
95 #endif
96  void makeFileBrowsers();
97  QString currentCustomParameters() const;
98  void removeStoredCustomParametersFromConfig(const QString &parameters);
99  void removeStoredCustomParametersFromWidget(const QString &parameters);
100  void showError(const QString &error);
101 
102  private slots:
103  void autoFindNeighbouringPaths();
104  void removeCurrentCustomParametersFromStorage();
105  void saveCustomParameters();
106  void showFindFailError();
107  void updateCustomParametersSaveState();
108 };
109 
110 #endif /* __ENGINECONFIGBASE_H__ */
Validation
Result of validate()
Definition: configpage.h:49
virtual void readSettings()=0
Reimplement this to read settings from config into widgets.
virtual QString title() const
Page title, by default returns the same string as name().
Definition: configpage.cpp:80
virtual QIcon icon() const =0
Reimplement this to return a displayable icon for the ConfigPage.
virtual QString name() const =0
Reimplement this to return a list-displayable name for this ConfigPage.
Definition: dptr.h:31
virtual Validation validate()
Validate settings on this page.
Definition: configpage.cpp:85
INI section representation.
Definition: inisection.h:40
Base for configuration pages for plugins; provides some default behavior.
virtual void saveSettings()=0
Reimplement this to write settings to config from widgets.
Base class for configuration pages.
Definition: configpage.h:43