Changeset 81303 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Oct 17, 2019 8:08:23 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 134008
- 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 145 145 }; 146 146 /* 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}}; 147 const 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}}; 150 151 151 152 … … 574 575 const QString &name() const; 575 576 void setName(const QString &strName); 577 void print(); 576 578 577 579 private: … … 654 656 QString currentColorThemeName() const; 655 657 void setColorTheme(const QString &strColorThemeName); 658 void parentDialogDeactivated(); 656 659 657 660 protected: … … 821 824 void setHideNumPad(bool fHide); 822 825 void setHideMultimediaKeys(bool fHide); 823 void set TableItemColor(KeyboardColorType tableRow, const QColor &color);826 void setColorSelectionButtonBackground(KeyboardColorType enmColorType, const QColor &color); 824 827 void setColorThemeNames(const QStringList &colorThemeNames); 825 828 void setCurrentColorThemeName(const QString &strColorThemeName); … … 840 843 QCheckBox *m_pShowOsMenuButtonsCheckBox; 841 844 QCheckBox *m_pHideMultimediaKeysCheckBox; 842 QGroupBox *m_pColorT ableGroupBox;845 QGroupBox *m_pColorThemeGroupBox; 843 846 QComboBox *m_pColorThemeComboBox; 844 847 QLabel *m_pTitleLabel; … … 2112 2115 } 2113 2116 2117 void 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 2114 2129 2115 2130 /********************************************************************************************************************************* … … 2535 2550 update(); 2536 2551 emit sigCurrentColorThemeChanged(); 2552 } 2553 2554 void 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(); 2537 2564 } 2538 2565 … … 3506 3533 , m_pShowOsMenuButtonsCheckBox(0) 3507 3534 , m_pHideMultimediaKeysCheckBox(0) 3508 , m_pColorT ableGroupBox(0)3535 , m_pColorThemeGroupBox(0) 3509 3536 , m_pColorThemeComboBox(0) 3510 3537 , m_pTitleLabel(0) … … 3533 3560 } 3534 3561 3535 void UISoftKeyboardSettingsWidget::set TableItemColor(KeyboardColorType tableRow, const QColor &color)3536 { 3537 if (m_colorSelectLabelsButtons.size() > tableRow && m_colorSelectLabelsButtons[tableRow].second)3538 { 3539 UISoftKeyboardColorButton *pButton = m_colorSelectLabelsButtons[ tableRow].second;3562 void 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; 3540 3567 QPalette pal = pButton->palette(); 3541 3568 pal.setColor(QPalette::Button, color); … … 3583 3610 if (m_pHideMultimediaKeysCheckBox) 3584 3611 m_pHideMultimediaKeysCheckBox->setText(UISoftKeyboard::tr("Hide Multimedia Keys")); 3585 if (m_pColorT ableGroupBox)3586 m_pColorT ableGroupBox->setTitle(UISoftKeyboard::tr("Button Colors"));3612 if (m_pColorThemeGroupBox) 3613 m_pColorThemeGroupBox->setTitle(UISoftKeyboard::tr("Color Themes")); 3587 3614 3588 3615 if (m_colorSelectLabelsButtons.size() == KeyboardColorType_Max) … … 3629 3656 connect(m_pHideMultimediaKeysCheckBox, &QCheckBox::toggled, this, &UISoftKeyboardSettingsWidget::sigHideMultimediaKeys); 3630 3657 3631 /* A groupbox to host the color table widget: */3632 m_pColorT ableGroupBox = new QGroupBox;3633 QVBoxLayout *p TableGroupBoxLayout = new QVBoxLayout(m_pColorTableGroupBox);3634 pSettingsLayout->addWidget(m_pColorT ableGroupBox, 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); 3635 3662 3636 3663 m_pColorThemeComboBox = new QComboBox; 3637 p TableGroupBoxLayout->addWidget(m_pColorThemeComboBox);3664 pGroupBoxLayout->addWidget(m_pColorThemeComboBox); 3638 3665 connect(m_pColorThemeComboBox, &QComboBox::currentTextChanged, this, &UISoftKeyboardSettingsWidget::sigColorThemeSelectionChanged); 3639 3666 … … 3641 3668 QGridLayout *pColorSelectionLayout = new QGridLayout; 3642 3669 pColorSelectionLayout->setSpacing(1); 3643 p TableGroupBoxLayout->addLayout(pColorSelectionLayout);3670 pGroupBoxLayout->addLayout(pColorSelectionLayout); 3644 3671 for (int i = KeyboardColorType_Background; i < KeyboardColorType_Max; ++i) 3645 3672 { … … 3720 3747 } 3721 3748 3749 bool 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 3722 3765 void UISoftKeyboard::sltKeyboardLedsChange() 3723 3766 { … … 3845 3888 { 3846 3889 KeyboardColorType enmType = (KeyboardColorType)i; 3847 m_pSettingsWidget->set TableItemColor(enmType, m_pKeyboardWidget->color(enmType));3890 m_pSettingsWidget->setColorSelectionButtonBackground(enmType, m_pKeyboardWidget->color(enmType)); 3848 3891 } 3849 3892 } … … 3908 3951 return; 3909 3952 m_pKeyboardWidget->setColor(static_cast<KeyboardColorType>(iColorRow), newColor); 3910 m_pSettingsWidget->set TableItemColor(static_cast<KeyboardColorType>(iColorRow), newColor);3953 m_pSettingsWidget->setColorSelectionButtonBackground(static_cast<KeyboardColorType>(iColorRow), newColor); 3911 3954 } 3912 3955 … … 4078 4121 { 4079 4122 KeyboardColorType enmType = (KeyboardColorType)i; 4080 m_pSettingsWidget->set TableItemColor(enmType, m_pKeyboardWidget->color(enmType));4123 m_pSettingsWidget->setColorSelectionButtonBackground(enmType, m_pKeyboardWidget->color(enmType)); 4081 4124 } 4082 4125 } -
trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.h
r81293 r81303 63 63 64 64 virtual void retranslateUi() /* override */; 65 66 65 virtual bool shouldBeMaximized() const /* override */; 66 bool event(QEvent *pEvent) /* override */; 67 67 68 68 private slots:
Note:
See TracChangeset
for help on using the changeset viewer.