Skip to content

Commit

Permalink
Updater|Win32: Various small improvements
Browse files Browse the repository at this point in the history
Adjusted notification dialog margins on Windows, removed the context help button
from the notification dialog, added a window title for the notification dialog,
and fixed an issue when the dialog was being constructed where a blank, larger
window would briefly appear and then disappear during the construction (parentless
QWidgets were being constructed).
  • Loading branch information
skyjake committed Jun 14, 2012
1 parent 87b8875 commit 3b869d2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
2 changes: 2 additions & 0 deletions doomsday/engine/portable/src/updater.cpp
Expand Up @@ -492,7 +492,9 @@ void Updater::checkNowShowingProgress()
d->availableDlg = new UpdateAvailableDialog(Window_Widget(Window_Main()));
connect(d->availableDlg, SIGNAL(checkAgain()), this, SLOT(recheck()));
d->queryLatestVersion(true);

d->availableDlg->exec();

delete d->availableDlg;
d->availableDlg = 0;
}
Expand Down
37 changes: 25 additions & 12 deletions doomsday/engine/portable/src/updater/updateavailabledialog.cpp
Expand Up @@ -20,6 +20,7 @@ struct UpdateAvailableDialog::Instance
QStackedLayout* stack;
QWidget* checkPage;
QWidget* resultPage;
bool emptyResultPage;
QVBoxLayout* resultLayout;
QLabel* checking;
QLabel* info;
Expand All @@ -41,26 +42,34 @@ struct UpdateAvailableDialog::Instance
{
init();
createResultPage(VersionInfo());
stack->setCurrentWidget(checkPage);

stack->addWidget(checkPage);
stack->addWidget(resultPage);
}

void initForResult(const VersionInfo& latest)
{
init();
updateResult(latest);
createResultPage(latest);

stack->addWidget(resultPage);
stack->addWidget(checkPage);
}

void init()
{
stack = new QStackedLayout;
checkPage = new QWidget;
resultPage = new QWidget;
self->setWindowTitle(tr("Doomsday %1").arg(VersionInfo().asText()));
self->setWindowFlags(self->windowFlags() & ~Qt::WindowContextHelpButtonHint);

emptyResultPage = true;
stack = new QStackedLayout(self);
checkPage = new QWidget(self);
resultPage = new QWidget(self);

#ifdef MACOSX
// Adjust spacing around all stacked widgets.
self->setContentsMargins(9, 9, 9, 9);

stack->addWidget(checkPage);
stack->addWidget(resultPage);
#endif

// Create the Check page.
QVBoxLayout* checkLayout = new QVBoxLayout;
Expand Down Expand Up @@ -89,10 +98,14 @@ struct UpdateAvailableDialog::Instance
latestVersion = latest;

// Get rid of the existing page.
stack->removeWidget(resultPage);
delete resultPage;
resultPage = new QWidget;
stack->addWidget(resultPage);
if(!emptyResultPage)
{
stack->removeWidget(resultPage);
delete resultPage;
resultPage = new QWidget(self);
stack->addWidget(resultPage);
}
emptyResultPage = false;

resultLayout = new QVBoxLayout;
resultPage->setLayout(resultLayout);
Expand Down

0 comments on commit 3b869d2

Please sign in to comment.