Move KoSizeGroup as KisSizeGroup from kowidgetutil to kritaui

only used by Krita plugins
parent 35670a1c
......@@ -23,7 +23,7 @@
#include <KoUnit.h>
#include <kis_icon_utils.h>
#include <KoSizeGroup.h>
#include <kis_size_group.h>
#include <klocalizedstring.h>
#include <kis_config.h>
......@@ -107,14 +107,14 @@ DlgCanvasSize::DlgCanvasSize(QWidget *parent, int width, int height, double reso
m_group->button(CENTER)->setChecked(true);
updateAnchorIcons(CENTER);
KoSizeGroup *labelsGroup = new KoSizeGroup(this);
KisSizeGroup *labelsGroup = new KisSizeGroup(this);
labelsGroup->addWidget(m_page->lblNewWidth);
labelsGroup->addWidget(m_page->lblNewHeight);
labelsGroup->addWidget(m_page->lblXOff);
labelsGroup->addWidget(m_page->lblYOff);
labelsGroup->addWidget(m_page->lblAnchor);
KoSizeGroup *spinboxesGroup = new KoSizeGroup(this);
KisSizeGroup *spinboxesGroup = new KisSizeGroup(this);
spinboxesGroup->addWidget(m_page->newWidth);
spinboxesGroup->addWidget(m_page->newWidthDouble);
spinboxesGroup->addWidget(m_page->newHeight);
......@@ -124,7 +124,7 @@ DlgCanvasSize::DlgCanvasSize(QWidget *parent, int width, int height, double reso
spinboxesGroup->addWidget(m_page->yOffset);
spinboxesGroup->addWidget(m_page->yOffsetDouble);
KoSizeGroup *comboboxesGroup = new KoSizeGroup(this);
KisSizeGroup *comboboxesGroup = new KisSizeGroup(this);
comboboxesGroup->addWidget(m_page->widthUnit);
comboboxesGroup->addWidget(m_page->heightUnit);
comboboxesGroup->addWidget(m_page->xOffUnit);
......
......@@ -23,7 +23,7 @@
#include "dlg_imagesize.h"
#include <KoUnit.h>
#include <KoSizeGroup.h>
#include <kis_size_group.h>
#include <klocalizedstring.h>
#include <klocale.h>
#include <kglobal.h>
......@@ -105,7 +105,7 @@ DlgImageSize::DlgImageSize(QWidget *parent, int width, int height, double resolu
m_page->printAspectRatioBtn->setKeepAspectRatio(true);
m_page->constrainProportionsCkb->setChecked(true);
KoSizeGroup *labelsGroup = new KoSizeGroup(this);
KisSizeGroup *labelsGroup = new KisSizeGroup(this);
labelsGroup->addWidget(m_page->lblPixelWidth);
labelsGroup->addWidget(m_page->lblPixelHeight);
labelsGroup->addWidget(m_page->lblPixelFilter);
......@@ -113,7 +113,7 @@ DlgImageSize::DlgImageSize(QWidget *parent, int width, int height, double resolu
labelsGroup->addWidget(m_page->lblPrintHeight);
labelsGroup->addWidget(m_page->lblResolution);
KoSizeGroup *spinboxesGroup = new KoSizeGroup(this);
KisSizeGroup *spinboxesGroup = new KisSizeGroup(this);
spinboxesGroup->addWidget(m_page->pixelWidth);
spinboxesGroup->addWidget(m_page->pixelWidthDouble);
spinboxesGroup->addWidget(m_page->pixelHeight);
......@@ -122,7 +122,7 @@ DlgImageSize::DlgImageSize(QWidget *parent, int width, int height, double resolu
spinboxesGroup->addWidget(m_page->printHeight);
spinboxesGroup->addWidget(m_page->printResolution);
KoSizeGroup *comboboxesGroup = new KoSizeGroup(this);
KisSizeGroup *comboboxesGroup = new KisSizeGroup(this);
comboboxesGroup->addWidget(m_page->pixelWidthUnit);
comboboxesGroup->addWidget(m_page->pixelHeightUnit);
comboboxesGroup->addWidget(m_page->printWidthUnit);
......
......@@ -22,7 +22,7 @@
#include "dlg_border_selection.h"
#include <KoUnit.h>
#include <KoSizeGroup.h>
#include <kis_size_group.h>
#include <KisViewManager.h>
#include <kis_image.h>
#include <operations/kis_operation_configuration.h>
......@@ -47,7 +47,7 @@ WdgBorderSelection::WdgBorderSelection(QWidget* parent, KisViewManager *view)
cmbUnit->setCurrentIndex(KoUnit(KoUnit::Pixel).indexInListForUi());
// ensure that both spinboxes request the same horizontal size
KoSizeGroup *spbGroup = new KoSizeGroup(this);
KisSizeGroup *spbGroup = new KisSizeGroup(this);
spbGroup->addWidget(spbWidth);
spbGroup->addWidget(spbWidthDouble);
......
......@@ -22,7 +22,7 @@
#include "dlg_feather_selection.h"
#include <KoUnit.h>
#include <KoSizeGroup.h>
#include <kis_size_group.h>
#include <KisViewManager.h>
#include <kis_image.h>
#include <operations/kis_operation_configuration.h>
......@@ -47,7 +47,7 @@ WdgFeatherSelection::WdgFeatherSelection(QWidget* parent, KisViewManager* view)
cmbUnit->setCurrentIndex(KoUnit(KoUnit::Pixel).indexInListForUi());
// ensure that both spinboxes request the same horizontal size
KoSizeGroup *spbGroup = new KoSizeGroup(this);
KisSizeGroup *spbGroup = new KisSizeGroup(this);
spbGroup->addWidget(spbRadius);
spbGroup->addWidget(spbRadiusDouble);
......
......@@ -22,7 +22,7 @@
#include "dlg_grow_selection.h"
#include <KoUnit.h>
#include <KoSizeGroup.h>
#include <kis_size_group.h>
#include <KisViewManager.h>
#include <kis_image.h>
#include <operations/kis_operation_configuration.h>
......@@ -47,7 +47,7 @@ WdgGrowSelection::WdgGrowSelection(QWidget* parent, KisViewManager* view)
cmbUnit->setCurrentIndex(KoUnit(KoUnit::Pixel).indexInListForUi());
// ensure that both spinboxes request the same horizontal size
KoSizeGroup *spbGroup = new KoSizeGroup(this);
KisSizeGroup *spbGroup = new KisSizeGroup(this);
spbGroup->addWidget(spbGrowValue);
spbGroup->addWidget(spbGrowValueDouble);
......
......@@ -22,7 +22,7 @@
#include "dlg_shrink_selection.h"
#include <KoUnit.h>
#include <KoSizeGroup.h>
#include <kis_size_group.h>
#include <KisViewManager.h>
#include <kis_image.h>
#include <operations/kis_operation_configuration.h>
......@@ -47,7 +47,7 @@ WdgShrinkSelection::WdgShrinkSelection(QWidget* parent, KisViewManager *view)
cmbUnit->setCurrentIndex(KoUnit(KoUnit::Pixel).indexInListForUi());
// ensure that both spinboxes request the same horizontal size
KoSizeGroup *spbGroup = new KoSizeGroup(this);
KisSizeGroup *spbGroup = new KisSizeGroup(this);
spbGroup->addWidget(spbShrinkValue);
spbGroup->addWidget(spbShrinkValueDouble);
......
......@@ -18,7 +18,7 @@
#include "kis_phong_bumpmap_config_widget.h"
#include <filter/kis_filter_configuration.h>
#include <KoSizeGroup.h>
#include <kis_size_group.h>
#include "phong_bumpmap_constants.h"
#include "KoChannelInfo.h"
#include "KoColorSpace.h"
......@@ -30,7 +30,7 @@ KisPhongBumpmapConfigWidget::KisPhongBumpmapConfigWidget(const KisPaintDeviceSP
Q_ASSERT(m_device);
m_page = new KisPhongBumpmapWidget(this);
KoSizeGroup *matPropLabelsGroup = new KoSizeGroup(this);
KisSizeGroup *matPropLabelsGroup = new KisSizeGroup(this);
matPropLabelsGroup->addWidget(m_page->lblAmbientReflectivity);
matPropLabelsGroup->addWidget(m_page->lblDiffuseReflectivity);
matPropLabelsGroup->addWidget(m_page->lblSpecularReflectivity);
......
......@@ -228,6 +228,8 @@ set(kritaui_LIB_SRCS
widgets/kis_preset_selector_strip.cpp
widgets/kis_tree_view_popup.cc
widgets/kis_slider_spin_box.cpp
widgets/kis_size_group.cpp
widgets/kis_size_group_p.cpp
widgets/kis_wdg_generator.cpp
widgets/kis_workspace_chooser.cpp
widgets/squeezedcombobox.cpp
......
......@@ -17,21 +17,21 @@
* Boston, MA 02110-1301, USA.
*/
#include "KoSizeGroup.h"
#include "KoSizeGroupPrivate.h"
#include "kis_size_group.h"
#include "kis_size_group_p.h"
KoSizeGroup::KoSizeGroup(QObject *parent, KoSizeGroup::mode mode, bool ignoreHidden)
KisSizeGroup::KisSizeGroup(QObject *parent, KisSizeGroup::mode mode, bool ignoreHidden)
: QObject(parent)
, d(new KoSizeGroupPrivate(this, mode, ignoreHidden))
, d(new KisSizeGroupPrivate(this, mode, ignoreHidden))
{}
KoSizeGroup::~KoSizeGroup()
KisSizeGroup::~KisSizeGroup()
{
delete d;
}
void KoSizeGroup::setMode(KoSizeGroup::mode mode)
void KisSizeGroup::setMode(KisSizeGroup::mode mode)
{
if (d->m_mode != mode) {
d->m_mode = mode;
......@@ -39,12 +39,12 @@ void KoSizeGroup::setMode(KoSizeGroup::mode mode)
}
}
KoSizeGroup::mode KoSizeGroup::getMode() const
KisSizeGroup::mode KisSizeGroup::getMode() const
{
return d->m_mode;
}
void KoSizeGroup::setIgnoreHidden(bool ignoreHidden)
void KisSizeGroup::setIgnoreHidden(bool ignoreHidden)
{
if (d->m_ignoreHidden != ignoreHidden) {
d->m_ignoreHidden = ignoreHidden;
......@@ -52,18 +52,18 @@ void KoSizeGroup::setIgnoreHidden(bool ignoreHidden)
}
}
bool KoSizeGroup::isIgnoreHidden() const
bool KisSizeGroup::isIgnoreHidden() const
{
return d->m_ignoreHidden;
}
void KoSizeGroup::addWidget(QWidget *widget)
void KisSizeGroup::addWidget(QWidget *widget)
{
d->addWidget(widget);
d->scheduleSizeUpdate();
}
void KoSizeGroup::removeWidget(QWidget *widget)
void KisSizeGroup::removeWidget(QWidget *widget)
{
d->removeWidget(widget);
d->scheduleSizeUpdate();
......
......@@ -17,37 +17,37 @@
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSIZEGROUP_H
#define KOSIZEGROUP_H
#ifndef KISSIZEGROUP_H
#define KISSIZEGROUP_H
#include <QObject>
#include "kowidgetutils_export.h"
#include "kritaui_export.h"
class QWidget;
class KoSizeGroupPrivate;
class KisSizeGroupPrivate;
/**
* KoSizeGroup provides a mechanism to group widgets together so they all
* KisSizeGroup provides a mechanism to group widgets together so they all
* request the same amount of space. Also, the widgets will share the same
* amount of minimum space. The mode of KoSizeGroup determines the direction of
* amount of minimum space. The mode of KisSizeGroup determines the direction of
* the space that are affected by the size group.
*
* All widgets inside of KoSizeGroup will use the same size hint value, computed
* All widgets inside of KisSizeGroup will use the same size hint value, computed
* as the maximum of all of his size hint values. The same value is used for the
* minimum size of all widgets. When KoSizeGroup ignore hidden widgets, the
* minimum size of all widgets. When KisSizeGroup ignore hidden widgets, the
* size of widgets that are not visible don't count in the computation of the
* current size value. When one of these widgets becomes visible again, a new
* size value is computed and applied to all visible widgets.
*
* KoSizeGroup cannot share the same widget with other size groups, so one
* widget can be in one, and only one, KoSizeGroup at time.
* KisSizeGroup cannot share the same widget with other size groups, so one
* widget can be in one, and only one, KisSizeGroup at time.
*
* NOTE: Added widgets in size groups must be laid out inside of a valid
* layout. The current implementation sopports widgets laid out inside of
* QGridLayout and QFormLayout. If the parent widget layout is not one of them,
* then the group size will not affect the widget size.
*/
class KOWIDGETUTILS_EXPORT KoSizeGroup : public QObject
class KRITAUI_EXPORT KisSizeGroup : public QObject
{
Q_OBJECT
......@@ -58,29 +58,29 @@ public:
*/
enum mode
{
KO_SIZE_GROUP_NONE = 0, //! group has no effect
KO_SIZE_GROUP_HORIZONTAL = 1 << 0, //! group affects horizontal size
KO_SIZE_GROUP_VERTICAL = 1 << 1, //! group affects vertical size
KO_SIZE_GROUP_BOTH = (KO_SIZE_GROUP_HORIZONTAL | KO_SIZE_GROUP_VERTICAL)//! group affects horizontal and vertical size
KIS_SIZE_GROUP_NONE = 0, //! group has no effect
KIS_SIZE_GROUP_HORIZONTAL = 1 << 0, //! group affects horizontal size
KIS_SIZE_GROUP_VERTICAL = 1 << 1, //! group affects vertical size
KIS_SIZE_GROUP_BOTH = (KIS_SIZE_GROUP_HORIZONTAL | KIS_SIZE_GROUP_VERTICAL)//! group affects horizontal and vertical size
};
/**
* Creates a new size group.
*
* By default, the mode of the size group is KO_SIZE_GROUP_HORIZONTAL and
* By default, the mode of the size group is KIS_SIZE_GROUP_HORIZONTAL and
* the group will not ignore hidden widgets.
*/
explicit KoSizeGroup(QObject* parent = 0,
KoSizeGroup::mode mode = KoSizeGroup::KO_SIZE_GROUP_HORIZONTAL,
explicit KisSizeGroup(QObject* parent = 0,
KisSizeGroup::mode mode = KisSizeGroup::KIS_SIZE_GROUP_HORIZONTAL,
bool ignoreHidden = false);
~KoSizeGroup();
~KisSizeGroup();
/// Changes the group size mode.
void setMode(KoSizeGroup::mode mode);
void setMode(KisSizeGroup::mode mode);
/// Returns the current mode of the group size.
KoSizeGroup::mode getMode() const;
KisSizeGroup::mode getMode() const;
/// Sets whether the group will ignore not visible widgets
void setIgnoreHidden(bool ignoreHidden);
......@@ -96,7 +96,7 @@ public:
void removeWidget(QWidget *widget);
private:
KoSizeGroupPrivate* const d;
KisSizeGroupPrivate* const d;
};
#endif // KOSIZEGROUP_H
#endif // KISSIZEGROUP_H
......@@ -17,7 +17,7 @@
* Boston, MA 02110-1301, USA.
*/
#include "KoSizeGroupPrivate.h"
#include "kis_size_group_p.h"
#include <QEvent>
#include <QTimer>
......@@ -26,7 +26,7 @@
#include <QGridLayout>
#include <QFormLayout>
KoSizeGroupPrivate::KoSizeGroupPrivate(KoSizeGroup *q_ptr, KoSizeGroup::mode mode, bool ignoreHidden)
KisSizeGroupPrivate::KisSizeGroupPrivate(KisSizeGroup *q_ptr, KisSizeGroup::mode mode, bool ignoreHidden)
: QObject()
, q(q_ptr)
, m_mode(mode)
......@@ -41,7 +41,7 @@ KoSizeGroupPrivate::KoSizeGroupPrivate(KoSizeGroup *q_ptr, KoSizeGroup::mode mod
QObject::connect(m_updateTimer, SIGNAL(timeout()), this, SLOT(updateSize()));
}
void KoSizeGroupPrivate::addWidget(QWidget *widget)
void KisSizeGroupPrivate::addWidget(QWidget *widget)
{
Q_ASSERT(widget);
......@@ -109,7 +109,7 @@ void KoSizeGroupPrivate::addWidget(QWidget *widget)
}
void KoSizeGroupPrivate::removeWidget(QWidget *widget)
void KisSizeGroupPrivate::removeWidget(QWidget *widget)
{
Q_ASSERT(widget);
......@@ -167,14 +167,14 @@ void KoSizeGroupPrivate::removeWidget(QWidget *widget)
}
}
void KoSizeGroupPrivate::scheduleSizeUpdate()
void KisSizeGroupPrivate::scheduleSizeUpdate()
{
m_updateTimer->start();
}
void KoSizeGroupPrivate::updateSize()
void KisSizeGroupPrivate::updateSize()
{
if (m_mode == KoSizeGroup::KO_SIZE_GROUP_NONE) {
if (m_mode == KisSizeGroup::KIS_SIZE_GROUP_NONE) {
// restore original widget size in each GroupItem
Q_FOREACH(GroupItem *groupItem, m_groupItems) {
groupItem->setSize(groupItem->widget()->sizeHint());
......@@ -202,15 +202,15 @@ void KoSizeGroupPrivate::updateSize()
continue;
switch(m_mode) {
case KoSizeGroup::KO_SIZE_GROUP_HORIZONTAL:
case KisSizeGroup::KIS_SIZE_GROUP_HORIZONTAL:
groupItem->setWidth(width);
break;
case KoSizeGroup::KO_SIZE_GROUP_VERTICAL:
case KisSizeGroup::KIS_SIZE_GROUP_VERTICAL:
groupItem->setHeight(height);
break;
case KoSizeGroup::KO_SIZE_GROUP_BOTH:
case KisSizeGroup::KIS_SIZE_GROUP_BOTH:
groupItem->setWidth(width);
groupItem->setHeight(height);
break;
......@@ -244,7 +244,7 @@ QSize GroupItem::sizeHint() const
QSize GroupItem::minimumSize() const
{
QSize size = QWidgetItem::minimumSize();
if (m_group->m_mode != KoSizeGroup::KO_SIZE_GROUP_NONE) {
if (m_group->m_mode != KisSizeGroup::KIS_SIZE_GROUP_NONE) {
size = m_group->getMaxSizeHint();
}
return size;
......
......@@ -17,27 +17,27 @@
* Boston, MA 02110-1301, USA.
*/
#ifndef KOSIZEGROUPPRIVATE_H
#define KOSIZEGROUPPRIVATE_H
#ifndef KISSIZEGROUPPRIVATE_H
#define KISSIZEGROUPPRIVATE_H
#include <QObject>
#include <QWidgetItem>
#include <QList>
#include <QSize>
#include "KoSizeGroup.h"
#include "kis_size_group.h"
class QWidget;
class QEvent;
class QTimer;
class GroupItem;
class KoSizeGroupPrivate : public QObject
class KisSizeGroupPrivate : public QObject
{
Q_OBJECT
public:
KoSizeGroupPrivate(KoSizeGroup *q_ptr, KoSizeGroup::mode mode, bool ignoreHidden);
KisSizeGroupPrivate(KisSizeGroup *q_ptr, KisSizeGroup::mode mode, bool ignoreHidden);
void addWidget(QWidget *widget);
void removeWidget(QWidget *widget);
......@@ -53,8 +53,8 @@ private Q_SLOTS:
void updateSize();
public:
KoSizeGroup* q;
KoSizeGroup::mode m_mode;
KisSizeGroup* q;
KisSizeGroup::mode m_mode;
bool m_ignoreHidden;
private:
......@@ -82,8 +82,8 @@ public:
bool hidden() const { return m_hidden; }
KoSizeGroupPrivate* getGroup() { return m_group; }
void setGroup(KoSizeGroupPrivate* group) { m_group = group; }
KisSizeGroupPrivate* getGroup() { return m_group; }
void setGroup(KisSizeGroupPrivate* group) { m_group = group; }
QSize sizeHint() const;
QSize minimumSize() const;
......@@ -93,7 +93,7 @@ public:
private:
bool m_hidden;
QSize m_size;
KoSizeGroupPrivate* m_group;
KisSizeGroupPrivate* m_group;
};
#endif // KOSIZEGROUPPRIVATE_H
#endif // KISSIZEGROUPPRIVATE_H
......@@ -7,8 +7,6 @@ set(kowidgetutils_LIB_SRCS
KoUpdater.cpp
KoUpdaterPrivate_p.cpp
KoProperties.cpp
KoSizeGroup.cpp
KoSizeGroupPrivate.cpp
)
......@@ -32,7 +30,6 @@ install(FILES
KoProgressUpdater.h
KoUpdater.h
KoProperties.h
KoSizeGroup.h
${CMAKE_CURRENT_BINARY_DIR}/kowidgetutils_export.h
DESTINATION ${INCLUDE_INSTALL_DIR}/calligra
COMPONENT Devel
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment