Index: sources/view/confirm/VConfirm.h =================================================================== diff -u -rbcb92b3c14c59f0761c366501a0e3262e9a061f9 -r4509b968b7280dc7e5b21490f9b5ec99f60e878f --- sources/view/confirm/VConfirm.h (.../VConfirm.h) (revision bcb92b3c14c59f0761c366501a0e3262e9a061f9) +++ sources/view/confirm/VConfirm.h (.../VConfirm.h) (revision 4509b968b7280dc7e5b21490f9b5ec99f60e878f) @@ -72,8 +72,44 @@ PROPERTY(bool , isUltrafilt , 0) PROPERTY(bool , isConnection , 0) + PROPERTY(float , extraParam1 , 0) + PROPERTY(float , extraParam2 , 0) + PROPERTY(float , extraParam3 , 0) + PROPERTY(float , extraParam4 , 0) + + TRIGGER (bool , visible , 0) + void titleModifier ( QString & ) const {} + void messageModifier ( QString &vValue ) const { + // this code can be improved more. + // ".\s*[{1-4]\s*\:\s*[1-3}]\s*." + QString regstr = ".\\s*[{1-4]\\s*\\:\\s*[1-3}]\\s*."; + QRegExp reg(regstr); + int pos = 0; + while ( (pos = reg.indexIn(vValue)) != -1 ) { + int len = reg.matchedLength(); + QString placeholder = vValue.mid(pos, len) ; + QString tmp = placeholder; + QStringList params = tmp.remove("{").remove("}").split(":"); + // no checking required since the regex has chaecked and found the placeholder. + float param = 0.0; + int index = params[0].toInt(); + switch (index) { + case 1: param = _extraParam1; break; + case 2: param = _extraParam2; break; + case 3: param = _extraParam3; break; + case 4: param = _extraParam4; break; + } + int precision = params[1].toInt(); + QString replacement = QString("%1").arg(param,0,'f', precision); + //DEBUG qDebug() << "@" << vValue << tmp << replacement; + vValue.replace(placeholder, replacement); + } + } + void confirmModifier ( QString & ) const {} + void cancelModifier ( QString & ) const {} + IDBASED (QString , title ,tr("Confirm" ), confirms, id) IDBASED (QString , message ,tr("Are you sure?" ), confirms, id) IDBASED (QString , confirm ,tr("CONFIRM" ), confirms, id)