VirtualBox

Ignore:
Timestamp:
Oct 17, 2019 8:08:23 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
134008
Message:

FE/Qt: bugref:6143. Some fixes on color themes.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard
Files:
2 edited

Legend:

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

    r81298 r81303  
    145145};
    146146/* Name, background color, normal font color, hover color, edited button background color, pressed button font color. */
    147 const char* predefinedColorThemes[][6] = {{"Solarized-Dark","#073642", "#586e75", "#dc322f", "#6c71c4", "#859900"},
    148                                           {"Solarized-Light","#b58900", "#586e75", "#dc322f", "#6c71c4", "#859900"},
    149                                           {0, 0, 0, 0, 0, 0}};
     147const char* predefinedColorThemes[][6] = {{"Clear Night","#000000", "#ffffff", "#859900", "#9b6767", "#000000"},
     148    {"Gobi Dark","#002b36", "#fdf6e3", "#859900", "#cb4b16", "#002b36"},
     149    {"Gobi Light","#fdf6e3", "#002b36", "#2aa198", "#cb4b16", "#bf4040"},
     150    {0, 0, 0, 0, 0, 0}};
    150151
    151152
     
    574575    const QString &name() const;
    575576    void setName(const QString &strName);
     577    void print();
    576578
    577579private:
     
    654656    QString currentColorThemeName() const;
    655657    void setColorTheme(const QString &strColorThemeName);
     658    void parentDialogDeactivated();
    656659
    657660protected:
     
    821824    void setHideNumPad(bool fHide);
    822825    void setHideMultimediaKeys(bool fHide);
    823     void setTableItemColor(KeyboardColorType tableRow, const QColor &color);
     826    void setColorSelectionButtonBackground(KeyboardColorType enmColorType, const QColor &color);
    824827    void setColorThemeNames(const QStringList &colorThemeNames);
    825828    void setCurrentColorThemeName(const QString &strColorThemeName);
     
    840843    QCheckBox    *m_pShowOsMenuButtonsCheckBox;
    841844    QCheckBox    *m_pHideMultimediaKeysCheckBox;
    842     QGroupBox    *m_pColorTableGroupBox;
     845    QGroupBox    *m_pColorThemeGroupBox;
    843846    QComboBox    *m_pColorThemeComboBox;
    844847    QLabel       *m_pTitleLabel;
     
    21122115}
    21132116
     2117void UISoftKeyboardColorTheme::print()
     2118{
     2119    printf("=====================\n");
     2120    printf("name: %s\n backround %s\n font %s\n hover %s\n edit %s\n pressed %s\n",
     2121           qPrintable(m_strName),
     2122           qPrintable(m_colors[KeyboardColorType_Background].name(QColor::HexRgb)),
     2123           qPrintable(m_colors[KeyboardColorType_Font].name(QColor::HexRgb)),
     2124           qPrintable(m_colors[KeyboardColorType_Hover].name(QColor::HexRgb)),
     2125           qPrintable(m_colors[KeyboardColorType_Edit].name(QColor::HexRgb)),
     2126           qPrintable(m_colors[KeyboardColorType_Pressed].name(QColor::HexRgb)));
     2127}
     2128
    21142129
    21152130/*********************************************************************************************************************************
     
    25352550    update();
    25362551    emit sigCurrentColorThemeChanged();
     2552}
     2553
     2554void UISoftKeyboardWidget::parentDialogDeactivated()
     2555{
     2556    if (!underMouse())
     2557        m_pKeyUnderMouse = 0;
     2558    else
     2559    {
     2560        printf("under %d %d\n", cursor().pos().x(), cursor().pos().y());
     2561
     2562    }
     2563    update();
    25372564}
    25382565
     
    35063533    , m_pShowOsMenuButtonsCheckBox(0)
    35073534    , m_pHideMultimediaKeysCheckBox(0)
    3508     , m_pColorTableGroupBox(0)
     3535    , m_pColorThemeGroupBox(0)
    35093536    , m_pColorThemeComboBox(0)
    35103537    , m_pTitleLabel(0)
     
    35333560}
    35343561
    3535 void UISoftKeyboardSettingsWidget::setTableItemColor(KeyboardColorType tableRow, const QColor &color)
    3536 {
    3537     if (m_colorSelectLabelsButtons.size() > tableRow && m_colorSelectLabelsButtons[tableRow].second)
    3538     {
    3539         UISoftKeyboardColorButton *pButton = m_colorSelectLabelsButtons[tableRow].second;
     3562void UISoftKeyboardSettingsWidget::setColorSelectionButtonBackground(KeyboardColorType enmColorType, const QColor &color)
     3563{
     3564    if (m_colorSelectLabelsButtons.size() > enmColorType && m_colorSelectLabelsButtons[enmColorType].second)
     3565    {
     3566        UISoftKeyboardColorButton *pButton = m_colorSelectLabelsButtons[enmColorType].second;
    35403567        QPalette pal = pButton->palette();
    35413568        pal.setColor(QPalette::Button, color);
     
    35833610    if (m_pHideMultimediaKeysCheckBox)
    35843611        m_pHideMultimediaKeysCheckBox->setText(UISoftKeyboard::tr("Hide Multimedia Keys"));
    3585     if (m_pColorTableGroupBox)
    3586         m_pColorTableGroupBox->setTitle(UISoftKeyboard::tr("Button Colors"));
     3612    if (m_pColorThemeGroupBox)
     3613        m_pColorThemeGroupBox->setTitle(UISoftKeyboard::tr("Color Themes"));
    35873614
    35883615    if (m_colorSelectLabelsButtons.size() == KeyboardColorType_Max)
     
    36293656    connect(m_pHideMultimediaKeysCheckBox, &QCheckBox::toggled, this, &UISoftKeyboardSettingsWidget::sigHideMultimediaKeys);
    36303657
    3631     /* A groupbox to host the color table widget: */
    3632     m_pColorTableGroupBox = new QGroupBox;
    3633     QVBoxLayout *pTableGroupBoxLayout = new QVBoxLayout(m_pColorTableGroupBox);
    3634     pSettingsLayout->addWidget(m_pColorTableGroupBox, 4, 0, 1, 1);
     3658    /* A groupbox to host the color selection widgets: */
     3659    m_pColorThemeGroupBox = new QGroupBox;
     3660    QVBoxLayout *pGroupBoxLayout = new QVBoxLayout(m_pColorThemeGroupBox);
     3661    pSettingsLayout->addWidget(m_pColorThemeGroupBox, 4, 0, 1, 1);
    36353662
    36363663    m_pColorThemeComboBox = new QComboBox;
    3637     pTableGroupBoxLayout->addWidget(m_pColorThemeComboBox);
     3664    pGroupBoxLayout->addWidget(m_pColorThemeComboBox);
    36383665    connect(m_pColorThemeComboBox, &QComboBox::currentTextChanged, this, &UISoftKeyboardSettingsWidget::sigColorThemeSelectionChanged);
    36393666
     
    36413668    QGridLayout *pColorSelectionLayout = new QGridLayout;
    36423669    pColorSelectionLayout->setSpacing(1);
    3643     pTableGroupBoxLayout->addLayout(pColorSelectionLayout);
     3670    pGroupBoxLayout->addLayout(pColorSelectionLayout);
    36443671    for (int i = KeyboardColorType_Background; i < KeyboardColorType_Max; ++i)
    36453672    {
     
    37203747}
    37213748
     3749bool UISoftKeyboard::event(QEvent *pEvent)
     3750{
     3751    if (pEvent->type() == QEvent::WindowDeactivate)
     3752    {
     3753        if (m_pKeyboardWidget)
     3754            m_pKeyboardWidget->parentDialogDeactivated();
     3755    }
     3756    else if (pEvent->type() == QEvent::WindowDeactivate)
     3757    {
     3758        if (m_pKeyboardWidget)
     3759            m_pKeyboardWidget->parentDialogDeactivated();
     3760    }
     3761
     3762    return QMainWindowWithRestorableGeometryAndRetranslateUi::event(pEvent);
     3763}
     3764
    37223765void UISoftKeyboard::sltKeyboardLedsChange()
    37233766{
     
    38453888    {
    38463889        KeyboardColorType enmType = (KeyboardColorType)i;
    3847         m_pSettingsWidget->setTableItemColor(enmType, m_pKeyboardWidget->color(enmType));
     3890        m_pSettingsWidget->setColorSelectionButtonBackground(enmType, m_pKeyboardWidget->color(enmType));
    38483891    }
    38493892}
     
    39083951        return;
    39093952    m_pKeyboardWidget->setColor(static_cast<KeyboardColorType>(iColorRow), newColor);
    3910     m_pSettingsWidget->setTableItemColor(static_cast<KeyboardColorType>(iColorRow), newColor);
     3953    m_pSettingsWidget->setColorSelectionButtonBackground(static_cast<KeyboardColorType>(iColorRow), newColor);
    39113954}
    39123955
     
    40784121        {
    40794122            KeyboardColorType enmType = (KeyboardColorType)i;
    4080             m_pSettingsWidget->setTableItemColor(enmType, m_pKeyboardWidget->color(enmType));
     4123            m_pSettingsWidget->setColorSelectionButtonBackground(enmType, m_pKeyboardWidget->color(enmType));
    40814124        }
    40824125    }
  • trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.h

    r81293 r81303  
    6363
    6464    virtual void retranslateUi() /* override */;
    65 
    6665    virtual bool shouldBeMaximized() const /* override */;
     66    bool event(QEvent *pEvent) /* override */;
    6767
    6868private slots:
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