Ejemplo n.º 1
0
void QueueManager::readSettings()
{
  QDir queueDir(queueConfigDirectory());
  if (!queueDir.exists()) {
    Logger::logWarning(tr("Cannot read queue settings: Queue config "
                          "directory does not exist (%1)")
                     .arg(queueDir.absolutePath()));
    return;
  }

  foreach (const QString &queueFileName,
           queueDir.entryList(QStringList()<<"*.mqq", QDir::Files)) {
    QString absoluteFileName = queueDir.absoluteFilePath(queueFileName);
    QString queueName = QFileInfo(queueFileName).baseName();
    QString queueType = Queue::queueTypeFromFile(absoluteFileName);
    Queue *queue = addQueue(queueName, queueType, this);

    if (queue != NULL) {
      bool success = queue->readSettings(absoluteFileName);
      if (!success) {
        Logger::logError(tr("Cannot load queue '%1' with type '%2' from '%3'. "
                            "Improper configuration file.")
                         .arg(queueName, queueType, absoluteFileName));
        removeQueue(queue);
        queue = NULL;
      }
    }
    else {
      Logger::logError(tr("Cannot load queue '%1' with type '%2' from '%3'.")
                       .arg(queueName, queueType, absoluteFileName));
    }
  }
}
Ejemplo n.º 2
0
void showTree(Node *root)
{
	Queue *q = queueConstructor();
	addQueue(q,root);
	int i=0;
	while(q->head != NULL)
	{
		Node *node = removeQueue(q);
		List *iterator;
		if (strcmp(node->path,"/")) printf("%s/%s:\n",node->path,node->name);
		else						    printf("%s%s:\n",node->path,node->name);
		iterator = node->listDir;
		while(iterator != NULL)
		{
			printf("  %s \n", iterator->node->name);
			addQueue(q,iterator->node);
			iterator = iterator->next;	
		}
	
		iterator = node->listFile;
		while(iterator != NULL)
		{
			printf("  %s \n", iterator->node->name);
			iterator = iterator->next;	
		}
	}
}
Ejemplo n.º 3
0
void closeFiles(MDATA *q){
	MDATA *mBuffer;
	int i;
	for(i=0; i<sizeofQueue(q); i++){
		mBuffer = (MDATA *) removeQueue(q);
		fclose(mBuffer->fp);
	}
}
Ejemplo n.º 4
0
///////////////////////////////////////////////////////////////
// rerun is to do a rerun
// Takes the elements of the queue, if there is no more 
// work it breaks, if it is a copy event is calculates the
// degree puts it in the node and makes sure the node has 
// a child, and if it is a run event it runs the wake up 
// code
/////////////////////////////////////////////////////////////
cluster* rerun(Queue *q,tree_t* tree, int doSynch)
{
  cluster* root;
  node *nd = NULL;
  int curheight = -1;
  deprintf(" \n Rerunning \n"); 
  
  currentTree  = tree;
  currentQueue = q;
 
  morework=1;
  //debug=1;
  while (!isEmpty(q)) {  
    // Loop
    // Free the qnode 
    drun(assert(!isEmpty(q)));
    nd = removeQueue(q);
    
    if(!(nd->deleted)) {    
      //If it is the end of a round then check if all is done, otherwise continue, resetting
      //the morework flag
      if(nd->height != curheight)
	{
	  curheight = nd->height;
	  deprintf("Height is %d\n",curheight);
	  if(morework == 0) break;
	  morework = 0;
	  }
      deprintf("Running %d\n",nd->nId);
      runNode(nd,q);
      drun(assert(verifyVertex(nd)));
      
    }
  }//while
  
  // Empty the queue
  emptyQueue(q);
  if(PUSHDOWN)
    {
    deprintf("push down\n");
    pushDownList(&oldRootList);
    }
  if(doSynch) {
     root = syncList(&newRootList);
  }
  
  return root; 
 
  
}
Ejemplo n.º 5
0
void dumpEvents(MDATA *m, LogDATA *l, pthread_mutex_t *mut){
	MDATA *mBuffer;
	LogDATA *lBuffer;
	int i;
	long offset;
	for(i=0; i<sizeofQueue(m); i++){
		mBuffer = (MDATA *) removeQueue(m);
		if(exists(mBuffer->path)) {

			mBuffer->fp = fopen(mBuffer->path, "r");
			
			fseek(mBuffer->fp, 0, SEEK_END);
			offset = ftell(mBuffer->fp) - mBuffer->offset;
			if(offset){
				fseek(mBuffer->fp, -offset, SEEK_END);
				char * buffer = malloc (sizeof(char)*offset);
				fread(buffer, 1, offset, mBuffer->fp);
				mBuffer->offset = ftell(mBuffer->fp);
				if(buffer != NULL){
					//printf("Host: %s - ", mBuffer->host);
					//printf("Path: %s - ", mBuffer->path);
					//printf("Type: %s - ", mBuffer->sourcetype);
					//printf("Offset: %d\n", mBuffer->offset);
					//printf("%d\n", offset);
					//printf("%s", buffer);
					lBuffer = malloc(sizeof(LogDATA));

					lBuffer->host = mBuffer->host;

					lBuffer->path = mBuffer->path;

					lBuffer->sourcetype = mBuffer->sourcetype;

					lBuffer->readTime = time(NULL);
					//lBuffer->log = malloc(strlen(buffer)+1);
					//strcpy(lBuffer->log, buffer);

					lBuffer->log = buffer;

					insertQueue(&(*l), lBuffer);
				} 	
			}

			fclose(mBuffer->fp);
		}
		insertQueue(m, mBuffer);
	}
}
Ejemplo n.º 6
0
int main(void)
{
  QUEUE_t myQueue;
  STACK_t myStack;
  
  stack_init(&myStack);
  queue_init(&myQueue);
  
  for(int i = 0; i < 10; i++)
  {
    insertQueue(&myQueue,(void*) (rand() % 100));
    push(&myStack, (void*) (rand() % 50));
  }
  itemS_t* holdS = pop(&myStack);
  printf("Item popped: %d\n", holdS->keyValue);
  free(holdS);
  
  printf("Pushing 99...\n");
  push(&myStack, (void*) 99);
  holdS = pop(&myStack);
  printf("Item popped: %d", holdS->keyValue);
  free(holdS);
  
  
  printQueue(&myQueue);
  printStack(&myStack);
  
  itemQ_t* holdQ = removeQueue(&myQueue);
  
  printf("Item removed from queue: %d.\n", holdQ->keyValue);
  free(holdQ);
  
  printQueue(&myQueue);
  printStack(&myStack);
  
  clearQueue(&myQueue);
  clearStack(&myStack);
  
  
  return 0;
}
Ejemplo n.º 7
0
// decrementa quantum da proxima rodada e manda executar
void decreaseQuantumNext() {
	int id;
	float tempoRodada;

	id = removeQueue(); 
	
	// fila não estava vazia
	if (id != -1) { 

		// definimos tempo do run da rodada atual
		if (tabelaProcessos[id].dt >= quantum) {
			tempoRodada = quantum;	
		} 
		else if (tabelaProcessos[id].dt > 0) {
			tempoRodada = tabelaProcessos[id].dt;
		}
		else {
			tempoRodada = 0; // condição de parada
		}
		
		tabelaProcessos[id].tempoRodada = tempoRodada;
		tabelaProcessos[id].dt -= tempoRodada; // decrementa do total
		
		if (tabelaProcessos[id].tempoRodada > 0 && tempoDesdeInicio(inicio) < tabelaProcessos[id].deadline) {	
			insertOrderedByArrivedQueue(id);   // move o mesmo processo pro fim da fila, mesmo se dt == 0
			mudancaContexto++;
			sem_post(&semQueue); 
		}
		else {
			// deixa o processo removido e contabiliza qtos processos terminaram
			sem_wait(&mutexQueue);
			deadProc++;
			sem_post(&mutexQueue);
		}
		
		// sinaliza o processo que foi removido da fila pra rodar ou retomar execução
		sem_post(&semThread[id]); 
	}
}
Ejemplo n.º 8
0
bool QueueManager::removeQueue(const Queue *queue)
{
  return removeQueue(queue->name());
}
Ejemplo n.º 9
0
ConfigDialog::ConfigDialog( QWidget *parent )
            : Ui_ConfigDialog()
{
    (void)parent;

    setupUi( this );
    
    pageListWidget->item( 4 )->setHidden( true );
   
    connect( cfg_unityEnabled, SIGNAL( toggled( bool ) ), 
             this, SLOT( toggleUnity(bool)) );
    connect( cfg_externalEditorEnabled, SIGNAL( toggled( bool ) ), 
             this, SLOT( toggleUnityEditor( bool ) ) );
    connect( cfg_useIdleTimeout, SIGNAL( toggled( bool ) ),
             this, SLOT( toggleUnityTimeout( bool ) ) );
    connect( filemanagerButton, SIGNAL( pressed() ),
             this, SLOT( getFilemanagerCommand() ) );
             
    connect( editorCommandButton, SIGNAL( pressed() ), 
             this, SLOT( getExternalEditorFile() ) );
    connect( editorSaveLocationButton, SIGNAL( pressed() ), 
             this, SLOT( getEditorSaveLocation() ) );
    connect( downloadDirectoryButton, SIGNAL( pressed() ),
             this, SLOT( getDownloadDirectory() ) );
    connect( buttonBox, SIGNAL( accepted() ), 
             this, SLOT( writeSettings() ) );
    connect( buttonBox, SIGNAL( rejected() ), 
             this, SLOT( close() ) );
    connect( engineerAddButton, SIGNAL( pressed() ), 
             this, SLOT( addEngineer() ) );
    connect( engineerRemoveButton, SIGNAL( pressed() ), 
             this, SLOT( removeEngineer() ) );
    connect( engineerMoveUpButton, SIGNAL( pressed() ),
             this, SLOT( moveEngineerUp() ) );
    connect( engineerMoveDownButton, SIGNAL( pressed() ),
             this, SLOT( moveEngineerDown() ) );
    connect( queueAddButton, SIGNAL( pressed() ), 
             this, SLOT( addQueue() ) );
    connect( queueRemoveButton, SIGNAL( pressed() ), 
             this, SLOT( removeQueue() ) );
    connect( queueMoveUpButton, SIGNAL( pressed() ),
             this, SLOT( moveQueueUp() ) );
    connect( queueMoveDownButton, SIGNAL( pressed() ), 
             this, SLOT( moveQueueDown() ) );
    connect( generalNotificationSoundButton, SIGNAL( pressed() ),
             this, SLOT( getGeneralNotificationSoundFile() ) );
    connect( generalNotificationPlayButton, SIGNAL( pressed() ), 
             this, SLOT( playGeneralNotificationSound() ) );
    connect( newPersonalNotificationSoundButton, SIGNAL( pressed() ),
             this, SLOT( getNewPersonalNotificationSoundFile() ) );
    connect( newPersonalNotificationPlayButton, SIGNAL( pressed() ), 
             this, SLOT( playNewPersonalNotificationSound() ) );
    connect( updatePersonalNotificationSoundButton, SIGNAL( pressed() ), 
             this, SLOT( getUpdatePersonalNotificationSoundFile() ) );
    connect( updatePersonalNotificationPlayButton, SIGNAL( pressed() ), 
             this, SLOT( playUpdatePersonalNotificationSound() ) );
    connect( bomgarNotificationSoundButton, SIGNAL( pressed() ), 
             this, SLOT( getBomgarNotificationSoundFile() ) );
    connect( bomgarNotificationPlayButton, SIGNAL( pressed() ), 
             this, SLOT( playBomgarNotificationSound() ) );
    connect( lowNotificationSoundButton, SIGNAL( pressed() ), 
             this, SLOT( getLowNotificationSoundFile() ) );
    connect( lowNotificationPlayButton, SIGNAL( pressed() ), 
             this, SLOT( playLowNotificationSound() ) );
    connect( mediumNotificationSoundButton, SIGNAL( pressed() ),
             this, SLOT( getMediumNotificationSoundFile() ) );
    connect( mediumNotificationPlayButton, SIGNAL( pressed() ), 
             this, SLOT( playMediumNotificationSound() ) );
    connect( urgentNotificationSoundButton, SIGNAL( pressed() ),
             this, SLOT( getUrgentNotificationSoundFile() ) );
    connect( urgentNotificationPlayButton, SIGNAL( pressed() ),
             this, SLOT( playUrgentNotificationSound() ) );
    connect( highNotificationSoundButton, SIGNAL( pressed() ),
             this, SLOT( getHighNotificationSoundFile() ) );
    connect( highNotificationPlayButton, SIGNAL( pressed() ),
             this, SLOT( playHighNotificationSound() ) );
    connect( cfg_showSystemTray, SIGNAL( toggled( bool ) ), 
             this, SLOT( toggleSystemTray( bool ) ) );
    connect( cfg_monitorEnabled, SIGNAL( toggled( bool ) ),
             this, SLOT( toggleMonitor( bool ) ) );
    connect( cfg_qbossFeatures, SIGNAL( toggled( bool ) ),
             this, SLOT( toggleQboss( bool ) ) );
    connect( cfg_notificationsDisabled, SIGNAL( toggled( bool ) ), 
             this, SLOT( toggleNotifications( bool ) ) );
    
    connect( cfg_generalNotificationSound, SIGNAL( toggled( bool ) ), 
             cfg_generalNotificationSoundFile, SLOT( setEnabled( bool ) ) );
    connect( cfg_generalNotificationSound, SIGNAL( toggled( bool ) ), 
             generalNotificationSoundButton, SLOT( setEnabled( bool ) ) );
    connect( cfg_generalNotificationSound, SIGNAL( toggled( bool ) ),
             generalNotificationPlayButton, SLOT( setEnabled( bool ) ) );
    
    connect( cfg_newPersonalNotificationSound, SIGNAL( toggled( bool ) ),
             cfg_newPersonalNotificationSoundFile, SLOT( setEnabled( bool ) ) );
    connect( cfg_newPersonalNotificationSound, SIGNAL( toggled( bool ) ),
             newPersonalNotificationSoundButton, SLOT( setEnabled( bool ) ) );
    connect( cfg_newPersonalNotificationSound, SIGNAL( toggled( bool ) ),
             newPersonalNotificationPlayButton, SLOT( setEnabled( bool ) ) );

    connect( cfg_updatePersonalNotificationSound, SIGNAL( toggled( bool ) ),
             cfg_updatePersonalNotificationSoundFile, SLOT( setEnabled( bool ) ) );
    connect( cfg_updatePersonalNotificationSound, SIGNAL( toggled( bool ) ),
             updatePersonalNotificationSoundButton, SLOT( setEnabled( bool ) ) );
    connect( cfg_updatePersonalNotificationSound, SIGNAL( toggled( bool ) ), 
             updatePersonalNotificationPlayButton, SLOT( setEnabled( bool ) ) );
    
    connect( cfg_bomgarNotificationSound, SIGNAL( toggled( bool ) ),
             cfg_bomgarNotificationSoundFile, SLOT( setEnabled( bool ) ) );
    connect( cfg_bomgarNotificationSound, SIGNAL( toggled( bool ) ),
             bomgarNotificationSoundButton, SLOT( setEnabled( bool ) ) );
    connect( cfg_bomgarNotificationSound, SIGNAL( toggled( bool ) ), 
             bomgarNotificationPlayButton, SLOT( setEnabled( bool ) ) );
    
    connect( cfg_lowNotificationSound, SIGNAL( toggled( bool ) ),
             cfg_lowNotificationSoundFile, SLOT( setEnabled( bool ) ) );
    connect( cfg_lowNotificationSound, SIGNAL( toggled( bool ) ),
             lowNotificationSoundButton, SLOT( setEnabled( bool ) ) );
    connect( cfg_lowNotificationSound, SIGNAL( toggled( bool ) ), 
             lowNotificationPlayButton, SLOT( setEnabled( bool ) ) );
    
    connect( cfg_mediumNotificationSound, SIGNAL( toggled( bool ) ),
             cfg_mediumNotificationSoundFile, SLOT( setEnabled( bool ) ) );
    connect( cfg_mediumNotificationSound, SIGNAL( toggled( bool ) ),
             mediumNotificationSoundButton, SLOT( setEnabled( bool ) ) );
    connect( cfg_mediumNotificationSound, SIGNAL( toggled( bool ) ),
             mediumNotificationPlayButton, SLOT( setEnabled( bool ) ) );
    
    connect( cfg_urgentNotificationSound, SIGNAL( toggled( bool ) ),
             cfg_urgentNotificationSoundFile, SLOT( setEnabled( bool ) ) );
    connect( cfg_urgentNotificationSound, SIGNAL( toggled( bool ) ),
             urgentNotificationSoundButton, SLOT( setEnabled( bool ) ) );
    connect( cfg_urgentNotificationSound, SIGNAL( toggled( bool ) ),
             urgentNotificationPlayButton, SLOT( setEnabled( bool ) ) );
    
    connect( cfg_highNotificationSound, SIGNAL( toggled( bool ) ),
             cfg_highNotificationSoundFile, SLOT( setEnabled( bool ) ) );
    connect( cfg_highNotificationSound, SIGNAL( toggled( bool ) ),
             highNotificationSoundButton, SLOT( setEnabled( bool ) ) );
    connect( cfg_highNotificationSound, SIGNAL( toggled( bool ) ), 
             highNotificationPlayButton, SLOT( setEnabled( bool ) ) );
    
    cfg_dBServer->setText( Settings::dBServer() );
    cfg_engineer->setText( Settings::engineer() );
    
    cfg_showAppWindow->setChecked( Settings::showAppWindow() );
    cfg_showTabsAtTop->setChecked( Settings::showTabsAtTop() );
    cfg_showSystemTray->setChecked( Settings::showSystemTray() );
    cfg_animateQueue->setChecked( Settings::animateQueue() );
    cfg_animateQmon->setChecked( Settings::animateQmon() );
    cfg_leftMouseButton->setCurrentIndex( Settings::leftMouseButton() );
    cfg_middleMouseButton->setCurrentIndex( Settings::middleMouseButton() );
    cfg_rightMouseButton->setCurrentIndex( Settings::rightMouseButton() );
    
    cfg_monitorEnabled->setChecked( Settings::monitorEnabled() );
    cfg_queuesToMonitor->addItems( Settings::queuesToMonitor() );
    cfg_showEmptyQueues->setChecked( Settings::showEmptyQueues() );
    cfg_monitorPersonalBomgar->setChecked( Settings::monitorPersonalBomgar() );
    cfg_bomgarName->setText( Settings::bomgarName() );
    
    cfg_qbossFeatures->setChecked( Settings::qbossFeatures() );
    cfg_engineerList->addItems( Settings::engineerList() );
    
    cfg_statsEnabled->setChecked( Settings::statsEnabled() );
    
    cfg_unityEnabled->setChecked( Settings::unityEnabled() );
    cfg_otherFileManagerCommand->setText( Settings::otherFileManagerCommand() );
    cfg_showDownloadManager->setChecked( Settings::showDownloadManager() );
    
    cfg_unityPassword->setText( Settings::unityPassword() );
    cfg_useIdleTimeout->setChecked( Settings::useIdleTimeout() );
    cfg_idleTimeoutMinutes->setValue( Settings::idleTimeoutMinutes() );
    cfg_minimumFontSize->setValue( Settings::minimumFontSize() );
    cfg_defaultFontSize->setValue( Settings::defaultFontSize() );
    cfg_externalEditorEnabled->setChecked( Settings::externalEditorEnabled() );
    cfg_editorCommand->setText( Settings::editorCommand() );
    cfg_editorSaveLocation->setText( Settings::editorSaveLocation() );
    cfg_replyFormat->setChecked( Settings::replyFormatEnabled() );
    cfg_replyLinebreak->setValue( Settings::replyFormatLineBreak() );
    cfg_downloadDirectory->setText( Settings::downloadDirectory() );
    cfg_useSrDirectory->setChecked( Settings::useSrDirectory() );
    cfg_autoExtract->setChecked( Settings::autoExtract() );
    cfg_splitSupportconfig->setChecked( Settings::splitSC() );
    cfg_autoNSA->setChecked( Settings::autoNSA() );
    cfg_cleanupDownloadDirectory->setChecked( Settings::cleanupDownloadDirectory() );
        
    cfg_notificationsDisabled->setChecked( Settings::notificationsDisabled() );

    cfg_generalNotificationPopup->setChecked( Settings::generalNotificationPopup() );
    cfg_generalNotificationSound->setChecked( Settings::generalNotificationSound() );
    cfg_generalNotificationSoundFile->setText( Settings::generalNotificationSoundFile() );
    
    cfg_newPersonalNotificationPopup->setChecked( Settings::newPersonalNotificationPopup() );
    cfg_newPersonalNotificationSound->setChecked( Settings::newPersonalNotificationSound() );
    cfg_newPersonalNotificationSoundFile->setText( Settings::newPersonalNotificationSoundFile() );
    
    cfg_updatePersonalNotificationPopup->setChecked( Settings::updatePersonalNotificationPopup() );
    cfg_updatePersonalNotificationSound->setChecked( Settings::updatePersonalNotificationSound() );
    cfg_updatePersonalNotificationSoundFile->setText( Settings::updatePersonalNotificationSoundFile() );
    
    cfg_bomgarNotificationPopup->setChecked( Settings::bomgarNotificationPopup() );
    cfg_bomgarNotificationSound->setChecked( Settings::bomgarNotificationSound() );
    cfg_bomgarNotificationSoundFile->setText( Settings::bomgarNotificationSoundFile() );
    
    cfg_lowNotificationPopup->setChecked( Settings::lowNotificationPopup() );
    cfg_lowNotificationSound->setChecked( Settings::lowNotificationSound() );
    cfg_lowNotificationSoundFile->setText( Settings::lowNotificationSoundFile() );
    
    cfg_mediumNotificationPopup->setChecked( Settings::mediumNotificationPopup() );
    cfg_mediumNotificationSound->setChecked( Settings::mediumNotificationSound() );
    cfg_mediumNotificationSoundFile->setText( Settings::mediumNotificationSoundFile() );
    
    cfg_urgentNotificationPopup->setChecked( Settings::urgentNotificationPopup() );
    cfg_urgentNotificationSound->setChecked( Settings::urgentNotificationSound() );
    cfg_urgentNotificationSoundFile->setText( Settings::urgentNotificationSoundFile() );
    
    cfg_highNotificationPopup->setChecked( Settings::highNotificationPopup() );
    cfg_highNotificationSound->setChecked( Settings::highNotificationSound() );
    cfg_highNotificationSoundFile->setText( Settings::highNotificationSoundFile() );
    
    cfg_generalNotificationSoundFile->setEnabled( Settings::generalNotificationSound() );
    generalNotificationSoundButton->setEnabled( Settings::generalNotificationSound() );
    generalNotificationPlayButton->setEnabled( Settings::generalNotificationSound() );
    
    cfg_newPersonalNotificationSoundFile->setEnabled( Settings::newPersonalNotificationSound() );
    newPersonalNotificationSoundButton->setEnabled( Settings::newPersonalNotificationSound() );
    newPersonalNotificationPlayButton->setEnabled( Settings::newPersonalNotificationSound() );
    
    cfg_updatePersonalNotificationSoundFile->setEnabled( Settings::updatePersonalNotificationSound() );
    updatePersonalNotificationSoundButton->setEnabled( Settings::updatePersonalNotificationSound() );
    updatePersonalNotificationPlayButton->setEnabled( Settings::updatePersonalNotificationSound() );
    
    cfg_bomgarNotificationSoundFile->setEnabled( Settings::bomgarNotificationSound() );
    bomgarNotificationSoundButton->setEnabled( Settings::bomgarNotificationSound() );
    bomgarNotificationPlayButton->setEnabled( Settings::bomgarNotificationSound() );
    
    cfg_lowNotificationSoundFile->setEnabled( Settings::lowNotificationSound() );
    lowNotificationSoundButton->setEnabled( Settings::lowNotificationSound() );
    lowNotificationPlayButton->setEnabled( Settings::lowNotificationSound() );
    
    cfg_mediumNotificationSoundFile->setEnabled( Settings::mediumNotificationSound() );
    mediumNotificationSoundButton->setEnabled( Settings::mediumNotificationSound() );
    mediumNotificationPlayButton->setEnabled( Settings::mediumNotificationSound() );
    
//     cfg_urgentNotificationSoundFile->setEnabled( Settings::urgentNotificationSound() );
    urgentNotificationSoundButton->setEnabled( Settings::urgentNotificationSound() );
    urgentNotificationPlayButton->setEnabled( Settings::urgentNotificationSound() );
    
    cfg_highNotificationSoundFile->setEnabled( Settings::highNotificationSound() );
    highNotificationSoundButton->setEnabled( Settings::highNotificationSound() );
    highNotificationPlayButton->setEnabled( Settings::highNotificationSound() );
    
    toggleSystemTray( Settings::showSystemTray() );
    toggleMonitor( Settings::monitorEnabled() );
    toggleQboss( Settings::qbossFeatures() );
    toggleNotifications( Settings::notificationsDisabled() );
    toggleUnity( Settings::unityEnabled() );
        
    #ifndef USE_PHONON
        
        cfg_highNotificationSound->setVisible( false );
        cfg_highNotificationSoundFile->setVisible( false );
        highNotificationSoundButton->setVisible( false );
        highNotificationPlayButton->setVisible( false );
        
        cfg_urgentNotificationSound->setVisible( false );
        cfg_urgentNotificationSoundFile->setVisible( false );
        urgentNotificationSoundButton->setVisible( false );
        urgentNotificationPlayButton->setVisible( false );
        
        cfg_mediumNotificationSound->setVisible( false );
        cfg_mediumNotificationSoundFile->setVisible( false );
        mediumNotificationSoundButton->setVisible( false );
        mediumNotificationPlayButton->setVisible( false );
        
        cfg_lowNotificationSound->setVisible( false );
        cfg_lowNotificationSoundFile->setVisible( false );
        lowNotificationSoundButton->setVisible( false );
        lowNotificationPlayButton->setVisible( false );
        
        cfg_bomgarNotificationSound->setVisible( false );
        cfg_bomgarNotificationSoundFile->setVisible( false );
        bomgarNotificationSoundButton->setVisible( false );
        bomgarNotificationPlayButton->setVisible( false );
        
        cfg_updatePersonalNotificationSound->setVisible( false );
        cfg_updatePersonalNotificationSoundFile->setVisible( false );
        updatePersonalNotificationSoundButton->setVisible( false );
        updatePersonalNotificationPlayButton->setVisible( false );
        
        cfg_newPersonalNotificationSound->setVisible( false );
        cfg_newPersonalNotificationSoundFile->setVisible( false );
        newPersonalNotificationSoundButton->setVisible( false );
        newPersonalNotificationPlayButton->setVisible( false );
        
        cfg_generalNotificationSound->setVisible( false );
        cfg_generalNotificationSoundFile->setVisible( false );
        generalNotificationSoundButton->setVisible( false );
        generalNotificationPlayButton->setVisible( false );
        
    #endif
    
    getQueueList();
}
Ejemplo n.º 10
0
/*implements A* algorithm*/
tree astar(int x, int y, int d, int heuristic){
	char a = 'X';//X simbolize that no action was taken to get there
	tree t, t1, t2;
	char **mat1, **mat2;
	int i, j;
	int level;
	double f;
	queue_vector aux;
	int k;
	
	//copy the starting matrix
	mat1 = newMatrix();
	for(i = 0; i < n; i++){
		for(j = 0; j < m; j++)
			mat1[i][j] = w[i][j];
	}
	
	t1 = insertTree(NULL, d, x, y, mat1, a, 0);
	t = t1;
	
	//compute the f value according to the heuristic
	f = computeHeuristic(x, y, 0, heuristic);
	
	insertQueue(t1, f);
	
	while(n_queue > 0){
		//remove the first element of the queue
		removeQueue(&aux.t, &aux.f);
		t1 = aux.t;
		
		d = t1 -> dirt;
		mat1 = t1 -> mat;
		a = t1 -> action;
		x = t1 -> x;
		y = t1 -> y;
		level = t1 -> level;
		
		//increments the number of nodes expanded
		expanded++;
		
		//adds into the queue
		if(y != 0 && mat1[y-1][x] != '#'){
			mat2 = newMatrix();
			copyMatrix(mat1, mat2);
			
			a = mat1[y-1][x];
			
			mat2[y-1][x] = '@';
			mat2[y][x] = '_';
			
			if(a == '*')
				k = d-1;
			else
				k = d;
			
			if(checkDuplicate(t, mat2, hashFunction(x, y-1), k) == 0){
				//inserts in lowercase if there is dirt
				if(a == '*'){
					removeListDirt(x, y-1);
					t2 = insertTree(t1, d-1, x, y-1, mat2, 'n', level + 1);
					
					if(d-1 == 0)
						return t2;
				}
				else
					t2 = insertTree(t1, d, x, y-1, mat2, 'N', level + 1);
					
				t1 -> N = t2;
				
				//compute the f value according to the heuristic
				f = computeHeuristic(x, y-1, level+1, heuristic);
					
				insertQueue(t2, f);
				generated++;
			}
		}
			
		if(y != n - 1 && mat1[y+1][x] != '#'){
			mat2 = newMatrix();
			copyMatrix(mat1, mat2);
			
			a = mat1[y+1][x];
			
			mat2[y+1][x] = '@';
			mat2[y][x] = '_';
			
			if(a == '*')
				k = d-1;
			else
				k = d;
			
			if(checkDuplicate(t, mat2, hashFunction(x, y+1), k) == 0){
				//inserts in lowercase if there is dirt
				if(a == '*'){
					removeListDirt(x, y+1);
					t2 = insertTree(t1, d-1, x, y+1, mat2, 's', level + 1);
					
					if(d-1 == 0)
						return t2;
				}
				else
					t2 = insertTree(t1, d, x, y+1, mat2, 'S', level + 1);
				
				t1 -> S = t2;
				
				//compute the f value according to the heuristic
				f = computeHeuristic(x, y-1, level+1, heuristic);
				
				insertQueue(t2, f);
				generated++;
			}
		}
		
		if(x != 0 && mat1[y][x-1] != '#'){
			mat2 = newMatrix();
			copyMatrix(mat1, mat2);
			
			a = mat1[y][x-1];
			
			mat2[y][x-1] = '@';
			mat2[y][x] = '_';
			
			if(a == '*')
				k = d-1;
			else
				k = d;
			
			if(checkDuplicate(t, mat2, hashFunction(x - 1, y), k) == 0){
				//inserts in lowercase if there is dirt
				if(a == '*'){
					removeListDirt(x-1, y);
					t2 = insertTree(t1, d-1, x-1, y, mat2, 'w', level + 1);
					
					if(d-1 == 0)
						return t2;
				}
				else
					t2 = insertTree(t1, d, x-1, y, mat2, 'W', level + 1);
					
				t1 -> W = t2;
				
				//compute the f value according to the heuristic
				f = computeHeuristic(x, y-1, level+1, heuristic);
					
				insertQueue(t2, f);
				generated++;
			}
		}
		
		if(x != m - 1 && mat1[y][x+1] != '#'){
			mat2 = newMatrix();
			copyMatrix(mat1, mat2);
			
			a = mat1[y][x+1];
			
			mat2[y][x+1] = '@';
			mat2[y][x] = '_';
			
			if(a == '*')
				k = d-1;
			else
				k = d;
			
			if(checkDuplicate(t, mat2, hashFunction(x + 1, y), k) == 0){
				//inserts in lowercase if there is dirt
				if(a == '*'){
					removeListDirt(x+1, y);
					t2 = insertTree(t1, d-1, x+1, y, mat2, 'e', level + 1);
					
					if(d-1 == 0)
						return t2;
				}
				else
					t2 = insertTree(t1, d, x+1, y, mat2, 'E', level + 1);
					
				t1 -> E = t2;
				
				//compute the f value according to the heuristic
				f = computeHeuristic(x, y-1, level+1, heuristic);
				
				insertQueue(t2, f);
				generated++;
			}
		}
		
		orderQueue();
	}
	
	return NULL;
}
Ejemplo n.º 11
0
 ~FairQueue() {
     while(!mQueuesByKey.empty())
         removeQueue( mQueuesByKey.begin()->first );
 }
Ejemplo n.º 12
0
/* Code to empty the queue */
void emptyQueue(Queue* q)
{
  while(!isEmpty(q))
    removeQueue(q);
}