2010-01-04 11:39:56 +01:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2011-01-11 16:28:15 +01:00
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2010-01-04 11:39:56 +01:00
|
|
|
**
|
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** No Commercial Usage
|
2010-01-04 11:39:56 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** This file contains pre-release code and may not be distributed.
|
|
|
|
|
** You may use this file in accordance with the terms and conditions
|
|
|
|
|
** contained in the Technology Preview License Agreement accompanying
|
|
|
|
|
** this package.
|
2010-01-04 11:39:56 +01:00
|
|
|
**
|
|
|
|
|
** 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.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
** If you have questions regarding the use of this file, please contact
|
|
|
|
|
** Nokia at qt-info@nokia.com.
|
2010-01-04 11:39:56 +01:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
2009-04-23 12:52:51 +02:00
|
|
|
#include "qtoptionspage.h"
|
|
|
|
|
#include "ui_showbuildlog.h"
|
|
|
|
|
#include "ui_qtversionmanager.h"
|
2011-01-17 19:15:51 +01:00
|
|
|
#include "ui_qtversioninfo.h"
|
|
|
|
|
#include "ui_debugginghelper.h"
|
2009-04-28 12:43:04 +02:00
|
|
|
#include "qt4projectmanagerconstants.h"
|
2010-02-12 13:32:20 +01:00
|
|
|
#include "qt4target.h"
|
2009-04-23 12:52:51 +02:00
|
|
|
#include "qtversionmanager.h"
|
2010-10-04 09:27:25 +02:00
|
|
|
#include "qmldumptool.h"
|
|
|
|
|
#include "qmlobservertool.h"
|
2011-01-17 13:50:47 +01:00
|
|
|
#include "debugginghelperbuildtask.h"
|
2009-08-07 15:20:05 +02:00
|
|
|
|
2009-09-03 19:16:22 +02:00
|
|
|
#include <projectexplorer/debugginghelper.h>
|
2010-11-01 14:14:17 +01:00
|
|
|
#include <projectexplorer/toolchaintype.h>
|
2009-04-23 12:52:51 +02:00
|
|
|
#include <coreplugin/coreconstants.h>
|
2009-08-07 15:20:05 +02:00
|
|
|
#include <coreplugin/icore.h>
|
|
|
|
|
#include <coreplugin/progressmanager/progressmanager.h>
|
2011-01-17 19:15:51 +01:00
|
|
|
#include <utils/detailsbutton.h>
|
2009-06-04 14:43:16 +02:00
|
|
|
#include <utils/treewidgetcolumnstretcher.h>
|
2009-08-07 15:20:05 +02:00
|
|
|
#include <utils/qtcassert.h>
|
2009-10-01 14:05:59 +02:00
|
|
|
#include <qtconcurrent/runextensions.h>
|
2009-04-23 12:52:51 +02:00
|
|
|
|
2009-08-07 15:20:05 +02:00
|
|
|
#include <QtCore/QFuture>
|
|
|
|
|
#include <QtCore/QtConcurrentRun>
|
2009-05-18 14:58:19 +02:00
|
|
|
#include <QtCore/QDebug>
|
2009-04-23 12:52:51 +02:00
|
|
|
#include <QtCore/QDir>
|
2010-02-12 13:32:20 +01:00
|
|
|
#include <QtCore/QSet>
|
2009-11-24 15:05:02 +01:00
|
|
|
#include <QtCore/QTextStream>
|
2009-08-07 15:20:05 +02:00
|
|
|
#include <QtCore/QDateTime>
|
2009-10-27 18:05:04 +01:00
|
|
|
#include <QtGui/QHelpEvent>
|
|
|
|
|
#include <QtGui/QToolTip>
|
2011-01-17 19:15:51 +01:00
|
|
|
#include <QtGui/QMenu>
|
2009-04-23 12:52:51 +02:00
|
|
|
|
2011-01-17 19:15:51 +01:00
|
|
|
enum ModelRoles { VersionIdRole = Qt::UserRole, BuildLogRole, BuildRunningRole};
|
2010-10-08 15:13:02 +02:00
|
|
|
|
2009-04-28 12:43:04 +02:00
|
|
|
using namespace Qt4ProjectManager;
|
|
|
|
|
using namespace Qt4ProjectManager::Internal;
|
2009-08-07 15:20:05 +02:00
|
|
|
|
2009-04-23 12:52:51 +02:00
|
|
|
///
|
|
|
|
|
// QtOptionsPage
|
|
|
|
|
///
|
|
|
|
|
|
|
|
|
|
QtOptionsPage::QtOptionsPage()
|
2010-06-02 14:58:52 +02:00
|
|
|
: m_widget(0)
|
2009-04-23 12:52:51 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString QtOptionsPage::id() const
|
|
|
|
|
{
|
2009-11-27 16:12:12 +01:00
|
|
|
return QLatin1String(Constants::QTVERSION_SETTINGS_PAGE_ID);
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
|
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
QString QtOptionsPage::displayName() const
|
2009-04-23 12:52:51 +02:00
|
|
|
{
|
2009-11-27 16:12:12 +01:00
|
|
|
return QCoreApplication::translate("Qt4ProjectManager", Constants::QTVERSION_SETTINGS_PAGE_NAME);
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString QtOptionsPage::category() const
|
|
|
|
|
{
|
2009-11-27 16:12:12 +01:00
|
|
|
return QLatin1String(Constants::QT_SETTINGS_CATEGORY);
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
|
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
QString QtOptionsPage::displayCategory() const
|
2009-04-23 12:52:51 +02:00
|
|
|
{
|
2009-11-27 16:12:12 +01:00
|
|
|
return QCoreApplication::translate("Qt4ProjectManager", Constants::QT_SETTINGS_TR_CATEGORY);
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
|
|
|
|
|
2010-03-26 17:34:10 +01:00
|
|
|
QIcon QtOptionsPage::categoryIcon() const
|
|
|
|
|
{
|
|
|
|
|
return QIcon(QLatin1String(Constants::QT_SETTINGS_CATEGORY_ICON));
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-23 12:52:51 +02:00
|
|
|
QWidget *QtOptionsPage::createPage(QWidget *parent)
|
|
|
|
|
{
|
|
|
|
|
QtVersionManager *vm = QtVersionManager::instance();
|
2010-02-08 15:50:06 +01:00
|
|
|
m_widget = new QtOptionsPageWidget(parent, vm->versions());
|
2009-11-24 15:05:02 +01:00
|
|
|
if (m_searchKeywords.isEmpty())
|
|
|
|
|
m_searchKeywords = m_widget->searchKeywords();
|
2009-04-23 12:52:51 +02:00
|
|
|
return m_widget;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QtOptionsPage::apply()
|
|
|
|
|
{
|
2010-12-02 18:28:16 +01:00
|
|
|
if (!m_widget) // page was never shown
|
|
|
|
|
return;
|
2009-04-23 12:52:51 +02:00
|
|
|
m_widget->finish();
|
|
|
|
|
|
|
|
|
|
QtVersionManager *vm = QtVersionManager::instance();
|
2009-08-07 15:20:05 +02:00
|
|
|
// Turn into flat list
|
|
|
|
|
QList<QtVersion *> versions;
|
|
|
|
|
foreach(const QSharedPointerQtVersion &spv, m_widget->versions())
|
|
|
|
|
versions.push_back(new QtVersion(*spv));
|
2010-02-08 15:50:06 +01:00
|
|
|
vm->setNewQtVersions(versions);
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
|
|
|
|
|
2009-11-24 15:05:02 +01:00
|
|
|
bool QtOptionsPage::matches(const QString &s) const
|
|
|
|
|
{
|
|
|
|
|
return m_searchKeywords.contains(s, Qt::CaseInsensitive);
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-23 12:52:51 +02:00
|
|
|
//-----------------------------------------------------
|
2009-06-04 14:43:16 +02:00
|
|
|
|
|
|
|
|
|
2010-02-08 15:50:06 +01:00
|
|
|
QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> versions)
|
2009-04-23 12:52:51 +02:00
|
|
|
: QWidget(parent)
|
|
|
|
|
, m_specifyNameString(tr("<specify a name>"))
|
2009-09-03 19:16:22 +02:00
|
|
|
, m_specifyPathString(tr("<specify a qmake location>"))
|
2009-08-07 15:20:05 +02:00
|
|
|
, m_ui(new Internal::Ui::QtVersionManager())
|
2011-01-17 19:15:51 +01:00
|
|
|
, m_versionUi(new Internal::Ui::QtVersionInfo())
|
|
|
|
|
, m_debuggingHelperUi(new Internal::Ui::DebuggingHelper())
|
2009-04-23 12:52:51 +02:00
|
|
|
{
|
|
|
|
|
// Initialize m_versions
|
2009-08-07 15:20:05 +02:00
|
|
|
foreach(QtVersion *version, versions)
|
|
|
|
|
m_versions.push_back(QSharedPointerQtVersion(new QtVersion(*version)));
|
2009-04-23 12:52:51 +02:00
|
|
|
|
2011-01-17 19:15:51 +01:00
|
|
|
QWidget *versionInfoWidget = new QWidget();
|
|
|
|
|
m_versionUi->setupUi(versionInfoWidget);
|
|
|
|
|
m_versionUi->qmakePath->setExpectedKind(Utils::PathChooser::File);
|
|
|
|
|
m_versionUi->qmakePath->setPromptDialogTitle(tr("Select qmake Executable"));
|
|
|
|
|
m_versionUi->mingwPath->setExpectedKind(Utils::PathChooser::Directory);
|
|
|
|
|
m_versionUi->mingwPath->setPromptDialogTitle(tr("Select the MinGW Directory"));
|
|
|
|
|
m_versionUi->mwcPath->setExpectedKind(Utils::PathChooser::Directory);
|
|
|
|
|
m_versionUi->mwcPath->setPromptDialogTitle(tr("Select Carbide Install Directory"));
|
|
|
|
|
m_versionUi->s60SDKPath->setExpectedKind(Utils::PathChooser::Directory);
|
|
|
|
|
m_versionUi->s60SDKPath->setPromptDialogTitle(tr("Select S60 SDK Root"));
|
|
|
|
|
m_versionUi->gccePath->setExpectedKind(Utils::PathChooser::Directory);
|
|
|
|
|
m_versionUi->gccePath->setPromptDialogTitle(tr("Select the CSL ARM Toolchain (GCCE) Directory"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QWidget *debuggingHelperDetailsWidget = new QWidget();
|
|
|
|
|
m_debuggingHelperUi->setupUi(debuggingHelperDetailsWidget);
|
|
|
|
|
|
2009-04-23 12:52:51 +02:00
|
|
|
m_ui->setupUi(this);
|
2011-01-17 19:15:51 +01:00
|
|
|
|
|
|
|
|
m_ui->versionInfoWidget->setWidget(versionInfoWidget);
|
|
|
|
|
m_ui->versionInfoWidget->setState(Utils::DetailsWidget::NoSummary);
|
|
|
|
|
|
|
|
|
|
m_ui->debuggingHelperWidget->setWidget(debuggingHelperDetailsWidget);
|
2009-04-23 12:52:51 +02:00
|
|
|
|
|
|
|
|
m_ui->addButton->setIcon(QIcon(Core::Constants::ICON_PLUS));
|
|
|
|
|
m_ui->delButton->setIcon(QIcon(Core::Constants::ICON_MINUS));
|
|
|
|
|
|
2009-10-05 11:06:05 +02:00
|
|
|
new Utils::TreeWidgetColumnStretcher(m_ui->qtdirList, 1);
|
2009-06-04 14:43:16 +02:00
|
|
|
|
2009-05-26 17:21:30 +02:00
|
|
|
// setup parent items for auto-detected and manual versions
|
|
|
|
|
m_ui->qtdirList->header()->setResizeMode(QHeaderView::ResizeToContents);
|
|
|
|
|
QTreeWidgetItem *autoItem = new QTreeWidgetItem(m_ui->qtdirList);
|
2009-10-27 18:05:04 +01:00
|
|
|
m_ui->qtdirList->installEventFilter(this);
|
2009-05-26 17:21:30 +02:00
|
|
|
autoItem->setText(0, tr("Auto-detected"));
|
|
|
|
|
autoItem->setFirstColumnSpanned(true);
|
|
|
|
|
QTreeWidgetItem *manualItem = new QTreeWidgetItem(m_ui->qtdirList);
|
|
|
|
|
manualItem->setText(0, tr("Manual"));
|
|
|
|
|
manualItem->setFirstColumnSpanned(true);
|
|
|
|
|
|
2009-04-23 12:52:51 +02:00
|
|
|
for (int i = 0; i < m_versions.count(); ++i) {
|
2009-08-07 15:20:05 +02:00
|
|
|
const QtVersion * const version = m_versions.at(i).data();
|
2009-05-28 11:31:35 +02:00
|
|
|
QTreeWidgetItem *item = new QTreeWidgetItem(version->isAutodetected()? autoItem : manualItem);
|
2010-01-07 18:17:24 +01:00
|
|
|
item->setText(0, version->displayName());
|
2009-09-03 19:16:22 +02:00
|
|
|
item->setText(1, QDir::toNativeSeparators(version->qmakeCommand()));
|
2011-01-17 19:15:51 +01:00
|
|
|
item->setData(0, VersionIdRole, version->uniqueId());
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
2009-05-26 17:21:30 +02:00
|
|
|
m_ui->qtdirList->expandAll();
|
2009-04-23 12:52:51 +02:00
|
|
|
|
2011-01-17 19:15:51 +01:00
|
|
|
connect(m_versionUi->nameEdit, SIGNAL(textEdited(const QString &)),
|
2009-04-23 12:52:51 +02:00
|
|
|
this, SLOT(updateCurrentQtName()));
|
|
|
|
|
|
|
|
|
|
|
2011-01-17 19:15:51 +01:00
|
|
|
connect(m_versionUi->qmakePath, SIGNAL(changed(QString)),
|
2009-09-03 19:16:22 +02:00
|
|
|
this, SLOT(updateCurrentQMakeLocation()));
|
2011-01-17 19:15:51 +01:00
|
|
|
connect(m_versionUi->mingwPath, SIGNAL(changed(QString)),
|
2009-04-23 12:52:51 +02:00
|
|
|
this, SLOT(updateCurrentMingwDirectory()));
|
2011-01-17 19:15:51 +01:00
|
|
|
connect(m_versionUi->mwcPath, SIGNAL(changed(QString)),
|
2009-06-04 10:50:44 +02:00
|
|
|
this, SLOT(updateCurrentMwcDirectory()));
|
2011-01-17 19:15:51 +01:00
|
|
|
connect(m_versionUi->s60SDKPath, SIGNAL(changed(QString)),
|
2009-10-27 17:59:53 +01:00
|
|
|
this, SLOT(updateCurrentS60SDKDirectory()));
|
2011-01-17 19:15:51 +01:00
|
|
|
connect(m_versionUi->gccePath, SIGNAL(changed(QString)),
|
2009-10-29 12:19:56 +01:00
|
|
|
this, SLOT(updateCurrentGcceDirectory()));
|
2011-01-17 19:15:51 +01:00
|
|
|
connect(m_versionUi->sbsV2Path, SIGNAL(changed(QString)),
|
2010-11-15 15:24:17 +01:00
|
|
|
this, SLOT(updateCurrentSbsV2Directory()));
|
2009-04-23 12:52:51 +02:00
|
|
|
|
|
|
|
|
connect(m_ui->addButton, SIGNAL(clicked()),
|
|
|
|
|
this, SLOT(addQtDir()));
|
|
|
|
|
connect(m_ui->delButton, SIGNAL(clicked()),
|
|
|
|
|
this, SLOT(removeQtDir()));
|
|
|
|
|
|
2011-01-17 19:15:51 +01:00
|
|
|
connect(m_versionUi->qmakePath, SIGNAL(browsingFinished()),
|
2009-04-23 12:52:51 +02:00
|
|
|
this, SLOT(onQtBrowsed()));
|
2011-01-17 19:15:51 +01:00
|
|
|
connect(m_versionUi->mingwPath, SIGNAL(browsingFinished()),
|
2009-04-23 12:52:51 +02:00
|
|
|
this, SLOT(onMingwBrowsed()));
|
|
|
|
|
|
|
|
|
|
connect(m_ui->qtdirList, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
|
|
|
|
|
this, SLOT(versionChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
|
2011-01-17 19:15:51 +01:00
|
|
|
connect(m_versionUi->msvcComboBox, SIGNAL(currentIndexChanged(int)),
|
2009-04-23 12:52:51 +02:00
|
|
|
this, SLOT(msvcVersionChanged()));
|
|
|
|
|
|
2011-01-17 19:15:51 +01:00
|
|
|
connect(m_debuggingHelperUi->rebuildButton, SIGNAL(clicked()),
|
2009-04-23 12:52:51 +02:00
|
|
|
this, SLOT(buildDebuggingHelper()));
|
2011-01-17 19:15:51 +01:00
|
|
|
connect(m_debuggingHelperUi->gdbHelperBuildButton, SIGNAL(clicked()),
|
|
|
|
|
this, SLOT(buildGdbHelper()));
|
|
|
|
|
connect(m_debuggingHelperUi->qmlDumpBuildButton, SIGNAL(clicked()),
|
|
|
|
|
this, SLOT(buildQmlDump()));
|
|
|
|
|
connect(m_debuggingHelperUi->qmlObserverBuildButton, SIGNAL(clicked()),
|
|
|
|
|
this, SLOT(buildQmlObserver()));
|
|
|
|
|
|
|
|
|
|
connect(m_debuggingHelperUi->showLogButton, SIGNAL(clicked()),
|
2010-10-08 15:13:02 +02:00
|
|
|
this, SLOT(slotShowDebuggingBuildLog()));
|
2009-04-23 12:52:51 +02:00
|
|
|
|
|
|
|
|
showEnvironmentPage(0);
|
|
|
|
|
updateState();
|
|
|
|
|
}
|
|
|
|
|
|
2009-10-27 18:05:04 +01:00
|
|
|
bool QtOptionsPageWidget::eventFilter(QObject *o, QEvent *e)
|
|
|
|
|
{
|
|
|
|
|
// Set the items tooltip, which may cause costly initialization
|
|
|
|
|
// of QtVersion and must be up-to-date
|
|
|
|
|
if (o != m_ui->qtdirList || e->type() != QEvent::ToolTip)
|
2010-01-29 21:33:57 +01:00
|
|
|
return false;
|
2009-10-27 18:05:04 +01:00
|
|
|
QHelpEvent *helpEvent = static_cast<QHelpEvent *>(e);
|
|
|
|
|
const QPoint treePos = helpEvent->pos() - QPoint(0, m_ui->qtdirList->header()->height());
|
|
|
|
|
QTreeWidgetItem *item = m_ui->qtdirList->itemAt(treePos);
|
|
|
|
|
if (!item)
|
|
|
|
|
return false;
|
|
|
|
|
const int index = indexForTreeItem(item);
|
|
|
|
|
if (index == -1)
|
|
|
|
|
return false;
|
|
|
|
|
const QString tooltip = m_versions.at(index)->toHtml();
|
|
|
|
|
QToolTip::showText(helpEvent->globalPos(), tooltip, m_ui->qtdirList);
|
|
|
|
|
helpEvent->accept();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2009-08-07 15:20:05 +02:00
|
|
|
int QtOptionsPageWidget::currentIndex() const
|
2009-04-23 12:52:51 +02:00
|
|
|
{
|
2009-08-07 15:20:05 +02:00
|
|
|
if (QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem())
|
|
|
|
|
return indexForTreeItem(currentItem);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2009-04-23 12:52:51 +02:00
|
|
|
|
2009-08-07 15:20:05 +02:00
|
|
|
QtVersion *QtOptionsPageWidget::currentVersion() const
|
|
|
|
|
{
|
|
|
|
|
const int currentItemIndex = currentIndex();
|
|
|
|
|
if (currentItemIndex >= 0 && currentItemIndex < m_versions.size())
|
|
|
|
|
return m_versions.at(currentItemIndex).data();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2009-04-23 12:52:51 +02:00
|
|
|
|
2011-01-17 15:06:16 +01:00
|
|
|
static inline int findVersionById(const QList<QSharedPointerQtVersion> &l, int id)
|
2009-08-07 15:20:05 +02:00
|
|
|
{
|
|
|
|
|
const int size = l.size();
|
|
|
|
|
for (int i = 0; i < size; i++)
|
2011-01-17 15:06:16 +01:00
|
|
|
if (l.at(i)->uniqueId() == id)
|
2009-08-07 15:20:05 +02:00
|
|
|
return i;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2009-04-23 12:52:51 +02:00
|
|
|
|
2009-08-07 15:20:05 +02:00
|
|
|
// Update with results of terminated helper build
|
2011-01-17 15:06:16 +01:00
|
|
|
void QtOptionsPageWidget::debuggingHelperBuildFinished(int qtVersionId, const QString &output)
|
2009-08-07 15:20:05 +02:00
|
|
|
{
|
2011-01-17 15:06:16 +01:00
|
|
|
const int index = findVersionById(m_versions, qtVersionId);
|
2009-08-07 15:20:05 +02:00
|
|
|
if (index == -1)
|
|
|
|
|
return; // Oops, somebody managed to delete the version
|
2011-01-17 15:06:16 +01:00
|
|
|
|
|
|
|
|
m_versions.at(index)->invalidateCache();
|
|
|
|
|
|
2009-08-07 15:20:05 +02:00
|
|
|
// Update item view
|
|
|
|
|
QTreeWidgetItem *item = treeItemForIndex(index);
|
|
|
|
|
QTC_ASSERT(item, return)
|
2011-01-17 19:15:51 +01:00
|
|
|
item->setData(0, BuildRunningRole, QVariant(false));
|
|
|
|
|
item->setData(0, BuildLogRole, output);
|
2010-10-08 15:13:02 +02:00
|
|
|
|
2010-09-27 17:22:57 +02:00
|
|
|
QSharedPointerQtVersion qtVersion = m_versions.at(index);
|
2010-10-04 09:27:25 +02:00
|
|
|
const bool success = qtVersion->hasDebuggingHelper()
|
|
|
|
|
&& (!QmlDumpTool::canBuild(qtVersion.data()) || qtVersion->hasQmlDump())
|
|
|
|
|
&& (!QmlObserverTool::canBuild(qtVersion.data()) || qtVersion->hasQmlObserver());
|
2009-08-07 15:20:05 +02:00
|
|
|
|
|
|
|
|
// Update bottom control if the selection is still the same
|
|
|
|
|
if (index == currentIndex()) {
|
2011-01-17 19:15:51 +01:00
|
|
|
updateDebuggingHelperInfo(m_versions.at(index).data());
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
2010-10-08 15:13:02 +02:00
|
|
|
if (!success)
|
|
|
|
|
showDebuggingBuildLog(item);
|
2009-08-07 15:20:05 +02:00
|
|
|
}
|
|
|
|
|
|
2011-01-17 19:15:51 +01:00
|
|
|
void QtOptionsPageWidget::buildDebuggingHelper(DebuggingHelperBuildTask::Tools tools)
|
2009-08-07 15:20:05 +02:00
|
|
|
{
|
|
|
|
|
const int index = currentIndex();
|
|
|
|
|
if (index < 0)
|
|
|
|
|
return;
|
|
|
|
|
|
2010-10-08 15:13:02 +02:00
|
|
|
QTreeWidgetItem *item = treeItemForIndex(index);
|
|
|
|
|
QTC_ASSERT(item, return);
|
2011-01-17 19:15:51 +01:00
|
|
|
|
|
|
|
|
item->setData(0, BuildRunningRole, QVariant(true));
|
|
|
|
|
|
|
|
|
|
QtVersion *version = m_versions.at(index).data();
|
|
|
|
|
if (!version)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
updateDebuggingHelperInfo(version);
|
2010-10-08 15:13:02 +02:00
|
|
|
|
2009-08-07 15:20:05 +02:00
|
|
|
// Run a debugging helper build task in the background.
|
2011-01-17 19:15:51 +01:00
|
|
|
DebuggingHelperBuildTask *buildTask = new DebuggingHelperBuildTask(version, tools);
|
2011-01-17 15:06:16 +01:00
|
|
|
connect(buildTask, SIGNAL(finished(int,QString)), this, SLOT(debuggingHelperBuildFinished(int,QString)),
|
2009-08-07 15:20:05 +02:00
|
|
|
Qt::QueuedConnection);
|
2009-10-01 14:05:59 +02:00
|
|
|
QFuture<void> task = QtConcurrent::run(&DebuggingHelperBuildTask::run, buildTask);
|
2009-08-07 15:20:05 +02:00
|
|
|
const QString taskName = tr("Building helpers");
|
2011-01-17 19:15:51 +01:00
|
|
|
|
2009-08-07 15:20:05 +02:00
|
|
|
Core::ICore::instance()->progressManager()->addTask(task, taskName,
|
2009-11-26 15:51:10 +01:00
|
|
|
QLatin1String("Qt4ProjectManager::BuildHelpers"));
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
2011-01-17 19:15:51 +01:00
|
|
|
void QtOptionsPageWidget::buildGdbHelper()
|
|
|
|
|
{
|
|
|
|
|
buildDebuggingHelper(DebuggingHelperBuildTask::GdbDebugging);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QtOptionsPageWidget::buildQmlDump()
|
|
|
|
|
{
|
|
|
|
|
buildDebuggingHelper(DebuggingHelperBuildTask::QmlDump);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QtOptionsPageWidget::buildQmlObserver()
|
|
|
|
|
{
|
|
|
|
|
buildDebuggingHelper(DebuggingHelperBuildTask::QmlObserver);
|
|
|
|
|
}
|
2009-04-23 12:52:51 +02:00
|
|
|
|
2010-10-08 15:13:02 +02:00
|
|
|
// Non-modal dialog
|
|
|
|
|
class BuildLogDialog : public QDialog {
|
|
|
|
|
public:
|
|
|
|
|
explicit BuildLogDialog(QWidget *parent = 0);
|
|
|
|
|
void setText(const QString &text);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Ui_ShowBuildLog m_ui;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
BuildLogDialog::BuildLogDialog(QWidget *parent) : QDialog(parent)
|
|
|
|
|
{
|
|
|
|
|
m_ui.setupUi(this);
|
|
|
|
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BuildLogDialog::setText(const QString &text)
|
2009-04-23 12:52:51 +02:00
|
|
|
{
|
2010-10-08 15:13:02 +02:00
|
|
|
m_ui.log->setPlainText(text); // Show and scroll to bottom
|
|
|
|
|
m_ui.log->moveCursor(QTextCursor::End);
|
|
|
|
|
m_ui.log->ensureCursorVisible();
|
|
|
|
|
}
|
2009-04-23 12:52:51 +02:00
|
|
|
|
2010-10-08 15:13:02 +02:00
|
|
|
void QtOptionsPageWidget::slotShowDebuggingBuildLog()
|
|
|
|
|
{
|
|
|
|
|
if (const QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem())
|
|
|
|
|
showDebuggingBuildLog(currentItem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QtOptionsPageWidget::showDebuggingBuildLog(const QTreeWidgetItem *currentItem)
|
|
|
|
|
{
|
|
|
|
|
const int currentItemIndex = indexForTreeItem(currentItem);
|
2009-05-26 17:21:30 +02:00
|
|
|
if (currentItemIndex < 0)
|
|
|
|
|
return;
|
2010-10-08 15:13:02 +02:00
|
|
|
BuildLogDialog *dialog = new BuildLogDialog(this);
|
|
|
|
|
dialog->setWindowTitle(tr("Debugging Helper Build Log for '%1'").arg(currentItem->text(0)));
|
2011-01-17 19:15:51 +01:00
|
|
|
dialog->setText(currentItem->data(0, BuildLogRole).toString());
|
2010-10-08 15:13:02 +02:00
|
|
|
dialog->show();
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
|
|
|
|
|
2009-04-23 13:23:46 +02:00
|
|
|
QtOptionsPageWidget::~QtOptionsPageWidget()
|
2009-04-23 12:52:51 +02:00
|
|
|
{
|
|
|
|
|
delete m_ui;
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-23 13:23:46 +02:00
|
|
|
void QtOptionsPageWidget::addQtDir()
|
2009-04-23 12:52:51 +02:00
|
|
|
{
|
2009-08-07 15:20:05 +02:00
|
|
|
QSharedPointerQtVersion newVersion(new QtVersion(m_specifyNameString, m_specifyPathString));
|
2009-04-23 12:52:51 +02:00
|
|
|
m_versions.append(newVersion);
|
|
|
|
|
|
2009-05-26 17:21:30 +02:00
|
|
|
QTreeWidgetItem *item = new QTreeWidgetItem(m_ui->qtdirList->topLevelItem(1));
|
2010-01-07 18:17:24 +01:00
|
|
|
item->setText(0, newVersion->displayName());
|
2009-09-03 19:16:22 +02:00
|
|
|
item->setText(1, QDir::toNativeSeparators(newVersion->qmakeCommand()));
|
2011-01-17 19:15:51 +01:00
|
|
|
item->setData(0, VersionIdRole, newVersion->uniqueId());
|
2009-04-23 12:52:51 +02:00
|
|
|
|
|
|
|
|
m_ui->qtdirList->setCurrentItem(item);
|
|
|
|
|
|
2011-01-17 19:15:51 +01:00
|
|
|
m_versionUi->nameEdit->setText(newVersion->displayName());
|
|
|
|
|
m_versionUi->qmakePath->setPath(newVersion->qmakeCommand());
|
|
|
|
|
m_versionUi->nameEdit->setFocus();
|
|
|
|
|
m_versionUi->nameEdit->selectAll();
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
|
|
|
|
|
2009-04-23 13:23:46 +02:00
|
|
|
void QtOptionsPageWidget::removeQtDir()
|
2009-04-23 12:52:51 +02:00
|
|
|
{
|
|
|
|
|
QTreeWidgetItem *item = m_ui->qtdirList->currentItem();
|
2009-05-26 17:21:30 +02:00
|
|
|
int index = indexForTreeItem(item);
|
2009-04-23 12:52:51 +02:00
|
|
|
if (index < 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
delete item;
|
|
|
|
|
|
2009-08-07 15:20:05 +02:00
|
|
|
m_versions.removeAt(index);
|
2009-04-23 12:52:51 +02:00
|
|
|
updateState();
|
|
|
|
|
}
|
|
|
|
|
|
2009-08-07 15:20:05 +02:00
|
|
|
// Format html table tooltip about helpers
|
2010-09-27 17:22:57 +02:00
|
|
|
static inline QString msgHtmlHelperToolTip(const QString &gdbHelperPath, const QString &qmlDumpPath, const QString &qmlObserverPath)
|
2009-08-07 15:20:05 +02:00
|
|
|
{
|
2010-09-27 17:22:57 +02:00
|
|
|
QFileInfo gdbHelperFI(gdbHelperPath);
|
|
|
|
|
QFileInfo qmlDumpFI(qmlDumpPath);
|
|
|
|
|
QFileInfo qmlObserverFI(qmlObserverPath);
|
|
|
|
|
|
|
|
|
|
QString notFound = QtOptionsPageWidget::tr("Binary not found");
|
|
|
|
|
|
2009-08-19 12:32:23 +02:00
|
|
|
//: Tooltip showing the debugging helper library file.
|
2010-10-04 09:27:25 +02:00
|
|
|
return QtOptionsPageWidget::tr("<html><body><table>"
|
|
|
|
|
"<tr><td colspan=\"2\"><b>GDB debugging helpers</b></td></tr>"
|
|
|
|
|
"<tr><td>File:</td><td><pre>%1</pre></td></tr>"
|
2009-08-07 15:20:05 +02:00
|
|
|
"<tr><td>Last modified:</td><td>%2</td></tr>"
|
2010-09-27 17:22:57 +02:00
|
|
|
"<tr><td>Size:</td><td>%3 Bytes</td></tr>"
|
2010-10-04 09:27:25 +02:00
|
|
|
"<tr><td colspan=\"2\"><b>QML type dumper</b></td></tr>"
|
2010-09-27 17:22:57 +02:00
|
|
|
"<tr><td>File:</td><td><pre>%4</pre></td></tr>"
|
|
|
|
|
"<tr><td>Last modified:</td><td>%5</td></tr>"
|
|
|
|
|
"<tr><td>Size:</td><td>%6 Bytes</td></tr>"
|
2010-10-04 09:27:25 +02:00
|
|
|
"<tr><td colspan=\"2\"><b>QML observer</b></td></tr>"
|
2010-09-27 17:22:57 +02:00
|
|
|
"<tr><td>File:</td><td><pre>%7</pre></td></tr>"
|
|
|
|
|
"<tr><td>Last modified:</td><td>%8</td></tr>"
|
|
|
|
|
"<tr><td>Size:</td><td>%9 Bytes</td></tr>"
|
|
|
|
|
"</table></body></html>"
|
|
|
|
|
).
|
|
|
|
|
arg(gdbHelperPath.isEmpty() ? notFound : QDir::toNativeSeparators(gdbHelperFI.absoluteFilePath())).
|
|
|
|
|
arg(gdbHelperFI.lastModified().toString(Qt::SystemLocaleLongDate)).
|
|
|
|
|
arg(gdbHelperFI.size()).
|
|
|
|
|
arg(qmlDumpPath.isEmpty() ? notFound : QDir::toNativeSeparators(qmlDumpFI.absoluteFilePath())).
|
|
|
|
|
arg(qmlDumpFI.lastModified().toString(Qt::SystemLocaleLongDate)).
|
|
|
|
|
arg(qmlDumpFI.size()).
|
|
|
|
|
arg(qmlObserverPath.isEmpty() ? notFound : QDir::toNativeSeparators(qmlObserverFI.absoluteFilePath())).
|
|
|
|
|
arg(qmlObserverFI.lastModified().toString(Qt::SystemLocaleLongDate)).
|
|
|
|
|
arg(qmlObserverFI.size());
|
2009-08-07 15:20:05 +02:00
|
|
|
}
|
|
|
|
|
|
2011-01-17 19:15:51 +01:00
|
|
|
void QtOptionsPageWidget::updateDebuggingHelperInfo(const QtVersion *version)
|
2009-08-07 15:20:05 +02:00
|
|
|
{
|
2011-01-17 19:15:51 +01:00
|
|
|
if (!version) {
|
|
|
|
|
QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
|
|
|
|
|
int currentItemIndex = indexForTreeItem(currentItem);
|
|
|
|
|
if (currentItemIndex >= 0)
|
|
|
|
|
version = m_versions.at(currentItemIndex).data();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!version || !version->supportsBinaryDebuggingHelper()) {
|
|
|
|
|
m_ui->debuggingHelperWidget->setVisible(false);
|
2009-08-07 15:20:05 +02:00
|
|
|
} else {
|
2011-01-17 19:15:51 +01:00
|
|
|
bool canBuildQmlDumper = QmlDumpTool::canBuild(version);
|
|
|
|
|
bool canBuildQmlObserver = QmlObserverTool::canBuild(version);
|
|
|
|
|
|
|
|
|
|
bool hasGdbHelper = !version->debuggingHelperLibrary().isEmpty();
|
|
|
|
|
bool hasQmlDumper = !version->qmlDumpTool().isEmpty();
|
|
|
|
|
bool hasQmlObserver = !version->qmlObserverTool().isEmpty();
|
|
|
|
|
|
|
|
|
|
// get names of tools from labels
|
|
|
|
|
QStringList helperNames;
|
|
|
|
|
if (hasGdbHelper)
|
|
|
|
|
helperNames << m_debuggingHelperUi->gdbHelperLabel->text().remove(':');
|
|
|
|
|
if (hasQmlDumper)
|
|
|
|
|
helperNames << m_debuggingHelperUi->qmlDumpLabel->text().remove(':');
|
|
|
|
|
if (hasQmlObserver)
|
|
|
|
|
helperNames << m_debuggingHelperUi->qmlObserverLabel->text().remove(':');
|
|
|
|
|
|
|
|
|
|
QString status;
|
|
|
|
|
if (helperNames.isEmpty()) {
|
2011-01-24 14:14:39 +01:00
|
|
|
status = tr("Helpers: None available");
|
2011-01-17 19:15:51 +01:00
|
|
|
} else {
|
2011-01-24 14:14:39 +01:00
|
|
|
status = tr("Helper(s): %1.", "%1 is list of tool names", helperNames.size()).arg(
|
2011-01-17 19:15:51 +01:00
|
|
|
helperNames.join(tr(", ", "Separator used to join names of helper tools.")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_ui->debuggingHelperWidget->setSummaryText(status);
|
|
|
|
|
|
|
|
|
|
// Set detailed labels
|
|
|
|
|
m_debuggingHelperUi->gdbHelperStatus->setText(hasGdbHelper
|
|
|
|
|
? version->debuggingHelperLibrary()
|
|
|
|
|
: QLatin1String("-"));
|
|
|
|
|
|
|
|
|
|
if (canBuildQmlDumper) {
|
|
|
|
|
m_debuggingHelperUi->qmlDumpStatus->setText(hasQmlDumper
|
|
|
|
|
? version->qmlDumpTool()
|
|
|
|
|
: QLatin1String("-"));
|
|
|
|
|
m_debuggingHelperUi->qmlDumpBuildButton->setEnabled(true);
|
|
|
|
|
} else {
|
|
|
|
|
m_debuggingHelperUi->qmlDumpStatus->setText(tr("<i>Cannot be compiled.</i>"));
|
|
|
|
|
m_debuggingHelperUi->qmlDumpBuildButton->setEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (canBuildQmlObserver) {
|
|
|
|
|
m_debuggingHelperUi->qmlObserverStatus->setText(hasQmlObserver
|
|
|
|
|
? version->qmlObserverTool()
|
|
|
|
|
: QLatin1String("-"));
|
|
|
|
|
m_debuggingHelperUi->qmlObserverBuildButton->setEnabled(true);
|
|
|
|
|
} else {
|
|
|
|
|
m_debuggingHelperUi->qmlDumpStatus->setText(tr("<i>Cannot be compiled.</i>"));
|
|
|
|
|
m_debuggingHelperUi->qmlObserverBuildButton->setEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
|
|
|
|
|
const bool hasLog = currentItem && !currentItem->data(0, BuildLogRole).toString().isEmpty();
|
|
|
|
|
|
|
|
|
|
m_debuggingHelperUi->showLogButton->setEnabled(hasLog);
|
|
|
|
|
|
|
|
|
|
m_ui->debuggingHelperWidget->setVisible(true);
|
2009-08-07 15:20:05 +02:00
|
|
|
}
|
2011-01-17 19:15:51 +01:00
|
|
|
|
2009-08-07 15:20:05 +02:00
|
|
|
}
|
|
|
|
|
|
2009-04-23 13:23:46 +02:00
|
|
|
void QtOptionsPageWidget::updateState()
|
2009-04-23 12:52:51 +02:00
|
|
|
{
|
2009-08-07 15:20:05 +02:00
|
|
|
const QtVersion *version = currentVersion();
|
|
|
|
|
const bool enabled = version != 0;
|
|
|
|
|
const bool isAutodetected = enabled && version->isAutodetected();
|
2009-05-28 11:31:35 +02:00
|
|
|
m_ui->delButton->setEnabled(enabled && !isAutodetected);
|
2011-01-17 19:15:51 +01:00
|
|
|
m_versionUi->nameEdit->setEnabled(enabled && !isAutodetected);
|
|
|
|
|
m_versionUi->qmakePath->setEnabled(enabled && !isAutodetected);
|
|
|
|
|
m_versionUi->mingwPath->setEnabled(enabled);
|
|
|
|
|
m_versionUi->mwcPath->setEnabled(enabled);
|
2009-11-04 19:14:17 +01:00
|
|
|
bool s60SDKPathEnabled = enabled &&
|
|
|
|
|
(isAutodetected ? version->s60SDKDirectory().isEmpty() : true);
|
2011-01-17 19:15:51 +01:00
|
|
|
m_versionUi->s60SDKPath->setEnabled(s60SDKPathEnabled);
|
|
|
|
|
m_versionUi->gccePath->setEnabled(enabled);
|
2009-04-23 12:52:51 +02:00
|
|
|
|
2011-01-17 19:15:51 +01:00
|
|
|
updateDebuggingHelperInfo(version);
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
2009-08-07 15:20:05 +02:00
|
|
|
|
2009-04-23 13:23:46 +02:00
|
|
|
void QtOptionsPageWidget::makeMingwVisible(bool visible)
|
2009-04-23 12:52:51 +02:00
|
|
|
{
|
2011-01-17 19:15:51 +01:00
|
|
|
m_versionUi->mingwLabel->setVisible(visible);
|
|
|
|
|
m_versionUi->mingwPath->setVisible(visible);
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
|
|
|
|
|
2009-05-18 14:58:19 +02:00
|
|
|
void QtOptionsPageWidget::makeMSVCVisible(bool visible)
|
|
|
|
|
{
|
2011-01-17 19:15:51 +01:00
|
|
|
m_versionUi->msvcLabel->setVisible(visible);
|
|
|
|
|
m_versionUi->msvcComboBox->setVisible(visible);
|
|
|
|
|
m_versionUi->msvcNotFoundLabel->setVisible(false);
|
2009-05-18 14:58:19 +02:00
|
|
|
}
|
|
|
|
|
|
2009-10-27 17:59:53 +01:00
|
|
|
void QtOptionsPageWidget::makeS60Visible(bool visible)
|
2009-06-04 10:50:44 +02:00
|
|
|
{
|
2011-01-17 19:15:51 +01:00
|
|
|
m_versionUi->mwcLabel->setVisible(visible);
|
|
|
|
|
m_versionUi->mwcPath->setVisible(visible);
|
|
|
|
|
m_versionUi->s60SDKLabel->setVisible(visible);
|
|
|
|
|
m_versionUi->s60SDKPath->setVisible(visible);
|
|
|
|
|
m_versionUi->gcceLabel->setVisible(visible);
|
|
|
|
|
m_versionUi->gccePath->setVisible(visible);
|
|
|
|
|
m_versionUi->sbsV2Label->setVisible(visible);
|
|
|
|
|
m_versionUi->sbsV2Path->setVisible(visible);
|
2010-04-23 13:24:51 +02:00
|
|
|
}
|
|
|
|
|
|
2009-04-23 13:23:46 +02:00
|
|
|
void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item)
|
2009-04-23 12:52:51 +02:00
|
|
|
{
|
|
|
|
|
if (item) {
|
2009-05-26 17:21:30 +02:00
|
|
|
int index = indexForTreeItem(item);
|
|
|
|
|
if (index < 0) {
|
2011-01-17 19:15:51 +01:00
|
|
|
m_versionUi->errorLabel->setText("");
|
2009-05-26 17:21:30 +02:00
|
|
|
makeMSVCVisible(false);
|
|
|
|
|
makeMingwVisible(false);
|
2009-10-27 17:59:53 +01:00
|
|
|
makeS60Visible(false);
|
2009-05-26 17:21:30 +02:00
|
|
|
return;
|
|
|
|
|
}
|
2010-03-04 15:23:02 +01:00
|
|
|
const QSharedPointerQtVersion qtVersion = m_versions.at(index);
|
2010-11-01 14:14:17 +01:00
|
|
|
QList<ProjectExplorer::ToolChainType> types = qtVersion->possibleToolChainTypes();
|
2010-03-04 15:23:02 +01:00
|
|
|
QSet<QString> targets = qtVersion->supportedTargetIds();
|
2010-02-11 15:29:46 +01:00
|
|
|
if (types.isEmpty()) {
|
|
|
|
|
makeMSVCVisible(false);
|
|
|
|
|
makeMingwVisible(false);
|
|
|
|
|
makeS60Visible(false);
|
2010-11-01 14:14:17 +01:00
|
|
|
} else if (types.contains(ProjectExplorer::ToolChain_MinGW)) {
|
2009-05-18 14:58:19 +02:00
|
|
|
makeMSVCVisible(false);
|
2009-04-23 12:52:51 +02:00
|
|
|
makeMingwVisible(true);
|
2009-10-27 17:59:53 +01:00
|
|
|
makeS60Visible(false);
|
2011-01-17 19:15:51 +01:00
|
|
|
m_versionUi->mingwPath->setPath(m_versions.at(index)->mingwDirectory());
|
2010-11-01 14:14:17 +01:00
|
|
|
} else if (types.contains(ProjectExplorer::ToolChain_MSVC) ||
|
|
|
|
|
types.contains(ProjectExplorer::ToolChain_WINCE)) {
|
2009-05-18 14:58:19 +02:00
|
|
|
makeMSVCVisible(false);
|
2009-04-23 12:52:51 +02:00
|
|
|
makeMingwVisible(false);
|
2009-10-27 17:59:53 +01:00
|
|
|
makeS60Visible(false);
|
2010-03-04 15:23:02 +01:00
|
|
|
const QStringList msvcEnvironments = ProjectExplorer::ToolChain::availableMSVCVersions(qtVersion->isQt64Bit());
|
2009-04-23 12:52:51 +02:00
|
|
|
if (msvcEnvironments.count() == 0) {
|
2011-01-17 19:15:51 +01:00
|
|
|
m_versionUi->msvcLabel->setVisible(true);
|
|
|
|
|
m_versionUi->msvcNotFoundLabel->setVisible(true);
|
2009-04-23 12:52:51 +02:00
|
|
|
} else {
|
2009-05-18 14:58:19 +02:00
|
|
|
makeMSVCVisible(true);
|
2011-01-17 19:15:51 +01:00
|
|
|
bool block = m_versionUi->msvcComboBox->blockSignals(true);
|
|
|
|
|
m_versionUi->msvcComboBox->clear();
|
2009-04-23 12:52:51 +02:00
|
|
|
foreach(const QString &msvcenv, msvcEnvironments) {
|
2011-01-17 19:15:51 +01:00
|
|
|
m_versionUi->msvcComboBox->addItem(msvcenv);
|
2009-04-23 12:52:51 +02:00
|
|
|
if (msvcenv == m_versions.at(index)->msvcVersion()) {
|
2011-01-17 19:15:51 +01:00
|
|
|
m_versionUi->msvcComboBox->setCurrentIndex(m_versionUi->msvcComboBox->count() - 1);
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
|
|
|
|
}
|
2011-01-17 19:15:51 +01:00
|
|
|
m_versionUi->msvcComboBox->blockSignals(block);
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
2010-02-25 16:51:27 +01:00
|
|
|
} else if (targets.contains(Constants::S60_DEVICE_TARGET_ID) ||
|
|
|
|
|
targets.contains(Constants::S60_EMULATOR_TARGET_ID)) {
|
2009-06-04 10:50:44 +02:00
|
|
|
makeMSVCVisible(false);
|
|
|
|
|
makeMingwVisible(false);
|
2009-10-27 17:59:53 +01:00
|
|
|
makeS60Visible(true);
|
2011-01-17 19:15:51 +01:00
|
|
|
m_versionUi->mwcPath->setPath(QDir::toNativeSeparators(m_versions.at(index)->mwcDirectory()));
|
|
|
|
|
m_versionUi->s60SDKPath->setPath(QDir::toNativeSeparators(m_versions.at(index)->s60SDKDirectory()));
|
|
|
|
|
m_versionUi->gccePath->setPath(QDir::toNativeSeparators(m_versions.at(index)->gcceDirectory()));
|
|
|
|
|
m_versionUi->sbsV2Path->setPath(m_versions.at(index)->sbsV2Directory());
|
|
|
|
|
m_versionUi->sbsV2Path->setEnabled(m_versions.at(index)->isBuildWithSymbianSbsV2());
|
2009-04-23 12:52:51 +02:00
|
|
|
} else { //ProjectExplorer::ToolChain::GCC
|
2009-05-18 14:58:19 +02:00
|
|
|
makeMSVCVisible(false);
|
2009-04-23 12:52:51 +02:00
|
|
|
makeMingwVisible(false);
|
2009-10-27 17:59:53 +01:00
|
|
|
makeS60Visible(false);
|
2010-02-11 15:29:46 +01:00
|
|
|
}
|
2010-02-12 13:32:20 +01:00
|
|
|
|
2011-01-17 19:15:51 +01:00
|
|
|
m_versionUi->errorLabel->setText(m_versions.at(index)->description());
|
2009-04-23 12:52:51 +02:00
|
|
|
} else {
|
2009-05-18 14:58:19 +02:00
|
|
|
makeMSVCVisible(false);
|
2009-04-23 12:52:51 +02:00
|
|
|
makeMingwVisible(false);
|
2009-10-27 17:59:53 +01:00
|
|
|
makeS60Visible(false);
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-08-07 15:20:05 +02:00
|
|
|
int QtOptionsPageWidget::indexForTreeItem(const QTreeWidgetItem *item) const
|
2009-05-26 17:21:30 +02:00
|
|
|
{
|
|
|
|
|
if (!item || !item->parent())
|
|
|
|
|
return -1;
|
2011-01-17 19:15:51 +01:00
|
|
|
const int uniqueId = item->data(0, VersionIdRole).toInt();
|
2009-05-26 17:21:30 +02:00
|
|
|
for (int index = 0; index < m_versions.size(); ++index) {
|
|
|
|
|
if (m_versions.at(index)->uniqueId() == uniqueId)
|
|
|
|
|
return index;
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-13 13:47:46 +02:00
|
|
|
QTreeWidgetItem *QtOptionsPageWidget::treeItemForIndex(int index) const
|
|
|
|
|
{
|
2009-08-07 15:20:05 +02:00
|
|
|
const int uniqueId = m_versions.at(index)->uniqueId();
|
2009-07-13 13:47:46 +02:00
|
|
|
for (int i = 0; i < m_ui->qtdirList->topLevelItemCount(); ++i) {
|
|
|
|
|
QTreeWidgetItem *toplevelItem = m_ui->qtdirList->topLevelItem(i);
|
|
|
|
|
for (int j = 0; j < toplevelItem->childCount(); ++j) {
|
|
|
|
|
QTreeWidgetItem *item = toplevelItem->child(j);
|
2011-01-17 19:15:51 +01:00
|
|
|
if (item->data(0, VersionIdRole).toInt() == uniqueId) {
|
2009-07-13 13:47:46 +02:00
|
|
|
return item;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-23 13:23:46 +02:00
|
|
|
void QtOptionsPageWidget::versionChanged(QTreeWidgetItem *item, QTreeWidgetItem *old)
|
2009-04-23 12:52:51 +02:00
|
|
|
{
|
|
|
|
|
if (old) {
|
2009-05-26 17:21:30 +02:00
|
|
|
fixQtVersionName(indexForTreeItem(old));
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
2009-05-26 17:21:30 +02:00
|
|
|
int itemIndex = indexForTreeItem(item);
|
|
|
|
|
if (itemIndex >= 0) {
|
2011-01-17 19:15:51 +01:00
|
|
|
m_versionUi->nameEdit->setText(item->text(0));
|
|
|
|
|
m_versionUi->qmakePath->setPath(item->text(1));
|
2009-04-23 12:52:51 +02:00
|
|
|
} else {
|
2011-01-17 19:15:51 +01:00
|
|
|
m_versionUi->nameEdit->clear();
|
|
|
|
|
m_versionUi->qmakePath->setPath(QString()); // clear()
|
2010-10-08 15:13:02 +02:00
|
|
|
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
|
|
|
|
showEnvironmentPage(item);
|
|
|
|
|
updateState();
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-23 13:23:46 +02:00
|
|
|
void QtOptionsPageWidget::onQtBrowsed()
|
2009-04-23 12:52:51 +02:00
|
|
|
{
|
2011-01-17 19:15:51 +01:00
|
|
|
const QString dir = m_versionUi->qmakePath->path();
|
2009-04-23 12:52:51 +02:00
|
|
|
if (dir.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
|
2009-09-03 19:16:22 +02:00
|
|
|
updateCurrentQMakeLocation();
|
2009-04-23 12:52:51 +02:00
|
|
|
updateState();
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-23 13:23:46 +02:00
|
|
|
void QtOptionsPageWidget::onMingwBrowsed()
|
2009-04-23 12:52:51 +02:00
|
|
|
{
|
2011-01-17 19:15:51 +01:00
|
|
|
const QString dir = m_versionUi->mingwPath->path();
|
2009-04-23 12:52:51 +02:00
|
|
|
if (dir.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
updateCurrentMingwDirectory();
|
|
|
|
|
updateState();
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-23 13:23:46 +02:00
|
|
|
void QtOptionsPageWidget::updateCurrentQtName()
|
2009-04-23 12:52:51 +02:00
|
|
|
{
|
|
|
|
|
QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
|
|
|
|
|
Q_ASSERT(currentItem);
|
2009-05-26 17:21:30 +02:00
|
|
|
int currentItemIndex = indexForTreeItem(currentItem);
|
|
|
|
|
if (currentItemIndex < 0)
|
|
|
|
|
return;
|
2011-01-17 19:15:51 +01:00
|
|
|
m_versions[currentItemIndex]->setDisplayName(m_versionUi->nameEdit->text());
|
2010-01-07 18:17:24 +01:00
|
|
|
currentItem->setText(0, m_versions[currentItemIndex]->displayName());
|
2011-01-17 19:15:51 +01:00
|
|
|
m_versionUi->errorLabel->setText(m_versions.at(currentItemIndex)->description());
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-04-23 13:23:46 +02:00
|
|
|
void QtOptionsPageWidget::finish()
|
2009-04-23 12:52:51 +02:00
|
|
|
{
|
|
|
|
|
if (QTreeWidgetItem *item = m_ui->qtdirList->currentItem())
|
2009-05-26 17:21:30 +02:00
|
|
|
fixQtVersionName(indexForTreeItem(item));
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Checks that the qt version name is unique
|
|
|
|
|
* and otherwise changes the name
|
|
|
|
|
*
|
|
|
|
|
*/
|
2009-04-23 13:23:46 +02:00
|
|
|
void QtOptionsPageWidget::fixQtVersionName(int index)
|
2009-04-23 12:52:51 +02:00
|
|
|
{
|
2009-05-26 17:21:30 +02:00
|
|
|
if (index < 0)
|
|
|
|
|
return;
|
2009-04-23 12:52:51 +02:00
|
|
|
int count = m_versions.count();
|
2010-01-07 18:17:24 +01:00
|
|
|
QString name = m_versions.at(index)->displayName();
|
2009-04-23 12:52:51 +02:00
|
|
|
for (int i = 0; i < count; ++i) {
|
|
|
|
|
if (i != index) {
|
2010-01-07 18:17:24 +01:00
|
|
|
if (m_versions.at(i)->displayName() == m_versions.at(index)->displayName()) {
|
2009-04-23 12:52:51 +02:00
|
|
|
// Same name, find new name
|
|
|
|
|
QRegExp regexp("^(.*)\\((\\d)\\)$");
|
|
|
|
|
if (regexp.exactMatch(name)) {
|
2010-01-11 10:22:55 +01:00
|
|
|
// Already in Name (#) format
|
2010-02-01 12:43:56 +01:00
|
|
|
name = regexp.cap(1);
|
|
|
|
|
name += QLatin1Char('(');
|
|
|
|
|
name += QString::number(regexp.cap(2).toInt() + 1);
|
|
|
|
|
name += QLatin1Char(')');
|
2009-04-23 12:52:51 +02:00
|
|
|
} else {
|
2010-02-01 12:43:56 +01:00
|
|
|
name += QLatin1String(" (2)");
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
|
|
|
|
// set new name
|
2010-01-07 18:17:24 +01:00
|
|
|
m_versions[index]->setDisplayName(name);
|
2009-07-13 13:47:46 +02:00
|
|
|
treeItemForIndex(index)->setText(0, name);
|
2009-04-23 12:52:51 +02:00
|
|
|
|
|
|
|
|
// Now check again...
|
|
|
|
|
fixQtVersionName(index);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-03 19:16:22 +02:00
|
|
|
void QtOptionsPageWidget::updateCurrentQMakeLocation()
|
2009-04-23 12:52:51 +02:00
|
|
|
{
|
|
|
|
|
QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
|
|
|
|
|
Q_ASSERT(currentItem);
|
2009-05-26 17:21:30 +02:00
|
|
|
int currentItemIndex = indexForTreeItem(currentItem);
|
|
|
|
|
if (currentItemIndex < 0)
|
|
|
|
|
return;
|
2009-08-07 15:20:05 +02:00
|
|
|
QtVersion *version = m_versions.at(currentItemIndex).data();
|
2011-01-17 19:15:51 +01:00
|
|
|
QFileInfo fi(m_versionUi->qmakePath->path());
|
2010-08-30 15:10:05 +02:00
|
|
|
if (!fi.exists() || !fi.isFile() || version->qmakeCommand() == fi.absoluteFilePath())
|
2009-04-23 12:52:51 +02:00
|
|
|
return;
|
2010-08-30 15:10:05 +02:00
|
|
|
version->setQMakeCommand(fi.absoluteFilePath());
|
2009-09-03 19:16:22 +02:00
|
|
|
currentItem->setText(1, QDir::toNativeSeparators(version->qmakeCommand()));
|
2009-04-23 12:52:51 +02:00
|
|
|
showEnvironmentPage(currentItem);
|
|
|
|
|
|
2011-01-17 19:15:51 +01:00
|
|
|
updateDebuggingHelperInfo(version);
|
2010-08-30 15:10:05 +02:00
|
|
|
|
2011-01-17 19:15:51 +01:00
|
|
|
if (m_versionUi->nameEdit->text().isEmpty() || m_versionUi->nameEdit->text() == m_specifyNameString) {
|
2010-08-30 15:10:05 +02:00
|
|
|
QString name = ProjectExplorer::DebuggingHelperLibrary::qtVersionForQMake(version->qmakeCommand());
|
|
|
|
|
if (!name.isEmpty())
|
2011-01-17 19:15:51 +01:00
|
|
|
m_versionUi->nameEdit->setText(name);
|
2010-08-30 15:10:05 +02:00
|
|
|
updateCurrentQtName();
|
|
|
|
|
}
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
|
|
|
|
|
2009-04-23 13:23:46 +02:00
|
|
|
void QtOptionsPageWidget::updateCurrentMingwDirectory()
|
2009-04-23 12:52:51 +02:00
|
|
|
{
|
|
|
|
|
QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
|
|
|
|
|
Q_ASSERT(currentItem);
|
2009-05-26 17:21:30 +02:00
|
|
|
int currentItemIndex = indexForTreeItem(currentItem);
|
|
|
|
|
if (currentItemIndex < 0)
|
|
|
|
|
return;
|
2011-01-17 19:15:51 +01:00
|
|
|
m_versions[currentItemIndex]->setMingwDirectory(m_versionUi->mingwPath->path());
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
|
|
|
|
|
2009-04-23 13:23:46 +02:00
|
|
|
void QtOptionsPageWidget::msvcVersionChanged()
|
2009-04-23 12:52:51 +02:00
|
|
|
{
|
2011-01-17 19:15:51 +01:00
|
|
|
const QString &msvcVersion = m_versionUi->msvcComboBox->currentText();
|
2009-04-23 12:52:51 +02:00
|
|
|
QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
|
|
|
|
|
Q_ASSERT(currentItem);
|
2009-05-26 17:21:30 +02:00
|
|
|
int currentItemIndex = indexForTreeItem(currentItem);
|
|
|
|
|
if (currentItemIndex < 0)
|
|
|
|
|
return;
|
2009-04-23 12:52:51 +02:00
|
|
|
m_versions[currentItemIndex]->setMsvcVersion(msvcVersion);
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-04 10:50:44 +02:00
|
|
|
void QtOptionsPageWidget::updateCurrentMwcDirectory()
|
|
|
|
|
{
|
|
|
|
|
QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
|
|
|
|
|
Q_ASSERT(currentItem);
|
|
|
|
|
int currentItemIndex = indexForTreeItem(currentItem);
|
|
|
|
|
if (currentItemIndex < 0)
|
|
|
|
|
return;
|
2010-02-12 11:56:42 +01:00
|
|
|
m_versions[currentItemIndex]->setMwcDirectory(
|
2011-01-17 19:15:51 +01:00
|
|
|
QDir::fromNativeSeparators(m_versionUi->mwcPath->path()));
|
2009-06-04 10:50:44 +02:00
|
|
|
}
|
2009-10-27 17:59:53 +01:00
|
|
|
void QtOptionsPageWidget::updateCurrentS60SDKDirectory()
|
|
|
|
|
{
|
|
|
|
|
QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
|
|
|
|
|
Q_ASSERT(currentItem);
|
|
|
|
|
int currentItemIndex = indexForTreeItem(currentItem);
|
|
|
|
|
if (currentItemIndex < 0)
|
|
|
|
|
return;
|
2010-02-12 11:56:42 +01:00
|
|
|
m_versions[currentItemIndex]->setS60SDKDirectory(
|
2011-01-17 19:15:51 +01:00
|
|
|
QDir::fromNativeSeparators(m_versionUi->s60SDKPath->path()));
|
2009-10-27 17:59:53 +01:00
|
|
|
}
|
2010-11-15 15:24:17 +01:00
|
|
|
|
2009-10-29 12:19:56 +01:00
|
|
|
void QtOptionsPageWidget::updateCurrentGcceDirectory()
|
|
|
|
|
{
|
|
|
|
|
QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
|
|
|
|
|
Q_ASSERT(currentItem);
|
|
|
|
|
int currentItemIndex = indexForTreeItem(currentItem);
|
|
|
|
|
if (currentItemIndex < 0)
|
|
|
|
|
return;
|
2010-02-12 11:56:42 +01:00
|
|
|
m_versions[currentItemIndex]->setGcceDirectory(
|
2011-01-17 19:15:51 +01:00
|
|
|
QDir::fromNativeSeparators(m_versionUi->gccePath->path()));
|
2009-10-29 12:19:56 +01:00
|
|
|
}
|
2009-06-04 10:50:44 +02:00
|
|
|
|
2010-11-15 15:24:17 +01:00
|
|
|
void QtOptionsPageWidget::updateCurrentSbsV2Directory()
|
|
|
|
|
{
|
|
|
|
|
QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
|
|
|
|
|
Q_ASSERT(currentItem);
|
|
|
|
|
int currentItemIndex = indexForTreeItem(currentItem);
|
|
|
|
|
if (currentItemIndex < 0)
|
|
|
|
|
return;
|
|
|
|
|
m_versions[currentItemIndex]->setSbsV2Directory(
|
2011-01-17 19:15:51 +01:00
|
|
|
QDir::fromNativeSeparators(m_versionUi->sbsV2Path->path()));
|
2010-11-15 15:24:17 +01:00
|
|
|
}
|
|
|
|
|
|
2009-08-07 15:20:05 +02:00
|
|
|
QList<QSharedPointerQtVersion> QtOptionsPageWidget::versions() const
|
2009-04-23 12:52:51 +02:00
|
|
|
{
|
2010-08-30 15:09:28 +02:00
|
|
|
QList<QSharedPointerQtVersion> result;
|
|
|
|
|
for (int i = 0; i < m_versions.count(); ++i) {
|
|
|
|
|
if (m_versions.at(i)->qmakeCommand() != m_specifyPathString)
|
|
|
|
|
result.append(m_versions.at(i));
|
|
|
|
|
}
|
|
|
|
|
return result;
|
2009-04-23 12:52:51 +02:00
|
|
|
}
|
|
|
|
|
|
2009-11-24 15:05:02 +01:00
|
|
|
QString QtOptionsPageWidget::searchKeywords() const
|
|
|
|
|
{
|
|
|
|
|
QString rc;
|
2010-12-01 14:35:36 +01:00
|
|
|
QLatin1Char sep(' ');
|
|
|
|
|
QTextStream(&rc)
|
2011-01-17 19:15:51 +01:00
|
|
|
<< sep << m_versionUi->versionNameLabel->text()
|
|
|
|
|
<< sep << m_versionUi->pathLabel->text()
|
|
|
|
|
<< sep << m_versionUi->mingwLabel->text()
|
|
|
|
|
<< sep << m_versionUi->msvcLabel->text()
|
|
|
|
|
<< sep << m_versionUi->s60SDKLabel->text()
|
|
|
|
|
<< sep << m_versionUi->gcceLabel->text()
|
|
|
|
|
<< sep << m_versionUi->mwcLabel->text()
|
|
|
|
|
<< sep << m_versionUi->sbsV2Label->text()
|
|
|
|
|
<< sep << m_debuggingHelperUi->gdbHelperLabel->text()
|
|
|
|
|
<< sep << m_debuggingHelperUi->qmlDumpLabel->text()
|
|
|
|
|
<< sep << m_debuggingHelperUi->qmlObserverLabel->text();
|
2009-11-24 15:05:02 +01:00
|
|
|
rc.remove(QLatin1Char('&'));
|
|
|
|
|
return rc;
|
|
|
|
|
}
|