Merge ../mainline into dui-editor

This commit is contained in:
Roberto Raggi
2009-04-24 09:07:38 +02:00
54 changed files with 955 additions and 688 deletions

View File

@@ -11,3 +11,5 @@ SOURCES += bineditorplugin.cpp \
bineditor.cpp
RESOURCES += bineditor.qrc
OTHER_FILES += BinEditor.pluginspec

View File

@@ -16,3 +16,5 @@ SOURCES += bookmarksplugin.cpp \
bookmarkmanager.cpp
RESOURCES += bookmarks.qrc
OTHER_FILES += Bookmarks.pluginspec

View File

@@ -19,3 +19,5 @@ SOURCES = cmakeproject.cpp \
cmakeopenprojectwizard.cpp
RESOURCES += cmakeproject.qrc
FORMS +=
OTHER_FILES += CMakeProjectManager.pluginspec

View File

@@ -167,3 +167,5 @@ linux-* {
INSTALLS += images
}
OTHER_FILES += Core.pluginspec

View File

@@ -26,7 +26,7 @@ background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0
*, * *, * * *, * * * *, * * * * * {
font-family: Arial, Trebuchet, Lucida, sans-serif;
font-size: 9pt;
font-size: 12px;
color: #5e5e5e;
}
@@ -118,7 +118,7 @@ border-width: 8 8 8 8;
<property name="text">
<string>&lt;style&gt;
h1 {
font-size: 2em;
font-size: 24px;
font-weight: normal;
color: #4d4d4d;
margin-top: 0px;
@@ -206,7 +206,7 @@ p {
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="recentSessionsLayout">
<layout class="QVBoxLayout" name="recentSessionsLayout" stretch="0,1">
<item>
<widget class="QFrame" name="recentSessionsFrame">
<property name="sizePolicy">

View File

@@ -22,3 +22,5 @@ SOURCES += cppplugin.cpp \
cppfilewizard.cpp \
cppclasswizard.cpp
RESOURCES += cppeditor.qrc
OTHER_FILES += CppEditor.pluginspec

View File

@@ -37,3 +37,5 @@ SOURCES += completionsettingspage.cpp \
FORMS += completionsettingspage.ui \
cppfilesettingspage.ui
OTHER_FILES += CppTools.pluginspec

View File

@@ -98,3 +98,5 @@ win32 {
include(win/win.pri)
include(cdb/cdb.pri)
}
OTHER_FILES += Debugger.pluginspec

View File

@@ -50,3 +50,5 @@ SOURCES += formeditorplugin.cpp \
formwizarddialog.cpp
RESOURCES += designer.qrc
OTHER_FILES += Designer.pluginspec

View File

@@ -25,3 +25,5 @@ HEADERS += \
FORMS += \
fakevimoptions.ui
OTHER_FILES += FakeVim.pluginspec

View File

@@ -31,3 +31,5 @@ SOURCES += findtoolwindow.cpp \
FORMS += findwidget.ui \
finddialog.ui
RESOURCES += find.qrc
OTHER_FILES += Find.pluginspec

View File

@@ -21,3 +21,5 @@ SOURCES = genericproject.cpp \
genericmakestep.cpp
RESOURCES += genericproject.qrc
FORMS += genericmakestep.ui
OTHER_FILES += GenericProjectManager.pluginspec

View File

@@ -41,3 +41,5 @@ FORMS += changeselectiondialog.ui \
settingspage.ui \
gitsubmitpanel.ui \
branchdialog.ui
OTHER_FILES += ScmGit.pluginspec

View File

@@ -35,3 +35,5 @@ include(../../shared/help/help.pri)
contains(QT_CONFIG, webkit) {
QT += webkit
}
OTHER_FILES += Help.pluginspec

View File

@@ -36,3 +36,5 @@ FORMS += settingspage.ui \
submitpanel.ui
RESOURCES += perforce.qrc
OTHER_FILES += Perforce.pluginspec

View File

@@ -21,6 +21,7 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<dependencyList>
<dependency name="Core" version="1.1.80"/>
<dependency name="Find" version="1.1.80"/>
<dependency name="Help" version="1.1.80"/>
<dependency name="QuickOpen" version="1.1.80"/>
<dependency name="TextEditor" version="1.1.80"/>
</dependencyList>

View File

@@ -56,6 +56,8 @@
#include "session.h"
#include "sessiondialog.h"
#include "buildparserfactory.h"
#include "qtversionmanager.h"
#include "qtoptionspage.h"
#include <coreplugin/basemode.h>
#include <coreplugin/coreconstants.h>
@@ -194,6 +196,11 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
connect(m_buildManager, SIGNAL(tasksChanged()),
this, SLOT(updateTaskActions()));
m_versionManager = new QtVersionManager();
addAutoReleasedObject(m_versionManager);
addAutoReleasedObject(new QtOptionsPage());
addAutoReleasedObject(new CoreListenerCheckingForRunningBuild(m_buildManager));
m_outputPane = new OutputPane;
@@ -1905,4 +1912,9 @@ void ProjectExplorerPlugin::setSession(QAction *action)
m_session->loadSession(session);
}
QtVersionManager *ProjectExplorerPlugin::qtVersionManager() const
{
return m_versionManager;
}
Q_EXPORT_PLUGIN(ProjectExplorerPlugin)

View File

@@ -64,6 +64,7 @@ class RunConfiguration;
class RunControl;
class SessionManager;
class IRunConfigurationRunner;
class QtVersionManager;
namespace Internal {
class ApplicationOutput;
@@ -104,6 +105,8 @@ public:
void showContextMenu(const QPoint &globalPos, Node *node);
QtVersionManager *qtVersionManager() const;
//PluginInterface
bool initialize(const QStringList &arguments, QString *error_message);
void extensionsInitialized();
@@ -246,6 +249,7 @@ private:
Node *m_currentNode;
BuildManager *m_buildManager;
QtVersionManager *m_versionManager;
QList<Internal::ProjectFileFactory*> m_fileFactories;
QStringList m_profileMimeTypes;

View File

@@ -54,11 +54,13 @@ HEADERS += projectexplorer.h \
projectmodels.h \
currentprojectfind.h \
toolchain.h \
cesdkhandler.h\
buildparserfactory.h\
gccparser.h\
msvcparser.h\
filewatcher.h
cesdkhandler.h \
buildparserfactory.h \
gccparser.h \
msvcparser.h \
filewatcher.h \
qtversionmanager.h \
qtoptionspage.h
SOURCES += projectexplorer.cpp \
projectwindow.cpp \
buildmanager.cpp \
@@ -101,11 +103,13 @@ SOURCES += projectexplorer.cpp \
projectmodels.cpp \
currentprojectfind.cpp \
toolchain.cpp \
cesdkhandler.cpp\
cesdkhandler.cpp \
buildparserfactory.cpp \
gccparser.cpp\
msvcparser.cpp\
filewatcher.cpp
gccparser.cpp \
msvcparser.cpp \
filewatcher.cpp \
qtversionmanager.cpp \
qtoptionspage.cpp
FORMS += dependenciespanel.ui \
buildsettingspropertiespage.ui \
processstep.ui \
@@ -114,7 +118,9 @@ FORMS += dependenciespanel.ui \
sessiondialog.ui \
projectwizardpage.ui \
buildstepspage.ui \
removefiledialog.ui
removefiledialog.ui \
qtversionmanager.ui \
showbuildlog.ui
win32 {
SOURCES += applicationlauncher_win.cpp \
winguiprocess.cpp
@@ -123,3 +129,4 @@ win32 {
else:unix:SOURCES += applicationlauncher_x11.cpp
RESOURCES += projectexplorer.qrc
DEFINES += PROJECTEXPLORER_LIBRARY
OTHER_FILES += ProjectExplorer.pluginspec

View File

@@ -3,3 +3,4 @@ include(../../plugins/quickopen/quickopen.pri)
include(../../plugins/find/find.pri)
include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/texteditor/texteditor.pri)
include(../../plugins/help/help.pri)

View File

@@ -177,7 +177,10 @@ const char * const RESOURCE_MIMETYPE = "application/vnd.nokia.xml.qt.resource";
const char * const BUILD_PARSER_MSVC = "BuildParser.MSVC";
const char * const BUILD_PARSER_GCC = "BuildParser.Gcc";
//Qt4 settings pages
const char * const QT_CATEGORY = "Qt4";
const char * const QTVERSION_PAGE = "Qt Versions";
const char * const BUILD_ENVIRONMENT_PAGE = "Build Environments";
} // namespace Constants
} // namespace ProjectExplorer

View File

@@ -0,0 +1,464 @@
#include "qtoptionspage.h"
#include "ui_showbuildlog.h"
#include "ui_qtversionmanager.h"
#include "projectexplorerconstants.h"
#include "qtversionmanager.h"
#include <coreplugin/coreconstants.h>
#include <QtCore/QDir>
using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
///
// QtOptionsPage
///
QtOptionsPage::QtOptionsPage()
{
}
QtOptionsPage::~QtOptionsPage()
{
}
QString QtOptionsPage::id() const
{
return QLatin1String(Constants::QTVERSION_PAGE);
}
QString QtOptionsPage::trName() const
{
return tr(Constants::QTVERSION_PAGE);
}
QString QtOptionsPage::category() const
{
return Constants::QT_CATEGORY;
}
QString QtOptionsPage::trCategory() const
{
return tr(Constants::QT_CATEGORY);
}
QWidget *QtOptionsPage::createPage(QWidget *parent)
{
QtVersionManager *vm = QtVersionManager::instance();
m_widget = new QtOptionsPageWidget(parent, vm->versions(), vm->currentQtVersion());
return m_widget;
}
void QtOptionsPage::apply()
{
m_widget->finish();
QtVersionManager *vm = QtVersionManager::instance();
vm->setNewQtVersions(m_widget->versions(), m_widget->defaultVersion());
}
//-----------------------------------------------------
QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> versions, QtVersion *defaultVersion)
: QWidget(parent)
, m_defaultVersion(versions.indexOf(defaultVersion))
, m_specifyNameString(tr("<specify a name>"))
, m_specifyPathString(tr("<specify a path>"))
{
// Initialize m_versions
foreach(QtVersion *version, versions) {
m_versions.append(new QtVersion(*version));
}
m_ui = new Internal::Ui::QtVersionManager();
m_ui->setupUi(this);
m_ui->qtPath->setExpectedKind(Core::Utils::PathChooser::Directory);
m_ui->qtPath->setPromptDialogTitle(tr("Select QTDIR"));
m_ui->mingwPath->setExpectedKind(Core::Utils::PathChooser::Directory);
m_ui->qtPath->setPromptDialogTitle(tr("Select the Qt Directory"));
m_ui->addButton->setIcon(QIcon(Core::Constants::ICON_PLUS));
m_ui->delButton->setIcon(QIcon(Core::Constants::ICON_MINUS));
for (int i = 0; i < m_versions.count(); ++i) {
const QtVersion * const version = m_versions.at(i);
QTreeWidgetItem *item = new QTreeWidgetItem(m_ui->qtdirList);
item->setText(0, version->name());
item->setText(1, QDir::toNativeSeparators(version->path()));
item->setData(0, Qt::UserRole, version->uniqueId());
if (version->isValid()) {
if (version->hasDebuggingHelper())
item->setData(2, Qt::DecorationRole, QIcon(":/extensionsystem/images/ok.png"));
else
item->setData(2, Qt::DecorationRole, QIcon(":/extensionsystem/images/error.png"));
} else {
item->setData(2, Qt::DecorationRole, QIcon());
}
m_ui->defaultCombo->addItem(version->name());
if (i == m_defaultVersion)
m_ui->defaultCombo->setCurrentIndex(i);
}
connect(m_ui->nameEdit, SIGNAL(textEdited(const QString &)),
this, SLOT(updateCurrentQtName()));
connect(m_ui->qtPath, SIGNAL(changed()),
this, SLOT(updateCurrentQtPath()));
connect(m_ui->mingwPath, SIGNAL(changed()),
this, SLOT(updateCurrentMingwDirectory()));
connect(m_ui->addButton, SIGNAL(clicked()),
this, SLOT(addQtDir()));
connect(m_ui->delButton, SIGNAL(clicked()),
this, SLOT(removeQtDir()));
connect(m_ui->qtPath, SIGNAL(browsingFinished()),
this, SLOT(onQtBrowsed()));
connect(m_ui->mingwPath, SIGNAL(browsingFinished()),
this, SLOT(onMingwBrowsed()));
connect(m_ui->qtdirList, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
this, SLOT(versionChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
connect(m_ui->defaultCombo, SIGNAL(currentIndexChanged(int)),
this, SLOT(defaultChanged(int)));
connect(m_ui->msvcComboBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(msvcVersionChanged()));
connect(m_ui->rebuildButton, SIGNAL(clicked()),
this, SLOT(buildDebuggingHelper()));
connect(m_ui->showLogButton, SIGNAL(clicked()),
this, SLOT(showDebuggingBuildLog()));
showEnvironmentPage(0);
updateState();
}
void QtOptionsPageWidget::buildDebuggingHelper()
{
// Find the qt version for this button..
QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
if (!currentItem)
return;
int currentItemIndex = m_ui->qtdirList->indexOfTopLevelItem(currentItem);
QtVersion *version = m_versions[currentItemIndex];
QString result = m_versions.at(currentItemIndex)->buildDebuggingHelperLibrary();
currentItem->setData(2, Qt::UserRole, result);
if (version->hasDebuggingHelper()) {
m_ui->debuggingHelperStateLabel->setPixmap(QPixmap(":/extensionsystem/images/ok.png"));
currentItem->setData(2, Qt::DecorationRole, QIcon(":/extensionsystem/images/ok.png"));
} else {
m_ui->debuggingHelperStateLabel->setPixmap(QPixmap(":/extensionsystem/images/error.png"));
currentItem->setData(2, Qt::DecorationRole, QIcon(":/extensionsystem/images/error.png"));
}
m_ui->showLogButton->setEnabled(true);
}
void QtOptionsPageWidget::showDebuggingBuildLog()
{
QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
if (!currentItem)
return;
int currentItemIndex = m_ui->qtdirList->indexOfTopLevelItem(currentItem);
QDialog dlg;
Ui_ShowBuildLog ui;
ui.setupUi(&dlg);
ui.log->setPlainText(m_ui->qtdirList->topLevelItem(currentItemIndex)->data(2, Qt::UserRole).toString());
dlg.exec();
}
QtOptionsPageWidget::~QtOptionsPageWidget()
{
qDeleteAll(m_versions);
delete m_ui;
}
void QtOptionsPageWidget::addQtDir()
{
QtVersion *newVersion = new QtVersion(m_specifyNameString, m_specifyPathString);
m_versions.append(newVersion);
QTreeWidgetItem *item = new QTreeWidgetItem(m_ui->qtdirList);
item->setText(0, newVersion->name());
item->setText(1, QDir::toNativeSeparators(newVersion->path()));
item->setData(0, Qt::UserRole, newVersion->uniqueId());
item->setData(2, Qt::DecorationRole, QIcon());
m_ui->qtdirList->setCurrentItem(item);
m_ui->nameEdit->setText(newVersion->name());
m_ui->qtPath->setPath(newVersion->path());
m_ui->defaultCombo->addItem(newVersion->name());
m_ui->nameEdit->setFocus();
m_ui->nameEdit->selectAll();
}
void QtOptionsPageWidget::removeQtDir()
{
QTreeWidgetItem *item = m_ui->qtdirList->currentItem();
int index = m_ui->qtdirList->indexOfTopLevelItem(item);
if (index < 0)
return;
for (int i = 0; i < m_ui->defaultCombo->count(); ++i) {
if (m_ui->defaultCombo->itemText(i) == item->text(0)) {
m_ui->defaultCombo->removeItem(i);
break;
}
}
delete item;
delete m_versions.takeAt(index);
updateState();
}
void QtOptionsPageWidget::updateState()
{
bool enabled = (m_ui->qtdirList->currentItem() != 0);
bool isSystemVersion = (enabled
&& m_versions.at(m_ui->qtdirList->indexOfTopLevelItem(m_ui->qtdirList->currentItem()))->isSystemVersion());
m_ui->delButton->setEnabled(enabled && !isSystemVersion);
m_ui->nameEdit->setEnabled(enabled && !isSystemVersion);
m_ui->qtPath->setEnabled(enabled && !isSystemVersion);
m_ui->mingwPath->setEnabled(enabled);
bool hasLog = enabled && !m_ui->qtdirList->currentItem()->data(2, Qt::UserRole).toString().isEmpty();
m_ui->showLogButton->setEnabled(hasLog);
QtVersion *version = 0;
if (enabled)
version = m_versions.at(m_ui->qtdirList->indexOfTopLevelItem(m_ui->qtdirList->currentItem()));
if (version) {
m_ui->rebuildButton->setEnabled(version->isValid());
if (version->hasDebuggingHelper())
m_ui->debuggingHelperStateLabel->setPixmap(QPixmap(":/extensionsystem/images/ok.png"));
else
m_ui->debuggingHelperStateLabel->setPixmap(QPixmap(":/extensionsystem/images/error.png"));
} else {
m_ui->rebuildButton->setEnabled(false);
m_ui->debuggingHelperStateLabel->setPixmap(QPixmap());
}
}
void QtOptionsPageWidget::makeMingwVisible(bool visible)
{
m_ui->mingwLabel->setVisible(visible);
m_ui->mingwPath->setVisible(visible);
}
void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item)
{
m_ui->msvcComboBox->setVisible(false);
if (item) {
int index = m_ui->qtdirList->indexOfTopLevelItem(item);
m_ui->errorLabel->setText("");
ProjectExplorer::ToolChain::ToolChainType t = m_versions.at(index)->toolchainType();
if (t == ProjectExplorer::ToolChain::MinGW) {
m_ui->msvcComboBox->setVisible(false);
makeMingwVisible(true);
m_ui->mingwPath->setPath(m_versions.at(index)->mingwDirectory());
} else if (t == ProjectExplorer::ToolChain::MSVC || t == ProjectExplorer::ToolChain::WINCE){
m_ui->msvcComboBox->setVisible(false);
makeMingwVisible(false);
QStringList msvcEnvironments = ProjectExplorer::ToolChain::availableMSVCVersions();
if (msvcEnvironments.count() == 0) {
} else if (msvcEnvironments.count() == 1) {
} else {
m_ui->msvcComboBox->setVisible(true);
bool block = m_ui->msvcComboBox->blockSignals(true);
m_ui->msvcComboBox->clear();
foreach(const QString &msvcenv, msvcEnvironments) {
m_ui->msvcComboBox->addItem(msvcenv);
if (msvcenv == m_versions.at(index)->msvcVersion()) {
m_ui->msvcComboBox->setCurrentIndex(m_ui->msvcComboBox->count() - 1);
}
}
m_ui->msvcComboBox->blockSignals(block);
}
} else if (t == ProjectExplorer::ToolChain::INVALID) {
m_ui->msvcComboBox->setVisible(false);
makeMingwVisible(false);
if (!m_versions.at(index)->isInstalled())
m_ui->errorLabel->setText(tr("The Qt Version %1 is not installed. Run make install")
.arg(QDir::toNativeSeparators(m_versions.at(index)->path())));
else
m_ui->errorLabel->setText(tr("%1 is not a valid qt directory").arg(QDir::toNativeSeparators(m_versions.at(index)->path())));
} else { //ProjectExplorer::ToolChain::GCC
m_ui->msvcComboBox->setVisible(false);
makeMingwVisible(false);
m_ui->errorLabel->setText(tr("Found Qt version %1, using mkspec %2")
.arg(m_versions.at(index)->qtVersionString(),
m_versions.at(index)->mkspec()));
}
} else {
m_ui->msvcComboBox->setVisible(false);
makeMingwVisible(false);
}
}
void QtOptionsPageWidget::versionChanged(QTreeWidgetItem *item, QTreeWidgetItem *old)
{
if (old) {
fixQtVersionName(m_ui->qtdirList->indexOfTopLevelItem(old));
}
if (item) {
m_ui->nameEdit->setText(item->text(0));
m_ui->qtPath->setPath(item->text(1));
} else {
m_ui->nameEdit->clear();
m_ui->qtPath->setPath(""); // clear()
}
showEnvironmentPage(item);
updateState();
}
void QtOptionsPageWidget::onQtBrowsed()
{
const QString dir = m_ui->qtPath->path();
if (dir.isEmpty())
return;
updateCurrentQtPath();
if (m_ui->nameEdit->text().isEmpty() || m_ui->nameEdit->text() == m_specifyNameString) {
QStringList dirSegments = dir.split(QDir::separator(), QString::SkipEmptyParts);
if (!dirSegments.isEmpty())
m_ui->nameEdit->setText(dirSegments.last());
updateCurrentQtName();
}
updateState();
}
void QtOptionsPageWidget::onMingwBrowsed()
{
const QString dir = m_ui->mingwPath->path();
if (dir.isEmpty())
return;
updateCurrentMingwDirectory();
updateState();
}
void QtOptionsPageWidget::defaultChanged(int)
{
for (int i=0; i<m_ui->defaultCombo->count(); ++i) {
if (m_versions.at(i)->name() == m_ui->defaultCombo->currentText()) {
m_defaultVersion = i;
return;
}
}
m_defaultVersion = 0;
}
void QtOptionsPageWidget::updateCurrentQtName()
{
QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
Q_ASSERT(currentItem);
int currentItemIndex = m_ui->qtdirList->indexOfTopLevelItem(currentItem);
m_versions[currentItemIndex]->setName(m_ui->nameEdit->text());
currentItem->setText(0, m_versions[currentItemIndex]->name());
m_ui->defaultCombo->setItemText(currentItemIndex, m_versions[currentItemIndex]->name());
}
void QtOptionsPageWidget::finish()
{
if (QTreeWidgetItem *item = m_ui->qtdirList->currentItem())
fixQtVersionName(m_ui->qtdirList->indexOfTopLevelItem(item));
}
/* Checks that the qt version name is unique
* and otherwise changes the name
*
*/
void QtOptionsPageWidget::fixQtVersionName(int index)
{
int count = m_versions.count();
for (int i = 0; i < count; ++i) {
if (i != index) {
if (m_versions.at(i)->name() == m_versions.at(index)->name()) {
// Same name, find new name
QString name = m_versions.at(index)->name();
QRegExp regexp("^(.*)\\((\\d)\\)$");
if (regexp.exactMatch(name)) {
// Alreay in Name (#) format
name = regexp.cap(1) + "(" + QString().setNum(regexp.cap(2).toInt() + 1) + ")";
} else {
name = name + " (2)";
}
// set new name
m_versions[index]->setName(name);
m_ui->qtdirList->topLevelItem(index)->setText(0, name);
m_ui->defaultCombo->setItemText(index, name);
// Now check again...
fixQtVersionName(index);
}
}
}
}
void QtOptionsPageWidget::updateCurrentQtPath()
{
QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
Q_ASSERT(currentItem);
int currentItemIndex = m_ui->qtdirList->indexOfTopLevelItem(currentItem);
if (m_versions[currentItemIndex]->path() == m_ui->qtPath->path())
return;
m_versions[currentItemIndex]->setPath(m_ui->qtPath->path());
currentItem->setText(1, QDir::toNativeSeparators(m_versions[currentItemIndex]->path()));
showEnvironmentPage(currentItem);
if (m_versions[currentItemIndex]->isValid()) {
bool hasLog = !currentItem->data(2, Qt::UserRole).toString().isEmpty();
bool hasHelper = m_versions[currentItemIndex]->hasDebuggingHelper();
if (hasHelper) {
currentItem->setData(2, Qt::DecorationRole, QIcon(":/extensionsystem/images/ok.png"));
m_ui->debuggingHelperStateLabel->setPixmap(QPixmap(":/extensionsystem/images/ok.png"));
} else {
currentItem->setData(2, Qt::DecorationRole, QIcon(":/extensionsystem/images/error.png"));
m_ui->debuggingHelperStateLabel->setPixmap(QPixmap(":/extensionsystem/images/error.png"));
}
m_ui->showLogButton->setEnabled(hasLog);
} else {
currentItem->setData(2, Qt::DecorationRole, QIcon());
m_ui->debuggingHelperStateLabel->setPixmap(QPixmap());
}
}
void QtOptionsPageWidget::updateCurrentMingwDirectory()
{
QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
Q_ASSERT(currentItem);
int currentItemIndex = m_ui->qtdirList->indexOfTopLevelItem(currentItem);
m_versions[currentItemIndex]->setMingwDirectory(m_ui->mingwPath->path());
}
void QtOptionsPageWidget::msvcVersionChanged()
{
const QString &msvcVersion = m_ui->msvcComboBox->currentText();
QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
Q_ASSERT(currentItem);
int currentItemIndex = m_ui->qtdirList->indexOfTopLevelItem(currentItem);
m_versions[currentItemIndex]->setMsvcVersion(msvcVersion);
}
QList<QtVersion *> QtOptionsPageWidget::versions() const
{
return m_versions;
}
int QtOptionsPageWidget::defaultVersion() const
{
return m_defaultVersion;
}

View File

@@ -0,0 +1,107 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (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 qt-sales@nokia.com.
**
**************************************************************************/
#ifndef QTOPTIONSPAGE_H
#define QTOPTIONSPAGE_H
#include <coreplugin/dialogs/ioptionspage.h>
#include <QtGui/QWidget>
QT_BEGIN_NAMESPACE
class QTreeWidgetItem;
QT_END_NAMESPACE
namespace ProjectExplorer {
class QtVersion;
namespace Internal {
namespace Ui {
class QtVersionManager;
}
class QtOptionsPageWidget : public QWidget
{
Q_OBJECT
public:
QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> versions, QtVersion *defaultVersion);
~QtOptionsPageWidget();
QList<QtVersion *> versions() const;
int defaultVersion() const;
void finish();
private:
void showEnvironmentPage(QTreeWidgetItem * item);
void fixQtVersionName(int index);
int indexForWidget(QWidget *debuggingHelperWidget) const;
Internal::Ui::QtVersionManager *m_ui;
QList<QtVersion *> m_versions;
int m_defaultVersion;
QString m_specifyNameString;
QString m_specifyPathString;
private slots:
void versionChanged(QTreeWidgetItem *item, QTreeWidgetItem *old);
void addQtDir();
void removeQtDir();
void updateState();
void makeMingwVisible(bool visible);
void onQtBrowsed();
void onMingwBrowsed();
void defaultChanged(int index);
void updateCurrentQtName();
void updateCurrentQtPath();
void updateCurrentMingwDirectory();
void msvcVersionChanged();
void buildDebuggingHelper();
void showDebuggingBuildLog();
};
class QtOptionsPage : public Core::IOptionsPage
{
Q_OBJECT
public:
QtOptionsPage();
~QtOptionsPage();
QString id() const;
QString trName() const;
QString category() const;
QString trCategory() const;
QWidget *createPage(QWidget *parent);
void apply();
void finish() { }
private:
QtOptionsPageWidget *m_widget;
};
} //namespace Internal
} //namespace ProjectExplorer
#endif // QTOPTIONSPAGE_H

View File

@@ -29,36 +29,24 @@
#include "qtversionmanager.h"
#include "qt4projectmanagerconstants.h"
#include "ui_showbuildlog.h"
#include "projectexplorerconstants.h"
#include "cesdkhandler.h"
#include "projectexplorer.h"
#include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/cesdkhandler.h>
#include <projectexplorer/toolchain.h>
#include <help/helpplugin.h>
#include <utils/qtcassert.h>
#include <QtCore/QDebug>
#include <QtCore/QProcess>
#include <QtCore/QSettings>
#include <QtCore/QStringRef>
#include <QtCore/QTime>
#include <QtGui/QFileDialog>
#include <QtGui/QHeaderView>
#include <QtGui/QMessageBox>
#include <QtGui/QPushButton>
#include <QtGui/QToolButton>
#include <QtGui/QApplication>
#include <QtGui/QDesktopServices>
#include <QtGui/QHBoxLayout>
#include <QtGui/QLabel>
using namespace Qt4ProjectManager::Internal;
using ProjectExplorer::Environment;
using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
static const char *QtVersionsSectionName = "QtVersions";
static const char *defaultQtVersionKey = "DefaultQtVersion";
@@ -90,7 +78,6 @@ QtVersionManager::QtVersionManager()
id,
s->value("IsSystemVersion", false).toBool());
version->setMingwDirectory(s->value("MingwDirectory").toString());
version->setPrependPath(s->value("PrependPath").toString());
version->setMsvcVersion(s->value("msvcVersion").toString());
m_versions.append(version);
}
@@ -113,6 +100,11 @@ QtVersionManager::~QtVersionManager()
m_emptyVersion = 0;
}
QtVersionManager *QtVersionManager::instance()
{
return ProjectExplorerPlugin::instance()->qtVersionManager();
}
void QtVersionManager::addVersion(QtVersion *version)
{
m_versions.append(version);
@@ -140,34 +132,6 @@ int QtVersionManager::getUniqueId()
return m_idcount++;
}
QString QtVersionManager::id() const
{
return QLatin1String(Constants::QTVERSION_PAGE);
}
QString QtVersionManager::trName() const
{
return tr(Constants::QTVERSION_PAGE);
}
QString QtVersionManager::category() const
{
return Constants::QT_CATEGORY;
}
QString QtVersionManager::trCategory() const
{
return tr(Constants::QT_CATEGORY);
}
QWidget *QtVersionManager::createPage(QWidget *parent)
{
if (m_widget)
delete m_widget;
m_widget = new QtDirWidget(parent, m_versions, m_defaultVersion);
return m_widget;
}
void QtVersionManager::updateUniqueIdToIndexMap()
{
m_uniqueIdToIndex.clear();
@@ -175,40 +139,6 @@ void QtVersionManager::updateUniqueIdToIndexMap()
m_uniqueIdToIndex.insert(m_versions.at(i)->uniqueId(), i);
}
void QtVersionManager::apply()
{
m_widget->finish();
QList<QtVersion*> newVersions = m_widget->versions();
bool versionPathsChanged = m_versions.size() != newVersions.size();
if (!versionPathsChanged) {
for (int i = 0; i < m_versions.size(); ++i) {
if (m_versions.at(i)->path() != newVersions.at(i)->path()) {
versionPathsChanged = true;
break;
}
}
}
qDeleteAll(m_versions);
m_versions.clear();
foreach(QtVersion *version, m_widget->versions())
m_versions.append(new QtVersion(*version));
if (versionPathsChanged)
updateDocumentation();
updateUniqueIdToIndexMap();
bool emitDefaultChanged = false;
if (m_defaultVersion != m_widget->defaultVersion()) {
m_defaultVersion = m_widget->defaultVersion();
emitDefaultChanged = true;
}
emit qtVersionsChanged();
if (emitDefaultChanged)
emit defaultQtVersionChanged();
writeVersionsIntoSettings();
}
void QtVersionManager::writeVersionsIntoSettings()
{
QSettings *s = Core::ICore::instance()->settings();
@@ -220,7 +150,6 @@ void QtVersionManager::writeVersionsIntoSettings()
s->setValue("Path", m_versions.at(i)->path());
s->setValue("Id", m_versions.at(i)->uniqueId());
s->setValue("MingwDirectory", m_versions.at(i)->mingwDirectory());
s->setValue("PrependPath", m_versions.at(i)->prependPath());
s->setValue("msvcVersion", m_versions.at(i)->msvcVersion());
s->setValue("IsSystemVersion", m_versions.at(i)->isSystemVersion());
}
@@ -271,8 +200,6 @@ void QtVersionManager::addNewVersionsFromInstaller()
QtVersion *version = new QtVersion(newVersionData[0], newVersionData[1], m_idcount++ );
if (newVersionData.count() >= 3)
version->setMingwDirectory(newVersionData[2]);
if (newVersionData.count() >= 4)
version->setPrependPath(newVersionData[3]);
bool versionWasAlreadyInList = false;
foreach(const QtVersion * const it, m_versions) {
@@ -378,408 +305,39 @@ QtVersion *QtVersionManager::currentQtVersion() const
return m_emptyVersion;
}
//-----------------------------------------------------
QtDirWidget::QtDirWidget(QWidget *parent, QList<QtVersion *> versions, int defaultVersion)
: QWidget(parent)
, m_defaultVersion(defaultVersion)
, m_specifyNameString(tr("<specify a name>"))
, m_specifyPathString(tr("<specify a path>"))
void QtVersionManager::setNewQtVersions(QList<QtVersion *> newVersions, int newDefaultVersion)
{
// Initialize m_versions
foreach(QtVersion *version, versions) {
m_versions.append(new QtVersion(*version));
}
m_ui.setupUi(this);
m_ui.qtPath->setExpectedKind(Core::Utils::PathChooser::Directory);
m_ui.qtPath->setPromptDialogTitle(tr("Select QTDIR"));
m_ui.mingwPath->setExpectedKind(Core::Utils::PathChooser::Directory);
m_ui.qtPath->setPromptDialogTitle(tr("Select the Qt Directory"));
m_ui.addButton->setIcon(QIcon(Core::Constants::ICON_PLUS));
m_ui.delButton->setIcon(QIcon(Core::Constants::ICON_MINUS));
for (int i = 0; i < m_versions.count(); ++i) {
const QtVersion * const version = m_versions.at(i);
QTreeWidgetItem *item = new QTreeWidgetItem(m_ui.qtdirList);
item->setText(0, version->name());
item->setText(1, QDir::toNativeSeparators(version->path()));
item->setData(0, Qt::UserRole, version->uniqueId());
if (version->isValid()) {
if (version->hasDebuggingHelper())
item->setData(2, Qt::DecorationRole, QIcon(":/extensionsystem/images/ok.png"));
else
item->setData(2, Qt::DecorationRole, QIcon(":/extensionsystem/images/error.png"));
} else {
item->setData(2, Qt::DecorationRole, QIcon());
bool versionPathsChanged = m_versions.size() != newVersions.size();
if (!versionPathsChanged) {
for (int i = 0; i < m_versions.size(); ++i) {
if (m_versions.at(i)->path() != newVersions.at(i)->path()) {
versionPathsChanged = true;
break;
}
}
m_ui.defaultCombo->addItem(version->name());
if (i == m_defaultVersion)
m_ui.defaultCombo->setCurrentIndex(i);
}
connect(m_ui.nameEdit, SIGNAL(textEdited(const QString &)),
this, SLOT(updateCurrentQtName()));
connect(m_ui.qtPath, SIGNAL(changed()),
this, SLOT(updateCurrentQtPath()));
connect(m_ui.mingwPath, SIGNAL(changed()),
this, SLOT(updateCurrentMingwDirectory()));
connect(m_ui.addButton, SIGNAL(clicked()),
this, SLOT(addQtDir()));
connect(m_ui.delButton, SIGNAL(clicked()),
this, SLOT(removeQtDir()));
connect(m_ui.qtPath, SIGNAL(browsingFinished()),
this, SLOT(onQtBrowsed()));
connect(m_ui.mingwPath, SIGNAL(browsingFinished()),
this, SLOT(onMingwBrowsed()));
connect(m_ui.qtdirList, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
this, SLOT(versionChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
connect(m_ui.defaultCombo, SIGNAL(currentIndexChanged(int)),
this, SLOT(defaultChanged(int)));
connect(m_ui.msvcComboBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(msvcVersionChanged()));
connect(m_ui.rebuildButton, SIGNAL(clicked()),
this, SLOT(buildDebuggingHelper()));
connect(m_ui.showLogButton, SIGNAL(clicked()),
this, SLOT(showDebuggingBuildLog()));
showEnvironmentPage(0);
updateState();
}
void QtDirWidget::buildDebuggingHelper()
{
// Find the qt version for this button..
QTreeWidgetItem *currentItem = m_ui.qtdirList->currentItem();
if (!currentItem)
return;
int currentItemIndex = m_ui.qtdirList->indexOfTopLevelItem(currentItem);
QtVersion *version = m_versions[currentItemIndex];
QString result = m_versions.at(currentItemIndex)->buildDebuggingHelperLibrary();
currentItem->setData(2, Qt::UserRole, result);
if (version->hasDebuggingHelper()) {
m_ui.debuggingHelperStateLabel->setPixmap(QPixmap(":/extensionsystem/images/ok.png"));
currentItem->setData(2, Qt::DecorationRole, QIcon(":/extensionsystem/images/ok.png"));
} else {
m_ui.debuggingHelperStateLabel->setPixmap(QPixmap(":/extensionsystem/images/error.png"));
currentItem->setData(2, Qt::DecorationRole, QIcon(":/extensionsystem/images/error.png"));
}
m_ui.showLogButton->setEnabled(true);
}
void QtDirWidget::showDebuggingBuildLog()
{
QTreeWidgetItem *currentItem = m_ui.qtdirList->currentItem();
if (!currentItem)
return;
int currentItemIndex = m_ui.qtdirList->indexOfTopLevelItem(currentItem);
QDialog dlg;
Ui_ShowBuildLog ui;
ui.setupUi(&dlg);
ui.log->setPlainText(m_ui.qtdirList->topLevelItem(currentItemIndex)->data(2, Qt::UserRole).toString());
dlg.exec();
}
QtDirWidget::~QtDirWidget()
{
qDeleteAll(m_versions);
}
m_versions.clear();
foreach(QtVersion *version, newVersions)
m_versions.append(new QtVersion(*version));
if (versionPathsChanged)
updateDocumentation();
updateUniqueIdToIndexMap();
void QtDirWidget::addQtDir()
{
QtVersion *newVersion = new QtVersion(m_specifyNameString, m_specifyPathString);
m_versions.append(newVersion);
QTreeWidgetItem *item = new QTreeWidgetItem(m_ui.qtdirList);
item->setText(0, newVersion->name());
item->setText(1, QDir::toNativeSeparators(newVersion->path()));
item->setData(0, Qt::UserRole, newVersion->uniqueId());
item->setData(2, Qt::DecorationRole, QIcon());
m_ui.qtdirList->setCurrentItem(item);
m_ui.nameEdit->setText(newVersion->name());
m_ui.qtPath->setPath(newVersion->path());
m_ui.defaultCombo->addItem(newVersion->name());
m_ui.nameEdit->setFocus();
m_ui.nameEdit->selectAll();
}
void QtDirWidget::removeQtDir()
{
QTreeWidgetItem *item = m_ui.qtdirList->currentItem();
int index = m_ui.qtdirList->indexOfTopLevelItem(item);
if (index < 0)
return;
for (int i = 0; i < m_ui.defaultCombo->count(); ++i) {
if (m_ui.defaultCombo->itemText(i) == item->text(0)) {
m_ui.defaultCombo->removeItem(i);
break;
}
bool emitDefaultChanged = false;
if (m_defaultVersion != newDefaultVersion) {
m_defaultVersion = newDefaultVersion;
emitDefaultChanged = true;
}
delete item;
emit qtVersionsChanged();
if (emitDefaultChanged)
emit defaultQtVersionChanged();
delete m_versions.takeAt(index);
updateState();
}
void QtDirWidget::updateState()
{
bool enabled = (m_ui.qtdirList->currentItem() != 0);
bool isSystemVersion = (enabled
&& m_versions.at(m_ui.qtdirList->indexOfTopLevelItem(m_ui.qtdirList->currentItem()))->isSystemVersion());
m_ui.delButton->setEnabled(enabled && !isSystemVersion);
m_ui.nameEdit->setEnabled(enabled && !isSystemVersion);
m_ui.qtPath->setEnabled(enabled && !isSystemVersion);
m_ui.mingwPath->setEnabled(enabled);
bool hasLog = enabled && !m_ui.qtdirList->currentItem()->data(2, Qt::UserRole).toString().isEmpty();
m_ui.showLogButton->setEnabled(hasLog);
QtVersion *version = 0;
if (enabled)
version = m_versions.at(m_ui.qtdirList->indexOfTopLevelItem(m_ui.qtdirList->currentItem()));
if (version) {
m_ui.rebuildButton->setEnabled(version->isValid());
if (version->hasDebuggingHelper())
m_ui.debuggingHelperStateLabel->setPixmap(QPixmap(":/extensionsystem/images/ok.png"));
else
m_ui.debuggingHelperStateLabel->setPixmap(QPixmap(":/extensionsystem/images/error.png"));
} else {
m_ui.rebuildButton->setEnabled(false);
m_ui.debuggingHelperStateLabel->setPixmap(QPixmap());
}
}
void QtDirWidget::makeMingwVisible(bool visible)
{
m_ui.mingwLabel->setVisible(visible);
m_ui.mingwPath->setVisible(visible);
}
void QtDirWidget::showEnvironmentPage(QTreeWidgetItem *item)
{
m_ui.msvcComboBox->setVisible(false);
if (item) {
int index = m_ui.qtdirList->indexOfTopLevelItem(item);
m_ui.errorLabel->setText("");
ProjectExplorer::ToolChain::ToolChainType t = m_versions.at(index)->toolchainType();
if (t == ProjectExplorer::ToolChain::MinGW) {
m_ui.msvcComboBox->setVisible(false);
makeMingwVisible(true);
m_ui.mingwPath->setPath(m_versions.at(index)->mingwDirectory());
} else if (t == ProjectExplorer::ToolChain::MSVC || t == ProjectExplorer::ToolChain::WINCE){
m_ui.msvcComboBox->setVisible(false);
makeMingwVisible(false);
QStringList msvcEnvironments = ProjectExplorer::ToolChain::availableMSVCVersions();
if (msvcEnvironments.count() == 0) {
} else if (msvcEnvironments.count() == 1) {
} else {
m_ui.msvcComboBox->setVisible(true);
bool block = m_ui.msvcComboBox->blockSignals(true);
m_ui.msvcComboBox->clear();
foreach(const QString &msvcenv, msvcEnvironments) {
m_ui.msvcComboBox->addItem(msvcenv);
if (msvcenv == m_versions.at(index)->msvcVersion()) {
m_ui.msvcComboBox->setCurrentIndex(m_ui.msvcComboBox->count() - 1);
}
}
m_ui.msvcComboBox->blockSignals(block);
}
} else if (t == ProjectExplorer::ToolChain::INVALID) {
m_ui.msvcComboBox->setVisible(false);
makeMingwVisible(false);
if (!m_versions.at(index)->isInstalled())
m_ui.errorLabel->setText(tr("The Qt Version %1 is not installed. Run make install")
.arg(QDir::toNativeSeparators(m_versions.at(index)->path())));
else
m_ui.errorLabel->setText(tr("%1 is not a valid qt directory").arg(QDir::toNativeSeparators(m_versions.at(index)->path())));
} else { //ProjectExplorer::ToolChain::GCC
m_ui.msvcComboBox->setVisible(false);
makeMingwVisible(false);
m_ui.errorLabel->setText(tr("Found Qt version %1, using mkspec %2")
.arg(m_versions.at(index)->qtVersionString(),
m_versions.at(index)->mkspec()));
}
} else {
m_ui.msvcComboBox->setVisible(false);
makeMingwVisible(false);
}
}
void QtDirWidget::versionChanged(QTreeWidgetItem *item, QTreeWidgetItem *old)
{
if (old) {
fixQtVersionName(m_ui.qtdirList->indexOfTopLevelItem(old));
}
if (item) {
m_ui.nameEdit->setText(item->text(0));
m_ui.qtPath->setPath(item->text(1));
} else {
m_ui.nameEdit->clear();
m_ui.qtPath->setPath(""); // clear()
}
showEnvironmentPage(item);
updateState();
}
void QtDirWidget::onQtBrowsed()
{
const QString dir = m_ui.qtPath->path();
if (dir.isEmpty())
return;
updateCurrentQtPath();
if (m_ui.nameEdit->text().isEmpty() || m_ui.nameEdit->text() == m_specifyNameString) {
QStringList dirSegments = dir.split(QDir::separator(), QString::SkipEmptyParts);
if (!dirSegments.isEmpty())
m_ui.nameEdit->setText(dirSegments.last());
updateCurrentQtName();
}
updateState();
}
void QtDirWidget::onMingwBrowsed()
{
const QString dir = m_ui.mingwPath->path();
if (dir.isEmpty())
return;
updateCurrentMingwDirectory();
updateState();
}
void QtDirWidget::defaultChanged(int)
{
for (int i=0; i<m_ui.defaultCombo->count(); ++i) {
if (m_versions.at(i)->name() == m_ui.defaultCombo->currentText()) {
m_defaultVersion = i;
return;
}
}
m_defaultVersion = 0;
}
void QtDirWidget::updateCurrentQtName()
{
QTreeWidgetItem *currentItem = m_ui.qtdirList->currentItem();
Q_ASSERT(currentItem);
int currentItemIndex = m_ui.qtdirList->indexOfTopLevelItem(currentItem);
m_versions[currentItemIndex]->setName(m_ui.nameEdit->text());
currentItem->setText(0, m_versions[currentItemIndex]->name());
m_ui.defaultCombo->setItemText(currentItemIndex, m_versions[currentItemIndex]->name());
writeVersionsIntoSettings();
}
void QtDirWidget::finish()
{
if (QTreeWidgetItem *item = m_ui.qtdirList->currentItem())
fixQtVersionName(m_ui.qtdirList->indexOfTopLevelItem(item));
}
/* Checks that the qt version name is unique
* and otherwise changes the name
*
*/
void QtDirWidget::fixQtVersionName(int index)
{
int count = m_versions.count();
for (int i = 0; i < count; ++i) {
if (i != index) {
if (m_versions.at(i)->name() == m_versions.at(index)->name()) {
// Same name, find new name
QString name = m_versions.at(index)->name();
QRegExp regexp("^(.*)\\((\\d)\\)$");
if (regexp.exactMatch(name)) {
// Alreay in Name (#) format
name = regexp.cap(1) + "(" + QString().setNum(regexp.cap(2).toInt() + 1) + ")";
} else {
name = name + " (2)";
}
// set new name
m_versions[index]->setName(name);
m_ui.qtdirList->topLevelItem(index)->setText(0, name);
m_ui.defaultCombo->setItemText(index, name);
// Now check again...
fixQtVersionName(index);
}
}
}
}
void QtDirWidget::updateCurrentQtPath()
{
QTreeWidgetItem *currentItem = m_ui.qtdirList->currentItem();
Q_ASSERT(currentItem);
int currentItemIndex = m_ui.qtdirList->indexOfTopLevelItem(currentItem);
if (m_versions[currentItemIndex]->path() == m_ui.qtPath->path())
return;
m_versions[currentItemIndex]->setPath(m_ui.qtPath->path());
currentItem->setText(1, QDir::toNativeSeparators(m_versions[currentItemIndex]->path()));
showEnvironmentPage(currentItem);
if (m_versions[currentItemIndex]->isValid()) {
bool hasLog = !currentItem->data(2, Qt::UserRole).toString().isEmpty();
bool hasHelper = m_versions[currentItemIndex]->hasDebuggingHelper();
if (hasHelper) {
currentItem->setData(2, Qt::DecorationRole, QIcon(":/extensionsystem/images/ok.png"));
m_ui.debuggingHelperStateLabel->setPixmap(QPixmap(":/extensionsystem/images/ok.png"));
} else {
currentItem->setData(2, Qt::DecorationRole, QIcon(":/extensionsystem/images/error.png"));
m_ui.debuggingHelperStateLabel->setPixmap(QPixmap(":/extensionsystem/images/error.png"));
}
m_ui.showLogButton->setEnabled(hasLog);
} else {
currentItem->setData(2, Qt::DecorationRole, QIcon());
m_ui.debuggingHelperStateLabel->setPixmap(QPixmap());
}
}
void QtDirWidget::updateCurrentMingwDirectory()
{
QTreeWidgetItem *currentItem = m_ui.qtdirList->currentItem();
Q_ASSERT(currentItem);
int currentItemIndex = m_ui.qtdirList->indexOfTopLevelItem(currentItem);
m_versions[currentItemIndex]->setMingwDirectory(m_ui.mingwPath->path());
}
void QtDirWidget::msvcVersionChanged()
{
const QString &msvcVersion = m_ui.msvcComboBox->currentText();
QTreeWidgetItem *currentItem = m_ui.qtdirList->currentItem();
Q_ASSERT(currentItem);
int currentItemIndex = m_ui.qtdirList->indexOfTopLevelItem(currentItem);
m_versions[currentItemIndex]->setMsvcVersion(msvcVersion);
}
QList<QtVersion *> QtDirWidget::versions() const
{
return m_versions;
}
int QtDirWidget::defaultVersion() const
{
return m_defaultVersion;
}
///
/// QtVersion
@@ -918,7 +476,6 @@ void QtVersion::updateSourcePath()
// QtVersion *QtVersionManager::qtVersionForDirectory(const QString directory);
QString QtVersionManager::findQtVersionFromMakefile(const QString &directory)
{
QString result = QString::null;
bool debugAdding = false;
QFile makefile(directory + "/Makefile" );
if (makefile.exists() && makefile.open(QFile::ReadOnly)) {
@@ -934,14 +491,12 @@ QString QtVersionManager::findQtVersionFromMakefile(const QString &directory)
QString qtDir = binDir.absolutePath();
if (debugAdding)
qDebug() << "#~~ QtDir:"<<qtDir;
// Now we have the qtDir
// look through the qtversions wheter we already have that qt version setup
return qtDir;
}
}
makefile.close();
}
return result;
return QString::null;
}
QtVersion *QtVersionManager::qtVersionForDirectory(const QString &directory)
@@ -1309,16 +864,6 @@ void QtVersion::setMingwDirectory(const QString &directory)
m_mingwDirectory = directory;
}
QString QtVersion::prependPath() const
{
return m_prependPath;
}
void QtVersion::setPrependPath(const QString &directory)
{
m_prependPath = directory;
}
QString QtVersion::msvcVersion() const
{
return m_msvcVersion;
@@ -1352,8 +897,7 @@ int QtVersion::uniqueId() const
int QtVersion::getUniqueId()
{
QtVersionManager *vm = ExtensionSystem::PluginManager::instance()->getObject<QtVersionManager>();
return vm->getUniqueId();
return QtVersionManager::instance()->getUniqueId();
}
bool QtVersion::isValid() const

View File

@@ -30,24 +30,22 @@
#ifndef QTVERSIONMANAGER_H
#define QTVERSIONMANAGER_H
#include "ui_qtversionmanager.h"
#include "environment.h"
#include "toolchain.h"
#include "projectexplorer_export.h"
#include <coreplugin/dialogs/ioptionspage.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/toolchain.h>
#include <QtCore/QHash>
#include <QtCore/QPointer>
#include <QtGui/QWidget>
#include <QtGui/QPushButton>
namespace ProjectExplorer {
namespace Qt4ProjectManager {
namespace Internal {
class QtOptionsPageWidget;
class QtOptionsPage;
}
class QtDirWidget;
class QtVersion
class PROJECTEXPLORER_EXPORT QtVersion
{
friend class QtDirWidget; //for changing name and path
friend class Internal::QtOptionsPageWidget; //for changing name and path
friend class QtVersionManager;
public:
QtVersion(const QString &name, const QString &path);
@@ -74,12 +72,11 @@ public:
QString mingwDirectory() const;
void setMingwDirectory(const QString &directory);
QString prependPath() const;
void setPrependPath(const QString &string);
QString msvcVersion() const;
QString wincePlatform() const;
void setMsvcVersion(const QString &version);
void addToEnvironment(ProjectExplorer::Environment &env);
bool hasDebuggingHelper() const;
// Builds a debugging library
// returns the output of the commands
@@ -98,6 +95,7 @@ public:
QString dumperLibrary() const;
private:
static int getUniqueId();
// Also used by QtOptionsPageWidget
void setName(const QString &name);
void setPath(const QString &path);
void updateSourcePath();
@@ -126,87 +124,42 @@ private:
bool m_hasDebuggingHelper;
};
class QtDirWidget : public QWidget
class PROJECTEXPLORER_EXPORT QtVersionManager : public QObject
{
Q_OBJECT
// for getUniqueId();
friend class QtVersion;
friend class Internal::QtOptionsPage;
public:
QtDirWidget(QWidget *parent, QList<QtVersion *> versions, int defaultVersion);
~QtDirWidget();
QList<QtVersion *> versions() const;
int defaultVersion() const;
void finish();
private:
void showEnvironmentPage(QTreeWidgetItem * item);
void fixQtVersionName(int index);
int indexForWidget(QWidget *debuggingHelperWidget) const;
Ui::QtVersionManager m_ui;
QList<QtVersion *> m_versions;
int m_defaultVersion;
QString m_specifyNameString;
QString m_specifyPathString;
private slots:
void versionChanged(QTreeWidgetItem *item, QTreeWidgetItem *old);
void addQtDir();
void removeQtDir();
void updateState();
void makeMingwVisible(bool visible);
void onQtBrowsed();
void onMingwBrowsed();
void defaultChanged(int index);
void updateCurrentQtName();
void updateCurrentQtPath();
void updateCurrentMingwDirectory();
void msvcVersionChanged();
void buildDebuggingHelper();
void showDebuggingBuildLog();
};
class QtVersionManager : public Core::IOptionsPage
{
Q_OBJECT
public:
static QtVersionManager *instance();
QtVersionManager();
~QtVersionManager();
QString id() const;
QString trName() const;
QString category() const;
QString trCategory() const;
QWidget *createPage(QWidget *parent);
void apply();
void finish() { }
void writeVersionsIntoSettings();
QList<QtVersion *> versions() const;
QtVersion * version(int id) const;
QtVersion * currentQtVersion() const;
QtVersion *version(int id) const;
QtVersion *currentQtVersion() const;
// internal
int getUniqueId();
QtVersion::QmakeBuildConfig scanMakefileForQmakeConfig(const QString &directory, QtVersion::QmakeBuildConfig defaultBuildConfig);
QString findQtVersionFromMakefile(const QString &directory);
QtVersion *qtVersionForDirectory(const QString &directory);
// Used by the projectloadwizard
void addVersion(QtVersion *version);
// Static Methods
// returns something like qmake4, qmake, qmake-qt4 or whatever distributions have chosen (used by QtVersion)
static QStringList possibleQMakeCommands();
// return true if the qmake at qmakePath is qt4 (used by QtVersion)
static QString qtVersionForQMake(const QString &qmakePath);
static QtVersion::QmakeBuildConfig scanMakefileForQmakeConfig(const QString &directory, QtVersion::QmakeBuildConfig defaultBuildConfig);
static QString findQtVersionFromMakefile(const QString &directory);
signals:
void defaultQtVersionChanged();
void qtVersionsChanged();
private:
// Used by QtOptionsPage
void setNewQtVersions(QList<QtVersion *> newVersions, int newDefaultVersion);
// Used by QtVersion
int getUniqueId();
void writeVersionsIntoSettings();
void addNewVersionsFromInstaller();
void updateSystemVersion();
void updateDocumentation();
@@ -214,8 +167,6 @@ private:
static int indexOfVersionInList(const QtVersion * const version, const QList<QtVersion *> &list);
void updateUniqueIdToIndexMap();
QPointer<QtDirWidget> m_widget;
QtVersion *m_emptyVersion;
int m_defaultVersion;
QList<QtVersion *> m_versions;
@@ -223,7 +174,6 @@ private:
int m_idcount;
};
} // namespace Internal
} // namespace Qt4ProjectManager
} // namespace ProjectExplorer
#endif // QTVERSIONMANAGER_H

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Qt4ProjectManager::Internal::QtVersionManager</class>
<widget class="QWidget" name="Qt4ProjectManager::Internal::QtVersionManager">
<class>ProjectExplorer::Internal::QtVersionManager</class>
<widget class="QWidget" name="ProjectExplorer::Internal::QtVersionManager">
<property name="geometry">
<rect>
<x>0</x>

View File

@@ -43,6 +43,7 @@
using ProjectExplorer::IBuildParserFactory;
using ProjectExplorer::BuildParserInterface;
using ProjectExplorer::Environment;
using ProjectExplorer::QtVersion;
using ExtensionSystem::PluginManager;
using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Internal;
@@ -64,7 +65,7 @@ MakeStep::~MakeStep()
m_buildParser = 0;
}
ProjectExplorer::BuildParserInterface *MakeStep::buildParser(const QtVersion * const version)
ProjectExplorer::BuildParserInterface *MakeStep::buildParser(const QtVersion *const version)
{
QString buildParser;
ProjectExplorer::ToolChain::ToolChainType type = version->toolchainType();

View File

@@ -30,16 +30,17 @@
#ifndef MAKESTEP_H
#define MAKESTEP_H
#include "qtversionmanager.h"
#include "ui_makestep.h"
#include <projectexplorer/abstractprocessstep.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/qtversionmanager.h>
namespace ProjectExplorer {
class BuildStep;
class IBuildStepFactory;
class Project;
class QtVersion;
}
namespace Qt4ProjectManager {
@@ -81,7 +82,7 @@ private slots:
void addDirectory(const QString &dir);
void removeDirectory(const QString &dir);
private:
ProjectExplorer::BuildParserInterface *buildParser(const Internal::QtVersion * const version);
ProjectExplorer::BuildParserInterface *buildParser(const ProjectExplorer::QtVersion *const version);
Qt4Project *m_project;
ProjectExplorer::BuildParserInterface *m_buildParser;
bool m_skipMakeClean;

View File

@@ -35,6 +35,8 @@
using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Internal;
using ProjectExplorer::QtVersion;
ProFileReader::ProFileReader()
{
}

View File

@@ -31,7 +31,7 @@
#define PROFILEREADER_H
#include "profileevaluator.h"
#include "qtversionmanager.h"
#include <projectexplorer/qtversionmanager.h>
#include <QtCore/QObject>
#include <QtCore/QMap>
@@ -39,7 +39,6 @@
namespace Qt4ProjectManager {
namespace Internal {
class ProFileReader : public QObject, public ProFileEvaluator
{
Q_OBJECT
@@ -48,7 +47,7 @@ public:
ProFileReader();
~ProFileReader();
void setQtVersion(QtVersion *qtVersion);
void setQtVersion(ProjectExplorer::QtVersion *qtVersion);
bool readProFile(const QString &fileName);
QList<ProFile*> includeFiles() const;

View File

@@ -34,6 +34,8 @@
#include "qmakestep.h"
#include "makestep.h"
#include <extensionsystem/pluginmanager.h>
#include <QtGui/QCheckBox>
#include <QtGui/QHeaderView>
#include <QtGui/QLabel>
@@ -43,12 +45,14 @@
using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Internal;
using ProjectExplorer::QtVersion;
ProjectLoadWizard::ProjectLoadWizard(Qt4Project *project, QWidget *parent, Qt::WindowFlags flags)
: QWizard(parent, flags), m_project(project), m_importVersion(0), m_temporaryVersion(false)
{
QtVersionManager * vm = project->qt4ProjectManager()->versionManager();
ProjectExplorer::QtVersionManager * vm = ProjectExplorer::QtVersionManager::instance();
QString directory = QFileInfo(project->file()->fileName()).absolutePath();
QString importVersion = vm->findQtVersionFromMakefile(directory);
QString importVersion = ProjectExplorer::QtVersionManager::findQtVersionFromMakefile(directory);
if (!importVersion.isNull()) {
// This also means we have a build in there
@@ -61,7 +65,7 @@ ProjectLoadWizard::ProjectLoadWizard(Qt4Project *project, QWidget *parent, Qt::W
}
m_importBuildConfig = m_importVersion->defaultBuildConfig();
m_importBuildConfig= vm->scanMakefileForQmakeConfig(directory, m_importBuildConfig);
m_importBuildConfig= ProjectExplorer::QtVersionManager::scanMakefileForQmakeConfig(directory, m_importBuildConfig);
}
// So now we have the version and the configuration for that version
@@ -125,6 +129,7 @@ void ProjectLoadWizard::addBuildConfiguration(QString name, QtVersion *qtversion
void ProjectLoadWizard::done(int result)
{
ProjectExplorer::QtVersionManager *vm = ProjectExplorer::QtVersionManager::instance();
QWizard::done(result);
// This normally happens on showing the final page, but since we
// don't show it anymore, do it here
@@ -133,7 +138,7 @@ void ProjectLoadWizard::done(int result)
if (m_importVersion && importCheckbox->isChecked()) {
// Importing
if (m_temporaryVersion)
m_project->qt4ProjectManager()->versionManager()->addVersion(m_importVersion);
vm->addVersion(m_importVersion);
// Import the existing stuff
// qDebug()<<"Creating m_buildconfiguration entry from imported stuff";
// qDebug()<<((m_importBuildConfig& QtVersion::BuildAll)? "debug_and_release" : "")<<((m_importBuildConfig & QtVersion::DebugBuild)? "debug" : "release");
@@ -156,7 +161,7 @@ void ProjectLoadWizard::done(int result)
delete m_importVersion;
// Create default
bool buildAll = false;
QtVersion *defaultVersion = m_project->qt4ProjectManager()->versionManager()->version(0);
QtVersion *defaultVersion = vm->version(0);
if (defaultVersion && defaultVersion->isValid() && (defaultVersion->defaultBuildConfig() & QtVersion::BuildAll))
buildAll = true;
if (buildAll) {

View File

@@ -30,7 +30,7 @@
#ifndef PROJECTLOADWIZARD_H
#define PROJECTLOADWIZARD_H
#include "qtversionmanager.h"
#include <projectexplorer/qtversionmanager.h>
#include <QtGui/QWizard>
@@ -57,14 +57,14 @@ public:
void execDialog();
private:
void addBuildConfiguration(QString name, QtVersion *qtversion, QtVersion::QmakeBuildConfig buildConfiguration);
void setupImportPage(QtVersion *version, QtVersion::QmakeBuildConfig buildConfig);
void addBuildConfiguration(QString name, ProjectExplorer::QtVersion *qtversion, ProjectExplorer::QtVersion::QmakeBuildConfig buildConfiguration);
void setupImportPage(ProjectExplorer::QtVersion *version, ProjectExplorer::QtVersion::QmakeBuildConfig buildConfig);
Qt4Project *m_project;
// Only used for imported stuff
QtVersion *m_importVersion;
QtVersion::QmakeBuildConfig m_importBuildConfig;
ProjectExplorer::QtVersion *m_importVersion;
ProjectExplorer::QtVersion::QmakeBuildConfig m_importBuildConfig;
// Those that we might add
bool m_temporaryVersion;

View File

@@ -33,10 +33,10 @@
#include "qt4projectmanagerconstants.h"
#include "qt4projectmanager.h"
#include "makestep.h"
#include "qtversionmanager.h"
#include <coreplugin/icore.h>
#include <utils/qtcassert.h>
#include <projectexplorer/qtversionmanager.h>
#include <QFileDialog>
#include <QDir>

View File

@@ -64,6 +64,7 @@
using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Internal;
using ProjectExplorer::QtVersion;
namespace {
bool debug = false;

View File

@@ -36,7 +36,6 @@
#include "qmakestep.h"
#include "deployhelper.h"
#include "qt4runconfiguration.h"
#include "qtversionmanager.h"
#include "qt4nodes.h"
#include "qt4projectconfigwidget.h"
#include "qt4buildenvironmentwidget.h"
@@ -51,6 +50,7 @@
#include <projectexplorer/nodesvisitor.h>
#include <projectexplorer/project.h>
#include <projectexplorer/customexecutablerunconfiguration.h>
#include <projectexplorer/qtversionmanager.h>
#include <QtCore/QDebug>
#include <QtCore/QDir>
@@ -236,9 +236,11 @@ Qt4Project::Qt4Project(Qt4Manager *manager, const QString& fileName) :
{
m_manager->registerProject(this);
connect(qt4ProjectManager()->versionManager(), SIGNAL(defaultQtVersionChanged()),
ProjectExplorer::QtVersionManager *vm = ProjectExplorer::QtVersionManager::instance();
connect(vm, SIGNAL(defaultQtVersionChanged()),
this, SLOT(defaultQtVersionChanged()));
connect(qt4ProjectManager()->versionManager(), SIGNAL(qtVersionsChanged()),
connect(vm, SIGNAL(qtVersionsChanged()),
this, SLOT(qtVersionsChanged()));
m_updateCodeModelTimer.setSingleShot(true);
@@ -266,8 +268,9 @@ void Qt4Project::defaultQtVersionChanged()
void Qt4Project::qtVersionsChanged()
{
QtVersionManager *vm = QtVersionManager::instance();
foreach (QString bc, buildConfigurations()) {
if (!qt4ProjectManager()->versionManager()->version(qtVersionId(bc))->isValid()) {
if (!vm->version(qtVersionId(bc))->isValid()) {
setQtVersion(bc, 0);
if (bc == activeBuildConfiguration())
m_rootProjectNode->update();
@@ -740,18 +743,19 @@ QString Qt4Project::qtDir(const QString &buildConfiguration) const
QtVersion *Qt4Project::qtVersion(const QString &buildConfiguration) const
{
return m_manager->versionManager()->version(qtVersionId(buildConfiguration));
return QtVersionManager::instance()->version(qtVersionId(buildConfiguration));
}
int Qt4Project::qtVersionId(const QString &buildConfiguration) const
{
QtVersionManager *vm = QtVersionManager::instance();
if (debug)
qDebug()<<"Looking for qtVersion ID of "<<buildConfiguration;
int id = 0;
QVariant vid = value(buildConfiguration, "QtVersionId");
if (vid.isValid()) {
id = vid.toInt();
if (m_manager->versionManager()->version(id)->isValid()) {
if (vm->version(id)->isValid()) {
return id;
} else {
const_cast<Qt4Project *>(this)->setValue(buildConfiguration, "QtVersionId", 0);
@@ -763,7 +767,7 @@ int Qt4Project::qtVersionId(const QString &buildConfiguration) const
if (debug)
qDebug()<<" Backward compatibility reading QtVersion"<<vname;
if (!vname.isEmpty()) {
const QList<QtVersion *> &versions = m_manager->versionManager()->versions();
const QList<QtVersion *> &versions = vm->versions();
foreach (const QtVersion * const version, versions) {
if (version->name() == vname) {
if (debug)

View File

@@ -30,7 +30,6 @@
#ifndef QT4PROJECT_H
#define QT4PROJECT_H
#include "qtversionmanager.h"
#include "qt4nodes.h"
#include "qmakestep.h"
#include "makestep.h"
@@ -39,6 +38,7 @@
#include <projectexplorer/applicationrunconfiguration.h>
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/qtversionmanager.h>
#include <QtCore/QObject>
#include <QtCore/QList>
@@ -148,7 +148,7 @@ public:
//returns the qtVersion, if the project is set to use the default qt version, then
// that is returned
// to check wheter the project uses the default qt version use qtVersionId
Internal::QtVersion *qtVersion(const QString &buildConfiguration) const;
ProjectExplorer::QtVersion *qtVersion(const QString &buildConfiguration) const;
// returns the id of the qt version, if the project is using the default qt version
// this function returns 0

View File

@@ -38,9 +38,14 @@
#include <coreplugin/icore.h>
#include <coreplugin/mainwindow.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <extensionsystem/pluginmanager.h>
#include <QtGui/QFileDialog>
using ProjectExplorer::QtVersionManager;
using ProjectExplorer::QtVersion;
namespace {
bool debug = false;
}
@@ -79,7 +84,9 @@ Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(Qt4Project *project)
connect(m_ui->manageQtVersionPushButtons, SIGNAL(clicked()),
this, SLOT(manageQtVersions()));
connect(m_pro->qt4ProjectManager()->versionManager(), SIGNAL(qtVersionsChanged()),
ProjectExplorer::QtVersionManager *vm = ProjectExplorer::QtVersionManager::instance();
connect(vm, SIGNAL(qtVersionsChanged()),
this, SLOT(setupQtVersionsComboBox()));
}
@@ -91,7 +98,7 @@ Qt4ProjectConfigWidget::~Qt4ProjectConfigWidget()
void Qt4ProjectConfigWidget::manageQtVersions()
{
Core::ICore *core = Core::ICore::instance();
core->showOptionsDialog(Constants::QT_CATEGORY, Constants::QTVERSION_PAGE);
core->showOptionsDialog(ProjectExplorer::Constants::QT_CATEGORY, ProjectExplorer::Constants::QTVERSION_PAGE);
}
@@ -139,7 +146,7 @@ void Qt4ProjectConfigWidget::setupQtVersionsComboBox()
m_ui->invalidQtWarningLabel->setVisible(false);
}
// Add Qt Versions to the combo box
QtVersionManager *vm = m_pro->qt4ProjectManager()->versionManager();
QtVersionManager *vm = QtVersionManager::instance();
const QList<QtVersion *> &versions = vm->versions();
for (int i = 0; i < versions.size(); ++i) {
m_ui->qtVersionComboBox->addItem(versions.at(i)->name(), versions.at(i)->uniqueId());
@@ -177,7 +184,7 @@ void Qt4ProjectConfigWidget::updateImportLabel()
{
m_ui->importLabel->setVisible(false);
if (m_ui->shadowBuildCheckBox->isChecked()) {
QString qtPath = m_pro->qt4ProjectManager()->versionManager()->findQtVersionFromMakefile(m_ui->shadowBuildDirEdit->path());
QString qtPath = ProjectExplorer::QtVersionManager::findQtVersionFromMakefile(m_ui->shadowBuildDirEdit->path());
if (!qtPath.isEmpty()) {
m_ui->importLabel->setVisible(true);
}
@@ -211,16 +218,16 @@ void Qt4ProjectConfigWidget::importLabelClicked()
if (m_ui->shadowBuildCheckBox->isChecked()) {
QString directory = m_ui->shadowBuildDirEdit->path();
if (!directory.isEmpty()) {
QtVersionManager *vm = m_pro->qt4ProjectManager()->versionManager();
QString qtPath = vm->findQtVersionFromMakefile(directory);
QString qtPath = QtVersionManager::findQtVersionFromMakefile(directory);
if (!qtPath.isEmpty()) {
QtVersionManager *vm = QtVersionManager::instance();
QtVersion *version = vm->qtVersionForDirectory(qtPath);
if (!version) {
version = new QtVersion(QFileInfo(qtPath).baseName(), qtPath);
vm->addVersion(version);
}
QtVersion::QmakeBuildConfig qmakeBuildConfig = version->defaultBuildConfig();
qmakeBuildConfig = vm->scanMakefileForQmakeConfig(directory, qmakeBuildConfig);
qmakeBuildConfig = QtVersionManager::scanMakefileForQmakeConfig(directory, qmakeBuildConfig);
// So we got all the information now apply it...
m_pro->setQtVersion(m_buildConfiguration, version->uniqueId());
@@ -261,7 +268,8 @@ void Qt4ProjectConfigWidget::qtVersionComboBoxCurrentIndexChanged(const QString
} else {
newQtVersion = m_ui->qtVersionComboBox->itemData(m_ui->qtVersionComboBox->currentIndex()).toInt();
}
bool isValid = m_pro->qt4ProjectManager()->versionManager()->version(newQtVersion)->isValid();
ProjectExplorer::QtVersionManager *vm = ProjectExplorer::QtVersionManager::instance();
bool isValid = vm->version(newQtVersion)->isValid();
m_ui->invalidQtWarningLabel->setVisible(!isValid);
if (newQtVersion != m_pro->qtVersionId(m_buildConfiguration)) {
m_pro->setQtVersion(m_buildConfiguration, newQtVersion);

View File

@@ -34,7 +34,6 @@
#include "qt4nodes.h"
#include "qt4project.h"
#include "profilereader.h"
#include "qtversionmanager.h"
#include "qmakestep.h"
#include <coreplugin/icore.h>
@@ -47,6 +46,7 @@
#include <projectexplorer/buildmanager.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/qtversionmanager.h>
#include <utils/listutils.h>
#include <QtCore/QCoreApplication>
@@ -68,6 +68,8 @@ using ProjectExplorer::SourceType;
using ProjectExplorer::FormType;
using ProjectExplorer::ResourceType;
using ProjectExplorer::UnknownFileType;
using ProjectExplorer::QtVersion;
using ProjectExplorer::QtVersionManager;
// Known file types of a Qt 4 project
static const char* qt4FileTypes[] = {
@@ -187,11 +189,6 @@ ProjectExplorer::Project *Qt4Manager::contextProject() const
return m_contextProject;
}
QtVersionManager *Qt4Manager::versionManager() const
{
return m_plugin->versionManager();
}
void Qt4Manager::runQMake()
{
runQMake(m_projectExplorer->currentProject());

View File

@@ -43,6 +43,7 @@ class PluginManager;
namespace ProjectExplorer {
class Project;
class ProjectExplorerPlugin;
class QtVersionManager;
}
namespace Qt4ProjectManager {
@@ -51,7 +52,6 @@ namespace Internal {
class Qt4Builder;
class ProFileEditor;
class Qt4ProjectManagerPlugin;
class QtVersionManager;
}
class Qt4Project;
@@ -85,8 +85,6 @@ public:
void setContextProject(ProjectExplorer::Project *project);
ProjectExplorer::Project *contextProject() const;
Internal::QtVersionManager *versionManager() const;
// Return the id string of a file
static QString fileTypeId(ProjectExplorer::FileType type);

View File

@@ -5,7 +5,6 @@ include(../../qworkbenchplugin.pri)
include(qt4projectmanager_dependencies.pri)
HEADERS = qt4projectmanagerplugin.h \
qt4projectmanager.h \
qtversionmanager.h \
qt4project.h \
qt4nodes.h \
profileeditor.h \
@@ -36,7 +35,6 @@ HEADERS = qt4projectmanagerplugin.h \
projectloadwizard.h
SOURCES = qt4projectmanagerplugin.cpp \
qt4projectmanager.cpp \
qtversionmanager.cpp \
qt4project.cpp \
qt4nodes.cpp \
profileeditor.cpp \
@@ -63,17 +61,17 @@ SOURCES = qt4projectmanagerplugin.cpp \
qt4projectconfigwidget.cpp \
qt4buildenvironmentwidget.cpp \
projectloadwizard.cpp
FORMS = qtversionmanager.ui \
envvariablespage.ui \
FORMS = envvariablespage.ui \
enveditdialog.ui \
proeditorcontainer.ui \
makestep.ui \
qmakestep.ui \
qt4projectconfigwidget.ui \
embeddedpropertiespage.ui \
qt4buildenvironmentwidget.ui \
showbuildlog.ui
qt4buildenvironmentwidget.ui
RESOURCES = qt4projectmanager.qrc \
wizards/wizards.qrc
include(../../shared/proparser/proparser.pri)
DEFINES += QT_NO_CAST_TO_ASCII
OTHER_FILES += Qt4ProjectManager.pluginspec

View File

@@ -37,11 +37,6 @@ namespace Constants {
const char * const C_PROFILEEDITOR = ".pro File Editor";
const char * const C_PROFILEEDITOR_PANEL = ".pro File Editor (embedded)";
//settings pages
const char * const QT_CATEGORY = "Qt4";
const char * const QTVERSION_PAGE = "Qt Versions";
const char * const BUILD_ENVIRONMENT_PAGE = "Build Environments";
// kinds
const char * const PROJECT_KIND = "Qt4";
const char * const PROFILE_EDITOR = ".pro File Editor";

View File

@@ -36,7 +36,6 @@
#include "profileeditorfactory.h"
#include "qt4projectmanagerconstants.h"
#include "qt4project.h"
#include "qtversionmanager.h"
#include "embeddedpropertiespage.h"
#include "qt4runconfiguration.h"
#include "profilereader.h"
@@ -48,6 +47,7 @@
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/qtversionmanager.h>
#include <coreplugin/uniqueidmanager.h>
#include <coreplugin/mimedatabase.h>
#include <coreplugin/actionmanager/actionmanager.h>
@@ -64,15 +64,13 @@
using namespace Qt4ProjectManager::Internal;
using namespace Qt4ProjectManager;
using ProjectExplorer::Project;
using ProjectExplorer::QtVersionManager;
Qt4ProjectManagerPlugin::~Qt4ProjectManagerPlugin()
{
//removeObject(m_embeddedPropertiesPage);
//delete m_embeddedPropertiesPage;
removeObject(m_qtVersionManager);
delete m_qtVersionManager;
removeObject(m_proFileEditorFactory);
delete m_proFileEditorFactory;
removeObject(m_qt4ProjectManager);
@@ -124,9 +122,6 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
addAutoReleasedObject(new QMakeStepFactory);
addAutoReleasedObject(new MakeStepFactory);
m_qtVersionManager = new QtVersionManager;
addObject(m_qtVersionManager);
addAutoReleasedObject(new Qt4RunConfigurationFactory);
addAutoReleasedObject(new Qt4RunConfigurationFactoryUser);
@@ -190,11 +185,6 @@ void Qt4ProjectManagerPlugin::updateContextMenu(Project *project,
}
}
QtVersionManager *Qt4ProjectManagerPlugin::versionManager() const
{
return m_qtVersionManager;
}
void Qt4ProjectManagerPlugin::currentProjectChanged()
{
m_runQMakeAction->setEnabled(!m_projectExplorer->buildManager()->isBuilding(m_projectExplorer->currentProject()));

View File

@@ -33,6 +33,10 @@
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
namespace ProjectExplorer {
class QtVersionManager;
}
namespace Qt4ProjectManager {
class Qt4Manager;
@@ -46,7 +50,6 @@ class QMakeStepFactory;
class MakeStepFactory;
class GccParserFactory;
class MsvcParserFactory;
class QtVersionManager;
class EmbeddedPropertiesPage;
class Qt4ProjectManagerPlugin : public ExtensionSystem::IPlugin
@@ -59,8 +62,6 @@ public:
void extensionsInitialized();
int projectContext() const { return m_projectContext; }
QtVersionManager *versionManager() const;
private slots:
void updateContextMenu(ProjectExplorer::Project *project,
@@ -77,8 +78,6 @@ private:
ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer;
ProFileEditorFactory *m_proFileEditorFactory;
Qt4Manager *m_qt4ProjectManager;
QtVersionManager *m_qtVersionManager;
EmbeddedPropertiesPage *m_embeddedPropertiesPage;
int m_projectContext;

View File

@@ -51,6 +51,7 @@ using namespace Qt4ProjectManager;
using ProjectExplorer::ApplicationRunConfiguration;
using ProjectExplorer::PersistentSettingsReader;
using ProjectExplorer::PersistentSettingsWriter;
using ProjectExplorer::QtVersion;
Qt4RunConfiguration::Qt4RunConfiguration(Qt4Project *pro, const QString &proFilePath)
: ApplicationRunConfiguration(pro),

View File

@@ -29,3 +29,5 @@ FORMS += settingspage.ui \
filesystemfilter.ui \
directoryfilter.ui
RESOURCES += quickopen.qrc
OTHER_FILES += QuickOpen.pluginspec

View File

@@ -22,3 +22,5 @@ resourcewizard.cpp \
resourceeditorw.cpp
RESOURCES += resourceeditor.qrc
OTHER_FILES += ResourceEditor.pluginspec

View File

@@ -29,3 +29,5 @@ SOURCES += annotationhighlighter.cpp \
FORMS += settingspage.ui
RESOURCES += subversion.qrc
OTHER_FILES += Subversion.pluginspec

View File

@@ -188,6 +188,10 @@ BaseTextEditor::BaseTextEditor(QWidget *parent)
d->m_parenthesesMatchingTimer->setSingleShot(true);
connect(d->m_parenthesesMatchingTimer, SIGNAL(timeout()), this, SLOT(_q_matchParentheses()));
d->m_highlightBlocksTimer = new QTimer(this);
d->m_highlightBlocksTimer->setSingleShot(true);
connect(d->m_highlightBlocksTimer, SIGNAL(timeout()), this, SLOT(_q_highlightBlocks()));
d->m_searchResultFormat.setBackground(QColor(0xffef0b));
@@ -429,6 +433,23 @@ bool DocumentMarker::addMark(TextEditor::ITextMark *mark, int line)
return false;
}
int BaseTextEditorPrivate::visualIndent(const QTextBlock &block) const
{
if (!block.isValid())
return 0;
const QTextDocument *document = block.document();
int i = 0;
while (i < block.length()) {
if (!document->characterAt(block.position() + i).isSpace()) {
QTextCursor cursor(block);
cursor.setPosition(block.position() + i);
return q->cursorRect(cursor).x();
}
++i;
}
return 0;
}
TextEditor::TextMarks DocumentMarker::marksAt(int line) const
{
@@ -693,7 +714,10 @@ void BaseTextEditor::moveLineUpDown(bool up)
{
QTextCursor cursor = textCursor();
QTextCursor move = cursor;
move.beginEditBlock();
if (d->m_moveLineUndoHack)
move.joinPreviousEditBlock();
else
move.beginEditBlock();
bool hasSelection = cursor.hasSelection();
@@ -701,7 +725,7 @@ void BaseTextEditor::moveLineUpDown(bool up)
move.setPosition(cursor.selectionStart());
move.movePosition(QTextCursor::StartOfBlock);
move.setPosition(cursor.selectionEnd(), QTextCursor::KeepAnchor);
move.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
move.movePosition(move.atBlockStart() ? QTextCursor::Left: QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
} else {
move.movePosition(QTextCursor::StartOfBlock);
move.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
@@ -739,6 +763,7 @@ void BaseTextEditor::moveLineUpDown(bool up)
move.endEditBlock();
setTextCursor(move);
d->m_moveLineUndoHack = true;
}
void BaseTextEditor::cleanWhitespace()
@@ -748,6 +773,7 @@ void BaseTextEditor::cleanWhitespace()
void BaseTextEditor::keyPressEvent(QKeyEvent *e)
{
d->m_moveLineUndoHack = false;
d->clearVisibleCollapsedBlock();
QKeyEvent *original_e = e;
@@ -1034,10 +1060,7 @@ bool BaseTextEditor::event(QEvent *e)
d->m_contentsChanged = false;
switch (e->type()) {
case QEvent::ShortcutOverride:
if (static_cast<QKeyEvent*>(e)->key() == Qt::Key_Backspace)
e->accept();
else
e->ignore(); // we are a really nice citizen
e->ignore(); // we are a really nice citizen
return true;
default:
break;
@@ -1201,8 +1224,11 @@ bool BaseTextEditor::lineSeparatorsAllowed() const
void BaseTextEditor::setHighlightBlocks(bool b)
{
d->m_highlightBlocks = b & d->m_codeFoldingSupported;
viewport()->update();
if (d->m_highlightBlocks == b)
return;
d->m_highlightBlocks = b;
d->m_highlightBlocksInfo = BaseTextEditorPrivateHighlightBlocks();
_q_highlightBlocks();
}
bool BaseTextEditor::highlightBlocks() const
@@ -1284,7 +1310,8 @@ BaseTextEditorPrivate::BaseTextEditorPrivate()
m_actionHack(0),
m_inBlockSelectionMode(false),
m_lastEventWasBlockSelectionEvent(false),
m_blockSelectionExtraX(0)
m_blockSelectionExtraX(0),
m_moveLineUndoHack(false)
{
}
@@ -1719,11 +1746,11 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
painter.fillRect(QRectF(lineX, 0, viewportRect.width() - lineX, viewportRect.height()), blendColor);
}
// keep right margin clean from full-width selection
int maxX = offset.x() + qMax((qreal)viewportRect.width(), documentLayout->documentSize().width())
- doc->documentMargin();
er.setRight(qMin(er.right(), maxX));
painter.setClipRect(er);
// // keep right margin clean from full-width selection
// int maxX = offset.x() + qMax((qreal)viewportRect.width(), documentLayout->documentSize().width())
// - doc->documentMargin();
// er.setRight(qMin(er.right(), maxX));
// painter.setClipRect(er);
bool editable = !isReadOnly();
@@ -1758,22 +1785,30 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
QTextBlock visibleCollapsedBlock;
QPointF visibleCollapsedBlockOffset;
while (block.isValid()) {
QRectF r = blockBoundingRect(block).translated(offset);
if (d->m_highlightBlocks) {
QTextBlock previousBlock = block.previous();
if (previousBlock.isValid()){
int thisBraceDepth = block.userState();
if (thisBraceDepth >= 0)
thisBraceDepth >>= 8;
int braceDepth = block.previous().userState();
if (braceDepth >= 0)
braceDepth >>= 8;
int minBraceDepth = qMin(thisBraceDepth, braceDepth);
if (minBraceDepth > 0) {
painter.fillRect(r, calcBlendColor(baseColor, minBraceDepth));
int n = block.blockNumber();
int depth = 0;
foreach (int i, d->m_highlightBlocksInfo.open)
if (n >= i)
++depth;
foreach (int i, d->m_highlightBlocksInfo.close)
if (n > i)
--depth;
int count = d->m_highlightBlocksInfo.visualIndent.size();
if (count) {
QRectF rr = r;
rr.setWidth(viewport()->width());
for(int i = 0; i <= depth; ++i) {
int vi = i > 0 ? d->m_highlightBlocksInfo.visualIndent.at(i-1) : 0;
painter.fillRect(rr.adjusted(vi, 0, -8*i, 0), calcBlendColor(baseColor, count - i));
}
}
}
@@ -1817,7 +1852,7 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
else
selections.append(o);
} else if (!range.cursor.hasSelection() && range.format.hasProperty(QTextFormat::FullWidthSelection)
&& block.contains(range.cursor.position())) {
&& block.contains(range.cursor.position())) {
// for full width selections we don't require an actual selection, just
// a position to specify the line. that's more convenience in usage.
QTextLayout::FormatRange o;
@@ -1884,7 +1919,6 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
// invisible blocks do have zero line count
block = doc->findBlockByLineNumber(block.firstLineNumber());
}
}
if (backgroundVisible() && !block.isValid() && offset.y() <= er.bottom()
@@ -2393,6 +2427,10 @@ void BaseTextEditor::slotCursorPositionChanged()
}
setExtraSelections(CurrentLineSelection, extraSelections);
if (d->m_highlightBlocks) {
d->m_highlightBlocksTimer->start(100);
}
}
void BaseTextEditor::slotUpdateBlockNotify(const QTextBlock &block)
@@ -3142,6 +3180,67 @@ bool TextBlockUserData::findNextClosingParenthesis(QTextCursor *cursor, bool sel
return false;
}
bool TextBlockUserData::findPreviousBlockOpenParenthesis(QTextCursor *cursor)
{
QTextBlock block = cursor->block();
int position = cursor->position();
int ignore = 0;
while (block.isValid()) {
Parentheses parenList = TextEditDocumentLayout::parentheses(block);
if (!parenList.isEmpty() && !TextEditDocumentLayout::ifdefedOut(block)) {
for (int i = parenList.count()-1; i >= 0; --i) {
Parenthesis paren = parenList.at(i);
if (paren.chr != QLatin1Char('{') && paren.chr != QLatin1Char('}')
&& paren.chr != QLatin1Char('+') && paren.chr != QLatin1Char('-'))
continue;
if (block == cursor->block() &&
(position - block.position() <= paren.pos))
continue;
if (paren.type == Parenthesis::Closed) {
++ignore;
} else if (ignore > 0) {
--ignore;
} else {
cursor->setPosition(block.position() + paren.pos);
return true;
}
}
}
block = block.previous();
}
return false;
}
bool TextBlockUserData::findNextBlockClosingParenthesis(QTextCursor *cursor)
{
QTextBlock block = cursor->block();
int position = cursor->position();
int ignore = 0;
while (block.isValid()) {
Parentheses parenList = TextEditDocumentLayout::parentheses(block);
if (!parenList.isEmpty() && !TextEditDocumentLayout::ifdefedOut(block)) {
for (int i = 0; i < parenList.count(); ++i) {
Parenthesis paren = parenList.at(i);
if (paren.chr != QLatin1Char('{') && paren.chr != QLatin1Char('}')
&& paren.chr != QLatin1Char('+') && paren.chr != QLatin1Char('-'))
continue;
if (block == cursor->block() && position - block.position() >= paren.pos)
continue;
if (paren.type == Parenthesis::Opened) {
++ignore;
} else if (ignore > 0) {
--ignore;
} else {
cursor->setPosition(block.position() + paren.pos+1);
return true;
}
}
}
block = block.next();
}
return false;
}
TextBlockUserData::MatchType TextBlockUserData::matchCursorBackward(QTextCursor *cursor)
{
cursor->clearSelection();
@@ -3277,6 +3376,23 @@ void BaseTextEditor::_q_matchParentheses()
setExtraSelections(ParenthesesMatchingSelection, extraSelections);
}
void BaseTextEditor::_q_highlightBlocks()
{
QTextCursor cursor = textCursor();
QTextCursor closeCursor = cursor;
BaseTextEditorPrivateHighlightBlocks highlightBlocksInfo;
while (TextBlockUserData::findPreviousBlockOpenParenthesis(&cursor)) {
highlightBlocksInfo.open.prepend(cursor.blockNumber());
highlightBlocksInfo.visualIndent.prepend(d->visualIndent(cursor.block()));
if (TextBlockUserData::findNextBlockClosingParenthesis(&closeCursor))
highlightBlocksInfo.close.append(closeCursor.blockNumber());
}
if (d->m_highlightBlocksInfo != highlightBlocksInfo) {
d->m_highlightBlocksInfo = highlightBlocksInfo;
viewport()->update();
}
}
void BaseTextEditor::setActionHack(QObject *hack)
{
d->m_actionHack = hack;

View File

@@ -167,6 +167,9 @@ public:
static bool findPreviousOpenParenthesis(QTextCursor *cursor, bool select = false);
static bool findNextClosingParenthesis(QTextCursor *cursor, bool select = false);
static bool findPreviousBlockOpenParenthesis(QTextCursor *cursor);
static bool findNextBlockClosingParenthesis(QTextCursor *cursor);
private:
TextMarks m_marks;
@@ -464,6 +467,7 @@ private:
// parentheses matcher
private slots:
void _q_matchParentheses();
void _q_highlightBlocks();
void slotSelectionChanged();
};

View File

@@ -114,6 +114,17 @@ private:
//================BaseTextEditorPrivate==============
struct BaseTextEditorPrivateHighlightBlocks
{
QList<int> open;
QList<int> close;
QList<int> visualIndent;
inline bool operator==(const BaseTextEditorPrivateHighlightBlocks &o) const {
return (open == o.open && close == o.close && visualIndent == o.visualIndent);
}
inline bool operator!=(const BaseTextEditorPrivateHighlightBlocks &o) const { return !(*this == o); }
};
class BaseTextEditorPrivate
{
BaseTextEditorPrivate(const BaseTextEditorPrivate &);
@@ -214,11 +225,17 @@ public:
void clearBlockSelection();
QString copyBlockSelection();
void removeBlockSelection(const QString &text = QString());
bool m_moveLineUndoHack;
QTextCursor m_findScope;
QTextCursor m_selectBlockAnchor;
void moveCursorVisible(bool ensureVisible = true);
int visualIndent(const QTextBlock &block) const;
BaseTextEditorPrivateHighlightBlocks m_highlightBlocksInfo;
QTimer *m_highlightBlocksTimer;
};
} // namespace Internal

View File

@@ -39,9 +39,9 @@ static const char * const textWrappingKey = "TextWrapping";
static const char * const showWrapColumnKey = "ShowWrapColumn";
static const char * const wrapColumnKey = "WrapColumn";
static const char * const visualizeWhitespaceKey = "VisualizeWhitespace";
static const char * const displayFoldingMarkersKey = "DisplayFoldingMarkers";
static const char * const displayFoldingMarkersKey = "DisplayFoldingMarkersV2";
static const char * const highlightCurrentLineKey = "HighlightCurrentLineKey";
static const char * const highlightBlocksKey = "HighlightBlocksKey";
static const char * const highlightBlocksKey = "HighlightBlocksKeyV2";
static const char * const groupPostfix = "DisplaySettings";
namespace TextEditor {
@@ -52,9 +52,9 @@ DisplaySettings::DisplaySettings() :
m_showWrapColumn(false),
m_wrapColumn(80),
m_visualizeWhitespace(false),
m_displayFoldingMarkers(true),
m_displayFoldingMarkers(false),
m_highlightCurrentLine(true),
m_highlightBlocks(false)
m_highlightBlocks(true)
{
}

View File

@@ -59,3 +59,5 @@ FORMS += behaviorsettingspage.ui \
displaysettingspage.ui \
fontsettingspage.ui
RESOURCES += texteditor.qrc
OTHER_FILES += TextEditor.pluginspec

View File

@@ -37,3 +37,5 @@ RESOURCES += vcsbase.qrc
FORMS += vcsbasesettingspage.ui \
nicknamedialog.ui
OTHER_FILES += VCSBase.pluginspec