Moved search code into a subfolder

This commit is contained in:
Christophe Dumez 2010-10-22 20:13:22 +00:00
parent 39778baaf5
commit 7ec842929a
44 changed files with 99 additions and 99 deletions

View file

@ -47,7 +47,7 @@
#include "GUI.h"
#include "transferlistwidget.h"
#include "misc.h"
#include "createtorrent_imp.h"
#include "torrentcreatordlg.h"
#include "downloadfromurldlg.h"
#include "torrentadditiondlg.h"
#include "searchengine.h"
@ -721,7 +721,7 @@ void GUI::on_actionCreate_torrent_triggered() {
if(createTorrentDlg) {
createTorrentDlg->setFocus();
} else {
createTorrentDlg = new createtorrent(this);
createTorrentDlg = new TorrentCreatorDlg(this);
connect(createTorrentDlg, SIGNAL(torrent_to_seed(QString)), this, SLOT(addTorrent(QString)));
}
}

View file

@ -54,7 +54,7 @@ class PropertiesWidget;
class StatusBar;
class consoleDlg;
class about;
class createtorrent;
class TorrentCreatorDlg;
class downloadFromURL;
class HidableTabWidget;
class LineEdit;
@ -149,7 +149,7 @@ private:
QPointer<options_imp> options;
QPointer<consoleDlg> console;
QPointer<about> aboutDlg;
QPointer<createtorrent> createTorrentDlg;
QPointer<TorrentCreatorDlg> createTorrentDlg;
QPointer<downloadFromURL> downloadFromURLDialog;
QPointer<QSystemTrayIcon> systrayIcon;
QPointer<QTimer> systrayCreator;

View file

