Git commit 3831838599266c95f136645851672ff2d0f3a65f by Dmitry Kazakov, on behalf of Alan North. Committed on 05/07/2021 at 07:20. Pushed by dkazakov into branch 'master'.
Popup Palette: Add bottom bar toggle GUI: M +10 -0 libs/ui/kis_config.cc M +3 -0 libs/ui/kis_config.h M +24 -3 libs/ui/kis_popup_palette.cpp M +4 -2 libs/ui/kis_popup_palette.h https://invent.kde.org/graphics/krita/commit/3831838599266c95f136645851672ff2d0f3a65f diff --git a/libs/ui/kis_config.cc b/libs/ui/kis_config.cc index 4e9f6cb638..55882d2ba3 100644 --- a/libs/ui/kis_config.cc +++ b/libs/ui/kis_config.cc @@ -2136,6 +2136,16 @@ void KisConfig::setShowBrushHud(bool value) m_cfg.writeEntry("showBrushHud", value); } +bool KisConfig::showPaletteBottomBar(bool defaultValue) const +{ + return defaultValue ? true : m_cfg.readEntry("showPaletteBottomBar", true); +} + +void KisConfig::setShowPaletteBottomBar(bool value) +{ + m_cfg.writeEntry("showPaletteBottomBar", value); +} + QString KisConfig::brushHudSetting(bool defaultValue) const { QString defaultDoc = "<!DOCTYPE hud_properties>\n<hud_properties>\n <version value=\"1\" type=\"value\"/>\n <paintbrush>\n <properties_list type=\"array\">\n <item_0 value=\"size\" type=\"value\"/>\n <item_1 value=\"opacity\" type=\"value\"/>\n <item_2 value=\"angle\" type=\"value\"/>\n </properties_list>\n </paintbrush>\n <colorsmudge>\n <properties_list type=\"array\">\n <item_0 value=\"size\" type=\"value\"/>\n <item_1 value=\"opacity\" type=\"value\"/>\n <item_2 value=\"smudge_mode\" type=\"value\"/>\n <item_3 value=\"smudge_length\" type=\"value\"/>\n <item_4 value=\"smudge_color_rate\" type=\"value\"/>\n </properties_list>\n </colorsmudge>\n <sketchbrush>\n <properties_list type=\"array\">\n <item_0 value=\"opacity\" type=\"value\"/>\n <item_1 value=\"size\" type=\"value\"/>\n </properties_list>\n </sketchbrush>\n <hairybrush>\n <properties_list type=\"array\">\n <item_0 value=\"size\" type=\"value\"/>\n <item_1 value=\"opacity\" type=\"value\"/>\n </properties_list>\n </hairybrush>\n <experimentbrush>\n <properties_list type=\"array\">\n <item_0 value=\"opacity\" type=\"value\"/>\n <item_1 value=\"shape_windingfill\" type=\"value\"/>\n </properties_list>\n </experimentbrush>\n <spraybrush>\n <properties_list type=\"array\">\n <item_0 value=\"size\" type=\"value\"/>\n <item_1 value=\"opacity\" type=\"value\"/>\n <item_2 value=\"spray_particlecount\" type=\"value\"/>\n <item_3 value=\"spray_density\" type=\"value\"/>\n </properties_list>\n </spraybrush>\n <hatchingbrush>\n <properties_list type=\"array\">\n <item_0 value=\"size\" type=\"value\"/>\n <item_1 value=\"opacity\" type=\"value\"/>\n <item_2 value=\"hatching_angle\" type=\"value\"/>\n <item_3 value=\"hatching_thickness\" type=\"value\"/>\n <item_4 value=\"hatching_separation\" type=\"value\"/>\n </properties_list>\n </hatchingbrush>\n <gridbrush>\n <properties_list type=\"array\">\n <item_0 value=\"size\" type=\"value\"/>\n <item_1 value=\"opacity\" type=\"value\"/>\n <item_2 value=\"grid_divisionlevel\" type=\"value\"/>\n </properties_list>\n </gridbrush>\n <curvebrush>\n <properties_list type=\"array\">\n <item_0 value=\"opacity\" type=\"value\"/>\n <item_1 value=\"curve_historysize\" type=\"value\"/>\n <item_2 value=\"curve_linewidth\" type=\"value\"/>\n <item_3 value=\"curve_lineopacity\" type=\"value\"/>\n <item_4 value=\"curve_connectionline\" type=\"value\"/>\n </properties_list>\n </curvebrush>\n <dynabrush>\n <properties_list type=\"array\">\n <item_0 value=\"dyna_diameter\" type=\"value\"/>\n <item_1 value=\"opacity\" type=\"value\"/>\n <item_2 value=\"dyna_mass\" type=\"value\"/>\n <item_3 value=\"dyna_drag\" type=\"value\"/>\n </properties_list>\n </dynabrush>\n <particlebrush>\n <properties_list type=\"array\">\n <item_0 value=\"opacity\" type=\"value\"/>\n <item_1 value=\"particle_particles\" type=\"value\"/>\n <item_2 value=\"particle_opecityweight\" type=\"value\"/>\n <item_3 value=\"particle_iterations\" type=\"value\"/>\n </properties_list>\n </particlebrush>\n <duplicate>\n <properties_list type=\"array\">\n <item_0 value=\"size\" type=\"value\"/>\n <item_1 value=\"opacity\" type=\"value\"/>\n <item_2 value=\"clone_healing\" type=\"value\"/>\n <item_3 value=\"clone_movesource\" type=\"value\"/>\n </properties_list>\n </duplicate>\n <deformbrush>\n <properties_list type=\"array\">\n <item_0 value=\"size\" type=\"value\"/>\n <item_1 value=\"opacity\" type=\"value\"/>\n <item_2 value=\"deform_amount\" type=\"value\"/>\n <item_3 value=\"deform_mode\" type=\"value\"/>\n </properties_list>\n </deformbrush>\n <tangentnormal>\n <properties_list type=\"array\">\n <item_0 value=\"size\" type=\"value\"/>\n <item_1 value=\"opacity\" type=\"value\"/>\n </properties_list>\n </tangentnormal>\n <filter>\n <properties_list type=\"array\">\n <item_0 value=\"size\" type=\"value\"/>\n <item_1 value=\"opacity\" type=\"value\"/>\n </properties_list>\n </filter>\n <roundmarker>\n <properties_list type=\"array\">\n <item_0 value=\"opacity\" type=\"value\"/>\n <item_1 value=\"size\" type=\"value\"/>\n </properties_list>\n </roundmarker>\n</hud_properties>\n"; diff --git a/libs/ui/kis_config.h b/libs/ui/kis_config.h index efd5e5e2d9..f38cd3a63d 100644 --- a/libs/ui/kis_config.h +++ b/libs/ui/kis_config.h @@ -591,6 +591,9 @@ public: bool showBrushHud(bool defaultValue = false) const; void setShowBrushHud(bool value); + + bool showPaletteBottomBar(bool defaultValue = false) const; + void setShowPaletteBottomBar(bool value); QString brushHudSetting(bool defaultValue = false) const; void setBrushHudSetting(const QString &value) const; diff --git a/libs/ui/kis_popup_palette.cpp b/libs/ui/kis_popup_palette.cpp index bbd75eae27..d66b132227 100644 --- a/libs/ui/kis_popup_palette.cpp +++ b/libs/ui/kis_popup_palette.cpp @@ -135,6 +135,12 @@ KisPopupPalette::KisPopupPalette(KisViewManager* viewManager, KisCoordinatesConv connect(m_brushHudButton, SIGNAL(toggled(bool)), SLOT(showHudWidget(bool))); + m_bottomBarWidget = new QWidget(this); + + m_bottomBarButton = new KisRoundHudButton(this); + m_bottomBarButton->setCheckable(true); + + connect( m_bottomBarButton, SIGNAL(toggled(bool)), SLOT(showBottomBarWidget(bool))); // add some stuff below the pop-up palette that will make it easier to use for tablet people @@ -146,10 +152,10 @@ KisPopupPalette::KisPopupPalette(KisViewManager* viewManager, KisCoordinatesConv gLayout->addItem(m_mainArea, 0, 0); // this should push the box to the bottom gLayout->setColumnMinimumWidth(1, BRUSH_HUD_MARGIN); gLayout->addWidget(m_brushHud, 0, 2); + gLayout->addWidget(m_bottomBarWidget, 2, 0); - QHBoxLayout* hLayout = new QHBoxLayout(); - gLayout->addItem(hLayout, 1, 0); - + QHBoxLayout* hLayout = new QHBoxLayout(m_bottomBarWidget); + mirrorMode = new KisHighlightedToolButton(this); mirrorMode->setFixedSize(35, 35); @@ -225,6 +231,7 @@ KisPopupPalette::KisPopupPalette(KisViewManager* viewManager, KisCoordinatesConv // Load configuration.. KisConfig cfg(true); m_brushHudButton->setChecked(cfg.showBrushHud()); + m_bottomBarButton->setChecked(cfg.showPaletteBottomBar()); } void KisPopupPalette::slotConfigurationChanged() @@ -294,6 +301,8 @@ void KisPopupPalette::reconfigure() m_brushHud->setFixedHeight(int(m_popupPaletteSize)); + m_bottomBarButton->setGeometry(m_popupPaletteSize - 3.4 * auxButtonSize, m_popupPaletteSize - auxButtonSize, + auxButtonSize, auxButtonSize); m_tagsButton->setGeometry(m_popupPaletteSize - 2.2 * auxButtonSize, m_popupPaletteSize - auxButtonSize, auxButtonSize, auxButtonSize); m_brushHudButton->setGeometry(m_popupPaletteSize - 1.0 * auxButtonSize, m_popupPaletteSize - auxButtonSize, @@ -385,6 +394,7 @@ void KisPopupPalette::slotUpdateIcons() zoomToOneHundredPercentButton->setIcon(m_actionCollection->action("zoom_to_100pct")->icon()); m_brushHud->updateIcons(); m_tagsButton->setIcon(KisIconUtils::loadIcon("tag")); + m_bottomBarButton->setOnOffIcons(KisIconUtils::loadIcon("arrow-up"), KisIconUtils::loadIcon("arrow-down")); m_brushHudButton->setOnOffIcons(KisIconUtils::loadIcon("arrow-left"), KisIconUtils::loadIcon("arrow-right")); } @@ -402,6 +412,16 @@ void KisPopupPalette::showHudWidget(bool visible) cfg.setShowBrushHud(visible); } +void KisPopupPalette::showBottomBarWidget(bool visible) +{ + const bool reallyVisible = visible && m_bottomBarButton->isChecked(); + + m_bottomBarWidget->setVisible(reallyVisible); + + KisConfig cfg(false); + cfg.setShowPaletteBottomBar(visible); +} + void KisPopupPalette::setParent(QWidget *parent) { QWidget::setParent(parent); } @@ -826,6 +846,7 @@ void KisPopupPalette::showEvent(QShowEvent *event) } m_brushHud->setVisible(m_brushHudButton->isChecked()); + m_bottomBarWidget->setVisible(m_bottomBarButton->isChecked()); QWidget::showEvent(event); } diff --git a/libs/ui/kis_popup_palette.h b/libs/ui/kis_popup_palette.h index a30dc1b317..35817a4cb9 100644 --- a/libs/ui/kis_popup_palette.h +++ b/libs/ui/kis_popup_palette.h @@ -116,6 +116,7 @@ private: QSpacerItem *m_mainArea {0}; KisBrushHud *m_brushHud {0}; + QWidget* m_bottomBarWidget {0}; float m_popupPaletteSize {385.0}; float m_colorHistoryInnerRadius {72.0}; qreal m_colorHistoryOuterRadius {92.0}; @@ -125,14 +126,14 @@ private: qreal m_presetRingMargin {3.0}; KisRoundHudButton *m_tagsButton {0}; + KisRoundHudButton *m_bottomBarButton {0}; KisRoundHudButton *m_brushHudButton {0}; QRectF m_canvasRotationIndicatorRect; QRectF m_resetCanvasRotationIndicatorRect; bool m_isOverCanvasRotationIndicator {false}; bool m_isRotatingCanvasIndicator {false}; bool m_isZoomingCanvas {false}; - - + KisHighlightedToolButton *mirrorMode {0}; KisHighlightedToolButton *canvasOnlyButton {0}; QPushButton *zoomToOneHundredPercentButton {0}; @@ -171,6 +172,7 @@ private Q_SLOTS: void slotHide() { setVisible(false); } void slotShowTagsPopup(); void showHudWidget(bool visible); + void showBottomBarWidget(bool visible); void slotZoomToOneHundredPercentClicked(); void slotZoomSliderChanged(int zoom);
