2009-04-09 18:55:47 +00:00
|
|
|
/*
|
2010-08-01 20:36:13 +00:00
|
|
|
* This file Copyright (C) Mnemosyne LLC
|
2009-04-09 18:55:47 +00:00
|
|
|
*
|
2010-08-01 20:36:13 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
2009-04-09 18:55:47 +00:00
|
|
|
*
|
2009-05-31 19:33:48 +00:00
|
|
|
* $Id$
|
2009-04-09 18:55:47 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PREFS_DIALOG_H
|
|
|
|
#define PREFS_DIALOG_H
|
|
|
|
|
|
|
|
#include <QDialog>
|
|
|
|
#include <QSet>
|
|
|
|
#include "prefs.h"
|
|
|
|
|
|
|
|
class QAbstractButton;
|
|
|
|
class QCheckBox;
|
|
|
|
class QString;
|
|
|
|
class QDoubleSpinBox;
|
|
|
|
class QSpinBox;
|
|
|
|
class QLabel;
|
|
|
|
class QLineEdit;
|
|
|
|
class QVBoxLayout;
|
|
|
|
class QTime;
|
|
|
|
class QTimeEdit;
|
|
|
|
class QWidget;
|
|
|
|
class QPushButton;
|
|
|
|
class QMessageBox;
|
|
|
|
class QHttp;
|
|
|
|
|
|
|
|
class Prefs;
|
|
|
|
class Session;
|
|
|
|
|
|
|
|
class PrefsDialog: public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void checkBoxToggled( bool checked );
|
2010-12-04 00:19:52 +00:00
|
|
|
void spinBoxEditingFinished( );
|
|
|
|
void timeEditingFinished( );
|
|
|
|
void lineEditingFinished( );
|
2010-08-02 16:30:24 +00:00
|
|
|
void refreshPref( int key );
|
2009-04-09 18:55:47 +00:00
|
|
|
void encryptionEdited( int );
|
|
|
|
void altSpeedDaysEdited( int );
|
|
|
|
void sessionUpdated( );
|
|
|
|
void onWatchClicked( );
|
2010-05-08 22:42:28 +00:00
|
|
|
void onScriptClicked( );
|
2009-10-19 05:25:50 +00:00
|
|
|
void onIncompleteClicked( );
|
2009-04-09 18:55:47 +00:00
|
|
|
void onDestinationClicked( );
|
2010-06-04 01:00:27 +00:00
|
|
|
void onLocationSelected( const QString&, int key );
|
2009-04-09 18:55:47 +00:00
|
|
|
void onPortTested( bool );
|
|
|
|
void onPortTest( );
|
|
|
|
|
|
|
|
void onUpdateBlocklistClicked( );
|
|
|
|
void onUpdateBlocklistCancelled( );
|
|
|
|
void onBlocklistDialogDestroyed( QObject * );
|
|
|
|
void onBlocklistUpdated( int n );
|
|
|
|
|
|
|
|
private:
|
2010-07-04 06:07:21 +00:00
|
|
|
QDoubleSpinBox * doubleSpinBoxNew( int key, double low, double high, double step, int decimals );
|
2009-04-09 18:55:47 +00:00
|
|
|
QCheckBox * checkBoxNew( const QString& text, int key );
|
2010-07-04 06:07:21 +00:00
|
|
|
QSpinBox * spinBoxNew( int key, int low, int high, int step );
|
2009-04-09 18:55:47 +00:00
|
|
|
QTimeEdit * timeEditNew( int key );
|
|
|
|
QLineEdit * lineEditNew( int key, int mode = 0 );
|
|
|
|
void enableBuddyWhenChecked( QCheckBox *, QWidget * );
|
2010-10-31 17:16:12 +00:00
|
|
|
void updateBlocklistLabel( );
|
2009-04-09 18:55:47 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
PrefsDialog( Session&, Prefs&, QWidget * parent = 0 );
|
|
|
|
~PrefsDialog( );
|
|
|
|
|
|
|
|
private:
|
2010-08-02 16:30:24 +00:00
|
|
|
void setPref( int key, const QVariant& v );
|
2009-04-09 18:55:47 +00:00
|
|
|
bool isAllowed( int key ) const;
|
|
|
|
QWidget * createTorrentsTab( );
|
2009-06-27 05:23:13 +00:00
|
|
|
QWidget * createSpeedTab( );
|
2010-08-02 03:07:42 +00:00
|
|
|
QWidget * createPrivacyTab( );
|
|
|
|
QWidget * createNetworkTab( );
|
|
|
|
QWidget * createDesktopTab( );
|
2009-04-09 18:55:47 +00:00
|
|
|
QWidget * createWebTab( Session& );
|
|
|
|
|
|
|
|
private:
|
|
|
|
typedef QMap<int,QWidget*> key2widget_t;
|
|
|
|
key2widget_t myWidgets;
|
|
|
|
const bool myIsServer;
|
|
|
|
Session& mySession;
|
|
|
|
Prefs& myPrefs;
|
|
|
|
QVBoxLayout * myLayout;
|
|
|
|
QLabel * myPortLabel;
|
|
|
|
QPushButton * myPortButton;
|
|
|
|
QPushButton * myWatchButton;
|
2010-06-04 01:00:27 +00:00
|
|
|
QPushButton * myTorrentDoneScriptButton;
|
2010-05-08 22:42:28 +00:00
|
|
|
QCheckBox * myTorrentDoneScriptCheckbox;
|
2010-04-23 05:58:04 +00:00
|
|
|
QCheckBox * myIncompleteCheckbox;
|
2009-10-19 05:25:50 +00:00
|
|
|
QPushButton * myIncompleteButton;
|
2009-04-09 18:55:47 +00:00
|
|
|
QPushButton * myDestinationButton;
|
|
|
|
QWidgetList myWebWidgets;
|
|
|
|
QWidgetList myWebAuthWidgets;
|
|
|
|
QWidgetList myWebWhitelistWidgets;
|
|
|
|
QWidgetList myProxyWidgets;
|
|
|
|
QWidgetList myProxyAuthWidgets;
|
|
|
|
QWidgetList mySchedWidgets;
|
|
|
|
QWidgetList myBlockWidgets;
|
|
|
|
QWidgetList myUnsupportedWhenRemote;
|
|
|
|
|
|
|
|
int myBlocklistHttpTag;
|
|
|
|
QHttp * myBlocklistHttp;
|
|
|
|
QMessageBox * myBlocklistDialog;
|
2010-10-31 17:16:12 +00:00
|
|
|
QLabel * myBlocklistLabel;
|
2009-04-09 18:55:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|