[quarkplayer] r1422 committed - Refactoring: add a mock system for PluginManager + MainWindow...

1 view
Skip to first unread message

quark...@googlecode.com

unread,
Feb 20, 2011, 4:17:50 PM2/20/11
to quarkplay...@googlegroups.com
Revision: 1422
Author: tkrotoff
Date: Sun Feb 20 13:15:39 2011
Log: Refactoring: add a mock system for PluginManager + MainWindow
Add MyVideoWidgetTest

http://code.google.com/p/quarkplayer/source/detail?r=1422

Added:
/trunk/quarkplayer/IPluginManager.h
/trunk/quarkplayer/MockPluginManager.cpp
/trunk/quarkplayer/MockPluginManager.h
/trunk/quarkplayer-plugins/MainWindow/CommonActions.cpp
/trunk/quarkplayer-plugins/MainWindow/CommonActions.h
/trunk/quarkplayer-plugins/MainWindow/IMainWindow.cpp
/trunk/quarkplayer-plugins/MainWindow/IMainWindow.h
/trunk/quarkplayer-plugins/MainWindow/MockMainWindow.cpp
/trunk/quarkplayer-plugins/MainWindow/MockMainWindow.h
/trunk/tests/quarkplayer-plugins/VideoWidget
/trunk/tests/quarkplayer-plugins/VideoWidget/CMakeLists.txt
/trunk/tests/quarkplayer-plugins/VideoWidget/MyVideoWidgetTest.cpp
/trunk/tests/quarkplayer-plugins/VideoWidget/MyVideoWidgetTest.h
Modified:
/trunk/3rdparty/phonon-mplayer/mplayer/libmplayer/MPlayerProcess.cpp
/trunk/libs/MediaInfoFetcher/MediaInfoFetcher.cpp
/trunk/quarkplayer/CMakeLists.txt
/trunk/quarkplayer/PluginInterface.cpp
/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/ConfigWindowPlugin.cpp
/trunk/quarkplayer-plugins/MainWindow/CMakeLists.txt
/trunk/quarkplayer-plugins/MainWindow/MainWindow.cpp
/trunk/quarkplayer-plugins/MainWindow/MainWindow.h
/trunk/quarkplayer-plugins/MediaController/MediaController.cpp
/trunk/quarkplayer-plugins/MediaController/MediaControllerToolBar.cpp
/trunk/quarkplayer-plugins/PlayToolBar/PlayToolBar.cpp
/trunk/quarkplayer-plugins/PlayToolBar/PlayToolBar.h
/trunk/quarkplayer-plugins/Playlist/PlaylistWidget.cpp
/trunk/quarkplayer-plugins/QuickSettings/QuickSettingsWindow.cpp
/trunk/quarkplayer-plugins/StatusBar/StatusBar.cpp
/trunk/quarkplayer-plugins/StatusBar/StatusBar.h
/trunk/quarkplayer-plugins/VideoWidget/BackgroundLogoWidget.ui
/trunk/quarkplayer-plugins/VideoWidget/MediaDataWidget.cpp
/trunk/quarkplayer-plugins/VideoWidget/MediaDataWidget.h
/trunk/quarkplayer-plugins/VideoWidget/MyVideoWidget.cpp
/trunk/quarkplayer-plugins/VideoWidget/MyVideoWidget.h
/trunk/quarkplayer-plugins/VideoWidget/VideoWidgetPlugin.cpp
/trunk/quarkplayer-plugins/VideoWidget/VideoWidgetPlugin.h
/trunk/tests/libs/Logger/CMakeLists.txt
/trunk/tests/libs/TkUtil/CMakeLists.txt
/trunk/tests/quarkplayer-plugins/CMakeLists.txt

