"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/kdefrontend/dockwidgets/CustomPointDock.cpp" between
labplot-2.8.1.tar.gz and labplot-2.8.2.tar.gz

About: LabPlot is an application for plotting and analysis of 2D and 3D functions and data. It is a complete rewrite of LabPlot1 and lacks in the first release a lot of features available in the predecessor. On the other hand, the GUI and the usability is more superior.

CustomPointDock.cpp  (labplot-2.8.1):CustomPointDock.cpp  (labplot-2.8.2)
/*************************************************************************** /***************************************************************************
File : CustomPointDock.cpp File : CustomPointDock.cpp
Project : LabPlot Project : LabPlot
Description : widget for Datapicker-Point properties Description : widget for CustomPoint properties
-------------------------------------------------------------------- --------------------------------------------------------------------
Copyright : (C) 2015 Alexander Semke (alexander.semke@web.de) Copyright : (C) 2015-2020 Alexander Semke (alexander.semke@web.de )
***************************************************************************/ ***************************************************************************/
/*************************************************************************** /***************************************************************************
* * * *
* This program is free software; you can redistribute it and/or modify * * 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 * * it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
* * * *
* This program is distributed in the hope that it will be useful, * * This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of * * but WITHOUT ANY WARRANTY; without even the implied warranty of *
skipping to change at line 40 skipping to change at line 40
#include "kdefrontend/TemplateHandler.h" #include "kdefrontend/TemplateHandler.h"
#include "kdefrontend/GuiTools.h" #include "kdefrontend/GuiTools.h"
#include <KLocalizedString> #include <KLocalizedString>
#include <KConfig> #include <KConfig>
#include <QPainter> #include <QPainter>
#include <QDir> #include <QDir>
CustomPointDock::CustomPointDock(QWidget *parent): BaseDock(parent) { CustomPointDock::CustomPointDock(QWidget* parent) : BaseDock(parent) {
ui.setupUi(this); ui.setupUi(this);
m_leName = ui.leName; m_leName = ui.leName;
m_leComment = ui.leComment; m_leComment = ui.leComment;
//Validators //Validators
ui.lePositionX->setValidator( new QDoubleValidator(ui.lePositionX) ); ui.lePositionX->setValidator( new QDoubleValidator(ui.lePositionX) );
ui.lePositionY->setValidator( new QDoubleValidator(ui.lePositionY) ); ui.lePositionY->setValidator( new QDoubleValidator(ui.lePositionY) );
//adjust layouts in the tabs //adjust layouts in the tabs
for (int i = 0; i < ui.tabWidget->count(); ++i) { for (int i = 0; i < ui.tabWidget->count(); ++i) {
skipping to change at line 66 skipping to change at line 66
layout->setHorizontalSpacing(2); layout->setHorizontalSpacing(2);
layout->setVerticalSpacing(2); layout->setVerticalSpacing(2);
} }
CustomPointDock::updateLocale(); CustomPointDock::updateLocale();
//SLOTS //SLOTS
//General //General
connect(ui.leName, &QLineEdit::textChanged, this, &CustomPointDock::nameC hanged); connect(ui.leName, &QLineEdit::textChanged, this, &CustomPointDock::nameC hanged);
connect(ui.leComment, &QLineEdit::textChanged, this, &CustomPointDock::co mmentChanged); connect(ui.leComment, &QLineEdit::textChanged, this, &CustomPointDock::co mmentChanged);
connect( ui.lePositionX, SIGNAL(returnPressed()), this, SLOT(positionXCha connect(ui.lePositionX, &QLineEdit::textChanged, this, &CustomPointDock::
nged()) ); positionXChanged);
connect( ui.lePositionY, SIGNAL(returnPressed()), this, SLOT(positionYCha connect(ui.dateTimeEditPositionX, &QDateTimeEdit::dateTimeChanged, this,
nged()) ); &CustomPointDock::positionXDateTimeChanged);
connect( ui.chkVisible, SIGNAL(clicked(bool)), this, SLOT(visibilityChang connect(ui.lePositionY, &QLineEdit::textChanged, this, &CustomPointDock::
ed(bool)) ); positionYChanged);
connect( ui.chkVisible, &QCheckBox::clicked, this, &CustomPointDock::visi
bilityChanged);
//Symbols //Symbols
connect( ui.cbSymbolStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(s connect( ui.cbSymbolStyle, QOverload<int>::of(&QComboBox::currentIndexCha
ymbolStyleChanged(int)) ); nged), this, &CustomPointDock::symbolStyleChanged);
connect( ui.sbSymbolSize, SIGNAL(valueChanged(double)), this, SLOT(symbol connect( ui.sbSymbolSize, QOverload<double>::of(&QDoubleSpinBox::valueCha
SizeChanged(double)) ); nged), this, &CustomPointDock::symbolSizeChanged);
connect( ui.sbSymbolRotation, SIGNAL(valueChanged(int)), this, SLOT(symbo connect( ui.sbSymbolRotation, QOverload<int>::of(&QSpinBox::valueChanged)
lRotationChanged(int)) ); , this, &CustomPointDock::symbolRotationChanged);
connect( ui.sbSymbolOpacity, SIGNAL(valueChanged(int)), this, SLOT(symbol connect( ui.sbSymbolOpacity, QOverload<int>::of(&QSpinBox::valueChanged),
OpacityChanged(int)) ); this, &CustomPointDock::symbolOpacityChanged);
connect( ui.cbSymbolFillingStyle, SIGNAL(currentIndexChanged(int)), this, connect( ui.cbSymbolFillingStyle, QOverload<int>::of(&QComboBox::currentI
SLOT(symbolFillingStyleChanged(int)) ); ndexChanged), this, &CustomPointDock::symbolFillingStyleChanged);
connect( ui.kcbSymbolFillingColor, SIGNAL(changed(QColor)), this, SLOT(sy connect( ui.kcbSymbolFillingColor, &KColorButton::changed, this, &CustomP
mbolFillingColorChanged(QColor)) ); ointDock::symbolFillingColorChanged);
connect( ui.cbSymbolBorderStyle, SIGNAL(currentIndexChanged(int)), this, connect( ui.cbSymbolBorderStyle, QOverload<int>::of(&QComboBox::currentIn
SLOT(symbolBorderStyleChanged(int)) ); dexChanged), this, &CustomPointDock::symbolBorderStyleChanged);
connect( ui.kcbSymbolBorderColor, SIGNAL(changed(QColor)), this, SLOT(sym connect( ui.kcbSymbolBorderColor, &KColorButton::changed, this, &CustomPo
bolBorderColorChanged(QColor)) ); intDock::symbolBorderColorChanged);
connect( ui.sbSymbolBorderWidth, SIGNAL(valueChanged(double)), this, SLOT connect( ui.sbSymbolBorderWidth, QOverload<double>::of(&QDoubleSpinBox::v
(symbolBorderWidthChanged(double)) ); alueChanged), this, &CustomPointDock::symbolBorderWidthChanged);
//Template handler //Template handler
auto* templateHandler = new TemplateHandler(this, TemplateHandler::ClassN ame::CustomPoint); auto* templateHandler = new TemplateHandler(this, TemplateHandler::ClassN ame::CustomPoint);
ui.verticalLayout->addWidget(templateHandler); ui.verticalLayout->addWidget(templateHandler);
connect(templateHandler, SIGNAL(loadConfigRequested(KConfig&)), this, SLO connect(templateHandler, &TemplateHandler::loadConfigRequested, this, &Cu
T(loadConfigFromTemplate(KConfig&))); stomPointDock::loadConfigFromTemplate);
connect(templateHandler, SIGNAL(saveConfigRequested(KConfig&)), this, SLO connect(templateHandler, &TemplateHandler::saveConfigRequested, this, &Cu
T(saveConfigAsTemplate(KConfig&))); stomPointDock::saveConfigAsTemplate);
connect(templateHandler, SIGNAL(info(QString)), this, SIGNAL(info(QString connect(templateHandler, &TemplateHandler::info, this, &CustomPointDock::
))); info);
init(); init();
} }
void CustomPointDock::init() { void CustomPointDock::init() {
m_initializing = true; m_initializing = true;
GuiTools::updatePenStyles(ui.cbSymbolBorderStyle, Qt::black); GuiTools::updatePenStyles(ui.cbSymbolBorderStyle, Qt::black);
QPainter pa; QPainter pa;
int iconSize = 20; int iconSize = 20;
QPixmap pm(iconSize, iconSize); QPixmap pm(iconSize, iconSize);
QPen pen(Qt::SolidPattern, 0);
ui.cbSymbolStyle->setIconSize(QSize(iconSize, iconSize)); ui.cbSymbolStyle->setIconSize(QSize(iconSize, iconSize));
QPen pen(Qt::SolidPattern, 0);
const QColor& color = (palette().color(QPalette::Base).lightness() < 128)
? Qt::white : Qt::black;
pen.setColor(color);
pa.setPen(pen);
QTransform trafo; QTransform trafo;
trafo.scale(15, 15); trafo.scale(15, 15);
for (int i = 0; i < 18; ++i) { for (int i = 1; i < Symbol::stylesCount(); ++i) { //skip the first style "None"
auto style = (Symbol::Style)i; auto style = (Symbol::Style)i;
pm.fill(Qt::transparent); pm.fill(Qt::transparent);
pa.begin(&pm); pa.begin(&pm);
pa.setPen( pen ); pa.setPen( pen );
pa.setRenderHint(QPainter::Antialiasing); pa.setRenderHint(QPainter::Antialiasing);
pa.translate(iconSize/2,iconSize/2); pa.translate(iconSize/2,iconSize/2);
pa.drawPath(trafo.map(Symbol::pathFromStyle(style))); pa.drawPath(trafo.map(Symbol::pathFromStyle(style)));
pa.end(); pa.end();
ui.cbSymbolStyle->addItem(QIcon(pm), Symbol::nameFromStyle(style) ); ui.cbSymbolStyle->addItem(QIcon(pm), Symbol::nameFromStyle(style) , (int)style);
} }
GuiTools::updateBrushStyles(ui.cbSymbolFillingStyle, Qt::black); GuiTools::updateBrushStyles(ui.cbSymbolFillingStyle, Qt::black);
m_initializing = false; m_initializing = false;
} }
void CustomPointDock::setPoints(QList<CustomPoint*> list) { void CustomPointDock::setPoints(QList<CustomPoint*> list) {
m_initializing = true; const Lock lock(m_initializing);
m_pointsList = list; m_pointsList = list;
m_point = list.first(); m_point = list.first();
m_aspect = list.first(); m_aspect = list.first();
Q_ASSERT(m_point); Q_ASSERT(m_point);
//if there is more then one point in the list, disable the comment and na me widgets in "general" //if there is more than one point in the list, disable the comment and na me widgets in "general"
if (list.size() == 1) { if (list.size() == 1) {
ui.lName->setEnabled(true); ui.lName->setEnabled(true);
ui.leName->setEnabled(true); ui.leName->setEnabled(true);
ui.lComment->setEnabled(true); ui.lComment->setEnabled(true);
ui.leComment->setEnabled(true); ui.leComment->setEnabled(true);
ui.leName->setText(m_point->name()); ui.leName->setText(m_point->name());
ui.leComment->setText(m_point->comment()); ui.leComment->setText(m_point->comment());
} else { } else {
ui.lName->setEnabled(false); ui.lName->setEnabled(false);
ui.leName->setEnabled(false); ui.leName->setEnabled(false);
skipping to change at line 148 skipping to change at line 154
ui.leComment->setText(QString()); ui.leComment->setText(QString());
} }
ui.leName->setStyleSheet(""); ui.leName->setStyleSheet("");
ui.leName->setToolTip(""); ui.leName->setToolTip("");
//show the properties of the first custom point //show the properties of the first custom point
this->load(); this->load();
//SIGNALs/SLOTs //SIGNALs/SLOTs
// general // general
connect(m_point, SIGNAL(aspectDescriptionChanged(const AbstractAspect*)), connect(m_point, &CustomPoint::aspectDescriptionChanged, this, &CustomPoi
this, SLOT(pointDescriptionChanged(const AbstractAspect*))); ntDock::pointDescriptionChanged);
connect(m_point, SIGNAL(positionChanged(QPointF)), this, SLOT(pointPositi connect(m_point, &CustomPoint::positionChanged, this, &CustomPointDock::p
onChanged(QPointF))); ointPositionChanged);
connect(m_point, SIGNAL(visibleChanged(bool)), this, SLOT(pointVisibility connect(m_point, &CustomPoint::visibleChanged, this, &CustomPointDock::po
Changed(bool))); intVisibilityChanged);
//symbol //symbol
connect(m_point, SIGNAL(symbolStyleChanged(Symbol::Style)), this, SLOT(po connect(m_point, &CustomPoint::symbolStyleChanged, this, &CustomPointDock
intSymbolStyleChanged(Symbol::Style))); ::pointSymbolStyleChanged);
connect(m_point, SIGNAL(symbolSizeChanged(qreal)), this, SLOT(pointSymbol connect(m_point, &CustomPoint::symbolSizeChanged, this, &CustomPointDock:
SizeChanged(qreal))); :pointSymbolSizeChanged);
connect(m_point, SIGNAL(symbolRotationAngleChanged(qreal)), this, SLOT(po connect(m_point, &CustomPoint::symbolRotationAngleChanged, this, &CustomP
intSymbolRotationAngleChanged(qreal))); ointDock::pointSymbolRotationAngleChanged);
connect(m_point, SIGNAL(symbolOpacityChanged(qreal)), this, SLOT(pointSym connect(m_point, &CustomPoint::symbolOpacityChanged, this, &CustomPointDo
bolOpacityChanged(qreal))); ck::pointSymbolOpacityChanged);
connect(m_point, SIGNAL(symbolBrushChanged(QBrush)), this, SLOT(pointSymb connect(m_point, &CustomPoint::symbolBrushChanged, this, &CustomPointDock
olBrushChanged(QBrush))); ::pointSymbolBrushChanged);
connect(m_point, SIGNAL(symbolPenChanged(QPen)), this, SLOT(pointSymbolPe connect(m_point, &CustomPoint::symbolPenChanged, this, &CustomPointDock::
nChanged(QPen))); pointSymbolPenChanged);
} }
/* /*
* updates the locale in the widgets. called when the application settins are ch anged. * updates the locale in the widgets. called when the application settins are ch anged.
*/ */
void CustomPointDock::updateLocale() { void CustomPointDock::updateLocale() {
SET_NUMBER_LOCALE SET_NUMBER_LOCALE
ui.sbSymbolSize->setLocale(numberLocale); ui.sbSymbolSize->setLocale(numberLocale);
ui.sbSymbolBorderWidth->setLocale(numberLocale); ui.sbSymbolBorderWidth->setLocale(numberLocale);
ui.lePositionX->setLocale(numberLocale);
ui.lePositionY->setLocale(numberLocale);
} }
//********************************************************** //**********************************************************
//**** SLOTs for changes triggered in CustomPointDock ****** //**** SLOTs for changes triggered in CustomPointDock ******
//********************************************************** //**********************************************************
//"General"-tab //"General"-tab
void CustomPointDock::positionXChanged() { void CustomPointDock::positionXChanged() {
if (m_initializing) if (m_initializing)
return; return;
skipping to change at line 189 skipping to change at line 197
SET_NUMBER_LOCALE SET_NUMBER_LOCALE
double x = numberLocale.toDouble(ui.lePositionX->text(), &ok); double x = numberLocale.toDouble(ui.lePositionX->text(), &ok);
if (ok) { if (ok) {
QPointF pos{m_point->position()}; QPointF pos{m_point->position()};
pos.setX(x); pos.setX(x);
for (auto* point : m_pointsList) for (auto* point : m_pointsList)
point->setPosition(pos); point->setPosition(pos);
} }
} }
void CustomPointDock::positionXDateTimeChanged(const QDateTime& dateTime) {
if (m_initializing)
return;
quint64 x = dateTime.toMSecsSinceEpoch();
QPointF pos{m_point->position()};
pos.setX(x);
for (auto* point : m_pointsList)
point->setPosition(pos);
}
void CustomPointDock::positionYChanged() { void CustomPointDock::positionYChanged() {
if (m_initializing) if (m_initializing)
return; return;
bool ok; bool ok;
SET_NUMBER_LOCALE SET_NUMBER_LOCALE
double y = numberLocale.toDouble(ui.lePositionY->text(), &ok); double y = numberLocale.toDouble(ui.lePositionY->text(), &ok);
if (ok) { if (ok) {
QPointF pos{m_point->position()}; QPointF pos{m_point->position()};
pos.setY(y); pos.setY(y);
skipping to change at line 214 skipping to change at line 233
void CustomPointDock::visibilityChanged(bool state) { void CustomPointDock::visibilityChanged(bool state) {
if (m_initializing) if (m_initializing)
return; return;
m_point->beginMacro(i18n("%1 CustomPoints: visibility changed", m_pointsL ist.count())); m_point->beginMacro(i18n("%1 CustomPoints: visibility changed", m_pointsL ist.count()));
for (auto* point : m_pointsList) for (auto* point : m_pointsList)
point->setVisible(state); point->setVisible(state);
m_point->endMacro(); m_point->endMacro();
} }
void CustomPointDock::symbolStyleChanged(int index) { void CustomPointDock::symbolStyleChanged(int) {
auto style = Symbol::Style(index); auto style = static_cast<Symbol::Style>(ui.cbSymbolStyle->itemData(ui.cbS
ymbolStyle->currentIndex()).toInt());
//enable/disable the filling options in the GUI depending on the current ly selected points. //enable/disable the filling options in the GUI depending on the current ly selected points.
if (style != Symbol::Style::Line && style != Symbol::Style::Cross) { if (style != Symbol::Style::Line && style != Symbol::Style::Cross) {
ui.cbSymbolFillingStyle->setEnabled(true); ui.cbSymbolFillingStyle->setEnabled(true);
bool noBrush = (Qt::BrushStyle(ui.cbSymbolFillingStyle->currentIn dex()) == Qt::NoBrush); bool noBrush = (Qt::BrushStyle(ui.cbSymbolFillingStyle->currentIn dex()) == Qt::NoBrush);
ui.kcbSymbolFillingColor->setEnabled(!noBrush); ui.kcbSymbolFillingColor->setEnabled(!noBrush);
} else { } else {
ui.kcbSymbolFillingColor->setEnabled(false); ui.kcbSymbolFillingColor->setEnabled(false);
ui.cbSymbolFillingStyle->setEnabled(false); ui.cbSymbolFillingStyle->setEnabled(false);
} }
skipping to change at line 382 skipping to change at line 401
} else if (aspect->comment() != ui.leComment->text()) { } else if (aspect->comment() != ui.leComment->text()) {
ui.leComment->setText(aspect->comment()); ui.leComment->setText(aspect->comment());
} }
m_initializing = false; m_initializing = false;
} }
void CustomPointDock::pointPositionChanged(QPointF position) { void CustomPointDock::pointPositionChanged(QPointF position) {
m_initializing = true; m_initializing = true;
SET_NUMBER_LOCALE SET_NUMBER_LOCALE
ui.lePositionX->setText(numberLocale.toString(position.x())); ui.lePositionX->setText(numberLocale.toString(position.x()));
ui.dateTimeEditPositionX->setDateTime(QDateTime::fromMSecsSinceEpoch(posi tion.x()));
ui.lePositionY->setText(numberLocale.toString(position.y())); ui.lePositionY->setText(numberLocale.toString(position.y()));
m_initializing = false; m_initializing = false;
} }
//"Symbol"-tab //"Symbol"-tab
void CustomPointDock::pointSymbolStyleChanged(Symbol::Style style) { void CustomPointDock::pointSymbolStyleChanged(Symbol::Style style) {
m_initializing = true; m_initializing = true;
ui.cbSymbolStyle->setCurrentIndex((int)style); int index = ui.cbSymbolStyle->findData((int)style);
ui.cbSymbolStyle->setCurrentIndex(index);
m_initializing = false; m_initializing = false;
} }
void CustomPointDock::pointSymbolSizeChanged(qreal size) { void CustomPointDock::pointSymbolSizeChanged(qreal size) {
m_initializing = true; m_initializing = true;
ui.sbSymbolSize->setValue( Worksheet::convertFromSceneUnits(size, Workshe et::Unit::Point) ); ui.sbSymbolSize->setValue( Worksheet::convertFromSceneUnits(size, Workshe et::Unit::Point) );
m_initializing = false; m_initializing = false;
} }
void CustomPointDock::pointSymbolRotationAngleChanged(qreal angle) { void CustomPointDock::pointSymbolRotationAngleChanged(qreal angle) {
skipping to change at line 441 skipping to change at line 462
m_initializing = false; m_initializing = false;
} }
//********************************************************** //**********************************************************
//******************** SETTINGS **************************** //******************** SETTINGS ****************************
//********************************************************** //**********************************************************
void CustomPointDock::load() { void CustomPointDock::load() {
if (!m_point) if (!m_point)
return; return;
m_initializing = true;
SET_NUMBER_LOCALE SET_NUMBER_LOCALE
ui.lePositionX->setText(numberLocale.toString(m_point->position().x())); CartesianPlot* plot = static_cast<CartesianPlot*>(m_point->parent(AspectT
ype::CartesianPlot));
if (plot->xRangeFormat() == CartesianPlot::RangeFormat::Numeric) {
ui.lPositionX->show();
ui.lePositionX->show();
ui.lPositionXDateTime->hide();
ui.dateTimeEditPositionX->hide();
ui.lePositionX->setText(numberLocale.toString(m_point->position()
.x()));
} else {
ui.lPositionX->hide();
ui.lePositionX->hide();
ui.lPositionXDateTime->show();
ui.dateTimeEditPositionX->show();
ui.dateTimeEditPositionX->setDisplayFormat(plot->xRangeDateTimeFo
rmat());
ui.dateTimeEditPositionX->setDateTime(QDateTime::fromMSecsSinceEp
och(m_point->position().x()));
}
ui.lePositionY->setText(numberLocale.toString(m_point->position().y())); ui.lePositionY->setText(numberLocale.toString(m_point->position().y()));
ui.cbSymbolStyle->setCurrentIndex( (int)m_point->symbolStyle() ); int index = ui.cbSymbolStyle->findData((int)m_point->symbolStyle());
ui.cbSymbolStyle->setCurrentIndex(index);
ui.sbSymbolSize->setValue( Worksheet::convertFromSceneUnits(m_point->symb olSize(), Worksheet::Unit::Point) ); ui.sbSymbolSize->setValue( Worksheet::convertFromSceneUnits(m_point->symb olSize(), Worksheet::Unit::Point) );
ui.sbSymbolRotation->setValue( m_point->symbolRotationAngle() ); ui.sbSymbolRotation->setValue( m_point->symbolRotationAngle() );
ui.sbSymbolOpacity->setValue( qRound(m_point->symbolOpacity()*100.0) ); ui.sbSymbolOpacity->setValue( qRound(m_point->symbolOpacity()*100.0) );
ui.cbSymbolFillingStyle->setCurrentIndex( (int) m_point->symbolBrush().st yle() ); ui.cbSymbolFillingStyle->setCurrentIndex( (int) m_point->symbolBrush().st yle() );
ui.kcbSymbolFillingColor->setColor( m_point->symbolBrush().color() ); ui.kcbSymbolFillingColor->setColor( m_point->symbolBrush().color() );
ui.cbSymbolBorderStyle->setCurrentIndex( (int) m_point->symbolPen().style () ); ui.cbSymbolBorderStyle->setCurrentIndex( (int) m_point->symbolPen().style () );
ui.kcbSymbolBorderColor->setColor( m_point->symbolPen().color() ); ui.kcbSymbolBorderColor->setColor( m_point->symbolPen().color() );
ui.sbSymbolBorderWidth->setValue( Worksheet::convertFromSceneUnits(m_poin t->symbolPen().widthF(), Worksheet::Unit::Point) ); ui.sbSymbolBorderWidth->setValue( Worksheet::convertFromSceneUnits(m_poin t->symbolPen().widthF(), Worksheet::Unit::Point) );
ui.chkVisible->setChecked( m_point->isVisible() ); ui.chkVisible->setChecked( m_point->isVisible() );
m_initializing = false;
} }
void CustomPointDock::loadConfigFromTemplate(KConfig& config) { void CustomPointDock::loadConfigFromTemplate(KConfig& config) {
//extract the name of the template from the file name //extract the name of the template from the file name
QString name; QString name;
int index = config.name().lastIndexOf(QLatin1String("/")); int index = config.name().lastIndexOf(QLatin1String("/"));
if (index != -1) if (index != -1)
name = config.name().right(config.name().size() - index - 1); name = config.name().right(config.name().size() - index - 1);
else else
name = config.name(); name = config.name();
skipping to change at line 487 skipping to change at line 522
m_point->beginMacro(i18n("%1: template \"%2\" loaded", m_point->n ame(), name)); m_point->beginMacro(i18n("%1: template \"%2\" loaded", m_point->n ame(), name));
this->loadConfig(config); this->loadConfig(config);
m_point->endMacro(); m_point->endMacro();
} }
void CustomPointDock::loadConfig(KConfig& config) { void CustomPointDock::loadConfig(KConfig& config) {
KConfigGroup group = config.group( "CustomPoint" ); KConfigGroup group = config.group( "CustomPoint" );
ui.cbSymbolStyle->setCurrentIndex( group.readEntry("SymbolStyle", (int)m_ int index = ui.cbSymbolStyle->findData((int)m_point->symbolStyle());
point->symbolStyle()) ); ui.cbSymbolStyle->setCurrentIndex(group.readEntry("SymbolStyle", index));
ui.sbSymbolSize->setValue( Worksheet::convertFromSceneUnits(group.readEnt ry("SymbolSize", m_point->symbolSize()), Worksheet::Unit::Point) ); ui.sbSymbolSize->setValue( Worksheet::convertFromSceneUnits(group.readEnt ry("SymbolSize", m_point->symbolSize()), Worksheet::Unit::Point) );
ui.sbSymbolRotation->setValue( group.readEntry("SymbolRotation", m_point- >symbolRotationAngle()) ); ui.sbSymbolRotation->setValue( group.readEntry("SymbolRotation", m_point- >symbolRotationAngle()) );
ui.sbSymbolOpacity->setValue( qRound(group.readEntry("SymbolOpacity", m_p oint->symbolOpacity())*100.0) ); ui.sbSymbolOpacity->setValue( qRound(group.readEntry("SymbolOpacity", m_p oint->symbolOpacity())*100.0) );
ui.cbSymbolFillingStyle->setCurrentIndex( group.readEntry("SymbolFillingS tyle", (int) m_point->symbolBrush().style()) ); ui.cbSymbolFillingStyle->setCurrentIndex( group.readEntry("SymbolFillingS tyle", (int) m_point->symbolBrush().style()) );
ui.kcbSymbolFillingColor->setColor( group.readEntry("SymbolFillingColor" , m_point->symbolBrush().color()) ); ui.kcbSymbolFillingColor->setColor( group.readEntry("SymbolFillingColor" , m_point->symbolBrush().color()) );
ui.cbSymbolBorderStyle->setCurrentIndex( group.readEntry("SymbolBorderSty le", (int) m_point->symbolPen().style()) ); ui.cbSymbolBorderStyle->setCurrentIndex( group.readEntry("SymbolBorderSty le", (int) m_point->symbolPen().style()) );
ui.kcbSymbolBorderColor->setColor( group.readEntry("SymbolBorderColor", m _point->symbolPen().color()) ); ui.kcbSymbolBorderColor->setColor( group.readEntry("SymbolBorderColor", m _point->symbolPen().color()) );
ui.sbSymbolBorderWidth->setValue( Worksheet::convertFromSceneUnits(group. readEntry("SymbolBorderWidth",m_point->symbolPen().widthF()), Worksheet::Unit::P oint) ); ui.sbSymbolBorderWidth->setValue( Worksheet::convertFromSceneUnits(group. readEntry("SymbolBorderWidth",m_point->symbolPen().widthF()), Worksheet::Unit::P oint) );
m_initializing = true; m_initializing = true;
GuiTools::updateBrushStyles(ui.cbSymbolFillingStyle, ui.kcbSymbolFillingC olor->color()); GuiTools::updateBrushStyles(ui.cbSymbolFillingStyle, ui.kcbSymbolFillingC olor->color());
GuiTools::updatePenStyles(ui.cbSymbolBorderStyle, ui.kcbSymbolBorderColor ->color()); GuiTools::updatePenStyles(ui.cbSymbolBorderStyle, ui.kcbSymbolBorderColor ->color());
m_initializing = false; m_initializing = false;
} }
void CustomPointDock::saveConfigAsTemplate(KConfig& config) { void CustomPointDock::saveConfigAsTemplate(KConfig& config) {
KConfigGroup group = config.group( "CustomPoint" ); KConfigGroup group = config.group( "CustomPoint" );
group.writeEntry("SymbolStyle", ui.cbSymbolStyle->currentText()); group.writeEntry("SymbolStyle", ui.cbSymbolStyle->itemData(ui.cbSymbolSty le->currentIndex()));
group.writeEntry("SymbolSize", Worksheet::convertToSceneUnits(ui.sbSymbol Size->value(), Worksheet::Unit::Point)); group.writeEntry("SymbolSize", Worksheet::convertToSceneUnits(ui.sbSymbol Size->value(), Worksheet::Unit::Point));
group.writeEntry("SymbolRotation", ui.sbSymbolRotation->value()); group.writeEntry("SymbolRotation", ui.sbSymbolRotation->value());
group.writeEntry("SymbolOpacity", ui.sbSymbolOpacity->value()/100.0); group.writeEntry("SymbolOpacity", ui.sbSymbolOpacity->value()/100.0);
group.writeEntry("SymbolFillingStyle", ui.cbSymbolFillingStyle->currentIn dex()); group.writeEntry("SymbolFillingStyle", ui.cbSymbolFillingStyle->currentIn dex());
group.writeEntry("SymbolFillingColor", ui.kcbSymbolFillingColor->color()) ; group.writeEntry("SymbolFillingColor", ui.kcbSymbolFillingColor->color()) ;
group.writeEntry("SymbolBorderStyle", ui.cbSymbolBorderStyle->currentInde x()); group.writeEntry("SymbolBorderStyle", ui.cbSymbolBorderStyle->currentInde x());
group.writeEntry("SymbolBorderColor", ui.kcbSymbolBorderColor->color()); group.writeEntry("SymbolBorderColor", ui.kcbSymbolBorderColor->color());
group.writeEntry("SymbolBorderWidth", Worksheet::convertToSceneUnits(ui.s bSymbolBorderWidth->value(), Worksheet::Unit::Point)); group.writeEntry("SymbolBorderWidth", Worksheet::convertToSceneUnits(ui.s bSymbolBorderWidth->value(), Worksheet::Unit::Point));
config.sync(); config.sync();
} }
 End of changes. 25 change blocks. 
68 lines changed or deleted 110 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)