mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-03-09 20:01:08 +00:00
Started preferences simplifying
This commit is contained in:
parent
5e7cafb8c0
commit
e71f144c40
25
src/GUI.cpp
25
src/GUI.cpp
@ -548,24 +548,30 @@ void GUI::closeEvent(QCloseEvent *e) {
|
||||
const bool goToSystrayOnExit = settings.value(QString::fromUtf8("Preferences/General/CloseToTray"), false).toBool();
|
||||
if(!force_exit && systrayIcon && goToSystrayOnExit && !this->isHidden()) {
|
||||
hide();
|
||||
//e->ignore();
|
||||
e->accept();
|
||||
return;
|
||||
}
|
||||
if(settings.value(QString::fromUtf8("Preferences/General/ExitConfirm"), true).toBool() && BTSession->hasActiveTorrents()) {
|
||||
show();
|
||||
if(!isMaximized())
|
||||
showNormal();
|
||||
if(e->spontaneous() || force_exit) {
|
||||
if(QMessageBox::question(this,
|
||||
tr("Are you sure you want to quit?")+QString::fromUtf8(" -- ")+tr("qBittorrent"),
|
||||
tr("Some files are currently transferring.\nAre you sure you want to quit qBittorrent?"),
|
||||
tr("&Yes"), tr("&No"),
|
||||
QString(), 0, 1)) {
|
||||
if(!isVisible())
|
||||
show();
|
||||
QMessageBox confirmBox(QMessageBox::Question, tr("Are you sure you want to quit?")+QString::fromUtf8(" -- ")+tr("qBittorrent"),
|
||||
tr("Some files are currently transferring.\nAre you sure you want to quit qBittorrent?"));
|
||||
QPushButton *noBtn = confirmBox.addButton(tr("No"), QMessageBox::NoRole);
|
||||
QPushButton *yesBtn = confirmBox.addButton(tr("Yes"), QMessageBox::YesRole);
|
||||
QPushButton *alwaysBtn = confirmBox.addButton(tr("Always"), QMessageBox::YesRole);
|
||||
confirmBox.setDefaultButton(yesBtn);
|
||||
confirmBox.exec();
|
||||
if(!confirmBox.clickedButton() || confirmBox.clickedButton() == noBtn) {
|
||||
// Cancel exit
|
||||
e->ignore();
|
||||
force_exit = false;
|
||||
return;
|
||||
}
|
||||
if(confirmBox.clickedButton() == alwaysBtn) {
|
||||
// Remember choice
|
||||
Preferences::setConfirmOnExit(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
hide();
|
||||
@ -580,7 +586,6 @@ void GUI::closeEvent(QCloseEvent *e) {
|
||||
qApp->exit();
|
||||
}
|
||||
|
||||
|
||||
// Display window to create a torrent
|
||||
void GUI::on_actionCreate_torrent_triggered() {
|
||||
if(createTorrentDlg) {
|
||||
|
@ -193,7 +193,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
||||
// General tab
|
||||
connect(comboI18n, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
|
||||
connect(comboStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(enableApplyButton()));
|
||||
connect(checkConfirmExit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(checkSpeedInTitle, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(checkAltRowColors, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(checkNoSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
@ -386,7 +385,6 @@ void options_imp::saveOptions(){
|
||||
settings.beginGroup("General");
|
||||
settings.setValue(QString::fromUtf8("Locale"), getLocale());
|
||||
settings.setValue(QString::fromUtf8("Style"), getStyle());
|
||||
settings.setValue(QString::fromUtf8("ExitConfirm"), confirmOnExit());
|
||||
settings.setValue(QString::fromUtf8("SpeedInTitleBar"), speedInTitleBar());
|
||||
settings.setValue(QString::fromUtf8("AlternatingRowColors"), checkAltRowColors->isChecked());
|
||||
settings.setValue(QString::fromUtf8("SystrayEnabled"), systrayIntegration());
|
||||
@ -617,7 +615,6 @@ void options_imp::loadOptions(){
|
||||
// General preferences
|
||||
setLocale(Preferences::getLocale());
|
||||
setStyle(Preferences::getStyle());
|
||||
checkConfirmExit->setChecked(Preferences::confirmOnExit());
|
||||
checkSpeedInTitle->setChecked(Preferences::speedInTitleBar());
|
||||
checkAltRowColors->setChecked(Preferences::useAlternatingRowColors());
|
||||
checkNoSystray->setChecked(!Preferences::systrayIntegration());
|
||||
@ -982,10 +979,6 @@ bool options_imp::closeToTray() const{
|
||||
return checkCloseToSystray->isChecked();
|
||||
}
|
||||
|
||||
bool options_imp::confirmOnExit() const{
|
||||
return checkConfirmExit->isChecked();
|
||||
}
|
||||
|
||||
bool options_imp::isQueueingSystemEnabled() const {
|
||||
return checkEnableQueueing->isChecked();
|
||||
}
|
||||
|
@ -67,7 +67,6 @@ protected:
|
||||
// General options
|
||||
QString getLocale() const;
|
||||
QString getStyle() const;
|
||||
bool confirmOnExit() const;
|
||||
bool speedInTitleBar() const;
|
||||
bool systrayIntegration() const;
|
||||
bool minimizeToTray() const;
|
||||
|
@ -87,6 +87,11 @@ public:
|
||||
settings.setValue(QString::fromUtf8("Preferences/General/DeleteTorrentsFilesAsDefault"), del);
|
||||
}
|
||||
|
||||
static void setConfirmOnExit(bool confirm) {
|
||||
QSettings settings("qBittorrent", "qBittorrent");
|
||||
settings.setValue(QString::fromUtf8("Preferences/General/ExitConfirm"), confirm);
|
||||
}
|
||||
|
||||
static bool confirmOnExit() {
|
||||
QSettings settings("qBittorrent", "qBittorrent");
|
||||
return settings.value(QString::fromUtf8("Preferences/General/ExitConfirm"), true).toBool();
|
||||
|
@ -242,7 +242,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>506</width>
|
||||
<height>571</height>
|
||||
<height>543</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
@ -335,16 +335,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkConfirmExit">
|
||||
<property name="text">
|
||||
<string>Ask for confirmation on exit when download list is not empty</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkDisplayToolbar">
|
||||
<property name="text">
|
||||
@ -571,7 +561,7 @@ QGroupBox {
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-298</y>
|
||||
<y>0</y>
|
||||
<width>632</width>
|
||||
<height>686</height>
|
||||
</rect>
|
||||
@ -1116,8 +1106,8 @@ QGroupBox {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>524</width>
|
||||
<height>398</height>
|
||||
<width>447</width>
|
||||
<height>288</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_28">
|
||||
@ -1361,8 +1351,8 @@ QGroupBox {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>524</width>
|
||||
<height>406</height>
|
||||
<width>364</width>
|
||||
<height>328</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_33">
|
||||
@ -1776,7 +1766,7 @@ QGroupBox {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>506</width>
|
||||
<width>459</width>
|
||||
<height>407</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -2193,8 +2183,8 @@ QGroupBox {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>524</width>
|
||||
<height>406</height>
|
||||
<width>475</width>
|
||||
<height>308</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_16">
|
||||
@ -2627,8 +2617,8 @@ QGroupBox {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>524</width>
|
||||
<height>406</height>
|
||||
<width>287</width>
|
||||
<height>124</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_21">
|
||||
@ -2724,8 +2714,8 @@ QGroupBox {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>524</width>
|
||||
<height>406</height>
|
||||
<width>213</width>
|
||||
<height>221</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_23">
|
||||
@ -2891,8 +2881,8 @@ QGroupBox {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>524</width>
|
||||
<height>406</height>
|
||||
<width>445</width>
|
||||
<height>192</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_24">
|
||||
@ -3066,8 +3056,8 @@ QGroupBox {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>524</width>
|
||||
<height>406</height>
|
||||
<width>98</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_36"/>
|
||||
@ -3115,7 +3105,6 @@ QGroupBox {
|
||||
<tabstop>tabOption</tabstop>
|
||||
<tabstop>comboI18n</tabstop>
|
||||
<tabstop>comboStyle</tabstop>
|
||||
<tabstop>checkConfirmExit</tabstop>
|
||||
<tabstop>checkSpeedInTitle</tabstop>
|
||||
<tabstop>checkNoSystray</tabstop>
|
||||
<tabstop>checkCloseToSystray</tabstop>
|
||||
|
Loading…
x
Reference in New Issue
Block a user