From 6cb616aeb84a8a27ce25b281240a7934b228530b Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Mon, 19 Dec 2022 16:55:47 +0100 Subject: [PATCH] Gui:: Application - user initiated restore status bit ===================================================== Add Status bits. Currently only to mark whether an UI operation of restore was initiated by the user (via click in the open dialog or in the hyperlink of the shortcuts of the home page). --- src/Gui/Application.cpp | 11 +++++++++++ src/Gui/Application.h | 13 +++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index bbcd71eab6..c5021e9685 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -198,6 +198,7 @@ struct ApplicationP /// Handles all commands CommandManager commandManager; ViewProviderMap viewproviderMap; + std::bitset<32> StatusBits; }; static PyObject * @@ -2289,6 +2290,16 @@ void Application::runApplication() Base::Console().Log("Finish: Event loop left\n"); } +bool Application::testStatus(Status pos) const +{ + return d->StatusBits.test((size_t)pos); +} + +void Application::setStatus(Status pos, bool on) +{ + d->StatusBits.set((size_t)pos, on); +} + void Application::setStyleSheet(const QString& qssFile, bool tiledBackground) { Gui::MainWindow* mw = getMainWindow(); diff --git a/src/Gui/Application.h b/src/Gui/Application.h index 4ad59f9f3f..692f95b672 100644 --- a/src/Gui/Application.h +++ b/src/Gui/Application.h @@ -54,6 +54,10 @@ class ViewProviderDocumentObject; class GuiExport Application { public: + enum Status { + UserInitiatedOpenDocument = 0 + }; + /// construction explicit Application(bool GUIenabled); /// destruction @@ -232,7 +236,12 @@ public: static void runApplication(); void tryClose( QCloseEvent * e ); //@} - + + /// return the status bits + bool testStatus(Status pos) const; + /// set the status bits + void setStatus(Status pos, bool on); + /** @name User edit mode */ //@{ protected: @@ -320,7 +329,7 @@ public: static PyObject* sAddDocObserver (PyObject *self,PyObject *args); static PyObject* sRemoveDocObserver (PyObject *self,PyObject *args); - + static PyObject* sListUserEditModes (PyObject *self,PyObject *args); static PyObject* sGetUserEditMode (PyObject *self,PyObject *args); static PyObject* sSetUserEditMode (PyObject *self,PyObject *args);