Skip to content

Commit

Permalink
UI|Updater: Stop progress rotation when download complete
Browse files Browse the repository at this point in the history
Also tweaked the mini progress icon.
  • Loading branch information
skyjake committed Sep 14, 2013
1 parent d656970 commit 86cadcb
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 4 deletions.
Binary file modified doomsday/client/data/defaultstyle.pack/graphics/progress-mini.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions doomsday/client/include/ui/widgets/progresswidget.h
Expand Up @@ -47,6 +47,7 @@ class ProgressWidget : public LabelWidget
ProgressWidget(de::String const &name = "");

void useMiniStyle();
void setRotationSpeed(float anglesPerSecond);

Mode mode() const;
de::Rangei range() const;
Expand Down
9 changes: 8 additions & 1 deletion doomsday/client/src/ui/widgets/progresswidget.cpp
Expand Up @@ -31,6 +31,7 @@ DENG_GUI_PIMPL(ProgressWidget), public Lockable
Rangef visualRange;
Animation pos;
float angle;
float rotationSpeed;
Id gearTex;
DotPath colorId;
DotPath shadowColorId;
Expand All @@ -44,6 +45,7 @@ DENG_GUI_PIMPL(ProgressWidget), public Lockable
visualRange(0, 1),
pos(0, Animation::Linear),
angle(0),
rotationSpeed(20),
colorId("progress.light.wheel"),
shadowColorId("progress.light.shadow"),
gearId("progress.gear"),
Expand Down Expand Up @@ -98,6 +100,11 @@ void ProgressWidget::useMiniStyle()
setOverrideImageSize(style().fonts().font("default").height().value());
}

void ProgressWidget::setRotationSpeed(float anglesPerSecond)
{
d->rotationSpeed = anglesPerSecond;
}

ProgressWidget::Mode ProgressWidget::mode() const
{
DENG2_GUARD(d);
Expand Down Expand Up @@ -169,7 +176,7 @@ void ProgressWidget::update()
TimeDelta const elapsed = d->updateAt.since();
d->updateAt = now;

d->angle = de::wrap(d->angle + float(elapsed * 20), 0.f, 360.f);
d->angle = de::wrap(d->angle + float(elapsed * d->rotationSpeed), 0.f, 360.f);

requestGeometry();
}
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/ui/widgets/taskbarwidget.cpp
Expand Up @@ -312,8 +312,8 @@ TaskBarWidget::TaskBarWidget() : GuiWidget("taskbar"), d(new Instance(this))
d->mainMenu->items()
<< unloadMenu // hidden with null-game
<< new ui::Item(ui::Item::Separator) // hidden with null-game
<< new ui::ActionItem(tr("About Doomsday"), new SignalAction(this, SLOT(showAbout())))
<< new ui::ActionItem(tr("Check for Updates..."), new CommandAction("updateandnotify"))
<< new ui::ActionItem(tr("About Doomsday"), new SignalAction(this, SLOT(showAbout())))
<< new ui::Item(ui::Item::Separator)
<< new ui::ActionItem(tr("Quit Doomsday"), new CommandAction("quit"));

Expand Down
6 changes: 4 additions & 2 deletions doomsday/client/src/updater/downloaddialog.cpp
Expand Up @@ -264,11 +264,12 @@ void DownloadDialog::finished(QNetworkReply *reply)
}

buttons().clear()
<< new DialogButtonItem(DialogWidget::Reject, tr("Abort"),
<< new DialogButtonItem(DialogWidget::Reject, tr("Delete"),
new SignalAction(this, SLOT(cancel())))
<< new DialogButtonItem(DialogWidget::Accept | DialogWidget::Default, tr("Install"));
<< new DialogButtonItem(DialogWidget::Accept | DialogWidget::Default, tr("Install Update"));

d->state = Instance::Finished;
d->progress->setRotationSpeed(0);
d->updateProgress();

// Make sure the finished download is noticed by the user.
Expand All @@ -282,6 +283,7 @@ void DownloadDialog::cancel()
LOG_INFO("Download cancelled via user request");

d->state = Instance::Error;
d->progress->setRotationSpeed(0);

if(d->reply)
{
Expand Down
1 change: 1 addition & 0 deletions doomsday/client/src/updater/updater.cpp
Expand Up @@ -120,6 +120,7 @@ class UpdaterStatusWidget : public ProgressWidget
{
useMiniStyle();
setColor("text");
setRotationSpeed(0);
setSizePolicy(ui::Expand, ui::Expand);

// The notification has a hidden button that can be clicked.
Expand Down

0 comments on commit 86cadcb

Please sign in to comment.