GCC Code Coverage Report


Directory: ./
File: backends/qscreen/qscreenbackend.cpp
Date: 2023-04-20 22:59:23
Exec Total Coverage
Lines: 15 24 62.5%
Branches: 2 2 100.0%

Line Branch Exec Source
1 /*************************************************************************************
2 * Copyright (C) 2012 by Alejandro Fiestas Olivares <afiestas@kde.org> *
3 * Copyright (C) 2012, 2013 by Daniel Vrátil <dvratil@redhat.com> *
4 * Copyright 2014 Sebastian Kügler <sebas@kde.org> *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU Lesser General Public *
8 * License as published by the Free Software Foundation; either *
9 * version 2.1 of the License, or (at your option) any later version. *
10 * *
11 * This library is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14 * Lesser General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Lesser General Public *
17 * License along with this library; if not, write to the Free Software *
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
19 *************************************************************************************/
20 #include "qscreenbackend.h"
21 #include "qscreenconfig.h"
22 #include "qscreenoutput.h"
23
24 using namespace Disman;
25
26 QScreenConfig* QScreenBackend::s_internalConfig = nullptr;
27
28 5 QScreenBackend::QScreenBackend()
29 : Disman::BackendImpl()
30 5 , m_valid(true)
31 {
32
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 2 times.
5 if (s_internalConfig == nullptr) {
33 3 s_internalConfig = new QScreenConfig();
34 3 connect(s_internalConfig, &QScreenConfig::config_changed, this, [this] {
35 Q_EMIT config_changed(config());
36 });
37 }
38 5 }
39
40 20 QScreenBackend::~QScreenBackend()
41 {
42 20 }
43
44 11 QString QScreenBackend::name() const
45 {
46 11 return QStringLiteral("QScreen");
47 }
48
49 QString QScreenBackend::service_name() const
50 {
51 return QStringLiteral("org.kde.Disman.Backend.QScreen");
52 }
53
54 20 void QScreenBackend::update_config(ConfigPtr& config) const
55 {
56 20 s_internalConfig->update_config(config);
57 20 }
58
59 bool QScreenBackend::set_config_system([[maybe_unused]] const ConfigPtr& config)
60 {
61 qWarning() << "The QScreen backend for disman is read-only,";
62 qWarning() << "setting a configuration is not supported.";
63 qWarning() << "You can force another backend using the DISMAN_BACKEND env var.";
64 return false;
65 }
66
67 5 bool QScreenBackend::valid() const
68 {
69 5 return m_valid;
70 }
71