|  |  | @ -3,14 +3,10 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | #include <QPushButton> |  |  |  | #include <QPushButton> | 
			
		
	
		
		
			
				
					
					|  |  |  | #include <QGridLayout> |  |  |  | #include <QGridLayout> | 
			
		
	
		
		
			
				
					
					|  |  |  | #include <QVBoxLayout> |  |  |  | #include <QVBoxLayout> | 
			
		
	
		
		
			
				
					
					|  |  |  | #include <QDebug> |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | #include <QGuiApplication> |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | #include <QScreen> |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | #include <QApplication> |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | #include <QDesktopWidget> |  |  |  | #include <QDesktopWidget> | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | #include "onboarding.hpp" |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | #include "common/params.h" |  |  |  | #include "common/params.h" | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | #include "onboarding.hpp" | 
			
		
	
		
		
			
				
					
					|  |  |  | #include "home.hpp" |  |  |  | #include "home.hpp" | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -20,22 +16,20 @@ QLabel * title_label(QString text) { | 
			
		
	
		
		
			
				
					
					|  |  |  |   return l; |  |  |  |   return l; | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | QWidget* layout2Widget(QLayout* l){ |  |  |  | QWidget * layout2Widget(QLayout* l){ | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   QWidget* q = new QWidget; |  |  |  |   QWidget *q = new QWidget; | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |   q->setLayout(l); |  |  |  |   q->setLayout(l); | 
			
		
	
		
		
			
				
					
					|  |  |  |   return q; |  |  |  |   return q; | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | void TrainingGuide::mouseReleaseEvent(QMouseEvent *e) { |  |  |  | void TrainingGuide::mouseReleaseEvent(QMouseEvent *e) { | 
			
		
	
		
		
			
				
					
					|  |  |  |   int leftOffset = (geometry().width()-1620)/2; |  |  |  |   int leftOffset = (geometry().width()-1620)/2; | 
			
		
	
		
		
			
				
					
					|  |  |  |   int mousex = e->x()-leftOffset; |  |  |  |   int mousex = e->x()-leftOffset; | 
			
		
	
		
		
			
				
					
					|  |  |  |   int mousey = e->y(); |  |  |  |   int mousey = e->y(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   // Check for restart
 |  |  |  |   // Check for restart
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   if (currentIndex == numberOfFrames-1) { |  |  |  |   if (currentIndex == boundingBox.size()-1) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     if (1050 <= mousex && mousex <= 1500 && 773 <= mousey && mousey <= 954){ |  |  |  |     if (1050 <= mousex && mousex <= 1500 && 773 <= mousey && mousey <= 954){ | 
			
		
	
		
		
			
				
					
					|  |  |  |       slayout->setCurrentIndex(0); |  |  |  |       slayout->setCurrentIndex(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |       currentIndex = 0; |  |  |  |       currentIndex = 0; | 
			
		
	
	
		
		
			
				
					|  |  | @ -46,7 +40,7 @@ void TrainingGuide::mouseReleaseEvent(QMouseEvent *e) { | 
			
		
	
		
		
			
				
					
					|  |  |  |   if (boundingBox[currentIndex][0] <= mousex && mousex <= boundingBox[currentIndex][1] && boundingBox[currentIndex][2] <= mousey && mousey <= boundingBox[currentIndex][3]) { |  |  |  |   if (boundingBox[currentIndex][0] <= mousex && mousex <= boundingBox[currentIndex][1] && boundingBox[currentIndex][2] <= mousey && mousey <= boundingBox[currentIndex][3]) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     slayout->setCurrentIndex(++currentIndex); |  |  |  |     slayout->setCurrentIndex(++currentIndex); | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |   if (currentIndex >= numberOfFrames) { |  |  |  |   if (currentIndex >= boundingBox.size()) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     emit completedTraining(); |  |  |  |     emit completedTraining(); | 
			
		
	
		
		
			
				
					
					|  |  |  |     return; |  |  |  |     return; | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
	
		
		
			
				
					|  |  | @ -56,7 +50,7 @@ TrainingGuide::TrainingGuide(QWidget* parent) { | 
			
		
	
		
		
			
				
					
					|  |  |  |   QHBoxLayout* hlayout = new QHBoxLayout; |  |  |  |   QHBoxLayout* hlayout = new QHBoxLayout; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   slayout = new QStackedLayout(this); |  |  |  |   slayout = new QStackedLayout(this); | 
			
		
	
		
		
			
				
					
					|  |  |  |   for (int i = 0; i <= 14; i++) { |  |  |  |   for (int i = 0; i < boundingBox.size(); i++) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     QWidget* w = new QWidget; |  |  |  |     QWidget* w = new QWidget; | 
			
		
	
		
		
			
				
					
					|  |  |  |     w->setStyleSheet(".QWidget {background-image: url(../assets/training/step" + QString::number(i) + ".jpg);}"); |  |  |  |     w->setStyleSheet(".QWidget {background-image: url(../assets/training/step" + QString::number(i) + ".jpg);}"); | 
			
		
	
		
		
			
				
					
					|  |  |  |     w->setFixedSize(1620, 1080); |  |  |  |     w->setFixedSize(1620, 1080); | 
			
		
	
	
		
		
			
				
					|  |  | @ -90,7 +84,7 @@ QWidget* OnboardingWindow::terms_screen() { | 
			
		
	
		
		
			
				
					
					|  |  |  |   QPushButton *accept_btn = new QPushButton("Accept"); |  |  |  |   QPushButton *accept_btn = new QPushButton("Accept"); | 
			
		
	
		
		
			
				
					
					|  |  |  |   main_layout->addWidget(accept_btn, 2, 1); |  |  |  |   main_layout->addWidget(accept_btn, 2, 1); | 
			
		
	
		
		
			
				
					
					|  |  |  |   QObject::connect(accept_btn, &QPushButton::released, [=]() { |  |  |  |   QObject::connect(accept_btn, &QPushButton::released, [=]() { | 
			
		
	
		
		
			
				
					
					|  |  |  |     Params().write_db_value("HasAcceptedTerms", current_terms_version.toStdString()); |  |  |  |     Params().write_db_value("HasAcceptedTerms", current_terms_version); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     updateActiveScreen(); |  |  |  |     updateActiveScreen(); | 
			
		
	
		
		
			
				
					
					|  |  |  |   }); |  |  |  |   }); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -113,8 +107,8 @@ QWidget* OnboardingWindow::terms_screen() { | 
			
		
	
		
		
			
				
					
					|  |  |  | void OnboardingWindow::updateActiveScreen() { |  |  |  | void OnboardingWindow::updateActiveScreen() { | 
			
		
	
		
		
			
				
					
					|  |  |  |   Params params = Params(); |  |  |  |   Params params = Params(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   bool accepted_terms = params.get("HasAcceptedTerms", false).compare(current_terms_version.toStdString()) == 0; |  |  |  |   bool accepted_terms = params.get("HasAcceptedTerms", false).compare(current_terms_version) == 0; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   bool training_done = params.get("CompletedTrainingVersion", false).compare(current_training_version.toStdString()) == 0; |  |  |  |   bool training_done = params.get("CompletedTrainingVersion", false).compare(current_training_version) == 0; | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |   if (!accepted_terms) { |  |  |  |   if (!accepted_terms) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     setCurrentIndex(0); |  |  |  |     setCurrentIndex(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |   } else if (!training_done) { |  |  |  |   } else if (!training_done) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -126,11 +120,16 @@ void OnboardingWindow::updateActiveScreen() { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | OnboardingWindow::OnboardingWindow(QWidget *parent) : QStackedWidget(parent) { |  |  |  | OnboardingWindow::OnboardingWindow(QWidget *parent) : QStackedWidget(parent) { | 
			
		
	
		
		
			
				
					
					|  |  |  |   Params params = Params(); |  |  |  |   Params params = Params(); | 
			
		
	
		
		
			
				
					
					|  |  |  |   current_terms_version = QString::fromStdString(params.get("TermsVersion", false)); |  |  |  |   current_terms_version = params.get("TermsVersion", false); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   current_training_version = QString::fromStdString(params.get("TrainingVersion", false)); |  |  |  |   current_training_version = params.get("TrainingVersion", false); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   addWidget(terms_screen()); |  |  |  |   addWidget(terms_screen()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   TrainingGuide* tr = new TrainingGuide(this); |  |  |  |   TrainingGuide* tr = new TrainingGuide(this); | 
			
		
	
		
		
			
				
					
					|  |  |  |   connect(tr, &TrainingGuide::completedTraining, [=](){Params().write_db_value("CompletedTrainingVersion", current_training_version.toStdString()); updateActiveScreen();}); |  |  |  |   connect(tr, &TrainingGuide::completedTraining, [=](){ | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     Params().write_db_value("CompletedTrainingVersion", current_training_version); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     updateActiveScreen(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   }); | 
			
		
	
		
		
			
				
					
					|  |  |  |   addWidget(tr); |  |  |  |   addWidget(tr); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   setStyleSheet(R"( |  |  |  |   setStyleSheet(R"( | 
			
		
	
	
		
		
			
				
					|  |  | 
 |