GCC Code Coverage Report


Directory: ./
File: ctl/watcher.cpp
Date: 2023-04-20 22:59:23
Exec Total Coverage
Lines: 0 9 0.0%
Branches: 0 0 -%

Line Branch Exec Source
1 /*
2 SPDX-FileCopyrightText: 2020 Roman Gilg <subdiff@gmail.com>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only
5 */
6 #include "watcher.h"
7 #include "doctor.h"
8
9 #include "configmonitor.h"
10
11 static QTextStream cout(stdout);
12 static QTextStream cerr(stderr);
13
14 namespace Disman::Ctl
15 {
16
17 Watcher::Watcher(Disman::ConfigPtr config, QObject* parent)
18 : QObject(parent)
19 , m_config{config}
20 {
21 Disman::ConfigMonitor::instance()->add_config(m_config);
22 connect(Disman::ConfigMonitor::instance(),
23 &Disman::ConfigMonitor::configuration_changed,
24 this,
25 &Watcher::changed,
26 Qt::UniqueConnection);
27
28 cout << "-- Current config --" << Qt::endl;
29 Doctor::showOutputs(m_config);
30 }
31
32 void Watcher::changed()
33 {
34 cout << "\n-- Config change " << ++m_count << " --" << Qt::endl;
35 Doctor::showOutputs(m_config);
36 }
37
38 }
39