mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-27 03:33:27 -03:00
Merge bitcoin-core/gui#349: replace QDateTime::fromTime_t with QDateTime::fromSecsSinceEpoch
3ae503c95b
refactor: replace QDateTime::toTime_t with QDateTime::toSecsSinceEpoch (fanquake)27257b39bf
refactor: replace QDateTime::fromTime_t with QDateTime::fromSecsSinceEpoch (fanquake) Pull request description: `QDateTime::fromTime_t` has [been obsoleted](https://doc.qt.io/qt-5.12/qdatetime-obsolete.html#fromTime_t) in favour of [`QDateTime::fromSecsSinceEpoch`](https://doc.qt.io/qt-5.12/qdatetime.html#fromSecsSinceEpoch), which is available from Qt 5.8+. ACKs for top commit: hebasto: ACK3ae503c95b
Tree-SHA512: 774243bccb4c4bd9e8ceeee0450d4f57b5665bdef8bcec0538d29664922fd354189d48718ca62ca49048b8b90c9b31ed184e1eefd7ff4529c55ba7d2b079e51e
This commit is contained in:
commit
dd455ecfa0
8 changed files with 15 additions and 11 deletions
|
@ -594,8 +594,8 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
|
||||||
connect(_clientModel, &ClientModel::numConnectionsChanged, this, &BitcoinGUI::setNumConnections);
|
connect(_clientModel, &ClientModel::numConnectionsChanged, this, &BitcoinGUI::setNumConnections);
|
||||||
connect(_clientModel, &ClientModel::networkActiveChanged, this, &BitcoinGUI::setNetworkActive);
|
connect(_clientModel, &ClientModel::networkActiveChanged, this, &BitcoinGUI::setNetworkActive);
|
||||||
|
|
||||||
modalOverlay->setKnownBestHeight(tip_info->header_height, QDateTime::fromTime_t(tip_info->header_time));
|
modalOverlay->setKnownBestHeight(tip_info->header_height, QDateTime::fromSecsSinceEpoch(tip_info->header_time));
|
||||||
setNumBlocks(tip_info->block_height, QDateTime::fromTime_t(tip_info->block_time), tip_info->verification_progress, false, SynchronizationState::INIT_DOWNLOAD);
|
setNumBlocks(tip_info->block_height, QDateTime::fromSecsSinceEpoch(tip_info->block_time), tip_info->verification_progress, false, SynchronizationState::INIT_DOWNLOAD);
|
||||||
connect(_clientModel, &ClientModel::numBlocksChanged, this, &BitcoinGUI::setNumBlocks);
|
connect(_clientModel, &ClientModel::numBlocksChanged, this, &BitcoinGUI::setNumBlocks);
|
||||||
|
|
||||||
// Receive and report messages from client model
|
// Receive and report messages from client model
|
||||||
|
|
|
@ -216,7 +216,7 @@ bool ClientModel::isReleaseVersion() const
|
||||||
|
|
||||||
QString ClientModel::formatClientStartupTime() const
|
QString ClientModel::formatClientStartupTime() const
|
||||||
{
|
{
|
||||||
return QDateTime::fromTime_t(GetStartupTime()).toString();
|
return QDateTime::fromSecsSinceEpoch(GetStartupTime()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ClientModel::dataDir() const
|
QString ClientModel::dataDir() const
|
||||||
|
@ -294,7 +294,7 @@ static void BlockTipChanged(ClientModel* clientmodel, SynchronizationState sync_
|
||||||
|
|
||||||
bool invoked = QMetaObject::invokeMethod(clientmodel, "numBlocksChanged", Qt::QueuedConnection,
|
bool invoked = QMetaObject::invokeMethod(clientmodel, "numBlocksChanged", Qt::QueuedConnection,
|
||||||
Q_ARG(int, tip.block_height),
|
Q_ARG(int, tip.block_height),
|
||||||
Q_ARG(QDateTime, QDateTime::fromTime_t(tip.block_time)),
|
Q_ARG(QDateTime, QDateTime::fromSecsSinceEpoch(tip.block_time)),
|
||||||
Q_ARG(double, verificationProgress),
|
Q_ARG(double, verificationProgress),
|
||||||
Q_ARG(bool, fHeader),
|
Q_ARG(bool, fHeader),
|
||||||
Q_ARG(SynchronizationState, sync_state));
|
Q_ARG(SynchronizationState, sync_state));
|
||||||
|
|
|
@ -81,7 +81,7 @@ QString dateTimeStr(const QDateTime &date)
|
||||||
|
|
||||||
QString dateTimeStr(qint64 nTime)
|
QString dateTimeStr(qint64 nTime)
|
||||||
{
|
{
|
||||||
return dateTimeStr(QDateTime::fromTime_t((qint32)nTime));
|
return dateTimeStr(QDateTime::fromSecsSinceEpoch(nTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
QFont fixedPitchFont(bool use_embedded_font)
|
QFont fixedPitchFont(bool use_embedded_font)
|
||||||
|
|
|
@ -234,7 +234,7 @@ bool RecentRequestEntryLessThan::operator()(const RecentRequestEntry& left, cons
|
||||||
switch(column)
|
switch(column)
|
||||||
{
|
{
|
||||||
case RecentRequestsTableModel::Date:
|
case RecentRequestsTableModel::Date:
|
||||||
return pLeft->date.toTime_t() < pRight->date.toTime_t();
|
return pLeft->date.toSecsSinceEpoch() < pRight->date.toSecsSinceEpoch();
|
||||||
case RecentRequestsTableModel::Label:
|
case RecentRequestsTableModel::Label:
|
||||||
return pLeft->recipient.label < pRight->recipient.label;
|
return pLeft->recipient.label < pRight->recipient.label;
|
||||||
case RecentRequestsTableModel::Message:
|
case RecentRequestsTableModel::Message:
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
#include <qt/sendcoinsrecipient.h>
|
#include <qt/sendcoinsrecipient.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
@ -26,9 +28,9 @@ public:
|
||||||
|
|
||||||
SERIALIZE_METHODS(RecentRequestEntry, obj) {
|
SERIALIZE_METHODS(RecentRequestEntry, obj) {
|
||||||
unsigned int date_timet;
|
unsigned int date_timet;
|
||||||
SER_WRITE(obj, date_timet = obj.date.toTime_t());
|
SER_WRITE(obj, date_timet = obj.date.toSecsSinceEpoch());
|
||||||
READWRITE(obj.nVersion, obj.id, date_timet, obj.recipient);
|
READWRITE(obj.nVersion, obj.id, date_timet, obj.recipient);
|
||||||
SER_READ(obj, obj.date = QDateTime::fromTime_t(date_timet));
|
SER_READ(obj, obj.date = QDateTime::fromSecsSinceEpoch(date_timet));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -651,7 +651,7 @@ void RPCConsole::setClientModel(ClientModel *model, int bestblock_height, int64_
|
||||||
setNumConnections(model->getNumConnections());
|
setNumConnections(model->getNumConnections());
|
||||||
connect(model, &ClientModel::numConnectionsChanged, this, &RPCConsole::setNumConnections);
|
connect(model, &ClientModel::numConnectionsChanged, this, &RPCConsole::setNumConnections);
|
||||||
|
|
||||||
setNumBlocks(bestblock_height, QDateTime::fromTime_t(bestblock_date), verification_progress, false);
|
setNumBlocks(bestblock_height, QDateTime::fromSecsSinceEpoch(bestblock_date), verification_progress, false);
|
||||||
connect(model, &ClientModel::numBlocksChanged, this, &RPCConsole::setNumBlocks);
|
connect(model, &ClientModel::numBlocksChanged, this, &RPCConsole::setNumBlocks);
|
||||||
|
|
||||||
updateNetworkState();
|
updateNetworkState();
|
||||||
|
|
|
@ -7,7 +7,9 @@
|
||||||
#include <qt/transactiontablemodel.h>
|
#include <qt/transactiontablemodel.h>
|
||||||
#include <qt/transactionrecord.h>
|
#include <qt/transactionrecord.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
TransactionFilterProxy::TransactionFilterProxy(QObject *parent) :
|
TransactionFilterProxy::TransactionFilterProxy(QObject *parent) :
|
||||||
QSortFilterProxyModel(parent),
|
QSortFilterProxyModel(parent),
|
||||||
|
|
|
@ -610,7 +610,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
|
||||||
case TypeRole:
|
case TypeRole:
|
||||||
return rec->type;
|
return rec->type;
|
||||||
case DateRole:
|
case DateRole:
|
||||||
return QDateTime::fromTime_t(static_cast<uint>(rec->time));
|
return QDateTime::fromSecsSinceEpoch(rec->time);
|
||||||
case WatchonlyRole:
|
case WatchonlyRole:
|
||||||
return rec->involvesWatchAddress;
|
return rec->involvesWatchAddress;
|
||||||
case WatchonlyDecorationRole:
|
case WatchonlyDecorationRole:
|
||||||
|
@ -630,7 +630,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
|
||||||
case TxPlainTextRole:
|
case TxPlainTextRole:
|
||||||
{
|
{
|
||||||
QString details;
|
QString details;
|
||||||
QDateTime date = QDateTime::fromTime_t(static_cast<uint>(rec->time));
|
QDateTime date = QDateTime::fromSecsSinceEpoch(rec->time);
|
||||||
QString txLabel = walletModel->getAddressTableModel()->labelForAddress(QString::fromStdString(rec->address));
|
QString txLabel = walletModel->getAddressTableModel()->labelForAddress(QString::fromStdString(rec->address));
|
||||||
|
|
||||||
details.append(date.toString("M/d/yy HH:mm"));
|
details.append(date.toString("M/d/yy HH:mm"));
|
||||||
|
|
Loading…
Add table
Reference in a new issue