diff options
author | Alex Zolotarev <deathbaba@gmail.com> | 2011-02-19 18:18:27 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:12:39 +0300 |
commit | 79549dc836970861151177437dfcf84d9b4d5a93 (patch) | |
tree | 9f833d6b523ccbcf95503a5673981cc959b0b5a0 /qt/update_dialog.cpp | |
parent | 6d74c073e1270f10a69aef3d5cc6910f1699cfad (diff) |
[Qt Downloader] Added Last Update Check time label
Diffstat (limited to 'qt/update_dialog.cpp')
-rw-r--r-- | qt/update_dialog.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/qt/update_dialog.cpp b/qt/update_dialog.cpp index 1d4d19b40a..ac2db27aa2 100644 --- a/qt/update_dialog.cpp +++ b/qt/update_dialog.cpp @@ -3,6 +3,8 @@ #include "../base/assert.hpp" +#include "../map/settings.hpp" + #include <boost/bind.hpp> #include <QtGui/QVBoxLayout> @@ -13,8 +15,12 @@ #include <QtGui/QHeaderView> #include <QtGui/QMessageBox> #include <QtGui/QProgressBar> +#include <QtCore/QDateTime> #define CHECK_FOR_UPDATE "Check for update" +#define LAST_UPDATE_CHECK "Last update check: " +/// used in settings +#define LAST_CHECK_TIME_KEY "LastUpdateCheckTime" using namespace storage; @@ -52,7 +58,10 @@ namespace qt UpdateDialog::UpdateDialog(QWidget * parent, Storage & storage) : QDialog(parent), m_storage(storage) { - //m_label = new QLabel(QObject::tr("Version: ") + VERSION_STRING, this); + string timeString; + if (!Settings::Get(LAST_CHECK_TIME_KEY, timeString)) + timeString = "Never checked"; + m_label = new QLabel(QString(QObject::tr(LAST_UPDATE_CHECK)) + timeString.c_str(), this); m_updateButton = new QPushButton(QObject::tr(CHECK_FOR_UPDATE), this); connect(m_updateButton, SIGNAL(clicked()), this, SLOT(OnUpdateClick())); @@ -65,7 +74,7 @@ namespace qt connect(m_tree, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(OnItemClick(QTreeWidgetItem *, int))); QHBoxLayout * horizontalLayout = new QHBoxLayout(); -// horizontalLayout->addWidget(m_label); + horizontalLayout->addWidget(m_label); horizontalLayout->addWidget(m_updateButton); QVBoxLayout * verticalLayout = new QVBoxLayout(); verticalLayout->addLayout(horizontalLayout); @@ -220,6 +229,10 @@ namespace qt // if (QMessageBox::Yes == QMessageBox::question(this, title, text, QMessageBox::Yes, QMessageBox::No)) // m_storage.PerformUpdate(); // } + QString labelText(LAST_UPDATE_CHECK); + QString const textDate = QDateTime::currentDateTime().toString(); + Settings::Set(LAST_CHECK_TIME_KEY, string(textDate.toLocal8Bit().data())); + m_label->setText(labelText.append(textDate)); m_updateButton->setText(CHECK_FOR_UPDATE); m_updateButton->setDisabled(false); } |