transmission/qt/Application.h

73 lines
1.5 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 <QSet>
2009-04-09 18:55:47 +00:00
#include <QTimer>
#include <QTranslator>
#include "FaviconCache.h"
2009-04-09 18:55:47 +00:00
class AddData;
2009-04-09 18:55:47 +00:00
class Prefs;
class Session;
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(QString const&);
void addTorrent(AddData const&);
private:
void maybeUpdateBlocklist();
void loadTranslations();
void quitLater();
2009-04-09 18:55:47 +00:00
private slots:
void consentGiven(int result);
void onSessionSourceChanged();
void refreshPref(int key);
void refreshTorrents();
void onTorrentsAdded(QSet<int> const& torrents);
void onTorrentCompleted(int);
void onNewTorrentChanged(int);
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())