cfgwadalias.h
1 //------------------------------------------------------------------------------
2 // cfgwadalias.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) 2014 "Zalewa" <zalewapl@gmail.com>
22 //------------------------------------------------------------------------------
23 #ifndef idBE57B8CD_234F_4EEE_AC1B1FAAFB11B1CD
24 #define idBE57B8CD_234F_4EEE_AC1B1FAAFB11B1CD
25 
26 #include "dptr.h"
27 #include "gui/configuration/configpage.h"
28 #include <QComboBox>
29 
30 class FileAlias;
31 class QTableWidgetItem;
32 
33 class CFGWadAlias : public ConfigPage
34 {
35  Q_OBJECT
36 
37 public:
38  CFGWadAlias(QWidget *parent = nullptr);
39  ~CFGWadAlias() override;
40 
41  QIcon icon() const override;
42  QString name() const override
43  {
44  return tr("WAD aliases");
45  }
46 
47  void readSettings() override;
48 
49 protected:
50  void saveSettings() override;
51  void showEvent(QShowEvent *event) override;
52 
53 private:
55 
56  void addAliasToTable(const FileAlias &alias);
57  FileAlias aliasFromRow(int row) const;
58  void applyAliasToRow(int row, const FileAlias &alias);
59  QList<FileAlias> aliases() const;
60  int findRowWithWad(const QString &wadName);
61  QComboBox *mkMatchTypeComboBox(int row);
62  void resizeRowsToContents();
63  QTableWidgetItem *toolTipItem(const QString &contents);
64 
65 private slots:
66  void addDefaults();
67  void addNewEntry();
68  void removeSelected();
69  void resizeRowToContents(int row);
70 };
71 
72 #endif