Still simplifying program options

This commit is contained in:
Christophe Dumez 2010-06-21 19:20:58 +00:00
parent 8b5886cc6e
commit 08a08e4b24
4 changed files with 1365 additions and 1341 deletions

View file

@ -44,6 +44,7 @@ class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg {
setupUi(this); setupUi(this);
move(misc::screenCenter(this)); move(misc::screenCenter(this));
checkPermDelete->setChecked(Preferences::deleteTorrentFilesAsDefault()); checkPermDelete->setChecked(Preferences::deleteTorrentFilesAsDefault());
connect(checkPermDelete, SIGNAL(clicked()), this, SLOT(updateRememberButtonState()));
buttonBox->setFocus(); buttonBox->setFocus();
} }
@ -60,6 +61,15 @@ class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg {
return false; return false;
} }
private slots:
void updateRememberButtonState() {
rememberBtn->setEnabled(checkPermDelete->isChecked() != Preferences::deleteTorrentFilesAsDefault());
}
void on_rememberBtn_clicked() {
Preferences::setDeleteTorrentFilesAsDefault(checkPermDelete->isChecked());
rememberBtn->setEnabled(false);
}
}; };
#endif // DELETIONCONFIRMATIONDLG_H #endif // DELETIONCONFIRMATIONDLG_H

View file

