Ejemplo n.º 1
0
  QueueInterface::QueueStatus SgeQueueInterface::getStatus(Structure *s) const
  {
    // lock structure
    QWriteLocker locker (s->lock());
    QStringList queueData = getQueueList();
    unsigned int jobID = static_cast<unsigned int>(s->getJobID());

    // If the queueData cannot be fetched, queueData contains a single
    // string, "CommError"
    if (queueData.size() == 1 && queueData[0].compare("CommError") == 0) {
      return QueueInterface::CommunicationError;
    }

    // If jobID = 0 and structure is not in "Submitted" state, return an error.
    if (!jobID && s->getStatus() != Structure::Submitted) {
      return QueueInterface::Error;
    }

    // Determine status if structure is in the queue. queueData
    // entries are of the following format:
    //
    // job-ID prior name  user  state submit/start at queue   function
    // 231    0     hydra craig r     07/13/96        durin.q MASTER
    //                                20:27:15
    //
    // (Note that the whitespace has been condensed in the above)
    QString status;
    QStringList list;
    for (int i = 0; i < queueData.size(); i++) {
      list = queueData.at(i).split(QRegExp("\\s+"), QString::SkipEmptyParts);
      if (list[0].toUInt() == jobID) {
        status = list[4];
        continue;
      }
    }

    // If structure is submitted, check if it is in the queue. If not,
    // check if the completion file has been written.
    //
    // If the completion file exists, then the job finished before the
    // queue checks could see it, and the function will continue on to
    // the status checks below.
    //
    // If the structure in Submitted state
    if (s->getStatus() == Structure::Submitted) {
      // and the jobID isn't in the queue
      if (status.isEmpty()) {
        // check if the output file is absent
        bool exists;
        if (!m_opt->optimizer()->checkIfOutputFileExists(s, &exists)) {
          return QueueInterface::CommunicationError;
        }
        if (!exists) {
          // The job is still pending
          return QueueInterface::Pending;
        }
        else {
          // The job has completed.
          return QueueInterface::Started;
        }
      }
      else {
        // The job is in the queue
        return QueueInterface::Started;
      }
    }

    if (status.contains('r')) {
      return QueueInterface::Running;
    }
      else if (status.contains(QRegExp("q|w|s"))) {
      return QueueInterface::Queued;
    }
    else { // Entry is missing from queue. Were the output files written?
      locker.unlock();
      bool outputFileExists;
      if (!m_opt->optimizer()->checkIfOutputFileExists(s, &outputFileExists) ) {
          return QueueInterface::CommunicationError;
      }
      locker.relock();

      if (outputFileExists) {
        // Did the job finish successfully?
        bool success;
        if (!m_opt->optimizer()->checkForSuccessfulOutput(s, &success)) {
          return QueueInterface::CommunicationError;
        }
        if (success) {
          return QueueInterface::Success;
        }
        else {
          return QueueInterface::Error;
        }
      }
    }
    // Not in queue and no output?
    return QueueInterface::Unknown;
  }
Ejemplo n.º 2
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();
}