mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 13:23:34 -07:00
Merge pull request #6185 from magao/issue5797
Ctrl+F search filter. Closes #5797.
This commit is contained in:
commit
e64b1f5ca1
2 changed files with 80 additions and 70 deletions
|
@ -118,7 +118,10 @@ namespace
|
||||||
const QString KEY_DOWNLOAD_TRACKER_FAVICON = NOTIFICATIONS_SETTINGS_KEY("DownloadTrackerFavicon");
|
const QString KEY_DOWNLOAD_TRACKER_FAVICON = NOTIFICATIONS_SETTINGS_KEY("DownloadTrackerFavicon");
|
||||||
|
|
||||||
// just a shortcut
|
// just a shortcut
|
||||||
inline SettingsStorage *settings() { return SettingsStorage::instance(); }
|
inline SettingsStorage *settings()
|
||||||
|
{
|
||||||
|
return SettingsStorage::instance();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
|
@ -609,7 +612,6 @@ void MainWindow::displayRSSTab(bool enable)
|
||||||
else if (m_rssWidget) {
|
else if (m_rssWidget) {
|
||||||
delete m_rssWidget;
|
delete m_rssWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateRSSTabLabel(int count)
|
void MainWindow::updateRSSTabLabel(int count)
|
||||||
|
@ -630,7 +632,12 @@ void MainWindow::displaySearchTab(bool enable)
|
||||||
else if (m_searchWidget) {
|
else if (m_searchWidget) {
|
||||||
delete m_searchWidget;
|
delete m_searchWidget;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::focusSearchFilter()
|
||||||
|
{
|
||||||
|
m_searchFilter->setFocus();
|
||||||
|
m_searchFilter->selectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateNbTorrents()
|
void MainWindow::updateNbTorrents()
|
||||||
|
@ -758,11 +765,12 @@ void MainWindow::createKeyboardShortcuts()
|
||||||
connect(switchTransferShortcut, SIGNAL(activated()), this, SLOT(displayTransferTab()));
|
connect(switchTransferShortcut, SIGNAL(activated()), this, SLOT(displayTransferTab()));
|
||||||
QShortcut *switchSearchShortcut = new QShortcut(QKeySequence("Alt+2"), this);
|
QShortcut *switchSearchShortcut = new QShortcut(QKeySequence("Alt+2"), this);
|
||||||
connect(switchSearchShortcut, SIGNAL(activated()), this, SLOT(displaySearchTab()));
|
connect(switchSearchShortcut, SIGNAL(activated()), this, SLOT(displaySearchTab()));
|
||||||
QShortcut *switchSearchShortcut2 = new QShortcut(QKeySequence::Find, this);
|
|
||||||
connect(switchSearchShortcut2, SIGNAL(activated()), this, SLOT(displaySearchTab()));
|
|
||||||
QShortcut *switchRSSShortcut = new QShortcut(QKeySequence("Alt+3"), this);
|
QShortcut *switchRSSShortcut = new QShortcut(QKeySequence("Alt+3"), this);
|
||||||
connect(switchRSSShortcut, SIGNAL(activated()), this, SLOT(displayRSSTab()));
|
connect(switchRSSShortcut, SIGNAL(activated()), this, SLOT(displayRSSTab()));
|
||||||
|
|
||||||
|
QShortcut *switchSearchFilterShortcut = new QShortcut(QKeySequence::Find, this);
|
||||||
|
connect(switchSearchFilterShortcut, SIGNAL(activated()), this, SLOT(focusSearchFilter()));
|
||||||
|
|
||||||
m_ui->actionDocumentation->setShortcut(QKeySequence::HelpContents);
|
m_ui->actionDocumentation->setShortcut(QKeySequence::HelpContents);
|
||||||
m_ui->actionOptions->setShortcut(QKeySequence("Alt+O"));
|
m_ui->actionOptions->setShortcut(QKeySequence("Alt+O"));
|
||||||
m_ui->actionStart->setShortcut(QKeySequence("Ctrl+S"));
|
m_ui->actionStart->setShortcut(QKeySequence("Ctrl+S"));
|
||||||
|
@ -854,10 +862,9 @@ void MainWindow::on_actionSetGlobalDownloadLimit_triggered()
|
||||||
void MainWindow::on_actionExit_triggered()
|
void MainWindow::on_actionExit_triggered()
|
||||||
{
|
{
|
||||||
// UI locking enforcement.
|
// UI locking enforcement.
|
||||||
if (isHidden() && m_uiLocked) {
|
if (isHidden() && m_uiLocked)
|
||||||
// Ask for UI lock password
|
// Ask for UI lock password
|
||||||
if (!unlockUI()) return;
|
if (!unlockUI()) return;
|
||||||
}
|
|
||||||
|
|
||||||
m_forceExit = true;
|
m_forceExit = true;
|
||||||
close();
|
close();
|
||||||
|
@ -999,12 +1006,11 @@ void MainWindow::closeEvent(QCloseEvent *e)
|
||||||
m_forceExit = false;
|
m_forceExit = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (confirmBox.clickedButton() == alwaysBtn) {
|
if (confirmBox.clickedButton() == alwaysBtn)
|
||||||
// Remember choice
|
// Remember choice
|
||||||
Preferences::instance()->setConfirmOnExit(false);
|
Preferences::instance()->setConfirmOnExit(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// abort search if any
|
// abort search if any
|
||||||
if (m_searchWidget)
|
if (m_searchWidget)
|
||||||
|
@ -1348,8 +1354,8 @@ void MainWindow::downloadFromURLList(const QStringList& urlList)
|
||||||
{
|
{
|
||||||
const bool useTorrentAdditionDialog = AddNewTorrentDialog::isEnabled();
|
const bool useTorrentAdditionDialog = AddNewTorrentDialog::isEnabled();
|
||||||
foreach (QString url, urlList) {
|
foreach (QString url, urlList) {
|
||||||
if ((url.size() == 40 && !url.contains(QRegExp("[^0-9A-Fa-f]")))
|
if (((url.size() == 40) && !url.contains(QRegExp("[^0-9A-Fa-f]")))
|
||||||
|| (url.size() == 32 && !url.contains(QRegExp("[^2-7A-Za-z]"))))
|
|| ((url.size() == 32) && !url.contains(QRegExp("[^2-7A-Za-z]"))))
|
||||||
url = "magnet:?xt=urn:btih:" + url;
|
url = "magnet:?xt=urn:btih:" + url;
|
||||||
|
|
||||||
if (useTorrentAdditionDialog)
|
if (useTorrentAdditionDialog)
|
||||||
|
@ -1590,6 +1596,7 @@ void MainWindow::handleUpdateCheckFinished(bool updateAvailable, QString newVers
|
||||||
if (Preferences::instance()->isUpdateCheckEnabled() && (answer == QMessageBox::Yes))
|
if (Preferences::instance()->isUpdateCheckEnabled() && (answer == QMessageBox::Yes))
|
||||||
m_programUpdateTimer->start();
|
m_programUpdateTimer->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void MainWindow::on_actionDonateMoney_triggered()
|
void MainWindow::on_actionDonateMoney_triggered()
|
||||||
|
@ -1734,6 +1741,7 @@ void MainWindow::checkProgramUpdate()
|
||||||
connect(updater, SIGNAL(updateCheckFinished(bool,QString,bool)), SLOT(handleUpdateCheckFinished(bool,QString,bool)));
|
connect(updater, SIGNAL(updateCheckFinished(bool,QString,bool)), SLOT(handleUpdateCheckFinished(bool,QString,bool)));
|
||||||
updater->checkForUpdates();
|
updater->checkForUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
@ -1812,4 +1820,5 @@ void MainWindow::pythonDownloadFailure(const QString &url, const QString &error)
|
||||||
setCursor(QCursor(Qt::ArrowCursor));
|
setCursor(QCursor(Qt::ArrowCursor));
|
||||||
QMessageBox::warning(this, tr("Download error"), tr("Python setup could not be downloaded, reason: %1.\nPlease install it manually.").arg(error));
|
QMessageBox::warning(this, tr("Download error"), tr("Python setup could not be downloaded, reason: %1.\nPlease install it manually.").arg(error));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -126,6 +126,7 @@ private slots:
|
||||||
void displayTransferTab() const;
|
void displayTransferTab() const;
|
||||||
void displaySearchTab() const;
|
void displaySearchTab() const;
|
||||||
void displayRSSTab() const;
|
void displayRSSTab() const;
|
||||||
|
void focusSearchFilter();
|
||||||
void updateGUI();
|
void updateGUI();
|
||||||
void loadPreferences(bool configureSession = true);
|
void loadPreferences(bool configureSession = true);
|
||||||
void addUnauthenticatedTracker(const QPair<BitTorrent::TorrentHandle *, QString> &tracker);
|
void addUnauthenticatedTracker(const QPair<BitTorrent::TorrentHandle *, QString> &tracker);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue