Purpose

jobcontroller.h
1/*
2 SPDX-FileCopyrightText: 2020 Nicolas Fella <nicolas.fella@gmx.de>
3 SPDX-License-Identifier: LGPL-2.1-or-later
4*/
5
6#ifndef JOBCONTROLLER_H
7#define JOBCONTROLLER_H
8
9#include <QObject>
10
11#include "alternativesmodel.h"
12#include "job.h"
13#include <purpose/purpose_export.h>
14
15namespace Purpose
16{
17class PURPOSE_EXPORT JobController : public QObject
18{
19 Q_OBJECT
20 Q_PROPERTY(AlternativesModel *model READ model WRITE setModel NOTIFY modelChanged)
21 Q_PROPERTY(int index READ index WRITE setIndex NOTIFY indexChanged)
22 Q_PROPERTY(State state READ state NOTIFY stateChanged)
23 Q_PROPERTY(Purpose::Configuration *configuration READ config NOTIFY configChanged)
24 Q_PROPERTY(Purpose::Job *job READ job NOTIFY jobChanged)
25
26public:
27 enum State {
28 Inactive = 0,
29 Configuring,
30 Running,
31 Finished,
32 Cancelled,
33 Error,
34 };
35 Q_ENUM(State)
36
37 AlternativesModel *model() const;
38 void setModel(AlternativesModel *model);
39
40 int index() const;
41 void setIndex(int index);
42
43 State state() const;
44
45 Configuration *config() const;
46
47 Job *job() const;
48
49 Q_INVOKABLE void configure();
50 Q_INVOKABLE void startJob();
51 Q_INVOKABLE void cancel();
52
53Q_SIGNALS:
54 void modelChanged();
55 void indexChanged();
56 void stateChanged();
57 void configChanged();
58 void jobChanged();
59
60private:
61 AlternativesModel *m_model = nullptr;
62 int m_index = -1;
63 Purpose::Configuration *m_configuration = nullptr;
64 State m_state = Inactive;
65 Job *m_job = nullptr;
66};
67
68}
69#endif
This class will be in charge of figuring out the job configuration.
Job that will actually perform the sharing.
Definition job.h:34
KGuiItem configure()
KGuiItem cancel()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:08:47 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.