Commit 3fd6db55 authored by Vera Lukman's avatar Vera Lukman

Implementation of favorite brushes palette is half done.

svn path=/trunk/koffice/; revision=1048296
parent a8dcf047
...@@ -151,6 +151,9 @@ ...@@ -151,6 +151,9 @@
<Separator/> <Separator/>
<Action name="paintops"/> <Action name="paintops"/>
<Action name="paintop_options"/> <Action name="paintop_options"/>
<Separator/>
<Action name="palette_manager"/>
<Action name="palette"/>
</ToolBar> </ToolBar>
<Menu name="image_popup"> <Menu name="image_popup">
......
...@@ -47,6 +47,7 @@ set(kritaui_LIB_SRCS ...@@ -47,6 +47,7 @@ set(kritaui_LIB_SRCS
flake/kis_shape_selection_canvas.cpp flake/kis_shape_selection_canvas.cpp
flake/kis_shape_selection_model.cpp flake/kis_shape_selection_model.cpp
flake/kis_layermap_visitor.cpp flake/kis_layermap_visitor.cpp
flowlayout.cpp
kis_autogradient.cc kis_autogradient.cc
kis_autogradient_resource.cc kis_autogradient_resource.cc
kis_bookmarked_configurations_editor.cc kis_bookmarked_configurations_editor.cc
...@@ -65,6 +66,7 @@ set(kritaui_LIB_SRCS ...@@ -65,6 +66,7 @@ set(kritaui_LIB_SRCS
kis_doc2.cc kis_doc2.cc
kis_exposure_visitor.cc kis_exposure_visitor.cc
kis_factory2.cc kis_factory2.cc
kis_favorite_brush_data.cpp
kis_filter_handler.cc kis_filter_handler.cc
kis_filter_manager.cc kis_filter_manager.cc
kis_filters_model.cc kis_filters_model.cc
...@@ -80,14 +82,18 @@ set(kritaui_LIB_SRCS ...@@ -80,14 +82,18 @@ set(kritaui_LIB_SRCS
kis_painting_assistant.cc kis_painting_assistant.cc
kis_painting_assistants_manager.cc kis_painting_assistants_manager.cc
kis_paintop_box.cc kis_paintop_box.cc
kis_palette_manager.cpp
kis_popup_palette.cpp
kis_png_converter.cpp kis_png_converter.cpp
kis_print_job.cpp kis_print_job.cpp
kis_recent_color_data.cpp
kis_resource_server_provider.cpp kis_resource_server_provider.cpp
kis_selection_decoration.cc kis_selection_decoration.cc
kis_selection_manager.cc kis_selection_manager.cc
kis_statusbar.cc kis_statusbar.cc
kis_view2.cpp kis_view2.cpp
kis_zoom_manager.cc kis_zoom_manager.cc
ko_favorite_resource_manager.cpp
kisexiv2/kis_exif_io.cpp kisexiv2/kis_exif_io.cpp
kisexiv2/kis_exiv2.cpp kisexiv2/kis_exiv2.cpp
kisexiv2/kis_iptc_io.cpp kisexiv2/kis_iptc_io.cpp
......
/****************************************************************************
**
** Copyright (C) 2004-2008 Trolltech ASA. All rights reserved.
**
** This file is part of the documentation of the Qt Toolkit.
**
** This file may be used under the terms of the GNU General Public
** License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Alternatively you may (at
** your option) use any later version of the GNU General Public
** License if such license has been publicly approved by Trolltech ASA
** (or its successors, if any) and the KDE Free Qt Foundation. In
** addition, as a special exception, Trolltech gives you certain
** additional rights. These rights are described in the Trolltech GPL
** Exception version 1.2, which can be found at
** http://www.trolltech.com/products/qt/gplexception/ and in the file
** GPL_EXCEPTION.txt in this package.
**
** Please review the following information to ensure GNU General
** Public Licensing requirements will be met:
** http://trolltech.com/products/qt/licenses/licensing/opensource/. If
** you are unsure which license is appropriate for your use, please
** review the following information:
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
** or contact the sales department at sales@trolltech.com.
**
** In addition, as a special exception, Trolltech, as the sole
** copyright holder for Qt Designer, grants users of the Qt/Eclipse
** Integration plug-in the right for the Qt/Eclipse Integration to
** link to functionality provided by Qt Designer and its related
** libraries.
**
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE. Trolltech reserves all rights not expressly
** granted herein.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
#include <QtGui>
#include "flowlayout.h"
FlowLayout::FlowLayout(QWidget *parent, int margin, int spacing)
: QLayout(parent)
{
setMargin(margin);
setSpacing(spacing);
}
FlowLayout::FlowLayout(int spacing)
{
setSpacing(spacing);
}
FlowLayout::~FlowLayout()
{
QLayoutItem *item;
while ((item = takeAt(0)))
delete item;
}
void FlowLayout::addItem(QLayoutItem *item)
{
itemList.append(item);
}
int FlowLayout::count() const
{
return itemList.size();
}
QLayoutItem *FlowLayout::itemAt(int index) const
{
return itemList.value(index);
}
QLayoutItem *FlowLayout::takeAt(int index)
{
if (index >= 0 && index < itemList.size())
return itemList.takeAt(index);
else
return 0;
}
Qt::Orientations FlowLayout::expandingDirections() const
{
return 0;
}
bool FlowLayout::hasHeightForWidth() const
{
return true;
}
int FlowLayout::heightForWidth(int width) const
{
int height = doLayout(QRect(0, 0, width, 0), true);
return height;
}
void FlowLayout::setGeometry(const QRect &rect)
{
QLayout::setGeometry(rect);
doLayout(rect, false);
}
QSize FlowLayout::sizeHint() const
{
return minimumSize();
}
QSize FlowLayout::minimumSize() const
{
QSize size;
QLayoutItem *item;
foreach (item, itemList)
size = size.expandedTo(item->minimumSize());
size += QSize(2*margin(), 2*margin());
return size;
}
int FlowLayout::doLayout(const QRect &rect, bool testOnly) const
{
int x = rect.x();
int y = rect.y();
int lineHeight = 0;
QLayoutItem *item;
foreach (item, itemList) {
int nextX = x + item->sizeHint().width() + spacing();
if (nextX - spacing() > rect.right() && lineHeight > 0) {
x = rect.x();
y = y + lineHeight + spacing();
nextX = x + item->sizeHint().width() + spacing();
lineHeight = 0;
}
if (!testOnly)
item->setGeometry(QRect(QPoint(x, y), item->sizeHint()));
x = nextX;
lineHeight = qMax(lineHeight, item->sizeHint().height());
}
return y + lineHeight - rect.y();
}
/****************************************************************************
**
** Copyright (C) 2004-2008 Trolltech ASA. All rights reserved.
**
** This file is part of the documentation of the Qt Toolkit.
**
** This file may be used under the terms of the GNU General Public
** License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Alternatively you may (at
** your option) use any later version of the GNU General Public
** License if such license has been publicly approved by Trolltech ASA
** (or its successors, if any) and the KDE Free Qt Foundation. In
** addition, as a special exception, Trolltech gives you certain
** additional rights. These rights are described in the Trolltech GPL
** Exception version 1.2, which can be found at
** http://www.trolltech.com/products/qt/gplexception/ and in the file
** GPL_EXCEPTION.txt in this package.
**
** Please review the following information to ensure GNU General
** Public Licensing requirements will be met:
** http://trolltech.com/products/qt/licenses/licensing/opensource/. If
** you are unsure which license is appropriate for your use, please
** review the following information:
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
** or contact the sales department at sales@trolltech.com.
**
** In addition, as a special exception, Trolltech, as the sole
** copyright holder for Qt Designer, grants users of the Qt/Eclipse
** Integration plug-in the right for the Qt/Eclipse Integration to
** link to functionality provided by Qt Designer and its related
** libraries.
**
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE. Trolltech reserves all rights not expressly
** granted herein.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
#ifndef FLOWLAYOUT_H
#define FLOWLAYOUT_H
#include <QLayout>
#include <QRect>
#include <QWidgetItem>
class FlowLayout : public QLayout
{
public:
FlowLayout(QWidget *parent, int margin = 0, int spacing = -1);
FlowLayout(int spacing = -1);
~FlowLayout();
void addItem(QLayoutItem *item);
Qt::Orientations expandingDirections() const;
bool hasHeightForWidth() const;
int heightForWidth(int) const;
int count() const;
QLayoutItem *itemAt(int index) const;
QSize minimumSize() const;
void setGeometry(const QRect &rect);
QSize sizeHint() const;
QLayoutItem *takeAt(int index);
private:
int doLayout(const QRect &rect, bool testOnly) const;
QList<QLayoutItem *> itemList;
};
#endif // FLOWLAYOUT_H
...@@ -65,6 +65,7 @@ KAboutData * newKritaAboutData() ...@@ -65,6 +65,7 @@ KAboutData * newKritaAboutData()
aboutData->addAuthor(ki18n("Toshitaka Fujioka"), KLocalizedString(), "fujioka@kde.org"); aboutData->addAuthor(ki18n("Toshitaka Fujioka"), KLocalizedString(), "fujioka@kde.org");
aboutData->addAuthor(ki18n("Thomas Zander"), KLocalizedString(), "zander@kde.org"); aboutData->addAuthor(ki18n("Thomas Zander"), KLocalizedString(), "zander@kde.org");
aboutData->addAuthor(ki18n("Tom Burdick"), KLocalizedString(), "tburdi1@uic.edu"); aboutData->addAuthor(ki18n("Tom Burdick"), KLocalizedString(), "tburdi1@uic.edu");
aboutData->addAuthor(ki18n("Vera Lukman"), KLocalizedString(), "shichan.karachu@gmail.com");
aboutData->addAuthor(ki18n("Sander Koning"), KLocalizedString(), "sanderkoning@kde.nl"); aboutData->addAuthor(ki18n("Sander Koning"), KLocalizedString(), "sanderkoning@kde.nl");
aboutData->addAuthor(ki18n("Andreas Lundin"), KLocalizedString(), "adde@update.uu.se"); aboutData->addAuthor(ki18n("Andreas Lundin"), KLocalizedString(), "adde@update.uu.se");
return aboutData; return aboutData;
......
...@@ -58,6 +58,8 @@ ...@@ -58,6 +58,8 @@
#include "kis_paintop_box.h" #include "kis_paintop_box.h"
#include "kis_custom_pattern.h" #include "kis_custom_pattern.h"
#include "widgets/kis_pattern_chooser.h" #include "widgets/kis_pattern_chooser.h"
#include "kis_popup_palette.h"
#include "ko_favorite_resource_manager.h"
KisControlFrame::KisControlFrame(KisView2 * view, const char* name) KisControlFrame::KisControlFrame(KisView2 * view, const char* name)
...@@ -113,6 +115,21 @@ KisControlFrame::KisControlFrame(KisView2 * view, const char* name) ...@@ -113,6 +115,21 @@ KisControlFrame::KisControlFrame(KisView2 * view, const char* name)
view->actionCollection()->addAction("paintops", action); view->actionCollection()->addAction("paintops", action);
action->setDefaultWidget(m_paintopBox); action->setDefaultWidget(m_paintopBox);
/***TESTING***/
m_view->setFavoriteResourceManager(m_paintopBox);
m_paletteButton = new QPushButton("Save to Palette");
connect(m_paletteButton, SIGNAL(clicked()), this, SLOT(slotSaveToFavouriteBrushes()));
action = new KAction(i18n("&Palette"), this);
view->actionCollection()->addAction("palette_manager", action);
action->setDefaultWidget(m_paletteButton);
QPushButton* m_popupPaletteButton = new QPushButton("Palette (temp)");
connect(m_popupPaletteButton, SIGNAL(clicked()), this, SLOT(slotPaletteTemp()));
action = new KAction(i18n("&PopupPalette"), this);
view->actionCollection()->addAction("palette", action);
action->setDefaultWidget(m_popupPaletteButton);
} }
...@@ -163,8 +180,32 @@ void KisControlFrame::createPatternsChooser(KisView2 * view) ...@@ -163,8 +180,32 @@ void KisControlFrame::createPatternsChooser(KisView2 * view)
chooser->setCurrentItem(0, 0); chooser->setCurrentItem(0, 0);
if (chooser->currentResource()) if (chooser->currentResource())
view->resourceProvider()->slotPatternActivated(chooser->currentResource()); view->resourceProvider()->slotPatternActivated(chooser->currentResource());
} }
void KisControlFrame::slotPaletteTemp()
{
if(! m_view->favoriteResourceManager())
{
qDebug() << "favoriteResourceManager is not instantiated";
m_view->setFavoriteResourceManager(m_paintopBox);
}
else{
m_view->favoriteResourceManager()->showPopupPalette();
}
}
void KisControlFrame::slotSaveToFavouriteBrushes()
{
if(! m_view->favoriteResourceManager())
{
qDebug() << "favoriteResourceManager is not instantiated";
m_view->setFavoriteResourceManager(m_paintopBox);
}
else {
m_view->favoriteResourceManager()->showPaletteManager();
}
}
void KisControlFrame::createGradientsChooser(KisView2 * view) void KisControlFrame::createGradientsChooser(KisView2 * view)
{ {
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
class QWidget; class QWidget;
class QTabWidget; class QTabWidget;
class QTableWidgetItem; class QTableWidgetItem;
class QPushButton;
class KToolBar; class KToolBar;
...@@ -65,6 +66,8 @@ public slots: ...@@ -65,6 +66,8 @@ public slots:
void slotSetPattern(KisPattern * pattern); void slotSetPattern(KisPattern * pattern);
void slotSetGradient(KoAbstractGradient * gradient); void slotSetGradient(KoAbstractGradient * gradient);
void slotSaveToFavouriteBrushes();
void slotPaletteTemp();
private: private:
...@@ -88,6 +91,7 @@ private: ...@@ -88,6 +91,7 @@ private:
KisGradientChooser * m_gradientChooser; KisGradientChooser * m_gradientChooser;
KisPaintopBox * m_paintopBox; KisPaintopBox * m_paintopBox;
QPushButton* m_paletteButton;
}; };
#endif #endif
......
/* This file is part of the KDE project
Copyright 2009 Vera Lukman <vla24@sfu.ca>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "kis_favorite_brush_data.h"
#include "kis_popup_palette.h"
#include <kis_paintop_preset.h>
#include <kis_types.h>
#include <KoID.h>
#include <QDebug>
#include <QIcon>
#include <QToolButton>
KisFavoriteBrushData::KisFavoriteBrushData(KisPaintOpPresetSP newdata, QIcon* icon)
: m_button (0)
, m_data (newdata) // put this here instead of in the constructor is better style and more efficient.
{
// without a button, this class doesn't make sense, so always initialize it
m_button = new QToolButton();
m_button->setMinimumSize(KisPopupPalette::BUTTON_SIZE, KisPopupPalette::BUTTON_SIZE);
m_button->setMaximumSize(KisPopupPalette::BUTTON_SIZE, KisPopupPalette::BUTTON_SIZE);
m_button->connect(m_button, SIGNAL(clicked()), this, SLOT(slotBrushButtonClicked()));
if (icon) m_button->setIcon(*icon);
}
void KisFavoriteBrushData::slotBrushButtonClicked()
{
qDebug() << "Brush name:" << m_data->paintOp();
}
KisPaintOpPresetSP KisFavoriteBrushData::paintopPreset()
{
return m_data;
}
void KisFavoriteBrushData::setIcon (QIcon* icon)
{
m_button->setIcon(*icon);
}
QToolButton* KisFavoriteBrushData::paintopButton()
{
return m_button;
}
KisFavoriteBrushData::~KisFavoriteBrushData()
{
qDebug() << "Brush name:" << m_data->paintOp() << "deleting";
// don't delete m_data, it's a shared pointer
// only delete the button if it hasn't got a parent object, otherwise
// we have a double delete
if (!m_button->parent()) {
delete m_button;
}
}
#include "kis_favorite_brush_data.moc"
/* This file is part of the KDE project
Copyright 2009 Vera Lukman <vla24@sfu.ca>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KIS_FAVORITE_BRUSH_DATA_H
#define KIS_FAVORITE_BRUSH_DATA_H
#include <QObject>
#include <kis_types.h>
class QToolButton;
class QIcon;
class KisFavoriteBrushData : public QObject
{
Q_OBJECT
public:
KisFavoriteBrushData(KisPaintOpPresetSP, QIcon * = 0);
~KisFavoriteBrushData();
KisPaintOpPresetSP paintopPreset(); //CHANGE TO KisPresetPaintOpSP
void setIcon (QIcon*);
QToolButton* paintopButton();
private:
QToolButton* m_button;
KisPaintOpPresetSP m_data; //CHANGE TO KisPresetPaintOpSP
private slots:
void slotBrushButtonClicked();
};
#endif // KIS_FAVORITE_BRUSH_DATA_H
...@@ -58,6 +58,9 @@ ...@@ -58,6 +58,9 @@
#include "widgets/kis_paintop_presets_popup.h" #include "widgets/kis_paintop_presets_popup.h"
#include <kis_paintop_settings_widget.h> #include <kis_paintop_settings_widget.h>
#include "kis_favorite_brush_data.h"
#include "ko_favorite_resource_manager.h"
KisPaintopBox::KisPaintopBox(KisView2 * view, QWidget *parent, const char * name) KisPaintopBox::KisPaintopBox(KisView2 * view, QWidget *parent, const char * name)
: QWidget(parent) : QWidget(parent)
, m_resourceProvider(view->resourceProvider()) , m_resourceProvider(view->resourceProvider())
...@@ -113,12 +116,21 @@ KisPaintopBox::~KisPaintopBox() ...@@ -113,12 +116,21 @@ KisPaintopBox::~KisPaintopBox()
{ {
// Do not delete the widget, since it it is global to the application, not owned by the view // Do not delete the widget, since it it is global to the application, not owned by the view
m_presetsPopup->setPaintOpSettingsWidget(0); m_presetsPopup->setPaintOpSettingsWidget(0);
}
foreach(const PresetMap& h, m_inputDevicePresets.values()) { KisPaintOpPresetSP KisPaintopBox::paintOpPresetSP(KoID* paintop)
foreach(KisPaintOpPresetSP preset, h.values()) { {
preset.clear(); if (paintop == 0)
} return m_activePreset->clone();
} else if (!QString::compare(paintop->id(), "eraser", Qt::CaseInsensitive))
return activePreset(*paintop, KoInputDevice::eraser());
else
return activePreset(*paintop, KoToolManager::instance()->currentInputDevice());
}
const KoID& KisPaintopBox::currentPaintopKoID()
{
return currentPaintop();
} }
void KisPaintopBox::slotItemSelected(int index) void KisPaintopBox::slotItemSelected(int index)
...@@ -223,43 +235,43 @@ void KisPaintopBox::slotCurrentNodeChanged(KisNodeSP node) ...@@ -223,43 +235,43 @@ void KisPaintopBox::slotCurrentNodeChanged(KisNodeSP node)
const KoID& KisPaintopBox::currentPaintop() const KoID& KisPaintopBox::currentPaintop()
{ {
KoID id = m_currentID[KoToolManager::instance()->currentInputDevice()]; KoID id = m_currentID[KoToolManager::instance()->currentInputDevice()];
return m_currentID[KoToolManager::instance()->currentInputDevice()];; return m_currentID[KoToolManager::instance()->currentInputDevice()];
} }
void KisPaintopBox::setCurrentPaintop(const KoID & paintop) void KisPaintopBox::setCurrentPaintop(const KoID & paintop)
{ {
if (m_activePreset && m_optionWidget) { if (m_activePreset && m_optionWidget) {
m_optionWidget->writeConfiguration(const_cast<KisPaintOpSettings*>(m_activePreset->settings().data())); m_optionWidget->writeConfiguration(const_cast<KisPaintOpSettings*>(m_activePreset->settings().data()));
m_optionWidget->disconnect(m_presetWidget); m_optionWidget->disconnect(m_presetWidget);
m_optionWidget->disconnect(m_presetsPopup->presetPreview()); m_optionWidget->disconnect(m_presetsPopup->presetPreview());
m_presetsPopup->setPaintOpSettingsWidget(0); m_presetsPopup->setPaintOpSettingsWidget(0);
m_optionWidget->hide(); m_optionWidget->hide();
const_cast<KisPaintOpSettings*>(m_activePreset->settings().data())->setOptionsWidget(0); const_cast<KisPaintOpSettings*>(m_activePreset->settings().data())->setOptionsWidget(0);
} }
m_currentID[KoToolManager::instance()->currentInputDevice()] = paintop; m_currentID[KoToolManager::instance()->currentInputDevice()] = paintop;
KisPaintOpPresetSP preset = KisPaintOpPresetSP preset =
activePreset(currentPaintop(), KoToolManager::instance()->currentInputDevice()); activePreset(currentPaintop(), KoToolManager::instance()->currentInputDevice());
if (preset != 0 && preset->settings()) { if (preset != 0 && preset->settings()) {
if (!m_paintopOptionWidgets.contains(paintop)) { if (!m_paintopOptionWidgets.contains(paintop)) {
m_paintopOptionWidgets[paintop] = KisPaintOpRegistry::instance()->get(paintop.id())->createSettingsWidget(this); m_paintopOptionWidgets[paintop] = KisPaintOpRegistry::instance()->get(paintop.id())->createSettingsWidget(this);
} }
m_optionWidget = m_paintopOptionWidgets[paintop]; m_optionWidget = m_paintopOptionWidgets[paintop];
// XXX: Hack! // XXX: Hack!
const_cast<KisPaintOpSettings*>(preset->settings().data())->setOptionsWidget(m_optionWidget); const_cast<KisPaintOpSettings*>(preset->settings().data())->setOptionsWidget(m_optionWidget);
m_optionWidget->setImage(m_view->image()); m_optionWidget->setImage(m_view->image());
if (!preset->settings()->getProperties().isEmpty()) { if (!preset->settings()->getProperties().isEmpty()) {
m_optionWidget->setConfiguration(preset->settings()); m_optionWidget->setConfiguration(preset->settings());
} }
m_presetsPopup->setPaintOpSettingsWidget(m_optionWidget); m_presetsPopup->setPaintOpSettingsWidget(m_optionWidget);
Q_ASSERT(m_optionWidget); Q_ASSERT(m_optionWidget);
Q_ASSERT(m_presetWidget); Q_ASSERT(m_presetWidget);
connect(m_optionWidget, SIGNAL(sigConfigurationUpdated()), this, SLOT(slotUpdatePreset())); connect(m_optionWidget, SIGNAL(sigConfigurationUpdated()), this, SLOT(slotUpdatePreset()));
} else { } else {
m_presetsPopup->setPaintOpSettingsWidget(0); m_presetsPopup->setPaintOpSettingsWidget(0);
} }
preset->settings()->setNode(m_resourceProvider->currentNode()); preset->settings()->setNode(m_resourceProvider->currentNode());
...@@ -268,15 +280,19 @@ void KisPaintopBox::setCurrentPaintop(const KoID & paintop) ...@@ -268,15 +280,19 @@ void KisPaintopBox::setCurrentPaintop(const KoID & paintop)
int index = m_displayedOps.indexOf(paintop); int index = m_displayedOps.indexOf(paintop);
if (index == -1) { if (index == -1) {
// Must change the paintop as the current one is not supported // Must change the paintop as the current one is not supported
// by the new colorspace. // by the new colorspace.
index = 0; index = 0;
} }
m_cmbPaintops->setCurrentIndex(index); m_cmbPaintops->setCurrentIndex(index);
m_activePreset = preset; m_activePreset = preset;
m_presetWidget->setPreset(m_activePreset); m_presetWidget->setPreset(m_activePreset);
m_presetsPopup->presetPreview()->setPreset(m_activePreset); m_presetsPopup->presetPreview()->setPreset(m_activePreset);
//TODO: FIX THIS! use signal and slot instead!
if (m_view->favoriteResourceManager() != 0)
m_view->favoriteResourceManager()->changeCurrentBrush();
} }
KoID KisPaintopBox::defaultPaintop(const KoInputDevice & inputDevice) KoID KisPaintopBox::defaultPaintop(const KoInputDevice & inputDevice)
......
...@@ -63,7 +63,9 @@ class KisPaintopBox : public QWidget ...@@ -63,7 +63,9 @@ class KisPaintopBox : public QWidget
public: public:
KisPaintopBox(KisView2 * view, QWidget * parent, const char * name); KisPaintopBox(KisView2 * view, QWidget * parent, const char * name);
KisPaintOpPresetSP paintOpPresetSP(KoID * = 0);
const KoID& currentPaintopKoID();
QPixmap paintopPixmap(const KoID & paintop);
~KisPaintopBox(); ~KisPaintopBox();
public slots: public slots:
...@@ -77,7 +79,6 @@ public slots: ...@@ -77,7 +79,6 @@ public slots:
private: private:
QPixmap paintopPixmap(const KoID & paintop);
const KoID & currentPaintop(); const KoID & currentPaintop();
void setCurrentPaintop(const KoID & paintop); void setCurrentPaintop(const KoID & paintop);
KoID defaultPaintop(const KoInputDevice & inputDevice); KoID defaultPaintop(const KoInputDevice & inputDevice);
......
/* This file is part of the KDE project
Copyright 2009 Vera Lukman <vla24@sfu.ca>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.