Example #1
0
void MainWindow::setAttempt(bool running)
{
	if (running == attemptRunningBool)
		return;
	// change state
	attemptRunningBool = running;
	if (attemptRunningBool)
	{
		MetroTypes metroPrep;
		if (exercise_->hasTryAudio())
			metroPrep = user_->getInfo().playbackMetro;
		else
			metroPrep = user_->getInfo().recordMetro;

		if (metroPrep == AUDIO)
			metro_->setAudio(true);
		else
			metro_->setAudio(false);
		if (metroPrep == INTRO)
			metro_->setBeatsLeft(4);
		else
			metro_->setBeatsLeft(-1);

		audio_->start();
		metro_->start();
		updateMain(RUNNING);
	}
	else
	{
		audio_->stop();
		metro_->stop();
		updateMain(PAUSED);
		analyze();
	}
}
Example #2
0
bool MainWindow::setupExercise()
{
	connect(exercise_, SIGNAL(updateMain(MainWindowStates)),
	        this, SLOT(updateMain(MainWindowStates)));
	attemptRunningBool = false;
	exercise_->setup(centralwidget);
	exercise_->setUserInfo(user_);
	setupBackend();
	setTempo(game_->getTempo());
	return true;
}
Example #3
0
void MainWindow::on_action_Close_User_triggered()
{
	if (exercise_ != NULL)
		if (exercise_->close())
		{
			delete exercise_;
			exercise_ = NULL;
			updateMain(NOTHING);
			if (user_->close())
				updateMain(NOTHING);
		}
}
Example #4
0
void EvBox::changeEV(int newValue)
{
    int stat = sender()->property("stat").toInt();
    poke().setEV(stat, newValue/4*4);
    updateEV(stat);
    updateMain();
}
Example #5
0
MainWindow::MainWindow()
{
	QString dataDir = QCoreApplication::applicationDirPath();
#ifdef Q_WS_MAC
	dataDir = dataDir.section('/', 0, -4);
	//dataDir = dataDir + "/Resources/data/";
	dataDir = dataDir + "/data/";
#else
	dataDir = dataDir + "/data/";
#endif

	user_ = new User();
	metro_ = new Metro(dataDir);
	game_ = new Game(dataDir);
	audio_ = new AudioBackend();
	connect(audio_, SIGNAL(setAttempt(bool)),
	        this, SLOT(setAttempt(bool)));

	exercise_ = NULL;

	createUi();

	readSettings();
	updateMain(NOTHING);
}
Example #6
0
void EvBox::changeEV(const QString &newValue)
{
    int stat = sender()->property("stat").toInt();
    poke().setEV(stat, std::max(std::min(newValue.toInt(), 252), 0));
    updateEV(stat);
    updateMain();
}
Example #7
0
std::unique_ptr<SymbolIndex> TestTU::index() const {
  auto AST = build();
  auto Idx = llvm::make_unique<FileIndex>(/*UseDex=*/true);
  Idx->updatePreamble(Filename, AST.getASTContext(), AST.getPreprocessorPtr(),
                      AST.getCanonicalIncludes());
  Idx->updateMain(Filename, AST);
  return std::move(Idx);
}
Example #8
0
MqsConfig::MqsConfig(QWidget *parent, Qt::WindowFlags flags)
	: QWidget(parent, flags)
{
	ui.setupUi(this);

	updateEncoders();
	updateChannels();
	updateResolutions();
    vector<string> suported_channels = ChannelManager::getSuportedPlugins();
	for(unsigned int i = 0; i < suported_channels.size(); ++i)
	{
		QAction* act = new QAction(suported_channels[i].c_str(), 0);
		add_channel_menu.addAction(act);
		connect(act, SIGNAL(triggered()), this, SLOT(onCreateChannel()));
	}

    QSqlRecord plugin_path_rec = settings->query("SELECT value as plugin_path FROM property WHERE name = 'plugin_path'").record();
    QSqlRecord screen_shot_path_rec = settings->query("SELECT value as screen_shot_path FROM property WHERE name = 'screen_shot_path'").record();
    ui.line_plugin_path->setText(plugin_path_rec.value("plugin_path").toString());
    ui.line_screen_shot_path->setText(screen_shot_path_rec.value("screen_shot_path").toString());

    QObject::connect(this, SIGNAL(updateMain(GUIUpdate)), parent, SLOT(updateMain(GUIUpdate)));

	QObject::connect(ui.button_add_channel, SIGNAL(clicked()), this, SLOT(onAddChannel()));
	QObject::connect(ui.button_edit_channel, SIGNAL(clicked()), this, SLOT(onEditChannel()));
	QObject::connect(ui.button_remove_channel, SIGNAL(clicked()), this, SLOT(onRemoveChannel()));

	QObject::connect(ui.button_add_encoder, SIGNAL(clicked()), this, SLOT(onAddEncoder()));
	QObject::connect(ui.button_edit_encoder, SIGNAL(clicked()), this, SLOT(onEditEncoder()));
	QObject::connect(ui.button_remove_encoder, SIGNAL(clicked()), this, SLOT(onRemoveEncoder()));

	QObject::connect(ui.list_resolutions, SIGNAL(itemChanged(QListWidgetItem *)), this, SLOT(onResolutionItemChanged(QListWidgetItem *)));
	QObject::connect(ui.button_clearall_resolutions, SIGNAL(clicked()), this, SLOT(onClearAllResolutions()));
	QObject::connect(ui.button_sellectall_resolutions, SIGNAL(clicked()), this, SLOT(onSellectAllResolutions()));
	QObject::connect(ui.button_loaddefaults_resolutions, SIGNAL(clicked()), this, SLOT(onLoadDefaultResolutions()));
	QObject::connect(ui.button_add_resolutions, SIGNAL(clicked()), this, SLOT(onAddResolutions()));
	QObject::connect(ui.button_remove_resolutions, SIGNAL(clicked()), this, SLOT(onRemoveResolutions()));
	QObject::connect(ui.button_edit_resolutions, SIGNAL(clicked()), this, SLOT(onEditResolutions()));
	QObject::connect(ui.line_screen_shot_path, SIGNAL(textChanged(const QString &)), this, SLOT(onEditScreenShotPath(const QString &)));
	QObject::connect(ui.line_plugin_path, SIGNAL(textChanged(const QString &)), this, SLOT(onEditPluginPath(const QString &)));
	QObject::connect(ui.select_plugins_dir, SIGNAL(clicked()), this, SLOT(onSelectPluginPath()));
	QObject::connect(ui.select_screenshot_dir, SIGNAL(clicked()), this, SLOT(onSelectScreenShotPath()));

	QObject::connect(ui.list_encoders, SIGNAL(currentTextChanged(const QString &)), this, SLOT(onEncoderSelect(const QString &)));
}
Example #9
0
void MqsConfig::onResolutionItemChanged(QListWidgetItem *resolution_item)
{
	unsigned int enabled = resolution_item->checkState() == Qt::Unchecked ? 0:1;
	QSqlRecord current_resolution = settings->query("SELECT value FROM property WHERE name = 'resolution'").record();
	ASSERT_WITH_CODE(current_resolution.value("value").toString() != resolution_item->text(), "Error! This resolution currently in use! Can't disable it!",  resolution_item->setCheckState(Qt::Checked); return);

	settings->query("UPDATE resolution SET enabled = %u WHERE name = '%s'", enabled, resolution_item->text().toStdString().c_str());
    emit updateMain(GUIUpdate::RESOLUTIONS);
}
Example #10
0
void MainWindow::on_action_Close_Exercise_triggered()
{
	if (exercise_ != NULL)
	{
		delete exercise_;
		exercise_ = NULL;
	}
	game_->reset();
	updateMain(USER);
}
Example #11
0
void MqsConfig::updateEncoders()
{
	ui.list_encoders->clear();
	QSqlQuery encoder_result = settings->query("SELECT name FROM encoder");
	do
	{
		QSqlRecord encoder = encoder_result.record();
		ui.list_encoders->addItem(new QListWidgetItem(QIcon(), encoder.value("name").toString()));
	}while(encoder_result.next());
    emit updateMain(GUIUpdate::BROADCASTS);
}
Example #12
0
void MqsConfig::updateChannels()
{
	ui.list_channel->clear();
	QSqlQuery channel_result = settings->query("SELECT name FROM channel");
	do
	{
		QSqlRecord channel = channel_result.record();
		ui.list_channel->addItem(channel.value("name").toString());
	}while(channel_result.next());
    emit updateMain(GUIUpdate::BROADCASTS);
}
Example #13
0
void MainWindow::on_action_User_Info_triggered()
{
	if (user_->setUserInfo())
	{
		// FIXME: doesn't work here for some reason?!?!
		QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
		if (exercise_ != NULL)
			exercise_->setUserInfo(user_);
		updateMain(UPDATE);
		QApplication::restoreOverrideCursor();
	}
}
Example #14
0
void MainWindow::analyze()
{
	if ( !exercise_->hasTryAudio() )
	{
		QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
		exercise_->setUserInfo(user_);
		if (exercise_->tryProcessAudio(audio_->getAudioData()))
		{
			updateMain(UPDATE);
		}
		QApplication::restoreOverrideCursor();
	}
}
Example #15
0
int		Menu::update(gdl::Input & input_)
{
  int		ret;
  
  if (input_.isKeyDown(gdl::Keys::Back) && this->which != 0)
    this->which = 0;
  if (this->which == 0)
    ret = updateMain(input_);
  else if (this->which == 1)
    ret = updateNew(input_);
  else if (this->which == 2)
    ret = updateLoad(input_);
  else if (this->which == 3)
    ret = updatePlayer(input_);
  return (ret);
}
Example #16
0
void MqsConfig::updateResolutions()
{
	ui.list_resolutions->clear();
	QSqlQuery result = settings->query(GET_RESOLUTION, GET_ALL);
	do
	{
		QSqlRecord resolution = result.record();

		QListWidgetItem *widgetitem_resolution = new QListWidgetItem(ui.list_resolutions);
		widgetitem_resolution->setText(resolution.value("name").toString());
		if(resolution.value("enabled").toBool())
			widgetitem_resolution->setCheckState(Qt::Checked);
		else
			widgetitem_resolution->setCheckState(Qt::Unchecked);
		ui.list_resolutions->addItem(widgetitem_resolution);
	}while(result.next());
    emit updateMain(GUIUpdate::RESOLUTIONS);
}
Example #17
0
void EvBox::updateAll()
{
    for (int i = 0; i < 6; i++) {
        updateEV(i);
    }

    updateMain();
    updateNatureButtons();

    if (poke().gen() <= 1) {
        ui->sdefboost->hide();
        ui->sdefdesc->hide();
        ui->sdefedit->hide();
        ui->sdeflabel->hide();
        ui->sdefslider->hide();
        ui->satkdesc->setText(tr("Special: "));
    } else {
        ui->sdefboost->show();
        ui->sdefdesc->show();
        ui->sdefedit->show();
        ui->sdeflabel->show();
        ui->sdefslider->show();
        ui->satkdesc->setText(tr("Special Attack: "));
    }

    if (poke().gen() <= 2) {
        ui->sdefslider->setDisabled(true);
        ui->sdefedit->setDisabled(true);

        for (int i = 0; i < 6; i++) {
            m_boosts[i]->setDisabled(true);
        }
    } else {
        ui->sdefslider->setDisabled(false);
        ui->sdefedit->setDisabled(false);

        for (int i = 0; i < 6; i++) {
            m_boosts[i]->setDisabled(false);
        }
    }
}
void MainWindow::updateMainOpt()
{
    int nb = m_bandsb->value();
    if (nb != settings.mainBand) {
        settings.mainBand = nb;
        m_hsi->band(settings.mainBand, m_mainval);
        updateMain();
    }

    int cr = m_radsb->value();
    if (cr != settings.curveRad) {
        settings.curveRad = cr;
        m_maincan->update();
    }

    int cw = m_widsb->value();
    if (cw != settings.curveWid) {
        settings.curveWid = cw;
        m_maincan->update();
    }
}
void MainWindow::open()
{
    QString fileName = QFileDialog::getOpenFileName(this,
            tr("Open File"), QDir::currentPath());
    if (!fileName.isEmpty()) {
        if (m_hsi)
            delete m_hsi;
        if (m_mainval)
            delete m_mainval;
        if (m_sectval)
            delete m_sectval;
        if (m_specval)
            delete m_specval;
        if (m_waveval)
                delete m_waveval;
        m_sectval = NULL;

        m_hsi = new HypSpecImage(fileName.toAscii().constData());
        m_mainval = new FloatImage(m_hsi->width(),  m_hsi->height(), 1);
        m_specval = new double[m_hsi->bands()];
        m_bandsb->setRange(1, m_hsi->bands());
        m_hsi->band(settings.mainBand, m_mainval);

        m_waveval = new double[m_hsi->bands()];
        for (int i = 0; i < m_hsi->bands(); i++)
            m_waveval[i] = i;

        m_points.clear();
        m_lines.clear();
        m_samples.clear();

        settings.defaults();
        updateMainOpt();
        updateSectOpt();
        clearPoints();
        updateSect();
        updateMain();
    }
}
Example #20
0
// User actions
void MainWindow::on_action_New_User_triggered()
{
	if (user_->newUser())
		updateMain(USER);
}
Example #21
0
TamyEditor::TamyEditor( QApplication& app, const char* fsRoot, QWidget *parent, Qt::WFlags flags )
   : QMainWindow( parent, flags )
   , m_app( app )
   , m_mainTime( new CTimer() )
   , m_resourcesBrowser( NULL )
   , m_activeProject( NULL )
   , m_activeProfilerView( NULL )
{
   ui.setupUi( this );
   setAutoFillBackground( true );

   setupResourcesManager( fsRoot );

   // add the resources browser
   {
      m_resourcesBrowser = new ResourcesBrowser( this );
      addDockWidget( Qt::LeftDockWidgetArea, m_resourcesBrowser );
   }

   // add the editors tabs
   {
      m_editorsTabs = new MainEditorPanel( ui.renderWindow, this );
      connect( m_editorsTabs, SIGNAL( onTabClosed( QWidget* ) ), this, SLOT( onEditorTabClosed( QWidget* ) ) );
      ui.renderWindow->layout()->addWidget( m_editorsTabs );
   }

   // create the timer
   m_mainTimeSlot = new QTimer( this );
   connect( m_mainTimeSlot, SIGNAL( timeout() ), this, SLOT( updateMain() ) );
   m_mainTimeSlot->start( 1 );

   // load the settings file
   m_editorSettings = new QSettings( ( std::string( fsRoot ) + "/Editor/Settings.ini" ).c_str(), QSettings::IniFormat );

   // create the main subsystems
   m_timeController = new TimeController();

   // associate resources with their respective editors
   associate< Model, SceneEditor >();
   associate< PixelShader, PixelShaderEditor >();
   associate< VertexShader, VertexShaderEditor >();
   associate< FragmentShader, FragmentShaderEditor >();
   associate< RenderingPipelineLayout, RenderingPipelineEditor >();
   associate< MaterialLayout, MaterialEditor >();
   associate< GeometryShaderLayout, GeometryShaderEditor >();
   associate< SkeletonAnimation, SkeletonAnimationEditor >();
   associate< Texture, TextureEditor >();
   associate< Project, ProjectEditor >();
   associate< MaterialInstance, MaterialInstanceEditor >();

   // setup menu contents
   {
      QAction* startProfilerAction = new QAction( "Profiler", ui.menuView );
      connect( startProfilerAction, SIGNAL( triggered() ), this, SLOT( startProfiler() ) );
      ui.menuView->addAction( startProfilerAction );
   }

   // setup the status bar
   {
      m_progressBar = new QProgressBar( ui.statusBar );
      m_progressBar->setMaximum(0);
      m_progressBar->setMinimum(0);
      m_progressBar->setValue(0);
      m_progressBar->setMaximumSize( 100, 10 );

      ui.statusBar->addWidget( m_progressBar );
   }
}
Example #22
0
void MainWindow::on_action_Open_User_triggered()
{
	if (user_->open())
		updateMain(USER);
}
Example #23
0
/*********************************************
		SDL event loop
**********************************************/
void App::utilEventLoop(){

	SDL_Event event;

    while ( !done ){
	   
	    while ( SDL_PollEvent( &event ) ){
	    
	    	//Hand the event off to the GUI first. If the GUI handles it, it's
	    	//done. 
#ifdef ENABLE_GUI
	    	if(processGUIEvent(event)){
	    		continue;
	    	}
#endif
	    
		    switch( event.type ){
						      
			case SDL_VIDEORESIZE:
			    //handle resize event
			    surface = SDL_SetVideoMode( event.resize.w, event.resize.h, 
			    							16, videoFlags );
			    if ( !surface ){
				    ERR( "Could not get a surface after resize: %s\n", 
				    	SDL_GetError( ) );
				    notifyShutdown();
				}
			    resizeWindow( event.resize.w, event.resize.h );
#ifdef ENABLE_GUI
			    resizeGUI( event.resize.w, event.resize.h );
#endif
			    break;
			
			case SDL_QUIT:
			    //handle quit requests
			    notifyShutdown();
			    break;
			
			case SDL_MOUSEBUTTONDOWN:
								
				if(mFlowMgr->onClick(event.button.button, 
									fMouseX, fMouseY, fMouseZ)){
					break;
				}			
				
				onMouseEvent(event.button.button, SDL_MOUSEBUTTONDOWN); 
				beginDrag();
												
				break;	
				
			case SDL_MOUSEBUTTONUP:
				onMouseEvent(event.button.button, SDL_MOUSEBUTTONUP); 
				endDrag();
				break;	
				
			case SDL_KEYDOWN:
				handleKeyEvent(&event.key.keysym, event.type);
				break;
			
			case SDL_KEYUP:
				handleKeyEvent(&event.key.keysym, event.type);
				break;
			
			default:
			    break;
			}
		}
		
	    if (!done){
	    
	    	//Do one frames worth of work and figure out the length of time
	    	uint32_t startTime = SDL_GetTicks();
			renderMain();
			updateMain();
			uint32_t endTime = SDL_GetTicks();
			
			//Figure out the scaling factor for FPS-independent movement
			uint32_t diff = endTime - startTime;
			
			if (iMaxFrameRate > 0 && diff < 1000 / iMaxFrameRate) {
				SDL_Delay((1000 / iMaxFrameRate) - diff);
				diff = 1000 / iMaxFrameRate;
			}
			
			fTimeScale = (float)diff * fTimeScaleScale;
			
			//Every hour, do a cleanup
			if(fCleanupTimer < 0.0f){
				ps()->doPeriodicCleanup();				
				fCleanupTimer = CLEANUP_TIMER;
			}
			
			//Update our various timers
			fCleanupTimer -= fTimeScale;
			fUptime += fTimeScale;
			fParticleFPS = fTimeScale;
		}
	}
	
}
Example #24
0
// Exercise actions
void MainWindow::on_action_Open_Game_triggered()
{
	if (openGame(true))
		updateMain(EXERCISE);
}
Example #25
0
void MainWindow::on_action_Open_Single_Exercise_triggered()
{
	if (openGame(false))
		updateMain(EXERCISE);
}
Example #26
0
void MainWindow::on_action_Next_Exercise_triggered()
{
	if (nextExercise())
		updateMain(EXERCISE);
}