Ejemplo n.º 1
0
void VolumeIOHelper::loadURL(const std::string& url, VolumeReader* reader) {
    tgtAssert(reader, "null pointer passed");

    try {
        std::vector<VolumeURL> origins = reader->listVolumes(url);
        if (origins.size() > 1) { // if more than one volume listed at URL, show listing dialog
            tgtAssert(volumeListingDialog_, "no volumelistingdialog");
            volumeListingDialog_->setOrigins(origins, reader);
            volumeListingDialog_->show();
        }
        else if (origins.size() == 1) { // load single volume directly
            loadOrigin(origins.front(), reader);
        }
        else {
            LWARNING("No volumes found at URL '" << url << "'");
            QErrorMessage* errorMessageDialog = new QErrorMessage(VoreenApplicationQt::qtApp()->getMainWindow());
            errorMessageDialog->showMessage(QString::fromStdString("No volumes found at '" + url + "'"));
        }
    }
    catch (const tgt::FileException& e) {
        LWARNING(e.what());
        QErrorMessage* errorMessageDialog = new QErrorMessage(VoreenApplicationQt::qtApp()->getMainWindow());
        errorMessageDialog->showMessage(e.what());
    }
}
Ejemplo n.º 2
0
void MainWindow::on_actionQueue2_triggered()
{
    if(getRoot() == NULL)
    {
        QErrorMessage err;
        err.showMessage("Root does not exits");
        err.exec();
        return;
    }
    space * wp = (space*)getRoot();
    if(wp->sublvl == NULL)
    {
        QErrorMessage err;
        err.showMessage("Stars does not exits");
        err.exec();
        return;
    }
    star ** st = (star**)wp->sublvl;
    int count_star = wp->sublvl_count;
    star * max = st[0];
    QString result = "Biggest star:";
    for(int i = 1;i < count_star;i++)
    {
        if(st[i]->sublvl_count > max->sublvl_count)
        {
            max = st[i];
        }else if(st[i]->sublvl_count == max->sublvl_count){
            if(st[i]->mass > max->mass){
                max = st[i];
            }
        }
    }
    result += " " + QString::fromStdString(max->name);
    QMessageBox::about(this,"Found data",result);
}
Ejemplo n.º 3
0
void VolumeIOHelper::loadOrigin(const VolumeURL& origin, VolumeReader* reader) {
    tgtAssert(reader, "null pointer passed");

    try {
        VolumeBase* handle = reader->read(origin);
        if (handle) {
            handle->getOrigin().addSearchParameter("preferredReader", reader->getClassName());
            emit(volumeLoaded(handle));
        }
        else {
            LERROR("Reader '" << reader->getClassName() << "' returned null pointer as volume (exception expected)");
        }
    }
    catch (const tgt::FileException& e) {
        LERROR(e.what());
        QErrorMessage* errorMessageDialog = new QErrorMessage(VoreenApplicationQt::qtApp()->getMainWindow());
        errorMessageDialog->showMessage(e.what());
    }
    catch (std::bad_alloc&) {
        LERROR("bad allocation while reading file: " << origin.getURL());
        QErrorMessage* errorMessageDialog = new QErrorMessage(VoreenApplicationQt::qtApp()->getMainWindow());
        errorMessageDialog->showMessage("Bad allocation while reading file: " + QString::fromStdString(origin.getURL()));
    }
    catch (std::exception& e) {
        LERROR("unknown exception while reading file '" << origin.getURL() << "':" << e.what());
        QErrorMessage* errorMessageDialog = new QErrorMessage(VoreenApplicationQt::qtApp()->getMainWindow());
        errorMessageDialog->showMessage("Unknown exception while reading file '" +
            QString::fromStdString(origin.getURL()) + "': " + e.what());
    }

}
void CParticleSystemPage::setPresetBehaviour(int index)
{
    updateLifeMgtPresets();
    if (index == _Node->getPSPointer()->getBehaviourType()) return;
    if (index == NL3D::CParticleSystem::SpellFX ||
            index == NL3D::CParticleSystem::SpawnedEnvironmentFX)
    {
        NL3D::CPSLocatedBindable *lb;
        if (!_Node->getPSPointer()->canFinish(&lb))
        {
            _ui.presetBehaviourComboBox->setCurrentIndex(_Node->getPSPointer()->getBehaviourType());
            QErrorMessage *errorMessage = new QErrorMessage();
            errorMessage->setModal(true);
            if (!lb)
            {
                errorMessage->showMessage(tr("Can't perform operation : the system is flagged with 'No max nb steps' or uses the preset 'Spell FX', "
                                             "and thus, should have a finite duration. Please remove that flag first."));
                errorMessage->exec();
            }
            else
            {
                errorMessage->showMessage(tr("The system must have a finite duration for this setting! Please check that the following object "
                                             "doesn't live forever or doesn't create a loop in the system :") + QString(lb->getName().c_str()));
                errorMessage->exec();
            }
            delete errorMessage;
            return;
        }
    }
    _Node->getPSPointer()->activatePresetBehaviour((NL3D::CParticleSystem::TPresetBehaviour) index);
    updateLifeMgtPresets();
    updateModifiedFlag();
}
Ejemplo n.º 5
0
//Function (slot) to read vtk image data
void Application::openvtkclicked()
{
	QString temp = QFileDialog::getOpenFileName(this, tr("Open VTK Data File"),"",tr("VTK Data (*.vtk)"));
	QFile data(temp);
	QString line;
	QTextStream in(&data);
	in.setCodec("UTF-8");
	if (data.open(QFile::ReadOnly)) 
	{
		line = in.readLine();
		if(line.contains("vtk") == true)
		{
			do 
			{
				line = in.readLine();
				if(line.contains("DATASET") == true)
				{
					//call for slicers
					if(line.contains("STRUCTURED_POINTS") == true)//if dataset is compatible
					{
						dataset = line;
						currentfile = temp;
						viewstructuredpointslices();		//calls this function to display slices along axes
						showisotog();						//generates isosurface in case, isosurfacing is true
						Enableall();
					}
					else
					{
						setStatusTip("Unsupported or Invalid Dataset!!");
						QErrorMessage errmsg;
						errmsg.showMessage(tr("Unsupported or Invalid Dataset!!"));
						errmsg.setWindowIcon(QIcon(":/ICONS/Head.jpg"));
						errmsg.exec();
					}
					break;
				}
			} while (!line.isNull());
		}
		else
		{
			this->setStatusTip("Invalid VTK file or file corrupt!!");
			QErrorMessage errmsg;
			errmsg.showMessage(tr("Invalid VTK file or file corrupt!!"));
			errmsg.setWindowIcon(QIcon(":/ICONS/Head.jpg"));
			errmsg.exec();
		}
		data.close();
	}
	else
		this->setStatusTip("File Opening Failed!!");
}
Ejemplo n.º 6
0
bool mainWindow::ifErrorsEvaluate(std::pair< int, unsigned int > msg)
{
    QString output;
    switch(msg.first)
    {
	case newParser::FILE_OK:
	    return false;
	case newParser::ERR_1ENTRY_PER_LINE:
	    output = tr("File is wrong!\nLine %1 has 1 entry when it needs two.").arg(msg.second);
	    break;
	case newParser::ERR_3PLUS_ENTRES_PER_LINE:
	    output = tr("File is wrong!\nLine %1 has 3+ entries when it needs two.").arg(msg.second);
	    break;
	case newParser::ERR_MILLIS_SHRUNK:
	    output.reserve(97);
	    output = tr("File is wrong!\nLine %1 shows that the data went back in time\n").arg(msg.second);
	    output += tr("When this never should have happened\n");
	    break;
	case newParser::ERR_TOXIC_CHARACTER:
	    output = tr("File data is wrong!\nLine %1 has a non-number character\n(Use 0-9 (no '-'))").arg(msg.second);
	    break;
	case newParser::FILE_EMPTY:
	    output = tr("The given file was empty");
	    break;
	default:
	    output = tr("Unspecified error in file");
	    break;
    }
    QErrorMessage* out = new QErrorMessage(this);
    out->showMessage(output);
    return true;

    
}
Ejemplo n.º 7
0
void NuevoCandidato::terminarCreacion()
{
        QString nombreTemporal;
        QString partidoTemporal;

        nombreTemporal = nombreCandidatoEdit->text();
        partidoTemporal = nombrePartidoEdit->text();

        if((nombreTemporal.isEmpty()) || (partidoTemporal.isEmpty()) || (imagen.isEmpty()))
        {
                QErrorMessage *error = new QErrorMessage();
                error->showMessage("Faltan datos!");
                return;
        }
        else
        {
            this->nombre = nombreTemporal;
            this->partido = partidoTemporal;
            this->guardarCandidato();
            QMessageBox exito;
            exito.setText("candidato añadido satisfactoriamente");
            exito.setWindowTitle ( tr("Confirmacion") );
            exito.exec();
            this->hide();
            this->ventanaAnterior->repaint();
            this->ventanaAnterior->show();
            return;
        }
}
Ejemplo n.º 8
0
void Login::error(QString title, QString messages)
{
    QErrorMessage *message = new QErrorMessage(this);
    message->setWindowTitle(title);
    message->showMessage(messages);
    return;
}
Ejemplo n.º 9
0
void cChatsView::chatroom_status(QString id, bool status, QString reason)
{
    qDebug() << "[INFO]cChatsView::chatroom_status-> id:" << id  << "status" << status;
  if (status)
  {
      for(int i = 0 ; i < m_chats.count() ; i++)
      {//Si ya le hemos creado no hacemos nada
          if (m_chats[i]->get_chatId() ==id)
          {
            qDebug() << "[INFO]cChatsView::chatroom_status-> ya le he creado!:" << m_chats[i]->get_chatId()  << "/" << id;
            return;
          }
      }
      cChatView* chat = new cChatView(m_pClient,id,id,this);
      m_chats.append(chat);
      ui->tabWidget->addTab(chat,id);
  }
  else
  {
      QErrorMessage errorMessage;
      QString msg("No se ha podido conectar al chat:");
      msg.append(id);
      msg.append(" Reason:");
      msg.append(reason);
      errorMessage.showMessage(msg);
      errorMessage.exec();
  }
}
Ejemplo n.º 10
0
void MainWindow::volumeReconstruction()
{

	std::cout<<"VOLUME RECONSTRUCTION"<<std::endl<<std::endl;
    if (!displayWidget->getVolumeImageStack().empty())
      {
       VolumeReconstructionWidget * volumeReconstruction = new VolumeReconstructionWidget();
		
		if (displayWidget->isVolumeImageStackLoaded){
           volumeReconstruction->setVolumeImageStack(displayWidget->getVolumeImageStack());
		   volumeReconstruction->setTransformStack(displayWidget->getTransformStack());
		}

        volumeReconstruction->setMainWindow(this);
        volumeReconstruction->show();
      }
    else
      {
        QErrorMessage errorMessage;
        errorMessage.showMessage(
            "No volume data loaded, </ br> please data before reconstruct the volume");
        errorMessage.exec();
      }
	
}
Ejemplo n.º 11
0
void MainWindow::checkCalibrationError()
{

	std::cout<<"Check Calibration Error"<<std::endl<<std::endl;

	if (!displayWidget->getImageStack().empty())
    {
      CheckCalibrationErrorWidget* checkCalibrationWidget = new CheckCalibrationErrorWidget();

      if (displayWidget->isImageStackLoaded)
        checkCalibrationWidget->setImageStack(displayWidget->getImageStack());
      else
        checkCalibrationWidget->setImage(displayWidget->getImageViewer()->GetInput());

	    displayWidget->setCalibrationErrorWidget(checkCalibrationWidget);
	  	displayWidget->setProbeFlag(false);
		displayWidget->startTracer();
	  
      checkCalibrationWidget->setMainWindow(this); 
      checkCalibrationWidget->show();
    }
  else
    {
      QErrorMessage errorMessage;
      errorMessage.showMessage(
		  "No images loaded, </ br> please load an images before checking the calibration");
      errorMessage.exec();
    }
}
Ejemplo n.º 12
0
void MainWindow::probeCalibration()
{

	std::cout<<"Probe Calibration"<<std::endl;

	if (!displayWidget->getImageStack().empty())
    {
      ProbeCalibrationWidget* probeCalibration = new ProbeCalibrationWidget();

      if (displayWidget->isImageStackLoaded)
        probeCalibration->setImageStack(displayWidget->getImageStack());
      else
        probeCalibration->setImage(displayWidget->getImageViewer()->GetInput());

	  displayWidget->setProbeFlag(true);
      // get left mouse pressed with high priority
      Connections->Connect(displayWidget->getQVTKWidget()->GetRenderWindow()->GetInteractor(),
                           vtkCommand::LeftButtonPressEvent,
                           probeCalibration,
                           SLOT(getCoordinates()));

      probeCalibration->setMainWindow(this);
      probeCalibration->show();
    }
  else
    {
      QErrorMessage errorMessage;
      errorMessage.showMessage(
		  "No images loaded, </ br> please load an images before calibrate the probe");
      errorMessage.exec();
    }
}
Ejemplo n.º 13
0
void ImageWidget::openWithVTK()
{
	QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), QDir::currentPath());
    
	if (!fileName.isEmpty()) {
		/* 		
		// This code is currently not used because the file is read with vtkImageReader2

		// Obtain image information
		this->setImageProperties(fileName.toAscii().data(), true);

		// set itk image depending on the image type 
		// if image type is grayscale
		if (imageType.compare("scalar") == 0) {
			// read the image
			typedef itk::ImageFileReader <ImageType> ReaderType;
			ReaderType::Pointer reader = ReaderType::New();
			reader->SetFileName(fileName.toAscii().data());
			reader->Update();

			// set the image data provided by the reader
			itkImage = reader->GetOutput();

		} else {
			// if the image is RGB
			typedef itk::ImageFileReader <RGBImageType> ReaderType;
			ReaderType::Pointer reader = ReaderType::New();
			reader->SetFileName(fileName.toAscii().data());
			reader->Update();

			// set the image data provided by the reader
			rgbItkImage = reader->GetOutput();
		}
		*/
		// reads a vtkImage for display purposes
		vtkSmartPointer <vtkImageReader2Factory> readerFactory =
			vtkSmartPointer <vtkImageReader2Factory>::New();
		vtkSmartPointer <vtkImageReader2> reader =
			readerFactory->CreateImageReader2(fileName.toAscii().data());

		reader->SetFileName(fileName.toAscii().data());
		reader->Update();

		vtkImage = reader->GetOutput();

        this->isFlipped = true;
		this->displayImage(vtkImage);


		readerFactory = NULL;
		reader = NULL;

	} else {
		QErrorMessage errorMessage;
		errorMessage.showMessage("No file specified for loading");
		errorMessage.exec();
		return;
	}
}
void JobEditorWindow::open()
{
    try {
        QString fileName = QFileDialog::getOpenFileName(this, tr("Open Job"), "", tr("Job (*.job)"));
        if ( fileName != NULL ) {
            openJob(rsString(fileName.toUtf8().data()));
        }
    } catch (const exception& e) {
    	QErrorMessage errorMessage;
    	errorMessage.showMessage(e.what());
    	errorMessage.exec();        
    } catch (...) {
    	QErrorMessage errorMessage;
    	errorMessage.showMessage("Unknown error while opening the job file");
    	errorMessage.exec();
    }
}
Ejemplo n.º 15
0
void SendEmail::errorMessage(const QString &message)
{
    QErrorMessage err (this);

    err.showMessage(message);

    err.exec();
}
Ejemplo n.º 16
0
void ElementsWindow::newElement() {
	bool accepted;
	QString name = QInputDialog::getText(this, tr("New element"),
		tr("Enter a name for the new element:"), QLineEdit::Normal, QString(""), &accepted);

	if (accepted) {
		QRegExpValidator validator(g_nameRegex);
		int pos = 0;
		if (validator.validate(name, pos) != QValidator::Acceptable) {
			QMessageBox::critical(this, "Not a valid name", "A name should contain a maximum of 25 alphanumeric characters and spaces.");
			newElement();
			return;
		}

		if (name == QString()) {
			QErrorMessage *errorDialog = QErrorMessage::qtHandler();
			errorDialog->showMessage("An element should not have an empty name.");
			newElement();
			return;
		}

		if (!!_properties->getElements()->getElement(name)) {
			QErrorMessage *errorDialog = QErrorMessage::qtHandler();
			errorDialog->showMessage("An element with the same name already exists.");
			newElement();
			return;
		}

		Element *newElement = Element::create(name);

		try {
			_properties->getElements()->addElement(newElement);
		} catch (ProjectException &e) {
			QMessageBox::critical(this, tr("An unexpected error occurred"), e.what());
			delete newElement;
			return;
		}

		_elementsList->addItem(name);
		_elementsList->setCurrentRow(_elementsList->count() -1);
		emit updateSignal();
	}
}
Ejemplo n.º 17
0
void VolumeIOHelper::saveVolumeToPath(const VolumeBase* volume, VolumeWriter* writer, const std::string& filepath) {
    tgtAssert(volume, "null pointer passed");
    tgtAssert(writer, "null pointer passed");

    try {
        writer->write(filepath, volume);
        emit(volumeSaved(volume, filepath));
    }
    catch (const tgt::FileException& e) {
        LERROR(e.what());
        QErrorMessage* errorMessageDialog = new QErrorMessage(VoreenApplicationQt::qtApp()->getMainWindow());
        errorMessageDialog->showMessage(e.what());
    }
    catch (std::exception& e) {
        LERROR("unknown exception while writing file '" << filepath << "':" << e.what());
        QErrorMessage* errorMessageDialog = new QErrorMessage(VoreenApplicationQt::qtApp()->getMainWindow());
        errorMessageDialog->showMessage("Unknown exception while writing file '" +
            QString::fromStdString(filepath) + "': " + e.what());
    }
}
Ejemplo n.º 18
0
void MyGL::slot_symEdgeButtonPressed() {
    if (edgeSelection != nullptr) {
        if (edgeSelection->sym != nullptr) {
            edgeSelection = edgeSelection->sym;
        } else {
            QErrorMessage* errorMessageDialog = new QErrorMessage(this);
            errorMessageDialog->setWindowTitle(QString("Error: No sym found!"));
            errorMessageDialog->showMessage(QString("This Half-Edge has no symmetrical edge value"));
        }
    }
}
Ejemplo n.º 19
0
void MyGL::slot_nextEdgeButtonPressed() {
    if (edgeSelection != nullptr) {
        if (edgeSelection->next != nullptr) {
            edgeSelection = edgeSelection->next; //The selection in the widget doesn't update 504
        } else {
            QErrorMessage* errorMessageDialog = new QErrorMessage(this);
            errorMessageDialog->setWindowTitle(QString("Error: No next found!"));
            errorMessageDialog->showMessage(QString("This Half-Edge has no next edge value"));
        }
    }
}
JobEditorWindow::JobEditorWindow(QMainWindow *parent) : QMainWindow(parent)
{
    ui.setupUi(this);
    ui.pipelineWidget->removePage(0);
    
    try {
        createActions();
        createMenus();
    } catch (const exception& e) {
    	QErrorMessage errorMessage;
    	errorMessage.showMessage(e.what());
    	errorMessage.exec();
    } catch (...) {
    	QErrorMessage errorMessage;
        errorMessage.showMessage("Unknown error while intializing the application");
    	errorMessage.exec();
    }
    currentJobPath = NULL;
    currentJob = NULL;
}
Ejemplo n.º 21
0
void ElementsWindow::addResistantElement() {
	if ((_elementsList->count() > 0) && !!_elementsList->currentItem()) {

		Element *currentElement = _properties->getElements()->getElement(_elementsList->currentItem()->text());
		if (!!currentElement) {
			QVector<Element*> elements = _properties->getElements()->getElements();
			QVector<Element*> resistantElements = currentElement->getResistantElements();
			QVector<Element*> vulnerableElements = currentElement->getVulnerableElements();

			removeComponent<Element>(elements, currentElement->getName());
			for(int i = 0; i < resistantElements.size(); i++) {
				removeComponent<Element>(elements, resistantElements.at(i)->getName());
			}
			for (int i = 0; i < vulnerableElements.size(); i++) {
				removeComponent<Element>(elements, vulnerableElements.at(i)->getName());
			}

			QStringList availableElements;
			for (int i = 0; i < elements.size(); i++) {
				availableElements.append(elements.at(i)->getName());
			}

			if (availableElements.size() == 0) {
				QMessageBox::information(0, "No elements available", "There are no more possible elements to select.");
				return;
			}

			bool accepted;
			QString name = QInputDialog::getItem(this, "Add a resistant element to " + currentElement->getName(), "Select an element:", availableElements, 0, false, &accepted);

			if (accepted) {
				if (name == QString()) {
					QErrorMessage *errorDialog = QErrorMessage::qtHandler();
					errorDialog->showMessage("Selected an unknown element.");
					return;
				}

				Element *element = _properties->getElements()->getElement(name);
				try {
					currentElement->addResistantElement(element);
				} catch (ProjectException &e) {
					QMessageBox::critical(this, tr("An unexpected error occurred"), e.what());
					return;
				}

				_resistantList->addItem(name);
				_resistantList->setCurrentRow(_resistantList->count()-1);
			}
		}
	}
}
Ejemplo n.º 22
0
/***********************************************************
PostManagement
***********************************************************/
QString FileDialogOptionsModel::PostManagement(const QString & selectedfile)
{
	QString outfile;

	// check if choosen file is in the directory data
	QDir datadir(DataDirHandler::getInstance()->GetDataDirPath().c_str());
	if(selectedfile.contains(datadir.absolutePath()))
	{
		outfile = selectedfile;
		outfile = outfile.remove(datadir.absolutePath() + "/");
	}
	else
	{
		//copy the file over
		try
		{
			// get all files with same name
			std::vector<std::string> files;
			QString fpath = selectedfile.section('/', 0, -2 );
			{
				QString filenoext = selectedfile.section('/', -1);
				filenoext = filenoext.section('.', 0, 0);

				FileUtil::ListFilesInDir(fpath.toAscii().data(), files, filenoext.toAscii().data());
			}

			for(size_t curs=0; curs<files.size(); ++curs)
			{
				QString tmp = fpath + "/";
				tmp += files[curs].c_str();
				QString tmp2 = StartingDirectory + "/";
				tmp2 += files[curs].c_str();
				FileUtil::MakeFileCopy(tmp.toAscii().data(), tmp2.toAscii().data());
			}

			QString filename = StartingDirectory + "/" + selectedfile.section('/', -1);
			outfile = filename.section('/', 1);
		}
		catch(...)
		{
			QErrorMessage msgdial;
			msgdial.showMessage ( "Error copying the file to the data directory!" );
			outfile = "";
		}
	}

	return outfile;
}
Ejemplo n.º 23
0
void QLuaLineNumberTextEdit::textChanged()
{
	if(L && stateChangeFunc != LUA_NOREF)
	{
		lua_rawgeti(L, LUA_REGISTRYINDEX, stateChangeFunc);

		if(lua_pcall(L, 0, 0, 0))
		{
			cerr << lua_tostring(L, -1) << endl;
			QErrorMessage* msg = new QErrorMessage(Singleton.mainWindow);
			msg->showMessage( QString(lua_tostring(L, -1)).replace("\n", "<br>") );
			lua_pop(L, lua_gettop(L));
		}
		lua_gc(L, LUA_GCCOLLECT, 0);
	}
}
void CParticleSystemPage::setNoMaxNBSteps(bool state)
{
    _ui.maxStepsWidget->setEnabled(!state);
    if (state == _Node->getPSPointer()->getBypassMaxNumIntegrationSteps()) return;
    if (state && !_Node->getPSPointer()->canFinish())
    {
        QErrorMessage *errorMessage = new QErrorMessage();
        errorMessage->setModal(true);
        errorMessage->showMessage(tr("The system must have a finite duration for this setting! Please check that."));
        errorMessage->exec();
        delete errorMessage;
        _ui.maxStepsWidget->setEnabled(state);
        _ui.noMaxNBStepsCheckBox->setChecked(!state);
        return;
    }
    _Node->getPSPointer()->setBypassMaxNumIntegrationSteps(state);
    updateModifiedFlag();
}
Ejemplo n.º 25
0
void MainWindow::on_actionSave_2_triggered()
{
    if(getRoot() == NULL)
    {
        QErrorMessage error_mes;
        error_mes.showMessage("Node was not create");
        error_mes.exec();
        return;
    }
    FILE * f = fopen("STANDART.txt","wb");
    if(f == NULL)
    {
        QErrorMessage err;
        err.showMessage("File open error");
        err.exec();
        return;
    }
    store((space*)getRoot(),f);
}
Ejemplo n.º 26
0
void MainWindow::on_actionLoad_triggered()
{
    QString file_name = QFileDialog::getOpenFileName(NULL,
                                                     QString::fromUtf8("Chose file with data"),
                                                     QDir::currentPath(),"(*.*)");

    char * f_name = (char*)qPrintable(file_name);
    FILE * f = fopen(f_name,"rb");
    if(f == NULL)
    {
        QErrorMessage err;
        err.showMessage(file_name + "File open error");
        err.exec();
        return;
    }
    space * root = restore(f);
    setRoot(root);
    show_tree();
}
Ejemplo n.º 27
0
/**
  * Starts the logging thread to a certain file
  */
