mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-16 13:11:36 +03:00
Preferences code clean up
This commit is contained in:
parent
851a677a48
commit
f5d4404b67
3 changed files with 158 additions and 136 deletions
|
@ -170,9 +170,9 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>-115</y>
|
||||||
<width>499</width>
|
<width>503</width>
|
||||||
<height>506</height>
|
<height>519</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||||
|
@ -378,74 +378,76 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkShowSystray">
|
<widget class="QGroupBox" name="checkShowSystray">
|
||||||
<property name="text">
|
<property name="title">
|
||||||
<string>Show qBittorrent icon in notification area</string>
|
<string>Show qBittorrent in notification area</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<layout class="QVBoxLayout" name="verticalLayout_22">
|
||||||
</item>
|
<item>
|
||||||
<item>
|
<widget class="QCheckBox" name="checkMinimizeToSysTray">
|
||||||
<widget class="QCheckBox" name="checkMinimizeToSysTray">
|
|
||||||
<property name="text">
|
|
||||||
<string>Minimize qBittorrent to notification area</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkCloseToSystray">
|
|
||||||
<property name="text">
|
|
||||||
<string comment="i.e: The systray tray icon will still be visible when closing the main window.">Close qBittorrent to notification area</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_trayIconStyle">
|
|
||||||
<property name="text">
|
|
||||||
<string>Tray icon style:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboTrayIcon">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Normal</string>
|
<string>Minimize qBittorrent to notification area</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
<property name="checked">
|
||||||
<item>
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkCloseToSystray">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Monochrome (Dark theme)</string>
|
<string comment="i.e: The systray tray icon will still be visible when closing the main window.">Close qBittorrent to notification area</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</widget>
|
||||||
<item>
|
</item>
|
||||||
<property name="text">
|
<item>
|
||||||
<string>Monochrome (Light theme)</string>
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
</property>
|
<item>
|
||||||
</item>
|
<widget class="QLabel" name="label_trayIconStyle">
|
||||||
</widget>
|
<property name="text">
|
||||||
</item>
|
<string>Tray icon style:</string>
|
||||||
<item>
|
</property>
|
||||||
<spacer name="horizontalSpacer_3">
|
</widget>
|
||||||
<property name="orientation">
|
</item>
|
||||||
<enum>Qt::Horizontal</enum>
|
<item>
|
||||||
</property>
|
<widget class="QComboBox" name="comboTrayIcon">
|
||||||
<property name="sizeHint" stdset="0">
|
<item>
|
||||||
<size>
|
<property name="text">
|
||||||
<width>40</width>
|
<string>Normal</string>
|
||||||
<height>20</height>
|
</property>
|
||||||
</size>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
</spacer>
|
<property name="text">
|
||||||
</item>
|
<string>Monochrome (Dark theme)</string>
|
||||||
</layout>
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Monochrome (Light theme)</string>
|
||||||
|
</property>
|
||||||
|
</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>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkProgramExitConfirm">
|
<widget class="QCheckBox" name="checkProgramExitConfirm">
|
||||||
|
@ -506,8 +508,8 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>-387</y>
|
<y>0</y>
|
||||||
<width>499</width>
|
<width>503</width>
|
||||||
<height>849</height>
|
<height>849</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -977,7 +979,7 @@ QGroupBox {
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>392</width>
|
<width>503</width>
|
||||||
<height>426</height>
|
<height>426</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1457,8 +1459,8 @@ QGroupBox {
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>328</width>
|
<width>518</width>
|
||||||
<height>306</height>
|
<height>384</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_33">
|
<layout class="QVBoxLayout" name="verticalLayout_33">
|
||||||
|
@ -1835,8 +1837,8 @@ QGroupBox {
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>-24</y>
|
||||||
<width>486</width>
|
<width>503</width>
|
||||||
<height>408</height>
|
<height>408</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -2199,8 +2201,8 @@ QGroupBox {
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>316</width>
|
<width>518</width>
|
||||||
<height>236</height>
|
<height>384</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_23">
|
<layout class="QVBoxLayout" name="verticalLayout_23">
|
||||||
|
@ -2348,8 +2350,8 @@ QGroupBox {
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>86</width>
|
<width>518</width>
|
||||||
<height>16</height>
|
<height>384</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_36"/>
|
<layout class="QVBoxLayout" name="verticalLayout_36"/>
|
||||||
|
@ -2396,8 +2398,6 @@ QGroupBox {
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>tabOption</tabstop>
|
<tabstop>tabOption</tabstop>
|
||||||
<tabstop>comboI18n</tabstop>
|
<tabstop>comboI18n</tabstop>
|
||||||
<tabstop>checkCloseToSystray</tabstop>
|
|
||||||
<tabstop>checkMinimizeToSysTray</tabstop>
|
|
||||||
<tabstop>textSavePath</tabstop>
|
<tabstop>textSavePath</tabstop>
|
||||||
<tabstop>browseSaveDirButton</tabstop>
|
<tabstop>browseSaveDirButton</tabstop>
|
||||||
<tabstop>checkAdditionDialog</tabstop>
|
<tabstop>checkAdditionDialog</tabstop>
|
||||||
|
@ -2448,5 +2448,85 @@ QGroupBox {
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>checkMaxConnecs</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>spinMaxConnec</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>496</x>
|
||||||
|
<y>157</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>574</x>
|
||||||
|
<y>160</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>checkMaxConnecsPerTorrent</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>spinMaxConnecPerTorrent</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>494</x>
|
||||||
|
<y>188</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>611</x>
|
||||||
|
<y>190</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>checkMaxUploadsPerTorrent</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>spinMaxUploadsPerTorrent</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>510</x>
|
||||||
|
<y>214</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>616</x>
|
||||||
|
<y>217</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>checkMaxRatio</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>spinMaxRatio</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>440</x>
|
||||||
|
<y>364</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>563</x>
|
||||||
|
<y>374</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>checkMaxRatio</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>comboRatioLimitAct</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>418</x>
|
||||||
|
<y>371</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>707</x>
|
||||||
|
<y>376</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -111,13 +111,6 @@ options_imp::options_imp(QWidget *parent):
|
||||||
comboTrayIcon->setVisible(false);
|
comboTrayIcon->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
// Connect signals / slots
|
// Connect signals / slots
|
||||||
// General tab
|
|
||||||
connect(checkShowSystray, SIGNAL(toggled(bool)), this, SLOT(setSystrayOptionsState(bool)));
|
|
||||||
// Bittorrent tab
|
|
||||||
connect(checkMaxConnecs, SIGNAL(toggled(bool)), this, SLOT(enableMaxConnecsLimit(bool)));
|
|
||||||
connect(checkMaxConnecsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableMaxConnecsLimitPerTorrent(bool)));
|
|
||||||
connect(checkMaxUploadsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableMaxUploadsLimitPerTorrent(bool)));
|
|
||||||
connect(checkMaxRatio, SIGNAL(toggled(bool)), this, SLOT(enableMaxRatio(bool)));
|
|
||||||
// Proxy tab
|
// Proxy tab
|
||||||
connect(comboProxyType, SIGNAL(currentIndexChanged(int)),this, SLOT(enableProxy(int)));
|
connect(comboProxyType, SIGNAL(currentIndexChanged(int)),this, SLOT(enableProxy(int)));
|
||||||
connect(checkProxyAuth, SIGNAL(toggled(bool)), this, SLOT(enableProxyAuth(bool)));
|
connect(checkProxyAuth, SIGNAL(toggled(bool)), this, SLOT(enableProxyAuth(bool)));
|
||||||
|
@ -475,10 +468,7 @@ void options_imp::loadOptions(){
|
||||||
checkAltRowColors->setChecked(pref.useAlternatingRowColors());
|
checkAltRowColors->setChecked(pref.useAlternatingRowColors());
|
||||||
checkShowSystray->setChecked(pref.systrayIntegration());
|
checkShowSystray->setChecked(pref.systrayIntegration());
|
||||||
checkShowSplash->setChecked(!pref.isSlashScreenDisabled());
|
checkShowSplash->setChecked(!pref.isSlashScreenDisabled());
|
||||||
if(!checkShowSystray->isChecked()) {
|
if(checkShowSystray->isChecked()) {
|
||||||
disableSystrayOptions();
|
|
||||||
} else {
|
|
||||||
enableSystrayOptions();
|
|
||||||
checkCloseToSystray->setChecked(pref.closeToTray());
|
checkCloseToSystray->setChecked(pref.closeToTray());
|
||||||
checkMinimizeToSysTray->setChecked(pref.minimizeToTray());
|
checkMinimizeToSysTray->setChecked(pref.minimizeToTray());
|
||||||
checkStartMinimized->setChecked(pref.startMinimized());
|
checkStartMinimized->setChecked(pref.startMinimized());
|
||||||
|
@ -845,51 +835,10 @@ bool options_imp::useAdditionDialog() const{
|
||||||
return checkAdditionDialog->isChecked();
|
return checkAdditionDialog->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void options_imp::enableMaxConnecsLimit(bool checked){
|
|
||||||
spinMaxConnec->setEnabled(checked);
|
|
||||||
}
|
|
||||||
|
|
||||||
void options_imp::enableMaxConnecsLimitPerTorrent(bool checked){
|
|
||||||
spinMaxConnecPerTorrent->setEnabled(checked);
|
|
||||||
}
|
|
||||||
|
|
||||||
void options_imp::enableSystrayOptions() {
|
|
||||||
checkCloseToSystray->setEnabled(true);
|
|
||||||
checkMinimizeToSysTray->setEnabled(true);
|
|
||||||
comboTrayIcon->setEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void options_imp::disableSystrayOptions() {
|
|
||||||
checkCloseToSystray->setEnabled(false);
|
|
||||||
checkMinimizeToSysTray->setEnabled(false);
|
|
||||||
comboTrayIcon->setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void options_imp::setSystrayOptionsState(bool checked) {
|
|
||||||
if(checked) {
|
|
||||||
enableSystrayOptions();
|
|
||||||
} else {
|
|
||||||
disableSystrayOptions();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void options_imp::enableMaxUploadsLimitPerTorrent(bool checked){
|
|
||||||
if(checked){
|
|
||||||
spinMaxUploadsPerTorrent->setEnabled(true);
|
|
||||||
}else{
|
|
||||||
spinMaxUploadsPerTorrent->setEnabled(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void options_imp::enableApplyButton(){
|
void options_imp::enableApplyButton(){
|
||||||
applyButton->setEnabled(true);
|
applyButton->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void options_imp::enableMaxRatio(bool checked){
|
|
||||||
spinMaxRatio->setEnabled(checked);
|
|
||||||
comboRatioLimitAct->setEnabled(checked);
|
|
||||||
}
|
|
||||||
|
|
||||||
void options_imp::enableProxy(int index){
|
void options_imp::enableProxy(int index){
|
||||||
if(index){
|
if(index){
|
||||||
//enable
|
//enable
|
||||||
|
|
|
@ -57,10 +57,6 @@ public:
|
||||||
protected slots:
|
protected slots:
|
||||||
void enableProxy(int comboIndex);
|
void enableProxy(int comboIndex);
|
||||||
void enableProxyAuth(bool checked);
|
void enableProxyAuth(bool checked);
|
||||||
void enableMaxConnecsLimit(bool checked);
|
|
||||||
void enableMaxConnecsLimitPerTorrent(bool checked);
|
|
||||||
void enableMaxUploadsLimitPerTorrent(bool checked);
|
|
||||||
void enableMaxRatio(bool checked);
|
|
||||||
void on_buttonBox_accepted();
|
void on_buttonBox_accepted();
|
||||||
void closeEvent(QCloseEvent *e);
|
void closeEvent(QCloseEvent *e);
|
||||||
void on_buttonBox_rejected();
|
void on_buttonBox_rejected();
|
||||||
|
@ -70,9 +66,6 @@ protected slots:
|
||||||
void on_browseSaveDirButton_clicked();
|
void on_browseSaveDirButton_clicked();
|
||||||
void on_browseTempDirButton_clicked();
|
void on_browseTempDirButton_clicked();
|
||||||
void enableApplyButton();
|
void enableApplyButton();
|
||||||
void enableSystrayOptions();
|
|
||||||
void disableSystrayOptions();
|
|
||||||
void setSystrayOptionsState(bool checked);
|
|
||||||
void changePage(QListWidgetItem*, QListWidgetItem*);
|
void changePage(QListWidgetItem*, QListWidgetItem*);
|
||||||
void loadWindowState();
|
void loadWindowState();
|
||||||
void saveWindowState() const;
|
void saveWindowState() const;
|
||||||
|
|
Loading…
Reference in a new issue