Browse Source

Rename "options.ui" to "optionsdlg.ui"

Rename class name "options_imp" to "OptionsDialog"
Rename "options_imp.cpp" to "optionsdlg.h"
adaptive-webui-19844
Chocobo1 9 years ago
parent
commit
c85a0a41ba
  1. 6
      src/gui/CMakeLists.txt
  2. 6
      src/gui/gui.pri
  3. 4
      src/gui/mainwindow.cpp
  4. 4
      src/gui/mainwindow.h
  5. 168
      src/gui/optionsdlg.cpp
  6. 10
      src/gui/optionsdlg.h
  7. 0
      src/gui/optionsdlg.ui
  8. 2
      src/gui/transferlistwidget.cpp

6
src/gui/CMakeLists.txt

@ -43,7 +43,7 @@ ico.h
loglistwidget.h loglistwidget.h
mainwindow.h mainwindow.h
messageboxraised.h messageboxraised.h
options_imp.h optionsdlg.h
previewlistdelegate.h previewlistdelegate.h
previewselect.h previewselect.h
scanfoldersdelegate.h scanfoldersdelegate.h
@ -79,7 +79,7 @@ ico.cpp
loglistwidget.cpp loglistwidget.cpp
mainwindow.cpp mainwindow.cpp
messageboxraised.cpp messageboxraised.cpp
options_imp.cpp optionsdlg.cpp
previewselect.cpp previewselect.cpp
scanfoldersdelegate.cpp scanfoldersdelegate.cpp
shutdownconfirmdlg.cpp shutdownconfirmdlg.cpp
@ -121,7 +121,7 @@ executionlog.ui
addnewtorrentdialog.ui addnewtorrentdialog.ui
autoexpandabledialog.ui autoexpandabledialog.ui
statsdialog.ui statsdialog.ui
options.ui optionsdlg.ui
torrentcreatordlg.ui torrentcreatordlg.ui
shutdownconfirmdlg.ui shutdownconfirmdlg.ui
) )

6
src/gui/gui.pri

@ -36,7 +36,7 @@ HEADERS += \
$$PWD/autoexpandabledialog.h \ $$PWD/autoexpandabledialog.h \
$$PWD/statsdialog.h \ $$PWD/statsdialog.h \
$$PWD/messageboxraised.h \ $$PWD/messageboxraised.h \
$$PWD/options_imp.h \ $$PWD/optionsdlg.h \
$$PWD/advancedsettings.h \ $$PWD/advancedsettings.h \
$$PWD/shutdownconfirmdlg.h \ $$PWD/shutdownconfirmdlg.h \
$$PWD/torrentmodel.h \ $$PWD/torrentmodel.h \
@ -77,7 +77,7 @@ SOURCES += \
$$PWD/statusbar.cpp \ $$PWD/statusbar.cpp \
$$PWD/advancedsettings.cpp \ $$PWD/advancedsettings.cpp \
$$PWD/trackerlogin.cpp \ $$PWD/trackerlogin.cpp \
$$PWD/options_imp.cpp \ $$PWD/optionsdlg.cpp \
$$PWD/shutdownconfirmdlg.cpp \ $$PWD/shutdownconfirmdlg.cpp \
$$PWD/torrentmodel.cpp \ $$PWD/torrentmodel.cpp \
$$PWD/torrentcreatordlg.cpp \ $$PWD/torrentcreatordlg.cpp \
@ -110,7 +110,7 @@ FORMS += \
$$PWD/addnewtorrentdialog.ui \ $$PWD/addnewtorrentdialog.ui \
$$PWD/autoexpandabledialog.ui \ $$PWD/autoexpandabledialog.ui \
$$PWD/statsdialog.ui \ $$PWD/statsdialog.ui \
$$PWD/options.ui \ $$PWD/optionsdlg.ui \
$$PWD/torrentcreatordlg.ui \ $$PWD/torrentcreatordlg.ui \
$$PWD/search/searchwidget.ui \ $$PWD/search/searchwidget.ui \
$$PWD/search/pluginselectdlg.ui \ $$PWD/search/pluginselectdlg.ui \

4
src/gui/mainwindow.cpp

@ -84,7 +84,7 @@
#include "statusbar.h" #include "statusbar.h"
#include "rss_imp.h" #include "rss_imp.h"
#include "about_imp.h" #include "about_imp.h"
#include "options_imp.h" #include "optionsdlg.h"
#include "trackerlogin.h" #include "trackerlogin.h"
#include "lineedit.h" #include "lineedit.h"
#include "executionlog.h" #include "executionlog.h"
@ -1452,7 +1452,7 @@ void MainWindow::on_actionOptions_triggered()
if (m_options) if (m_options)
m_options->setFocus(); m_options->setFocus();
else else
m_options = new options_imp(this); m_options = new OptionsDialog(this);
} }
void MainWindow::on_actionTopToolBar_triggered() void MainWindow::on_actionTopToolBar_triggered()

