Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qprocessscheduler_p.h
Go to the documentation of this file.
1// Copyright (C) 2025 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QPROCESSSCHEDULER_P_H
5#define QPROCESSSCHEDULER_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/qobject.h>
19#include <QtCore/qprocess.h>
20#include <QtCore/qlist.h>
21#include <QtCore/qbytearray.h>
22#include <QtCore/qqueue.h>
23
24QT_BEGIN_NAMESPACE
25namespace QmlLsp {
26
28{
30public:
31 using Id = QByteArray;
32 struct Command
33 {
37
38 friend bool comparesEqual(const Command &a, const Command &b) noexcept
39 {
40 return a.program == b.program && a.arguments == b.arguments
41 && a.customEnvironment == b.customEnvironment;
42 }
44 };
45
47 {
49 friend bool comparesEqual(const StartMarker &a, const StartMarker &b) noexcept
50 {
51 return a.id == b.id;
52 }
54 };
55 struct EndMarker
56 {
58 friend bool comparesEqual(const EndMarker &a, const EndMarker &b) noexcept
59 {
60 return a.id == b.id;
61 }
63 };
65
68
70 void done(const Id &id);
71 void started(const Id &id);
72 void cancelled(const Id &id);
73
74public Q_SLOTS:
75 void schedule(const QList<Command> &commands, const Id &id);
76 void cancel(const Id &id);
77
78private Q_SLOTS:
79 void processNext();
80 void onErrorOccurred(QProcess::ProcessError error);
81
82private:
83 QQueue<QueueElement> m_queue;
84 std::optional<Id> m_current;
85 QProcess m_process;
86 bool m_isRunning = false;
87};
88
89} // namespace QmlLsp
90
91QT_END_NAMESPACE
92
93#endif // QPROCESSSCHEDULER_P_H
Runs multiple processes sequentially via a QProcess, and signals once they are done.
void started(const Id &id)
void cancelled(const Id &id)
Combined button and popup list for selecting options.
static bool isStartMarkerOf(const QProcessScheduler::QueueElement &e, const QProcessScheduler::Id &id)
static bool isEndMarkerOf(const QProcessScheduler::QueueElement &e, const QProcessScheduler::Id &id)
friend bool comparesEqual(const Command &a, const Command &b) noexcept
friend bool comparesEqual(const EndMarker &a, const EndMarker &b) noexcept
friend bool comparesEqual(const StartMarker &a, const StartMarker &b) noexcept