transmission/qt/Application.h

76 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
*
* $Id$
2009-04-09 18:55:47 +00:00
*/
#ifndef QTR_APPLICATION_H
#define QTR_APPLICATION_H
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 ();
2014-05-09 02:32:28 +00:00
bool notifyApp (const QString& title, const QString& body) const;
2015-06-12 22:12:12 +00:00
FaviconCache& faviconCache ();
public slots:
void addTorrent (const QString&);
void addTorrent (const AddData&);
private:
2015-06-12 22:12:12 +00:00
void maybeUpdateBlocklist ();
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 (const QSet<int>& torrents);
void onTorrentCompleted (int);
void onNewTorrentChanged (int);
private:
2015-06-12 22:12:12 +00:00
Prefs * myPrefs;
Session * mySession;
TorrentModel * myModel;
MainWindow * myWindow;
WatchDir * myWatchDir;
QTimer myModelTimer;
QTimer myStatsTimer;
QTimer mySessionTimer;
time_t myLastFullUpdateTime;
QTranslator qtTranslator;
QTranslator appTranslator;
FaviconCache myFavicons;
2009-04-09 18:55:47 +00:00
};
#undef qApp
#define qApp static_cast<Application*> (Application::instance ())
#endif // QTR_APPLICATION_H