Preferences code clean up

This commit is contained in:
Christophe Dumez 2011-04-11 16:56:33 +00:00
parent 851a677a48
commit f5d4404b67
3 changed files with 158 additions and 136 deletions

View file

@ -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,15 +378,14 @@
</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"> <property name="text">
@ -447,6 +446,9 @@
</item> </item>
</layout> </layout>
</item> </item>
</layout>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="checkProgramExitConfirm"> <widget class="QCheckBox" name="checkProgramExitConfirm">
<property name="text"> <property name="text">
@ -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>

View file

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

View file

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