drop kde4 from master

This commit is contained in:
arcan1s
2015-05-20 00:36:48 +03:00
parent 3bac9ac09f
commit a53c5ec38c
93 changed files with 47 additions and 7457 deletions

View File

@ -4,28 +4,20 @@ set (PLUGIN_NAME ${SUBPROJECT})
message (STATUS "Subproject ${SUBPROJECT}")
# find required libaries
if (BUILD_KDE4)
find_package (KDE4 REQUIRED)
include (KDE4Defaults)
find_package (Qt5 REQUIRED COMPONENTS DBus Network Widgets Xml)
find_package (ECM 0.0.11 REQUIRED NO_MODULE)
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
find_package (KF5 REQUIRED COMPONENTS Plasma Service WindowSystem)
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
set (KDE_INCLUDE ${KDE4_INCLUDES})
else ()
find_package (Qt5 REQUIRED COMPONENTS DBus Network Widgets Xml)
find_package (ECM 0.0.11 REQUIRED NO_MODULE)
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
find_package (KF5 REQUIRED COMPONENTS Plasma Service WindowSystem)
include (KDEInstallDirs)
include (KDECMakeSettings)
include (KDECompilerSettings)
include (KDEInstallDirs)
include (KDECMakeSettings)
include (KDECompilerSettings)
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS}
${Qt5Network_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Xml_DEFINITIONS})
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS}
${Qt5Network_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Xml_INCLUDE_DIRS})
set (KDE_INCLUDE ${Plasma_INCLUDE_DIR})
endif ()
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS}
${Qt5Network_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Xml_DEFINITIONS})
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS}
${Qt5Network_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Xml_INCLUDE_DIRS})
set (KDE_INCLUDE ${Plasma_INCLUDE_DIR})
include_directories (${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
@ -49,26 +41,15 @@ set (SUBPROJECT_UPGRADE ${CMAKE_CURRENT_SOURCE_DIR}/upgrade)
configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
# make
if (BUILD_KDE4)
qt4_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
kde4_add_ui_files (SUBPROJECT_SOURCE ${SUBPROJECT_UI})
kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE} ${TASK_MOC_SOURCE})
target_link_libraries (${PLUGIN_NAME} ${KDE4_KDECORE_LIBS} ${KDE4_PLASMA_LIBS}
${QT_QTNETWORK_LIBRARY} ${QT_QTXML_LIBRARY})
else ()
qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
qt5_wrap_ui (SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
add_library (${PLUGIN_NAME} MODULE ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER} ${TASK_MOC_SOURCE})
target_link_libraries (${PLUGIN_NAME} ${Plasma_LIBRARIES} KF5::WindowSystem
${Qt5DBus_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Xml_LIBRARIES})
kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
endif ()
qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
qt5_wrap_ui (SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
add_library (${PLUGIN_NAME} MODULE ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER} ${TASK_MOC_SOURCE})
target_link_libraries (${PLUGIN_NAME} ${Plasma_LIBRARIES} KF5::WindowSystem
${Qt5DBus_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Xml_LIBRARIES})
kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
# install
if (BUILD_KDE4)
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR})
else ()
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine)
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine)
endif ()
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
install (FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR})

View File

@ -33,6 +33,7 @@
#include <QRegExp>
#include <QTextCodec>
#include <QSettings>
#include <QStandardPaths>
#include <pdebug/pdebug.h>
#include <task/taskadds.h>
@ -42,14 +43,6 @@
#include "extupgrade.h"
#include "version.h"
// KF5-KDE4 compability
#ifdef BUILD_KDE4
#include <KGlobal>
#include <KStandardDirs>
#else
#include <QStandardPaths>
#endif /* BUILD_KDE4 */
ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList &args)
: Plasma::DataEngine(parent, args)
@ -137,25 +130,15 @@ void ExtendedSysMon::initQuotes()
if (debug) qDebug() << PDEBUG;
// create directory at $HOME and create dirs list
QString localDir;
QStringList dirs;
#ifdef BUILD_KDE4
localDir = KStandardDirs::locateLocal("data", "awesomewidgets/quotes");
if (KStandardDirs::makeDir(localDir))
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
dirs = KGlobal::dirs()->findDirs("data", "awesomewidgets/quotes");
#else
localDir = QString("%1/awesomewidgets/quotes")
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
QString localDir = QString("%1/awesomewidgets/quotes")
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
QDir localDirectory;
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
QString("awesomewidgets/quotes"),
QStandardPaths::LocateDirectory);
#endif /* BUILD_KDE4 */
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
QString("awesomewidgets/quotes"),
QStandardPaths::LocateDirectory);
QStringList names;
for (int i=0; i<dirs.count(); i++) {
@ -176,25 +159,15 @@ void ExtendedSysMon::initScripts()
if (debug) qDebug() << PDEBUG;
// create directory at $HOME and create dirs list
QString localDir;
QStringList dirs;
#ifdef BUILD_KDE4
localDir = KStandardDirs::locateLocal("data", "awesomewidgets/scripts");
if (KStandardDirs::makeDir(localDir))
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
dirs = KGlobal::dirs()->findDirs("data", "awesomewidgets/scripts");
#else
localDir = QString("%1/awesomewidgets/scripts")
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
QString localDir = QString("%1/awesomewidgets/scripts")
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
QDir localDirectory;
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
QString("awesomewidgets/scripts"),
QStandardPaths::LocateDirectory);
#endif /* BUILD_KDE4 */
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
QString("awesomewidgets/scripts"),
QStandardPaths::LocateDirectory);
QStringList names;
for (int i=0; i<dirs.count(); i++) {
@ -215,25 +188,15 @@ void ExtendedSysMon::initUpgrade()
if (debug) qDebug() << PDEBUG;
// create directory at $HOME and create dirs list
QString localDir;
QStringList dirs;
#ifdef BUILD_KDE4
localDir = KStandardDirs::locateLocal("data", "awesomewidgets/upgrade");
if (KStandardDirs::makeDir(localDir))
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
dirs = KGlobal::dirs()->findDirs("data", "awesomewidgets/upgrade");
#else
localDir = QString("%1/awesomewidgets/upgrade")
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
QString localDir = QString("%1/awesomewidgets/upgrade")
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
QDir localDirectory;
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
QString("awesomewidgets/upgrade"),
QStandardPaths::LocateDirectory);
#endif /* BUILD_KDE4 */
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
QString("awesomewidgets/upgrade"),
QStandardPaths::LocateDirectory);
QStringList names;
for (int i=0; i<dirs.count(); i++) {
@ -276,12 +239,8 @@ void ExtendedSysMon::readConfiguration()
{
if (debug) qDebug() << PDEBUG;
QString fileName;
#ifdef BUILD_KDE4
fileName = KGlobal::dirs()->findResource("config", "plasma-dataengine-extsysmon.conf");
#else
fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("plasma-dataengine-extsysmon.conf"));
#endif /* BUILD_KDE4 */
QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation,
QString("plasma-dataengine-extsysmon.conf"));
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
QSettings settings(fileName, QSettings::IniFormat);
QMap<QString, QString> rawConfig;
@ -763,10 +722,6 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
}
#ifdef BUILD_KDE4
K_EXPORT_PLASMA_DATAENGINE(extsysmon, ExtendedSysMon)
#else
K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(extsysmon, ExtendedSysMon, "plasma-dataengine-extsysmon.json")
#endif /* BUILD_KDE4 */
#include "extsysmon.moc"