Browse Source

Cosmetic changes to program preferences

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
675e8282b0
  1. 194
      src/preferences/options.ui
  2. 23
      src/preferences/options_imp.cpp
  3. 30
      src/preferences/options_imp.h

194
src/preferences/options.ui

@ -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,15 +1038,10 @@ 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>
<layout class="QVBoxLayout" name="_8">
<property name="bottomMargin">
<number>0</number>
</property> </property>
<item> <layout class="QGridLayout" name="gridLayout">
<layout class="QHBoxLayout" name="_9"> <item row="0" column="0">
<item>
<widget class="QCheckBox" name="checkMaxConnecs"> <widget class="QCheckBox" name="checkMaxConnecs">
<property name="text"> <property name="text">
<string>Global maximum number of connections:</string> <string>Global maximum number of connections:</string>
@ -1079,7 +1051,7 @@ QGroupBox {
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="1">
<widget class="QSpinBox" name="spinMaxConnec"> <widget class="QSpinBox" name="spinMaxConnec">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@ -1095,24 +1067,7 @@ QGroupBox {
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="1" column="0">
<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>
<layout class="QHBoxLayout" name="_10">
<item>
<widget class="QCheckBox" name="checkMaxConnecsPerTorrent"> <widget class="QCheckBox" name="checkMaxConnecsPerTorrent">
<property name="text"> <property name="text">
<string>Maximum number of connections per torrent:</string> <string>Maximum number of connections per torrent:</string>
@ -1122,7 +1077,7 @@ QGroupBox {
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="1" column="1">
<widget class="QSpinBox" name="spinMaxConnecPerTorrent"> <widget class="QSpinBox" name="spinMaxConnecPerTorrent">
<property name="minimum"> <property name="minimum">
<number>2</number> <number>2</number>
@ -1135,24 +1090,7 @@ QGroupBox {
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="2" column="0">
<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>
<layout class="QHBoxLayout" name="_11">
<item>
<widget class="QCheckBox" name="checkMaxUploadsPerTorrent"> <widget class="QCheckBox" name="checkMaxUploadsPerTorrent">
<property name="text"> <property name="text">
<string>Maximum number of upload slots per torrent:</string> <string>Maximum number of upload slots per torrent:</string>
@ -1162,7 +1100,7 @@ QGroupBox {
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="2" column="1">
<widget class="QSpinBox" name="spinMaxUploadsPerTorrent"> <widget class="QSpinBox" name="spinMaxUploadsPerTorrent">
<property name="maximum"> <property name="maximum">
<number>500</number> <number>500</number>
@ -1172,8 +1110,8 @@ QGroupBox {
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="2">
<spacer> <spacer name="horizontalSpacer_3">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -1185,7 +1123,31 @@ QGroupBox {
</property> </property>
</spacer> </spacer>
</item> </item>
</layout> <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>

23
src/preferences/options_imp.cpp

@ -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,11 +928,9 @@ 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
@ -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;
} }
} }
} }

30
src/preferences/options_imp.h

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

Loading…
Cancel
Save