Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.1:Staging:C:DVD
amarok
0002-Don-t-allow-adding-Analyzer-applet-when-no...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0002-Don-t-allow-adding-Analyzer-applet-when-not-supporte.patch of Package amarok
From 2b87fb43c550e946acfb47b3c5b217a07fcefa0c Mon Sep 17 00:00:00 2001 From: Mark Kretschmann <kretschmann@kde.org> Date: Thu, 22 Aug 2013 16:47:30 +0200 Subject: [PATCH 1/1] Don't allow adding Analyzer applet when not supported. Also now shows an error message explaining why it can't be used. BUG: 323119 --- src/EngineController.cpp | 7 +++++++ src/EngineController.h | 5 +++++ src/context/Containment.h | 2 +- src/context/ContextView.cpp | 21 ++------------------- src/context/ContextView.h | 5 ----- .../verticallayout/VerticalToolbarContainment.cpp | 17 +++++++++++++---- .../verticallayout/VerticalToolbarContainment.h | 4 ++-- 7 files changed, 30 insertions(+), 31 deletions(-) diff --git a/src/EngineController.cpp b/src/EngineController.cpp index 99adb53..82ca86b 100644 --- a/src/EngineController.cpp +++ b/src/EngineController.cpp @@ -926,6 +926,13 @@ bool EngineController::supportsGainAdjustments() const return m_preamp; } +bool EngineController::supportsAudioDataOutput() const +{ + const Phonon::AudioDataOutput out; + return out.isValid(); +} + + ////////////////////////////////////////////////////////////////////////////////////////// // PRIVATE SLOTS ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/EngineController.h b/src/EngineController.h index c4fae9a..8735a71 100644 --- a/src/EngineController.h +++ b/src/EngineController.h @@ -313,6 +313,11 @@ public slots: */ bool supportsGainAdjustments() const; + /** + * Return true if the current Phonon backend supports visualizations. + */ + bool supportsAudioDataOutput() const; + Q_SIGNALS: /** * Emitted when the playback stops while playing a track. diff --git a/src/context/Containment.h b/src/context/Containment.h index a0f5d7c..9b54b75 100644 --- a/src/context/Containment.h +++ b/src/context/Containment.h @@ -51,7 +51,7 @@ public: public slots: void showApplet( Plasma::Applet* ) {} void moveApplet( Plasma::Applet*, int, int ) {} - virtual Applet* addApplet( const QString& pluginName, const int ) { Q_UNUSED( pluginName ); return 0; } + virtual void addApplet( const QString& pluginName, const int ) = 0; }; } // Context namespace diff --git a/src/context/ContextView.cpp b/src/context/ContextView.cpp index e7eeb49..ce28d8d 100644 --- a/src/context/ContextView.cpp +++ b/src/context/ContextView.cpp @@ -36,6 +36,7 @@ #include "core/support/Amarok.h" #include "core/support/Debug.h" #include "core/meta/Meta.h" +#include "EngineController.h" #include <plasma/dataenginemanager.h> @@ -221,12 +222,8 @@ ContextView::loadConfig() const bool firstTimeWithAnalyzer = Amarok::config( "Context View" ).readEntry( "firstTimeWithAnalyzer", true ); if( firstTimeWithAnalyzer ) { - // Check if the Phonon backend implements all features required by the analyzer - Phonon::AudioDataOutput out; - const bool phononCanHandleAnalyzer = out.isValid(); - QStringList plugins = cg.readEntry( "plugins", QStringList() ); - if( phononCanHandleAnalyzer && !plugins.contains( "analyzer" ) ) + if( EngineController::instance()->supportsAudioDataOutput() && !plugins.contains( "analyzer" ) ) { Amarok::config( "Context View" ).writeEntry( "firstTimeWithAnalyzer", false ); @@ -244,20 +241,6 @@ ContextView::loadConfig() PERF_LOG( "Done loading config" ); } -Plasma::Applet* -ContextView::addApplet( const QString& name, const QStringList& args ) -{ - QVariantList argList; - QStringListIterator i(args); - while( i.hasNext() ) - argList << QVariant( i.next() ); - - if( !containment() ) - contextScene()->addContainment( "amarok_containment_vertical" ); - - return containment()->addApplet( name, argList ); -} - void ContextView::addCollapseAnimation( QAbstractAnimation *anim ) { diff --git a/src/context/ContextView.h b/src/context/ContextView.h index 1593f20..0cd5236 100644 --- a/src/context/ContextView.h +++ b/src/context/ContextView.h @@ -98,11 +98,6 @@ public: public slots: /** - * Add the applet with the given plugin name to the context view. Will add in default position, which is at - * the end of the applet list. - */ - Plasma::Applet* addApplet(const QString& name, const QStringList& args = QStringList()); - /** * Convenience methods to show and hide the applet explorer. */ void hideAppletExplorer(); diff --git a/src/context/containments/verticallayout/VerticalToolbarContainment.cpp b/src/context/containments/verticallayout/VerticalToolbarContainment.cpp index 783d3db..3a9fdc8 100644 --- a/src/context/containments/verticallayout/VerticalToolbarContainment.cpp +++ b/src/context/containments/verticallayout/VerticalToolbarContainment.cpp @@ -19,7 +19,10 @@ #include "VerticalToolbarContainment.h" #include "ContextView.h" +#include "core/interfaces/Logger.h" +#include "core/support/Components.h" #include "core/support/Debug.h" +#include "EngineController.h" #include "PaletteHandler.h" #include "VerticalAppletLayout.h" @@ -136,19 +139,25 @@ Context::VerticalToolbarContainment::updateGeometry() m_applets->refresh(); } -Plasma::Applet* +void Context::VerticalToolbarContainment::addApplet( const QString& pluginName, const int loc ) // SLOT { DEBUG_BLOCK + if( pluginName == "analyzer" && !EngineController::instance()->supportsAudioDataOutput() ) + { + Amarok::Components::logger()->longMessage( i18n( "Error: Visualizations are not supported by your current Phonon backend." ), + Amarok::Logger::Error ) ; + + return; + } + Plasma::Applet* applet = Plasma::Containment::addApplet( pluginName ); Q_ASSERT_X( applet, "addApplet", "FAILED ADDING APPLET TO CONTAINMENT!! NOT FOUND!!" ); m_applets->addApplet( applet, loc ); - applet->setFlag(QGraphicsItem::ItemIsMovable, false); - - return applet; + applet->setFlag( QGraphicsItem::ItemIsMovable, false ); } void diff --git a/src/context/containments/verticallayout/VerticalToolbarContainment.h b/src/context/containments/verticallayout/VerticalToolbarContainment.h index 31f7632..6c933ab 100644 --- a/src/context/containments/verticallayout/VerticalToolbarContainment.h +++ b/src/context/containments/verticallayout/VerticalToolbarContainment.h @@ -48,8 +48,8 @@ class VerticalToolbarContainment : public Containment virtual ContextView *view(); public slots: - Applet* addApplet( const QString& pluginName, const int ); - void appletRemoved( Plasma::Applet* ); + void addApplet( const QString& pluginName, const int ); + void appletRemoved( Plasma::Applet* ); // these slots below are forwarded to the layout void showApplet( Plasma::Applet* ); void moveApplet( Plasma::Applet*, int, int ); -- 1.8.4
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