Pencil2D  ff90c0872e88be3bf81c548cd60f01983012ec49
Pencil2D is an animation software for both bitmap and vector graphics. It is free, multi-platform, and open source.
 All Classes Functions
preferencesdialog.h
1 /*
2 
3 Pencil - Traditional Animation Software
4 Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5 Copyright (C) 2013-2017 Matt 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 #ifndef _PREFERENCES_H_
18 #define _PREFERENCES_H_
19 
20 #include <QDialog>
21 #include <QListWidget>
22 #include <QStackedWidget>
23 #include <QButtonGroup>
24 #include <QGroupBox>
25 #include <QCheckBox>
26 #include <QHBoxLayout>
27 #include <QVBoxLayout>
28 #include <QRadioButton>
29 #include <QLineEdit>
30 #include <QSpinBox>
31 #include <QScrollArea>
32 #include <QLabel>
33 #include <QPushButton>
34 
35 #include "pencildef.h"
36 #include "scribblearea.h"
37 #include "shortcutspage.h"
38 #include "preferencemanager.h"
39 
40 class QListWidget;
41 class QListWidgetItem;
42 class QStackedWidget;
43 class QComboBox;
44 class PreferenceManager;
45 class FilesPage;
46 
47 
48 class PreferencesDialog : public QDialog
49 {
50  Q_OBJECT
51 
52 public:
53  PreferencesDialog(QWidget* parent);
55 
56  void init( PreferenceManager* m );
57 
58  void changePage(QListWidgetItem* current, QListWidgetItem* previous);
59  void updateRecentListBtn(bool isEmpty);
60 
61 Q_SIGNALS:
62  void windowOpacityChange(int);
63  void curveOpacityChange(int);
64  void clearRecentList();
65  void updateRecentFileListBtn();
66 
67 protected:
68  void closeEvent( QCloseEvent* ) override;
69 
70 private:
71  void createIcons();
72 
73  QListWidget* contentsWidget = nullptr;
74  QStackedWidget* pagesWidget = nullptr;
75  QScrollArea* scrollArea = nullptr;
76 
77  PreferenceManager* mPrefManager = nullptr;
78  FilesPage* mFilesPage = nullptr;
79 };
80 
81 
82 class GeneralPage : public QWidget
83 {
84  Q_OBJECT
85 public:
86  GeneralPage(QWidget* parent = 0);
87  void setManager( PreferenceManager* p ) { mManager = p; }
88 
89 
90 public slots:
91  void updateValues();
92  void gridSizeChange(int value);
93 
94 protected:
95  void resizeEvent(QResizeEvent *event) override;
96 
97 private:
98  void languageChanged( int i );
99  void shadowsCheckboxStateChanged(bool b);
100  void antiAliasCheckboxStateChanged( bool b );
101  void toolCursorsCheckboxStateChanged( bool b );
102  void dottedCursorCheckboxStateChanged( bool b );
103  void highResCheckboxStateChanged(bool b);
104  void gridCheckBoxStateChanged(bool b);
105  void curveSmoothingChange(int value);
106  void backgroundChange(int value);
107 
108  PreferenceManager* mManager = nullptr;
109  QScrollArea* scrollArea;
110  QWidget* contents;
111 
112  QComboBox* mLanguageCombo = nullptr;
113  QSlider* mWindowOpacityLevel;
114  QSlider* mCurveSmoothingLevel;
115  QCheckBox* mShadowsBox;
116  QCheckBox* mToolCursorsBox;
117  QCheckBox* mAntialiasingBox;
118  QCheckBox* mHighResBox;
119  QButtonGroup *mBackgroundButtons;
120  QCheckBox* mDottedCursorBox;
121  QSpinBox* mGridSizeInput;
122  QCheckBox* mGridCheckBox;
123 
124  int gridSize;
125 
126 };
127 
128 class TimelinePage : public QWidget
129 {
130  Q_OBJECT
131 public:
132  TimelinePage(QWidget* parent = 0);
133  void setManager( PreferenceManager* p ) { mManager = p; }
134 
135 public slots:
136  void updateValues();
137 
138  void lengthSizeChange(QString);
139  void fontSizeChange(int);
140  void frameSizeChange(int);
141  void labelChange(bool);
142  void scrubChange(bool);
143 
144 private:
145  PreferenceManager* mManager = nullptr;
146  QCheckBox* mDrawLabel;
147  QSpinBox* mFontSize;
148  QSlider* mFrameSize;
149  QLineEdit* mLengthSize;
150  QCheckBox* mScrubBox;
151 };
152 
153 class FilesPage : public QWidget
154 {
155  Q_OBJECT
156 
157 public:
158  FilesPage(QWidget *parent = 0);
159  void setManager( PreferenceManager* p ) { mManager = p; }
160 
161 public slots:
162  void updateValues();
163  void autosaveChange(bool b);
164  void autosaveNumberChange(int number);
165  void clearRecentFilesList();
166  QPushButton *getClearRecentFilesBtn() { return mClearRecentFilesBtn; }
167  void updateClearRecentListButton();
168 
169 Q_SIGNALS:
170  void clearRecentList();
171 
172 private:
173  PreferenceManager *mManager = nullptr;
174  QCheckBox *mAutosaveCheckBox;
175  QSpinBox *mAutosaveNumberBox;
176  QPushButton *mClearRecentFilesBtn;
177 
178 };
179 
180 
181 class ToolsPage : public QWidget
182 {
183  Q_OBJECT
184 public:
185  ToolsPage(QWidget* parent = 0);
186  void setManager( PreferenceManager* p ) { mManager = p; }
187 
188 public slots:
189  void updateValues();
190  void onionMaxOpacityChange(int);
191  void onionMinOpacityChange(int);
192  void onionPrevFramesNumChange(int);
193  void onionNextFramesNumChange(int);
194  void quickSizingChange(bool);
195 private:
196  PreferenceManager* mManager = nullptr;
197  QSpinBox* mOnionMaxOpacityBox;
198  QSpinBox* mOnionMinOpacityBox;
199  QSpinBox* mOnionPrevFramesNumBox;
200  QSpinBox* mOnionNextFramesNumBox;
201  QCheckBox * mUseQuickSizingBox;
202 };
203 
204 #endif