@ -415,7 +415,7 @@ void misc::moveToXDGFolders() {
copyDir(old_BTBackupPath, BTBackupLocation());
}
// Copy search engine folder
const QString old_searchPath = old_qBtPath.absoluteFilePath("search_engine");
const QString old_searchPath = old_qBtPath.absoluteFilePath("nova");
if(QDir(old_searchPath).exists()) {
copyDir(old_searchPath, searchEngineLocation());
}
@ -471,7 +471,7 @@ QPoint misc::screenCenter(QWidget *win) {
QString misc::searchEngineLocation() {
const QString location = QDir::cleanPath(QDesktopServicesDataLocation()
+ QDir::separator() + "search_engine");
+ QDir::separator() + "nova");
QDir locationDir(location);
if(!locationDir.exists())
locationDir.mkpath(locationDir.absolutePath());

View file

@ -1,9 +1,8 @@
INCLUDEPATH += $$PWD
!contains(DEFINES, DISABLE_GUI) {
FORMS += $$PWD/propertieswidget.ui
FORMS += $$PWD/propertieswidget.ui
HEADERS += $$PWD/propertieswidget.h \
HEADERS += $$PWD/propertieswidget.h \
$$PWD/peerlistwidget.h \
$$PWD/proplistdelegate.h \
$$PWD/trackerlist.h \
@ -11,16 +10,11 @@ INCLUDEPATH += $$PWD
$$PWD/peerlistdelegate.h \
$$PWD/peeraddition.h \
$$PWD/trackersadditiondlg.h \
$$PWD/pieceavailabilitybar.h
$$PWD/pieceavailabilitybar.h \
$$PWD/proptabbar.h
SOURCES += $$PWD/propertieswidget.cpp \
SOURCES += $$PWD/propertieswidget.cpp \
$$PWD/peerlistwidget.cpp \
$$PWD/trackerlist.cpp
$$PWD/trackerlist.cpp \
$$PWD/proptabbar.cpp
}
HEADERS += \
properties/proptabbar.h
SOURCES += \
properties/proptabbar.cpp

View file

@ -1,8 +1,6 @@
INCLUDEPATH += $$PWD
!contains(DEFINES, DISABLE_GUI) {
HEADERS += $$PWD/rss_imp.h \
HEADERS += $$PWD/rss_imp.h \
$$PWD/rsssettings.h \
$$PWD/feeddownloader.h \
$$PWD/feedlistwidget.h \
@ -13,7 +11,7 @@ INCLUDEPATH += $$PWD
$$PWD/rssarticle.h \
$$PWD/rssfilters.h
SOURCES += $$PWD/rss_imp.cpp \
SOURCES += $$PWD/rss_imp.cpp \
$$PWD/rsssettings.cpp \
$$PWD/feedlistwidget.cpp \
$$PWD/rssmanager.cpp \
@ -23,7 +21,7 @@ INCLUDEPATH += $$PWD
$$PWD/feeddownloader.cpp \
$$PWD/rssfilters.cpp
FORMS += $$PWD/ui/rss.ui \
FORMS += $$PWD/ui/rss.ui \
$$PWD/ui/feeddownloader.ui \
$$PWD/ui/rsssettings.ui
}

View file

@ -1,23 +0,0 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>search_engine/nova2.py</file>
<file>search_engine/novaprinter.py</file>
<file>search_engine/socks.py</file>
<file>search_engine/nova2dl.py</file>
<file>search_engine/helpers.py</file>
<file>search_engine/engines/vertor.png</file>
<file>search_engine/engines/mininova.png</file>
<file>search_engine/engines/mininova.py</file>
<file>search_engine/engines/torrentdownloads.png</file>
<file>search_engine/engines/isohunt.png</file>
<file>search_engine/engines/torrentreactor.py</file>
<file>search_engine/engines/btjunkie.png</file>
<file>search_engine/engines/piratebay.py</file>
<file>search_engine/engines/torrentdownloads.py</file>
<file>search_engine/engines/torrentreactor.png</file>
<file>search_engine/engines/isohunt.py</file>
<file>search_engine/engines/btjunkie.py</file>
<file>search_engine/engines/piratebay.png</file>
<file>search_engine/engines/vertor.py</file>
</qresource>
</RCC>

View file

@ -44,7 +44,7 @@
#include <QTemporaryFile>
enum EngineColumns {ENGINE_NAME, ENGINE_URL, ENGINE_STATE, ENGINE_ID};
#define UPDATE_URL "http://qbittorrent.svn.sourceforge.net/viewvc/qbittorrent/trunk/src/search_engine/engines/"
#define UPDATE_URL "http://qbittorrent.svn.sourceforge.net/viewvc/qbittorrent/trunk/src/nova/engines/"
engineSelectDlg::engineSelectDlg(QWidget *parent, SupportedEngines *supported_engines) : QDialog(parent), supported_engines(supported_engines) {
setupUi(this);
@ -164,7 +164,7 @@ void engineSelectDlg::on_actionUninstall_triggered() {
int index = pluginsTree->indexOfTopLevelItem(item);
Q_ASSERT(index != -1);
QString id = item->text(ENGINE_ID);
if(QFile::exists(":/search_engine/engines/"+id+".py")) {
if(QFile::exists(":/nova/engines/"+id+".py")) {
error = true;
// Disable it instead
supported_engines->value(id)->setEnabled(false);

View file

Before

Width:  |  Height:  |  Size: 622 B

After

Width:  |  Height:  |  Size: 622 B

View file

Before

Width:  |  Height:  |  Size: 633 B

After

Width:  |  Height:  |  Size: 633 B

View file

Before

Width:  |  Height:  |  Size: 365 B

After

Width:  |  Height:  |  Size: 365 B

View file

Before

Width:  |  Height:  |  Size: 609 B

After

Width:  |  Height:  |  Size: 609 B

View file

Before

Width:  |  Height:  |  Size: 423 B

After

Width:  |  Height:  |  Size: 423 B

View file

Before

Width:  |  Height:  |  Size: 529 B

After

Width:  |  Height:  |  Size: 529 B

View file

Before

Width:  |  Height:  |  Size: 643 B

After

Width:  |  Height:  |  Size: 643 B

View file

@ -0,0 +1,23 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>nova/nova2.py</file>
<file>nova/novaprinter.py</file>
<file>nova/socks.py</file>
<file>nova/nova2dl.py</file>
<file>nova/helpers.py</file>
<file>nova/engines/vertor.png</file>
<file>nova/engines/mininova.png</file>
<file>nova/engines/mininova.py</file>
<file>nova/engines/torrentdownloads.png</file>
<file>nova/engines/isohunt.png</file>
<file>nova/engines/torrentreactor.py</file>
<file>nova/engines/btjunkie.png</file>
<file>nova/engines/piratebay.py</file>
<file>nova/engines/torrentdownloads.py</file>
<file>nova/engines/torrentreactor.png</file>
<file>nova/engines/isohunt.py</file>
<file>nova/engines/btjunkie.py</file>
<file>nova/engines/piratebay.png</file>
<file>nova/engines/vertor.py</file>
</qresource>
</RCC>

View file

@ -470,7 +470,7 @@ void SearchEngine::downloadFinished(int exitcode, QProcess::ExitStatus) {
// Update nova.py search plugin if necessary
void SearchEngine::updateNova() {
qDebug("Updating nova");
// create search_engine directory if necessary
// create nova directory if necessary
QDir search_dir(misc::searchEngineLocation());
QFile package_file(search_dir.absoluteFilePath("__init__.py"));
package_file.open(QIODevice::WriteOnly | QIODevice::Text);
@ -483,47 +483,47 @@ void SearchEngine::updateNova() {
package_file2.close();
// Copy search plugin files (if necessary)
QString filePath = search_dir.absoluteFilePath("nova2.py");
if(getPluginVersion(":/search_engine/nova2.py") > getPluginVersion(filePath)) {
if(getPluginVersion(":/nova/nova2.py") > getPluginVersion(filePath)) {
if(QFile::exists(filePath)) {
misc::safeRemove(filePath);
misc::safeRemove(filePath+"c");
}
QFile::copy(":/search_engine/nova2.py", filePath);
QFile::copy(":/nova/nova2.py", filePath);
}
filePath = search_dir.absoluteFilePath("nova2dl.py");
if(getPluginVersion(":/search_engine/nova2dl.py") > getPluginVersion(filePath)) {
if(getPluginVersion(":/nova/nova2dl.py") > getPluginVersion(filePath)) {
if(QFile::exists(filePath)){
misc::safeRemove(filePath);
misc::safeRemove(filePath+"c");
}
QFile::copy(":/search_engine/nova2dl.py", filePath);
QFile::copy(":/nova/nova2dl.py", filePath);
}
filePath = search_dir.absoluteFilePath("novaprinter.py");
if(getPluginVersion(":/search_engine/novaprinter.py") > getPluginVersion(filePath)) {
if(getPluginVersion(":/nova/novaprinter.py") > getPluginVersion(filePath)) {
if(QFile::exists(filePath)){
misc::safeRemove(filePath);
misc::safeRemove(filePath+"c");
}
QFile::copy(":/search_engine/novaprinter.py", filePath);
QFile::copy(":/nova/novaprinter.py", filePath);
}
filePath = search_dir.absoluteFilePath("helpers.py");
if(getPluginVersion(":/search_engine/helpers.py") > getPluginVersion(filePath)) {
if(getPluginVersion(":/nova/helpers.py") > getPluginVersion(filePath)) {
if(QFile::exists(filePath)){
misc::safeRemove(filePath);
misc::safeRemove(filePath+"c");
}
QFile::copy(":/search_engine/helpers.py", filePath);
QFile::copy(":/nova/helpers.py", filePath);
}
filePath = search_dir.absoluteFilePath("socks.py");
if(!QFile::exists(filePath)) {
QFile::copy(":/search_engine/socks.py", filePath);
QFile::copy(":/nova/socks.py", filePath);
}
QDir destDir(QDir(misc::searchEngineLocation()).absoluteFilePath("engines"));
QDir shipped_subDir(":/search_engine/engines/");
QDir shipped_subDir(":/nova/engines/");
QStringList files = shipped_subDir.entryList();
foreach(const QString &file, files){
QString shipped_file = shipped_subDir.absoluteFilePath(file);

View file

@ -0,0 +1,17 @@
INCLUDEPATH += $$PWD
FORMS += $$PWD/search.ui \
$$PWD/engineselect.ui
HEADERS += $$PWD/searchengine.h \
$$PWD/searchtab.h \
$$PWD/engineselectdlg.h \
$$PWD/pluginsource.h \
$$PWD/searchlistdelegate.h \
$$PWD/supportedengines.h
SOURCES += $$PWD/searchengine.cpp \
$$PWD/searchtab.cpp \
$$PWD/engineselectdlg.cpp
RESOURCES += $$PWD/search.qrc

View file

@ -222,7 +222,6 @@ os2 {
# Resource files
RESOURCES += icons.qrc \
lang.qrc \
search.qrc \
about.qrc
# Add GeoIP resource file if the GeoIP database
@ -282,13 +281,13 @@ HEADERS += misc.h \
preferences.h \
scannedfoldersmodel.h \
qinisettings.h \
smtp.h
smtp.h \
torrentcreatordlg.h
contains(DEFINES, DISABLE_GUI) {
HEADERS += headlessloader.h
} else {
HEADERS += GUI.h \
supportedengines.h \
transferlistwidget.h \
transferlistdelegate.h \
transferlistfilterswidget.h \
@ -297,17 +296,11 @@ contains(DEFINES, DISABLE_GUI) {
deletionconfirmationdlg.h \
statusbar.h \
reverseresolution.h \
searchtab.h \
console_imp.h \
ico.h \
engineselectdlg.h \
pluginsource.h \
searchEngine.h \
speedlimitdlg.h \
options_imp.h \
about_imp.h \
createtorrent_imp.h \
searchlistdelegate.h \
previewselect.h \
previewlistdelegate.h \
downloadfromurldlg.h \
@ -345,9 +338,12 @@ contains(DEFINES, USE_SYSTEM_QTSINGLEAPPLICATION) {
include(qtlibtorrent/qtlibtorrent.pri)
include(webui/webui.pri)
include(rss/rss.pri)
include(tracker/tracker.pri)
include(properties/properties.pri)
!contains(DEFINES, DISABLE_GUI) {
include(properties/properties.pri)
include(searchengine/searchengine.pri)
include(rss/rss.pri)
}
!contains(DEFINES, DISABLE_GUI) {
FORMS += ui/mainwindow.ui \
@ -358,9 +354,7 @@ include(properties/properties.pri)
ui/login.ui \
ui/downloadfromurldlg.ui \
ui/torrentadditiondlg.ui \
ui/search.ui \
ui/bandwidth_limit.ui \
ui/engineselect.ui \
ui/pluginsource.ui \
ui/trackersadditiondlg.ui \
ui/console.ui \
@ -373,15 +367,12 @@ SOURCES += main.cpp \
downloadthread.cpp \
scannedfoldersmodel.cpp \
misc.cpp \
smtp.cpp
smtp.cpp \
torrentcreatordlg.cpp
!contains(DEFINES, DISABLE_GUI) {
SOURCES += GUI.cpp \
options_imp.cpp \
createtorrent_imp.cpp \
searchengine.cpp \
engineselectdlg.cpp \
searchtab.cpp \
ico.cpp \
transferlistwidget.cpp \
cookiesdlg.cpp \

View file

@ -48,7 +48,7 @@
#include <libtorrent/create_torrent.hpp>
#include "torrentpersistentdata.h"
#include "createtorrent_imp.h"
#include "torrentcreatordlg.h"
#include "misc.h"
#include "qinisettings.h"
@ -64,7 +64,7 @@ bool file_filter(boost::filesystem::path const& filename)
return true;
}
createtorrent::createtorrent(QWidget *parent): QDialog(parent){
TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent): QDialog(parent){
setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
setModal(true);
@ -76,11 +76,11 @@ createtorrent::createtorrent(QWidget *parent): QDialog(parent){
show();
}
createtorrent::~createtorrent() {
TorrentCreatorDlg::~TorrentCreatorDlg() {
delete creatorThread;
}
void createtorrent::on_addFolder_button_clicked(){
void TorrentCreatorDlg::on_addFolder_button_clicked(){
QIniSettings settings("qBittorrent", "qBittorrent");
QString last_path = settings.value("CreateTorrent/last_add_path", QDir::homePath()).toString();
QString dir = QFileDialog::getExistingDirectory(this, tr("Select a folder to add to the torrent"), last_path, QFileDialog::ShowDirsOnly);
@ -93,7 +93,7 @@ void createtorrent::on_addFolder_button_clicked(){
}
}
void createtorrent::on_addFile_button_clicked(){
void TorrentCreatorDlg::on_addFile_button_clicked(){
QIniSettings settings("qBittorrent", "qBittorrent");
QString last_path = settings.value("CreateTorrent/last_add_path", QDir::homePath()).toString();
QString file = QFileDialog::getOpenFileName(this, tr("Select a file to add to the torrent"), last_path);
@ -106,7 +106,7 @@ void createtorrent::on_addFile_button_clicked(){
}
}
void createtorrent::on_removeTracker_button_clicked() {
void TorrentCreatorDlg::on_removeTracker_button_clicked() {
QModelIndexList selectedIndexes = trackers_list->selectionModel()->selectedIndexes();
for(int i=selectedIndexes.size()-1; i>=0; --i){
QListWidgetItem *item = trackers_list->takeItem(selectedIndexes.at(i).row());
@ -114,7 +114,7 @@ void createtorrent::on_removeTracker_button_clicked() {
}
}
int createtorrent::getPieceSize() const {
int TorrentCreatorDlg::getPieceSize() const {
switch(comboPieceSize->currentIndex()) {
case 0:
return 32*1024;
@ -135,7 +135,7 @@ int createtorrent::getPieceSize() const {
}
}
void createtorrent::on_addTracker_button_clicked() {
void TorrentCreatorDlg::on_addTracker_button_clicked() {
bool ok;
QString URL = QInputDialog::getText(this, tr("Please type an announce URL"),
tr("Announce URL:", "Tracker URL"), QLineEdit::Normal,
@ -146,7 +146,7 @@ void createtorrent::on_addTracker_button_clicked() {
}
}
void createtorrent::on_removeURLSeed_button_clicked(){
void TorrentCreatorDlg::on_removeURLSeed_button_clicked(){
QModelIndexList selectedIndexes = URLSeeds_list->selectionModel()->selectedIndexes();
for(int i=selectedIndexes.size()-1; i>=0; --i){
QListWidgetItem *item = URLSeeds_list->takeItem(selectedIndexes.at(i).row());
@ -154,7 +154,7 @@ void createtorrent::on_removeURLSeed_button_clicked(){
}
}
void createtorrent::on_addURLSeed_button_clicked(){
void TorrentCreatorDlg::on_addURLSeed_button_clicked(){
bool ok;
QString URL = QInputDialog::getText(this, tr("Please type a web seed url"),
tr("Web seed URL:"), QLineEdit::Normal,
@ -165,7 +165,7 @@ void createtorrent::on_addURLSeed_button_clicked(){
}
}
QStringList createtorrent::allItems(QListWidget *list){
QStringList TorrentCreatorDlg::allItems(QListWidget *list){
QStringList res;
unsigned int nbItems = list->count();
for(unsigned int i=0; i< nbItems; ++i){
@ -175,7 +175,7 @@ QStringList createtorrent::allItems(QListWidget *list){
}
// Main function that create a .torrent file
void createtorrent::on_createButton_clicked(){
void TorrentCreatorDlg::on_createButton_clicked(){
QString input = textInputPath->text().trimmed();
if (input.endsWith(QDir::separator()))
input.chop(1);
@ -206,7 +206,7 @@ void createtorrent::on_createButton_clicked(){
creatorThread->create(input, destination, trackers, url_seeds, comment, check_private->isChecked(), getPieceSize());
}
void createtorrent::handleCreationFailure(QString msg) {
void TorrentCreatorDlg::handleCreationFailure(QString msg) {
// Enable dialog
setEnabled(true);
// Remove busy cursor
@ -214,7 +214,7 @@ void createtorrent::handleCreationFailure(QString msg) {
QMessageBox::information(0, tr("Torrent creation"), tr("Torrent creation was unsuccessful, reason: %1").arg(msg));
}
void createtorrent::handleCreationSuccess(QString path, QString branch_path) {
void TorrentCreatorDlg::handleCreationSuccess(QString path, QString branch_path) {
// Enable Dialog
setEnabled(true);
// Remove busy cursor
@ -246,7 +246,7 @@ void createtorrent::handleCreationSuccess(QString path, QString branch_path) {
close();
}
void createtorrent::on_cancelButton_clicked() {
void TorrentCreatorDlg::on_cancelButton_clicked() {
// End torrent creation thread
if(creatorThread->isRunning()) {
creatorThread->abortCreation();
@ -258,7 +258,7 @@ void createtorrent::on_cancelButton_clicked() {
reject();
}
void createtorrent::updateProgressBar(int progress) {
void TorrentCreatorDlg::updateProgressBar(int progress) {
progressBar->setValue(progress);
}

View file

@ -71,15 +71,15 @@ class torrentCreatorThread : public QThread {
void updateProgress(int progress);
};
class createtorrent : public QDialog, private Ui::createTorrentDialog{
class TorrentCreatorDlg : public QDialog, private Ui::createTorrentDialog{
Q_OBJECT
private:
torrentCreatorThread *creatorThread;
public:
createtorrent(QWidget *parent = 0);
~createtorrent();
TorrentCreatorDlg(QWidget *parent = 0);
~TorrentCreatorDlg();
QStringList allItems(QListWidget *list);
int getPieceSize() const;