Browse Source

Merge pull request #6185 from magao/issue5797

Ctrl+F search filter. Closes #5797.
adaptive-webui-19844
sledgehammer999 8 years ago committed by GitHub
parent
commit
e64b1f5ca1
  1. 29
      src/gui/mainwindow.cpp
  2. 1
      src/gui/mainwindow.h

29
src/gui/mainwindow.cpp

@ -118,7 +118,10 @@ namespace @@ -118,7 +118,10 @@ namespace
const QString KEY_DOWNLOAD_TRACKER_FAVICON = NOTIFICATIONS_SETTINGS_KEY("DownloadTrackerFavicon");
// just a shortcut
inline SettingsStorage *settings() { return SettingsStorage::instance(); }
inline SettingsStorage *settings()
{
return SettingsStorage::instance();
}
}
MainWindow::MainWindow(QWidget *parent)
@ -609,7 +612,6 @@ void MainWindow::displayRSSTab(bool enable) @@ -609,7 +612,6 @@ void MainWindow::displayRSSTab(bool enable)
else if (m_rssWidget) {
delete m_rssWidget;
}
}
void MainWindow::updateRSSTabLabel(int count)
@ -630,7 +632,12 @@ void MainWindow::displaySearchTab(bool enable) @@ -630,7 +632,12 @@ void MainWindow::displaySearchTab(bool enable)
else if (m_searchWidget) {
delete m_searchWidget;
}
}
void MainWindow::focusSearchFilter()
{
m_searchFilter->setFocus();
m_searchFilter->selectAll();
}
void MainWindow::updateNbTorrents()
@ -758,11 +765,12 @@ void MainWindow::createKeyboardShortcuts() @@ -758,11 +765,12 @@ void MainWindow::createKeyboardShortcuts()
connect(switchTransferShortcut, SIGNAL(activated()), this, SLOT(displayTransferTab()));
QShortcut *switchSearchShortcut = new QShortcut(QKeySequence("Alt+2"), this);
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);
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->actionOptions->setShortcut(QKeySequence("Alt+O"));
m_ui->actionStart->setShortcut(QKeySequence("Ctrl+S"));
@ -854,10 +862,9 @@ void MainWindow::on_actionSetGlobalDownloadLimit_triggered() @@ -854,10 +862,9 @@ void MainWindow::on_actionSetGlobalDownloadLimit_triggered()
void MainWindow::on_actionExit_triggered()
{
// UI locking enforcement.
if (isHidden() && m_uiLocked) {
if (isHidden() && m_uiLocked)
// Ask for UI lock password
if (!unlockUI()) return;
}
m_forceExit = true;
close();
@ -999,12 +1006,11 @@ void MainWindow::closeEvent(QCloseEvent *e) @@ -999,12 +1006,11 @@ void MainWindow::closeEvent(QCloseEvent *e)
m_forceExit = false;
return;
}
if (confirmBox.clickedButton() == alwaysBtn) {
if (confirmBox.clickedButton() == alwaysBtn)
// Remember choice
Preferences::instance()->setConfirmOnExit(false);
}
}
}
// abort search if any
if (m_searchWidget)
@ -1348,8 +1354,8 @@ void MainWindow::downloadFromURLList(const QStringList& urlList) @@ -1348,8 +1354,8 @@ void MainWindow::downloadFromURLList(const QStringList& urlList)
{
const bool useTorrentAdditionDialog = AddNewTorrentDialog::isEnabled();
foreach (QString url, urlList) {
if ((url.size() == 40 && !url.contains(QRegExp("[^0-9A-Fa-f]")))
|| (url.size() == 32 && !url.contains(QRegExp("[^2-7A-Za-z]"))))
if (((url.size() == 40) && !url.contains(QRegExp("[^0-9A-Fa-f]")))
|| ((url.size() == 32) && !url.contains(QRegExp("[^2-7A-Za-z]"))))
url = "magnet:?xt=urn:btih:" + url;
if (useTorrentAdditionDialog)
@ -1590,6 +1596,7 @@ void MainWindow::handleUpdateCheckFinished(bool updateAvailable, QString newVers @@ -1590,6 +1596,7 @@ void MainWindow::handleUpdateCheckFinished(bool updateAvailable, QString newVers
if (Preferences::instance()->isUpdateCheckEnabled() && (answer == QMessageBox::Yes))
m_programUpdateTimer->start();
}
#endif
void MainWindow::on_actionDonateMoney_triggered()
@ -1734,6 +1741,7 @@ void MainWindow::checkProgramUpdate() @@ -1734,6 +1741,7 @@ void MainWindow::checkProgramUpdate()
connect(updater, SIGNAL(updateCheckFinished(bool,QString,bool)), SLOT(handleUpdateCheckFinished(bool,QString,bool)));
updater->checkForUpdates();
}
#endif
#ifdef Q_OS_WIN
@ -1812,4 +1820,5 @@ void MainWindow::pythonDownloadFailure(const QString &url, const QString &error) @@ -1812,4 +1820,5 @@ void MainWindow::pythonDownloadFailure(const QString &url, const QString &error)
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));
}
#endif

1
src/gui/mainwindow.h

@ -126,6 +126,7 @@ private slots: @@ -126,6 +126,7 @@ private slots:
void displayTransferTab() const;
void displaySearchTab() const;
void displayRSSTab() const;
void focusSearchFilter();
void updateGUI();
void loadPreferences(bool configureSession = true);
void addUnauthenticatedTracker(const QPair<BitTorrent::TorrentHandle *, QString> &tracker);

Loading…
Cancel
Save