sketchy workaround for access to the PlayController (#1072)

...which itself is obsolete and needs to be redesigned from scratch.
For now we create a local instance of this obsolete PlaybackController
in each viewer panel and we use a static accessor function to just some
instance. Which would break if we start playback with multiple viewer
panels. But we can't anyway, since the Player itself is also a broken
leftover from an obsoleted design study from the early days.

so why care...
This commit is contained in:
Fischlurch 2017-01-27 23:56:52 +01:00
parent 6aec1adb38
commit 4e1641f192
9 changed files with 68 additions and 19 deletions

View file

@ -28,15 +28,36 @@
namespace gui {
namespace controller {
namespace ctrl {
namespace error = lumiera::error;
PlaybackController::PlaybackController()
: playing_(false)
, viewerHandle_(0)
{ }
{
instance = this; ////////////////////////////////////////////////////////TICKET #1067 shitty workaround to allow disentangling of top-level
}
PlaybackController::~PlaybackController()
{
instance = nullptr; ////////////////////////////////////////////////////////TICKET #1067 shitty workaround to allow disentangling of top-level
}
PlaybackController* PlaybackController::instance; ////////////////////////////////////////////////////////TICKET #1067 shitty workaround to allow disentangling of top-level
PlaybackController&
PlaybackController::get() ////////////////////////////////////////////////////////TICKET #1067 shitty workaround to allow disentangling of top-level
{
if (not instance)
throw error::Logic ("GTK UI is not in running state"
, error::LUMIERA_ERROR_LIFECYCLE);
return *instance;
}
void
PlaybackController::play()

View file

@ -22,7 +22,17 @@
/** @file controller/playback-controller.hpp
** This file contains the definition of the playback controller object
** This file contains the definition of the playback controller object.
**
** @deprecated this represents an early design of playback and will be reworked
** @remarks what we actually need is a PlaybackController as a shell or proxy
** to maintain a flexible link to ongoing processes in the core. But note,
** this is also related to the Displayer service, which needs to be offered
** by the UI, so we create a mutual dependency here, and there is not much
** that can be done about this.
** @warning as a temporary solution, 1/2017 the playback controller was moved
** into the viewer panel. Of course it can not work that way....
** @todo create a durable PlaybacController design //////////////////////////////////////////////////////TICKET #1072
*/
@ -37,10 +47,11 @@
namespace gui {
namespace controller {
namespace ctrl {
/** @deprecated we need a durable design for the playback process */
class PlaybackController
: boost::noncopyable
{
@ -51,9 +62,14 @@ namespace controller {
LumieraDisplaySlot viewerHandle_;
static PlaybackController* instance; ///////////////////////////////////////////////////////////////////TICKET #1067 shitty workaround to allow disentangling of top-level
public:
PlaybackController();
~PlaybackController();
static PlaybackController& get(); ///////////////////////////////////////////////////////////////////TICKET #1067 shitty workaround to allow disentangling of top-level
void play();
void pause();
@ -70,6 +86,6 @@ namespace controller {
};
}} // namespace gui::controller
}} // namespace gui::ctrl
#endif // PLAYBACK_CONTROLLER_HPP

View file

@ -109,7 +109,7 @@ namespace gui {
WindowList&
GtkLumiera::windowManager()
GtkLumiera::windowManager() /////////////////////////////////////////TICKET #1048 : last Blocker is Actions::onMenu_window_new_window()
{
if (not windowManagerInstance_)
throw error::Logic ("GTK UI is not in running state"

View file

@ -24,8 +24,8 @@
#include "gui/gtk-lumiera.hpp"
#include "gui/panel/timeline-panel-obsolete.hpp"
#include "gui/widget/timeline/timeline-zoom-scale.hpp"
#include "gui/workspace/workspace-window.hpp"
#include "gui/ctrl/playback-controller.hpp"
#include "gui/model/project.hpp"
#include "gui/ui-bus.hpp"
@ -39,6 +39,8 @@ using namespace gui::widget;
using namespace gui::widget::timeline;
using namespace gui::model;
using gui::controller::Controller;
using gui::ctrl::PlaybackController;
using std::shared_ptr;
using std::weak_ptr;
using util::contains;
@ -175,7 +177,7 @@ namespace panel {
void
TimelinePanelObsolete::on_stop()
{
getController().get_playback_controller().stop();
PlaybackController::get().stop();
updatePlaybackButtons();
}
@ -346,19 +348,19 @@ namespace panel {
void
TimelinePanelObsolete::play()
{
getController().get_playback_controller().play();
PlaybackController::get().play();
}
void
TimelinePanelObsolete::pause()
{
getController().get_playback_controller().pause();
PlaybackController::get().pause();
}
bool
TimelinePanelObsolete::is_playing()
{
return getController().get_playback_controller().is_playing();
return PlaybackController::get().is_playing();
}
void

View file

@ -25,7 +25,6 @@
#include "gui/workspace/workspace-window.hpp"
#include "gui/ui-bus.hpp" ///////////////////////////////////TODO why are we forced to include this after workspace-window.hpp ?? Ambiguity between std::ref and boost::reference_wrapper
#include "gui/ctrl/playback-controller.hpp"
#include "gui/display-service.hpp"
@ -39,14 +38,13 @@ namespace panel {
ViewerPanel::ViewerPanel (workspace::PanelManager& panelManager
,Gdl::DockItem& dockItem)
: Panel(panelManager, dockItem, getTitle(), getStockID())
, playbackController_{}
{
//----- Pack in the Widgets -----//
pack_start(display_, PACK_EXPAND_WIDGET);
PlaybackController& playback(getController().get_playback_controller());
FrameDestination outputDestination (sigc::mem_fun(this, &ViewerPanel::on_frame));
playback.useDisplay (DisplayService::setUp (outputDestination));
playbackController_.useDisplay (DisplayService::setUp (outputDestination));
}
const char*

View file

@ -31,6 +31,7 @@
#include "gui/panel/panel.hpp"
#include "gui/widget/video-display-widget.hpp"
#include "gui/ctrl/playback-controller.hpp"
namespace gui {
namespace panel{
@ -41,6 +42,8 @@ namespace panel{
class ViewerPanel
: public Panel
{
ctrl::PlaybackController playbackController_;
public:
ViewerPanel (workspace::PanelManager&, Gdl::DockItem&);

View file

@ -51,7 +51,7 @@ namespace controller {
PlaybackController& Controller::get_playback_controller()
ctrl::PlaybackController& Controller::get_playback_controller()
{
return playback_;
}

View file

@ -126,12 +126,12 @@ namespace gui {
class Controller
{
model::Project& project_;
PlaybackController playback_;
ctrl::PlaybackController playback_;
public:
Controller (model::Project&);
PlaybackController& get_playback_controller();
ctrl::PlaybackController& get_playback_controller();
};
}// namespace gui::controller

View file

@ -1664,6 +1664,14 @@
<icon BUILTIN="flag-yellow"/>
<node CREATED="1485550968230" ID="ID_164246989" MODIFIED="1485550989113" TEXT="GtkLumiera darf kein Singleton mehr sein">
<linktarget COLOR="#80b3ef" DESTINATION="ID_164246989" ENDARROW="Default" ENDINCLINATION="-42;-74;" ID="Arrow_ID_401425747" SOURCE="ID_1145950660" STARTARROW="None" STARTINCLINATION="348;19;"/>
<node CREATED="1485561982971" ID="ID_287757293" MODIFIED="1485561988374" TEXT="Blocker entfernen"/>
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1485561988922" ID="ID_1690912259" MODIFIED="1485562014648" TEXT="letzter Blocker: Actions::onMenu_window_new_window()">
<icon BUILTIN="flag-pink"/>
</node>
<node CREATED="1485562029644" ID="ID_1022779645" MODIFIED="1485562063560" TEXT="wieder das Problem mit dem BInden der Actions">
<arrowlink DESTINATION="ID_530209145" ENDARROW="Default" ENDINCLINATION="-17;-195;" ID="Arrow_ID_626063593" STARTARROW="None" STARTINCLINATION="9;270;"/>
<icon BUILTIN="messagebox_warning"/>
</node>
</node>
<node CREATED="1485550992299" ID="ID_1685125156" MODIFIED="1485550997398" TEXT="es blocken">
<node CREATED="1485550999762" ID="ID_249139218" MODIFIED="1485551006493" TEXT="WindowList"/>
@ -1728,7 +1736,8 @@
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1485549716225" ID="ID_1584608575" MODIFIED="1485549726513" TEXT="passende Repr&#xe4;sentation hierf&#xfc;r finden">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1485549049388" ID="ID_530209145" MODIFIED="1485549070887" TEXT="Problem: Aktionen binden">
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1485549049388" ID="ID_530209145" MODIFIED="1485562057742" TEXT="Problem: Aktionen binden">
<linktarget COLOR="#a9b4c1" DESTINATION="ID_530209145" ENDARROW="Default" ENDINCLINATION="-17;-195;" ID="Arrow_ID_626063593" SOURCE="ID_1022779645" STARTARROW="None" STARTINCLINATION="9;270;"/>
<icon BUILTIN="messagebox_warning"/>
<node CREATED="1485549075929" ID="ID_1887127861" MODIFIED="1485549081236" TEXT="spezifische Aktionen">
<node CREATED="1485549803366" ID="ID_1969698948" MODIFIED="1485549809977" TEXT="Fenster-Bindung">