summaryrefslogtreecommitdiffhomepage
path: root/facetracknoir
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-07-17 07:33:42 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-07-17 07:33:42 +0200
commit509a72bd7cc001878c2be34680eb78b0382f8d55 (patch)
tree597c03eb4d958f4e9ebe95ccdb7bb7558509f332 /facetracknoir
parentffb237e3f3f723c24e8935d3880970b288d3eeb1 (diff)
ui: set game title in titlebar
Diffstat (limited to 'facetracknoir')
-rw-r--r--facetracknoir/ui.cpp23
-rw-r--r--facetracknoir/ui.h1
2 files changed, 20 insertions, 4 deletions
diff --git a/facetracknoir/ui.cpp b/facetracknoir/ui.cpp
index 1f403925..88699810 100644
--- a/facetracknoir/ui.cpp
+++ b/facetracknoir/ui.cpp
@@ -185,11 +185,11 @@ extern "C" volatile const char* opentrack_version;
void MainWindow::fill_profile_combobox()
{
QStringList ini_list = group::ini_list();
- QString current = QFileInfo(group::ini_pathname()).fileName();
- setWindowTitle(QString( const_cast<const char*>(opentrack_version) + QStringLiteral(" :: ")) + current);
+ set_title();
ui.iconcomboProfile->clear();
for (auto x : ini_list)
ui.iconcomboProfile->addItem(QIcon(":/images/settings16.png"), x);
+ QString current = QFileInfo(group::ini_pathname()).fileName();
ui.iconcomboProfile->setCurrentText(current);
}
@@ -291,6 +291,8 @@ void MainWindow::stopTracker( ) {
display_pose(p, p);
}
updateButtonState(false, false);
+
+ set_title();
}
void MainWindow::display_pose(const double *mapped, const double *raw)
@@ -322,6 +324,20 @@ void MainWindow::display_pose(const double *mapped, const double *raw)
ui.pose_yaw->display(mapped_[Yaw]);
ui.pose_pitch->display(mapped_[Pitch]);
ui.pose_roll->display(mapped_[Roll]);
+
+ QString game_title;
+ if (libs.pProtocol)
+ game_title = libs.pProtocol->game_name();
+ set_title(game_title);
+}
+
+void MainWindow::set_title(const QString& game_title_)
+{
+ QString game_title;
+ if (game_title_ != "")
+ game_title = " :: " + game_title_;
+ QString current = QFileInfo(group::ini_pathname()).fileName();
+ setWindowTitle(const_cast<const char*>(opentrack_version) + QStringLiteral(" :: ") + current + game_title);
}
void MainWindow::showHeadPose()
@@ -446,8 +462,7 @@ void MainWindow::profileSelected(int index)
ui.iconcomboProfile->itemText(index)));
}
- QString current = QFileInfo(group::ini_pathname()).fileName();
- setWindowTitle(QString( const_cast<const char*>(opentrack_version) + QStringLiteral(" :: ")) + current);
+ set_title();
load_settings();
}
diff --git a/facetracknoir/ui.h b/facetracknoir/ui.h
index 48648716..7fa10664 100644
--- a/facetracknoir/ui.h
+++ b/facetracknoir/ui.h
@@ -91,6 +91,7 @@ class MainWindow : public QMainWindow, private State
void fill_profile_combobox();
void display_pose(const double* mapped, const double* raw);
void ensure_tray();
+ void set_title(const QString& game_title = QStringLiteral(""));
public slots:
void shortcutRecentered();
void shortcutToggled();