Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
Remove GUI from SAP configuration
Agata Cacko20c052a8094b
diff --git a/libs/ui/dialogs/kis_dlg_preferences.cc b/libs/ui/dialogs/kis_dlg_preferences.ccindex 77682d515f..e94200edfa 100644--- a/libs/ui/dialogs/kis_dlg_preferences.cc+++ b/libs/ui/dialogs/kis_dlg_preferences.cc@@ -433,63 +433,6 @@ GeneralTab::GeneralTab(QWidget *_parent, const char *_name)chkEnableSelectionActionBar->setChecked(sapEnabled);- m_sapOrientationGroup.addButton(sapHorizontalButton, KisConfig::SelectionActionsBarOrientation::Horizontal);- m_sapOrientationGroup.addButton(sapVerticalButton, KisConfig::SelectionActionsBarOrientation::Vertical);-- if (m_sapOrientationGroup.button(cfg.selectionActionBarOrientation())) {- m_sapOrientationGroup.button(cfg.selectionActionBarOrientation())->setChecked(true);- }-- m_sapBehaviourGroup.addButton(sapFixedButton, KisConfig::SelectionActionsBarBehavior::Fixed);- m_sapBehaviourGroup.addButton(sapFreeFloatingButton, KisConfig::SelectionActionsBarBehavior::FreeFloating);- if (m_sapBehaviourGroup.button(cfg.selectionActionBarBehavior())) {- m_sapBehaviourGroup.button(cfg.selectionActionBarBehavior())->setChecked(true);- }-- selectionActionsBarBehaviorLabel->setEnabled(sapEnabled);- setButtonGroupEnabled(m_sapBehaviourGroup, sapEnabled);-- setButtonGroupEnabled(m_sapOrientationGroup, sapEnabled);- selectionActionsBarOrientationLabel->setEnabled(sapEnabled);--#if (QT_VERSION > QT_VERSION_CHECK(6, 7, 0))- connect(chkEnableSelectionActionBar, SIGNAL(checkStateChanged(Qt::CheckState)), this, SLOT(selectionActionsBarCheckboxChanged(Qt::CheckState)));-#else- connect(chkEnableSelectionActionBar, SIGNAL(stateChanged(int)), this, SLOT(selectionActionsBarCheckboxChanged(int)));-#endif-- QSize sapPositionIconSize = sapRightMiddleButton->iconSize();- sapRightMiddleButton->setIcon(addDisabledStatesToIcon(KisIconUtils::loadIcon("arrow-right"), sapPositionIconSize));- sapTopRightButton->setIcon(addDisabledStatesToIcon(KisIconUtils::loadIcon("arrow-topright"), sapPositionIconSize));- sapTopMiddleButton->setIcon(addDisabledStatesToIcon(KisIconUtils::loadIcon("arrow-up"), sapPositionIconSize));- sapTopLeftButton->setIcon(addDisabledStatesToIcon(KisIconUtils::loadIcon("arrow-topleft"), sapPositionIconSize));- sapLeftMiddleButton->setIcon(addDisabledStatesToIcon(KisIconUtils::loadIcon("arrow-left"), sapPositionIconSize));- sapBottomLeftButton->setIcon(addDisabledStatesToIcon(KisIconUtils::loadIcon("arrow-downleft"), sapPositionIconSize));- sapBottomMiddleButton->setIcon(addDisabledStatesToIcon(KisIconUtils::loadIcon("arrow-down"), sapPositionIconSize));- sapBottomRightButton->setIcon(addDisabledStatesToIcon(KisIconUtils::loadIcon("arrow-downright"), sapPositionIconSize));--- using Position = KisConfig::SelectionActionsBarPosition;- m_sapPositionGroup.addButton(sapBottomLeftButton, Position::BottomLeft);- m_sapPositionGroup.addButton(sapBottomMiddleButton, Position::Bottom);- m_sapPositionGroup.addButton(sapBottomRightButton, Position::BottomRight);- m_sapPositionGroup.addButton(sapLeftMiddleButton, Position::Left);- m_sapPositionGroup.addButton(sapRightMiddleButton, Position::Right);- m_sapPositionGroup.addButton(sapTopLeftButton, Position::TopLeft);- m_sapPositionGroup.addButton(sapTopMiddleButton, Position::Top);- m_sapPositionGroup.addButton(sapTopRightButton, Position::TopRight);--- if (m_sapPositionGroup.button(cfg.selectionActionBarPosition())) {- m_sapPositionGroup.button(cfg.selectionActionBarPosition())->setChecked(true);- }--- setButtonGroupEnabled(m_sapPositionGroup, sapEnabled);- selectionActionsBarPositionLabel->setEnabled(sapEnabled);-- connect(&m_sapPositionGroup, SIGNAL(idClicked(int)), this, SLOT(selectionActionsBarPositionChanged(int)));-//// File handling//@@ -969,53 +912,6 @@ void GeneralTab::colorSamplePreviewOutlineEnabledChanged(int value)m_lblColorSamplerPreviewSizePreview->setOutlineEnabled(value);}-void GeneralTab::selectionActionsBarPositionChanged(int buttonId)-{- KisConfig::SelectionActionsBarPosition position = (KisConfig::SelectionActionsBarPosition)buttonId;- KisConfig::SelectionActionsBarOrientation currentOrientation = (KisConfig::SelectionActionsBarOrientation)m_sapOrientationGroup.checkedId();-- switch (position) {- case KisConfig::SelectionActionsBarPosition::Top:- case KisConfig::SelectionActionsBarPosition::Bottom:- // set to horizontal- if (currentOrientation != KisConfig::SelectionActionsBarOrientation::Horizontal) {- sapHorizontalButton->setChecked(true);- }- break;- case KisConfig::SelectionActionsBarPosition::Left:- case KisConfig::SelectionActionsBarPosition::Right:- // set to vertical- if (currentOrientation != KisConfig::SelectionActionsBarOrientation::Vertical) {- sapVerticalButton->setChecked(true);- }- break;- case KisConfig::SelectionActionsBarPosition::TopLeft:- case KisConfig::SelectionActionsBarPosition::TopRight:- case KisConfig::SelectionActionsBarPosition::BottomLeft:- case KisConfig::SelectionActionsBarPosition::BottomRight:- // nothing to do- break;- }-}--#if (QT_VERSION > QT_VERSION_CHECK(6, 7, 0))-void GeneralTab::selectionActionsBarCheckboxChanged(Qt::CheckState value)-#else-void GeneralTab::selectionActionsBarCheckboxChanged(int value)-#endif-{- bool enabled = value == Qt::CheckState::Checked;-- setButtonGroupEnabled(m_sapPositionGroup, enabled);- selectionActionsBarPositionLabel->setEnabled(enabled);-- setButtonGroupEnabled(m_sapBehaviourGroup, enabled);- selectionActionsBarBehaviorLabel->setEnabled(enabled);-- setButtonGroupEnabled(m_sapOrientationGroup, enabled);- selectionActionsBarOrientationLabel->setEnabled(enabled);-}-void GeneralTab::setButtonGroupEnabled(const QButtonGroup &buttonGroup, bool value){Q_FOREACH(QAbstractButton* button, buttonGroup.buttons()) {@@ -3231,10 +3127,6 @@ bool KisDlgPreferences::editPreferences(std::optional<PageDesc>page)cfg.setZoomHorizontal(m_general->chkZoomHorizontally->isChecked());cfg.setSelectionActionBar(m_general->chkEnableSelectionActionBar->isChecked());- cfg.setSelectionActionBarBehavior((KisConfig::SelectionActionsBarBehavior)m_general->m_sapBehaviourGroup.checkedId());- cfg.setSelectionActionBarPosition((KisConfig::SelectionActionsBarPosition)m_general->m_sapPositionGroup.checkedId());- cfg.setSelectionActionBarOrientation((KisConfig::SelectionActionsBarOrientation)m_general->m_sapOrientationGroup.checkedId());-cfg.setConvertToImageColorspaceOnImport(m_general->convertToImageColorspaceOnImport());cfg.setUndoStackLimit(m_general->undoStackSize());cfg.setCumulativeUndoRedo(m_general->chkCumulativeUndo->isChecked());diff --git a/libs/ui/dialogs/kis_dlg_preferences.h b/libs/ui/dialogs/kis_dlg_preferences.hindex 861aa860b3..b0e9e26a46 100644--- a/libs/ui/dialogs/kis_dlg_preferences.h+++ b/libs/ui/dialogs/kis_dlg_preferences.h@@ -128,21 +128,11 @@ private Q_SLOTS:void colorSamplePreviewThicknessChanged(qreal value);void colorSamplePreviewOutlineEnabledChanged(int value);- void selectionActionsBarPositionChanged(int buttonId);-#if (QT_VERSION > QT_VERSION_CHECK(6, 7, 0))- void selectionActionsBarCheckboxChanged(Qt::CheckState value);-#else- void selectionActionsBarCheckboxChanged(int value);-#endif-static void setButtonGroupEnabled(const QButtonGroup& buttonGroup, bool value);public:QButtonGroup m_pasteFormatGroup;KisCumulativeUndoData m_cumulativeUndoData;- QButtonGroup m_sapPositionGroup;- QButtonGroup m_sapBehaviourGroup;- QButtonGroup m_sapOrientationGroup;};diff --git a/libs/ui/forms/wdggeneralsettings.ui b/libs/ui/forms/wdggeneralsettings.uiindex a9cbafc9de..7664abbd2b 100644--- a/libs/ui/forms/wdggeneralsettings.ui+++ b/libs/ui/forms/wdggeneralsettings.ui@@ -1107,23 +1107,11 @@</item><item row="13" column="0" colspan="2"><widget class="QGroupBox" name="groupBox_5">- <property name="title">- <string>Selection Actions Bar</string>- </property><property name="alignment"><set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set></property><layout class="QFormLayout" name="formLayout_3">- <property name="fieldGrowthPolicy">- <enum>QFormLayout::FieldsStayAtSizeHint</enum>- </property>- <property name="formAlignment">- <set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>- </property>- <property name="horizontalSpacing">- <number>153</number>- </property>- <item row="1" column="1">+ <item row="0" column="0"><widget class="QCheckBox" name="chkEnableSelectionActionBar"><property name="toolTip"><string>When enabled, any selections will produce a small floating panel of useful selection-related actions.</string>@@ -1136,202 +1124,7 @@</property></widget></item>- <item row="2" column="0">- <widget class="QLabel" name="selectionActionsBarBehaviorLabel">- <property name="text">- <string>Behavior:</string>- </property>- </widget>- </item>- <item row="4" column="0">- <widget class="QLabel" name="selectionActionsBarOrientationLabel">- <property name="text">- <string>Orientation:</string>- </property>- </widget>- </item>- <item row="4" column="1">- <layout class="QHBoxLayout" name="horizontalLayout_7">- <item>- <widget class="QRadioButton" name="sapHorizontalButton">- <property name="text">- <string>Horizontal</string>- </property>- </widget>- </item>- <item>- <widget class="QRadioButton" name="sapVerticalButton">- <property name="text">- <string>Vertical</string>- </property>- </widget>- </item>- </layout>- </item>- <item row="5" column="0">- <widget class="QLabel" name="selectionActionsBarPositionLabel">- <property name="enabled">- <bool>true</bool>- </property>- <property name="text">- <string>Position:</string>- </property>- </widget>- </item>- <item row="5" column="1">- <layout class="QGridLayout" name="gridLayout">- <item row="0" column="1">- <widget class="QPushButton" name="sapTopMiddleButton">- <property name="sizePolicy">- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">- <horstretch>0</horstretch>- <verstretch>0</verstretch>- </sizepolicy>- </property>- <property name="text">- <string/>- </property>- <property name="checkable">- <bool>true</bool>- </property>- </widget>- </item>- <item row="0" column="0">- <widget class="QPushButton" name="sapTopLeftButton">- <property name="sizePolicy">- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">- <horstretch>0</horstretch>- <verstretch>0</verstretch>- </sizepolicy>- </property>- <property name="text">- <string/>- </property>- <property name="checkable">- <bool>true</bool>- </property>- <property name="checked">- <bool>false</bool>- </property>- </widget>- </item>- <item row="2" column="0">- <widget class="QPushButton" name="sapBottomLeftButton">- <property name="sizePolicy">- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">- <horstretch>0</horstretch>- <verstretch>0</verstretch>- </sizepolicy>- </property>- <property name="text">- <string/>- </property>- <property name="checkable">- <bool>true</bool>- </property>- </widget>- </item>- <item row="1" column="0">- <widget class="QPushButton" name="sapLeftMiddleButton">- <property name="sizePolicy">- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">- <horstretch>0</horstretch>- <verstretch>0</verstretch>- </sizepolicy>- </property>- <property name="text">- <string/>- </property>- <property name="checkable">- <bool>true</bool>- </property>- </widget>- </item>- <item row="0" column="2">- <widget class="QPushButton" name="sapTopRightButton">- <property name="sizePolicy">- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">- <horstretch>0</horstretch>- <verstretch>0</verstretch>- </sizepolicy>- </property>- <property name="text">- <string/>- </property>- <property name="checkable">- <bool>true</bool>- </property>- </widget>- </item>- <item row="1" column="2">- <widget class="QPushButton" name="sapRightMiddleButton">- <property name="sizePolicy">- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">- <horstretch>0</horstretch>- <verstretch>0</verstretch>- </sizepolicy>- </property>- <property name="text">- <string/>- </property>- <property name="checkable">- <bool>true</bool>- </property>- </widget>- </item>- <item row="2" column="1">- <widget class="QPushButton" name="sapBottomMiddleButton">- <property name="sizePolicy">- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">- <horstretch>0</horstretch>- <verstretch>0</verstretch>- </sizepolicy>- </property>- <property name="text">- <string/>- </property>- <property name="checkable">- <bool>true</bool>- </property>- </widget>- </item>- <item row="2" column="2">- <widget class="QPushButton" name="sapBottomRightButton">- <property name="sizePolicy">- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">- <horstretch>0</horstretch>- <verstretch>0</verstretch>- </sizepolicy>- </property>- <property name="text">- <string/>- </property>- <property name="checkable">- <bool>true</bool>- </property>- </widget>- </item>- </layout>- </item>- <item row="2" column="1">- <layout class="QHBoxLayout" name="horizontalLayout_5">- <item>- <widget class="QRadioButton" name="sapFixedButton">- <property name="text">- <string>Fixed</string>- </property>- </widget>- </item>- <item>- <widget class="QRadioButton" name="sapFreeFloatingButton">- <property name="text">- <string>Free floating</string>- </property>- </widget>- </item>- </layout>- </item>- </layout>+ </layout></widget></item></layout>diff --git a/libs/ui/kis_selection_actions_panel.cpp b/libs/ui/kis_selection_actions_panel.cppindex c476be1073..04ecddd677 100644--- a/libs/ui/kis_selection_actions_panel.cpp+++ b/libs/ui/kis_selection_actions_panel.cpp@@ -126,6 +126,14 @@ KisSelectionActionsPanel::KisSelectionActionsPanel(KisViewManager *viewManager)d->m_viewManager = viewManager;d->m_selectionManager = viewManager->selectionManager();++ KisConfig kcfg(true);+ // instead of loading the user's configuration, set it to the "old version" of the behaviour:+ kcfg.setSelectionActionBarOrientation(KisConfig::SelectionActionsBarOrientation::Horizontal);+ kcfg.setSelectionActionBarPosition(KisConfig::SelectionActionsBarPosition::Bottom);+ // whether it's fixed or free-floating can be determined by the pin icon, so let's load that one correctly and don't change it+ // TODO: remove this whole part when restoring the behaviour+// Setup buttons...QVector<ActionButtonData> data = Private::buttonData();for (int i = 0; i < data.length(); i++) {