diff --git a/kded/CMakeLists.txt b/kded/CMakeLists.txt index 56ac2d5..506d5cd 100644 --- a/kded/CMakeLists.txt +++ b/kded/CMakeLists.txt @@ -1,54 +1,55 @@ add_definitions(-DTRANSLATION_DOMAIN=\"kscreen\") include_directories(${CMAKE_CURRENT_BINARY_DIR}/../ ${CMAKE_SOURCE_DIR}/kcm/src) set(kscreen_daemon_SRCS daemon.cpp config.cpp + output.cpp generator.cpp device.cpp osd.cpp osdmanager.cpp osdaction.cpp ${CMAKE_SOURCE_DIR}/kcm/src/utils.cpp ) ecm_qt_declare_logging_category(kscreen_daemon_SRCS HEADER kscreen_daemon_debug.h IDENTIFIER KSCREEN_KDED CATEGORY_NAME kscreen.kded) qt5_add_dbus_interface(kscreen_daemon_SRCS org.freedesktop.DBus.Properties.xml freedesktop_interface) qt5_add_dbus_adaptor(kscreen_daemon_SRCS org.kde.KScreen.xml daemon.h KScreenDaemon ) add_library(kscreen MODULE ${kscreen_daemon_SRCS}) target_link_libraries(kscreen Qt5::Widgets Qt5::DBus Qt5::Quick KF5::Declarative KF5::Screen KF5::DBusAddons KF5::I18n KF5::XmlGui KF5::GlobalAccel) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/kscreen.desktop.cmake ${CMAKE_CURRENT_BINARY_DIR}/kscreen.desktop @ONLY) kcoreaddons_desktop_to_json(kscreen ${CMAKE_CURRENT_BINARY_DIR}/kscreen.desktop) install(TARGETS kscreen DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/kded) set(QML_FILES qml/Osd.qml qml/OsdItem.qml qml/OsdSelector.qml qml/OutputIdentifier.qml ) install(FILES ${QML_FILES} DESTINATION ${KDE_INSTALL_DATADIR}/kded_kscreen/qml) diff --git a/kded/config.cpp b/kded/config.cpp index cac3544..6dc1cc7 100644 --- a/kded/config.cpp +++ b/kded/config.cpp @@ -1,364 +1,228 @@ /******************************************************************** Copyright 2012 Alejandro Fiestas Olivares Copyright 2019 Roman Gilg This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ #include "config.h" +#include "output.h" #include "kscreen_daemon_debug.h" -#include "generator.h" #include "device.h" -#include -#include #include #include #include -#include #include #include #include #include #include -#include QString Config::s_fixedConfigFileName = QStringLiteral("fixed-config"); QString Config::s_dirPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) % QStringLiteral("/kscreen/"); QString Config::s_configsDirName = QStringLiteral("" /*"configs/"*/); // TODO: KDE6 - move these files into the subfolder QString Config::configsDirPath() { return s_dirPath % s_configsDirName; } Config::Config(KScreen::ConfigPtr config) : m_data(config) { } void Config::setDirPath(const QString &path) { s_dirPath = path; if (!s_dirPath.endsWith(QLatin1Char('/'))) { s_dirPath += QLatin1Char('/'); } } QString Config::filePath() { if (!QDir().mkpath(configsDirPath())) { return QString(); } return configsDirPath() % id(); } QString Config::id() const { if (!m_data) { return QString(); } return m_data->connectedOutputsHash(); } bool Config::fileExists() const { return (QFile::exists(configsDirPath() % id()) || QFile::exists(configsDirPath() % s_fixedConfigFileName)); } std::unique_ptr Config::readFile() { if (Device::self()->isLaptop() && !Device::self()->isLidClosed()) { // We may look for a config that has been set when the lid was closed, Bug: 353029 const QString lidOpenedFilePath(filePath() % QStringLiteral("_lidOpened")); const QFile srcFile(lidOpenedFilePath); if (srcFile.exists()) { QFile::remove(filePath()); if (QFile::copy(lidOpenedFilePath, filePath())) { QFile::remove(lidOpenedFilePath); qCDebug(KSCREEN_KDED) << "Restored lid opened config to" << id(); } } } return readFile(id()); } std::unique_ptr Config::readOpenLidFile() { const QString openLidFilePath = filePath() % QStringLiteral("_lidOpened"); auto config = readFile(openLidFilePath); QFile::remove(openLidFilePath); return config; } std::unique_ptr Config::readFile(const QString &fileName) { if (!m_data) { return nullptr; } KScreen::ConfigPtr config = m_data->clone(); QFile file; if (QFile::exists(configsDirPath() % s_fixedConfigFileName)) { file.setFileName(configsDirPath() % s_fixedConfigFileName); qCDebug(KSCREEN_KDED) << "found a fixed config, will use " << file.fileName(); } else { file.setFileName(configsDirPath() % fileName); } if (!file.open(QIODevice::ReadOnly)) { qCDebug(KSCREEN_KDED) << "failed to open file" << file.fileName(); return nullptr; } - KScreen::OutputList outputList = config->outputs(); QJsonDocument parser; QVariantList outputs = parser.fromJson(file.readAll()).toVariant().toList(); - Q_FOREACH(KScreen::OutputPtr output, outputList) { - if (!output->isConnected() && output->isEnabled()) { - output->setEnabled(false); - } - } + Output::readInOutputs(config->outputs(), outputs); QSize screenSize; - Q_FOREACH(const QVariant &info, outputs) { - KScreen::OutputPtr output = findOutput(config, info.toMap()); - if (!output) { + for (const auto &output : config->outputs()) { + if (!output->isConnected() || !output->isEnabled()) { continue; } - if (output->isEnabled()) { - const QRect geom = output->geometry(); - if (geom.x() + geom.width() > screenSize.width()) { - screenSize.setWidth(geom.x() + geom.width()); - } - if (geom.y() + geom.height() > screenSize.height()) { - screenSize.setHeight(geom.y() + geom.height()); - } + const QRect geom = output->geometry(); + if (geom.x() + geom.width() > screenSize.width()) { + screenSize.setWidth(geom.x() + geom.width()); + } + if (geom.y() + geom.height() > screenSize.height()) { + screenSize.setHeight(geom.y() + geom.height()); } - - outputList.remove(output->id()); - outputList.insert(output->id(), output); } - config->setOutputs(outputList); config->screen()->setCurrentSize(screenSize); if (!canBeApplied(config)) { return nullptr; } auto cfg = std::unique_ptr(new Config(config)); cfg->setValidityFlags(m_validityFlags); return cfg; } bool Config::canBeApplied() const { return canBeApplied(m_data); } bool Config::canBeApplied(KScreen::ConfigPtr config) const { #ifdef KDED_UNIT_TEST Q_UNUSED(config); return true; #else return KScreen::Config::canBeApplied(config, m_validityFlags); #endif } bool Config::writeFile() { return writeFile(filePath()); } bool Config::writeOpenLidFile() { return writeFile(filePath() % QStringLiteral("_lidOpened")); } -static QVariantMap metadata(const KScreen::OutputPtr &output) -{ - QVariantMap metadata; - metadata[QStringLiteral("name")] = output->name(); - if (!output->edid() || !output->edid()->isValid()) { - return metadata; - } - - metadata[QStringLiteral("fullname")] = output->edid()->deviceId(); - return metadata; -} - bool Config::writeFile(const QString &filePath) { if (!m_data) { return false; } const KScreen::OutputList outputs = m_data->outputs(); QVariantList outputList; Q_FOREACH(const KScreen::OutputPtr &output, outputs) { + QVariantMap info; + if (!output->isConnected()) { continue; } + if (!Output::writeGlobalPart(output, info)) { + continue; + } - QVariantMap info; - - info[QStringLiteral("id")] = output->hash(); info[QStringLiteral("primary")] = output->isPrimary(); info[QStringLiteral("enabled")] = output->isEnabled(); - info[QStringLiteral("rotation")] = output->rotation(); - info[QStringLiteral("scale")] = output->scale(); QVariantMap pos; pos[QStringLiteral("x")] = output->pos().x(); pos[QStringLiteral("y")] = output->pos().y(); info[QStringLiteral("pos")] = pos; - if (output->isEnabled()) { - const KScreen::ModePtr mode = output->currentMode(); - if (!mode) { - qWarning() << "CurrentMode is null" << output->name(); - return false; - } - - QVariantMap modeInfo; - modeInfo[QStringLiteral("refresh")] = mode->refreshRate(); - - QVariantMap modeSize; - modeSize[QStringLiteral("width")] = mode->size().width(); - modeSize[QStringLiteral("height")] = mode->size().height(); - modeInfo[QStringLiteral("size")] = modeSize; - - info[QStringLiteral("mode")] = modeInfo; - } - - info[QStringLiteral("metadata")] = metadata(output); + // try to update global output data + Output::writeGlobal(output); outputList.append(info); } QFile file(filePath); if (!file.open(QIODevice::WriteOnly)) { qCWarning(KSCREEN_KDED) << "Failed to open config file for writing! " << file.errorString(); return false; } file.write(QJsonDocument::fromVariant(outputList).toJson()); qCDebug(KSCREEN_KDED) << "Config saved on: " << file.fileName(); return true; } -KScreen::OutputPtr Config::findOutput(const KScreen::ConfigPtr &config, const QVariantMap& info) -{ - const KScreen::OutputList outputs = config->outputs(); // As individual outputs are indexed by a hash of their edid, which is not unique, - // to be able to tell apart multiple identical outputs, these need special treatment - QStringList duplicateIds; - QStringList allIds; - allIds.reserve(outputs.count()); - Q_FOREACH (const KScreen::OutputPtr &output, outputs) { - const auto outputId = output->hash(); - if (allIds.contains(outputId) && !duplicateIds.contains(outputId)) { - duplicateIds << outputId; - } - allIds << outputId; - } - allIds.clear(); - - Q_FOREACH(KScreen::OutputPtr output, outputs) { - if (!output->isConnected()) { - continue; - } - const auto outputId = output->hash(); - if (outputId != info[QStringLiteral("id")].toString()) { - continue; - } - - // We may have identical outputs connected, these will have the same id in the config - // in order to find the right one, also check the output's name (usually the connector) - if (!output->name().isEmpty() && duplicateIds.contains(outputId)) { - const auto metadata = info[QStringLiteral("metadata")].toMap(); - const auto outputName = metadata[QStringLiteral("name")].toString(); - if (output->name() != outputName) { - continue; - } - } - - const QVariantMap posInfo = info[QStringLiteral("pos")].toMap(); - QPoint point(posInfo[QStringLiteral("x")].toInt(), posInfo[QStringLiteral("y")].toInt()); - output->setPos(point); - output->setPrimary(info[QStringLiteral("primary")].toBool()); - output->setEnabled(info[QStringLiteral("enabled")].toBool()); - output->setRotation(static_cast(info[QStringLiteral("rotation")].toInt())); - output->setScale(info.value(QStringLiteral("scale"), 1).toInt()); - - const QVariantMap modeInfo = info[QStringLiteral("mode")].toMap(); - const QVariantMap modeSize = modeInfo[QStringLiteral("size")].toMap(); - const QSize size = QSize(modeSize[QStringLiteral("width")].toInt(), modeSize[QStringLiteral("height")].toInt()); - - qCDebug(KSCREEN_KDED) << "Finding a mode for" << size << "@" << modeInfo[QStringLiteral("refresh")].toFloat(); - - KScreen::ModeList modes = output->modes(); - KScreen::ModePtr matchingMode; - Q_FOREACH(const KScreen::ModePtr &mode, modes) { - if (mode->size() != size) { - continue; - } - if (!qFuzzyCompare(mode->refreshRate(), modeInfo[QStringLiteral("refresh")].toFloat())) { - continue; - } - - qCDebug(KSCREEN_KDED) << "\tFound: " << mode->id() << " " << mode->size() << "@" << mode->refreshRate(); - matchingMode = mode; - break; - } - - if (!matchingMode) { - qCWarning(KSCREEN_KDED) << "\tFailed to find a matching mode - this means that our config is corrupted" - "or a different device with the same serial number has been connected (very unlikely)." - "Falling back to preferred modes."; - matchingMode = output->preferredMode(); - - if (!matchingMode) { - qCWarning(KSCREEN_KDED) << "\tFailed to get a preferred mode, falling back to biggest mode."; - matchingMode = Generator::biggestMode(modes); - - if (!matchingMode) { - qCWarning(KSCREEN_KDED) << "\tFailed to get biggest mode. Which means there are no modes. Turning off the screen."; - output->setEnabled(false); - return output; - } - } - } - - output->setCurrentModeId(matchingMode->id()); - return output; - } - - qCWarning(KSCREEN_KDED) << "\tFailed to find a matching output in the current config - this means that our config is corrupted" - "or a different device with the same serial number has been connected (very unlikely)."; - return KScreen::OutputPtr(); -} - void Config::log() { if (!m_data) { return; } const auto outputs = m_data->outputs(); for (const auto o : outputs) { if (o->isConnected()) { qCDebug(KSCREEN_KDED) << o; } } } diff --git a/kded/config.h b/kded/config.h index 7412c77..725fc79 100644 --- a/kded/config.h +++ b/kded/config.h @@ -1,78 +1,77 @@ /******************************************************************** Copyright 2019 Roman Gilg This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ #ifndef KDED_CONFIG_H #define KDED_CONFIG_H #include #include #include #include class Config { public: explicit Config(KScreen::ConfigPtr config); ~Config() = default; static void setDirPath(const QString &path); + static QString dirPath() { + return s_dirPath; + } QString id() const; bool fileExists() const; std::unique_ptr readFile(); std::unique_ptr readOpenLidFile(); bool writeFile(); bool writeOpenLidFile(); KScreen::ConfigPtr data() const { return m_data; } void log(); void setValidityFlags(KScreen::Config::ValidityFlags flags) { m_validityFlags = flags; } bool canBeApplied() const; private: friend class TestConfig; QString filePath(); std::unique_ptr readFile(const QString &fileName); bool writeFile(const QString &filePath); bool canBeApplied(KScreen::ConfigPtr config) const; - // this could probably be done on m_data - KScreen::OutputPtr findOutput(const KScreen::ConfigPtr &config, const QVariantMap &info); - KScreen::ConfigPtr m_data; - KScreen::Config::ValidityFlags m_validityFlags; static QString s_dirPath; static QString s_configsDirName; static QString s_fixedConfigFileName; static QString configsDirPath(); }; #endif diff --git a/kded/output.cpp b/kded/output.cpp new file mode 100644 index 0000000..3f89b5d --- /dev/null +++ b/kded/output.cpp @@ -0,0 +1,245 @@ +/******************************************************************** +Copyright 2019 Roman Gilg + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*********************************************************************/ +#include "output.h" +#include "config.h" + +#include "kscreen_daemon_debug.h" +#include "generator.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +QString Output::s_dirName = QStringLiteral("outputs/"); + +QString Output::dirPath() +{ + return Config::dirPath() % s_dirName; +} + +QString Output::globalFileName(const QString &hash) +{ + const auto dir = dirPath(); + if (!QDir().mkpath(dir)) { + return QString(); + } + return dir % hash; +} + +void Output::readInGlobalPartFromInfo(KScreen::OutputPtr output, const QVariantMap &info) +{ + output->setRotation(static_cast(info.value(QStringLiteral("rotation"), 1).toInt())); + output->setScale(info.value(QStringLiteral("scale"), 1).toInt()); + + const QVariantMap modeInfo = info[QStringLiteral("mode")].toMap(); + const QVariantMap modeSize = modeInfo[QStringLiteral("size")].toMap(); + const QSize size = QSize(modeSize[QStringLiteral("width")].toInt(), modeSize[QStringLiteral("height")].toInt()); + + qCDebug(KSCREEN_KDED) << "Finding a mode for" << size << "@" << modeInfo[QStringLiteral("refresh")].toFloat(); + + KScreen::ModeList modes = output->modes(); + KScreen::ModePtr matchingMode; + for(const KScreen::ModePtr &mode : modes) { + if (mode->size() != size) { + continue; + } + if (!qFuzzyCompare(mode->refreshRate(), modeInfo[QStringLiteral("refresh")].toFloat())) { + continue; + } + + qCDebug(KSCREEN_KDED) << "\tFound: " << mode->id() << " " << mode->size() << "@" << mode->refreshRate(); + matchingMode = mode; + break; + } + + if (!matchingMode) { + qCWarning(KSCREEN_KDED) << "\tFailed to find a matching mode - this means that our config is corrupted" + "or a different device with the same serial number has been connected (very unlikely)." + "Falling back to preferred modes."; + matchingMode = output->preferredMode(); + } + if (!matchingMode) { + qCWarning(KSCREEN_KDED) << "\tFailed to get a preferred mode, falling back to biggest mode."; + matchingMode = Generator::biggestMode(modes); + } + if (!matchingMode) { + qCWarning(KSCREEN_KDED) << "\tFailed to get biggest mode. Which means there are no modes. Turning off the screen."; + output->setEnabled(false); + return; + } + + output->setCurrentModeId(matchingMode->id()); +} + +QVariantMap Output::getGlobalData(KScreen::OutputPtr output) +{ + QFile file(globalFileName(output->hashMd5())); + if (!file.open(QIODevice::ReadOnly)) { + qCDebug(KSCREEN_KDED) << "Failed to open file" << file.fileName(); + return QVariantMap(); + } + QJsonDocument parser; + return parser.fromJson(file.readAll()).toVariant().toMap(); +} + +bool Output::readInGlobal(KScreen::OutputPtr output) +{ + const QVariantMap info = getGlobalData(output); + if (info.empty()) { + // if info is empty, the global file does not exists, or is in an unreadable state + return false; + } + readInGlobalPartFromInfo(output, info); + return true; +} + +void Output::readIn(KScreen::OutputPtr output, const QVariantMap &info) +{ + const QVariantMap posInfo = info[QStringLiteral("pos")].toMap(); + QPoint point(posInfo[QStringLiteral("x")].toInt(), posInfo[QStringLiteral("y")].toInt()); + output->setPos(point); + output->setPrimary(info[QStringLiteral("primary")].toBool()); + output->setEnabled(info[QStringLiteral("enabled")].toBool()); + + if (!readInGlobal(output)) { + // read in global part from config info instead + readInGlobalPartFromInfo(output, info); + } +} + +void Output::readInOutputs(KScreen::OutputList outputs, const QVariantList &outputsInfo) +{ + // As global outputs are indexed by a hash of their edid, which is not unique, + // to be able to tell apart multiple identical outputs, these need special treatment + QStringList duplicateIds; + { + QStringList allIds; + allIds.reserve(outputs.count()); + for (const KScreen::OutputPtr &output : outputs) { + const auto outputId = output->hash(); + if (allIds.contains(outputId) && !duplicateIds.contains(outputId)) { + duplicateIds << outputId; + } + allIds << outputId; + } + allIds.clear(); + } + + for (KScreen::OutputPtr output : outputs) { + if (!output->isConnected()) { + output->setEnabled(false); + continue; + } + const auto outputId = output->hash(); + bool infoFound = false; + for (const auto &variantInfo : outputsInfo) { + const QVariantMap info = variantInfo.toMap(); + if (outputId == info[QStringLiteral("id")].toString()) { + + // We may have identical outputs connected, these will have the same id in the config + // in order to find the right one, also check the output's name (usually the connector) + if (!output->name().isEmpty() && duplicateIds.contains(outputId)) { + const auto metadata = info[QStringLiteral("metadata")].toMap(); + const auto outputName = metadata[QStringLiteral("name")].toString(); + if (output->name() != outputName) { + infoFound = true; + readIn(output, info); + } + // was a duplicate id, but info not for this output + continue; + } + infoFound = true; + readIn(output, info); + } + } + if (!infoFound) { + // no info in info for this output, try reading in global output info atleast or set some default values + + qCWarning(KSCREEN_KDED) << "\tFailed to find a matching output in the current info data - this means that our info is corrupted" + "or a different device with the same serial number has been connected (very unlikely)."; + if (!readInGlobal(output)) { + // set some default values instead + readInGlobalPartFromInfo(output, QVariantMap()); + } + } + } +} + +static QVariantMap metadata(const KScreen::OutputPtr &output) +{ + QVariantMap metadata; + metadata[QStringLiteral("name")] = output->name(); + if (!output->edid() || !output->edid()->isValid()) { + return metadata; + } + + metadata[QStringLiteral("fullname")] = output->edid()->deviceId(); + return metadata; +} + +bool Output::writeGlobalPart(const KScreen::OutputPtr &output, QVariantMap &info) +{ + if (!output->isEnabled()) { + return false; + } + const KScreen::ModePtr mode = output->currentMode(); + if (!mode) { + qWarning() << "CurrentMode is null" << output->name(); + return false; + } + + info[QStringLiteral("id")] = output->hash(); + info[QStringLiteral("rotation")] = output->rotation(); + info[QStringLiteral("scale")] = output->scale(); + info[QStringLiteral("metadata")] = metadata(output); + + QVariantMap modeInfo; + modeInfo[QStringLiteral("refresh")] = mode->refreshRate(); + + QVariantMap modeSize; + modeSize[QStringLiteral("width")] = mode->size().width(); + modeSize[QStringLiteral("height")] = mode->size().height(); + modeInfo[QStringLiteral("size")] = modeSize; + + info[QStringLiteral("mode")] = modeInfo; + + return true; +} + +void Output::writeGlobal(const KScreen::OutputPtr &output) +{ + // get old values and subsequently override + QVariantMap info = getGlobalData(output); + if (!writeGlobalPart(output, info)) { + return; + } + + QFile file(globalFileName(output->hashMd5())); + if (!file.open(QIODevice::WriteOnly)) { + qCWarning(KSCREEN_KDED) << "Failed to open global output file for writing! " << file.errorString(); + return; + } + + file.write(QJsonDocument::fromVariant(info).toJson()); + return; +} diff --git a/kded/output.h b/kded/output.h new file mode 100644 index 0000000..113bfb3 --- /dev/null +++ b/kded/output.h @@ -0,0 +1,45 @@ +/******************************************************************** +Copyright 2019 Roman Gilg + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*********************************************************************/ +#ifndef KDED_OUTPUT_H +#define KDED_OUTPUT_H + +#include + +#include + +class Output +{ +public: + static void readInOutputs(KScreen::OutputList outputs, const QVariantList &outputsInfo); + + static void writeGlobal(const KScreen::OutputPtr &output); + static bool writeGlobalPart(const KScreen::OutputPtr &output, QVariantMap &info); + + static QString dirPath(); + +private: + static QString globalFileName(const QString &hash); + static QVariantMap getGlobalData(KScreen::OutputPtr output); + + static void readIn(KScreen::OutputPtr output, const QVariantMap &info); + static bool readInGlobal(KScreen::OutputPtr output); + static void readInGlobalPartFromInfo(KScreen::OutputPtr output, const QVariantMap &info); + + static QString s_dirName; +}; + +#endif diff --git a/tests/kded/CMakeLists.txt b/tests/kded/CMakeLists.txt index c70097d..8c853ee 100644 --- a/tests/kded/CMakeLists.txt +++ b/tests/kded/CMakeLists.txt @@ -1,30 +1,31 @@ include_directories(${CMAKE_BINARY_DIR}) add_definitions(-DKDED_UNIT_TEST) macro(ADD_KDED_TEST testname) set(test_SRCS ${testname}.cpp ${CMAKE_SOURCE_DIR}/kded/generator.cpp ${CMAKE_SOURCE_DIR}/kded/device.cpp ${CMAKE_SOURCE_DIR}/kded/config.cpp + ${CMAKE_SOURCE_DIR}/kded/output.cpp #${CMAKE_SOURCE_DIR}/kded/daemon.cpp ) ecm_qt_declare_logging_category(test_SRCS HEADER kscreen_daemon_debug.h IDENTIFIER KSCREEN_KDED CATEGORY_NAME kscreen.kded) qt5_add_dbus_interface(test_SRCS ${CMAKE_SOURCE_DIR}/kded/org.freedesktop.DBus.Properties.xml freedesktop_interface ) add_executable(${testname} ${test_SRCS}) add_dependencies(${testname} kscreen) # make sure the dbus interfaces are generated target_compile_definitions(${testname} PRIVATE "-DTEST_DATA=\"${CMAKE_CURRENT_SOURCE_DIR}/\"") target_link_libraries(${testname} Qt5::Test Qt5::DBus Qt5::Gui KF5::Screen) add_test(NAME kscreen-kded-${testname} COMMAND ${testname}) ecm_mark_as_test(${testname}) endmacro() add_kded_test(testgenerator) add_kded_test(configtest) #add_kded_test(testdaemon)