summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--facetracknoir/curve-config.cpp1
-rw-r--r--facetracknoir/curve-config.h2
-rw-r--r--facetracknoir/main.cpp2
-rw-r--r--facetracknoir/main.ui (renamed from facetracknoir/facetracknoir.ui)0
-rw-r--r--facetracknoir/mapping.ui (renamed from facetracknoir/ftnoir_curves.ui)0
-rw-r--r--facetracknoir/ui-res.qrc (renamed from facetracknoir/main-facetracknoir.qrc)0
-rw-r--r--facetracknoir/ui.cpp (renamed from facetracknoir/facetracknoir.cpp)18
-rw-r--r--facetracknoir/ui.h (renamed from facetracknoir/facetracknoir.h)3
-rw-r--r--opentrack/main-settings.hpp4
9 files changed, 25 insertions, 5 deletions
diff --git a/facetracknoir/curve-config.cpp b/facetracknoir/curve-config.cpp
index f00d3657..db5a4a75 100644
--- a/facetracknoir/curve-config.cpp
+++ b/facetracknoir/curve-config.cpp
@@ -1,4 +1,3 @@
-#include "./facetracknoir.h"
#include "./curve-config.h"
#include "opentrack/main-settings.hpp"
MapWidget::MapWidget(Mappings& m, main_settings& s) :
diff --git a/facetracknoir/curve-config.h b/facetracknoir/curve-config.h
index 2104b7fa..d1ef7ad2 100644
--- a/facetracknoir/curve-config.h
+++ b/facetracknoir/curve-config.h
@@ -1,7 +1,7 @@
#pragma once
#include <QWidget>
#include "opentrack/mappings.hpp"
-#include "ui_ftnoir_curves.h"
+#include "ui_mapping.h"
class MapWidget: public QWidget
{
diff --git a/facetracknoir/main.cpp b/facetracknoir/main.cpp
index ee8da907..9c2ced45 100644
--- a/facetracknoir/main.cpp
+++ b/facetracknoir/main.cpp
@@ -1,4 +1,4 @@
-#include "facetracknoir.h"
+#include "ui.h"
#include <QApplication>
#include <QStyleFactory>
#include <QStringList>
diff --git a/facetracknoir/facetracknoir.ui b/facetracknoir/main.ui
index 69ae1f8a..69ae1f8a 100644
--- a/facetracknoir/facetracknoir.ui
+++ b/facetracknoir/main.ui
diff --git a/facetracknoir/ftnoir_curves.ui b/facetracknoir/mapping.ui
index 9f422b9b..9f422b9b 100644
--- a/facetracknoir/ftnoir_curves.ui
+++ b/facetracknoir/mapping.ui
diff --git a/facetracknoir/main-facetracknoir.qrc b/facetracknoir/ui-res.qrc
index 0b28b032..0b28b032 100644
--- a/facetracknoir/main-facetracknoir.qrc
+++ b/facetracknoir/ui-res.qrc
diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/ui.cpp
index 3ea95baa..edd3a818 100644
--- a/facetracknoir/facetracknoir.cpp
+++ b/facetracknoir/ui.cpp
@@ -21,7 +21,7 @@
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
-#include "facetracknoir.h"
+#include "ui.h"
#include "opentrack/tracker.h"
#include <QFileDialog>
@@ -78,6 +78,10 @@ MainWindow::MainWindow() :
connect(&pose_update_timer, SIGNAL(timeout()), this, SLOT(showHeadPose()));
connect(&kbd_quit, SIGNAL(activated()), this, SLOT(exit()));
kbd_quit.setEnabled(true);
+
+ ensure_tray();
+ if (s.tray_enabled)
+ hide();
}
MainWindow::~MainWindow()
@@ -406,3 +410,15 @@ void MainWindow::shortcutToggled()
if (work)
work->tracker->toggle_enabled();
}
+
+void MainWindow::ensure_tray()
+{
+ tray = nullptr;
+ if (s.tray_enabled)
+ {
+ tray = std::make_shared<QSystemTrayIcon>(this);
+ tray->setIcon(QIcon(":/images/facetracknoir.png"));
+ tray->show();
+ connect(tray.get(), SIGNAL(activated()), this, SLOT(show()));
+ }
+}
diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/ui.h
index 6e7ea4e0..9419936f 100644
--- a/facetracknoir/facetracknoir.h
+++ b/facetracknoir/ui.h
@@ -36,6 +36,7 @@
#include <QPixmap>
#include <QLabel>
#include <QTimer>
+#include <QSystemTrayIcon>
#if !defined(_WIN32)
# include "qxt-mini/QxtGlobalShortcut"
@@ -61,6 +62,7 @@ class MainWindow : public QMainWindow, private State
Q_OBJECT
Ui::OpentrackUI ui;
+ ptr<QSystemTrayIcon> tray;
QTimer pose_update_timer;
ptr<KeyboardShortcutDialog> shortcuts_widget;
ptr<MapWidget> mapping_widget;
@@ -88,6 +90,7 @@ class MainWindow : public QMainWindow, private State
void updateButtonState(bool running, bool inertialp);
void fill_profile_combobox();
void display_pose(const double* mapped, const double* raw);
+ void ensure_tray();
public slots:
void shortcutRecentered();
diff --git a/opentrack/main-settings.hpp b/opentrack/main-settings.hpp
index e41a23c9..83ec8968 100644
--- a/opentrack/main-settings.hpp
+++ b/opentrack/main-settings.hpp
@@ -27,6 +27,7 @@ struct main_settings {
value<QString> tracker_dll, tracker2_dll, filter_dll, protocol_dll;
axis_opts a_x, a_y, a_z, a_yaw, a_pitch, a_roll;
value<bool> tcomp_p, tcomp_tz;
+ value<bool> tray_enabled;
main_settings(pbundle b) :
b(b),
tracker_dll(b, "tracker-dll", ""),
@@ -40,6 +41,7 @@ struct main_settings {
a_pitch(b, "pitch", Pitch),
a_roll(b, "roll", Roll),
tcomp_p(b, "compensate-translation", true),
- tcomp_tz(b, "compensate-translation-disable-z-axis", false)
+ tcomp_tz(b, "compensate-translation-disable-z-axis", false),
+ tray_enabled(false, "use-system-tray", true)
{}
};