Просмотр исходного кода

yuzu/loading_screen: Specify string conversions explicitly

Allows the loading screen code to compile with implicit string
conversions disabled.

While we're at it remove unnecessary const usages, and add it to nearby
variables where appropriate.
Lioncash 7 лет назад
Родитель
Сommit
922d8c6cb4
1 измененных файлов с 9 добавлено и 9 удалено
  1. 9 9
      src/yuzu/loading_screen.cpp

+ 9 - 9
src/yuzu/loading_screen.cpp

@@ -30,11 +30,11 @@
 #include <QMovie>
 #include <QMovie>
 #endif
 #endif
 
 
-constexpr const char PROGRESSBAR_STYLE_PREPARE[] = R"(
+constexpr char PROGRESSBAR_STYLE_PREPARE[] = R"(
 QProgressBar {}
 QProgressBar {}
 QProgressBar::chunk {})";
 QProgressBar::chunk {})";
 
 
-constexpr const char PROGRESSBAR_STYLE_DECOMPILE[] = R"(
+constexpr char PROGRESSBAR_STYLE_DECOMPILE[] = R"(
 QProgressBar {
 QProgressBar {
   background-color: black;
   background-color: black;
   border: 2px solid white;
   border: 2px solid white;
@@ -46,7 +46,7 @@ QProgressBar::chunk {
   width: 1px;
   width: 1px;
 })";
 })";
 
 
-constexpr const char PROGRESSBAR_STYLE_BUILD[] = R"(
+constexpr char PROGRESSBAR_STYLE_BUILD[] = R"(
 QProgressBar {
 QProgressBar {
   background-color: black;
   background-color: black;
   border: 2px solid white;
   border: 2px solid white;
@@ -58,7 +58,7 @@ QProgressBar::chunk {
   width: 1px;
   width: 1px;
 })";
 })";
 
 
-constexpr const char PROGRESSBAR_STYLE_COMPLETE[] = R"(
+constexpr char PROGRESSBAR_STYLE_COMPLETE[] = R"(
 QProgressBar {
 QProgressBar {
   background-color: #0ab9e6;
   background-color: #0ab9e6;
   border: 2px solid white;
   border: 2px solid white;
@@ -149,10 +149,10 @@ void LoadingScreen::OnLoadComplete() {
 void LoadingScreen::OnLoadProgress(VideoCore::LoadCallbackStage stage, std::size_t value,
 void LoadingScreen::OnLoadProgress(VideoCore::LoadCallbackStage stage, std::size_t value,
                                    std::size_t total) {
                                    std::size_t total) {
     using namespace std::chrono;
     using namespace std::chrono;
-    auto now = high_resolution_clock::now();
+    const auto now = high_resolution_clock::now();
     // reset the timer if the stage changes
     // reset the timer if the stage changes
     if (stage != previous_stage) {
     if (stage != previous_stage) {
-        ui->progress_bar->setStyleSheet(progressbar_style[stage]);
+        ui->progress_bar->setStyleSheet(QString::fromUtf8(progressbar_style[stage]));
         // Hide the progress bar during the prepare stage
         // Hide the progress bar during the prepare stage
         if (stage == VideoCore::LoadCallbackStage::Prepare) {
         if (stage == VideoCore::LoadCallbackStage::Prepare) {
             ui->progress_bar->hide();
             ui->progress_bar->hide();
@@ -178,16 +178,16 @@ void LoadingScreen::OnLoadProgress(VideoCore::LoadCallbackStage stage, std::size
             slow_shader_first_value = value;
             slow_shader_first_value = value;
         }
         }
         // only calculate an estimate time after a second has passed since stage change
         // only calculate an estimate time after a second has passed since stage change
-        auto diff = duration_cast<milliseconds>(now - slow_shader_start);
+        const auto diff = duration_cast<milliseconds>(now - slow_shader_start);
         if (diff > seconds{1}) {
         if (diff > seconds{1}) {
-            auto eta_mseconds =
+            const auto eta_mseconds =
                 static_cast<long>(static_cast<double>(total - slow_shader_first_value) /
                 static_cast<long>(static_cast<double>(total - slow_shader_first_value) /
                                   (value - slow_shader_first_value) * diff.count());
                                   (value - slow_shader_first_value) * diff.count());
             estimate =
             estimate =
                 tr("Estimated Time %1")
                 tr("Estimated Time %1")
                     .arg(QTime(0, 0, 0, 0)
                     .arg(QTime(0, 0, 0, 0)
                              .addMSecs(std::max<long>(eta_mseconds - diff.count() + 1000, 1000))
                              .addMSecs(std::max<long>(eta_mseconds - diff.count() + 1000, 1000))
-                             .toString("mm:ss"));
+                             .toString(QStringLiteral("mm:ss")));
         }
         }
     }
     }