From 010b2faa08606081230a49ee901d8587a6b0964f Mon Sep 17 00:00:00 2001 From: RadRussianRus Date: Mon, 10 Aug 2020 00:49:25 +0300 Subject: [PATCH] Add reading of double options --- Telegram/SourceFiles/kotato/json_settings.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Telegram/SourceFiles/kotato/json_settings.cpp b/Telegram/SourceFiles/kotato/json_settings.cpp index 99701f178..0ea35e449 100644 --- a/Telegram/SourceFiles/kotato/json_settings.cpp +++ b/Telegram/SourceFiles/kotato/json_settings.cpp @@ -146,6 +146,17 @@ bool ReadStringOption(QJsonObject obj, QString key, std::function return (readValueResult && readResult); } +bool ReadDoubleOption(QJsonObject obj, QString key, std::function callback) { + auto readResult = false; + auto readValueResult = ReadOption(obj, key, [&](QJsonValue v) { + if (v.isDouble()) { + callback(v.toDouble()); + readResult = true; + } + }); + return (readValueResult && readResult); +} + bool ReadIntOption(QJsonObject obj, QString key, std::function callback) { auto readResult = false; auto readValueResult = ReadOption(obj, key, [&](QJsonValue v) {