Commit e1b29f5e authored by Boudewijn Rempt's avatar Boudewijn Rempt

Remember the configuration of sliders and make opacity + size default

parent b41442c6
......@@ -920,6 +920,24 @@ void KisConfig::setDefaultPalette(const QString& name)
m_cfg.writeEntry("defaultPalette", name);
}
QString KisConfig::toolbarSlider(int sliderNumber)
{
QString def = "flow";
if (sliderNumber == 1) {
def = "opacity";
}
if (sliderNumber == 2) {
def = "size";
}
return m_cfg.readEntry(QString("toolbarslider_%1").arg(sliderNumber), def);
}
void KisConfig::setToolbarSlider(int sliderNumber, const QString &slider)
{
m_cfg.writeEntry(QString("toolbarslider_%1").arg(sliderNumber), slider);
}
bool KisConfig::useSystemMonitorProfile() const
{
return m_cfg.readEntry("ColorManagement/UseSystemMonitorProfile", false);
......
......@@ -287,6 +287,9 @@ public:
QString defaultPalette();
void setDefaultPalette(const QString& name);
QString toolbarSlider(int sliderNumber);
void setToolbarSlider(int sliderNumber, const QString &slider);
template<class T>
void writeEntry(const QString& name, const T& value) {
m_cfg.writeEntry(name, value);
......
......@@ -59,6 +59,7 @@
#include "kis_canvas_resource_provider.h"
#include "kis_resource_server_provider.h"
#include "ko_favorite_resource_manager.h"
#include "kis_config.h"
#include "widgets/kis_popup_button.h"
#include "widgets/kis_paintop_presets_popup.h"
......@@ -132,8 +133,9 @@ KisPaintopBox::KisPaintopBox(KisView2 * view, QWidget *parent, const char * name
vMirrorButton->setDefaultAction(vMirrorAction);
m_view->actionCollection()->addAction("vmirror_action", vMirrorAction);
KisConfig cfg;
for(int i=0; i<2; ++i) {
m_sliderChooser[i] = new KisWidgetChooser();
m_sliderChooser[i] = new KisWidgetChooser(i + 1);
KisDoubleSliderSpinBox* slOpacity = m_sliderChooser[i]->addWidget<KisDoubleSliderSpinBox>("opacity", i18n("Opacity:"));
KisDoubleSliderSpinBox* slFlow = m_sliderChooser[i]->addWidget<KisDoubleSliderSpinBox>("flow" , i18n("Flow:"));
KisDoubleSliderSpinBox* slSize = m_sliderChooser[i]->addWidget<KisDoubleSliderSpinBox>("size" , i18n("Size:"));
......@@ -153,10 +155,10 @@ KisPaintopBox::KisPaintopBox(KisView2 * view, QWidget *parent, const char * name
slSize->setSingleStep(0.05);
slSize->setExponentRatio(3.0);
slSize->setMinimumWidth(120);
m_sliderChooser[i]->chooseWidget(cfg.toolbarSlider(i + 1));
}
m_sliderChooser[0]->chooseWidget("opacity");
m_sliderChooser[1]->chooseWidget("flow");
QLabel* labelMode = new QLabel(i18n("Mode: "), this);
labelMode->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
......
......@@ -31,8 +31,11 @@
#include <QStylePainter>
#include <QStyleOption>
KisWidgetChooser::KisWidgetChooser(QWidget* parent):
QFrame(parent)
#include "kis_config.h"
KisWidgetChooser::KisWidgetChooser(int id, QWidget* parent)
: QFrame(parent)
, m_chooserid(id)
{
// QFrame::setFrameStyle(QFrame::StyledPanel|QFrame::Raised);
......@@ -188,6 +191,9 @@ QWidget* KisWidgetChooser::chooseWidget(const QString& id)
delete QWidget::layout();
QWidget::setLayout(createLayout());
KisConfig cfg;
cfg.setToolbarSlider(m_chooserid, id);
return choosenWidget;
}
......
......@@ -57,7 +57,7 @@ class KRITAUI_EXPORT KisWidgetChooser: public QFrame
typedef QList<Data>::const_iterator ConstIterator;
public:
KisWidgetChooser(QWidget* parent=0);
KisWidgetChooser(int id, QWidget* parent=0);
~KisWidgetChooser();
QWidget* chooseWidget(const QString& id);
......@@ -90,6 +90,7 @@ protected slots:
void slotWidgetChoosen(int index);
private:
int m_chooserid;
QIcon m_acceptIcon;
QToolButton* m_arrowButton;
QButtonGroup* m_buttons;
......
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