1 | /* |
---|
2 | * This file Copyright (C) 2009 Charles Kerr <charles@transmissionbt.com> |
---|
3 | * |
---|
4 | * This file is licensed by the GPL version 2. Works owned by the |
---|
5 | * Transmission project are granted a special exemption to clause 2(b) |
---|
6 | * so that the bulk of its code can remain under the MIT license. |
---|
7 | * This exemption does not extend to derived works not owned by |
---|
8 | * the Transmission project. |
---|
9 | * |
---|
10 | * $Id: prefs-dialog.h 8763 2009-06-30 18:08:50Z charles $ |
---|
11 | */ |
---|
12 | |
---|
13 | #ifndef PREFS_DIALOG_H |
---|
14 | #define PREFS_DIALOG_H |
---|
15 | |
---|
16 | #include <QDialog> |
---|
17 | #include <QSet> |
---|
18 | #include "prefs.h" |
---|
19 | |
---|
20 | class QAbstractButton; |
---|
21 | class QCheckBox; |
---|
22 | class QString; |
---|
23 | class QDoubleSpinBox; |
---|
24 | class QSpinBox; |
---|
25 | class QLabel; |
---|
26 | class QLineEdit; |
---|
27 | class QVBoxLayout; |
---|
28 | class QTime; |
---|
29 | class QTimeEdit; |
---|
30 | class QWidget; |
---|
31 | class QPushButton; |
---|
32 | class QMessageBox; |
---|
33 | class QHttp; |
---|
34 | |
---|
35 | class Prefs; |
---|
36 | class Session; |
---|
37 | |
---|
38 | class PrefsDialog: public QDialog |
---|
39 | { |
---|
40 | Q_OBJECT |
---|
41 | |
---|
42 | private slots: |
---|
43 | void checkBoxToggled( bool checked ); |
---|
44 | void spinBoxChanged( int value ); |
---|
45 | void doubleSpinBoxChanged( double value ); |
---|
46 | void spinBoxChangedIdle( ); |
---|
47 | void timeChanged( const QTime& ); |
---|
48 | void textChanged( const QString& ); |
---|
49 | void updatePref( int key ); |
---|
50 | void encryptionEdited( int ); |
---|
51 | void altSpeedDaysEdited( int ); |
---|
52 | void sessionUpdated( ); |
---|
53 | void onWatchClicked( ); |
---|
54 | void onWatchSelected( const QStringList& ); |
---|
55 | void onDestinationClicked( ); |
---|
56 | void onDestinationSelected( const QStringList& ); |
---|
57 | void onPortTested( bool ); |
---|
58 | void onPortTest( ); |
---|
59 | |
---|
60 | void onUpdateBlocklistClicked( ); |
---|
61 | void onUpdateBlocklistCancelled( ); |
---|
62 | void onBlocklistDialogDestroyed( QObject * ); |
---|
63 | void onBlocklistUpdated( int n ); |
---|
64 | |
---|
65 | private: |
---|
66 | QDoubleSpinBox * doubleSpinBoxNew( int key, double low, double high, double step, int decimals ); |
---|
67 | QCheckBox * checkBoxNew( const QString& text, int key ); |
---|
68 | QSpinBox * spinBoxNew( int key, int low, int high, int step ); |
---|
69 | QTimeEdit * timeEditNew( int key ); |
---|
70 | QLineEdit * lineEditNew( int key, int mode = 0 ); |
---|
71 | void enableBuddyWhenChecked( QCheckBox *, QWidget * ); |
---|
72 | void updateBlocklistCheckBox( ); |
---|
73 | |
---|
74 | public: |
---|
75 | PrefsDialog( Session&, Prefs&, QWidget * parent = 0 ); |
---|
76 | ~PrefsDialog( ); |
---|
77 | |
---|
78 | private: |
---|
79 | bool isAllowed( int key ) const; |
---|
80 | QWidget * createTorrentsTab( ); |
---|
81 | QWidget * createNetworkTab( ); |
---|
82 | QWidget * createPrivacyTab( ); |
---|
83 | QWidget * createSpeedTab( ); |
---|
84 | QWidget * createWebTab( Session& ); |
---|
85 | QWidget * createTrackerTab( ); |
---|
86 | |
---|
87 | private: |
---|
88 | typedef QMap<int,QWidget*> key2widget_t; |
---|
89 | key2widget_t myWidgets; |
---|
90 | const bool myIsServer; |
---|
91 | Session& mySession; |
---|
92 | Prefs& myPrefs; |
---|
93 | QVBoxLayout * myLayout; |
---|
94 | QLabel * myPortLabel; |
---|
95 | QPushButton * myPortButton; |
---|
96 | QPushButton * myWatchButton; |
---|
97 | QPushButton * myDestinationButton; |
---|
98 | QWidgetList myWebWidgets; |
---|
99 | QWidgetList myWebAuthWidgets; |
---|
100 | QWidgetList myWebWhitelistWidgets; |
---|
101 | QWidgetList myProxyWidgets; |
---|
102 | QWidgetList myProxyAuthWidgets; |
---|
103 | QWidgetList mySchedWidgets; |
---|
104 | QWidgetList myBlockWidgets; |
---|
105 | QWidgetList myUnsupportedWhenRemote; |
---|
106 | |
---|
107 | int myBlocklistHttpTag; |
---|
108 | QHttp * myBlocklistHttp; |
---|
109 | QMessageBox * myBlocklistDialog; |
---|
110 | }; |
---|
111 | |
---|
112 | #endif |
---|