=======================================
--- /dev/null
+++ /trunk/quarkplayer/IPluginManager.h Sun Feb 20 13:15:39 2011
@@ -0,0 +1,73 @@
+/*
+ * QuarkPlayer, a Phonon media player
+ * Copyright (C) 2010-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 IPLUGINMANAGER_H
+#define IPLUGINMANAGER_H
+
+#include <quarkplayer/QuarkPlayerExport.h>
+
+#include <QtCore/QObject>
+
+class QuarkPlayer;
+
+/**
+ * Interface for PluginManager.
+ *
+ * IoC would have been nice here
+ * This is useful for unit test
+ *
+ * @see PluginManager
+ * @author Tanguy Krotoff
+ */
+class QUARKPLAYER_API IPluginManager : public QObject {
+ Q_OBJECT
+public:
+
+ /** Loads all the available plugins. */
+ virtual void loadAllPlugins(QuarkPlayer & quarkPlayer) = 0;
+
+signals:
+
+ /**
+ * All plugins have been loaded.
+ *
+ * This signal is usefull for doing some processing after the GUI has
+ * been drew (i.e all plugins loaded since most of the plugins contain
GUIs).
+ *
+ * Typical case:
+ * the playlist plugin loads automatically current_playlist.m3u which can
+ * be huge. Instead of doing it inside the playlist plugin constructor,
+ * we do it inside a slot connected to this signal. This way, the GUI
+ * is drew very quickly.
+ *
+ * Consider using Qt::QueuedConnection when you connect to this signal,
+ * this way you won't block the signal from being sent to other slots.
+ *
+ * Qt::AutoConnection is in fact Qt::DirectConnection
+ * and Qt::DirectConnection waits for the current slot to process before
+ * to deliver the signal to other slots.
+ *
+ * So if your slot needs a lot of time to process, it is better to use
+ * Qt::QueuedConnection
+ *
+ * @see http://doc.trolltech.com/main-snapshot/qt.html#ConnectionType-enum
+ */
+ void allPluginsLoaded();
+};
+
+#endif //IPLUGINMANAGER_H
=======================================
--- /dev/null
+++ /trunk/quarkplayer/MockPluginManager.cpp Sun Feb 20 13:15:39 2011
@@ -0,0 +1,25 @@
+/*
+ * 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 "MockPluginManager.h"
+
+void MockPluginManager::loadAllPlugins(QuarkPlayer & quarkPlayer) {
+ Q_UNUSED(quarkPlayer);
+
+ emit allPluginsLoaded();
+}
=======================================
--- /dev/null
+++ /trunk/quarkplayer/MockPluginManager.h Sun Feb 20 13:15:39 2011
@@ -0,0 +1,41 @@
+/*
+ * 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 MOCKPLUGINMANAGER_H
+#define MOCKPLUGINMANAGER_H
+
+#include <quarkplayer/IPluginManager.h>
+
+class QuarkPlayer;
+
+/**
+ * Mock for IPluginManager.
+ *
+ * @see PluginManager
+ * @author Tanguy Krotoff
+ */
+class QUARKPLAYER_API MockPluginManager : public IPluginManager {
+ Q_OBJECT
+public:
+
+ void loadAllPlugins(QuarkPlayer & quarkPlayer);
+
+private:
+};
+
+#endif //MOCKPLUGINMANAGER_H
=======================================
--- /dev/null
+++ /trunk/quarkplayer-plugins/MainWindow/CommonActions.cpp Sun Feb 20
13:15:39 2011
@@ -0,0 +1,302 @@
+/*
+ * 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 "CommonActions.h"
+
+#include "MainWindowLogger.h"
+
+#include <quarkplayer/QuarkPlayer.h>
+
+#include <TkUtil/ActionCollection.h>
+#include <TkUtil/TkAction.h>
+#include <TkUtil/DesktopEnvironment.h>
+#include <TkUtil/LanguageChangeEventFilter.h>
+
+#include <phonon/mediaobject.h>
+#include <phonon/audiooutput.h>
+
+#include <QtGui/QtGui>
+
+CommonActions::CommonActions(QuarkPlayer & quarkPlayer, QObject * parent)
+ : QObject(parent),
+ _quarkPlayer(quarkPlayer) {
+
+ populateActionCollection();
+
+ if (quarkPlayer.currentMediaObject()) {
+ //The current MediaObject has been already created
+ //So to wait for the signal is useless: it was already sent long before
+ currentMediaObjectChanged(quarkPlayer.currentMediaObject());
+ }
+ connect(&quarkPlayer,
SIGNAL(currentMediaObjectChanged(Phonon::MediaObject *)),
+ SLOT(currentMediaObjectChanged(Phonon::MediaObject *)));
+
+ RETRANSLATE(this);
+ retranslate();
+}
+
+CommonActions::~CommonActions() {
+}
+
+void CommonActions::populateActionCollection() {
+ QCoreApplication * app = QApplication::instance();
+ Q_ASSERT(app);
+
+ ActionCollection::addAction("CommonActions.OpenFile", new TkAction(app,
QKeySequence::Open));
+ 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.About", new TkAction(app,
tr("Ctrl+F1")));
+ ActionCollection::addAction("CommonActions.AboutQt", new QAction(app));
+ ActionCollection::addAction("CommonActions.OpenDVD", new TkAction(app,
tr("Ctrl+D")));
+ ActionCollection::addAction("CommonActions.OpenURL", new TkAction(app,
tr("Ctrl+U")));
+ ActionCollection::addAction("CommonActions.OpenVCD", new QAction(app));
+ ActionCollection::addAction("CommonActions.NewMediaObject", new
QAction(app));
+ ActionCollection::addAction("CommonActions.Equalizer", new TkAction(app,
tr("Ctrl+E")));
+ ActionCollection::addAction("CommonActions.Configure", new QAction(app));
+ ActionCollection::addAction("CommonActions.EmptyMenu", new QAction(app));
+
+ TkAction * action = new TkAction(app, tr("Space"), Qt::Key_MediaPlay,
Qt::Key_Pause);
+ action->setShortcutContext(Qt::ApplicationShortcut);
+ ActionCollection::addAction("CommonActions.PlayPause", action);
+ action = new TkAction(app, Qt::Key_MediaStop);
+ ActionCollection::addAction("CommonActions.Stop", action);
+ action = new TkAction(app, tr("Ctrl+N"), tr(">"), Qt::Key_MediaNext);
+ action->setShortcutContext(Qt::ApplicationShortcut);
+ ActionCollection::addAction("CommonActions.NextTrack", action);
+ action = new TkAction(app, tr("Ctrl+P"), tr("<"), Qt::Key_MediaPrevious);
+ action->setShortcutContext(Qt::ApplicationShortcut);
+ ActionCollection::addAction("CommonActions.PreviousTrack", action);
+
+ action = new TkAction(app, tr("Left"));
+ action->setShortcutContext(Qt::ApplicationShortcut);
+ ActionCollection::addAction("CommonActions.JumpBackward10s", action);
+ action = new TkAction(app, tr("Ctrl+Left"));
+ action->setShortcutContext(Qt::ApplicationShortcut);
+ ActionCollection::addAction("CommonActions.JumpBackward1min", action);
+ action = new TkAction(app, tr("Shift+Left"));
+ action->setShortcutContext(Qt::ApplicationShortcut);
+ ActionCollection::addAction("CommonActions.JumpBackward10min", action);
+
+ action = new TkAction(app, tr("Right"));
+ action->setShortcutContext(Qt::ApplicationShortcut);
+ ActionCollection::addAction("CommonActions.JumpForward10s", action);
+ action = new TkAction(app, tr("Ctrl+Right"));
+ action->setShortcutContext(Qt::ApplicationShortcut);
+ ActionCollection::addAction("CommonActions.JumpForward1min", action);
+ action = new TkAction(app, tr("Shift+Right"));
+ action->setShortcutContext(Qt::ApplicationShortcut);
+ ActionCollection::addAction("CommonActions.JumpForward10min", action);
+
+ action = new TkAction(app, tr("["));
+ action->setShortcutContext(Qt::ApplicationShortcut);
+ ActionCollection::addAction("CommonActions.SpeedDecrease10%", action);
+ action = new TkAction(app, tr("]"));
+ action->setShortcutContext(Qt::ApplicationShortcut);
+ ActionCollection::addAction("CommonActions.SpeedIncrease10%", action);
+
+ action = new TkAction(app, tr("Ctrl+M"));
+ action->setShortcutContext(Qt::ApplicationShortcut);
+ action->setCheckable(true);
+ ActionCollection::addAction("CommonActions.VolumeMute", action);
+
+ action = new TkAction(app, tr("Ctrl+Down"), tr("-"), tr("Alt+-"));
+ action->setShortcutContext(Qt::ApplicationShortcut);
+ ActionCollection::addAction("CommonActions.VolumeDecrease10%", action);
+ action = new TkAction(app, tr("Ctrl+Up"), tr("+"), tr("Alt++"));
+ action->setShortcutContext(Qt::ApplicationShortcut);
+ ActionCollection::addAction("CommonActions.VolumeIncrease10%", action);
+
+ action = new TkAction(app, tr("Ctrl+F"), tr("Alt+Return"));
+ action->setShortcutContext(Qt::ApplicationShortcut);
+ action->setCheckable(true);
+ ActionCollection::addAction("CommonActions.FullScreen", action);
+
+ action = new TkAction(app, tr("Esc"));
+ ActionCollection::addAction("CommonActions.FullScreenExit", action);
+}
+
+void CommonActions::retranslate() {
+ ActionCollection::action("CommonActions.OpenFile")->setText(tr("Play
&File..."));
+
ActionCollection::action("CommonActions.OpenFile")->setIcon(QIcon::fromTheme("document-open"));
+
+ ActionCollection::action("CommonActions.Quit")->setText(tr("&Quit"));
+
ActionCollection::action("CommonActions.Quit")->setIcon(QIcon::fromTheme("application-exit"));
+
+ ActionCollection::action("CommonActions.ReportBug")->setText(tr("&Report
a Problem..."));
+ if (desktopEnvironment() == GNOME) {
+
ActionCollection::action("CommonActions.ReportBug")->setIcon(QIcon::fromTheme("apport"));
+ } else {
+
ActionCollection::action("CommonActions.ReportBug")->setIcon(QIcon::fromTheme("tools-report-bug"));
+ }
+
+
ActionCollection::action("CommonActions.ShowMailingList")->setText(tr("&Discuss
about QuarkPlayer..."));
+ if (desktopEnvironment() == GNOME) {
+
ActionCollection::action("CommonActions.ShowMailingList")->setIcon(QIcon::fromTheme("help-faq"));
+ } else {
+
ActionCollection::action("CommonActions.ShowMailingList")->setIcon(QIcon::fromTheme("help-hint"));
+ }
+
+ ActionCollection::action("CommonActions.ViewLog")->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.About")->setText(tr("&About"));
+
ActionCollection::action("CommonActions.About")->setIcon(QIcon::fromTheme("help-about"));
+
+ ActionCollection::action("CommonActions.AboutQt")->setText(tr("About
&Qt"));
+
ActionCollection::action("CommonActions.AboutQt")->setIcon(QIcon::fromTheme("help-about"));
+
+ ActionCollection::action("CommonActions.OpenDVD")->setText(tr("Play
&DVD..."));
+
ActionCollection::action("CommonActions.OpenDVD")->setIcon(QIcon::fromTheme("media-optical"));
+
+ ActionCollection::action("CommonActions.OpenURL")->setText(tr("Play
&URL..."));
+
ActionCollection::action("CommonActions.OpenURL")->setIcon(QIcon::fromTheme("document-open-remote"));
+
+ ActionCollection::action("CommonActions.OpenVCD")->setText(tr("Play
&VCD..."));
+
//ActionCollection::action("CommonActions.OpenVCD")->setIcon(QIcon::fromTheme("media-optical"));
+
+ ActionCollection::action("CommonActions.NewMediaObject")->setText(tr("New
Media Window"));
+
ActionCollection::action("CommonActions.NewMediaObject")->setIcon(QIcon::fromTheme("tab-new"));
+
+
ActionCollection::action("CommonActions.Equalizer")->setText(tr("&Equalizer..."));
+
ActionCollection::action("CommonActions.Equalizer")->setIcon(QIcon::fromTheme("view-media-equalizer"));
+
+
ActionCollection::action("CommonActions.Configure")->setText(tr("&Configure..."));
+
ActionCollection::action("CommonActions.Configure")->setIcon(QIcon::fromTheme("preferences-system"));
+
+
ActionCollection::action("CommonActions.EmptyMenu")->setText(tr("<empty>"));
+ ActionCollection::action("CommonActions.EmptyMenu")->setEnabled(false);
+
+
ActionCollection::action("CommonActions.PreviousTrack")->setText(tr("P&revious
Track"));
+
ActionCollection::action("CommonActions.PreviousTrack")->setIcon(QIcon::fromTheme("media-skip-backward"));
+
+
ActionCollection::action("CommonActions.PlayPause")->setText(tr("&Play/Pause"));
+
ActionCollection::action("CommonActions.PlayPause")->setIcon(QIcon::fromTheme("media-playback-start"));
+
+ ActionCollection::action("CommonActions.Stop")->setText(tr("&Stop"));
+
ActionCollection::action("CommonActions.Stop")->setIcon(QIcon::fromTheme("media-playback-stop"));
+
+ ActionCollection::action("CommonActions.NextTrack")->setText(tr("&Next
Track"));
+
ActionCollection::action("CommonActions.NextTrack")->setIcon(QIcon::fromTheme("media-skip-forward"));
+
+
ActionCollection::action("CommonActions.JumpBackward10s")->setText(tr("Jump
&Backward 10s"));
+
ActionCollection::action("CommonActions.JumpBackward10s")->setIcon(QIcon::fromTheme("media-seek-backward"));
+
ActionCollection::action("CommonActions.JumpBackward1min")->setText(tr("Jump
&Backward 1min"));
+
ActionCollection::action("CommonActions.JumpBackward1min")->setIcon(QIcon::fromTheme("media-seek-backward"));
+
ActionCollection::action("CommonActions.JumpBackward10min")->setText(tr("Jump
&Backward 10min"));
+
ActionCollection::action("CommonActions.JumpBackward10min")->setIcon(QIcon::fromTheme("media-seek-backward"));
+
ActionCollection::action("CommonActions.JumpForward10s")->setText(tr("Jump
&Forward 10s"));
+
ActionCollection::action("CommonActions.JumpForward10s")->setIcon(QIcon::fromTheme("media-seek-forward"));
+
ActionCollection::action("CommonActions.JumpForward1min")->setText(tr("Jump
&Forward 1min"));
+
ActionCollection::action("CommonActions.JumpForward1min")->setIcon(QIcon::fromTheme("media-seek-forward"));
+
ActionCollection::action("CommonActions.JumpForward10min")->setText(tr("Jump
&Forward 10min"));
+
ActionCollection::action("CommonActions.JumpForward10min")->setIcon(QIcon::fromTheme("media-seek-forward"));
+
ActionCollection::action("CommonActions.SpeedDecrease10%")->setText(tr("Decrease
Speed"));
+
ActionCollection::action("CommonActions.SpeedDecrease10%")->setIcon(QIcon::fromTheme("media-seek-backward"));
+
ActionCollection::action("CommonActions.SpeedIncrease10%")->setText(tr("Increase
Speed"));
+
ActionCollection::action("CommonActions.SpeedIncrease10%")->setIcon(QIcon::fromTheme("media-seek-forward"));
+
+
ActionCollection::action("CommonActions.VolumeMute")->setText(tr("&Mute"));
+
ActionCollection::action("CommonActions.VolumeMute")->setIcon(QIcon::fromTheme("audio-volume-muted"));
+
ActionCollection::action("CommonActions.VolumeDecrease10%")->setText(tr("&Decrease
Volume"));
+
ActionCollection::action("CommonActions.VolumeDecrease10%")->setIcon(QIcon::fromTheme("audio-volume-low"));
+
ActionCollection::action("CommonActions.VolumeIncrease10%")->setText(tr("&Increase
Volume"));
+
ActionCollection::action("CommonActions.VolumeIncrease10%")->setIcon(QIcon::fromTheme("audio-volume-high"));
+
+
ActionCollection::action("CommonActions.FullScreen")->setText(tr("&Fullscreen"));
+
ActionCollection::action("CommonActions.FullScreen")->setIcon(QIcon::fromTheme("view-fullscreen"));
+
+
ActionCollection::action("CommonActions.FullScreenExit")->setText(tr("&Exit
Fullscreen"));
+}
+
+void CommonActions::stateChanged(Phonon::State newState) {
+ //Enabled/disabled fullscreen button depending if media is a video or
audio
+ if (_quarkPlayer.currentMediaObject()->hasVideo()) {
+ ActionCollection::action("CommonActions.FullScreen")->setEnabled(true);
+ } else {
+ ActionCollection::action("CommonActions.FullScreen")->setEnabled(false);
+ }
+
+ switch (newState) {
+ case Phonon::ErrorState:
+ break;
+
+ case Phonon::PlayingState:
+
ActionCollection::action("CommonActions.PlayPause")->setText(tr("&Pause"));
+
ActionCollection::action("CommonActions.PlayPause")->setIcon(QIcon::fromTheme("media-playback-pause"));
+ disconnect(ActionCollection::action("CommonActions.PlayPause"), 0, 0, 0);
+ connect(ActionCollection::action("CommonActions.PlayPause"),
SIGNAL(triggered()),
+ _quarkPlayer.currentMediaObject(), SLOT(pause()));
+
+ ActionCollection::action("CommonActions.Stop")->setEnabled(true);
+ break;
+
+ case Phonon::StoppedState:
+
ActionCollection::action("CommonActions.PlayPause")->setText(tr("P&lay"));
+
ActionCollection::action("CommonActions.PlayPause")->setIcon(QIcon::fromTheme("media-playback-start"));
+ disconnect(ActionCollection::action("CommonActions.PlayPause"), 0, 0, 0);
+ connect(ActionCollection::action("CommonActions.PlayPause"),
SIGNAL(triggered()),
+ _quarkPlayer.currentMediaObject(), SLOT(play()));
+
+ ActionCollection::action("CommonActions.Stop")->setEnabled(false);
+ break;
+
+ case Phonon::PausedState:
+
ActionCollection::action("CommonActions.PlayPause")->setText(tr("P&lay"));
+
ActionCollection::action("CommonActions.PlayPause")->setIcon(QIcon::fromTheme("media-playback-start"));
+ disconnect(ActionCollection::action("CommonActions.PlayPause"), 0, 0, 0);
+ connect(ActionCollection::action("CommonActions.PlayPause"),
SIGNAL(triggered()),
+ _quarkPlayer.currentMediaObject(), SLOT(play()));
+
+ ActionCollection::action("CommonActions.Stop")->setEnabled(true);
+ break;
+
+ case Phonon::LoadingState:
+ break;
+
+ case Phonon::BufferingState:
+ break;
+
+ default:
+ MainWindowCritical() << "Unknown state:" << newState;
+ }
+}
+
+void CommonActions::currentMediaObjectChanged(Phonon::MediaObject *
mediaObject) {
+ foreach (Phonon::MediaObject * tmp, _quarkPlayer.mediaObjectList()) {
+ tmp->disconnect(this);
+ }
+
+ connect(mediaObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)),
+ SLOT(stateChanged(Phonon::State)));
+
+ //Update current MediaObject state
+ stateChanged(mediaObject->state());
+
+ //Actions connect
+ disconnect(ActionCollection::action("CommonActions.Stop"), 0, 0, 0);
+ connect(ActionCollection::action("CommonActions.Stop"),
SIGNAL(triggered()),
+ mediaObject, SLOT(stop()));
+}
=======================================
--- /dev/null
+++ /trunk/quarkplayer-plugins/MainWindow/CommonActions.h Sun Feb 20
13:15:39 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/>.
+ */
+
+#ifndef COMMONACTIONS_H
+#define COMMONACTIONS_H
+
+#include <quarkplayer-plugins/MainWindow/MainWindowExport.h>
+
+#include <QtCore/QObject>
+
+#include <phonon/phononnamespace.h>
+
+class QuarkPlayer;
+
+namespace Phonon {
+ class MediaObject;
+ class AudioOutput;
+}
+
+/**
+ * Common QActions.
+ *
+ * @author Tanguy Krotoff
+ */
+class MAINWINDOW_API CommonActions : public QObject {
+ Q_OBJECT
+public:
+
+ CommonActions(QuarkPlayer & quarkPlayer, QObject * parent);
+
+ ~CommonActions();
+
+private slots:
+
+ void stateChanged(Phonon::State newState);
+
+ void retranslate();
+
+ void currentMediaObjectChanged(Phonon::MediaObject * mediaObject);
+
+private:
+
+ void populateActionCollection();
+
+ QuarkPlayer & _quarkPlayer;
+};
+
+#endif //COMMONACTIONS_H
=======================================
--- /dev/null
+++ /trunk/quarkplayer-plugins/MainWindow/IMainWindow.cpp Sun Feb 20
13:15:39 2011
@@ -0,0 +1,27 @@
+/*
+ * 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 "IMainWindow.h"
+
+IMainWindow::IMainWindow(QuarkPlayer & quarkPlayer, const QUuid & uuid)
+ : TkMainWindow(NULL),
+ PluginInterface(quarkPlayer, uuid) {
+}
+
+IMainWindow::~IMainWindow() {
+}
=======================================
--- /dev/null
+++ /trunk/quarkplayer-plugins/MainWindow/IMainWindow.h Sun Feb 20 13:15:39
2011
@@ -0,0 +1,72 @@
+/*
+ * 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 IMAINWINDOW_H
+#define IMAINWINDOW_H
+
+#include <quarkplayer-plugins/MainWindow/MainWindowExport.h>
+
+#include <quarkplayer/PluginInterface.h>
+
+#include <TkUtil/TkMainWindow.h>
+
+class QDockWidget;
+
+/**
+ * Interface for MainWindowQuarkPlayer main window.
+ *
+ * Facade pattern.
+ *
+ * @see QMainWindow
+ * @author Tanguy Krotoff
+ */
+class MAINWINDOW_API IMainWindow : public TkMainWindow, public
PluginInterface {
+ Q_OBJECT
+public:
+
+ IMainWindow(QuarkPlayer & quarkPlayer, const QUuid & uuid);
+
+ virtual ~IMainWindow();
+
+ virtual void setPlayToolBar(QToolBar * playToolBar) = 0;
+ virtual QToolBar * playToolBar() const = 0;
+
+ virtual void addBrowserDockWidget(QDockWidget * dockWidget) = 0;
+ virtual void resetBrowserDockWidget() = 0;
+
+ virtual void addVideoDockWidget(QDockWidget * dockWidget) = 0;
+ virtual void resetVideoDockWidget() = 0;
+
+ virtual void addPlaylistDockWidget(QDockWidget * dockWidget) = 0;
+ virtual void resetPlaylistDockWidget() = 0;
+
+signals:
+
+ /**
+ * The play toolbar has been added to the main window.
+ *
+ * Specific to the PlayToolBar plugin.
+ *
+ * @see setPlayToolBar()
+ * @see PlayToolBar
+ * @param playToolBar main window play toolbar (cannot be NULL or there
is a bug...)
+ */
+ void playToolBarAdded(QToolBar * playToolBar);
+};
+
+#endif //IMAINWINDOW_H
=======================================
--- /dev/null
+++ /trunk/quarkplayer-plugins/MainWindow/MockMainWindow.cpp Sun Feb 20
13:15:39 2011
@@ -0,0 +1,177 @@
+/*
+ * 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 "MockMainWindow.h"
+
+#include "CommonActions.h"
+#include "MainWindowLogger.h"
+
+#include <quarkplayer/QuarkPlayer.h>
+#include <quarkplayer/PluginManager.h>
+#include <quarkplayer/config/Config.h>
+#include <quarkplayer/version.h>
+
+#include <TkUtil/ActionCollection.h>
+#include <TkUtil/TkFileDialog.h>
+
+#include <FileTypes/FileTypes.h>
+
+#include <QtSingleApplication>
+
+#include <phonon/mediaobject.h>
+#include <phonon/mediasource.h>
+#include <phonon/audiooutput.h>
+
+#include <QtGui/QtGui>
+
+MockMainWindow::MockMainWindow(QuarkPlayer & quarkPlayer, const QUuid &
uuid)
+ : IMainWindow(quarkPlayer, uuid) {
+
+ new CommonActions(quarkPlayer, this);
+
+ setupUi();
+
+ //DockWidgets tabs are vertical like in Amarok
+ setDockOptions(QMainWindow::VerticalTabs);
+
+ _playToolBar = NULL;
+
+ connect(ActionCollection::action("CommonActions.OpenFile"),
SIGNAL(triggered()), SLOT(playFile()));
+ connect(ActionCollection::action("CommonActions.Quit"),
SIGNAL(triggered()), SLOT(close()));
+
+ connect(&quarkPlayer,
SIGNAL(currentMediaObjectChanged(Phonon::MediaObject *)),
+ SLOT(currentMediaObjectChanged(Phonon::MediaObject *)));
+
+ show();
+}
+
+MockMainWindow::~MockMainWindow() {
+ //If the MainWindow is destroyed, it's reasonable to say
+ //that we can quit the entire application
+ QCoreApplication::quit();
+}
+
+void MockMainWindow::setPlayToolBar(QToolBar * playToolBar) {
+ _playToolBar = playToolBar;
+ addToolBar(Qt::BottomToolBarArea, playToolBar);
+ emit playToolBarAdded(_playToolBar);
+}
+
+QToolBar * MockMainWindow::playToolBar() const {
+ return _playToolBar;
+}
+
+void MockMainWindow::playFile() {
+ QString fileName = TkFileDialog::getOpenFileName(
+ this, tr("Select Audio/Video File"), Config::instance().lastDirOpened(),
+ tr("Multimedia") +
FileTypes::toFilterFormat(FileTypes::extensions(FileType::Video,
FileType::Audio)) + ";;" +
+ tr("Video") +
FileTypes::toFilterFormat(FileTypes::extensions(FileType::Video)) +";;" +
+ tr("Audio") +
FileTypes::toFilterFormat(FileTypes::extensions(FileType::Audio)) +";;" +
+ tr("Playlist") +
FileTypes::toFilterFormat(FileTypes::extensions(FileType::Playlist)) + ";;"
+
+ tr("All Files") + " (*)"
+ );
+
+ if (!fileName.isEmpty()) {
+ quarkPlayer().play(fileName);
+ }
+}
+
+void MockMainWindow::setupUi() {
+ _menuFile = new QMenu();
+ menuBar()->addMenu(_menuFile);
+ _menuFile->addAction(ActionCollection::action("CommonActions.OpenFile"));
+ _menuFile->addSeparator();
+ _menuFile->addAction(ActionCollection::action("CommonActions.Quit"));
+
+ _menuPlay = new QMenu();
+ 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"));
+}
+
+void MockMainWindow::closeEvent(QCloseEvent * event) {
+ TkMainWindow::closeEvent(event);
+
+ event->accept();
+
+ //Quits the application
+ //QCoreApplication::quit();
+
+ //FIXME we should only use QCoreApplication::quit()
+ //exit(EXIT_SUCCESS);
+}
+
+void MockMainWindow::addDockWidget(Qt::DockWidgetArea area, QDockWidget *
lastDockWidget, QDockWidget * dockWidget) {
+ if (dockWidget) {
+ //dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
+ //dockWidget->setFloating(false);
+
+ //To hide the title bar completely
+ //we must replace the default widget with a generic one
+ dockWidget->setTitleBarWidget(new QWidget(this));
+
+ QMainWindow::addDockWidget(area, dockWidget);
+ if (lastDockWidget) {
+ tabifyDockWidget(lastDockWidget, dockWidget);
+ }
+ }
+}
+
+void MockMainWindow::addBrowserDockWidget(QDockWidget * dockWidget) {
+ static QDockWidget * lastDockWidget = NULL;
+ addDockWidget(Qt::LeftDockWidgetArea, lastDockWidget, dockWidget);
+ lastDockWidget = dockWidget;
+}
+
+void MockMainWindow::resetBrowserDockWidget() {
+ addBrowserDockWidget(NULL);
+}
+
+void MockMainWindow::addVideoDockWidget(QDockWidget * dockWidget) {
+ static QDockWidget * lastDockWidget = NULL;
+ addDockWidget(Qt::RightDockWidgetArea, lastDockWidget, dockWidget);
+ lastDockWidget = dockWidget;
+}
+
+void MockMainWindow::resetVideoDockWidget() {
+ addVideoDockWidget(NULL);
+}
+
+void MockMainWindow::addPlaylistDockWidget(QDockWidget * dockWidget) {
+ static QDockWidget * lastDockWidget = NULL;
+ addDockWidget(Qt::RightDockWidgetArea, lastDockWidget, dockWidget);
+ lastDockWidget = dockWidget;
+}
+
+void MockMainWindow::resetPlaylistDockWidget() {
+ addPlaylistDockWidget(NULL);
+}
+
+void MockMainWindow::currentMediaObjectChanged(Phonon::MediaObject *
mediaObject) {
+ foreach (Phonon::MediaObject * tmp, quarkPlayer().mediaObjectList()) {
+ tmp->disconnect(this);
+ }
+
+ disconnect(ActionCollection::action("CommonActions.Quit"),
SIGNAL(triggered()), mediaObject, SLOT(stop()));
+ connect(ActionCollection::action("CommonActions.Quit"),
SIGNAL(triggered()), mediaObject, SLOT(stop()));
+}
=======================================
--- /dev/null
+++ /trunk/quarkplayer-plugins/MainWindow/MockMainWindow.h Sun Feb 20
13:15:39 2011
@@ -0,0 +1,110 @@
+/*
+ * 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 MOCKMAINWINDOW_H
+#define MOCKMAINWINDOW_H
+
+#include <quarkplayer-plugins/MainWindow/IMainWindow.h>
+
+#include <QtGui/QMainWindow>
+#include <QtGui/QToolBar>
+
+class QuarkPlayer;
+
+namespace Phonon {
+ class MediaSource;
+ class MediaObject;
+}
+
+class QDockWidget;
+
+/**
+ * QuarkPlayer main window.
+ *
+ * Facade pattern.
+ *
+ * @see QMainWindow
+ * @see QuarkPlayer
+ * @see http://en.wikipedia.org/wiki/Facade_pattern
+ * @author Tanguy Krotoff
+ */
+class MAINWINDOW_API MockMainWindow : public IMainWindow {
+ Q_OBJECT
+public:
+
+ MockMainWindow(QuarkPlayer & quarkPlayer, const QUuid & uuid);
+
+ ~MockMainWindow();
+
+ void setPlayToolBar(QToolBar * playToolBar);
+ QToolBar * playToolBar() const;
+
+ void addBrowserDockWidget(QDockWidget * dockWidget);
+ void resetBrowserDockWidget();
+
+ void addVideoDockWidget(QDockWidget * dockWidget);
+ void resetVideoDockWidget();
+
+ void addPlaylistDockWidget(QDockWidget * dockWidget);
+ void resetPlaylistDockWidget();
+
+signals:
+
+ /**
+ * The play toolbar has been added to the main window.
+ *
+ * Specific to the PlayToolBar plugin.
+ *
+ * @see setPlayToolBar()
+ * @see PlayToolBar
+ * @param playToolBar main window play toolbar (cannot be NULL or there
is a bug...)
+ */
+ void playToolBarAdded(QToolBar * playToolBar);
+
+ /**
+ * The status bar has been added to the main window.
+ *
+ * @param statusBar main window status bar (cannot be NULL or there is a
bug...)
+ * @see setStatusBar()
+ */
+ void statusBarAdded(QStatusBar * statusBar);
+
+private slots:
+
+ void playFile();
+
+ void currentMediaObjectChanged(Phonon::MediaObject * mediaObject);
+
+private:
+
+ void populateActionCollection();
+
+ void setupUi();
+
+ /** Internal factorization code. */
+ void addDockWidget(Qt::DockWidgetArea area, QDockWidget * lastDockWidget,
QDockWidget * dockWidget);
+
+ void closeEvent(QCloseEvent * event);
+
+ QMenu * _menuFile;
+ QMenu * _menuPlay;
+
+ QToolBar * _playToolBar;
+};
+
+#endif //MOCKMAINWINDOW_H
=======================================
--- /dev/null
+++ /trunk/tests/quarkplayer-plugins/VideoWidget/CMakeLists.txt Sun Feb 20
13:15:39 2011
@@ -0,0 +1,23 @@
+project(VideoWidgetTests)
+
+macro(add_my_test name)
+ set(SRCS ${ARGN})
+
+ add_executable(${name} ${SRCS})
+
+ add_test(${name} ${name})
+
+ target_link_libraries(${name}
+ VideoWidget
+ PlayToolBar
+
+ ${QT_QTGUI_LIBRARY}
+ ${QT_QTTEST_LIBRARY}
+ )
+ install(TARGETS ${name} ${INSTALL_TARGETS_DEFAULT_ARGS})
+endmacro(add_my_test name)
+
+
+set(MyVideoWidgetTest_SRCS MyVideoWidgetTest.cpp)
+qt4_wrap_cpp(MyVideoWidgetTest_SRCS MyVideoWidgetTest.h)
+add_my_test(MyVideoWidgetTest ${MyVideoWidgetTest_SRCS})
=======================================
--- /dev/null
+++ /trunk/tests/quarkplayer-plugins/VideoWidget/MyVideoWidgetTest.cpp Sun
Feb 20 13:15:39 2011
@@ -0,0 +1,73 @@
+/*
+ * QuarkPlayer, a Phonon media player
+ * 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
+ * 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 "MyVideoWidgetTest.h"
+
+#include <quarkplayer/QuarkPlayer.h>
+#include <quarkplayer/MockPluginManager.h>
+
+#include <quarkplayer-plugins/MainWindow/MockMainWindow.h>
+#include <quarkplayer-plugins/VideoWidget/VideoWidgetPlugin.h>
+#include <quarkplayer-plugins/VideoWidget/MyVideoWidget.h>
+#include <quarkplayer-plugins/PlayToolBar/PlayToolBar.h>
+
+#include <phonon/mediaobject.h>
+
+#include <QtGui/QtGui>
+
+MyVideoWidgetTest::MyVideoWidgetTest(QuarkPlayer & quarkPlayer,
IMainWindow * mainWindow) {
+ _mainWindow = mainWindow;
+
+ connect(&quarkPlayer, SIGNAL(mediaObjectAdded(Phonon::MediaObject *)),
+ SLOT(mediaObjectAdded(Phonon::MediaObject *)));
+}
+
+MyVideoWidgetTest::~MyVideoWidgetTest() {
+}
+
+void MyVideoWidgetTest::mediaObjectAdded(Phonon::MediaObject *
mediaObject) {
+ QDockWidget * videoDockWidget = new QDockWidget();
+
+ //videoWidget
+ MyVideoWidget * videoWidget = new MyVideoWidget(videoDockWidget,
_mainWindow);
+ videoDockWidget->setWidget(videoWidget);
+ Phonon::createPath(mediaObject, videoWidget);
+
+ //Add to the main window
+ _mainWindow->addVideoDockWidget(videoDockWidget);
+}
+
+int main(int argc, char * argv[]) {
+ QApplication app(argc, argv);
+
+ //General infos
+ app.setOrganizationName("QuarkPlayer");
+ app.setOrganizationDomain("quarkplayer.org");
+ app.setApplicationName("QuarkPlayer");
+
+ MockPluginManager * pluginManager = new MockPluginManager();
+ QuarkPlayer quarkPlayer(pluginManager, &app);
+
+ MockMainWindow * mainWindow = new MockMainWindow(quarkPlayer,
QUuid::createUuid());
+
+ new MyVideoWidgetTest(quarkPlayer, mainWindow);
+
+ pluginManager->loadAllPlugins(quarkPlayer);
+
+ return app.exec();
+}
=======================================
--- /dev/null
+++ /trunk/tests/quarkplayer-plugins/VideoWidget/MyVideoWidgetTest.h Sun
Feb 20 13:15:39 2011
@@ -0,0 +1,54 @@
+/*
+ * QuarkPlayer, a Phonon media player
+ * 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
+ * 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 MYVIDEOWIDGETTEST_H
+#define MYVIDEOWIDGETTEST_H
+
+#include <QtCore/QObject>
+
+namespace Phonon {
+ class MediaObject;
+}
+
+class QuarkPlayer;
+class IMainWindow;
+
+/**
+ * Test class for MyVideoWidget.
+ *
+ * @see MyVideoWidget
+ * @author Tanguy Krotoff
+ */
+class MyVideoWidgetTest : public QObject {
+ Q_OBJECT
+public:
+
+ MyVideoWidgetTest(QuarkPlayer & quarkPlayer, IMainWindow * mainWindow);
+
+ ~MyVideoWidgetTest();
+
+private slots:
+
+ void mediaObjectAdded(Phonon::MediaObject * mediaObject);
+
+private:
+
+ IMainWindow * _mainWindow;
+};
+
+#endif //MYVIDEOWIDGETTEST_H
=======================================
--- /trunk/3rdparty/phonon-mplayer/mplayer/libmplayer/MPlayerProcess.cpp
Thu Feb 10 11:24:55 2011
+++ /trunk/3rdparty/phonon-mplayer/mplayer/libmplayer/MPlayerProcess.cpp
Sun Feb 20 13:15:39 2011
@@ -916,7 +916,7 @@
//"Starting playback..." message
/*else if (rx_play.indexIn(line) > -1) {
//OK, now all the media datas should be in clean state
- //Second time we emit mediaLoaded(), this one is usefull for DVD with
angles/chapters/subtitles...
+ //Second time we emit mediaLoaded(), this one is useful for DVD with
angles/chapters/subtitles...
//This must be changed, see MediaObject::mediaLoaded()
emit mediaLoaded();
emit mediaDataChanged(_mediaData);
=======================================
--- /trunk/libs/MediaInfoFetcher/MediaInfoFetcher.cpp Fri Aug 13 02:18:04
2010
+++ /trunk/libs/MediaInfoFetcher/MediaInfoFetcher.cpp Sun Feb 20 13:15:39
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
@@ -472,7 +472,7 @@
//TODO check for errors
mediaInfo.Open(_mediaInfo.fileName().toStdWString());

- //Info_Parameters: gets all usefull MediaInfoLib parameters names
+ //Info_Parameters: gets all useful MediaInfoLib parameters names
//mediaInfo.Option(_T("Info_Parameters"));
//mediaInfo.Option(_T("Complete"), _T("1"));
//MediaInfoFetcherDebug() << QString::fromStdWString(mediaInfo.Inform());
=======================================
--- /trunk/quarkplayer/CMakeLists.txt Mon Sep 13 08:00:40 2010
+++ /trunk/quarkplayer/CMakeLists.txt Sun Feb 20 13:15:39 2011
@@ -35,6 +35,7 @@
PluginData.cpp
PluginManager.cpp
PluginManager_win32.cpp
+ MockPluginManager.cpp
PluginConfig.cpp
CommandLineManager.cpp
CommandLineParser.cpp
@@ -46,7 +47,9 @@

qt4_wrap_cpp(QuarkPlayerCore_SRCS
QuarkPlayer.h
+ IPluginManager.h
PluginManager.h
+ MockPluginManager.h
CommandLineManager.h
CommandLineParser.h
Languages.h
=======================================
--- /trunk/quarkplayer/PluginInterface.cpp Fri Aug 13 02:18:04 2010
+++ /trunk/quarkplayer/PluginInterface.cpp Sun Feb 20 13:15:39 2011
@@ -26,8 +26,8 @@
PluginInterface::PluginInterface(QuarkPlayer & quarkPlayer, const QUuid &
uuid)
: _quarkPlayer(quarkPlayer) {

+ Q_ASSERT(!uuid.isNull());
_uuid = uuid;
- Q_ASSERT(!_uuid.isNull());
}

PluginInterface::~PluginInterface() {
@@ -38,7 +38,6 @@
}

QUuid PluginInterface::uuid() const {
- Q_ASSERT(!_uuid.isNull());
return _uuid;
}

=======================================
--- /trunk/quarkplayer/PluginManager.cpp Fri Aug 13 02:18:04 2010
+++ /trunk/quarkplayer/PluginManager.cpp Sun Feb 20 13:15:39 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
@@ -37,8 +37,8 @@
}

PluginManager::~PluginManager() {
- //Saves the plugin list
- PluginConfig::instance().setPlugins(availablePlugins());
+ //This can crash because of the singletons
+ //savePluginConfig();

deleteAllPlugins();
}
@@ -47,6 +47,10 @@
static PluginManager instance;
return instance;
}
+
+void PluginManager::savePluginConfig() {
+ PluginConfig::instance().setPlugins(availablePlugins());
+}

QString PluginManager::findPluginDir() const {
QStringList pluginDirList(Config::instance().pluginDirList());
@@ -171,6 +175,9 @@
}

_allPluginsLoaded = true;
+
+ savePluginConfig();
+
emit allPluginsLoaded();
}

@@ -347,6 +354,11 @@
//Wait for the plugin to be completely loaded graphically
//QCoreApplication::processEvents();

+ if (_allPluginsLoaded) {
+ //Update and saves the plugins configuration
+ savePluginConfig();
+ }
+
return loaded;
}

@@ -364,7 +376,7 @@
bool ret = deletePluginWithoutSavingConfig(pluginData);
if (ret) {
//Update and saves the plugins configuration
- PluginConfig::instance().setPlugins(availablePlugins());
+ savePluginConfig();
}
return ret;
}
=======================================
--- /trunk/quarkplayer/PluginManager.h Fri Aug 13 02:18:04 2010
+++ /trunk/quarkplayer/PluginManager.h Sun Feb 20 13:15:39 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
@@ -19,12 +19,11 @@
#ifndef PLUGINMANAGER_H
#define PLUGINMANAGER_H

-#include <quarkplayer/QuarkPlayerExport.h>
+#include <quarkplayer/IPluginManager.h>
#include <quarkplayer/PluginData.h>

#include <TkUtil/Singleton.h>

-#include <QtCore/QObject>
#include <QtCore/QStringList>

class QuarkPlayer;
@@ -37,14 +36,13 @@
* @see QPluginLoader
* @author Tanguy Krotoff
*/
-class QUARKPLAYER_API PluginManager : public QObject, public Singleton {
+class QUARKPLAYER_API PluginManager : public IPluginManager, public
Singleton {
Q_OBJECT
public:

/** Singleton. */
static PluginManager & instance();

- /** Loads all the available plugins. */
void loadAllPlugins(QuarkPlayer & quarkPlayer);

/** Loads a given plugin. */
@@ -91,34 +89,6 @@
*/
bool allPluginsAlreadyLoaded() const;

-signals:
-
- /**
- * All plugins have been loaded.
- *
- * This signal is usefull for doing some processing after the GUI has
- * been drew (i.e all plugins loaded since most of the plugins contain
GUIs).
- *
- * Typical case:
- * the playlist plugin loads automatically current_playlist.m3u which can
- * be huge. Instead of doing it inside the playlist plugin constructor,
- * we do it inside a slot connected to this signal. This way, the GUI
- * is drew very quickly.
- *
- * Consider using Qt::QueuedConnection when you connect to this signal,
- * this way you won't block the signal from being sent to other slots.
- *
- * Qt::AutoConnection is in fact Qt::DirectConnection
- * and Qt::DirectConnection waits for the current slot to process before
- * to deliver the signal to other slots.
- *
- * So if you're slot needs a lot of time to process, it is better to use
- * Qt::QueuedConnection
- *
- * @see http://doc.trolltech.com/main-snapshot/qt.html#ConnectionType-enum
- */
- void allPluginsLoaded();
-
private:

PluginManager();
@@ -126,6 +96,9 @@
/** @see deleteAllPlugins() */
~PluginManager();

+ /** Saves the plugins configuration. */
+ void savePluginConfig();
+
/**
* Deletes all the available plugins.
*
=======================================
--- /trunk/quarkplayer/QuarkPlayer.cpp Fri Aug 13 02:18:04 2010
+++ /trunk/quarkplayer/QuarkPlayer.cpp Sun Feb 20 13:15:39 2011
@@ -18,7 +18,7 @@

#include "QuarkPlayer.h"

-#include "PluginManager.h"
+#include "IPluginManager.h"
#include "QuarkPlayerCoreLogger.h"
#include "config/Config.h"

@@ -31,13 +31,13 @@
#include <QtCore/QRegExp>
#include <QtCore/QFileInfo>

-QuarkPlayer::QuarkPlayer(QObject * parent)
+QuarkPlayer::QuarkPlayer(IPluginManager * pluginManager, QObject * parent)
: QObject(parent) {

_currentMediaObject = NULL;
_currentMediaController = NULL;

- connect(&PluginManager::instance(), SIGNAL(allPluginsLoaded()),
SLOT(allPluginsLoaded()));
+ connect(pluginManager, SIGNAL(allPluginsLoaded()),
SLOT(allPluginsLoaded()));
}

QuarkPlayer::~QuarkPlayer() {
=======================================
--- /trunk/quarkplayer/QuarkPlayer.h Fri Aug 13 02:18:04 2010
+++ /trunk/quarkplayer/QuarkPlayer.h Sun Feb 20 13:15:39 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
@@ -27,6 +27,7 @@
#include <phonon/phononnamespace.h>
#include <phonon/path.h>

+class IPluginManager;
class Config;

namespace Phonon {
@@ -60,10 +61,11 @@
*
* This is called only once inside main.cpp
*
+ * @param pluginManager plugin manager interface
* @param parent QuarkPlayer QObject parent, should be QCoreApplication
* @see main.cpp
*/
- QuarkPlayer(QObject * parent);
+ QuarkPlayer(IPluginManager * pluginManager, QObject * parent);

~QuarkPlayer();

=======================================
--- /trunk/quarkplayer-app/main.cpp Sun Jan 23 14:47:36 2011
+++ /trunk/quarkplayer-app/main.cpp Sun Feb 20 13:15:39 2011
@@ -132,7 +132,7 @@
//Parse the command line arguments
CommandLineParser parser;

- QuarkPlayer quarkPlayer(&app);
+ QuarkPlayer quarkPlayer(&PluginManager::instance(), &app);

PluginManager::instance().loadAllPlugins(quarkPlayer);

=======================================
--- /trunk/quarkplayer-plugins/ConfigWindow/ConfigWindowPlugin.cpp Wed Aug
25 15:38:42 2010
+++ /trunk/quarkplayer-plugins/ConfigWindow/ConfigWindowPlugin.cpp Sun Feb
20 13:15:39 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
@@ -57,7 +57,7 @@

_configWindow = NULL;

- connect(ActionCollection::action("MainWindow.Configure"),
SIGNAL(triggered()),
+ connect(ActionCollection::action("CommonActions.Configure"),
SIGNAL(triggered()),
SLOT(showConfigWindow()));
}

=======================================
--- /trunk/quarkplayer-plugins/MainWindow/CMakeLists.txt Mon Oct 11
12:22:42 2010
+++ /trunk/quarkplayer-plugins/MainWindow/CMakeLists.txt Sun Feb 20
13:15:39 2011
@@ -23,8 +23,12 @@
remove_definitions(-DQT_NO_STL)

set(MainWindow_SRCS
+ IMainWindow.cpp
MainWindow.cpp
+ MockMainWindow.cpp
AboutWindow.cpp
+
+ CommonActions.cpp
)

if (MSVC)
@@ -45,7 +49,11 @@
endif (MSVC)

qt4_wrap_cpp(MainWindow_SRCS
+ IMainWindow.h
MainWindow.h
+ MockMainWindow.h
+
+ CommonActions.h
)

qt4_wrap_ui(MainWindow_SRCS
@@ -64,6 +72,8 @@

QuarkPlayerCore

+ Playlist
+
${QTSINGLEAPPLICATION_LIBRARIES}

${QT_QTCORE_LIBRARY}
=======================================
--- /trunk/quarkplayer-plugins/MainWindow/MainWindow.cpp Wed Feb 9
08:27:27 2011
+++ /trunk/quarkplayer-plugins/MainWindow/MainWindow.cpp Sun Feb 20
13:15:39 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
@@ -18,6 +18,7 @@

#include "MainWindow.h"

+#include "CommonActions.h"
#include "AboutWindow.h"
#include "MainWindowLogger.h"

@@ -32,9 +33,8 @@
#include <Logger/LogWindow.h>

#include <TkUtil/ActionCollection.h>
-#include <TkUtil/TkAction.h>
-#include <TkUtil/DesktopEnvironment.h>
#include <TkUtil/TkFileDialog.h>
+#include <TkUtil/TkToolBar.h>
#include <TkUtil/LanguageChangeEventFilter.h>

#include <FileTypes/FileTypes.h>
@@ -45,12 +45,8 @@
#include <phonon/mediasource.h>
#include <phonon/audiooutput.h>

-#include <QtCore/QSignalMapper>
-
#include <QtGui/QtGui>

-#include <cstdio>
-
Q_EXPORT_PLUGIN2(MainWindow, MainWindowFactory);

const char * MainWindowFactory::PLUGIN_NAME = "MainWindow";
@@ -71,8 +67,9 @@
}

MainWindow::MainWindow(QuarkPlayer & quarkPlayer, const QUuid & uuid)
- : TkMainWindow(NULL),
- PluginInterface(quarkPlayer, uuid) {
+ : IMainWindow(quarkPlayer, uuid) {
+
+ new CommonActions(quarkPlayer, this);

QtSingleApplication * app = qobject_cast<QtSingleApplication
*>(QCoreApplication::instance());
if (app) {
@@ -93,19 +90,19 @@
_playToolBar = NULL;
_statusBar = NULL;

- connect(ActionCollection::action("MainWindow.OpenFile"),
SIGNAL(triggered()), SLOT(playFile()));
- connect(ActionCollection::action("MainWindow.OpenDVD"),
SIGNAL(triggered()), SLOT(playDVD()));
- connect(ActionCollection::action("MainWindow.OpenURL"),
SIGNAL(triggered()), SLOT(playURL()));
- connect(ActionCollection::action("MainWindow.OpenVCD"),
SIGNAL(triggered()), SLOT(playVCD()));
- connect(ActionCollection::action("MainWindow.NewMediaObject"),
SIGNAL(triggered()), &quarkPlayer, SLOT(createNewMediaObject()));
- connect(ActionCollection::action("MainWindow.Quit"), SIGNAL(triggered()),
SLOT(close()));
- connect(ActionCollection::action("MainWindow.ReportBug"),
SIGNAL(triggered()), SLOT(reportBug()));
- connect(ActionCollection::action("MainWindow.ShowMailingList"),
SIGNAL(triggered()), SLOT(showMailingList()));
- connect(ActionCollection::action("MainWindow.ViewLog"),
SIGNAL(triggered()), SLOT(viewLog()));
- connect(ActionCollection::action("MainWindow.About"),
SIGNAL(triggered()), SLOT(about()));
- connect(ActionCollection::action("MainWindow.AboutQt"),
SIGNAL(triggered()), qApp, SLOT(aboutQt()));
-
- connect(ActionCollection::action("MainWindow.VolumeMute"),
SIGNAL(toggled(bool)), SLOT(mutedToggled(bool)));
+ connect(ActionCollection::action("CommonActions.OpenFile"),
SIGNAL(triggered()), SLOT(playFile()));
+ connect(ActionCollection::action("CommonActions.OpenDVD"),
SIGNAL(triggered()), SLOT(playDVD()));
+ connect(ActionCollection::action("CommonActions.OpenURL"),
SIGNAL(triggered()), SLOT(playURL()));
+ connect(ActionCollection::action("CommonActions.OpenVCD"),
SIGNAL(triggered()), SLOT(playVCD()));
+ connect(ActionCollection::action("CommonActions.NewMediaObject"),
SIGNAL(triggered()), &quarkPlayer, SLOT(createNewMediaObject()));
+ 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.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 *)),
SLOT(currentMediaObjectChanged(Phonon::MediaObject *)));
@@ -133,8 +130,14 @@

void MainWindow::setPlayToolBar(QToolBar * playToolBar) {
_playToolBar = playToolBar;
+
+#ifdef Q_WS_MAC
+ _playToolBar->setFloatable(false);
+ _playToolBar->setMovable(false);
+#endif //!Q_WS_MAC
+
addToolBar(Qt::BottomToolBarArea, playToolBar);
- MainWindowDebug();
+
emit playToolBarAdded(_playToolBar);
}

@@ -176,13 +179,13 @@
QString fileToPlay(fileNames[0]);
Config::instance().setValue(Config::LAST_DIR_OPENED_KEY,
QFileInfo(fileToPlay).absolutePath());

- /*PlaylistWidget * playlistWidget =
PlaylistWidgetFactory::playlistWidget();
+ PlaylistWidget * playlistWidget =
PlaylistWidgetFactory::playlistWidget();
if (playlistWidget) {
playlistWidget->addFilesToCurrentPlaylist(fileNames);
playlistWidget->playlistModel()->play(0);
} else {
play(fileToPlay);
- }*/
+ }
}
}

