~alan-griffiths/qtmir/migrate-to-mir-Server-API

« back to all changes in this revision

Viewing changes to src/modules/Unity/Application/taskcontroller.h

  • Committer: Gerry Boland
  • Date: 2014-07-01 13:38:06 UTC
  • mto: This revision was merged to the branch mainline in revision 158.
  • Revision ID: gerry.boland@canonical.com-20140701133806-lwfnplkijthydzj4
Update QML plugin: rename to Unity.Application, merge latest unity-mir changes, add tests (not passing yet) and use category logging

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2013 Canonical, Ltd.
 
2
 * Copyright (C) 2013-2014 Canonical, Ltd.
3
3
 *
4
4
 * This program is free software: you can redistribute it and/or modify it under
5
5
 * the terms of the GNU Lesser General Public License version 3, as published by
22
22
#include <QObject>
23
23
 
24
24
#include "application.h"
 
25
#include "applicationcontroller.h"
 
26
#include "processcontroller.h"
25
27
 
26
28
extern "C" {
27
29
    #include "ubuntu-app-launch.h"
28
30
}
29
31
 
 
32
namespace qtmir
 
33
{
 
34
 
30
35
class TaskController : public QObject
31
36
{
32
37
    Q_OBJECT
33
38
public:
34
 
    static TaskController* singleton();
 
39
    TaskController(
 
40
            QObject *parent,
 
41
            const QSharedPointer<ApplicationController> &appController,
 
42
            const QSharedPointer<ProcessController> &processController = QSharedPointer<ProcessController>(new ProcessController()));
35
43
    ~TaskController();
36
44
 
37
 
    bool start(const QString& appId, const QStringList& args);
38
 
    bool stop(const QString& appId);
39
 
 
40
 
    bool suspend(const QString& appId);
41
 
    bool resume(const QString& appId);
42
 
 
43
 
    bool appIdHasProcessId(const QString& appId, const quint64 pid);
 
45
    bool start(const QString &appId, const QStringList &args);
 
46
    bool stop(const QString &appId);
 
47
 
 
48
    bool suspend(const QString &appId);
 
49
    bool resume(const QString &appId);
 
50
 
 
51
    bool appIdHasProcessId(const QString &appId, const quint64 pid);
 
52
    QFileInfo findDesktopFileForAppId(const QString &appId) const;
44
53
 
45
54
Q_SIGNALS:
46
 
    void processStartReport(const QString& appId, const bool failure);
47
 
    void processStopped(const QString& appId, const bool unexpectedly);
48
 
    void requestFocus(const QString& appId);
49
 
    void requestResume(const QString& appId);
 
55
    void processStarting(const QString &appId);
 
56
    void processStopped(const QString &appId);
 
57
    void processFailed(const QString &appId, const bool duringStartup);
 
58
    void requestFocus(const QString &appId);
 
59
    void requestResume(const QString &appId);
 
60
 
 
61
private Q_SLOTS:
 
62
    void onApplicationStarted(const QString &id);
 
63
    void onApplicationFocusRequest(const QString &id);
 
64
    void onApplicationResumeRequest(const QString &id);
 
65
 
 
66
    void onApplicationError(const QString &id, ApplicationController::Error error);
50
67
 
51
68
private:
52
 
    TaskController(QObject *parent = 0);
53
 
 
54
 
    static TaskController* m_theTaskController;
55
 
    UbuntuAppLaunchAppObserver preStartCallback, startedCallback, stopCallback, focusCallback, resumeCallback;
56
 
    UbuntuAppLaunchAppFailedObserver failureCallback;
 
69
    QSharedPointer<ApplicationController> m_appController;
 
70
    QSharedPointer<ProcessController> m_processController;
57
71
};
58
72
 
 
73
} // namespace qtmir
 
74
 
59
75
#endif // TASKCONTROLLER_H