Normalize EOL

This commit is contained in:
Nick Tiskov 2014-12-20 20:29:17 +03:00
parent 197c201269
commit 385bbe0df6
18 changed files with 2639 additions and 2639 deletions

View file

@ -1,9 +1,9 @@
Flag icons - http://www.famfamfam.com Flag icons - http://www.famfamfam.com
These icons are public domain, and as such are free for any use (attribution appreciated but not required). These icons are public domain, and as such are free for any use (attribution appreciated but not required).
Note that these flags are named using the ISO3166-1 alpha-2 country codes where appropriate. A list of codes can be found at http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 Note that these flags are named using the ISO3166-1 alpha-2 country codes where appropriate. A list of codes can be found at http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
If you find these icons useful, please donate via paypal to mjames@gmail.com (or click the donate button available at http://www.famfamfam.com/lab/icons/silk) If you find these icons useful, please donate via paypal to mjames@gmail.com (or click the donate button available at http://www.famfamfam.com/lab/icons/silk)
Contact: mjames@gmail.com Contact: mjames@gmail.com

View file

@ -1,101 +1,101 @@
/* /*
* Bittorrent Client using Qt and libtorrent. * Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2014 Vladimir Golovnev <glassez@yandex.ru> * Copyright (C) 2014 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2006 Christophe Dumez * Copyright (C) 2006 Christophe Dumez
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to * In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with * link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library), * modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public * and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you * License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s), * modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this * but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version. * exception statement from your version.
*/ */
#include <QDebug> #include <QDebug>
#include <QFileInfo> #include <QFileInfo>
#include <QLocale> #include <QLocale>
#include <QLibraryInfo> #include <QLibraryInfo>
#include <QSysInfo> #include <QSysInfo>
#include "application.h" #include "application.h"
#include "preferences.h" #include "preferences.h"
Application::Application(const QString &id, int &argc, char **argv) Application::Application(const QString &id, int &argc, char **argv)
#ifndef DISABLE_GUI #ifndef DISABLE_GUI
: SessionApplication(id, argc, argv) : SessionApplication(id, argc, argv)
#else #else
: QtSingleCoreApplication(id, argc, argv) : QtSingleCoreApplication(id, argc, argv)
#endif #endif
{ {
#if defined(Q_OS_MACX) && !defined(DISABLE_GUI) #if defined(Q_OS_MACX) && !defined(DISABLE_GUI)
if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_8) { if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_8) {
// fix Mac OS X 10.9 (mavericks) font issue // fix Mac OS X 10.9 (mavericks) font issue
// https://bugreports.qt-project.org/browse/QTBUG-32789 // https://bugreports.qt-project.org/browse/QTBUG-32789
QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande"); QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
} }
#endif #endif
setApplicationName("qBittorrent"); setApplicationName("qBittorrent");
initializeTranslation(); initializeTranslation();
#ifndef DISABLE_GUI #ifndef DISABLE_GUI
setStyleSheet("QStatusBar::item { border-width: 0; }"); setStyleSheet("QStatusBar::item { border-width: 0; }");
setQuitOnLastWindowClosed(false); setQuitOnLastWindowClosed(false);
#endif #endif
} }
void Application::initializeTranslation() void Application::initializeTranslation()
{ {
Preferences* const pref = Preferences::instance(); Preferences* const pref = Preferences::instance();
// Load translation // Load translation
QString locale = pref->getLocale(); QString locale = pref->getLocale();
if (locale.isEmpty()) { if (locale.isEmpty()) {
locale = QLocale::system().name(); locale = QLocale::system().name();
pref->setLocale(locale); pref->setLocale(locale);
} }
if (qtTranslator_.load( if (qtTranslator_.load(
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
QString::fromUtf8("qtbase_") + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath)) || QString::fromUtf8("qtbase_") + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath)) ||
qtTranslator_.load( qtTranslator_.load(
#endif #endif
QString::fromUtf8("qt_") + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) { QString::fromUtf8("qt_") + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
qDebug("Qt %s locale recognized, using translation.", qPrintable(locale)); qDebug("Qt %s locale recognized, using translation.", qPrintable(locale));
} }
else { else {
qDebug("Qt %s locale unrecognized, using default (en).", qPrintable(locale)); qDebug("Qt %s locale unrecognized, using default (en).", qPrintable(locale));
} }
installTranslator(&qtTranslator_); installTranslator(&qtTranslator_);
if (translator_.load(QString::fromUtf8(":/lang/qbittorrent_") + locale)) { if (translator_.load(QString::fromUtf8(":/lang/qbittorrent_") + locale)) {
qDebug("%s locale recognized, using translation.", qPrintable(locale)); qDebug("%s locale recognized, using translation.", qPrintable(locale));
} }
else { else {
qDebug("%s locale unrecognized, using default (en).", qPrintable(locale)); qDebug("%s locale unrecognized, using default (en).", qPrintable(locale));
} }
installTranslator(&translator_); installTranslator(&translator_);
#ifndef DISABLE_GUI #ifndef DISABLE_GUI
if (locale.startsWith("ar") || locale.startsWith("he")) { if (locale.startsWith("ar") || locale.startsWith("he")) {
qDebug("Right to Left mode"); qDebug("Right to Left mode");
setLayoutDirection(Qt::RightToLeft); setLayoutDirection(Qt::RightToLeft);
} }
else { else {
setLayoutDirection(Qt::LeftToRight); setLayoutDirection(Qt::LeftToRight);
} }
#endif #endif
} }

View file

@ -1,59 +1,59 @@
/* /*
* Bittorrent Client using Qt and libtorrent. * Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2014 Vladimir Golovnev <glassez@yandex.ru> * Copyright (C) 2014 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2006 Christophe Dumez * Copyright (C) 2006 Christophe Dumez
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to * In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with * link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library), * modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public * and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you * License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s), * modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this * but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version. * exception statement from your version.
*/ */
#ifndef APPLICATION_H #ifndef APPLICATION_H
#define APPLICATION_H #define APPLICATION_H
#include <QStringList> #include <QStringList>
#include <QTranslator> #include <QTranslator>
#ifndef DISABLE_GUI #ifndef DISABLE_GUI
#include "sessionapplication.h" #include "sessionapplication.h"
#else #else
#include "qtsinglecoreapplication.h" #include "qtsinglecoreapplication.h"
#endif #endif
class Application class Application
#ifndef DISABLE_GUI #ifndef DISABLE_GUI
: public SessionApplication : public SessionApplication
#else #else
: public QtSingleCoreApplication : public QtSingleCoreApplication
#endif #endif
{ {
public: public:
Application(const QString &id, int &argc, char **argv); Application(const QString &id, int &argc, char **argv);
private: private:
QTranslator qtTranslator_; QTranslator qtTranslator_;
QTranslator translator_; QTranslator translator_;
void initializeTranslation(); void initializeTranslation();
}; };
#endif // APPLICATION_H #endif // APPLICATION_H

View file

@ -1,121 +1,121 @@
/* /*
* Bittorrent Client using Qt4 and libtorrent. * Bittorrent Client using Qt4 and libtorrent.
* Copyright (C) 2013 Nick Tiskov * Copyright (C) 2013 Nick Tiskov
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to * In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with * link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library), * modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public * and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you * License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s), * modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this * but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version. * exception statement from your version.
* *
* Contact : daymansmail@gmail.com * Contact : daymansmail@gmail.com
*/ */
#include <QDesktopWidget> #include <QDesktopWidget>
#include "mainwindow.h" #include "mainwindow.h"
#include "autoexpandabledialog.h" #include "autoexpandabledialog.h"
#include "ui_autoexpandabledialog.h" #include "ui_autoexpandabledialog.h"
AutoExpandableDialog::AutoExpandableDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AutoExpandableDialog) { AutoExpandableDialog::AutoExpandableDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AutoExpandableDialog) {
ui->setupUi(this); ui->setupUi(this);
} }
AutoExpandableDialog::~AutoExpandableDialog() { AutoExpandableDialog::~AutoExpandableDialog() {
delete ui; delete ui;
} }
QString AutoExpandableDialog::getText(QWidget *parent, const QString &title, const QString &label, QString AutoExpandableDialog::getText(QWidget *parent, const QString &title, const QString &label,
QLineEdit::EchoMode mode, const QString &text, bool *ok, QLineEdit::EchoMode mode, const QString &text, bool *ok,
Qt::InputMethodHints inputMethodHints) { Qt::InputMethodHints inputMethodHints) {
AutoExpandableDialog d(parent); AutoExpandableDialog d(parent);
d.setWindowTitle(title); d.setWindowTitle(title);
d.ui->textLabel->setText(label); d.ui->textLabel->setText(label);
d.ui->textEdit->setText(text); d.ui->textEdit->setText(text);
d.ui->textEdit->setEchoMode(mode); d.ui->textEdit->setEchoMode(mode);
d.ui->textEdit->setInputMethodHints(inputMethodHints); d.ui->textEdit->setInputMethodHints(inputMethodHints);
bool res = d.exec(); bool res = d.exec();
if (ok) if (ok)
*ok = res; *ok = res;
if (!res) if (!res)
return QString(); return QString();
return d.ui->textEdit->text(); return d.ui->textEdit->text();
} }
void AutoExpandableDialog::showEvent(QShowEvent *e) { void AutoExpandableDialog::showEvent(QShowEvent *e) {
// Overriding showEvent is required for consistent UI with fixed size under custom DPI // Overriding showEvent is required for consistent UI with fixed size under custom DPI
// Show dialog // Show dialog
QDialog::showEvent(e); QDialog::showEvent(e);
// and resize textbox to fit the text // and resize textbox to fit the text
// NOTE: For some strange reason QFontMetrics gets more accurate // NOTE: For some strange reason QFontMetrics gets more accurate
// when called from showEvent. Only 6 symbols off instead of 11 symbols off. // when called from showEvent. Only 6 symbols off instead of 11 symbols off.
int textW = ui->textEdit->fontMetrics().width(ui->textEdit->text()) + 4; int textW = ui->textEdit->fontMetrics().width(ui->textEdit->text()) + 4;
int screenW = QApplication::desktop()->width() / 4; int screenW = QApplication::desktop()->width() / 4;
int wd = textW; int wd = textW;
if (!windowTitle().isEmpty()) { if (!windowTitle().isEmpty()) {
int _w = fontMetrics().width(windowTitle()); int _w = fontMetrics().width(windowTitle());
if (_w > wd) if (_w > wd)
wd = _w; wd = _w;
} }
if (!ui->textLabel->text().isEmpty()) { if (!ui->textLabel->text().isEmpty()) {
int _w = ui->textLabel->fontMetrics().width(ui->textLabel->text()); int _w = ui->textLabel->fontMetrics().width(ui->textLabel->text());
if (_w > wd) if (_w > wd)
wd = _w; wd = _w;
} }
// Now resize the dialog to fit the contents // Now resize the dialog to fit the contents
// Maximum value is whichever is smaller: // Maximum value is whichever is smaller:
// 1. screen width / 4 // 1. screen width / 4
// 2. max width of text from either of: label, title, textedit // 2. max width of text from either of: label, title, textedit
// If the value is less than dialog default size default size is used // If the value is less than dialog default size default size is used
wd = textW < screenW ? textW : screenW; wd = textW < screenW ? textW : screenW;
if (wd > width()) if (wd > width())
resize(width() - ui->horizontalLayout->sizeHint().width() + wd, height()); resize(width() - ui->horizontalLayout->sizeHint().width() + wd, height());
// Use old dialog behavior: prohibit resizing the dialog // Use old dialog behavior: prohibit resizing the dialog
setFixedHeight(height()); setFixedHeight(height());
// Update geometry: center on screen // Update geometry: center on screen
QDesktopWidget *desk = QApplication::desktop(); QDesktopWidget *desk = QApplication::desktop();
MainWindow *wnd = qobject_cast<MainWindow*>(QApplication::activeWindow()); MainWindow *wnd = qobject_cast<MainWindow*>(QApplication::activeWindow());
QPoint p = QCursor::pos(); QPoint p = QCursor::pos();
int screenNum = 0; int screenNum = 0;
if (wnd == 0) if (wnd == 0)
screenNum = desk->screenNumber(p); screenNum = desk->screenNumber(p);
else if (!wnd->isHidden()) else if (!wnd->isHidden())
screenNum = desk->screenNumber(wnd); screenNum = desk->screenNumber(wnd);
else else
screenNum = desk->screenNumber(p); screenNum = desk->screenNumber(p);
QRect screenRes = desk->screenGeometry(screenNum); QRect screenRes = desk->screenGeometry(screenNum);
QRect geom = geometry(); QRect geom = geometry();
geom.moveCenter(QPoint(screenRes.width() / 2, screenRes.height() / 2)); geom.moveCenter(QPoint(screenRes.width() / 2, screenRes.height() / 2));
setGeometry(geom); setGeometry(geom);
} }

View file

@ -1,60 +1,60 @@
/* /*
* Bittorrent Client using Qt4 and libtorrent. * Bittorrent Client using Qt4 and libtorrent.
* Copyright (C) 2013 Nick Tiskov * Copyright (C) 2013 Nick Tiskov
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to * In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with * link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library), * modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public * and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you * License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s), * modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this * but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version. * exception statement from your version.
* *
* Contact : daymansmail@gmail.com * Contact : daymansmail@gmail.com
*/ */
#ifndef AUTOEXPANDABLEDIALOG_H #ifndef AUTOEXPANDABLEDIALOG_H
#define AUTOEXPANDABLEDIALOG_H #define AUTOEXPANDABLEDIALOG_H
#include <QDialog> #include <QDialog>
#include <QString> #include <QString>
#include <QLineEdit> #include <QLineEdit>
namespace Ui { namespace Ui {
class AutoExpandableDialog; class AutoExpandableDialog;
} }
class AutoExpandableDialog : public QDialog { class AutoExpandableDialog : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
explicit AutoExpandableDialog(QWidget *parent = 0); explicit AutoExpandableDialog(QWidget *parent = 0);
~AutoExpandableDialog(); ~AutoExpandableDialog();
static QString getText(QWidget *parent, const QString& title, const QString& label, static QString getText(QWidget *parent, const QString& title, const QString& label,
QLineEdit::EchoMode mode = QLineEdit::Normal, const QString & text = QString(), QLineEdit::EchoMode mode = QLineEdit::Normal, const QString & text = QString(),
bool * ok = 0, Qt::InputMethodHints inputMethodHints = Qt::ImhNone); bool * ok = 0, Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
protected: protected:
void showEvent(QShowEvent *e); void showEvent(QShowEvent *e);
private: private:
Ui::AutoExpandableDialog *ui; Ui::AutoExpandableDialog *ui;
}; };
#endif // AUTOEXPANDABLEDIALOG_H #endif // AUTOEXPANDABLEDIALOG_H

View file

@ -1,120 +1,120 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>AutoExpandableDialog</class> <class>AutoExpandableDialog</class>
<widget class="QDialog" name="AutoExpandableDialog"> <widget class="QDialog" name="AutoExpandableDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>222</width> <width>222</width>
<height>94</height> <height>94</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string notr="true">Dialog</string> <string notr="true">Dialog</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>40</height> <height>40</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QLabel" name="textLabel"> <widget class="QLabel" name="textLabel">
<property name="toolTip"> <property name="toolTip">
<string notr="true"/> <string notr="true"/>
</property> </property>
<property name="text"> <property name="text">
<string notr="true"/> <string notr="true"/>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="textEdit"> <widget class="QLineEdit" name="textEdit">
<property name="toolTip"> <property name="toolTip">
<string notr="true"/> <string notr="true"/>
</property> </property>
<property name="text"> <property name="text">
<string notr="true"/> <string notr="true"/>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>40</width> <width>40</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="standardButtons"> <property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>
<connections> <connections>
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>accepted()</signal> <signal>accepted()</signal>
<receiver>AutoExpandableDialog</receiver> <receiver>AutoExpandableDialog</receiver>
<slot>accept()</slot> <slot>accept()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>248</x> <x>248</x>
<y>254</y> <y>254</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>157</x> <x>157</x>
<y>274</y> <y>274</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>rejected()</signal> <signal>rejected()</signal>
<receiver>AutoExpandableDialog</receiver> <receiver>AutoExpandableDialog</receiver>
<slot>reject()</slot> <slot>reject()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>316</x> <x>316</x>
<y>260</y> <y>260</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>286</x> <x>286</x>
<y>274</y> <y>274</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
</connections> </connections>
</ui> </ui>

