[TD] update balloon dialog

2 weeks ago the properties EndTypeScale and LineVisible were added but not to the dialog.

This PR adds them t the balloon dialog-

It also took the opportunity to cleanup the code:
- add missing tooltips
- uniform tooltips in App and Gui
- uniform the UI element names
This commit is contained in:
donovaly
2020-12-27 05:35:49 +01:00
committed by wwmayer
parent 78492b5bb7
commit 12c9aa00cf
5 changed files with 245 additions and 168 deletions

View File

@@ -68,44 +68,49 @@ TaskBalloon::TaskBalloon(QGIViewBalloon *parent, ViewProviderBalloon *balloonVP)
ui->setupUi(this);
ui->inputScale->setValue(parent->dvBalloon->ShapeScale.getValue());
connect(ui->inputScale, SIGNAL(valueChanged(double)), this, SLOT(onShapeScaleChanged()));
ui->qsbShapeScale->setValue(parent->dvBalloon->ShapeScale.getValue());
connect(ui->qsbShapeScale, SIGNAL(valueChanged(double)), this, SLOT(onShapeScaleChanged()));
ui->qsbSymbolScale->setValue(parent->dvBalloon->EndTypeScale.getValue());
connect(ui->qsbSymbolScale, SIGNAL(valueChanged(double)), this, SLOT(onEndSymbolScaleChanged()));
std::string value = parent->dvBalloon->Text.getValue();
QString qs = QString::fromUtf8(value.data(), value.size());
ui->inputValue->setText(qs);
ui->inputValue->selectAll();
connect(ui->inputValue, SIGNAL(textChanged(QString)), this, SLOT(onTextChanged()));
QTimer::singleShot(0, ui->inputValue, SLOT(setFocus()));
ui->leText->setText(qs);
ui->leText->selectAll();
connect(ui->leText, SIGNAL(textChanged(QString)), this, SLOT(onTextChanged()));
QTimer::singleShot(0, ui->leText, SLOT(setFocus()));
DrawGuiUtil::loadArrowBox(ui->comboEndType);
DrawGuiUtil::loadArrowBox(ui->comboEndSymbol);
i = parent->dvBalloon->EndType.getValue();
ui->comboEndType->setCurrentIndex(i);
connect(ui->comboEndType, SIGNAL(currentIndexChanged(int)), this, SLOT(onEndTypeChanged()));
ui->comboEndSymbol->setCurrentIndex(i);
connect(ui->comboEndSymbol, SIGNAL(currentIndexChanged(int)), this, SLOT(onEndSymbolChanged()));
i = parent->dvBalloon->BubbleShape.getValue();
ui->comboSymbol->setCurrentIndex(i);
connect(ui->comboSymbol, SIGNAL(currentIndexChanged(int)), this, SLOT(onShapeChanged()));
ui->comboBubbleShape->setCurrentIndex(i);
connect(ui->comboBubbleShape, SIGNAL(currentIndexChanged(int)), this, SLOT(onBubbleShapeChanged()));
ui->qsbFontSize->setUnit(Base::Unit::Length);
ui->qsbFontSize->setMinimum(0);
connect(ui->qsbFontSize, SIGNAL(valueChanged(double)), this, SLOT(onFontsizeChanged()));
connect(ui->comboLineVisible, SIGNAL(currentIndexChanged(int)), this, SLOT(onLineVisibleChanged()));
ui->qsbLineWidth->setUnit(Base::Unit::Length);
ui->qsbLineWidth->setSingleStep(0.100);
ui->qsbLineWidth->setMinimum(0);
connect(ui->qsbLineWidth, SIGNAL(valueChanged(double)), this, SLOT(onLineWidthChanged()));
ui->qsbBalloonKink->setUnit(Base::Unit::Length);
ui->qsbKinkLength->setUnit(Base::Unit::Length);
// negative kink length is allowed, thus no minimum
connect(ui->qsbBalloonKink, SIGNAL(valueChanged(double)), this, SLOT(onBalloonKinkChanged()));
connect(ui->qsbKinkLength, SIGNAL(valueChanged(double)), this, SLOT(onKinkLengthChanged()));
if (balloonVP != nullptr) {
ui->textColor->setColor(balloonVP->Color.getValue().asValue<QColor>());
connect(ui->textColor, SIGNAL(changed()), this, SLOT(onColorChanged()));
ui->qsbFontSize->setValue(balloonVP->Fontsize.getValue());
ui->comboLineVisible->setCurrentIndex(balloonVP->LineVisible.getValue());
ui->qsbLineWidth->setValue(balloonVP->LineWidth.getValue());
}
// new balloons have already the preferences BalloonKink length
ui->qsbBalloonKink->setValue(parent->dvBalloon->KinkLength.getValue());
ui->qsbKinkLength->setValue(parent->dvBalloon->KinkLength.getValue());
}
TaskBalloon::~TaskBalloon()
@@ -115,16 +120,18 @@ TaskBalloon::~TaskBalloon()
bool TaskBalloon::accept()
{
m_parent->dvBalloon->Text.setValue(ui->inputValue->text().toUtf8().constData());
m_parent->dvBalloon->Text.setValue(ui->leText->text().toUtf8().constData());
App::Color ac;
ac.setValue<QColor>(ui->textColor->color());
m_balloonVP->Color.setValue(ac);
m_balloonVP->Fontsize.setValue(ui->qsbFontSize->value().getValue());
m_parent->dvBalloon->ShapeScale.setValue(ui->inputScale->value().getValue());
m_parent->dvBalloon->EndType.setValue(ui->comboEndType->currentIndex());
m_parent->dvBalloon->BubbleShape.setValue(ui->comboSymbol->currentIndex());
m_parent->dvBalloon->ShapeScale.setValue(ui->qsbShapeScale->value().getValue());
m_parent->dvBalloon->EndType.setValue(ui->comboEndSymbol->currentIndex());
m_parent->dvBalloon->EndTypeScale.setValue(ui->qsbSymbolScale->value().getValue());
m_parent->dvBalloon->BubbleShape.setValue(ui->comboBubbleShape->currentIndex());
m_balloonVP->LineVisible.setValue(ui->comboLineVisible->currentIndex());
m_balloonVP->LineWidth.setValue(ui->qsbLineWidth->value().getValue());
m_parent->dvBalloon->KinkLength.setValue(ui->qsbBalloonKink->value().getValue());
m_parent->dvBalloon->KinkLength.setValue(ui->qsbKinkLength->value().getValue());
m_parent->updateView(true);
return true;
@@ -144,7 +151,7 @@ void TaskBalloon::recomputeFeature()
void TaskBalloon::onTextChanged()
{
m_parent->dvBalloon->Text.setValue(ui->inputValue->text().toUtf8().constData());
m_parent->dvBalloon->Text.setValue(ui->leText->text().toUtf8().constData());
recomputeFeature();
}
@@ -162,21 +169,33 @@ void TaskBalloon::onFontsizeChanged()
recomputeFeature();
}
void TaskBalloon::onShapeChanged()
void TaskBalloon::onBubbleShapeChanged()
{
m_parent->dvBalloon->BubbleShape.setValue(ui->comboSymbol->currentIndex());
m_parent->dvBalloon->BubbleShape.setValue(ui->comboBubbleShape->currentIndex());
recomputeFeature();
}
void TaskBalloon::onShapeScaleChanged()
{
m_parent->dvBalloon->ShapeScale.setValue(ui->inputScale->value().getValue());
m_parent->dvBalloon->ShapeScale.setValue(ui->qsbShapeScale->value().getValue());
recomputeFeature();
}
void TaskBalloon::onEndTypeChanged()
void TaskBalloon::onEndSymbolChanged()
{
m_parent->dvBalloon->EndType.setValue(ui->comboEndType->currentIndex());
m_parent->dvBalloon->EndType.setValue(ui->comboEndSymbol->currentIndex());
recomputeFeature();
}
void TaskBalloon::onEndSymbolScaleChanged()
{
m_parent->dvBalloon->EndTypeScale.setValue(ui->qsbSymbolScale->value().getValue());
recomputeFeature();
}
void TaskBalloon::onLineVisibleChanged()
{
m_balloonVP->LineVisible.setValue(ui->comboLineVisible->currentIndex());
recomputeFeature();
}
@@ -186,9 +205,9 @@ void TaskBalloon::onLineWidthChanged()
recomputeFeature();
}
void TaskBalloon::onBalloonKinkChanged()
void TaskBalloon::onKinkLengthChanged()
{
m_parent->dvBalloon->KinkLength.setValue(ui->qsbBalloonKink->value().getValue());
m_parent->dvBalloon->KinkLength.setValue(ui->qsbKinkLength->value().getValue());
recomputeFeature();
}