Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:wolfi323:branches:KDE:Unstable:Frameworks
kmediaplayer
_service:obs_scm:kmediaplayer-VERSIONgit.202001...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:kmediaplayer-VERSIONgit.20200111T180051~40f3544.obscpio of Package kmediaplayer
07070100000000000081A40000000200000002000000015E1A0D5300000039000000000000000000000000000000000000003B00000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/.arcconfig{ "phabricator.uri" : "https://phabricator.kde.org/" } 07070100000001000081A40000000200000002000000015E1A0D5300000A5E000000000000000000000000000000000000003F00000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/CMakeLists.txtcmake_minimum_required(VERSION 3.5) set(KF5_VERSION "5.67.0") # handled by release scripts set(KF5_DEP_VERSION "5.66.0") # handled by release scripts project(KMediaPlayer VERSION ${KF5_VERSION}) # # CMake stuff from ECM # include(FeatureSummary) find_package(ECM 5.66.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) include(KDEInstallDirs) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(KDECMakeSettings) include(GenerateExportHeader) include(ECMSetupVersion) include(ECMGenerateHeaders) include(CMakePackageConfigHelpers) # # Version info # ecm_setup_version(PROJECT VARIABLE_PREFIX KMEDIAPLAYER VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kmediaplayer_version.h" PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5MediaPlayerConfigVersion.cmake" SOVERSION 5) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kmediaplayer_version.h DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel) # # Dependencies # set(REQUIRED_QT_VERSION 5.12.0) find_package(Qt5DBus ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE) find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE) find_package(KF5Parts ${KF5_DEP_VERSION} REQUIRED) find_package(KF5XmlGui ${KF5_DEP_VERSION} REQUIRED) # # Subdirectories # include_directories ( ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src) add_definitions(-DQT_NO_FOREACH) add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050d00) add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054100) add_subdirectory(src) if (BUILD_TESTING) add_subdirectory(autotests) endif() # # Config.cmake stuff # set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5MediaPlayer") configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/KF5MediaPlayerConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/KF5MediaPlayerConfig.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KF5MediaPlayerConfigVersion.cmake" DESTINATION "${CMAKECONFIG_INSTALL_DIR}" COMPONENT Devel) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KF5MediaPlayerConfig.cmake" DESTINATION "${CMAKECONFIG_INSTALL_DIR}" COMPONENT Devel) install(EXPORT KF5MediaPlayerTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5MediaPlayerTargets.cmake NAMESPACE KF5::) # # Feature summary # feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) 07070100000002000081A40000000200000002000000015E1A0D530000010A000000000000000000000000000000000000004E00000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/KF5MediaPlayerConfig.cmake.in@PACKAGE_INIT@ # Any changes in this ".cmake" file will be overwritten by CMake, the source is the ".cmake.in" file. include(CMakeFindDependencyMacro) find_dependency(KF5Parts "@KF5_DEP_VERSION@") include("${CMAKE_CURRENT_LIST_DIR}/KF5MediaPlayerTargets.cmake") 07070100000003000081A40000000200000002000000015E1A0D5300000188000000000000000000000000000000000000003800000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/LICENSEAll the code in this framework is under the X11 license (http://techbase.kde.org/Policies/Licensing_Policy#X11_License) and, as such, the source code for this framework can be distributed according to that license. However, once built, the library and test executables will link against LGPL libraries (and potentially GPL ones), and so any binary package will be subject to those licenses. 07070100000004000081A40000000200000002000000015E1A0D53000005D4000000000000000000000000000000000000003A00000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/README.md# KMediaPlayer Interface for media player KParts ## Introduction KMediaPlayer builds on the KParts framework to provide a common interface for KParts that can play media files. This framework is a porting aid. It is not recommended for new projects, and existing projects that use it are advised to port away from it, and use plain KParts instead. ## Usage If you are using CMake, you need to have find_package(KF5MediaPlayer NO_MODULE) (or similar) in your CMakeLists.txt file, and you need to link any target that uses KMediaPlayer against KF5::MediaPlayer. A KPart that wishes to implement this interface must inherit KMediaPlayer::Player, and indicate in the desktop file that it provides the KMediaPlayer/Engine service. It may also provide a user interface (by implementing KMediaPlayer::View), and indicate this by listing the KMediaPlayer/Player service in the desktop file. Code needing to make use of this interface can search for relevant KParts with KService::List offers = KServiceTypeTrader::self()->query("KMediaPlayer/Player"); if the GUI is required, or KService::List offers = KServiceTypeTrader::self()->query("KMediaPlayer/Engine"); if not. After checking to see if any services were returned, one can be instantiated with KPluginFactory *factory = KPluginLoader(offers.first()).factory(); if (factory) { KMediaPlayer::Player part = factory->create<KMediaPlayer::Player>(this); // use the part } 07070100000005000041ED0000000200000002000000025E1A0D5300000000000000000000000000000000000000000000003A00000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/autotests07070100000006000081A40000000200000002000000015E1A0D53000000CE000000000000000000000000000000000000004900000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/autotests/CMakeLists.txtfind_package(Qt5Test ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE) include(ECMMarkAsTest) include(ECMAddTests) ecm_add_tests( playertest.cpp viewtest.cpp LINK_LIBRARIES Qt5::Test KF5::MediaPlayer ) 07070100000007000081A40000000200000002000000015E1A0D5300000D2E000000000000000000000000000000000000004900000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/autotests/playertest.cpp/* * Copyright 2013 Alex Merry <alex.merry@kdemail.net> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the X Consortium shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from the X Consortium. */ #include "testplayer.h" #include <QSignalSpy> #include <QTest> class PlayerTest : public QObject { Q_OBJECT private Q_SLOTS: void init() { player = new TestPlayer(this); } void cleanup() { delete player; player = nullptr; } void testParent(); void testDefaultState(); void testDefaultLooping(); void testSetState(); void testSetLooping(); private: TestPlayer *player; }; using namespace KMediaPlayer; void PlayerTest::testParent() { QCOMPARE(player->parent(), this); } void PlayerTest::testDefaultState() { QCOMPARE(player->state(), Player::Empty); } void PlayerTest::testDefaultLooping() { QCOMPARE(player->isLooping(), false); } void PlayerTest::testSetState() { QSignalSpy spy(player, SIGNAL(stateChanged(KMediaPlayer::Player::State))); player->setStateWrapper(Player::Play); QCOMPARE(spy.count(), 1); QList<QVariant> arguments = spy.takeFirst(); QCOMPARE(arguments.count(), 1); QCOMPARE(arguments.at(0).value<Player::State>(), Player::Play); QCOMPARE(player->state(), Player::Play); player->setStateWrapper(Player::Empty); QCOMPARE(spy.count(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.count(), 1); QCOMPARE(arguments.at(0).value<Player::State>(), Player::Empty); QCOMPARE(player->state(), Player::Empty); } void PlayerTest::testSetLooping() { QSignalSpy spy(player, SIGNAL(loopingChanged(bool))); player->setLooping(true); QCOMPARE(spy.count(), 1); QList<QVariant> arguments = spy.takeFirst(); QCOMPARE(arguments.count(), 1); QCOMPARE(arguments.at(0).toBool(), true); QCOMPARE(player->isLooping(), true); player->setLooping(false); QCOMPARE(spy.count(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.count(), 1); QCOMPARE(arguments.at(0).toBool(), false); QCOMPARE(player->isLooping(), false); } QTEST_GUILESS_MAIN(PlayerTest) #include "playertest.moc" #include "moc_testplayer.cpp" 07070100000008000081A40000000200000002000000015E1A0D53000008A2000000000000000000000000000000000000004700000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/autotests/testplayer.h/* * Copyright 2013 Alex Merry <alex.merry@kdemail.net> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the X Consortium shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from the X Consortium. */ #ifndef TESTPLAYER_H #define TESTPLAYER_H #include <kmediaplayer/player.h> class TestPlayer : public KMediaPlayer::Player { Q_OBJECT public: TestPlayer(QObject *parent) : Player(parent) {} KMediaPlayer::View *view() override { return nullptr; } void pause() override { } void play() override { } void stop() override { } void seek(qlonglong) override { } bool isSeekable() const override { return false; } qlonglong position() const override { return 0L; } bool hasLength() const override { return false; } qlonglong length() const override { return 0L; } void setStateWrapper(State state) { // this is protected setState(state); } }; #endif // TESTPLAYER_H 07070100000009000081A40000000200000002000000015E1A0D53000006AA000000000000000000000000000000000000004500000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/autotests/testview.h/* * Copyright 2013 Alex Merry <alex.merry@kdemail.net> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the X Consortium shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from the X Consortium. */ #ifndef TESTVIEW_H #define TESTVIEW_H #include <kmediaplayer/view.h> class TestView : public KMediaPlayer::View { Q_OBJECT public: TestView(QWidget *parent) : View(parent) {}; void setVideoWidgetWrapper(QWidget *videoWidget) { // this is protected setVideoWidget(videoWidget); } }; #endif // TESTVIEW_H 0707010000000A000081A40000000200000002000000015E1A0D5300001054000000000000000000000000000000000000004700000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/autotests/viewtest.cpp/* * Copyright 2013 Alex Merry <alex.merry@kdemail.net> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the X Consortium shall not be * used in advertising or otherwise to promote the sale, use or other dealings * in this Software without prior written authorization from the X Consortium. */ #include "testview.h" #include <QSignalSpy> #include <QScopedPointer> #include <QTest> class ViewTest : public QWidget { Q_OBJECT private Q_SLOTS: void init() { view = new TestView(this); } void cleanup() { delete view; view = nullptr; } void testParent(); void testDefaultVideoWidget(); void testSetVideoWidget(); void testSetButtons(); private: TestView *view; }; using namespace KMediaPlayer; void ViewTest::testParent() { QCOMPARE(view->parent(), this); } void ViewTest::testDefaultVideoWidget() { QCOMPARE(view->videoWidget(), static_cast<QWidget *>(nullptr)); } void ViewTest::testSetVideoWidget() { QScopedPointer<QWidget> widget(new QWidget(this)); view->setVideoWidgetWrapper(widget.data()); QCOMPARE(view->videoWidget(), widget.data()); view->setVideoWidgetWrapper(nullptr); QCOMPARE(view->videoWidget(), static_cast<QWidget *>(nullptr)); } void ViewTest::testSetButtons() { QSignalSpy spy(view, SIGNAL(buttonsChanged(KMediaPlayer::View::Buttons))); View::Buttons expButtons = View::Stop | View::Pause; view->setButtons(expButtons); QCOMPARE(spy.count(), 1); QList<QVariant> arguments = spy.takeFirst(); QCOMPARE(arguments.count(), 1); QCOMPARE(arguments.at(0).value<View::Buttons>(), expButtons); QCOMPARE(view->buttons(), expButtons); expButtons |= View::Play; view->toggleButton(View::Play); QCOMPARE(spy.count(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.count(), 1); QCOMPARE(arguments.at(0).value<View::Buttons>(), expButtons); QCOMPARE(view->buttons(), expButtons); expButtons = View::Stop | View::Pause; view->toggleButton(View::Play); QCOMPARE(spy.count(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.count(), 1); QCOMPARE(arguments.at(0).value<View::Buttons>(), expButtons); QCOMPARE(view->buttons(), expButtons); expButtons = View::Stop; view->hideButton(View::Pause); QCOMPARE(spy.count(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.count(), 1); QCOMPARE(arguments.at(0).value<View::Buttons>(), expButtons); QCOMPARE(view->buttons(), expButtons); expButtons |= View::Seeker; view->showButton(View::Seeker); QCOMPARE(spy.count(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.count(), 1); QCOMPARE(arguments.at(0).value<View::Buttons>(), expButtons); QCOMPARE(view->buttons(), expButtons); // showing an already-visible button view->showButton(View::Stop); QCOMPARE(view->buttons(), expButtons); // hiding an already-hidden button view->hideButton(View::Play); QCOMPARE(view->buttons(), expButtons); } QTEST_MAIN(ViewTest) #include "viewtest.moc" #include "moc_testview.cpp" 0707010000000B000041ED0000000200000002000000025E1A0D5300000000000000000000000000000000000000000000003500000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/docs0707010000000C000081A40000000200000002000000015E1A0D530000006E000000000000000000000000000000000000004400000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/docs/Doxyfile.local# This file is an auto-generated file with a private header EXCLUDE_PATTERNS += */src/kmediaplayeradaptor.cpp 0707010000000D000081A40000000200000002000000015E1A0D5300000145000000000000000000000000000000000000003E00000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/metainfo.yamlmaintainer: alexmerry description: Plugin interface for media player features tier: 3 type: integration platforms: - name: Linux - name: FreeBSD - name: Windows - name: MacOSX portingAid: true deprecated: true release: true cmakename: KF5MediaPlayer public_lib: true group: Frameworks subgroup: Porting Aids 0707010000000E000041ED0000000200000002000000025E1A0D5300000000000000000000000000000000000000000000003400000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/src0707010000000F000081A40000000200000002000000015E1A0D5300000614000000000000000000000000000000000000004300000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/src/CMakeLists.txtset(kmediaplayer_LIB_SRCS player.cpp view.cpp kmediaplayeradaptor.cpp ) add_library(KF5MediaPlayer ${kmediaplayer_LIB_SRCS}) generate_export_header(KF5MediaPlayer BASE_NAME KMediaPlayer) add_library(KF5::MediaPlayer ALIAS KF5MediaPlayer) # Apps must include <KMediaPlayer/File> or <kmediaplayer/file.h> target_include_directories(KF5MediaPlayer INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/KMediaPlayer>") target_link_libraries(KF5MediaPlayer PUBLIC Qt5::Widgets KF5::Parts ) target_link_libraries(KF5MediaPlayer PRIVATE KF5::XmlGui ) set_target_properties(KF5MediaPlayer PROPERTIES VERSION ${KMEDIAPLAYER_VERSION_STRING} SOVERSION ${KMEDIAPLAYER_SOVERSION} EXPORT_NAME MediaPlayer ) ecm_generate_headers(KMediaPlayer_CamelCase_HEADERS HEADER_NAMES Player View PREFIX KMediaPlayer REQUIRED_HEADERS KMediaPlayer_HEADERS ) install(FILES ${KMediaPlayer_CamelCase_HEADERS} DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/KMediaPlayer/KMediaPlayer COMPONENT Devel) install(TARGETS KF5MediaPlayer EXPORT KF5MediaPlayerTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS} ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kmediaplayer_export.h ${KMediaPlayer_HEADERS} DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/KMediaPlayer/kmediaplayer COMPONENT Devel ) install(FILES kmediaplayerengine.desktop kmediaplayer.desktop DESTINATION ${KDE_INSTALL_KSERVICETYPES5DIR}) install(FILES org.kde.KMediaPlayer.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR} RENAME kf5_org.kde.KMediaPlayer.xml) 07070100000010000081A40000000200000002000000015E1A0D5300000069000000000000000000000000000000000000004900000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/src/kmediaplayer.desktop[Desktop Entry] Type=ServiceType X-KDE-ServiceType=KMediaPlayer/Player X-KDE-Derived=KParts/ReadOnlyPart 07070100000011000081A40000000200000002000000015E1A0D5300000BF7000000000000000000000000000000000000004C00000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/src/kmediaplayeradaptor.cpp/* * This file was generated by dbusidl2cpp version 0.4 * when processing input file org.kde.KMediaPlayer.xml * * dbusidl2cpp is Copyright (C) 2006 Trolltech AS. All rights reserved. * * This is an auto-generated file. */ #include "kmediaplayeradaptor_p.h" #include <QString> /* * Implementation of adaptor class KMediaPlayerAdaptor */ KMediaPlayerAdaptor::KMediaPlayerAdaptor(QObject *parent) : QDBusAbstractAdaptor(parent) { // constructor setAutoRelaySignals(true); } KMediaPlayerAdaptor::~KMediaPlayerAdaptor() { // destructor } bool KMediaPlayerAdaptor::hasLength() const { // get the value of property hasLength return qvariant_cast< bool >(parent()->property("hasLength")); } qlonglong KMediaPlayerAdaptor::length() const { // get the value of property length return qvariant_cast< qlonglong >(parent()->property("length")); } bool KMediaPlayerAdaptor::isLooping() const { // get the value of property looping return qvariant_cast< bool >(parent()->property("looping")); } void KMediaPlayerAdaptor::setLooping(bool value) { // set the value of property looping parent()->setProperty("looping", value); } qlonglong KMediaPlayerAdaptor::position() const { // get the value of property position return qvariant_cast< qlonglong >(parent()->property("position")); } bool KMediaPlayerAdaptor::isSeekable() const { // get the value of property seekable return qvariant_cast< bool >(parent()->property("seekable")); } int KMediaPlayerAdaptor::state() const { // get the value of property state return qvariant_cast< int >(parent()->property("state")); } void KMediaPlayerAdaptor::setState(int value) { // set the value of property state parent()->setProperty("state", value); } bool KMediaPlayerAdaptor::openUrl(const QString &file) { // handle method call org.kde.KMediaPlayer.openUrl bool out0; QMetaObject::invokeMethod(parent(), "openUrl", Q_RETURN_ARG(bool, out0), Q_ARG(QString, file)); // Alternative: //out0 = static_cast<YourObjectType *>(parent())->openUrl(file); return out0; } void KMediaPlayerAdaptor::pause() { // handle method call org.kde.KMediaPlayer.pause QMetaObject::invokeMethod(parent(), "pause"); // Alternative: //static_cast<YourObjectType *>(parent())->pause(); } void KMediaPlayerAdaptor::play() { // handle method call org.kde.KMediaPlayer.play QMetaObject::invokeMethod(parent(), "play"); // Alternative: //static_cast<YourObjectType *>(parent())->play(); } void KMediaPlayerAdaptor::seek(qlonglong msec) { // handle method call org.kde.KMediaPlayer.seek QMetaObject::invokeMethod(parent(), "seek", Q_ARG(qlonglong, msec)); // Alternative: //static_cast<YourObjectType *>(parent())->seek(msec); } void KMediaPlayerAdaptor::stop() { // handle method call org.kde.KMediaPlayer.stop QMetaObject::invokeMethod(parent(), "stop"); // Alternative: //static_cast<YourObjectType *>(parent())->stop(); } #include "moc_kmediaplayeradaptor_p.cpp" 07070100000012000081A40000000200000002000000015E1A0D5300000B5D000000000000000000000000000000000000004C00000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/src/kmediaplayeradaptor_p.h/* * This file was generated by dbusidl2cpp version 0.4 * when processing input file org.kde.KMediaPlayer.xml * * dbusidl2cpp is Copyright (C) 2006 Trolltech AS. All rights reserved. * * This is an auto-generated file. */ #ifndef KMEDIAPLAYERADAPTOR_H_19781146507443 #define KMEDIAPLAYERADAPTOR_H_19781146507443 #include <QObject> #include <QDBusAbstractAdaptor> template<class T> class QList; template<class Key, class Value> class QMap; class QString; /* * Adaptor class for interface org.kde.KMediaPlayer */ class KMediaPlayerAdaptor: public QDBusAbstractAdaptor { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "org.kde.KMediaPlayer") Q_CLASSINFO("D-Bus Introspection", "" " <interface name=\"org.kde.KMediaPlayer\" >" " <method name=\"openUrl\" >" " <arg direction=\"in\" type=\"s\" name=\"file\" />" " <arg direction=\"out\" type=\"b\" />" " </method>" " <method name=\"pause\" />" " <method name=\"play\" />" " <method name=\"stop\" />" " <method name=\"seek\" >" " <arg direction=\"in\" type=\"x\" name=\"msec\" />" " </method>" " <property access=\"read\" type=\"b\" name=\"seekable\" >" " <annotation value=\"isSeekable\" name=\"com.trolltech.QtDBus.propertyGetter\" />" " </property>" " <property access=\"read\" type=\"x\" name=\"position\" />" " <property access=\"read\" type=\"b\" name=\"hasLength\" />" " <property access=\"read\" type=\"x\" name=\"length\" />" " <property access=\"readwrite\" type=\"b\" name=\"looping\" >" " <annotation value=\"isLooping\" name=\"com.trolltech.QtDBus.propertyGetter\" />" " </property>" " <property access=\"readwrite\" type=\"i\" name=\"state\" />" " </interface>" "") public: KMediaPlayerAdaptor(QObject *parent); virtual ~KMediaPlayerAdaptor(); public: // PROPERTIES Q_PROPERTY(bool hasLength READ hasLength) bool hasLength() const; Q_PROPERTY(qlonglong length READ length) qlonglong length() const; Q_PROPERTY(bool looping READ isLooping WRITE setLooping) bool isLooping() const; void setLooping(bool value); Q_PROPERTY(qlonglong position READ position) qlonglong position() const; Q_PROPERTY(bool seekable READ isSeekable) bool isSeekable() const; Q_PROPERTY(int state READ state WRITE setState) int state() const; void setState(int value); public Q_SLOTS: // METHODS bool openUrl(const QString &file); void pause(); void play(); void seek(qlonglong msec); void stop(); Q_SIGNALS: // SIGNALS }; #endif 07070100000013000081A40000000200000002000000015E1A0D5300000047000000000000000000000000000000000000004F00000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/src/kmediaplayerengine.desktop[Desktop Entry] Type=ServiceType X-KDE-ServiceType=KMediaPlayer/Engine 07070100000014000081A40000000200000002000000015E1A0D530000040F000000000000000000000000000000000000004D00000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/src/org.kde.KMediaPlayer.xml<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> <node> <interface name="org.kde.KMediaPlayer"> <method name="openUrl"> <arg name="file" type="s" direction="in"/> <arg type="b" direction="out"/> </method> <method name="pause"/> <method name="play"/> <method name="stop"/> <method name="seek"> <arg name="msec" type="x" direction="in"/> </method> <property name="seekable" type="b" access="read"> <annotation name="com.trolltech.QtDBus.propertyGetter" value="isSeekable"/> </property> <property name="position" type="x" access="read"/> <property name="hasLength" type="b" access="read"/> <property name="length" type="x" access="read"/> <property name="looping" type="b" access="readwrite"> <annotation name="com.trolltech.QtDBus.propertyGetter" value="isLooping"/> </property> <property name="state" type="i" access="readwrite"/> </interface> </node> 07070100000015000081A40000000200000002000000015E1A0D5300000AA1000000000000000000000000000000000000003F00000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/src/player.cpp// Copyright (C) 2002 Neil Stevens <neil@qualityassistant.com> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN // AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // Except as contained in this notice, the name(s) of the author(s) shall not be // used in advertising or otherwise to promote the sale, use or other dealings // in this Software without prior written authorization from the author(s). #include "player.h" #include "kmediaplayeradaptor_p.h" class KMediaPlayer::Player::Private { public: Private() : currentLooping(false) , currentState(Empty) { if (!stateEnumRegistered) { stateEnumRegistered = qRegisterMetaType<KMediaPlayer::Player::State>("KMediaPlayer::Player::State"); } } bool currentLooping; State currentState; static bool stateEnumRegistered; }; bool KMediaPlayer::Player::Private::stateEnumRegistered = false; KMediaPlayer::Player::Player(QWidget *, const char *, QObject *parent) : KParts::ReadOnlyPart(parent) , d(new Private()) { (void)new KMediaPlayerAdaptor(this); } KMediaPlayer::Player::Player(QObject *parent) : KParts::ReadOnlyPart(parent) , d(new Private()) { (void)new KMediaPlayerAdaptor(this); } KMediaPlayer::Player::~Player() { delete d; } void KMediaPlayer::Player::setLooping(bool b) { if (b != d->currentLooping) { d->currentLooping = b; emit loopingChanged(b); } } bool KMediaPlayer::Player::isLooping() const { return d->currentLooping; } void KMediaPlayer::Player::setState(State s) { if (s != d->currentState) { d->currentState = s; emit stateChanged(s); } } KMediaPlayer::Player::State KMediaPlayer::Player::state() const { return d->currentState; } 07070100000016000081A40000000200000002000000015E1A0D5300001E36000000000000000000000000000000000000003D00000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/src/player.h// Copyright (C) 2002 Neil Stevens <neil@qualityassistant.com> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN // AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // Except as contained in this notice, the name(s) of the author(s) shall not be // used in advertising or otherwise to promote the sale, use or other dealings // in this Software without prior written authorization from the author(s). #ifndef KMEDIAPLAYERPLAYER_H #define KMEDIAPLAYERPLAYER_H #include <kparts/readonlypart.h> #include "view.h" #include "kmediaplayer_export.h" /** * An interface for media playback parts. */ namespace KMediaPlayer { /** * KPart interface to allow controlling and querying playback of a media track. * * This class provides methods to control playback of a single media track, as * well as providing information on the current playback state. It can * optionally provide access to a user interface that can be displayed to the * user. * * There are two servicetypes for this KParts interface: KMediaPlayer/Player * and KMediaPlayer/Engine. KMediaPlayer/Player provides a user interface (see * view()), while KMediaPlayer/Engine just provides direct control via this * class. */ class KMEDIAPLAYER_EXPORT Player : public KParts::ReadOnlyPart { Q_OBJECT Q_ENUMS(State) /** * Whether the length property is valid. * * Not all media tracks have a length (for example, some streams are * continuous). */ Q_PROPERTY(bool hasLength READ hasLength) /** * The length of the media track in milliseconds. * * The value is undefined if hasLength is @c false. */ Q_PROPERTY(qlonglong length READ length) /** * Whether playback should loop. * * As this interface has no concept of a playlist, this indicates * whether the current media track will play repeatedly. */ Q_PROPERTY(bool looping READ isLooping WRITE setLooping) /** * The position in the media track in milliseconds. */ Q_PROPERTY(qlonglong position READ position) /** * Whether seek() can be expected to work on the current media track. * * Some streams cannot be seeked. */ Q_PROPERTY(bool seekable READ isSeekable) /** * The current state of the player. */ Q_PROPERTY(State state READ state WRITE setState NOTIFY stateChanged) public: /** * Constructs a Player instance with no associated GUI. * * This should be used when a KMediaPlayer/Engine is requested. */ explicit Player(QObject *parent); /** * Constructs a Player instance with a GUI. * * This should be used when a KMediaPlayer/Player is requested. */ Player(QWidget *parentWidget, const char *widgetName, QObject *parent); /** * Cleans up any associated resources. * * This should not explicitly delete any widget returned by view(): if it * has been reparented, it is up to the caller to dispose of it properly. */ virtual ~Player(); /** * Returns the widget associated with this player. * * If the part's service type is KMediaPlayer/Player, this should not return * 0. However, if the part's service is just KMediaPlayer/Engine, this may * return 0. * * @returns A widget to view and control this Player instance, or 0 if * there is no GUI. */ virtual View *view() = 0; public Q_SLOTS: /** * Pauses playback of the media track. * * If the media track is not already paused, this should have no effect. */ virtual void pause() = 0; /** * Starts playing the media track. * * If the media track is already playing, this should have no effect. */ virtual void play() = 0; /** * Stops playback of the media track and returns it to the beginning. */ virtual void stop() = 0; /** * Moves the current playback position. * * This will have no effect if isSeekable() is @c false. * * @param msec The new playback position in milliseconds. */ virtual void seek(qlonglong msec) = 0; public: /** * Returns whether seek() can be expected to work on the current media * track. */ virtual bool isSeekable() const = 0; /** * Returns the current playback position in milliseconds. */ virtual qlonglong position() const = 0; /** * Returns whether the current media track has a length. */ virtual bool hasLength() const = 0; /** * Returns the length of the current media track. * * The returned value is undefined if hasLength() returns @c false. */ virtual qlonglong length() const = 0; public Q_SLOTS: /** * Sets whether playback should loop. * * @param on If @c true, playback will resume from the start of the * track when the end is reached; if @c false it will not. */ void setLooping(bool on); public: /** * Returns whether playback will loop. */ bool isLooping() const; Q_SIGNALS: /** * Indicates that the value of isLooping() has changed. * * @param isLooping The new value. */ void loopingChanged(bool isLooping); public: /** * The possible states of the player. */ enum State { /** * No track is loaded. * * Most functions will not work in this state. */ Empty, /** * A track is loaded, but playback is stopped. * * The position should always be 0 in this state. Playback will start * from the beginning when play() is called. */ Stop, /** * Playback is temporarily suspended. * * Playback will resume from the current position when play() is called. */ Pause, /** * The media is currently being output. */ Play }; /** * Returns the current state of the player. */ State state() const; Q_SIGNALS: /** * Indicates that the value returned by state() has changed. * * @param newState The new value. */ void stateChanged(KMediaPlayer::Player::State newState); protected Q_SLOTS: /** * Sets the current state. * * This allows implementors to alter the playback state. This will emit the * stateChanged() signal as appropriate. */ void setState(State state); protected: /* Enable the stateChanged(QString&, ...) method that was hidden by the stateChanged(State) signal */ using KXMLGUIClient::stateChanged; private: class Private; Private *d; }; } Q_DECLARE_METATYPE(KMediaPlayer::Player::State) #endif 07070100000017000081A40000000200000002000000015E1A0D5300000BE4000000000000000000000000000000000000003D00000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/src/view.cpp// Copyright (C) 2002 Neil Stevens <neil@qualityassistant.com> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN // AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // Except as contained in this notice, the name(s) of the author(s) shall not be // used in advertising or otherwise to promote the sale, use or other dealings // in this Software without prior written authorization from the author(s). #include "view.h" class KMediaPlayer::View::Private { public: Private() : videoWidget(nullptr) , currentButtons(All) { if (!buttonEnumRegistered) { buttonEnumRegistered = qRegisterMetaType<KMediaPlayer::View::Button>("KMediaPlayer::View::Button"); } if (!buttonsFlagsRegistered) { buttonsFlagsRegistered = qRegisterMetaType<KMediaPlayer::View::Buttons>("KMediaPlayer::View::Buttons"); } } QWidget *videoWidget; Buttons currentButtons; static bool buttonEnumRegistered; static bool buttonsFlagsRegistered; }; bool KMediaPlayer::View::Private::buttonEnumRegistered = false; bool KMediaPlayer::View::Private::buttonsFlagsRegistered = false; KMediaPlayer::View::View(QWidget *parent) : QWidget(parent) , d(new Private()) { } KMediaPlayer::View::~View() { delete d; } KMediaPlayer::View::Buttons KMediaPlayer::View::buttons() { return d->currentButtons; } void KMediaPlayer::View::setButtons(Buttons buttons) { if (buttons != d->currentButtons) { d->currentButtons = buttons; emit buttonsChanged(buttons); } } bool KMediaPlayer::View::button(Button b) { return d->currentButtons & b; } void KMediaPlayer::View::showButton(Button b) { setButtons(d->currentButtons | b); } void KMediaPlayer::View::hideButton(Button b) { setButtons(d->currentButtons & ~b); } void KMediaPlayer::View::toggleButton(Button b) { setButtons(d->currentButtons ^ b); } void KMediaPlayer::View::setVideoWidget(QWidget *videoWidget) { d->videoWidget = videoWidget; } QWidget *KMediaPlayer::View::videoWidget() { return d->videoWidget; } 07070100000018000081A40000000200000002000000015E1A0D53000014BB000000000000000000000000000000000000003B00000000kmediaplayer-VERSIONgit.20200111T180051~40f3544/src/view.h// Copyright (C) 2002 Neil Stevens <neil@qualityassistant.com> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN // AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // Except as contained in this notice, the name(s) of the author(s) shall not be // used in advertising or otherwise to promote the sale, use or other dealings // in this Software without prior written authorization from the author(s). #ifndef KMEDIAPLAYERVIEW_H #define KMEDIAPLAYERVIEW_H #include <QWidget> #include "kmediaplayer_export.h" namespace KMediaPlayer { /** * A user interface to control a Player object. * * Player::view() should be used to access an instance of this class. */ class KMEDIAPLAYER_EXPORT View : public QWidget { Q_OBJECT Q_FLAGS(Button Buttons) /** * The controls that are displayed by the interface. */ Q_PROPERTY(Buttons buttons READ buttons WRITE setButtons NOTIFY buttonsChanged) /** * The widget that displays video output. * * This may be 0 if video output is not supported. */ Q_PROPERTY(QWidget* videoWidget READ videoWidget) public: /** * Creates the user interface widget. * * @param parent The parent widget. */ explicit View(QWidget *parent); /** * Destroys all related resources (but not the player object). */ virtual ~View(); /** The controls that can appear in the interface. */ enum Button { /** * A control to start playback. * * @see Player::play() */ Play = 1, /** * A control to stop playback. * * @see Player::stop() */ Stop = 2, /** * A control to pause playback. * * @see Player::pause() */ Pause = 4, /** * A control to adjust the playback position. * * @see Player::seek() */ Seeker = 8, /** * All controls. */ All = 255 }; Q_DECLARE_FLAGS(Buttons, Button) /** * Returns which buttons are being displayed. */ Buttons buttons(); /** * Returns the widget used to display video output. * * May return 0 if video output is not supported. */ QWidget *videoWidget(); public Q_SLOTS: /** * Set the controls to display. * * @param buttons A ORed combination of buttons to display. */ void setButtons(Buttons buttons); /** * Queries whether a particular control is being displayed. * * @param button The control to query. */ bool button(Button button); /** * Display a control. * * If the control is already displayed, this has no effect. Otherwise, it * will be added to the set of controls to be displayed. * * @param button The control to display. */ void showButton(Button button); /** * Stop displaying a control. * * If the control is not already displayed, this has no effect. Otherwise, * it will be removed from the set of controls to be displayed. * * @param button The control to stop displaying. */ void hideButton(Button button); /** * Toggle the display of a control. * * If the control is not already displayed, it will be added to the set of * controls to be displayed. Otherwise, it will be removed from that set. * * @param button The control to toggle. */ void toggleButton(Button button); Q_SIGNALS: /** * Indicates that the value returned by buttons() has changed. * * Subclasses should connect to this signal to update the set of controls * they display. * * @param buttons The new value. */ void buttonsChanged(KMediaPlayer::View::Buttons buttons); protected: /** * Set the widget used to display video output. * * This should normally be created with this object as the parent, but users * of this object may use QWidget::setParent(QWidget*) to move it elsewhere. */ void setVideoWidget(QWidget *videoWidget); private: class Private; Private *d; }; } Q_DECLARE_METATYPE(KMediaPlayer::View::Button) Q_DECLARE_METATYPE(KMediaPlayer::View::Buttons) Q_DECLARE_OPERATORS_FOR_FLAGS(KMediaPlayer::View::Buttons) #endif 07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!96 blocks
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor