Commit 6b65850a authored by Lukáš Tvrdý's avatar Lukáš Tvrdý

Merged revisions 1109617 via svnmerge from

https://lukast@svn.kde.org/home/kde/branches/work/koffice-ko

........
  r1109617 | lukast | 2010-03-31 16:39:25 +0200 (Wed, 31 Mar 2010) | 1 line
  
  Add the default button feature.
........

svn path=/trunk/koffice/; revision=1119237
parent e9c6c2ce
......@@ -77,6 +77,13 @@
</item>
</layout>
</item>
<item row="5" column="0">
<widget class="QPushButton" name="bnDefaultPreset">
<property name="text">
<string>Default preset</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabChooser">
......
......@@ -70,7 +70,9 @@ KisPaintopBox::KisPaintopBox(KisView2 * view, QWidget *parent, const char * name
, m_activePreset(0)
{
Q_ASSERT(view != 0);
KGlobal::mainComponent().dirs()->addResourceType("kis_defaultpresets", "data", "krita/defaultpresets/");
setObjectName(name);
KAcceleratorManager::setNoAccel(this);
......@@ -112,6 +114,8 @@ KisPaintopBox::KisPaintopBox(KisView2 * view, QWidget *parent, const char * name
connect(m_cmbPaintops, SIGNAL(activated(int)), this, SLOT(slotItemSelected(int)));
connect(m_presetsPopup, SIGNAL(savePresetClicked()), this, SLOT(slotSaveActivePreset()));
connect(m_presetsPopup, SIGNAL(defaultPresetClicked()), this, SLOT(slotSetupDefaultPreset()));
connect(m_presetsPopup, SIGNAL(resourceSelected(KoResource*)),
this, SLOT(resourceSelected(KoResource*)));
......@@ -378,4 +382,22 @@ void KisPaintopBox::slotUpdatePreset()
m_optionWidget->writeConfiguration(const_cast<KisPaintOpSettings*>(m_activePreset->settings().data()));
}
void KisPaintopBox::slotSetupDefaultPreset(){
QString defaultName = m_activePreset->paintOp().id() + ".kpp";
QString path = KGlobal::mainComponent().dirs()->findResource("kis_defaultpresets", defaultName);
KisPaintOpPresetSP preset = new KisPaintOpPreset(path);
if ( !preset->load() ){
kWarning() << preset->filename() << "could not be found.";
kWarning() << "I was looking for " << defaultName;
return;
}
preset->settings()->setNode( m_activePreset->settings()->node() );
preset->settings()->setOptionsWidget(m_optionWidget);
m_optionWidget->setConfiguration(preset->settings());
m_optionWidget->writeConfiguration(const_cast<KisPaintOpSettings*>( preset->settings().data() ));
m_presetWidget->updatePreview();
}
#include "kis_paintop_box.moc"
......@@ -81,6 +81,7 @@ public slots:
void slotCurrentNodeChanged(KisNodeSP node);
void slotSaveActivePreset();
void slotUpdatePreset();
void slotSetupDefaultPreset();
private:
......
......@@ -106,6 +106,10 @@ KisPaintOpPresetsPopup::KisPaintOpPresetsPopup(KisCanvasResourceProvider * resou
connect(m_d->uiWdgPaintOpPresets.bnSave, SIGNAL(clicked()),
this, SIGNAL(savePresetClicked()));
connect(m_d->uiWdgPaintOpPresets.bnDefaultPreset, SIGNAL(clicked()),
this, SIGNAL(defaultPresetClicked()));
connect(m_d->uiWdgPaintOpPresets.wdgPresetChooser, SIGNAL(resourceSelected(KoResource*)),
this, SIGNAL(resourceSelected(KoResource*)));
......
......@@ -71,6 +71,7 @@ public slots:
signals:
void savePresetClicked();
void defaultPresetClicked();
void resourceSelected( KoResource * resource );
private slots:
......
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