-
Notifications
You must be signed in to change notification settings - Fork 29
/
launchercontroller.h
82 lines (66 loc) · 1.97 KB
/
launchercontroller.h
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
81
82
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <QtQml/qqml.h>
#include <QCommandLineOption>
#include <QFont>
#include <QObject>
class QTimer;
class Launcher1Adaptor;
class LauncherController : public QObject
{
Q_OBJECT
Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged)
Q_PROPERTY(QString currentFrame READ currentFrame WRITE setCurrentFrame NOTIFY currentFrameChanged)
QML_NAMED_ELEMENT(LauncherController)
QML_SINGLETON
// I really don't want to expose those dbus API as public function...
friend class Launcher1Adaptor;
public:
static LauncherController &instance()
{
static LauncherController _instance;
return _instance;
}
static LauncherController *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine)
{
Q_UNUSED(qmlEngine)
Q_UNUSED(jsEngine)
return &instance();
}
~LauncherController();
bool visible() const;
void setVisible(bool visible);
bool isFullScreenFrame() const;
QString currentFrame() const;
void setCurrentFrame(const QString & frame);
Q_INVOKABLE void hideWithTimer();
Q_INVOKABLE void cancelHide();
Q_INVOKABLE QFont adjustFontWeight(const QFont& f, QFont::Weight weight);
signals:
void currentFrameChanged();
void visibleChanged(bool visible);
public:
QCommandLineOption optShow;
QCommandLineOption optToggle;
// called by dbus adapter
private:
Q_PROPERTY(bool Visible READ visible NOTIFY VisibleChanged)
void Exit();
void Hide();
void Show();
void ShowByMode(qlonglong in0);
void Toggle();
signals:
void Closed();
void Shown();
void VisibleChanged(bool visible);
private:
explicit LauncherController(QObject *parent=nullptr);
QTimer *m_timer;
Launcher1Adaptor * m_launcher1Adaptor;
bool m_visible;
QString m_currentFrame;
bool m_pendingHide = false;
};