Skip to content
Extraits de code Groupes Projets
Valider ab18a046 rédigé par Elliu's avatar Elliu
Parcourir les fichiers

Replacing getCurrentVivyDocument by getCurrentDocument

And some macros to get the current VivyDocument or current
ScriptDocument
parent 4e0c072e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!17Api update
...@@ -92,13 +92,10 @@ VivyApplication::getMainWindow() const ...@@ -92,13 +92,10 @@ VivyApplication::getMainWindow() const
return mainWindowPtr.get(); return mainWindowPtr.get();
} }
/* AbstractDocument *
* @return the current VivyDocument, or null if there isn't one or if the current document is not a VivyDocument VivyApplication::getCurrentDocument() const
*/
VivyDocument *
VivyApplication::getCurrentVivyDocument() const
{ {
if (!mainWindowPtr) if (!mainWindowPtr)
throw std::logic_error("No main window in the graphic VivyApplication"); throw std::logic_error("No main window in the graphic VivyApplication");
return dynamic_cast<VivyDocument*>(mainWindowPtr.get()->getCurrentDocument()); return mainWindowPtr.get()->getCurrentDocument();
} }
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
#define vivyApp static_cast<VivyApplication *>(QApplication::instance()) #define vivyApp static_cast<VivyApplication *>(QApplication::instance())
#define currentVivyDocument() dynamic_cast<VivyDocument*>(vivyApp->getCurrentDocument())
#define currentScriptDocument dynamic_cast<ScriptDocument*>(vivyApp->getCurrentDocument())
// Only support dark theme for now // Only support dark theme for now
#define VIVY_ICON_APP ":icons/vivy.png" #define VIVY_ICON_APP ":icons/vivy.png"
#define VIVY_ICON_SCRIPT ":icons/lua.png" #define VIVY_ICON_SCRIPT ":icons/lua.png"
...@@ -71,7 +74,7 @@ public: ...@@ -71,7 +74,7 @@ public:
QFont getApplicationFont(Font) const noexcept; QFont getApplicationFont(Font) const noexcept;
[[nodiscard("handle-it")]] MainWindow *getMainWindow() const; [[nodiscard("handle-it")]] MainWindow *getMainWindow() const;
[[nodiscard("handle-it")]] VivyDocument *getCurrentVivyDocument() const; [[nodiscard("handle-it")]] AbstractDocument *getCurrentDocument() const;
void setTheme(Theme) noexcept; void setTheme(Theme) noexcept;
}; };
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter