コード例 #1
0
ファイル: ProcessMonitor.C プロジェクト: bjnano/IQmol
// At this point the server is connected and tested, but we still need to check
// if the test was successful.  If it is, then we can go ahead with the setup
// which starts with obtaining the working directory.
void ProcessMonitor::submitJob1()
{
   if (!m_pendingProcess) {
      qDebug() << "ProcessMonitor::submitJob1() called with no pending process";
      return;
   }

   ServerTask::Base* task = qobject_cast<ServerTask::Base*>(sender());
   if (!task) {
      delete m_pendingProcess;
      m_pendingProcess = 0;
      return;
   }

   QString errorMessage(task->errorMessage());
   task->deleteLater();

   if (!errorMessage.isEmpty()) {
      QString msg("Problem submitting job:\n");
      msg += errorMessage;
      QMsgBox::warning(this, "IQmol", msg);
      delete m_pendingProcess;
      m_pendingProcess = 0;
      return;
   }

   postStatusMessage("Determining working directory...");
   Server* server = ServerRegistry::instance().get(m_pendingProcess->serverName());
   if (server->getWorkingDirectoryFromUser(m_pendingProcess)) {
      task = server->setup(m_pendingProcess);
      connect(task, SIGNAL(finished()), this, SLOT(submitJob2()));
      task->start();
   }else {
      delete m_pendingProcess;
      m_pendingProcess = 0;
   }
}