VirtualBox

Changeset 71459 in vbox


Ignore:
Timestamp:
Mar 22, 2018 2:41:03 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
121428
Message:

FE/Qt: bugref:9049: Heavy cleanup for UIMessageCenter.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/globals
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r69553 r71459  
    55
    66/*
    7  * Copyright (C) 2006-2017 Oracle Corporation
     7 * Copyright (C) 2006-2018 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2828# ifdef VBOX_WS_MAC
    2929#  include <QPushButton>
    30 # endif /* VBOX_WS_MAC */
     30# endif
    3131
    3232/* GUI includes: */
     33# include "QIMessageBox.h"
    3334# include "VBoxGlobal.h"
    3435# include "UIConverter.h"
     
    4748#  include "UIDownloaderUserManual.h"
    4849# endif /* VBOX_OSE */
    49 # include "UIMachine.h"
    5050# include "VBoxAboutDlg.h"
    5151# include "UIHostComboEditor.h"
    5252# ifdef VBOX_WS_MAC
    5353#  include "VBoxUtils-darwin.h"
    54 # endif /* VBOX_WS_MAC */
     54# endif
    5555# ifdef VBOX_WS_WIN
    5656#  include <Htmlhelp.h>
    57 # endif /* VBOX_WS_WIN */
     57# endif
    5858
    5959/* COM includes: */
     
    9191
    9292/* static */
    93 UIMessageCenter* UIMessageCenter::m_spInstance = 0;
    94 UIMessageCenter* UIMessageCenter::instance() { return m_spInstance; }
     93UIMessageCenter *UIMessageCenter::s_pInstance = 0;
     94UIMessageCenter *UIMessageCenter::instance() { return s_pInstance; }
    9595
    9696/* static */
     
    9898{
    9999    /* Make sure instance is NOT created yet: */
    100     if (m_spInstance)
     100    if (s_pInstance)
    101101    {
    102102        AssertMsgFailed(("UIMessageCenter instance is already created!"));
     
    107107    new UIMessageCenter;
    108108    /* Prepare instance: */
    109     m_spInstance->prepare();
     109    s_pInstance->prepare();
    110110}
    111111
     
    114114{
    115115    /* Make sure instance is NOT destroyed yet: */
    116     if (!m_spInstance)
     116    if (!s_pInstance)
    117117    {
    118118        AssertMsgFailed(("UIMessageCenter instance is already destroyed!"));
     
    121121
    122122    /* Cleanup instance: */
    123     m_spInstance->cleanup();
     123    s_pInstance->cleanup();
    124124    /* Destroy instance: */
    125     delete m_spInstance;
    126 }
    127 
    128 bool UIMessageCenter::warningShown(const QString &strWarningName) const
    129 {
    130     return m_warnings.contains(strWarningName);
     125    delete s_pInstance;
    131126}
    132127
     
    139134}
    140135
    141 int UIMessageCenter::message(QWidget *pParent, MessageType type,
     136bool UIMessageCenter::warningShown(const QString &strWarningName) const
     137{
     138    return m_warnings.contains(strWarningName);
     139}
     140
     141int UIMessageCenter::message(QWidget *pParent, MessageType enmType,
    142142                             const QString &strMessage,
    143143                             const QString &strDetails,
     
    155155        /* We have to throw a blocking signal
    156156         * to show a message-box in the GUI thread: */
    157         emit sigToShowMessageBox(pParent, type,
     157        emit sigToShowMessageBox(pParent, enmType,
    158158                                 strMessage, strDetails,
    159159                                 iButton1, iButton2, iButton3,
     
    164164    }
    165165    /* In usual case we can chow a message-box directly: */
    166     return showMessageBox(pParent, type,
     166    return showMessageBox(pParent, enmType,
    167167                          strMessage, strDetails,
    168168                          iButton1, iButton2, iButton3,
     
    171171}
    172172
    173 void UIMessageCenter::error(QWidget *pParent, MessageType type,
     173void UIMessageCenter::error(QWidget *pParent, MessageType enmType,
    174174                           const QString &strMessage,
    175175                           const QString &strDetails,
    176176                           const char *pcszAutoConfirmId /* = 0*/) const
    177177{
    178     message(pParent, type, strMessage, strDetails, pcszAutoConfirmId,
     178    message(pParent, enmType, strMessage, strDetails, pcszAutoConfirmId,
    179179            AlertButton_Ok | AlertButtonOption_Default | AlertButtonOption_Escape);
    180180}
    181181
    182 bool UIMessageCenter::errorWithQuestion(QWidget *pParent, MessageType type,
     182bool UIMessageCenter::errorWithQuestion(QWidget *pParent, MessageType enmType,
    183183                                        const QString &strMessage,
    184184                                        const QString &strDetails,
     
    187187                                        const QString &strCancelButtonText /* = QString()*/) const
    188188{
    189     return (message(pParent, type, strMessage, strDetails, pcszAutoConfirmId,
     189    return (message(pParent, enmType, strMessage, strDetails, pcszAutoConfirmId,
    190190                    AlertButton_Ok | AlertButtonOption_Default,
    191191                    AlertButton_Cancel | AlertButtonOption_Escape,
     
    197197}
    198198
    199 void UIMessageCenter::alert(QWidget *pParent, MessageType type,
     199void UIMessageCenter::alert(QWidget *pParent, MessageType enmType,
    200200                           const QString &strMessage,
    201201                           const char *pcszAutoConfirmId /* = 0*/) const
    202202{
    203     error(pParent, type, strMessage, QString(), pcszAutoConfirmId);
    204 }
    205 
    206 int UIMessageCenter::question(QWidget *pParent, MessageType type,
     203    error(pParent, enmType, strMessage, QString(), pcszAutoConfirmId);
     204}
     205
     206int UIMessageCenter::question(QWidget *pParent, MessageType enmType,
    207207                              const QString &strMessage,
    208208                              const char *pcszAutoConfirmId/* = 0*/,
     
    214214                              const QString &strButtonText3 /* = QString()*/) const
    215215{
    216     return message(pParent, type, strMessage, QString(), pcszAutoConfirmId,
     216    return message(pParent, enmType, strMessage, QString(), pcszAutoConfirmId,
    217217                   iButton1, iButton2, iButton3, strButtonText1, strButtonText2, strButtonText3);
    218218}
    219219
    220 bool UIMessageCenter::questionBinary(QWidget *pParent, MessageType type,
     220bool UIMessageCenter::questionBinary(QWidget *pParent, MessageType enmType,
    221221                                     const QString &strMessage,
    222222                                     const char *pcszAutoConfirmId /* = 0*/,
     
    226226{
    227227    return fDefaultFocusForOk ?
    228            ((question(pParent, type, strMessage, pcszAutoConfirmId,
     228           ((question(pParent, enmType, strMessage, pcszAutoConfirmId,
    229229                      AlertButton_Ok | AlertButtonOption_Default,
    230230                      AlertButton_Cancel | AlertButtonOption_Escape,
     
    234234                      QString() /* third button */) &
    235235             AlertButtonMask) == AlertButton_Ok) :
    236            ((question(pParent, type, strMessage, pcszAutoConfirmId,
     236           ((question(pParent, enmType, strMessage, pcszAutoConfirmId,
    237237                      AlertButton_Ok,
    238238                      AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape,
     
    244244}
    245245
    246 int UIMessageCenter::questionTrinary(QWidget *pParent, MessageType type,
     246int UIMessageCenter::questionTrinary(QWidget *pParent, MessageType enmType,
    247247                                     const QString &strMessage,
    248248                                     const char *pcszAutoConfirmId /* = 0*/,
     
    251251                                     const QString &strCancelButtonText /* = QString()*/) const
    252252{
    253     return question(pParent, type, strMessage, pcszAutoConfirmId,
     253    return question(pParent, enmType, strMessage, pcszAutoConfirmId,
    254254                    AlertButton_Choice1,
    255255                    AlertButton_Choice2 | AlertButtonOption_Default,
     
    260260}
    261261
    262 int UIMessageCenter::messageWithOption(QWidget *pParent, MessageType type,
     262int UIMessageCenter::messageWithOption(QWidget *pParent, MessageType enmType,
    263263                                       const QString &strMessage,
    264264                                       const QString &strOptionText,
     
    278278    QString strTitle;
    279279    AlertIconType icon;
    280     switch (type)
     280    switch (enmType)
    281281    {
    282282        default:
     
    10971097}
    10981098
    1099 void UIMessageCenter::cannotAttachDevice(const CMachine &machine, UIMediumType type,
     1099void UIMessageCenter::cannotAttachDevice(const CMachine &machine, UIMediumType enmType,
    11001100                                         const QString &strLocation, const StorageSlot &storageSlot,
    11011101                                         QWidget *pParent /* = 0*/)
    11021102{
    11031103    QString strMessage;
    1104     switch (type)
     1104    switch (enmType)
    11051105    {
    11061106        case UIMediumType_HardDisk:
     
    13531353}
    13541354
    1355 void UIMessageCenter::cannotDetachDevice(const CMachine &machine, UIMediumType type, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent /* = 0*/) const
     1355void UIMessageCenter::cannotDetachDevice(const CMachine &machine, UIMediumType enmType, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent /* = 0*/) const
    13561356{
    13571357    /* Prepare the message: */
    13581358    QString strMessage;
    1359     switch (type)
     1359    switch (enmType)
    13601360    {
    13611361        case UIMediumType_HardDisk:
     
    14381438}
    14391439
    1440 void UIMessageCenter::cannotOpenMedium(const CVirtualBox &vbox, UIMediumType /* type */, const QString &strLocation, QWidget *pParent /* = 0*/) const
     1440void UIMessageCenter::cannotOpenMedium(const CVirtualBox &vbox, UIMediumType, const QString &strLocation, QWidget *pParent /* = 0*/) const
    14411441{
    14421442    /* Show the error: */
     
    17781778    CConsole console1 = console;
    17791779    KMachineState state = console1.GetState();
    1780     MessageType type;
     1780    MessageType enmType;
    17811781    QString severity;
    17821782
     
    17941794    if (fFatal)
    17951795    {
    1796         type = MessageType_Critical;
     1796        enmType = MessageType_Critical;
    17971797        severity = tr("<nobr>Fatal Error</nobr>", "runtime error info");
    17981798        autoConfimId += "fatal.";
     
    18001800    else if (state == KMachineState_Paused)
    18011801    {
    1802         type = MessageType_Error;
     1802        enmType = MessageType_Error;
    18031803        severity = tr("<nobr>Non-Fatal Error</nobr>", "runtime error info");
    18041804        autoConfimId += "error.";
     
    18061806    else
    18071807    {
    1808         type = MessageType_Warning;
     1808        enmType = MessageType_Warning;
    18091809        severity = tr("<nobr>Warning</nobr>", "runtime error info");
    18101810        autoConfimId += "warning.";
     
    18291829
    18301830    /* Show the error: */
    1831     if (type == MessageType_Critical)
     1831    if (enmType == MessageType_Critical)
    18321832    {
    1833         error(0, type,
     1833        error(0, enmType,
    18341834              tr("<p>A fatal error has occurred during virtual machine execution! "
    18351835                 "The virtual machine will be powered off. Please copy the following error message "
     
    18371837              formatted, autoConfimId.data());
    18381838    }
    1839     else if (type == MessageType_Error)
     1839    else if (enmType == MessageType_Error)
    18401840    {
    1841         error(0, type,
     1841        error(0, enmType,
    18421842              tr("<p>An error has occurred during virtual machine execution! "
    18431843                 "The error details are shown below. You may try to correct the error "
     
    18471847    else
    18481848    {
    1849         error(0, type,
     1849        error(0, enmType,
    18501850              tr("<p>The virtual machine execution may run into an error condition as described below. "
    18511851                 "We suggest that you take an appropriate action to avert the error.</p>"),
     
    26282628}
    26292629
    2630 void UIMessageCenter::sltShowMessageBox(QWidget *pParent, MessageType type,
     2630void UIMessageCenter::sltShowMessageBox(QWidget *pParent, MessageType enmType,
    26312631                                        const QString &strMessage, const QString &strDetails,
    26322632                                        int iButton1, int iButton2, int iButton3,
     
    26352635{
    26362636    /* Now we can show a message-box directly: */
    2637     showMessageBox(pParent, type,
     2637    showMessageBox(pParent, enmType,
    26382638                   strMessage, strDetails,
    26392639                   iButton1, iButton2, iButton3,
     
    26452645{
    26462646    /* Assign instance: */
    2647     m_spInstance = this;
     2647    s_pInstance = this;
    26482648}
    26492649
     
    26512651{
    26522652    /* Unassign instance: */
    2653     m_spInstance = 0;
     2653    s_pInstance = 0;
    26542654}
    26552655
     
    26962696}
    26972697
    2698 int UIMessageCenter::showMessageBox(QWidget *pParent, MessageType type,
     2698int UIMessageCenter::showMessageBox(QWidget *pParent, MessageType enmType,
    26992699                                    const QString &strMessage, const QString &strDetails,
    27002700                                    int iButton1, int iButton2, int iButton3,
     
    27302730    QString title;
    27312731    AlertIconType icon;
    2732     switch (type)
     2732    switch (enmType)
    27332733    {
    27342734        default:
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r70474 r71459  
    55
    66/*
    7  * Copyright (C) 2006-2017 Oracle Corporation
     7 * Copyright (C) 2006-2018 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1616 */
    1717
    18 #ifndef __UIMessageCenter_h__
    19 #define __UIMessageCenter_h__
     18#ifndef ___UIMessageCenter_h___
     19#define ___UIMessageCenter_h___
    2020
    2121/* Qt includes: */
     
    2323
    2424/* GUI includes: */
    25 #include "QIMessageBox.h"
    2625#include "UIMediumDefs.h"
    2726
     
    3534#ifdef VBOX_WITH_DRAG_AND_DROP
    3635class CGuest;
    37 #endif /* VBOX_WITH_DRAG_AND_DROP */
    38 
    39 /* Possible message types: */
     36#endif
     37
     38
     39/** Possible message types. */
    4040enum MessageType
    4141{
     
    4949Q_DECLARE_METATYPE(MessageType);
    5050
    51 /* Global message-center object: */
    52 class UIMessageCenter: public QObject
     51
     52/** Singleton QObject extension
     53  * providing GUI with corresponding messages. */
     54class UIMessageCenter : public QObject
    5355{
    5456    Q_OBJECT;
     
    5658signals:
    5759
    58     /* Notifier: Interthreading stuff: */
    59     void sigToShowMessageBox(QWidget *pParent, MessageType type,
     60    /** Asks to show message-box.
     61      * @param  pParent           Brings the message-box parent.
     62      * @param  enmType           Brings the message-box type.
     63      * @param  strMessage        Brings the message.
     64      * @param  strDetails        Brings the details.
     65      * @param  iButton1          Brings the button 1 type.
     66      * @param  iButton2          Brings the button 2 type.
     67      * @param  iButton3          Brings the button 3 type.
     68      * @param  strButtonText1    Brings the button 1 text.
     69      * @param  strButtonText2    Brings the button 2 text.
     70      * @param  strButtonText3    Brings the button 3 text.
     71      * @param  strAutoConfirmId  Brings whether this message can be auto-confirmed. */
     72    void sigToShowMessageBox(QWidget *pParent, MessageType enmType,
    6073                             const QString &strMessage, const QString &strDetails,
    6174                             int iButton1, int iButton2, int iButton3,
     
    6578public:
    6679
    67     /* Static API: Create/destroy stuff: */
     80    /** Creates message-center singleton. */
    6881    static void create();
     82    /** Destroys message-center singleton. */
    6983    static void destroy();
    7084
    71     /* API: Warning registration stuff: */
     85    /** Defines whether warning with particular @a strWarningName is @a fShown. */
     86    void setWarningShown(const QString &strWarningName, bool fShown) const;
     87    /** Returns whether warning with particular @a strWarningName is shown. */
    7288    bool warningShown(const QString &strWarningName) const;
    73     void setWarningShown(const QString &strWarningName, bool fWarningShown) const;
    74 
    75     /* API: Main message function, used directly only in exceptional cases: */
    76     int message(QWidget *pParent, MessageType type,
    77                 const QString &strMessage,
    78                 const QString &strDetails,
     89
     90    /** Shows a general type of 'Message'.
     91      * @param  pParent            Brings the message-box parent.
     92      * @param  enmType            Brings the message-box type.
     93      * @param  strMessage         Brings the message.
     94      * @param  strDetails         Brings the details.
     95      * @param  pcszAutoConfirmId  Brings the auto-confirm ID.
     96      * @param  iButton1           Brings the button 1 type.
     97      * @param  iButton2           Brings the button 2 type.
     98      * @param  iButton3           Brings the button 3 type.
     99      * @param  strButtonText1     Brings the button 1 text.
     100      * @param  strButtonText2     Brings the button 2 text.
     101      * @param  strButtonText3     Brings the button 3 text. */
     102    int message(QWidget *pParent, MessageType enmType,
     103                const QString &strMessage, const QString &strDetails,
    79104                const char *pcszAutoConfirmId = 0,
    80105                int iButton1 = 0, int iButton2 = 0, int iButton3 = 0,
     
    83108                const QString &strButtonText3 = QString()) const;
    84109
    85     /* API: Wrapper to 'message' function.
    86      * Provides single OK button: */
    87     void error(QWidget *pParent, MessageType type,
     110    /** Shows an 'Error' type of 'Message'.
     111      * Provides single Ok button.
     112      * @param  pParent            Brings the message-box parent.
     113      * @param  enmType            Brings the message-box type.
     114      * @param  strMessage         Brings the message.
     115      * @param  strDetails         Brings the details.
     116      * @param  pcszAutoConfirmId  Brings the auto-confirm ID. */
     117    void error(QWidget *pParent, MessageType enmType,
    88118               const QString &strMessage,
    89119               const QString &strDetails,
    90120               const char *pcszAutoConfirmId = 0) const;
    91121
    92     /* API: Wrapper to 'message' function,
    93      * Error with question providing two buttons (OK and Cancel by default): */
    94     bool errorWithQuestion(QWidget *pParent, MessageType type,
     122    /** Shows an 'Error with Question' type of 'Message'.
     123      * Provides Ok and Cancel buttons (called same way by default).
     124      * @param  pParent              Brings the message-box parent.
     125      * @param  enmType              Brings the message-box type.
     126      * @param  strMessage           Brings the message.
     127      * @param  strDetails           Brings the details.
     128      * @param  pcszAutoConfirmId    Brings the auto-confirm ID.
     129      * @param  strOkButtonText      Brings the Ok button text.
     130      * @param  strCancelButtonText  Brings the Cancel button text. */
     131    bool errorWithQuestion(QWidget *pParent, MessageType enmType,
    95132                           const QString &strMessage,
    96133                           const QString &strDetails,
     
    99136                           const QString &strCancelButtonText = QString()) const;
    100137
    101     /* API: Wrapper to 'error' function.
    102      * Omits details: */
    103     void alert(QWidget *pParent, MessageType type,
     138    /** Shows an 'Alert' type of 'Error'.
     139      * Omit details.
     140      * @param  pParent            Brings the message-box parent.
     141      * @param  enmType            Brings the message-box type.
     142      * @param  strMessage         Brings the message.
     143      * @param  pcszAutoConfirmId  Brings the auto-confirm ID. */
     144    void alert(QWidget *pParent, MessageType enmType,
    104145               const QString &strMessage,
    105146               const char *pcszAutoConfirmId = 0) const;
    106147
    107     /* API: Wrapper to 'message' function.
    108      * Omits details, provides two or three buttons: */
    109     int question(QWidget *pParent, MessageType type,
     148    /** Shows a 'Question' type of 'Message'.
     149      * Omit details.
     150      * @param  pParent            Brings the message-box parent.
     151      * @param  enmType            Brings the message-box type.
     152      * @param  strMessage         Brings the message.
     153      * @param  pcszAutoConfirmId  Brings the auto-confirm ID.
     154      * @param  iButton1           Brings the button 1 type.
     155      * @param  iButton2           Brings the button 2 type.
     156      * @param  iButton3           Brings the button 3 type.
     157      * @param  strButtonText1     Brings the button 1 text.
     158      * @param  strButtonText2     Brings the button 2 text.
     159      * @param  strButtonText3     Brings the button 3 text. */
     160    int question(QWidget *pParent, MessageType enmType,
    110161                 const QString &strMessage,
    111162                 const char *pcszAutoConfirmId = 0,
     
    115166                 const QString &strButtonText3 = QString()) const;
    116167
    117     /* API: Wrapper to 'question' function,
    118      * Question providing two buttons (OK and Cancel by default): */
    119     bool questionBinary(QWidget *pParent, MessageType type,
     168    /** Shows a 'Binary' type of 'Question'.
     169      * Omit details. Provides Ok and Cancel buttons (called same way by default).
     170      * @param  pParent              Brings the message-box parent.
     171      * @param  enmType              Brings the message-box type.
     172      * @param  strMessage           Brings the message.
     173      * @param  pcszAutoConfirmId    Brings the auto-confirm ID.
     174      * @param  strOkButtonText      Brings the button 1 text.
     175      * @param  strCancelButtonText  Brings the button 2 text.
     176      * @param  fDefaultFocusForOk   Brings whether Ok button should be focused initially. */
     177    bool questionBinary(QWidget *pParent, MessageType enmType,
    120178                        const QString &strMessage,
    121179                        const char *pcszAutoConfirmId = 0,
     
    124182                        bool fDefaultFocusForOk = true) const;
    125183
    126     /* API: Wrapper to 'question' function,
    127      * Question providing three buttons (Yes, No and Cancel by default): */
    128     int questionTrinary(QWidget *pParent, MessageType type,
     184    /** Shows a 'Trinary' type of 'Question'.
     185      * Omit details. Provides Yes, No and Cancel buttons (called same way by default).
     186      * @param  pParent               Brings the message-box parent.
     187      * @param  enmType               Brings the message-box type.
     188      * @param  strMessage            Brings the message.
     189      * @param  pcszAutoConfirmId     Brings the auto-confirm ID.
     190      * @param  strChoice1ButtonText  Brings the button 1 text.
     191      * @param  strChoice2ButtonText  Brings the button 2 text.
     192      * @param  strCancelButtonText   Brings the button 3 text. */
     193    int questionTrinary(QWidget *pParent, MessageType enmType,
    129194                        const QString &strMessage,
    130195                        const char *pcszAutoConfirmId = 0,
     
    133198                        const QString &strCancelButtonText = QString()) const;
    134199
    135     /* API: One more main function: */
    136     int messageWithOption(QWidget *pParent, MessageType type,
     200    /** Shows a general type of 'Message with Option'.
     201      * @param  pParent              Brings the message-box parent.
     202      * @param  enmType              Brings the message-box type.
     203      * @param  strMessage           Brings the message.
     204      * @param  strOptionText        Brings the option text.
     205      * @param  fDefaultOptionValue  Brings the default option value.
     206      * @param  iButton1             Brings the button 1 type.
     207      * @param  iButton2             Brings the button 2 type.
     208      * @param  iButton3             Brings the button 3 type.
     209      * @param  strButtonText1       Brings the button 1 text.
     210      * @param  strButtonText2       Brings the button 2 text.
     211      * @param  strButtonText3       Brings the button 3 text. */
     212    int messageWithOption(QWidget *pParent, MessageType enmType,
    137213                          const QString &strMessage,
    138214                          const QString &strOptionText,
     
    143219                          const QString &strButtonText3 = QString()) const;
    144220
    145     /* API: Progress-dialog stuff: */
    146     bool showModalProgressDialog(CProgress &progress, const QString &strTitle,
     221    /** Shows modal progress-dialog.
     222      * @param  comProgress   Brings the progress this dialog is based on.
     223      * @param  strTitle      Brings the title.
     224      * @param  strImage      Brings the image.
     225      * @param  pParent       Brings the parent.
     226      * @param  cMinDuration  Brings the minimum diration to show this dialog after expiring it. */
     227    bool showModalProgressDialog(CProgress &comProgress, const QString &strTitle,
    147228                                 const QString &strImage = "", QWidget *pParent = 0,
    148229                                 int cMinDuration = 2000);
     
    390471private slots:
    391472
    392     /* Handler: Interthreading stuff: */
    393     void sltShowMessageBox(QWidget *pParent, MessageType type,
     473    /** Shows message-box.
     474      * @param  pParent           Brings the message-box parent.
     475      * @param  enmType           Brings the message-box type.
     476      * @param  strMessage        Brings the message.
     477      * @param  strDetails        Brings the details.
     478      * @param  iButton1          Brings the button 1 type.
     479      * @param  iButton2          Brings the button 2 type.
     480      * @param  iButton3          Brings the button 3 type.
     481      * @param  strButtonText1    Brings the button 1 text.
     482      * @param  strButtonText2    Brings the button 2 text.
     483      * @param  strButtonText3    Brings the button 3 text.
     484      * @param  strAutoConfirmId  Brings whether this message can be auto-confirmed. */
     485    void sltShowMessageBox(QWidget *pParent, MessageType enmType,
    394486                           const QString &strMessage, const QString &strDetails,
    395487                           int iButton1, int iButton2, int iButton3,
     
    399491private:
    400492
    401     /* Constructor/destructor: */
     493    /** Constructs message-center. */
    402494    UIMessageCenter();
     495    /** Destructs message-center. */
    403496    ~UIMessageCenter();
    404497
    405     /* Helpers: Prepare/cleanup stuff: */
     498    /** Prepares all. */
    406499    void prepare();
     500    /** Cleanups all. */
    407501    void cleanup();
    408502
    409     /* Helper: Message-box stuff: */
     503    /** Shows message-box.
     504      * @param  pParent           Brings the message-box parent.
     505      * @param  enmType           Brings the message-box type.
     506      * @param  strMessage        Brings the message.
     507      * @param  strDetails        Brings the details.
     508      * @param  iButton1          Brings the button 1 type.
     509      * @param  iButton2          Brings the button 2 type.
     510      * @param  iButton3          Brings the button 3 type.
     511      * @param  strButtonText1    Brings the button 1 text.
     512      * @param  strButtonText2    Brings the button 2 text.
     513      * @param  strButtonText3    Brings the button 3 text.
     514      * @param  strAutoConfirmId  Brings whether this message can be auto-confirmed. */
    410515    int showMessageBox(QWidget *pParent, MessageType type,
    411516                       const QString &strMessage, const QString &strDetails,
     
    414519                       const QString &strAutoConfirmId) const;
    415520
    416     /* Variables: */
     521    /** Holds the list of shown warnings. */
    417522    mutable QStringList m_warnings;
    418523
    419     /* API: Instance stuff: */
    420     static UIMessageCenter* m_spInstance;
    421     static UIMessageCenter* instance();
    422     friend UIMessageCenter& msgCenter();
     524    /** Holds the singleton message-center instance. */
     525    static UIMessageCenter *s_pInstance;
     526    /** Returns the singleton message-center instance. */
     527    static UIMessageCenter *instance();
     528    /** Allows for shortcut access. */
     529    friend UIMessageCenter &msgCenter();
    423530};
    424531
    425 /* Shortcut to the static UIMessageCenter::instance() method: */
    426 inline UIMessageCenter& msgCenter() { return *UIMessageCenter::instance(); }
    427 
    428 #endif // __UIMessageCenter_h__
     532/** Singleton Message Center 'official' name. */
     533inline UIMessageCenter &msgCenter() { return *UIMessageCenter::instance(); }
     534
     535
     536#endif /* !___UIMessageCenter_h___ */
     537
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette