VirtualBox

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


Ignore:
Timestamp:
May 26, 2021 3:43:54 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
144645
Message:

FE/Qt: bugref:10003: Introducing new UIColorThemeEditor class allowing to choose corresponding parameter; That stuff isn't yet used anywhere.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
1 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r89093 r89299  
    55
    66#
    7 # Copyright (C) 2006-2020 Oracle Corporation
     7# Copyright (C) 2006-2021 Oracle Corporation
    88#
    99# This file is part of VirtualBox Open Source Edition (OSE), as
     
    848848        src/settings/editors/UIBaseMemoryEditor.h \
    849849        src/settings/editors/UIBootOrderEditor.h \
     850        src/settings/editors/UIColorThemeEditor.h \
    850851        src/settings/editors/UIDefaultMachineFolderEditor.h \
    851852        src/settings/editors/UIGraphicsControllerEditor.h \
     
    13881389        src/settings/editors/UIBaseMemoryEditor.cpp \
    13891390        src/settings/editors/UIBootOrderEditor.cpp \
     1391        src/settings/editors/UIColorThemeEditor.cpp \
    13901392        src/settings/editors/UIDefaultMachineFolderEditor.cpp \
    13911393        src/settings/editors/UIGraphicsControllerEditor.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIColorThemeEditor.cpp

    r89263 r89299  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIVisualStateEditor class implementation.
     3 * VBox Qt GUI - UIColorThemeEditor class implementation.
    44 */
    55
    66/*
    7  * Copyright (C) 2019-2020 Oracle Corporation
     7 * Copyright (C) 2019-2021 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2323/* GUI includes: */
    2424#include "QIComboBox.h"
    25 #include "UICommon.h"
     25#include "UIColorThemeEditor.h"
    2626#include "UIConverter.h"
    27 #include "UIExtraDataManager.h"
    28 #include "UIVisualStateEditor.h"
    2927
    3028
    31 UIVisualStateEditor::UIVisualStateEditor(QWidget *pParent /* = 0 */, bool fWithLabel /* = false */)
     29UIColorThemeEditor::UIColorThemeEditor(QWidget *pParent /* = 0 */, bool fWithLabel /* = false */)
    3230    : QIWithRetranslateUI<QWidget>(pParent)
    3331    , m_fWithLabel(fWithLabel)
    34     , m_enmValue(UIVisualStateType_Invalid)
     32    , m_enmValue(UIColorThemeType_Auto)
    3533    , m_pLabel(0)
    3634    , m_pCombo(0)
     
    3937}
    4038
    41 void UIVisualStateEditor::setMachineId(const QUuid &uMachineId)
    42 {
    43     m_uMachineId = uMachineId;
    44 }
    45 
    46 void UIVisualStateEditor::setValue(UIVisualStateType enmValue)
     39void UIColorThemeEditor::setValue(UIColorThemeType enmValue)
    4740{
    4841    if (m_pCombo)
     
    6356}
    6457
    65 UIVisualStateType UIVisualStateEditor::value() const
     58UIColorThemeType UIColorThemeEditor::value() const
    6659{
    67     return m_pCombo ? m_pCombo->currentData().value<UIVisualStateType>() : m_enmValue;
     60    return m_pCombo ? m_pCombo->currentData().value<UIColorThemeType>() : m_enmValue;
    6861}
    6962
    70 void UIVisualStateEditor::retranslateUi()
     63void UIColorThemeEditor::retranslateUi()
    7164{
    7265    if (m_pLabel)
    73         m_pLabel->setText(tr("Visual &State:"));
     66        m_pLabel->setText(tr("Color &Theme:"));
    7467    if (m_pCombo)
    7568    {
    7669        for (int i = 0; i < m_pCombo->count(); ++i)
    7770        {
    78             const UIVisualStateType enmType = m_pCombo->itemData(i).value<UIVisualStateType>();
     71            const UIColorThemeType enmType = m_pCombo->itemData(i).value<UIColorThemeType>();
    7972            m_pCombo->setItemText(i, gpConverter->toString(enmType));
    8073        }
     
    8275}
    8376
    84 void UIVisualStateEditor::sltHandleCurrentIndexChanged()
     77void UIColorThemeEditor::sltHandleCurrentIndexChanged()
    8578{
    8679    if (m_pCombo)
    87         emit sigValueChanged(m_pCombo->itemData(m_pCombo->currentIndex()).value<UIVisualStateType>());
     80        emit sigValueChanged(m_pCombo->itemData(m_pCombo->currentIndex()).value<UIColorThemeType>());
    8881}
    8982
    90 void UIVisualStateEditor::prepare()
     83void UIColorThemeEditor::prepare()
    9184{
    9285    /* Create main layout: */
     
    117110                    m_pLabel->setBuddy(m_pCombo->focusProxy());
    118111                connect(m_pCombo, static_cast<void(QIComboBox::*)(int)>(&QIComboBox::currentIndexChanged),
    119                         this, &UIVisualStateEditor::sltHandleCurrentIndexChanged);
     112                        this, &UIColorThemeEditor::sltHandleCurrentIndexChanged);
    120113                pComboLayout->addWidget(m_pCombo);
    121114            }
     
    136129}
    137130
    138 void UIVisualStateEditor::populateCombo()
     131void UIColorThemeEditor::populateCombo()
    139132{
    140133    if (m_pCombo)
    141134    {
    142135        /* Clear combo first of all: */
    143         m_supportedValues.clear();
    144136        m_pCombo->clear();
    145137
    146138        /* Get possible values: */
    147         QList<UIVisualStateType> possibleValues;
    148         possibleValues << UIVisualStateType_Normal
    149                        << UIVisualStateType_Fullscreen
    150                        << UIVisualStateType_Seamless
    151                        << UIVisualStateType_Scale;
     139        QList<UIColorThemeType> possibleValues;
     140        possibleValues << UIColorThemeType_Auto
     141                       << UIColorThemeType_Light
     142                       << UIColorThemeType_Dark;
    152143
    153         /* Load currently supported visual state types: */
    154         const UIVisualStateType enmRestrictedTypes = m_uMachineId.isNull()
    155                                                    ? UIVisualStateType_Invalid
    156                                                    : gEDataManager->restrictedVisualStates(m_uMachineId);
    157         foreach (const UIVisualStateType &enmPossibleValue, possibleValues)
    158             if (!(enmPossibleValue & enmRestrictedTypes))
    159                 m_supportedValues << enmPossibleValue;
    160 
    161         /* Make sure requested value if sane is present as well: */
    162         if (   possibleValues.contains(m_enmValue)
    163             && !m_supportedValues.contains(m_enmValue))
    164             m_supportedValues.prepend(m_enmValue);
    165 
    166         /* Update combo with all the supported values: */
    167         foreach (const UIVisualStateType &enmType, m_supportedValues)
     144        /* Update combo with all the possible values: */
     145        foreach (const UIColorThemeType &enmType, possibleValues)
    168146            m_pCombo->addItem(QString(), QVariant::fromValue(enmType));
    169147
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIColorThemeEditor.h

    r89263 r89299  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIVisualStateEditor class declaration.
     3 * VBox Qt GUI - UIColorThemeEditor class declaration.
    44 */
    55
    66/*
    7  * Copyright (C) 2019-2020 Oracle Corporation
     7 * Copyright (C) 2019-2021 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1616 */
    1717
    18 #ifndef FEQT_INCLUDED_SRC_settings_editors_UIVisualStateEditor_h
    19 #define FEQT_INCLUDED_SRC_settings_editors_UIVisualStateEditor_h
     18#ifndef FEQT_INCLUDED_SRC_settings_editors_UIColorThemeEditor_h
     19#define FEQT_INCLUDED_SRC_settings_editors_UIColorThemeEditor_h
    2020#ifndef RT_WITHOUT_PRAGMA_ONCE
    2121# pragma once
     
    2323
    2424/* Qt includes: */
    25 #include <QUuid>
    2625#include <QWidget>
    2726
     
    3534class QIComboBox;
    3635
    37 /** QWidget subclass used as a visual state editor. */
    38 class SHARED_LIBRARY_STUFF UIVisualStateEditor : public QIWithRetranslateUI<QWidget>
     36/** QWidget subclass used as a color theme editor. */
     37class SHARED_LIBRARY_STUFF UIColorThemeEditor : public QIWithRetranslateUI<QWidget>
    3938{
    4039    Q_OBJECT;
     
    4342
    4443    /** Notifies listeners about @a enmValue change. */
    45     void sigValueChanged(UIVisualStateType enmValue);
     44    void sigValueChanged(UIColorThemeType enmValue);
    4645
    4746public:
    4847
    49     /** Constructs visual state editor passing @a pParent to the base-class.
     48    /** Constructs color theme editor passing @a pParent to the base-class.
    5049      * @param  fWithLabel  Brings whether we should add label ourselves. */
    51     UIVisualStateEditor(QWidget *pParent = 0, bool fWithLabel = false);
    52 
    53     /** Defines editor @a uMachineId. */
    54     void setMachineId(const QUuid &uMachineId);
     50    UIColorThemeEditor(QWidget *pParent = 0, bool fWithLabel = false);
    5551
    5652    /** Defines editor @a enmValue. */
    57     void setValue(UIVisualStateType enmValue);
     53    void setValue(UIColorThemeType enmValue);
    5854    /** Returns editor value. */
    59     UIVisualStateType value() const;
    60 
    61     /** Returns the vector of supported values. */
    62     QVector<UIVisualStateType> supportedValues() const { return m_supportedValues; }
     55    UIColorThemeType value() const;
    6356
    6457protected:
     
    7972    void populateCombo();
    8073
    81     /** Holds the machine id. */
    82     QUuid  m_uMachineId;
    83 
    8474    /** Holds whether descriptive label should be created. */
    8575    bool  m_fWithLabel;
    8676
    8777    /** Holds the value to be selected. */
    88     UIVisualStateType  m_enmValue;
    89 
    90     /** Holds the vector of supported values. */
    91     QVector<UIVisualStateType>  m_supportedValues;
     78    UIColorThemeType  m_enmValue;
    9279
    9380    /** Holds the label instance. */
     
    9784};
    9885
    99 #endif /* !FEQT_INCLUDED_SRC_settings_editors_UIVisualStateEditor_h */
     86#endif /* !FEQT_INCLUDED_SRC_settings_editors_UIColorThemeEditor_h */
Note: See TracChangeset for help on using the changeset viewer.

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