Beispiel #1
0
void IOThread::run() {
    while (1) {
        Request r = queue.pull();

        switch (r.type) {
        case Stop:
            return;
        case Load:
            if (queue.size() < 8) {
                // start ignoring old loads if I get hammered with requests
                r.image->load();
                emit loadFinished(r.image);
                break;
            }
        case Save:
            r.image->save();
            emit saveFinished(r.image);
            break;
        case LoadThumbnail:
            if (queue.size() < 8) {
                // start ignoring old loads if I get hammered with requests
                r.image->loadThumbnail();
                emit loadFinished(r.image);
                break;
            }
        case Demosaic:
            r.image->demosaic();
            emit demosaicFinished();        
            break;
        }

    }
}
void ModelBackendOneFile::addDir ( const QString& dirPath )
{
    // IMPORTANT: Keep in mind that the dirPath is not guaranteed to exist during the whole function (i.e a SD card may be extracted)
    QString path(QDir::cleanPath(dirPath));// Copy of the reference dirPath

    m_pathsMount.insert(path, false);

    // Load path files MetaInfo
    bool bRet = loadMetaInfo(path);
    if(!bRet)
    {
        qWarning() << Q_FUNC_INFO << "Error loading metaInfo, exiting";
        removeDir(path);// TODO: Do partial remove to make it faster
        return;
    }

    // Load path dir looking for new files
    QStringList booksPaths;
    bRet = booksToLoad(path, booksPaths);
    if(!bRet)
    {
        qDebug() << Q_FUNC_INFO << "Error loading books, Exiting";
        removeDir(path);// TODO: Do partial remove to make it faster
        return;
    }

    qDebug() << Q_FUNC_INFO << "Books to load: " << booksPaths;

    int totalBooks = booksPaths.size();
    if(path != _privatePartition)
    {
        if(totalBooks > BOOKS_LOADED_TO_SHOW_DIALOG) // For 20 books or more it shows progress dialog
            emit loadingBooks(totalBooks);
    }

    bRet = load(booksPaths);
    if(!bRet)
    {
        qDebug() << Q_FUNC_INFO << "Error. Exiting";
        removeDir(path);// TODO: Do partial remove to make it faster
        emit loadFinished();
        return;
    }

    qDebug() << Q_FUNC_INFO << "Before load finished";

    emit loadFinished();

    qDebug() << Q_FUNC_INFO << "After load finished";

    qDebug() << Q_FUNC_INFO << "dir path: " << path << "_privatePartition: " << _privatePartition;
    if(QDir::cleanPath(path) == QDir::cleanPath(_privatePartition))
        loadArchivedBooks();

    messDir(path, UPDATE_FULL);
}
Beispiel #3
0
UrlLoader::UrlLoader(BrowserWindow* browserWindow, const QString& inputFileName, int timeoutSeconds, int extraTimeSeconds)
    : m_browserWindow(browserWindow)
    , m_stdOut(stdout)
    , m_loaded(0)
    , m_numFramesLoading(0)
{
    m_checkIfFinishedTimer.setInterval(200);
    m_checkIfFinishedTimer.setSingleShot(true);
    connect(&m_checkIfFinishedTimer, SIGNAL(timeout()), this, SLOT(checkIfFinished()));
    // loadStarted and loadFinished on QWebPage is emitted for each frame/sub-frame
    connect(m_browserWindow->webView(), SIGNAL(loadingChanged(QWebLoadRequest*)), this, SLOT(loadingChanged(QWebLoadRequest*)));
    connect(this, SIGNAL(loadStarted()), this, SLOT(frameLoadStarted()));
    connect(this, SIGNAL(loadFinished()), this, SLOT(frameLoadFinished()));

    if (timeoutSeconds) {
        m_timeoutTimer.setInterval(timeoutSeconds * 1000);
        m_timeoutTimer.setSingleShot(true);
        connect(this, SIGNAL(loadStarted()), &m_timeoutTimer, SLOT(start()));
        connect(&m_timeoutTimer, SIGNAL(timeout()), this, SLOT(loadNext()));
    }
    if (extraTimeSeconds) {
        m_extraTimeTimer.setInterval(extraTimeSeconds * 1000);
        m_extraTimeTimer.setSingleShot(true);
        connect(this, SIGNAL(pageLoadFinished()), &m_extraTimeTimer, SLOT(start()));
        connect(&m_extraTimeTimer, SIGNAL(timeout()), this, SLOT(loadNext()));
    } else
        connect(this, SIGNAL(pageLoadFinished()), this, SLOT(loadNext()));
    loadUrlList(inputFileName);
}
Beispiel #4
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    connect(ui->searchButton, SIGNAL(clicked(bool)), this, SLOT(startSearch()));

    m_view = new QWebView;
    DatabaseConnector databaseConnector("localhost", dbFile().absoluteFilePath(), "admin", "admin");
    databaseConnector.connect();


    m_domainsModel = std::shared_ptr<QSqlQueryModel>(new QSqlQueryModel);
    m_domainsModel->setQuery("SELECT * FROM Domains");
    m_domainsModel->setHeaderData(0, Qt::Horizontal, tr("ID"));
    m_domainsModel->setHeaderData(1, Qt::Horizontal, tr("Domain"));

    ui->domainsView->setModel(m_domainsModel.get());
    ui->domainsView->resizeColumnsToContents();

    m_keywordsModel = std::shared_ptr<QSqlQueryModel>(new QSqlQueryModel);
    ui->keywordsView->setModel(m_keywordsModel.get());
    connect(ui->domainsView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(onDomainIndexChanged(QModelIndex,QModelIndex)));
    std::shared_ptr<OpenGoogle>command(new OpenGoogle(m_view));
    connect(command.get(), SIGNAL(loadFinished()), this, SLOT(onPageLoaded()));
    runCommand(command);

}
Beispiel #5
0
void Document::reload(bool prompt)
{
	// Abort if there is no file to reload
	if (m_index) {
		return;
	}

	// Confirm that they do want to reload
	if (prompt) {
		QMessageBox mbox(window());
		mbox.setIcon(QMessageBox::Question);
		mbox.setWindowTitle(tr("Reload File"));
		mbox.setText(tr("Reload the file %1 from disk?").arg("<i>" + QFileInfo(m_filename).fileName() + "</i>"));
		mbox.setInformativeText(tr("All unsaved changes will be lost."));

		QPushButton* reload_button = mbox.addButton(tr("Reload"), QMessageBox::AcceptRole);
		if (reload_button->style()->styleHint(QStyle::SH_DialogButtonBox_ButtonsHaveIcons)) {
			reload_button->setIcon(reload_button->style()->standardIcon(QStyle::SP_BrowserReload));
		}
		mbox.addButton(QMessageBox::Cancel);
		mbox.setDefaultButton(reload_button);

		if (mbox.exec() == QMessageBox::Cancel) {
			return;
		}
	}

	// Reload file
	emit loadStarted(Window::tr("Opening %1").arg(QDir::toNativeSeparators(m_filename)));
	m_text->setReadOnly(true);
	disconnect(m_text->document(), SIGNAL(contentsChange(int,int,int)), this, SLOT(updateWordCount(int,int,int)));
	disconnect(m_text->document(), SIGNAL(undoCommandAdded()), this, SLOT(undoCommandAdded()));
	loadFile(m_filename, -1);
	emit loadFinished();
}
BDHServerController::BDHServerController(QObject *parent)
    :QObject(parent)
{
    m_dataStorage = new SQLiteDatabase(this);
    m_ahpServer = new AHP::AHPServer(this,this);
    m_dataAcquisition = new DataAcquisition(this);
    m_realtimeCache = new RealtimeCache(this);
    m_collectorInterface = nullptr;
    m_configurationLoader = new XmlLoader(this);

    m_alarmCounter = 0;
    m_myIP = selectHostAddress().toString();
    m_myPort = 9999;

    connect(this,SIGNAL(newVariablePoint(quint32,quint8,qulonglong,QVariant)),m_realtimeCache,SLOT(storeVariablePoint(quint32,quint8,quint64,QVariant)));

    //! Acquisition Simulation
    connect(m_dataAcquisition,SIGNAL(incommingAlarmPoint(quint32,AlarmState,quint64)),m_dataStorage,SLOT(storeIncommingAlarmPoint(quint32,AlarmState,quint64)));
    connect(m_dataAcquisition,SIGNAL(incommingVariablePoint(quint32,quint8,quint64,QVariant)),m_realtimeCache,SLOT(storeVariablePoint(quint32,quint8,quint64,QVariant)));

    //! Connection between RealtimeCache and SQLiteDatabase to persist data
    connect(m_realtimeCache,SIGNAL(persistData(quint32,quint8,quint64,QVariant)),m_dataStorage,SLOT(storeIncommingVariablePoint(quint32,quint8,quint64,QVariant)));

    //! Configuration connects
    connect(m_configurationLoader,SIGNAL(loadFinished()),SLOT(configurationLoadFinish()));

    connect(m_configurationLoader,SIGNAL(newCollector(QXmlAttributes)),this,SLOT(addConfigurationCollector(QXmlAttributes)));
    connect(m_configurationLoader,SIGNAL(newVariable(QXmlAttributes)),this,SLOT(addConfigurationVariable(QXmlAttributes)));
    connect(m_configurationLoader,SIGNAL(newAlarm(QXmlAttributes)),this,SLOT(addConfigurationAlarm(QXmlAttributes)));
    connect(m_configurationLoader,SIGNAL(newBDH(QXmlAttributes)),this,SLOT(addConfigurationBDH(QXmlAttributes)));
}
Beispiel #7
0
void KCTranslator::translationRequestFinished()
{
	// Read the response body
	QNetworkReply *reply(qobject_cast<QNetworkReply*>(QObject::sender()));
	if(reply->error() != QNetworkReply::NoError)
	{
		emit loadFailed(QString("Network Error: %1").arg(reply->errorString()));
		return;
	}
	QByteArray body(reply->readAll());

	// Parse the JSON
	QJsonParseError error;
	QJsonDocument doc(QJsonDocument::fromJson(body, &error));
	if(error.error != QJsonParseError::NoError)
	{
		emit loadFailed(QString("JSON Error: %1").arg(error.errorString()));
		return;
	}
	QJsonObject root(doc.object());

	// Check the response
	int success = (int) root.value("success").toDouble();
	if(success != 1)
	{
		emit loadFailed(QString("API Error %1").arg(success));
		return;
	}

	// Parse the translation data
	translation = root.value("translation").toObject().toVariantMap();

	emit loadFinished();
}
Beispiel #8
0
void BrowserWindow::loadFinish(bool ok)
{
    emit loadFinished(ok);
    progressLabel->setText(ok ? tr("Loaded") : tr("Canceled"));
#ifdef DEBUG
    qDebug("loadFinished(%s)", ok ? "true" : "false");
#endif
}
Beispiel #9
0
/**
 * @brief Called when the movie infos are downloaded
 * @see OFDb::parseAndAssignInfos
 */
void OFDb::loadFinished()
{
    QNetworkReply *reply = static_cast<QNetworkReply*>(QObject::sender());
    Movie *movie = reply->property("storage").value<Storage*>()->movie();
    QString ofdbId = reply->property("ofdbId").toString();
    QList<int> infos = reply->property("infosToLoad").value<Storage*>()->infosToLoad();
    int notFoundCounter = reply->property("notFoundCounter").toInt();
    if (!movie)
        return;

    if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 302 ||
        reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 301) {
        qDebug() << "Got redirect" << reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
        reply->deleteLater();
        reply = qnam()->get(QNetworkRequest(reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl()));
        reply->setProperty("storage", Storage::toVariant(reply, movie));
        reply->setProperty("ofdbId", ofdbId);
        reply->setProperty("infosToLoad", Storage::toVariant(reply, infos));
        connect(reply, SIGNAL(finished()), this, SLOT(loadFinished()));
        return;
    }

    if (reply->error() == QNetworkReply::ContentNotFoundError && notFoundCounter < 3) {
        qWarning() << "Got 404";
        notFoundCounter++;
        reply->deleteLater();
        QUrl url(QString("http://ofdbgw.org/movie/%1").arg(ofdbId));
        reply = qnam()->get(QNetworkRequest(url));
        reply->setProperty("storage", Storage::toVariant(reply, movie));
        reply->setProperty("ofdbId", ofdbId);
        reply->setProperty("notFoundCounter", notFoundCounter);
        reply->setProperty("infosToLoad", Storage::toVariant(reply, infos));
        connect(reply, SIGNAL(finished()), this, SLOT(loadFinished()));
        return;
    }


    if (reply->error() == QNetworkReply::NoError ) {
        QString msg = QString::fromUtf8(reply->readAll());
        parseAndAssignInfos(msg, movie, infos);
    } else {
        qWarning() << "Network Error" << reply->errorString();
    }
    reply->deleteLater();
    movie->controller()->scraperLoadDone(this);
}
void PendingInterfaceInternal::loadInterface(QSharedPointer<EnhancedQDBusAbstractInterface> interface)
{
    if (interface->hasInitialProperties()) {
        QTimer::singleShot(0, this, SLOT(loadFinished()));
    } else {
        interface->fetchInitialProperties();
        connect(interface.data(), &EnhancedQDBusAbstractInterface::initialPropertiesFetched, this, &PendingInterfaceInternal::loadFinished);
    }
}
Beispiel #11
0
void CProgram::rejigIncludes()
{
	archiveModel();
	killIncludeds();
	// Import declarations.
	GccXml::extractHeaders(qs(includeCode()), GccXml::declarationsHandler(this));
	// De-archive pointers;
//	ModelPtrRegistrar::get()->restorePtrs(this);
	loadFinished();
}
Beispiel #12
0
void CProgram::initWithModules(List<Module*> const& _ps)
{
	foreach (Module* p, _ps)
		p->move(back());

	ChangeMan::get()->sleep();
	GccXml::extractHeaders(qs(includeCode()), GccXml::declarationsHandler(this));
//	ModelPtrRegistrar::get()->restorePtrs(this);
	ChangeMan::get()->wake();
	loadFinished();
}
Beispiel #13
0
void QDeclarativeWebView::doLoadFinished(bool ok)
{
    if (ok) {
        d->status = d->url.isEmpty() ? Null : Ready;
        emit loadFinished();
    } else {
        d->status = Error;
        emit loadFailed();
    }
    emit statusChanged(d->status);
}
Beispiel #14
0
/**
 * @brief Starts network requests to download infos from Cinefacts
 * @param id Cinefacts movie ID
 * @param movie Movie object
 * @param infos List of infos to load
 * @see Cinefacts::loadFinished
 */
void Cinefacts::loadData(QMap<ScraperInterface*, QString> ids, Movie *movie, QList<int> infos)
{
    movie->clear(infos);

    QUrl url(QString("http://www.cinefacts.de/Filme/%1").arg(ids.values().first()));
    QNetworkReply *reply = qnam()->get(QNetworkRequest(url));
    reply->setProperty("storage", Storage::toVariant(reply, movie));
    reply->setProperty("cinefactsId", ids.values().first());
    reply->setProperty("infosToLoad", Storage::toVariant(reply, infos));
    connect(reply, SIGNAL(finished()), this, SLOT(loadFinished()));
}
Beispiel #15
0
void Player::loadThreadFinished()
{
    // async load in player done
    qDebug() << Q_FUNC_INFO <<":"<<parentWidget()->objectName();
    p->isLoaded=true;
    emit loadFinished();

    if (p->isStarted) {
        play();
    }
}
Beispiel #16
0
/**
 * @brief Starts network requests to download infos from VideoBuster
 * @param id VideoBuster movie ID
 * @param movie Movie object
 * @param infos List of infos to load
 * @see VideoBuster::loadFinished
 */
void VideoBuster::loadData(QString id, Movie *movie, QList<int> infos)
{
    qDebug() << "Entered, id=" << id << "movie=" << movie->name();
    movie->clear(infos);

    QUrl url(QString("https://www.videobuster.de%1").arg(id));
    QNetworkReply *reply = this->qnam()->get(QNetworkRequest(url));
    reply->setProperty("storage", Storage::toVariant(reply, movie));
    reply->setProperty("infosToLoad", Storage::toVariant(reply, infos));
    connect(reply, SIGNAL(finished()), this, SLOT(loadFinished()));
}
Beispiel #17
0
void QuickPhraseModel::load()
{
    QThread* thread = new QThread;
    m_parser->moveToThread(thread);
    connect(thread, SIGNAL(started()), m_parser, SLOT(run()));
    thread->start();
    connect(m_parser, SIGNAL(finished()), thread, SLOT(quit()));
    connect(thread, SIGNAL(finished()), this, SLOT(loadFinished()));
    //delete thread only when thread has really finished
    connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
    connect(thread, SIGNAL(terminated()), thread, SLOT(deleteLater()));
}
Beispiel #18
0
/**
 * @brief Starts network requests to download infos from OFDb
 * @param id OFDb movie ID
 * @param movie Movie object
 * @param infos List of infos to load
 * @see OFDb::loadFinished
 */
void OFDb::loadData(QMap<ScraperInterface*, QString> ids, Movie *movie, QList<int> infos)
{
    movie->clear(infos);

    QUrl url(QString("http://ofdbgw.org/movie/%1").arg(ids.values().first()));
    QNetworkReply *reply = qnam()->get(QNetworkRequest(url));
    reply->setProperty("storage", Storage::toVariant(reply, movie));
    reply->setProperty("ofdbId", ids.values().first());
    reply->setProperty("notFoundCounter", 0);
    reply->setProperty("infosToLoad", Storage::toVariant(reply, infos));
    connect(reply, SIGNAL(finished()), this, SLOT(loadFinished()));
}
Beispiel #19
0
void CProgram::removeModule(Module* _p)
{
	ChangeMan::get()->sleep();
	archiveModel();
	killIncludeds();

	_p->killAndDeleteWithNotification();

	GccXml::extractHeaders(qs(includeCode()), GccXml::declarationsHandler(this));
//	ModelPtrRegistrar::get()->restorePtrs(this);
	ChangeMan::get()->wake();
	loadFinished();
}
Beispiel #20
0
void NewLoader::onLoadFinished(int loaded) {
    startPreload();
    if(loaded == loadTarget && current != cache->imageAt(loaded)) {
        current = cache->imageAt(loaded);
       //qDebug() << "loadFinished: setting new current to " << loaded;
        emit loadFinished(cache->imageAt(loaded), loaded);
    } else if(isRevelant(loaded)) {
       //qDebug() << "loadfinished image is revelant, keeping.." << loaded;
    } else {
        cache->unloadAt(loaded);
       //qDebug() << "load finished but not revelant ("<< loaded <<"). deleting..";
    }
}
Beispiel #21
0
/**
 * @brief Starts network requests to download infos from OFDb
 * @param id OFDb movie ID
 * @param movie Movie object
 * @param infos List of infos to load
 * @see OFDb::loadFinished
 */