@ -155,12 +155,12 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
#else #else
if(!QSystemTrayIcon::isSystemTrayAvailable()){ if(!QSystemTrayIcon::isSystemTrayAvailable()){
#endif #endif
checkNoSystray->setChecked(true); checkShowSystray->setChecked(false);
checkNoSystray->setEnabled(false); checkShowSystray->setEnabled(false);
} }
// Connect signals / slots // Connect signals / slots
// General tab // General tab
connect(checkNoSystray, SIGNAL(toggled(bool)), this, SLOT(setSystrayOptionsState(bool))); connect(checkShowSystray, SIGNAL(toggled(bool)), this, SLOT(setSystrayOptionsState(bool)));
// Downloads tab // Downloads tab
connect(checkTempFolder, SIGNAL(toggled(bool)), this, SLOT(enableTempPathInput(bool))); connect(checkTempFolder, SIGNAL(toggled(bool)), this, SLOT(enableTempPathInput(bool)));
connect(checkExportDir, SIGNAL(toggled(bool)), this, SLOT(enableTorrentExport(bool))); connect(checkExportDir, SIGNAL(toggled(bool)), this, SLOT(enableTorrentExport(bool)));
@ -194,12 +194,11 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
connect(comboI18n, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton())); connect(comboI18n, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
connect(comboStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton())); connect(comboStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
connect(checkAltRowColors, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkAltRowColors, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkNoSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkShowSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkCloseToSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkCloseToSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkMinimizeToSysTray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkMinimizeToSysTray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkStartMinimized, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkStartMinimized, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkNoSplash, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkShowSplash, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkDeleteTorrentFiles, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
// Downloads tab // Downloads tab
connect(textSavePath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton())); connect(textSavePath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkAppendLabel, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkAppendLabel, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
@ -379,7 +378,6 @@ void options_imp::saveOptions(){
settings.setValue(QString::fromUtf8("MinimizeToTray"), minimizeToTray()); settings.setValue(QString::fromUtf8("MinimizeToTray"), minimizeToTray());
settings.setValue(QString::fromUtf8("StartMinimized"), startMinimized()); settings.setValue(QString::fromUtf8("StartMinimized"), startMinimized());
settings.setValue(QString::fromUtf8("NoSplashScreen"), isSlashScreenDisabled()); settings.setValue(QString::fromUtf8("NoSplashScreen"), isSlashScreenDisabled());
Preferences::setDeleteTorrentFilesAsDefault(checkDeleteTorrentFiles->isChecked());
// End General preferences // End General preferences
settings.endGroup(); settings.endGroup();
// Downloads preferences // Downloads preferences
@ -601,10 +599,9 @@ void options_imp::loadOptions(){
setLocale(Preferences::getLocale()); setLocale(Preferences::getLocale());
setStyle(Preferences::getStyle()); setStyle(Preferences::getStyle());
checkAltRowColors->setChecked(Preferences::useAlternatingRowColors()); checkAltRowColors->setChecked(Preferences::useAlternatingRowColors());
checkNoSystray->setChecked(!Preferences::systrayIntegration()); checkShowSystray->setChecked(Preferences::systrayIntegration());
checkNoSplash->setChecked(Preferences::isSlashScreenDisabled()); checkShowSplash->setChecked(!Preferences::isSlashScreenDisabled());
checkDeleteTorrentFiles->setChecked(Preferences::deleteTorrentFilesAsDefault()); if(!checkShowSystray->isChecked()) {
if(checkNoSystray->isChecked()) {
disableSystrayOptions(); disableSystrayOptions();
} else { } else {
enableSystrayOptions(); enableSystrayOptions();
@ -952,12 +949,12 @@ int options_imp::getMaxActiveTorrents() const {
} }
bool options_imp::minimizeToTray() const{ bool options_imp::minimizeToTray() const{
if(checkNoSystray->isChecked()) return false; if(!checkShowSystray->isChecked()) return false;
return checkMinimizeToSysTray->isChecked(); return checkMinimizeToSysTray->isChecked();
} }
bool options_imp::closeToTray() const{ bool options_imp::closeToTray() const{
if(checkNoSystray->isChecked()) return false; if(!checkShowSystray->isChecked()) return false;
return checkCloseToSystray->isChecked(); return checkCloseToSystray->isChecked();
} }
@ -1008,7 +1005,7 @@ bool options_imp::systrayIntegration() const{
return false; return false;
#endif #endif
if (!QSystemTrayIcon::isSystemTrayAvailable()) return false; if (!QSystemTrayIcon::isSystemTrayAvailable()) return false;
return (!checkNoSystray->isChecked()); return checkShowSystray->isChecked();
} }
int options_imp::getDHTPort() const { int options_imp::getDHTPort() const {
@ -1161,9 +1158,9 @@ void options_imp::disableSystrayOptions() {
void options_imp::setSystrayOptionsState(bool checked) { void options_imp::setSystrayOptionsState(bool checked) {
if(checked) { if(checked) {
disableSystrayOptions();
} else {
enableSystrayOptions(); enableSystrayOptions();
} else {
disableSystrayOptions();
} }
} }
@ -1273,7 +1270,7 @@ void options_imp::enableTorrentExport(bool checked) {
} }
bool options_imp::isSlashScreenDisabled() const { bool options_imp::isSlashScreenDisabled() const {
return checkNoSplash->isChecked(); return !checkShowSplash->isChecked();
} }
bool options_imp::preAllocateAllFiles() const { bool options_imp::preAllocateAllFiles() const {

View file

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>399</width> <width>463</width>
<height>143</height> <height>152</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -59,6 +59,31 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QToolButton" name="rememberBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Remember choice</string>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/Icons/oxygen/encrypted.png</normaloff>:/Icons/oxygen/encrypted.png</iconset>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>18</height>
</size>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="checkPermDelete"> <widget class="QCheckBox" name="checkPermDelete">
<property name="sizePolicy"> <property name="sizePolicy">
@ -73,10 +98,12 @@
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>Delete the files on the hard disk as well</string> <string>Also delete the files on the hard disk</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout>
</item>
<item> <item>
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="sizePolicy"> <property name="sizePolicy">
@ -97,7 +124,6 @@
</widget> </widget>
<resources> <resources>
<include location="../icons.qrc"/> <include location="../icons.qrc"/>
<include location="icons.qrc"/>
</resources> </resources>
<connections> <connections>
<connection> <connection>

View file

@ -240,16 +240,16 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>-24</y>
<width>524</width> <width>506</width>
<height>406</height> <height>430</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_9"> <layout class="QVBoxLayout" name="verticalLayout_9">
<item> <item>
<widget class="QGroupBox" name="UISettingsBox"> <widget class="QGroupBox" name="UISettingsBox">
<property name="title"> <property name="title">
<string>User interface</string> <string>Visual Appearance</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_8"> <layout class="QVBoxLayout" name="verticalLayout_8">
<property name="bottomMargin"> <property name="bottomMargin">
@ -338,20 +338,6 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QCheckBox" name="checkNoSplash">
<property name="text">
<string>Disable splash screen</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkDeleteTorrentFiles">
<property name="text">
<string>On torrent deletion, also delete files on hard disk as a default</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -475,40 +461,47 @@
<item> <item>
<widget class="QGroupBox" name="systrayBox"> <widget class="QGroupBox" name="systrayBox">
<property name="title"> <property name="title">
<string>System tray icon</string> <string>Desktop</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_12">
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0"> <item>
<widget class="QCheckBox" name="checkNoSystray"> <widget class="QCheckBox" name="checkShowSplash">
<property name="text"> <property name="text">
<string>Disable system tray icon</string> <string>Show splash screen on start up</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item>
<widget class="QCheckBox" name="checkStartMinimized">
<property name="text">
<string>Start qBittorrent minimized</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkShowSystray">
<property name="text">
<string>Show qBittorrent icon in notification area</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkMinimizeToSysTray"> <widget class="QCheckBox" name="checkMinimizeToSysTray">
<property name="text"> <property name="text">
<string>Minimize to tray</string> <string>Minimize qBittorrent to notification area</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>false</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item>
<widget class="QCheckBox" name="checkCloseToSystray"> <widget class="QCheckBox" name="checkCloseToSystray">
<property name="text"> <property name="text">
<string comment="i.e: The systray tray icon will still be visible when closing the main window.">Close to tray</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>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="checkStartMinimized">
<property name="text">
<string>Start minimized</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -3089,10 +3082,8 @@ QGroupBox {
<tabstop>tabOption</tabstop> <tabstop>tabOption</tabstop>
<tabstop>comboI18n</tabstop> <tabstop>comboI18n</tabstop>
<tabstop>comboStyle</tabstop> <tabstop>comboStyle</tabstop>
<tabstop>checkNoSystray</tabstop>
<tabstop>checkCloseToSystray</tabstop> <tabstop>checkCloseToSystray</tabstop>
<tabstop>checkMinimizeToSysTray</tabstop> <tabstop>checkMinimizeToSysTray</tabstop>
<tabstop>checkStartMinimized</tabstop>
<tabstop>textSavePath</tabstop> <tabstop>textSavePath</tabstop>
<tabstop>browseSaveDirButton</tabstop> <tabstop>browseSaveDirButton</tabstop>
<tabstop>checkPreallocateAll</tabstop> <tabstop>checkPreallocateAll</tabstop>