Skip to content

Commit

Permalink
Updater: Show when the latest check was made
Browse files Browse the repository at this point in the history
Also adjusted initial dialog positioning.
  • Loading branch information
skyjake committed Jun 13, 2012
1 parent ffd840a commit a05eb0f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
9 changes: 2 additions & 7 deletions doomsday/engine/portable/src/updater.cpp
Expand Up @@ -242,11 +242,6 @@ struct Updater::Instance
{
UpdaterSettings().setLastCheckTime(de::Time());
alwaysShowNotification = notifyAlways;
doCheckRequest();
}

void doCheckRequest()
{
network->get(QNetworkRequest(composeCheckUri()));
}

Expand Down Expand Up @@ -473,7 +468,7 @@ void Updater::settingsDialogClosed(int /*result*/)

void Updater::recheck()
{
d->doCheckRequest();
d->queryLatestVersion(d->alwaysShowNotification);
}

void Updater::showSettings()
Expand All @@ -494,7 +489,7 @@ void Updater::checkNowShowingProgress()
// Not if there is an ongoing download.
if(d->download) return;

d->availableDlg = new UpdateAvailableDialog;
d->availableDlg = new UpdateAvailableDialog(Window_Widget(Window_Main()));
connect(d->availableDlg, SIGNAL(checkAgain()), this, SLOT(recheck()));
d->queryLatestVersion(true);
d->availableDlg->exec();
Expand Down
Expand Up @@ -2,6 +2,7 @@
#include "updatersettings.h"
#include "updatersettingsdialog.h"
#include "versioninfo.h"
#include "window.h"
#include <de/Log>
#include <QUrl>
#include <QDesktopServices>
Expand Down Expand Up @@ -39,6 +40,7 @@ struct UpdateAvailableDialog::Instance
void initForChecking(void)
{
init();
createResultPage(VersionInfo());
stack->setCurrentWidget(checkPage);
}

Expand Down
22 changes: 16 additions & 6 deletions doomsday/engine/portable/src/updater/updatersettingsdialog.cpp
Expand Up @@ -3,6 +3,7 @@
#include <QDesktopServices>
#include <QVBoxLayout>
#include <QFormLayout>
#include <QLabel>
#include <QPushButton>
#include <QCheckBox>
#include <QComboBox>
Expand All @@ -26,6 +27,7 @@ struct UpdaterSettingsDialog::Instance
UpdaterSettingsDialog* self;
QCheckBox* neverCheck;
QComboBox* freqList;
QLabel* lastChecked;
QComboBox* channelList;
QComboBox* pathList;
QCheckBox* deleteAfter;
Expand All @@ -52,6 +54,9 @@ struct UpdaterSettingsDialog::Instance
freqList->addItem(tr("Monthly"), UpdaterSettings::Monthly);
form->addRow(tr("&Check for updates:"), freqList);

lastChecked = new QLabel;
form->addRow(new QWidget, lastChecked);

channelList = new QComboBox;
channelList->addItem(tr("Stable"), UpdaterSettings::Stable);
channelList->addItem(tr("Unstable/Candidate"), UpdaterSettings::Unstable);
Expand Down Expand Up @@ -84,12 +89,17 @@ struct UpdaterSettingsDialog::Instance

void fetch()
{
neverCheck->setChecked(UpdaterSettings().onlyCheckManually());
freqList->setEnabled(!UpdaterSettings().onlyCheckManually());
freqList->setCurrentIndex(freqList->findData(UpdaterSettings().frequency()));
channelList->setCurrentIndex(channelList->findData(UpdaterSettings().channel()));
setDownloadPath(UpdaterSettings().downloadPath());
deleteAfter->setChecked(UpdaterSettings().deleteAfterUpdate());
UpdaterSettings st;

lastChecked->setText(tr("<small>Last checked on %1.</small>")
.arg(st.lastCheckTime().asText(de::Time::FriendlyFormat)));

neverCheck->setChecked(st.onlyCheckManually());
freqList->setEnabled(!st.onlyCheckManually());
freqList->setCurrentIndex(freqList->findData(st.frequency()));
channelList->setCurrentIndex(channelList->findData(st.channel()));
setDownloadPath(st.downloadPath());
deleteAfter->setChecked(st.deleteAfterUpdate());
}

void apply()
Expand Down
3 changes: 2 additions & 1 deletion doomsday/libdeng2/include/de/data/time.h
Expand Up @@ -99,7 +99,8 @@ class DENG2_PUBLIC Time : public ISerializable

enum Format {
ISOFormat,
BuildNumberAndTime
BuildNumberAndTime,
FriendlyFormat
};

public:
Expand Down
4 changes: 4 additions & 0 deletions doomsday/libdeng2/src/data/time.cpp
Expand Up @@ -130,6 +130,10 @@ String Time::asText(Format format) const
{
return _time.toString("yyyy-MM-dd hh:mm:ss.zzz");
}
else if(format == FriendlyFormat)
{
return _time.toString(Qt::TextDate);
}
else
{
return QString("#%1 ").arg(asBuildNumber(), -4) +
Expand Down

0 comments on commit a05eb0f

Please sign in to comment.