2011-05-27 18:38:30 +02:00
|
|
|
#include "guiutil.h"
|
2011-06-02 15:57:23 +02:00
|
|
|
#include "bitcoinaddressvalidator.h"
|
2011-05-27 18:38:30 +02:00
|
|
|
|
2011-06-02 15:57:23 +02:00
|
|
|
#include <QString>
|
2011-05-27 18:38:30 +02:00
|
|
|
#include <QDateTime>
|
2011-06-02 15:57:23 +02:00
|
|
|
#include <QDoubleValidator>
|
|
|
|
#include <QFont>
|
|
|
|
#include <QLineEdit>
|
2011-05-27 18:38:30 +02:00
|
|
|
|
2011-06-02 15:57:23 +02:00
|
|
|
QString GUIUtil::DateTimeStr(qint64 nTime)
|
2011-05-27 18:38:30 +02:00
|
|
|
{
|
2011-06-25 23:14:10 +02:00
|
|
|
QDateTime date = QDateTime::fromTime_t((qint32)nTime);
|
2011-05-27 19:48:42 +02:00
|
|
|
return date.date().toString(Qt::SystemLocaleShortDate) + QString(" ") + date.toString("hh:mm");
|
2011-05-27 18:38:30 +02:00
|
|
|
}
|
2011-06-01 20:08:21 +02:00
|
|
|
|
2011-06-02 15:57:23 +02:00
|
|
|
QFont GUIUtil::bitcoinAddressFont()
|
2011-06-01 20:08:21 +02:00
|
|
|
{
|
|
|
|
QFont font("Monospace");
|
|
|
|
font.setStyleHint(QFont::TypeWriter);
|
|
|
|
return font;
|
|
|
|
}
|
2011-06-02 15:57:23 +02:00
|
|
|
|
|
|
|
void GUIUtil::setupAddressWidget(QLineEdit *widget, QWidget *parent)
|
|
|
|
{
|
|
|
|
widget->setMaxLength(BitcoinAddressValidator::MaxAddressLength);
|
|
|
|
widget->setValidator(new BitcoinAddressValidator(parent));
|
|
|
|
widget->setFont(bitcoinAddressFont());
|
|
|
|
}
|
|
|
|
|
|
|
|
void GUIUtil::setupAmountWidget(QLineEdit *widget, QWidget *parent)
|
|
|
|
{
|
|
|
|
QDoubleValidator *amountValidator = new QDoubleValidator(parent);
|
|
|
|
amountValidator->setDecimals(8);
|
|
|
|
amountValidator->setBottom(0.0);
|
|
|
|
widget->setValidator(amountValidator);
|
2011-06-11 12:46:09 +02:00
|
|
|
widget->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
2011-06-02 15:57:23 +02:00
|
|
|
}
|
|
|
|
|