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).
This commit is contained in:
Abdullah Tahiri
2022-12-19 16:55:47 +01:00
committed by abdullahtahiriyo
parent b2d42ba5f2
commit 6cb616aeb8
2 changed files with 22 additions and 2 deletions

View File

@@ -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();

View File

@@ -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);