1/*
2 * This file Copyright (C) Mnemosyne LLC
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2
6 * as published by the Free Software Foundation.
7 *
8 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9 *
10 * $Id: app.h 12595 2011-07-26 02:56:30Z jordan $
11 */
12
13#ifndef QTR_APP_H
14#define QTR_APP_H
15
16#include <QApplication>
17#include <QSet>
18#include <QTimer>
19#include <QTranslator>
20
21#include "favicon.h"
22
23class AddData;
24class Prefs;
25class Session;
26class TorrentModel;
27class TrMainWindow;
28class WatchDir;
29
30class MyApp: public QApplication
31{
32        Q_OBJECT
33
34    public:
35        MyApp( int& argc, char ** argv );
36        virtual ~MyApp( );
37
38    public:
39        void raise( );
40        bool notify( const QString& title, const QString& body ) const;
41
42    public:
43        Favicons favicons;
44
45    private:
46        Prefs * myPrefs;
47        Session * mySession;
48        TorrentModel * myModel;
49        TrMainWindow * myWindow;
50        WatchDir * myWatchDir;
51        QTimer myModelTimer;
52        QTimer myStatsTimer;
53        QTimer mySessionTimer;
54        time_t myLastFullUpdateTime;
55        QTranslator qtTranslator;
56        QTranslator appTranslator;
57
58    private slots:
59        void consentGiven( );
60        void onSessionSourceChanged( );
61        void refreshPref( int key );
62        void refreshTorrents( );
63        void onTorrentsAdded( QSet<int> );
64        void onTorrentCompleted( int );
65        void onNewTorrentChanged( int );
66
67    public slots:
68        void addTorrent( const QString& );
69        void addTorrent( const AddData& );
70
71    private:
72        void maybeUpdateBlocklist( );
73};
74
75#endif
76