[TD] Add ability to translate for some tooltip text. Fix incorrect use of tr(variable).
This commit is contained in:
committed by
Chris Hennes
parent
af811b34b3
commit
29cc754cfd
@@ -1509,11 +1509,9 @@ std::vector<std::string> getSelectedSubElements(Gui::Command* cmd,
|
||||
}
|
||||
}
|
||||
if (dvp == nullptr) {
|
||||
std::stringstream edgeMsg;
|
||||
edgeMsg << "No Part View in Selection";
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong Selection"),
|
||||
QObject::tr(edgeMsg.str().c_str()));
|
||||
return selectedSubs;
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong Selection"),
|
||||
QObject::tr("No Part View in Selection"));
|
||||
return selectedSubs;
|
||||
}
|
||||
|
||||
for (auto& s: subNames) {
|
||||
@@ -1523,10 +1521,10 @@ std::vector<std::string> getSelectedSubElements(Gui::Command* cmd,
|
||||
}
|
||||
|
||||
if (selectedSubs.empty()) {
|
||||
std::stringstream edgeMsg;
|
||||
edgeMsg << "No " << subType << " in Selection";
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong Selection"),
|
||||
QObject::tr(edgeMsg.str().c_str()));
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
QObject::tr("Wrong Selection"),
|
||||
QObject::tr("No %1 in Selection")
|
||||
.arg(QString::fromStdString(subType)));
|
||||
return selectedSubs;
|
||||
}
|
||||
|
||||
|
||||
@@ -326,10 +326,11 @@ void CmdTechDrawRadiusDimension::activated(int iMsg)
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
std::stringstream edgeMsg;
|
||||
edgeMsg << "Selection for Radius does not contain a circular edge (edge type: " << _edgeTypeToText(edgeType) << ")";
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Incorrect Selection"),
|
||||
QObject::tr(edgeMsg.str().c_str()));
|
||||
QMessageBox::warning(
|
||||
Gui::getMainWindow(), QObject::tr("Incorrect Selection"),
|
||||
QObject::tr("Selection for Radius does not contain a circular edge "
|
||||
"(edge type: %1)")
|
||||
.arg(QString::fromStdString(_edgeTypeToText(edgeType))));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -448,11 +449,12 @@ void CmdTechDrawDiameterDimension::activated(int iMsg)
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
std::stringstream edgeMsg;
|
||||
edgeMsg << "Selection for Diameter does not contain a circular edge (edge type: " << _edgeTypeToText(edgeType) << ")";
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Incorrect Selection"),
|
||||
QObject::tr(edgeMsg.str().c_str()));
|
||||
return;
|
||||
QMessageBox::warning(
|
||||
Gui::getMainWindow(), QObject::tr("Incorrect Selection"),
|
||||
QObject::tr("Selection for Diameter does not contain a circular edge "
|
||||
"(edge type: %1)")
|
||||
.arg(QString::fromStdString(_edgeTypeToText(edgeType))));
|
||||
return;
|
||||
}
|
||||
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Create Dimension"));
|
||||
@@ -545,11 +547,11 @@ void CmdTechDrawLengthDimension::activated(int iMsg)
|
||||
subs.push_back(SubNames[0]);
|
||||
subs.push_back(SubNames[1]);
|
||||
} else {
|
||||
std::stringstream edgeMsg;
|
||||
edgeMsg << "Need 2 Vertexes, 2 Edges or 1 Vertex and 1 Edge for Distance Dimension";
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Incorrect Selection"),
|
||||
QObject::tr(edgeMsg.str().c_str()));
|
||||
return;
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
QObject::tr("Incorrect Selection"),
|
||||
QObject::tr("Need 2 Vertexes, 2 Edges or 1 Vertex "
|
||||
"and 1 Edge for Distance Dimension"));
|
||||
return;
|
||||
}
|
||||
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Create Dimension"));
|
||||
@@ -648,11 +650,11 @@ void CmdTechDrawHorizontalDimension::activated(int iMsg)
|
||||
subs.push_back(SubNames[0]);
|
||||
subs.push_back(SubNames[1]);
|
||||
} else {
|
||||
std::stringstream edgeMsg;
|
||||
edgeMsg << "Need 2 Vertexes, 2 Edges or 1 Vertex and 1 Edge for Horizontal Dimension";
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Incorrect Selection"),
|
||||
QObject::tr(edgeMsg.str().c_str()));
|
||||
return;
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
QObject::tr("Incorrect Selection"),
|
||||
QObject::tr("Need 2 Vertexes, 2 Edges or 1 Vertex "
|
||||
"and 1 Edge for Horizontal Dimension"));
|
||||
return;
|
||||
}
|
||||
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Create Dimension"));
|
||||
@@ -751,11 +753,11 @@ void CmdTechDrawVerticalDimension::activated(int iMsg)
|
||||
subs.push_back(SubNames[0]);
|
||||
subs.push_back(SubNames[1]);
|
||||
} else {
|
||||
std::stringstream edgeMsg;
|
||||
edgeMsg << "Need 2 Vertexes, 2 Edges or 1 Vertex and 1 Edge for Vertical Dimension";
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Incorrect Selection"),
|
||||
QObject::tr(edgeMsg.str().c_str()));
|
||||
return;
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
QObject::tr("Incorrect Selection"),
|
||||
QObject::tr("Need 2 Vertexes, 2 Edges or 1 Vertex "
|
||||
"and 1 Edge for Vertical Dimension"));
|
||||
return;
|
||||
}
|
||||
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Create Dimension"));
|
||||
|
||||
@@ -144,7 +144,7 @@ int DlgPrefsTechDrawAnnotationImp::prefBalloonArrow(void) const
|
||||
void DlgPrefsTechDrawAnnotationImp::onLineGroupChanged(int index)
|
||||
{
|
||||
if (index == -1) { // there is no valid index yet
|
||||
ui->pcbLineGroup->setToolTip(QString::fromStdString("Please select a Line Group"));
|
||||
ui->pcbLineGroup->setToolTip(QObject::tr("Please select a Line Group"));
|
||||
return;
|
||||
}
|
||||
// get the definition the the selected LineGroup (includes the name)
|
||||
@@ -154,13 +154,13 @@ void DlgPrefsTechDrawAnnotationImp::onLineGroupChanged(int index)
|
||||
while (std::getline(ss, lgRecord, ',')) {
|
||||
lgNames.push_back(lgRecord);
|
||||
}
|
||||
// format the tooltip
|
||||
std::stringstream TooltipText;
|
||||
TooltipText << lgNames.at(0).substr(1) << " defines these line widths:\n"
|
||||
<< "thin: " << lgNames.at(1) << "\n"
|
||||
<< "graphic: " << lgNames.at(2) << "\n"
|
||||
<< "thick: " << lgNames.at(3);
|
||||
ui->pcbLineGroup->setToolTip(QString::fromStdString(TooltipText.str()));
|
||||
ui->pcbLineGroup->setToolTip(
|
||||
QObject::tr("%1 defines these line widths:\n thin: %2\n graphic: %3\n "
|
||||
"thick: %4")
|
||||
.arg(QString::fromStdString(lgNames.at(0).substr(1)),
|
||||
QString::fromStdString(lgNames.at(1)),
|
||||
QString::fromStdString(lgNames.at(2)),
|
||||
QString::fromStdString(lgNames.at(3))));
|
||||
}
|
||||
|
||||
#include <Mod/TechDraw/Gui/moc_DlgPrefsTechDrawAnnotationImp.cpp>
|
||||
|
||||
Reference in New Issue
Block a user