View file

@ -1,5 +1,5 @@
<RCC> <RCC>
<qresource prefix="/geoip"> <qresource prefix="/geoip">
<file>GeoIP.dat</file> <file>GeoIP.dat</file>
</qresource> </qresource>
</RCC> </RCC>

View file

@ -1,4 +1,4 @@
INCLUDEPATH += $$PWD/src INCLUDEPATH += $$PWD/src
HEADERS += $$PWD/src/lineedit.h HEADERS += $$PWD/src/lineedit.h
SOURCES += $$PWD/src/lineedit.cpp SOURCES += $$PWD/src/lineedit.cpp
RESOURCES += $$PWD/resources/lineeditimages.qrc RESOURCES += $$PWD/resources/lineeditimages.qrc

View file

@ -1,55 +1,55 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (c) 2007 Trolltech ASA <info@trolltech.com> ** Copyright (c) 2007 Trolltech ASA <info@trolltech.com>
** **
** Use, modification and distribution is allowed without limitation, ** Use, modification and distribution is allowed without limitation,
** warranty, liability or support of any kind. ** warranty, liability or support of any kind.
** **
****************************************************************************/ ****************************************************************************/
#include "lineedit.h" #include "lineedit.h"
#include <QToolButton> #include <QToolButton>
#include <QStyle> #include <QStyle>
#include <QtDebug> #include <QtDebug>
LineEdit::LineEdit(QWidget *parent) LineEdit::LineEdit(QWidget *parent)
: QLineEdit(parent) : QLineEdit(parent)
{ {
searchButton = new QToolButton(this); searchButton = new QToolButton(this);
QPixmap pixmap1(":/lineeditimages/search.png"); QPixmap pixmap1(":/lineeditimages/search.png");
searchButton->setIcon(QIcon(pixmap1)); searchButton->setIcon(QIcon(pixmap1));
searchButton->setIconSize(pixmap1.size()); searchButton->setIconSize(pixmap1.size());
searchButton->setCursor(Qt::ArrowCursor); searchButton->setCursor(Qt::ArrowCursor);
searchButton->setStyleSheet("QToolButton { border: none; padding: 2px; }"); searchButton->setStyleSheet("QToolButton { border: none; padding: 2px; }");
clearButton = new QToolButton(this); clearButton = new QToolButton(this);
QPixmap pixmap2(":/lineeditimages/clear_left.png"); QPixmap pixmap2(":/lineeditimages/clear_left.png");
clearButton->setIcon(QIcon(pixmap2)); clearButton->setIcon(QIcon(pixmap2));
clearButton->setIconSize(pixmap2.size()); clearButton->setIconSize(pixmap2.size());
clearButton->setCursor(Qt::ArrowCursor); clearButton->setCursor(Qt::ArrowCursor);
clearButton->setStyleSheet("QToolButton { border: none; padding: 2px; }"); clearButton->setStyleSheet("QToolButton { border: none; padding: 2px; }");
clearButton->setToolTip(tr("Clear the text")); clearButton->setToolTip(tr("Clear the text"));
clearButton->hide(); clearButton->hide();
connect(clearButton, SIGNAL(clicked()), this, SLOT(clear())); connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));
connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(updateCloseButton(const QString&))); connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(updateCloseButton(const QString&)));
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth); int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
setStyleSheet(QString("QLineEdit { padding-right: %1px; padding-left: %2px; }").arg(clearButton->sizeHint().width() + frameWidth + 1).arg(clearButton->sizeHint().width() + frameWidth + 1)); setStyleSheet(QString("QLineEdit { padding-right: %1px; padding-left: %2px; }").arg(clearButton->sizeHint().width() + frameWidth + 1).arg(clearButton->sizeHint().width() + frameWidth + 1));
QSize msz = minimumSizeHint(); QSize msz = minimumSizeHint();
setMinimumSize(qMax(msz.width(), clearButton->sizeHint().width() + searchButton->sizeHint().width() + frameWidth * 2 + 2), setMinimumSize(qMax(msz.width(), clearButton->sizeHint().width() + searchButton->sizeHint().width() + frameWidth * 2 + 2),
qMax(msz.height(), clearButton->sizeHint().height() + frameWidth * 2 + 2)); qMax(msz.height(), clearButton->sizeHint().height() + frameWidth * 2 + 2));
} }
void LineEdit::resizeEvent(QResizeEvent *) void LineEdit::resizeEvent(QResizeEvent *)
{ {
QSize sz = searchButton->sizeHint(); QSize sz = searchButton->sizeHint();
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth); int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
searchButton->move(rect().left() + frameWidth, (rect().bottom() + 2 - sz.height())/2); searchButton->move(rect().left() + frameWidth, (rect().bottom() + 2 - sz.height())/2);
sz = clearButton->sizeHint(); sz = clearButton->sizeHint();
clearButton->move(rect().right() - frameWidth - sz.width(), clearButton->move(rect().right() - frameWidth - sz.width(),
(rect().bottom() + 2 - sz.height())/2); (rect().bottom() + 2 - sz.height())/2);
} }
void LineEdit::updateCloseButton(const QString& text) void LineEdit::updateCloseButton(const QString& text)
{ {
clearButton->setVisible(!text.isEmpty()); clearButton->setVisible(!text.isEmpty());
} }

View file

@ -1,37 +1,37 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (c) 2007 Trolltech ASA <info@trolltech.com> ** Copyright (c) 2007 Trolltech ASA <info@trolltech.com>
** **
** Use, modification and distribution is allowed without limitation, ** Use, modification and distribution is allowed without limitation,
** warranty, liability or support of any kind. ** warranty, liability or support of any kind.
** **
****************************************************************************/ ****************************************************************************/
#ifndef LINEEDIT_H #ifndef LINEEDIT_H
#define LINEEDIT_H #define LINEEDIT_H
#include <QLineEdit> #include <QLineEdit>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QToolButton; class QToolButton;
QT_END_NAMESPACE QT_END_NAMESPACE
class LineEdit : public QLineEdit class LineEdit : public QLineEdit
{ {
Q_OBJECT Q_OBJECT
public: public:
LineEdit(QWidget *parent = 0); LineEdit(QWidget *parent = 0);
protected: protected:
void resizeEvent(QResizeEvent *); void resizeEvent(QResizeEvent *);
private slots: private slots:
void updateCloseButton(const QString &text); void updateCloseButton(const QString &text);
private: private:
QToolButton *clearButton; QToolButton *clearButton;
QToolButton *searchButton; QToolButton *searchButton;
}; };
#endif // LIENEDIT_H #endif // LIENEDIT_H

View file

