1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-23 21:14:33 +00:00

Merge pull request #3092 from Chocobo1/focus_default

Change default focus button in various dialog, closes #3085
This commit is contained in:
sledgehammer999 2015-06-03 21:35:17 +03:00
commit 2b7c47c789
3 changed files with 10 additions and 6 deletions

View File

@ -87,6 +87,8 @@ AddNewTorrentDialog::AddNewTorrentDialog(QWidget *parent)
editHotkey = new QShortcut(QKeySequence("F2"), ui->content_tree, 0, 0, Qt::WidgetShortcut);
connect(editHotkey, SIGNAL(activated()), SLOT(renameSelectedFile()));
connect(ui->content_tree, SIGNAL(doubleClicked(QModelIndex)), SLOT(renameSelectedFile()));
ui->buttonBox->button(QDialogButtonBox::Ok)->setFocus();
}
AddNewTorrentDialog::~AddNewTorrentDialog()

View File

@ -32,6 +32,7 @@
#define DELETIONCONFIRMATIONDLG_H
#include <QDialog>
#include <QPushButton>
#include "ui_confirmdeletiondlg.h"
#include "preferences.h"
#include "iconprovider.h"
@ -55,7 +56,7 @@ class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg {
move(misc::screenCenter(this));
checkPermDelete->setChecked(Preferences::instance()->deleteTorrentFilesAsDefault());
connect(checkPermDelete, SIGNAL(clicked()), this, SLOT(updateRememberButtonState()));
buttonBox->setFocus();
buttonBox->button(QDialogButtonBox::Cancel)->setFocus();
}
bool shouldDeleteLocalFiles() const {

View File

@ -911,10 +911,10 @@ void MainWindow::closeEvent(QCloseEvent *e)
QMessageBox confirmBox(QMessageBox::Question, tr("Exiting qBittorrent"),
tr("Some files are currently transferring.\nAre you sure you want to quit qBittorrent?"),
QMessageBox::NoButton, this);
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);
QPushButton *noBtn = confirmBox.addButton(tr("&No"), QMessageBox::NoRole);
QPushButton *yesBtn = confirmBox.addButton(tr("&Yes"), QMessageBox::YesRole);
QPushButton *alwaysBtn = confirmBox.addButton(tr("&Always Yes"), QMessageBox::YesRole);
confirmBox.setDefaultButton(noBtn);
confirmBox.exec();
if (!confirmBox.clickedButton() || confirmBox.clickedButton() == noBtn) {
// Cancel exit
@ -922,9 +922,10 @@ void MainWindow::closeEvent(QCloseEvent *e)
force_exit = false;
return;
}
if (confirmBox.clickedButton() == alwaysBtn)
if (confirmBox.clickedButton() == alwaysBtn) {
// Remember choice
Preferences::instance()->setConfirmOnExit(false);
}
}
}