Plasma

timetracker.h
1 /*
2  SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef TIMETRACKER_H
8 #define TIMETRACKER_H
9 
10 #include <QDateTime>
11 #include <QObject>
12 #include <QVariantMap>
13 #include <QVector>
14 
15 #include "plasma/plasma_export.h"
16 
17 namespace Plasma
18 {
19 class Containment;
20 class Applet;
21 
22 struct TimeEvent {
23  QDateTime moment;
24  QString comment;
25 };
26 
27 struct ObjectHistory {
28  QVariantMap initial;
29  QVector<TimeEvent> events;
30 };
31 
32 /**
33  * This debugging class is meant to provide an overview of how the objects change
34  * over time and hopefully provide the information required to detect buggy initialization.
35  *
36  * To use it, you'll pass the object you want to track to the constructor and the TimeTracker
37  * will use Qt introspection to read the properties and check what values they have and how they
38  * change.
39  *
40  * To analyze the results one can read the generated json file /tmp/debug-$USER, as soon
41  * as the process has quit.
42  */
43 
44 class PLASMA_EXPORT TimeTracker : public QObject
45 {
46  Q_OBJECT
47 public:
48  explicit TimeTracker(QObject *applet);
49  ~TimeTracker() override;
50 
51 private Q_SLOTS:
52  void init();
53  void sync();
54  void propertyChanged();
55 
56 private:
57  ObjectHistory m_history;
58 };
59 
60 }
61 
62 #endif // TIMETRACKER_H
Namespace for everything in libplasma.
Definition: datamodel.cpp:14
This debugging class is meant to provide an overview of how the objects change over time and hopefull...
Definition: timetracker.h:44
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Mar 23 2023 04:18:17 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.