File: application.h

package info (click to toggle)
qflipper 1.3.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 12,320 kB
  • sloc: cpp: 18,500; sh: 247; ansic: 191; xml: 38; python: 14; makefile: 5
file content (80 lines) | stat: -rw-r--r-- 1,955 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#pragma once

#include <QApplication>
#include <QQmlApplicationEngine>

#include "qtsingleapplication/qtsingleapplication.h"

#include "applicationupdater.h"
#include "applicationbackend.h"
#include "systemfiledialog.h"
#include "applicationupdateregistry.h"

class Application : public QtSingleApplication
{
    Q_OBJECT
    Q_PROPERTY(QString name READ applicationName NOTIFY applicationNameChanged)
    Q_PROPERTY(QString version READ applicationVersion NOTIFY applicationVersionChanged)
    Q_PROPERTY(QString commit READ commitNumber CONSTANT)

    Q_PROPERTY(ApplicationUpdater* updater READ updater CONSTANT)

    Q_PROPERTY(bool isDeveloperMode READ isDeveloperMode CONSTANT)
    Q_PROPERTY(UpdateStatus updateStatus READ updateStatus NOTIFY updateStatusChanged)

    enum OptionIndex {
        DeveloperModeOption = 0,
    };

public:
    enum class UpdateStatus {
        NoUpdates,
        Checking,
        CanUpdate
    };

    Q_ENUM(UpdateStatus)

    Application(int &argc, char **argv);
    ~Application();

    ApplicationUpdater *updater();

    static const QString commitNumber();
    bool isDeveloperMode() const;
    UpdateStatus updateStatus() const;

    Q_INVOKABLE void selfUpdate();
    Q_INVOKABLE void checkForUpdates();

signals:
    void updateStatusChanged();

private slots:
    void onMessageReceived();
    void onLatestVersionChanged();
    void onCurrentDeviceChanged();

private:
    void initCommandOptions();
    void initConnections();
    void initLogger();
    void initStyles();
    void initTranslations();
    void initQmlTypes();
    void initImports();
    void initFonts();
    void initGUI();

    void setUpdateStatus(UpdateStatus newUpdateStatus);

    ApplicationUpdater m_updater;
    ApplicationUpdateRegistry m_updateRegistry;
    SystemFileDialog m_fileDialog;
    ApplicationBackend m_backend;
    QQmlApplicationEngine m_engine;

    bool m_isDeveloperMode;
    UpdateStatus m_updateStatus;
};