Index: sources/view/confirm/VConfirm.h =================================================================== diff -u -r6e9dccd1109d9c8d4ee4b6a21260618969a1706b -rb51d4ccc77d53e6e62a23255053888c936e7e919 --- sources/view/confirm/VConfirm.h (.../VConfirm.h) (revision 6e9dccd1109d9c8d4ee4b6a21260618969a1706b) +++ sources/view/confirm/VConfirm.h (.../VConfirm.h) (revision b51d4ccc77d53e6e62a23255053888c936e7e919) @@ -14,6 +14,7 @@ */ #pragma once +#include #include // Project @@ -69,8 +70,46 @@ PROPERTY(bool , isReject , 0) PROPERTY(bool , isAccept , 0) + 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; + } + QString replacement = QString("%1").arg(param); + //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)