Exemplo n.º 1
0
/**
 * Inherited from HighLevelHttpConnection.
 * Called when the HTTP connection has finished
 * downloading data.
 * Calls onDownloadComplete.
 * @param data Handle to the data, will be
 * 0 on error, > 0 on success.
 * @param result Result code, RES_OK on success,
 * otherwise an HTTP error code.
 */
void HighLevelImageDownloader::dataDownloaded(MAHandle data, int result)
{
	// The resulting image.
	MAHandle image = 0;

	// Do we have any data?
	if (data)
	{
		// Convert data to image.
		image = maCreatePlaceholder();
		int res = maCreateImageFromData(
			image,
			data,
			0,
			maGetDataSize(data));

		// Do we have an error?
		if (RES_OUT_OF_MEMORY == res)
		{
			// The image could not be created, set data handle to zero.
			image = 0;
		}

		// Deallocate the data object, we are done with it.
		maDestroyPlaceholder(data);
	}

	// Notify download complete.
	onDownloadComplete(image);
}
Exemplo n.º 2
0
/**
 * Inherited from HighLevelHttpConnection.
 * Called when the HTTP connection has finished
 * downloading data.
 * Calls onDownloadComplete.
 * @param data Handle to the data, will be
 * 0 on error, > 0 on success.
 * @param result Result code, RES_OK on success,
 * otherwise an HTTP error code.
 */
void HighLevelTextDownloader::dataDownloaded(MAHandle data, int result)
{
	// The resulting text.
	char* text = NULL;

	// Do we have any data?
	if (data)
	{
		// Copy data to string.
		int size = maGetDataSize(data);
		text = new char[size + 1];
		if (text)
		{
			maReadData(data, text, 0, size);
			text[size] = '\0'; // Zero terminate string
		}

		// Deallocate the data object, we are done with it.
		maDestroyObject(data);
	}

	// Notify download complete.
	onDownloadComplete(text);

	// Delete myself!
	delete this;
}
Exemplo n.º 3
0
WebBridgeRS::WebBridgeRS(QObject *parent) :
    QObject(parent)
{
    this->setObjectName("bridge");
    //rsFiles->getSharedDirectories();
    //embpyqt = new EmbeddedPyQt();
    //todo, perhaps - deeper intergration with retroshare-gui
    //MainWindow *pMainWindow = MainWindow::getInstance();
    //pMainWindow->forumsDialog->
    //pMainWindow->chatLobbyDialog->
    //pMainWindow->//blast - adding actions/plugins is private...
    connect(NotifyQt::getInstance(), SIGNAL(downloadComplete(QString)), this, SLOT(onDownloadComplete(QString)));
    connect(NotifyQt::getInstance(), SIGNAL(gotTurtleSearchResult(qulonglong,FileDetail)), this, SLOT(gotTurtleSearchResult(qulonglong,FileDetail)));

}