Commit 159e4baf authored by Sebastian Kügler's avatar Sebastian Kügler

Use QString for number parsing

Instead of our hand-baked version, use QString::toInt() to convert to numbers.
parent ea01f5e2
...@@ -198,7 +198,7 @@ void Doctor::parsePositionalArgs() ...@@ -198,7 +198,7 @@ void Doctor::parsePositionalArgs()
} }
} }
if (output_id == -1) { if (output_id == -1) {
output_id = parseInt(ops[1], ok); output_id = ops[1].toInt(&ok);
if (!ok) { if (!ok) {
cerr << "Unable to parse output id" << ops[1] << endl; cerr << "Unable to parse output id" << ops[1] << endl;
qApp->exit(3); qApp->exit(3);
...@@ -231,8 +231,8 @@ void Doctor::parsePositionalArgs() ...@@ -231,8 +231,8 @@ void Doctor::parsePositionalArgs()
qApp->exit(5); qApp->exit(5);
return; return;
} }
int x = parseInt(_pos[0], ok); int x = _pos[0].toInt(&ok);
int y = parseInt(_pos[1], ok); int y = _pos[1].toInt(&ok);
if (!ok) { if (!ok) {
cerr << "Unable to parse position" << ops[3] << endl; cerr << "Unable to parse position" << ops[3] << endl;
qApp->exit(5); qApp->exit(5);
...@@ -268,17 +268,6 @@ void Doctor::parsePositionalArgs() ...@@ -268,17 +268,6 @@ void Doctor::parsePositionalArgs()
} }
} }
int Doctor::parseInt(const QString &str, bool &ok) const
{
int _id = str.toInt();
if (QString::number(_id) == str) {
ok = true;
return _id;
}
ok = false;
return 0;
}
void Doctor::configReceived(KScreen::ConfigOperation *op) void Doctor::configReceived(KScreen::ConfigOperation *op)
{ {
m_config = op->config(); m_config = op->config();
......
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