On Wed, Dec 8, 2010 at 00:42, Teo Mrnjavac <t...@kde.org> wrote: > On Tue, Dec 7, 2010 at 23:04, Tomasz Bątor <tom...@gmail.com> wrote: >> On Tue, Dec 7, 2010 at 10:18 PM, Teo Mrnjavac <t...@kde.org> wrote: >>> >>> > Doesn't compile on Windows using VS2008: >>> > >>> > C:\dev\src\amarok-2.3.90\src\core\transcoding\TranscodingController.cpp(30) >>> > : error C2491: 'The::transcodingController' : definition of dllimport >>> > function not allowed >>> Since I don't run Windows, I would greatly appreciate if you could >>> please check if the attached patch fixes the build issue. >> >> Not so good, lots of warnings and errors now: http://pastebin.com/7ESDrMqD >> regards, >> Tomasz
This has been fixed in git master as of commit 79596a4f4041c5ae5ebdfae535a6a89d579454c2. Windows users who wish to test Amarok 2.4 Beta 1 are advised to either build from git or apply the attached 3 patches in order on top of the 2.4 Beta 1 tarball. Cheers -- Teo
From b93953693819fd85ef37724585094a0037f5476e Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac <t...@kde.org> Date: Tue, 7 Dec 2010 22:12:38 +0100 Subject: [PATCH 1/4] Removed useless AMAROK_EXPORT in a method's definition. --- src/core/transcoding/TranscodingController.cpp | 2 +- src/core/transcoding/TranscodingController.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/transcoding/TranscodingController.cpp b/src/core/transcoding/TranscodingController.cpp index 49d8b22..9f25c7f 100644 --- a/src/core/transcoding/TranscodingController.cpp +++ b/src/core/transcoding/TranscodingController.cpp @@ -26,7 +26,7 @@ namespace The { -AMAROK_EXPORT Transcoding::Controller *transcodingController() +Transcoding::Controller *transcodingController() { return Transcoding::Controller::instance(); } diff --git a/src/core/transcoding/TranscodingController.h b/src/core/transcoding/TranscodingController.h index 016ddd8..54848c0 100644 --- a/src/core/transcoding/TranscodingController.h +++ b/src/core/transcoding/TranscodingController.h @@ -72,7 +72,7 @@ private: namespace The { - AMAROK_EXPORT Transcoding::Controller *transcodingController(); + AMAROK_CORE_EXPORT Transcoding::Controller *transcodingController(); } #endif //TRANSCODING_CONTROLLER_H -- 1.7.3.2
From 885ac8ac7b8a3e8ebb4b991b9e7bbfdfa14f8e3b Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac <t...@kde.org> Date: Wed, 8 Dec 2010 00:36:34 +0100 Subject: [PATCH 2/4] Removed singleton pattern from Transcoding::Controller in favor of using Amarok::Components as Maximilian suggested. Also fixed an enum-unchecked-by-switch warning. --- src/App.cpp | 2 +- src/browsers/CollectionTreeView.cpp | 2 +- src/browsers/filebrowser/FileView.cpp | 2 +- src/core-impl/collections/db/sql/SqlCollection.cpp | 2 +- .../collections/db/sql/SqlCollectionLocation.cpp | 2 +- src/core/support/Components.cpp | 5 +++- src/core/support/Components.h | 8 +++++ src/core/transcoding/TranscodingController.cpp | 28 -------------------- src/core/transcoding/TranscodingController.h | 20 +------------ src/transcoding/TranscodingAssistantDialog.cpp | 8 +++-- src/transcoding/TranscodingJob.cpp | 4 +- .../TranscodingOptionsStackedWidget.cpp | 2 +- 12 files changed, 27 insertions(+), 58 deletions(-) diff --git a/src/App.cpp b/src/App.cpp index d903811..6232eea 100644 --- a/src/App.cpp +++ b/src/App.cpp @@ -668,7 +668,7 @@ App::continueInit() //Instantiate the Transcoding::Controller, this fires up an asynchronous KProcess with //FFmpeg which should not take more than ~200msec. - The::transcodingController(); + Amarok::Components::setTranscodingController( new Transcoding::Controller( this ) ); if( splash ) // close splash correctly { diff --git a/src/browsers/CollectionTreeView.cpp b/src/browsers/CollectionTreeView.cpp index c5b826c..74f46da 100644 --- a/src/browsers/CollectionTreeView.cpp +++ b/src/browsers/CollectionTreeView.cpp @@ -1150,7 +1150,7 @@ void CollectionTreeView::slotCopyTracks() { Transcoding::Configuration configuration = Transcoding::Configuration(); - if( !The::transcodingController()->availableFormats().isEmpty() ) + if( !Amarok::Components::transcodingController()->availableFormats().isEmpty() ) { Transcoding::AssistantDialog dialog( this ); if( dialog.exec() ) diff --git a/src/browsers/filebrowser/FileView.cpp b/src/browsers/filebrowser/FileView.cpp index 6d9d1ef..df44f98 100644 --- a/src/browsers/filebrowser/FileView.cpp +++ b/src/browsers/filebrowser/FileView.cpp @@ -250,7 +250,7 @@ FileView::slotPrepareTranscodeTracks() debug()<<" SRC URL IS " << list.urlList().first(); debug()<<" SRC URL IS " << list.urlList().first(); - if( !The::transcodingController()->availableFormats().isEmpty() ) + if( !Amarok::Components::transcodingController()->availableFormats().isEmpty() ) { Transcoding::AssistantDialog *d = new Transcoding::AssistantDialog( this ); debug() << "About to show Transcoding::AssistantDialog"; diff --git a/src/core-impl/collections/db/sql/SqlCollection.cpp b/src/core-impl/collections/db/sql/SqlCollection.cpp index a851dcc..fda199c 100644 --- a/src/core-impl/collections/db/sql/SqlCollection.cpp +++ b/src/core-impl/collections/db/sql/SqlCollection.cpp @@ -69,7 +69,7 @@ public: virtual void setTranscodingConfiguration( const Transcoding::Configuration &configuration = Transcoding::Configuration() ) { m_targetFileExtension = - The::transcodingController()->format( configuration.encoder() )->fileExtension(); } + Amarok::Components::transcodingController()->format( configuration.encoder() )->fileExtension(); } virtual void show() { diff --git a/src/core-impl/collections/db/sql/SqlCollectionLocation.cpp b/src/core-impl/collections/db/sql/SqlCollectionLocation.cpp index 4c6e566..f729c31 100644 --- a/src/core-impl/collections/db/sql/SqlCollectionLocation.cpp +++ b/src/core-impl/collections/db/sql/SqlCollectionLocation.cpp @@ -569,7 +569,7 @@ bool SqlCollectionLocation::startNextJob( const Transcoding::Configuration confi { QString destPath = dest.path(); destPath.truncate( dest.path().lastIndexOf( '.' ) + 1 ); - destPath.append( The::transcodingController()-> + destPath.append( Amarok::Components::transcodingController()-> format( configuration.encoder() )->fileExtension() ); dest.setPath( destPath ); job = new Transcoding::Job( src, dest, configuration, this ); diff --git a/src/core/support/Components.cpp b/src/core/support/Components.cpp index fd6c9a2..add22f8 100644 --- a/src/core/support/Components.cpp +++ b/src/core/support/Components.cpp @@ -27,7 +27,7 @@ public: , sqlStorage( 0 ) , applicationController( 0 ) , collectionLocationDelegate( 0 ) - + , transcodingController( 0 ) {} CollectionManager *collectionManager; @@ -36,6 +36,7 @@ public: Amarok::Logger *logger; Amarok::ApplicationController *applicationController; Collections::CollectionLocationDelegate *collectionLocationDelegate; + Transcoding::Controller *transcodingController; }; //using a static variable is ok in this case as ComponentsPrivate does nothing on destruction @@ -71,3 +72,5 @@ COMPONENT_ACCESSORS( Amarok::ApplicationController*, applicationController, setA COMPONENT_ACCESSORS( Collections::CollectionLocationDelegate*, collectionLocationDelegate, setCollectionLocationDelegate ) +COMPONENT_ACCESSORS( Transcoding::Controller*, transcodingController, setTranscodingController ) + diff --git a/src/core/support/Components.h b/src/core/support/Components.h index a75bb9e..93eaf45 100644 --- a/src/core/support/Components.h +++ b/src/core/support/Components.h @@ -30,6 +30,11 @@ namespace Collections class CollectionLocationDelegate; } +namespace Transcoding +{ + class Controller; +} + class CollectionManager; class EngineController; class SqlStorage; @@ -55,6 +60,9 @@ namespace Amarok AMAROK_CORE_EXPORT Collections::CollectionLocationDelegate* collectionLocationDelegate(); AMAROK_CORE_EXPORT Collections::CollectionLocationDelegate* setCollectionLocationDelegate( Collections::CollectionLocationDelegate *delegate ); + + AMAROK_CORE_EXPORT Transcoding::Controller* transcodingController(); + AMAROK_CORE_EXPORT Transcoding::Controller* setTranscodingController( Transcoding::Controller *controller ); } } diff --git a/src/core/transcoding/TranscodingController.cpp b/src/core/transcoding/TranscodingController.cpp index 9f25c7f..b0b92a4 100644 --- a/src/core/transcoding/TranscodingController.cpp +++ b/src/core/transcoding/TranscodingController.cpp @@ -24,37 +24,9 @@ #include "formats/TranscodingVorbisFormat.h" #include "formats/TranscodingWmaFormat.h" -namespace The -{ -Transcoding::Controller *transcodingController() -{ - return Transcoding::Controller::instance(); -} -} - namespace Transcoding { -Controller *Controller::s_instance = 0; - -Controller * -Controller::instance() -{ - if( s_instance == 0 ) - s_instance = new Controller(); - return s_instance; -} - -void -Controller::destroy() -{ - if( s_instance ) - { - delete s_instance; - s_instance = 0; - } -} - Controller::Controller( QObject *parent ) : QObject( parent ) , m_formats( QList< Format * >() diff --git a/src/core/transcoding/TranscodingController.h b/src/core/transcoding/TranscodingController.h index 54848c0..9c3e2858 100644 --- a/src/core/transcoding/TranscodingController.h +++ b/src/core/transcoding/TranscodingController.h @@ -20,6 +20,7 @@ #include "shared/amarok_export.h" #include "TranscodingDefines.h" #include "TranscodingFormat.h" +#include "core/support/Components.h" #include <KProcess> @@ -32,23 +33,13 @@ namespace Transcoding /** * Singleton class that handles and wraps around the Transcoding architecture. - * To talk to the transcoding controller, use The::transcodingController(). * @author Téo Mrnjavac <t...@kde.org> */ class AMAROK_CORE_EXPORT Controller : public QObject { Q_OBJECT public: - /** - * Accessor for the singleton pattern. - * @return a pointer to the only instance of Transcoding::Controller. - */ - static Controller *instance(); - - /** - * Singleton destructor. - */ - static void destroy(); + Controller( QObject *parent = 0 ); const QList< Format * > & availableFormats() const { return m_availableFormats; } const QList< Format * > & allFormats() const { return m_formats; } @@ -58,8 +49,6 @@ private slots: void onAvailabilityVerified( int exitCode, QProcess::ExitStatus exitStatus ); private: - Controller( QObject *parent = 0 ); - static Controller *s_instance; const QList< Format * > m_formats; QList< Format * > m_availableFormats; /* Unfortunately here I can't use QList< Format > instead of QList< Format * > because apparently @@ -70,9 +59,4 @@ private: } //namespace Transcoding -namespace The -{ - AMAROK_CORE_EXPORT Transcoding::Controller *transcodingController(); -} - #endif //TRANSCODING_CONTROLLER_H diff --git a/src/transcoding/TranscodingAssistantDialog.cpp b/src/transcoding/TranscodingAssistantDialog.cpp index d28645b..b64e74b 100644 --- a/src/transcoding/TranscodingAssistantDialog.cpp +++ b/src/transcoding/TranscodingAssistantDialog.cpp @@ -92,7 +92,7 @@ AssistantDialog::AssistantDialog( QWidget *parent ) void AssistantDialog::populateFormatList() { - foreach( Format *format, The::transcodingController()->availableFormats() ) + foreach( Format *format, Amarok::Components::transcodingController()->availableFormats() ) { QListWidgetItem *item = new QListWidgetItem( format->icon(), format->prettyName() ); item->setToolTip( format->description() ); @@ -112,7 +112,7 @@ AssistantDialog::onTranscodeWithDefaultsClicked() //SLOT { //REMOVE THIS BUTTON! m_configuration = Configuration( VORBIS ); - foreach( Property property, The::transcodingController()->format( VORBIS )->propertyList() ) + foreach( Property property, Amarok::Components::transcodingController()->format( VORBIS )->propertyList() ) { switch( property.type() ) { @@ -122,6 +122,8 @@ AssistantDialog::onTranscodeWithDefaultsClicked() //SLOT m_configuration.addProperty( property.name(), property.defaultText() ); case Property::LIST: m_configuration.addProperty( property.name(), property.defaultIndex() ); + case Property::TRADEOFF: + m_configuration.addProperty( property.name(), property.defaultValue() ); } } KDialog::done( KDialog::Accepted ); @@ -162,7 +164,7 @@ AssistantDialog::onFormatSelect( QListWidgetItem *item ) //SLOT ui.formatIconLabel->show(); ui.formatNameLabel->show(); Encoder encoder = static_cast< Encoder >( item->data( Qt::UserRole ).toInt() ); - const Format *format = The::transcodingController()->format( encoder ); + const Format *format = Amarok::Components::transcodingController()->format( encoder ); ui.formatIconLabel->setPixmap( format->icon().pixmap( 32, 32 ) ); ui.formatNameLabel->setText( format->prettyName() ); ui.formatIconLabel->setToolTip( format->description() ); diff --git a/src/transcoding/TranscodingJob.cpp b/src/transcoding/TranscodingJob.cpp index b715bd1..5b30c44 100644 --- a/src/transcoding/TranscodingJob.cpp +++ b/src/transcoding/TranscodingJob.cpp @@ -51,7 +51,7 @@ Job::Job( KUrl &src, debug() << "Transcoding::Job ctor!!"; debug()<< src; debug()<< src.path(); - QString fileExtension = The::transcodingController()->format( configuration.encoder() )->fileExtension(); + QString fileExtension = Amarok::Components::transcodingController()->format( configuration.encoder() )->fileExtension(); if( !( fileExtension.isEmpty() ) ) { QString destPath = src.path(); @@ -76,7 +76,7 @@ Job::init() *m_transcoder << QString( "-i" ) << m_src.path(); //... and finally, outfile configuration followed by the outfile path. - const Transcoding::Format *format = The::transcodingController()->format( m_configuration.encoder() ); + const Transcoding::Format *format = Amarok::Components::transcodingController()->format( m_configuration.encoder() ); *m_transcoder << format->ffmpegParameters( m_configuration ) << QString( "-map_meta_data" ) << QString( m_dest.path() + ":" + m_src.path() ) diff --git a/src/transcoding/TranscodingOptionsStackedWidget.cpp b/src/transcoding/TranscodingOptionsStackedWidget.cpp index daf1791..54c936d 100644 --- a/src/transcoding/TranscodingOptionsStackedWidget.cpp +++ b/src/transcoding/TranscodingOptionsStackedWidget.cpp @@ -34,7 +34,7 @@ OptionsStackedWidget::OptionsStackedWidget( QWidget *parent ) : QStackedWidget( parent ) { initWelcomePage(); - foreach( Format *format, The::transcodingController()->availableFormats() ) + foreach( Format *format, Amarok::Components::transcodingController()->availableFormats() ) { m_pagesMap.insert( format->encoder(), initCodecPage( format ) ); } -- 1.7.3.2
From 79596a4f4041c5ae5ebdfae535a6a89d579454c2 Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac <t...@kde.org> Date: Wed, 8 Dec 2010 17:05:32 +0100 Subject: [PATCH 4/4] Fix exports. --- src/core/transcoding/TranscodingConfiguration.h | 2 +- src/core/transcoding/TranscodingProperty.h | 2 +- src/transcoding/TranscodingAssistantDialog.h | 3 +- src/transcoding/TranscodingJob.h | 3 +- src/transcoding/amarok_transcoding_export.h | 35 +++++++++++++++++++++++ 5 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 src/transcoding/amarok_transcoding_export.h diff --git a/src/core/transcoding/TranscodingConfiguration.h b/src/core/transcoding/TranscodingConfiguration.h index 2a527e7c..378fe12 100644 --- a/src/core/transcoding/TranscodingConfiguration.h +++ b/src/core/transcoding/TranscodingConfiguration.h @@ -32,7 +32,7 @@ namespace Transcoding * Transcoding::PropertyList. It contains all the data needed to start a Transcoding::Job. * @author Téo Mrnjavac <t...@kde.org> */ -class AMAROK_EXPORT Configuration +class AMAROK_CORE_EXPORT Configuration { public: explicit Configuration( Encoder encoder = NULL_CODEC ); diff --git a/src/core/transcoding/TranscodingProperty.h b/src/core/transcoding/TranscodingProperty.h index 68e0ff4..928854b 100644 --- a/src/core/transcoding/TranscodingProperty.h +++ b/src/core/transcoding/TranscodingProperty.h @@ -32,7 +32,7 @@ namespace Transcoding * defined by a Transcoding::Format subclass. * @author Téo Mrnjavac <t...@kde.org> */ -class AMAROK_EXPORT Property +class AMAROK_CORE_EXPORT Property { public: enum Type diff --git a/src/transcoding/TranscodingAssistantDialog.h b/src/transcoding/TranscodingAssistantDialog.h index d2fea8a..718c01d 100644 --- a/src/transcoding/TranscodingAssistantDialog.h +++ b/src/transcoding/TranscodingAssistantDialog.h @@ -18,6 +18,7 @@ #define TRANSCODING_ASSISTANTDIALOG_H #include "src/transcoding/ui_TranscodingAssistantDialog.h" +#include "amarok_transcoding_export.h" #include "core/transcoding/TranscodingFormat.h" #include "core/transcoding/TranscodingConfiguration.h" #include "core/support/Debug.h" @@ -33,7 +34,7 @@ namespace Transcoding * A KDialog for initiating a transcoding operation. * @author Téo Mrnjavac <t...@kde.org> */ -class AMAROK_EXPORT AssistantDialog : public KDialog +class AMAROK_TRANSCODING_EXPORT AssistantDialog : public KDialog { Q_OBJECT public: diff --git a/src/transcoding/TranscodingJob.h b/src/transcoding/TranscodingJob.h index fc008ef..88d8d11 100644 --- a/src/transcoding/TranscodingJob.h +++ b/src/transcoding/TranscodingJob.h @@ -17,6 +17,7 @@ #ifndef TRANSCODING_JOB_H #define TRANSCODING_JOB_H +#include "amarok_transcoding_export.h" #include "core/transcoding/TranscodingConfiguration.h" #include <KJob> @@ -32,7 +33,7 @@ namespace Transcoding * codec and container format. * @author Téo Mrnjavac <t...@kde.org> */ -class AMAROK_EXPORT Job : public KJob +class AMAROK_TRANSCODING_EXPORT Job : public KJob { Q_OBJECT public: diff --git a/src/transcoding/amarok_transcoding_export.h b/src/transcoding/amarok_transcoding_export.h new file mode 100644 index 0000000..401b95c --- /dev/null +++ b/src/transcoding/amarok_transcoding_export.h @@ -0,0 +1,35 @@ +/**************************************************************************************** + * Copyright (c) 2010 Téo Mrnjavac <t...@kde.org> * + * * + * 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) 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/>. * + ****************************************************************************************/ + +#ifndef AMAROK_TRANSCODING_EXPORT_H +#define AMAROK_TRANSCODING_EXPORT_H + +/* needed for KDE_EXPORT and KDE_IMPORT macros */ +#include <kdemacros.h> + +#ifndef AMAROK_TRANSCODING_EXPORT +# ifdef MAKE_AMAROK_TRANSCODING_LIB + /* We are building this library */ +# define AMAROK_TRANSCODING_EXPORT KDE_EXPORT + +# else + /* We are using this library */ +# define AMAROK_TRANSCODING_EXPORT KDE_IMPORT + +# endif//MAKE_TRANSCODING_LIB +#endif// AMAROK_EXPORT + +#endif //AMAROK_TRANSCODING_EXPORT_H -- 1.7.3.2
_______________________________________________ Amarok mailing list Amarok@kde.org https://mail.kde.org/mailman/listinfo/amarok