VirtualBox

Changeset 89926 in vbox for trunk


Ignore:
Timestamp:
Jun 28, 2021 9:22:36 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145384
Message:

FE/Qt: bugref:10049. Refactoring message dialog code to enable a 4th. button as HelpButton

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.cpp

    r83535 r89926  
    313313        case AlertButton_Choice2: strText = tr("No");     role = QDialogButtonBox::NoRole; break;
    314314        case AlertButton_Copy:    strText = tr("Copy");   role = QDialogButtonBox::ActionRole; break;
     315        case AlertButton_Help:    strText = tr("Copy");   role = QDialogButtonBox::HelpRole; break;
    315316        default:
    316317            AssertMsgFailed(("Type %d is not supported!", iButton));
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.h

    r83535 r89926  
    4747    AlertButton_Choice2       =  0x8,  /* 00000000 00001000 */
    4848    AlertButton_Copy          = 0x10,  /* 00000000 00010000 */
     49    AlertButton_Help          = 0x11,  /* 00000000 00010001 */
    4950    AlertButtonMask           = 0xFF   /* 00000000 11111111 */
    5051};
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r89851 r89926  
    160160                             int iButton2 /* = 0*/,
    161161                             int iButton3 /* = 0*/,
     162                             int iButton4 /* = 0*/,
    162163                             const QString &strButtonText1 /* = QString() */,
    163164                             const QString &strButtonText2 /* = QString() */,
    164                              const QString &strButtonText3 /* = QString() */) const
     165                             const QString &strButtonText3 /* = QString() */,
     166                             const QString &strButtonText4 /* = QString() */) const
    165167{
    166168    /* If this is NOT a GUI thread: */
     
    171173        emit sigToShowMessageBox(pParent, enmType,
    172174                                 strMessage, strDetails,
    173                                  iButton1, iButton2, iButton3,
    174                                  strButtonText1, strButtonText2, strButtonText3,
     175                                 iButton1, iButton2, iButton3, iButton4,
     176                                 strButtonText1, strButtonText2, strButtonText3, strButtonText4,
    175177                                 QString(pcszAutoConfirmId));
    176178        /* Inter-thread communications are not yet implemented: */
     
    205207                    AlertButton_Cancel | AlertButtonOption_Escape,
    206208                    0 /* third button */,
     209                    0 /* fourth button */,
    207210                    strOkButtonText,
    208211                    strCancelButtonText,
    209                     QString() /* third button */) &
     212                    QString() /* third button */,
     213                    QString() /* fourth button */) &
    210214            AlertButtonMask) == AlertButton_Ok;
    211215}
     
    224228                              int iButton2 /* = 0*/,
    225229                              int iButton3 /* = 0*/,
     230                              int iButton4 /* = 0*/,
    226231                              const QString &strButtonText1 /* = QString()*/,
    227232                              const QString &strButtonText2 /* = QString()*/,
    228                               const QString &strButtonText3 /* = QString()*/) const
     233                              const QString &strButtonText3 /* = QString()*/,
     234                              const QString &strButtonText4 /* = QString()*/) const
    229235{
    230236    return message(pParent, enmType, strMessage, QString(), pcszAutoConfirmId,
    231                    iButton1, iButton2, iButton3, strButtonText1, strButtonText2, strButtonText3);
     237                   iButton1, iButton2, iButton3, iButton4, strButtonText1, strButtonText2, strButtonText3, strButtonText4);
    232238}
    233239
     
    244250                      AlertButton_Cancel | AlertButtonOption_Escape,
    245251                      0 /* third button */,
     252                      0 /* fourth button */,
    246253                      strOkButtonText,
    247254                      strCancelButtonText,
    248                       QString() /* third button */) &
     255                      QString() /* third button */,
     256                      QString() /* fourth button */) &
    249257             AlertButtonMask) == AlertButton_Ok) :
    250258           ((question(pParent, enmType, strMessage, pcszAutoConfirmId,
     
    252260                      AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape,
    253261                      0 /* third button */,
     262                      0 /* fourth button */,
    254263                      strOkButtonText,
    255264                      strCancelButtonText,
    256                       QString() /* third button */) &
     265                      QString() /* third button */,
     266                      QString() /* fourth button */) &
    257267             AlertButtonMask) == AlertButton_Ok);
    258268}
     
    269279                    AlertButton_Choice2 | AlertButtonOption_Default,
    270280                    AlertButton_Cancel | AlertButtonOption_Escape,
     281                    0 /* fourth button */,
    271282                    strChoice1ButtonText,
    272283                    strChoice2ButtonText,
    273                     strCancelButtonText);
     284                    strCancelButtonText,
     285                    QString() /* fourth button text*/);
    274286}
    275287
     
    281293                                       int iButton2 /* = 0*/,
    282294                                       int iButton3 /* = 0*/,
     295                                       int iButton4 /* = 0*/,
    283296                                       const QString &strButtonName1 /* = QString() */,
    284297                                       const QString &strButtonName2 /* = QString() */,
    285                                        const QString &strButtonName3 /* = QString() */) const
     298                                       const QString &strButtonName3 /* = QString() */,
     299                                       const QString &strButtonName4 /* = QString() */) const
    286300{
    287301    /* If no buttons are set, using single 'OK' button: */
    288     if (iButton1 == 0 && iButton2 == 0 && iButton3 == 0)
     302    if (iButton1 == 0 && iButton2 == 0 && iButton3 == 0 && iButton4 == 0)
    289303        iButton1 = AlertButton_Ok | AlertButtonOption_Default;
    290304
     
    341355    if (!strButtonName3.isNull())
    342356        pBox->setButtonText(2, strButtonName3);
     357    if (!strButtonName4.isNull())
     358        pBox->setButtonText(3, strButtonName4);
    343359
    344360    /* Show box: */
     
    762778                   AlertButton_Ok,
    763779                   AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape,
    764                    0,
     780                   0 /* button 3 */,
     781                   0 /* button 4 */,
    765782                   tr("Remove")) :
    766783           message(0, MessageType_Question,
     
    770787                   AlertButton_Choice2,
    771788                   AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape,
     789                   0 /* button 4 */,
    772790                   tr("Delete all files"),
    773791                   tr("Remove only"));
     
    798816                   AlertButton_Choice2,
    799817                   AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape,
     818                   0 /* button 4 */,
    800819                   tr("Delete everything"),
    801820                   tr("Remove only"));
     
    11271146                             AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape,
    11281147                             0 /* 3rd button */,
     1148                             0 /* 4th button */,
    11291149                             tr("Restore"), tr("Cancel"), QString() /* 3rd button text */) :
    11301150           message(0, MessageType_Question,
     
    11361156                   AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape,
    11371157                   0 /* 3rd button */,
     1158                   0 /* 4th button */,
    11381159                   tr("Restore"), tr("Cancel"), QString() /* 3rd button text */);
    11391160}
     
    22172238                    AlertButton_Choice2,
    22182239                    AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape,
     2240                    0 /* 4th button */,
    22192241                    tr("Accept", "cloud profile manager changes"),
    22202242                    tr("Reject", "cloud profile manager changes"));
     
    27532775                      AlertButton_Ok | AlertButtonOption_Default,
    27542776                      AlertButton_Cancel | AlertButtonOption_Escape,
    2755                       0,
     2777                      0 /* 3rd button */,
     2778                      0 /* 4th button */,
    27562779                      tr("Capture", "do input capture"));
    27572780    /* Was the message auto-confirmed? */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r89851 r89926  
    7171      * @param  iButton2          Brings the button 2 type.
    7272      * @param  iButton3          Brings the button 3 type.
     73      * @param  iButton4          Brings the button 4 type.
    7374      * @param  strButtonText1    Brings the button 1 text.
    7475      * @param  strButtonText2    Brings the button 2 text.
    7576      * @param  strButtonText3    Brings the button 3 text.
     77      * @param  strButtonText4    Brings the button 4 text.
    7678      * @param  strAutoConfirmId  Brings whether this message can be auto-confirmed. */
    7779    void sigToShowMessageBox(QWidget *pParent, MessageType enmType,
    7880                             const QString &strMessage, const QString &strDetails,
    79                              int iButton1, int iButton2, int iButton3,
    80                              const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3,
     81                             int iButton1, int iButton2, int iButton3, int iButton4,
     82                             const QString &strButtonText1, const QString &strButtonText2,
     83                             const QString &strButtonText3, const QString &strButtonText4,
    8184                             const QString &strAutoConfirmId) const;
    8285
     
    102105      * @param  iButton2           Brings the button 2 type.
    103106      * @param  iButton3           Brings the button 3 type.
     107      * @param  iButton4           Brings the button 4 type.
    104108      * @param  strButtonText1     Brings the button 1 text.
    105109      * @param  strButtonText2     Brings the button 2 text.
    106       * @param  strButtonText3     Brings the button 3 text. */
     110      * @param  strButtonText3     Brings the button 3 text.
     111      * @param  strButtonText3     Brings the button 4 text. */
    107112    int message(QWidget *pParent, MessageType enmType,
    108113                const QString &strMessage, const QString &strDetails,
    109114                const char *pcszAutoConfirmId = 0,
    110                 int iButton1 = 0, int iButton2 = 0, int iButton3 = 0,
     115                int iButton1 = 0, int iButton2 = 0, int iButton3 = 0, int iButton4 = 0,
    111116                const QString &strButtonText1 = QString(),
    112117                const QString &strButtonText2 = QString(),
    113                 const QString &strButtonText3 = QString()) const;
     118                const QString &strButtonText3 = QString(),
     119                const QString &strButtonText4 = QString()) const;
    114120
    115121    /** Shows an 'Error' type of 'Message'.
     
    160166      * @param  iButton2           Brings the button 2 type.
    161167      * @param  iButton3           Brings the button 3 type.
     168      * @param  iButton4           Brings the button 4 type.
    162169      * @param  strButtonText1     Brings the button 1 text.
    163170      * @param  strButtonText2     Brings the button 2 text.
    164       * @param  strButtonText3     Brings the button 3 text. */
     171      * @param  strButtonText3     Brings the button 3 text.
     172      * @param  strButtonText4     Brings the button 4 text. */
    165173    int question(QWidget *pParent, MessageType enmType,
    166174                 const QString &strMessage,
    167175                 const char *pcszAutoConfirmId = 0,
    168                  int iButton1 = 0, int iButton2 = 0, int iButton3 = 0,
     176                 int iButton1 = 0, int iButton2 = 0, int iButton3 = 0, int iButton4 = 0,
    169177                 const QString &strButtonText1 = QString(),
    170178                 const QString &strButtonText2 = QString(),
    171                  const QString &strButtonText3 = QString()) const;
     179                 const QString &strButtonText3 = QString(),
     180                 const QString &strButtonText4 = QString()) const;
    172181
    173182    /** Shows a 'Binary' type of 'Question'.
     
    212221      * @param  iButton2             Brings the button 2 type.
    213222      * @param  iButton3             Brings the button 3 type.
     223      * @param  iButton4             Brings the button 4 type.
    214224      * @param  strButtonText1       Brings the button 1 text.
    215225      * @param  strButtonText2       Brings the button 2 text.
     
    219229                          const QString &strOptionText,
    220230                          bool fDefaultOptionValue = true,
    221                           int iButton1 = 0, int iButton2 = 0, int iButton3 = 0,
     231                          int iButton1 = 0, int iButton2 = 0, int iButton3 = 0, int iButton4 = 0,
    222232                          const QString &strButtonText1 = QString(),
    223233                          const QString &strButtonText2 = QString(),
    224                           const QString &strButtonText3 = QString()) const;
     234                          const QString &strButtonText3 = QString(),
     235                          const QString &strButtonText4 = QString()) const;
    225236
    226237    /** Shows modal progress-dialog.
Note: See TracChangeset for help on using the changeset viewer.

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