Browse Source

Moved search code into a subfolder

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
7ec842929a
  1. 4
      src/GUI.cpp
  2. 4
      src/GUI.h
  3. 4
      src/misc.cpp
  4. 20
      src/properties/properties.pri
  5. 12
      src/rss/rss.pri
  6. 23
      src/search.qrc
  7. 0
      src/searchengine/engineselect.ui
  8. 4
      src/searchengine/engineselectdlg.cpp
  9. 0
      src/searchengine/engineselectdlg.h
  10. 0
      src/searchengine/nova/__init__.py
  11. 0
      src/searchengine/nova/engines/__init__.py
  12. 0
      src/searchengine/nova/engines/btjunkie.png
  13. 0
      src/searchengine/nova/engines/btjunkie.py
  14. 0
      src/searchengine/nova/engines/isohunt.png
  15. 0
      src/searchengine/nova/engines/isohunt.py
  16. 0
      src/searchengine/nova/engines/mininova.png
  17. 0
      src/searchengine/nova/engines/mininova.py
  18. 0
      src/searchengine/nova/engines/piratebay.png
  19. 0
      src/searchengine/nova/engines/piratebay.py
  20. 0
      src/searchengine/nova/engines/torrentdownloads.png
  21. 0
      src/searchengine/nova/engines/torrentdownloads.py
  22. 0
      src/searchengine/nova/engines/torrentreactor.png
  23. 0
      src/searchengine/nova/engines/torrentreactor.py
  24. 0
      src/searchengine/nova/engines/versions.txt
  25. 0
      src/searchengine/nova/engines/vertor.png
  26. 0
      src/searchengine/nova/engines/vertor.py
  27. 0
      src/searchengine/nova/helpers.py
  28. 0
      src/searchengine/nova/nova2.py
  29. 0
      src/searchengine/nova/nova2dl.py
  30. 0
      src/searchengine/nova/novaprinter.py
  31. 0
      src/searchengine/nova/socks.py
  32. 0
      src/searchengine/pluginsource.h
  33. 23
      src/searchengine/search.qrc
  34. 0
      src/searchengine/search.ui
  35. 22
      src/searchengine/searchengine.cpp
  36. 0
      src/searchengine/searchengine.h
  37. 17
      src/searchengine/searchengine.pri
  38. 0
      src/searchengine/searchlistdelegate.h
  39. 0
      src/searchengine/searchtab.cpp
  40. 0
      src/searchengine/searchtab.h
  41. 0
      src/searchengine/supportedengines.h
  42. 27
      src/src.pro
  43. 32
      src/torrentcreatordlg.cpp
  44. 6
      src/torrentcreatordlg.h

4
src/GUI.cpp

@ -47,7 +47,7 @@ @@ -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() { @@ -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)));
}
}

4
src/GUI.h

@ -54,7 +54,7 @@ class PropertiesWidget; @@ -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: @@ -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;

4
src/misc.cpp

@ -415,7 +415,7 @@ void misc::moveToXDGFolders() { @@ -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) { @@ -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());

20
src/properties/properties.pri

@ -1,9 +1,8 @@ @@ -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 @@ -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

12
src/rss/rss.pri

@ -1,8 +1,6 @@ @@ -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 \
@ -12,8 +10,8 @@ INCLUDEPATH += $$PWD @@ -12,8 +10,8 @@ INCLUDEPATH += $$PWD
$$PWD/rssfile.h \
$$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 @@ -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
}

23
src/search.qrc

@ -1,23 +0,0 @@ @@ -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>

0
src/ui/engineselect.ui → src/searchengine/engineselect.ui

4
src/engineselectdlg.cpp → src/searchengine/engineselectdlg.cpp

@ -44,7 +44,7 @@ @@ -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() { @@ -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);

0
src/engineselectdlg.h → src/searchengine/engineselectdlg.h

0
src/search_engine/__init__.py → src/searchengine/nova/__init__.py

0
src/search_engine/engines/__init__.py → src/searchengine/nova/engines/__init__.py

0
src/search_engine/engines/btjunkie.png → src/searchengine/nova/engines/btjunkie.png

Before

Width:  |  Height:  |  Size: 622 B

After

Width:  |  Height:  |  Size: 622 B

0
src/search_engine/engines/btjunkie.py → src/searchengine/nova/engines/btjunkie.py

