cfgfilepaths.h
1 //------------------------------------------------------------------------------
2 // cfgfilepaths.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) 2009 "Zalewa" <zalewapl@gmail.com>
22 //------------------------------------------------------------------------------
23 
24 #ifndef __CFG_FILE_PATHS_H_
25 #define __CFG_FILE_PATHS_H_
26 
27 #include "dptr.h"
28 #include "gui/configuration/configpage.h"
29 
30 class FileSearchPath;
31 class QFileInfo;
32 
33 class CFGFilePaths : public ConfigPage
34 {
35  Q_OBJECT
36 
37 public:
38  CFGFilePaths(QWidget *parent = nullptr);
39  ~CFGFilePaths() override;
40 
41  void readSettings() override;
42  Validation validate() override;
43 
44 protected:
45  void addPath(const FileSearchPath &fileSearchPath);
46 
47  QIcon icon() const override;
48 
49  bool isPathAlreadyDefined(const QString &path);
50 
51  QString name() const override
52  {
53  return tr("File Paths");
54  }
55 
56  void saveSettings() override;
57 
58 protected slots:
59  void btnAddWadPath_Click();
60  void btnRemoveWadPath_Click();
61 
62 private:
64 
65  QString validatePath(const QString &path) const;
66 };
67 
68 #endif