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

View file

@ -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;
}
}
}

View file

@ -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;