0
src/search_engine/engines/isohunt.png → src/searchengine/nova/engines/isohunt.png

Before

Width:  |  Height:  |  Size: 633 B

After

Width:  |  Height:  |  Size: 633 B

0
src/search_engine/engines/isohunt.py → src/searchengine/nova/engines/isohunt.py

0
src/search_engine/engines/mininova.png → src/searchengine/nova/engines/mininova.png

Before

Width:  |  Height:  |  Size: 365 B

After

Width:  |  Height:  |  Size: 365 B

0
src/search_engine/engines/mininova.py → src/searchengine/nova/engines/mininova.py

0
src/search_engine/engines/piratebay.png → src/searchengine/nova/engines/piratebay.png

Before

Width:  |  Height:  |  Size: 609 B

After

Width:  |  Height:  |  Size: 609 B

0
src/search_engine/engines/piratebay.py → src/searchengine/nova/engines/piratebay.py

0
src/search_engine/engines/torrentdownloads.png → src/searchengine/nova/engines/torrentdownloads.png

Before

Width:  |  Height:  |  Size: 423 B

After

Width:  |  Height:  |  Size: 423 B

0
src/search_engine/engines/torrentdownloads.py → src/searchengine/nova/engines/torrentdownloads.py

0
src/search_engine/engines/torrentreactor.png → src/searchengine/nova/engines/torrentreactor.png

Before

Width:  |  Height:  |  Size: 529 B

After

Width:  |  Height:  |  Size: 529 B

0
src/search_engine/engines/torrentreactor.py → src/searchengine/nova/engines/torrentreactor.py

0
src/search_engine/engines/versions.txt → src/searchengine/nova/engines/versions.txt

0
src/search_engine/engines/vertor.png → src/searchengine/nova/engines/vertor.png

Before

Width:  |  Height:  |  Size: 643 B

After

Width:  |  Height:  |  Size: 643 B

0
src/search_engine/engines/vertor.py → src/searchengine/nova/engines/vertor.py

0
src/search_engine/helpers.py → src/searchengine/nova/helpers.py

0
src/search_engine/nova2.py → src/searchengine/nova/nova2.py

0
src/search_engine/nova2dl.py → src/searchengine/nova/nova2dl.py

0
src/search_engine/novaprinter.py → src/searchengine/nova/novaprinter.py

0
src/search_engine/socks.py → src/searchengine/nova/socks.py

0
src/pluginsource.h → src/searchengine/pluginsource.h

23
src/searchengine/search.qrc

@ -0,0 +1,23 @@ @@ -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>

0
src/ui/search.ui → src/searchengine/search.ui

22
src/searchengine.cpp → src/searchengine/searchengine.cpp

@ -470,7 +470,7 @@ void SearchEngine::downloadFinished(int exitcode, QProcess::ExitStatus) { @@ -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() { @@ -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);

0
src/searchengine.h → src/searchengine/searchengine.h

17
src/searchengine/searchengine.pri

@ -0,0 +1,17 @@ @@ -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

0
src/searchlistdelegate.h → src/searchengine/searchlistdelegate.h

0
src/searchtab.cpp → src/searchengine/searchtab.cpp

0
src/searchtab.h → src/searchengine/searchtab.h

0
src/supportedengines.h → src/searchengine/supportedengines.h

27
src/src.pro

@ -222,7 +222,6 @@ os2 { @@ -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 \ @@ -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) { @@ -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) { @@ -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) @@ -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 \ @@ -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 \

32
src/createtorrent_imp.cpp → src/torrentcreatordlg.cpp

@ -48,7 +48,7 @@ @@ -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) @@ -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){ @@ -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(){ @@ -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(){ @@ -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() { @@ -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 { @@ -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() { @@ -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(){ @@ -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(){ @@ -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){ @@ -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(){ @@ -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) { @@ -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) { @@ -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() { @@ -258,7 +258,7 @@ void createtorrent::on_cancelButton_clicked() {
reject();
}
void createtorrent::updateProgressBar(int progress) {
void TorrentCreatorDlg::updateProgressBar(int progress) {
progressBar->setValue(progress);
}

6
src/createtorrent_imp.h → src/torrentcreatordlg.h

@ -71,15 +71,15 @@ class torrentCreatorThread : public QThread { @@ -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;
Loading…
Cancel
Save