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  QIcon icon() const override;
46 
47  QString name() const override
48  {
49  return tr("File paths");
50  }
51 
52  void saveSettings() override;
53 
54 private:
56 
57  void addPath(const FileSearchPath &fileSearchPath);
58  void addPathToTable(const FileSearchPath &fileSearchPath);
59  bool isPathAlreadyDefined(const QString &path) const;
60  void reject_();
61  QString validatePath(const QString &path) const;
62 
63 private slots:
64  void btnAddWadPath_Click();
65  void btnBrowseWadPath_Click();
66  void btnRemoveWadPath_Click();
67  void cbResolveTemplatedPathsPlaceholders_Toggled(bool state);
68 };
69 
70 #endif