From 09fdfc2df0ae38afb6314d734afe2d3d00d57671 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 14 Jul 2015 10:45:15 +0200 Subject: wizard now works --- facetracknoir/main.cpp | 12 ++ facetracknoir/trackhat-wizard.ui | 248 +++++++++++++++++++-------------------- facetracknoir/wizard.cpp | 22 +++- facetracknoir/wizard.h | 15 ++- 4 files changed, 164 insertions(+), 133 deletions(-) (limited to 'facetracknoir') diff --git a/facetracknoir/main.cpp b/facetracknoir/main.cpp index 326b40ec..eff35c0b 100644 --- a/facetracknoir/main.cpp +++ b/facetracknoir/main.cpp @@ -2,6 +2,7 @@ # include #endif +#include "wizard.h" #include "ui.h" #include "opentrack/options.hpp" using namespace options; @@ -60,6 +61,17 @@ int main(int argc, char** argv) QApplication::setAttribute(Qt::AA_X11InitThreads, true); QApplication app(argc, argv); + { + QSettings s(OPENTRACK_ORG); + if (!s.contains("wizard-run-once")) + { + s.setValue("wizard-run-once", true); + auto w = std::make_shared(); + w->show(); + app.exec(); + } + } + auto w = std::make_shared(); w->show(); diff --git a/facetracknoir/trackhat-wizard.ui b/facetracknoir/trackhat-wizard.ui index 7d5febaa..751c324f 100644 --- a/facetracknoir/trackhat-wizard.ui +++ b/facetracknoir/trackhat-wizard.ui @@ -1,168 +1,162 @@ - Form - + wizard + 0 0 - 718 - 488 + 500 + 360 - - New configuration wizard + + true - - - - - true - - - QWizard::AeroStyle - - - QWizard::NoCancelButton - - - - Introduction + + QWizard::AeroStyle + + + QWizard::NoCancelButton + + + + Introduction + + + + + + + + + This wizard helps you configure TrackHat hardware. Add a logo here. More placeholder text. - - + + + + + + + Camera setup + + + + + + Detected PS3 Eye camera. Setting it up now. A logo and some more placeholder text. - - - - - This wizard helps you configure TrackHat hardware. Add a logo here. More placeholder text. - - - - - - - Camera setup + + + + + QFrame::StyledPanel - + + QFrame::Raised + + - + - Detected PS3 Eye camera. Setting it up now. A logo and some more placeholder text. + Resolution and framerate - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - Resolution and framerate - - - - - - - - 640x480, 75 Hz - - - - - 640x480, 60 Hz - - - - - 320x240, 187 Hz - - - - - 320x240, 120 Hz - - - - - + + + + + 640x480, 75 Hz + + + + + 640x480, 60 Hz + + + + + 320x240, 189 Hz + + + + + 320x240, 120 Hz + + - + + + + + + Select a model + + + + + + Select one of TrackHat models. + + + + + + + QGroupBox { border: 0; } + - Select a model + - - - + + + - Select one of TrackHat models. + Cap, add a big logo - - - - QGroupBox { border: 0; } + + + + Clip, add a big logo - - + + true - - - - - Cap, add a big logo - - - - - - - Clip, add a big logo - - - - - - - Clip, left-handed - - - - - - - - - We're all done! - - - - + + - <html><head/><body><p>You can now use your new hardware and thanks for flying TrackHat.</p></body></html> + Clip, left-handed - - - + + + + + + We're all done! + + + + + + <html><head/><body><p>You can now use your new hardware and thanks for flying TrackHat.</p></body></html> + + + + + diff --git a/facetracknoir/wizard.cpp b/facetracknoir/wizard.cpp index 2ce81689..1c7ab5b3 100644 --- a/facetracknoir/wizard.cpp +++ b/facetracknoir/wizard.cpp @@ -1,6 +1,26 @@ #include "wizard.h" -Wizard::Wizard(QWidget* parent = nullptr) : QWizard(parent) +Wizard::Wizard() : QWizard(nullptr) { ui.setupUi(this); + connect(this, SIGNAL(accepted()), this, SLOT(set_data())); +} + +void Wizard::set_data() +{ + Model m; + + if (ui.clip_model->isChecked()) + m = ClipRight; + else if (ui.clip_model_left->isChecked()) + m = ClipLeft; + else // ui.cap_model + m = Cap; + + auto camera_mode = static_cast(ui.resolution_select->currentIndex()); + + settings_pt pt; + main_settings s; + + qDebug() << "wizard done" << "model" << m << "camera-mode" << camera_mode; } diff --git a/facetracknoir/wizard.h b/facetracknoir/wizard.h index 0dc4f9ea..08259bc1 100644 --- a/facetracknoir/wizard.h +++ b/facetracknoir/wizard.h @@ -5,17 +5,22 @@ #include "opentrack/mappings.hpp" #include "ui_trackhat-wizard.h" #include "ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h" +#include #include class Wizard : public QWizard { Q_OBJECT - Ui_Form ui; + settings_pt pt; main_settings s; + Ui_wizard ui; public: - Wizard(QWidget* parent); - enum Model { Hat, ClipRight, ClipLeft }; - int fps, res_x, res_y; - Model model; + Wizard(); + + enum Model { Cap, ClipRight, ClipLeft }; + enum { ClipRightX = 135, ClipLeftX = -135 }; + enum CameraMode { x640_480_75, x640_480_60, x320_240_189, x320_240_120 }; +private slots: + void set_data(); }; -- cgit v1.2.3