LibrePCB Developers Documentation
Loading...
Searching...
No Matches
DismissableMessageContext Class Referencefinal

A handle to a optionally dismissable message in the UI. More...

#include <dismissablemessagecontext.h>

Inherits QObject.

+ Collaboration diagram for DismissableMessageContext:

Signals

void visibilityChanged (bool visible)
 

Public Member Functions

 DismissableMessageContext (bool active=false, QObject *parent=nullptr) noexcept
 Constructor for a message without the "don't show again" feature.
 
 DismissableMessageContext (Workspace &workspace, const QString &dismissKey, bool active=false, QObject *parent=nullptr) noexcept
 Constructor for a message with the "don't show again" feature.
 
 DismissableMessageContext (const DismissableMessageContext &other)=delete
 
 ~DismissableMessageContext () noexcept
 
ui::DismissableMessageData getUiData () const noexcept
 Get UI data.
 
void setUiData (const ui::DismissableMessageData &data) noexcept
 Set UI data.
 
void setActive (bool active) noexcept
 Set whether the message should be shown (if not dismissed) or not.
 
void dismiss () noexcept
 Dismiss (hide) the message temporarily.
 
void dontShowAgain () noexcept
 Dismiss (hide) the message persistently.
 
bool isVisible () const noexcept
 Get whether the message shall currently be visible or not.
 
DismissableMessageContextoperator= (const DismissableMessageContext &rhs)=delete
 

Private Member Functions

void trigger (ui::DismissableMessageAction a) noexcept
 
void dismissedMessagesModified () noexcept
 
void updateVisibility () noexcept
 

Private Attributes

const QPointer< WorkspacemWorkspace
 
const QString mDismissKey
 
bool mActive
 
bool mTemporarilyHidden
 
bool mVisible
 

Detailed Description

A handle to a optionally dismissable message in the UI.

Helper which holds and updates the state of some kind of message in the UI which is dismissable, optionally even persistently with a "don't show again" link. The dismissed state is just a bool hold in this class while the "don't show again" feature is implemented with librepcb::WorkspaceSettings::dismissedMessages and is therefore only available if a librepcb::Workspace is set.

Constructor & Destructor Documentation

◆ DismissableMessageContext() [1/3]

DismissableMessageContext ( bool  active = false,
QObject *  parent = nullptr 
)
explicitnoexcept

Constructor for a message without the "don't show again" feature.

Allows only temporary dismissing, but not permanently.

Parameters
activeWhether the message should currently be shown or not.
parentParent object.

◆ DismissableMessageContext() [2/3]

DismissableMessageContext ( Workspace workspace,
const QString &  dismissKey,
bool  active = false,
QObject *  parent = nullptr 
)
explicitnoexcept

Constructor for a message with the "don't show again" feature.

Allows both, temporary or permanently dismissing the message.

Parameters
workspaceThe workspace to use for the persistent settings.
dismissKeyThe unique identifier for this message, see details at librepcb::WorkspaceSettings::dismissedMessages.
activeWhether the message should currently be shown or not.
parentParent object.
+ Here is the call graph for this function:

◆ DismissableMessageContext() [3/3]

◆ ~DismissableMessageContext()

Member Function Documentation

◆ getUiData()

ui::DismissableMessageData getUiData ( ) const
noexcept

Get UI data.

Returns
UI data.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUiData()

void setUiData ( const ui::DismissableMessageData &  data)
noexcept

Set UI data.

Parameters
dataUI data.

◆ setActive()

void setActive ( bool  active)
noexcept

Set whether the message should be shown (if not dismissed) or not.

The widget will be visible only if true is passed and the message was not dismissed.

Parameters
activeWhether the message should currently be shown or not.
+ Here is the caller graph for this function:

◆ dismiss()

void dismiss ( )
noexcept

Dismiss (hide) the message temporarily.

+ Here is the call graph for this function:

◆ dontShowAgain()

void dontShowAgain ( )
noexcept

Dismiss (hide) the message persistently.

+ Here is the call graph for this function:

◆ isVisible()

bool isVisible ( ) const
inlinenoexcept

Get whether the message shall currently be visible or not.

Return values
trueMessage shall be visible.
falseMessage shall be hidden.
+ Here is the caller graph for this function:

◆ operator=()

DismissableMessageContext & operator= ( const DismissableMessageContext rhs)
delete

◆ visibilityChanged

void visibilityChanged ( bool  visible)
signal
+ Here is the caller graph for this function:

◆ trigger()

void trigger ( ui::DismissableMessageAction  a)
privatenoexcept

◆ dismissedMessagesModified()

void dismissedMessagesModified ( )
privatenoexcept

◆ updateVisibility()

void updateVisibility ( )
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ mWorkspace

const QPointer<Workspace> mWorkspace
private

◆ mDismissKey

const QString mDismissKey
private

◆ mActive

bool mActive
private

◆ mTemporarilyHidden

bool mTemporarilyHidden
private

◆ mVisible

bool mVisible
private

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