Turn template into dataengine project.
This commit is contained in:
@@ -11,20 +11,18 @@ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
|
||||
include(KDEInstallDirs)
|
||||
include(KDECMakeSettings)
|
||||
include(KDECompilerSettings NO_POLICY_SCOPE)
|
||||
include(ECMInstallIcons)
|
||||
include(FeatureSummary)
|
||||
|
||||
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Widgets)
|
||||
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core)
|
||||
|
||||
find_package(KF5 ${KF_MIN_VERSION} REQUIRED COMPONENTS
|
||||
CoreAddons
|
||||
Service
|
||||
Plasma
|
||||
I18n
|
||||
)
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(icons)
|
||||
|
||||
# Make it possible to use the po files fetched by the fetch-translations step
|
||||
ki18n_install(po)
|
||||
|
||||
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||
|
||||
5
README
5
README
@@ -15,3 +15,8 @@ where $KDEDIRS points to your KDE installation prefix.
|
||||
Note: you can use another build path. Then cd in your build dir and:
|
||||
export KDE_SRC=path_to_your_src
|
||||
cmake $KDE_SRC -DCMAKE_INSTALL_PREFIX=$KDEDIRS -DCMAKE_BUILD_TYPE=Debug
|
||||
|
||||
Requires:
|
||||
* KDNSSD
|
||||
* youtube-dl
|
||||
* QtMultimedia
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
set( simplecastengine_SRCS
|
||||
main.cpp
|
||||
simplecastenginewindow.cpp
|
||||
simplecastengine.cpp
|
||||
)
|
||||
|
||||
ki18n_wrap_ui(simplecastengine_SRCS simplecastengine.ui)
|
||||
add_library( plasma_dataengine_simplecastengine ${simplecastengine_SRCS} )
|
||||
|
||||
add_executable( simplecastengine ${simplecastengine_SRCS} )
|
||||
kcoreaddons_desktop_to_json(plasma_dataengine_simplecastengine plasma_dataengine_simplecastengine.desktop)
|
||||
|
||||
target_link_libraries( simplecastengine
|
||||
KF5::CoreAddons
|
||||
target_link_libraries( plasma_dataengine_simplecastengine
|
||||
Qt5::Core
|
||||
KF5::Plasma
|
||||
KF5::Service
|
||||
KF5::I18n
|
||||
Qt5::Widgets
|
||||
)
|
||||
|
||||
install( TARGETS simplecastengine ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} )
|
||||
install( PROGRAMS org.example.simplecastengine.desktop DESTINATION ${KDE_INSTALL_APPDIR} )
|
||||
install( FILES org.example.simplecastengine.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR} )
|
||||
install(TARGETS plasma_dataengine_simplecastengine DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/dataengine)
|
||||
install( PROGRAMS org.eyecreate.simplecastengine.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} )
|
||||
|
||||
62
src/main.cpp
62
src/main.cpp
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
Copyright (C) %{CURRENT_YEAR} by %{AUTHOR} <%{EMAIL}>
|
||||
|
||||
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) version 3 or any later version
|
||||
accepted by the membership of KDE e.V. (or its successor approved
|
||||
by the membership of KDE e.V.), which shall act as a proxy
|
||||
defined in Section 14 of version 3 of the license.
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// application header
|
||||
#include "simplecastenginewindow.h"
|
||||
|
||||
// KF headers
|
||||
#include <KAboutData>
|
||||
#include <KLocalizedString>
|
||||
|
||||
// Qt headers
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication application(argc, argv);
|
||||
|
||||
KLocalizedString::setApplicationDomain("simplecastengine");
|
||||
|
||||
KAboutData aboutData( QStringLiteral("simplecastengine"),
|
||||
i18n("SimpleCastEngine"),
|
||||
QStringLiteral("%{VERSION}"),
|
||||
i18n("A Simple Application written with KDE Frameworks"),
|
||||
KAboutLicense::GPL,
|
||||
i18n("Copyright %{CURRENT_YEAR}, %{AUTHOR} <%{EMAIL}>"));
|
||||
|
||||
aboutData.addAuthor(i18n("%{AUTHOR}"),i18n("Author"), QStringLiteral("%{EMAIL}"));
|
||||
aboutData.setOrganizationDomain("example.org");
|
||||
aboutData.setDesktopFileName(QStringLiteral("org.example.simplecastengine"));
|
||||
|
||||
KAboutData::setApplicationData(aboutData);
|
||||
application.setWindowIcon(QIcon::fromTheme(QStringLiteral("simplecastengine")));
|
||||
|
||||
QCommandLineParser parser;
|
||||
aboutData.setupCommandLine(&parser);
|
||||
|
||||
parser.process(application);
|
||||
aboutData.processCommandLine(&parser);
|
||||
|
||||
SimpleCastEngineWindow *mainWindow = new SimpleCastEngineWindow;
|
||||
mainWindow->show();
|
||||
|
||||
return application.exec();
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<component type="desktop-application">
|
||||
<id>org.example.simplecastengine.desktop</id>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license> https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-metadata_license </project_license>
|
||||
<name>SimpleCastEngine</name>
|
||||
<summary> https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-summary </summary>
|
||||
<description>
|
||||
<p> https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-description </p>
|
||||
</description>
|
||||
<url type="homepage">https://www.example.org</url>
|
||||
<url type="bugtracker">https://bugs.example.org</url>
|
||||
<url type="donation">https://www.example.org/community/donations</url>
|
||||
<screenshots>
|
||||
<screenshot type="default">
|
||||
<image> https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-screenshots </image>
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
<provides>
|
||||
<binary>simplecastengine</binary>
|
||||
</provides>
|
||||
<project_group>KDE</project_group>
|
||||
</component>
|
||||
@@ -1,9 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
|
||||
Name=SimpleCastEngine
|
||||
GenericName=A Simple KDE Application
|
||||
Icon=simplecastengine
|
||||
|
||||
Exec=simplecastengine
|
||||
StartupWMClass=simplecastengine
|
||||
17
src/plasma_dataengine_simplecastengine.desktop
Normal file
17
src/plasma_dataengine_simplecastengine.desktop
Normal file
@@ -0,0 +1,17 @@
|
||||
[Desktop Entry]
|
||||
Name=Simple Cast Engine
|
||||
Comment=Data Engine that handles listing, queueing, and playing media URLs from other devices.
|
||||
Type=Service
|
||||
|
||||
X-KDE-ServiceTypes=Plasma/DataEngine
|
||||
X-KDE-Library=plasma_dataengine_simplecast
|
||||
X-Plasma-EngineName=simplecast
|
||||
X-KDE-PluginInfo-Author=Kevin Whitaker
|
||||
X-KDE-PluginInfo-Email=eyecreate@eyecreate.org
|
||||
X-KDE-PluginInfo-Name=simplecast
|
||||
X-KDE-PluginInfo-Version=0.1
|
||||
X-KDE-PluginInfo-Website=http://plasma.kde.org/
|
||||
X-KDE-PluginInfo-Category=Examples
|
||||
X-KDE-PluginInfo-Depends=
|
||||
X-KDE-PluginInfo-License=LGPL
|
||||
X-KDE-PluginInfo-EnabledByDefault=true
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) %{CURRENT_YEAR} by %{AUTHOR} <%{EMAIL}>
|
||||
Copyright (C) 2019 by Kevin Whitaker <eyecreate@eyecreate.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
@@ -18,40 +18,27 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SIMPLECASTENGINEWINDOW_H
|
||||
#define SIMPLECASTENGINEWINDOW_H
|
||||
#include "simplecastengine.h"
|
||||
|
||||
|
||||
#include "ui_simplecastengine.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
/**
|
||||
* This class serves as the main window for SimpleCastEngine. It handles the
|
||||
* menus, toolbars and status bars.
|
||||
*
|
||||
* @short Main window class
|
||||
* @author %{AUTHOR} <%{EMAIL}>
|
||||
* @version %{VERSION}
|
||||
*/
|
||||
class SimpleCastEngineWindow : public QMainWindow
|
||||
SimpleCastEngine::SimpleCastEngine(QObject *parent, const QVariantList &args)
|
||||
: Plasma::DataEngine(parent,args)
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
SimpleCastEngineWindow();
|
||||
Q_UNUSED(args)
|
||||
setMinimumPollingInterval(333);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Destructor
|
||||
*/
|
||||
~SimpleCastEngineWindow() override;
|
||||
bool SimpleCastEngine::sourceRequestEvent(const QString& source)
|
||||
{
|
||||
return updateSourceEvent(source);//TODO
|
||||
}
|
||||
|
||||
private:
|
||||
// this is the name of the root widget inside our Ui file
|
||||
// you can rename it in designer and then change it here
|
||||
Ui::mainWidget m_ui;
|
||||
};
|
||||
bool SimpleCastEngine::updateSourceEvent(const QString& source)
|
||||
{
|
||||
return true;//TODO
|
||||
}
|
||||
|
||||
#endif // SIMPLECASTENGINEWINDOW_H
|
||||
|
||||
|
||||
K_EXPORT_PLASMA_DATAENGINE(simplecast, SimpleCastEngine)
|
||||
|
||||
#include "simplecastengine.moc"
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) %{CURRENT_YEAR} by %{AUTHOR} <%{EMAIL}>
|
||||
Copyright (C) 2019 by Kevin Whitaker <eyecreate@eyecreate.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
@@ -18,16 +18,22 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "simplecastenginewindow.h"
|
||||
#ifndef SIMPLECASTENGINE_H
|
||||
#define SIMPLECASTENGINE_H
|
||||
|
||||
SimpleCastEngineWindow::SimpleCastEngineWindow()
|
||||
: QMainWindow()
|
||||
{
|
||||
QWidget *widget = new QWidget(this);
|
||||
setCentralWidget(widget);
|
||||
m_ui.setupUi(widget);
|
||||
}
|
||||
|
||||
SimpleCastEngineWindow::~SimpleCastEngineWindow()
|
||||
#include <Plasma/DataEngine>
|
||||
|
||||
class SimpleCastEngine : public Plasma::DataEngine
|
||||
{
|
||||
}
|
||||
Q_OBJECT
|
||||
public:
|
||||
SimpleCastEngine(QObject *parent, const QVariantList &args);
|
||||
|
||||
protected:
|
||||
bool sourceRequestEvent(const QString &source);
|
||||
bool updateSourceEvent(const QString &source);
|
||||
|
||||
};
|
||||
|
||||
#endif // SIMPLECASTENGINE_H
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>mainWidget</class>
|
||||
<widget class="QWidget" name="mainWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Hello world!</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user