@ -1,487 +1,487 @@
/* /*
* Bittorrent Client using Qt4 and libtorrent. * Bittorrent Client using Qt4 and libtorrent.
* Copyright (C) 2006 Christophe Dumez * Copyright (C) 2006 Christophe Dumez
* Copyright (C) 2014 sledgehammer999 * Copyright (C) 2014 sledgehammer999
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* In addition, as a special exception, the copyright holders give permission to * In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with * link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library), * modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public * and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you * License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s), * modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this * but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version. * exception statement from your version.
* *
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
* Contact : hammered999@gmail.com * Contact : hammered999@gmail.com
*/ */
#ifndef PREFERENCES_H #ifndef PREFERENCES_H
#define PREFERENCES_H #define PREFERENCES_H
#include <QTime> #include <QTime>
#include <QDateTime> #include <QDateTime>
#include <QList> #include <QList>
#include <QTimer> #include <QTimer>
#include <QReadWriteLock> #include <QReadWriteLock>
#include <QNetworkCookie> #include <QNetworkCookie>
#include <QVariant> #include <QVariant>
#include <libtorrent/version.hpp> #include <libtorrent/version.hpp>
enum scheduler_days { EVERY_DAY, WEEK_DAYS, WEEK_ENDS, MON, TUE, WED, THU, FRI, SAT, SUN }; enum scheduler_days { EVERY_DAY, WEEK_DAYS, WEEK_ENDS, MON, TUE, WED, THU, FRI, SAT, SUN };
enum maxRatioAction {PAUSE_ACTION, REMOVE_ACTION}; enum maxRatioAction {PAUSE_ACTION, REMOVE_ACTION};
namespace Proxy { namespace Proxy {
enum ProxyType {HTTP=1, SOCKS5=2, HTTP_PW=3, SOCKS5_PW=4, SOCKS4=5}; enum ProxyType {HTTP=1, SOCKS5=2, HTTP_PW=3, SOCKS5_PW=4, SOCKS4=5};
} }
namespace TrayIcon { namespace TrayIcon {
enum Style { NORMAL = 0, MONO_DARK, MONO_LIGHT }; enum Style { NORMAL = 0, MONO_DARK, MONO_LIGHT };
} }
namespace DNS { namespace DNS {
enum Service { DYNDNS, NOIP, NONE = -1 }; enum Service { DYNDNS, NOIP, NONE = -1 };
} }
class Preferences : public QObject { class Preferences : public QObject {
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY(Preferences) Q_DISABLE_COPY(Preferences)
private: private:
explicit Preferences(); explicit Preferences();
static Preferences* m_instance; static Preferences* m_instance;
QHash<QString, QVariant> m_data; QHash<QString, QVariant> m_data;
bool dirty; bool dirty;
QTimer timer; QTimer timer;
mutable QReadWriteLock lock; mutable QReadWriteLock lock;
const QVariant value(const QString &key, const QVariant &defaultValue = QVariant()) const; const QVariant value(const QString &key, const QVariant &defaultValue = QVariant()) const;
void setValue(const QString &key, const QVariant &value); void setValue(const QString &key, const QVariant &value);
public slots: public slots:
void save(); void save();
public: public:
static Preferences* instance(); static Preferences* instance();
static void drop(); static void drop();
~Preferences(); ~Preferences();
// General options // General options
QString getLocale() const; QString getLocale() const;
void setLocale(const QString &locale); void setLocale(const QString &locale);
bool useProgramNotification() const; bool useProgramNotification() const;
void useProgramNotification(bool use); void useProgramNotification(bool use);
bool deleteTorrentFilesAsDefault() const; bool deleteTorrentFilesAsDefault() const;
void setDeleteTorrentFilesAsDefault(bool del); void setDeleteTorrentFilesAsDefault(bool del);
bool confirmOnExit() const; bool confirmOnExit() const;
void setConfirmOnExit(bool confirm); void setConfirmOnExit(bool confirm);
bool speedInTitleBar() const; bool speedInTitleBar() const;
void showSpeedInTitleBar(bool show); void showSpeedInTitleBar(bool show);
bool useAlternatingRowColors() const; bool useAlternatingRowColors() const;
void setAlternatingRowColors(bool b); void setAlternatingRowColors(bool b);
bool useRandomPort() const; bool useRandomPort() const;
void setRandomPort(bool b); void setRandomPort(bool b);
bool systrayIntegration() const; bool systrayIntegration() const;
void setSystrayIntegration(bool enabled); void setSystrayIntegration(bool enabled);
bool isToolbarDisplayed() const; bool isToolbarDisplayed() const;
void setToolbarDisplayed(bool displayed); void setToolbarDisplayed(bool displayed);
bool minimizeToTray() const; bool minimizeToTray() const;
void setMinimizeToTray(bool b); void setMinimizeToTray(bool b);
bool closeToTray() const; bool closeToTray() const;
void setCloseToTray(bool b); void setCloseToTray(bool b);
bool startMinimized() const; bool startMinimized() const;
void setStartMinimized(bool b); void setStartMinimized(bool b);
bool isSlashScreenDisabled() const; bool isSlashScreenDisabled() const;
void setSplashScreenDisabled(bool b); void setSplashScreenDisabled(bool b);
bool preventFromSuspend() const; bool preventFromSuspend() const;
void setPreventFromSuspend(bool b); void setPreventFromSuspend(bool b);
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
bool WinStartup() const; bool WinStartup() const;
void setWinStartup(bool b); void setWinStartup(bool b);
#endif #endif
// Downloads // Downloads
QString getSavePath() const; QString getSavePath() const;
void setSavePath(const QString &save_path); void setSavePath(const QString &save_path);
bool isTempPathEnabled() const; bool isTempPathEnabled() const;
void setTempPathEnabled(bool enabled); void setTempPathEnabled(bool enabled);
QString getTempPath() const; QString getTempPath() const;
void setTempPath(const QString &path); void setTempPath(const QString &path);
bool useIncompleteFilesExtension() const; bool useIncompleteFilesExtension() const;
void useIncompleteFilesExtension(bool enabled); void useIncompleteFilesExtension(bool enabled);
bool appendTorrentLabel() const; bool appendTorrentLabel() const;
void setAppendTorrentLabel(bool b); void setAppendTorrentLabel(bool b);
QString lastLocationPath() const; QString lastLocationPath() const;
void setLastLocationPath(const QString &path); void setLastLocationPath(const QString &path);
bool preAllocateAllFiles() const; bool preAllocateAllFiles() const;
void preAllocateAllFiles(bool enabled); void preAllocateAllFiles(bool enabled);
bool useAdditionDialog() const; bool useAdditionDialog() const;
void useAdditionDialog(bool b); void useAdditionDialog(bool b);
bool additionDialogFront() const; bool additionDialogFront() const;
void additionDialogFront(bool b); void additionDialogFront(bool b);
bool addTorrentsInPause() const; bool addTorrentsInPause() const;
void addTorrentsInPause(bool b); void addTorrentsInPause(bool b);
QStringList getScanDirs() const; QStringList getScanDirs() const;
void setScanDirs(const QStringList &dirs); void setScanDirs(const QStringList &dirs);
QList<bool> getDownloadInScanDirs() const; QList<bool> getDownloadInScanDirs() const;
void setDownloadInScanDirs(const QList<bool> &list); void setDownloadInScanDirs(const QList<bool> &list);
QString getScanDirsLastPath() const; QString getScanDirsLastPath() const;
void setScanDirsLastPath(const QString &path); void setScanDirsLastPath(const QString &path);
bool isTorrentExportEnabled() const; bool isTorrentExportEnabled() const;
QString getTorrentExportDir() const; QString getTorrentExportDir() const;
void setTorrentExportDir(QString path); void setTorrentExportDir(QString path);
bool isFinishedTorrentExportEnabled() const; bool isFinishedTorrentExportEnabled() const;
QString getFinishedTorrentExportDir() const; QString getFinishedTorrentExportDir() const;
void setFinishedTorrentExportDir(QString path); void setFinishedTorrentExportDir(QString path);
bool isMailNotificationEnabled() const; bool isMailNotificationEnabled() const;
void setMailNotificationEnabled(bool enabled); void setMailNotificationEnabled(bool enabled);
QString getMailNotificationEmail() const; QString getMailNotificationEmail() const;
void setMailNotificationEmail(const QString &mail); void setMailNotificationEmail(const QString &mail);
QString getMailNotificationSMTP() const; QString getMailNotificationSMTP() const;
void setMailNotificationSMTP(const QString &smtp_server); void setMailNotificationSMTP(const QString &smtp_server);
bool getMailNotificationSMTPSSL() const; bool getMailNotificationSMTPSSL() const;
void setMailNotificationSMTPSSL(bool use); void setMailNotificationSMTPSSL(bool use);
bool getMailNotificationSMTPAuth() const; bool getMailNotificationSMTPAuth() const;
void setMailNotificationSMTPAuth(bool use); void setMailNotificationSMTPAuth(bool use);
QString getMailNotificationSMTPUsername() const; QString getMailNotificationSMTPUsername() const;
void setMailNotificationSMTPUsername(const QString &username); void setMailNotificationSMTPUsername(const QString &username);
QString getMailNotificationSMTPPassword() const; QString getMailNotificationSMTPPassword() const;
void setMailNotificationSMTPPassword(const QString &password); void setMailNotificationSMTPPassword(const QString &password);
int getActionOnDblClOnTorrentDl() const; int getActionOnDblClOnTorrentDl() const;
void setActionOnDblClOnTorrentDl(int act); void setActionOnDblClOnTorrentDl(int act);
int getActionOnDblClOnTorrentFn() const; int getActionOnDblClOnTorrentFn() const;
void setActionOnDblClOnTorrentFn(int act); void setActionOnDblClOnTorrentFn(int act);
// Connection options // Connection options
int getSessionPort() const; int getSessionPort() const;
void setSessionPort(int port); void setSessionPort(int port);
bool isUPnPEnabled() const; bool isUPnPEnabled() const;
void setUPnPEnabled(bool enabled); void setUPnPEnabled(bool enabled);
int getGlobalDownloadLimit() const; int getGlobalDownloadLimit() const;
void setGlobalDownloadLimit(int limit); void setGlobalDownloadLimit(int limit);
int getGlobalUploadLimit() const; int getGlobalUploadLimit() const;
void setGlobalUploadLimit(int limit); void setGlobalUploadLimit(int limit);
int getAltGlobalDownloadLimit() const; int getAltGlobalDownloadLimit() const;
void setAltGlobalDownloadLimit(int limit); void setAltGlobalDownloadLimit(int limit);
int getAltGlobalUploadLimit() const; int getAltGlobalUploadLimit() const;
void setAltGlobalUploadLimit(int limit); void setAltGlobalUploadLimit(int limit);
bool isAltBandwidthEnabled() const; bool isAltBandwidthEnabled() const;
void setAltBandwidthEnabled(bool enabled); void setAltBandwidthEnabled(bool enabled);
bool isSchedulerEnabled() const; bool isSchedulerEnabled() const;
void setSchedulerEnabled(bool enabled); void setSchedulerEnabled(bool enabled);
QTime getSchedulerStartTime() const; QTime getSchedulerStartTime() const;
void setSchedulerStartTime(const QTime &time); void setSchedulerStartTime(const QTime &time);
QTime getSchedulerEndTime() const; QTime getSchedulerEndTime() const;
void setSchedulerEndTime(const QTime &time); void setSchedulerEndTime(const QTime &time);
scheduler_days getSchedulerDays() const; scheduler_days getSchedulerDays() const;
void setSchedulerDays(scheduler_days days); void setSchedulerDays(scheduler_days days);
// Proxy options // Proxy options
bool isProxyEnabled() const; bool isProxyEnabled() const;
bool isProxyAuthEnabled() const; bool isProxyAuthEnabled() const;
void setProxyAuthEnabled(bool enabled); void setProxyAuthEnabled(bool enabled);
QString getProxyIp() const; QString getProxyIp() const;
void setProxyIp(const QString &ip); void setProxyIp(const QString &ip);
unsigned short getProxyPort() const; unsigned short getProxyPort() const;
void setProxyPort(unsigned short port); void setProxyPort(unsigned short port);
QString getProxyUsername() const; QString getProxyUsername() const;
void setProxyUsername(const QString &username); void setProxyUsername(const QString &username);
QString getProxyPassword() const; QString getProxyPassword() const;
void setProxyPassword(const QString &password); void setProxyPassword(const QString &password);
int getProxyType() const; int getProxyType() const;
void setProxyType(int type); void setProxyType(int type);
bool proxyPeerConnections() const; bool proxyPeerConnections() const;
void setProxyPeerConnections(bool enabled); void setProxyPeerConnections(bool enabled);
#if LIBTORRENT_VERSION_NUM >= 10000 #if LIBTORRENT_VERSION_NUM >= 10000
bool getForceProxy() const; bool getForceProxy() const;
void setForceProxy(bool enabled); void setForceProxy(bool enabled);
#endif #endif
// Bittorrent options // Bittorrent options
int getMaxConnecs() const; int getMaxConnecs() const;
void setMaxConnecs(int val); void setMaxConnecs(int val);
int getMaxConnecsPerTorrent() const; int getMaxConnecsPerTorrent() const;
void setMaxConnecsPerTorrent(int val); void setMaxConnecsPerTorrent(int val);
int getMaxUploads() const; int getMaxUploads() const;
void setMaxUploads(int val); void setMaxUploads(int val);
int getMaxUploadsPerTorrent() const; int getMaxUploadsPerTorrent() const;
void setMaxUploadsPerTorrent(int val); void setMaxUploadsPerTorrent(int val);
bool isuTPEnabled() const; bool isuTPEnabled() const;
void setuTPEnabled(bool enabled); void setuTPEnabled(bool enabled);
bool isuTPRateLimited() const; bool isuTPRateLimited() const;
void setuTPRateLimited(bool enabled); void setuTPRateLimited(bool enabled);
bool isDHTEnabled() const; bool isDHTEnabled() const;
void setDHTEnabled(bool enabled); void setDHTEnabled(bool enabled);
bool isPeXEnabled() const; bool isPeXEnabled() const;
void setPeXEnabled(bool enabled); void setPeXEnabled(bool enabled);
bool isLSDEnabled() const; bool isLSDEnabled() const;
void setLSDEnabled(bool enabled); void setLSDEnabled(bool enabled);
int getEncryptionSetting() const; int getEncryptionSetting() const;
void setEncryptionSetting(int val); void setEncryptionSetting(int val);
qreal getGlobalMaxRatio() const; qreal getGlobalMaxRatio() const;
void setGlobalMaxRatio(qreal ratio); void setGlobalMaxRatio(qreal ratio);
int getMaxRatioAction() const; int getMaxRatioAction() const;
void setMaxRatioAction(int act); void setMaxRatioAction(int act);
// IP Filter // IP Filter
bool isFilteringEnabled() const; bool isFilteringEnabled() const;
void setFilteringEnabled(bool enabled); void setFilteringEnabled(bool enabled);
QString getFilter() const; QString getFilter() const;
void setFilter(const QString &path); void setFilter(const QString &path);
QStringList bannedIPs() const; QStringList bannedIPs() const;
void banIP(const QString &ip); void banIP(const QString &ip);
// Search // Search
bool isSearchEnabled() const; bool isSearchEnabled() const;
void setSearchEnabled(bool enabled); void setSearchEnabled(bool enabled);
// Execution Log // Execution Log
bool isExecutionLogEnabled() const; bool isExecutionLogEnabled() const;
void setExecutionLogEnabled(bool b); void setExecutionLogEnabled(bool b);
// Queueing system // Queueing system
bool isQueueingSystemEnabled() const; bool isQueueingSystemEnabled() const;
void setQueueingSystemEnabled(bool enabled); void setQueueingSystemEnabled(bool enabled);
int getMaxActiveDownloads() const; int getMaxActiveDownloads() const;
void setMaxActiveDownloads(int val); void setMaxActiveDownloads(int val);
int getMaxActiveUploads() const; int getMaxActiveUploads() const;
void setMaxActiveUploads(int val); void setMaxActiveUploads(int val);
int getMaxActiveTorrents() const; int getMaxActiveTorrents() const;
void setMaxActiveTorrents(int val); void setMaxActiveTorrents(int val);
bool ignoreSlowTorrentsForQueueing() const; bool ignoreSlowTorrentsForQueueing() const;
void setIgnoreSlowTorrentsForQueueing(bool ignore); void setIgnoreSlowTorrentsForQueueing(bool ignore);
bool isWebUiEnabled() const; bool isWebUiEnabled() const;
void setWebUiEnabled(bool enabled); void setWebUiEnabled(bool enabled);
bool isWebUiLocalAuthEnabled() const; bool isWebUiLocalAuthEnabled() const;
void setWebUiLocalAuthEnabled(bool enabled); void setWebUiLocalAuthEnabled(bool enabled);
quint16 getWebUiPort() const; quint16 getWebUiPort() const;
void setWebUiPort(quint16 port); void setWebUiPort(quint16 port);
bool useUPnPForWebUIPort() const; bool useUPnPForWebUIPort() const;
void setUPnPForWebUIPort(bool enabled); void setUPnPForWebUIPort(bool enabled);
QString getWebUiUsername() const; QString getWebUiUsername() const;
void setWebUiUsername(const QString &username); void setWebUiUsername(const QString &username);
QString getWebUiPassword() const; QString getWebUiPassword() const;
void setWebUiPassword(const QString &new_password); void setWebUiPassword(const QString &new_password);
bool isWebUiHttpsEnabled() const; bool isWebUiHttpsEnabled() const;
void setWebUiHttpsEnabled(bool enabled); void setWebUiHttpsEnabled(bool enabled);
QByteArray getWebUiHttpsCertificate() const; QByteArray getWebUiHttpsCertificate() const;
void setWebUiHttpsCertificate(const QByteArray &data); void setWebUiHttpsCertificate(const QByteArray &data);
QByteArray getWebUiHttpsKey() const; QByteArray getWebUiHttpsKey() const;
void setWebUiHttpsKey(const QByteArray &data); void setWebUiHttpsKey(const QByteArray &data);
bool isDynDNSEnabled() const; bool isDynDNSEnabled() const;
void setDynDNSEnabled(bool enabled); void setDynDNSEnabled(bool enabled);
DNS::Service getDynDNSService() const; DNS::Service getDynDNSService() const;
void setDynDNSService(int service); void setDynDNSService(int service);
QString getDynDomainName() const; QString getDynDomainName() const;
void setDynDomainName(const QString &name); void setDynDomainName(const QString &name);
QString getDynDNSUsername() const; QString getDynDNSUsername() const;
void setDynDNSUsername(const QString &username); void setDynDNSUsername(const QString &username);
QString getDynDNSPassword() const; QString getDynDNSPassword() const;
void setDynDNSPassword(const QString &password); void setDynDNSPassword(const QString &password);
// Advanced settings // Advanced settings
void setUILockPassword(const QString &clear_password); void setUILockPassword(const QString &clear_password);
void clearUILockPassword(); void clearUILockPassword();
QString getUILockPasswordMD5() const; QString getUILockPasswordMD5() const;
bool isUILocked() const; bool isUILocked() const;
void setUILocked(bool locked); void setUILocked(bool locked);
bool isAutoRunEnabled() const; bool isAutoRunEnabled() const;
void setAutoRunEnabled(bool enabled); void setAutoRunEnabled(bool enabled);
QString getAutoRunProgram() const; QString getAutoRunProgram() const;
void setAutoRunProgram(const QString &program); void setAutoRunProgram(const QString &program);
bool shutdownWhenDownloadsComplete() const; bool shutdownWhenDownloadsComplete() const;
void setShutdownWhenDownloadsComplete(bool shutdown); void setShutdownWhenDownloadsComplete(bool shutdown);
bool suspendWhenDownloadsComplete() const; bool suspendWhenDownloadsComplete() const;
void setSuspendWhenDownloadsComplete(bool suspend); void setSuspendWhenDownloadsComplete(bool suspend);
bool hibernateWhenDownloadsComplete() const; bool hibernateWhenDownloadsComplete() const;
void setHibernateWhenDownloadsComplete(bool hibernate); void setHibernateWhenDownloadsComplete(bool hibernate);
bool shutdownqBTWhenDownloadsComplete() const; bool shutdownqBTWhenDownloadsComplete() const;
void setShutdownqBTWhenDownloadsComplete(bool shutdown); void setShutdownqBTWhenDownloadsComplete(bool shutdown);
uint diskCacheSize() const; uint diskCacheSize() const;
void setDiskCacheSize(uint size); void setDiskCacheSize(uint size);
uint diskCacheTTL() const; uint diskCacheTTL() const;
void setDiskCacheTTL(uint ttl); void setDiskCacheTTL(uint ttl);
bool osCache() const; bool osCache() const;
void setOsCache(bool enable); void setOsCache(bool enable);
uint saveResumeDataInterval() const; uint saveResumeDataInterval() const;
void setSaveResumeDataInterval(uint m); void setSaveResumeDataInterval(uint m);
uint outgoingPortsMin() const; uint outgoingPortsMin() const;
void setOutgoingPortsMin(uint val); void setOutgoingPortsMin(uint val);
uint outgoingPortsMax() const; uint outgoingPortsMax() const;
void setOutgoingPortsMax(uint val); void setOutgoingPortsMax(uint val);
bool ignoreLimitsOnLAN() const; bool ignoreLimitsOnLAN() const;
void ignoreLimitsOnLAN(bool ignore); void ignoreLimitsOnLAN(bool ignore);
bool includeOverheadInLimits() const; bool includeOverheadInLimits() const;
void includeOverheadInLimits(bool include); void includeOverheadInLimits(bool include);
bool trackerExchangeEnabled() const; bool trackerExchangeEnabled() const;
void setTrackerExchangeEnabled(bool enable); void setTrackerExchangeEnabled(bool enable);
bool recheckTorrentsOnCompletion() const; bool recheckTorrentsOnCompletion() const;
void recheckTorrentsOnCompletion(bool recheck); void recheckTorrentsOnCompletion(bool recheck);
unsigned int getRefreshInterval() const; unsigned int getRefreshInterval() const;
void setRefreshInterval(uint interval); void setRefreshInterval(uint interval);
bool resolvePeerCountries() const; bool resolvePeerCountries() const;
void resolvePeerCountries(bool resolve); void resolvePeerCountries(bool resolve);
bool resolvePeerHostNames() const; bool resolvePeerHostNames() const;
void resolvePeerHostNames(bool resolve); void resolvePeerHostNames(bool resolve);
int getMaxHalfOpenConnections() const; int getMaxHalfOpenConnections() const;
void setMaxHalfOpenConnections(int value); void setMaxHalfOpenConnections(int value);
QString getNetworkInterface() const; QString getNetworkInterface() const;
void setNetworkInterface(const QString& iface); void setNetworkInterface(const QString& iface);
QString getNetworkInterfaceName() const; QString getNetworkInterfaceName() const;
void setNetworkInterfaceName(const QString& iface); void setNetworkInterfaceName(const QString& iface);
bool getListenIPv6() const; bool getListenIPv6() const;
void setListenIPv6(bool enable); void setListenIPv6(bool enable);
QString getNetworkAddress() const; QString getNetworkAddress() const;
void setNetworkAddress(const QString& addr); void setNetworkAddress(const QString& addr);
bool isAnonymousModeEnabled() const; bool isAnonymousModeEnabled() const;
void enableAnonymousMode(bool enabled); void enableAnonymousMode(bool enabled);
bool isSuperSeedingEnabled() const; bool isSuperSeedingEnabled() const;
void enableSuperSeeding(bool enabled); void enableSuperSeeding(bool enabled);
bool announceToAllTrackers() const; bool announceToAllTrackers() const;
void setAnnounceToAllTrackers(bool enabled); void setAnnounceToAllTrackers(bool enabled);
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) #if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
bool useSystemIconTheme() const; bool useSystemIconTheme() const;
void useSystemIconTheme(bool enabled); void useSystemIconTheme(bool enabled);
#endif #endif
QStringList getTorrentLabels() const; QStringList getTorrentLabels() const;
void setTorrentLabels(const QStringList& labels); void setTorrentLabels(const QStringList& labels);
void addTorrentLabel(const QString& label); void addTorrentLabel(const QString& label);
void removeTorrentLabel(const QString& label); void removeTorrentLabel(const QString& label);
bool recursiveDownloadDisabled() const; bool recursiveDownloadDisabled() const;
void disableRecursiveDownload(bool disable=true); void disableRecursiveDownload(bool disable=true);
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
static QString getPythonPath(); static QString getPythonPath();
bool neverCheckFileAssoc() const; bool neverCheckFileAssoc() const;
void setNeverCheckFileAssoc(bool check = true); void setNeverCheckFileAssoc(bool check = true);
static bool isTorrentFileAssocSet(); static bool isTorrentFileAssocSet();
static bool isMagnetLinkAssocSet(); static bool isMagnetLinkAssocSet();
static void setTorrentFileAssoc(bool set); static void setTorrentFileAssoc(bool set);
static void setMagnetLinkAssoc(bool set); static void setMagnetLinkAssoc(bool set);
#endif #endif
bool isTrackerEnabled() const; bool isTrackerEnabled() const;
void setTrackerEnabled(bool enabled); void setTrackerEnabled(bool enabled);
int getTrackerPort() const; int getTrackerPort() const;
void setTrackerPort(int port); void setTrackerPort(int port);
#if defined(Q_OS_WIN) || defined(Q_OS_MAC) #if defined(Q_OS_WIN) || defined(Q_OS_MAC)
bool isUpdateCheckEnabled() const; bool isUpdateCheckEnabled() const;
void setUpdateCheckEnabled(bool enabled); void setUpdateCheckEnabled(bool enabled);
#endif #endif
bool confirmTorrentDeletion() const; bool confirmTorrentDeletion() const;
void setConfirmTorrentDeletion(bool enabled); void setConfirmTorrentDeletion(bool enabled);
TrayIcon::Style trayIconStyle() const; TrayIcon::Style trayIconStyle() const;
void setTrayIconStyle(TrayIcon::Style style); void setTrayIconStyle(TrayIcon::Style style);
// Stuff that don't appear in the Options GUI but are saved // Stuff that don't appear in the Options GUI but are saved
// in the same file. // in the same file.
QByteArray getAddNewTorrentDialogState() const; QByteArray getAddNewTorrentDialogState() const;
void setAddNewTorrentDialogState(const QByteArray &state); void setAddNewTorrentDialogState(const QByteArray &state);
int getAddNewTorrentDialogPos() const; int getAddNewTorrentDialogPos() const;
void setAddNewTorrentDialogPos(const int &pos); void setAddNewTorrentDialogPos(const int &pos);
int getAddNewTorrentDialogWidth() const; int getAddNewTorrentDialogWidth() const;
void setAddNewTorrentDialogWidth(const int &width); void setAddNewTorrentDialogWidth(const int &width);
bool getAddNewTorrentDialogExpanded() const; bool getAddNewTorrentDialogExpanded() const;
void setAddNewTorrentDialogExpanded(const bool expanded); void setAddNewTorrentDialogExpanded(const bool expanded);
QStringList getAddNewTorrentDialogPathHistory() const; QStringList getAddNewTorrentDialogPathHistory() const;
void setAddNewTorrentDialogPathHistory(const QStringList &history); void setAddNewTorrentDialogPathHistory(const QStringList &history);
QDateTime getDNSLastUpd() const; QDateTime getDNSLastUpd() const;
void setDNSLastUpd(const QDateTime &date); void setDNSLastUpd(const QDateTime &date);
QString getDNSLastIP() const; QString getDNSLastIP() const;
void setDNSLastIP(const QString &ip); void setDNSLastIP(const QString &ip);
bool getAcceptedLegal() const; bool getAcceptedLegal() const;
void setAcceptedLegal(const bool accepted); void setAcceptedLegal(const bool accepted);
QByteArray getMainGeometry() const; QByteArray getMainGeometry() const;
void setMainGeometry(const QByteArray &geometry); void setMainGeometry(const QByteArray &geometry);
QByteArray getMainVSplitterState() const; QByteArray getMainVSplitterState() const;
void setMainVSplitterState(const QByteArray &state); void setMainVSplitterState(const QByteArray &state);
QString getMainLastDir() const; QString getMainLastDir() const;
void setMainLastDir(const QString &path); void setMainLastDir(const QString &path);
#ifndef DISABLE_GUI #ifndef DISABLE_GUI
QSize getPrefSize(const QSize &defaultSize) const; QSize getPrefSize(const QSize &defaultSize) const;
void setPrefSize(const QSize &size); void setPrefSize(const QSize &size);
#endif #endif
QPoint getPrefPos() const; QPoint getPrefPos() const;
void setPrefPos(const QPoint &pos); void setPrefPos(const QPoint &pos);
QStringList getPrefHSplitterSizes() const; QStringList getPrefHSplitterSizes() const;
void setPrefHSplitterSizes(const QStringList &sizes); void setPrefHSplitterSizes(const QStringList &sizes);
QByteArray getPeerListState() const; QByteArray getPeerListState() const;
void setPeerListState(const QByteArray &state); void setPeerListState(const QByteArray &state);
QString getPropSplitterSizes() const; QString getPropSplitterSizes() const;
void setPropSplitterSizes(const QString &sizes); void setPropSplitterSizes(const QString &sizes);
QByteArray getPropFileListState() const; QByteArray getPropFileListState() const;
void setPropFileListState(const QByteArray &state); void setPropFileListState(const QByteArray &state);
int getPropCurTab() const; int getPropCurTab() const;
void setPropCurTab(const int &tab); void setPropCurTab(const int &tab);
bool getPropVisible() const; bool getPropVisible() const;
void setPropVisible(const bool visible); void setPropVisible(const bool visible);
QByteArray getPropTrackerListState() const; QByteArray getPropTrackerListState() const;
void setPropTrackerListState(const QByteArray &state); void setPropTrackerListState(const QByteArray &state);
QByteArray getRssGeometry() const; QByteArray getRssGeometry() const;
void setRssGeometry(const QByteArray &geometry); void setRssGeometry(const QByteArray &geometry);
QByteArray getRssHSplitterSizes() const; QByteArray getRssHSplitterSizes() const;
void setRssHSplitterSizes(const QByteArray &sizes); void setRssHSplitterSizes(const QByteArray &sizes);
QStringList getRssOpenFolders() const; QStringList getRssOpenFolders() const;
void setRssOpenFolders(const QStringList &folders); void setRssOpenFolders(const QStringList &folders);
QByteArray getRssHSplitterState() const; QByteArray getRssHSplitterState() const;
void setRssHSplitterState(const QByteArray &state); void setRssHSplitterState(const QByteArray &state);
QByteArray getRssVSplitterState() const; QByteArray getRssVSplitterState() const;
void setRssVSplitterState(const QByteArray &state); void setRssVSplitterState(const QByteArray &state);
QString getSearchColsWidth() const; QString getSearchColsWidth() const;
void setSearchColsWidth(const QString &width); void setSearchColsWidth(const QString &width);
QStringList getSearchEngDisabled() const; QStringList getSearchEngDisabled() const;
void setSearchEngDisabled(const QStringList &engines); void setSearchEngDisabled(const QStringList &engines);
QString getCreateTorLastAddPath() const; QString getCreateTorLastAddPath() const;
void setCreateTorLastAddPath(const QString &path); void setCreateTorLastAddPath(const QString &path);
QString getCreateTorLastSavePath() const; QString getCreateTorLastSavePath() const;
void setCreateTorLastSavePath(const QString &path); void setCreateTorLastSavePath(const QString &path);
QString getCreateTorTrackers() const; QString getCreateTorTrackers() const;
void setCreateTorTrackers(const QString &path); void setCreateTorTrackers(const QString &path);
QByteArray getCreateTorGeometry() const; QByteArray getCreateTorGeometry() const;
void setCreateTorGeometry(const QByteArray &geometry); void setCreateTorGeometry(const QByteArray &geometry);
bool getCreateTorIgnoreRatio() const; bool getCreateTorIgnoreRatio() const;
void setCreateTorIgnoreRatio(const bool ignore); void setCreateTorIgnoreRatio(const bool ignore);
QString getTorImportLastContentDir() const; QString getTorImportLastContentDir() const;
void setTorImportLastContentDir(const QString &path); void setTorImportLastContentDir(const QString &path);
QByteArray getTorImportGeometry() const; QByteArray getTorImportGeometry() const;
void setTorImportGeometry(const QByteArray &geometry); void setTorImportGeometry(const QByteArray &geometry);
int getTransSelFilter() const; int getTransSelFilter() const;
void setTransSelFilter(const int &index); void setTransSelFilter(const int &index);
QByteArray getTransHeaderState() const; QByteArray getTransHeaderState() const;
void setTransHeaderState(const QByteArray &state); void setTransHeaderState(const QByteArray &state);
// Temp code. // Temp code.
// See TorrentStatistics::loadStats() for details. // See TorrentStatistics::loadStats() for details.
QVariantHash getStats() const; QVariantHash getStats() const;
void removeStats(); void removeStats();
//From old RssSettings class //From old RssSettings class
bool isRSSEnabled() const; bool isRSSEnabled() const;
void setRSSEnabled(const bool enabled); void setRSSEnabled(const bool enabled);
uint getRSSRefreshInterval() const; uint getRSSRefreshInterval() const;
void setRSSRefreshInterval(const uint &interval); void setRSSRefreshInterval(const uint &interval);
int getRSSMaxArticlesPerFeed() const; int getRSSMaxArticlesPerFeed() const;
void setRSSMaxArticlesPerFeed(const int &nb); void setRSSMaxArticlesPerFeed(const int &nb);
bool isRssDownloadingEnabled() const; bool isRssDownloadingEnabled() const;
void setRssDownloadingEnabled(const bool b); void setRssDownloadingEnabled(const bool b);
QStringList getRssFeedsUrls() const; QStringList getRssFeedsUrls() const;
void setRssFeedsUrls(const QStringList &rssFeeds); void setRssFeedsUrls(const QStringList &rssFeeds);
QStringList getRssFeedsAliases() const; QStringList getRssFeedsAliases() const;
void setRssFeedsAliases(const QStringList &rssAliases); void setRssFeedsAliases(const QStringList &rssAliases);
QList<QByteArray> getHostNameCookies(const QString &host_name) const; QList<QByteArray> getHostNameCookies(const QString &host_name) const;
QList<QNetworkCookie> getHostNameQNetworkCookies(const QString& host_name) const; QList<QNetworkCookie> getHostNameQNetworkCookies(const QString& host_name) const;
void setHostNameCookies(const QString &host_name, const QList<QByteArray> &cookies); void setHostNameCookies(const QString &host_name, const QList<QByteArray> &cookies);
}; };
#endif // PREFERENCES_H #endif // PREFERENCES_H

