diff options
-rw-r--r-- | facetracknoir/main.cpp | 12 | ||||
-rw-r--r-- | facetracknoir/trackhat-wizard.ui | 248 | ||||
-rw-r--r-- | facetracknoir/wizard.cpp | 22 | ||||
-rw-r--r-- | facetracknoir/wizard.h | 15 |
4 files changed, 164 insertions, 133 deletions
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 <stdlib.h> #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<Wizard>(); + w->show(); + app.exec(); + } + } + auto w = std::make_shared<MainWindow>(); 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 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>Form</class> - <widget class="QWidget" name="Form"> + <class>wizard</class> + <widget class="QWizard" name="wizard"> <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>718</width> - <height>488</height> + <width>500</width> + <height>360</height> </rect> </property> - <property name="windowTitle"> - <string>New configuration wizard</string> + <property name="modal"> + <bool>true</bool> </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QWizard" name="wizard"> - <property name="modal"> - <bool>true</bool> - </property> - <property name="wizardStyle"> - <enum>QWizard::AeroStyle</enum> - </property> - <property name="options"> - <set>QWizard::NoCancelButton</set> - </property> - <widget class="QWizardPage" name="page_intro"> - <property name="title"> - <string>Introduction</string> + <property name="wizardStyle"> + <enum>QWizard::AeroStyle</enum> + </property> + <property name="options"> + <set>QWizard::NoCancelButton</set> + </property> + <widget class="QWizardPage" name="page_intro"> + <property name="title"> + <string>Introduction</string> + </property> + <property name="subTitle"> + <string/> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>This wizard helps you configure TrackHat hardware. Add a logo here. More placeholder text.</string> </property> - <property name="subTitle"> - <string/> + </widget> + </item> + </layout> + </widget> + <widget class="QWizardPage" name="page_camera"> + <property name="title"> + <string>Camera setup</string> + </property> + <layout class="QGridLayout" name="gridLayout_4"> + <item row="0" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Detected PS3 Eye camera. Setting it up now. A logo and some more placeholder text.</string> </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>This wizard helps you configure TrackHat hardware. Add a logo here. More placeholder text.</string> - </property> - </widget> - </item> - </layout> </widget> - <widget class="QWizardPage" name="page_camera"> - <property name="title"> - <string>Camera setup</string> + </item> + <item row="1" column="0"> + <widget class="QFrame" name="frame"> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> </property> - <layout class="QGridLayout" name="gridLayout_4"> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QGridLayout" name="gridLayout_3"> <item row="0" column="0"> - <widget class="QLabel" name="label_2"> + <widget class="QLabel" name="label_3"> <property name="text"> - <string>Detected PS3 Eye camera. Setting it up now. A logo and some more placeholder text.</string> + <string>Resolution and framerate</string> </property> </widget> </item> - <item row="1" column="0"> - <widget class="QFrame" name="frame"> - <property name="frameShape"> - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <layout class="QGridLayout" name="gridLayout_3"> - <item row="0" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Resolution and framerate</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="resolution_select"> - <item> - <property name="text"> - <string>640x480, 75 Hz</string> - </property> - </item> - <item> - <property name="text"> - <string>640x480, 60 Hz</string> - </property> - </item> - <item> - <property name="text"> - <string>320x240, 187 Hz</string> - </property> - </item> - <item> - <property name="text"> - <string>320x240, 120 Hz</string> - </property> - </item> - </widget> - </item> - </layout> + <item row="0" column="1"> + <widget class="QComboBox" name="resolution_select"> + <item> + <property name="text"> + <string>640x480, 75 Hz</string> + </property> + </item> + <item> + <property name="text"> + <string>640x480, 60 Hz</string> + </property> + </item> + <item> + <property name="text"> + <string>320x240, 189 Hz</string> + </property> + </item> + <item> + <property name="text"> + <string>320x240, 120 Hz</string> + </property> + </item> </widget> </item> </layout> </widget> - <widget class="QWizardPage" name="page_model"> + </item> + </layout> + </widget> + <widget class="QWizardPage" name="page_model"> + <property name="title"> + <string>Select a model</string> + </property> + <layout class="QGridLayout" name="gridLayout_6"> + <item row="0" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Select one of TrackHat models.</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QGroupBox" name="groupBox"> + <property name="styleSheet"> + <string notr="true">QGroupBox { border: 0; }</string> + </property> <property name="title"> - <string>Select a model</string> + <string/> </property> - <layout class="QGridLayout" name="gridLayout_6"> - <item row="0" column="0"> - <widget class="QLabel" name="label_5"> + <layout class="QGridLayout" name="gridLayout_5"> + <item row="2" column="0"> + <widget class="QRadioButton" name="cap_model"> <property name="text"> - <string>Select one of TrackHat models.</string> + <string>Cap, add a big logo</string> </property> </widget> </item> - <item row="1" column="0"> - <widget class="QGroupBox" name="groupBox"> - <property name="styleSheet"> - <string notr="true">QGroupBox { border: 0; }</string> + <item row="0" column="0"> + <widget class="QRadioButton" name="clip_model"> + <property name="text"> + <string>Clip, add a big logo</string> </property> - <property name="title"> - <string/> + <property name="checked"> + <bool>true</bool> </property> - <layout class="QGridLayout" name="gridLayout_5"> - <item row="2" column="0"> - <widget class="QRadioButton" name="cap_model"> - <property name="text"> - <string>Cap, add a big logo</string> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QRadioButton" name="clip_model"> - <property name="text"> - <string>Clip, add a big logo</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QRadioButton" name="clip_model_left"> - <property name="text"> - <string>Clip, left-handed</string> - </property> - </widget> - </item> - </layout> </widget> </item> - </layout> - </widget> - <widget class="QWizardPage" name="page_done"> - <property name="title"> - <string>We're all done!</string> - </property> - <layout class="QGridLayout" name="gridLayout_7"> - <item row="0" column="0"> - <widget class="QLabel" name="label_6"> + <item row="1" column="0"> + <widget class="QRadioButton" name="clip_model_left"> <property name="text"> - <string><html><head/><body><p>You can now use your new hardware and thanks for flying TrackHat.</p></body></html></string> + <string>Clip, left-handed</string> </property> </widget> </item> </layout> </widget> - </widget> - </item> - </layout> + </item> + </layout> + </widget> + <widget class="QWizardPage" name="page_done"> + <property name="title"> + <string>We're all done!</string> + </property> + <layout class="QGridLayout" name="gridLayout_7"> + <item row="0" column="0"> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string><html><head/><body><p>You can now use your new hardware and thanks for flying TrackHat.</p></body></html></string> + </property> + </widget> + </item> + </layout> + </widget> </widget> <resources/> <connections/> 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<CameraMode>(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 <QObject> #include <QWizard> 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(); }; |