VirtualBox

Changeset 57511 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 24, 2015 1:57:15 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: 7918: About VirtualBox Dialog Improvements: 1. Version text copyable and Uniform. 2. Dialog not closed on focus/mouse event.

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

Legend:

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

    r52722 r57511  
    2424# include <QEvent>
    2525# include <QPainter>
     26# include <QLabel>
    2627# include <iprt/path.h>
    2728# include <VBox/version.h> /* VBOX_VENDOR */
     
    3839
    3940VBoxAboutDlg::VBoxAboutDlg(QWidget *pParent, const QString &strVersion)
    40     : QIWithRetranslateUI2<QIDialog>(pParent, Qt::CustomizeWindowHint | Qt::WindowTitleHint)
     41    : QIWithRetranslateUI2<QIDialog>(pParent)
    4142    , m_strVersion(strVersion)
    4243{
     
    6364    m_pixmap = icon.pixmap(m_size);
    6465
     66    /* Create main layout: */
     67    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
     68
     69    /* Create label for version text: */
     70    m_pLabel = new QLabel();
     71    pMainLayout->addWidget(m_pLabel);
     72
     73    QPalette palette;
     74    /* Branding: Set a different text color (because splash also could be white),
     75     * otherwise use white as default color: */
     76    QString strColor = vboxGlobal().brandingGetKey("UI/AboutTextColor");
     77    if (!strColor.isEmpty())
     78        palette.setColor(QPalette::WindowText, QColor(strColor).name());
     79    else
     80        palette.setColor(QPalette::WindowText, Qt::black);
     81    m_pLabel->setPalette(palette);
     82    m_pLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
     83    m_pLabel->setFont(font());
     84
     85    pMainLayout->setAlignment(m_pLabel, Qt::AlignRight | Qt::AlignBottom);
     86
    6587    /* Translate: */
    6688    retranslateUi();
     
    7193    if (pEvent->type() == QEvent::Polish)
    7294        setFixedSize(m_size);
    73     if (pEvent->type() == QEvent::WindowDeactivate)
    74         close();
    7595    return QIDialog::event(pEvent);
    7696}
     
    80100    QPainter painter(this);
    81101    painter.drawPixmap(0, 0, m_pixmap);
    82     painter.setFont(font());
    83 
    84     /* Branding: Set a different text color (because splash also could be white),
    85                  otherwise use white as default color: */
    86     QString strColor = vboxGlobal().brandingGetKey("UI/AboutTextColor");
    87     if (!strColor.isEmpty())
    88         painter.setPen(QColor(strColor).name());
    89     else
    90         painter.setPen(Qt::black);
    91 #if VBOX_OSE
    92     painter.drawText(QRect(0, 400, 600, 32),
    93                      Qt::AlignCenter | Qt::AlignVCenter | Qt::TextWordWrap,
    94                      m_strAboutText);
    95 #else /* VBOX_OSE */
    96     painter.drawText(QRect(271, 370, 360, 72),
    97                      Qt::AlignLeft | Qt::AlignBottom | Qt::TextWordWrap,
    98                      m_strAboutText);
    99 #endif /* VBOX_OSE */
    100 }
    101 
    102 void VBoxAboutDlg::mouseReleaseEvent(QMouseEvent* /* pEvent */)
    103 {
    104     /* Close the dialog on mouse button release: */
    105     close();
    106102}
    107103
     
    109105{
    110106    setWindowTitle(tr("VirtualBox - About"));
    111     QString strAboutText =  tr("VirtualBox Graphical User Interface");
     107    QString strAboutText = tr("VirtualBox Graphical User Interface");
    112108#ifdef VBOX_BLEEDING_EDGE
    113109    QString strVersionText = "EXPERIMENTAL build %1 - " + QString(VBOX_BLEEDING_EDGE);
     
    121117    m_strAboutText = strAboutText + "\n" + strVersionText.arg(m_strVersion);
    122118#endif /* VBOX_OSE */
     119    m_strAboutText = m_strAboutText + "\n" + QString("Copyright %1 2015 Oracle and/or its affiliates. All rights reserved.").arg(QChar(0xa9));
     120    m_pLabel->setText(m_strAboutText);
    123121}
    124122
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxAboutDlg.h

    r55401 r57511  
    2828/* Forward declarations */
    2929class QEvent;
     30class QLabel;
    3031
    3132/* VBox about dialog */
     
    4445    bool event(QEvent *pEvent);
    4546    void paintEvent(QPaintEvent *pEvent);
    46     void mouseReleaseEvent(QMouseEvent *pEvent);
    4747
    4848    /* Language stuff: */
     
    5656    QPixmap m_pixmap;
    5757    QSize   m_size;
     58    QLabel *m_pLabel;
    5859};
    5960
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