10ea2eeae624ee14b86197d85a6729ce21012a27
[apps/homescreen.git] / homescreen / src / applicationlauncher.h
1 /*
2  * Copyright (C) 2016 The Qt Company Ltd.
3  * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH
4  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18
19 #ifndef APPLICATIONLAUNCHER_H
20 #define APPLICATIONLAUNCHER_H
21
22 #include <QTimer>
23 #include <QtCore/QObject>
24
25 #include "launcher.h"
26
27 class QTimer;
28
29 class ApplicationLauncher : public QObject
30 {
31     Q_OBJECT
32     Q_PROPERTY(bool launching READ isLaunching NOTIFY launchingChanged)
33     Q_PROPERTY(QString current READ current WRITE setCurrent NOTIFY currentChanged)
34 public:
35     explicit ApplicationLauncher(const QString &afm_conn_str, QObject *parent = NULL);
36
37     bool isLaunching() const;
38     QString current() const;
39
40 signals:
41     void newAppRequestsToBeVisible(int pid);
42     void launchingChanged(bool launching);
43     void currentChanged(const QString &current);
44
45 public slots:
46     int launch(const QString &application);
47     bool is_running(const QString &application);
48     void setCurrent(const QString &current);
49
50 private:
51     void setLaunching(bool launching);
52
53 private:
54     bool m_launching;
55     QString m_current;
56     QTimer *m_timeout;
57     Launcher *m_launcher;
58 };
59
60 #endif // APPLICATIONLAUNCHER_H