aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/libparser/diceroller.cpp
diff options
context:
space:
mode:
authorRenaud Guezennec <renaud@rolisteam.org>2025-10-07 00:10:02 +0200
committerRenaud Guezennec <renaud@rolisteam.org>2025-11-10 02:39:57 +0000
commit19670fc751782d063fafd43c9be03ecc92572c6b (patch)
tree0c7a3a803324e7cc9f70a6f2f5ed41907b4468e8 /src/libparser/diceroller.cpp
parent46cb61e9f90a480b0277816ae8d42e5b0c91fe0c (diff)
downloadOneRoll-19670fc751782d063fafd43c9be03ecc92572c6b.tar.gz
OneRoll-19670fc751782d063fafd43c9be03ecc92572c6b.zip
Fix error and cpp style.
Diffstat (limited to 'src/libparser/diceroller.cpp')
-rw-r--r--src/libparser/diceroller.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/libparser/diceroller.cpp b/src/libparser/diceroller.cpp
index 3c315f6..5396ef8 100644
--- a/src/libparser/diceroller.cpp
+++ b/src/libparser/diceroller.cpp
@@ -63,18 +63,21 @@ void DiceRoller::readErrorAndWarning()
void DiceRoller::start()
{
- auto future= QtConcurrent::run([this]() {
- if(m_diceparser.parseLine(m_command))
+ auto future= QtConcurrent::run(
+ [this]()
{
- m_diceparser.start();
- readErrorAndWarning();
- auto jsonstr= m_diceparser.resultAsJSon([](const QString& value, const QString&, bool) { return value; });
- QJsonDocument doc= QJsonDocument::fromJson(jsonstr.toLocal8Bit());
- auto json= doc.object();
- m_result= json["scalar"].toString().toDouble();
- emit resultChanged();
- }
- });
+ if(m_diceparser.parseLine(m_command))
+ {
+ m_diceparser.start();
+ readErrorAndWarning();
+ auto jsonstr
+ = m_diceparser.resultAsJSon([](const QString& value, const QString&, bool) { return value; });
+ QJsonDocument doc= QJsonDocument::fromJson(jsonstr.toLocal8Bit());
+ auto json= doc.object();
+ m_result= json["scalar"].toString().toDouble();
+ emit resultChanged();
+ }
+ });
}
QString DiceRoller::error() const