diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2010-02-26 14:55:25 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2010-02-26 14:55:39 +0100 |
commit | 13a608f86fdd7726f0bd1328fa5a70d0f2d7cf28 (patch) | |
tree | 9cda27d28eebd422a26a6012b68cca28f268a588 /src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp | |
parent | f1192c419ef7123d4ababa365b226b5b24d160f3 (diff) | |
download | qt-creator-13a608f86fdd7726f0bd1328fa5a70d0f2d7cf28.tar.gz |
uic-Codemodel-updating: Decouple form editor.
Pass around contents as string, saving repeated
invocation of FormWindowEditor::contents().
Remove dependency to FormWindowEditor.
Reviewed-by: dt <qtc-committer@nokia.com>
Diffstat (limited to 'src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp')
-rw-r--r-- | src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp b/src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp index 173fb9d1a9..472525dec9 100644 --- a/src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp +++ b/src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp @@ -33,11 +33,11 @@ #include "qt4project.h" #include "qt4target.h" -#include <designer/formwindoweditor.h> - using namespace Qt4ProjectManager; using namespace Internal; +enum { debug = 0 }; + Qt4UiCodeModelSupport::Qt4UiCodeModelSupport(CppTools::CppModelManagerInterface *modelmanager, Qt4Project *project, const QString &source, @@ -123,33 +123,32 @@ bool Qt4UiCodeModelSupport::runUic(const QString &ui) const Qt4BuildConfiguration *qt4bc = m_project->activeTarget()->activeBuildConfiguration(); QProcess uic; uic.setEnvironment(qt4bc->environment().toStringList()); - uic.start(qt4bc->qtVersion()->uicCommand(), QStringList(), QIODevice::ReadWrite); - uic.waitForStarted(); + const QString uicCommand = qt4bc->qtVersion()->uicCommand(); + if (debug) + qDebug() << "Qt4UiCodeModelSupport::runUic " << uicCommand << " on " << ui.size() << " bytes"; + uic.start(uicCommand, QStringList(), QIODevice::ReadWrite); + if (!uic.waitForStarted()) + return false; uic.write(ui.toUtf8()); uic.closeWriteChannel(); - if (uic.waitForFinished()) { + if (uic.waitForFinished() && uic.exitStatus() == QProcess::NormalExit && uic.exitCode() == 0) { m_contents = uic.readAllStandardOutput(); m_cacheTime = QDateTime::currentDateTime(); - return true; + if (debug) + qDebug() << "ok" << m_contents.size() << "bytes."; + return true; } else { -// qDebug()<<"running uic failed"<<" using uic: "<<m_project->qtVersion(m_project->activeBuildConfiguration())->uicCommand(); -// qDebug()<<uic.readAllStandardError(); -// qDebug()<<uic.readAllStandardOutput(); -// qDebug()<<uic.errorString(); -// qDebug()<<uic.error(); + if (debug) + qDebug() << "failed" << uic.readAllStandardError(); uic.kill(); } return false; } -void Qt4UiCodeModelSupport::updateFromEditor(Designer::FormWindowEditor *fw) +void Qt4UiCodeModelSupport::updateFromEditor(const QString &formEditorContents) { -// qDebug()<<"Qt4UiCodeModelSupport::updateFromEditor"<<fw; - if (runUic(fw->contents())) { -// qDebug()<<"runUic: success, updated on the fly"; + if (runUic(formEditorContents)) { updateDocument(); - } else { -// qDebug()<<"runUic: failed, not updated"; } } |