CmdAccess: **Big Bang** wire the first real command from UI down into the Session

...just the implementation within SessManagerImpl is not yet there P-)
So everything remains as defunct as before, but at least: "yes we can"
This commit is contained in:
Fischlurch 2017-04-17 21:54:36 +02:00
parent 6a80053395
commit 4e7c64bf39
6 changed files with 39 additions and 15 deletions

View file

@ -38,7 +38,10 @@
#include "gui/setting/asset-controller.hpp"
#include "gui/timeline/timeline-controller.hpp"
#include "proc/mobject/session/root.hpp"
#include "proc/cmd.hpp"
#include "backend/real-clock.hpp"
#include "lib/diff/tree-mutator.hpp"
#include "lib/format-obj.hpp"
//#include "gui/ui-bus.hpp"
//#include "lib/util.hpp"
@ -49,12 +52,14 @@
//using std::list;
//using std::shared_ptr;
using lib::diff::TreeMutator;
using util::toString;
namespace gui {
namespace interact {
namespace session = proc::mobject::session;
namespace cmd = proc::cmd;
using ctrl::GlobalCtx;
using ctrl::UiState;
@ -118,7 +123,8 @@ namespace interact {
void
InteractionDirector::saveSnapshot()
{
UNIMPLEMENTED ("issue save snapshot command towards current session");
string snapshotID{"snap-" + toString(backend::RealClock::now())};
invoke (cmd::session_saveSnapshot, snapshotID);
}

View file

@ -59,11 +59,9 @@ namespace cmd {
//using std::shared_ptr;
/* ========= global actions ========= */
/**
* @todo wtf
*/
extern CommandSetup session_saveSnapshot;

View file

@ -36,6 +36,7 @@
#include "proc/cmd.hpp"
#include "proc/control/command-def.hpp"
#include "proc/mobject/session.hpp"
//#include "lib/symbol.hpp"
//#include "lib/format-string.hpp"
@ -50,6 +51,7 @@ namespace proc {
namespace cmd {
namespace error = lumiera::error;
using mobject::Session;
namespace { // implementation helper...
}//(End) implementation helper
@ -57,7 +59,24 @@ namespace cmd {
/** storage for.... */
/** store a snapshot of current session actions and state and UI state.
* @param snapshotID a marker to tag the snapshot
*/
COMMAND_DEFINITION (session_saveSnapshot)
{
def.operation ([](string snapshotID)
{
Session::current.save (snapshotID);
})
.captureUndo ([](string snapshotID) -> string
{
return snapshotID;
})
.undoOperation ([](string, string oldSnapshot)
{
UNIMPLEMENTED ("how to remove a snapshot from session history");
});
};

View file

@ -189,9 +189,10 @@ namespace mobject {
/** create a complete, serialised representation
* of the current session config and contents.
* @todo how to serialise, parameters, return value?
* @todo 2017 how actually to serialise, parameters, return value?
* @param snapshotID marker to tag the snapshot, like e.g. a timestamp
*/
virtual void save () =0;
virtual void save (string snapshotID) =0;
/** access to the current session object instance.
* This is the sole access path available for clients.

View file

@ -295,7 +295,7 @@ namespace session {
* to several files (master file and edl files)
*/
void
SessManagerImpl::save()
SessManagerImpl::save (string stnapshotID)
{
UNIMPLEMENTED ("save session (serialised)");
/////////////////////////////////////////////////TODO: need lock?

View file

@ -71,13 +71,13 @@ namespace session {
~SessManagerImpl() ;
/* ==== SessManager API ==== */
virtual void clear() override;
virtual void close() override;
virtual void reset() override;
virtual void load () override;
virtual void save () override;
virtual void clear() override;
virtual void close() override;
virtual void reset() override;
virtual void load () override;
virtual void save (string) override;
virtual bool isUp () override;
virtual bool isUp () override;
public: