diff options
author | bunnei <bunneidev@gmail.com> | 2019-10-06 01:29:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-06 01:29:35 +0200 |
commit | 6f511c8006f73206519731db8bd7117fb629b56f (patch) | |
tree | 19d08b8008c7171da99e28ba1882032d2e9371b6 /src | |
parent | Merge pull request #2944 from lioncash/ast (diff) | |
parent | qt: Change titlebar formatting (diff) | |
download | yuzu-6f511c8006f73206519731db8bd7117fb629b56f.tar yuzu-6f511c8006f73206519731db8bd7117fb629b56f.tar.gz yuzu-6f511c8006f73206519731db8bd7117fb629b56f.tar.bz2 yuzu-6f511c8006f73206519731db8bd7117fb629b56f.tar.lz yuzu-6f511c8006f73206519731db8bd7117fb629b56f.tar.xz yuzu-6f511c8006f73206519731db8bd7117fb629b56f.tar.zst yuzu-6f511c8006f73206519731db8bd7117fb629b56f.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/common/CMakeLists.txt | 12 | ||||
-rw-r--r-- | src/common/scm_rev.cpp.in | 6 | ||||
-rw-r--r-- | src/common/scm_rev.h | 3 | ||||
-rw-r--r-- | src/yuzu/main.cpp | 21 |
4 files changed, 36 insertions, 6 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 0ed96c0d4..906c486fd 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -15,11 +15,23 @@ if (DEFINED ENV{CI}) set(BUILD_TAG $ENV{AZURE_REPO_TAG}) endif() endif() +if (DEFINED ENV{TITLEBARFORMATIDLE}) + set(TITLE_BAR_FORMAT_IDLE $ENV{TITLEBARFORMATIDLE}) +endif () +if (DEFINED ENV{TITLEBARFORMATRUNNING}) + set(TITLE_BAR_FORMAT_RUNNING $ENV{TITLEBARFORMATRUNNING}) +endif () +if (DEFINED ENV{DISPLAYVERSION}) + set(DISPLAY_VERSION $ENV{DISPLAYVERSION}) +endif () add_custom_command(OUTPUT scm_rev.cpp COMMAND ${CMAKE_COMMAND} -DSRC_DIR="${CMAKE_SOURCE_DIR}" -DBUILD_REPOSITORY="${BUILD_REPOSITORY}" + -DTITLE_BAR_FORMAT_IDLE="${TITLE_BAR_FORMAT_IDLE}" + -DTITLE_BAR_FORMAT_RUNNING="${TITLE_BAR_FORMAT_RUNNING}" -DBUILD_TAG="${BUILD_TAG}" + -DBUILD_ID="${DISPLAY_VERSION}" -P "${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake" DEPENDS # WARNING! It was too much work to try and make a common location for this list, diff --git a/src/common/scm_rev.cpp.in b/src/common/scm_rev.cpp.in index d69038f65..5f126f324 100644 --- a/src/common/scm_rev.cpp.in +++ b/src/common/scm_rev.cpp.in @@ -11,6 +11,9 @@ #define BUILD_DATE "@BUILD_DATE@" #define BUILD_FULLNAME "@BUILD_FULLNAME@" #define BUILD_VERSION "@BUILD_VERSION@" +#define BUILD_ID "@BUILD_ID@" +#define TITLE_BAR_FORMAT_IDLE "@TITLE_BAR_FORMAT_IDLE@" +#define TITLE_BAR_FORMAT_RUNNING "@TITLE_BAR_FORMAT_RUNNING@" #define SHADER_CACHE_VERSION "@SHADER_CACHE_VERSION@" namespace Common { @@ -22,6 +25,9 @@ const char g_build_name[] = BUILD_NAME; const char g_build_date[] = BUILD_DATE; const char g_build_fullname[] = BUILD_FULLNAME; const char g_build_version[] = BUILD_VERSION; +const char g_build_id[] = BUILD_ID; +const char g_title_bar_format_idle[] = TITLE_BAR_FORMAT_IDLE; +const char g_title_bar_format_running[] = TITLE_BAR_FORMAT_RUNNING; const char g_shader_cache_version[] = SHADER_CACHE_VERSION; } // namespace diff --git a/src/common/scm_rev.h b/src/common/scm_rev.h index 666bf0367..563015ec9 100644 --- a/src/common/scm_rev.h +++ b/src/common/scm_rev.h @@ -13,6 +13,9 @@ extern const char g_build_name[]; extern const char g_build_date[]; extern const char g_build_fullname[]; extern const char g_build_version[]; +extern const char g_build_id[]; +extern const char g_title_bar_format_idle[]; +extern const char g_title_bar_format_running[]; extern const char g_shader_cache_version[]; } // namespace Common diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 2d82df739..197e704b4 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1889,15 +1889,24 @@ void GMainWindow::OnCaptureScreenshot() { } void GMainWindow::UpdateWindowTitle(const QString& title_name) { - const QString full_name = QString::fromUtf8(Common::g_build_fullname); - const QString branch_name = QString::fromUtf8(Common::g_scm_branch); - const QString description = QString::fromUtf8(Common::g_scm_desc); + const auto full_name = std::string(Common::g_build_fullname); + const auto branch_name = std::string(Common::g_scm_branch); + const auto description = std::string(Common::g_scm_desc); + const auto build_id = std::string(Common::g_build_id); + + const auto date = + QDateTime::currentDateTime().toString(QStringLiteral("yyyy-MM-dd")).toStdString(); if (title_name.isEmpty()) { - setWindowTitle(QStringLiteral("yuzu %1| %2-%3").arg(full_name, branch_name, description)); + const auto fmt = std::string(Common::g_title_bar_format_idle); + setWindowTitle(QString::fromStdString(fmt::format(fmt.empty() ? "yuzu {0}| {1}-{2}" : fmt, + full_name, branch_name, description, + std::string{}, date, build_id))); } else { - setWindowTitle(QStringLiteral("yuzu %1| %4 | %2-%3") - .arg(full_name, branch_name, description, title_name)); + const auto fmt = std::string(Common::g_title_bar_format_idle); + setWindowTitle(QString::fromStdString( + fmt::format(fmt.empty() ? "yuzu {0}| {3} | {1}-{2}" : fmt, full_name, branch_name, + description, std::string{}, date, build_id))); } } |