View file

@ -1,391 +1,391 @@
"""SocksiPy - Python SOCKS module. """SocksiPy - Python SOCKS module.
Version 1.01 Version 1.01
Copyright 2006 Dan-Haim. All rights reserved. Copyright 2006 Dan-Haim. All rights reserved.
Various fixes by Christophe DUMEZ <chris@qbittorrent.org> - 2010 Various fixes by Christophe DUMEZ <chris@qbittorrent.org> - 2010
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this 1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, 2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution. and/or other materials provided with the distribution.
3. Neither the name of Dan Haim nor the names of his contributors may be used 3. Neither the name of Dan Haim nor the names of his contributors may be used
to endorse or promote products derived from this software without specific to endorse or promote products derived from this software without specific
prior written permission. prior written permission.
THIS SOFTWARE IS PROVIDED BY DAN HAIM "AS IS" AND ANY EXPRESS OR IMPLIED THIS SOFTWARE IS PROVIDED BY DAN HAIM "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL DAN HAIM OR HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, EVENT SHALL DAN HAIM OR HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMANGE. OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMANGE.
This module provides a standard socket-like interface for Python This module provides a standard socket-like interface for Python
for tunneling connections through SOCKS proxies. for tunneling connections through SOCKS proxies.
""" """
import socket import socket
import struct import struct
PROXY_TYPE_SOCKS4 = 1 PROXY_TYPE_SOCKS4 = 1
PROXY_TYPE_SOCKS5 = 2 PROXY_TYPE_SOCKS5 = 2
PROXY_TYPE_HTTP = 3 PROXY_TYPE_HTTP = 3
_defaultproxy = None _defaultproxy = None
_orgsocket = socket.socket _orgsocket = socket.socket
class ProxyError(Exception): class ProxyError(Exception):
def __init__(self, value): def __init__(self, value):
self.value = value self.value = value
def __str__(self): def __str__(self):
return repr(self.value) return repr(self.value)
class GeneralProxyError(ProxyError): class GeneralProxyError(ProxyError):
def __init__(self, value): def __init__(self, value):
self.value = value self.value = value
def __str__(self): def __str__(self):
return repr(self.value) return repr(self.value)
class Socks5AuthError(ProxyError): class Socks5AuthError(ProxyError):
def __init__(self, value): def __init__(self, value):
self.value = value self.value = value
def __str__(self): def __str__(self):
return repr(self.value) return repr(self.value)
class Socks5Error(ProxyError): class Socks5Error(ProxyError):
def __init__(self, value): def __init__(self, value):
self.value = value self.value = value
def __str__(self): def __str__(self):
return repr(self.value) return repr(self.value)
class Socks4Error(ProxyError): class Socks4Error(ProxyError):
def __init__(self, value): def __init__(self, value):
self.value = value self.value = value
def __str__(self): def __str__(self):
return repr(self.value) return repr(self.value)
class HTTPError(ProxyError): class HTTPError(ProxyError):
def __init__(self, value): def __init__(self, value):
self.value = value self.value = value
def __str__(self): def __str__(self):
return repr(self.value) return repr(self.value)
_generalerrors = ("success", _generalerrors = ("success",
"invalid data", "invalid data",
"not connected", "not connected",
"not available", "not available",
"bad proxy type", "bad proxy type",
"bad input") "bad input")
_socks5errors = ("succeeded", _socks5errors = ("succeeded",
"general SOCKS server failure", "general SOCKS server failure",
"connection not allowed by ruleset", "connection not allowed by ruleset",
"Network unreachable", "Network unreachable",
"Host unreachable", "Host unreachable",
"Connection refused", "Connection refused",
"TTL expired", "TTL expired",
"Command not supported", "Command not supported",
"Address type not supported", "Address type not supported",
"Unknown error") "Unknown error")
_socks5autherrors = ("succeeded", _socks5autherrors = ("succeeded",
"authentication is required", "authentication is required",
"all offered authentication methods were rejected", "all offered authentication methods were rejected",
"unknown username or invalid password", "unknown username or invalid password",
"unknown error") "unknown error")
_socks4errors = ("request granted", _socks4errors = ("request granted",
"request rejected or failed", "request rejected or failed",
"request rejected because SOCKS server cannot connect to identd on the client", "request rejected because SOCKS server cannot connect to identd on the client",
"request rejected because the client program and identd report different user-ids", "request rejected because the client program and identd report different user-ids",
"unknown error") "unknown error")
def setdefaultproxy(proxytype=None,addr=None,port=None,rdns=True,username=None,password=None): def setdefaultproxy(proxytype=None,addr=None,port=None,rdns=True,username=None,password=None):
"""setdefaultproxy(proxytype, addr[, port[, rdns[, username[, password]]]]) """setdefaultproxy(proxytype, addr[, port[, rdns[, username[, password]]]])
Sets a default proxy which all further socksocket objects will use, Sets a default proxy which all further socksocket objects will use,
unless explicitly changed. unless explicitly changed.
""" """
global _defaultproxy global _defaultproxy
_defaultproxy = (proxytype,addr,port,rdns,username,password) _defaultproxy = (proxytype,addr,port,rdns,username,password)
class socksocket(socket.socket): class socksocket(socket.socket):
"""socksocket([family[, type[, proto]]]) -> socket object """socksocket([family[, type[, proto]]]) -> socket object
Open a SOCKS enabled socket. The parameters are the same as Open a SOCKS enabled socket. The parameters are the same as
those of the standard socket init. In order for SOCKS to work, those of the standard socket init. In order for SOCKS to work,
you must specify family=AF_INET, type=SOCK_STREAM and proto=0. you must specify family=AF_INET, type=SOCK_STREAM and proto=0.
""" """
def __init__(self, family=socket.AF_INET, type=socket.SOCK_STREAM, proto=0, _sock=None): def __init__(self, family=socket.AF_INET, type=socket.SOCK_STREAM, proto=0, _sock=None):
_orgsocket.__init__(self,family,type,proto,_sock) _orgsocket.__init__(self,family,type,proto,_sock)
if _defaultproxy != None: if _defaultproxy != None:
self.__proxy = _defaultproxy self.__proxy = _defaultproxy
else: else:
self.__proxy = (None, None, None, None, None, None) self.__proxy = (None, None, None, None, None, None)
self.__proxysockname = None self.__proxysockname = None
self.__proxypeername = None self.__proxypeername = None
def __recvall(self, bytes): def __recvall(self, bytes):
"""__recvall(bytes) -> data """__recvall(bytes) -> data
Receive EXACTLY the number of bytes requested from the socket. Receive EXACTLY the number of bytes requested from the socket.
Blocks until the required number of bytes have been received. Blocks until the required number of bytes have been received.
""" """
data = "" data = ""
while len(data) < bytes: while len(data) < bytes:
d = self.recv(bytes-len(data)) d = self.recv(bytes-len(data))
if not d: if not d:
raise GeneralProxyError("connection closed unexpectedly") raise GeneralProxyError("connection closed unexpectedly")
data = data + d data = data + d
return data return data
def setproxy(self,proxytype=None,addr=None,port=None,rdns=True,username=None,password=None): def setproxy(self,proxytype=None,addr=None,port=None,rdns=True,username=None,password=None):
"""setproxy(proxytype, addr[, port[, rdns[, username[, password]]]]) """setproxy(proxytype, addr[, port[, rdns[, username[, password]]]])
Sets the proxy to be used. Sets the proxy to be used.
proxytype - The type of the proxy to be used. Three types proxytype - The type of the proxy to be used. Three types
are supported: PROXY_TYPE_SOCKS4 (including socks4a), are supported: PROXY_TYPE_SOCKS4 (including socks4a),
PROXY_TYPE_SOCKS5 and PROXY_TYPE_HTTP PROXY_TYPE_SOCKS5 and PROXY_TYPE_HTTP
addr - The address of the server (IP or DNS). addr - The address of the server (IP or DNS).
port - The port of the server. Defaults to 1080 for SOCKS port - The port of the server. Defaults to 1080 for SOCKS
servers and 8080 for HTTP proxy servers. servers and 8080 for HTTP proxy servers.
rdns - Should DNS queries be preformed on the remote side rdns - Should DNS queries be preformed on the remote side
(rather than the local side). The default is True. (rather than the local side). The default is True.
Note: This has no effect with SOCKS4 servers. Note: This has no effect with SOCKS4 servers.
username - Username to authenticate with to the server. username - Username to authenticate with to the server.
The default is no authentication. The default is no authentication.
password - Password to authenticate with to the server. password - Password to authenticate with to the server.
Only relevant when username is also provided. Only relevant when username is also provided.
""" """
self.__proxy = (proxytype,addr,port,rdns,username,password) self.__proxy = (proxytype,addr,port,rdns,username,password)
def __negotiatesocks5(self,destaddr,destport): def __negotiatesocks5(self,destaddr,destport):
"""__negotiatesocks5(self,destaddr,destport) """__negotiatesocks5(self,destaddr,destport)
Negotiates a connection through a SOCKS5 server. Negotiates a connection through a SOCKS5 server.
""" """
# First we'll send the authentication packages we support. # First we'll send the authentication packages we support.
if (self.__proxy[4]!=None) and (self.__proxy[5]!=None): if (self.__proxy[4]!=None) and (self.__proxy[5]!=None):
# The username/password details were supplied to the # The username/password details were supplied to the
# setproxy method so we support the USERNAME/PASSWORD # setproxy method so we support the USERNAME/PASSWORD
# authentication (in addition to the standard none). # authentication (in addition to the standard none).
self.sendall("\x05\x02\x00\x02") self.sendall("\x05\x02\x00\x02")
else: else:
# No username/password were entered, therefore we # No username/password were entered, therefore we
# only support connections with no authentication. # only support connections with no authentication.
self.sendall("\x05\x01\x00") self.sendall("\x05\x01\x00")
# We'll receive the server's response to determine which # We'll receive the server's response to determine which
# method was selected # method was selected
chosenauth = self.__recvall(2) chosenauth = self.__recvall(2)
if chosenauth[0] != "\x05": if chosenauth[0] != "\x05":
self.close() self.close()
raise GeneralProxyError((1,_generalerrors[1])) raise GeneralProxyError((1,_generalerrors[1]))
# Check the chosen authentication method # Check the chosen authentication method
if chosenauth[1] == "\x00": if chosenauth[1] == "\x00":
# No authentication is required # No authentication is required
pass pass
elif chosenauth[1] == "\x02": elif chosenauth[1] == "\x02":
# Okay, we need to perform a basic username/password # Okay, we need to perform a basic username/password
# authentication. # authentication.
self.sendall("\x01" + chr(len(self.__proxy[4])) + self.__proxy[4] + chr(len(self.__proxy[5])) + self.__proxy[5]) self.sendall("\x01" + chr(len(self.__proxy[4])) + self.__proxy[4] + chr(len(self.__proxy[5])) + self.__proxy[5])
authstat = self.__recvall(2) authstat = self.__recvall(2)
if authstat[0] != "\x01": if authstat[0] != "\x01":
# Bad response # Bad response
self.close() self.close()
raise GeneralProxyError((1,_generalerrors[1])) raise GeneralProxyError((1,_generalerrors[1]))
if authstat[1] != "\x00": if authstat[1] != "\x00":
# Authentication failed # Authentication failed
self.close() self.close()
raise Socks5AuthError,((3,_socks5autherrors[3])) raise Socks5AuthError,((3,_socks5autherrors[3]))
# Authentication succeeded # Authentication succeeded
else: else:
# Reaching here is always bad # Reaching here is always bad
self.close() self.close()
if chosenauth[1] == "\xFF": if chosenauth[1] == "\xFF":
raise Socks5AuthError((2,_socks5autherrors[2])) raise Socks5AuthError((2,_socks5autherrors[2]))
else: else:
raise GeneralProxyError((1,_generalerrors[1])) raise GeneralProxyError((1,_generalerrors[1]))
# Now we can request the actual connection # Now we can request the actual connection
req = "\x05\x01\x00" req = "\x05\x01\x00"
# If the given destination address is an IP address, we'll # If the given destination address is an IP address, we'll
# use the IPv4 address request even if remote resolving was specified. # use the IPv4 address request even if remote resolving was specified.
try: try:
ipaddr = socket.inet_aton(destaddr) ipaddr = socket.inet_aton(destaddr)
req = req + "\x01" + ipaddr req = req + "\x01" + ipaddr
except socket.error: except socket.error:
# Well it's not an IP number, so it's probably a DNS name. # Well it's not an IP number, so it's probably a DNS name.
if self.__proxy[3]==True: if self.__proxy[3]==True:
# Resolve remotely # Resolve remotely
ipaddr = None ipaddr = None
req = req + "\x03" + chr(len(destaddr)) + destaddr req = req + "\x03" + chr(len(destaddr)) + destaddr
else: else:
# Resolve locally # Resolve locally
ipaddr = socket.inet_aton(socket.gethostbyname(destaddr)) ipaddr = socket.inet_aton(socket.gethostbyname(destaddr))
req = req + "\x01" + ipaddr req = req + "\x01" + ipaddr
req = req + struct.pack(">H",destport) req = req + struct.pack(">H",destport)
self.sendall(req) self.sendall(req)
# Get the response # Get the response
resp = self.__recvall(4) resp = self.__recvall(4)
if resp[0] != "\x05": if resp[0] != "\x05":
self.close() self.close()
raise GeneralProxyError((1,_generalerrors[1])) raise GeneralProxyError((1,_generalerrors[1]))
elif resp[1] != "\x00": elif resp[1] != "\x00":
# Connection failed # Connection failed
self.close() self.close()
if ord(resp[1])<=8: if ord(resp[1])<=8:
raise Socks5Error((ord(resp[1]),_generalerrors[ord(resp[1])])) raise Socks5Error((ord(resp[1]),_generalerrors[ord(resp[1])]))
else: else:
raise Socks5Error((9,_generalerrors[9])) raise Socks5Error((9,_generalerrors[9]))
# Get the bound address/port # Get the bound address/port
elif resp[3] == "\x01": elif resp[3] == "\x01":
boundaddr = self.__recvall(4) boundaddr = self.__recvall(4)
elif resp[3] == "\x03": elif resp[3] == "\x03":
resp = resp + self.recv(1) resp = resp + self.recv(1)
boundaddr = self.__recvall(ord(resp[4])) boundaddr = self.__recvall(ord(resp[4]))
else: else:
self.close() self.close()
raise GeneralProxyError((1,_generalerrors[1])) raise GeneralProxyError((1,_generalerrors[1]))
boundport = struct.unpack(">H",self.__recvall(2))[0] boundport = struct.unpack(">H",self.__recvall(2))[0]
self.__proxysockname = (boundaddr,boundport) self.__proxysockname = (boundaddr,boundport)
if ipaddr != None: if ipaddr != None:
self.__proxypeername = (socket.inet_ntoa(ipaddr),destport) self.__proxypeername = (socket.inet_ntoa(ipaddr),destport)
else: else:
self.__proxypeername = (destaddr,destport) self.__proxypeername = (destaddr,destport)
def getproxysockname(self): def getproxysockname(self):
"""getsockname() -> address info """getsockname() -> address info
Returns the bound IP address and port number at the proxy. Returns the bound IP address and port number at the proxy.
""" """
return self.__proxysockname return self.__proxysockname
def getproxypeername(self): def getproxypeername(self):
"""getproxypeername() -> address info """getproxypeername() -> address info
Returns the IP and port number of the proxy. Returns the IP and port number of the proxy.
""" """
return _orgsocket.getpeername(self) return _orgsocket.getpeername(self)
def getpeername(self): def getpeername(self):
"""getpeername() -> address info """getpeername() -> address info
Returns the IP address and port number of the destination Returns the IP address and port number of the destination
machine (note: getproxypeername returns the proxy) machine (note: getproxypeername returns the proxy)
""" """
return self.__proxypeername return self.__proxypeername
def __negotiatesocks4(self,destaddr,destport): def __negotiatesocks4(self,destaddr,destport):
"""__negotiatesocks4(self,destaddr,destport) """__negotiatesocks4(self,destaddr,destport)
Negotiates a connection through a SOCKS4 server. Negotiates a connection through a SOCKS4 server.
""" """
# Check if the destination address provided is an IP address # Check if the destination address provided is an IP address
rmtrslv = False rmtrslv = False
try: try:
ipaddr = socket.inet_aton(destaddr) ipaddr = socket.inet_aton(destaddr)
except socket.error: except socket.error:
# It's a DNS name. Check where it should be resolved. # It's a DNS name. Check where it should be resolved.
if self.__proxy[3]==True: if self.__proxy[3]==True:
ipaddr = "\x00\x00\x00\x01" ipaddr = "\x00\x00\x00\x01"
rmtrslv = True rmtrslv = True
else: else:
ipaddr = socket.inet_aton(socket.gethostbyname(destaddr)) ipaddr = socket.inet_aton(socket.gethostbyname(destaddr))
# Construct the request packet # Construct the request packet
req = "\x04\x01" + struct.pack(">H",destport) + ipaddr req = "\x04\x01" + struct.pack(">H",destport) + ipaddr
# The username parameter is considered userid for SOCKS4 # The username parameter is considered userid for SOCKS4
if self.__proxy[4] != None: if self.__proxy[4] != None:
req = req + self.__proxy[4] req = req + self.__proxy[4]
req = req + "\x00" req = req + "\x00"
# DNS name if remote resolving is required # DNS name if remote resolving is required
# NOTE: This is actually an extension to the SOCKS4 protocol # NOTE: This is actually an extension to the SOCKS4 protocol
# called SOCKS4A and may not be supported in all cases. # called SOCKS4A and may not be supported in all cases.
if rmtrslv==True: if rmtrslv==True:
req = req + destaddr + "\x00" req = req + destaddr + "\x00"
self.sendall(req) self.sendall(req)
# Get the response from the server # Get the response from the server
resp = self.__recvall(8) resp = self.__recvall(8)
if resp[0] != "\x00": if resp[0] != "\x00":
# Bad data # Bad data
self.close() self.close()
raise GeneralProxyError((1,_generalerrors[1])) raise GeneralProxyError((1,_generalerrors[1]))
if resp[1] != "\x5A": if resp[1] != "\x5A":
# Server returned an error # Server returned an error
self.close() self.close()
if ord(resp[1]) in (91,92,93): if ord(resp[1]) in (91,92,93):
self.close() self.close()
raise Socks4Error((ord(resp[1]),_socks4errors[ord(resp[1])-90])) raise Socks4Error((ord(resp[1]),_socks4errors[ord(resp[1])-90]))
else: else:
raise Socks4Error((94,_socks4errors[4])) raise Socks4Error((94,_socks4errors[4]))
# Get the bound address/port # Get the bound address/port
self.__proxysockname = (socket.inet_ntoa(resp[4:]),struct.unpack(">H",resp[2:4])[0]) self.__proxysockname = (socket.inet_ntoa(resp[4:]),struct.unpack(">H",resp[2:4])[0])
if rmtrslv != None: if rmtrslv != None:
self.__proxypeername = (socket.inet_ntoa(ipaddr),destport) self.__proxypeername = (socket.inet_ntoa(ipaddr),destport)
else: else:
self.__proxypeername = (destaddr,destport) self.__proxypeername = (destaddr,destport)
def __negotiatehttp(self,destaddr,destport): def __negotiatehttp(self,destaddr,destport):
"""__negotiatehttp(self,destaddr,destport) """__negotiatehttp(self,destaddr,destport)
Negotiates a connection through an HTTP server. Negotiates a connection through an HTTP server.
""" """
# If we need to resolve locally, we do this now # If we need to resolve locally, we do this now
if self.__proxy[3] == False: if self.__proxy[3] == False:
addr = socket.gethostbyname(destaddr) addr = socket.gethostbyname(destaddr)
else: else:
addr = destaddr addr = destaddr
self.sendall("CONNECT " + addr + ":" + str(destport) + " HTTP/1.1\r\n" + "Host: " + destaddr + "\r\n\r\n") self.sendall("CONNECT " + addr + ":" + str(destport) + " HTTP/1.1\r\n" + "Host: " + destaddr + "\r\n\r\n")
# We read the response until we get the string "\r\n\r\n" # We read the response until we get the string "\r\n\r\n"
resp = self.recv(1) resp = self.recv(1)
while resp.find("\r\n\r\n")==-1: while resp.find("\r\n\r\n")==-1:
resp = resp + self.recv(1) resp = resp + self.recv(1)
# We just need the first line to check if the connection # We just need the first line to check if the connection
# was successful # was successful
statusline = resp.splitlines()[0].split(" ",2) statusline = resp.splitlines()[0].split(" ",2)
if statusline[0] not in ("HTTP/1.0","HTTP/1.1"): if statusline[0] not in ("HTTP/1.0","HTTP/1.1"):
self.close() self.close()
raise GeneralProxyError((1,_generalerrors[1])) raise GeneralProxyError((1,_generalerrors[1]))
try: try:
statuscode = int(statusline[1]) statuscode = int(statusline[1])
except ValueError: except ValueError:
self.close() self.close()
raise GeneralProxyError((1,_generalerrors[1])) raise GeneralProxyError((1,_generalerrors[1]))
if statuscode != 200: if statuscode != 200:
self.close() self.close()
raise HTTPError((statuscode,statusline[2])) raise HTTPError((statuscode,statusline[2]))
self.__proxysockname = ("0.0.0.0",0) self.__proxysockname = ("0.0.0.0",0)
self.__proxypeername = (addr,destport) self.__proxypeername = (addr,destport)
def connect(self,destpair): def connect(self,destpair):
"""connect(self,despair) """connect(self,despair)
Connects to the specified destination through a proxy. Connects to the specified destination through a proxy.
destpar - A tuple of the IP/DNS address and the port number. destpar - A tuple of the IP/DNS address and the port number.
(identical to socket's connect). (identical to socket's connect).
To select the proxy server use setproxy(). To select the proxy server use setproxy().
""" """
# Do a minimal input check first # Do a minimal input check first
if (type(destpair) in (list,tuple)==False) or (len(destpair)<2) or (type(destpair[0])!=str) or (type(destpair[1])!=int): if (type(destpair) in (list,tuple)==False) or (len(destpair)<2) or (type(destpair[0])!=str) or (type(destpair[1])!=int):
raise GeneralProxyError((5,_generalerrors[5])) raise GeneralProxyError((5,_generalerrors[5]))
if self.__proxy[0] == PROXY_TYPE_SOCKS5: if self.__proxy[0] == PROXY_TYPE_SOCKS5:
if self.__proxy[2] != None: if self.__proxy[2] != None:
portnum = self.__proxy[2] portnum = self.__proxy[2]
else: else:
portnum = 1080 portnum = 1080
_orgsocket.connect(self,(self.__proxy[1],portnum)) _orgsocket.connect(self,(self.__proxy[1],portnum))
self.__negotiatesocks5(destpair[0],destpair[1]) self.__negotiatesocks5(destpair[0],destpair[1])
elif self.__proxy[0] == PROXY_TYPE_SOCKS4: elif self.__proxy[0] == PROXY_TYPE_SOCKS4:
if self.__proxy[2] != None: if self.__proxy[2] != None:
portnum = self.__proxy[2] portnum = self.__proxy[2]
else: else:
portnum = 1080 portnum = 1080
_orgsocket.connect(self,(self.__proxy[1],portnum)) _orgsocket.connect(self,(self.__proxy[1],portnum))
self.__negotiatesocks4(destpair[0],destpair[1]) self.__negotiatesocks4(destpair[0],destpair[1])
elif self.__proxy[0] == PROXY_TYPE_HTTP: elif self.__proxy[0] == PROXY_TYPE_HTTP:
if self.__proxy[2] != None: if self.__proxy[2] != None:
portnum = self.__proxy[2] portnum = self.__proxy[2]
else: else:
portnum = 8080 portnum = 8080
_orgsocket.connect(self,(self.__proxy[1],portnum)) _orgsocket.connect(self,(self.__proxy[1],portnum))
self.__negotiatehttp(destpair[0],destpair[1]) self.__negotiatehttp(destpair[0],destpair[1])
elif self.__proxy[0] == None: elif self.__proxy[0] == None:
_orgsocket.connect(self,(destpair[0],destpair[1])) _orgsocket.connect(self,(destpair[0],destpair[1]))
else: else:
raise GeneralProxyError((4,_generalerrors[4])) raise GeneralProxyError((4,_generalerrors[4]))

