diff --git a/map/settings.cpp b/map/settings.cpp index 12f03f53d1..1ba2f84cf1 100644 --- a/map/settings.cpp +++ b/map/settings.cpp @@ -65,6 +65,17 @@ namespace Settings StringStorage StringStorage::m_instance; //////////////////////////////////////////////////////////////////////////////////////////// + template <> string ToString(string const & str) + { + return str; + } + + template <> bool FromString(string const & strIn, string & strOut) + { + strOut = strIn; + return true; + } + template <> string ToString(m2::RectD const & rect) { ostringstream stream; 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 #include @@ -13,8 +15,12 @@ #include #include #include +#include #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); } diff --git a/qt/update_dialog.hpp b/qt/update_dialog.hpp index 11cb766dae..8b03754a3d 100644 --- a/qt/update_dialog.hpp +++ b/qt/update_dialog.hpp @@ -38,7 +38,7 @@ namespace qt private: QTreeWidget * m_tree; - //QLabel * m_label; + QLabel * m_label; QPushButton * m_updateButton; storage::Storage & m_storage; };