VirtualBox

Changeset 47595 in vbox for trunk/src


Ignore:
Timestamp:
Aug 7, 2013 3:00:01 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Settings dialog: New validation stuff: Step 6 (Validation mechanism now uses icons related to particular failed pages).

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
8 edited
15 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/VirtualBox2.qrc

    r46626 r47595  
    200200        <file alias="sf_settings_16px.png">images/sf_settings_16px.png</file>
    201201        <file alias="sf_settings_disabled_16px.png">images/sf_settings_disabled_16px.png</file>
     202        <file alias="chipset_warning_16px.png">images/chipset_warning_16px.png</file>
     203        <file alias="extension_pack_warning_16px.png">images/extension_pack_warning_16px.png</file>
     204        <file alias="hd_warning_16px.png">images/hd_warning_16px.png</file>
     205        <file alias="hostkey_warning_16px.png">images/hostkey_warning_16px.png</file>
     206        <file alias="machine_warning_16px.png">images/machine_warning_16px.png</file>
     207        <file alias="nw_warning_16px.png">images/nw_warning_16px.png</file>
     208        <file alias="parallel_port_warning_16px.png">images/parallel_port_warning_16px.png</file>
     209        <file alias="proxy_warning_16px.png">images/proxy_warning_16px.png</file>
     210        <file alias="refresh_warning_16px.png">images/refresh_warning_16px.png</file>
     211        <file alias="serial_port_warning_16px.png">images/serial_port_warning_16px.png</file>
     212        <file alias="sf_warning_16px.png">images/sf_warning_16px.png</file>
     213        <file alias="site_warning_16px.png">images/site_warning_16px.png</file>
     214        <file alias="sound_warning_16px.png">images/sound_warning_16px.png</file>
     215        <file alias="usb_warning_16px.png">images/usb_warning_16px.png</file>
     216        <file alias="vrdp_warning_16px.png">images/vrdp_warning_16px.png</file>
    202217    </qresource>
    203218</RCC>
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverter.h

    r42526 r47595  
    5050        Assert(0); return QPixmap();
    5151    }
     52    /* QPixmap <= template class: */
     53    template<class T> QPixmap toWarningPixmap(const T &data) const
     54    {
     55        if (canConvert<T>())
     56            return ::toWarningPixmap(data);
     57        Assert(0); return QPixmap();
     58    }
    5259
    5360    /* QString <= template class: */
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h

    r47478 r47595  
    3939 * This function returns null QPixmap for any object type until re-determined for specific one. */
    4040template<class X> QPixmap toPixmap(const X & /* xobject */) { Assert(0); return QPixmap(); }
     41/* Converts passed 'Object X' to QPixmap.
     42 * This function returns null QPixmap for any object type until re-determined for specific one. */
     43template<class X> QPixmap toWarningPixmap(const X & /* xobject */) { Assert(0); return QPixmap(); }
    4144
    4245/* Converts passed 'Object of type X' to QString.
     
    100103template<> QString toInternalString(const GlobalSettingsPageType &globalSettingsPageType);
    101104template<> GlobalSettingsPageType fromInternalString<GlobalSettingsPageType>(const QString &strGlobalSettingsPageType);
     105template<> QPixmap toWarningPixmap(const GlobalSettingsPageType &globalSettingsPageType);
    102106template<> QString toInternalString(const MachineSettingsPageType &machineSettingsPageType);
    103107template<> MachineSettingsPageType fromInternalString<MachineSettingsPageType>(const QString &strMachineSettingsPageType);
     108template<> QPixmap toWarningPixmap(const MachineSettingsPageType &machineSettingsPageType);
    104109template<> QString toInternalString(const IndicatorType &indicatorType);
    105110template<> IndicatorType fromInternalString<IndicatorType>(const QString &strIndicatorType);
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp

    r47594 r47595  
    496496    /* Corresponding type for known words: */
    497497    return values.at(keys.indexOf(QRegExp(strGlobalSettingsPageType, Qt::CaseInsensitive)));
     498}
     499
     500/* QPixmap <= GlobalSettingsPageType: */
     501template<> QPixmap toWarningPixmap(const GlobalSettingsPageType &type)
     502{
     503    switch (type)
     504    {
     505        case GlobalSettingsPageType_General:    return QPixmap(":/machine_warning_16px.png");
     506        case GlobalSettingsPageType_Input:      return QPixmap(":/hostkey_warning_16px.png");
     507        case GlobalSettingsPageType_Update:     return QPixmap(":/refresh_warning_16px.png");
     508        case GlobalSettingsPageType_Language:   return QPixmap(":/site_warning_16px.png");
     509        case GlobalSettingsPageType_Display:    return QPixmap(":/vrdp_warning_16px.png");
     510        case GlobalSettingsPageType_Network:    return QPixmap(":/nw_warning_16px.png");
     511        case GlobalSettingsPageType_Extensions: return QPixmap(":/extension_pack_warning_16px.png");
     512        case GlobalSettingsPageType_Proxy:      return QPixmap(":/proxy_warning_16px.png");
     513        default: AssertMsgFailed(("No pixmap for %d", type)); break;
     514    }
     515    return QPixmap();
    498516}
    499517
     
    548566}
    549567
     568/* QPixmap <= MachineSettingsPageType: */
     569template<> QPixmap toWarningPixmap(const MachineSettingsPageType &type)
     570{
     571    switch (type)
     572    {
     573        case MachineSettingsPageType_General:  return QPixmap(":/machine_warning_16px.png");
     574        case MachineSettingsPageType_System:   return QPixmap(":/chipset_warning_16px.png");
     575        case MachineSettingsPageType_Display:  return QPixmap(":/vrdp_warning_16px.png");
     576        case MachineSettingsPageType_Storage:  return QPixmap(":/hd_warning_16px.png");
     577        case MachineSettingsPageType_Audio:    return QPixmap(":/sound_warning_16px.png");
     578        case MachineSettingsPageType_Network:  return QPixmap(":/nw_warning_16px.png");
     579        case MachineSettingsPageType_Ports:    return QPixmap(":/serial_port_warning_16px.png");
     580        case MachineSettingsPageType_Serial:   return QPixmap(":/serial_port_warning_16px.png");
     581        case MachineSettingsPageType_Parallel: return QPixmap(":/parallel_port_warning_16px.png");
     582        case MachineSettingsPageType_USB:      return QPixmap(":/usb_warning_16px.png");
     583        case MachineSettingsPageType_SF:       return QPixmap(":/sf_warning_16px.png");
     584        default: AssertMsgFailed(("No pixmap for %d", type)); break;
     585    }
     586    return QPixmap();
     587}
     588
    550589/* QString <= IndicatorType: */
    551590template<> QString toInternalString(const IndicatorType &indicatorType)
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp

    r47581 r47595  
    120120    /* Setup error & warning stuff: */
    121121    m_pStatusBar->addWidget(m_pWarningPane);
    122     m_errorIcon = UIIconPool::defaultIcon(UIIconPool::MessageBoxCriticalIcon, this).pixmap(16, 16);
    123     m_warningIcon = UIIconPool::defaultIcon(UIIconPool::MessageBoxWarningIcon, this).pixmap(16, 16);
    124122
    125123    /* Setup whatsthis stuff: */
     
    371369            UISettingsPage *pFailedSettingsPage = pValidator->page();
    372370            LogRel(("Settings Dialog:  Dialog validation FAILED: Page *%s*\n",
    373                     gpConverter->toInternalString((MachineSettingsPageType)pFailedSettingsPage->id()).toUtf8().constData()));
     371                    pFailedSettingsPage->internalName().toUtf8().constData()));
    374372
    375373            /* Show error first: */
     
    378376                m_fValid = false;
    379377                setError(pValidator->lastMessage());
    380                 m_pWarningPane->setWarningPixmap(m_errorIcon);
    381378                m_pWarningPane->setWarningText(m_strErrorHint);
    382379#ifdef Q_WS_MAC
     
    389386                m_fSilent = false;
    390387                setWarning(pValidator->lastMessage());
    391                 m_pWarningPane->setWarningPixmap(m_warningIcon);
    392388                m_pWarningPane->setWarningText(m_strWarningHint);
    393389#ifdef Q_WS_MAC
     
    396392            }
    397393
     394            /* Configure warning pixmap: */
     395            m_pWarningPane->setWarningPixmap(pFailedSettingsPage->warningPixmap());
     396
    398397            /* Stop dialog revalidation on first error/warning: */
    399             if (!m_fValid || !m_fSilent)
    400                 break;
     398            break;
    401399        }
    402400    }
     
    419417    {
    420418        /* Determine settings-page name: */
    421         const QString strPageName(gpConverter->toInternalString((MachineSettingsPageType)pSettingsPage->id()));
     419        const QString strPageName(pSettingsPage->internalName());
    422420
    423421        LogRel(("Settings Dialog: %s Page: Revalidation in progress..\n",
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h

    r47563 r47595  
    143143    QString m_strErrorString;
    144144    QString m_strWarningString;
    145     QPixmap m_errorIcon;
    146     QPixmap m_warningIcon;
    147145    VBoxWarningPane *m_pWarningPane;
    148146
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.cpp

    r47579 r47595  
    1919
    2020/* GUI includes: */
     21#include "UIConverter.h"
    2122#include "UISettingsPage.h"
    2223#include "QIWidgetValidator.h"
     
    5960}
    6061
     62GlobalSettingsPageType UISettingsPageGlobal::internalID() const
     63{
     64    return static_cast<GlobalSettingsPageType>(id());
     65}
     66
     67QString UISettingsPageGlobal::internalName() const
     68{
     69    return gpConverter->toInternalString(internalID());
     70}
     71
     72QPixmap UISettingsPageGlobal::warningPixmap() const
     73{
     74    return gpConverter->toWarningPixmap(internalID());
     75}
     76
    6177/* Fetch data to m_properties & m_settings: */
    6278void UISettingsPageGlobal::fetchData(const QVariant &data)
     
    7894}
    7995
     96MachineSettingsPageType UISettingsPageMachine::internalID() const
     97{
     98    return static_cast<MachineSettingsPageType>(id());
     99}
     100
     101QString UISettingsPageMachine::internalName() const
     102{
     103    return gpConverter->toInternalString(internalID());
     104}
     105
     106QPixmap UISettingsPageMachine::warningPixmap() const
     107{
     108    return gpConverter->toWarningPixmap(internalID());
     109}
     110
    80111/* Fetch data to m_machine & m_console: */
    81112void UISettingsPageMachine::fetchData(const QVariant &data)
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h

    r47579 r47595  
    2626/* GUI includes: */
    2727#include "QIWithRetranslateUI.h"
     28#include "UIDefs.h"
    2829#include "UISettingsDefs.h"
    2930#include "VBoxGlobalSettings.h"
     
    118119    int id() const { return m_cId; }
    119120    void setId(int cId) { m_cId = cId; }
     121
     122    /* Page 'name' stuff: */
     123    virtual QString internalName() const = 0;
     124
     125    /* Page 'warning pixmap' stuff: */
     126    virtual QPixmap warningPixmap() const = 0;
    120127
    121128    /* Page 'processed' stuff: */
     
    163170    UISettingsPageGlobal();
    164171
     172    /* Page 'ID' stuff: */
     173    GlobalSettingsPageType internalID() const;
     174
     175    /* Page 'name' stuff: */
     176    QString internalName() const;
     177
     178    /* Page 'warning pixmap' stuff: */
     179    QPixmap warningPixmap() const;
     180
    165181    /* Fetch data to m_properties & m_settings: */
    166182    void fetchData(const QVariant &data);
     
    187203    UISettingsPageMachine();
    188204
     205    /* Page 'ID' stuff: */
     206    MachineSettingsPageType internalID() const;
     207
     208    /* Page 'name' stuff: */
     209    QString internalName() const;
     210
     211    /* Page 'warning pixmap' stuff: */
     212    QPixmap warningPixmap() const;
     213
    189214    /* Fetch data to m_machine: */
    190215    void fetchData(const QVariant &data);
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