View file

@ -1,54 +1,54 @@
/* /*
Core.css for Mocha UI Core.css for Mocha UI
Theme: Default Theme: Default
Copyright: Copyright:
Copyright (c) 2007-2009 Greg Houston, <http://greghoustondesign.com/>. Copyright (c) 2007-2009 Greg Houston, <http://greghoustondesign.com/>.
License: License:
MIT-style license. MIT-style license.
Notes: Notes:
CSS rules in this file: CSS rules in this file:
1. Rules required by all MochaUI components or are shared by more than one. 1. Rules required by all MochaUI components or are shared by more than one.
2. Theme specific ajustments to plugin styles. 2. Theme specific ajustments to plugin styles.
3. Miscellaneous rules that have no better place to go. 3. Miscellaneous rules that have no better place to go.
*/ */
/* Required By All /* Required By All
---------------------------------------------------------------- */ ---------------------------------------------------------------- */
/* Clears */ /* Clears */
.clear { .clear {
clear: both; clear: both;
height: 0; height: 0;
} }
* html .clear { * html .clear {
font-size: 1px; font-size: 1px;
line-height: 1px; line-height: 1px;
overflow: hidden; overflow: hidden;
visibility: hidden; visibility: hidden;
} }
/* Miscellaneous /* Miscellaneous
---------------------------------------------------------------- */ ---------------------------------------------------------------- */
#themeControl { #themeControl {
margin-top: 2px; margin-top: 2px;
} }
/* Theme Specific Adjustments to Default Plugin Styles /* Theme Specific Adjustments to Default Plugin Styles
---------------------------------------------------------------- */ ---------------------------------------------------------------- */
/* Folder Tree */ /* Folder Tree */
.tree li a { .tree li a {
color: #3f3f3f !important; color: #3f3f3f !important;
} }

