1 /*****************************************************************************
2  * simple_preferences.hpp : Simple prefs
3  ****************************************************************************
4  * Copyright (C) 2006 the VideoLAN team
5  * $Id: 856b88ba9714b565427b4849ea2670d2ce56e51b $
6  *
7  * Authors: Clément Stenac <zorglub@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23 
24 #ifndef VLC_QT_SIMPLE_PREFERENCES_HPP_
25 #define VLC_QT_SIMPLE_PREFERENCES_HPP_
26 
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30 
31 #include <vlc_common.h>
32 #include <vlc_interface.h>
33 
34 #include "ui/sprefs_input.h"
35 #include "ui/sprefs_audio.h"
36 #include "ui/sprefs_video.h"
37 #include "ui/sprefs_subtitles.h"
38 #include "ui/sprefs_interface.h"
39 
40 #ifdef _WIN32
41 # include "util/registry.hpp"
42 #endif
43 
44 #include <QWidget>
45 
46 enum {
47     SPrefsInterface = 0,
48     SPrefsAudio,
49     SPrefsVideo,
50     SPrefsSubtitles,
51     SPrefsInputAndCodecs,
52     SPrefsHotkeys,
53     SPrefsMax
54 };
55 #define SPrefsDefaultCat SPrefsInterface
56 
57 enum {
58     CachingCustom = 0,
59     CachingLowest = 100,
60     CachingLow    = 200,
61     CachingNormal = 300,
62     CachingHigh   = 500,
63     CachingHigher = 1000
64 };
65 
66 class ConfigControl;
67 class QString;
68 
69 #ifdef _WIN32
70 class QTreeWidgetItem;
71 #endif
72 
73 class SPrefsCatList : public QWidget
74 {
75     Q_OBJECT
76 public:
77     SPrefsCatList( intf_thread_t *, QWidget * );
~SPrefsCatList()78     virtual ~SPrefsCatList() {};
79 private:
80     intf_thread_t *p_intf;
81 signals:
82     void currentItemChanged( int );
83 public slots:
84     void switchPanel( int );
85 };
86 
87 class SPrefsPanel : public QWidget
88 {
89     Q_OBJECT
90 public:
91     SPrefsPanel( intf_thread_t *, QWidget *, int );
92     virtual ~SPrefsPanel();
93     void apply();
94     void clean();
95 #ifdef _WIN32
96     void cleanLang();
97 #endif
98 
99 private:
100     intf_thread_t *p_intf;
101     QList<ConfigControl *> controls;
102 
103     int number;
104 
105     QHash<QString, QWidget*> optionWidgets;
106     QStringList qs_filter;
107     QButtonGroup *radioGroup;
108 
109     char *lang;
110 
111 #ifdef _WIN32
112     QList<QTreeWidgetItem *> listAsso;
113     bool addType( const char * psz_ext, QTreeWidgetItem*, QTreeWidgetItem*, QVLCRegistry* );
114     void saveLang();
115 #endif
116 
117 /* Display only the options for the selected audio output */
118 private slots:
119     void lastfm_Changed( int );
120     void updateVideoOptions( int );
121     void updateAudioOptions( int );
122     void updateAudioVolume( int );
123     void langChanged( int );
124 #ifdef _WIN32
125     void assoDialog();
126     void updateCheckBoxes( QTreeWidgetItem*, int );
127     void saveAsso();
128 #endif
129     void configML();
130     void changeStyle( QString );
131 };
132 
133 #endif
134