@@ -270,82 +273,7 @@
}

void MainWindow::populateActionCollection() {
- QCoreApplication * app = QApplication::instance();
- Q_ASSERT(app);
-
- ActionCollection::addAction("MainWindow.OpenFile", new TkAction(app,
QKeySequence::Open));
- ActionCollection::addAction("MainWindow.Quit", new TkAction(app,
tr("Ctrl+Q"), tr("Alt+X")));
- ActionCollection::addAction("MainWindow.ReportBug", new QAction(app));
- ActionCollection::addAction("MainWindow.ShowMailingList", new
QAction(app));
- ActionCollection::addAction("MainWindow.ViewLog", new QAction(app));
- ActionCollection::addAction("MainWindow.About", new TkAction(app,
tr("Ctrl+F1")));
- ActionCollection::addAction("MainWindow.AboutQt", new QAction(app));
- ActionCollection::addAction("MainWindow.OpenDVD", new TkAction(app,
tr("Ctrl+D")));
- ActionCollection::addAction("MainWindow.OpenURL", new TkAction(app,
tr("Ctrl+U")));
- ActionCollection::addAction("MainWindow.OpenVCD", new QAction(app));
- ActionCollection::addAction("MainWindow.NewMediaObject", new
QAction(app));
- ActionCollection::addAction("MainWindow.Equalizer", new TkAction(app,
tr("Ctrl+E")));
- ActionCollection::addAction("MainWindow.Configure", new QAction(app));
- ActionCollection::addAction("MainWindow.EmptyMenu", new QAction(app));
-
- TkAction * action = new TkAction(app, tr("Space"), Qt::Key_MediaPlay,
Qt::Key_Pause);
- action->setShortcutContext(Qt::ApplicationShortcut);
- ActionCollection::addAction("MainWindow.PlayPause", action);
- action = new TkAction(app, Qt::Key_MediaStop);
- ActionCollection::addAction("MainWindow.Stop", action);
- action = new TkAction(app, tr("Ctrl+N"), tr(">"), Qt::Key_MediaNext);
- action->setShortcutContext(Qt::ApplicationShortcut);
- ActionCollection::addAction("MainWindow.NextTrack", action);
- action = new TkAction(app, tr("Ctrl+P"), tr("<"), Qt::Key_MediaPrevious);
- action->setShortcutContext(Qt::ApplicationShortcut);
- ActionCollection::addAction("MainWindow.PreviousTrack", action);
-
- action = new TkAction(app, tr("Left"));
- action->setShortcutContext(Qt::ApplicationShortcut);
- ActionCollection::addAction("MainWindow.JumpBackward10s", action);
- action = new TkAction(app, tr("Ctrl+Left"));
- action->setShortcutContext(Qt::ApplicationShortcut);
- ActionCollection::addAction("MainWindow.JumpBackward1min", action);
- action = new TkAction(app, tr("Shift+Left"));
- action->setShortcutContext(Qt::ApplicationShortcut);
- ActionCollection::addAction("MainWindow.JumpBackward10min", action);
-
- action = new TkAction(app, tr("Right"));
- action->setShortcutContext(Qt::ApplicationShortcut);
- ActionCollection::addAction("MainWindow.JumpForward10s", action);
- action = new TkAction(app, tr("Ctrl+Right"));
- action->setShortcutContext(Qt::ApplicationShortcut);
- ActionCollection::addAction("MainWindow.JumpForward1min", action);
- action = new TkAction(app, tr("Shift+Right"));
- action->setShortcutContext(Qt::ApplicationShortcut);
- ActionCollection::addAction("MainWindow.JumpForward10min", action);
-
- action = new TkAction(app, tr("["));
- action->setShortcutContext(Qt::ApplicationShortcut);
- ActionCollection::addAction("MainWindow.SpeedDecrease10%", action);
- action = new TkAction(app, tr("]"));
- action->setShortcutContext(Qt::ApplicationShortcut);
- ActionCollection::addAction("MainWindow.SpeedIncrease10%", action);
-
- action = new TkAction(app, tr("Ctrl+M"));
- action->setShortcutContext(Qt::ApplicationShortcut);
- action->setCheckable(true);
- ActionCollection::addAction("MainWindow.VolumeMute", action);
-
- action = new TkAction(app, tr("Ctrl+Down"), tr("-"), tr("Alt+-"));
- action->setShortcutContext(Qt::ApplicationShortcut);
- ActionCollection::addAction("MainWindow.VolumeDecrease10%", action);
- action = new TkAction(app, tr("Ctrl+Up"), tr("+"), tr("Alt++"));
- action->setShortcutContext(Qt::ApplicationShortcut);
- ActionCollection::addAction("MainWindow.VolumeIncrease10%", action);
-
- action = new TkAction(app, tr("Ctrl+F"), tr("Alt+Return"));
- action->setShortcutContext(Qt::ApplicationShortcut);
- action->setCheckable(true);
- ActionCollection::addAction("MainWindow.FullScreen", action);
-
- action = new TkAction(app, tr("Esc"));
- ActionCollection::addAction("MainWindow.FullScreenExit", action);
+
}

