mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-07 20:34:14 +00:00
- FEATURE: Added right click menu in search engine to clear completion history
This commit is contained in:
parent
106f7cdd32
commit
0d63f46035
@ -4,6 +4,7 @@
|
|||||||
- FEATURE: Display total amount of uploaded data in finished list
|
- FEATURE: Display total amount of uploaded data in finished list
|
||||||
- FEATURE: Resizing a column in a search results tab affects all tabs
|
- FEATURE: Resizing a column in a search results tab affects all tabs
|
||||||
- FEATURE: Search results tab columns are now remembered upon startup
|
- FEATURE: Search results tab columns are now remembered upon startup
|
||||||
|
- FEATURE: Added right click menu in search engine to clear completion history
|
||||||
- BUGFIX: Provide more helpful explanation when an I/O error occured
|
- BUGFIX: Provide more helpful explanation when an I/O error occured
|
||||||
- COSMETIC: Redesigned program preferences
|
- COSMETIC: Redesigned program preferences
|
||||||
- COSMETIC: Updated icons set
|
- COSMETIC: Updated icons set
|
||||||
|
118
src/search.ui
118
src/search.ui
@ -1,7 +1,8 @@
|
|||||||
<ui version="4.0" >
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
<class>search_engine</class>
|
<class>search_engine</class>
|
||||||
<widget class="QWidget" name="search_engine" >
|
<widget class="QWidget" name="search_engine">
|
||||||
<property name="geometry" >
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
@ -9,27 +10,27 @@
|
|||||||
<height>453</height>
|
<height>453</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle">
|
||||||
<string>Search</string>
|
<string>Search</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout">
|
||||||
<property name="spacing" >
|
<property name="spacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="margin" >
|
<property name="margin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="search_lbl" >
|
<widget class="QLabel" name="search_lbl">
|
||||||
<property name="maximumSize" >
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>16777215</width>
|
<width>16777215</width>
|
||||||
<height>35</height>
|
<height>35</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="font" >
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<family>Sans Serif</family>
|
<family>Sans Serif</family>
|
||||||
<pointsize>9</pointsize>
|
<pointsize>9</pointsize>
|
||||||
@ -40,37 +41,40 @@
|
|||||||
<strikeout>false</strikeout>
|
<strikeout>false</strikeout>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Search Pattern:</string>
|
<string>Search Pattern:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="search_pattern" >
|
<widget class="QLineEdit" name="search_pattern">
|
||||||
<property name="maximumSize" >
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>16777215</width>
|
<width>16777215</width>
|
||||||
<height>22</height>
|
<height>22</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="clearPatternButton" >
|
<widget class="QPushButton" name="clearPatternButton">
|
||||||
<property name="maximumSize" >
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>34</width>
|
<width>34</width>
|
||||||
<height>29</height>
|
<height>29</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon" >
|
<property name="icon">
|
||||||
<iconset resource="icons.qrc" >
|
<iconset resource="icons.qrc">
|
||||||
<normaloff>:/Icons/oxygen/edit_clear.png</normaloff>:/Icons/oxygen/edit_clear.png</iconset>
|
<normaloff>:/Icons/oxygen/edit_clear.png</normaloff>:/Icons/oxygen/edit_clear.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize" >
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
<width>30</width>
|
<width>30</width>
|
||||||
<height>21</height>
|
<height>21</height>
|
||||||
@ -79,37 +83,37 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="search_button" >
|
<widget class="QPushButton" name="search_button">
|
||||||
<property name="maximumSize" >
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>16777215</width>
|
<width>16777215</width>
|
||||||
<height>29</height>
|
<height>29</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Search</string>
|
<string>Search</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="stop_search_button" >
|
<widget class="QPushButton" name="stop_search_button">
|
||||||
<property name="enabled" >
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize" >
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>16777215</width>
|
<width>16777215</width>
|
||||||
<height>29</height>
|
<height>29</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Stop</string>
|
<string>Stop</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="enginesButton" >
|
<widget class="QPushButton" name="enginesButton">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Search engines...</string>
|
<string>Search engines...</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
@ -117,16 +121,16 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="status_lbl" >
|
<widget class="QLabel" name="status_lbl">
|
||||||
<property name="maximumSize" >
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>16777215</width>
|
<width>16777215</width>
|
||||||
<height>35</height>
|
<height>35</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="font" >
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<family>Sans Serif</family>
|
<family>Sans Serif</family>
|
||||||
<pointsize>9</pointsize>
|
<pointsize>9</pointsize>
|
||||||
@ -137,26 +141,26 @@
|
|||||||
<strikeout>false</strikeout>
|
<strikeout>false</strikeout>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Status:</string>
|
<string>Status:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="search_status" >
|
<widget class="QLabel" name="search_status">
|
||||||
<property name="minimumSize" >
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize" >
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>16777215</width>
|
<width>16777215</width>
|
||||||
<height>35</height>
|
<height>35</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="font" >
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<family>Sans Serif</family>
|
<family>Sans Serif</family>
|
||||||
<pointsize>9</pointsize>
|
<pointsize>9</pointsize>
|
||||||
@ -167,17 +171,17 @@
|
|||||||
<strikeout>false</strikeout>
|
<strikeout>false</strikeout>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Stopped</string>
|
<string>Stopped</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0" >
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>188</width>
|
<width>188</width>
|
||||||
<height>21</height>
|
<height>21</height>
|
||||||
@ -188,40 +192,40 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget" />
|
<widget class="QTabWidget" name="tabWidget"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout">
|
||||||
<property name="spacing" >
|
<property name="spacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="margin" >
|
<property name="margin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout">
|
||||||
<property name="spacing" >
|
<property name="spacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="margin" >
|
<property name="margin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="download_button" >
|
<widget class="QPushButton" name="download_button">
|
||||||
<property name="enabled" >
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Download</string>
|
<string>Download</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0" >
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>601</width>
|
<width>601</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
@ -236,7 +240,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="icons.qrc" />
|
<include location="icons.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
@ -245,11 +249,11 @@
|
|||||||
<receiver>search_button</receiver>
|
<receiver>search_button</receiver>
|
||||||
<slot>click()</slot>
|
<slot>click()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel">
|
||||||
<x>421</x>
|
<x>421</x>
|
||||||
<y>37</y>
|
<y>37</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel">
|
||||||
<x>685</x>
|
<x>685</x>
|
||||||
<y>45</y>
|
<y>45</y>
|
||||||
</hint>
|
</hint>
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QMenu>
|
||||||
|
|
||||||
#include "searchEngine.h"
|
#include "searchEngine.h"
|
||||||
#include "bittorrent.h"
|
#include "bittorrent.h"
|
||||||
@ -53,9 +54,8 @@ SearchEngine::SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon, b
|
|||||||
setupUi(this);
|
setupUi(this);
|
||||||
// new qCompleter to the search pattern
|
// new qCompleter to the search pattern
|
||||||
startSearchHistory();
|
startSearchHistory();
|
||||||
searchCompleter = new QCompleter(searchHistory, this);
|
searchCompleter = 0;
|
||||||
searchCompleter->setCaseSensitivity(Qt::CaseInsensitive);
|
createCompleter();
|
||||||
search_pattern->setCompleter(searchCompleter);
|
|
||||||
// Add close tab button
|
// Add close tab button
|
||||||
closeTab_button = new QPushButton();
|
closeTab_button = new QPushButton();
|
||||||
closeTab_button->setIcon(QIcon(QString::fromUtf8(":/Icons/gnome-shutdown.png")));
|
closeTab_button->setIcon(QIcon(QString::fromUtf8(":/Icons/gnome-shutdown.png")));
|
||||||
@ -79,6 +79,7 @@ SearchEngine::SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon, b
|
|||||||
loadEngineSettings();
|
loadEngineSettings();
|
||||||
// Update nova.py search plugin if necessary
|
// Update nova.py search plugin if necessary
|
||||||
updateNova();
|
updateNova();
|
||||||
|
connect(search_pattern, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(displayPatternContextMenu(QPoint)));
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchEngine::~SearchEngine(){
|
SearchEngine::~SearchEngine(){
|
||||||
@ -94,7 +95,21 @@ SearchEngine::~SearchEngine(){
|
|||||||
}
|
}
|
||||||
delete searchTimeout;
|
delete searchTimeout;
|
||||||
delete searchProcess;
|
delete searchProcess;
|
||||||
delete searchCompleter;
|
if(searchCompleter)
|
||||||
|
delete searchCompleter;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SearchEngine::displayPatternContextMenu(QPoint) {
|
||||||
|
QMenu myMenu(this);
|
||||||
|
QAction clearHistoryAct(tr("Clear history"), &myMenu);
|
||||||
|
myMenu.addAction(&clearHistoryAct);
|
||||||
|
QAction *act = myMenu.exec(QCursor::pos());
|
||||||
|
if(act != 0) {
|
||||||
|
if(act == &clearHistoryAct) {
|
||||||
|
searchHistory.clear();
|
||||||
|
createCompleter();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchEngine::tab_changed(int t)
|
void SearchEngine::tab_changed(int t)
|
||||||
@ -178,12 +193,9 @@ void SearchEngine::on_search_button_clicked(){
|
|||||||
// verify the max size of the history
|
// verify the max size of the history
|
||||||
if(searchHistory.size() > SEARCHHISTORY_MAXSIZE)
|
if(searchHistory.size() > SEARCHHISTORY_MAXSIZE)
|
||||||
searchHistory = searchHistory.mid(searchHistory.size()/2,searchHistory.size()/2);
|
searchHistory = searchHistory.mid(searchHistory.size()/2,searchHistory.size()/2);
|
||||||
searchCompleter = new QCompleter(searchHistory, this);
|
createCompleter();
|
||||||
searchCompleter->setCaseSensitivity(Qt::CaseInsensitive);
|
|
||||||
search_pattern->setCompleter(searchCompleter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Getting checked search engines
|
// Getting checked search engines
|
||||||
Q_ASSERT(!enabled_engines.empty());
|
Q_ASSERT(!enabled_engines.empty());
|
||||||
QStringList params;
|
QStringList params;
|
||||||
@ -203,6 +215,14 @@ void SearchEngine::on_search_button_clicked(){
|
|||||||
searchTimeout->start(180000); // 3min
|
searchTimeout->start(180000); // 3min
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SearchEngine::createCompleter() {
|
||||||
|
if(searchCompleter)
|
||||||
|
delete searchCompleter;
|
||||||
|
searchCompleter = new QCompleter(searchHistory, this);
|
||||||
|
searchCompleter->setCaseSensitivity(Qt::CaseInsensitive);
|
||||||
|
search_pattern->setCompleter(searchCompleter);
|
||||||
|
}
|
||||||
|
|
||||||
void SearchEngine::propagateSectionResized(int index, int , int newsize) {
|
void SearchEngine::propagateSectionResized(int index, int , int newsize) {
|
||||||
foreach(SearchTab * tab, all_tab) {
|
foreach(SearchTab * tab, all_tab) {
|
||||||
tab->getCurrentTreeView()->setColumnWidth(index, newsize);
|
tab->getCurrentTreeView()->setColumnWidth(index, newsize);
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
|
#include <QPointer>
|
||||||
#include "ui_search.h"
|
#include "ui_search.h"
|
||||||
#include "engineSelectDlg.h"
|
#include "engineSelectDlg.h"
|
||||||
#include "SearchTab.h"
|
#include "SearchTab.h"
|
||||||
@ -57,7 +58,7 @@ class SearchEngine : public QWidget, public Ui::search_engine{
|
|||||||
bool no_search_results;
|
bool no_search_results;
|
||||||
QByteArray search_result_line_truncated;
|
QByteArray search_result_line_truncated;
|
||||||
unsigned long nb_search_results;
|
unsigned long nb_search_results;
|
||||||
QCompleter *searchCompleter;
|
QPointer<QCompleter> searchCompleter;
|
||||||
QStringList searchHistory;
|
QStringList searchHistory;
|
||||||
bittorrent *BTSession;
|
bittorrent *BTSession;
|
||||||
QSystemTrayIcon *myTrayIcon;
|
QSystemTrayIcon *myTrayIcon;
|
||||||
@ -94,6 +95,8 @@ class SearchEngine : public QWidget, public Ui::search_engine{
|
|||||||
void saveResultsColumnsWidth();
|
void saveResultsColumnsWidth();
|
||||||
void downloadFinished(int exitcode, QProcess::ExitStatus);
|
void downloadFinished(int exitcode, QProcess::ExitStatus);
|
||||||
void downloadTorrent(QString engine_url, QString torrent_url);
|
void downloadTorrent(QString engine_url, QString torrent_url);
|
||||||
|
void displayPatternContextMenu(QPoint);
|
||||||
|
void createCompleter();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user