http://code.google.com/p/quarkplayer/source/detail?r=1429
Added:
/trunk/tests/quarkplayer-plugins/MainWindow/CMakeLists.txt
/trunk/tests/quarkplayer-plugins/MainWindow/MainWindowTest.cpp
/trunk/tests/quarkplayer-plugins/MainWindow/MainWindowTest.h
/trunk/tests/quarkplayer-plugins/Playlist/CMakeLists.txt
/trunk/tests/quarkplayer-plugins/Playlist/PlaylistWidgetTest.cpp
/trunk/tests/quarkplayer-plugins/Playlist/PlaylistWidgetTest.h
Modified:
/trunk/libs/TkUtil/ActionCollection.cpp
/trunk/quarkplayer/IPluginManager.h
/trunk/quarkplayer/MockPluginManager.cpp
/trunk/quarkplayer/MockPluginManager.h
/trunk/quarkplayer/PluginManager.cpp
/trunk/quarkplayer/PluginManager.h
/trunk/quarkplayer/QuarkPlayer.cpp
/trunk/quarkplayer/QuarkPlayer.h
/trunk/quarkplayer-app/main.cpp
/trunk/quarkplayer-plugins/ConfigWindow/PlaylistConfig.cpp
/trunk/quarkplayer-plugins/ConfigWindow/PlaylistConfig.h
/trunk/quarkplayer-plugins/FileBrowser/FileBrowserWidget.cpp
/trunk/quarkplayer-plugins/MainWindow/CommonActions.cpp
/trunk/quarkplayer-plugins/MainWindow/MainWindow.cpp
/trunk/quarkplayer-plugins/MainWindow/MainWindow.h
/trunk/quarkplayer-plugins/MainWindow/MockMainWindow.cpp
/trunk/quarkplayer-plugins/MainWindow/MockMainWindow.h
/trunk/quarkplayer-plugins/Playlist/PlaylistModel.cpp
/trunk/quarkplayer-plugins/Playlist/PlaylistModel.h
/trunk/quarkplayer-plugins/Playlist/PlaylistWidget.cpp
/trunk/tests/quarkplayer-plugins/CMakeLists.txt
/trunk/tests/quarkplayer-plugins/VideoWidget/MyVideoWidgetTest.cpp
=======================================
--- /dev/null
+++ /trunk/tests/quarkplayer-plugins/MainWindow/CMakeLists.txt Tue Feb 22
16:25:52 2011
@@ -0,0 +1,22 @@
+project(MainWindowTests)
+
+macro(add_my_test name)
+ set(SRCS ${ARGN})
+
+ add_executable(${name} ${SRCS})
+
+ add_test(${name} ${name})
+
+ target_link_libraries(${name}
+ MainWindow
+
+ ${QT_QTGUI_LIBRARY}
+ ${QT_QTTEST_LIBRARY}
+ )
+ install(TARGETS ${name} ${INSTALL_TARGETS_DEFAULT_ARGS})
+endmacro(add_my_test name)
+
+
+set(MainWindowTest_SRCS MainWindowTest.cpp)
+qt4_wrap_cpp(MainWindowTest_SRCS MainWindowTest.h)
+add_my_test(MainWindowTest ${MainWindowTest_SRCS})
=======================================
--- /dev/null
+++ /trunk/tests/quarkplayer-plugins/MainWindow/MainWindowTest.cpp Tue Feb
22 16:25:52 2011
@@ -0,0 +1,55 @@
+/*
+ * QuarkPlayer, a Phonon media player
+ * Copyright (C) 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
+ * 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "MainWindowTest.h"
+
+#include <quarkplayer/QuarkPlayer.h>
+#include <quarkplayer/MockPluginManager.h>
+
+#include <quarkplayer-plugins/MainWindow/MainWindow.h>
+
+#include <Logger/Logger.h>
+
+#include <QtGui/QtGui>
+
+MainWindowTest::MainWindowTest(QuarkPlayer & quarkPlayer) {
+}
+
+MainWindowTest::~MainWindowTest() {
+}
+
+int main(int argc, char * argv[]) {
+ QApplication app(argc, argv);
+
+ //General infos
+ app.setOrganizationName("QuarkPlayer");
+ app.setOrganizationDomain("quarkplayer.org");
+ app.setApplicationName("QuarkPlayer");
+
+ //Installs a custom message handler for qDebug(), qWarning() and others
+ qInstallMsgHandler(Logger::myMessageOutput);
+
+ MockPluginManager pluginManager;
+ QuarkPlayer quarkPlayer(pluginManager, &app);
+
+ MainWindow * mainWindow = new MainWindow(quarkPlayer,
QUuid::createUuid());
+
+ pluginManager.loadAllPlugins(quarkPlayer);
+
+ return app.exec();
+}
=======================================
--- /dev/null
+++ /trunk/tests/quarkplayer-plugins/MainWindow/MainWindowTest.h Tue Feb 22
16:25:52 2011
@@ -0,0 +1,43 @@
+/*
+ * QuarkPlayer, a Phonon media player
+ * Copyright (C) 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
+ * 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MAINWINDOWTEST_H
+#define MAINWINDOWTEST_H
+
+#include <QtCore/QObject>
+
+class QuarkPlayer;
+
+/**
+ * Test class for MainWindow.
+ *
+ * @see MainWindow
+ * @author Tanguy Krotoff
+ */
+class MainWindowTest : public QObject {
+ Q_OBJECT
+public:
+
+ MainWindowTest(QuarkPlayer & quarkPlayer);
+
+ ~MainWindowTest();
+
+private:
+};
+
+#endif //MAINWINDOWTEST_H
=======================================
--- /dev/null
+++ /trunk/tests/quarkplayer-plugins/Playlist/CMakeLists.txt Tue Feb 22
16:25:52 2011
@@ -0,0 +1,22 @@
+project(PlaylistTests)
+
+macro(add_my_test name)
+ set(SRCS ${ARGN})
+
+ add_executable(${name} ${SRCS})
+
+ add_test(${name} ${name})
+
+ target_link_libraries(${name}
+ Playlist
+
+ ${QT_QTGUI_LIBRARY}
+ ${QT_QTTEST_LIBRARY}
+ )
+ install(TARGETS ${name} ${INSTALL_TARGETS_DEFAULT_ARGS})
+endmacro(add_my_test name)
+
+
+set(PlaylistWidgetTest_SRCS PlaylistWidgetTest.cpp)
+qt4_wrap_cpp(PlaylistWidgetTest_SRCS PlaylistWidgetTest.h)
+add_my_test(PlaylistWidgetTest ${PlaylistWidgetTest_SRCS})
=======================================
--- /dev/null
+++ /trunk/tests/quarkplayer-plugins/Playlist/PlaylistWidgetTest.cpp Tue
Feb 22 16:25:52 2011
@@ -0,0 +1,63 @@
+/*
+ * QuarkPlayer, a Phonon media player
+ * Copyright (C) 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
+ * 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "PlaylistWidgetTest.h"
+
+#include <quarkplayer/QuarkPlayer.h>
+#include <quarkplayer/MockPluginManager.h>
+
+#include <quarkplayer-plugins/MainWindow/MockMainWindow.h>
+#include <quarkplayer-plugins/Playlist/PlaylistWidget.h>
+
+#include <Logger/Logger.h>
+
+#include <QtGui/QtGui>
+
+Q_IMPORT_PLUGIN(Playlist)
+Q_IMPORT_PLUGIN(MainWindow)
+Q_IMPORT_PLUGIN(ConfigWindow)
+
+PlaylistWidgetTest::PlaylistWidgetTest(QuarkPlayer & quarkPlayer,
IMainWindow * mainWindow) {
+ new PlaylistWidget(quarkPlayer, QUuid::createUuid(), mainWindow);
+}
+
+PlaylistWidgetTest::~PlaylistWidgetTest() {
+}
+
+int main(int argc, char * argv[]) {
+ QApplication app(argc, argv);
+
+ //General infos
+ app.setOrganizationName("QuarkPlayer");
+ app.setOrganizationDomain("quarkplayer.org");
+ app.setApplicationName("QuarkPlayer");
+
+ //Installs a custom message handler for qDebug(), qWarning() and others
+ qInstallMsgHandler(Logger::myMessageOutput);
+
+ MockPluginManager pluginManager;
+ QuarkPlayer quarkPlayer(pluginManager, &app);
+
+ MockMainWindow * mainWindow = new MockMainWindow(quarkPlayer,
QUuid::createUuid());
+
+ new PlaylistWidgetTest(quarkPlayer, mainWindow);
+
+ pluginManager.loadAllPlugins(quarkPlayer);
+
+ return app.exec();
+}
=======================================
--- /dev/null
+++ /trunk/tests/quarkplayer-plugins/Playlist/PlaylistWidgetTest.h Tue Feb
22 16:25:52 2011
@@ -0,0 +1,44 @@
+/*
+ * QuarkPlayer, a Phonon media player
+ * Copyright (C) 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
+ * 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef PLAYLISTWIDGETTEST_H
+#define PLAYLISTWIDGETTEST_H
+
+#include <QtCore/QObject>
+
+class QuarkPlayer;
+class IMainWindow;
+
+/**
+ * Test class for PlaylistWidget.
+ *
+ * @see PlaylistWidget
+ * @author Tanguy Krotoff
+ */
+class PlaylistWidgetTest : public QObject {
+ Q_OBJECT
+public:
+
+ PlaylistWidgetTest(QuarkPlayer & quarkPlayer, IMainWindow * mainWindow);
+
+ ~PlaylistWidgetTest();
+
+private:
+};
+
+#endif //PLAYLISTWIDGETTEST_H
=======================================
--- /trunk/libs/TkUtil/ActionCollection.cpp Fri Aug 13 02:18:04 2010
+++ /trunk/libs/TkUtil/ActionCollection.cpp Tue Feb 22 16:25:52 2011
@@ -1,6 +1,6 @@
/*
* QuarkPlayer, a Phonon media player
- * Copyright (C) 2008 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
@@ -32,38 +32,19 @@
}
void ActionCollection::addAction(const QString & name, QAction * action) {
- if (!action) {
- TkUtilCritical() << "QAction is null";
- }
-
- QString indexName = name;
- if (indexName.isEmpty()) {
- TkUtilCritical() << "QAction index name is empty";
- indexName = action->objectName();
- } else {
- action->setObjectName(indexName);
+ Q_ASSERT(action);
+ Q_ASSERT(!name.isEmpty());
+
+ if (_actionHash.contains(name)) {
+ TkUtilCritical() << "QAction:" << name << "already exist";
}
- if (indexName.isEmpty()) {
- indexName = indexName.sprintf("unnamed-%p", (void *) action);
- }
-
- if (_actionHash.contains(indexName)) {
- TkUtilCritical() << "QAction index name:" << indexName << "already
exist";
- }
-
- _actionHash[indexName] = action;
+ _actionHash[name] = action;
}
QAction * ActionCollection::action(const QString & name) {
- if (_actionHash.count(name) != 1) {
- TkUtilCritical() << "Invalid QAction name:" << name;
- }
-
QAction * action = _actionHash.value(name);
- if (!action) {
- TkUtilCritical() << "QAction is null";
- }
+ Q_ASSERT(action);
return action;
}
=======================================
--- /trunk/quarkplayer/IPluginManager.h Sun Feb 20 13:15:39 2011
+++ /trunk/quarkplayer/IPluginManager.h Tue Feb 22 16:25:52 2011
@@ -24,6 +24,8 @@
#include <QtCore/QObject>
class QuarkPlayer;
+class PluginData;
+class PluginInterface;
/**
* Interface for PluginManager.
@@ -41,6 +43,32 @@
/** Loads all the available plugins. */
virtual void loadAllPlugins(QuarkPlayer & quarkPlayer) = 0;
+ /** Loads a given plugin. */
+ virtual bool loadPlugin(PluginData & pluginData) = 0;
+
+ /**
+ * Loads/reloads a previously disabled plugin that matches the given
plugin fileName.
+ *
+ * If no previously disabled plugin exists then a new one will be created.
+ *
+ * <pre>
+ *
pluginManager.loadDisabledPlugin("name_of_my_plugin_without_file_extension");
+ * </pre>
+ *
+ * @param fileName plugin to reload
+ */
+ virtual bool loadDisabledPlugin(const QString & fileName) = 0;
+
+ /**
+ * Deletes/unloads a given plugin and saves the plugins configuration.
+ *
+ * This will delete/unload all the plugins depending on the plugin asked
to be deleted/unloaded.
+ */
+ virtual bool deletePlugin(PluginData & pluginData) = 0;
+
+ /** Gets the first loaded plugin interface matching the given fileName. */
+ virtual PluginInterface * pluginInterface(const QString & fileName) const
= 0;
+
signals:
/**
=======================================
--- /trunk/quarkplayer/MockPluginManager.cpp Tue Feb 22 03:13:10 2011
+++ /trunk/quarkplayer/MockPluginManager.cpp Tue Feb 22 16:25:52 2011
@@ -19,9 +19,23 @@
#include "MockPluginManager.h"
#include "QuarkPlayer.h"
+#include "PluginData.h"
void MockPluginManager::loadAllPlugins(QuarkPlayer & quarkPlayer) {
Q_UNUSED(quarkPlayer);
emit allPluginsLoaded();
}
+
+bool MockPluginManager::loadPlugin(PluginData & pluginData) {
+}
+
+bool MockPluginManager::loadDisabledPlugin(const QString & fileName) {
+}
+
+bool MockPluginManager::deletePlugin(PluginData & pluginData) {
+}
+
+PluginInterface * MockPluginManager::pluginInterface(const QString &
fileName) const {
+ return NULL;
+}
=======================================
--- /trunk/quarkplayer/MockPluginManager.h Sun Feb 20 13:15:39 2011
+++ /trunk/quarkplayer/MockPluginManager.h Tue Feb 22 16:25:52 2011
@@ -22,6 +22,8 @@
#include <quarkplayer/IPluginManager.h>
class QuarkPlayer;
+class PluginData;
+class PluginInterface;
/**
* Mock for IPluginManager.
@@ -35,6 +37,14 @@
void loadAllPlugins(QuarkPlayer & quarkPlayer);
+ bool loadPlugin(PluginData & pluginData);
+
+ bool loadDisabledPlugin(const QString & fileName);
+
+ bool deletePlugin(PluginData & pluginData);
+
+ PluginInterface * pluginInterface(const QString & fileName) const;
+
private:
};
=======================================
--- /trunk/quarkplayer/PluginManager.cpp Sun Feb 20 14:46:08 2011
+++ /trunk/quarkplayer/PluginManager.cpp Tue Feb 22 16:25:52 2011
@@ -227,6 +227,7 @@
pluginData.setEnabled(true);
QString fileName(pluginData.fileName());
+ Q_ASSERT(!fileName.isEmpty());
//Creates the factory
//2 cases: dynamic plugin and static plugin
@@ -244,6 +245,9 @@
pluginFound = true;
QuarkPlayerCoreDebug() << "Loading static plugin:" << fileName
<< "...";
break;
+ } else {
+ //Not the right factory since the static plugin was not found
+ factory = NULL;
}
}
}
@@ -273,53 +277,49 @@
if (factory) {
QStringList dependsOn(factory->dependencies());
- foreach (QString fileNameDepend, dependsOn) {
-
- bool dependSolved = false;
+ foreach (QString fileNameDependency, dependsOn) {
+ Q_ASSERT(!fileNameDependency.isEmpty());
//Check in the list of already loaded plugins
- PluginDataList loadedPlugins = _loadedPlugins.values(fileNameDepend);
- foreach (PluginData data, loadedPlugins) {
- //If we are here, it means the dependency plugin is already loaded
- //so no problem
- dependSolved = true;
- break;
- }
-
- if (!dependSolved) {
+ bool dependencySolved
= !_loadedPlugins.values(fileNameDependency).isEmpty();
+
+ if (!dependencySolved) {
//Compare to the configuration
- PluginDataList
configPlugins(PluginConfig::instance().plugins().values(fileNameDepend));
+ PluginDataList
configPlugins(PluginConfig::instance().plugins().values(fileNameDependency));
foreach (PluginData data, configPlugins) {
if (data.isEnabled()) {
} else {
//FIXME load the disabled plugin?
}
- loadPlugin(data);
- dependSolved = true;
+ dependencySolved = loadPlugin(data);
break;
}
}
- if (!dependSolved) {
+ if (!dependencySolved) {
//Still not found the dependency plugin?
//Check in the list of available plugins
//these plugins are neither part of the two categories at the moment:
//loaded or disabled
foreach (QString availableFilename, _availablePlugins) {
- if (fileNameDepend == availableFilename) {
+ if (fileNameDependency == availableFilename) {
//Ok, the dependency plugin has been found
//and is not loaded nor disabled
- PluginData pluginDataDepend(fileNameDepend, QUuid::createUuid(),
true);
- loadPlugin(pluginDataDepend);
- dependSolved = true;
+ PluginData pluginDataDependency(fileNameDependency,
QUuid::createUuid(), true);
+ dependencySolved = loadPlugin(pluginDataDependency);
break;
}
}
}
- if (!dependSolved) {
- //What to do?
- QuarkPlayerCoreCritical() << "Missing dependency:" << fileNameDepend;
+ if (!dependencySolved) {
+ QuarkPlayerCoreCritical() << "Missing dependency:" <<
fileNameDependency;
+
+ //Do not load the plugin since the dependencies are missing
+ //so factory set to NULL
+ pluginData.setFactory(NULL);
+
+ break;
}
}
}
=======================================
--- /trunk/quarkplayer/PluginManager.h Sun Feb 20 13:15:39 2011
+++ /trunk/quarkplayer/PluginManager.h Tue Feb 22 16:25:52 2011
@@ -45,30 +45,12 @@
void loadAllPlugins(QuarkPlayer & quarkPlayer);
- /** Loads a given plugin. */
bool loadPlugin(PluginData & pluginData);
- /**
- * Loads/reloads a previously disabled plugin that matches the given
plugin fileName.
- *
- * If no previously disabled plugin exists then a new one will be created.
- *
- * <pre>
- *
PluginManager::instance().loadDisabledPlugin("name_of_my_plugin_without_file_extension");
- * </pre>
- *
- * @param fileName plugin to reload
- */
bool loadDisabledPlugin(const QString & fileName);
- /**
- * Deletes/unloads a given plugin and saves the plugins configuration.
- *
- * This will delete/unload all the plugins depending on the plugin asked
to be deleted/unloaded.
- */
bool deletePlugin(PluginData & pluginData);
- /** Gets the first loaded plugin interface matching the given fileName. */
PluginInterface * pluginInterface(const QString & fileName) const;
/** Gets a plugin given a unique ID, search among all the available
plugins (loaded + disabled). */
=======================================
--- /trunk/quarkplayer/QuarkPlayer.cpp Sun Feb 20 13:15:39 2011
+++ /trunk/quarkplayer/QuarkPlayer.cpp Tue Feb 22 16:25:52 2011
@@ -1,6 +1,6 @@
/*
* QuarkPlayer, a Phonon media player
- * Copyright (C) 2008-2010 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
@@ -31,17 +31,22 @@
#include <QtCore/QRegExp>
#include <QtCore/QFileInfo>
-QuarkPlayer::QuarkPlayer(IPluginManager * pluginManager, QObject * parent)
- : QObject(parent) {
+QuarkPlayer::QuarkPlayer(IPluginManager & pluginManager, QObject * parent)
+ : QObject(parent),
+ _pluginManager(pluginManager) {
_currentMediaObject = NULL;
_currentMediaController = NULL;
- connect(pluginManager, SIGNAL(allPluginsLoaded()),
SLOT(allPluginsLoaded()));
+ connect(&_pluginManager, SIGNAL(allPluginsLoaded()),
SLOT(allPluginsLoaded()));
}
QuarkPlayer::~QuarkPlayer() {
}
+
+IPluginManager & QuarkPlayer::pluginManager() const {
+ return _pluginManager;
+}
void QuarkPlayer::setCurrentMediaObject(Phonon::MediaObject * mediaObject)
{
if (_currentMediaObject != mediaObject) {
=======================================
--- /trunk/quarkplayer/QuarkPlayer.h Sun Feb 20 13:15:39 2011
+++ /trunk/quarkplayer/QuarkPlayer.h Tue Feb 22 16:25:52 2011
@@ -65,10 +65,12 @@
* @param parent QuarkPlayer QObject parent, should be QCoreApplication
* @see main.cpp
*/
- QuarkPlayer(IPluginManager * pluginManager, QObject * parent);
+ QuarkPlayer(IPluginManager & pluginManager, QObject * parent);
~QuarkPlayer();
+ IPluginManager & pluginManager() const;
+
/**
* Changes the current media object to be used when playing a media.
*
@@ -200,6 +202,8 @@
private:
+ IPluginManager & _pluginManager;
+
/** Current media object, can be NULL if none. */
Phonon::MediaObject * _currentMediaObject;
=======================================
--- /trunk/quarkplayer-app/main.cpp Sun Feb 20 13:15:39 2011
+++ /trunk/quarkplayer-app/main.cpp Tue Feb 22 16:25:52 2011
@@ -132,7 +132,7 @@
//Parse the command line arguments
CommandLineParser parser;
- QuarkPlayer quarkPlayer(&PluginManager::instance(), &app);
+ QuarkPlayer quarkPlayer(PluginManager::instance(), &app);
PluginManager::instance().loadAllPlugins(quarkPlayer);
=======================================
--- /trunk/quarkplayer-plugins/ConfigWindow/PlaylistConfig.cpp Fri Aug 13
02:18:04 2010
+++ /trunk/quarkplayer-plugins/ConfigWindow/PlaylistConfig.cpp Tue Feb 22
16:25:52 2011
@@ -1,6 +1,6 @@
/*
* QuarkPlayer, a Phonon media player
- * Copyright (C) 2008 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,6 +36,6 @@
emit activePlaylistChanged(_uuid);
}
-QUuid PlaylistConfig::activePlaylist() const {
+const QUuid PlaylistConfig::activePlaylist() const {
return _uuid;
}
=======================================
--- /trunk/quarkplayer-plugins/ConfigWindow/PlaylistConfig.h Fri Aug 13
02:18:04 2010
+++ /trunk/quarkplayer-plugins/ConfigWindow/PlaylistConfig.h Tue Feb 22
16:25:52 2011
@@ -1,6 +1,6 @@
/*
* QuarkPlayer, a Phonon media player
- * Copyright (C) 2008 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
@@ -50,7 +50,7 @@
void setActivePlaylist(const QUuid & uuid);
/** Gets the current active playlist. */
- QUuid activePlaylist() const;
+ const QUuid activePlaylist() const;
signals:
=======================================
--- /trunk/quarkplayer-plugins/FileBrowser/FileBrowserWidget.cpp Sun Feb 20
17:34:30 2011
+++ /trunk/quarkplayer-plugins/FileBrowser/FileBrowserWidget.cpp Tue Feb 22
16:25:52 2011
@@ -284,7 +284,7 @@
}
void FileBrowserWidget::createNewFileBrowserWidget() {
-
PluginManager::instance().loadDisabledPlugin(FileBrowserWidgetFactory::PLUGIN_NAME);
+
quarkPlayer().pluginManager().loadDisabledPlugin(FileBrowserWidgetFactory::PLUGIN_NAME);
}
void FileBrowserWidget::retranslate() {
=======================================
--- /trunk/quarkplayer-plugins/MainWindow/CommonActions.cpp Mon Feb 21
09:03:06 2011
+++ /trunk/quarkplayer-plugins/MainWindow/CommonActions.cpp Tue Feb 22
16:25:52 2011
@@ -61,7 +61,7 @@
ActionCollection::addAction("CommonActions.Quit", new TkAction(app,
tr("Ctrl+Q"), tr("Alt+X")));
ActionCollection::addAction("CommonActions.ReportBug", new QAction(app));
ActionCollection::addAction("CommonActions.ShowMailingList", new
QAction(app));
- ActionCollection::addAction("CommonActions.ViewLog", new QAction(app));
+ ActionCollection::addAction("CommonActions.ShowLog", new QAction(app));
ActionCollection::addAction("CommonActions.About", new TkAction(app,
tr("Ctrl+F1")));
ActionCollection::addAction("CommonActions.AboutQt", new QAction(app));
ActionCollection::addAction("CommonActions.OpenDVD", new TkAction(app,
tr("Ctrl+D")));
@@ -153,14 +153,14 @@
ActionCollection::action("CommonActions.ShowMailingList")->setIcon(QIcon::fromTheme("help-hint"));
}
- ActionCollection::action("CommonActions.ViewLog")->setText(tr("View
&Log"));
+ ActionCollection::action("CommonActions.ShowLog")->setText(tr("View
&Log"));
QIcon logIcon;
if (desktopEnvironment() == GNOME) {
logIcon = QIcon::fromTheme("logviewer");
} else {
logIcon = QIcon::fromTheme("text-x-log");
}
- ActionCollection::action("CommonActions.ViewLog")->setIcon(logIcon);
+ ActionCollection::action("CommonActions.ShowLog")->setIcon(logIcon);
ActionCollection::action("CommonActions.About")->setText(tr("&About"));
=======================================
--- /trunk/quarkplayer-plugins/MainWindow/MainWindow.cpp Mon Feb 21
09:03:06 2011
+++ /trunk/quarkplayer-plugins/MainWindow/MainWindow.cpp Tue Feb 22
16:25:52 2011
@@ -98,10 +98,9 @@
connect(ActionCollection::action("CommonActions.Quit"),
SIGNAL(triggered()), SLOT(close()));
connect(ActionCollection::action("CommonActions.ReportBug"),
SIGNAL(triggered()), SLOT(reportBug()));
connect(ActionCollection::action("CommonActions.ShowMailingList"),
SIGNAL(triggered()), SLOT(showMailingList()));
- connect(ActionCollection::action("CommonActions.ViewLog"),
SIGNAL(triggered()), SLOT(viewLog()));
+ connect(ActionCollection::action("CommonActions.ShowLog"),
SIGNAL(triggered()), SLOT(showLog()));
connect(ActionCollection::action("CommonActions.About"),
SIGNAL(triggered()), SLOT(about()));
connect(ActionCollection::action("CommonActions.AboutQt"),
SIGNAL(triggered()), qApp, SLOT(aboutQt()));
-
connect(ActionCollection::action("CommonActions.VolumeMute"),
SIGNAL(toggled(bool)), SLOT(mutedToggled(bool)));
connect(&quarkPlayer,
SIGNAL(currentMediaObjectChanged(Phonon::MediaObject *)),
@@ -115,10 +114,6 @@
RETRANSLATE(this);
retranslate();
- //Trick: MainWindow should get the focus and be the active window
- //otherwise SearchLineEdit can get the focus instead
- app->setActiveWindow(this);
-
show();
}
@@ -250,30 +245,17 @@
QDesktopServices::openUrl(QUrl("http://groups.google.com/group/quarkplayer"));
}
-void MainWindow::viewLog() {
- static LogWindow * logWindow = NULL;
- if (!logWindow) {
- //Lazy initialization
- logWindow = new LogWindow(this);
- }
-
+void MainWindow::showLog() {
+ static LogWindow * logWindow = new LogWindow(this);
logWindow->show();
}
void MainWindow::about() {
static AboutWindow * aboutWindow = new AboutWindow(this);
aboutWindow->exec();
-
- QApplication * app = qobject_cast<QApplication
*>(QApplication::instance());
- Q_ASSERT(app);
-
- //Trick: MainWindow should get the focus and be the active window
- //otherwise SearchLineEdit can get the focus instead
- app->setActiveWindow(this);
}
void MainWindow::populateActionCollection() {
-
}
void MainWindow::setupUi() {
@@ -334,7 +316,7 @@
menuBar()->addMenu(_menuHelp);
_menuHelp->addAction(ActionCollection::action("CommonActions.ShowMailingList"));
_menuHelp->addAction(ActionCollection::action("CommonActions.ReportBug"));
- _menuHelp->addAction(ActionCollection::action("CommonActions.ViewLog"));
+ _menuHelp->addAction(ActionCollection::action("CommonActions.ShowLog"));
_menuHelp->addSeparator();
_menuHelp->addAction(ActionCollection::action("CommonActions.About"));
_menuHelp->addAction(ActionCollection::action("CommonActions.AboutQt"));
=======================================
--- /trunk/quarkplayer-plugins/MainWindow/MainWindow.h Sun Feb 20 13:15:39
2011
+++ /trunk/quarkplayer-plugins/MainWindow/MainWindow.h Tue Feb 22 16:25:52
2011
@@ -104,7 +104,7 @@
void reportBug();
void showMailingList();
- void viewLog();
+ void showLog();
void about();
=======================================
--- /trunk/quarkplayer-plugins/MainWindow/MockMainWindow.cpp Sun Feb 20
17:34:30 2011
+++ /trunk/quarkplayer-plugins/MainWindow/MockMainWindow.cpp Tue Feb 22
16:25:52 2011
@@ -19,6 +19,7 @@
#include "MockMainWindow.h"
#include "CommonActions.h"
+#include "AboutWindow.h"
#include "MainWindowLogger.h"
#include <quarkplayer/QuarkPlayer.h>
@@ -26,6 +27,8 @@
#include <quarkplayer/config/Config.h>
#include <quarkplayer/version.h>
+#include <Logger/LogWindow.h>
+
#include <TkUtil/ActionCollection.h>
#include <TkUtil/TkFileDialog.h>
@@ -53,6 +56,8 @@
connect(ActionCollection::action("CommonActions.OpenFile"),
SIGNAL(triggered()), SLOT(playFile()));
connect(ActionCollection::action("CommonActions.Quit"),
SIGNAL(triggered()), SLOT(close()));
+ connect(ActionCollection::action("CommonActions.ShowLog"),
SIGNAL(triggered()), SLOT(showLog()));
+ connect(ActionCollection::action("CommonActions.About"),
SIGNAL(triggered()), SLOT(about()));
connect(&quarkPlayer,
SIGNAL(currentMediaObjectChanged(Phonon::MediaObject *)),
SLOT(currentMediaObjectChanged(Phonon::MediaObject *)));
@@ -77,11 +82,11 @@
}
QMenu * MockMainWindow::menuFile() const {
- return NULL;
+ return _menuFile;
}
QMenu * MockMainWindow::menuPlay() const {
- return NULL;
+ return _menuPlay;
}
QMenu * MockMainWindow::menuAudio() const {
@@ -93,7 +98,7 @@
}
QMenu * MockMainWindow::menuHelp() const {
- return NULL;
+ return _menuHelp;
}
void MockMainWindow::playFile() {
@@ -110,23 +115,38 @@
quarkPlayer().play(fileName);
}
}
+
+void MockMainWindow::showLog() {
+ static LogWindow * logWindow = new LogWindow(this);
+ logWindow->show();
+}
+
+void MockMainWindow::about() {
+ static AboutWindow * aboutWindow = new AboutWindow(this);
+ aboutWindow->exec();
+}
void MockMainWindow::setupUi() {
_menuFile = new QMenu();
+ _menuFile->setTitle("&File");
menuBar()->addMenu(_menuFile);
_menuFile->addAction(ActionCollection::action("CommonActions.OpenFile"));
_menuFile->addSeparator();
_menuFile->addAction(ActionCollection::action("CommonActions.Quit"));
_menuPlay = new QMenu();
+ _menuPlay->setTitle("&Play");
menuBar()->addMenu(_menuPlay);
_menuPlay->addAction(ActionCollection::action("CommonActions.PlayPause"));
_menuPlay->addSeparator();
_menuPlay->addAction(ActionCollection::action("CommonActions.FullScreen"));
//No menu entry for FullScreenExit, see MyVideoWidget.cpp
- _menuFile->setTitle(tr("&File"));
- _menuPlay->setTitle(tr("&Play"));
+ _menuHelp = new QMenu();
+ _menuHelp->setTitle("&Help");
+ menuBar()->addMenu(_menuHelp);
+ _menuHelp->addAction(ActionCollection::action("CommonActions.ShowLog"));
+ _menuHelp->addAction(ActionCollection::action("CommonActions.About"));
}
void MockMainWindow::closeEvent(QCloseEvent * event) {
=======================================
--- /trunk/quarkplayer-plugins/MainWindow/MockMainWindow.h Tue Feb 22
03:13:10 2011
+++ /trunk/quarkplayer-plugins/MainWindow/MockMainWindow.h Tue Feb 22
16:25:52 2011
@@ -91,6 +91,10 @@
private slots:
+ void about();
+
+ void showLog();
+
void playFile();
void currentMediaObjectChanged(Phonon::MediaObject * mediaObject);
@@ -108,6 +112,7 @@
QMenu * _menuFile;
QMenu * _menuPlay;
+ QMenu * _menuHelp;
QToolBar * _playToolBar;
};
=======================================
--- /trunk/quarkplayer-plugins/Playlist/PlaylistModel.cpp Mon Oct 11
12:23:54 2010
+++ /trunk/quarkplayer-plugins/Playlist/PlaylistModel.cpp Tue Feb 22
16:25:52 2011
@@ -65,7 +65,7 @@
//String to indicates that no error occured while playing the media
static const char * PLAY_MEDIA_NOERROR = "PLAY_MEDIA_NOERROR";
-PlaylistModel::PlaylistModel(QObject * parent, QuarkPlayer & quarkPlayer,
const QUuid & uuid)
+PlaylistModel::PlaylistModel(QuarkPlayer & quarkPlayer, const QUuid &
uuid, QObject * parent)
: QAbstractListModel(parent),
_quarkPlayer(quarkPlayer) {
=======================================
--- /trunk/quarkplayer-plugins/Playlist/PlaylistModel.h Tue Sep 7 12:02:18
2010
+++ /trunk/quarkplayer-plugins/Playlist/PlaylistModel.h Tue Feb 22 16:25:52
2011
@@ -68,7 +68,7 @@
static const int COLUMN_FIRST;
static const int COLUMN_LAST;
- PlaylistModel(QObject * parent, QuarkPlayer & quarkPlayer, const QUuid &
uuid);
+ PlaylistModel(QuarkPlayer & quarkPlayer, const QUuid & uuid, QObject *
parent);
~PlaylistModel();
=======================================
--- /trunk/quarkplayer-plugins/Playlist/PlaylistWidget.cpp Mon Feb 21
09:03:06 2011
+++ /trunk/quarkplayer-plugins/Playlist/PlaylistWidget.cpp Tue Feb 22
16:25:52 2011
@@ -79,7 +79,7 @@
_mainWindow = mainWindow;
//Model
- _playlistModel = new PlaylistModel(this, quarkPlayer, uuid);
+ _playlistModel = new PlaylistModel(quarkPlayer, uuid, this);
connect(_playlistModel, SIGNAL(rowsInserted(const QModelIndex &, int,
int)),
SLOT(updateWindowTitle()));
connect(_playlistModel, SIGNAL(rowsRemoved(const QModelIndex &, int,
int)),
@@ -415,7 +415,7 @@
}
void PlaylistWidget::createNewPlaylistWidget() {
-
PluginManager::instance().loadDisabledPlugin(PlaylistWidgetFactory::PLUGIN_NAME);
+
quarkPlayer().pluginManager().loadDisabledPlugin(PlaylistWidgetFactory::PLUGIN_NAME);
}
void PlaylistWidget::jumpToCurrent() {
=======================================
--- /trunk/tests/quarkplayer-plugins/CMakeLists.txt Sun Feb 20 13:15:39 2011
+++ /trunk/tests/quarkplayer-plugins/CMakeLists.txt Tue Feb 22 16:25:52 2011
@@ -1,3 +1,4 @@
add_subdirectory(FindSubtitles)
-#add_subdirectory(MainWindow)
+add_subdirectory(MainWindow)
add_subdirectory(VideoWidget)
+add_subdirectory(Playlist)
=======================================
--- /trunk/tests/quarkplayer-plugins/VideoWidget/MyVideoWidgetTest.cpp Mon
Feb 21 09:03:06 2011
+++ /trunk/tests/quarkplayer-plugins/VideoWidget/MyVideoWidgetTest.cpp Tue
Feb 22 16:25:52 2011
@@ -24,6 +24,8 @@
#include <quarkplayer-plugins/MainWindow/MockMainWindow.h>
#include <quarkplayer-plugins/VideoWidget/MyVideoWidget.h>
+#include <Logger/Logger.h>
+
#include <phonon/mediaobject.h>
#include <QtGui/QtGui>
@@ -58,14 +60,17 @@
app.setOrganizationDomain("quarkplayer.org");
app.setApplicationName("QuarkPlayer");
- MockPluginManager * pluginManager = new MockPluginManager();
+ //Installs a custom message handler for qDebug(), qWarning() and others
+ qInstallMsgHandler(Logger::myMessageOutput);
+
+ MockPluginManager pluginManager;
QuarkPlayer quarkPlayer(pluginManager, &app);
MockMainWindow * mainWindow = new MockMainWindow(quarkPlayer,
QUuid::createUuid());
new MyVideoWidgetTest(quarkPlayer, mainWindow);
- pluginManager->loadAllPlugins(quarkPlayer);
+ pluginManager.loadAllPlugins(quarkPlayer);
return app.exec();
}