Browse Source

Merge pull request #3092 from Chocobo1/focus_default

Change default focus button in various dialog, closes #3085
adaptive-webui-19844
sledgehammer999 10 years ago
parent
commit
2b7c47c789
  1. 2
      src/gui/addnewtorrentdialog.cpp
  2. 3
      src/gui/deletionconfirmationdlg.h
  3. 11
      src/gui/mainwindow.cpp

2
src/gui/addnewtorrentdialog.cpp

@ -87,6 +87,8 @@ AddNewTorrentDialog::AddNewTorrentDialog(QWidget *parent) @@ -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()

3
src/gui/deletionconfirmationdlg.h

@ -32,6 +32,7 @@ @@ -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 { @@ -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 {

11
src/gui/mainwindow.cpp

@ -911,10 +911,10 @@ void MainWindow::closeEvent(QCloseEvent *e) @@ -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) @@ -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);
}
}
}

Loading…
Cancel
Save