[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: extragear/multimedia/amarok/src/dialogs
From: "Peter Zhou" <peterzhoulei () gmail ! com>
Date: 2008-08-11 19:51:58
Message-ID: 2d760a610808111251xd9fb65ai594a19d6e88d3e35 () mail ! gmail ! com
[Download RAW message or body]
m_scripts[name].info.setPluginEnabled( false ); is not working anymore
after the patch. ( in slotStopScript )
On Mon, Aug 11, 2008 at 4:26 PM, Andrew Turner
<andrewturner512+kdebugs@googlemail.com> wrote:
> SVN commit 845349 by aturner:
>
> Make the gui a member of the ScriptManager and delete it in the destructor (rather \
> than leaking memory as before).
>
> M +30 -28 ScriptManager.cpp
> M +10 -2 ScriptManager.h
>
>
> --- trunk/extragear/multimedia/amarok/src/dialogs/ScriptManager.cpp #845348:845349
> @@ -117,7 +117,7 @@
> , EngineObserver( The::engineController() )
> {
> DEBUG_BLOCK
> - Ui::ScriptManagerBase* gui = new Ui::ScriptManagerBase();
> + m_gui = new Ui::ScriptManagerBase;
> setObjectName( "ScriptManager" );
> setButtons( None );
>
> @@ -133,21 +133,21 @@
> #endif
>
> QWidget* main = new QWidget( this );
> - gui->setupUi( main );
> + m_gui->setupUi( main );
> setMainWidget( main );
>
> - m_scriptSelector = gui->pluginWidget;
> - gui->pluginWidget->setSizePolicy(QSizePolicy::Preferred \
> ,QSizePolicy::Expanding); + m_scriptSelector = m_gui->pluginWidget;
> + m_gui->pluginWidget->setSizePolicy(QSizePolicy::Preferred \
> ,QSizePolicy::Expanding);
> - connect( gui->installButton, SIGNAL( clicked() ), SLOT( slotInstallScript() \
> ) );
> - connect( gui->retrieveButton, SIGNAL( clicked() ), SLOT( slotRetrieveScript() \
> ) );
> - connect( gui->uninstallButton, SIGNAL( clicked() ), SLOT( \
> slotUninstallScript() ) ); + connect( m_gui->installButton, SIGNAL( clicked() \
> ), SLOT( slotInstallScript() ) ); + connect( m_gui->retrieveButton, SIGNAL( \
> clicked() ), SLOT( slotRetrieveScript() ) ); + connect( m_gui->uninstallButton, \
> SIGNAL( clicked() ), SLOT( slotUninstallScript() ) ); connect( m_scriptSelector, \
> SIGNAL( changed( bool ) ), SLOT( slotConfigChanged( bool ) ) ); connect( \
> m_scriptSelector, SIGNAL( configCommitted ( const QByteArray & ) ), SLOT( \
> slotConfigComitted( const QByteArray & ) ) );
> - gui->installButton ->setIcon( KIcon( "folder-amarok" ) );
> - gui->retrieveButton ->setIcon( KIcon( "get-hot-new-stuff-amarok" ) );
> - gui->uninstallButton->setIcon( KIcon( "edit-delete-amarok" ) );
> + m_gui->installButton ->setIcon( KIcon( "folder-amarok" ) );
> + m_gui->retrieveButton ->setIcon( KIcon( "get-hot-new-stuff-amarok" ) );
> + m_gui->uninstallButton->setIcon( KIcon( "edit-delete-amarok" ) );
>
> // Center the dialog in the middle of the mainwindow
> const int x = parentWidget()->width() / 2 - sizeHint().width() / 2;
> @@ -173,6 +173,8 @@
>
> config.sync();
>
> + delete m_gui;
> +
> s_instance = 0;
> }
>
> @@ -248,12 +250,12 @@
> }
> foreach( const QString &key, m_scripts.keys() )
> {
> - if ( m_scripts[key].info->category() == "Generic" )
> - GenericInfoList.append( *m_scripts[key].info );
> - else if ( m_scripts[key].info->category() == "Lyrics" )
> - LyricsInfoList.append( *m_scripts[key].info );
> - else if ( m_scripts[key].info->category() == "Scriptable Service" )
> - ServiceInfoList.append( *m_scripts[key].info );
> + if ( m_scripts[key].info.category() == "Generic" )
> + GenericInfoList.append( m_scripts[key].info );
> + else if ( m_scripts[key].info.category() == "Lyrics" )
> + LyricsInfoList.append( m_scripts[key].info );
> + else if ( m_scripts[key].info.category() == "Scriptable Service" )
> + ServiceInfoList.append( m_scripts[key].info );
> }
> m_scriptSelector->addScripts( LyricsInfoList, KPluginSelector::ReadConfigFile, \
> "Lyrics" ); m_scriptSelector->addScripts( GenericInfoList, \
> KPluginSelector::ReadConfigFile, "Generic" ); @@ -429,10 +431,10 @@
> DEBUG_BLOCK
>
> m_scripts[name].engine->abortEvaluation();
> - if( m_scripts[name].info->category() == "Scriptable Service" )
> + if( m_scripts[name].info.category() == "Scriptable Service" )
> The::scriptableServiceManager()->removeRunningScript( name );
> - if ( m_scripts[name].info->isPluginEnabled() )
> - m_scripts[name].info->setPluginEnabled( false );
> + if ( m_scripts[name].info.isPluginEnabled() )
> + m_scripts[name].info.setPluginEnabled( false );
>
> scriptFinished( name );
> }
> @@ -451,10 +453,10 @@
> m_scriptSelector->save();
> foreach( const QString &key, m_scripts.keys() )
> {
> - if( !m_scripts[key].running && m_scripts[key].info->isPluginEnabled() \
> )
> - slotRunScript( m_scripts[key].info->name() );
> - if( m_scripts[key].running && !m_scripts[key].info->isPluginEnabled() \
> )
> - slotStopScript( m_scripts[key].info->name() );
> + if( !m_scripts[key].running && m_scripts[key].info.isPluginEnabled() )
> + slotRunScript( m_scripts[key].info.name() );
> + if( m_scripts[key].running && !m_scripts[key].info.isPluginEnabled() )
> + slotStopScript( m_scripts[key].info.name() );
> }
> }
> }
> @@ -508,13 +510,13 @@
> {
> const KUrl url = KUrl( path );
> ScriptItem item;
> - item.info = new KPluginInfo( specPath );
> - if ( !item.info->isValid() ) return false;
> - if ( ( item.info->name() == "" ) || ( item.info->version() == "" ) || \
> ( item.info->category() == "" ) ) return false;
> - debug() << "script info:" << item.info->name() << " " << \
> item.info->version() << " " << item.info->category(); + item.info = \
> KPluginInfo( specPath ); + if ( !item.info.isValid() ) return false;
> + if ( ( item.info.name() == "" ) || ( item.info.version() == "" ) || ( \
> item.info.category() == "" ) ) return false; + debug() << "script info:" \
> << item.info.name() << " " << item.info.version() << " " << item.info.category(); \
> item.url = url; item.running = false;
> - m_scripts[item.info->name()] = item;
> + m_scripts[item.info.name()] = item;
> }
> else
> {
> --- trunk/extragear/multimedia/amarok/src/dialogs/ScriptManager.h #845348:845349
> @@ -35,6 +35,11 @@
> #include <QMap>
> #include <QScriptValue>
>
> +namespace Ui
> +{
> + class ScriptManagerBase;
> +}
> +
> class KArchiveDirectory;
> class KPluginInfo;
> class KPluginSelector;
> @@ -103,7 +108,7 @@
> bool m_installSuccess;
>
> struct ScriptItem {
> - KPluginInfo* info;
> + KPluginInfo info;
> QScriptEngine* engine;
> KUrl url;
> bool running;
> @@ -112,7 +117,7 @@
> QString log;
> QList<QObject*> guiPtrList;
> QList<QObject*> wrapperList;
> - ScriptItem() : info( 0 ), engine( 0 ), running( false ), globalPtr( 0 \
> ), servicePtr( 0 ) {} + ScriptItem() : engine( 0 ), running( false ), \
> globalPtr( 0 ), servicePtr( 0 ) {} };
>
> typedef QMap<QString, ScriptItem> ScriptMap;
> @@ -121,6 +126,9 @@
> QScriptValue m_global;
> bool m_configChanged;
> QStringList m_changedScripts;
> +
> + Ui::ScriptManagerBase* m_gui;
> +
> };
>
> #endif /* AMAROK_SCRIPTMANAGER_H */
>
--
Peter
-------------------------------
http://www.peterzl.net/
> > Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic