Started preferences simplifying

This commit is contained in:
Christophe Dumez 2010-06-21 15:53:42 +00:00
parent 5e7cafb8c0
commit e71f144c40
5 changed files with 37 additions and 46 deletions

View file

@ -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) {