Plasma Engine  2.0
Loading...
Searching...
No Matches
UIServices.moc.h
1#pragma once
2
3#include <Foundation/Communication/Event.h>
4#include <Foundation/Configuration/Singleton.h>
5#include <Foundation/Strings/FormatString.h>
6#include <Foundation/Time/Time.h>
7#include <Foundation/Types/Status.h>
8#include <GuiFoundation/GuiFoundationDLL.h>
9#include <QApplication>
10#include <QMessageBox>
11
12class QColorDialog;
13class plQtColorDialog;
14
15class PL_GUIFOUNDATION_DLL plQtUiServices : public QObject
16{
17 Q_OBJECT
18
19 PL_DECLARE_SINGLETON(plQtUiServices);
20
21public:
22 struct Event
23 {
24 enum Type
25 {
26 ShowDocumentTemporaryStatusBarText,
27 ShowDocumentPermanentStatusBarText,
28 ShowGlobalStatusBarText,
29 ClickedDocumentPermanentStatusBarText,
30 CheckForUpdates,
31 };
32
33 enum TextType
34 {
35 Info,
36 Warning,
37 Error
38 };
39
40 Type m_Type;
41 plString m_sText;
42 plTime m_Time;
43 TextType m_TextType = TextType::Info;
44 };
45
47
48 struct TickEvent
49 {
50 enum class Type
51 {
52 StartFrame,
53 EndFrame,
54 };
55
56 Type m_Type;
57 plUInt32 m_uiFrame = 0;
58 plTime m_Time;
59 double m_fRefreshRate = 60.0;
60 };
61
63
64public:
66
68 static bool IsHeadless();
69
71 static void SetHeadless(bool bHeadless);
72
75 void ShowColorDialog(const plColor& color, bool bAlpha, bool bHDR, QWidget* pParent, const char* szSlotCurColChanged, const char* szSlotAccept, const char* szSlotReject);
76
80 static void MessageBoxStatus(const plStatus& s, const char* szFailureMsg, const char* szSuccessMsg = "", bool bOnlySuccessMsgIfDetails = true);
81
83 static void MessageBoxInformation(const plFormatString& msg);
84
86 static void MessageBoxWarning(const plFormatString& msg);
87
89 static QMessageBox::StandardButton MessageBoxQuestion(const plFormatString& msg, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton);
90
93 static void ShowAllDocumentsTemporaryStatusBarMessage(const plFormatString& msg, plTime timeOut);
94
95 static void ShowAllDocumentsPermanentStatusBarMessage(const plFormatString& msg, Event::TextType type);
96
98 static void ShowGlobalStatusBarMessage(const plFormatString& msg);
99
101 static bool OpenFileInDefaultProgram(const char* szPath);
102
104 static void OpenInExplorer(const char* szPath, bool bIsFile);
105
106 static plStatus OpenInClion(const QStringList& arguments);
107
108 static plStatus OpenInRider(const char* szPath);
109
110 static plStatus OpenIn10X(const char* szPath);
111
112 static plStatus OpenInVisualStudio(const char* szPath);
113
115 static plStatus OpenInVsCode(const QStringList& arguments);
116
118 void LoadState();
119
121 void SaveState();
122
130 static const QIcon& GetCachedIconResource(plStringView sIdentifier, plColor svgTintColor = plColor::MakeZero());
131
134 static const QImage& GetCachedImageResource(const char* szIdentifier);
135
138 static const QPixmap& GetCachedPixmapResource(const char* szIdentifier);
139
144 static plResult AddToGitIgnore(const char* szGitIgnoreFile, const char* szPattern);
145
147 static void CheckForUpdates();
148
149 void Init();
150
151private Q_SLOTS:
152 void TickEventHandler();
153
154private:
155 plQtColorDialog* m_pColorDlg;
156 QByteArray m_ColorDlgGeometry;
157
158 static plMap<plString, QIcon> s_IconsCache;
159 static plMap<plString, QImage> s_ImagesCache;
160 static plMap<plString, QPixmap> s_PixmapsCache;
161 static bool s_bHeadless;
162 static TickEvent s_LastTickEvent;
163 bool m_bIsDrawingATM = false;
164};
Definition EditorApp.moc.h:27
plColor represents an RGBA color in linear color space. Values are stored as float,...
Definition Color.h:44
static plColor MakeZero()
Returns a color with all four RGBA components set to zero. This is different to plColor::Black,...
Definition Color.cpp:13
Definition Event.h:177
Implements formating of strings with placeholders and formatting options.
Definition FormatString.h:59
Definition Map.h:408
Definition ColorDialog.moc.h:16
Definition UIServices.moc.h:16
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
Definition UIServices.moc.h:23
Definition UIServices.moc.h:49
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54
An plResult with an additional message for the reason of failure.
Definition Status.h:12
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12