View file

@ -1,429 +1,429 @@
/* /*
Core.css for Mocha UI Core.css for Mocha UI
Theme: Default Theme: Default
Copyright: Copyright:
Copyright (c) 2007-2009 Greg Houston, <http://greghoustondesign.com/>. Copyright (c) 2007-2009 Greg Houston, <http://greghoustondesign.com/>.
License: License:
MIT-style license. MIT-style license.
Required by: Required by:
Layout.js Layout.js
*/ */
/* Layout /* Layout
---------------------------------------------------------------- */ ---------------------------------------------------------------- */
html, body { html, body {
background: #fff; background: #fff;
} }
body { body {
margin: 0; /* Required */ margin: 0; /* Required */
} }
#desktop { #desktop {
position: relative; position: relative;
min-width: 400px; /* Helps keep header content from wrapping */ min-width: 400px; /* Helps keep header content from wrapping */
height: 100%; height: 100%;
min-height: 100%; min-height: 100%;
overflow: hidden; overflow: hidden;
cursor: default; /* Fix for issue in IE7. IE7 wants to use the I-bar text cursor */ cursor: default; /* Fix for issue in IE7. IE7 wants to use the I-bar text cursor */
} }
#desktopHeader { #desktopHeader {
background: #f2f2f2; background: #f2f2f2;
} }
#desktopTitlebarWrapper { #desktopTitlebarWrapper {
position: relative; position: relative;
height: 45px; height: 45px;
overflow: hidden; overflow: hidden;
background: #718BA6 url(../images/skin/bg-header.gif) repeat-x; background: #718BA6 url(../images/skin/bg-header.gif) repeat-x;
} }
#desktopTitlebar { #desktopTitlebar {
padding: 7px 8px 6px 8px; padding: 7px 8px 6px 8px;
height: 32px; height: 32px;
background: url(../images/skin/logo.gif) no-repeat; background: url(../images/skin/logo.gif) no-repeat;
background-position: left 0; background-position: left 0;
} }
#desktopTitlebar h1.applicationTitle { #desktopTitlebar h1.applicationTitle {
display: none; display: none;
margin: 0; margin: 0;
padding: 0 5px 0 0; padding: 0 5px 0 0;
font-size: 20px; font-size: 20px;
line-height: 25px; line-height: 25px;
font-weight: bold; font-weight: bold;
color: #fff; color: #fff;
} }
#desktopTitlebar h2.tagline { #desktopTitlebar h2.tagline {
padding: 7px 0 0 0; padding: 7px 0 0 0;
font-family: Verdana, Arial, Helvetica, sans-serif; font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px; font-size: 10px;
color: #d4dce4; color: #d4dce4;
font-weight: bold; font-weight: bold;
text-align: center; text-align: center;
text-transform: uppercase; text-transform: uppercase;
} }
#desktopTitlebar h2.tagline .taglineEm { #desktopTitlebar h2.tagline .taglineEm {
color: #fff; color: #fff;
font-weight: bold; font-weight: bold;
} }
#topNav { #topNav {
font-family: Verdana, Arial, Helvetica, sans-serif; font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px; font-size: 10px;
position: absolute; position: absolute;
right: 0; right: 0;
top: 0; top: 0;
color: #d4dce4; color: #d4dce4;
text-align: right; text-align: right;
padding: 13px 10px 0 0; padding: 13px 10px 0 0;
} }
#topNav a { #topNav a {
color: #fff; color: #fff;
font-weight: normal; font-weight: normal;
} }
#topNav a:hover { #topNav a:hover {
text-decoration: none; text-decoration: none;
} }
/* Navbar */ /* Navbar */
#desktopNavbar { #desktopNavbar {
background: #f2f2f2; background: #f2f2f2;
/*height: 30px;*/ /*height: 30px;*/
margin: 0 0px; margin: 0 0px;
overflow: hidden; /* Remove this line if you want the menu to be backward compatible with Firefox 2 */ overflow: hidden; /* Remove this line if you want the menu to be backward compatible with Firefox 2 */
/* Fixes by Chris */ /* Fixes by Chris */
/*background-color: #ccc;*/ /*background-color: #ccc;*/
height: 20px; height: 20px;
margin-bottom: 5px; margin-bottom: 5px;
border-bottom: 1px solid #3f3f3f; border-bottom: 1px solid #3f3f3f;
} }
#desktopNavbar ul { #desktopNavbar ul {
padding: 0; padding: 0;
margin: 0; margin: 0;
list-style: none; list-style: none;
font-size: 12px; font-size: 12px;
} }
#desktopNavbar>ul>li { #desktopNavbar>ul>li {
float: left; float: left;
} }
#desktopNavbar a { #desktopNavbar a {
display: block; display: block;
} }
#desktopNavbar ul li a { #desktopNavbar ul li a {
/*padding: 6px 10px 6px 10px;*/ /*padding: 6px 10px 6px 10px;*/
color: #333; color: #333;
font-weight: normal; font-weight: normal;
/* Fix by Chris */ /* Fix by Chris */
padding: 2px 10px 6px 10px; padding: 2px 10px 6px 10px;
} }
#desktopNavbar ul li a:hover { #desktopNavbar ul li a:hover {
color: #333; color: #333;
/* Fix By Chris */ /* Fix By Chris */
background-color: #fff; background-color: #fff;
} }
#desktopNavbar ul li a.arrow-right, #desktopNavbar ul li a:hover.arrow-right { #desktopNavbar ul li a.arrow-right, #desktopNavbar ul li a:hover.arrow-right {
background-image: url(../images/skin/arrow-right.gif); background-image: url(../images/skin/arrow-right.gif);
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: right 7px; background-position: right 7px;
} }
#desktopNavbar li ul { #desktopNavbar li ul {
border: 1px solid #3f3f3f; border: 1px solid #3f3f3f;
background: #fff url(../images/skin/bg-dropdown.gif) repeat-y; background: #fff url(../images/skin/bg-dropdown.gif) repeat-y;
position: absolute; position: absolute;
left: -999em; left: -999em;
z-index: 8000; z-index: 8000;
/* Fix by Chris */ /* Fix by Chris */
margin-top: -6px; margin-top: -6px;
} }
#desktopNavbar li:hover ul ul, #desktopNavbar li:hover ul ul,
#desktopNavbar li.ieHover ul ul, #desktopNavbar li.ieHover ul ul,
#desktopNavbar li:hover ul ul ul, #desktopNavbar li:hover ul ul ul,
#desktopNavbar li.ieHover ul ul ul { #desktopNavbar li.ieHover ul ul ul {
left: -999em; left: -999em;
} }
#desktopNavbar li ul ul { /* third-and-above-level lists */ #desktopNavbar li ul ul { /* third-and-above-level lists */
margin: -22px 0 0 163px; margin: -22px 0 0 163px;
} }
#desktopNavbar li ul li .check { #desktopNavbar li ul li .check {
position: absolute; position: absolute;
top: 8px; top: 8px;
left: 6px; left: 6px;
width: 5px; width: 5px;
height: 5px; height: 5px;
background: #555; background: #555;
overflow: hidden; overflow: hidden;
line-height: 1px; line-height: 1px;
font-size: 1px; font-size: 1px;
} }
#desktopNavbar li ul li a { #desktopNavbar li ul li a {
position: relative; position: relative;
/*padding: 1px 9px 1px 25px;*/ /*padding: 1px 9px 1px 25px;*/
min-width: 120px; min-width: 120px;
color: #3f3f3f; color: #3f3f3f;
font-weight: normal; font-weight: normal;
/* Fix By Chris */ /* Fix By Chris */
padding: 1px 10px 1px 20px; /* Reduce left padding */ padding: 1px 10px 1px 20px; /* Reduce left padding */
} }
#desktopNavbar li ul li a:hover { #desktopNavbar li ul li a:hover {
background: #6C98D9; background: #6C98D9;
color: #fff; color: #fff;
-moz-border-radius: 2px; -moz-border-radius: 2px;
} }
#desktopNavbar li ul li a:hover .check { #desktopNavbar li ul li a:hover .check {
background: #fff; background: #fff;
} }
#desktopNavbar li:hover ul, #desktopNavbar li:hover ul,
#desktopNavbar li.ieHover ul, #desktopNavbar li.ieHover ul,
#desktopNavbar li li.ieHover ul, #desktopNavbar li li.ieHover ul,
#desktopNavbar li li li.ieHover ul, #desktopNavbar li li li.ieHover ul,
#desktopNavbar li li:hover ul, #desktopNavbar li li:hover ul,
#desktopNavbar li li li:hover ul { /* lists nested under hovered list items */ #desktopNavbar li li li:hover ul { /* lists nested under hovered list items */
left: auto; left: auto;
} }
#desktopNavbar li:hover { /* For IE7 */ #desktopNavbar li:hover { /* For IE7 */
position: static; position: static;
} }
li.divider { li.divider {
margin-top: 2px; margin-top: 2px;
padding-top: 3px; padding-top: 3px;
border-top: 1px solid #ebebeb; border-top: 1px solid #ebebeb;
} }
#pageWrapper { #pageWrapper {
position: relative; position: relative;
overflow: hidden; /* This can be set to hidden or auto */ overflow: hidden; /* This can be set to hidden or auto */
border-top: 1px solid #909090; border-top: 1px solid #909090;
border-bottom: 1px solid #909090; border-bottom: 1px solid #909090;
/*height: 100%;*/ /*height: 100%;*/
} }
/* Footer */ /* Footer */
#desktopFooterWrapper { #desktopFooterWrapper {
position: absolute; position: absolute;
left: 0; left: 0;
bottom: 0; bottom: 0;
width: 100%; width: 100%;
height: 30px; height: 30px;
overflow: hidden; overflow: hidden;
} }
#desktopFooter { #desktopFooter {
font-family: Verdana, Arial, Helvetica, sans-serif; font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px; font-size: 10px;
height: 24px; height: 24px;
padding: 6px 8px 0 8px; padding: 6px 8px 0 8px;
background: #f2f2f2; background: #f2f2f2;
} }
/* Panel Layout /* Panel Layout
---------------------------------------------------------------- */ ---------------------------------------------------------------- */
/* Columns */ /* Columns */
.column { .column {
position: relative; position: relative;
float: left; float: left;
overflow: hidden; /* Required by IE6 */ overflow: hidden; /* Required by IE6 */
} }
/* Panels */ /* Panels */
.panel { .panel {
position: relative; position: relative;
overflow: auto; overflow: auto;
background: #f8f8f8; background: #f8f8f8;
border-bottom: 1px solid #b9b9b9; border-bottom: 1px solid #b9b9b9;
} }
.panelWrapper.collapsed .panel-header { .panelWrapper.collapsed .panel-header {
border-bottom: 0; border-bottom: 0;
} }
.panelAlt { .panelAlt {
background: #f2f2f2; background: #f2f2f2;
} }
.bottomPanel { .bottomPanel {
border-bottom: 0; border-bottom: 0;
} }
.pad { .pad {
padding: 8px; padding: 8px;
} }
#mainPanel { #mainPanel {
background: #fff; background: #fff;
} }
.panel-header { .panel-header {
position: relative; position: relative;
background: #f1f1f1 url(../images/skin/bg-panel-header.gif) repeat-x; background: #f1f1f1 url(../images/skin/bg-panel-header.gif) repeat-x;
height: 30px; height: 30px;
overflow: hidden; overflow: hidden;
border-bottom: 1px solid #d3d3d3; border-bottom: 1px solid #d3d3d3;
} }
.panel-headerContent { .panel-headerContent {
padding-top: 2px; padding-top: 2px;
} }
.panel-headerContent.tabs { .panel-headerContent.tabs {
background: url(../images/skin/tabs.gif) repeat-x; background: url(../images/skin/tabs.gif) repeat-x;
background-position: left -68px; background-position: left -68px;
} }
.panel-header h2 { .panel-header h2 {
display: inline-block; display: inline-block;
font-size: 12px; font-size: 12px;
margin: 0; margin: 0;
padding: 3px 8px 0 8px; padding: 3px 8px 0 8px;
height: 22px; height: 22px;
overflow: hidden; overflow: hidden;
color: #333; color: #333;
} }
.panel-collapse { .panel-collapse {
background: url(../images/skin/collapse-expand.gif) left top no-repeat; background: url(../images/skin/collapse-expand.gif) left top no-repeat;
} }
.panel-expand { .panel-expand {
background: url(../images/skin/collapse-expand.gif) left -16px no-repeat; background: url(../images/skin/collapse-expand.gif) left -16px no-repeat;
} }
.icon16 { .icon16 {
margin: 4px 0 0 2px; margin: 4px 0 0 2px;
cursor: pointer; cursor: pointer;
} }
/* Column and Panel Handles */ /* Column and Panel Handles */
.horizontalHandle { .horizontalHandle {
height: 4px; height: 4px;
line-height: 1px; line-height: 1px;
font-size: 1px; font-size: 1px;
overflow: hidden; overflow: hidden;
background: #eee url(../images/skin/bg-handle-horizontal.gif) repeat-x; background: #eee url(../images/skin/bg-handle-horizontal.gif) repeat-x;
} }
.horizontalHandle.detached .handleIcon { .horizontalHandle.detached .handleIcon {
background: transparent; background: transparent;
} }
.horizontalHandle .handleIcon { .horizontalHandle .handleIcon {
margin: 0 auto; margin: 0 auto;
height: 4px; height: 4px;
line-height: 1px; line-height: 1px;
font-size: 1px; font-size: 1px;
overflow: hidden; overflow: hidden;
background: url(../images/skin/handle-icon-horizontal.gif) center center no-repeat; background: url(../images/skin/handle-icon-horizontal.gif) center center no-repeat;
} }
.columnHandle { .columnHandle {
min-height: 10px; min-height: 10px;
float: left; float: left;
width: 4px; width: 4px;
overflow: hidden; overflow: hidden;
background: #c3c3c3 url(../images/skin/handle-icon.gif) center center no-repeat; background: #c3c3c3 url(../images/skin/handle-icon.gif) center center no-repeat;
border: 1px solid #909090; border: 1px solid #909090;
border-top: 0; border-top: 0;
border-bottom: 0; border-bottom: 0;
} }
/* Toolboxes */ /* Toolboxes */
.toolbox { .toolbox {
float: right; float: right;
margin-top: 3px; margin-top: 3px;
padding: 0 5px; padding: 0 5px;
height: 24px; height: 24px;
overflow: hidden; overflow: hidden;
text-align: right; text-align: right;
} }
.panel-header-toolbox { .panel-header-toolbox {
} }
div.toolbox.divider { /* Have to specify div here for IE6's sake */ div.toolbox.divider { /* Have to specify div here for IE6's sake */
background: url(../images/skin/toolbox-divider.gif) repeat-y; background: url(../images/skin/toolbox-divider.gif) repeat-y;
padding-left: 8px; padding-left: 8px;
} }
.toolbox img.disabled { .toolbox img.disabled {
cursor: default; cursor: default;
} }
.iconWrapper { .iconWrapper {
display: inline-block; display: inline-block;
height: 22px; height: 22px;
min-width: 22px; min-width: 22px;
overflow: hidden; overflow: hidden;
border: 1px solid transparent; border: 1px solid transparent;
} }
* html .iconWrapper { * html .iconWrapper {
padding: 1px; padding: 1px;
border: 0; border: 0;
} }
.iconWrapper img { .iconWrapper img {
cursor: pointer; cursor: pointer;
margin: 0; margin: 0;
padding: 3px; padding: 3px;
} }
.iconWrapper:hover { .iconWrapper:hover {
border: 1px solid #a0a0a0; border: 1px solid #a0a0a0;
-moz-border-radius: 3px; -moz-border-radius: 3px;
} }
#spinnerWrapper { #spinnerWrapper {
width: 16px; width: 16px;
height: 16px; height: 16px;
background: url(../images/skin/spinner-placeholder.gif) no-repeat; background: url(../images/skin/spinner-placeholder.gif) no-repeat;
margin: 4px 5px 0 5px; margin: 4px 5px 0 5px;
} }
#spinner { #spinner {
display: none; display: none;
background: url(../images/skin/spinner.gif) no-repeat; background: url(../images/skin/spinner.gif) no-repeat;
width: 16px; width: 16px;
height: 16px; height: 16px;
} }
#desktopFooter td { #desktopFooter td {
vertical-align: top; vertical-align: top;
text-align: center; text-align: center;
} }

