diff --git a/share/qtcreator/templates/wizards/helloworld/wizard.xml b/share/qtcreator/templates/wizards/helloworld/wizard.xml new file mode 100644 index 0000000000000000000000000000000000000000..dfcf4e00aaee04e3d9a22b7dc13abd2c769453d4 --- /dev/null +++ b/share/qtcreator/templates/wizards/helloworld/wizard.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** +**************************************************************************/ + +Custom project wizard configuration example file. Note that by convention, +the project file goes last. +The "class" and "firstpage" attributes specify that it is a Qt 4 wizard and +leave room for the Qt 4 target page. +--> +<wizard version="1" kind="project" + class="qt4project" firstpage="10" + id="A.HelloWorld" category="B.CustomProjects"> + <icon>console.png</icon> + <description>Creates a hello-world-project with custom message.</description> + <displayname>Hello World</displayname>; + <displaycategory>Custom Projects</displaycategory> + <files> + <file source="main.cpp" openeditor="true"/> + <file source="project.pro" target="%ProjectName%.pro" openproject="true"/> + </files> + <!-- Create a 2nd wizard page with parameters --> + <fieldpagetitle>Hello World Parameters</fieldpagetitle> + <fieldpagetitle xml:lang="de">Hallo Welt Parameter</fieldpagetitle> + <fields> + <field mandatory="true" name="MESSAGE"> + <fieldcontrol class="QLineEdit" validator='^[^"]+$' + defaulttext="Hello world from project '%ProjectName:c%'!" /> + <fielddescription>Hello world message:</fielddescription> + <fielddescription xml:lang="de">Hallo-Welt-Nachricht:</fielddescription> + </field> + <!-- Checkbox technique 1: Comment out network in profile according to user's wishes --> + <field name="NETWORK"> + <fieldcontrol class="QCheckBox" truevalue="" falsevalue="# "/> + <fielddescription>Include network module</fielddescription> + <fielddescription xml:lang="de">Netzwerk-Modul verwenden</fielddescription> + </field> + <!-- Checkbox technique 2: Use preprocessor for profile according to user's wishes --> + <field name="SCRIPT"> + <fieldcontrol class="QCheckBox"/> + <fielddescription>Include script module</fielddescription> + <fielddescription xml:lang="de">Script-Modul verwenden</fielddescription> + </field> + </fields> +</wizard> diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp index c79b73c5bf631756b30f76fb9fb80a3ce11c87ce..56870530fbff05b96d1bb30717bac4526b2ff8d1 100644 --- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp @@ -328,6 +328,11 @@ void CMakeRunPage::initWidgets() pl.setVerticalStretch(1); m_output->setSizePolicy(pl); fl->addRow(m_output); + + m_exitCodeLabel = new QLabel(this); + m_exitCodeLabel->setVisible(false); + fl->addRow(m_exitCodeLabel); + setTitle(tr("Run CMake")); } @@ -460,7 +465,8 @@ void CMakeRunPage::runCMake() if (m_cmakeWizard->cmakeManager()->isCMakeExecutableValid()) { m_cmakeProcess = new QProcess(); - connect(m_cmakeProcess, SIGNAL(readyRead()), this, SLOT(cmakeReadyRead())); + connect(m_cmakeProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(cmakeReadyReadStandardOutput())); + connect(m_cmakeProcess, SIGNAL(readyReadStandardError()), this, SLOT(cmakeReadyReadStandardError())); connect(m_cmakeProcess, SIGNAL(finished(int)), this, SLOT(cmakeFinished())); cmakeManager->createXmlFile(m_cmakeProcess, arguments, m_cmakeWizard->sourceDirectory(), m_buildDirectory, env, generator); } else { @@ -470,20 +476,54 @@ void CMakeRunPage::runCMake() } } -void CMakeRunPage::cmakeReadyRead() +static QColor mix_colors(QColor a, QColor b) +{ + return QColor((a.red() + 2 * b.red()) / 3, (a.green() + 2 * b.green()) / 3, + (a.blue() + 2* b.blue()) / 3, (a.alpha() + 2 * b.alpha()) / 3); +} + +void CMakeRunPage::cmakeReadyReadStandardOutput() +{ + QTextCursor cursor(m_output->document()); + QTextCharFormat tf; + + QFont font = m_output->font(); + tf.setFont(font); + tf.setForeground(m_output->palette().color(QPalette::Text)); + + cursor.insertText(m_cmakeProcess->readAllStandardOutput(), tf); +} + +void CMakeRunPage::cmakeReadyReadStandardError() { - m_output->appendPlainText(m_cmakeProcess->readAll()); + QTextCursor cursor(m_output->document()); + QTextCharFormat tf; + + QFont font = m_output->font(); + QFont boldFont = font; + boldFont.setBold(true); + tf.setFont(boldFont); + tf.setForeground(mix_colors(m_output->palette().color(QPalette::Text), QColor(Qt::red))); + + cursor.insertText(m_cmakeProcess->readAllStandardError(), tf); } void CMakeRunPage::cmakeFinished() { m_runCMake->setEnabled(true); m_argumentsLineEdit->setEnabled(true); + if (m_cmakeProcess->exitCode() != 0) { + m_exitCodeLabel->setVisible(true); + m_exitCodeLabel->setText(tr("CMake exited with errors. Please check cmake output.")); + m_complete = false; + } else { + m_exitCodeLabel->setVisible(false); + m_complete = true; + } m_cmakeProcess->deleteLater(); m_cmakeProcess = 0; m_cmakeWizard->setArguments(Utils::Environment::parseCombinedArgString(m_argumentsLineEdit->text())); //TODO Actually test that running cmake was finished, for setting this bool - m_complete = true; emit completeChanged(); } @@ -491,6 +531,7 @@ void CMakeRunPage::cleanupPage() { m_output->clear(); m_complete = false; + m_exitCodeLabel->setVisible(false); emit completeChanged(); } diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h index 1fc1dc2ebbab41dbc1c707c5e04fa794f5108205..d38edd6b4be4fb269b37b94b3763ce1445ea6081 100644 --- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h +++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h @@ -133,7 +133,8 @@ public: private slots: void runCMake(); void cmakeFinished(); - void cmakeReadyRead(); + void cmakeReadyReadStandardOutput(); + void cmakeReadyReadStandardError(); private: void initWidgets(); CMakeOpenProjectWizard *m_cmakeWizard; @@ -144,6 +145,7 @@ private: Utils::PathChooser *m_cmakeExecutable; QComboBox *m_generatorComboBox; QLabel *m_descriptionLabel; + QLabel *m_exitCodeLabel; bool m_complete; Mode m_mode; QString m_buildDirectory; diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp index bb84b5242d8d4b5c904a9f4018abed827f0f36dd..2403846cd9ccfc7fd7433722c3864ffb75b4e4b3 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp @@ -117,7 +117,6 @@ void CMakeManager::createXmlFile(QProcess *proc, const QStringList &arguments, QString buildDirectoryPath = buildDirectory.absolutePath(); buildDirectory.mkpath(buildDirectoryPath); proc->setWorkingDirectory(buildDirectoryPath); - proc->setProcessChannelMode(QProcess::MergedChannels); proc->setEnvironment(env.toStringList()); const QString srcdir = buildDirectory.exists(QLatin1String("CMakeCache.txt")) ? diff --git a/src/plugins/projectexplorer/outputformatter.cpp b/src/plugins/projectexplorer/outputformatter.cpp index 9fa6ab1bb5c460a43ea69d714722bd8ee9afd017..6c7ab905e4a5438577ed624f24cd4b1bd1ebf87f 100644 --- a/src/plugins/projectexplorer/outputformatter.cpp +++ b/src/plugins/projectexplorer/outputformatter.cpp @@ -94,7 +94,6 @@ static QColor mix_colors(QColor a, QColor b) (a.blue() + 2* b.blue()) / 3, (a.alpha() + 2 * b.alpha()) / 3); } - void OutputFormatter::initFormats() { QPalette p = plainTextEdit()->palette();