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)
editHotkey = new QShortcut(QKeySequence("F2"), ui->content_tree, 0, 0, Qt::WidgetShortcut); editHotkey = new QShortcut(QKeySequence("F2"), ui->content_tree, 0, 0, Qt::WidgetShortcut);
connect(editHotkey, SIGNAL(activated()), SLOT(renameSelectedFile())); connect(editHotkey, SIGNAL(activated()), SLOT(renameSelectedFile()));
connect(ui->content_tree, SIGNAL(doubleClicked(QModelIndex)), SLOT(renameSelectedFile())); connect(ui->content_tree, SIGNAL(doubleClicked(QModelIndex)), SLOT(renameSelectedFile()));
ui->buttonBox->button(QDialogButtonBox::Ok)->setFocus();
} }
AddNewTorrentDialog::~AddNewTorrentDialog() AddNewTorrentDialog::~AddNewTorrentDialog()

3
src/gui/deletionconfirmationdlg.h

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

11
src/gui/mainwindow.cpp

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

Loading…
Cancel
Save