http://code.google.com/p/quarkplayer/source/detail?r=1423
Modified:
/trunk/quarkplayer/PluginConfig.cpp
/trunk/quarkplayer/PluginData.cpp
/trunk/quarkplayer/PluginData.h
/trunk/quarkplayer/PluginManager.cpp
=======================================
--- /trunk/quarkplayer/PluginConfig.cpp Fri Aug 13 02:18:04 2010
+++ /trunk/quarkplayer/PluginConfig.cpp Sun Feb 20 14:46:08 2011
@@ -1,6 +1,6 @@
/*
* QuarkPlayer, a Phonon media player
- * Copyright (C) 2008-2009 Tanguy Krotoff <tkro...@gmail.com>
+ * Copyright (C) 2008-2011 Tanguy Krotoff <tkro...@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
published by
@@ -36,18 +36,22 @@
}
PluginDataList PluginConfig::plugins() const {
- //Version working with QDataStream
- /*
- QVariant tmp = Config::instance().value(PLUGINS_KEY);
- PluginDataList pluginList = tmp.value<PluginDataList>();
- return pluginList;
- */
-
- //Version working with QTextStream
- QString tmp(Config::instance().value(PLUGINS_KEY).toString());
- QTextStream stream(&tmp);
- PluginDataList pluginList;
- stream >> pluginList;
+ static PluginDataList pluginList;
+
+ if (pluginList.isEmpty()) {
+ //Version working with QDataStream
+ /*
+ QVariant tmp = Config::instance().value(PLUGINS_KEY);
+ PluginDataList pluginList = tmp.value<PluginDataList>();
+ return pluginList;
+ */
+
+ //Version working with QTextStream
+ QString tmp(Config::instance().value(PLUGINS_KEY).toString());
+ QTextStream stream(&tmp);
+ stream >> pluginList;
+ }
+
return pluginList;
}
=======================================
--- /trunk/quarkplayer/PluginData.cpp Wed Aug 25 15:38:42 2010
+++ /trunk/quarkplayer/PluginData.cpp Sun Feb 20 14:46:08 2011
@@ -1,6 +1,6 @@
/*
* QuarkPlayer, a Phonon media player
- * Copyright (C) 2008-2009 Tanguy Krotoff <tkro...@gmail.com>
+ * Copyright (C) 2008-2011 Tanguy Krotoff <tkro...@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
published by
@@ -30,8 +30,8 @@
#include <QtCore/QDir>
#include <QtCore/QStringList>
-PluginData::PluginData(const QString & filename, const QUuid & uuid, bool
enabled) {
- _filename = filename;
+PluginData::PluginData(const QString & fileName, const QUuid & uuid, bool
enabled) {
+ _fileName = fileName;
_uuid = uuid;
_enabled = enabled;
@@ -54,7 +54,7 @@
}
void PluginData::copy(const PluginData & pluginData) {
- _filename = pluginData._filename;
+ _fileName = pluginData._fileName;
_uuid = pluginData._uuid;
_enabled = pluginData._enabled;
@@ -77,7 +77,7 @@
}
QString PluginData::fileName() const {
- return _filename;
+ return _fileName;
}
QUuid PluginData::uuid() const {
@@ -118,10 +118,10 @@
}
}
-PluginDataList PluginDataList::values(const QString & filename) const {
+PluginDataList PluginDataList::values(const QString & fileName) const {
PluginDataList pluginDataList;
- foreach(PluginData pluginData, *this) {
- if (pluginData.fileName() == filename) {
+ foreach (PluginData pluginData, *this) {
+ if (pluginData.fileName() == fileName) {
pluginDataList += pluginData;
}
}
@@ -174,19 +174,19 @@
}
while (!stream.atEnd()) {
- QString filename;
- stream >> filename;
+ QString fileName;
+ stream >> fileName;
QUuid uuid;
bool enabled;
stream >> uuid;
stream >> enabled;
- if (filename.isEmpty()) {
+ if (fileName.isEmpty()) {
//FIXME don't know why, stream can contain empty datas
//even if we didn't put empty datas in it (!)
} else {
- PluginData pluginData(filename, uuid, enabled);
+ PluginData pluginData(fileName, uuid, enabled);
plugins.removeAll(pluginData);
plugins += pluginData;
}
@@ -236,12 +236,12 @@
}
while (!stream.atEnd()) {
- //FIXME this is buggy if the filename contains whitespaces
+ //FIXME this is buggy if the fileName contains whitespaces
//I don't know how to make QTextStream aware about string spaces :/
//See
http://doc.trolltech.com/main-snapshot/qtextstream.html#operator-gt-gt-4
- //Anyway, plugin filenames should not contain whitespaces
- QString filename;
- stream >> filename;
+ //Anyway, plugin fileNames should not contain whitespaces
+ QString fileName;
+ stream >> fileName;
///
QString uuid;
@@ -249,11 +249,11 @@
stream >> uuid;
stream >> enabled;
- if (filename.isEmpty()) {
+ if (fileName.isEmpty()) {
//FIXME don't know why, stream can contain empty datas
//even if we didn't put empty datas in it (!)
} else {
- PluginData pluginData(filename, uuid, enabled);
+ PluginData pluginData(fileName, uuid, enabled);
plugins.removeAll(pluginData);
plugins += pluginData;
}
=======================================
--- /trunk/quarkplayer/PluginData.h Fri Aug 13 02:18:04 2010
+++ /trunk/quarkplayer/PluginData.h Sun Feb 20 14:46:08 2011
@@ -1,6 +1,6 @@
/*
* QuarkPlayer, a Phonon media player
- * Copyright (C) 2008-2009 Tanguy Krotoff <tkro...@gmail.com>
+ * Copyright (C) 2008-2011 Tanguy Krotoff <tkro...@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
published by
@@ -22,7 +22,6 @@
#include <quarkplayer/QuarkPlayerExport.h>
#include <QtCore/QUuid>
-#include <QtCore/QMultiHash>
#include <QtCore/QTextStream>
class PluginInterface;
@@ -53,7 +52,7 @@
class QUARKPLAYER_API PluginData {
public:
- PluginData(const QString & filename, const QUuid & uuid, bool enabled);
+ PluginData(const QString & fileName, const QUuid & uuid, bool enabled);
PluginData(const PluginData & pluginData);
@@ -87,7 +86,7 @@
void copy(const PluginData & pluginData);
- QString _filename;
+ QString _fileName;
QUuid _uuid;
@@ -106,7 +105,7 @@
public:
/** Gets the sublist of plugins matching the given filename. */
- PluginDataList values(const QString & filename) const;
+ PluginDataList values(const QString & fileName) const;
};
=======================================
--- /trunk/quarkplayer/PluginManager.cpp Sun Feb 20 13:15:39 2011
+++ /trunk/quarkplayer/PluginManager.cpp Sun Feb 20 14:46:08 2011
@@ -343,6 +343,10 @@
//This is why we prepend the loaded plugins to the list of loaded
plugins
_loadedPlugins.prepend(pluginData);
+ //The plugin we are loading might be a disabled plugin
+ //So let's erase it from the list of disabled plugins if possible
+ _disabledPlugins.removeAll(pluginData);
+
QuarkPlayerCoreDebug() << "Plugin loaded:" << fileName;
loaded = true;
} else {