First check if key was setted.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-10-07 20:59:52 +03:00
parent 1aaef9e406
commit 951f6f2f4e

View File

@ -534,32 +534,38 @@ void MApplication::ParseCommandLine(const SocketConnection &connection, const QS
int height = 0; int height = 0;
Unit unit = Unit::Cm; Unit unit = Unit::Cm;
const QString heightValue = parser.value(heightOption); if (parser.isSet(heightOption))
if (VMeasurement::IsGradationHeightValid(heightValue))
{ {
flagHeight = true; const QString heightValue = parser.value(heightOption);
height = heightValue.toInt(); if (VMeasurement::IsGradationHeightValid(heightValue))
} {
else flagHeight = true;
{ height = heightValue.toInt();
qCCritical(mApp, "%s\n", }
qPrintable(tr("Invalid base height argument. Must be %1cm.") else
.arg(VMeasurement::WholeListHeights(Unit::Cm).join(", ")))); {
parser.showHelp(V_EX_USAGE); qCCritical(mApp, "%s\n",
qPrintable(tr("Invalid base height argument. Must be %1cm.")
.arg(VMeasurement::WholeListHeights(Unit::Cm).join(", "))));
parser.showHelp(V_EX_USAGE);
}
} }
const QString sizeValue = parser.value(sizeOption); if (parser.isSet(sizeOption))
if (VMeasurement::IsGradationSizeValid(sizeValue))
{ {
flagSize = true; const QString sizeValue = parser.value(sizeOption);
size = sizeValue.toInt(); if (VMeasurement::IsGradationSizeValid(sizeValue))
} {
else flagSize = true;
{ size = sizeValue.toInt();
qCCritical(mApp, "%s\n", }
qPrintable(tr("Invalid base size argument. Must be %1cm.") else
.arg(VMeasurement::WholeListSizes(Unit::Cm).join(", ")))); {
parser.showHelp(V_EX_USAGE); qCCritical(mApp, "%s\n",
qPrintable(tr("Invalid base size argument. Must be %1cm.")
.arg(VMeasurement::WholeListSizes(Unit::Cm).join(", "))));
parser.showHelp(V_EX_USAGE);
}
} }
{ {