| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -3,9 +3,9 @@ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include <iostream> | 
					 | 
					 | 
					 | 
					#include <iostream> | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include <QString> | 
					 | 
					 | 
					 | 
					#include <QString> | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					#include <QTransform> | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include <QGridLayout> | 
					 | 
					 | 
					 | 
					#include <QGridLayout> | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include <QApplication> | 
					 | 
					 | 
					 | 
					#include <QApplication> | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include <QDesktopWidget> | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include "spinner.hpp" | 
					 | 
					 | 
					 | 
					#include "spinner.hpp" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include "qt_window.hpp" | 
					 | 
					 | 
					 | 
					#include "qt_window.hpp" | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -15,19 +15,26 @@ Spinner::Spinner(QWidget *parent) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  main_layout->setSpacing(0); | 
					 | 
					 | 
					 | 
					  main_layout->setSpacing(0); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  main_layout->setContentsMargins(200, 200, 200, 200); | 
					 | 
					 | 
					 | 
					  main_layout->setContentsMargins(200, 200, 200, 200); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  const int img_size = 360; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  comma = new QLabel(); | 
					 | 
					 | 
					 | 
					  comma = new QLabel(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  comma->setPixmap(QPixmap("../assets/img_spinner_comma.png").scaled(img_size, img_size, Qt::KeepAspectRatio, Qt::SmoothTransformation)); | 
					 | 
					 | 
					 | 
					  comma->setPixmap(QPixmap("../assets/img_spinner_comma.png").scaled(spinner_size, Qt::KeepAspectRatio, Qt::SmoothTransformation)); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  comma->setFixedSize(img_size, img_size); | 
					 | 
					 | 
					 | 
					  comma->setFixedSize(spinner_size); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  main_layout->addWidget(comma, 0, 0, Qt::AlignHCenter | Qt::AlignVCenter); | 
					 | 
					 | 
					 | 
					  main_layout->addWidget(comma, 0, 0, Qt::AlignHCenter | Qt::AlignVCenter); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  track_img = QPixmap("../assets/img_spinner_track.png").scaled(img_size, img_size, Qt::KeepAspectRatio, Qt::SmoothTransformation); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  track = new QLabel(); | 
					 | 
					 | 
					 | 
					  track = new QLabel(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  track->setPixmap(track_img); | 
					 | 
					 | 
					 | 
					  track->setFixedSize(spinner_size); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  track->setFixedSize(img_size, img_size); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  main_layout->addWidget(track, 0, 0, Qt::AlignHCenter | Qt::AlignVCenter); | 
					 | 
					 | 
					 | 
					  main_layout->addWidget(track, 0, 0, Qt::AlignHCenter | Qt::AlignVCenter); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  // pre-compute all the track imgs. make this a gif instead?
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  track_idx = 0; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  QTransform transform; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  QPixmap track_img = QPixmap("../assets/img_spinner_track.png").scaled(spinner_size, Qt::KeepAspectRatio, Qt::SmoothTransformation); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  for (auto &img : track_imgs) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    QPixmap r = track_img.transformed(transform.rotate(360/spinner_fps), Qt::SmoothTransformation); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    int x = (r.width() - track->width()) / 2; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    int y = (r.height() - track->height()) / 2; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    img = r.copy(x, y, track->width(), track->height()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  text = new QLabel(); | 
					 | 
					 | 
					 | 
					  text = new QLabel(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  text->setVisible(false); | 
					 | 
					 | 
					 | 
					  text->setVisible(false); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  main_layout->addWidget(text, 1, 0, Qt::AlignHCenter); | 
					 | 
					 | 
					 | 
					  main_layout->addWidget(text, 1, 0, Qt::AlignHCenter); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -61,7 +68,7 @@ Spinner::Spinner(QWidget *parent) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  )"); | 
					 | 
					 | 
					 | 
					  )"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  rotate_timer = new QTimer(this); | 
					 | 
					 | 
					 | 
					  rotate_timer = new QTimer(this); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  rotate_timer->start(1000/30.); | 
					 | 
					 | 
					 | 
					  rotate_timer->start(1000./spinner_fps); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  QObject::connect(rotate_timer, SIGNAL(timeout()), this, SLOT(rotate())); | 
					 | 
					 | 
					 | 
					  QObject::connect(rotate_timer, SIGNAL(timeout()), this, SLOT(rotate())); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  notifier = new QSocketNotifier(fileno(stdin), QSocketNotifier::Read); | 
					 | 
					 | 
					 | 
					  notifier = new QSocketNotifier(fileno(stdin), QSocketNotifier::Read); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -69,12 +76,8 @@ Spinner::Spinner(QWidget *parent) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}; | 
					 | 
					 | 
					 | 
					}; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					void Spinner::rotate() { | 
					 | 
					 | 
					 | 
					void Spinner::rotate() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  transform.rotate(5); | 
					 | 
					 | 
					 | 
					  track_idx = (track_idx+1) % track_imgs.size(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					  track->setPixmap(track_imgs[track_idx]); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  QPixmap r = track_img.transformed(transform.rotate(5), Qt::SmoothTransformation); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  int x = (r.width() - track->width()) / 2; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  int y = (r.height() - track->height()) / 2; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  track->setPixmap(r.copy(x, y, track->width(), track->height())); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}; | 
					 | 
					 | 
					 | 
					}; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					void Spinner::update(int n) { | 
					 | 
					 | 
					 | 
					void Spinner::update(int n) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |