summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/loading_screen.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/yuzu/loading_screen.cpp b/src/yuzu/loading_screen.cpp
index 4e2d988cd..4f2bfab48 100644
--- a/src/yuzu/loading_screen.cpp
+++ b/src/yuzu/loading_screen.cpp
@@ -30,11 +30,11 @@
30#include <QMovie> 30#include <QMovie>
31#endif 31#endif
32 32
33constexpr const char PROGRESSBAR_STYLE_PREPARE[] = R"( 33constexpr char PROGRESSBAR_STYLE_PREPARE[] = R"(
34QProgressBar {} 34QProgressBar {}
35QProgressBar::chunk {})"; 35QProgressBar::chunk {})";
36 36
37constexpr const char PROGRESSBAR_STYLE_DECOMPILE[] = R"( 37constexpr char PROGRESSBAR_STYLE_DECOMPILE[] = R"(
38QProgressBar { 38QProgressBar {
39 background-color: black; 39 background-color: black;
40 border: 2px solid white; 40 border: 2px solid white;
@@ -46,7 +46,7 @@ QProgressBar::chunk {
46 width: 1px; 46 width: 1px;
47})"; 47})";
48 48
49constexpr const char PROGRESSBAR_STYLE_BUILD[] = R"( 49constexpr char PROGRESSBAR_STYLE_BUILD[] = R"(
50QProgressBar { 50QProgressBar {
51 background-color: black; 51 background-color: black;
52 border: 2px solid white; 52 border: 2px solid white;
@@ -58,7 +58,7 @@ QProgressBar::chunk {
58 width: 1px; 58 width: 1px;
59})"; 59})";
60 60
61constexpr const char PROGRESSBAR_STYLE_COMPLETE[] = R"( 61constexpr char PROGRESSBAR_STYLE_COMPLETE[] = R"(
62QProgressBar { 62QProgressBar {
63 background-color: #0ab9e6; 63 background-color: #0ab9e6;
64 border: 2px solid white; 64 border: 2px solid white;
@@ -149,10 +149,10 @@ void LoadingScreen::OnLoadComplete() {
149void LoadingScreen::OnLoadProgress(VideoCore::LoadCallbackStage stage, std::size_t value, 149void LoadingScreen::OnLoadProgress(VideoCore::LoadCallbackStage stage, std::size_t value,
150 std::size_t total) { 150 std::size_t total) {
151 using namespace std::chrono; 151 using namespace std::chrono;
152 auto now = high_resolution_clock::now(); 152 const auto now = high_resolution_clock::now();
153 // reset the timer if the stage changes 153 // reset the timer if the stage changes
154 if (stage != previous_stage) { 154 if (stage != previous_stage) {
155 ui->progress_bar->setStyleSheet(progressbar_style[stage]); 155 ui->progress_bar->setStyleSheet(QString::fromUtf8(progressbar_style[stage]));
156 // Hide the progress bar during the prepare stage 156 // Hide the progress bar during the prepare stage
157 if (stage == VideoCore::LoadCallbackStage::Prepare) { 157 if (stage == VideoCore::LoadCallbackStage::Prepare) {
158 ui->progress_bar->hide(); 158 ui->progress_bar->hide();
@@ -178,16 +178,16 @@ void LoadingScreen::OnLoadProgress(VideoCore::LoadCallbackStage stage, std::size
178 slow_shader_first_value = value; 178 slow_shader_first_value = value;
179 } 179 }
180 // only calculate an estimate time after a second has passed since stage change 180 // only calculate an estimate time after a second has passed since stage change
181 auto diff = duration_cast<milliseconds>(now - slow_shader_start); 181 const auto diff = duration_cast<milliseconds>(now - slow_shader_start);
182 if (diff > seconds{1}) { 182 if (diff > seconds{1}) {
183 auto eta_mseconds = 183 const auto eta_mseconds =
184 static_cast<long>(static_cast<double>(total - slow_shader_first_value) / 184 static_cast<long>(static_cast<double>(total - slow_shader_first_value) /
185 (value - slow_shader_first_value) * diff.count()); 185 (value - slow_shader_first_value) * diff.count());
186 estimate = 186 estimate =
187 tr("Estimated Time %1") 187 tr("Estimated Time %1")
188 .arg(QTime(0, 0, 0, 0) 188 .arg(QTime(0, 0, 0, 0)
189 .addMSecs(std::max<long>(eta_mseconds - diff.count() + 1000, 1000)) 189 .addMSecs(std::max<long>(eta_mseconds - diff.count() + 1000, 1000))
190 .toString("mm:ss")); 190 .toString(QStringLiteral("mm:ss")));
191 } 191 }
192 } 192 }
193 193