VirtualBox

Changeset 23368 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Sep 28, 2009 12:39:04 PM (15 years ago)
Author:
vboxsync
Message:

Fe/Qt: Added first runtime branding support for version reporting and about dialog.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h

    r23223 r23368  
    297297    void setMainWindow (QWidget *aMainWindow) { mMainWindow = aMainWindow; }
    298298    QWidget *mainWindow() const { return mMainWindow; }
     299
     300    /* branding */
     301    bool brandingIsActive (bool aForce = false);
     302    QString VBoxGlobal::brandingGetKey (QString aKey);
    299303
    300304    bool isVMConsoleProcess() const { return !vmUuid.isNull(); }
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxAboutDlg.cpp

    r22391 r23368  
    2222
    2323#include "VBoxAboutDlg.h"
     24#include "VBoxGlobal.h"
    2425
    2526/* Qt includes */
     27#include <QDir>
     28#include <QEvent>
    2629#include <QPainter>
    27 #include <QEvent>
    2830
    2931VBoxAboutDlg::VBoxAboutDlg (QWidget* aParent, const QString &aVersion)
    3032    : QIWithRetranslateUI2 <QIDialog> (aParent, Qt::CustomizeWindowHint |
    3133                                       Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
    32     mVersion (aVersion),
    33     mBgImage (":/about.png")
     34    mVersion (aVersion)
    3435{
    3536    retranslateUi();
     37
     38    /* Branding: Use a custom about splash picture if set */
     39    QString sSplash = vboxGlobal().brandingGetKey("UI/AboutSplash");
     40    QDir pathImage(sSplash);
     41    if (vboxGlobal().brandingIsActive() && !sSplash.isEmpty())
     42        mBgImage.load(pathImage.absolutePath());
     43    else /* ... or load the built-in picture */
     44        mBgImage.load(":/about.png");
    3645}
    3746
     
    6675    painter.drawPixmap (0, 0, mBgImage);
    6776    painter.setFont (font());
    68     painter.setPen (Qt::white);
     77
     78    /* Branding: Set a different text color (because splash also could be white),
     79                 otherwise use white as default color */
     80    QColor colorText(vboxGlobal().brandingGetKey("UI/AboutTextColor"));
     81    if (!colorText.name().isEmpty())
     82        painter.setPen (colorText.name());
     83    else
     84        painter.setPen (Qt::white);
    6985#if VBOX_OSE
    7086    painter.drawText (QRect (0, 400, 600, 32),
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp

    r23358 r23368  
    5454#include <QThread>
    5555#include <QPainter>
     56#include <QSettings>
    5657#include <QTimer>
    5758#include <QDir>
     
    754755
    755756    return *mConsoleWnd;
     757}
     758
     759bool VBoxGlobal::brandingIsActive (bool aForce /* = false*/)
     760{
     761    if (aForce)
     762        return true;
     763    return !VBoxGlobal::brandingGetKey("VerSuffix").isEmpty();
     764}
     765
     766/**
     767  * Gets a value from the global (platform-specific) application settings
     768  * (e.g. on Windows using the registry) for branding stuff
     769  */
     770QString VBoxGlobal::brandingGetKey (QString aKey)
     771{
     772    QSettings settings("Sun", "VirtualBox");
     773    return settings.value(QString("Branding/%1").arg(aKey)).toString();
    756774}
    757775
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp

    r23223 r23368  
    23462346{
    23472347    CVirtualBox vbox = vboxGlobal().virtualBox();
    2348     QString fullVersion (QString ("%1 r%2").arg (vbox.GetVersion())
    2349                                           .arg (vbox.GetRevision()));
     2348    QString fullVersion ;
     2349    if (vboxGlobal().brandingIsActive())
     2350    {
     2351        fullVersion = (QString ("%1 r%2 - %3").arg (vbox.GetVersion())
     2352                                              .arg (vbox.GetRevision())
     2353                                              .arg (vboxGlobal().brandingGetKey("Name")));
     2354    }
     2355    else
     2356    {
     2357        fullVersion = (QString ("%1 r%2").arg (vbox.GetVersion())
     2358                                         .arg (vbox.GetRevision()));
     2359    }
    23502360    AssertWrapperOk (vbox);
    23512361
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxUpdateDlg.cpp

    r21770 r23368  
    353353    /* Compose query */
    354354    QUrl url (mUrl);
    355     url.addQueryItem ("platform", vboxGlobal().virtualBox().GetPackageType());
    356     url.addQueryItem ("version", QString ("%1_%2").arg (vboxGlobal().virtualBox().GetVersion())
    357                                                   .arg (vboxGlobal().virtualBox().GetRevision()));
     355    url.addQueryItem ("platform", vboxGlobal().virtualBox().GetPackageType());   
     356    /* Branding: Check whether we have a local branding file which tells us our version suffix "FOO"
     357                     (e.g. 3.06.54321_FOO) to identify this installation */
     358    if (vboxGlobal().brandingIsActive())
     359    {       
     360        url.addQueryItem ("version", QString ("%1_%2_%3").arg (vboxGlobal().virtualBox().GetVersion())
     361                                                         .arg (vboxGlobal().virtualBox().GetRevision())
     362                                                         .arg (vboxGlobal().brandingGetKey("VerSuffix")));
     363    }
     364    else
     365    {
     366        /* Use hard coded version set by VBOX_VERSION_STRING */
     367        url.addQueryItem ("version", QString ("%1_%2").arg (vboxGlobal().virtualBox().GetVersion())
     368                                                      .arg (vboxGlobal().virtualBox().GetRevision()));
     369    }
    358370    url.addQueryItem ("count", QString::number (count));
    359371    url.addQueryItem ("branch", VBoxUpdateData (vboxGlobal().virtualBox().
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