diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-07-14 09:06:02 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-07-14 09:09:36 +0200 |
commit | f3006884d2187e4a4198663024efc5d8e6104c4b (patch) | |
tree | 98a1aaf70617d817b09be1c6af20c4d6d00d3212 /variant/default/main-window.cpp | |
parent | a924f54ef87764bd9bc257babd3a02aafcc90cbb (diff) |
opentrack: cleanup main_window::set_title
Diffstat (limited to 'variant/default/main-window.cpp')
-rw-r--r-- | variant/default/main-window.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/variant/default/main-window.cpp b/variant/default/main-window.cpp index 200400e6..5e90d287 100644 --- a/variant/default/main-window.cpp +++ b/variant/default/main-window.cpp @@ -660,15 +660,19 @@ void main_window::display_pose(const double *mapped, const double *raw) set_title(game_title); } -void main_window::set_title(const QString& game_title_) +void main_window::set_title(const QString& game_title) { - QString game_title; - if (game_title_ != "") - game_title = tr(" :: ") + game_title_; - QString current = ini_filename(); - QString version(opentrack_version); - version = tr("opentrack") + " " + version.mid(sizeof("opentrack-") - 1); - setWindowTitle(version + tr(" :: ") + current + game_title); + static const QString version{opentrack_version}; + static const QString sep { tr(" :: ") }; + static const QString pat1{ version + sep + "%1" + sep + "%2" }; + static const QString pat2{ version + sep + "%1" }; + + const QString current = ini_filename(); + + if (game_title.isEmpty()) + setWindowTitle(pat2.arg(current)); + else + setWindowTitle(pat1.arg(current, game_title)); } void main_window::show_pose() |