summaryrefslogtreecommitdiffhomepage
path: root/facetracknoir
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-05-20 19:53:43 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-05-20 19:53:43 +0200
commit296c95ebe47b99d0127dd5131f0e3db18d434dd7 (patch)
treef396aee64a14b4f99c503dfa0c21f5cdc19021ca /facetracknoir
parente05f9e949faea2d03d39829c709a410ea0f8813f (diff)
main: simplify #161
Diffstat (limited to 'facetracknoir')
-rw-r--r--facetracknoir/main.cpp14
-rw-r--r--facetracknoir/ui.cpp14
-rw-r--r--facetracknoir/ui.h9
3 files changed, 16 insertions, 21 deletions
diff --git a/facetracknoir/main.cpp b/facetracknoir/main.cpp
index bbdfbc70..398f293a 100644
--- a/facetracknoir/main.cpp
+++ b/facetracknoir/main.cpp
@@ -1,4 +1,6 @@
#include "ui.h"
+#include "opentrack/options.hpp"
+using namespace options;
#include <QApplication>
#include <QCommandLineParser>
#include <QStyleFactory>
@@ -36,13 +38,17 @@ int main(int argc, char** argv)
p.addOption(autostartOption);
p.process(app);
- MainWindow w;
-
QString profile = p.value(autostartOption);
- if (! profile.isEmpty() )
+ if (!profile.isEmpty())
{
- w.open_and_run(profile);
+ QSettings settings(group::org);
+ settings.setValue(group::filename_key, MainWindow::remove_app_path(profile));
}
+
+ MainWindow w;
+
+ if (!profile.isEmpty())
+ w.startTracker();
w.show();
app.exec();
diff --git a/facetracknoir/ui.cpp b/facetracknoir/ui.cpp
index 071a4126..4c6c694c 100644
--- a/facetracknoir/ui.cpp
+++ b/facetracknoir/ui.cpp
@@ -212,19 +212,7 @@ void MainWindow::bindKeyboardShortcuts()
ensure_tray();
}
-void MainWindow::open_and_run(const QString &fileName) {
- if (! fileName.isEmpty() && QFileInfo(fileName).exists()) {
- {
- QSettings settings(group::org);
- settings.setValue(group::filename_key, remove_app_path(fileName));
- }
- fill_profile_combobox();
- load_settings();
- QTimer::singleShot(0, this, SLOT(startTracker()));
- }
-}
-
-void MainWindow::startTracker( ) {
+void MainWindow::startTracker() {
s.b->save();
load_settings();
bindKeyboardShortcuts();
diff --git a/facetracknoir/ui.h b/facetracknoir/ui.h
index 92be8071..aea4991d 100644
--- a/facetracknoir/ui.h
+++ b/facetracknoir/ui.h
@@ -95,13 +95,11 @@ class MainWindow : public QMainWindow, private State
void display_pose(const double* mapped, const double* raw);
void ensure_tray();
void set_working_directory();
- QString remove_app_path(const QString full_path);
public slots:
void shortcutRecentered();
void shortcutToggled();
void shortcutZeroed();
void bindKeyboardShortcuts();
- void open_and_run(const QString &profile);
private slots:
void open();
void save();
@@ -116,13 +114,16 @@ private slots:
void showCurveConfiguration();
void showHeadPose();
+ void restore_from_tray(QSystemTrayIcon::ActivationReason);
+
+public slots:
void startTracker();
void stopTracker();
-
- void restore_from_tray(QSystemTrayIcon::ActivationReason);
+
public:
MainWindow();
~MainWindow();
void save_mappings();
void load_mappings();
+ static QString remove_app_path(const QString full_path);
};