void OFDb::loadData(QString id, Movie *movie, QList<int> infos)
{
    qDebug() << "Entered, id=" << id << "movie=" << movie->name();
    movie->clear(infos);

    QUrl url(QString("http://ofdbgw.org/movie/%1").arg(id));
    QNetworkReply *reply = qnam()->get(QNetworkRequest(url));
    reply->setProperty("storage", Storage::toVariant(reply, movie));
    reply->setProperty("ofdbId", id);
    reply->setProperty("notFoundCounter", 0);
    reply->setProperty("infosToLoad", Storage::toVariant(reply, infos));
    connect(reply, SIGNAL(finished()), this, SLOT(loadFinished()));
}
Beispiel #22
0
void CProgram::addModule(Module* _p)
{
	ChangeMan::get()->sleep();
	archiveModel();
	killIncludeds();

	_p->move(back());

	GccXml::extractHeaders(qs(includeCode()), GccXml::declarationsHandler(this));
//	ModelPtrRegistrar::get()->restorePtrs(this);
	ChangeMan::get()->wake();
//	apresLoad(_p);
	loadFinished();
}
Beispiel #23
0
void UrlLoader::loadingChanged(QWebLoadRequest* loadRequest)
{
    switch (loadRequest->status()) {
    case QQuickWebView::LoadStartedStatus:
        Q_EMIT loadStarted();
        break;
    case QQuickWebView::LoadStoppedStatus:
    case QQuickWebView::LoadSucceededStatus:
    case QQuickWebView::LoadFailedStatus:
    default:
        Q_EMIT loadFinished();
        break;
    }
}
Beispiel #24
0
/**
 * @brief Starts network requests to download infos from TMDb
 * @param id TMDb movie ID
 * @param concert Concert object
 * @param infos List of infos to load
 * @see TMDbConcerts::loadFinished
 * @see TMDbConcerts::loadCastsFinished
 * @see TMDbConcerts::loadTrailersFinished
 * @see TMDbConcerts::loadImagesFinished
 * @see TMDbConcerts::loadReleasesFinished
 */
