1 /*  smplayer, GUI front-end for mplayer.
2     Copyright (C) 2006-2021 Ricardo Villalba <ricardo@smplayer.info>
3 
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8 
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17 */
18 
19 #ifndef PREFERENCESDIALOG_H
20 #define PREFERENCESDIALOG_H
21 
22 #include "ui_preferencesdialog.h"
23 
24 /*
25 #ifdef Q_OS_WIN
26 #define USE_ASSOCIATIONS 1
27 #endif
28 */
29 
30 class InfoWindow;
31 class QPushButton;
32 
33 class PrefWidget;
34 class PrefGeneral;
35 class PrefDrives;
36 class PrefPerformance;
37 class PrefSubtitles;
38 class PrefInterface;
39 class PrefInput;
40 class PrefAdvanced;
41 class PrefPlaylist;
42 class PrefTV;
43 class PrefUpdates;
44 class PrefNetwork;
45 class PrefAssociations;
46 
47 class Preferences;
48 
49 
50 class PreferencesDialog : public QDialog, public Ui::PreferencesDialog
51 {
52 	Q_OBJECT
53 	Q_PROPERTY(bool iconMode READ isIconMode WRITE setIconMode)
54 
55 public:
56 	enum Section { General=0, Drives=1, Performance=2,
57                    Subtitles=3, Gui=4, Mouse=5, Advanced=6, Associations=7 };
58 
59 	PreferencesDialog( QWidget * parent = 0, Qt::WindowFlags f = QFlag(0) );
60 	~PreferencesDialog();
61 
mod_general()62 	PrefGeneral * mod_general() { return page_general; };
mod_interface()63 	PrefInterface * mod_interface() { return page_interface; };
mod_input()64 	PrefInput * mod_input() { return page_input; };
mod_advanced()65 	PrefAdvanced * mod_advanced() { return page_advanced; };
mod_playlist()66 	PrefPlaylist * mod_playlist() { return page_playlist; };
mod_updates()67 	PrefUpdates * mod_updates() { return page_updates; };
mod_network()68 	PrefNetwork * mod_network() { return page_network; };
69 
70 	void addSection(PrefWidget *w);
71 
72 	// Pass data to the standard dialogs
73 	void setData(Preferences * pref);
74 
75 	// Apply changes
76 	void getData(Preferences * pref);
77 
78 	// Return true if the mplayer process should be restarted.
79 	bool requiresRestart();
80 
81 	void setIconMode(bool);
isIconMode()82 	bool isIconMode() { return icon_mode; };
83 
84 public slots:
85 	void showSection(Section s);
86 
87 	virtual void accept(); // Reimplemented to send a signal
88 	virtual void reject();
89 
90 signals:
91 	void applied();
92 
93 protected:
94 	virtual void retranslateStrings();
95 	virtual void changeEvent ( QEvent * event ) ;
96 
97 protected slots:
98 	void apply();
99 	void showHelp();
100 
101 protected:
102 	PrefGeneral * page_general;
103 	PrefDrives * page_drives;
104 	PrefPerformance * page_performance;
105 	PrefSubtitles * page_subtitles;
106 	PrefInterface * page_interface;
107 	PrefInput * page_input;
108 	PrefPlaylist * page_playlist;
109 #ifdef TV_SUPPORT
110 	PrefTV * page_tv;
111 #endif
112 	PrefUpdates * page_updates;
113 	PrefNetwork * page_network;
114 	PrefAdvanced * page_advanced;
115 
116 #if USE_ASSOCIATIONS
117 	PrefAssociations* page_associations;
118 #endif
119 
120 	InfoWindow * help_window;
121 
122 private:
123 	QPushButton * okButton;
124 	QPushButton * cancelButton;
125 	QPushButton * applyButton;
126 	QPushButton * helpButton;
127 
128 	bool icon_mode;
129 };
130 
131 #endif
132