XII Release 0.1.0
Loading...
Searching...
No Matches
xiiQtUiServices Class Reference
Inheritance diagram for xiiQtUiServices:
[legend]

Classes

struct  Event
 
struct  TickEvent
 

Public Member Functions

void ShowColorDialog (const xiiColor &color, bool bAlpha, bool bHDR, QWidget *pParent, xiiStringView sSlotCurColChanged, xiiStringView sSlotAccept, xiiStringView sSlotReject)
 Shows a non-modal color dialog. The Qt slots are called when the selected color is changed or when the dialog is closed and the result accepted or rejected.
 
void LoadState ()
 Loads some global state used by xiiQtUiServices from the registry. E.g. the last position of the color dialog.
 
void SaveState ()
 Saves some global state used by xiiQtUiServices to the registry.
 
void Init ()
 

Static Public Member Functions

static bool IsHeadless ()
 True if the application doesn't show any window and only works in the background.
 
static void SetHeadless (bool bHeadless)
 Set to true if the application doesn't show any window and only works in the background.
 
static void MessageBoxStatus (const xiiStatus &s, xiiStringView sFailureMsg, xiiStringView sSuccessMsg={}, bool bOnlySuccessMsgIfDetails=true)
 Might show a message box depending on the given status. If the status is 'failure' the sFailureMsg is shown, including the message in xiiStatus. If the status is success a message box with text sSuccessMsg is shown, but only if the status message is not empty or if bOnlySuccessMsgIfDetails is false.
 
static void MessageBoxInformation (const xiiFormatString &msg)
 Shows an information message box.
 
static void MessageBoxWarning (const xiiFormatString &msg)
 Shows an warning message box.
 
static QMessageBox::StandardButton MessageBoxQuestion (const xiiFormatString &msg, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
 Shows a question message box and returns which button the user pressed.
 
static void ShowAllDocumentsTemporaryStatusBarMessage (const xiiFormatString &msg, xiiTime timeOut)
 Use this if you need to display a status bar message in any/all documents. Go directly through the document, if you only want to show a message in a single document window.
 
static void ShowAllDocumentsPermanentStatusBarMessage (const xiiFormatString &msg, Event::TextType type)
 
static void ShowGlobalStatusBarMessage (const xiiFormatString &msg)
 Shows a 'critical' message in all container windows (in red), which does not disappear, until it is replaced with another (empty) string.
 
static bool OpenFileInDefaultProgram (xiiStringView sPath)
 Opens the given file in the program that is registered in the OS to handle that file type.
 
static void OpenInExplorer (xiiStringView sPath, bool bIsFile)
 Opens the given file or folder in the Explorer.
 
static void OpenWith (xiiStringView sPath)
 Shows the "Open With" dialog.
 
static xiiStatus OpenInVsCode (const QStringList &arguments)
 Attempts to launch Visual Studio Code with the given command line.
 
static const QIcon & GetCachedIconResource (xiiStringView sIdentifier, xiiColor svgTintColor=xiiColor::MakeZero())
 Returns a cached QIcon that was created from an internal Qt resource (e.g. 'QIcon(":QtNamespace/MyIcon.png")' ). Prevents creating the object over and over.
 
static const QImage & GetCachedImageResource (xiiStringView sIdentifier)
 Returns a cached QImage that was created from an internal Qt resource (e.g. 'QImage(":QtNamespace/MyIcon.png")' ). Prevents creating the object over and over.
 
static const QPixmap & GetCachedPixmapResource (xiiStringView sIdentifier)
 Returns a cached QPixmap that was created from an internal Qt resource (e.g. 'QPixmap(":QtNamespace/MyIcon.png")' ). Prevents creating the object over and over.
 
static xiiResult AddToGitIgnore (xiiStringView sGitIgnoreFile, xiiStringView sPattern)
 Adds the pattern to the gitignore file.
 
static void CheckForUpdates ()
 Raises the 'CheckForUpdates' event.
 

Static Public Attributes

static xiiEvent< const xiiQtUiServices::Event & > s_Events
 
static xiiEvent< const xiiQtUiServices::TickEvent & > s_TickEvent
 

Member Function Documentation

◆ AddToGitIgnore()

xiiResult xiiQtUiServices::AddToGitIgnore ( xiiStringView sGitIgnoreFile,
xiiStringView sPattern )
static

Adds the pattern to the gitignore file.

If the gitignore file does not exist, it is created. If the pattern is already present in the file, it is not added again.

◆ GetCachedIconResource()

const QIcon & xiiQtUiServices::GetCachedIconResource ( xiiStringView sIdentifier,
xiiColor svgTintColor = xiiColor::MakeZero() )
static

Returns a cached QIcon that was created from an internal Qt resource (e.g. 'QIcon(":QtNamespace/MyIcon.png")' ). Prevents creating the object over and over.

If svgTintColor is a non-zero color, and sIdentifier points to an .SVG file, then the first time the icon is requested with that color, a copy is made, and the SVG content is modified such that white ("#FFFFFF") gets replaced by the requested color. Thus multiple tints of the same icon can be created for different use cases. Usually this is used to get different shades of the same icon, such that it looks good on the target background.


The documentation for this class was generated from the following files: