mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-06 15:42:32 -06:00
Made changes for clean up and fix the problem that a new ramdon port is set every time a setting is saved.
This commit is contained in:
committed by
sledgehammer999
parent
7a99eb8e23
commit
75e28bb3e6
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>789</width>
|
||||
<width>779</width>
|
||||
<height>591</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -177,8 +177,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-161</y>
|
||||
<width>486</width>
|
||||
<height>638</height>
|
||||
<width>484</width>
|
||||
<height>693</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
@@ -262,6 +262,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkRandomPort">
|
||||
<property name="text">
|
||||
<string>Use random port to communicate</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_7">
|
||||
<property name="font">
|
||||
@@ -516,8 +526,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>482</width>
|
||||
<height>1025</height>
|
||||
<width>501</width>
|
||||
<height>930</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
@@ -735,6 +745,15 @@
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderDefaultSectionSize">
|
||||
<number>80</number>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -1022,8 +1041,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>474</width>
|
||||
<height>577</height>
|
||||
<width>451</width>
|
||||
<height>524</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_20">
|
||||
@@ -1466,8 +1485,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>359</width>
|
||||
<height>480</height>
|
||||
<width>398</width>
|
||||
<height>458</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_33">
|
||||
@@ -1741,6 +1760,12 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTimeEdit" name="schedule_from">
|
||||
<property name="displayFormat">
|
||||
<string notr="true">hh:mm</string>
|
||||
</property>
|
||||
<property name="calendarPopup">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="time">
|
||||
<time>
|
||||
<hour>8</hour>
|
||||
@@ -1748,12 +1773,6 @@
|
||||
<second>0</second>
|
||||
</time>
|
||||
</property>
|
||||
<property name="displayFormat">
|
||||
<string notr="true">hh:mm</string>
|
||||
</property>
|
||||
<property name="calendarPopup">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -1768,6 +1787,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTimeEdit" name="schedule_to">
|
||||
<property name="displayFormat">
|
||||
<string notr="true">hh:mm</string>
|
||||
</property>
|
||||
<property name="time">
|
||||
<time>
|
||||
<hour>20</hour>
|
||||
@@ -1775,9 +1797,6 @@
|
||||
<second>0</second>
|
||||
</time>
|
||||
</property>
|
||||
<property name="displayFormat">
|
||||
<string notr="true">hh:mm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -1878,8 +1897,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>557</width>
|
||||
<height>555</height>
|
||||
<width>546</width>
|
||||
<height>524</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
@@ -2292,8 +2311,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>426</width>
|
||||
<height>611</height>
|
||||
<width>436</width>
|
||||
<height>553</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_23">
|
||||
|
||||
@@ -138,6 +138,8 @@ options_imp::options_imp(QWidget *parent):
|
||||
// General tab
|
||||
connect(comboI18n, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
|
||||
connect(checkAltRowColors, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
//add checkbox for random port
|
||||
connect(checkRandomPort, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(checkShowSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(checkCloseToSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(checkMinimizeToSysTray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
@@ -367,6 +369,8 @@ void options_imp::saveOptions() {
|
||||
// General preferences
|
||||
pref.setLocale(locale);
|
||||
pref.setAlternatingRowColors(checkAltRowColors->isChecked());
|
||||
//set random port
|
||||
pref.setRandomPort(checkRandomPort->isChecked());
|
||||
pref.setSystrayIntegration(systrayIntegration());
|
||||
pref.setTrayIconStyle(TrayIcon::Style(comboTrayIcon->currentIndex()));
|
||||
pref.setCloseToTray(closeToTray());
|
||||
@@ -540,6 +544,8 @@ void options_imp::loadOptions() {
|
||||
const Preferences pref;
|
||||
setLocale(pref.getLocale());
|
||||
checkAltRowColors->setChecked(pref.useAlternatingRowColors());
|
||||
//get random port
|
||||
checkRandomPort->setChecked(pref.useRandomPort());
|
||||
checkShowSystray->setChecked(pref.systrayIntegration());
|
||||
checkShowSplash->setChecked(!pref.isSlashScreenDisabled());
|
||||
if (checkShowSystray->isChecked()) {
|
||||
@@ -792,6 +798,7 @@ void options_imp::on_randomButton_clicked() {
|
||||
spinPort->setValue(rand() % 64512 + 1024);
|
||||
}
|
||||
|
||||
|
||||
int options_imp::getEncryptionSetting() const {
|
||||
return comboEncryption->currentIndex();
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ public:
|
||||
}
|
||||
|
||||
// General options
|
||||
|
||||
QString getLocale() const {
|
||||
return value(QString::fromUtf8("Preferences/General/Locale"), "en_GB").toString();
|
||||
}
|
||||
@@ -85,7 +86,7 @@ public:
|
||||
void setLocale(const QString &locale) {
|
||||
setValue(QString::fromUtf8("Preferences/General/Locale"), locale);
|
||||
}
|
||||
|
||||
|
||||
bool useProgramNotification() const {
|
||||
return value(QString::fromUtf8("Preferences/General/ProgramNotification"), true).toBool();
|
||||
}
|
||||
@@ -126,6 +127,14 @@ public:
|
||||
setValue("Preferences/General/AlternatingRowColors", b);
|
||||
}
|
||||
|
||||
bool useRandomPort() const {
|
||||
return value(QString::fromUtf8("Preferences/General/RandomPort"), true).toBool();
|
||||
}
|
||||
|
||||
void setRandomPort(bool b) {
|
||||
setValue("Preferences/General/RandomPort", b);
|
||||
}
|
||||
|
||||
bool systrayIntegration() const {
|
||||
#ifdef Q_WS_MAC
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user