Procházet zdrojové kódy

main: Don't add an extra separator when the title version is absent

Some titles, such as homebrew, do not have any version string. Because
yuzu hard codes the title bar string assuming a version string is
preset, booting homebrew causes yuzu to add an extra separator with no
content between.

This uses a lambda expression to prevent that from happening.
lat9nq před 4 roky
rodič
revize
596323f89f
1 změnil soubory, kde provedl 7 přidání a 2 odebrání
  1. 7 2
      src/yuzu/main.cpp

+ 7 - 2
src/yuzu/main.cpp

@@ -2913,8 +2913,13 @@ void GMainWindow::UpdateWindowTitle(std::string_view title_name, std::string_vie
     if (title_name.empty()) {
     if (title_name.empty()) {
         setWindowTitle(QString::fromStdString(window_title));
         setWindowTitle(QString::fromStdString(window_title));
     } else {
     } else {
-        const auto run_title =
-            fmt::format("{} | {} | {} | {}", window_title, title_name, title_version, gpu_vendor);
+        const auto run_title = [window_title, title_name, title_version, gpu_vendor]() {
+            if (title_version.empty()) {
+                return fmt::format("{} | {} | {}", window_title, title_name, gpu_vendor);
+            }
+            return fmt::format("{} | {} | {} | {}", window_title, title_name, title_version,
+                               gpu_vendor);
+        }();
         setWindowTitle(QString::fromStdString(run_title));
         setWindowTitle(QString::fromStdString(run_title));
     }
     }
 }
 }