mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-13 00:33:09 -07:00
Started preferences simplifying
This commit is contained in:
parent
5e7cafb8c0
commit
e71f144c40
5 changed files with 37 additions and 46 deletions
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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue