engineconfigpage.h
1 //------------------------------------------------------------------------------
2 // engineconfigpage.h
3 //------------------------------------------------------------------------------
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library 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 GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; 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 Braden "Blzut3" Obrzut <admin@maniacsvault.net>
22 //------------------------------------------------------------------------------
23 
24 #ifndef __ENGINECONFIGBASE_H__
25 #define __ENGINECONFIGBASE_H__
26 
27 #include "dptr.h"
28 #include "gui/configuration/configpage.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 = nullptr);
64  virtual ~EngineConfigPage() override;
65 
66  QIcon icon() const override;
67  QString name() const override;
71  const EnginePlugin *plugin() const;
72  QString title() const override;
73  Validation validate() override;
74 
75 protected:
79  void addWidget(QWidget *widget);
80  void readSettings() override;
81  void saveSettings() override;
82 
83 private:
85  friend class PrivData<EngineConfigPage>;
86 
87  QStringList collectKnownGameFilePaths() const;
88  void makeFileBrowsers();
89  QString currentCustomParameters() const;
90  void removeStoredCustomParametersFromConfig(const QString &parameters);
91  void removeStoredCustomParametersFromWidget(const QString &parameters);
92  void showError(const QString &error);
93 
94 private slots:
95  void autoFindNeighbouringPaths();
96  void removeCurrentCustomParametersFromStorage();
97  void saveCustomParameters();
98  void showFindFailError();
99  void updateCustomParametersSaveState();
100 };
101 
102 #endif /* __ENGINECONFIGBASE_H__ */