mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-14 01:03:08 -07:00
- Made search engine use libnotify instead of qt notification when available. Note that a notification is displayed when a search request has finished and the search tab is not currently displayed (other tab is displayed or window is minimized/iconified)
This commit is contained in:
parent
507b9b149e
commit
17f712e3e0
3 changed files with 10 additions and 11 deletions
|
@ -144,7 +144,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
|
||||||
connect(actionDecreasePriority, SIGNAL(triggered()), transferList, SLOT(decreasePrioSelectedTorrents()));
|
connect(actionDecreasePriority, SIGNAL(triggered()), transferList, SLOT(decreasePrioSelectedTorrents()));
|
||||||
|
|
||||||
// Search engine tab
|
// Search engine tab
|
||||||
searchEngine = new SearchEngine(BTSession, systrayIcon);
|
searchEngine = new SearchEngine(this, BTSession);
|
||||||
tabs->addTab(searchEngine, QIcon(QString::fromUtf8(":/Icons/oxygen/edit-find.png")), tr("Search"));
|
tabs->addTab(searchEngine, QIcon(QString::fromUtf8(":/Icons/oxygen/edit-find.png")), tr("Search"));
|
||||||
|
|
||||||
// Configure BT session according to options
|
// Configure BT session according to options
|
||||||
|
@ -429,7 +429,7 @@ void GUI::previewFile(QString filePath) {
|
||||||
QDesktopServices::openUrl(QString("file://")+filePath);
|
QDesktopServices::openUrl(QString("file://")+filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GUI::getCurrentTabIndex() const{
|
int GUI::getCurrentTabIndex() const {
|
||||||
if(isMinimized() || !isVisible())
|
if(isMinimized() || !isVisible())
|
||||||
return -1;
|
return -1;
|
||||||
return tabs->currentIndex();
|
return tabs->currentIndex();
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include <QCompleter>
|
#include <QCompleter>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QSystemTrayIcon>
|
|
||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -49,11 +48,12 @@
|
||||||
#include "downloadthread.h"
|
#include "downloadthread.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "searchlistdelegate.h"
|
#include "searchlistdelegate.h"
|
||||||
|
#include "GUI.h"
|
||||||
|
|
||||||
#define SEARCHHISTORY_MAXSIZE 50
|
#define SEARCHHISTORY_MAXSIZE 50
|
||||||
|
|
||||||
/*SEARCH ENGINE START*/
|
/*SEARCH ENGINE START*/
|
||||||
SearchEngine::SearchEngine(Bittorrent *BTSession, QSystemTrayIcon *systrayIcon) : QWidget(), BTSession(BTSession), systrayIcon(systrayIcon) {
|
SearchEngine::SearchEngine(GUI *parent, Bittorrent *BTSession) : QWidget(parent), BTSession(BTSession), parent(parent) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
// new qCompleter to the search pattern
|
// new qCompleter to the search pattern
|
||||||
startSearchHistory();
|
startSearchHistory();
|
||||||
|
@ -428,8 +428,8 @@ void SearchEngine::updateNova() {
|
||||||
void SearchEngine::searchFinished(int exitcode,QProcess::ExitStatus){
|
void SearchEngine::searchFinished(int exitcode,QProcess::ExitStatus){
|
||||||
QSettings settings("qBittorrent", "qBittorrent");
|
QSettings settings("qBittorrent", "qBittorrent");
|
||||||
bool useNotificationBalloons = settings.value("Preferences/General/NotificationBaloons", true).toBool();
|
bool useNotificationBalloons = settings.value("Preferences/General/NotificationBaloons", true).toBool();
|
||||||
if(systrayIcon && useNotificationBalloons) {
|
if(useNotificationBalloons && parent->getCurrentTabIndex() != TAB_SEARCH) {
|
||||||
systrayIcon->showMessage(tr("Search Engine"), tr("Search has finished"), QSystemTrayIcon::Information, TIME_TRAY_BALLOON);
|
parent->showNotificationBaloon(tr("Search Engine"), tr("Search has finished"));
|
||||||
}
|
}
|
||||||
if(exitcode){
|
if(exitcode){
|
||||||
search_status->setText(tr("An error occured during search..."));
|
search_status->setText(tr("An error occured during search..."));
|
||||||
|
|
|
@ -31,8 +31,6 @@
|
||||||
#ifndef SEARCH_H
|
#ifndef SEARCH_H
|
||||||
#define SEARCH_H
|
#define SEARCH_H
|
||||||
|
|
||||||
#define TIME_TRAY_BALLOON 5000
|
|
||||||
|
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
|
@ -44,10 +42,10 @@
|
||||||
#include "supportedengines.h"
|
#include "supportedengines.h"
|
||||||
|
|
||||||
class Bittorrent;
|
class Bittorrent;
|
||||||
class QSystemTrayIcon;
|
|
||||||
class downloadThread;
|
class downloadThread;
|
||||||
class QTimer;
|
class QTimer;
|
||||||
class SearchEngine;
|
class SearchEngine;
|
||||||
|
class GUI;
|
||||||
|
|
||||||
class SearchEngine : public QWidget, public Ui::search_engine{
|
class SearchEngine : public QWidget, public Ui::search_engine{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -63,15 +61,16 @@ private:
|
||||||
QPointer<QCompleter> searchCompleter;
|
QPointer<QCompleter> searchCompleter;
|
||||||
QStringListModel searchHistory;
|
QStringListModel searchHistory;
|
||||||
Bittorrent *BTSession;
|
Bittorrent *BTSession;
|
||||||
QSystemTrayIcon *systrayIcon;
|
|
||||||
SupportedEngines *supported_engines;
|
SupportedEngines *supported_engines;
|
||||||
QTimer *searchTimeout;
|
QTimer *searchTimeout;
|
||||||
SearchTab *currentSearchTab;
|
SearchTab *currentSearchTab;
|
||||||
QPushButton *closeTab_button;
|
QPushButton *closeTab_button;
|
||||||
QList<SearchTab*> all_tab; // To store all tabs
|
QList<SearchTab*> all_tab; // To store all tabs
|
||||||
const SearchCategories full_cat_names;
|
const SearchCategories full_cat_names;
|
||||||
|
GUI *parent;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SearchEngine(Bittorrent *BTSession, QSystemTrayIcon *systrayIcon);
|
SearchEngine(GUI *parent, Bittorrent *BTSession);
|
||||||
~SearchEngine();
|
~SearchEngine();
|
||||||
QString selectedCategory() const;
|
QString selectedCategory() const;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue