mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-16 05:01:37 +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">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>499</width>
|
||||
<height>506</height>
|
||||
<y>-115</y>
|
||||
<width>503</width>
|
||||
<height>519</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
|
@ -378,74 +378,76 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkShowSystray">
|
||||
<property name="text">
|
||||
<string>Show qBittorrent icon in notification area</string>
|
||||
<widget class="QGroupBox" name="checkShowSystray">
|
||||
<property name="title">
|
||||
<string>Show qBittorrent in notification area</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<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>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_22">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkMinimizeToSysTray">
|
||||
<property name="text">
|
||||
<string>Normal</string>
|
||||
<string>Minimize qBittorrent to notification area</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkCloseToSystray">
|
||||
<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>
|
||||
</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>
|
||||
</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">
|
||||
<string>Normal</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Monochrome (Dark theme)</string>
|
||||
</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>
|
||||
<widget class="QCheckBox" name="checkProgramExitConfirm">
|
||||
|
@ -506,8 +508,8 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-387</y>
|
||||
<width>499</width>
|
||||
<y>0</y>
|
||||
<width>503</width>
|
||||
<height>849</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -977,7 +979,7 @@ QGroupBox {
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>392</width>
|
||||
<width>503</width>
|
||||
<height>426</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -1457,8 +1459,8 @@ QGroupBox {
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>328</width>
|
||||
<height>306</height>
|
||||
<width>518</width>
|
||||
<height>384</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_33">
|
||||
|
@ -1835,8 +1837,8 @@ QGroupBox {
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>486</width>
|
||||
<y>-24</y>
|
||||
<width>503</width>
|
||||
<height>408</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -2199,8 +2201,8 @@ QGroupBox {
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>316</width>
|
||||
<height>236</height>
|
||||
<width>518</width>
|
||||
<height>384</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_23">
|
||||
|
@ -2348,8 +2350,8 @@ QGroupBox {
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>86</width>
|
||||
<height>16</height>
|
||||
<width>518</width>
|
||||
<height>384</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_36"/>
|
||||
|
@ -2396,8 +2398,6 @@ QGroupBox {
|
|||
<tabstops>
|
||||
<tabstop>tabOption</tabstop>
|
||||
<tabstop>comboI18n</tabstop>
|
||||
<tabstop>checkCloseToSystray</tabstop>
|
||||
<tabstop>checkMinimizeToSysTray</tabstop>
|
||||
<tabstop>textSavePath</tabstop>
|
||||
<tabstop>browseSaveDirButton</tabstop>
|
||||
<tabstop>checkAdditionDialog</tabstop>
|
||||
|
@ -2448,5 +2448,85 @@ QGroupBox {
|
|||
</hint>
|
||||
</hints>
|
||||
</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>
|
||||
</ui>
|
||||
|
|
|
@ -111,13 +111,6 @@ options_imp::options_imp(QWidget *parent):
|
|||
comboTrayIcon->setVisible(false);
|
||||
#endif
|
||||
// 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
|
||||
connect(comboProxyType, SIGNAL(currentIndexChanged(int)),this, SLOT(enableProxy(int)));
|
||||
connect(checkProxyAuth, SIGNAL(toggled(bool)), this, SLOT(enableProxyAuth(bool)));
|
||||
|
@ -475,10 +468,7 @@ void options_imp::loadOptions(){
|
|||
checkAltRowColors->setChecked(pref.useAlternatingRowColors());
|
||||
checkShowSystray->setChecked(pref.systrayIntegration());
|
||||
checkShowSplash->setChecked(!pref.isSlashScreenDisabled());
|
||||
if(!checkShowSystray->isChecked()) {
|
||||
disableSystrayOptions();
|
||||
} else {
|
||||
enableSystrayOptions();
|
||||
if(checkShowSystray->isChecked()) {
|
||||
checkCloseToSystray->setChecked(pref.closeToTray());
|
||||
checkMinimizeToSysTray->setChecked(pref.minimizeToTray());
|
||||
checkStartMinimized->setChecked(pref.startMinimized());
|
||||
|
@ -845,51 +835,10 @@ bool options_imp::useAdditionDialog() const{
|
|||
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(){
|
||||
applyButton->setEnabled(true);
|
||||
}
|
||||
|
||||
void options_imp::enableMaxRatio(bool checked){
|
||||
spinMaxRatio->setEnabled(checked);
|
||||
comboRatioLimitAct->setEnabled(checked);
|
||||
}
|
||||
|
||||
void options_imp::enableProxy(int index){
|
||||
if(index){
|
||||
//enable
|
||||
|
|
|
@ -57,10 +57,6 @@ public:
|
|||
protected slots:
|
||||
void enableProxy(int comboIndex);
|
||||
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 closeEvent(QCloseEvent *e);
|
||||
void on_buttonBox_rejected();
|
||||
|
@ -70,9 +66,6 @@ protected slots:
|
|||
void on_browseSaveDirButton_clicked();
|
||||
void on_browseTempDirButton_clicked();
|
||||
void enableApplyButton();
|
||||
void enableSystrayOptions();
|
||||
void disableSystrayOptions();
|
||||
void setSystrayOptionsState(bool checked);
|
||||
void changePage(QListWidgetItem*, QListWidgetItem*);
|
||||
void loadWindowState();
|
||||
void saveWindowState() const;
|
||||
|
|
Loading…
Reference in a new issue