Exemplo n.º 1
0
/*
  Uploader handles uploading a binary image to a board.  It fires up a QProcess
  and runs the uploader with flags determined by settings in Preferences.
*/
Uploader::Uploader(MainWindow *mainWindow) : QDialog( 0 )
{
  this->mainWindow = mainWindow;
  setupUi(this);
  connect(this, SIGNAL(finished(int)), this, SLOT(onDialogClosed()));
  connect(&uploader, SIGNAL(readyReadStandardOutput()), this, SLOT(filterOutput()));
  connect(&uploader, SIGNAL(readyReadStandardError()), this, SLOT(filterError()));
  connect(&uploader, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(uploadFinished(int, QProcess::ExitStatus)));
  connect(&uploader, SIGNAL(error(QProcess::ProcessError)), this, SLOT(onError(QProcess::ProcessError)));
  connect(browseButton, SIGNAL(clicked()), this, SLOT(onBrowseButton()));
  connect(uploadButton, SIGNAL(clicked()), this, SLOT(onUploadButton()));

  QSettings settings;
  QString lastFilePath = settings.value("last_firmware_upload", QDir::homePath()).toString();
  browseEdit->setText(lastFilePath);
  progressBar->reset();
  resize(gridLayout->sizeHint());
}
Exemplo n.º 2
0
void IDBOpenDBRequest::requestCompleted(const IDBResultData& data)
{
    LOG(IndexedDB, "IDBOpenDBRequest::requestCompleted");

    switch (data.type()) {
    case IDBResultType::Error:
        onError(data);
        break;
    case IDBResultType::OpenDatabaseSuccess:
        onSuccess(data);
        break;
    case IDBResultType::OpenDatabaseUpgradeNeeded:
        onUpgradeNeeded(data);
        break;
    default:
        RELEASE_ASSERT_NOT_REACHED();
    }
}
Exemplo n.º 3
0
bool HTTPTransaction::validateIngressStateTransition(
    HTTPTransactionIngressSM::Event event) {
  DestructorGuard g(this);

  if (!HTTPTransactionIngressSM::transit(ingressState_, event)) {
    std::stringstream ss;
    ss << "Invalid ingress state transition, state=" << ingressState_ <<
      ", event=" << event << ", streamID=" << id_;
    HTTPException ex(HTTPException::Direction::INGRESS_AND_EGRESS, ss.str());
    ex.setProxygenError(kErrorIngressStateTransition);
    ex.setCodecStatusCode(ErrorCode::INTERNAL_ERROR);
    // This will invoke sendAbort() and also inform the handler of the
    // error and detach the handler.
    onError(ex);
    return false;
  }
  return true;
}
Exemplo n.º 4
0
void TcpGateDialog::onNewConnection()
{
	if(m_ndListen.tcpSocket)
	{
		m_ndListen.tcpSocket->close();
		delete m_ndListen.tcpSocket;
	}
	
	m_ndListen.tcpSocket = m_ndListen.tcpServer->nextPendingConnection();
	connect(m_ndListen.tcpSocket, SIGNAL(disconnected()), this, SLOT(onDisConnected()));
	connect(m_ndListen.tcpSocket, SIGNAL(readyRead()), this, SLOT(onRead()));
	connect(m_ndListen.tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)),
		this, SLOT(onError(QAbstractSocket::SocketError)));
	
	Log2Main(tr("receive new connect%1:%2").arg(m_ndListen.tcpSocket->peerAddress().toString()).arg(m_ndListen.tcpSocket->peerPort()));
	
	m_ndListen.bConnected = true;
}
Exemplo n.º 5
0
execWindow::execWindow(QWidget *parent, const QString& info) :
    QDialog(parent),
    m_ui(new Ui::execWindow)
{
    m_ui->setupUi(this);
    m_proc = new QProcess(this);
    m_proc->setProcessChannelMode(QProcess::MergedChannels);

    connect(m_proc,SIGNAL(started()),this,SLOT(onStarted()));
    connect(m_proc,SIGNAL(error(QProcess::ProcessError)),this,SLOT(onError(QProcess::ProcessError)));
    connect(m_proc,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(onFinished(int)));
    connect(m_proc,SIGNAL(readyReadStandardOutput()),this,SLOT(onDataReady()) );

    if(info.isEmpty())
        m_ui->plainTextEdit->appendHtml(tr("<font color=gray>Sony PlayStation3 HD Movie Muxer<br>Copyright (C) 2011 Anton Burdinuk<br>[email protected]<br>http://code.google.com/p/tsdemuxer<br>---------------------------------------------------<br><br></font>"));
    else
        m_ui->plainTextEdit->appendHtml(info);
}
Exemplo n.º 6
0
void GameClient::onCommand(Session* session, Command* command)
{
    printf("GameClient::onCommand\n");
    switch(command->getId())
    {
    case PAMMO_COMMAND_STATUSUPDATE:
        onStatusUpdate((StatusUpdateCommand*)command);
        break;

    case PAMMO_COMMAND_ERROR:
        onError((ErrorCommand*)command);
        break;

    default:
        printf("GameClient received unknown command %d\n", command->getId());
        CommandFactory::deleteCommand(command);
    }
}
Exemplo n.º 7
0
void BooRedisAsync::connectComplete(const boost::system::error_code& error)
{
    if (!error)
    {
        m_connectTimer->cancel();
        readStart();
        m_onceConnected = true;
        m_connected = true;

        onLogMessage("Successfully connected to Redis " + endpointToString(getEndpointIterator()),LOG_LEVEL_INFO);
        onConnect();

        if (!m_writeInProgress && !m_writeBuffer.empty())
            writeStart();
    }
    else
        onError(error);
}
Exemplo n.º 8
0
void VoiceMessages::play(AudioData *audio) {
	QMutexLocker lock(&voicemsgsMutex);

	bool startNow = true;
	if (_data[_current].audio != audio) {
		switch (_data[_current].state) {
		case VoiceMessageStarting:
		case VoiceMessageResuming:
		case VoiceMessagePlaying:
			_data[_current].state = VoiceMessageFinishing;
			updateCurrentStarted();
			startNow = false;
			break;
		case VoiceMessagePausing: _data[_current].state = VoiceMessageFinishing; startNow = false; break;
		case VoiceMessagePaused: _data[_current].state = VoiceMessageStopped; break;
		}
		if (_data[_current].audio) {
			emit loaderOnCancel(_data[_current].audio);
			emit faderOnTimer();
		}
	}

	int32 index = 0;
	for (; index < AudioVoiceMsgSimultaneously; ++index) {
		if (_data[index].audio == audio) {
			_current = index;
			break;
		}
	}
	if (index == AudioVoiceMsgSimultaneously && ++_current >= AudioVoiceMsgSimultaneously) {
		_current -= AudioVoiceMsgSimultaneously;
	}
	_data[_current].audio = audio;
	_data[_current].fname = audio->already(true);
	_data[_current].data = audio->data;
	if (_data[_current].fname.isEmpty() && _data[_current].data.isEmpty()) {
		_data[_current].state = VoiceMessageStopped;
		onError(audio);
	} else if (updateCurrentStarted(0)) {
		_data[_current].state = startNow ? VoiceMessagePlaying : VoiceMessageStarting;
		_data[_current].loading = true;
		emit loaderOnStart(audio);
	}
}
void QSerienJunkiesReply::searchSeries(const QString &string)
{
    QByteArray postData;
    postData.append("string=");
    postData.append(string);

    QNetworkRequest request = QNetworkRequest(QUrl("http://serienjunkies.org/media/ajax/search/search.php"));
    request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");

    QNetworkReply *reply = QSerienJunkies::networkAccessManager()->post(request, postData);
    QObject::connect(reply, &QNetworkReply::finished,
                     this, &QSerienJunkiesReply::seriesSearchReplyFinished);

    QObject::connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
                     this, SLOT(onError()));

    QObject::connect(this, &QObject::destroyed,
                     reply, &QNetworkReply::deleteLater);
}
Exemplo n.º 10
0
/**
  Load execution implementation of throughput class
*/
bool MwtsIPerfThroughput::Exec()
{
	MWTS_ENTER;

	m_pReturnValue = false;

	// Connect to important signals
	connect( m_pProcess, SIGNAL(error(QProcess::ProcessError)), SLOT(onError(QProcess::ProcessError)) );
	connect( m_pProcess, SIGNAL(finished(int,QProcess::ExitStatus)), SLOT(onFinished(int,QProcess::ExitStatus)) );
	connect( m_pProcess, SIGNAL(started()), SLOT(onStarted()) );
	connect( m_pProcess, SIGNAL(stateChanged(QProcess::ProcessState)), SLOT(onStateChanged(QProcess::ProcessState)) );


	qDebug() << "Starting iPerf with params" << m_params;
	if ( m_pIperfRole == IPERF_CLIENT )
	{
		qDebug() << "Starting iperf in client role.";
		m_pProcess->start("iperf", m_params);
		qDebug() << "Wating for iperf to finish...";
		// We might use waitForFinished, but then we'd loose the ability to
		// use fail timeout
		//m_pProcess->waitForFinished(TEST_TIME_INT*1100);
		// Wait until iperf client has finished.
		g_pTest->Start();
		m_pProcess->disconnect();
	}
	else
	{
		qDebug() << "Starting iperf in server role.";
		m_pProcess->start("iperf", m_params);
		qDebug() << "Wating for iperf to start...";
		// We might use waitForStarted, but then we'd loose the ability to
		// use fail timeout
		//m_pProcess->waitForStarted(TEST_TIME_INT*1100);
		// Wait until iperf server has started.
		g_pTest->Start();
		// Mark the return vaue to true, for successfull start
		m_pReturnValue = true;
	}

	MWTS_LEAVE;
	return m_pReturnValue;
}
Exemplo n.º 11
0
void URLRequest::cancel(bool cleanup)
{
	if (_handle == NULL || !cleanup)
		return;

	g_Net->cancelRequest(this, cleanup);

	if (cleanup)
		_handle = NULL;

	LOG(0, "*** %s '%s' canceled\n", getTypeName(), _url.c_str());

	_canceled = true;
	_error = CURLE_ABORTED_BY_CALLBACK;
	onError(_error);

	if (_scriptWaitBlock)
		_scriptWaitBlock->signal(0x00);
}
Exemplo n.º 12
0
Worker::Worker(INotifyContextAccess *notifyContextAccess) :
    mNotifyContextAccess(notifyContextAccess),
    mWorker(new ThreadWorker())
{
    connect(mWorker, SIGNAL(connectedToServer()),
            this, SLOT(onConnectedToServer()), Qt::QueuedConnection);
    connect(mWorker, SIGNAL(disconnectedFromServer()),
            this, SLOT(onDisconnectedFromServer()));
    connect(mWorker, SIGNAL(error()),
            this, SLOT(onError()));
    connect(mWorker, SIGNAL(logMessage(QString)),
            this, SIGNAL(logMessage(QString)));
    mWorker->moveToThread(&mThread);
    mThread.start();

    connect(qApp, SIGNAL(aboutToQuit()),
            this, SLOT(quit()));

}
Exemplo n.º 13
0
RaceClient::RaceClient(QString host, int port, QObject *parent)
{
    m_host = host;
    m_port = port;

    m_socket = new QTcpSocket(this);
    m_state = RaceClient::Connecting;
    createNet(false);
    emit stateChanged(m_state);

    connect(m_socket, SIGNAL(readyRead()),
            this, SLOT(readFromServer()));

    connect(m_socket, SIGNAL(connected()),
            this, SLOT(onConnected()));

    connect(m_socket, SIGNAL(error(QAbstractSocket::SocketError)),
            this, SLOT(onError(QAbstractSocket::SocketError)));
}
Exemplo n.º 14
0
void HTTPTransaction::onIngressEOM() {
  if (isIngressEOMSeen()) {
    // This can happen when HTTPSession calls onIngressEOF()
    sendAbort(ErrorCode::STREAM_CLOSED);
    return;
  }
  if (expectedContentLengthRemaining_.hasValue() &&
      expectedContentLengthRemaining_.value() > 0) {
    auto errorMsg = folly::to<std::string>(
        "Content-Length/body mismatch: expecting another ",
        expectedContentLengthRemaining_.value());
    LOG(ERROR) << *this << " " << errorMsg;
    if (handler_) {
      HTTPException ex(HTTPException::Direction::INGRESS, errorMsg);
      ex.setProxygenError(kErrorParseBody);
      onError(ex);
    }
    return;
  }

  // TODO: change the codec to not give an EOM callback after a 100 response?
  // We could then delete the below 'if'
  if (isUpstream() && extraResponseExpected()) {
    VLOG(4) << "Ignoring EOM on initial 100 response on " << *this;
    return;
  }
  if (!validateIngressStateTransition(
        HTTPTransactionIngressSM::Event::onEOM)) {
    return;
  }
  // We need to update the read timeout here.  We're not likely to be
  // expecting any more ingress, and the timer should be cancelled
  // immediately.  If we are expecting more, this will reset the timer.
  updateReadTimeout();
  if (mustQueueIngress()) {
    checkCreateDeferredIngress();
    deferredIngress_->emplace(id_, HTTPEvent::Type::MESSAGE_COMPLETE);
    VLOG(4) << *this << " Queued ingress event of type " <<
      HTTPEvent::Type::MESSAGE_COMPLETE;
  } else {
    processIngressEOM();
  }
}
Exemplo n.º 15
0
void GStreamerPipeline::handleBusMessage( const QGst::MessagePtr &message )
{
    switch( message->type() ) {
    case( QGst::MessageEos ):
        onEos();
        break;
    case( QGst::MessageError ):
        onError( message.staticCast<QGst::ErrorMessage>() );
        break;
    case( QGst::MessageBuffering ):
        onBuffering( message.staticCast<QGst::BufferingMessage>() );
        break;
    case( QGst::MessageClockLost ):
        qDebug() << "Clock Lost!";
        mPipeline->setState( QGst::StatePaused );
        mPipeline->setState( QGst::StatePlaying );
        break;
    }
}
Exemplo n.º 16
0
void XYTCPSocketLayer::ReadSocket()
{
	while(_IsReadThreadRunning)
	{
		usleep(5000);

		if(!_IsReadThreadRunning)
		{
			break;
		}

		char* pOut = new char[MAX_BYTE_READ_ONCE];
		ssize_t readSize = Readn(_fd, pOut, MAX_BYTE_READ_ONCE);
		if(readSize > 0)
		{
			//dispatch data
			onReceive(pOut, readSize);

			bzero(pOut, MAX_BYTE_READ_ONCE);
			delete [] pOut;
		}
		else if(readSize == 0)
		{
			//dispatch disconnect
            onDisconnect(XYNetworkErrorCode(XYNetworkErrorCode::eXYNetworkErrorCode::SERVER_DISCONNECT));

			bzero(pOut, MAX_BYTE_READ_ONCE);
			delete [] pOut;

			_IsReadThreadRunning = false;
			_stat = States_Disconnected;
			break;
		}
		else
		{
			//dispatch read error
            onError(XYNetworkErrorCode(XYNetworkErrorCode::eXYNetworkErrorCode::READ_ERROR));
			bzero(pOut, MAX_BYTE_READ_ONCE);
			delete [] pOut;
		}
	}
	return;
}
Exemplo n.º 17
0
void ReplyFetcher::start(QNetworkAccessManager *nam, QNetworkRequest request, QByteArray postData)
{
    httpStatusCode_= 0;
    errorText_.clear();
    receivedData_.clear();
    success_ = true; // not in finished() signal handler, it might be not called according to the docs
                     // besides, I've added timeout feature
    lastNetworkTime_ = QDateTime::currentMSecsSinceEpoch();
    ticker_->start(1000);
    if(postData.isNull()) {
        reply = QSharedPointer<QNetworkReply>(nam->get(request), &QObject::deleteLater);
    } else {
        reply = QSharedPointer<QNetworkReply>(nam->post(request, postData), &QObject::deleteLater);
    }
    connect(reply.data(), SIGNAL(finished()), this, SLOT(onFinished()));
    connect(reply.data(), SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onError()));
    connect(reply.data(), SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(onSslErrors(QList<QSslError>)));
    connect(reply.data(), SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(onDownloadProgress(qint64,qint64)));
}
Exemplo n.º 18
0
void CreateProgPage::onComplete(gcString& path)
{
	gcFrame* par = dynamic_cast<gcFrame*>(GetParent());
	gcException eFailCrtMCF(ERR_BADPATH, "Failed to create MCF");
	if (par)
		par->setProgressState(gcFrame::P_NONE);

	if (UTIL::FS::isValidFile(UTIL::FS::PathWithFile(path)))
	{
		CreateMCFForm* temp = dynamic_cast<CreateMCFForm*>(GetParent());

		if (temp)
			temp->showOverView(path.c_str());
	}
	else
	{
		onError(eFailCrtMCF);
	}
}
Exemplo n.º 19
0
// addSession
void srv::CServerEngin::addSession( zz::CSocket* pSocket )
{
	if (!pSocket || !pSocket->isValid())
		return;
	t_SocketPtr spSocket( pSocket );

	m_oMutex.lock();  // Lock
	m_hshSockets.insert( pSocket, spSocket );
	// Make Connections
	QObject::connect( pSocket, SIGNAL( sigNewRequest(zz::CRequest*) ),
					  this, SLOT( onNewRequest(zz::CRequest*) ) );
	QObject::connect( pSocket, SIGNAL( sigRequestWasSent() ),
					  this, SLOT( onRequestWasSent() ) );
	QObject::connect( pSocket, SIGNAL( disconnected() ),
					  this, SLOT( onDisconnected() ) );
	QObject::connect( pSocket, SIGNAL( error() ),
					  this, SLOT( onError() ) );
	m_oMutex.unlock(); // Unlock
}
Exemplo n.º 20
0
int	SyntroSocket::sockCreate(int nSocketPort, int nSocketType, int nFlags)
{
	bool	ret;

	m_sockType = nSocketType;
	m_sockPort = nSocketPort;
	switch (m_sockType) {
		case SOCK_DGRAM:
			m_UDPSocket = new QUdpSocket(this);
			connect(m_UDPSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(onError(QAbstractSocket::SocketError)));
			connect(m_UDPSocket, SIGNAL(stateChanged ( QAbstractSocket::SocketState) ), this, SLOT(onState( QAbstractSocket::SocketState)));
			if (nFlags)
				ret = m_UDPSocket->bind(nSocketPort, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint);
			else
				ret = m_UDPSocket->bind(nSocketPort);
			return ret;

		case SOCK_STREAM:
            if (m_encrypt) {
		        m_TCPSocket = new QSslSocket(this);
                connect((QSslSocket *)m_TCPSocket, SIGNAL(sslErrors(const QList<QSslError>&)),
                    this, SLOT(sslErrors(const QList<QSslError>&)));
                connect((QSslSocket *)m_TCPSocket, SIGNAL(peerVerifyError(const QSslError&)),
                    this, SLOT(peerVerifyError(const QSslError&)));
                ((QSslSocket *)m_TCPSocket)->setPeerVerifyMode(QSslSocket::VerifyNone);
           } else {
		        m_TCPSocket = new QTcpSocket(this);
		        connect(m_TCPSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(onError(QAbstractSocket::SocketError)));
            }
		    connect(m_TCPSocket, SIGNAL(stateChanged( QAbstractSocket::SocketState) ), this, SLOT(onState( QAbstractSocket::SocketState)));
			return 1;

		case SOCK_SERVER:
            if (m_encrypt)
			    m_server = new SSLServer(this);
            else
			    m_server = new TCPServer(this);
			return 1;

		default:
			logError(QString("Socket create on illegal type %1").arg(nSocketType));
			return 0;
	}
Exemplo n.º 21
0
int EdStream::handleEvents(short event)
{
    int ret = 0;
    LS_DBG_L("EdStream::handleEvent(), fd: %d, event: %hd", getfd(), event);
    if (event & POLLIN)
    {
        ret = onRead();
        if (!getAssignedRevent())
            goto EVENT_DONE;
    }
    if (event & POLLHUP)
    {
        if ((ret != -1) || (getHupCounter() > 50))
            ret = onHangup();
        else if (getHupCounter() > 100)
            abort();
        if (!getAssignedRevent())
            goto EVENT_DONE;
    }
    if ((ret != -1) && (event & POLLHUP))
    {
        ret = onHangup();
        if (!getAssignedRevent())
            return 0;
    }
    if ((ret != -1) && (event & POLLOUT))
    {
        ret = onWrite();
        if (!getAssignedRevent())
            goto EVENT_DONE;
    }
    if ((ret != -1) && (event & POLLERR))
    {
        ret = onError();
        if (!getAssignedRevent())
            return 0;
    }
EVENT_DONE:    
    if (ret != -1)
        onEventDone(event);
    return 0;
}
Exemplo n.º 22
0
void MainWindow::doConvertSPE()
{
    int     i               = 0;
    int     err             = 0;
    int     stopProgress    = 0;

    QString s_FilenameIn    = "";
    QString s_FilenameOut   = "";

// **********************************************************************************************

    if ( existsFirstFile( gi_ActionNumber, gs_FilenameFormat, gi_Extension, gsl_FilenameList ) == true )
    {
        initFileProgress( gsl_FilenameList.count(), gsl_FilenameList.at( 0 ), tr( "Converting SPE data..." ) );

        while ( ( i < gsl_FilenameList.count() ) && ( err == _NOERROR_ ) && ( stopProgress != _APPBREAK_ ) )
        {
            if ( buildFilename( gi_ActionNumber, gs_FilenameFormat, gi_Extension, gsl_FilenameList.at( i ), s_FilenameIn, s_FilenameOut ) == true )
            {
                err = convertSPE( s_FilenameIn, s_FilenameOut, gi_CodecInput, gi_CodecOutput, gi_EOL, gsl_FilenameList.count() );

                stopProgress = incFileProgress( gsl_FilenameList.count(), ++i );
            }
            else
            {
                err = _FILENOTEXISTS_;
            }
        }

        resetFileProgress( gsl_FilenameList.count() );
    }
    else
    {
        err = _CHOOSEABORTED_;
    }

// **********************************************************************************************

    endTool( err, stopProgress, gi_ActionNumber, gs_FilenameFormat, gi_Extension, gsl_FilenameList, tr( "Done" ), tr( "Converting SPE data was canceled" ) );

    onError( err );
}
Exemplo n.º 23
0
MainWindow::MainWindow(const QString &defaultDisplay, QSplashScreen *splash, QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    _qpd(NULL), _kcpos(0), _defaultDisplay(defaultDisplay),
    _silent(false), _allowSilent(false), _splash(splash), _settings(NULL),
    _activatedEth(false), _numInstalledOS(0), _netaccess(NULL), _displayModeBox(NULL)
{
    ui->setupUi(this);
    setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint);
    setContextMenuPolicy(Qt::NoContextMenu);
    update_window_title();
    _kc << 0x01000013 << 0x01000013 << 0x01000015 << 0x01000015 << 0x01000012
        << 0x01000014 << 0x01000012 << 0x01000014 << 0x42 << 0x41;
    ui->list->setItemDelegate(new TwoIconsDelegate(this));
    ui->list->installEventFilter(this);
    ui->advToolBar->setVisible(false);

    QRect s = QApplication::desktop()->screenGeometry();
    if (s.height() < 500)
        resize(s.width()-10, s.height()-100);

    if (qApp->arguments().contains("-runinstaller") && !_partInited)
    {
        /* Repartition SD card first */
        _partInited = true;
        setEnabled(false);
        _qpd = new QProgressDialog( tr("Setting up SD card"), QString(), 0, 0, this);
        _qpd->setWindowModality(Qt::WindowModal);
        _qpd->setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint);

        InitDriveThread *idt = new InitDriveThread(this);
        connect(idt, SIGNAL(statusUpdate(QString)), _qpd, SLOT(setLabelText(QString)));
        connect(idt, SIGNAL(completed()), _qpd, SLOT(deleteLater()));
        connect(idt, SIGNAL(error(QString)), this, SLOT(onError(QString)));
        connect(idt, SIGNAL(query(QString, QString, QMessageBox::StandardButton*)),
                this, SLOT(onQuery(QString, QString, QMessageBox::StandardButton*)),
                Qt::BlockingQueuedConnection);

        idt->start();
        _qpd->exec();
        setEnabled(true);
    }
Exemplo n.º 24
0
void OpenSSLContext::doConnect() {
	int connectResult = SSL_connect(handle_);
	int error = SSL_get_error(handle_, connectResult);
	switch (error) {
		case SSL_ERROR_NONE: {
			state_ = Connected;
			//std::cout << x->name << std::endl;
			//const char* comp = SSL_get_current_compression(handle_);
			//std::cout << "Compression: " << SSL_COMP_get_name(comp) << std::endl;
			onConnected();
			break;
		}
		case SSL_ERROR_WANT_READ:
			sendPendingDataToNetwork();
			break;
		default:
			state_ = Error;
			onError(boost::make_shared<TLSError>());
	}
}
Exemplo n.º 25
0
void MainWindow::doSetOverwriteDatasetFlag()
{
    int err = _NOERROR_;

    if ( gb_OverwriteDataset == true )
      gb_OverwriteDataset = false;
    else
      gb_OverwriteDataset = true;

// **********************************************************************************************

    setOverwriteDatasetFlagAction->setChecked( gb_OverwriteDataset );

// **********************************************************************************************

    if ( gb_OverwriteDataset == true )
        err = readBsrnDatasetIDs();

    onError( err );
}
Exemplo n.º 26
0
void DownloadTask::start()
{
	Q_ASSERT(state_ != Unvalid);
	state_ = Start;

	if (name_.isEmpty())
	{
		splitName();
	}
	
	QNetworkRequest request(url_);
	QString range("bytes=%1-");
	range = range.arg(progress_);
	request.setRawHeader("Range", range.toAscii());
	QNetworkReply *reply = networkMgr_->get(request);
	connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(onDownloadProgress(qint64, qint64)));
	connect(reply, SIGNAL(finished()), this, SLOT(onFinished()));
	connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onError(QNetworkReply::NetworkError)));
	speedTest_.lastMSecsSinceEpoch_ = QDateTime::currentMSecsSinceEpoch();
}
Exemplo n.º 27
0
void Connection::onSendCompleted(const asio::error_code& e)
{
	if ( e )
	{
		m_socket.close();

		onError(e);

		return;
	}

	// 락 범위
	{
		asio::detail::mutex::scoped_lock sl( m_sendLock ); 

		m_sending = false;
	}

	requestSend();
}
Exemplo n.º 28
0
void Connection::onRecvCompleted(const asio::error_code& e, std::size_t bytes_transferred)
{
	if ( e )
	{
		m_socket.close();

		onError(e);

		return;
	}

	if ( bytes_transferred > 0 )
	{
		m_recvBuf.write( m_buffer.data(), bytes_transferred );	

		packetize();
	}

	requestRecv();
}
Exemplo n.º 29
0
void Tasks::exec(Task* t, bool foreground) {

	// setup signals
	connect(t, SIGNAL(onStart()), this, SLOT(onTaskStart()), Qt::AutoConnection);
	connect(t, SIGNAL(onProgress(TaskStatus)), this, SLOT(onTaskProgress(TaskStatus)), Qt::AutoConnection);
	connect(t, SIGNAL(onDone()), this, SLOT(onTaskDone()), Qt::AutoConnection);
	connect(t, SIGNAL(onError(QString)), this, SLOT(onTaskError(QString)), Qt::AutoConnection);

	// run (will trigger start, progress, done)
	t->run();

	// done
	//TaskStatus ts("", 1);
	//emit onTaskProgress(ts);

	// the task will be deleted, after he sent the onDone() signal
	// AND this signal has been processed by the event loop.
	// see "Tasks::onTaskDone()" below.

}
Exemplo n.º 30
0
void ZipPlugin::loadArchive()
{
    m_archive->open(QIODevice::ReadOnly);

    if (!m_archive->isOpen()) {
        onError(i18n("An error occurred. Could not open archive <b>%1</b>", m_archive->fileName()));
        return;
    }

    m_currentPath.clear();
    m_entries.clear();

    getEntries(m_archive->directory());

    m_archive->close();


    onArchiveLoaded(m_entries);

}