forked from RussianMiningCoin/RMCWallet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
format.h
37 lines (28 loc) · 861 Bytes
/
format.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef FORMAT_H
#define FORMAT_H
#include <QString>
#include <QLocale>
#include <QLineEdit>
#include "money.h"
// Helpers
inline static QString timeFormat(int64_t nTime)
{
return QDateTime::fromTime_t(946684800 + nTime).toString("dd/MM/yyyy hh:mm:ss");
}
inline static QString AmountWithSign(int64_t nAmount, bool isDebit = false, QString strCurrency = "STM")
{
return QString("%1%2 %3").arg(isDebit ? "-" : "").arg(QString::number ( nAmount / coinAsDouble, 'f', 6 )).arg(strCurrency);
}
inline static QString Amount(int64_t nAmount)
{
return QString::number ( nAmount / coinAsDouble, 'f', 6 );
}
inline static int64_t readInt(QLineEdit* lineEdit)
{
return QLocale::system().toInt(lineEdit->text());
}
inline static double readDouble(QLineEdit* lineEdit)
{
return QLocale::system().toDouble(lineEdit->text());
}
#endif // FORMAT_H