4
src/gui/mainwindow.h

@ -46,7 +46,7 @@ class downloadFromURL;
class SearchWidget; class SearchWidget;
class RSSImp; class RSSImp;
class about; class about;
class options_imp; class OptionsDialog;
class TransferListWidget; class TransferListWidget;
class TransferListFiltersWidget; class TransferListFiltersWidget;
class PropertiesWidget; class PropertiesWidget;
@ -208,7 +208,7 @@ private:
bool m_posInitialized; bool m_posInitialized;
QTabWidget *m_tabs; QTabWidget *m_tabs;
StatusBar *m_statusBar; StatusBar *m_statusBar;
QPointer<options_imp> m_options; QPointer<OptionsDialog> m_options;
QPointer<about> m_aboutDlg; QPointer<about> m_aboutDlg;
QPointer<StatsDialog> m_statsDlg; QPointer<StatsDialog> m_statsDlg;
QPointer<TorrentCreatorDlg> m_createTorrentDlg; QPointer<TorrentCreatorDlg> m_createTorrentDlg;

168
src/gui/options_imp.cpp → src/gui/optionsdlg.cpp

@ -28,7 +28,7 @@
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */
#include "options_imp.h" #include "optionsdlg.h"
#include <cstdlib> #include <cstdlib>
@ -61,10 +61,10 @@
#include "guiiconprovider.h" #include "guiiconprovider.h"
#include "scanfoldersdelegate.h" #include "scanfoldersdelegate.h"
#include "ui_options.h" #include "ui_optionsdlg.h"
// Constructor // Constructor
options_imp::options_imp(QWidget *parent) OptionsDialog::OptionsDialog(QWidget *parent)
: QDialog(parent) : QDialog(parent)
, m_refreshingIpFilter(false) , m_refreshingIpFilter(false)
, m_ui(new Ui::OptionsDialog) , m_ui(new Ui::OptionsDialog)
@ -344,7 +344,7 @@ options_imp::options_imp(QWidget *parent)
loadWindowState(); loadWindowState();
} }
void options_imp::initializeLanguageCombo() void OptionsDialog::initializeLanguageCombo()
{ {
// List language files // List language files
const QDir langDir(":/lang"); const QDir langDir(":/lang");
@ -367,7 +367,7 @@ void options_imp::initializeLanguageCombo()
} }
// Main destructor // Main destructor
options_imp::~options_imp() OptionsDialog::~OptionsDialog()
{ {
qDebug("-> destructing Options"); qDebug("-> destructing Options");
foreach (const QString &path, addedScanDirs) foreach (const QString &path, addedScanDirs)
@ -376,14 +376,14 @@ options_imp::~options_imp()
delete m_ui; delete m_ui;
} }
void options_imp::changePage(QListWidgetItem *current, QListWidgetItem *previous) void OptionsDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
{ {
if (!current) if (!current)
current = previous; current = previous;
m_ui->tabOption->setCurrentIndex(m_ui->tabSelection->row(current)); m_ui->tabOption->setCurrentIndex(m_ui->tabSelection->row(current));
} }
void options_imp::loadWindowState() void OptionsDialog::loadWindowState()
{ {
const Preferences* const pref = Preferences::instance(); const Preferences* const pref = Preferences::instance();
resize(pref->getPrefSize(sizeFittingScreen())); resize(pref->getPrefSize(sizeFittingScreen()));
@ -406,7 +406,7 @@ void options_imp::loadWindowState()
m_ui->hsplitter->setSizes(sizes); m_ui->hsplitter->setSizes(sizes);
} }
void options_imp::saveWindowState() const void OptionsDialog::saveWindowState() const
{ {
Preferences* const pref = Preferences::instance(); Preferences* const pref = Preferences::instance();
pref->setPrefSize(size()); pref->setPrefSize(size());
@ -418,7 +418,7 @@ void options_imp::saveWindowState() const
pref->setPrefHSplitterSizes(sizes_str); pref->setPrefHSplitterSizes(sizes_str);
} }
QSize options_imp::sizeFittingScreen() const QSize OptionsDialog::sizeFittingScreen() const
{ {
int scrn = 0; int scrn = 0;
QWidget *w = this->topLevelWidget(); QWidget *w = this->topLevelWidget();
@ -437,7 +437,7 @@ QSize options_imp::sizeFittingScreen() const
return size(); return size();
} }
void options_imp::saveOptions() void OptionsDialog::saveOptions()
{ {
applyButton->setEnabled(false); applyButton->setEnabled(false);
Preferences* const pref = Preferences::instance(); Preferences* const pref = Preferences::instance();
@ -620,12 +620,12 @@ void options_imp::saveOptions()
pref->apply(); pref->apply();
} }
bool options_imp::isFilteringEnabled() const bool OptionsDialog::isFilteringEnabled() const
{ {
return m_ui->checkIPFilter->isChecked(); return m_ui->checkIPFilter->isChecked();
} }
int options_imp::getProxyType() const int OptionsDialog::getProxyType() const
{ {
switch (m_ui->comboProxyType->currentIndex()) { switch (m_ui->comboProxyType->currentIndex()) {
case 1: case 1:
@ -644,7 +644,7 @@ int options_imp::getProxyType() const
} }
} }
void options_imp::loadOptions() void OptionsDialog::loadOptions()
{ {
int intValue; int intValue;
qreal floatValue; qreal floatValue;
@ -977,72 +977,72 @@ void options_imp::loadOptions()
// return min & max ports // return min & max ports
// [min, max] // [min, max]
int options_imp::getPort() const int OptionsDialog::getPort() const
{ {
return m_ui->spinPort->value(); return m_ui->spinPort->value();
} }
void options_imp::on_randomButton_clicked() void OptionsDialog::on_randomButton_clicked()
{ {
// Range [1024: 65535] // Range [1024: 65535]
m_ui->spinPort->setValue(rand() % 64512 + 1024); m_ui->spinPort->setValue(rand() % 64512 + 1024);
} }
int options_imp::getEncryptionSetting() const int OptionsDialog::getEncryptionSetting() const
{ {
return m_ui->comboEncryption->currentIndex(); return m_ui->comboEncryption->currentIndex();
} }
int options_imp::getMaxActiveDownloads() const int OptionsDialog::getMaxActiveDownloads() const
{ {
return m_ui->spinMaxActiveDownloads->value(); return m_ui->spinMaxActiveDownloads->value();
} }
int options_imp::getMaxActiveUploads() const int OptionsDialog::getMaxActiveUploads() const
{ {
return m_ui->spinMaxActiveUploads->value(); return m_ui->spinMaxActiveUploads->value();
} }
int options_imp::getMaxActiveTorrents() const int OptionsDialog::getMaxActiveTorrents() const
{ {
return m_ui->spinMaxActiveTorrents->value(); return m_ui->spinMaxActiveTorrents->value();
} }
bool options_imp::minimizeToTray() const bool OptionsDialog::minimizeToTray() const
{ {
if (!m_ui->checkShowSystray->isChecked()) return false; if (!m_ui->checkShowSystray->isChecked()) return false;
return m_ui->checkMinimizeToSysTray->isChecked(); return m_ui->checkMinimizeToSysTray->isChecked();
} }
bool options_imp::closeToTray() const bool OptionsDialog::closeToTray() const
{ {
if (!m_ui->checkShowSystray->isChecked()) return false; if (!m_ui->checkShowSystray->isChecked()) return false;
return m_ui->checkCloseToSystray->isChecked(); return m_ui->checkCloseToSystray->isChecked();
} }
bool options_imp::isQueueingSystemEnabled() const bool OptionsDialog::isQueueingSystemEnabled() const
{ {
return m_ui->checkEnableQueueing->isChecked(); return m_ui->checkEnableQueueing->isChecked();
} }
bool options_imp::isDHTEnabled() const bool OptionsDialog::isDHTEnabled() const
{ {
return m_ui->checkDHT->isChecked(); return m_ui->checkDHT->isChecked();
} }
bool options_imp::isLSDEnabled() const bool OptionsDialog::isLSDEnabled() const
{ {
return m_ui->checkLSD->isChecked(); return m_ui->checkLSD->isChecked();
} }
bool options_imp::isUPnPEnabled() const bool OptionsDialog::isUPnPEnabled() const
{ {
return m_ui->checkUPnP->isChecked(); return m_ui->checkUPnP->isChecked();
} }
// Return Download & Upload limits in kbps // Return Download & Upload limits in kbps
// [download,upload] // [download,upload]
QPair<int, int> options_imp::getGlobalBandwidthLimits() const QPair<int, int> OptionsDialog::getGlobalBandwidthLimits() const
{ {
int DL = -1, UP = -1; int DL = -1, UP = -1;
if (m_ui->checkDownloadLimit->isChecked()) if (m_ui->checkDownloadLimit->isChecked())
@ -1054,7 +1054,7 @@ QPair<int, int> options_imp::getGlobalBandwidthLimits() const
// Return alternate Download & Upload limits in kbps // Return alternate Download & Upload limits in kbps
// [download,upload] // [download,upload]
QPair<int, int> options_imp::getAltGlobalBandwidthLimits() const QPair<int, int> OptionsDialog::getAltGlobalBandwidthLimits() const
{ {
int DL = -1, UP = -1; int DL = -1, UP = -1;
if (m_ui->checkDownloadLimitAlt->isChecked()) if (m_ui->checkDownloadLimitAlt->isChecked())
@ -1064,19 +1064,19 @@ QPair<int, int> options_imp::getAltGlobalBandwidthLimits() const
return qMakePair(DL, UP); return qMakePair(DL, UP);
} }
bool options_imp::startMinimized() const bool OptionsDialog::startMinimized() const
{ {
return m_ui->checkStartMinimized->isChecked(); return m_ui->checkStartMinimized->isChecked();
} }
bool options_imp::systrayIntegration() const bool OptionsDialog::systrayIntegration() const
{ {
if (!QSystemTrayIcon::isSystemTrayAvailable()) return false; if (!QSystemTrayIcon::isSystemTrayAvailable()) return false;
return m_ui->checkShowSystray->isChecked(); return m_ui->checkShowSystray->isChecked();
} }
// Return Share ratio // Return Share ratio
qreal options_imp::getMaxRatio() const qreal OptionsDialog::getMaxRatio() const
{ {
if (m_ui->checkMaxRatio->isChecked()) if (m_ui->checkMaxRatio->isChecked())
return m_ui->spinMaxRatio->value(); return m_ui->spinMaxRatio->value();
@ -1084,7 +1084,7 @@ qreal options_imp::getMaxRatio() const
} }
// Return max connections number // Return max connections number
int options_imp::getMaxConnecs() const int OptionsDialog::getMaxConnecs() const
{ {
if (!m_ui->checkMaxConnecs->isChecked()) if (!m_ui->checkMaxConnecs->isChecked())
return -1; return -1;
@ -1092,7 +1092,7 @@ int options_imp::getMaxConnecs() const
return m_ui->spinMaxConnec->value(); return m_ui->spinMaxConnec->value();
} }
int options_imp::getMaxConnecsPerTorrent() const int OptionsDialog::getMaxConnecsPerTorrent() const
{ {
if (!m_ui->checkMaxConnecsPerTorrent->isChecked()) if (!m_ui->checkMaxConnecsPerTorrent->isChecked())
return -1; return -1;
@ -1100,7 +1100,7 @@ int options_imp::getMaxConnecsPerTorrent() const
return m_ui->spinMaxConnecPerTorrent->value(); return m_ui->spinMaxConnecPerTorrent->value();
} }
int options_imp::getMaxUploads() const int OptionsDialog::getMaxUploads() const
{ {
if (!m_ui->checkMaxUploads->isChecked()) if (!m_ui->checkMaxUploads->isChecked())
return -1; return -1;
@ -1108,7 +1108,7 @@ int options_imp::getMaxUploads() const
return m_ui->spinMaxUploads->value(); return m_ui->spinMaxUploads->value();
} }
int options_imp::getMaxUploadsPerTorrent() const int OptionsDialog::getMaxUploadsPerTorrent() const
{ {
if (!m_ui->checkMaxUploadsPerTorrent->isChecked()) if (!m_ui->checkMaxUploadsPerTorrent->isChecked())
return -1; return -1;
@ -1116,7 +1116,7 @@ int options_imp::getMaxUploadsPerTorrent() const
return m_ui->spinMaxUploadsPerTorrent->value(); return m_ui->spinMaxUploadsPerTorrent->value();
} }
void options_imp::on_buttonBox_accepted() void OptionsDialog::on_buttonBox_accepted()
{ {
if (applyButton->isEnabled()) { if (applyButton->isEnabled()) {
if (!schedTimesOk()) { if (!schedTimesOk()) {
@ -1135,7 +1135,7 @@ void options_imp::on_buttonBox_accepted()
accept(); accept();
} }
void options_imp::applySettings(QAbstractButton* button) void OptionsDialog::applySettings(QAbstractButton* button)
{ {
if (button == applyButton) { if (button == applyButton) {
if (!schedTimesOk()) { if (!schedTimesOk()) {
@ -1150,29 +1150,29 @@ void options_imp::applySettings(QAbstractButton* button)
} }
} }
void options_imp::closeEvent(QCloseEvent *e) void OptionsDialog::closeEvent(QCloseEvent *e)
{ {
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
e->accept(); e->accept();
} }
void options_imp::on_buttonBox_rejected() void OptionsDialog::on_buttonBox_rejected()
{ {
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
reject(); reject();
} }
bool options_imp::useAdditionDialog() const bool OptionsDialog::useAdditionDialog() const
{ {
return m_ui->checkAdditionDialog->isChecked(); return m_ui->checkAdditionDialog->isChecked();
} }
void options_imp::enableApplyButton() void OptionsDialog::enableApplyButton()
{ {
applyButton->setEnabled(true); applyButton->setEnabled(true);
} }
void options_imp::enableProxy(int index) void OptionsDialog::enableProxy(int index)
{ {
if (index) { if (index) {
//enable //enable
@ -1205,61 +1205,61 @@ void options_imp::enableProxy(int index)
} }
} }
bool options_imp::isSlashScreenDisabled() const bool OptionsDialog::isSlashScreenDisabled() const
{ {
return !m_ui->checkShowSplash->isChecked(); return !m_ui->checkShowSplash->isChecked();
} }
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
bool options_imp::WinStartup() const bool OptionsDialog::WinStartup() const
{ {
return m_ui->checkStartup->isChecked(); return m_ui->checkStartup->isChecked();
} }
#endif #endif
bool options_imp::preventFromSuspend() const bool OptionsDialog::preventFromSuspend() const
{ {
return m_ui->checkPreventFromSuspend->isChecked(); return m_ui->checkPreventFromSuspend->isChecked();
} }
bool options_imp::preAllocateAllFiles() const bool OptionsDialog::preAllocateAllFiles() const
{ {
return m_ui->checkPreallocateAll->isChecked(); return m_ui->checkPreallocateAll->isChecked();
} }
bool options_imp::addTorrentsInPause() const bool OptionsDialog::addTorrentsInPause() const
{ {
return m_ui->checkStartPaused->isChecked(); return m_ui->checkStartPaused->isChecked();
} }
// Proxy settings // Proxy settings
bool options_imp::isProxyEnabled() const bool OptionsDialog::isProxyEnabled() const
{ {
return m_ui->comboProxyType->currentIndex(); return m_ui->comboProxyType->currentIndex();
} }
bool options_imp::isProxyAuthEnabled() const bool OptionsDialog::isProxyAuthEnabled() const
{ {
return m_ui->checkProxyAuth->isChecked(); return m_ui->checkProxyAuth->isChecked();
} }
QString options_imp::getProxyIp() const QString OptionsDialog::getProxyIp() const
{ {
return m_ui->textProxyIP->text().trimmed(); return m_ui->textProxyIP->text().trimmed();
} }
unsigned short options_imp::getProxyPort() const unsigned short OptionsDialog::getProxyPort() const
{ {
return m_ui->spinProxyPort->value(); return m_ui->spinProxyPort->value();
} }
QString options_imp::getProxyUsername() const QString OptionsDialog::getProxyUsername() const
{ {
QString username = m_ui->textProxyUsername->text().trimmed(); QString username = m_ui->textProxyUsername->text().trimmed();
return username; return username;
} }
QString options_imp::getProxyPassword() const QString OptionsDialog::getProxyPassword() const
{ {
QString password = m_ui->textProxyPassword->text(); QString password = m_ui->textProxyPassword->text();
password = password.trimmed(); password = password.trimmed();
@ -1267,12 +1267,12 @@ QString options_imp::getProxyPassword() const
} }
// Locale Settings // Locale Settings
QString options_imp::getLocale() const QString OptionsDialog::getLocale() const
{ {
return m_ui->comboI18n->itemData(m_ui->comboI18n->currentIndex(), Qt::UserRole).toString(); return m_ui->comboI18n->itemData(m_ui->comboI18n->currentIndex(), Qt::UserRole).toString();
} }
void options_imp::setLocale(const QString &localeStr) void OptionsDialog::setLocale(const QString &localeStr)
{ {
QString name; QString name;
if (localeStr.startsWith("eo", Qt::CaseInsensitive)) { if (localeStr.startsWith("eo", Qt::CaseInsensitive)) {
@ -1300,14 +1300,14 @@ void options_imp::setLocale(const QString &localeStr)
m_ui->comboI18n->setCurrentIndex(index); m_ui->comboI18n->setCurrentIndex(index);
} }
QString options_imp::getTorrentExportDir() const QString OptionsDialog::getTorrentExportDir() const
{ {
if (m_ui->checkExportDir->isChecked()) if (m_ui->checkExportDir->isChecked())
return Utils::Fs::expandPathAbs(m_ui->textExportDir->text()); return Utils::Fs::expandPathAbs(m_ui->textExportDir->text());
return QString(); return QString();
} }
QString options_imp::getFinishedTorrentExportDir() const QString OptionsDialog::getFinishedTorrentExportDir() const
{ {
if (m_ui->checkExportDirFin->isChecked()) if (m_ui->checkExportDirFin->isChecked())
return Utils::Fs::expandPathAbs(m_ui->textExportDirFin->text()); return Utils::Fs::expandPathAbs(m_ui->textExportDirFin->text());
@ -1315,7 +1315,7 @@ QString options_imp::getFinishedTorrentExportDir() const
} }
// Return action on double-click on a downloading torrent set in options // Return action on double-click on a downloading torrent set in options
int options_imp::getActionOnDblClOnTorrentDl() const int OptionsDialog::getActionOnDblClOnTorrentDl() const
{ {
if (m_ui->actionTorrentDlOnDblClBox->currentIndex() < 1) if (m_ui->actionTorrentDlOnDblClBox->currentIndex() < 1)
return 0; return 0;
@ -1323,14 +1323,14 @@ int options_imp::getActionOnDblClOnTorrentDl() const
} }
// Return action on double-click on a finished torrent set in options // Return action on double-click on a finished torrent set in options
int options_imp::getActionOnDblClOnTorrentFn() const int OptionsDialog::getActionOnDblClOnTorrentFn() const
{ {
if (m_ui->actionTorrentFnOnDblClBox->currentIndex() < 1) if (m_ui->actionTorrentFnOnDblClBox->currentIndex() < 1)
return 0; return 0;
return m_ui->actionTorrentFnOnDblClBox->currentIndex(); return m_ui->actionTorrentFnOnDblClBox->currentIndex();
} }
void options_imp::on_addScanFolderButton_clicked() void OptionsDialog::on_addScanFolderButton_clicked()
{ {
Preferences* const pref = Preferences::instance(); Preferences* const pref = Preferences::instance();
const QString dir = QFileDialog::getExistingDirectory(this, tr("Select folder to monitor"), const QString dir = QFileDialog::getExistingDirectory(this, tr("Select folder to monitor"),
@ -1361,7 +1361,7 @@ void options_imp::on_addScanFolderButton_clicked()
} }
} }
void options_imp::on_removeScanFolderButton_clicked() void OptionsDialog::on_removeScanFolderButton_clicked()
{ {
const QModelIndexList selected const QModelIndexList selected
= m_ui->scanFoldersView->selectionModel()->selectedIndexes(); = m_ui->scanFoldersView->selectionModel()->selectedIndexes();
@ -1375,12 +1375,12 @@ void options_imp::on_removeScanFolderButton_clicked()
ScanFoldersModel::instance()->removePath(selected.first().row(), false); ScanFoldersModel::instance()->removePath(selected.first().row(), false);
} }
void options_imp::handleScanFolderViewSelectionChanged() void OptionsDialog::handleScanFolderViewSelectionChanged()
{ {
m_ui->removeScanFolderButton->setEnabled(!m_ui->scanFoldersView->selectionModel()->selectedIndexes().isEmpty()); m_ui->removeScanFolderButton->setEnabled(!m_ui->scanFoldersView->selectionModel()->selectedIndexes().isEmpty());
} }
QString options_imp::askForExportDir(const QString& currentExportPath) QString OptionsDialog::askForExportDir(const QString& currentExportPath)
{ {
QDir currentExportDir(Utils::Fs::expandPathAbs(currentExportPath)); QDir currentExportDir(Utils::Fs::expandPathAbs(currentExportPath));
QString dir; QString dir;
@ -1391,7 +1391,7 @@ QString options_imp::askForExportDir(const QString& currentExportPath)
return dir; return dir;
} }
void options_imp::on_browseFileLogDir_clicked() void OptionsDialog::on_browseFileLogDir_clicked()
{ {
const QString path = Utils::Fs::expandPathAbs(Utils::Fs::fromNativePath(m_ui->textFileLogPath->text())); const QString path = Utils::Fs::expandPathAbs(Utils::Fs::fromNativePath(m_ui->textFileLogPath->text()));
QDir pathDir(path); QDir pathDir(path);
@ -1404,21 +1404,21 @@ void options_imp::on_browseFileLogDir_clicked()
m_ui->textFileLogPath->setText(Utils::Fs::toNativePath(dir)); m_ui->textFileLogPath->setText(Utils::Fs::toNativePath(dir));
} }
void options_imp::on_browseExportDirButton_clicked() void OptionsDialog::on_browseExportDirButton_clicked()
{ {
const QString newExportDir = askForExportDir(m_ui->textExportDir->text()); const QString newExportDir = askForExportDir(m_ui->textExportDir->text());
if (!newExportDir.isNull()) if (!newExportDir.isNull())
m_ui->textExportDir->setText(Utils::Fs::toNativePath(newExportDir)); m_ui->textExportDir->setText(Utils::Fs::toNativePath(newExportDir));
} }
void options_imp::on_browseExportDirFinButton_clicked() void OptionsDialog::on_browseExportDirFinButton_clicked()
{ {
const QString newExportDir = askForExportDir(m_ui->textExportDirFin->text()); const QString newExportDir = askForExportDir(m_ui->textExportDirFin->text());
if (!newExportDir.isNull()) if (!newExportDir.isNull())
m_ui->textExportDirFin->setText(Utils::Fs::toNativePath(newExportDir)); m_ui->textExportDirFin->setText(Utils::Fs::toNativePath(newExportDir));
} }
void options_imp::on_browseFilterButton_clicked() void OptionsDialog::on_browseFilterButton_clicked()
{ {
const QString filter_path = Utils::Fs::expandPathAbs(m_ui->textFilterPath->text()); const QString filter_path = Utils::Fs::expandPathAbs(m_ui->textFilterPath->text());
QDir filterDir(filter_path); QDir filterDir(filter_path);
@ -1432,7 +1432,7 @@ void options_imp::on_browseFilterButton_clicked()
} }
// Display dialog to choose save dir // Display dialog to choose save dir
void options_imp::on_browseSaveDirButton_clicked() void OptionsDialog::on_browseSaveDirButton_clicked()
{ {
const QString save_path = Utils::Fs::expandPathAbs(m_ui->textSavePath->text()); const QString save_path = Utils::Fs::expandPathAbs(m_ui->textSavePath->text());
QDir saveDir(save_path); QDir saveDir(save_path);
@ -1445,7 +1445,7 @@ void options_imp::on_browseSaveDirButton_clicked()
m_ui->textSavePath->setText(Utils::Fs::toNativePath(dir)); m_ui->textSavePath->setText(Utils::Fs::toNativePath(dir));
} }
void options_imp::on_browseTempDirButton_clicked() void OptionsDialog::on_browseTempDirButton_clicked()
{ {
const QString temp_path = Utils::Fs::expandPathAbs(m_ui->textTempPath->text()); const QString temp_path = Utils::Fs::expandPathAbs(m_ui->textTempPath->text());
QDir tempDir(temp_path); QDir tempDir(temp_path);
@ -1459,39 +1459,39 @@ void options_imp::on_browseTempDirButton_clicked()
} }
// Return Filter object to apply to BT session // Return Filter object to apply to BT session
QString options_imp::getFilter() const QString OptionsDialog::getFilter() const
{ {
return Utils::Fs::fromNativePath(m_ui->textFilterPath->text()); return Utils::Fs::fromNativePath(m_ui->textFilterPath->text());
} }
// Web UI // Web UI
bool options_imp::isWebUiEnabled() const bool OptionsDialog::isWebUiEnabled() const
{ {
return m_ui->checkWebUi->isChecked(); return m_ui->checkWebUi->isChecked();
} }
quint16 options_imp::webUiPort() const quint16 OptionsDialog::webUiPort() const
{ {
return m_ui->spinWebUiPort->value(); return m_ui->spinWebUiPort->value();
} }
QString options_imp::webUiUsername() const QString OptionsDialog::webUiUsername() const
{ {
return m_ui->textWebUiUsername->text(); return m_ui->textWebUiUsername->text();
} }
QString options_imp::webUiPassword() const QString OptionsDialog::webUiPassword() const
{ {
return m_ui->textWebUiPassword->text(); return m_ui->textWebUiPassword->text();
} }
void options_imp::showConnectionTab() void OptionsDialog::showConnectionTab()
{ {
m_ui->tabSelection->setCurrentRow(TAB_CONNECTION); m_ui->tabSelection->setCurrentRow(TAB_CONNECTION);
} }
void options_imp::on_btnWebUiCrt_clicked() void OptionsDialog::on_btnWebUiCrt_clicked()
{ {
QString filename = QFileDialog::getOpenFileName(this, QString(), QString(), tr("SSL Certificate") + QString(" (*.crt *.pem)")); QString filename = QFileDialog::getOpenFileName(this, QString(), QString(), tr("SSL Certificate") + QString(" (*.crt *.pem)"));
if (filename.isNull()) if (filename.isNull())
@ -1503,7 +1503,7 @@ void options_imp::on_btnWebUiCrt_clicked()
} }
} }
void options_imp::on_btnWebUiKey_clicked() void OptionsDialog::on_btnWebUiKey_clicked()
{ {
QString filename = QFileDialog::getOpenFileName(this, QString(), QString(), tr("SSL Key") + QString(" (*.key *.pem)")); QString filename = QFileDialog::getOpenFileName(this, QString(), QString(), tr("SSL Key") + QString(" (*.key *.pem)"));
if (filename.isNull()) if (filename.isNull())
@ -1515,12 +1515,12 @@ void options_imp::on_btnWebUiKey_clicked()
} }
} }
void options_imp::on_registerDNSBtn_clicked() void OptionsDialog::on_registerDNSBtn_clicked()
{ {
QDesktopServices::openUrl(Net::DNSUpdater::getRegistrationUrl(m_ui->comboDNSService->currentIndex())); QDesktopServices::openUrl(Net::DNSUpdater::getRegistrationUrl(m_ui->comboDNSService->currentIndex()));
} }
void options_imp::on_IpFilterRefreshBtn_clicked() void OptionsDialog::on_IpFilterRefreshBtn_clicked()
{ {
if (m_refreshingIpFilter) return; if (m_refreshingIpFilter) return;
m_refreshingIpFilter = true; m_refreshingIpFilter = true;
@ -1534,7 +1534,7 @@ void options_imp::on_IpFilterRefreshBtn_clicked()
BitTorrent::Session::instance()->enableIPFilter(getFilter(), true); BitTorrent::Session::instance()->enableIPFilter(getFilter(), true);
} }
void options_imp::handleIPFilterParsed(bool error, int ruleCount) void OptionsDialog::handleIPFilterParsed(bool error, int ruleCount)
{ {
setCursor(QCursor(Qt::ArrowCursor)); setCursor(QCursor(Qt::ArrowCursor));
if (error) if (error)
@ -1545,7 +1545,7 @@ void options_imp::handleIPFilterParsed(bool error, int ruleCount)
disconnect(BitTorrent::Session::instance(), SIGNAL(ipFilterParsed(bool, int)), this, SLOT(handleIPFilterParsed(bool, int))); disconnect(BitTorrent::Session::instance(), SIGNAL(ipFilterParsed(bool, int)), this, SLOT(handleIPFilterParsed(bool, int)));
} }
QString options_imp::languageToLocalizedString(const QLocale &locale) QString OptionsDialog::languageToLocalizedString(const QLocale &locale)
{ {
switch (locale.language()) { switch (locale.language()) {
case QLocale::English: { case QLocale::English: {
@ -1616,7 +1616,7 @@ QString options_imp::languageToLocalizedString(const QLocale &locale)
} }
} }
void options_imp::setSslKey(const QByteArray &key, bool interactive) void OptionsDialog::setSslKey(const QByteArray &key, bool interactive)
{ {
#ifndef QT_NO_OPENSSL #ifndef QT_NO_OPENSSL
if (!key.isEmpty() && !QSslKey(key, QSsl::Rsa).isNull()) { if (!key.isEmpty() && !QSslKey(key, QSsl::Rsa).isNull()) {
@ -1632,7 +1632,7 @@ void options_imp::setSslKey(const QByteArray &key, bool interactive)
#endif #endif
} }
void options_imp::setSslCertificate(const QByteArray &cert, bool interactive) void OptionsDialog::setSslCertificate(const QByteArray &cert, bool interactive)
{ {
#ifndef QT_NO_OPENSSL #ifndef QT_NO_OPENSSL
if (!cert.isEmpty() && !QSslCertificate(cert).isNull()) { if (!cert.isEmpty() && !QSslCertificate(cert).isNull()) {
@ -1648,7 +1648,7 @@ void options_imp::setSslCertificate(const QByteArray &cert, bool interactive)
#endif #endif
} }
bool options_imp::schedTimesOk() bool OptionsDialog::schedTimesOk()
{ {
if (m_ui->schedule_from->time() == m_ui->schedule_to->time()) { if (m_ui->schedule_from->time() == m_ui->schedule_to->time()) {
QMessageBox::warning(this, tr("Time Error"), tr("The start time and the end time can't be the same.")); QMessageBox::warning(this, tr("Time Error"), tr("The start time and the end time can't be the same."));
@ -1657,7 +1657,7 @@ bool options_imp::schedTimesOk()
return true; return true;
} }
bool options_imp::webUIAuthenticationOk() bool OptionsDialog::webUIAuthenticationOk()
{ {
if (webUiUsername().length() < 3) { if (webUiUsername().length() < 3) {
QMessageBox::warning(this, tr("Length Error"), tr("The Web UI username must be at least 3 characters long.")); QMessageBox::warning(this, tr("Length Error"), tr("The Web UI username must be at least 3 characters long."));

10
src/gui/options_imp.h → src/gui/optionsdlg.h

@ -28,8 +28,8 @@
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */
#ifndef OPTIONS_IMP_H #ifndef OPTIONSDLG_H
#define OPTIONS_IMP_H #define OPTIONSDLG_H
#include <QButtonGroup> #include <QButtonGroup>
#include <QDialog> #include <QDialog>
@ -52,7 +52,7 @@ namespace Ui
class OptionsDialog; class OptionsDialog;
} }
class options_imp: public QDialog class OptionsDialog: public QDialog
{ {
Q_OBJECT Q_OBJECT
private: private:
@ -69,8 +69,8 @@ private:
public: public:
// Constructor / Destructor // Constructor / Destructor
options_imp(QWidget *parent = 0); OptionsDialog(QWidget *parent = 0);
~options_imp(); ~OptionsDialog();
public slots: public slots:
void showConnectionTab(); void showConnectionTab();

0
src/gui/options.ui → src/gui/optionsdlg.ui

2
src/gui/transferlistwidget.cpp

@ -52,7 +52,7 @@
#include "previewselect.h" #include "previewselect.h"
#include "speedlimitdlg.h" #include "speedlimitdlg.h"
#include "updownratiodlg.h" #include "updownratiodlg.h"
#include "options_imp.h" #include "optionsdlg.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "base/preferences.h" #include "base/preferences.h"
#include "torrentmodel.h" #include "torrentmodel.h"

Loading…
Cancel
Save