GUI: resolved issue #640 (normalized date output format)
This commit is contained in:
parent
51a9fb5ec9
commit
5a2bc3c878
|
@ -12,6 +12,7 @@
|
|||
#include "ShortcutsDialog.h"
|
||||
#include "AttachDialog.h"
|
||||
#include "LineEditDialog.h"
|
||||
#include "StringUtil.h"
|
||||
|
||||
QString MainWindow::windowTitle = "";
|
||||
|
||||
|
@ -20,8 +21,7 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||
ui->setupUi(this);
|
||||
|
||||
// Build information
|
||||
QString buildText = QString(__DATE__).simplified();
|
||||
QAction* buildInfo = new QAction(buildText, this);
|
||||
QAction* buildInfo = new QAction(ToDateString(GetCompileDate()), this);
|
||||
buildInfo->setEnabled(false);
|
||||
ui->menuBar->addAction(buildInfo);
|
||||
|
||||
|
@ -584,7 +584,7 @@ void MainWindow::displayAboutWidget()
|
|||
QString title = "About x32dbg";
|
||||
#endif
|
||||
title += QString().sprintf(" v%d", BridgeGetDbgVersion());
|
||||
QMessageBox msg(QMessageBox::Information, title, "Website:<br><a href=\"http://x64dbg.com\">http://x64dbg.com</a><br><br>Attribution:<br><a href=\"http://icons8.com\">Icons8</a><br><a href=\"http://p.yusukekamiyamane.com\">Yusuke Kamiyamane</a><br><br>Compiled on:<br>" + QString(__DATE__).simplified() + ", " __TIME__);
|
||||
QMessageBox msg(QMessageBox::Information, title, "Website:<br><a href=\"http://x64dbg.com\">http://x64dbg.com</a><br><br>Attribution:<br><a href=\"http://icons8.com\">Icons8</a><br><a href=\"http://p.yusukekamiyamane.com\">Yusuke Kamiyamane</a><br><br>Compiled on:<br>" + ToDateString(GetCompileDate()) + ", " __TIME__);
|
||||
msg.setWindowIcon(QIcon(":/icons/images/information.png"));
|
||||
msg.setTextFormat(Qt::RichText);
|
||||
msg.setParent(this, Qt::Dialog);
|
||||
|
|
|
@ -167,3 +167,23 @@ QString ToLongDoubleString(void* buffer)
|
|||
return sigStr + expStr;
|
||||
}
|
||||
}
|
||||
|
||||
QString ToDateString(const QDate & date)
|
||||
{
|
||||
static const char* months[] =
|
||||
{
|
||||
"Jan",
|
||||
"Feb",
|
||||
"Mar",
|
||||
"Arp",
|
||||
"May",
|
||||
"Jun",
|
||||
"Jul",
|
||||
"Aug",
|
||||
"Sep",
|
||||
"Oct",
|
||||
"Nov",
|
||||
"Dec"
|
||||
};
|
||||
return QString().sprintf("%s %d %d", months[date.month() - 1], date.day(), date.year());
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <QString>
|
||||
#include <QDateTime>
|
||||
#include <QLocale>
|
||||
#include "Imports.h"
|
||||
|
||||
static QString ToPtrString(duint Address)
|
||||
|
@ -73,4 +75,11 @@ static QString ToDoubleString(void* buffer)
|
|||
|
||||
QString ToLongDoubleString(void* buffer);
|
||||
|
||||
QString ToDateString(const QDate & date);
|
||||
|
||||
static QDate GetCompileDate()
|
||||
{
|
||||
return QLocale("en_US").toDate(QString(__DATE__).simplified(), "MMM d yyyy");
|
||||
}
|
||||
|
||||
#endif // STRINGUTIL_H
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <QIcon>
|
||||
#include <QDateTime>
|
||||
#include "Bridge.h"
|
||||
#include "StringUtil.h"
|
||||
|
||||
UpdateChecker::UpdateChecker(QWidget* parent)
|
||||
: QNetworkAccessManager(parent),
|
||||
|
@ -47,15 +48,14 @@ void UpdateChecker::finishedSlot(QNetworkReply* reply)
|
|||
return;
|
||||
}
|
||||
auto server = QDateTime::fromTime_t(timestamp).date();
|
||||
auto build = QDateTime::fromString(QString(__DATE__).simplified(), "MMM d yyyy").date();
|
||||
auto build = GetCompileDate();
|
||||
QString info;
|
||||
auto dateFormat = "MMM d yyyy";
|
||||
if(server > build)
|
||||
info = QString("New build %1 available!<br>Download <a href=\"http://releases.x64dbg.com\">here</a><br><br>You are now on build %2").arg(server.toString(dateFormat), build.toString(dateFormat));
|
||||
info = QString("New build %1 available!<br>Download <a href=\"http://releases.x64dbg.com\">here</a><br><br>You are now on build %2").arg(ToDateString(server), ToDateString(build));
|
||||
else if(server < build)
|
||||
info = QString("You have a development build (%1) of x64dbg!").arg(build.toString(dateFormat));
|
||||
info = QString("You have a development build (%1) of x64dbg!").arg(ToDateString(build));
|
||||
else
|
||||
info = QString("You have the latest build (%1) of x64dbg!").arg(build.toString(dateFormat));
|
||||
info = QString("You have the latest build (%1) of x64dbg!").arg(ToDateString(build));
|
||||
QMessageBox msg(QMessageBox::Information, "Information", info);
|
||||
msg.setWindowIcon(QIcon(":/icons/images/information.png"));
|
||||
msg.setParent(mParent, Qt::Dialog);
|
||||
|
|
Loading…
Reference in New Issue