e6ac18366f2b207b1b1c79a73c09b4d4ae61c31e
[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     void setCurrent(const QString &current);
48
49 private:
50     void setLaunching(bool launching);
51
52 private:
53     bool m_launching;
54     QString m_current;
55     QTimer *m_timeout;
56     Launcher *m_launcher;
57 };
58
59 #endif // APPLICATIONLAUNCHER_H