Songbook-Client  0.7
This application is a manager of customguitar songbooks
 All Classes Files Functions Variables Enumerations Enumerator Pages
preferences.hh
1 // Copyright (C) 2009-2011, Romain Goffe <romain.goffe@gmail.com>
2 // Copyright (C) 2009-2011, Alexandre Dupas <alexandre.dupas@gmail.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License as
6 // published by the Free Software Foundation; either version 2 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but
10 // WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 // 02110-1301, USA.
18 //******************************************************************************
19 #ifndef __PREFERENCES_HH__
20 #define __PREFERENCES_HH__
21 
22 #include <QDialog>
23 #include <QWidget>
24 #include <QScrollArea>
25 #include <QPushButton>
26 
27 #if defined(Q_OS_WIN32)
28 #define PLATFORM_BUILD_COMMAND "cmd.exe /C windows\\make.bat %basename"
29 #define PLATFORM_CLEAN_COMMAND "cmd.exe /C windows\\clean.bat"
30 #define PLATFORM_CLEANALL_COMMAND "cmd.exe /C windows\\cleanall.bat"
31 #elif defined(Q_OS_MAC)
32 #define PLATFORM_BUILD_COMMAND "macos/make.sh %basename"
33 #define PLATFORM_CLEAN_COMMAND "macos/clean.sh"
34 #define PLATFORM_CLEANALL_COMMAND "macos/cleanall.sh"
35 #else //Unix/Linux
36 #define PLATFORM_BUILD_COMMAND "make %target"
37 #define PLATFORM_CLEAN_COMMAND "make clean"
38 #define PLATFORM_CLEANALL_COMMAND "make cleanall"
39 #endif
40 
41 #include "config.hh"
42 
43 class QListWidget;
44 class QListWidgetItem;
45 class QStackedWidget;
46 
47 class QLabel;
48 class QLineEdit;
49 class QCheckBox;
50 class QSpinBox;
51 class CFileChooser;
52 class CMainWindow;
53 
54 class QtGroupBoxPropertyBrowser;
55 
58 class ConfigDialog : public QDialog
59 {
60  Q_OBJECT
61 
62 public:
64  ConfigDialog(QWidget* parent=0);
65 
69  CMainWindow* parent() const;
70 
71 public slots:
75  void changePage(QListWidgetItem *current, QListWidgetItem *previous);
76 
77 protected:
81  void closeEvent(QCloseEvent *event);
82 
83 private:
84  void createIcons();
85 
86  QListWidget *m_contentsWidget;
87  QStackedWidget *m_pagesWidget;
88 };
89 
92 class Page : public QScrollArea
93 {
94  Q_OBJECT
95 public:
97  Page(QWidget *parent=0);
98 
102  ConfigDialog * parent() const;
103 
107  void setLayout(QLayout *layout);
108 
109 protected:
113  void closeEvent(QCloseEvent *event);
114 
115 private:
116  virtual void readSettings();
117  virtual void writeSettings();
118 
119  QWidget *m_content;
120 };
121 
128 class DisplayPage : public Page
129 {
130  Q_OBJECT
131 
132 public:
134  DisplayPage(QWidget *parent=0);
135 
136 private:
137  void readSettings();
138  void writeSettings();
139 
140  QCheckBox *m_statusBarCheckBox;
141  QCheckBox *m_toolBarCheckBox;
142  QCheckBox *m_compilationLogCheckBox;
143 
144  QCheckBox *m_titleCheckBox;
145  QCheckBox *m_artistCheckBox;
146  QCheckBox *m_pathCheckBox;
147  QCheckBox *m_albumCheckBox;
148  QCheckBox *m_lilypondCheckBox;
149  QCheckBox *m_langCheckBox;
150 };
151 
157 class OptionsPage : public Page
158 {
159  Q_OBJECT
160 
161 public:
163  OptionsPage(QWidget *parent=0);
164 
165 private slots:
166  void checkWorkingPath(const QString &path);
167  void resetBuildCommand();
168  void resetCleanCommand();
169  void resetCleanallCommand();
170 
171 private:
172  void readSettings();
173  void writeSettings();
174 
175  CFileChooser *m_workingPath;
176  QLabel *m_workingPathValid;
177 
178  QLineEdit *m_buildCommand;
179  QLineEdit *m_cleanCommand;
180  QLineEdit *m_cleanallCommand;
181 };
182 
189 class EditorPage : public Page
190 {
191  Q_OBJECT
192 
193 public:
195  EditorPage(QWidget *parent=0);
196 
197 private slots:
198  void selectFont();
199  void updateFontButton();
200 
201 private:
202  void readSettings();
203  void writeSettings();
204 
205  QCheckBox *m_numberLinesCheckBox;
206  QCheckBox *m_highlightCurrentLineCheckBox;
207  QCheckBox *m_colorEnvironmentsCheckBox;
208  QPushButton *m_fontButton;
209  QFont m_font;
210  QString m_fontstr;
211 };
212 
213 #ifdef ENABLE_LIBRARY_DOWNLOAD
214 
218 class NetworkPage : public Page
219 {
220  Q_OBJECT
221 
222 public:
224  NetworkPage(QWidget *parent=0);
225 
226 private:
227  void readSettings();
228  void writeSettings();
229 
230  QLineEdit *m_hostname;
231  QSpinBox *m_port;
232  QLineEdit *m_user;
233  QLineEdit *m_password;
234 };
235 
236 #endif // ENABLE_LIBRARY_DOWNLOAD
237 
241 class SongbookPage : public Page
242 {
243  Q_OBJECT
244 
245 public:
247  SongbookPage(QWidget *parent=0);
248 
249 private slots:
250  void updatePropertyEditor();
251 
252 private:
253  QtGroupBoxPropertyBrowser * m_propertyEditor;
254  CMainWindow *m_mainwindow;
255 };
256 
257 #endif // __PREFERENCES_HH__