View file

@ -1,66 +1,66 @@
/* /*
Tabs.css for Mocha UI Tabs.css for Mocha UI
Theme: Default Theme: Default
Copyright: Copyright:
Copyright (c) 2007-2009 Greg Houston, <http://greghoustondesign.com/>. Copyright (c) 2007-2009 Greg Houston, <http://greghoustondesign.com/>.
License: License:
MIT-style license. MIT-style license.
Required by: Required by:
Tabs.js Tabs.js
*/ */
/* Toolbar Tabs */ /* Toolbar Tabs */
.toolbarTabs { .toolbarTabs {
padding: 0 5px 2px 2px; padding: 0 5px 2px 2px;
background: url(../images/skin/tabs.gif) repeat-x; background: url(../images/skin/tabs.gif) repeat-x;
background-position: left -70px; background-position: left -70px;
overflow: visible; overflow: visible;
} }
.tab-menu { .tab-menu {
padding-top: 1px; padding-top: 1px;
list-style: none; list-style: none;
margin: 0; margin: 0;
padding: 0; padding: 0;
line-height: 16px; line-height: 16px;
font-size: 11px; font-size: 11px;
} }
.tab-menu li { .tab-menu li {
display: block; display: block;
float: left; float: left;
margin: 0 0 5px 0; margin: 0 0 5px 0;
cursor: pointer; cursor: pointer;
background: url(../images/skin/tabs.gif) repeat-x; background: url(../images/skin/tabs.gif) repeat-x;
background-position: left -35px; background-position: left -35px;
} }
.tab-menu li.selected { .tab-menu li.selected {
background: url(../images/skin/tabs.gif) repeat-x; background: url(../images/skin/tabs.gif) repeat-x;
background-position: left 0; background-position: left 0;
} }
.tab-menu li a { .tab-menu li a {
display: block; display: block;
margin-left: 8px; margin-left: 8px;
padding: 6px 15px 5px 9px; padding: 6px 15px 5px 9px;
text-align: center; text-align: center;
font-weight: normal; font-weight: normal;
color: #181818; color: #181818;
background: url(../images/skin/tabs.gif) repeat-x; background: url(../images/skin/tabs.gif) repeat-x;
background-position: right -35px; background-position: right -35px;
} }
.tab-menu li.selected a { .tab-menu li.selected a {
color: #181818; color: #181818;
font-weight: bold; font-weight: bold;
background: url(../images/skin/tabs.gif) repeat-x; background: url(../images/skin/tabs.gif) repeat-x;
background-position: right 0; background-position: right 0;
} }

View file

@ -1,378 +1,378 @@
/* /*
Window.css for Mocha UI Window.css for Mocha UI
Theme: Default Theme: Default
Copyright: Copyright:
Copyright (c) 2007-2009 Greg Houston, <http://greghoustondesign.com/>. Copyright (c) 2007-2009 Greg Houston, <http://greghoustondesign.com/>.
License: License:
MIT-style license. MIT-style license.
Required by: Required by:
Window.js and Modal.css Window.js and Modal.css
*/ */
/* Windows /* Windows
---------------------------------------------------------------- */ ---------------------------------------------------------------- */
.mocha { .mocha {
display: none; display: none;
overflow: hidden; overflow: hidden;
background-color: #e5e5e5; background-color: #e5e5e5;
} }
.mocha.isFocused { .mocha.isFocused {
} }
.mochaOverlay { .mochaOverlay {
position: absolute; /* This is also set in theme.js in order to make theme transitions smoother */ position: absolute; /* This is also set in theme.js in order to make theme transitions smoother */
top: 0; top: 0;
left: 0; left: 0;
} }
/* /*
We get a little creative here in order to define a gradient in the CSS using a query We get a little creative here in order to define a gradient in the CSS using a query
string appended to a background image. string appended to a background image.
"from" is the top color of the gradient. "to" is the bottom color of the gradient. "from" is the top color of the gradient. "to" is the bottom color of the gradient.
Both must be hex values without the leading # sign. Both must be hex values without the leading # sign.
*/ */
.mochaTitlebar { .mochaTitlebar {
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
background: url(../images/skin/spacer.gif?from=fafafa&to=e5e5e5); background: url(../images/skin/spacer.gif?from=fafafa&to=e5e5e5);
} }
.mochaTitlebar h3 { .mochaTitlebar h3 {
font-size: 12px; font-size: 12px;
line-height: 15px; line-height: 15px;
font-weight: bold; font-weight: bold;
margin: 0; margin: 0;
padding: 5px 10px 4px 12px; padding: 5px 10px 4px 12px;
color: #888; color: #888;
} }
.mocha.isFocused .mochaTitlebar h3 { .mocha.isFocused .mochaTitlebar h3 {
color: #181818; color: #181818;
} }
.mochaToolbarWrapper { .mochaToolbarWrapper {
width: 100%; /* For IE */ width: 100%; /* For IE */
position: relative; position: relative;
height: 29px; height: 29px;
background: #f1f1f1; background: #f1f1f1;
overflow: hidden; overflow: hidden;
border-top: 1px solid #d9d9d9; border-top: 1px solid #d9d9d9;
} }
div.mochaToolbarWrapper.bottom { div.mochaToolbarWrapper.bottom {
border: 0; border: 0;
border-bottom: 1px solid #d9d9d9; border-bottom: 1px solid #d9d9d9;
} }
.mochaToolbar { .mochaToolbar {
width: 100%; /* For IE */ width: 100%; /* For IE */
border-top: 1px solid #fff; border-top: 1px solid #fff;
} }
.mochaContentBorder { .mochaContentBorder {
border-top: 1px solid #dadada; border-top: 1px solid #dadada;
border-bottom: 1px solid #dadada; border-bottom: 1px solid #dadada;
} }
.mochaContentWrapper { /* Has a fixed height and scrollbars if required. */ .mochaContentWrapper { /* Has a fixed height and scrollbars if required. */
font-size: 12px; font-size: 12px;
overflow: auto; overflow: auto;
background: #fff; background: #fff;
} }
.mochaContent { .mochaContent {
padding: 10px 12px; padding: 10px 12px;
} }
.mocha .handle { .mocha .handle {
position: absolute; position: absolute;
background: #0f0; background: #0f0;
width: 3px; width: 3px;
height: 3px; height: 3px;
z-index: 2; z-index: 2;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; /* IE8 */ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; /* IE8 */
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); /* IE6 and 7*/ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); /* IE6 and 7*/
opacity: .0; opacity: .0;
-moz-opacity: .0; -moz-opacity: .0;
overflow: hidden; overflow: hidden;
font-size: 1px; /* For IE6 */ font-size: 1px; /* For IE6 */
} }
.mocha .corner { /* Corner resize handles */ .mocha .corner { /* Corner resize handles */
width: 10px; width: 10px;
height: 10px; height: 10px;
background: #f00; background: #f00;
} }
.mocha .cornerSE { /* Bottom right resize handle */ .mocha .cornerSE { /* Bottom right resize handle */
width: 20px; width: 20px;
height: 20px; height: 20px;
background: #fefefe; /* This is the color of the visible resize handle */ background: #fefefe; /* This is the color of the visible resize handle */
} }
.mochaCanvasHeader { .mochaCanvasHeader {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
background: transparent; background: transparent;
z-index: -1; z-index: -1;
visibility: hidden; visibility: hidden;
overflow: hidden; overflow: hidden;
} }
.mochaControls { .mochaControls {
position: absolute; position: absolute;
width: 52px; width: 52px;
top: 8px; top: 8px;
right: 8px; right: 8px;
height: 14px; height: 14px;
z-index: 4; z-index: 4;
background: transparent; background: transparent;
} }
.mochaCanvasControls { .mochaCanvasControls {
position: absolute; position: absolute;
top: 8px; top: 8px;
right: 8px; right: 8px;
z-index: 3; z-index: 3;
background: transparent; background: transparent;
} }
/* /*
To use images for these buttons: To use images for these buttons:
1. Set the useCanvasControls window option to false. 1. Set the useCanvasControls window option to false.
2. If you use a different button size you may need to reposition the controls. 2. If you use a different button size you may need to reposition the controls.
Modify the controlsOffset window option. Modify the controlsOffset window option.
2. Replcac the background-color with a background-image for each button. 2. Replcac the background-color with a background-image for each button.
*/ */
.mochaMinimizeButton, .mochaMaximizeButton, .mochaCloseButton { .mochaMinimizeButton, .mochaMaximizeButton, .mochaCloseButton {
float: right; float: right;
width: 14px; width: 14px;
height: 14px; height: 14px;
font-size: 1px; font-size: 1px;
cursor: pointer; cursor: pointer;
z-index: 4; z-index: 4;
color: #666; color: #666;
background-color: #fff; background-color: #fff;
margin-left: 5px; margin-left: 5px;
} }
.mochaMinimizeButton { .mochaMinimizeButton {
margin-left: 0; margin-left: 0;
} }
.mochaMaximizeButton { .mochaMaximizeButton {
} }
.mochaCloseButton { .mochaCloseButton {
} }
.mochaSpinner{ .mochaSpinner{
display: none; display: none;
position: absolute; position: absolute;
bottom: 7px; bottom: 7px;
left: 6px; left: 6px;
width: 16px; width: 16px;
height: 16px; height: 16px;
background: url(../images/skin/spinner.gif) no-repeat; background: url(../images/skin/spinner.gif) no-repeat;
} }
.mochaIframe { .mochaIframe {
width: 100%; width: 100%;
} }
/* Fix for IE6 select z-index issue */ /* Fix for IE6 select z-index issue */
.zIndexFix { .zIndexFix {
display: block; display: block;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
z-index: -1; z-index: -1;
filter: mask(); filter: mask();
width: 100px; width: 100px;
height: 100px; height: 100px;
border: 1px solid transparent; border: 1px solid transparent;
} }
/* Viewport overlays /* Viewport overlays
---------------------------------------------------------------- */ ---------------------------------------------------------------- */
#modalOverlay { #modalOverlay {
display: none; display: none;
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
background: #000; background: #000;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; /* IE8 */ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; /* IE8 */
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); /* IE6 and 7*/ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); /* IE6 and 7*/
opacity: 0; opacity: 0;
-moz-opacity: 0; -moz-opacity: 0;
z-index: 10000; z-index: 10000;
} }
/* Fix for IE6 select z-index issue */ /* Fix for IE6 select z-index issue */
#modalFix { #modalFix {
display: none; display: none;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; /* IE8 */ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; /* IE8 */
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); /* IE6 and 7*/ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); /* IE6 and 7*/
opacity: 0; opacity: 0;
-moz-opacity: 0; -moz-opacity: 0;
z-index: 9999; z-index: 9999;
} }
/* Underlay */ /* Underlay */
#windowUnderlay { #windowUnderlay {
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
background: #fff; background: #fff;
} }
* html #windowUnderlay { * html #windowUnderlay {
position: absolute; position: absolute;
} }
/* The replaced class is used internally when converting CSS values to Canvas. These classes should not be removed. */ /* The replaced class is used internally when converting CSS values to Canvas. These classes should not be removed. */
.mocha.replaced, .mochaTitlebar.replaced, .mochaMinimizeButton.replaced, .mochaMaximizeButton.replaced, .mochaCloseButton.replaced { .mocha.replaced, .mochaTitlebar.replaced, .mochaMinimizeButton.replaced, .mochaMaximizeButton.replaced, .mochaCloseButton.replaced {
background-color: transparent !important; background-color: transparent !important;
} }
.windowClosed { .windowClosed {
visibility: hidden; visibility: hidden;
display: none; display: none;
position: absolute; position: absolute;
top: -20000px; top: -20000px;
left: -20000px; left: -20000px;
z-index: -1; z-index: -1;
overflow: hidden; overflow: hidden;
} }
.windowClosed .mochaContentBorder, .windowClosed .mochaToolbarWrapper, .windowClosed .mochaTitlebar, .windowClosed .mochaControls, .windowClosed .mochaContentBorder, .windowClosed .mochaToolbarWrapper, .windowClosed .mochaTitlebar, .windowClosed .mochaControls,
.windowClosed .mochaCanvasControls { .windowClosed .mochaCanvasControls {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
visibility: hidden; visibility: hidden;
display: none; display: none;
z-index: -1; z-index: -1;
} }
/* Modals */ /* Modals */
.modal2 { .modal2 {
border: 8px solid #fff; border: 8px solid #fff;
} }
.modal2 .mochaContentBorder { .modal2 .mochaContentBorder {
border-width: 0px; border-width: 0px;
} }
/* Window Themes */ /* Window Themes */
.mocha.no-canvas { .mocha.no-canvas {
background: #e5e5e5; background: #e5e5e5;
border: 1px solid #555; border: 1px solid #555;
} }
.mocha.no-canvas .mochaTitlebar { .mocha.no-canvas .mochaTitlebar {
background: #e5e5e5; background: #e5e5e5;
} }
.mocha.transparent .mochaTitlebar h3 { .mocha.transparent .mochaTitlebar h3 {
color: #fff; color: #fff;
display: none; display: none;
} }
.mocha.transparent .mochaContentWrapper { .mocha.transparent .mochaContentWrapper {
background: transparent; background: transparent;
} }
.mocha.notification { .mocha.notification {
background: #cedff2; background: #cedff2;
} }
.mocha.notification .mochaTitlebar { .mocha.notification .mochaTitlebar {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; /* IE8 */ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; /* IE8 */
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); /* IE6 and 7*/ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); /* IE6 and 7*/
opacity: .0; opacity: .0;
-moz-opacity: 0; -moz-opacity: 0;
} }
.mocha.notification .mochaContentBorder { .mocha.notification .mochaContentBorder {
border-width: 0px; border-width: 0px;
} }
.mocha.notification .mochaContentWrapper { .mocha.notification .mochaContentWrapper {
text-align: center; text-align: center;
font-size: 12px; font-size: 12px;
font-weight: bold; font-weight: bold;
background: transparent; background: transparent;
} }
/* Example Window Themes */ /* Example Window Themes */
#about_contentWrapper { #about_contentWrapper {
background: #e5e5e5 url(../images/skin/logo2.gif) 3px 3px no-repeat; background: #e5e5e5 url(../images/skin/logo2.gif) 3px 3px no-repeat;
} }
#builder_contentWrapper { #builder_contentWrapper {
background: #f5f5f7; background: #f5f5f7;
} }
#json01 .mochaTitlebar { #json01 .mochaTitlebar {
background: #6dd2db; background: #6dd2db;
} }
#json02 .mochaTitlebar { #json02 .mochaTitlebar {
background: #6db6db; background: #6db6db;
} }
#json03 .mochaTitlebar { #json03 .mochaTitlebar {
background: #6d92db; background: #6d92db;
} }
.jsonExample .mochaTitlebar h3 { .jsonExample .mochaTitlebar h3 {
color: #ddd; color: #ddd;
} }
/* This does not work in IE6. */ /* This does not work in IE6. */
.isFocused.jsonExample .mochaTitlebar h3 { .isFocused.jsonExample .mochaTitlebar h3 {
color: #fff; color: #fff;
} }
#fxmorpherExample .mochaContentWrapper { #fxmorpherExample .mochaContentWrapper {
background: #577a9e; background: #577a9e;
} }
#clock { #clock {
background: #fff; background: #fff;
} }
/* Workaround to make invisible buttons clickable */ /* Workaround to make invisible buttons clickable */
.mochaMinimizeButton.replaced, .mochaMinimizeButton.replaced,
.mochaMaximizeButton.replaced, .mochaMaximizeButton.replaced,
.mochaCloseButton.replaced { .mochaCloseButton.replaced {
background-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7) !important; background-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7) !important;
} }

