Libksysguard

SensorQuery.h
1/*
2 SPDX-FileCopyrightText: 2020 Arjen Hiemstra <ahiemstra@heimr.nl>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "sensors_export.h"
10#include <QObject>
11#include <memory>
12
13namespace KSysGuard
14{
15class SensorInfo;
16
17/**
18 * An object to query the daemon for a list of sensors and their metadata.
19 *
20 * This class will request a list of sensors from the daemon, then filter them
21 * based on the supplied path. The path can include the wildcard "*" to get a
22 * list of all sensors matching the specified part of their path. In addition,
23 * if left empty, all sensors will be returned.
24 */
25class SENSORS_EXPORT SensorQuery : public QObject
26{
27 Q_OBJECT
28
29public:
30 SensorQuery(const QString &path = QString{}, QObject *parent = nullptr);
31 ~SensorQuery() override;
32
33 QString path() const;
34 void setPath(const QString &path);
35
36 /**
37 * A list of sensors ids that match the query.
38 */
39 QStringList sensorIds() const;
40 /**
41 * Sort the retrieved sensors by their user visible names.
42 */
43 void sortByName();
44
45 /**
46 * Start processing the query.
47 */
48 bool execute();
49 /**
50 * Wait for the query to finish.
51 *
52 * Mostly useful for code that needs the result to be available before
53 * continuing. Ideally the finished() signal should be used instead.
54 */
55 bool waitForFinished();
56
57 Q_SIGNAL void finished(SensorQuery *query);
58
59private:
60 friend class Sensor;
61 friend class SensorTreeModel;
63
64 class Private;
65 const std::unique_ptr<Private> d;
66};
67
68} // namespace KSysGuard
An object to query the daemon for a list of sensors and their metadata.
Definition SensorQuery.h:26
A model representing a tree of sensors that are available from the daemon.
An object encapsulating a backend sensor.
Definition Sensor.h:35
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:58:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.