2009-04-09 18:55:47 +00:00
|
|
|
/*
|
2015-06-10 21:27:11 +00:00
|
|
|
* This file Copyright (C) 2009-2015 Mnemosyne LLC
|
2009-04-09 18:55:47 +00:00
|
|
|
*
|
2014-01-21 03:10:30 +00:00
|
|
|
* It may be used under the GNU GPL versions 2 or 3
|
2014-01-19 01:09:44 +00:00
|
|
|
* or any future license endorsed by Mnemosyne LLC.
|
2009-04-09 18:55:47 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-03-29 16:37:21 +00:00
|
|
|
#pragma once
|
2009-04-09 18:55:47 +00:00
|
|
|
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QTimer>
|
2010-11-25 03:00:25 +00:00
|
|
|
#include <QTranslator>
|
2010-08-01 18:55:04 +00:00
|
|
|
|
2015-06-10 21:27:11 +00:00
|
|
|
#include "FaviconCache.h"
|
2019-11-12 01:37:05 +00:00
|
|
|
#include "Typedefs.h"
|
2009-04-09 18:55:47 +00:00
|
|
|
|
2010-08-01 18:55:04 +00:00
|
|
|
class AddData;
|
2009-04-09 18:55:47 +00:00
|
|
|
class Prefs;
|
|
|
|
class Session;
|
2019-11-12 23:13:42 +00:00
|
|
|
class Torrent;
|
2009-04-09 18:55:47 +00:00
|
|
|
class TorrentModel;
|
2015-06-10 21:27:11 +00:00
|
|
|
class MainWindow;
|
2009-04-09 18:55:47 +00:00
|
|
|
class WatchDir;
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
class Application : public QApplication
|
2009-04-09 18:55:47 +00:00
|
|
|
{
|
2013-01-26 01:19:54 +00:00
|
|
|
Q_OBJECT
|
2009-04-09 18:55:47 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
public:
|
|
|
|
Application(int& argc, char** argv);
|
|
|
|
virtual ~Application();
|
2009-04-09 18:55:47 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
void raise();
|
2017-04-20 16:02:19 +00:00
|
|
|
bool notifyApp(QString const& title, QString const& body) const;
|
2010-04-27 03:10:32 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
FaviconCache& faviconCache();
|
2015-06-12 22:12:12 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
public slots:
|
2017-04-20 16:02:19 +00:00
|
|
|
void addTorrent(AddData const&);
|
2010-07-25 17:16:03 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
private slots:
|
|
|
|
void consentGiven(int result);
|
|
|
|
void onSessionSourceChanged();
|
2019-11-12 01:37:05 +00:00
|
|
|
void onTorrentsAdded(torrent_ids_t const& torrents);
|
|
|
|
void onTorrentsCompleted(torrent_ids_t const& torrents);
|
2019-11-12 23:13:42 +00:00
|
|
|
void onTorrentsEdited(torrent_ids_t const& torrents);
|
2019-11-12 01:37:05 +00:00
|
|
|
void onTorrentsNeedInfo(torrent_ids_t const& torrents);
|
2019-11-12 23:13:42 +00:00
|
|
|
void refreshPref(int key);
|
|
|
|
void refreshTorrents();
|
2019-11-09 14:44:40 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void maybeUpdateBlocklist();
|
|
|
|
void loadTranslations();
|
2019-11-12 01:37:05 +00:00
|
|
|
QStringList getNames(torrent_ids_t const& ids) const;
|
2019-11-09 23:02:23 +00:00
|
|
|
void quitLater();
|
2010-04-27 03:10:32 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
private:
|
|
|
|
Prefs* myPrefs;
|
|
|
|
Session* mySession;
|
|
|
|
TorrentModel* myModel;
|
|
|
|
MainWindow* myWindow;
|
|
|
|
WatchDir* myWatchDir;
|
2015-06-12 22:12:12 +00:00
|
|
|
QTimer myModelTimer;
|
|
|
|
QTimer myStatsTimer;
|
|
|
|
QTimer mySessionTimer;
|
|
|
|
time_t myLastFullUpdateTime;
|
2015-11-15 11:03:27 +00:00
|
|
|
QTranslator myQtTranslator;
|
|
|
|
QTranslator myAppTranslator;
|
2015-06-12 22:12:12 +00:00
|
|
|
FaviconCache myFavicons;
|
2009-04-09 18:55:47 +00:00
|
|
|
};
|
|
|
|
|
2014-12-27 14:07:14 +00:00
|
|
|
#undef qApp
|
2017-04-19 12:04:45 +00:00
|
|
|
#define qApp static_cast<Application*>(Application::instance())
|