void LoggingPlugin::startLogging(QString file)
{
    qDebug() << "Logging to " << file;
    // We have to delete the previous logging thread if is was still there!
    if (loggingThread)
        delete loggingThread;
    loggingThread = new LoggingThread();
    if(loggingThread->openFile(file,this))
    {
        connect(loggingThread,SIGNAL(finished()),this,SLOT(loggingStopped()));
        state = LOGGING;
        loggingThread->start();
        emit stateChanged("LOGGING");
    } else {
        QErrorMessage err;
        err.showMessage("Unable to open file for logging");
        err.exec();
    }
}
Ejemplo n.º 28
0
void ConnectingDialog::error(QAbstractSocket::SocketError socketError)
{
	QErrorMessage *msgD = new QErrorMessage();
	QString msg = "Connection error: ";
	switch(socketError)
	{
		case QAbstractSocket::HostNotFoundError:
			msg.append("Host not found");
			break;
		case QAbstractSocket::ConnectionRefusedError:
			msg.append("Connection refused");
			break;
		case QAbstractSocket::RemoteHostClosedError:
			msg.append("Remote host closed the connection");
	}
	msgD->showMessage(msg);
	msgD->exec();
	reject();
}
Ejemplo n.º 29
0
void MyGL::slot_bindAtIndex(int idx) {
    if (meshes.size() > idx && joints[idx]!=nullptr) {
        meshes[idx]->bindVertices(joints[idx]);

        glm::mat4 transMats[100];
        glm::mat4 bindMats[100];

        joints[0]->getTransMats(transMats);
        joints[0]->getBindMats(bindMats);

        prog_mesh.setBindMatrices(bindMats);
        prog_mesh.setTransMatrices(transMats);
    } else {
         QErrorMessage* errorMessageDialog = new QErrorMessage(this);
         errorMessageDialog->setWindowTitle(QString("Error: Root Joint Not Selected!"));
         errorMessageDialog->showMessage(QString("Select Root Joint to Bind"));
    }

}
Ejemplo n.º 30
0
bool
XClient::connect (const char *ipcpath, const bool &sync, QWidget *parent)
{
	bool tried_once = false;
try_again:

	try {
		delete m_client;
		m_client = new Xmms::Client (m_name);
		if (!ipcpath || ipcpath == QLatin1String (""))
			m_client->connect (NULL);
		else
			m_client->connect (ipcpath);
	}
	catch (Xmms::connection_error& e) {
		if (ipcpath == NULL && !tried_once) {
			QSettings s;
			if (s.value ("core/autostart", true).toBool ()) {
				if (!system ("xmms2-launcher")) {
					tried_once = true;
					goto try_again;
				}
			}
		}

		QErrorMessage *err = new QErrorMessage (parent);
		err->showMessage ("Couldn't connect to XMMS2, please try again.");
		err->exec ();
		delete err;
		return false;
	}

	m_client->setMainloop (new XmmsQT4 (m_client->getConnection ()));

	m_isconnected = true;
	// useing normal disconnect callback, if that causes problems,
	// an own method schould be created
    setDisconnectCallback (boost::bind (&XClient::disconnect, this));
	emit gotConnection (this);

	return true;
}