|
|
@ -27,28 +27,51 @@ |
|
|
|
* exception statement from your version. |
|
|
|
* exception statement from your version. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "application.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <algorithm> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <QAtomicInt> |
|
|
|
#include <QDebug> |
|
|
|
#include <QDebug> |
|
|
|
#include <QFileInfo> |
|
|
|
#include <QFileInfo> |
|
|
|
#include <QLocale> |
|
|
|
|
|
|
|
#include <QLibraryInfo> |
|
|
|
#include <QLibraryInfo> |
|
|
|
#include <QSysInfo> |
|
|
|
#include <QLocale> |
|
|
|
#include <QProcess> |
|
|
|
#include <QProcess> |
|
|
|
#include <QAtomicInt> |
|
|
|
#include <QSysInfo> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "base/bittorrent/session.h" |
|
|
|
|
|
|
|
#include "base/bittorrent/torrenthandle.h" |
|
|
|
|
|
|
|
#include "base/iconprovider.h" |
|
|
|
|
|
|
|
#include "base/logger.h" |
|
|
|
|
|
|
|
#include "base/net/downloadmanager.h" |
|
|
|
|
|
|
|
#include "base/net/geoipmanager.h" |
|
|
|
|
|
|
|
#include "base/net/proxyconfigurationmanager.h" |
|
|
|
|
|
|
|
#include "base/net/smtp.h" |
|
|
|
|
|
|
|
#include "base/preferences.h" |
|
|
|
|
|
|
|
#include "base/profile.h" |
|
|
|
|
|
|
|
#include "base/rss/rss_autodownloader.h" |
|
|
|
|
|
|
|
#include "base/rss/rss_session.h" |
|
|
|
|
|
|
|
#include "base/scanfoldersmodel.h" |
|
|
|
|
|
|
|
#include "base/settingsstorage.h" |
|
|
|
|
|
|
|
#include "base/utils/fs.h" |
|
|
|
|
|
|
|
#include "base/utils/misc.h" |
|
|
|
|
|
|
|
#include "base/utils/string.h" |
|
|
|
|
|
|
|
#include "filelogger.h" |
|
|
|
|
|
|
|
|
|
|
|
#ifndef DISABLE_GUI |
|
|
|
#ifndef DISABLE_GUI |
|
|
|
#include "gui/guiiconprovider.h" |
|
|
|
|
|
|
|
#ifdef Q_OS_WIN |
|
|
|
#ifdef Q_OS_WIN |
|
|
|
#include <windows.h> |
|
|
|
#include <windows.h> |
|
|
|
#include <QSharedMemory> |
|
|
|
|
|
|
|
#include <QSessionManager> |
|
|
|
#include <QSessionManager> |
|
|
|
|
|
|
|
#include <QSharedMemory> |
|
|
|
#endif // Q_OS_WIN
|
|
|
|
#endif // Q_OS_WIN
|
|
|
|
#ifdef Q_OS_MAC |
|
|
|
#ifdef Q_OS_MAC |
|
|
|
#include <QFileOpenEvent> |
|
|
|
#include <QFileOpenEvent> |
|
|
|
#include <QFont> |
|
|
|
#include <QFont> |
|
|
|
#include <QUrl> |
|
|
|
#include <QUrl> |
|
|
|
#endif // Q_OS_MAC
|
|
|
|
#endif // Q_OS_MAC
|
|
|
|
#include "mainwindow.h" |
|
|
|
|
|
|
|
#include "addnewtorrentdialog.h" |
|
|
|
#include "addnewtorrentdialog.h" |
|
|
|
|
|
|
|
#include "gui/guiiconprovider.h" |
|
|
|
|
|
|
|
#include "mainwindow.h" |
|
|
|
#include "shutdownconfirmdlg.h" |
|
|
|
#include "shutdownconfirmdlg.h" |
|
|
|
#else // DISABLE_GUI
|
|
|
|
#else // DISABLE_GUI
|
|
|
|
#include <iostream> |
|
|
|
#include <iostream> |
|
|
@ -58,25 +81,6 @@ |
|
|
|
#include "webui/webui.h" |
|
|
|
#include "webui/webui.h" |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#include "application.h" |
|
|
|
|
|
|
|
#include "filelogger.h" |
|
|
|
|
|
|
|
#include "base/logger.h" |
|
|
|
|
|
|
|
#include "base/preferences.h" |
|
|
|
|
|
|
|
#include "base/settingsstorage.h" |
|
|
|
|
|
|
|
#include "base/profile.h" |
|
|
|
|
|
|
|
#include "base/utils/fs.h" |
|
|
|
|
|
|
|
#include "base/utils/misc.h" |
|
|
|
|
|
|
|
#include "base/iconprovider.h" |
|
|
|
|
|
|
|
#include "base/scanfoldersmodel.h" |
|
|
|
|
|
|
|
#include "base/net/smtp.h" |
|
|
|
|
|
|
|
#include "base/net/downloadmanager.h" |
|
|
|
|
|
|
|
#include "base/net/geoipmanager.h" |
|
|
|
|
|
|
|
#include "base/net/proxyconfigurationmanager.h" |
|
|
|
|
|
|
|
#include "base/bittorrent/session.h" |
|
|
|
|
|
|
|
#include "base/bittorrent/torrenthandle.h" |
|
|
|
|
|
|
|
#include "base/rss/rss_autodownloader.h" |
|
|
|
|
|
|
|
#include "base/rss/rss_session.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace |
|
|
|
namespace |
|
|
|
{ |
|
|
|
{ |
|
|
|
#define SETTINGS_KEY(name) "Application/" name |
|
|
|
#define SETTINGS_KEY(name) "Application/" name |
|
|
@ -269,11 +273,16 @@ void Application::processMessage(const QString &message) |
|
|
|
m_paramsQueue.append(params); |
|
|
|
m_paramsQueue.append(params); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Application::runExternalProgram(BitTorrent::TorrentHandle *const torrent) const |
|
|
|
void Application::runExternalProgram(const BitTorrent::TorrentHandle *torrent) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
QString program = Preferences::instance()->getAutoRunProgram(); |
|
|
|
QString program = Preferences::instance()->getAutoRunProgram(); |
|
|
|
program.replace("%N", torrent->name()); |
|
|
|
program.replace("%N", torrent->name()); |
|
|
|
program.replace("%L", torrent->category()); |
|
|
|
program.replace("%L", torrent->category()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QStringList tags = torrent->tags().toList(); |
|
|
|
|
|
|
|
std::sort(tags.begin(), tags.end(), Utils::String::naturalLessThan<Qt::CaseInsensitive>); |
|
|
|
|
|
|
|
program.replace("%G", tags.join(',')); |
|
|
|
|
|
|
|
|
|
|
|
program.replace("%F", Utils::Fs::toNativePath(torrent->contentPath())); |
|
|
|
program.replace("%F", Utils::Fs::toNativePath(torrent->contentPath())); |
|
|
|
program.replace("%R", Utils::Fs::toNativePath(torrent->rootPath())); |
|
|
|
program.replace("%R", Utils::Fs::toNativePath(torrent->rootPath())); |
|
|
|
program.replace("%D", Utils::Fs::toNativePath(torrent->savePath())); |
|
|
|
program.replace("%D", Utils::Fs::toNativePath(torrent->savePath())); |
|
|
|