void TMDbConcerts::loadData(QString id, Concert *concert, QList<int> infos)
{
    qDebug() << "Entered, id=" << id << "concert=" << concert->name();
    concert->setTmdbId(id);
    m_infosToLoad = infos;
    m_currentConcert = concert;
    m_currentConcert->clear(infos);
    m_currentId = id;
    m_loadDoneFired = false;
    m_loadsLeft.clear();

    QUrl url;
    QNetworkRequest request;
    request.setRawHeader("Accept", "application/json");

    // Infos
    m_loadsLeft.append(DataInfos);
    url.setUrl(QString("http://api.themoviedb.org/3/movie/%1?api_key=%2&language=%3").arg(id).arg(m_apiKey).arg(m_language));
    request.setUrl(url);
    m_loadReply = this->qnam()->get(QNetworkRequest(request));
    connect(m_loadReply, SIGNAL(finished()), this, SLOT(loadFinished()));

    // Trailers
    if (m_infosToLoad.contains(ConcertScraperInfos::Trailer)) {
        m_loadsLeft.append(DataTrailers);
        url.setUrl(QString("http://api.themoviedb.org/3/movie/%1/trailers?api_key=%2").arg(m_currentId).arg(m_apiKey));
        request.setUrl(url);
        m_trailersReply = this->qnam()->get(QNetworkRequest(request));
        connect(m_trailersReply, SIGNAL(finished()), this, SLOT(loadTrailersFinished()));
    }

    // Images
    if (m_infosToLoad.contains(ConcertScraperInfos::Poster) || m_infosToLoad.contains(ConcertScraperInfos::Backdrop)) {
        m_loadsLeft.append(DataImages);
        url.setUrl(QString("http://api.themoviedb.org/3/movie/%1/images?api_key=%2").arg(m_currentId).arg(m_apiKey));
        request.setUrl(url);
        m_imagesReply = this->qnam()->get(QNetworkRequest(request));
        connect(m_imagesReply, SIGNAL(finished()), this, SLOT(loadImagesFinished()));
    }

    // Releases
    if (m_infosToLoad.contains(ConcertScraperInfos::Certification)) {
        m_loadsLeft.append(DataReleases);
        url.setUrl(QString("http://api.themoviedb.org/3/movie/%1/releases?api_key=%2").arg(m_currentId).arg(m_apiKey));
        request.setUrl(url);
        m_releasesReply = this->qnam()->get(QNetworkRequest(request));
        connect(m_releasesReply, SIGNAL(finished()), this, SLOT(loadReleasesFinished()));
    }
}
Beispiel #25
0
void LoadingAuthorsThread::run()
{
	kDebug() << "Running query in a separate thread.";

	// Connect to the database reading the settings from krecipesrc.
	m_database = RecipeDB::createDatabase();
	m_database->connect( false, false );

	//Retrieve the list of authors;
	ElementList authorList;
	int numberOfAuthors = m_database->loadAuthors( &authorList , m_limit, m_offset );

	delete m_database;
	emit loadFinished( authorList, numberOfAuthors );
}
Beispiel #26
0
void QCefWebView::SetLoading(bool isLoading) {
    //qDebug() << __FUNCTION__ << isLoading << url();
    if (isLoading) {
        if (!need_load_ && !url_.isEmpty())
            emit loadStarted();
    } else {
        if (need_load_) {
            //qDebug() << __FUNCTION__ << "need_load_" << url_;
            BrowserLoadUrl(url_);
            need_load_ = false;
        } else if (/*!need_load_ && */!url_.isEmpty()) {
            emit loadFinished(true);
        }
    }
}
Beispiel #27
0
void TextBrowserHtmlDocument::setHtml(const QString &html, const QUrl &url)
{
    m_doc->setHtml(html);
    if (!url.isEmpty()) {
        QString file = url.toLocalFile();
        if (!file.isEmpty()) {
            QFileInfo info(file);
            QStringList paths = m_doc->searchPaths();
            paths.append(info.path());
            paths.removeDuplicates();
            m_doc->setSearchPaths(paths);
        }
    }
    emit loadFinished(true);
}
Beispiel #28
0
void FrameLoaderClientQt::postProgressFinishedNotification()
{
    // send a mousemove event to
    // (1) update the cursor to change according to whatever is underneath the mouse cursor right now
    // (2) display the tool tip if the mouse hovers a node which has a tool tip
    if (m_frame && m_frame->eventHandler() && m_webFrame->page()) {
        QWidget* view = m_webFrame->page()->view();
        if (view && view->hasFocus()) {
            QPoint localPos = view->mapFromGlobal(QCursor::pos());
            if (view->rect().contains(localPos)) {
                QMouseEvent event(QEvent::MouseMove, localPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier);
                m_frame->eventHandler()->mouseMoved(PlatformMouseEvent(&event, 0));
            }
        }
    }

    if (m_webFrame && m_frame->page())
        emit loadFinished(m_loadError.isNull());
}
Beispiel #29
0
Application::Application() :
    moteDataHolder(*this),
    window(NULL, *this),
    sdataWidget(NULL, *this) ,    
    dataRecorder(*this) ,
    connectWidget(NULL, *this)
{
    window.resize(800,400);
    window.show();

    //sdataWidget.show();

    sdataWidget.initLeft(false);

    connect(&moteDataHolder, SIGNAL(loadFinished()), &window, SLOT(onLoadFinished()));    
    connect(&moteDataHolder, SIGNAL(sampleAdded(int)), &window, SLOT(onOnlineSampleAdded(int)));
    connect(&serialListener, SIGNAL(receiveMessage(ActiveMessage)), &moteDataHolder, SLOT(createSampleFromOnline(ActiveMessage)), Qt::DirectConnection);

}
Beispiel #30
0
void Downloader::loadFinished()
{
    QNetworkReply *reply = qobject_cast<QNetworkReply *>(sender());
    reply->deleteLater();
    if(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt()==301||reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt()==302)
    {
        QNetworkReply *r = net->get(QNetworkRequest(reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl()));
        connect(r,SIGNAL(finished()),this,SLOT(loadFinished()));
        return;
    }
    if(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt()!=200)
    {

        emit error("Downloading fail with code:" + reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toString());
        return;
    }
    data = reply->readAll();
    emit ready();
}