From 675e8282b0a4533ac554e45c195a47d6021e1e4a Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Mon, 11 Apr 2011 17:21:16 +0000 Subject: [PATCH] Cosmetic changes to program preferences --- src/preferences/options.ui | 338 ++++++++++++++------------------ src/preferences/options_imp.cpp | 27 ++- src/preferences/options_imp.h | 30 ++- 3 files changed, 175 insertions(+), 220 deletions(-) diff --git a/src/preferences/options.ui b/src/preferences/options.ui index a04ba678b..617629ad3 100644 --- a/src/preferences/options.ui +++ b/src/preferences/options.ui @@ -247,7 +247,7 @@ - Transfer list + Transfer List @@ -277,7 +277,10 @@ true - + + + QFormLayout::ExpandingFieldsGrow + 0 @@ -342,19 +345,6 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -421,15 +411,15 @@ - - + + Tray icon style: - + @@ -448,19 +438,6 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -565,7 +542,7 @@ - File system + Hard Disk @@ -985,9 +962,9 @@ QGroupBox { 0 - -84 + 0 503 - 462 + 456 @@ -996,7 +973,7 @@ QGroupBox { - Listening port + Listening Port @@ -1061,131 +1038,116 @@ QGroupBox { - Connections limit + Connections Limits - - - 0 - - - - - - - Global maximum number of connections: - - - true - - - - - - - true - - - 2 - - - 2000 - - - 500 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + + + Global maximum number of connections: + + + true + + - - - - - - Maximum number of connections per torrent: - - - true - - - - - - - 2 - - - 2000 - - - 100 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + + true + + + 2 + + + 2000 + + + 500 + + - - - - - - Maximum number of upload slots per torrent: - - - true - - - - - - - 500 - - - 4 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + + Maximum number of connections per torrent: + + + true + + + + + + + 2 + + + 2000 + + + 100 + + + + + + + Maximum number of upload slots per torrent: + + + true + + + + + + + 500 + + + 4 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + @@ -1196,7 +1158,7 @@ QGroupBox { true - Proxy server + Proxy Server @@ -1284,19 +1246,6 @@ QGroupBox { - - - - Qt::Horizontal - - - - 21 - 29 - - - - @@ -1465,7 +1414,7 @@ QGroupBox { - Global speed limits + Global Speed Limits @@ -1570,7 +1519,7 @@ QGroupBox { - Alternative global speed limits + Alternative Global Speed Limits @@ -1995,7 +1944,7 @@ QGroupBox { - Torrent queueing + Torrent Queueing true @@ -2080,13 +2029,39 @@ QGroupBox { + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + - Share ratio limiting + Share Ratio Limiting @@ -2150,19 +2125,6 @@ QGroupBox { - - - - Qt::Horizontal - - - - 40 - 20 - - - - diff --git a/src/preferences/options_imp.cpp b/src/preferences/options_imp.cpp index e16d111e1..eaa11bb6d 100644 --- a/src/preferences/options_imp.cpp +++ b/src/preferences/options_imp.cpp @@ -283,7 +283,7 @@ void options_imp::saveWindowState() const { settings.setValue(QString::fromUtf8("Preferences/State/hSplitterSizes"), sizes_str); } -QSize options_imp::sizeFittingScreen() { +QSize options_imp::sizeFittingScreen() const { int scrn = 0; QWidget *w = this->topLevelWidget(); @@ -891,9 +891,7 @@ bool options_imp::isProxyAuthEnabled() const{ } QString options_imp::getProxyIp() const{ - QString ip = textProxyIP->text(); - ip = ip.trimmed(); - return ip; + return textProxyIP->text().trimmed(); } unsigned short options_imp::getProxyPort() const{ @@ -917,7 +915,7 @@ QString options_imp::getLocale() const{ return comboI18n->itemData(comboI18n->currentIndex(), Qt::UserRole).toString(); } -void options_imp::setLocale(QString localeStr) { +void options_imp::setLocale(const QString &localeStr) { QLocale locale(localeStr); // Attempt to find exact match int index = comboI18n->findData(locale.name(), Qt::UserRole); @@ -930,23 +928,21 @@ void options_imp::setLocale(QString localeStr) { } QString options_imp::getExportDir() const { - if(checkExportDir->isChecked()){ + if(checkExportDir->isChecked()) return misc::expandPath(textExportDir->text()); - }else{ - return QString::null; - } + return QString(); } // Return action on double-click on a downloading torrent set in options int options_imp::getActionOnDblClOnTorrentDl() const { - if(actionTorrentDlOnDblClBox->currentIndex()<1) + if(actionTorrentDlOnDblClBox->currentIndex() < 1) return 0; return actionTorrentDlOnDblClBox->currentIndex(); } // Return action on double-click on a finished torrent set in options int options_imp::getActionOnDblClOnTorrentFn() const { - if(actionTorrentFnOnDblClBox->currentIndex()<1) + if(actionTorrentFnOnDblClBox->currentIndex() < 1) return 0; return actionTorrentFnOnDblClBox->currentIndex(); } @@ -991,7 +987,7 @@ void options_imp::handleScanFolderViewSelectionChanged() { } void options_imp::on_browseExportDirButton_clicked() { - QString export_path = misc::expandPath(textExportDir->text()); + const QString export_path = misc::expandPath(textExportDir->text()); QDir exportDir(export_path); QString dir; if(!export_path.isEmpty() && exportDir.exists()) { @@ -1008,7 +1004,7 @@ void options_imp::on_browseExportDirButton_clicked() { } void options_imp::on_browseFilterButton_clicked() { - QString filter_path = misc::expandPath(textFilterPath->text()); + const QString filter_path = misc::expandPath(textFilterPath->text()); QDir filterDir(filter_path); QString ipfilter; if(!filter_path.isEmpty() && filterDir.exists()) { @@ -1026,7 +1022,7 @@ void options_imp::on_browseFilterButton_clicked() { // Display dialog to choose save dir void options_imp::on_browseSaveDirButton_clicked(){ - QString save_path = misc::expandPath(textSavePath->text()); + const QString save_path = misc::expandPath(textSavePath->text()); QDir saveDir(save_path); QString dir; if(!save_path.isEmpty() && saveDir.exists()) { @@ -1043,7 +1039,7 @@ void options_imp::on_browseSaveDirButton_clicked(){ } void options_imp::on_browseTempDirButton_clicked(){ - QString temp_path = misc::expandPath(textTempPath->text()); + const QString temp_path = misc::expandPath(textTempPath->text()); QDir tempDir(temp_path); QString dir; if(!temp_path.isEmpty() && tempDir.exists()) { @@ -1165,5 +1161,4 @@ QString options_imp::languageToLocalizedString(QLocale::Language language, const return eng_lang; } } - } diff --git a/src/preferences/options_imp.h b/src/preferences/options_imp.h index 09d66eb0f..4686d0ef6 100644 --- a/src/preferences/options_imp.h +++ b/src/preferences/options_imp.h @@ -52,37 +52,34 @@ public: // Contructor / Destructor options_imp(QWidget *parent=0); ~options_imp(); - QSize sizeFittingScreen(); -protected slots: +signals: + void status_changed() const; + void exitWithCancel(); + +private slots: void enableProxy(int comboIndex); void on_buttonBox_accepted(); void closeEvent(QCloseEvent *e); void on_buttonBox_rejected(); void applySettings(QAbstractButton* button); - void on_browseExportDirButton_clicked(); - void on_browseFilterButton_clicked(); - void on_browseSaveDirButton_clicked(); - void on_browseTempDirButton_clicked(); void enableApplyButton(); void changePage(QListWidgetItem*, QListWidgetItem*); void loadWindowState(); void saveWindowState() const; - void on_randomButton_clicked(); - void on_addScanFolderButton_clicked(); - void on_removeScanFolderButton_clicked(); void handleScanFolderViewSelectionChanged(); void on_IpFilterRefreshBtn_clicked(); void handleIPFilterParsed(bool error, int ruleCount); - -public slots: - void setLocale(QString locale); + void on_browseExportDirButton_clicked(); + void on_browseFilterButton_clicked(); + void on_browseSaveDirButton_clicked(); + void on_browseTempDirButton_clicked(); + void on_randomButton_clicked(); + void on_addScanFolderButton_clicked(); + void on_removeScanFolderButton_clicked(); + void setLocale(const QString &locale); void showConnectionTab(); -signals: - void status_changed() const; - void exitWithCancel(); - private: // Methods void saveOptions(); @@ -142,6 +139,7 @@ private: quint16 webUiPort() const; QString webUiUsername() const; QString webUiPassword() const; + QSize sizeFittingScreen() const; private: QButtonGroup choiceLanguage;