source: trunk/qt/Application.h @ 14600

Last change on this file since 14600 was 14600, checked in by mikedld, 7 years ago

Fallback to English if no proper translation is available

  • Property svn:keywords set to Date Rev Author Id
File size: 1.6 KB
Line 
1/*
2 * This file Copyright (C) 2009-2015 Mnemosyne LLC
3 *
4 * It may be used under the GNU GPL versions 2 or 3
5 * or any future license endorsed by Mnemosyne LLC.
6 *
7 * $Id: Application.h 14600 2015-11-15 11:03:27Z mikedld $
8 */
9
10#ifndef QTR_APPLICATION_H
11#define QTR_APPLICATION_H
12
13#include <QApplication>
14#include <QSet>
15#include <QTimer>
16#include <QTranslator>
17
18#include "FaviconCache.h"
19
20class AddData;
21class Prefs;
22class Session;
23class TorrentModel;
24class MainWindow;
25class WatchDir;
26
27class Application: public QApplication
28{
29    Q_OBJECT
30
31  public:
32    Application (int& argc, char ** argv);
33    virtual ~Application ();
34
35    void raise ();
36    bool notifyApp (const QString& title, const QString& body) const;
37
38    FaviconCache& faviconCache ();
39
40  public slots:
41    void addTorrent (const QString&);
42    void addTorrent (const AddData&);
43
44  private:
45    void maybeUpdateBlocklist ();
46    void loadTranslations ();
47    void quitLater ();
48
49  private slots:
50    void consentGiven (int result);
51    void onSessionSourceChanged ();
52    void refreshPref (int key);
53    void refreshTorrents ();
54    void onTorrentsAdded (const QSet<int>& torrents);
55    void onTorrentCompleted (int);
56    void onNewTorrentChanged (int);
57
58  private:
59    Prefs * myPrefs;
60    Session * mySession;
61    TorrentModel * myModel;
62    MainWindow * myWindow;
63    WatchDir * myWatchDir;
64    QTimer myModelTimer;
65    QTimer myStatsTimer;
66    QTimer mySessionTimer;
67    time_t myLastFullUpdateTime;
68    QTranslator myQtTranslator;
69    QTranslator myAppTranslator;
70    FaviconCache myFavicons;
71};
72
73#undef qApp
74#define qApp static_cast<Application*> (Application::instance ())
75
76#endif // QTR_APPLICATION_H
Note: See TracBrowser for help on using the repository browser.