DemoGuiRoundtrip: draft mock commands to be invoked

this would be the first half of the roundtrip, the call UI -> Proc
This commit is contained in:
Fischlurch 2018-09-29 13:37:48 +02:00
parent 6b941b2c1e
commit e54556f565
3 changed files with 134 additions and 16 deletions

View file

@ -76,6 +76,11 @@ namespace cmd {
extern CommandSetup test_meta_activateContentDiff; ////////////////////////////////TICKET #211 prefix test_ bypasses logging and immediately executes for now (2018)
extern CommandSetup meta_deactivateContentDiff;
//--Demo-and-Development----
extern CommandSetup test_meta_displayInfo;
extern CommandSetup test_meta_markError;
extern CommandSetup test_meta_markNote;
extern CommandSetup test_meta_markAction;
}} // namespace proc::cmd

View file

@ -39,16 +39,23 @@
#include "proc/control/command-def.hpp"
//#include "proc/mobject/session.hpp"
#include "include/gui-notification-facade.h"
#include "gui/interact/wizard.hpp" //////////////////////////////////////////////////////////////TICKET #1099 : include needed temporarily
//#include "lib/symbol.hpp"
#include "lib/idi/entry-id.hpp"
//#include "lib/format-string.hpp"
//#include <string>
#include <string>
using lib::hash::LuidH;
//using std::string;
using gui::ID;
using gui::NOTE_INFO;
using gui::NOTE_WARN;
using gui::NOTE_ERROR;
using gui::NotifyLevel;
using gui::GuiNotification;
//using util::cStr;
//using util::_Fmt;
using std::string;
namespace proc {
@ -80,7 +87,7 @@ COMMAND_DEFINITION (test_meta_activateContentDiff)
TODO ("send a population diff starting from scratch");
TODO ("activate life-update service within the session");
// Temporary hack to get any meaningful UI <-> Proc communication
gui::GuiNotification::facade().displayInfo(gui::NOTE_INFO, "Request: population-Diff from Session.");
GuiNotification::facade().displayInfo(NOTE_INFO, "Request: population-Diff from Session.");
})
.captureUndo ([]() -> bool
{
@ -130,6 +137,104 @@ COMMAND_DEFINITION (meta_deactivateContentDiff)
/* ===== Demo and Development ===== */
/** DemoGuiRoundtrip: push a notification info message back up into the UI.
* @todo this is a demo mock setup to further development of the Proc-UI integration //////////////////TICKET #1099 : prototypical Proc-GUI communication
*/
COMMAND_DEFINITION (test_meta_displayInfo)
{
def.operation ([](NotifyLevel level, string message)
{
GuiNotification::facade().displayInfo (level, message);
})
.captureUndo ([](NotifyLevel level, string message) -> bool
{
return true;
})
.undoOperation ([](NotifyLevel level, string message, bool wasActive)
{
if (wasActive)
{
GuiNotification::facade().displayInfo (NOTE_WARN, "Sorry, can't do that Dave.");
}
});
};
/** DemoGuiRoundtrip: send a `markError` message back up into the UI.
* @todo this is a demo mock setup to further development of the Proc-UI integration //////////////////TICKET #1099 : prototypical Proc-GUI communication
*/
COMMAND_DEFINITION (test_meta_markError)
{
def.operation ([](string message)
{
ID errorLogID = gui::interact::Wizard::getErrorLogID();
GuiNotification::facade().markError (errorLogID, message);
})
.captureUndo ([](string message) -> bool
{
return true;
})
.undoOperation ([](string message, bool wasActive)
{
if (wasActive)
{
GuiNotification::facade().displayInfo (NOTE_WARN, "Sorry, can't do that Dave.");
}
});
};
/** DemoGuiRoundtrip: send a `markNote` message back up into the UI.
* @todo this is a demo mock setup to further development of the Proc-UI integration //////////////////TICKET #1099 : prototypical Proc-GUI communication
*/
COMMAND_DEFINITION (test_meta_markNote)
{
def.operation ([](string message)
{
ID errorLogID = gui::interact::Wizard::getErrorLogID();
GuiNotification::facade().markNote (errorLogID, message);
})
.captureUndo ([](string message) -> bool
{
return true;
})
.undoOperation ([](string message, bool wasActive)
{
if (wasActive)
{
GuiNotification::facade().displayInfo (NOTE_WARN, "Sorry, can't do that Dave.");
}
});
};
/** DemoGuiRoundtrip: send a generic `mark` message with given _action ID_ back up into the UI.
* @todo this is a demo mock setup to further development of the Proc-UI integration //////////////////TICKET #1099 : prototypical Proc-GUI communication
*/
COMMAND_DEFINITION (test_meta_markAction)
{
def.operation ([](string actionID, string message)
{
ID errorLogID = gui::interact::Wizard::getErrorLogID();
UNIMPLEMENTED ("GuiNotification::facade().mark (errorLogID, actionID, message);");
})
.captureUndo ([](string actionID, string message) -> bool
{
return true;
})
.undoOperation ([](string actionID, string message, bool wasActive)
{
if (wasActive)
{
GuiNotification::facade().displayInfo (NOTE_WARN, "Sorry, can't do that Dave.");
}
});
};
/** more to come here...*/

View file

@ -2804,28 +2804,36 @@
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1533689243871" ID="ID_1745090225" MODIFIED="1538176877674" TEXT="triggert Dummy-Command">
<linktarget COLOR="#47ebbb" DESTINATION="ID_1745090225" ENDARROW="Default" ENDINCLINATION="119;0;" ID="Arrow_ID_372783230" SOURCE="ID_1206004" STARTARROW="None" STARTINCLINATION="-10;35;"/>
<icon BUILTIN="flag-yellow"/>
<node COLOR="#435e98" CREATED="1538220904703" HGAP="46" ID="ID_1997338106" MODIFIED="1538220975996" TEXT="definieren..." VSHIFT="31">
<icon BUILTIN="yes"/>
<node CREATED="1538220944278" MODIFIED="1538220944278" TEXT="test_meta_displayInfo"/>
<node CREATED="1538220949651" MODIFIED="1538220949651" TEXT="test_meta_markError"/>
<node CREATED="1538220955266" MODIFIED="1538220955266" TEXT="test_meta_markNote"/>
<node CREATED="1538220961641" MODIFIED="1538220961641" TEXT="test_meta_markAction"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1533689255174" ID="ID_821013695" MODIFIED="1537835685388" TEXT="Aufruf via Notification_Facade">
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1537835197558" ID="ID_1477928890" MODIFIED="1537977714184" TEXT="displayInfo">
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1537977715375" ID="ID_26283848" MODIFIED="1537977727814" TEXT="INFO">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1537977721054" ID="ID_1182006449" MODIFIED="1537977727294" TEXT="WARN">
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1533689255174" ID="ID_821013695" MODIFIED="1538220890763" TEXT="Aufruf via Notification_Facade">
<icon BUILTIN="flag-yellow"/>
<icon BUILTIN="pencil"/>
<node COLOR="#338800" CREATED="1537835197558" ID="ID_1477928890" MODIFIED="1538220882124" TEXT="displayInfo">
<icon BUILTIN="button_ok"/>
<node COLOR="#338800" CREATED="1537977715375" ID="ID_26283848" MODIFIED="1538220884023" TEXT="INFO">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1537977723454" ID="ID_484673349" MODIFIED="1537977726486" TEXT="ERROR">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1537977721054" ID="ID_1182006449" MODIFIED="1538220885525" TEXT="WARN">
<icon BUILTIN="button_ok"/>
</node>
<node COLOR="#338800" CREATED="1537977723454" ID="ID_484673349" MODIFIED="1538220887767" TEXT="ERROR">
<icon BUILTIN="button_ok"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1537835015601" ID="ID_1684094906" MODIFIED="1537835021881" TEXT="direkte Bus-Aufrufe">
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1537835220978" ID="ID_1439086949" MODIFIED="1537835698918" TEXT="markError">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1537835220978" ID="ID_1439086949" MODIFIED="1538220877346" TEXT="markError">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1537835228018" ID="ID_1420898810" MODIFIED="1537835700414" TEXT="markNote">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#338800" CREATED="1537835228018" ID="ID_1420898810" MODIFIED="1538220879207" TEXT="markNote">
<icon BUILTIN="button_ok"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1537835741000" ID="ID_1072038781" MODIFIED="1538013147452" TEXT="mark">
<linktarget COLOR="#19f524" DESTINATION="ID_1072038781" ENDARROW="Default" ENDINCLINATION="-7;-200;" ID="Arrow_ID_746117643" SOURCE="ID_556296967" STARTARROW="None" STARTINCLINATION="94;0;"/>