Commit 72cd9d1b authored by Sven Langkamp's avatar Sven Langkamp

replace non-working preset widget with button

BUG:233642

svn path=/trunk/koffice/; revision=1115348
parent ada98aaa
......@@ -25,6 +25,9 @@
#include <QPixmap>
#include <QLayout>
#include <QHBoxLayout>
#include <QToolButton>
#include <QMenu>
#include <QGridLayout>
#include <kactioncollection.h>
#include <kis_debug.h>
......@@ -61,11 +64,26 @@
#include "ko_favorite_resource_manager.h"
class DummyMenu : public QMenu
{
public:
DummyMenu(QWidget * parent = 0);
virtual QSize sizeHint() const;
};
DummyMenu::DummyMenu(QWidget * parent)
: QMenu(parent)
{
}
QSize DummyMenu::sizeHint() const
{
return layout()->sizeHint();
}
KisPaintopBox::KisPaintopBox(KisView2 * view, QWidget *parent, const char * name)
: QWidget(parent)
, m_resourceProvider(view->resourceProvider())
, m_optionWidget(0)
, m_presetWidget(0)
, m_view(view)
, m_activePreset(0)
{
......@@ -87,18 +105,27 @@ KisPaintopBox::KisPaintopBox(KisView2 * view, QWidget *parent, const char * name
m_cmbPaintops->setAttribute(Qt::WA_MacSmallSize, true);
#endif
m_presetWidget = new KisPresetWidget(this, "presetwidget");
m_presetWidget->setToolTip(i18n("Edit brush preset"));
m_presetWidget->setFixedSize(120, 26);
m_layout = new QHBoxLayout(this);
m_layout->addWidget(m_cmbPaintops);
m_layout->addWidget(m_presetWidget);
QToolButton* presetMenuButton = new QToolButton(this);
presetMenuButton->setToolTip(i18n("Edit brush preset"));
presetMenuButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
presetMenuButton->setIconSize(QSize(24, 24));
presetMenuButton->setIcon(KIcon("document-properties"));
presetMenuButton->setPopupMode(QToolButton::InstantPopup);
DummyMenu* popupMenu = new DummyMenu(this);
presetMenuButton->setMenu(popupMenu);
QHBoxLayout * popupLayout = new QHBoxLayout(popupMenu);
popupLayout->setMargin(3);
m_presetsPopup = new KisPaintOpPresetsPopup(m_resourceProvider);
m_presetWidget->setPopupWidget(m_presetsPopup);
popupLayout->addWidget(m_presetsPopup);
m_presetsPopup->switchDetached();
m_layout = new QHBoxLayout(this);
m_layout->addWidget(m_cmbPaintops);
m_layout->addWidget(presetMenuButton);
QList<KoID> keys = KisPaintOpRegistry::instance()->listKeys();
for (QList<KoID>::Iterator it = keys.begin(); it != keys.end(); ++it) {
// add all paintops, and show/hide them afterwards
......@@ -265,9 +292,7 @@ void KisPaintopBox::setCurrentPaintop(const KoID & paintop)
{
if (m_activePreset && m_optionWidget) {
m_optionWidget->writeConfiguration(const_cast<KisPaintOpSettings*>(m_activePreset->settings().data()));
m_optionWidget->disconnect(m_presetWidget);
m_presetsPopup->setPaintOpSettingsWidget(0);
m_optionWidget->hide();
}
m_currentID[KoToolManager::instance()->currentInputDevice()] = paintop;
......@@ -290,7 +315,6 @@ void KisPaintopBox::setCurrentPaintop(const KoID & paintop)
m_presetsPopup->setPaintOpSettingsWidget(m_optionWidget);
m_presetsPopup->setPresetFilter(paintop);
Q_ASSERT(m_optionWidget);
Q_ASSERT(m_presetWidget);
connect(m_optionWidget, SIGNAL(sigConfigurationUpdated()), this, SLOT(slotUpdatePreset()));
m_presetsPopup->setPreset(preset);
} else {
......@@ -310,7 +334,6 @@ void KisPaintopBox::setCurrentPaintop(const KoID & paintop)
m_cmbPaintops->setCurrentIndex(index);
m_activePreset = preset;
m_presetWidget->setPreset(m_activePreset);
//m_presetsPopup->presetPreview()->setPreset(m_activePreset);
emit signalPaintopChanged(preset);
......@@ -377,8 +400,6 @@ void KisPaintopBox::slotSaveActivePreset()
void KisPaintopBox::slotUpdatePreset()
{
m_optionWidget->writeConfiguration(const_cast<KisPaintOpSettings*>(m_activePreset->settings().data()));
m_presetWidget->updatePreview();
//m_presetsPopup->presetPreview()->updatePreview();
}
#include "kis_paintop_box.moc"
......@@ -101,7 +101,6 @@ private:
QHBoxLayout* m_layout;
KisPaintOpSettingsWidget* m_optionWidget;
KisPresetWidget* m_presetWidget;
KisPaintOpPresetsPopup* m_presetsPopup;
KisView2* m_view;
......
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