VirtualBox

Ignore:
Timestamp:
Apr 3, 2013 7:28:29 AM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: QIMessageBox cleanup/rework (part 1).

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

Legend:

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

    r45192 r45295  
    5151 */
    5252QIMessageBox::QIMessageBox (const QString &aCaption, const QString &aText,
    53                             Icon aIcon, int aButton0, int aButton1, int aButton2,
     53                            IconType aIcon, int aButton0, int aButton1, int aButton2,
    5454                            QWidget *aParent, const char *aName, bool aModal)
    5555    : QIDialog (aParent)
     
    156156    /* If this is an error message add an "Copy to clipboard" button for easier
    157157     * bug reports. */
    158     if (aIcon == QIMessageBox::Critical)
     158    if (aIcon == QIMessageBox::IconType_Critical)
    159159    {
    160160        QPushButton *pCopyButton = createButton(Copy);
     
    316316}
    317317
    318 QPixmap QIMessageBox::standardPixmap (QIMessageBox::Icon aIcon)
     318QPixmap QIMessageBox::standardPixmap (QIMessageBox::IconType aIcon)
    319319{
    320320    QIcon icon;
    321321    switch (aIcon)
    322322    {
    323         case QIMessageBox::Information:
     323        case QIMessageBox::IconType_Information:
    324324            icon = UIIconPool::defaultIcon(UIIconPool::MessageBoxInformationIcon, this);
    325325            break;
     
    327327            icon = UIIconPool::defaultIcon(UIIconPool::MessageBoxWarningIcon, this);
    328328            break;
    329         case QIMessageBox::Critical:
     329        case QIMessageBox::IconType_Critical:
    330330            icon = UIIconPool::defaultIcon(UIIconPool::MessageBoxCriticalIcon, this);
    331331            break;
    332         case QIMessageBox::Question:
     332        case QIMessageBox::IconType_Question:
    333333            icon = UIIconPool::defaultIcon(UIIconPool::MessageBoxQuestionIcon, this);
    334334            break;
    335         case QIMessageBox::GuruMeditation:
     335        case QIMessageBox::IconType_GuruMeditation:
    336336            icon = QIcon(":/meditation_32px.png");
    337337            break;
     
    364364        mTextLabel->useSizeHintForWidth (mTextLabel->width());
    365365        mTextLabel->updateGeometry();
    366         setFixedWidth (width());
     366        setFixedSize(size());
    367367        mDetailsSplitter->toggleWidget();
    368368        mWasPolished = true;
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.h

    r45192 r45295  
    66
    77/*
    8  * Copyright (C) 2006-2012 Oracle Corporation
     8 * Copyright (C) 2006-2013 Oracle Corporation
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2020#define __QIMessageBox_h__
    2121
    22 /* VBox includes */
    23 #include "QIDialog.h"
    24 
    25 /* Qt includes */
     22/* Qt includes: */
    2623#include <QCheckBox>
    2724#include <QMessageBox>
    2825#include <QTextEdit>
    2926
    30 /* VBox forwards */
     27/* GUI includes: */
     28#include "QIDialog.h"
     29
     30/* Forward declarations: */
     31class QCloseEvent;
     32class QLabel;
     33class QPushButton;
     34class QSpacerItem;
    3135class QIArrowSplitter;
    3236class QIDialogButtonBox;
    3337class QILabel;
    3438
    35 /* Qt forwards */
    36 class QCloseEvent;
    37 class QLabel;
    38 class QPushButton;
    39 class QSpacerItem;
    40 
    41 /** @class QIMessageBox
    42  *
    43  *  The QIMessageBox class is a message box similar to QMessageBox.
    44  *  It partly implements the QMessageBox interface and adds some enhanced
    45  *  functionality.
    46  */
     39/* QIDialog extension representing GUI alerts: */
    4740class QIMessageBox : public QIDialog
    4841{
     
    5144public:
    5245
    53     // for compatibility with QMessageBox
    54     enum Icon
     46    /* Icon type enumerator: */
     47    enum IconType
    5548    {
    56         NoIcon = QMessageBox::NoIcon,
    57         Information = QMessageBox::Information,
    58         Warning = QMessageBox::Warning,
    59         Critical = QMessageBox::Critical,
    60         Question = QMessageBox::Question,
    61         GuruMeditation,
     49        IconType_NoIcon = QMessageBox::NoIcon,
     50        IconType_Information = QMessageBox::Information,
     51        IconType_Warning = QMessageBox::Warning,
     52        IconType_Critical = QMessageBox::Critical,
     53        IconType_Question = QMessageBox::Question,
     54        IconType_GuruMeditation,
    6255    };
    6356
     
    7568
    7669    QIMessageBox (const QString &aCaption, const QString &aText,
    77                   Icon aIcon, int aButton0, int aButton1 = 0, int aButton2 = 0,
     70                  IconType aIcon, int aButton0, int aButton1 = 0, int aButton2 = 0,
    7871                  QWidget *aParent = 0, const char *aName = 0, bool aModal = TRUE);
    7972
     
    9083    void setDetailsText (const QString &aText);
    9184
    92     QPixmap standardPixmap (QIMessageBox::Icon aIcon);
     85    QPixmap standardPixmap (QIMessageBox::IconType aIcon);
    9386
    9487private:
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r45292 r45295  
    134134    /* Assign corresponding title and icon: */
    135135    QString strTitle;
    136     QIMessageBox::Icon icon;
     136    QIMessageBox::IconType icon;
    137137    switch (type)
    138138    {
     
    140140        case MessageType_Info:
    141141            strTitle = tr("VirtualBox - Information", "msg box title");
    142             icon = QIMessageBox::Information;
     142            icon = QIMessageBox::IconType_Information;
    143143            break;
    144144        case MessageType_Question:
    145145            strTitle = tr("VirtualBox - Question", "msg box title");
    146             icon = QIMessageBox::Question;
     146            icon = QIMessageBox::IconType_Question;
    147147            break;
    148148        case MessageType_Warning:
    149149            strTitle = tr("VirtualBox - Warning", "msg box title");
    150             icon = QIMessageBox::Warning;
     150            icon = QIMessageBox::IconType_Warning;
    151151            break;
    152152        case MessageType_Error:
    153153            strTitle = tr("VirtualBox - Error", "msg box title");
    154             icon = QIMessageBox::Critical;
     154            icon = QIMessageBox::IconType_Critical;
    155155            break;
    156156        case MessageType_Critical:
    157157            strTitle = tr("VirtualBox - Critical Error", "msg box title");
    158             icon = QIMessageBox::Critical;
     158            icon = QIMessageBox::IconType_Critical;
    159159            break;
    160160        case MessageType_GuruMeditation:
    161161            strTitle = "VirtualBox - Guru Meditation"; /* don't translate this */
    162             icon = QIMessageBox::GuruMeditation;
     162            icon = QIMessageBox::IconType_GuruMeditation;
    163163            break;
    164164    }
     
    795795    /* Show the message: */
    796796    message(mainWindowShown(), res.isWarning() ? MessageType_Warning : MessageType_Error,
    797              tr("Failed to access the USB subsystem."),
    798              formatErrorInfo(res),
    799              "cannotAccessUSB");
     797            tr("Failed to access the USB subsystem."),
     798            formatErrorInfo(res),
     799            "cannotAccessUSB");
    800800}
    801801
     
    29842984    /* Choose title and icon: */
    29852985    QString title;
    2986     QIMessageBox::Icon icon;
     2986    QIMessageBox::IconType icon;
    29872987    switch (type)
    29882988    {
     
    29902990        case MessageType_Info:
    29912991            title = tr("VirtualBox - Information", "msg box title");
    2992             icon = QIMessageBox::Information;
     2992            icon = QIMessageBox::IconType_Information;
    29932993            break;
    29942994        case MessageType_Question:
    29952995            title = tr("VirtualBox - MessageType_Question", "msg box title");
    2996             icon = QIMessageBox::Question;
     2996            icon = QIMessageBox::IconType_Question;
    29972997            break;
    29982998        case MessageType_Warning:
    29992999            title = tr("VirtualBox - MessageType_Warning", "msg box title");
    3000             icon = QIMessageBox::Warning;
     3000            icon = QIMessageBox::IconType_Warning;
    30013001            break;
    30023002        case MessageType_Error:
    30033003            title = tr("VirtualBox - MessageType_Error", "msg box title");
    3004             icon = QIMessageBox::Critical;
     3004            icon = QIMessageBox::IconType_Critical;
    30053005            break;
    30063006        case MessageType_Critical:
    30073007            title = tr("VirtualBox - MessageType_Critical MessageType_Error", "msg box title");
    3008             icon = QIMessageBox::Critical;
     3008            icon = QIMessageBox::IconType_Critical;
    30093009            break;
    30103010        case MessageType_GuruMeditation:
    30113011            title = "VirtualBox - Guru Meditation"; /* don't translate this */
    3012             icon = QIMessageBox::GuruMeditation;
     3012            icon = QIMessageBox::IconType_GuruMeditation;
    30133013            break;
    30143014    }
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