Ejemplo n.º 1
0
void KmlRunner::parseFile( const QString &fileName, DocumentRole role = UnknownDocument )
{
    QString kmlFileName = fileName;
    QString kmzPath;
    QStringList kmzFiles;

#ifdef MARBLE_HAVE_QUAZIP
    QFileInfo const kmzFile( fileName );
    if ( kmzFile.exists() && kmzFile.suffix().toLower() == "kmz" ) {
        KmzHandler kmzHandler;
        if ( kmzHandler.open( fileName ) ) {
            kmlFileName = kmzHandler.kmlFile();
            kmzPath = kmzHandler.kmzPath();
            kmzFiles = kmzHandler.kmzFiles();
        } else {
            qWarning() << "File " << fileName << " is not a valid .kmz file";
            emit parsingFinished( 0 );
            return;
        }
    }
#endif

    QFile  file( kmlFileName );
    if ( !file.exists() ) {
        qWarning() << "File" << kmlFileName << "does not exist!";
        emit parsingFinished( 0 );
        return;
    }

    // Open file in right mode
    file.open( QIODevice::ReadOnly );

    KmlParser parser;

    if ( !parser.read( &file ) ) {
        emit parsingFinished( 0, parser.errorString() );
        return;
    }
    GeoDocument* document = parser.releaseDocument();
    Q_ASSERT( document );
    KmlDocument* doc = static_cast<KmlDocument*>( document );
    doc->setDocumentRole( role );
    doc->setFileName( fileName );
    doc->setBaseUri( kmlFileName );
    doc->setFiles( kmzPath, kmzFiles );

    file.close();
    emit parsingFinished( doc );
}
void CommunicationDescriptionGateway::requestReceived(QByteArray response) {
    if(networkRequest == NULL) {
        WLog("Response recieved, but request is already deleted! Cannot parse the response! This should never happen.");
        return;
    }

    Q_EMIT _receivedResponseData(response);

    networkResponse = networkRequest->getResponseParser();
    if (!networkResponse) {
        QList<BaseNetworkEntity*> emptyList;
        Q_EMIT this->finished(emptyList);
        _finishedWithCommunicationStep();
        return;
    }


    connect(networkResponse, SIGNAL(finished()), this, SLOT(responseFinished()));
    connect(networkResponse, SIGNAL(parsingFinished(QList<BaseNetworkEntity*>)), this, SIGNAL(finished(QList<BaseNetworkEntity*>)));
    connect(networkResponse, SIGNAL(parsingFailed(QString)), this, SIGNAL(failedToRetrieveDescription(QString)));

    //
    // parse in background
    QThreadPool::globalInstance()->start(networkResponse);
}
Ejemplo n.º 3
0
void SelectableFilesModel::buildTreeFinished()
{
    beginResetModel();
    deleteTree(m_root);
    m_root = m_rootForFuture;
    m_rootForFuture = 0;
    endResetModel();
    emit parsingFinished();
}
Ejemplo n.º 4
0
QQTMRequester::QQTMRequester(QObject * parent) :
	QQNetworkAccessor(parent)
{
	m_currKey.clear();
	m_netReply = NULL;

	m_xmlParser = new QQTMXmlParser(this);
	connect(m_xmlParser, SIGNAL(finished()), this, SLOT(parsingFinished()));
}
Ejemplo n.º 5
0
void GlobalDictionary::init()
{
    if(textsDataHandler)
    {
        QObject::connect(textsDataHandler, SIGNAL(data(RestDataItem*)),
                         this, SLOT(data(RestDataItem*)));
        QObject::connect(textsDataHandler, SIGNAL(parsingFinished()),
                         this, SLOT(done()));
        QObject::connect(textsDataHandler, SIGNAL(parsingStarted()),
                         this, SLOT(start()));
    }
}
void FilesSelectionWizardPage::initializePage()
{
    m_view->setModel(0);
    delete m_model;
    m_model = new ProjectExplorer::SelectableFilesModel(this);
    connect(m_model, SIGNAL(parsingProgress(QString)),
            this, SLOT(parsingProgress(QString)));
    connect(m_model, SIGNAL(parsingFinished()),
            this, SLOT(parsingFinished()));
    m_model->startParsing(m_genericProjectWizardDialog->path());

    m_hideFilesFilterLabel->setVisible(false);
    m_hideFilesfilterLineEdit->setVisible(false);

    m_showFilesFilterLabel->setVisible(false);
    m_showFilesfilterLineEdit->setVisible(false);

    m_applyFilterButton->setVisible(false);
    m_view->setVisible(false);
    m_label->setVisible(true);
    m_view->setModel(m_model);
}
Ejemplo n.º 7
0
TreeWidget::TreeWidget(const ProgramLoader& programLoader, QWidget *parent) :
    QWidget(parent)
{
    setAcceptDrops(true);

    view =  new TreeView(*this);
    model = new TreeModel("Tree", programLoader, view, this);

    view->setModel(model);

    delegate = new HTMLDelegate(this);

    view->setModel(model);
    view->setItemDelegate(delegate);
    setColumnsWidths();

    filterWidget = new FilterWidget(this);
    statusBar = new QStatusBar(this);

    //Layout
    QGridLayout *layout = new QGridLayout;
    layout->addWidget(view, 0, 0, 1, 1);
    layout->addWidget(filterWidget, 1, 0, 1, 1);
    layout->addWidget(statusBar, 2, 0, 1, 1);
    layout->setContentsMargins(0,0,0,0);
    setLayout(layout);

    connect(view, SIGNAL(selected(QModelIndex)), model, SLOT(updateCurrent(QModelIndex)));
    connect(view, SIGNAL(expanded(QModelIndex)), model, SLOT(requestExpansion(QModelIndex)));

    connect(view, SIGNAL(selected(QModelIndex)), this, SLOT(updatePath(QModelIndex)));
    connect(view, SIGNAL(selected(QModelIndex)), this, SLOT(updatePosition(QModelIndex)));

    connect(model, SIGNAL(parsingStarted(QModelIndex)), this, SLOT(onParsingStarted(QModelIndex)));
    connect(model, SIGNAL(parsingFinished(QModelIndex)), this, SLOT(onParsingFinished(QModelIndex)));
    connect(model, SIGNAL(exploringStarted(QModelIndex, qint64)), this, SLOT(onExploringStarted(QModelIndex, qint64)));
    connect(model, SIGNAL(exploringFinished(QModelIndex, qint64)), this, SLOT(onExploringFinished(QModelIndex, qint64)));

    connect(model, SIGNAL(filterChanged(QString)), filterWidget, SLOT(changeText(QString)));
    connect(filterWidget, SIGNAL(textChanged(QString)), model, SLOT(updateFilter(QString)));
    connect(model, SIGNAL(invalidFilter()), filterWidget, SLOT(invalidateText()));

    // in the constructor
    view->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(displayMenu(QPoint)));
}
XCodeProject::XCodeProject(XCodeManager *projectManager, const QString &projectFilePath) :
    d(new PrivateXCodeProject())
{
    d->m_projectManager = projectManager;
    d->m_projectFilePath = projectFilePath;
    d->m_projectFileWatcher = new QFileSystemWatcher(this);
    d->m_rootNode = new XCodeProjectNode(projectFilePath);
    d->m_projectFile.reset(new XCodeProjectFile(projectFilePath));

    setProjectContext(Core::Context(Constants::XCODE_PROJECT_CONTEXT));
    setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));

    connect(&d->m_modelReloadWatcher, SIGNAL(finished()), this, SLOT(parsingFinished()));
    startReparsing();

    d->m_projectFileWatcher->addPath(projectFilePath);
    connect(d->m_projectFileWatcher, SIGNAL(fileChanged(QString)), this, SLOT(startReparsing()));
}
Ejemplo n.º 9
0
void MarbleAbstractRunner::parseFile( const QString &, DocumentRole )
{
    // dummy implementation
    emit parsingFinished( 0, "Not Implemented" );
}
Ejemplo n.º 10
0
void Parser::parse(QString text) {
    qDebug() << "Request text reparse...";
    _state["parseTextNew"]( text.toStdString().c_str());
    qDebug() << "... parsing DONE";
    emit parsingFinished();
}
Ejemplo n.º 11
0
bool PSCommentLexer::parse(QIODevice& fin)
{
    char c;

    m_buffer.clear();
    m_curState = State_Start;

    parsingStarted();

    while (!fin.atEnd()) {
        fin.getChar(&c);

//    qDebug ("got %c", c);

        State newState;
        Action action;

        nextStep(c, &newState, &action);

        switch (action) {
        case Action_Copy :
            m_buffer.append(c);
            break;
        case Action_CopyOutput :
            m_buffer.append(c);
            doOutput();
            break;
        case Action_Output :
            doOutput();
            break;
        case Action_OutputUnget :
            doOutput();
            fin.ungetChar(c);
            break;
        case Action_Ignore :
            /* ignore */
            break;
        case Action_Abort :
            qWarning("state %s / %s char %c (%d)" , statetoa(m_curState), statetoa(newState), c, c);
            parsingAborted();
            return false;
            break;
        case Action_InitTemp :
            m_temp.clear();
            break;
        case Action_CopyTemp :
            m_temp.append(c);
            break;
        case Action_DecodeUnget :
            m_buffer.append(decode());
            fin.ungetChar(c);
            break;
        default :
            qWarning("unknown action: %d ", action);
        }

        m_curState = newState;
    }

    parsingFinished();
    return true;
}