forked from jsmitar/playbar2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
87 changed files
with
7,963 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[Dolphin] | ||
Timestamp=2015,1,16,11,10,3 | ||
Version=3 | ||
|
||
[Settings] | ||
HiddenFilesShown=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Ignore hidden files | ||
.directory | ||
|
||
# build directory | ||
build/ | ||
|
||
# backup files | ||
*.qml~ | ||
*.xml~ | ||
*.js~ | ||
*.sh~ | ||
*.desktop~ | ||
*.kate-swp | ||
.~* | ||
|
||
# mo files | ||
*.mo | ||
|
||
# KDevelop Project files | ||
*.kdev4 | ||
.kdev4/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
project(PlayBar) | ||
|
||
find_package(KDE4 REQUIRED) | ||
|
||
include(KDE4Defaults) | ||
|
||
add_subdirectory( plasmoid ) | ||
add_subdirectory( engine ) | ||
|
||
execute_process(COMMAND ./messages.sh -compile-po | ||
OUTPUT_VARIABLE out_messages | ||
WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}) | ||
|
||
message(${out_messages}) | ||
|
||
#This is not yet implemented | ||
#add_subdirectory( kcm_shortcuts ) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Copyright (C) 2014 smith AR <[email protected]> | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2.1 of the License, or (at your option) any later version. | ||
* | ||
* This library 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 | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
* | ||
*/ | ||
|
||
#include "playbarengine.h" | ||
#include "service.h" | ||
|
||
#include <Plasma/DataContainer> | ||
#include <Plasma/DataEngineManager> | ||
|
||
using Plasma::DataContainer; | ||
using Plasma::DataEngineManager; | ||
|
||
PlayBarEngine::PlayBarEngine(QObject* parent, const QVariantList& args) | ||
: DataEngine(parent, args) | ||
{ | ||
Q_UNUSED(args) | ||
setMinimumPollingInterval(-1); | ||
} | ||
|
||
|
||
PlayBarEngine::~PlayBarEngine() | ||
{ | ||
|
||
} | ||
|
||
Service* PlayBarEngine::serviceForSource(const QString& source) | ||
{ | ||
if (source != "Provider") | ||
return createDefaultService(this); | ||
|
||
updateSourceEvent(source); | ||
return new PlayBarService(mpris2_data, this); | ||
} | ||
|
||
void PlayBarEngine::init() | ||
{ | ||
DataEngineManager* engine = DataEngineManager::self(); | ||
mpris2 = engine->loadEngine("mpris2"); | ||
|
||
return updateSourceEvent(source); | ||
} | ||
|
||
bool PlayBarEngine::updateSourceEvent(const QString& source) | ||
{ | ||
const Data* data = &mediaActions->actions(); | ||
|
||
setData(source, *data); | ||
setData(source, "Mpris2Source", p_mpris2Source); | ||
setData(source, "PlaybackStatus", playbackStat()); | ||
setData(source, "Metadata", mpris2_data.value("Metadata").toMap()); | ||
|
||
delete data; data = 0; | ||
return true; | ||
} | ||
|
||
void PlayBarEngine::startOpOverMpris2(const QString& name) | ||
{ | ||
serv = mpris2->serviceForSource(p_mpris2Source); | ||
op = serv->operationDescription(name); | ||
job = serv->startOperationCall(op); | ||
connect(job, SIGNAL(finished(KJob*)), serv, SLOT(deleteLater())); | ||
} | ||
|
||
QString PlayBarEngine::p_mpris2Source; | ||
|
||
K_EXPORT_PLASMA_DATAENGINE(playbarengine, PlayBarEngine) | ||
|
||
#include "playbarengine.moc" | ||
// kate: indent-mode cstyle; indent-width 4; replace-tabs on; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
project(PlayBarEngine) | ||
|
||
find_package(KDE4 REQUIRED) | ||
#find_package(Taglib 1.8) | ||
|
||
include(KDE4Defaults) | ||
include(MacroLibrary) | ||
|
||
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) | ||
include_directories( | ||
${CMAKE_SOURCE_DIR} | ||
${CMAKE_BINARY_DIR} | ||
${KDE4_INCLUDES} | ||
${QT_INCLUDES} | ||
# ${TAGLIB_INCLUDES} | ||
) | ||
|
||
# We add our source code here | ||
set(playbar_engine_SRCS shortcuts.cpp service.cpp playbarengine.cpp) | ||
|
||
# Now make sure all files get to the right place | ||
kde4_add_plugin(plasma_engine_playbar ${playbar_engine_SRCS}) | ||
|
||
target_link_libraries(plasma_engine_playbar | ||
${KDE4_KDECORE_LIBS} | ||
${KDE4_PLASMA_LIBS} | ||
${TAGLIBS}) | ||
|
||
install(TARGETS plasma_engine_playbar | ||
DESTINATION ${PLUGIN_INSTALL_DIR}) | ||
|
||
install(FILES plasma-engine-playbar.desktop | ||
DESTINATION ${SERVICES_INSTALL_DIR}) | ||
|
||
install(FILES playbarservice.operations | ||
DESTINATION ${DATA_INSTALL_DIR}/plasma/services) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
* <one line to give the program's name and a brief idea of what it does.> | ||
* Copyright (C) 2014 smith AR <[email protected]> | ||
* | ||
* 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 3 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 <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#include "filetype.h" | ||
#include <KMimeType> | ||
#include <QFile> | ||
#include <QLatin1String> | ||
#include <QDebug> | ||
|
||
#include <audioproperties.h> | ||
#include <flacfile.h> | ||
#include <mpcfile.h> | ||
#include <mpegfile.h> | ||
#include <oggfile.h> | ||
#include <oggflacfile.h> | ||
#include <vorbisfile.h> | ||
|
||
#include <taglib_config.h> | ||
#ifdef TAGLIB_WITH_MP4 | ||
#include <mp4file.h> | ||
#endif | ||
|
||
namespace MediaFiles | ||
{ | ||
static const QLatin1String flacType("audio/flac"); | ||
static const QLatin1String mp3Type("audio/mpeg"); | ||
#ifdef TAGLIB_WITH_MP4 | ||
static const QLatin1String mp4Type("audio/mp4"); | ||
#endif | ||
static const QLatin1String mpcType("audio/x-musepack"); | ||
static const QLatin1String oggType("audio/ogg"); | ||
static const QLatin1String oggFlacType("audio/x-flac+ogg"); | ||
static const QLatin1String oggVorbisType("audio/x-vorbis+ogg"); | ||
static const QLatin1String vorbisType("audio/vorbis"); | ||
} | ||
|
||
File* FileType::createFile(const QString& fileName) | ||
{ | ||
QUrl url(fileName); | ||
if(!url.isLocalFile()) return 0; | ||
|
||
KMimeType::Ptr mime = KMimeType::findByUrl(url.toLocalFile()); | ||
if (!mime->isValid()) return 0; | ||
|
||
File* file(0); | ||
QByteArray encodedFileName(QFile::encodeName(url.toLocalFile())); | ||
|
||
if (mime->is(MediaFiles::flacType)) | ||
file = new FLAC::File(encodedFileName.constData()); | ||
else if (mime->is(MediaFiles::mp3Type)) | ||
file = new MPEG::File(encodedFileName.constData()); | ||
else if (mime->is(MediaFiles::mpcType)) | ||
file = new MPC::File(encodedFileName.constData()); | ||
else if (mime->is(MediaFiles::oggFlacType) || | ||
mime->is(MediaFiles::vorbisType)) | ||
file = new Ogg::FLAC::File(encodedFileName.constData(), AudioProperties::Accurate); | ||
else if (mime->is(MediaFiles::oggVorbisType)) | ||
file = new Ogg::Vorbis::File(encodedFileName.constData(), true, AudioProperties::Accurate); | ||
#ifdef TAGLIB_WITH_MP4 | ||
else if (mime->is(MediaFiles::mp4Type)) | ||
file = new MP4::File(encodedFileName.constData()); | ||
#endif | ||
|
||
if( !file ) | ||
qDebug() << QString( "FileTypeResolver: file %1 (mimetype %2) not" "recognized as compatible" ).arg(fileName, | ||
mime->name()).toLocal8Bit().data(); | ||
|
||
if(file && !file->isValid()){ | ||
delete file; | ||
file = 0; | ||
} | ||
return file; | ||
|
||
} | ||
// kate: indent-mode cstyle; indent-width 4; replace-tabs on; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* <one line to give the library's name and an idea of what it does.> | ||
* Copyright (C) 2014 smith AR <[email protected]> | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2.1 of the License, or (at your option) any later version. | ||
* | ||
* This library 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 | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
* | ||
*/ | ||
|
||
#include "service.h" | ||
#include "playbarengine.h" | ||
|
||
PlayBarService::PlayBarService(const DataEngine::Data& data, QObject* parent) | ||
: Service(parent), data(data) | ||
{ | ||
setName("playbarservice"); | ||
} | ||
|
||
ServiceJob* PlayBarService::createJob(const QString& operation, | ||
QMap< QString, QVariant >& parameters) | ||
{ | ||
setDestination(name() + ": " + operation); | ||
parameters.insert("Metadata", data.value("Metadata")); | ||
|
||
return new Job(destination(), operation, parameters, this); | ||
} | ||
|
||
Job::Job(const QString& destination, | ||
const QString& operation, | ||
const QMap< QString, QVariant >& parameters, | ||
QObject* parent): | ||
ServiceJob(destination, operation, parameters, parent) | ||
{ | ||
} | ||
|
||
void Job::start() | ||
{ | ||
const QString operation(operationName()); | ||
|
||
bool result = false; | ||
|
||
if (operation == QLatin1String("SetSource")) { | ||
PlayBarEngine::p_mpris2Source = parameters().value("name").toString(); | ||
result = true; | ||
} | ||
// TODO: Implementar el tagger para el rating | ||
else if (operation == QLatin1String("SetRating")) { | ||
const QVariantMap metadata(parameters().value("Metadata").toMap()); | ||
|
||
if (metadata.isEmpty()) qDebug() << "metadata isEmpty"; | ||
// result = setRating(metadata.value("xesam:url").toString(), parameters().value("rating", "0").toString()); | ||
} | ||
|
||
setResult(result); | ||
} | ||
|
||
|
||
#include "service.moc" | ||
// kate: indent-mode cstyle; indent-width 4; replace-tabs on; |
Oops, something went wrong.