diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2019-11-12 13:23:09 +0200 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2020-01-08 17:21:34 +0200 |
commit | e35e4b2ba052c9a533626286026dbe0a2d546c5b (patch) | |
tree | f1da9cbddeb6fd0f81c4f21b4b08d435563e702f /src/qt/optionsmodel.h | |
parent | 295211e668290d7741eb0fd46223087c21fc7c59 (diff) |
util: Add PruneMiBtoGB() function
Now the text of prune QCheckBox shows the space in GB instead of
thousands MiB, which is consistent with other parts of the GUI.
Diffstat (limited to 'src/qt/optionsmodel.h')
-rw-r--r-- | src/qt/optionsmodel.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h index 6f5c8b8c5c..9751deadc4 100644 --- a/src/qt/optionsmodel.h +++ b/src/qt/optionsmodel.h @@ -6,6 +6,7 @@ #define BITCOIN_QT_OPTIONSMODEL_H #include <amount.h> +#include <qt/guiconstants.h> #include <QAbstractListModel> @@ -16,6 +17,11 @@ class Node; extern const char *DEFAULT_GUI_PROXY_HOST; static constexpr unsigned short DEFAULT_GUI_PROXY_PORT = 9050; +/** + * Convert configured prune target MiB to displayed GB. Round up to avoid underestimating max disk usage. + */ +static inline int PruneMiBtoGB(int64_t mib) { return (mib * 1024 * 1024 + GB_BYTES - 1) / GB_BYTES; } + /** Interface from Qt to configuration data structure for Bitcoin client. To Qt, the options are presented as a list with the different options laid out vertically. |