diff --git a/Changelog b/Changelog index d061cc54d..9e6b5d827 100644 --- a/Changelog +++ b/Changelog @@ -10,6 +10,7 @@ - FEATURE: Improved a lot the torrent creation module - FEATURE: Allow to set upload/download limit per torrent (right click) - FEATURE: Ask for exit confirmation only if download list is not empty + - FEATURE: Better systems integration (buttons, dialogs...) - BUGFIX: Window can now stay maximized on exit - COSMETIC: Redesigned torrent properties a little - COSMETIC: Redesigned options a little diff --git a/TODO b/TODO index 74b247409..2d6ef8101 100644 --- a/TODO +++ b/TODO @@ -47,4 +47,5 @@ - Improve ratio display / calculation / saving / per torrent... - Use buttonboxes when possible - Display the sum of the size of the selected files in the torrent instead of the whole torrent size in download list -- Sorting in Download Status column should be smarter than just an alphabetical sort \ No newline at end of file +- Sorting in Download Status column should be smarter than just an alphabetical sort +- remove ETA from finished list \ No newline at end of file diff --git a/src/options.ui b/src/options.ui index 4a1b59bb8..48a8784dd 100644 --- a/src/options.ui +++ b/src/options.ui @@ -62,7 +62,7 @@ QTabWidget::Rounded - 1 + 0 @@ -1640,55 +1640,18 @@ 6 - + Qt::Horizontal - - - 81 - 31 - - - - - - - - OK - - - - - - - Cancel - - - - - - - false + + QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok - - Apply + + true - - - - Qt::Horizontal - - - - 81 - 31 - - - - diff --git a/src/options_imp.cpp b/src/options_imp.cpp index 88f65ad2c..e1fea6d9a 100644 --- a/src/options_imp.cpp +++ b/src/options_imp.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #ifdef Q_WS_WIN #include #endif @@ -45,6 +46,16 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ qDebug("-> Constructing Options"); QString savePath; setupUi(this); + // Get apply button in button box + QList buttons = buttonBox->buttons(); + QAbstractButton *button; + foreach(button, buttons){ + if(buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole){ + applyButton = button; + break; + } + } + connect(buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(applySettings(QAbstractButton*))); // Setting icons tabOptions->setTabIcon(0, QIcon(QString::fromUtf8(":/Icons/connection.png"))); tabOptions->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/style.png"))); @@ -244,6 +255,7 @@ void options_imp::useStyle(){ } void options_imp::saveOptions(){ + applyButton->setEnabled(false); QSettings settings("qBittorrent", "qBittorrent"); // Apply style useStyle(); @@ -329,8 +341,6 @@ void options_imp::saveOptions(){ settings.setValue("Style", getStyle()); // End Options group settings.endGroup(); - // Disable apply Button - applyButton->setEnabled(false); } bool options_imp::isFilteringEnabled() const{ @@ -567,8 +577,6 @@ void options_imp::loadOptions(){ setStyle(settings.value("Style", QString()).toString()); // End Options group settings.endGroup(); - // Disable apply Button - applyButton->setEnabled(false); } void options_imp::systrayDisabled(int val){ @@ -705,7 +713,7 @@ int options_imp::getMaxConnec() const{ } } -void options_imp::on_okButton_clicked(){ +void options_imp::on_buttonBox_accepted(){ if(applyButton->isEnabled()){ saveOptions(); applyButton->setEnabled(false); @@ -718,9 +726,11 @@ void options_imp::on_okButton_clicked(){ } } -void options_imp::on_applyButton_clicked(){ - saveOptions(); - emit status_changed(tr("Options were saved successfully."), false); +void options_imp::applySettings(QAbstractButton* button) { + if(button == applyButton){ + saveOptions(); + emit status_changed(tr("Options were saved successfully."), false); + } } void options_imp::closeEvent(QCloseEvent *e){ @@ -728,7 +738,7 @@ void options_imp::closeEvent(QCloseEvent *e){ e->accept(); } -void options_imp::on_cancelButton_clicked(){ +void options_imp::on_buttonBox_rejected(){ setAttribute(Qt::WA_DeleteOnClose); reject(); } diff --git a/src/options_imp.h b/src/options_imp.h index 1e05403ce..4e8968139 100644 --- a/src/options_imp.h +++ b/src/options_imp.h @@ -36,6 +36,7 @@ class options_imp : public QDialog, private Ui::Dialog{ QButtonGroup choiceLanguage; ip_filter filter; QStringList locales; + QAbstractButton *applyButton; public: // Contructor / Destructor @@ -83,10 +84,10 @@ class options_imp : public QDialog, private Ui::Dialog{ bool useSystrayIntegration() const; protected slots: - void on_okButton_clicked(); + void on_buttonBox_accepted(); void closeEvent(QCloseEvent *e); - void on_cancelButton_clicked(); - void on_applyButton_clicked(); + void on_buttonBox_rejected(); + void applySettings(QAbstractButton* button); void on_addFilterRange_clicked(); void on_delFilterRange_clicked(); void on_browse_button_scan_clicked();