Commit 7dd8c646 authored by Michael Zhou's avatar Michael Zhou

Ready to submit the refactor to move palette view into kritawidgets

Minor fix, clean and change to make the refactoring code ready to be merged into master

T8646
parent 468f2aa0
#include "KisPaletteChooserPopup.h"
KisPaletteChooserPopup::KisPaletteChooserPopup()
{
}
#ifndef KISPALETTECHOOSERPOPUP_H
#define KISPALETTECHOOSERPOPUP_H
class KisPaletteChooserPopup
{
public:
KisPaletteChooserPopup();
};
#endif // KISPALETTECHOOSERPOPUP_H
\ No newline at end of file
......@@ -1651,16 +1651,6 @@ void KisConfig::setLineSmoothingStabilizeSensors(bool value)
m_cfg.writeEntry("LineSmoothingStabilizeSensors", value);
}
int KisConfig::paletteDockerPaletteViewSectionSize(bool defaultValue) const
{
return (defaultValue ? 12 : m_cfg.readEntry("paletteDockerPaletteViewSectionSize", 12));
}
void KisConfig::setPaletteDockerPaletteViewSectionSize(int value) const
{
m_cfg.writeEntry("paletteDockerPaletteViewSectionSize", value);
}
int KisConfig::tabletEventsDelay(bool defaultValue) const
{
return (defaultValue ? 10 : m_cfg.readEntry("tabletEventsDelay", 10));
......
......@@ -27,7 +27,6 @@
#include <QWindow>
#include <QTimer>
// #include "KisMainWindow.h"
#include <kis_canvas2.h>
#include "kis_shared_ptr.h"
......
......@@ -59,9 +59,6 @@ set(kritawidgets_LIB_SRCS
KisPaletteModel.cpp
kis_palette_delegate.cpp
kis_palette_view.cpp
# KisPaletteListModel.cpp
# KisPaletteListView.cpp
# KisPaletteListDelegate.cpp
KoPageLayoutWidget.cpp
KoPageLayoutDialog.cpp
......
......@@ -16,8 +16,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISBASICINTERNALCOLORSELECTOR_H
#define KISBASICINTERNALCOLORSELECTOR_H
#ifndef KISDLGINTERNALCOLORSELECTOR_H
#define KISDLGINTERNALCOLORSELECTOR_H
#include "kritawidgets_export.h"
#include "KoColor.h"
......@@ -95,15 +95,6 @@ public:
*/
static KoColor getModalColorDialog(const KoColor color, QWidget* parent = Q_NULLPTR, QString caption = QString());
/**
* @brief getColor
* Wrapper function that enables makes this class interchangable with QColorDialog sometimes.
*/
static KoColor getColor(const KoColor color, QWidget* parent = Q_NULLPTR, QString caption = QString())
{
return getModalColorDialog(color, parent, caption);
}
/**
* @brief getCurrentColor
* @return gives currently active color;
......@@ -197,13 +188,9 @@ private:
void updateAllElements(QObject *source);
private:
/**
* the UI, made protected so that elements can be added;
* for now only the screen color picker is added
*/
Ui_WdgDlgInternalColorSelector *m_ui;
struct Private; //The private struct
const QScopedPointer<Private> m_d; //the private pointer
};
#endif // KISBASICINTERNALCOLORSELECTOR_H
#endif // KISDLGINTERNALCOLORSELECTOR_H
......@@ -30,9 +30,6 @@
#include <resources/KoColorSet.h>
#include <KoColorDisplayRendererInterface.h>
// #include <kis_layer.h>
// #include <kis_paint_layer.h>
KisPaletteModel::KisPaletteModel(QObject* parent)
: QAbstractTableModel(parent),
m_colorSet(0),
......
......@@ -25,7 +25,6 @@
#include <KoColorDisplayRendererInterface.h>
/// #include <kis_types.h>
#include "kritawidgets_export.h"
#include <KoColorSet.h>
#include <QScopedPointer>
......
/*
* Copyright (C) Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>, (C) 2016
* Copyright (C) Michael Zhou <simeirxh@gmail.com>, (C) 2018
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <KisScreenColorPickerBase.h>
/*
* Copyright (C) Wolthera van Hovell tot Westerflier <griffinvalley@gmail.com>, (C) 2016
* Copyright (C) Michael Zhou <simeirxh@gmail.com>, (C) 2018
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KISSCREENCOLORPICKERBASE_H
#define KISSCREENCOLORPICKERBASE_H
#include <QWidget>
......
......@@ -20,19 +20,21 @@
#include <QWheelEvent>
#include <QHeaderView>
#include "kis_palette_delegate.h"
#include "KisPaletteModel.h"
#include <KLocalizedString>
#include <KoDialog.h>
#include <QFormLayout>
#include <QLabel>
#include <QLineEdit>
#include <KoColorPopupButton.h>
#include <QCheckBox>
#include <QComboBox>
#include <QMenu>
#include <KConfigGroup>
#include <KSharedConfig>
#include <KLocalizedString>
#include <KoDialog.h>
#include "kis_palette_delegate.h"
#include "KisPaletteModel.h"
#include "kis_color_button.h"
struct KisPaletteView::Private
......@@ -54,14 +56,13 @@ KisPaletteView::KisPaletteView(QWidget *parent)
// setDragDropMode(QAbstractItemView::InternalMove);
setDropIndicatorShown(true);
/// KisConfig cfg;
KConfigGroup cfg(KSharedConfig::openConfig()->group(""));
//QPalette pal(palette());
//pal.setColor(QPalette::Base, cfg.getMDIBackgroundColor());
//setAutoFillBackground(true);
//setPalette(pal);
int defaultSectionSize = 12;
/// int defaultSectionSize = cfg.paletteDockerPaletteViewSectionSize();
int defaultSectionSize = cfg.readEntry("paletteDockerPaletteViewSectionSize", 12);
horizontalHeader()->setDefaultSectionSize(defaultSectionSize);
verticalHeader()->setDefaultSectionSize(defaultSectionSize);
connect(this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(modifyEntry(QModelIndex)));
......@@ -99,7 +100,7 @@ bool KisPaletteView::addEntryWithDialog(KoColor color)
editableItems->addRow(i18n("ID"), lnIDName);
editableItems->addRow(i18n("Name"), lnName);
editableItems->addRow(i18n("Color"), bnColor);
editableItems->addRow(i18n("Spot"), chkSpot);
editableItems->addRow(i18nc("Spot Color", "Spot"), chkSpot);
cmbGroups->setCurrentIndex(0);
lnName->setText(i18nc("Part of a default name for a color","Color")+" "+QString::number(m_d->model->colorSet()->nColors()+1));
lnIDName->setText(QString::number(m_d->model->colorSet()->nColors()+1));
......@@ -262,6 +263,8 @@ void KisPaletteView::wheelEvent(QWheelEvent *event)
} else {
horizontalHeader()->setDefaultSectionSize(setSize);
verticalHeader()->setDefaultSectionSize(setSize);
KConfigGroup cfg(KSharedConfig::openConfig()->group(""));
cfg.writeEntry("paletteDockerPaletteViewSectionSize", setSize);
}
event->accept();
......@@ -296,7 +299,7 @@ void KisPaletteView::entrySelection(bool foreground) {
void KisPaletteView::modifyEntry(QModelIndex index) {
if (m_d->allowPaletteModification) {
KoDialog *group = new KoDialog();
KoDialog *group = new KoDialog(this);
QFormLayout *editableItems = new QFormLayout(group);
group->mainWidget()->setLayout(editableItems);
QLineEdit *lnIDName = new QLineEdit(group);
......
......@@ -101,7 +101,6 @@ protected:
private:
struct Private;
class SimpleColorButton;
const QScopedPointer<Private> m_d;
private Q_SLOTS:
/**
......
......@@ -30,7 +30,6 @@
#include "kis_global.h"
#include <kis_debug.h>
// #include <kis_paintop_presets_popup.h>
struct KisPopupButton::Private {
Private()
......
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