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);
move(misc::screenCenter(this));
checkPermDelete->setChecked(Preferences::deleteTorrentFilesAsDefault());
connect(checkPermDelete, SIGNAL(clicked()), this, SLOT(updateRememberButtonState()));
buttonBox->setFocus();
}
@ -60,6 +61,15 @@ class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg {
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

View file

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

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>399</width>
<height>143</height>
<width>463</width>
<height>152</height>
</rect>
</property>
<property name="sizePolicy">
@ -59,6 +59,31 @@
</item>
</layout>
</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>
<widget class="QCheckBox" name="checkPermDelete">
<property name="sizePolicy">
@ -73,10 +98,12 @@
</font>
</property>
<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>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="sizePolicy">
@ -97,7 +124,6 @@
</widget>
<resources>
<include location="../icons.qrc"/>
<include location="icons.qrc"/>
</resources>
<connections>
<connection>

View file

@ -240,16 +240,16 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>524</width>
<height>406</height>
<y>-24</y>
<width>506</width>
<height>430</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QGroupBox" name="UISettingsBox">
<property name="title">
<string>User interface</string>
<string>Visual Appearance</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
<property name="bottomMargin">
@ -338,20 +338,6 @@
</item>
</layout>
</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>
</widget>
</item>
@ -475,40 +461,47 @@
<item>
<widget class="QGroupBox" name="systrayBox">
<property name="title">
<string>System tray icon</string>
<string>Desktop</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<layout class="QVBoxLayout" name="verticalLayout_12">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="checkNoSystray">
<item>
<widget class="QCheckBox" name="checkShowSplash">
<property name="text">
<string>Disable system tray icon</string>
<string>Show splash screen on start up</string>
</property>
</widget>
</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">
<property name="text">
<string>Minimize to tray</string>
<string>Minimize qBittorrent to notification area</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<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 to tray</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="checkStartMinimized">
<property name="text">
<string>Start minimized</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>
@ -3089,10 +3082,8 @@ QGroupBox {
<tabstop>tabOption</tabstop>
<tabstop>comboI18n</tabstop>
<tabstop>comboStyle</tabstop>
<tabstop>checkNoSystray</tabstop>
<tabstop>checkCloseToSystray</tabstop>
<tabstop>checkMinimizeToSysTray</tabstop>
<tabstop>checkStartMinimized</tabstop>
<tabstop>textSavePath</tabstop>
<tabstop>browseSaveDirButton</tabstop>
<tabstop>checkPreallocateAll</tabstop>