mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-29 13:58:51 +03: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()));
|
||||
|
||||
// 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"));
|
||||
|
||||
// Configure BT session according to options
|
||||
|
@ -429,7 +429,7 @@ void GUI::previewFile(QString filePath) {
|
|||
QDesktopServices::openUrl(QString("file://")+filePath);
|
||||
}
|
||||
|
||||
int GUI::getCurrentTabIndex() const{
|
||||
int GUI::getCurrentTabIndex() const {
|
||||
if(isMinimized() || !isVisible())
|
||||
return -1;
|
||||
return tabs->currentIndex();
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include <QCompleter>
|
||||
#include <QSettings>
|
||||
#include <QMessageBox>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QTemporaryFile>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <iostream>
|
||||
|
@ -49,11 +48,12 @@
|
|||
#include "downloadthread.h"
|
||||
#include "misc.h"
|
||||
#include "searchlistdelegate.h"
|
||||
#include "GUI.h"
|
||||
|
||||
#define SEARCHHISTORY_MAXSIZE 50
|
||||
|
||||
/*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);
|
||||
// new qCompleter to the search pattern
|
||||
startSearchHistory();
|
||||
|
@ -428,8 +428,8 @@ void SearchEngine::updateNova() {
|
|||
void SearchEngine::searchFinished(int exitcode,QProcess::ExitStatus){
|
||||
QSettings settings("qBittorrent", "qBittorrent");
|
||||
bool useNotificationBalloons = settings.value("Preferences/General/NotificationBaloons", true).toBool();
|
||||
if(systrayIcon && useNotificationBalloons) {
|
||||
systrayIcon->showMessage(tr("Search Engine"), tr("Search has finished"), QSystemTrayIcon::Information, TIME_TRAY_BALLOON);
|
||||
if(useNotificationBalloons && parent->getCurrentTabIndex() != TAB_SEARCH) {
|
||||
parent->showNotificationBaloon(tr("Search Engine"), tr("Search has finished"));
|
||||
}
|
||||
if(exitcode){
|
||||
search_status->setText(tr("An error occured during search..."));
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
#ifndef SEARCH_H
|
||||
#define SEARCH_H
|
||||
|
||||
#define TIME_TRAY_BALLOON 5000
|
||||
|
||||
#include <QProcess>
|
||||
#include <QList>
|
||||
#include <QPair>
|
||||
|
@ -44,10 +42,10 @@
|
|||
#include "supportedengines.h"
|
||||
|
||||
class Bittorrent;
|
||||
class QSystemTrayIcon;
|
||||
class downloadThread;
|
||||
class QTimer;
|
||||
class SearchEngine;
|
||||
class GUI;
|
||||
|
||||
class SearchEngine : public QWidget, public Ui::search_engine{
|
||||
Q_OBJECT
|
||||
|
@ -63,15 +61,16 @@ private:
|
|||
QPointer<QCompleter> searchCompleter;
|
||||
QStringListModel searchHistory;
|
||||
Bittorrent *BTSession;
|
||||
QSystemTrayIcon *systrayIcon;
|
||||
SupportedEngines *supported_engines;
|
||||
QTimer *searchTimeout;
|
||||
SearchTab *currentSearchTab;
|
||||
QPushButton *closeTab_button;
|
||||
QList<SearchTab*> all_tab; // To store all tabs
|
||||
const SearchCategories full_cat_names;
|
||||
GUI *parent;
|
||||
|
||||
public:
|
||||
SearchEngine(Bittorrent *BTSession, QSystemTrayIcon *systrayIcon);
|
||||
SearchEngine(GUI *parent, Bittorrent *BTSession);
|
||||
~SearchEngine();
|
||||
QString selectedCategory() const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue