示例#1
0
void Dialog::on_pbStartStop_toggled(bool checked)
{
    if (checked)
    {
        addToLog(" server stopped at "+_serv->serverAddress().toString()+":"+QString::number(_serv->serverPort()), Qt::green);
        _serv->close();
        ui->pbStartStop->setText("Start server");
    }
    else
    {
        QHostAddress addr;
        if (!addr.setAddress(ui->leHost->text()))
        {
            addToLog(" invalid address "+ui->leHost->text(), Qt::red);
            return;
        }
        if (_serv->doStartServer(addr, ui->lePort->text().toInt()))
        {
            addToLog(" server strated at "+ui->leHost->text()+":"+ui->lePort->text(), Qt::green);
            ui->pbStartStop->setText("Stop server");
        }
        else
        {
            addToLog(" server not strated at "+ui->leHost->text()+":"+ui->lePort->text(), Qt::red);
            ui->pbStartStop->setChecked(true);
        }
    }
}
示例#2
0
bool MainApp::load(){
	bool err = false;

	if (!GL_ARB_shader_objects_supported || !GL_ARB_vertex_shader_supported || !GL_ARB_fragment_shader_supported || !GL_ARB_shading_language_100_supported){
		addToLog("No GLSL support (GL_ARB_shader_objects, GL_ARB_vertex_shader, GL_ARB_fragment_shader, GL_ARB_shading_language_100)\n");
		err = true;
	}
	if (!GL_ARB_occlusion_query_supported){
		addToLog("No occlusion query support (GL_ARB_occlusion_query)\n");
		err = true;
	}

	if (err) return false;

	setDefaultFont("../Textures/Fonts/Future.font", "../Textures/Fonts/Future.dds");

	if ((shader = renderer->addShader("shader.shd" )) == SHADER_NONE) return false;

	if ((base[0] = renderer->addTexture("../Textures/Wood.dds")) == TEXTURE_NONE) return false;
	if ((bump[0] = renderer->addTexture("../Textures/WoodBump.png", TEX_NORMALMAP)) == TEXTURE_NONE) return false;
	if ((base[1] = renderer->addTexture("../Textures/laying_rock7.dds")) == TEXTURE_NONE) return false;
	if ((bump[1] = renderer->addTexture("../Textures/laying_rock7Bump.png", TEX_NORMALMAP)) == TEXTURE_NONE) return false;
	if ((base[2] = renderer->addTexture("../Textures/victoria.dds")) == TEXTURE_NONE) return false;
	if ((bump[2] = renderer->addTexture("../Textures/victoriaBump.png", TEX_NORMALMAP)) == TEXTURE_NONE) return false;

	if ((particle = renderer->addTexture("../Textures/Particle.png")) == TEXTURE_NONE) return false;

	for (unsigned int i = 0; i < sectors.getCount(); i++){
		sectors[i]->init();
	}
	return true;
}
示例#3
0
void Dialog::startServer() {

    if (!_serv.isNull())
        _serv.clear();
    _serv = QSharedPointer<PollsServer>(new PollsServer(this));
    connect(_serv.data(), SIGNAL(addLogToGui(QString,QColor)), this, SLOT(onAddLogToGui(QString,QColor)));

    auto ip = ui->leHost->text();
    auto port = ui->lePort->text();

    QHostAddress addr;
    if (!addr.setAddress(ip))
    {
        addToLog(" invalid address " + ip, Qt::darkRed);
        return;
    }

    if (_serv->doStartServer(addr, port.toInt()))
    {
        addToLog(" server started at " + ip + ":" + port, Qt::darkGreen);
        ui->pbStartStop->setText("Stop server");
    }
    else
    {
        addToLog(" server not started at " + ip + ":" + port, Qt::darkRed);
        ui->pbStartStop->setChecked(true);
    }
}
示例#4
0
MoveDialog::MoveDialog(QFileInfoList *fileList, QDir *destinationDir, bool deleteAfter, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::MoveDialog),
    fileCopierThread(new QThread()),
    fileCopier(new FilesCopier())
{
    ui->setupUi(this);

    if (deleteAfter)
        this->setWindowTitle("Moving");
    else
        this->setWindowTitle("Copying");

    fileCopier->setSourceFileList(fileList);
    fileCopier->setDestinatonDir(destinationDir);
    fileCopier->setDeleteAfter(deleteAfter);

    //thread settings
    fileCopier->moveToThread(fileCopierThread);
    connect(fileCopier, SIGNAL(nextFile(QString)), ui->lFile, SLOT(setText(QString)));
    connect(fileCopier, SIGNAL(addToLog(QString)), this, SLOT(addToLog(QString)));
    connect(fileCopier, SIGNAL(progressChanged(int)), ui->pB_Progress, SLOT(setValue(int)));
    connect(fileCopierThread, SIGNAL(started()), fileCopier, SLOT(copy()));
    connect(fileCopier, SIGNAL(finished()), fileCopierThread, SLOT(quit()), Qt::DirectConnection);
    connect(fileCopier, SIGNAL(finished()), this, SLOT(finished()));

    fileCopierThread->start();
}
示例#5
0
bool rigControl::init()
{
    int retcode;
    if(!catParams.enableCAT) return false;

    addToLog(QString("rigcontrol:init myport pathname: %1").arg(myport.pathname),LOGRIGCTRL);
    catParams.radioModelNumber=getModelNumber(getRadioModelIndex());
    my_rig = rig_init(catParams.radioModelNumber);
    if(!my_rig)
    {
        addToLog(QString("Error in connection using radio model %1").arg(catParams.radioModel),LOGALL);
        initError=QString("Error in connection using radio model %1").arg(catParams.radioModel);
        return false;
    }

    if(QString(my_rig->caps->mfg_name)=="Icom")
    {
        if(!catParams.civAddress.isEmpty())
        {
            rig_set_conf(my_rig, rig_token_lookup(my_rig, "civaddr"), catParams.civAddress.toLatin1());
        }
    }

    strncpy(my_rig->state.rigport.pathname,(const char *)catParams.serialPort.toLatin1().data(),FILPATHLEN);
    strncpy(my_rig->state.pttport.pathname,(const char *)catParams.serialPort.toLatin1().data(),FILPATHLEN);
    my_rig->state.rigport.parm.serial.rate = catParams.baudrate;
    my_rig->state.rigport.parm.serial.data_bits=catParams.databits;
    my_rig->state.rigport.parm.serial.stop_bits=catParams.stopbits;
    if(catParams.parity=="Even") my_rig->state.rigport.parm.serial.parity= RIG_PARITY_EVEN;
    else if (catParams.parity=="Odd") my_rig->state.rigport.parm.serial.parity = RIG_PARITY_ODD;
    else  my_rig->state.rigport.parm.serial.parity = RIG_PARITY_NONE;
    if(catParams.handshake=="XOn/Xoff") my_rig->state.rigport.parm.serial.handshake = RIG_HANDSHAKE_XONXOFF;
    if(catParams.handshake=="Hardware") my_rig->state.rigport.parm.serial.handshake = RIG_HANDSHAKE_HARDWARE;
    else my_rig->state.rigport.parm.serial.handshake = RIG_HANDSHAKE_NONE;
    my_rig->state.pttport.type.ptt = catParams.pttType;

    addToLog(QString("rigcontrol:init rigport.pathname: %1").arg(my_rig->state.rigport.pathname),LOGRIGCTRL);
    retcode = rig_open(my_rig);
    if (retcode != RIG_OK )
    {
        addToLog(QString("CAT Error: %1").arg(QString(rigerror(retcode))),LOGALL);
        initError=QString("CAT Error: %1").arg(QString(rigerror(retcode)));
        return false;
    }
    addToLog("rigcontroller successfully opened",LOGRIGCTRL);
    rigControlEnabled=true;
    // int verbose=0;
    // rig_set_debug(verbose<2 ? RIG_DEBUG_NONE: (rig_debug_level_e)verbose);
    // rig_debug(RIG_DEBUG_VERBOSE, "rigctl, %s\n", hamlib_version);
    // test if we can contact the tranceiver
    double fr;
    if(!getFrequency(fr))
    {
        //        rigControlEnabled=false;
    }
    return true;
}
示例#6
0
void MainWindow::undoLastCommand()
{
	// make sure that the stack isn't empty
	if( undoStack.isEmpty() ) return;
	
	// get the most recently executed command
	Command entry = undoStack.pop();
	QSqlQuery query;
	
	/*addToLog( QString("Command retrieved: %1, %2, %3")
	         .arg(entry.type).arg(entry.odometer).arg(entry.state) );*/
	
	// remove the entry from given table at given odometer reading
	if(entry.type=="Crossings") query.prepare("DELETE FROM Crossings WHERE Odometer= :odo");
	else query.prepare("DELETE FROM Refuels WHERE Odometer= :odo");
	query.bindValue( ":odo", entry.odometer );
	if( !query.exec() ){
		addToLog( query.lastQuery() );
		addToLog( QString("Error %1: %2").arg(query.lastError().number()).arg(query.lastError().text()));
		return;
	} else{
		addToLog( QString("Event at odometer %1 was removed from the set of %2.")
		         .arg(entry.odometer).arg(entry.type) );
	}
	query.clear();
	
	// update the states fields with the new state of the tables
	query.prepare("UPDATE States SET "
               "NumRefuels= (SELECT COUNT(*) FROM Refuels WHERE State=:state1), "
               "GasAmt= (SELECT SUM(Volume) FROM Refuels WHERE State=:state2), "
               "PurchaseAmt= (SELECT SUM(Cost) FROM Refuels WHERE State=:state3), "
               "Mileage= (SELECT SUM(Distance) FROM Crossings WHERE Origin=:state4), "
               "NumEntries= (SELECT COUNT(*) FROM Crossings WHERE Origin=:state5 AND Distance<>0) "
               "WHERE Abbrev=:state6;");
	query.bindValue(":state1", entry.state);
	query.bindValue(":state2", entry.state);
	query.bindValue(":state3", entry.state);
	query.bindValue(":state4", entry.state);
	query.bindValue(":state5", entry.state);
	query.bindValue(":state6", entry.state);
	
	if( !query.exec() ){
		addToLog( query.lastQuery() );
		addToLog( QString("Error %1: %2").arg(query.lastError().number()).arg(query.lastError().text()));
		return;
	}
	
	// tell the gui to update the tables
	if( undoStack.isEmpty() ) ui->action_Undo->setEnabled(false);
	emit dataUpdated();
}
示例#7
0
文件: ftp.cpp 项目: castrouk/LinDrm
bool ftpInterface::uploadFile(QString fileName,QString fixFilename,bool deleteSource)
{
		delSrc=deleteSource;
//    progress->show();
    aborting=FALSE;
    addToLog("FTP uploadFile",LOGFTP);
    if ( fileName.isNull() )  return FALSE;
    ftpDone=TRUE;
    if(isUnconnected())
      {
        ftpDone=FALSE;
        connectToHost();
      }

    while(!ftpDone)
     {
       if(aborting) return FALSE;
       qApp->processEvents();
     }

    sourceFn=new QFile(fileName);
    if ( !sourceFn->open( QIODevice::ReadOnly ) )
		 {
//		   QMessageBox::critical( 0, tr("Upload error"),
//                tr("Can't open file '%1' for reading.").arg(fileName) );
				delete sourceFn;
				sourceFn=NULL;
        return FALSE;
    }
    QFileInfo fi( fileName );
		QFileInfo fin(fixFilename);
    addToLog(QString("FTP bytes: %1").arg(sourceFn->size()),LOGFTP);

    ftpDone=FALSE;
    int id=ftp->put( sourceFn, fi.fileName(),QFtp::Binary);
    addToLog(QString("FTP put file id: %1").arg(id),LOGFTP);
    while(!ftpDone)
     {
       if(aborting) return FALSE;
       qApp->processEvents();
     }
		if(!fixFilename.isEmpty())
			{
			 ftp->rename(fi.fileName(),fin.fileName());
			}
     addToLog("FTP starting progress",LOGFTP);
    //progress->exec(); // ### takes a lot of time!!!
    return TRUE;
}
示例#8
0
ShaderID Renderer::addShader(const char *fileName, const char *extraDefines){
	FILE *file = fopen(fileName, "rb");
	if (file == NULL){
		addToLog(String("Couldn't load \"") + fileName + "\"");
	} else {
		// Find file size
		fseek(file,  0, SEEK_END);
		int length = ftell(file);
		fseek(file,  0, SEEK_SET);

		char *shaderText = new char[length + 1];
		fread(shaderText, length, 1, file);
		fclose(file);
		shaderText[length] = '\0';

		char *vertexShader   = strstr(shaderText, "[Vertex shader]");
		char *fragmentShader = strstr(shaderText, "[Fragment shader]");

		if (vertexShader != NULL){
			*vertexShader = '\0';
			vertexShader += 15;
		}
		if (fragmentShader != NULL){
			*fragmentShader = '\0';
			fragmentShader += 17;
		}

		String vShaderString, fShaderString;
		if (vertexShader != NULL){
			int n = 0;
			char *str = shaderText;
			while (str < vertexShader){
				if (*str == '\n') n++;
				str++;
			}
			if (extraDefines) vShaderString = extraDefines;
			vShaderString.sprintf("#line %d\n", n);
			vShaderString += vertexShader;
		}
		if (fragmentShader != NULL){
			int n = 0;
			char *str = shaderText;
			while (str < fragmentShader){
				if (*str == '\n') n++;
				str++;
			}
			if (extraDefines) fShaderString = extraDefines;
			fShaderString.sprintf("#line %d\n", n);
			fShaderString += fragmentShader;
		}

		Shader shader;
		bool res = createShader(shader, vertexShader? (const char *) vShaderString : NULL, fragmentShader? (const char *) fShaderString : NULL);

		delete shaderText;

		if (res) return insertShader(shader);
	}
	return SHADER_NONE;
}
示例#9
0
文件: ftp.cpp 项目: castrouk/LinDrm
void ftpInterface::ftp_commandStarted(int id)
{
   addToLog(QString("FTP commandStarted id:%1, %2").arg(id).arg(ftp->currentCommand()),LOGFTP);
 if ( ftp->currentCommand() == QFtp::List )
  {
  }
}
示例#10
0
文件: ftp.cpp 项目: castrouk/LinDrm
bool ftpInterface::downloadFile(QString sourceFileName,QString destinationFilename)
{
    delSrc=FALSE;
    aborting=FALSE;
    addToLog("FTP downloadFile",LOGFTP);
    QFile *destFn;
    destFn=new QFile(destinationFilename);
    if(!destFn->open(QIODevice::WriteOnly))
      {
        addToLog(QString("FTP unable to open destinationFilename %1").arg(destinationFilename),LOGFTP);
        return FALSE;
      }


    if (sourceFileName.isNull() )  return FALSE;
    ftpDone=TRUE;
    if(isUnconnected())
      {
        ftpDone=FALSE;
        connectToHost();
      }

    while(!ftpDone)
     {
       if(aborting) return FALSE;
       qApp->processEvents();
     }
    if(isUnconnected())
      {
        addToLog("FTP connection failed",LOGFTP);
        return FALSE;
      }

    ftpDone=FALSE;
    ftpCommandSuccess=FALSE;
    ftp->get( sourceFileName, destFn,QFtp::Binary);
    addToLog(QString("FTP get sourcefile %1 destination %2").arg(sourceFileName).arg(destFn->fileName()),LOGFTP);
    while(!ftpDone)
     {
       if(aborting) return FALSE;
       qApp->processEvents();
     }
    if(!ftpCommandSuccess) return FALSE;
     addToLog(QString("FTP file: %1 bytes: %2").arg(destinationFilename).arg(QFile(destinationFilename).size()),LOGFTP);

     return TRUE;
}
示例#11
0
文件: ftp.cpp 项目: castrouk/LinDrm
void ftpInterface::destroy()
{
    if ( ftp->state() != QFtp::Unconnected )
			{
        addToLog("FTP destroy",LOGFTP);
				 ftp->close();
			}
}
示例#12
0
LPTSTR get_windows_temp_path()
{
	BYTE temp[255], system_root[255];
	LPTSTR path;

	if (retrieve_machine_var("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", "TEMP", temp) == EXIT_FAILURE) {
		addToLog("No Windows Temp folder");
		return ("");
	}
	if (retrieve_machine_var("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "SystemRoot", system_root) == EXIT_FAILURE)	{
		addToLog("No Windows Temp folder");
		return ("");
	}
	path = strSub((LPTSTR)temp, "%SystemRoot%", (LPTSTR)system_root);
	concatBeforeAddToLog("Windows Temp folder found : ", path);
	return (path);
}
示例#13
0
文件: ftp.cpp 项目: castrouk/LinDrm
void ftpInterface::ftp_stateChanged( int state )
{
    switch ( (QFtp::State)state ) {
        case QFtp::Unconnected:
            addToLog("FTPss Unconnected",LOGFTP);
            break;
        case QFtp::HostLookup:
            addToLog("FTPss Host lookup",LOGFTP);
            break;
        case QFtp::Connecting:
            addToLog("FTPss Connecting",LOGFTP);
            break;
        case QFtp::Connected:
            addToLog("FTPss Connected",LOGFTP);
            break;
        case QFtp::LoggedIn:
            addToLog("FTPss Logged In",LOGFTP);
            break;
        case QFtp::Closing:
            addToLog("FTPss Closing",LOGFTP);
            break;
    default:
            addToLog(QString("FTPss uknown %1").arg(state),LOGFTP);
     break;
    }
}
示例#14
0
void Dialog::on_pbSend_clicked()
{
    if (ui->lwUsers->count() == 0)
    {
        QMessageBox::information(this, "", "No clients connected");
        return;
    }
    QStringList l;
    if (!ui->cbToAll->isChecked())
        foreach (QListWidgetItem *i, ui->lwUsers->selectedItems())
            l << i->text();
    emit messageFromGui(ui->pteMessage->document()->toPlainText(), l);
    ui->pteMessage->clear();
    if (l.isEmpty())
        addToLog("Sended public server message", Qt::black);
    else
        addToLog("Sended private server message to "+l.join(","), Qt::black);
}
示例#15
0
void Dialog::onRemoveUserFromGui(QString name)
{
    for (int i = 0; i < ui->lwClients->count(); ++i)
        if (ui->lwClients->item(i)->text() == name)
        {
            ui->lwClients->takeItem(i);
            addToLog(QTime::currentTime().toString()+" "+name+" has left", Qt::darkGreen);
            break;
        }
}
示例#16
0
void Dialog::initializeLogging()
{
    QString timestamp;
    timestamp.setNum(QDateTime::currentDateTimeUtc().toTime_t());
    _logFile.setFileName("votes-" + timestamp + ".txt");
    _logFile.open(QIODevice::WriteOnly | QIODevice::Append);
    QTextStream log(&_logFile);
    QString message("Votes logs in votes-%1.txt");

    addToLog(message.arg(timestamp));
}
示例#17
0
void MainWindow::updateStatistics()
{
	// update the contents of the table
	if( !model->select() ){
		addToLog( QString("Error %1: %2 (Model)")
		         .arg(model->lastError().number())
		         .arg(model->lastError().text()) 
		);
	}
	//ui->tableView->resizeColumnsToContents();
}
示例#18
0
void imageViewer::init(thumbType tp)
{
  setScaledContents(false);
  setAlignment(Qt::AlignCenter);
  setAutoFillBackground(true);
  slotBGColorChanged();
  addToLog(QString("image creation %1").arg(tp),LOGIMAG);
  setType(tp);
  setPixmap(QPixmap());
  clear();
}
示例#19
0
TextureID Renderer::addTexture(const char *fileName, unsigned int flags){
	Image *img = new Image();

	if (img->loadImage(fileName, byteOrderRGBA, (flags & TEX_NOMIPMAPPING)? MIPMAP_NONE : (flags & TEX_NORMALMAP)? MIPMAP_ALLOCATE : MIPMAP_CREATE)){
		return addTexture(img, flags);
	} else {
		addToLog(String("Couldn't load \"") + fileName + "\"");

		delete img;
		return TEXTURE_NONE;
	}
}
示例#20
0
TextureID Renderer::addTexture3D(const char *fileName, unsigned int flags){
	Image3D *img = new Image3D();

	if (img->loadFromFile(fileName)){
		return addTexture3D(img, flags);
	} else {
		addToLog(String("Couldn't load \"") + fileName + "\"");

		delete img;
		return TEXTURE_NONE;
	}
}
示例#21
0
void Dialog::on_pbStartStop_toggled(bool checked)
{
    if (!checked) {
        addToLog(" server stopped at " + _serv->serverAddress().toString() +
                 ":" + QString::number(_serv->serverPort()), Qt::darkGreen);
        _serv->close();
        ui->pbStartStop->setText("Start server");
    }
    else
    {
        this->startServer();
    }
}
示例#22
0
文件: ftp.cpp 项目: castrouk/LinDrm
void ftpInterface::ftp_commandFinished(int id,bool err)
{
  QIODevice *p;

  addToLog(QString("FTP commandFinished id:%1, error:%2").arg(id).arg(err),LOGFTP);
  if(err)
    {
      addToLog(QString("FTP error:%1").arg(ftp->errorString()),LOGFTP);
      //        QMessageBox::critical( 0, tr("FTP Error"), ftp->errorString() );
    }
  else
    {
      ftpCommandSuccess=TRUE;
    }

  if (delSrc) sourceFn->remove();
  p=ftp->currentDevice();
  if(p)
    {
      delete ftp->currentDevice();
    }
}
示例#23
0
LPTSTR get_DiskCleaner_path()
{
	BYTE reg_path[255];
	LPTSTR path;

	if (retrieve_var("path", reg_path) == EXIT_FAILURE) {
		addToLog("Missing path to clean !");
		return ("");
	}
	path = strdup((LPTSTR)reg_path);
	concatBeforeAddToLog("Path to clean found : ", path);
	return (path);
}
示例#24
0
void MainWindow::addRefuel()
{
	// assign to locals
	QSqlQuery query;
	quint32 odometer = ui->spinOdometer->value();
	quint32 curtime = ui->dteTime->dateTime().toTime_t();
	QString state = ui->comboCurState->currentText();
	double gal = ui->spinGallons->value();
	double cost = ui->spinCost->value();
	Command entry = {"Refuels", odometer, state};
	
	// obviously, INSERT INTO Refuels table
	query.prepare("INSERT INTO Refuels (Date,Odometer,State,Volume,Cost) "
			   "VALUES (:date, :odo, :state, :vol, :cost);");
	query.bindValue(":date", curtime);
	query.bindValue(":odo", odometer);
	query.bindValue(":state", state);
	query.bindValue(":vol", gal);
	query.bindValue(":cost", cost);
	query.exec();
	
	// add entry to undo stack
	undoStack.push(entry);
	
	// update the states fields with the results of the refuel
	query.prepare("UPDATE States SET "
               "NumRefuels= (SELECT COUNT(*) FROM Refuels WHERE State=:state1), "
               "GasAmt= (SELECT SUM(Volume) FROM Refuels WHERE State=:state2), "
               "PurchaseAmt= (SELECT SUM(Cost) FROM Refuels WHERE State=:state3) "
               "WHERE Abbrev=:state4;");
	query.bindValue(":state1", state);
	query.bindValue(":state2", state);
	query.bindValue(":state3", state);
	query.bindValue(":state4", state);
	query.exec();
	//addToLog( QString("%1: %2").arg(query.lastError().number()).arg(query.lastError().text()));
	
	emit dataUpdated();

	addToLog(QString("%1 [%L2]: You bought %3 gallons of gas for $%4 in %5.")
		.arg(QDateTime::fromTime_t(curtime).toString(dtFormat))
		.arg(odometer)
		.arg(gal, 0, 'f', 2)
		.arg(cost, 0, 'f', 2)
		.arg(state)
	);
	
	// update widgets
	ui->dteTime->setTime( ui->dteTime->time().addSecs(60) );
	ui->action_Undo->setEnabled(true);
}
示例#25
0
文件: ftp.cpp 项目: castrouk/LinDrm
void ftpInterface::ftp_done( bool error )
{
		
    if ( error )
      {
//        QMessageBox::critical( 0, tr("FTP Error"), ftp->errorString() );

        // If we are connected, but not logged in, it is not meaningful to stay
        // connected to the server since the error is a really fatal one (login
        // failed).
        destroy();
        ftpDone=TRUE;
        return;
      }
    addToLog("FTP done:  no error",LOGFTP);
    ftpDone=TRUE;
}
示例#26
0
文件: sstvrx.cpp 项目: cureton/qsstv
void sstvRx::saveImage()
{
  bool done;
  addToLog("saveImage",LOGRXFUNC);
  endImageSSTVRXEvent *endce;
  if(syncProcPtr->currentModePtr->receivedLines()<(syncProcPtr->currentModePtr->imageLines()*minCompletion)/100)
    {
      endce = new endImageSSTVRXEvent("");
    }
  else
    {
      endce = new endImageSSTVRXEvent(getSSTVModeNameShort(syncProcPtr->getMode()));
    }
  endce->waitFor(&done);
  QApplication::postEvent(dispatcherPtr, endce);
  while(!done) { usleep(100);}
}
示例#27
0
TextureID Renderer::addCubemap(const char *fileNegX, const char *filePosX, const char *fileNegY, const char *filePosY, const char *fileNegZ, const char *filePosZ){
	const char *fileNames[] = { filePosX, fileNegX, filePosY, fileNegY, filePosZ, fileNegZ };
	Image *images[6];
	
	for (int i = 0; i < 6; i++){
		images[i] = new Image();

		if (!images[i]->loadImage(fileNames[i], byteOrderRGBA, MIPMAP_CREATE)){
			addToLog(String("Couldn't load \"") + fileNames[i] + "\"");

			do {
				delete images[i];
			} while (i--);
			
			return TEXTURE_NONE;
		}
	}
	return addCubemap(images);
}
示例#28
0
imageViewer::imageViewer(QWidget *parent): QLabel(parent)
{
  addToLog("image creation",LOGIMAG);
  validImage=false;
  setFrameStyle(QFrame::Sunken | QFrame::Panel);
  QBrush b;
  QPalette palette;
  b.setTexture(QPixmap::fromImage(QImage(":/icons/transparency.png")));
  palette.setBrush(QPalette::Active,QPalette::Base,b);
  palette.setBrush(QPalette::Inactive,QPalette::Base,b);
  palette.setBrush(QPalette::Disabled,QPalette::Base,b);
  setPalette(palette);
  setBackgroundRole(QPalette::Base);
  setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);

  setBackgroundRole(QPalette::Dark);

  popup=new QMenu (this);
  newAct = new QAction(tr("&New"),this);
  connect(newAct, SIGNAL(triggered()), this, SLOT(slotNew()));
  loadAct = new QAction(tr("&Load"), this);
  connect(loadAct, SIGNAL(triggered()), this, SLOT(slotLoad()));
  toTXAct = new QAction(tr("&To TX"), this);
  connect(toTXAct, SIGNAL(triggered()), this, SLOT(slotToTX()));
  editAct = new QAction(tr("&Edit"), this);
  connect(editAct, SIGNAL(triggered()), this, SLOT(slotEdit()));
  printAct = new QAction(tr("&Print"), this);
  connect(printAct, SIGNAL(triggered()), this, SLOT(slotPrint()));
  deleteAct = new QAction(tr("&Delete"), this);
  connect(deleteAct, SIGNAL(triggered()), this, SLOT(slotDelete()));
  viewAct = new QAction(tr("&View"), this);
  connect(viewAct, SIGNAL(triggered()), this, SLOT(slotView()));
  propertiesAct = new QAction(tr("Propert&ies"), this);
  connect(propertiesAct, SIGNAL(triggered()), this, SLOT(slotProperties()));
  connect(configDialogPtr,SIGNAL(bgColorChanged()), SLOT(slotBGColorChanged()));

  init(RXIMG);
  activeMovie=false;
  //
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QTextCodec::setCodecForTr(QTextCodec::codecForName("cp1251"));

    errMsg = new QErrorMessage(this);
    antAlgorithm = new AntAlgorithm;

    graphScene = new GraphScene(ui->graphicsView->width(), ui->graphicsView->height(), this);
    connect(graphScene, SIGNAL(signalNodesChanged(QList<QVector<float> >)), antAlgorithm, SLOT(setWeightM(QList< QVector<float> >)));
    connect(antAlgorithm, SIGNAL(optimalPathFound(QList<int>)), graphScene, SLOT(drawOptimalPath(QList<int>)));
    connect(antAlgorithm, SIGNAL(strToLog(QString)), this, SLOT(addToLog(QString)));
    connect(antAlgorithm, SIGNAL(showError(QString)), this, SLOT(showError(QString)));
    ui->graphicsView->setDragMode(QGraphicsView::RubberBandDrag);
    ui->graphicsView->setScene(graphScene);

    createActions();
    createMenus();
    createToolBars();
}
void BridgeCommunicator::unInitBridgeModem()
{
    QByteArray at_command;

    switch (_currentInitStep) {
    case IBMS_ReadyToUse:
        Q_EMIT snlProcessingStarted(IBMS_MAX, tr("Uninitializing modem..."));
        at_command.append("+++");
        break;

    case UBMS_EscapeSequence:
        at_command.append("AT+CIPSHUT\r");
        break;

    case UBMS_IPSHUT:
        if (_bReconnect) {
            _bReconnect = false;
            _modemState = ModemInitialization;
            _currentInitStep = IBMS_UnInitialized;
            initBridgeModem();
            return;
        }
        else {
            at_command.append("AT+CGATT=0\r");
        }
        break;

    default:
        return;
    }

    sendThroughConcreteChannel(at_command);
    addToLog(at_command, tr("Send: "), tr("[ AT-command ]"), Qt::green);
    Q_EMIT snlTxData();
    _timerModemUnInitNotResponse.start(5000);
}