=== modified file 'sources/main.cpp' --- sources/main.cpp 2012-07-01 15:36:34 +0000 +++ sources/main.cpp 2012-09-19 08:27:51 +0000 @@ -63,6 +63,9 @@ #endif // command-line arguments + + QRegExp regExp1("(.+)#(\\d+)"); + QRegExp regExp2("(.+)#(\\d+)#(\\d?\\.\\d+)"); QStringList arguments = QApplication::arguments(); QList< Link > links; @@ -76,22 +79,28 @@ { if(!argument.startsWith("--")) { - QStringList fields = argument.split('#'); Link link; - - link.filePath = QFileInfo(fields.at(0)).absoluteFilePath(); - - if(fields.count() > 1) - { - link.page = fields.at(1).toInt(); - link.page = qMax(link.page, 1); - } - if(fields.count() > 2) - { - link.top = fields.at(2).toFloat(); - link.top = qMax(link.top, static_cast< qreal >(0.0)); - link.top = qMin(link.top, static_cast< qreal >(1.0)); - } + + if(regExp2.exactMatch(argument)) + { + link.filePath = QFileInfo(regExp2.cap(1)).absoluteFilePath(); + link.page = regExp2.cap(2).toInt(); + link.top = regExp2.cap(3).toFloat(); + } + else if(regExp1.exactMatch(argument)) + { + link.filePath = QFileInfo(regExp1.cap(1)).absoluteFilePath(); + link.page = regExp1.cap(2).toInt(); + } + else + { + link.filePath = QFileInfo(argument).absoluteFilePath(); + } + + link.page = qMax(link.page, 1); + + link.top = qMax(link.top, static_cast< qreal >(0.0)); + link.top = qMin(link.top, static_cast< qreal >(1.0)); links.append(link); }