33#include <QVariantList>
34#include <QQmlExtensionPlugin>
37#include <condition_variable>
59 enum class Kind { Timed, Signal };
120 QString
text()
const {
return text_; }
199 std::condition_variable *changeSignal{
nullptr};
201 std::string *outputBuffer{
nullptr};
209 std::shared_ptr<bool> execute;
211 std::condition_variable *executionSignal{
nullptr};
228 void startModules_(std::vector<ModuleSpec> specs);
246 void bridgeLoop_(ModuleSlot *slot);
253 void signalWaitLoop_();
259 void rebuildCombinedText_();
268 QString delimiter_{ QStringLiteral(
" | ") };
271 std::shared_ptr<std::mutex> mutex_;
273 std::shared_ptr<std::condition_variable> stopSignal_;
275 std::shared_ptr<bool> stop_;
283 std::deque<ModuleSlot> slots_;
285 std::thread signalWaitThread_;
294 bool signalsActive_{
false};
308 Q_PLUGIN_METADATA(IID
"org.qt-project.Qt.QQmlExtensionInterface")
Q_INVOKABLE void setModules(const QVariantList &specs)
(Re)configure the running modules from QML
QString delimiter
Separator inserted between adjacent module outputs.
Definition plasma-show-stdout.hpp:86
void textChanged()
Change-notification signal for the text property.
ScriptOutput(QObject *parent=nullptr)
QML constructor.
void delimiterChanged()
Change-notification signal for the delimiter property.
QString hostName
Command name of the host process, as pkill matches it (constant).
Definition plasma-show-stdout.hpp:92
void setDelimiter(const QString &delimiter)
Set the delimiter inserted between module outputs.
int maxSignalOffset() const
Largest valid realtime-signal offset.
int maxSignalOffset
Largest valid realtime-signal offset, SIGRTMAX - SIGRTMIN (constant).
Definition plasma-show-stdout.hpp:88
qint64 hostPid
PID of the host process the plugin is loaded into (constant).
Definition plasma-show-stdout.hpp:90
qint64 hostPid() const
PID of the process hosting this plugin.
QString text
Combined, delimiter-joined output of all modules (read-only).
Definition plasma-show-stdout.hpp:84
QString delimiter() const
Delimiter inserted between module outputs.
Definition plasma-show-stdout.hpp:125
QString hostName() const
Command name of the process hosting this plugin.
QML extension plugin registering the ScriptOutput type.
Definition plasma-show-stdout.hpp:305
void registerTypes(const char *uri) override
Register the plugin's QML types.
Inert description of one module.
Definition plasma-show-stdout.hpp:57
std::chrono::duration< uint32_t > interval
Polling interval (Timed modules only).
Definition plasma-show-stdout.hpp:65
size_t outputLimit
Maximum number of output characters to retain.
Definition plasma-show-stdout.hpp:69
Kind kind
Trigger kind.
Definition plasma-show-stdout.hpp:61
int signalNumber
Realtime signal to listen on, e.g. SIGRTMIN+2 (Signal modules only).
Definition plasma-show-stdout.hpp:67
Kind
How the module is triggered.
Definition plasma-show-stdout.hpp:59
std::filesystem::path script
Path to the script to run.
Definition plasma-show-stdout.hpp:63