void QmlDesignerPlugin::activateAutoSynchronization()
{
    // text editor -> visual editor
    if (!currentDesignDocument()->isDocumentLoaded()) {
        currentDesignDocument()->loadDocument(currentDesignDocument()->plainTextEdit());
    }

    currentDesignDocument()->attachRewriterToModel();

    resetModelSelection();

    viewManager().attachComponentView();
    viewManager().attachViewsExceptRewriterAndComponetView();

    QList<RewriterView::Error> errors = currentDesignDocument()->qmlSyntaxErrors();
    if (errors.isEmpty()) {
        selectModelNodeUnderTextCursor();
        m_mainWidget->enableWidgets();
        m_mainWidget->setupNavigatorHistory(currentDesignDocument()->textEditor());
    } else {
        m_mainWidget->disableWidgets();
        m_mainWidget->showErrorMessage(errors);
    }

    currentDesignDocument()->updateSubcomponentManager();

    connect(currentDesignDocument()->rewriterView(),
            SIGNAL(errorsChanged(QList<RewriterView::Error>)),
            m_mainWidget,
            SLOT(updateErrorStatus(QList<RewriterView::Error>)));
}
Exemple #2
0
ParserMaker::ParserMaker(QWidget *parent, ParserManager *pd, SiilihaiSettings &s, SiilihaiProtocol &p) :
    QMainWindow(parent), pdb(pd), settings(s), protocol(p), nam(this), engine(this, 0, 0, &nam) {
    ui.setupUi(this);
    loginMatcher = new PatternMatcher(this, true);

    groupListEditor = new GroupListPatternEditor(engine, &parser, &subscription, this);
    ui.tabWidget->addTab(groupListEditor, groupListEditor->tabIcon(), groupListEditor->tabName());
    threadListEditor = new ThreadListPatternEditor(engine, &parser, &subscription, this);
    ui.tabWidget->addTab(threadListEditor, threadListEditor->tabIcon(), threadListEditor->tabName());
    threadListEditor->setEnabled(false);
    messageListEditor = new MessageListPatternEditor(engine, &parser, &subscription, this);
    ui.tabWidget->addTab(messageListEditor, threadListEditor->tabIcon(), messageListEditor->tabName());
    messageListEditor->setEnabled(false);

    connect(groupListEditor, SIGNAL(groupSelected(ForumGroup*)), threadListEditor, SLOT(setGroup(ForumGroup*)));
    connect(threadListEditor, SIGNAL(threadSelected(ForumThread*)), messageListEditor, SLOT(setThread(ForumThread*)));

    connect(&protocol, SIGNAL(saveParserFinished(int, QString)), this, SLOT(saveParserFinished(int, QString)));
    connect(ui.openParserButton, SIGNAL(clicked()), this, SLOT(openClicked()));
    connect(ui.newFromRequestButton, SIGNAL(clicked()), this, SLOT(newFromRequestClicked()));
    connect(ui.saveChangesButton, SIGNAL(clicked()), this, SLOT(saveClicked()));
    connect(ui.saveAsNewButton, SIGNAL(clicked()), this, SLOT(saveAsNewClicked()));
    connect(ui.testForumUrlButton, SIGNAL(clicked()), this, SLOT(testForumUrlClicked()));
    connect(ui.forumUrl, SIGNAL(textEdited(QString)), this, SLOT(updateState()));
    connect(ui.parserName, SIGNAL(textEdited(QString)), this, SLOT(updateState()));
    connect(ui.parserType, SIGNAL(currentIndexChanged(int)), this, SLOT(updateState()));
    connect(ui.viewThreadPath, SIGNAL(textEdited(QString)), this, SLOT(updateState()));
    connect(ui.threadListPath, SIGNAL(textEdited(QString)), this, SLOT(updateState()));
    connect(ui.viewMessagePath, SIGNAL(textEdited(QString)), this, SLOT(updateState()));
    connect(ui.loginPath, SIGNAL(textEdited(QString)), this, SLOT(updateState()));
    connect(ui.loginTypeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateState()));
    connect(ui.tryLoginButton, SIGNAL(clicked()), this, SLOT(tryLogin()));
    connect(ui.tryWithoutLoginButton, SIGNAL(clicked()), this, SLOT(tryWithoutLogin()));
    connect(ui.verifyLoginPattern, SIGNAL(textEdited(QString)), this, SLOT(updateState()));
    connect(ui.helpButton, SIGNAL(clicked()), this, SLOT(helpClicked()));
    connect(&engine, SIGNAL(loginFinished(ForumSubscription *,bool)), this, SLOT(loginFinished(ForumSubscription *, bool)));
    connect(&subscription, SIGNAL(errorsChanged()), this, SLOT(subscriptionErrorsChanged()));

    connect(&engine, SIGNAL(getHttpAuthentication(ForumSubscription *, QAuthenticator *)),
            this, SLOT(getHttpAuthentication(ForumSubscription *, QAuthenticator *)));

    connect(loginMatcher, SIGNAL(dataMatched(int, QString, PatternMatchType)),
            this, SLOT(dataMatched(int, QString, PatternMatchType)));
    connect(loginMatcher, SIGNAL(dataMatchingStart(QString&)), this, SLOT(dataMatchingStart(QString&)));
    connect(loginMatcher, SIGNAL(dataMatchingEnd()), this, SLOT(dataMatchingEnd()));

    subscription.setLatestThreads(100);
    subscription.setLatestMessages(100);
    loginWithoutCredentials = false;

    updateState();
    ui.tabWidget->setCurrentIndex(0);
    if (!restoreGeometry(settings.value("parsermaker_geometry").toByteArray()))
        showMaximized();

    show();
}
void QmlDesignerPlugin::deactivateAutoSynchronization()
{
    viewManager().detachViewsExceptRewriterAndComponetView();
    viewManager().detachComponentView();
    viewManager().detachRewriterView();
    documentManager().currentDesignDocument()->resetToDocumentModel();

    disconnect(currentDesignDocument()->rewriterView(),
               SIGNAL(errorsChanged(QList<RewriterView::Error>)),
               m_mainWidget,
               SLOT(updateErrorStatus(QList<RewriterView::Error>)));

}
QList<RewriterView::Error> DesignDocumentController::loadMaster(QPlainTextEdit *edit)
{
    Q_CHECK_PTR(edit);

    d->textEdit = edit;

    connect(edit, SIGNAL(undoAvailable(bool)),
            this, SIGNAL(undoAvailable(bool)));
    connect(edit, SIGNAL(redoAvailable(bool)),
            this, SIGNAL(redoAvailable(bool)));
    connect(edit, SIGNAL(modificationChanged(bool)),
            this, SIGNAL(dirtyStateChanged(bool)));

    d->textModifier = new BaseTextEditModifier(dynamic_cast<TextEditor::BaseTextEditorWidget*>(d->textEdit.data()));

    d->componentTextModifier = 0;

    //d->masterModel = Model::create(d->textModifier, d->searchPath, errors);

    d->masterModel = Model::create("QtQuick.Rectangle", 1, 0);

#if defined(VIEWLOGGER)
    d->viewLogger = new Internal::ViewLogger(d->model.data());
    d->masterModel->attachView(d->viewLogger.data());
#endif

    d->masterModel->setFileUrl(d->searchPath);

    d->subComponentModel = Model::create("QtQuick.Rectangle", 1, 0);
    d->subComponentModel->setFileUrl(d->searchPath);

    d->rewriterView = new RewriterView(RewriterView::Amend, d->masterModel.data());
    d->rewriterView->setTextModifier( d->textModifier);
    connect(d->rewriterView.data(), SIGNAL(errorsChanged(QList<RewriterView::Error>)),
            this, SIGNAL(qmlErrorsChanged(QList<RewriterView::Error>)));

    d->masterModel->attachView(d->rewriterView.data());
    d->model = d->masterModel;
    d->componentNode = d->rewriterView->rootModelNode();

    d->subComponentManager = new SubComponentManager(d->masterModel.data(), this);
    d->subComponentManager->update(d->searchPath, d->model->imports());

    loadCurrentModel();

    d->masterModel->attachView(d->componentView.data());

    return d->rewriterView->errors();
}
void AbstractSceneParser::logError(const QString &error)
{
    m_errors.append(error);
    emit errorsChanged();
}
Exemple #6
0
void QSceneImporter::logError(const QString &error)
{
    m_errors.append(error);
    emit errorsChanged(m_errors);
}