1 /*
2 
3 Pencil2D - Traditional Animation Software
4 Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5 Copyright (C) 2012-2020 Matthew Chiawen Chang
6 
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; version 2 of the License.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 */
17 
18 #ifndef FILESPAGE_H
19 #define FILESPAGE_H
20 
21 #include <QDir>
22 
23 class PreferenceManager;
24 class QListWidgetItem;
25 class QSettings;
26 
27 namespace Ui {
28 class FilesPage;
29 }
30 
31 class FilesPage : public QWidget
32 {
33 Q_OBJECT
34 
35 public:
36     FilesPage();
37     ~FilesPage() override;
setManager(PreferenceManager * p)38     void setManager(PreferenceManager* p) { mManager = p; }
39 
40 public slots:
41     void initPreset();
42     void addPreset();
43     void removePreset();
44     void setDefaultPreset();
45     void presetNameChanged(QListWidgetItem* item);
46 
47     void updateValues();
48     void askForPresetChange(int b);
49     void loadMostRecentChange(int b);
50     void loadDefaultPreset(int b);
51     void autoSaveChange(int b);
52     void autoSaveNumberChange(int number);
53 
54 signals:
55     void clearRecentList();
56 
57 private:
58     Ui::FilesPage* ui = nullptr;
59     PreferenceManager* mManager = nullptr;
60     QSettings* mPresetSettings = nullptr;
61     QDir mPresetDir;
62     int mMaxPresetIndex = 0;
63 };
64 
65 #endif // FILESPAGE_H
66