Skip to content

Commit a479b91

Browse files
committed
0.0.8
1 parent 9b9aa2a commit a479b91

2 files changed

Lines changed: 20 additions & 26 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Standard routine
22
cmake_minimum_required(VERSION 3.16)
33
project(example_app
4-
VERSION 0.0.7 # CI_PROJECT_VERSION
4+
VERSION 0.0.8 # CI_PROJECT_VERSION
55
)
66

77
option(BUILD_SHARED_LIBS "Build shared libs" OFF)
88

9-
set(AUI_VERSION fb9313a3a6cec7999bc42d1db16a31c1280ef6ff)
9+
set(AUI_VERSION a98b704e4cda510781ea2d0931c1c7b6e755912c)
1010

1111
# Use AUI.Boot
1212
file(

src/MainWindow.cpp

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,24 @@ MainWindow::MainWindow(_<MyUpdater> updater)
2020
_new<AButton>("Submit an issue")
2121
.connect(
2222
&AView::clicked, this, [] { APlatform::openUrl("https://github.com/aui-framework/aui/issues/new"); }),
23-
CustomLayout {} & mUpdater->status.readProjected([&updater = mUpdater](const AUpdater::Status& status) {
24-
return std::visit(
25-
aui::lambda_overloaded {
26-
[&](const AUpdater::StatusIdle&) -> _<AView> {
27-
return _new<AButton>("Check for updates").connect(&AView::clicked, slot(updater)::checkForUpdates);
28-
},
29-
[&](const AUpdater::StatusCheckingForUpdates&) -> _<AView> {
30-
return Label { "Checking for updates..." };
31-
},
32-
[&](const AUpdater::StatusDownloading& s) -> _<AView> {
33-
return Vertical {
34-
Label { "Downloading..." },
35-
_new<AProgressBar>() let { it->setValue(s.progress); },
36-
};
37-
},
38-
[&](const AUpdater::StatusWaitingForApplyAndRestart&) -> _<AView> {
39-
return _new<AButton>("Apply update and restart")
40-
.connect(&AView::clicked, slot(updater)::applyUpdateAndRestart);
41-
},
42-
[&](const AUpdater::StatusNotAvailable&) -> _<AView> {
43-
return nullptr;
44-
},
45-
},
46-
status);
23+
CustomLayout {} & mUpdater->status.readProjected([&updater = mUpdater](const std::any& status) -> _<AView> {
24+
if (std::any_cast<AUpdater::StatusIdle>(&status)) {
25+
return _new<AButton>("Check for updates").connect(&AView::clicked, slot(updater)::checkForUpdates);
26+
}
27+
if (std::any_cast<AUpdater::StatusCheckingForUpdates>(&status)) {
28+
return Label { "Checking for updates..." };
29+
}
30+
if (auto downloading = std::any_cast<AUpdater::StatusDownloading>(&status)) {
31+
return Vertical {
32+
Label { "Downloading..." },
33+
_new<AProgressBar>() & downloading->progress,
34+
};
35+
}
36+
if (std::any_cast<AUpdater::StatusWaitingForApplyAndRestart>(&status)) {
37+
return _new<AButton>("Apply update and restart")
38+
.connect(&AView::clicked, slot(updater)::applyUpdateAndRestart);
39+
}
40+
return nullptr;
4741
}),
4842
Label { "Btw, 2 + 2 = {}"_format(sum(2, 2)) },
4943
Label { "Version: " AUI_PP_STRINGIZE(AUI_CMAKE_PROJECT_VERSION) },

0 commit comments

Comments
 (0)