2009-04-09 18:55:47 +00:00
|
|
|
/*
|
2014-01-19 01:09:44 +00:00
|
|
|
* This file Copyright (C) 2009-2014 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
|
|
|
*
|
2009-05-31 19:33:48 +00:00
|
|
|
* $Id$
|
2009-04-09 18:55:47 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef QTR_APP_H
|
|
|
|
#define QTR_APP_H
|
|
|
|
|
|
|
|
#include <QApplication>
|
2010-08-01 14:51:28 +00:00
|
|
|
#include <QSet>
|
2009-04-09 18:55:47 +00:00
|
|
|
#include <QTimer>
|
2010-11-25 03:00:25 +00:00
|
|
|
#include <QTranslator>
|
2010-08-01 18:55:04 +00:00
|
|
|
|
2010-07-25 17:16:03 +00:00
|
|
|
#include "favicon.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;
|
|
|
|
class TorrentModel;
|
|
|
|
class TrMainWindow;
|
|
|
|
class WatchDir;
|
|
|
|
|
|
|
|
class MyApp: public QApplication
|
|
|
|
{
|
2013-01-26 01:19:54 +00:00
|
|
|
Q_OBJECT
|
2009-04-09 18:55:47 +00:00
|
|
|
|
2013-01-26 01:19:54 +00:00
|
|
|
public:
|
|
|
|
MyApp (int& argc, char ** argv);
|
|
|
|
virtual ~MyApp ();
|
2009-04-09 18:55:47 +00:00
|
|
|
|
2013-01-26 01:19:54 +00:00
|
|
|
public:
|
|
|
|
void raise ();
|
2014-05-09 02:32:28 +00:00
|
|
|
bool notifyApp (const QString& title, const QString& body) const;
|
2010-04-27 03:10:32 +00:00
|
|
|
|
2013-01-26 01:19:54 +00:00
|
|
|
public:
|
|
|
|
Favicons favicons;
|
2010-07-25 17:16:03 +00:00
|
|
|
|
2013-01-26 01:19:54 +00:00
|
|
|
private:
|
|
|
|
Prefs * myPrefs;
|
|
|
|
Session * mySession;
|
|
|
|
TorrentModel * myModel;
|
|
|
|
TrMainWindow * myWindow;
|
|
|
|
WatchDir * myWatchDir;
|
|
|
|
QTimer myModelTimer;
|
|
|
|
QTimer myStatsTimer;
|
|
|
|
QTimer mySessionTimer;
|
|
|
|
time_t myLastFullUpdateTime;
|
|
|
|
QTranslator qtTranslator;
|
|
|
|
QTranslator appTranslator;
|
2009-04-09 18:55:47 +00:00
|
|
|
|
2013-01-26 01:19:54 +00:00
|
|
|
private slots:
|
2015-01-04 12:29:10 +00:00
|
|
|
void consentGiven (int result);
|
2013-01-26 01:19:54 +00:00
|
|
|
void onSessionSourceChanged ();
|
|
|
|
void refreshPref (int key);
|
|
|
|
void refreshTorrents ();
|
2014-12-12 23:52:17 +00:00
|
|
|
void onTorrentsAdded (const QSet<int>& torrents);
|
2013-01-26 01:19:54 +00:00
|
|
|
void onTorrentCompleted (int);
|
|
|
|
void onNewTorrentChanged (int);
|
2010-04-27 03:10:32 +00:00
|
|
|
|
2013-01-26 01:19:54 +00:00
|
|
|
public slots:
|
|
|
|
void addTorrent (const QString&);
|
|
|
|
void addTorrent (const AddData&);
|
2009-04-09 18:55:47 +00:00
|
|
|
|
2013-01-26 01:19:54 +00:00
|
|
|
private:
|
|
|
|
void maybeUpdateBlocklist ();
|
2009-04-09 18:55:47 +00:00
|
|
|
};
|
|
|
|
|
2014-12-27 14:07:14 +00:00
|
|
|
#undef qApp
|
|
|
|
#define qApp static_cast<MyApp*> (MyApp::instance ())
|
|
|
|
|
2009-04-09 18:55:47 +00:00
|
|
|
#endif
|