mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-22 21:54:00 +02:00
Yo dawg (teo-), I put a plugin in your plugin, so I can load another plugin for showing an in-application KDE config widget
This commit is contained in:
committed by
Teo Mrnjavac
parent
a5121f3ad1
commit
8f1c4aeaf0
@@ -311,8 +311,8 @@ if (WITH_KDE4)
|
|||||||
endif(WITH_KDE4)
|
endif(WITH_KDE4)
|
||||||
# this was used before we had FindKDE4Installed, just leaving it here to keep the flags
|
# this was used before we had FindKDE4Installed, just leaving it here to keep the flags
|
||||||
# for future kde integration
|
# for future kde integration
|
||||||
|
macro_log_feature(KDE4_FOUND "KDE4" "Provides support for configuring Telepathy Accounts from inside Tomahawk" "https://www.kde.org" FALSE "" "")
|
||||||
|
|
||||||
# macro_optional_find_package(KDE4)
|
|
||||||
IF( KDE4_FOUND )
|
IF( KDE4_FOUND )
|
||||||
IF( CMAKE_C_FLAGS )
|
IF( CMAKE_C_FLAGS )
|
||||||
# KDE4 adds and removes some compiler flags that we don't like
|
# KDE4 adds and removes some compiler flags that we don't like
|
||||||
|
@@ -5,7 +5,22 @@ tomahawk_add_plugin(telepathy
|
|||||||
EXPORT_MACRO CONFIGSTORAGEDLLEXPORT_PRO
|
EXPORT_MACRO CONFIGSTORAGEDLLEXPORT_PRO
|
||||||
SOURCES
|
SOURCES
|
||||||
TelepathyConfigStorage.cpp
|
TelepathyConfigStorage.cpp
|
||||||
|
TelepathyConfigStorageConfigWidgetPlugin.cpp
|
||||||
LINK_LIBRARIES
|
LINK_LIBRARIES
|
||||||
${TOMAHAWK_LIBRARIES}
|
${TOMAHAWK_LIBRARIES}
|
||||||
${TELEPATHY_QT_LIBRARIES}
|
${TELEPATHY_QT_LIBRARIES}
|
||||||
|
SHARED_LIB
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if( KDE4_FOUND )
|
||||||
|
include_directories( ${KDE4_INCLUDES} )
|
||||||
|
tomahawk_add_plugin(kde
|
||||||
|
TYPE configstorage_telepathy
|
||||||
|
EXPORT_MACRO CONFIGSTORAGETELEPATHYDLLEXPORT_PRO
|
||||||
|
SOURCES
|
||||||
|
KdeTelepathyConfigWidget.cpp
|
||||||
|
LINK_LIBRARIES
|
||||||
|
tomahawk_configstorage_telepathy
|
||||||
|
${KDE4_KCMUTILS_LIBS}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
@@ -0,0 +1,35 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2013, Dominik Schmidt <domme@tomahawk-player.org>
|
||||||
|
*
|
||||||
|
* Tomahawk 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 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk 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 Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "KdeTelepathyConfigWidget.h"
|
||||||
|
|
||||||
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
|
#include <KCModuleProxy>
|
||||||
|
|
||||||
|
#include <QtPlugin>
|
||||||
|
|
||||||
|
QWidget*
|
||||||
|
KdeTelepathyConfigWidget::configWidget()
|
||||||
|
{
|
||||||
|
return new KCModuleProxy( "kcm_ktp_accounts" );
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_EXPORT_PLUGIN2( TelepathyConfigStorageConfigWidgetPlugin, KdeTelepathyConfigWidget )
|
||||||
|
|
||||||
|
|
@@ -0,0 +1,36 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2013, Dominik Schmidt <domme@tomahawk-player.org>
|
||||||
|
*
|
||||||
|
* Tomahawk 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 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk 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 Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef KDETELEPATHYCONFIGWIDGET_H
|
||||||
|
#define KDETELEPATHYCONFIGWIDGET_H
|
||||||
|
|
||||||
|
#include "TelepathyConfigStorageConfigWidgetPlugin.h"
|
||||||
|
|
||||||
|
#include "TelepathyConfigStorageConfigWidgetDllMacro.h"
|
||||||
|
|
||||||
|
class CONFIGSTORAGETELEPATHYDLLEXPORT KdeTelepathyConfigWidget : public TelepathyConfigStorageConfigWidgetPlugin
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_INTERFACES( TelepathyConfigStorageConfigWidgetPlugin )
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual QWidget* configWidget();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // KDETELEPATHYCONFIGWIDGET_H
|
@@ -1,6 +1,7 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
|
||||||
|
* Copyright 2013, Dominik Schmidt <domme@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -18,10 +19,14 @@
|
|||||||
|
|
||||||
#include "TelepathyConfigStorage.h"
|
#include "TelepathyConfigStorage.h"
|
||||||
|
|
||||||
|
#include "TelepathyConfigStorageConfigWidgetPlugin.h"
|
||||||
|
|
||||||
|
|
||||||
#include "accounts/Account.h"
|
#include "accounts/Account.h"
|
||||||
#include "accounts/AccountManager.h"
|
#include "accounts/AccountManager.h"
|
||||||
#include "accounts/CredentialsManager.h"
|
#include "accounts/CredentialsManager.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
#include "utils/PluginLoader.h"
|
||||||
|
|
||||||
#include <TelepathyQt/Account>
|
#include <TelepathyQt/Account>
|
||||||
#include <TelepathyQt/PendingReady>
|
#include <TelepathyQt/PendingReady>
|
||||||
@@ -41,6 +46,7 @@ Tomahawk::Accounts::TelepathyConfigStorage::TelepathyConfigStorage( QObject* par
|
|||||||
, m_credentialsServiceName( "telepathy-kde" )
|
, m_credentialsServiceName( "telepathy-kde" )
|
||||||
{
|
{
|
||||||
tDebug() << Q_FUNC_INFO;
|
tDebug() << Q_FUNC_INFO;
|
||||||
|
loadConfigWidgetPlugins();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -137,6 +143,24 @@ Tomahawk::Accounts::TelepathyConfigStorage::onCredentialsManagerReady( const QSt
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Tomahawk::Accounts::TelepathyConfigStorage::loadConfigWidgetPlugins()
|
||||||
|
{
|
||||||
|
tDebug() << Q_FUNC_INFO;
|
||||||
|
foreach( QObject* plugin, Tomahawk::Utils::PluginLoader( "configstorage_telepathy" ).loadPlugins().values() )
|
||||||
|
{
|
||||||
|
TelepathyConfigStorageConfigWidgetPlugin* configWidgetPlugin = qobject_cast< TelepathyConfigStorageConfigWidgetPlugin* >( plugin );
|
||||||
|
if( !configWidgetPlugin )
|
||||||
|
{
|
||||||
|
tLog() << "Tried to load invalid TelepathyConfigStorageConfigWidgetPlugin";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_configWidgetPlugins << configWidgetPlugin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
Tomahawk::Accounts::TelepathyConfigStorage::telepathyPathToAccountId( const QString& objectPath, const QString& telepathyServiceName )
|
Tomahawk::Accounts::TelepathyConfigStorage::telepathyPathToAccountId( const QString& objectPath, const QString& telepathyServiceName )
|
||||||
{
|
{
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
|
||||||
|
* Copyright 2013, Dominik Schmidt <domme@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -29,6 +30,8 @@ namespace Tp
|
|||||||
class PendingOperation;
|
class PendingOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class TelepathyConfigStorageConfigWidgetPlugin;
|
||||||
|
|
||||||
namespace Tomahawk
|
namespace Tomahawk
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -61,12 +64,15 @@ private slots:
|
|||||||
void onCredentialsManagerReady( const QString& service );
|
void onCredentialsManagerReady( const QString& service );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void loadConfigWidgetPlugins();
|
||||||
|
|
||||||
QString telepathyPathToAccountId( const QString& objectPath, const QString& telepathyServiceName );
|
QString telepathyPathToAccountId( const QString& objectPath, const QString& telepathyServiceName );
|
||||||
QString accountIdToTelepathyPath( const QString& accountId );
|
QString accountIdToTelepathyPath( const QString& accountId );
|
||||||
|
|
||||||
const QString m_credentialsServiceName;
|
const QString m_credentialsServiceName;
|
||||||
QStringList m_accountIds;
|
QStringList m_accountIds;
|
||||||
Tp::AccountManagerPtr m_tpam;
|
Tp::AccountManagerPtr m_tpam;
|
||||||
|
QList< TelepathyConfigStorageConfigWidgetPlugin* > m_configWidgetPlugins;
|
||||||
|
|
||||||
static TelepathyConfigStorage* s_instance;
|
static TelepathyConfigStorage* s_instance;
|
||||||
};
|
};
|
||||||
|
@@ -0,0 +1,32 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
|
||||||
|
*
|
||||||
|
* Tomahawk 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 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk 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 Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TELEPATHYCONFIGSTORAGECONFIGWIDGETDLLMACRO_H
|
||||||
|
#define TELEPATHYCONFIGSTORAGECONFIGWIDGETDLLMACRO_H
|
||||||
|
|
||||||
|
#include <QtCore/qglobal.h>
|
||||||
|
|
||||||
|
#ifndef CONFIGSTORAGETELEPATHYDLLEXPORT
|
||||||
|
# if defined (CONFIGSTORAGETELEPATHYDLLEXPORT_PRO)
|
||||||
|
# define CONFIGSTORAGETELEPATHYDLLEXPORT Q_DECL_EXPORT
|
||||||
|
# else
|
||||||
|
# define CONFIGSTORAGETELEPATHYDLLEXPORT Q_DECL_IMPORT
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // TELEPATHYCONFIGSTORAGECONFIGWIDGETDLLMACRO_H
|
@@ -0,0 +1,23 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2013, Dominik Schmidt <domme@tomahawk-player.org>
|
||||||
|
*
|
||||||
|
* Tomahawk 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 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk 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 Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "TelepathyConfigStorageConfigWidgetPlugin.h"
|
||||||
|
|
||||||
|
TelepathyConfigStorageConfigWidgetPlugin::~TelepathyConfigStorageConfigWidgetPlugin()
|
||||||
|
{
|
||||||
|
}
|
@@ -0,0 +1,38 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
|
||||||
|
*
|
||||||
|
* Tomahawk 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 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk 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 Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TELEPATHYCONFIGSTORAGECONFIGWIDGETPLUGIN_H
|
||||||
|
#define TELEPATHYCONFIGSTORAGECONFIGWIDGETPLUGIN_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
#include "accounts/ConfigStorageDllMacro.h"
|
||||||
|
|
||||||
|
class CONFIGSTORAGEDLLEXPORT TelepathyConfigStorageConfigWidgetPlugin : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual ~TelepathyConfigStorageConfigWidgetPlugin();
|
||||||
|
|
||||||
|
virtual QWidget* configWidget() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_INTERFACE( TelepathyConfigStorageConfigWidgetPlugin, "tomahawk.TelepathyConfigStorageConfigWidget/1.0" )
|
||||||
|
|
||||||
|
#endif // TELEPATHYCONFIGSTORAGE_H
|
Reference in New Issue
Block a user