Skip to content

Commit

Permalink
UI|Updater|Client: Reimplemented the updater settings dialog
Browse files Browse the repository at this point in the history
Now using Doomsday's own UI framework for the settings dialog.
  • Loading branch information
skyjake committed Aug 20, 2013
1 parent 0c351cc commit 51b273d
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 108 deletions.
1 change: 1 addition & 0 deletions doomsday/client/include/ui/widgets/taskbarwidget.h
Expand Up @@ -59,6 +59,7 @@ public slots:
void openMainMenu();
void unloadGame();
void showAbout();
void showUpdaterSettings();

signals:
void opened();
Expand Down
16 changes: 15 additions & 1 deletion doomsday/client/src/ui/widgets/taskbarwidget.cpp
Expand Up @@ -38,7 +38,7 @@
#include <de/GLBuffer>
#include <de/ScalarRule>

#include "../../updater/versioninfo.h"
#include "versioninfo.h"
#include "dd_main.h"

using namespace de;
Expand All @@ -47,6 +47,7 @@ using namespace ui;
static TimeDelta OPEN_CLOSE_SPAN = 0.2;
static uint POS_PANEL = 0;
static uint POS_UNLOAD = 3;
static uint POS_UPDATER_SETTINGS = 6;

DENG2_PIMPL(TaskBarWidget),
public IGameChangeObserver
Expand Down Expand Up @@ -492,3 +493,16 @@ void TaskBarWidget::showAbout()
about->setDeleteAfterDismissed(true);
about->exec(root());
}

void TaskBarWidget::showUpdaterSettings()
{
UpdaterSettingsDialog *dlg = new UpdaterSettingsDialog;
dlg->setDeleteAfterDismissed(true);
if(d->mainMenu->isOpen())
{
dlg->setAnchorAndOpeningDirection(d->mainMenu->menu().organizer().
itemWidget(POS_UPDATER_SETTINGS)->hitRule(),
ui::Left);
}
dlg->exec(root());
}
3 changes: 2 additions & 1 deletion doomsday/client/src/updater/updateavailabledialog.cpp
Expand Up @@ -256,6 +256,7 @@ void UpdateAvailableDialog::showWhatsNew()

void UpdateAvailableDialog::editSettings()
{
/*
UpdaterSettingsDialog st(this);
if(st.exec())
{
Expand All @@ -265,7 +266,7 @@ void UpdateAvailableDialog::editSettings()
// Rerun the check.
emit checkAgain();
}
}*/
}

void UpdateAvailableDialog::recenterDialog()
Expand Down
8 changes: 5 additions & 3 deletions doomsday/client/src/updater/updater.cpp
Expand Up @@ -132,7 +132,7 @@ DENG2_PIMPL(Updater)
DownloadDialog* download;
bool alwaysShowNotification;
UpdateAvailableDialog* availableDlg;
UpdaterSettingsDialog* settingsDlg;
//UpdaterSettingsDialog* settingsDlg;
bool backToFullscreen;
bool savingSuggested;

Expand All @@ -146,7 +146,7 @@ DENG2_PIMPL(Updater)
network(0),
download(0),
availableDlg(0),
settingsDlg(0),
//settingsDlg(0),
backToFullscreen(false),
savingSuggested(false)
{
Expand All @@ -172,7 +172,7 @@ DENG2_PIMPL(Updater)

~Instance()
{
if(settingsDlg) delete settingsDlg;
//if(settingsDlg) delete settingsDlg;

// Delete the ongoing download.
if(download) delete download;
Expand Down Expand Up @@ -240,6 +240,7 @@ DENG2_PIMPL(Updater)

void showSettingsNonModal()
{
/*
if(!settingsDlg)
{
settingsDlg = new UpdaterSettingsDialog(&ClientWindow::main());
Expand All @@ -250,6 +251,7 @@ DENG2_PIMPL(Updater)
settingsDlg->fetch();
}
settingsDlg->open();
*/
}

void queryLatestVersion(bool notifyAlways)
Expand Down
16 changes: 13 additions & 3 deletions doomsday/client/src/updater/updatersettings.cpp
Expand Up @@ -199,19 +199,29 @@ de::String UpdaterSettings::lastCheckAgo() const
if(delta < 60.0)
{
t = delta.asMilliSeconds() / 1000;
return de::String("%1 second%2 ago").arg(t).arg(t != 1? "s" : "");
return de::String(QObject::tr("%1 %2 ago")).arg(t).
arg(t != 1? QObject::tr("seconds") : QObject::tr("second"));
}

t = delta.asMinutes();
if(t <= 60)
{
return de::String("%1 minute%2 ago").arg(t).arg(t != 1? "s" : "");
return de::String(QObject::tr("%1 %2 ago")).arg(t).
arg(t != 1? QObject::tr("minutes") : QObject::tr("minute"));
}

t = delta.asHours();
if(t <= 24)
{
return de::String("%1 hour%2 ago").arg(t).arg(t != 1? "s" : "");
return de::String(QObject::tr("%1 %2 ago")).arg(t).
arg(t != 1? QObject::tr("hours") : QObject::tr("hour"));
}

t = delta.asDays();
if(t <= 7)
{
return de::String(QObject::tr("%1 %2 ago")).arg(t).
arg(t != 1? QObject::tr("days") : QObject::tr("day"));
}

return de::String("on " + when.asText(de::Time::FriendlyFormat));
Expand Down

0 comments on commit 51b273d

Please sign in to comment.