Browse Source

Preferences code clean up

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
f5d4404b67
  1. 124
      src/preferences/options.ui
  2. 53
      src/preferences/options_imp.cpp
  3. 7
      src/preferences/options_imp.h

124
src/preferences/options.ui

@ -170,9 +170,9 @@ @@ -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,15 +378,14 @@ @@ -378,15 +378,14 @@
</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>
<layout class="QVBoxLayout" name="verticalLayout_22">
<item>
<widget class="QCheckBox" name="checkMinimizeToSysTray">
<property name="text">
@ -447,6 +446,9 @@ @@ -447,6 +446,9 @@
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkProgramExitConfirm">
<property name="text">
@ -506,8 +508,8 @@ @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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 { @@ -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>

53
src/preferences/options_imp.cpp

@ -111,13 +111,6 @@ options_imp::options_imp(QWidget *parent): @@ -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(){ @@ -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{ @@ -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

7
src/preferences/options_imp.h

@ -57,10 +57,6 @@ public: @@ -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: @@ -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…
Cancel
Save