Cosmetic changes to program preferences

This commit is contained in:
Christophe Dumez 2011-04-11 17:21:16 +00:00
parent a1272fff82
commit 675e8282b0
3 changed files with 175 additions and 220 deletions

View file

@ -247,7 +247,7 @@
<item> <item>
<widget class="QGroupBox" name="groupBox_4"> <widget class="QGroupBox" name="groupBox_4">
<property name="title"> <property name="title">
<string>Transfer list</string> <string>Transfer List</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_4"> <layout class="QVBoxLayout" name="verticalLayout_4">
<property name="bottomMargin"> <property name="bottomMargin">
@ -277,7 +277,10 @@
<property name="flat"> <property name="flat">
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QFormLayout" name="formLayout_3">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -342,19 +345,6 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="0" column="2">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -421,15 +411,15 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QFormLayout" name="formLayout_4">
<item> <item row="0" column="0">
<widget class="QLabel" name="label_trayIconStyle"> <widget class="QLabel" name="label_trayIconStyle">
<property name="text"> <property name="text">
<string>Tray icon style:</string> <string>Tray icon style:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="1">
<widget class="QComboBox" name="comboTrayIcon"> <widget class="QComboBox" name="comboTrayIcon">
<item> <item>
<property name="text"> <property name="text">
@ -448,19 +438,6 @@
</item> </item>
</widget> </widget>
</item> </item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>
@ -565,7 +542,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="title"> <property name="title">
<string>File system</string> <string>Hard Disk</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_25"> <layout class="QVBoxLayout" name="verticalLayout_25">
<property name="bottomMargin"> <property name="bottomMargin">
@ -985,9 +962,9 @@ QGroupBox {
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>-84</y> <y>0</y>
<width>503</width> <width>503</width>
<height>462</height> <height>456</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_20"> <layout class="QVBoxLayout" name="verticalLayout_20">
@ -996,7 +973,7 @@ QGroupBox {
<item> <item>
<widget class="QGroupBox" name="ListeningPortBox"> <widget class="QGroupBox" name="ListeningPortBox">
<property name="title"> <property name="title">
<string>Listening port</string> <string>Listening Port</string>
</property> </property>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<item> <item>
@ -1061,131 +1038,116 @@ QGroupBox {
<item> <item>
<widget class="QGroupBox" name="nbConnecBox"> <widget class="QGroupBox" name="nbConnecBox">
<property name="title"> <property name="title">
<string>Connections limit</string> <string>Connections Limits</string>
</property> </property>
<layout class="QVBoxLayout" name="_8"> <layout class="QGridLayout" name="gridLayout">
<property name="bottomMargin"> <item row="0" column="0">
<number>0</number> <widget class="QCheckBox" name="checkMaxConnecs">
</property> <property name="text">
<item> <string>Global maximum number of connections:</string>
<layout class="QHBoxLayout" name="_9"> </property>
<item> <property name="checked">
<widget class="QCheckBox" name="checkMaxConnecs"> <bool>true</bool>
<property name="text"> </property>
<string>Global maximum number of connections:</string> </widget>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinMaxConnec">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimum">
<number>2</number>
</property>
<property name="maximum">
<number>2000</number>
</property>
<property name="value">
<number>500</number>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item> </item>
<item> <item row="0" column="1">
<layout class="QHBoxLayout" name="_10"> <widget class="QSpinBox" name="spinMaxConnec">
<item> <property name="enabled">
<widget class="QCheckBox" name="checkMaxConnecsPerTorrent"> <bool>true</bool>
<property name="text"> </property>
<string>Maximum number of connections per torrent:</string> <property name="minimum">
</property> <number>2</number>
<property name="checked"> </property>
<bool>true</bool> <property name="maximum">
</property> <number>2000</number>
</widget> </property>
</item> <property name="value">
<item> <number>500</number>
<widget class="QSpinBox" name="spinMaxConnecPerTorrent"> </property>
<property name="minimum"> </widget>
<number>2</number>
</property>
<property name="maximum">
<number>2000</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item> </item>
<item> <item row="1" column="0">
<layout class="QHBoxLayout" name="_11"> <widget class="QCheckBox" name="checkMaxConnecsPerTorrent">
<item> <property name="text">
<widget class="QCheckBox" name="checkMaxUploadsPerTorrent"> <string>Maximum number of connections per torrent:</string>
<property name="text"> </property>
<string>Maximum number of upload slots per torrent:</string> <property name="checked">
</property> <bool>true</bool>
<property name="checked"> </property>
<bool>true</bool> </widget>
</property> </item>
</widget> <item row="1" column="1">
</item> <widget class="QSpinBox" name="spinMaxConnecPerTorrent">
<item> <property name="minimum">
<widget class="QSpinBox" name="spinMaxUploadsPerTorrent"> <number>2</number>
<property name="maximum"> </property>
<number>500</number> <property name="maximum">
</property> <number>2000</number>
<property name="value"> </property>
<number>4</number> <property name="value">
</property> <number>100</number>
</widget> </property>
</item> </widget>
<item> </item>
<spacer> <item row="2" column="0">
<property name="orientation"> <widget class="QCheckBox" name="checkMaxUploadsPerTorrent">
<enum>Qt::Horizontal</enum> <property name="text">
</property> <string>Maximum number of upload slots per torrent:</string>
<property name="sizeHint" stdset="0"> </property>
<size> <property name="checked">
<width>40</width> <bool>true</bool>
<height>20</height> </property>
</size> </widget>
</property> </item>
</spacer> <item row="2" column="1">
</item> <widget class="QSpinBox" name="spinMaxUploadsPerTorrent">
</layout> <property name="maximum">
<number>500</number>
</property>
<property name="value">
<number>4</number>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -1196,7 +1158,7 @@ QGroupBox {
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="title"> <property name="title">
<string>Proxy server</string> <string>Proxy Server</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_29"> <layout class="QVBoxLayout" name="verticalLayout_29">
<item> <item>
@ -1284,19 +1246,6 @@ QGroupBox {
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>21</width>
<height>29</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</item> </item>
<item> <item>
@ -1465,7 +1414,7 @@ QGroupBox {
<item> <item>
<widget class="QGroupBox" name="bandwidthBox"> <widget class="QGroupBox" name="bandwidthBox">
<property name="title"> <property name="title">
<string>Global speed limits</string> <string>Global Speed Limits</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_7"> <layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0"> <item row="0" column="0">
@ -1570,7 +1519,7 @@ QGroupBox {
<item> <item>
<widget class="QGroupBox" name="groupBox_6"> <widget class="QGroupBox" name="groupBox_6">
<property name="title"> <property name="title">
<string>Alternative global speed limits</string> <string>Alternative Global Speed Limits</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_11"> <layout class="QVBoxLayout" name="verticalLayout_11">
<item> <item>
@ -1995,7 +1944,7 @@ QGroupBox {
<item> <item>
<widget class="QGroupBox" name="checkEnableQueueing"> <widget class="QGroupBox" name="checkEnableQueueing">
<property name="title"> <property name="title">
<string>Torrent queueing</string> <string>Torrent Queueing</string>
</property> </property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
@ -2080,13 +2029,39 @@ QGroupBox {
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="2">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2">
<spacer name="horizontalSpacer_11">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="ratioBox"> <widget class="QGroupBox" name="ratioBox">
<property name="title"> <property name="title">
<string>Share ratio limiting</string> <string>Share Ratio Limiting</string>
</property> </property>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<property name="bottomMargin"> <property name="bottomMargin">
@ -2150,19 +2125,6 @@ QGroupBox {
</item> </item>
</widget> </widget>
</item> </item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>

View file

@ -283,7 +283,7 @@ void options_imp::saveWindowState() const {
settings.setValue(QString::fromUtf8("Preferences/State/hSplitterSizes"), sizes_str); settings.setValue(QString::fromUtf8("Preferences/State/hSplitterSizes"), sizes_str);
} }
QSize options_imp::sizeFittingScreen() { QSize options_imp::sizeFittingScreen() const {
int scrn = 0; int scrn = 0;
QWidget *w = this->topLevelWidget(); QWidget *w = this->topLevelWidget();
@ -891,9 +891,7 @@ bool options_imp::isProxyAuthEnabled() const{
} }
QString options_imp::getProxyIp() const{ QString options_imp::getProxyIp() const{
QString ip = textProxyIP->text(); return textProxyIP->text().trimmed();
ip = ip.trimmed();
return ip;
} }
unsigned short options_imp::getProxyPort() const{ unsigned short options_imp::getProxyPort() const{
@ -917,7 +915,7 @@ QString options_imp::getLocale() const{
return comboI18n->itemData(comboI18n->currentIndex(), Qt::UserRole).toString(); return comboI18n->itemData(comboI18n->currentIndex(), Qt::UserRole).toString();
} }
void options_imp::setLocale(QString localeStr) { void options_imp::setLocale(const QString &localeStr) {
QLocale locale(localeStr); QLocale locale(localeStr);
// Attempt to find exact match // Attempt to find exact match
int index = comboI18n->findData(locale.name(), Qt::UserRole); int index = comboI18n->findData(locale.name(), Qt::UserRole);
@ -930,23 +928,21 @@ void options_imp::setLocale(QString localeStr) {
} }
QString options_imp::getExportDir() const { QString options_imp::getExportDir() const {
if(checkExportDir->isChecked()){ if(checkExportDir->isChecked())
return misc::expandPath(textExportDir->text()); return misc::expandPath(textExportDir->text());
}else{ return QString();
return QString::null;
}
} }
// 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 options_imp::getActionOnDblClOnTorrentDl() const {
if(actionTorrentDlOnDblClBox->currentIndex()<1) if(actionTorrentDlOnDblClBox->currentIndex() < 1)
return 0; return 0;
return actionTorrentDlOnDblClBox->currentIndex(); return actionTorrentDlOnDblClBox->currentIndex();
} }
// 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 options_imp::getActionOnDblClOnTorrentFn() const {
if(actionTorrentFnOnDblClBox->currentIndex()<1) if(actionTorrentFnOnDblClBox->currentIndex() < 1)
return 0; return 0;
return actionTorrentFnOnDblClBox->currentIndex(); return actionTorrentFnOnDblClBox->currentIndex();
} }
@ -991,7 +987,7 @@ void options_imp::handleScanFolderViewSelectionChanged() {
} }
void options_imp::on_browseExportDirButton_clicked() { 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); QDir exportDir(export_path);
QString dir; QString dir;
if(!export_path.isEmpty() && exportDir.exists()) { if(!export_path.isEmpty() && exportDir.exists()) {
@ -1008,7 +1004,7 @@ void options_imp::on_browseExportDirButton_clicked() {
} }
void options_imp::on_browseFilterButton_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); QDir filterDir(filter_path);
QString ipfilter; QString ipfilter;
if(!filter_path.isEmpty() && filterDir.exists()) { if(!filter_path.isEmpty() && filterDir.exists()) {
@ -1026,7 +1022,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 options_imp::on_browseSaveDirButton_clicked(){
QString save_path = misc::expandPath(textSavePath->text()); const QString save_path = misc::expandPath(textSavePath->text());
QDir saveDir(save_path); QDir saveDir(save_path);
QString dir; QString dir;
if(!save_path.isEmpty() && saveDir.exists()) { if(!save_path.isEmpty() && saveDir.exists()) {
@ -1043,7 +1039,7 @@ void options_imp::on_browseSaveDirButton_clicked(){
} }
void options_imp::on_browseTempDirButton_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); QDir tempDir(temp_path);
QString dir; QString dir;
if(!temp_path.isEmpty() && tempDir.exists()) { if(!temp_path.isEmpty() && tempDir.exists()) {
@ -1165,5 +1161,4 @@ QString options_imp::languageToLocalizedString(QLocale::Language language, const
return eng_lang; return eng_lang;
} }
} }
} }

View file

@ -52,37 +52,34 @@ public:
// Contructor / Destructor // Contructor / Destructor
options_imp(QWidget *parent=0); options_imp(QWidget *parent=0);
~options_imp(); ~options_imp();
QSize sizeFittingScreen();
protected slots: signals:
void status_changed() const;
void exitWithCancel();
private slots:
void enableProxy(int comboIndex); void enableProxy(int comboIndex);
void on_buttonBox_accepted(); void on_buttonBox_accepted();
void closeEvent(QCloseEvent *e); void closeEvent(QCloseEvent *e);
void on_buttonBox_rejected(); void on_buttonBox_rejected();
void applySettings(QAbstractButton* button); void applySettings(QAbstractButton* button);
void on_browseExportDirButton_clicked();
void on_browseFilterButton_clicked();
void on_browseSaveDirButton_clicked();
void on_browseTempDirButton_clicked();
void enableApplyButton(); void enableApplyButton();
void changePage(QListWidgetItem*, QListWidgetItem*); void changePage(QListWidgetItem*, QListWidgetItem*);
void loadWindowState(); void loadWindowState();
void saveWindowState() const; void saveWindowState() const;
void on_randomButton_clicked();
void on_addScanFolderButton_clicked();
void on_removeScanFolderButton_clicked();
void handleScanFolderViewSelectionChanged(); void handleScanFolderViewSelectionChanged();
void on_IpFilterRefreshBtn_clicked(); void on_IpFilterRefreshBtn_clicked();
void handleIPFilterParsed(bool error, int ruleCount); void handleIPFilterParsed(bool error, int ruleCount);
void on_browseExportDirButton_clicked();
public slots: void on_browseFilterButton_clicked();
void setLocale(QString locale); 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(); void showConnectionTab();
signals:
void status_changed() const;
void exitWithCancel();
private: private:
// Methods // Methods
void saveOptions(); void saveOptions();
@ -142,6 +139,7 @@ private:
quint16 webUiPort() const; quint16 webUiPort() const;
QString webUiUsername() const; QString webUiUsername() const;
QString webUiPassword() const; QString webUiPassword() const;
QSize sizeFittingScreen() const;
private: private:
QButtonGroup choiceLanguage; QButtonGroup choiceLanguage;