View file

@ -1,212 +1,212 @@
/* /*
Script: Parametrics.js Script: Parametrics.js
Initializes the GUI property sliders. Initializes the GUI property sliders.
Copyright: Copyright:
Copyright (c) 2007-2008 Greg Houston, <http://greghoustondesign.com/>. Copyright (c) 2007-2008 Greg Houston, <http://greghoustondesign.com/>.
License: License:
MIT-style license. MIT-style license.
Requires: Requires:
Core.js, Window.js Core.js, Window.js
*/ */
MochaUI.extend({ MochaUI.extend({
addUpLimitSlider: function(hash) { addUpLimitSlider: function(hash) {
if ($('uplimitSliderarea')) { if ($('uplimitSliderarea')) {
var windowOptions = MochaUI.Windows.windowOptions; var windowOptions = MochaUI.Windows.windowOptions;
var sliderFirst = true; var sliderFirst = true;
// Get global upload limit // Get global upload limit
var maximum = 500; var maximum = 500;
var req = new Request({ var req = new Request({
url: 'command/getGlobalUpLimit', url: 'command/getGlobalUpLimit',
method: 'post', method: 'post',
data: {}, data: {},
onSuccess: function(data) { onSuccess: function(data) {
if (data) { if (data) {
var tmp = data.toInt(); var tmp = data.toInt();
if (tmp > 0) { if (tmp > 0) {
maximum = tmp / 1024. maximum = tmp / 1024.
} }
else { else {
if (hash == "global") if (hash == "global")
maximum = 10000; maximum = 10000;
else else
maximum = 1000; maximum = 1000;
} }
} }
// Get torrent upload limit // Get torrent upload limit
// And create slider // And create slider
if (hash == 'global') { if (hash == 'global') {
var up_limit = maximum; var up_limit = maximum;
if (up_limit < 0) up_limit = 0; if (up_limit < 0) up_limit = 0;
maximum = 10000; maximum = 10000;
var mochaSlide = new Slider($('uplimitSliderarea'), $('uplimitSliderknob'), { var mochaSlide = new Slider($('uplimitSliderarea'), $('uplimitSliderknob'), {
steps: maximum, steps: maximum,
offset: 0, offset: 0,
initialStep: up_limit.round(), initialStep: up_limit.round(),
onChange: function(pos) { onChange: function(pos) {
if (pos > 0) { if (pos > 0) {
$('uplimitUpdatevalue').value = pos; $('uplimitUpdatevalue').value = pos;
$('upLimitUnit').style.visibility = "visible"; $('upLimitUnit').style.visibility = "visible";
} }
else { else {
$('uplimitUpdatevalue').value = '∞'; $('uplimitUpdatevalue').value = '∞';
$('upLimitUnit').style.visibility = "hidden"; $('upLimitUnit').style.visibility = "hidden";
} }
}.bind(this) }.bind(this)
}); });
// Set default value // Set default value
if (up_limit == 0) { if (up_limit == 0) {
$('uplimitUpdatevalue').value = '∞'; $('uplimitUpdatevalue').value = '∞';
$('upLimitUnit').style.visibility = "hidden"; $('upLimitUnit').style.visibility = "hidden";
} }
else { else {
$('uplimitUpdatevalue').value = up_limit.round(); $('uplimitUpdatevalue').value = up_limit.round();
$('upLimitUnit').style.visibility = "visible"; $('upLimitUnit').style.visibility = "visible";
} }
} }
else { else {
var req = new Request({ var req = new Request({
url: 'command/getTorrentUpLimit', url: 'command/getTorrentUpLimit',
method: 'post', method: 'post',
data: { data: {
hash: hash hash: hash
}, },
onSuccess: function(data) { onSuccess: function(data) {
if (data) { if (data) {
var up_limit = data.toInt(); var up_limit = data.toInt();
if (up_limit < 0) up_limit = 0; if (up_limit < 0) up_limit = 0;
var mochaSlide = new Slider($('uplimitSliderarea'), $('uplimitSliderknob'), { var mochaSlide = new Slider($('uplimitSliderarea'), $('uplimitSliderknob'), {
steps: maximum, steps: maximum,
offset: 0, offset: 0,
initialStep: (up_limit / 1024.).round(), initialStep: (up_limit / 1024.).round(),
onChange: function(pos) { onChange: function(pos) {
if (pos > 0) { if (pos > 0) {
$('uplimitUpdatevalue').value = pos; $('uplimitUpdatevalue').value = pos;
$('upLimitUnit').style.visibility = "visible"; $('upLimitUnit').style.visibility = "visible";
} }
else { else {
$('uplimitUpdatevalue').value = '∞'; $('uplimitUpdatevalue').value = '∞';
$('upLimitUnit').style.visibility = "hidden"; $('upLimitUnit').style.visibility = "hidden";
} }
}.bind(this) }.bind(this)
}); });
// Set default value // Set default value
if (up_limit == 0) { if (up_limit == 0) {
$('uplimitUpdatevalue').value = '∞'; $('uplimitUpdatevalue').value = '∞';
$('upLimitUnit').style.visibility = "hidden"; $('upLimitUnit').style.visibility = "hidden";
} }
else { else {
$('uplimitUpdatevalue').value = (up_limit / 1024.).round(); $('uplimitUpdatevalue').value = (up_limit / 1024.).round();
$('upLimitUnit').style.visibility = "visible"; $('upLimitUnit').style.visibility = "visible";
} }
} }
} }
}).send(); }).send();
} }
} }
}).send(); }).send();
} }
}, },
addDlLimitSlider: function(hash) { addDlLimitSlider: function(hash) {
if ($('dllimitSliderarea')) { if ($('dllimitSliderarea')) {
var windowOptions = MochaUI.Windows.windowOptions; var windowOptions = MochaUI.Windows.windowOptions;
var sliderFirst = true; var sliderFirst = true;
// Get global upload limit // Get global upload limit
var maximum = 500; var maximum = 500;
var req = new Request({ var req = new Request({
url: 'command/getGlobalDlLimit', url: 'command/getGlobalDlLimit',
method: 'post', method: 'post',
data: {}, data: {},
onSuccess: function(data) { onSuccess: function(data) {
if (data) { if (data) {
var tmp = data.toInt(); var tmp = data.toInt();
if (tmp > 0) { if (tmp > 0) {
maximum = tmp / 1024. maximum = tmp / 1024.
} }
else { else {
if (hash == "global") if (hash == "global")
maximum = 10000; maximum = 10000;
else else
maximum = 1000; maximum = 1000;
} }
} }
// Get torrent download limit // Get torrent download limit
// And create slider // And create slider
if (hash == "global") { if (hash == "global") {
var dl_limit = maximum; var dl_limit = maximum;
if (dl_limit < 0) dl_limit = 0; if (dl_limit < 0) dl_limit = 0;
maximum = 10000; maximum = 10000;
var mochaSlide = new Slider($('dllimitSliderarea'), $('dllimitSliderknob'), { var mochaSlide = new Slider($('dllimitSliderarea'), $('dllimitSliderknob'), {
steps: maximum, steps: maximum,
offset: 0, offset: 0,
initialStep: dl_limit.round(), initialStep: dl_limit.round(),
onChange: function(pos) { onChange: function(pos) {
if (pos > 0) { if (pos > 0) {
$('dllimitUpdatevalue').value = pos; $('dllimitUpdatevalue').value = pos;
$('dlLimitUnit').style.visibility = "visible"; $('dlLimitUnit').style.visibility = "visible";
} }
else { else {
$('dllimitUpdatevalue').value = '∞'; $('dllimitUpdatevalue').value = '∞';
$('dlLimitUnit').style.visibility = "hidden"; $('dlLimitUnit').style.visibility = "hidden";
} }
}.bind(this) }.bind(this)
}); });
// Set default value // Set default value
if (dl_limit == 0) { if (dl_limit == 0) {
$('dllimitUpdatevalue').value = '∞'; $('dllimitUpdatevalue').value = '∞';
$('dlLimitUnit').style.visibility = "hidden"; $('dlLimitUnit').style.visibility = "hidden";
} }
else { else {
$('dllimitUpdatevalue').value = dl_limit.round(); $('dllimitUpdatevalue').value = dl_limit.round();
$('dlLimitUnit').style.visibility = "visible"; $('dlLimitUnit').style.visibility = "visible";
} }
} }
else { else {
var req = new Request({ var req = new Request({
url: 'command/getTorrentDlLimit', url: 'command/getTorrentDlLimit',
method: 'post', method: 'post',
data: { data: {
hash: hash hash: hash
}, },
onSuccess: function(data) { onSuccess: function(data) {
if (data) { if (data) {
var dl_limit = data.toInt(); var dl_limit = data.toInt();
if (dl_limit < 0) dl_limit = 0; if (dl_limit < 0) dl_limit = 0;
var mochaSlide = new Slider($('dllimitSliderarea'), $('dllimitSliderknob'), { var mochaSlide = new Slider($('dllimitSliderarea'), $('dllimitSliderknob'), {
steps: maximum, steps: maximum,
offset: 0, offset: 0,
initialStep: (dl_limit / 1024.).round(), initialStep: (dl_limit / 1024.).round(),
onChange: function(pos) { onChange: function(pos) {
if (pos > 0) { if (pos > 0) {
$('dllimitUpdatevalue').value = pos; $('dllimitUpdatevalue').value = pos;
$('dlLimitUnit').style.visibility = "visible"; $('dlLimitUnit').style.visibility = "visible";
} }
else { else {
$('dllimitUpdatevalue').value = '∞'; $('dllimitUpdatevalue').value = '∞';
$('dlLimitUnit').style.visibility = "hidden"; $('dlLimitUnit').style.visibility = "hidden";
} }
}.bind(this) }.bind(this)
}); });
// Set default value // Set default value
if (dl_limit == 0) { if (dl_limit == 0) {
$('dllimitUpdatevalue').value = '∞'; $('dllimitUpdatevalue').value = '∞';
$('dlLimitUnit').style.visibility = "hidden"; $('dlLimitUnit').style.visibility = "hidden";
} }
else { else {
$('dllimitUpdatevalue').value = (dl_limit / 1024.).round(); $('dllimitUpdatevalue').value = (dl_limit / 1024.).round();
$('dlLimitUnit').style.visibility = "visible"; $('dlLimitUnit').style.visibility = "visible";
} }
} }
} }
}).send(); }).send();
} }
} }
}).send(); }).send();
} }
} }
}); });

View file

@ -1,61 +1,61 @@
# Adapt these paths on Windows # Adapt these paths on Windows
#Point this to the boost include folder #Point this to the boost include folder
INCLUDEPATH += $$quote(C:/qBittorrent/boost_1_51_0) INCLUDEPATH += $$quote(C:/qBittorrent/boost_1_51_0)
#Point this to the libtorrent include folder #Point this to the libtorrent include folder
INCLUDEPATH += $$quote(C:/qBittorrent/RC_0_16/include) INCLUDEPATH += $$quote(C:/qBittorrent/RC_0_16/include)
#Point this to the zlib include folder #Point this to the zlib include folder
INCLUDEPATH += $$quote(C:/qBittorrent/Zlib/include) INCLUDEPATH += $$quote(C:/qBittorrent/Zlib/include)
#Point this to the boost lib folder #Point this to the boost lib folder
LIBS += $$quote(-LC:/qBittorrent/boost_1_51_0/stage/lib) LIBS += $$quote(-LC:/qBittorrent/boost_1_51_0/stage/lib)
#Point this to the libtorrent lib folder #Point this to the libtorrent lib folder
LIBS += $$quote(-LC:/qBittorrent/RC_0_16/bin/<path-according-to-the-build-options-chosen>) LIBS += $$quote(-LC:/qBittorrent/RC_0_16/bin/<path-according-to-the-build-options-chosen>)
#Point this to the zlib lib folder #Point this to the zlib lib folder
LIBS += $$quote(-LC:/qBittorrent/Zlib/lib) LIBS += $$quote(-LC:/qBittorrent/Zlib/lib)
# LIBTORRENT DEFINES # LIBTORRENT DEFINES
DEFINES += BOOST_ALL_NO_LIB DEFINES += BOOST_ALL_NO_LIB
DEFINES += BOOST_ASIO_HASH_MAP_BUCKETS=1021 DEFINES += BOOST_ASIO_HASH_MAP_BUCKETS=1021
DEFINES += BOOST_ASIO_SEPARATE_COMPILATION DEFINES += BOOST_ASIO_SEPARATE_COMPILATION
DEFINES += BOOST_EXCEPTION_DISABLE DEFINES += BOOST_EXCEPTION_DISABLE
DEFINES += BOOST_SYSTEM_STATIC_LINK=1 DEFINES += BOOST_SYSTEM_STATIC_LINK=1
DEFINES += TORRENT_USE_OPENSSL DEFINES += TORRENT_USE_OPENSSL
DEFINES += UNICODE DEFINES += UNICODE
DEFINES += _UNICODE DEFINES += _UNICODE
DEFINES += WIN32 DEFINES += WIN32
DEFINES += _WIN32 DEFINES += _WIN32
DEFINES += WIN32_LEAN_AND_MEAN DEFINES += WIN32_LEAN_AND_MEAN
DEFINES += _WIN32_WINNT=0x0500 DEFINES += _WIN32_WINNT=0x0500
DEFINES += _WIN32_IE=0x0500 DEFINES += _WIN32_IE=0x0500
DEFINES += _CRT_SECURE_NO_DEPRECATE DEFINES += _CRT_SECURE_NO_DEPRECATE
DEFINES += _SCL_SECURE_NO_DEPRECATE DEFINES += _SCL_SECURE_NO_DEPRECATE
DEFINES += __USE_W32_SOCKETS DEFINES += __USE_W32_SOCKETS
DEFINES += _FILE_OFFSET_BITS=64 DEFINES += _FILE_OFFSET_BITS=64
DEFINES += WITH_SHIPPED_GEOIP_H DEFINES += WITH_SHIPPED_GEOIP_H
CONFIG(debug, debug|release) { CONFIG(debug, debug|release) {
DEFINES += TORRENT_DEBUG DEFINES += TORRENT_DEBUG
} else { } else {
DEFINES += NDEBUG DEFINES += NDEBUG
} }
#Enable backtrace support #Enable backtrace support
CONFIG += strace_win CONFIG += strace_win
strace_win:{ strace_win:{
DEFINES += STACKTRACE_WIN DEFINES += STACKTRACE_WIN
FORMS += stacktrace_win_dlg.ui FORMS += stacktrace_win_dlg.ui
HEADERS += stacktrace_win.h \ HEADERS += stacktrace_win.h \
stacktrace_win_dlg.h stacktrace_win_dlg.h
} }
win32-g++ { win32-g++ {
include(winconf-mingw.pri) include(winconf-mingw.pri)
} }
else { else {
include(winconf-msvc.pri) include(winconf-msvc.pri)
} }
DEFINES += WITH_GEOIP_EMBEDDED DEFINES += WITH_GEOIP_EMBEDDED
message("On Windows, GeoIP database must be embedded.") message("On Windows, GeoIP database must be embedded.")