void MainWindow::setupUi() {
@@ -362,63 +290,63 @@

_menuFile = new QMenu();
menuBar()->addMenu(_menuFile);
- _menuFile->addAction(ActionCollection::action("MainWindow.OpenFile"));
- _menuFile->addAction(ActionCollection::action("MainWindow.OpenDVD"));
- _menuFile->addAction(ActionCollection::action("MainWindow.OpenURL"));
- _menuFile->addAction(ActionCollection::action("MainWindow.OpenVCD"));
+ _menuFile->addAction(ActionCollection::action("CommonActions.OpenFile"));
+ _menuFile->addAction(ActionCollection::action("CommonActions.OpenURL"));
+ _menuFile->addAction(ActionCollection::action("CommonActions.OpenDVD"));
+ _menuFile->addAction(ActionCollection::action("CommonActions.OpenVCD"));
_menuFile->addSeparator();
- _menuFile->addAction(ActionCollection::action("MainWindow.Quit"));
+ _menuFile->addAction(ActionCollection::action("CommonActions.Quit"));

_menuPlay = new QMenu();
menuBar()->addMenu(_menuPlay);
-
_menuPlay->addAction(ActionCollection::action("MainWindow.PreviousTrack"));
- _menuPlay->addAction(ActionCollection::action("MainWindow.PlayPause"));
- _menuPlay->addAction(ActionCollection::action("MainWindow.Stop"));
- _menuPlay->addAction(ActionCollection::action("MainWindow.NextTrack"));
+
_menuPlay->addAction(ActionCollection::action("CommonActions.PreviousTrack"));
+ _menuPlay->addAction(ActionCollection::action("CommonActions.PlayPause"));
+ _menuPlay->addAction(ActionCollection::action("CommonActions.Stop"));
+ _menuPlay->addAction(ActionCollection::action("CommonActions.NextTrack"));
_menuPlay->addSeparator();
-
_menuPlay->addAction(ActionCollection::action("MainWindow.JumpBackward10s"));
-
_menuPlay->addAction(ActionCollection::action("MainWindow.JumpBackward1min"));
-
_menuPlay->addAction(ActionCollection::action("MainWindow.JumpBackward10min"));
-
_menuPlay->addAction(ActionCollection::action("MainWindow.JumpForward10s"));
-
_menuPlay->addAction(ActionCollection::action("MainWindow.JumpForward1min"));
-
_menuPlay->addAction(ActionCollection::action("MainWindow.JumpForward10min"));
-
_menuPlay->addAction(ActionCollection::action("MainWindow.SpeedDecrease10%"));
-
_menuPlay->addAction(ActionCollection::action("MainWindow.SpeedIncrease10%"));
+
_menuPlay->addAction(ActionCollection::action("CommonActions.JumpBackward10s"));
+
_menuPlay->addAction(ActionCollection::action("CommonActions.JumpBackward1min"));
+
_menuPlay->addAction(ActionCollection::action("CommonActions.JumpBackward10min"));
+
_menuPlay->addAction(ActionCollection::action("CommonActions.JumpForward10s"));
+
_menuPlay->addAction(ActionCollection::action("CommonActions.JumpForward1min"));
+
_menuPlay->addAction(ActionCollection::action("CommonActions.JumpForward10min"));
+
_menuPlay->addAction(ActionCollection::action("CommonActions.SpeedDecrease10%"));
+
_menuPlay->addAction(ActionCollection::action("CommonActions.SpeedIncrease10%"));
_menuPlay->addSeparator();
- _menuPlay->addAction(ActionCollection::action("MainWindow.FullScreen"));
+
_menuPlay->addAction(ActionCollection::action("CommonActions.FullScreen"));
//No menu entry for FullScreenExit, see MyVideoWidget.cpp
_menuPlay->addSeparator();
-
_menuPlay->addAction(ActionCollection::action("MainWindow.NewMediaObject"));
+
_menuPlay->addAction(ActionCollection::action("CommonActions.NewMediaObject"));

_menuAudio = new QMenu();
menuBar()->addMenu(_menuAudio);
- _menuAudio->addAction(ActionCollection::action("MainWindow.VolumeMute"));
-
_menuAudio->addAction(ActionCollection::action("MainWindow.VolumeDecrease10%"));
-
_menuAudio->addAction(ActionCollection::action("MainWindow.VolumeIncrease10%"));
+
_menuAudio->addAction(ActionCollection::action("CommonActions.VolumeMute"));
+
_menuAudio->addAction(ActionCollection::action("CommonActions.VolumeIncrease10%"));
+
_menuAudio->addAction(ActionCollection::action("CommonActions.VolumeDecrease10%"));

_menuSettings = new QMenu();
menuBar()->addMenu(_menuSettings);
-
_menuSettings->addAction(ActionCollection::action("MainWindow.Equalizer"));
-
_menuSettings->addAction(ActionCollection::action("MainWindow.Configure"));
+
_menuSettings->addAction(ActionCollection::action("CommonActions.Equalizer"));
+
_menuSettings->addAction(ActionCollection::action("CommonActions.Configure"));

_menuHelp = new QMenu();
menuBar()->addMenu(_menuHelp);
-
_menuHelp->addAction(ActionCollection::action("MainWindow.ShowMailingList"));
- _menuHelp->addAction(ActionCollection::action("MainWindow.ReportBug"));
- _menuHelp->addAction(ActionCollection::action("MainWindow.ViewLog"));
+
_menuHelp->addAction(ActionCollection::action("CommonActions.ShowMailingList"));
+ _menuHelp->addAction(ActionCollection::action("CommonActions.ReportBug"));
+ _menuHelp->addAction(ActionCollection::action("CommonActions.ViewLog"));
_menuHelp->addSeparator();
- _menuHelp->addAction(ActionCollection::action("MainWindow.About"));
- _menuHelp->addAction(ActionCollection::action("MainWindow.AboutQt"));
+ _menuHelp->addAction(ActionCollection::action("CommonActions.About"));
+ _menuHelp->addAction(ActionCollection::action("CommonActions.AboutQt"));

//Main ToolBar
_mainToolBar = new TkToolBar(this);
TkToolBar::setToolButtonStyle(_mainToolBar);
- _mainToolBar->addAction(ActionCollection::action("MainWindow.OpenFile"));
- _mainToolBar->addAction(ActionCollection::action("MainWindow.OpenDVD"));
- //_mainToolBar->addAction(ActionCollection::action("MainWindow.OpenURL"));
+
_mainToolBar->addAction(ActionCollection::action("CommonActions.OpenFile"));
+
_mainToolBar->addAction(ActionCollection::action("CommonActions.OpenDVD"));
+
//_mainToolBar->addAction(ActionCollection::action("CommonActions.OpenURL"));
//_mainToolBar->addSeparator();
-
//_mainToolBar->addAction(ActionCollection::action("MainWindow.Equalizer"));
-
//_mainToolBar->addAction(ActionCollection::action("MainWindow.Configure"));
+
//_mainToolBar->addAction(ActionCollection::action("CommonActions.Equalizer"));
+
//_mainToolBar->addAction(ActionCollection::action("CommonActions.Configure"));
addToolBar(_mainToolBar);

//Main toolbar accessible but disabled by default
@@ -429,62 +357,6 @@
updateWindowTitle();
setWindowIcon(QIcon(":/icons/quarkplayer-16x16.png"));

- ActionCollection::action("MainWindow.OpenFile")->setText(tr("Play
&File..."));
-
ActionCollection::action("MainWindow.OpenFile")->setIcon(QIcon::fromTheme("document-open"));
-
- ActionCollection::action("MainWindow.Quit")->setText(tr("&Quit"));
-
ActionCollection::action("MainWindow.Quit")->setIcon(QIcon::fromTheme("application-exit"));
-
- ActionCollection::action("MainWindow.ReportBug")->setText(tr("&Report a
Problem..."));
- if (desktopEnvironment() == GNOME) {
-
ActionCollection::action("MainWindow.ReportBug")->setIcon(QIcon::fromTheme("apport"));
- } else {
-
ActionCollection::action("MainWindow.ReportBug")->setIcon(QIcon::fromTheme("tools-report-bug"));
- }
-
-
ActionCollection::action("MainWindow.ShowMailingList")->setText(tr("&Discuss
about QuarkPlayer..."));
- if (desktopEnvironment() == GNOME) {
-
ActionCollection::action("MainWindow.ShowMailingList")->setIcon(QIcon::fromTheme("help-faq"));
- } else {
-
ActionCollection::action("MainWindow.ShowMailingList")->setIcon(QIcon::fromTheme("help-hint"));
- }
-
- ActionCollection::action("MainWindow.ViewLog")->setText(tr("View &Log"));
- QIcon logIcon;
- if (desktopEnvironment() == GNOME) {
- logIcon = QIcon::fromTheme("logviewer");
- } else {
- logIcon = QIcon::fromTheme("text-x-log");
- }
- ActionCollection::action("MainWindow.ViewLog")->setIcon(logIcon);
-
- ActionCollection::action("MainWindow.About")->setText(tr("&About"));
-
ActionCollection::action("MainWindow.About")->setIcon(QIcon::fromTheme("help-about"));
-
- ActionCollection::action("MainWindow.AboutQt")->setText(tr("About &Qt"));
-
ActionCollection::action("MainWindow.AboutQt")->setIcon(QIcon::fromTheme("help-about"));
-
- ActionCollection::action("MainWindow.OpenDVD")->setText(tr("Play
&DVD..."));
-
ActionCollection::action("MainWindow.OpenDVD")->setIcon(QIcon::fromTheme("media-optical"));
-
- ActionCollection::action("MainWindow.OpenURL")->setText(tr("Play
&URL..."));
-
ActionCollection::action("MainWindow.OpenURL")->setIcon(QIcon::fromTheme("document-open-remote"));
-
- ActionCollection::action("MainWindow.OpenVCD")->setText(tr("Play
&VCD..."));
-
//ActionCollection::action("MainWindow.OpenVCD")->setIcon(QIcon::fromTheme("media-optical"));
-
- ActionCollection::action("MainWindow.NewMediaObject")->setText(tr("New
Media Window"));
-
ActionCollection::action("MainWindow.NewMediaObject")->setIcon(QIcon::fromTheme("tab-new"));
-
-
ActionCollection::action("MainWindow.Equalizer")->setText(tr("&Equalizer..."));
-
ActionCollection::action("MainWindow.Equalizer")->setIcon(QIcon::fromTheme("view-media-equalizer"));
-
-
ActionCollection::action("MainWindow.Configure")->setText(tr("&Configure..."));
-
ActionCollection::action("MainWindow.Configure")->setIcon(QIcon::fromTheme("preferences-system"));
-
- ActionCollection::action("MainWindow.EmptyMenu")->setText(tr("<empty>"));
- ActionCollection::action("MainWindow.EmptyMenu")->setEnabled(false);
-
//Main toolbar accessible but disabled by default
_mainToolBar->setWindowTitle(tr("Main ToolBar"));
_mainToolBar->setMinimumSize(_mainToolBar->sizeHint());
@@ -494,47 +366,6 @@
_menuAudio->setTitle(tr("&Audio"));
_menuSettings->setTitle(tr("&Settings"));
_menuHelp->setTitle(tr("&Help"));
-
-
ActionCollection::action("MainWindow.PreviousTrack")->setText(tr("P&revious
Track"));
-
ActionCollection::action("MainWindow.PreviousTrack")->setIcon(QIcon::fromTheme("media-skip-backward"));
-
-
ActionCollection::action("MainWindow.PlayPause")->setText(tr("&Play/Pause"));
-
ActionCollection::action("MainWindow.PlayPause")->setIcon(QIcon::fromTheme("media-playback-start"));
-
- ActionCollection::action("MainWindow.Stop")->setText(tr("&Stop"));
-
ActionCollection::action("MainWindow.Stop")->setIcon(QIcon::fromTheme("media-playback-stop"));
-
- ActionCollection::action("MainWindow.NextTrack")->setText(tr("&Next
Track"));
-
ActionCollection::action("MainWindow.NextTrack")->setIcon(QIcon::fromTheme("media-skip-forward"));
-
- ActionCollection::action("MainWindow.JumpBackward10s")->setText(tr("Jump
&Backward 10s"));
-
ActionCollection::action("MainWindow.JumpBackward10s")->setIcon(QIcon::fromTheme("media-seek-backward"));
- ActionCollection::action("MainWindow.JumpBackward1min")->setText(tr("Jump
&Backward 1min"));
-
ActionCollection::action("MainWindow.JumpBackward1min")->setIcon(QIcon::fromTheme("media-seek-backward"));
-
ActionCollection::action("MainWindow.JumpBackward10min")->setText(tr("Jump
&Backward 10min"));
-
ActionCollection::action("MainWindow.JumpBackward10min")->setIcon(QIcon::fromTheme("media-seek-backward"));
- ActionCollection::action("MainWindow.JumpForward10s")->setText(tr("Jump
&Forward 10s"));
-
ActionCollection::action("MainWindow.JumpForward10s")->setIcon(QIcon::fromTheme("media-seek-forward"));
- ActionCollection::action("MainWindow.JumpForward1min")->setText(tr("Jump
&Forward 1min"));
-
ActionCollection::action("MainWindow.JumpForward1min")->setIcon(QIcon::fromTheme("media-seek-forward"));
- ActionCollection::action("MainWindow.JumpForward10min")->setText(tr("Jump
&Forward 10min"));
-
ActionCollection::action("MainWindow.JumpForward10min")->setIcon(QIcon::fromTheme("media-seek-forward"));
-
ActionCollection::action("MainWindow.SpeedDecrease10%")->setText(tr("Decrease
Speed"));
-
ActionCollection::action("MainWindow.SpeedDecrease10%")->setIcon(QIcon::fromTheme("media-seek-backward"));
-
ActionCollection::action("MainWindow.SpeedIncrease10%")->setText(tr("Increase
Speed"));
-
ActionCollection::action("MainWindow.SpeedIncrease10%")->setIcon(QIcon::fromTheme("media-seek-forward"));
-
- ActionCollection::action("MainWindow.VolumeMute")->setText(tr("&Mute"));
-
ActionCollection::action("MainWindow.VolumeMute")->setIcon(QIcon::fromTheme("audio-volume-muted"));
-
ActionCollection::action("MainWindow.VolumeDecrease10%")->setText(tr("&Decrease
Volume"));
-
ActionCollection::action("MainWindow.VolumeDecrease10%")->setIcon(QIcon::fromTheme("audio-volume-low"));
-
ActionCollection::action("MainWindow.VolumeIncrease10%")->setText(tr("&Increase
Volume"));
-
ActionCollection::action("MainWindow.VolumeIncrease10%")->setIcon(QIcon::fromTheme("audio-volume-high"));
-
-
ActionCollection::action("MainWindow.FullScreen")->setText(tr("&Fullscreen"));
-
ActionCollection::action("MainWindow.FullScreen")->setIcon(QIcon::fromTheme("view-fullscreen"));
-
- ActionCollection::action("MainWindow.FullScreenExit")->setText(tr("&Exit
Fullscreen"));
}

QMenu * MainWindow::menuFile() const {
@@ -628,11 +459,16 @@
void MainWindow::addDockWidget(Qt::DockWidgetArea area, QDockWidget *
lastDockWidget, QDockWidget * dockWidget) {
if (dockWidget) {
//dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
- //dockWidget->setFloating(false);
+
+#ifdef Q_WS_MAC
+ //QDockWidgets cannot be floatable under Mac
+ //so let's fully disable this feature
+ dockWidget->setFloating(false);
+#endif //Q_WS_MAC

//To hide the title bar completely
//we must replace the default widget with a generic one
- //dockWidget->setTitleBarWidget(new QWidget(this));
+ dockWidget->setTitleBarWidget(new QWidget(this));

QMainWindow::addDockWidget(area, dockWidget);
if (lastDockWidget) {
@@ -679,22 +515,24 @@
//Resets the window title when needed
connect(mediaObject, SIGNAL(metaDataChanged()),
SLOT(updateWindowTitle()));

- disconnect(ActionCollection::action("MainWindow.Quit"),
SIGNAL(triggered()), mediaObject, SLOT(stop()));
- connect(ActionCollection::action("MainWindow.Quit"), SIGNAL(triggered()),
mediaObject, SLOT(stop()));
+ disconnect(ActionCollection::action("CommonActions.Quit"),
SIGNAL(triggered()), mediaObject, SLOT(stop()));
+ connect(ActionCollection::action("CommonActions.Quit"),
SIGNAL(triggered()), mediaObject, SLOT(stop()));

Phonon::AudioOutput * audioOutput = quarkPlayer().currentAudioOutput();
if (audioOutput) {
//Avoid a crash inside Phonon if the backend couldn't be loaded
-
ActionCollection::action("MainWindow.VolumeMute")->setChecked(audioOutput->isMuted());
+
ActionCollection::action("CommonActions.VolumeMute")->setChecked(audioOutput->isMuted());
disconnect(audioOutput, SIGNAL(mutedChanged(bool)), this,
SLOT(mutedChanged(bool)));
connect(audioOutput, SIGNAL(mutedChanged(bool)),
SLOT(mutedChanged(bool)));
}
}

void MainWindow::mutedChanged(bool muted) {
- ActionCollection::action("MainWindow.VolumeMute")->setChecked(muted);
+ ActionCollection::action("CommonActions.VolumeMute")->setChecked(muted);
}

void MainWindow::mutedToggled(bool muted) {
- quarkPlayer().currentAudioOutput()->setMuted(muted);
-}
+ Phonon::AudioOutput * audioOutput = quarkPlayer().currentAudioOutput();
+ Q_ASSERT(audioOutput);
+ audioOutput->setMuted(muted);
+}
=======================================
--- /trunk/quarkplayer-plugins/MainWindow/MainWindow.h Wed Feb 9 08:27:27
2011
+++ /trunk/quarkplayer-plugins/MainWindow/MainWindow.h Sun Feb 20 13:15:39
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
@@ -19,12 +19,7 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

-#include <quarkplayer-plugins/MainWindow/MainWindowExport.h>
-
-#include <quarkplayer/PluginInterface.h>
-
-#include <TkUtil/TkMainWindow.h>
-#include <TkUtil/TkToolBar.h>
+#include <quarkplayer-plugins/MainWindow/IMainWindow.h>

#include <QtGui/QMainWindow>

@@ -47,7 +42,7 @@
* @see http://en.wikipedia.org/wiki/Facade_pattern
* @author Tanguy Krotoff
*/
-class MAINWINDOW_API MainWindow : public TkMainWindow, public
PluginInterface {
+class MAINWINDOW_API MainWindow : public IMainWindow {
Q_OBJECT
public:

@@ -104,15 +99,6 @@
*/
void statusBarAdded(QStatusBar * statusBar);

-public slots:
-
- /**
- * Play a media source using the current media object.
- *
- * @see QuarkPlayer::play()
- */
- void play(const Phonon::MediaSource & mediaSource);
-
private slots:

void reportBug();
@@ -146,6 +132,15 @@

void setupUi();

+ /**
+ * Play a media source using the current media object.
+ *
+ * Code factorization.
+ *
+ * @see QuarkPlayer::play()
+ */
+ void play(const Phonon::MediaSource & mediaSource);
+
/** Internal factorization code. */
void addDockWidget(Qt::DockWidgetArea area, QDockWidget * lastDockWidget,
QDockWidget * dockWidget);

@@ -162,13 +157,13 @@
*/
QString getDiscPath(const QString & defaultPath, const QString &
windowTitle);

- TkToolBar * _mainToolBar;
QMenu * _menuFile;
QMenu * _menuPlay;
QMenu * _menuAudio;
QMenu * _menuSettings;
QMenu * _menuHelp;

+ QToolBar * _mainToolBar;
QToolBar * _playToolBar;
QStatusBar * _statusBar;
};
=======================================
--- /trunk/quarkplayer-plugins/MediaController/MediaController.cpp Tue Nov
9 09:44:05 2010
+++ /trunk/quarkplayer-plugins/MediaController/MediaController.cpp Sun Feb
20 13:15:39 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
@@ -120,26 +120,26 @@
QAction * insertBeforeMenuSettings =
_mainWindow->menuSettings()->menuAction();

_menuAudioChannels = new QMenu();
-
_menuAudioChannels->addAction(ActionCollection::action("MainWindow.EmptyMenu"));
+
_menuAudioChannels->addAction(ActionCollection::action("CommonActions.EmptyMenu"));
_mainWindow->menuAudio()->addMenu(_menuAudioChannels);

_menuSubtitle = new QMenu();
menuBar->insertMenu(insertBeforeMenuSettings, _menuSubtitle);

_menuSubtitle->addAction(ActionCollection::action("MediaController.OpenSubtitleFile"));
_menuSubtitles = new QMenu();
-
_menuSubtitles->addAction(ActionCollection::action("MainWindow.EmptyMenu"));
+
_menuSubtitles->addAction(ActionCollection::action("CommonActions.EmptyMenu"));
_menuSubtitle->addMenu(_menuSubtitles);

_menuBrowse = new QMenu();
menuBar->insertMenu(insertBeforeMenuSettings, _menuBrowse);
_menuTitles = new QMenu();
- _menuTitles->addAction(ActionCollection::action("MainWindow.EmptyMenu"));
+
_menuTitles->addAction(ActionCollection::action("CommonActions.EmptyMenu"));
_menuBrowse->addAction(_menuTitles->menuAction());
_menuChapters = new QMenu();
-
_menuChapters->addAction(ActionCollection::action("MainWindow.EmptyMenu"));
+
_menuChapters->addAction(ActionCollection::action("CommonActions.EmptyMenu"));
_menuBrowse->addAction(_menuChapters->menuAction());
_menuAngles = new QMenu();
- _menuAngles->addAction(ActionCollection::action("MainWindow.EmptyMenu"));
+
_menuAngles->addAction(ActionCollection::action("CommonActions.EmptyMenu"));
_menuBrowse->addAction(_menuAngles->menuAction());
}

@@ -266,8 +266,8 @@
removeAllAction(_menuAudioChannels);
removeAllAction(_toolBar->menuAudioChannels());
if (audios.isEmpty()) {
-
_menuAudioChannels->addAction(ActionCollection::action("MainWindow.EmptyMenu"));
-
_toolBar->menuAudioChannels()->addAction(ActionCollection::action("MainWindow.EmptyMenu"));
+
_menuAudioChannels->addAction(ActionCollection::action("CommonActions.EmptyMenu"));
+
_toolBar->menuAudioChannels()->addAction(ActionCollection::action("CommonActions.EmptyMenu"));
}

for (int i = 0; i < audios.size(); i++) {
@@ -317,8 +317,8 @@
removeAllAction(_menuSubtitles);
removeAllAction(_toolBar->menuSubtitles());
if (subtitles.isEmpty()) {
-
_menuSubtitles->addAction(ActionCollection::action("MainWindow.EmptyMenu"));
-
_toolBar->menuSubtitles()->addAction(ActionCollection::action("MainWindow.EmptyMenu"));
+
_menuSubtitles->addAction(ActionCollection::action("CommonActions.EmptyMenu"));
+
_toolBar->menuSubtitles()->addAction(ActionCollection::action("CommonActions.EmptyMenu"));
}

for (int i = 0; i < subtitles.size(); i++) {
@@ -376,7 +376,7 @@
int nbTitles = titles.size();
removeAllAction(_menuTitles);
if (titles.isEmpty()) {
- _menuTitles->addAction(ActionCollection::action("MainWindow.EmptyMenu"));
+
_menuTitles->addAction(ActionCollection::action("CommonActions.EmptyMenu"));
}

for (int i = 0; i < nbTitles; i++) {
@@ -391,7 +391,7 @@
int nbTitles = titles;
removeAllAction(_menuTitles);
if (titles == 0) {
- _menuTitles->addAction(ActionCollection::action("MainWindow.EmptyMenu"));
+
_menuTitles->addAction(ActionCollection::action("CommonActions.EmptyMenu"));
}

for (int i = 0; i < nbTitles; i++) {
@@ -461,7 +461,7 @@
QList<Phonon::ChapterDescription> chapters =
_currentMediaController->availableChapters2();
removeAllAction(_menuChapters);
if (chapters.isEmpty()) {
-
_menuChapters->addAction(ActionCollection::action("MainWindow.EmptyMenu"));
+
_menuChapters->addAction(ActionCollection::action("CommonActions.EmptyMenu"));
}

for (int i = 0; i < chapters.size(); i++) {
@@ -475,7 +475,7 @@
int chapters = _currentMediaController->availableChapters();
removeAllAction(_menuChapters);
if (chapters == 0) {
-
_menuChapters->addAction(ActionCollection::action("MainWindow.EmptyMenu"));
+
_menuChapters->addAction(ActionCollection::action("CommonActions.EmptyMenu"));
}

for (int i = 0; i < chapters; i++) {
@@ -524,7 +524,7 @@
int angles = _currentMediaController->availableAngles();
removeAllAction(_menuAngles);
if (angles == 0) {
- _menuAngles->addAction(ActionCollection::action("MainWindow.EmptyMenu"));
+
_menuAngles->addAction(ActionCollection::action("CommonActions.EmptyMenu"));
}

for (int i = 0; i < angles; i++) {
=======================================
--- /trunk/quarkplayer-plugins/MediaController/MediaControllerToolBar.cpp
Fri Aug 13 02:18:04 2010
+++ /trunk/quarkplayer-plugins/MediaController/MediaControllerToolBar.cpp
Sun Feb 20 13:15:39 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
@@ -32,13 +32,13 @@

_audioChannelsButton = new QPushButton();
_menuAudioChannels = new QMenu();
-
_menuAudioChannels->addAction(ActionCollection::action("MainWindow.EmptyMenu"));
+
_menuAudioChannels->addAction(ActionCollection::action("CommonActions.EmptyMenu"));
_audioChannelsButton->setMenu(_menuAudioChannels);
addWidget(_audioChannelsButton);

_subtitlesButton = new QPushButton();
_menuSubtitles = new QMenu();
-
_menuSubtitles->addAction(ActionCollection::action("MainWindow.EmptyMenu"));
+
_menuSubtitles->addAction(ActionCollection::action("CommonActions.EmptyMenu"));
_subtitlesButton->setMenu(_menuSubtitles);
addWidget(_subtitlesButton);

=======================================
--- /trunk/quarkplayer-plugins/PlayToolBar/PlayToolBar.cpp Fri Aug 13
02:18:04 2010
+++ /trunk/quarkplayer-plugins/PlayToolBar/PlayToolBar.cpp Sun Feb 20
13:15:39 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
@@ -47,11 +47,11 @@
}

PluginInterface * PlayToolBarFactory::create(QuarkPlayer & quarkPlayer,
const QUuid & uuid) const {
- return new PlayToolBar(quarkPlayer, uuid);
+ return new PlayToolBar(quarkPlayer, uuid,
MainWindowFactory::mainWindow());
}

-PlayToolBar::PlayToolBar(QuarkPlayer & quarkPlayer, const QUuid & uuid)
- : QToolBar(MainWindowFactory::mainWindow()),
+PlayToolBar::PlayToolBar(QuarkPlayer & quarkPlayer, const QUuid & uuid,
IMainWindow * mainWindow)
+ : QToolBar(NULL),
PluginInterface(quarkPlayer, uuid) {

_volumeSlider = NULL;
@@ -83,7 +83,7 @@
setToolBarEnabled(false);

//Add to the main window
- MainWindowFactory::mainWindow()->setPlayToolBar(this);
+ mainWindow->setPlayToolBar(this);

if (quarkPlayer.currentMediaObject()) {
//The current MediaObject has been already created
@@ -101,63 +101,14 @@
}

void PlayToolBar::stateChanged(Phonon::State newState) {
+ Q_UNUSED(newState);
+
static bool firstTime = true;

if (firstTime) {
firstTime = false;
setToolBarEnabled(true);
}
-
- //Enabled/disabled fullscreen button depending if media file is a video
or audio
- if (quarkPlayer().currentMediaObject()->hasVideo()) {
- ActionCollection::action("MainWindow.FullScreen")->setEnabled(true);
- } else {
- ActionCollection::action("MainWindow.FullScreen")->setEnabled(false);
- }
-
- switch (newState) {
- case Phonon::ErrorState:
- break;
-
- case Phonon::PlayingState:
- ActionCollection::action("MainWindow.PlayPause")->setText(tr("&Pause"));
-
ActionCollection::action("MainWindow.PlayPause")->setIcon(QIcon::fromTheme("media-playback-pause"));
- disconnect(ActionCollection::action("MainWindow.PlayPause"), 0, 0, 0);
- connect(ActionCollection::action("MainWindow.PlayPause"),
SIGNAL(triggered()),
- quarkPlayer().currentMediaObject(), SLOT(pause()));
-
- ActionCollection::action("MainWindow.Stop")->setEnabled(true);
- break;
-
- case Phonon::StoppedState:
- ActionCollection::action("MainWindow.PlayPause")->setText(tr("P&lay"));
-
ActionCollection::action("MainWindow.PlayPause")->setIcon(QIcon::fromTheme("media-playback-start"));
- disconnect(ActionCollection::action("MainWindow.PlayPause"), 0, 0, 0);
- connect(ActionCollection::action("MainWindow.PlayPause"),
SIGNAL(triggered()),
- quarkPlayer().currentMediaObject(), SLOT(play()));
-
- ActionCollection::action("MainWindow.Stop")->setEnabled(false);
- break;
-
- case Phonon::PausedState:
- ActionCollection::action("MainWindow.PlayPause")->setText(tr("P&lay"));
-
ActionCollection::action("MainWindow.PlayPause")->setIcon(QIcon::fromTheme("media-playback-start"));
- disconnect(ActionCollection::action("MainWindow.PlayPause"), 0, 0, 0);
- connect(ActionCollection::action("MainWindow.PlayPause"),
SIGNAL(triggered()),
- quarkPlayer().currentMediaObject(), SLOT(play()));
-
- ActionCollection::action("MainWindow.Stop")->setEnabled(true);
- break;
-
- case Phonon::LoadingState:
- break;
-
- case Phonon::BufferingState:
- break;
-
- default:
- PlayToolBarDebug() << "newState:" << newState;
- }
}

void PlayToolBar::createSeekToolBar() {
@@ -169,28 +120,28 @@
//_seekSlider->setIconVisible(true);
//_seekSlider->setTracking(false);

-
//_seekToolBar->addAction(ActionCollection::action("MainWindow.SpeedDecrease10%"));
- connect(ActionCollection::action("MainWindow.SpeedDecrease10%"),
SIGNAL(triggered()), SLOT(decreaseSpeed10()));
-
//_seekToolBar->addAction(ActionCollection::action("MainWindow.JumpBackward10min"));
- connect(ActionCollection::action("MainWindow.JumpBackward10min"),
SIGNAL(triggered()), SLOT(jumpBackward10min()));
-
_seekToolBar->addAction(ActionCollection::action("MainWindow.JumpBackward1min"));
- connect(ActionCollection::action("MainWindow.JumpBackward1min"),
SIGNAL(triggered()), SLOT(jumpBackward1min()));
-
//_seekToolBar->addAction(ActionCollection::action("MainWindow.JumpBackward10s"));
- connect(ActionCollection::action("MainWindow.JumpBackward10s"),
SIGNAL(triggered()), SLOT(jumpBackward10s()));
+
//_seekToolBar->addAction(ActionCollection::action("CommonActions.SpeedDecrease10%"));
+ connect(ActionCollection::action("CommonActions.SpeedDecrease10%"),
SIGNAL(triggered()), SLOT(decreaseSpeed10()));
+
//_seekToolBar->addAction(ActionCollection::action("CommonActions.JumpBackward10min"));
+ connect(ActionCollection::action("CommonActions.JumpBackward10min"),
SIGNAL(triggered()), SLOT(jumpBackward10min()));
+
_seekToolBar->addAction(ActionCollection::action("CommonActions.JumpBackward1min"));
+ connect(ActionCollection::action("CommonActions.JumpBackward1min"),
SIGNAL(triggered()), SLOT(jumpBackward1min()));
+
//_seekToolBar->addAction(ActionCollection::action("CommonActions.JumpBackward10s"));
+ connect(ActionCollection::action("CommonActions.JumpBackward10s"),
SIGNAL(triggered()), SLOT(jumpBackward10s()));

_seekToolBar->addWidget(_seekSlider);

-
//_seekToolBar->addAction(ActionCollection::action("MainWindow.JumpForward10s"));
- connect(ActionCollection::action("MainWindow.JumpForward10s"),
SIGNAL(triggered()), SLOT(jumpForward10s()));
-
_seekToolBar->addAction(ActionCollection::action("MainWindow.JumpForward1min"));
- connect(ActionCollection::action("MainWindow.JumpForward1min"),
SIGNAL(triggered()), SLOT(jumpForward1min()));
-
//_seekToolBar->addAction(ActionCollection::action("MainWindow.JumpForward10min"));
- connect(ActionCollection::action("MainWindow.JumpForward10min"),
SIGNAL(triggered()), SLOT(jumpForward10min()));
-
//_seekToolBar->addAction(ActionCollection::action("MainWindow.SpeedIncrease10%"));
- connect(ActionCollection::action("MainWindow.SpeedIncrease10%"),
SIGNAL(triggered()), SLOT(increaseSpeed10()));
-
- connect(ActionCollection::action("MainWindow.VolumeDecrease10%"),
SIGNAL(triggered()), SLOT(volumeDecrease10()));
- connect(ActionCollection::action("MainWindow.VolumeIncrease10%"),
SIGNAL(triggered()), SLOT(volumeIncrease10()));
+
//_seekToolBar->addAction(ActionCollection::action("CommonActions.JumpForward10s"));
+ connect(ActionCollection::action("CommonActions.JumpForward10s"),
SIGNAL(triggered()), SLOT(jumpForward10s()));
+
_seekToolBar->addAction(ActionCollection::action("CommonActions.JumpForward1min"));
+ connect(ActionCollection::action("CommonActions.JumpForward1min"),
SIGNAL(triggered()), SLOT(jumpForward1min()));
+
//_seekToolBar->addAction(ActionCollection::action("CommonActions.JumpForward10min"));
+ connect(ActionCollection::action("CommonActions.JumpForward10min"),
SIGNAL(triggered()), SLOT(jumpForward10min()));
+
//_seekToolBar->addAction(ActionCollection::action("CommonActions.SpeedIncrease10%"));
+ connect(ActionCollection::action("CommonActions.SpeedIncrease10%"),
SIGNAL(triggered()), SLOT(increaseSpeed10()));
+
+ connect(ActionCollection::action("CommonActions.VolumeDecrease10%"),
SIGNAL(triggered()), SLOT(volumeDecrease10()));
+ connect(ActionCollection::action("CommonActions.VolumeIncrease10%"),
SIGNAL(triggered()), SLOT(volumeIncrease10()));
}

void PlayToolBar::decreaseSpeed10() {
@@ -282,6 +233,8 @@
} else {
_volumeSlider->setVolumeIcon(QIcon::fromTheme("audio-volume-medium"));
}
+#else
+ Q_UNUSED(volume);
#endif //NEW_TITLE_CHAPTER_HANDLING
}

@@ -289,16 +242,16 @@
_controlToolBar = new QToolBar(NULL);
_controlToolBar->setIconSize(QSize(24, 18));

-
_controlToolBar->addAction(ActionCollection::action("MainWindow.PreviousTrack"));
-
_controlToolBar->addAction(ActionCollection::action("MainWindow.PlayPause"));
- _controlToolBar->addAction(ActionCollection::action("MainWindow.Stop"));
-
_controlToolBar->addAction(ActionCollection::action("MainWindow.NextTrack"));
+
_controlToolBar->addAction(ActionCollection::action("CommonActions.PreviousTrack"));
+
_controlToolBar->addAction(ActionCollection::action("CommonActions.PlayPause"));
+
_controlToolBar->addAction(ActionCollection::action("CommonActions.Stop"));
+
_controlToolBar->addAction(ActionCollection::action("CommonActions.NextTrack"));

_controlToolBar->addSeparator();
-
_controlToolBar->addAction(ActionCollection::action("MainWindow.FullScreen"));
+
_controlToolBar->addAction(ActionCollection::action("CommonActions.FullScreen"));

_controlToolBar->addSeparator();
-
_controlToolBar->addAction(ActionCollection::action("MainWindow.NewMediaObject"));
+
_controlToolBar->addAction(ActionCollection::action("CommonActions.NewMediaObject"));

//volumeSlider
_controlToolBar->addSeparator();
@@ -327,11 +280,11 @@
//FIXME don't know why, seekToolBar does not get enabled afterwards
//_seekToolBar->setEnabled(enabled);

- ActionCollection::action("MainWindow.PreviousTrack")->setEnabled(enabled);
- ActionCollection::action("MainWindow.PlayPause")->setEnabled(enabled);
- ActionCollection::action("MainWindow.Stop")->setEnabled(enabled);
- ActionCollection::action("MainWindow.NextTrack")->setEnabled(enabled);
- ActionCollection::action("MainWindow.FullScreen")->setEnabled(enabled);
+
ActionCollection::action("CommonActions.PreviousTrack")->setEnabled(enabled);
+ ActionCollection::action("CommonActions.PlayPause")->setEnabled(enabled);
+ ActionCollection::action("CommonActions.Stop")->setEnabled(enabled);
+ ActionCollection::action("CommonActions.NextTrack")->setEnabled(enabled);
+ ActionCollection::action("CommonActions.FullScreen")->setEnabled(enabled);
}

void PlayToolBar::currentMediaObjectChanged(Phonon::MediaObject *
mediaObject) {
@@ -345,11 +298,6 @@
//Update current MediaObject state
stateChanged(mediaObject->state());

- //Actions connect
- disconnect(ActionCollection::action("MainWindow.Stop"), 0, 0, 0);
- connect(ActionCollection::action("MainWindow.Stop"), SIGNAL(triggered()),
- mediaObject, SLOT(stop()));
-
_seekSlider->setMediaObject(mediaObject);

Phonon::AudioOutput * audioOutput = quarkPlayer().currentAudioOutput();
=======================================
--- /trunk/quarkplayer-plugins/PlayToolBar/PlayToolBar.h Fri Aug 13
02:18:04 2010
+++ /trunk/quarkplayer-plugins/PlayToolBar/PlayToolBar.h Sun Feb 20
13:15:39 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
@@ -25,6 +25,8 @@

#include <phonon/phononnamespace.h>

+class IMainWindow;
+
namespace Phonon {
class SeekSlider;
class VolumeSlider;
@@ -41,7 +43,7 @@
Q_OBJECT
public:

- PlayToolBar(QuarkPlayer & quarkPlayer, const QUuid & uuid);
+ PlayToolBar(QuarkPlayer & quarkPlayer, const QUuid & uuid, IMainWindow *
mainWindow);

~PlayToolBar();

=======================================
--- /trunk/quarkplayer-plugins/Playlist/PlaylistWidget.cpp Wed Feb 16
06:13:11 2011
+++ /trunk/quarkplayer-plugins/Playlist/PlaylistWidget.cpp Sun Feb 20
13:15:39 2011
@@ -390,11 +390,11 @@
}

//Next track
- connect(ActionCollection::action("MainWindow.NextTrack"),
SIGNAL(triggered()),
+ connect(ActionCollection::action("CommonActions.NextTrack"),
SIGNAL(triggered()),
_playlistFilter, SLOT(playNextTrack()));

//Previous track
- connect(ActionCollection::action("MainWindow.PreviousTrack"),
SIGNAL(triggered()),
+ connect(ActionCollection::action("CommonActions.PreviousTrack"),
SIGNAL(triggered()),
_playlistFilter, SLOT(playPreviousTrack()));
}

@@ -405,10 +405,10 @@
}

//Next track
-
ActionCollection::action("MainWindow.NextTrack")->disconnect(_playlistFilter);
+
ActionCollection::action("CommonActions.NextTrack")->disconnect(_playlistFilter);

//Previous track
-
ActionCollection::action("MainWindow.PreviousTrack")->disconnect(_playlistFilter);
+
ActionCollection::action("CommonActions.PreviousTrack")->disconnect(_playlistFilter);
}

void PlaylistWidget::createNewPlaylistWidget() {
=======================================
--- /trunk/quarkplayer-plugins/QuickSettings/QuickSettingsWindow.cpp Fri
Aug 13 02:18:04 2010
+++ /trunk/quarkplayer-plugins/QuickSettings/QuickSettingsWindow.cpp Sun
Feb 20 13:15:39 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
@@ -67,7 +67,7 @@
_nextEffect = NULL;
_ui = NULL;

- connect(ActionCollection::action("MainWindow.Equalizer"),
SIGNAL(triggered()), SLOT(show()));
+ connect(ActionCollection::action("CommonActions.Equalizer"),
SIGNAL(triggered()), SLOT(show()));
}

QuickSettingsWindow::~QuickSettingsWindow() {
=======================================
--- /trunk/quarkplayer-plugins/StatusBar/StatusBar.cpp Fri Feb 11 10:48:23
2011
+++ /trunk/quarkplayer-plugins/StatusBar/StatusBar.cpp Sun Feb 20 13:15:39
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
@@ -68,15 +68,9 @@

setSizeGripEnabled(false);

-#ifdef Q_WS_MAC
- //Background color is dark-grey and text color is black
- _backgroundColor = QColor(150, 150, 150);
- _textColor = QColor(0, 0, 0);
-#else
//Background color is black and text color is white
_backgroundColor = QColor(0, 0, 0);
_textColor = QColor(255, 255, 255);
-#endif //Q_WS_MAC
setStyleSheet(QString("background-color: %1; color: %2;")
.arg(_backgroundColor.name())
.arg(_textColor.name()));
@@ -102,19 +96,22 @@

void StatusBar::tick(qint64 time) {
QString timeText;
- qint64 totalTime = quarkPlayer().currentMediaObject()->totalTime();
- TimeDisplayMode timeDisplayMode = static_cast<TimeDisplayMode>(
- Config::instance().value(STATUSBAR_TIME_DIPLAY_MODE_KEY).toInt());
-
- switch (timeDisplayMode) {
- case TimeDisplayModeElapsed:
- timeText = TkTime::convertMilliseconds(time, totalTime);
- break;
- case TimeDisplayModeRemaining:
- timeText = "- " + TkTime::convertMilliseconds(totalTime - time,
totalTime);
- break;
- default:
- StatusBarCritical() << "Unknown TimeDisplayMode:" << timeDisplayMode;
+
+ if (time > 0) {
+ qint64 totalTime = quarkPlayer().currentMediaObject()->totalTime();
+ TimeDisplayMode timeDisplayMode = static_cast<TimeDisplayMode>(
+ Config::instance().value(STATUSBAR_TIME_DIPLAY_MODE_KEY).toInt());
+
+ switch (timeDisplayMode) {
+ case TimeDisplayModeElapsed:
+ timeText = TkTime::convertMilliseconds(time, totalTime);
+ break;
+ case TimeDisplayModeRemaining:
+ timeText = "- " + TkTime::convertMilliseconds(totalTime - time,
totalTime);
+ break;
+ default:
+ StatusBarCritical() << "Unknown TimeDisplayMode:" << timeDisplayMode;
+ }
}

_timeLabel->setText(timeText);
@@ -170,7 +167,7 @@

case Phonon::StoppedState:
showMessage(tr("Stopped"));
- //Re-initializes the time label to "00:00 / total time"
+ //Re-initializes the time label
tick(0);
break;

@@ -227,11 +224,7 @@
stateChanged(mediaObject->state());

//Resets current and total time display
- int time = mediaObject->currentTime();
- if (time > 0) {
- tick(time);
- }
- ///
+ tick(mediaObject->currentTime());

connect(mediaObject, SIGNAL(tick(qint64)), SLOT(tick(qint64)));
connect(mediaObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)),
=======================================
--- /trunk/quarkplayer-plugins/StatusBar/StatusBar.h Fri Feb 11 10:48:23
2011
+++ /trunk/quarkplayer-plugins/StatusBar/StatusBar.h Sun Feb 20 13:15:39
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
=======================================
--- /trunk/quarkplayer-plugins/VideoWidget/BackgroundLogoWidget.ui Wed Apr
15 06:32:58 2009
+++ /trunk/quarkplayer-plugins/VideoWidget/BackgroundLogoWidget.ui Sun Feb
20 13:15:39 2011
@@ -1,30 +1,31 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>BackgroundLogoWidget</class>
- <widget class="QWidget" name="BackgroundLogoWidget" >
- <property name="geometry" >
+ <widget class="QWidget" name="BackgroundLogoWidget">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>281</width>
- <height>108</height>
+ <height>114</height>
</rect>
</property>
- <property name="styleSheet" >
- <string notr="true" >background-color: rgb(0, 0, 0);</string>
+ <property name="styleSheet">
+ <string notr="true">background-color: rgb(0, 0, 0);</string>
</property>
- <layout class="QGridLayout" >
- <item row="0" column="0" colspan="2" >
- <widget class="QLabel" name="logoLabel" >
- <property name="maximumSize" >
+ <layout class="QGridLayout">
+ <item row="0" column="0" colspan="2">
+ <widget class="QLabel" name="logoLabel">
+ <property name="maximumSize">
<size>
<width>90</width>
<height>90</height>
</size>
</property>
- <property name="pixmap" >
- <pixmap resource="../../quarkplayer-app/quarkplayer.qrc"
>:/icons/quarkplayer-128x128.png</pixmap>
+ <property name="pixmap">
+ <pixmap
resource="../../quarkplayer-app/quarkplayer.qrc">:/icons/quarkplayer-128x128.png</pixmap>
</property>
- <property name="scaledContents" >
+ <property name="scaledContents">
<bool>true</bool>
</property>
</widget>
@@ -32,7 +33,7 @@
</layout>
</widget>
<resources>
- <include location="../../quarkplayer-app/quarkplayer.qrc" />
+ <include location="../../quarkplayer-app/quarkplayer.qrc"/>
</resources>
<connections/>
</ui>
=======================================
--- /trunk/quarkplayer-plugins/VideoWidget/MediaDataWidget.cpp Sun Nov 21
14:39:28 2010
+++ /trunk/quarkplayer-plugins/VideoWidget/MediaDataWidget.cpp Sun Feb 20
13:15:39 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
@@ -21,7 +21,6 @@
#include "VideoWidgetLogger.h"

#include <quarkplayer/config/Config.h>
-#include <quarkplayer-plugins/MainWindow/MainWindow.h>

#include <MediaInfoWindow/MediaInfoWindow.h>
#include <MediaInfoWindow/MediaInfoWidget.h>
@@ -45,9 +44,10 @@
//Your Secret Access Key:
static const char * AMAZON_WEB_SERVICE_SECRET_KEY
= "RfD3RoKwZ+5GpJa/i03jhoiDZM26OAc+TPpXMps0";

-MediaDataWidget::MediaDataWidget(QWidget * parent)
+MediaDataWidget::MediaDataWidget(QStatusBar * statusBar, QWidget * parent)
: MediaInfoWidget(parent) {

+ _statusBar = statusBar;
_mediaInfoFetcher = NULL;
_amazonCoverArt = NULL;

@@ -173,13 +173,15 @@
return;
}

- showCoverArtStatusMessage(tr("Amazon cover art error: ") +
ContentFetcher::errorString(error) + " " + url.toString());
+ showCoverArtStatusMessage(tr("Amazon cover art error: ")
+ + ContentFetcher::errorString(error)
+ + " " + url.toString()
+ );
}
}

void MediaDataWidget::showCoverArtStatusMessage(const QString & message)
const {
- MainWindow * mainWindow = MainWindowFactory::mainWindow();
- if (mainWindow && mainWindow->statusBar()) {
- mainWindow->statusBar()->showMessage(message);
+ if (_statusBar) {
+ _statusBar->showMessage(message);
}
}
=======================================
--- /trunk/quarkplayer-plugins/VideoWidget/MediaDataWidget.h Fri Aug 13
02:18:04 2010
+++ /trunk/quarkplayer-plugins/VideoWidget/MediaDataWidget.h Sun Feb 20
13:15:39 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
@@ -40,6 +40,7 @@
class QToolButton;
class QFile;
class QTimer;
+class QStatusBar;

/**
* Shows the media data inside a widget.
@@ -50,7 +51,7 @@
Q_OBJECT
public:

- MediaDataWidget(QWidget * parent);
+ MediaDataWidget(QStatusBar * statusBar, QWidget * parent);

~MediaDataWidget();

@@ -73,6 +74,8 @@
/** Shows a status message about the cover art downloading. */
void showCoverArtStatusMessage(const QString & message) const;

+ QStatusBar * _statusBar;
+
MediaInfoWindow * _mediaInfoWindow;

MediaInfoFetcher * _mediaInfoFetcher;
=======================================
--- /trunk/quarkplayer-plugins/VideoWidget/MyVideoWidget.cpp Wed Aug 25
15:38:42 2010
+++ /trunk/quarkplayer-plugins/VideoWidget/MyVideoWidget.cpp Sun Feb 20
13:15:39 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,10 +31,12 @@

#include <QtCore/QTimerEvent>

-MyVideoWidget::MyVideoWidget(QDockWidget * dockWidget, MainWindow *
mainWindow)
+MyVideoWidget::MyVideoWidget(QDockWidget * dockWidget, IMainWindow *
mainWindow)
: Phonon::VideoWidget(NULL) {

+ Q_ASSERT(dockWidget);
_dockWidget = dockWidget;
+ Q_ASSERT(mainWindow);
_mainWindow = mainWindow;

_playToolBar = _mainWindow->playToolBar();
@@ -48,6 +50,19 @@
//Lazy initialization
_widgetOverFullScreen = NULL;

+ connect(ActionCollection::action("CommonActions.FullScreen"),
SIGNAL(toggled(bool)),
+ SLOT(setFullScreenInternal(bool)));
+
+ //We have to add the QAction to the widget otherwise it won't work
+ //From Qt doc:
+ //Note that an action must be added to a widget before it can be used;
+ //this is also true when the shortcut should be global
+ //(i.e., Qt::ApplicationShortcut as Qt::ShortcutContext).
+ addAction(ActionCollection::action("CommonActions.FullScreenExit"));
+
+ connect(ActionCollection::action("CommonActions.FullScreenExit"),
SIGNAL(triggered()),
+ SLOT(triggerFullScreenExitAction()));
+
if (_playToolBar) {
playToolBarAdded(_playToolBar);
}
@@ -101,17 +116,17 @@
void MyVideoWidget::createContextMenu() {
_contextMenu = new QMenu(this);

-
_contextMenu->addAction(ActionCollection::action("MainWindow.PreviousTrack"));
- _contextMenu->addAction(ActionCollection::action("MainWindow.PlayPause"));
- _contextMenu->addAction(ActionCollection::action("MainWindow.Stop"));
- _contextMenu->addAction(ActionCollection::action("MainWindow.NextTrack"));
-
_contextMenu->addAction(ActionCollection::action("MainWindow.FullScreen"));
+
_contextMenu->addAction(ActionCollection::action("CommonActions.PreviousTrack"));
+
_contextMenu->addAction(ActionCollection::action("CommonActions.PlayPause"));
+ _contextMenu->addAction(ActionCollection::action("CommonActions.Stop"));
+
_contextMenu->addAction(ActionCollection::action("CommonActions.NextTrack"));
+
_contextMenu->addAction(ActionCollection::action("CommonActions.FullScreen"));

_contextMenu->addSeparator();

- _contextMenu->addAction(ActionCollection::action("MainWindow.OpenFile"));
- _contextMenu->addAction(ActionCollection::action("MainWindow.OpenDVD"));
- _contextMenu->addAction(ActionCollection::action("MainWindow.OpenURL"));
+
_contextMenu->addAction(ActionCollection::action("CommonActions.OpenFile"));
+
_contextMenu->addAction(ActionCollection::action("CommonActions.OpenURL"));
+
_contextMenu->addAction(ActionCollection::action("CommonActions.OpenDVD"));

_contextMenu->addSeparator();

@@ -159,7 +174,7 @@

_contextMenu->addSeparator();

- _contextMenu->addAction(ActionCollection::action("MainWindow.Quit"));
+ _contextMenu->addAction(ActionCollection::action("CommonActions.Quit"));
}

void MyVideoWidget::showContextMenu(const QPoint & pos) {
@@ -191,7 +206,7 @@
}

void MyVideoWidget::triggerFullScreenExitAction() {
- ActionCollection::action("MainWindow.FullScreen")->setChecked(false);
+ ActionCollection::action("CommonActions.FullScreen")->setChecked(false);
}

void MyVideoWidget::enterFullScreenInternal() {
@@ -201,6 +216,8 @@

//Going fullscreen

+ VideoWidgetDebug() << "Enter fullscreen";
+
//Disable screensaver
ScreenSaver::disable();

@@ -232,6 +249,8 @@
if (!isFullScreen()) {
return;
}
+
+ VideoWidgetDebug() << "Exit fullscreen";

//Restore screensaver
ScreenSaver::restore();
@@ -239,7 +258,11 @@
exitFullScreen();
_dockWidget->setWidget(this);

- addPlayToolBarToMainWindow();
+ //Re-initializes the toolbars
+ playToolBarAdded(_playToolBar);
+ statusBarAdded(_statusBar);
+ ///
+
_widgetOverFullScreen->hide();
}

@@ -254,10 +277,11 @@
void MyVideoWidget::mouseDoubleClickEvent(QMouseEvent * event) {
if (event->button() == Qt::LeftButton) {
event->accept();
- ActionCollection::action("MainWindow.FullScreen")->toggle();
+ ActionCollection::action("CommonActions.FullScreen")->toggle();
} else {
event->ignore();
}
+ return Phonon::VideoWidget::mouseDoubleClickEvent(event);
}

void MyVideoWidget::mouseMoveEvent(QMouseEvent * event) {
@@ -267,6 +291,7 @@
_timer.start(1000, this);
}
unsetCursor();
+ return Phonon::VideoWidget::mouseMoveEvent(event);
}

bool MyVideoWidget::event(QEvent * event) {
@@ -368,42 +393,16 @@
}

void MyVideoWidget::playToolBarAdded(QToolBar * playToolBar) {
- VideoWidgetDebug();
-
_playToolBar = playToolBar;
-
- //We do this in order to add the play toolbar to the mainwindow
- //when starting
- addPlayToolBarToMainWindow();
-
- connect(ActionCollection::action("MainWindow.FullScreen"),
SIGNAL(toggled(bool)),
- SLOT(setFullScreenInternal(bool)));
-
-
- //We have to add the QAction to the widget otherwise it won't work
- //From Qt doc:
- //Note that an action must be added to a widget before it can be used;
- //this is also true when the shortcut should be global
- //(i.e., Qt::ApplicationShortcut as Qt::ShortcutContext).
- addAction(ActionCollection::action("MainWindow.FullScreenExit"));
-
- connect(ActionCollection::action("MainWindow.FullScreenExit"),
SIGNAL(triggered()),
- SLOT(triggerFullScreenExitAction()));
-}
-
-void MyVideoWidget::statusBarAdded(QStatusBar * statusBar) {
- _statusBar = statusBar;
-}
-
-void MyVideoWidget::addPlayToolBarToMainWindow() {
- VideoWidgetDebug() << "_playToolBar:" << _playToolBar;
- VideoWidgetDebug() << "_statusBar:" << _statusBar;
-
if (_playToolBar) {
_mainWindow->addToolBar(Qt::BottomToolBarArea, _playToolBar);
}
-
+}
+
+void MyVideoWidget::statusBarAdded(QStatusBar * statusBar) {
+ _statusBar = statusBar;
if (_statusBar) {
_mainWindow->setStatusBar(_statusBar);
}
}
+
=======================================
--- /trunk/quarkplayer-plugins/VideoWidget/MyVideoWidget.h Fri Aug 13
02:18:04 2010
+++ /trunk/quarkplayer-plugins/VideoWidget/MyVideoWidget.h Sun Feb 20
13:15:39 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
@@ -26,7 +26,7 @@

#include <QtCore/QBasicTimer>

-class MainWindow;
+class IMainWindow;

namespace Phonon {
class MediaObject;
@@ -50,7 +50,7 @@
Q_OBJECT
public:

- MyVideoWidget(QDockWidget * dockWidget, MainWindow * mainWindow);
+ MyVideoWidget(QDockWidget * dockWidget, IMainWindow * mainWindow);

~MyVideoWidget();

@@ -119,8 +119,6 @@

static void showWidgetOver(QWidget * widgetOver, QWidget * widgetUnder);

- void addPlayToolBarToMainWindow();
-
/**
* Creates the context menu of the video.
*
@@ -133,7 +131,7 @@

QDockWidget * _dockWidget;

- MainWindow * _mainWindow;
+ IMainWindow * _mainWindow;

QToolBar * _playToolBar;

=======================================
--- /trunk/quarkplayer-plugins/VideoWidget/VideoWidgetPlugin.cpp Wed Feb 9
08:27:27 2011
+++ /trunk/quarkplayer-plugins/VideoWidget/VideoWidgetPlugin.cpp Sun Feb 20
13:15:39 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
@@ -49,13 +49,17 @@
}

PluginInterface * VideoWidgetPluginFactory::create(QuarkPlayer &
quarkPlayer, const QUuid & uuid) const {
- return new VideoWidgetPlugin(quarkPlayer, uuid);
+ return new VideoWidgetPlugin(quarkPlayer, uuid,
MainWindowFactory::mainWindow());
}

-VideoWidgetPlugin::VideoWidgetPlugin(QuarkPlayer & quarkPlayer, const
QUuid & uuid)
- : QObject(MainWindowFactory::mainWindow()),
+VideoWidgetPlugin::VideoWidgetPlugin(QuarkPlayer & quarkPlayer, const
QUuid & uuid,
+ IMainWindow * mainWindow)
+ : QObject(mainWindow),
PluginInterface(quarkPlayer, uuid) {

+ Q_ASSERT(mainWindow);
+ _mainWindow = mainWindow;
+
connect(&quarkPlayer, SIGNAL(mediaObjectAdded(Phonon::MediaObject *)),
SLOT(mediaObjectAdded(Phonon::MediaObject *)));

@@ -71,9 +75,9 @@
it.next();

VideoContainer * container = it.value();
-
MainWindowFactory::mainWindow()->removeDockWidget(container->videoDockWidget);
- }
- MainWindowFactory::mainWindow()->resetVideoDockWidget();
+ _mainWindow->removeDockWidget(container->videoDockWidget);
+ }
+ _mainWindow->resetVideoDockWidget();
}

void VideoWidgetPlugin::stateChanged(Phonon::State newState, Phonon::State
oldState) {
@@ -158,16 +162,16 @@
///

//mediaDataWidget
- container->mediaDataWidget = new MediaDataWidget(NULL);
+ container->mediaDataWidget = new
MediaDataWidget(_mainWindow->statusBar(), NULL);

//videoWidget
- container->videoWidget = new MyVideoWidget(container->videoDockWidget,
MainWindowFactory::mainWindow());
+ container->videoWidget = new MyVideoWidget(container->videoDockWidget,
_mainWindow);
Phonon::createPath(mediaObject, container->videoWidget);

_mediaObjectHash[mediaObject] = container;

//Add to the main window
-
MainWindowFactory::mainWindow()->addVideoDockWidget(container->videoDockWidget);
+ _mainWindow->addVideoDockWidget(container->videoDockWidget);

//Stop the current media object
container->videoDockWidget->installEventFilter(new
CloseEventFilter(mediaObject, SLOT(stop())));
=======================================
--- /trunk/quarkplayer-plugins/VideoWidget/VideoWidgetPlugin.h Wed Feb 9
08:27:27 2011
+++ /trunk/quarkplayer-plugins/VideoWidget/VideoWidgetPlugin.h Sun Feb 20
13:15:39 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
@@ -28,7 +28,7 @@

class MyVideoWidget;
class MediaDataWidget;
-
+class IMainWindow;
class QuarkPlayer;

namespace Phonon {
@@ -49,7 +49,8 @@
Q_OBJECT
public:

- VideoWidgetPlugin(QuarkPlayer & quarkPlayer, const QUuid & uuid);
+ VideoWidgetPlugin(QuarkPlayer & quarkPlayer, const QUuid & uuid,
+ IMainWindow * mainWindow);

~VideoWidgetPlugin();

@@ -111,6 +112,8 @@
VideoContainer * findMatchingVideoContainer(QDockWidget * dockWidget);

QHash<Phonon::MediaObject *, VideoContainer *> _mediaObjectHash;
+
+ IMainWindow * _mainWindow;
};

#include <quarkplayer/PluginFactory.h>
=======================================
--- /trunk/tests/libs/Logger/CMakeLists.txt Fri Jan 21 09:19:32 2011
+++ /trunk/tests/libs/Logger/CMakeLists.txt Sun Feb 20 13:15:39 2011
@@ -1,6 +1,6 @@
project(LoggerTests)

-macro(add_unit_test name)
+macro(add_my_test name)
set(SRCS ${ARGN})

add_executable(${name} ${SRCS})
@@ -14,30 +14,30 @@
${QT_QTTEST_LIBRARY}
)
install(TARGETS ${name} ${INSTALL_TARGETS_DEFAULT_ARGS})
-endmacro(add_unit_test name)
+endmacro(add_my_test name)


set(LogMessageTest_SRCS LogMessageTest.cpp)
qt4_wrap_cpp(LogMessageTest_SRCS LogMessageTest.h)
-add_unit_test(LogMessageTest ${LogMessageTest_SRCS})
+add_my_test(LogMessageTest ${LogMessageTest_SRCS})


set(LogModelTest_SRCS LogModelTest.cpp)
qt4_wrap_cpp(LogModelTest_SRCS LogModelTest.h)
qt4_add_resources(LogModelTest_SRCS LogModelTest.qrc)
-add_unit_test(LogModelTest ${LogModelTest_SRCS})
+add_my_test(LogModelTest ${LogModelTest_SRCS})


set(LoggerTest_SRCS LoggerTest.cpp)
qt4_wrap_cpp(LoggerTest_SRCS LoggerTest.h)
-add_unit_test(LoggerTest ${LoggerTest_SRCS})
+add_my_test(LoggerTest ${LoggerTest_SRCS})


set(LogWindowTest_SRCS LogWindowTest.cpp)
qt4_wrap_cpp(LogWindowTest_SRCS LogWindowTest.h)
-add_unit_test(LogWindowTest ${LogWindowTest_SRCS})
+add_my_test(LogWindowTest ${LogWindowTest_SRCS})


set(ConsoleOutputTest_SRCS ConsoleOutputTest.cpp)
qt4_wrap_cpp(ConsoleOutputTest_SRCS ConsoleOutputTest.h)
-add_unit_test(ConsoleOutputTest ${ConsoleOutputTest_SRCS})
+add_my_test(ConsoleOutputTest ${ConsoleOutputTest_SRCS})
=======================================
--- /trunk/tests/libs/TkUtil/CMakeLists.txt Fri Jan 21 09:19:32 2011
+++ /trunk/tests/libs/TkUtil/CMakeLists.txt Sun Feb 20 13:15:39 2011
@@ -1,6 +1,6 @@
project(TkUtilTests)

-macro(add_unit_test name)
+macro(add_my_test name)
set(SRCS ${ARGN})

add_executable(${name} ${SRCS})
@@ -14,15 +14,15 @@
${QT_QTTEST_LIBRARY}
)
install(TARGETS ${name} ${INSTALL_TARGETS_DEFAULT_ARGS})
-endmacro(add_unit_test name)
+endmacro(add_my_test name)


set(SearchLineEditTest_SRCS SearchLineEditTest.cpp)
qt4_wrap_cpp(SearchLineEditTest_SRCS SearchLineEditTest.h)
qt4_add_resources(SearchLineEditTest_SRCS SearchLineEditTest.qrc)
-add_unit_test(SearchLineEditTest ${SearchLineEditTest_SRCS})
+add_my_test(SearchLineEditTest ${SearchLineEditTest_SRCS})


set(FindFilesTest_SRCS FindFilesTest.cpp)
qt4_wrap_cpp(FindFilesTest_SRCS FindFilesTest.h)
-add_unit_test(FindFilesTest ${FindFilesTest_SRCS})
+add_my_test(FindFilesTest ${FindFilesTest_SRCS})
=======================================
--- /trunk/tests/quarkplayer-plugins/CMakeLists.txt Mon Sep 13 09:27:15 2010
+++ /trunk/tests/quarkplayer-plugins/CMakeLists.txt Sun Feb 20 13:15:39 2011
@@ -1,2 +1,3 @@
add_subdirectory(FindSubtitles)
#add_subdirectory(MainWindow)
+add_subdirectory(VideoWidget)

Reply all
Reply to author
Forward
0 new messages