Exemplo n.º 1
0
void UpdateManager::DownloadUpdate()
{
    QNetworkAccessManager *manager = new QNetworkAccessManager(this);
    connect(manager, &QNetworkAccessManager::finished,
            [=](QNetworkReply *reply)
            {
                if(reply->error())
                    emit errorSignal("UpdateManager: "+reply->errorString());
                else
                {
                    // todo: progress bar
                    // todo: compression
                    QFile *file = new QFile("Baka MPlayer.exe");
                    if(file->open(QFile::Truncate))
                    {
                        file->write(reply->readAll());
                        file->flush();
                        file->close();
                    }
                    delete file;
                }
                reply->deleteLater();
            });
    manager->get(QNetworkRequest(QUrl("http://bakamplayer.u8sand.net/Baka MPlayer.exe")));
}
Exemplo n.º 2
0
void FileTask::startFileOp()
{
    bool error = false;
    QString errMessage;
    QFile src(m_srcFileName);

    switch (m_currentOp) {
    case CopyOp:
        if (!src.copy(m_filesDir + m_destFileName)) {
            error = true;
            errMessage = tr("Failed to copy %1 to %2: %3")
                    .arg(m_srcFileName).arg(m_filesDir + m_destFileName)
                    .arg(src.errorString());
        }
        break;
    case RemoveOp:
        if (!QFile::remove(m_filesDir + m_srcFileName)) {
            error = true;
            errMessage = tr("Failed to remove %1: %2")
                    .arg(m_filesDir + m_srcFileName).arg(src.errorString());
        }
        break;
    default:
        break;
    }

    if (error) {
        emit errorSignal(errMessage);
        return;
    }

    emit finishedSignal(m_srcFileName, m_destFileName, m_currentOp);
}
Exemplo n.º 3
0
void SR865::init()
{
    if (this->srs == nullptr)
        this->srs = new SRS();

    initBaudrateList();
    initReferenceSourceList();
    initReferenceTriggerModeList();
    initReferenceTriggerOutputZList();
    initSignalInputList();
    initVoltageInputModeList();
    initVoltageInputCouplingList();
    initVoltageInputShieldsList();
    initVoltageInputRangeList();
    initCurrentInputGainList();
    initSensivityList();
    initTimeConstantList();
    initFilterList();
    initOutputNumberList();
    initFrequencyPostfixList();
    initVoltagePostfixList();

    connect(this->srs, SIGNAL(errorSignal(QString)),    this, SLOT(catchErrorSignal(QString))   , Qt::DirectConnection);
    connect(this->srs, SIGNAL(responseSignal(QString)), this, SLOT(catchResponseSignal(QString)), Qt::DirectConnection);
    connect(this->srs, SIGNAL(commandSignal(QString)),  this, SLOT(catchCommandSignal(QString)) , Qt::DirectConnection);
    connect(this->srs, SIGNAL(timeoutSignal(QString)),  this, SLOT(catchTimeoutSignal(QString)) , Qt::DirectConnection);

    return;
}
Exemplo n.º 4
0
void SensorManager::setError(SensorManagerError errorCode, const QString& errorString)
{
    sensordLogW() << "SensorManagerError: " << errorString;

    errorCode_   = errorCode;
    errorString_ = errorString;

    emit errorSignal(errorCode);
}
Exemplo n.º 5
0
void AbstractSensorChannel::setError(SensorError errorCode, const QString& errorString)
{
    sensordLogC() << "SensorError: " <<  errorString;

    errorCode_   = errorCode;
    errorString_ = errorString;

    emit errorSignal(errorCode);
}
void Exchange_Bitstamp::sendToApi(int reqType, QByteArray method, bool auth, bool sendNow, QByteArray commands)
{
	if(julyHttp==0)
	{ 
		julyHttp=new JulyHttp("www.bitstamp.net","",this);
		connect(julyHttp,SIGNAL(anyDataReceived()),baseValues_->mainWindow_,SLOT(anyDataReceived()));
		connect(julyHttp,SIGNAL(setDataPending(bool)),baseValues_->mainWindow_,SLOT(setDataPending(bool)));
		connect(julyHttp,SIGNAL(apiDown(bool)),baseValues_->mainWindow_,SLOT(setApiDown(bool)));
		connect(julyHttp,SIGNAL(errorSignal(QString)),baseValues_->mainWindow_,SLOT(showErrorMessage(QString)));
		connect(julyHttp,SIGNAL(sslErrorSignal(const QList<QSslError> &)),this,SLOT(sslErrors(const QList<QSslError> &)));
		connect(julyHttp,SIGNAL(dataReceived(QByteArray,int)),this,SLOT(dataReceivedAuth(QByteArray,int)));
	}
Exemplo n.º 7
0
void tst_QCameraBackend::testCameraStates()
{
    QCamera camera;
    QCameraImageCapture imageCapture(&camera);

    QSignalSpy errorSignal(&camera, SIGNAL(error(QCamera::Error)));
    QSignalSpy stateChangedSignal(&camera, SIGNAL(stateChanged(QCamera::State)));
    QSignalSpy statusChangedSignal(&camera, SIGNAL(statusChanged(QCamera::Status)));

    QCOMPARE(camera.state(), QCamera::UnloadedState);
    QCOMPARE(camera.status(), QCamera::UnloadedStatus);

    camera.load();
    QCOMPARE(camera.state(), QCamera::LoadedState);
    QCOMPARE(stateChangedSignal.count(), 1);
    QCOMPARE(stateChangedSignal.last().first().value<QCamera::State>(), QCamera::LoadedState);
    QVERIFY(stateChangedSignal.count() > 0);

    QTRY_COMPARE(camera.status(), QCamera::LoadedStatus);
    QCOMPARE(statusChangedSignal.last().first().value<QCamera::Status>(), QCamera::LoadedStatus);

    camera.unload();
    QCOMPARE(camera.state(), QCamera::UnloadedState);
    QCOMPARE(stateChangedSignal.last().first().value<QCamera::State>(), QCamera::UnloadedState);
    QTRY_COMPARE(camera.status(), QCamera::UnloadedStatus);
    QCOMPARE(statusChangedSignal.last().first().value<QCamera::Status>(), QCamera::UnloadedStatus);

#ifdef Q_WS_MAEMO_6
    //resource policy doesn't work correctly when resource is released and immediately requested again.
    QTest::qWait(250);
#endif

    camera.start();
    QCOMPARE(camera.state(), QCamera::ActiveState);
    QCOMPARE(stateChangedSignal.last().first().value<QCamera::State>(), QCamera::ActiveState);
    QTRY_COMPARE(camera.status(), QCamera::ActiveStatus);
    QCOMPARE(statusChangedSignal.last().first().value<QCamera::Status>(), QCamera::ActiveStatus);

    camera.stop();
    QCOMPARE(camera.state(), QCamera::LoadedState);
    QCOMPARE(stateChangedSignal.last().first().value<QCamera::State>(), QCamera::LoadedState);
    QTRY_COMPARE(camera.status(), QCamera::LoadedStatus);
    QCOMPARE(statusChangedSignal.last().first().value<QCamera::Status>(), QCamera::LoadedStatus);

    camera.unload();
    QCOMPARE(camera.state(), QCamera::UnloadedState);
    QCOMPARE(stateChangedSignal.last().first().value<QCamera::State>(), QCamera::UnloadedState);
    QTRY_COMPARE(camera.status(), QCamera::UnloadedStatus);
    QCOMPARE(statusChangedSignal.last().first().value<QCamera::Status>(), QCamera::UnloadedStatus);

    QCOMPARE(camera.errorString(), QString());
    QCOMPARE(errorSignal.count(), 0);
}
Exemplo n.º 8
0
void Exchange_Cryptsy::sendToApi(int reqType, QByteArray method, bool auth, bool sendNow, QByteArray commands)
{
	if(ShibeHttp==0)
	{
		ShibeHttp=new ShibeHttp("data.mtgox.com","Rest-Key: "+privateRestKey+"\r\n",this);
		connect(ShibeHttp,SIGNAL(anyDataReceived()),baseValues_->mainWindow_,SLOT(anyDataReceived()));
		connect(ShibeHttp,SIGNAL(setDataPending(bool)),baseValues_->mainWindow_,SLOT(setDataPending(bool)));
		connect(ShibeHttp,SIGNAL(apiDown(bool)),baseValues_->mainWindow_,SLOT(setApiDown(bool)));
		connect(ShibeHttp,SIGNAL(errorSignal(QString)),baseValues_->mainWindow_,SLOT(showErrorMessage(QString)));
		connect(ShibeHttp,SIGNAL(sslErrorSignal(const QList<QSslError> &)),this,SLOT(sslErrors(const QList<QSslError> &)));
		connect(ShibeHttp,SIGNAL(dataReceived(QByteArray,int)),this,SLOT(dataReceivedAuth(QByteArray,int)));
	}
Exemplo n.º 9
0
void Exchange_BitCurex::sendToApi(int reqType, QByteArray method, bool auth, QByteArray hashData, QByteArray postData)
{
	if(julyHttp==0)
	{ 
        julyHttp=new JulyHttp("api.bitcurex.com","Key: "+getApiKey()+"\r\n",this,true);
		connect(julyHttp,SIGNAL(anyDataReceived()),baseValues_->mainWindow_,SLOT(anyDataReceived()));
		connect(julyHttp,SIGNAL(apiDown(bool)),baseValues_->mainWindow_,SLOT(setApiDown(bool)));
		connect(julyHttp,SIGNAL(setDataPending(bool)),baseValues_->mainWindow_,SLOT(setDataPending(bool)));
		connect(julyHttp,SIGNAL(errorSignal(QString)),baseValues_->mainWindow_,SLOT(showErrorMessage(QString)));
		connect(julyHttp,SIGNAL(sslErrorSignal(const QList<QSslError> &)),this,SLOT(sslErrors(const QList<QSslError> &)));
		connect(julyHttp,SIGNAL(dataReceived(QByteArray,int)),this,SLOT(dataReceivedAuth(QByteArray,int)));
	}
Exemplo n.º 10
0
 void forwardBackward(CSArrayF& activs, CSArrayI& labellings,
     int seqLen, float& err, SArrayF& errSigs, SArrayF& priors, float tdp_loop, float tdp_fwd)
 {                
     nLabels_ = activs.dim(1);
     verify((nLabels_ + 1) % 2 == 0);
     si_ = (nLabels_ + 1) / 2 - 1;
     T_ = seqLen;
     N_ = calcLen(labellings);
     canonical_ = calcCanonical(labellings, N_);
     M_ = canonical_.size();
     errorSignal(activs, labellings, err, errSigs, priors, tdp_loop, tdp_fwd);
 }
Exemplo n.º 11
0
void TransmRpcSession::dataReceived(bool error) {
  if(error) {
    QMessageBox::warning(parent, tr("TranRem"), tr("Error recieving data!"), QMessageBox::Ok );
    //qDebug() << "Error recieving data!" << http->errorString();
    emit errorSignal(dataRecievingError);
  }
  else {
    switch(http->lastResponse().statusCode()) {
    case 409:
	  transmSessionId = http->lastResponse().value("X-Transmission-Session-Id");
	  requestHeader.setValue("X-Transmission-Session-Id", transmSessionId);
	  response->close();
	  response->buffer().clear(); 
	  http->request(requestHeader, requestBody, response);//check this!!!
	  break;
	  case 200:
	  response->seek(0);
      if(parseRequestData()) {
        emit requestComplete();
/*        //debug
        qDebug() << "Tag: " << Tag << " Result: " << Result;
        int i;
        for(i=0;i<Torrents.size();i++)
          qDebug() << "# " << i << " Status: " << Torrents.at(i).status(); 
        //end debug   */
      }
	    else
		    emit errorSignal(parsingError);
	  break;
	  default:
    QMessageBox::warning(parent, tr("TranRem"), tr("Response status code: %1").arg(http->lastResponse().statusCode()), QMessageBox::Ok );
	  //qDebug() << "Response status code: " << http->lastResponse().statusCode();
	  response->close();
	  response->buffer().clear();
	  emit errorSignal(connectionError);
	}
  };
};
Exemplo n.º 12
0
void
Mp3tunesHarmonyDaemon::setClient( Mp3tunesHarmonyClient *client )
{
    m_client = client;
    connect( this, SIGNAL( disconnected() ),
            m_client, SLOT( harmonyDisconnected() ));
    connect( this, SIGNAL( waitingForEmail( QString ) ),
            m_client, SLOT( harmonyWaitingForEmail( QString ) ) );
    connect( this, SIGNAL( connected() ),
            m_client, SLOT( harmonyConnected() ) );
    connect( this, SIGNAL( errorSignal( QString ) ),
            m_client, SLOT( harmonyError( QString ) ) );
    connect( this, SIGNAL( downloadReady( Mp3tunesHarmonyDownload ) ),
            m_client, SLOT( harmonyDownloadReady( Mp3tunesHarmonyDownload ) ) );
    connect( this, SIGNAL( downloadPending( Mp3tunesHarmonyDownload ) ),
            m_client, SLOT( harmonyDownloadPending( Mp3tunesHarmonyDownload ) ) );
}
Exemplo n.º 13
0
void DS345::init()
{
    if (this->srs == nullptr)
        this->srs = new SRS();

    initBaudrateList();
    initAmplitudeTypeList();
    initFunctionList();
    initModulationFunctionList();
    initModulationTypeList();

    connect(this->srs, SIGNAL(errorSignal(QString)),    this, SLOT(catchErrorSignal(QString))   , Qt::DirectConnection);
    connect(this->srs, SIGNAL(responseSignal(QString)), this, SLOT(catchResponseSignal(QString)), Qt::DirectConnection);
    connect(this->srs, SIGNAL(commandSignal(QString)),  this, SLOT(catchCommandSignal(QString)) , Qt::DirectConnection);
    connect(this->srs, SIGNAL(timeoutSignal(QString)),  this, SLOT(catchTimeoutSignal(QString)) , Qt::DirectConnection);

    return;
}
Exemplo n.º 14
0
void BackupTask::startBackupTask()
{
    bool error = false;
    QString errMessage;

    switch (m_currentOp) {
    case ExportOp:
        error = !fullExport(m_path, errMessage);
        break;
    case ImportOp:
        error = !fullImport(m_path, errMessage);
        break;
    default:
        break;
    }

    if (error) {
        emit errorSignal(errMessage);
        return;
    }

    emit finishedSignal(m_currentOp);
}
Exemplo n.º 15
0
void UpdateManager::CheckForUpdates()
{
    QNetworkAccessManager *manager = new QNetworkAccessManager(this);
    connect(manager, &QNetworkAccessManager::finished,
            [=](QNetworkReply *reply)
            {
                if(reply->error())
                    emit errorSignal("UpdateManager: "+reply->errorString());
                else
                {
                    QMap<QString, QString> info;
                    QList<QByteArray> lines = reply->readAll().split('\n');
                    QList<QByteArray> pair;
                    for(auto line : lines)
                    {
                        pair = line.split('=');
                        info[QString(pair[0])] = QString(pair[1].replace('\r','\n')); // for multi-line info use \r's instead of \n's
                    }
                    emit Update(info);
                }
                reply->deleteLater();
            });
    manager->get(QNetworkRequest(QUrl("http://bakamplayer.u8sand.net/version")));
}
Exemplo n.º 16
0
void Exchange_BTCChina::sendToApi(int reqType, QByteArray method, bool auth, bool sendNow, QByteArray commands)
{
	if(auth)
	{
		if(julyHttpAuth==0)
		{
			julyHttpAuth=new JulyHttp("api.btcchina.com","",this,true,true,"application/json-rpc");
			connect(julyHttpAuth,SIGNAL(anyDataReceived()),baseValues_->mainWindow_,SLOT(anyDataReceived()));
			connect(julyHttpAuth,SIGNAL(setDataPending(bool)),baseValues_->mainWindow_,SLOT(setDataPending(bool)));
			connect(julyHttpAuth,SIGNAL(apiDown(bool)),baseValues_->mainWindow_,SLOT(setApiDown(bool)));
			connect(julyHttpAuth,SIGNAL(errorSignal(QString)),baseValues_->mainWindow_,SLOT(showErrorMessage(QString)));
			connect(julyHttpAuth,SIGNAL(sslErrorSignal(const QList<QSslError> &)),this,SLOT(sslErrors(const QList<QSslError> &)));
			connect(julyHttpAuth,SIGNAL(dataReceived(QByteArray,int)),this,SLOT(dataReceivedAuth(QByteArray,int)));
		}

		QByteArray signatureParams;

		signatureParams=commands;
		signatureParams.replace("\"","");
		signatureParams.replace("true","1");
		signatureParams.replace("false","");

		QByteArray postData;
		QByteArray appendedHeader;

		static int tonceCounter=0;		
        static quint32 lastTonce=QDateTime::currentDateTime().toTime_t();
        quint32 newTonce=QDateTime::currentDateTime().toTime_t();

		if(lastTonce!=newTonce)
		{
			tonceCounter=0;
			lastTonce=newTonce;
		}
		else
		{
			tonceCounter+=10;
			if(tonceCounter>99)tonceCounter=0;
		}

		QByteArray tonceCounterData=QByteArray::number(tonceCounter);
		if(tonceCounter>9)tonceCounterData.append("0000");
		else tonceCounterData.append("00000");

		QByteArray tonce=QByteArray::number(newTonce)+tonceCounterData;

		QByteArray signatureString="tonce="+tonce+"&accesskey="+getApiKey()+"&requestmethod=post&id=1&method="+method+"&params="+signatureParams;

		signatureString=getApiKey()+":"+hmacSha1(getApiSign(),signatureString).toHex();

		if(debugLevel&&reqType>299)logThread->writeLog(postData);

		postData="{\"method\":\""+method+"\",\"params\":["+commands+"],\"id\":1}";

		appendedHeader="Authorization: Basic "+signatureString.toBase64()+"\r\n";
		appendedHeader+="Json-Rpc-Tonce: "+tonce+"\r\n";

		if(sendNow)
			julyHttpAuth->sendData(reqType, "POST /api_trade_v1.php",postData,appendedHeader);
		else
			julyHttpAuth->prepareData(reqType, "POST /api_trade_v1.php",postData,appendedHeader);
	}
Exemplo n.º 17
0
 void QmSensorPrivate::setError(QString error)
 {
     errorString_ = error;
     emit errorSignal(errorString_);
 }
Exemplo n.º 18
0
 QmSensorPrivate::QmSensorPrivate(QmSensor *sensor) : QObject(sensor), sessionType_(QmSensor::SessionTypeNone), initDone_(false), running_(false)
 {
     connect(this, SIGNAL(errorSignal(QString)), sensor, SIGNAL(errorSignal(QString)));
 }
Exemplo n.º 19
0
void tst_QCameraBackend::testCaptureMode()
{
    QCamera camera;

    QSignalSpy errorSignal(&camera, SIGNAL(error(QCamera::Error)));
    QSignalSpy stateChangedSignal(&camera, SIGNAL(stateChanged(QCamera::State)));
    QSignalSpy captureModeSignal(&camera, SIGNAL(captureModeChanged(QCamera::CaptureModes)));

    QCOMPARE(camera.captureMode(), QCamera::CaptureStillImage);

    if (!camera.isCaptureModeSupported(QCamera::CaptureVideo)) {
        camera.setCaptureMode(QCamera::CaptureVideo);
        QCOMPARE(camera.captureMode(), QCamera::CaptureStillImage);
        QSKIP("Video capture not supported");
    }

    camera.setCaptureMode(QCamera::CaptureVideo);
    QCOMPARE(camera.captureMode(), QCamera::CaptureVideo);
    QTRY_COMPARE(captureModeSignal.size(), 1);
    QCOMPARE(captureModeSignal.last().first().value<QCamera::CaptureModes>(), QCamera::CaptureVideo);
    captureModeSignal.clear();

    camera.load();
    QTRY_COMPARE(camera.status(), QCamera::LoadedStatus);
    //capture mode should still be video
    QCOMPARE(camera.captureMode(), QCamera::CaptureVideo);

    //it should be possible to switch capture mode in Loaded state
    camera.setCaptureMode(QCamera::CaptureStillImage);
    QTRY_COMPARE(captureModeSignal.size(), 1);
    QCOMPARE(captureModeSignal.last().first().value<QCamera::CaptureModes>(), QCamera::CaptureStillImage);
    captureModeSignal.clear();

    camera.setCaptureMode(QCamera::CaptureVideo);
    QTRY_COMPARE(captureModeSignal.size(), 1);
    QCOMPARE(captureModeSignal.last().first().value<QCamera::CaptureModes>(), QCamera::CaptureVideo);
    captureModeSignal.clear();

    camera.start();
    QTRY_COMPARE(camera.status(), QCamera::ActiveStatus);
    //capture mode should still be video
    QCOMPARE(camera.captureMode(), QCamera::CaptureVideo);

    stateChangedSignal.clear();
    //it should be possible to switch capture mode in Active state
    camera.setCaptureMode(QCamera::CaptureStillImage);
    //camera may leave Active status, but should return to Active
    QTest::qWait(10); //camera may leave Active status async
    QTRY_COMPARE(camera.status(), QCamera::ActiveStatus);
    QCOMPARE(camera.captureMode(), QCamera::CaptureStillImage);
    QVERIFY2(stateChangedSignal.isEmpty(), "camera should not change the state during capture mode changes");

    QCOMPARE(captureModeSignal.size(), 1);
    QCOMPARE(captureModeSignal.last().first().value<QCamera::CaptureModes>(), QCamera::CaptureStillImage);
    captureModeSignal.clear();

    camera.setCaptureMode(QCamera::CaptureVideo);
    //camera may leave Active status, but should return to Active
    QTest::qWait(10); //camera may leave Active status async
    QTRY_COMPARE(camera.status(), QCamera::ActiveStatus);
    QCOMPARE(camera.captureMode(), QCamera::CaptureVideo);

    QVERIFY2(stateChangedSignal.isEmpty(), "camera should not change the state during capture mode changes");

    QCOMPARE(captureModeSignal.size(), 1);
    QCOMPARE(captureModeSignal.last().first().value<QCamera::CaptureModes>(), QCamera::CaptureVideo);
    captureModeSignal.clear();

    camera.stop();
    QCOMPARE(camera.captureMode(), QCamera::CaptureVideo);
    camera.unload();
    QCOMPARE(camera.captureMode(), QCamera::CaptureVideo);

    QVERIFY2(errorSignal.isEmpty(), QString("Camera error: %1").arg(camera.errorString()).toLocal8Bit());
}
Exemplo n.º 20
0
void MainWindow::startSWG() {
    QStringList arguments;

    QSettings settings;
    QString folder = settings.value("swg_folder").toString();
    bool multiple = settings.value("multiple_instances").toBool();
    ConfigParser* parser = new ConfigParser();
    GameProcess* process = new GameProcess(parser, NULL);

    parser->connect(parser, SIGNAL(errorSignal(QString)), process, SLOT(outputDebugString(QString)));

    try {
        if (parser->loadFile(folder, "swgemu.cfg") != 0) {
            QMessageBox::warning(this, "Warning", "There was an issue parsing the swg config files! To restore them run full scan!");
        }
    } catch (...) {
        QMessageBox::warning(this, "Warning", "There was an issue parsing the swg config files! To restore them run full scan!");
    }

    QVector<ConfigValue> loginServerAddresses = parser->getConfigValues("ClientGame", "loginServerAddress0");
    QVector<ConfigValue> loginServerPorts = parser->getConfigValues("ClientGame", "loginServerPort0");

    if (loginServerAddresses.size() > 1) {
        QString warningString;
        QTextStream stream(&warningString);

        stream << "You have several login server addresses defined in the following swg config files: ";

        for (int i = 0; i < loginServerAddresses.size(); ++i) {
            const ConfigValue val = loginServerAddresses.at(i);

            stream << val.fileName << " ";
        }

        stream << " client will use the value: " << parser->getStringConfigValue("ClientGame", "loginServerAddress0");

        QMessageBox::warning(this, "Warning", warningString);
    }

    if (loginServerPorts.size() > 1) {
        QString warningString;
        QTextStream stream(&warningString);

        stream << "You have several login server ports defined in the following swg config files: ";

        for (int i = 0; i < loginServerPorts.size(); ++i) {
            const ConfigValue val = loginServerPorts.at(i);

            stream << val.fileName << " ";
        }

        stream << " client will use the value: " << parser->getStringConfigValue("ClientGame", "loginServerPort0");

        QMessageBox::warning(this, "Warning", warningString);
    }

    LoginServer* server = loginServers->getServer(ui->comboBox_login->currentText());

    QString loginAddress = parser->getStringConfigValue("ClientGame", "loginServerAddress0", "loginServerAddress0");
    QString port = parser->getStringConfigValue("ClientGame", "loginServerAddress0", "loginServerPort0");

    if (loginAddress != server->getHost() || port != QString::number(server->getPort())) {
#ifdef Q_OS_WIN32
        QFile loginFile(folder + "\\swgemu_login.cfg");
#else
        QFile loginFile(folder + "/swgemu_login.cfg");
#endif

        if (loginFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
            QTextStream stream(&loginFile);
            stream << "[ClientGame]" << endl;
            stream << "loginServerAddress0=" << server->getHost() << endl;
            stream << "loginServerPort0=" << server->getPort();

            loginFile.close();
        } else {
            QMessageBox::warning(this, "Error", "Could not write swgemu_login.cfg!");
        }
    }
/*
    arguments.append("--");
    arguments.append("-s");
    arguments.append("ClientGame");
    arguments.append("cameraFarPlane=4096");
*/
/*
    arguments.append("--");
    arguments.append("-s");
    arguments.append("SharedFoundation");
    arguments.append("minFrameRate=60");
*/
  //  QFile executable()
/*
    arguments.append("--");
    arguments.append("-s");
    arguments.append("ClientTerrain");
    arguments.append("dynamicNearFloraDistance=128");

    arguments.append("--");
    arguments.append("-s");
    arguments.append("ClientTerrain");
    arguments.append("staticNonCollidableFloraDistance=2048");

    arguments.append("--");
    arguments.append("-s");
    arguments.append("ClientProceduralTerrainAppearance_LevelOfDetail");
    arguments.append("forceHighThreshold=40");

    arguments.append("--");
    arguments.append("-s");
    arguments.append("ClientProceduralTerrainAppearance_LevelOfDetail");
    arguments.append("threshold=40");

    arguments.append("--");
    arguments.append("-s");
    arguments.append("ClientProceduralTerrainAppearance_LevelOfDetail");
    arguments.append("heightBiasMax=4096");
*/
    //ClientProceduralTerrainAppearance_LevelOfDetail.heightBiasMax



    //ClientGame.cameraFarPlane

    /*ClientProceduralTerrainAppearance_LevelOfDetail.threshold*/


    /*ClientProceduralTerrainAppearance_LevelOfDetail.forceHighThreshold*/


    arguments.append("--");
    arguments.append("-s");
    arguments.append("ClientGame");

    if (server != NULL)
        arguments.append("loginServerAddress0=" + server->getHost());
    else
        arguments.append("loginServerAddress0=" + LoginServers::defaultLoginAddress);

    if (server == NULL)
        arguments.append("loginServerPort0=" + QString::number(LoginServers::defaultLoginPort));
    else
        arguments.append("loginServerPort0=" + QString::number(server->getPort()));

    arguments.append("-s");
    arguments.append("Station");
    arguments.append("gameFeatures=34929");

    if (multiple) {
        if (parser->hasConfigValue("SwgClient", "allowMultipleInstances")) {
            bool val = parser->getBooleanConfigValue("SwgClient", "allowMultipleInstances");

            if (!val) {
                QMessageBox::warning(this, "Warning", "You selected the multiple instances option but you have set it to false in the swg config files!");
            }
        }

        arguments.append("-s");
        arguments.append("SwgClient");
        arguments.append("allowMultipleInstances=true");
    }

    qDebug() << "start swg with arguments " << arguments;

    connect(process, SIGNAL(processFinished(GameProcess*,int)), this, SLOT(gameProcessFinished(GameProcess*,int)));

    ui->tabWidget->addTab(process, "Process " + QString::number(++gameProcessesCount));
    gameProcesses.append(process);
    QTabBar* bar = ui->tabWidget->tabBar();
    int tabIndex = ui->tabWidget->indexOf(process);
    bar->setTabTextColor(tabIndex, Qt::green);
    bar->setTabIcon(tabIndex, QIcon(":/img/tab.svg"));

    //process->show();
    bool startResult = process->start(folder, gameExecutable, arguments);

    if (startResult) {
        //showMinimized();
        if (settings.value("minimize_after_start", false).toBool()) {
            systemTrayIcon->show();

            QTimer::singleShot(0, this, SLOT(hide()));
        }
    }
}