transmission/qt/Application.h

75 lines
1.6 KiB
C
Raw Normal View History

2009-04-09 18:55:47 +00:00
/*
* This file Copyright (C) 2009-2015 Mnemosyne LLC
2009-04-09 18:55:47 +00:00
*
* It may be used under the GNU GPL versions 2 or 3
* or any future license endorsed by Mnemosyne LLC.
2009-04-09 18:55:47 +00:00
*
*/
#pragma once
2009-04-09 18:55:47 +00:00
#include <QApplication>
#include <QTimer>
#include <QTranslator>
#include "FaviconCache.h"
#include "Typedefs.h"
2009-04-09 18:55:47 +00:00
class AddData;
2009-04-09 18:55:47 +00:00
class Prefs;
class Session;
class Torrent;
2009-04-09 18:55:47 +00:00
class TorrentModel;
class MainWindow;
2009-04-09 18:55:47 +00:00
class WatchDir;
class Application : public QApplication
2009-04-09 18:55:47 +00:00
{
Q_OBJECT
2009-04-09 18:55:47 +00:00
public:
Application(int& argc, char** argv);
virtual ~Application();
2009-04-09 18:55:47 +00:00
void raise();
bool notifyApp(QString const& title, QString const& body) const;
FaviconCache& faviconCache();
2015-06-12 22:12:12 +00:00
public slots:
void addTorrent(AddData const&);
private slots:
void consentGiven(int result);
void onSessionSourceChanged();
void onTorrentsAdded(torrent_ids_t const& torrents);
void onTorrentsCompleted(torrent_ids_t const& torrents);
void onTorrentsEdited(torrent_ids_t const& torrents);
void onTorrentsNeedInfo(torrent_ids_t const& torrents);
void refreshPref(int key);
void refreshTorrents();
private:
void maybeUpdateBlocklist();
void loadTranslations();
QStringList getNames(torrent_ids_t const& ids) const;
void quitLater();
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;
QTranslator myQtTranslator;
QTranslator myAppTranslator;
2015-06-12 22:12:12 +00:00
FaviconCache myFavicons;
2009-04-09 18:55:47 +00:00
};
#undef qApp
#define qApp static_cast<Application*>(Application::instance())