forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/2.6'
Conflicts: src/plugins/qt4projectmanager/qt4buildconfiguration.cpp src/plugins/qtsupport/baseqtversion.cpp Change-Id: Id870f70aa35c232dbbd455f83429bab80f266c2d
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
|
||||
<Icon>logo.png</Icon>
|
||||
<Watermark>watermark.png</Watermark>
|
||||
<UninstallerName>QtCreatorUninstaller</UninstallerName>
|
||||
<UninstallerName>QtCreatorUninst</UninstallerName>
|
||||
<!-- @homeDir@ and @rootDir@ are some of the supported vars -->
|
||||
<TargetDir>@rootDir@/Qt/qtcreator-{version}</TargetDir>
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 14 KiB |
Binary file not shown.
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 12 KiB |
@@ -36,7 +36,7 @@
|
||||
to use them from \QC.
|
||||
|
||||
To run the Valgrind tools on a remote host over SSH, select \gui {Analyze
|
||||
> Valgrind Analyze Memory (External)} or \gui {Valgrind Function Profile
|
||||
> Valgrind Memory Analyzer (External)} or \gui {Valgrind Function Profiler
|
||||
(External)}.
|
||||
|
||||
To stop the currently running analyzer, select \gui {Analyze
|
||||
|
@@ -252,8 +252,8 @@
|
||||
|
||||
\list 1
|
||||
|
||||
\o Select \gui {Analyze > Valgrind Analyze Memory (External)} or
|
||||
\gui {Valgrind Function Profile (External)}.
|
||||
\o Select \gui {Analyze > Valgrind Memory Analyzer (External)} or
|
||||
\gui {Valgrind Function Profiler (External)}.
|
||||
|
||||
\image qtcreator-valgrind-remote-settings.png "Start Analyzer dialog"
|
||||
|
||||
|
@@ -631,6 +631,17 @@
|
||||
Also, the debugger displays access data for QFileInfo and provides
|
||||
access to the "real" contents of QVariant.
|
||||
|
||||
Right-click in the the \gui{Locals and Expressions} view to open a context
|
||||
menu that provides additional options for viewing data. The available
|
||||
options depend on the type of the current items, and are provided by the
|
||||
\l{Using Debugging Helpers}{Debugging Helpers}. Typically, string-like data,
|
||||
such as \c{QByteArray} and \c{std::string}, offer a selection of encodings,
|
||||
as well as the possibility to use a full editor window. Map-like data, such
|
||||
as \c{QMap}, \c{QHash}, and \c{std::map}, offer a compact option using the
|
||||
\c{name} column for keys, resulting in a concise display of containers with
|
||||
short keys, such as numbers or short strings. For example, to expand all the
|
||||
values of QMap, select \gui {Change Local Display Format} > \gui Compact.
|
||||
|
||||
You can use the \gui{Locals and Expressions} view to change the contents of
|
||||
variables of simple data types, for example, \c int or \c float when the
|
||||
program is interrupted. To do so, click the \gui Value column, modify
|
||||
|
@@ -73,8 +73,8 @@
|
||||
You can open files for editing in the default text editor for your system:
|
||||
Notepad on Windows and vi on Linux and Mac OS.
|
||||
To open the file you are currently viewing in an external editor, select
|
||||
\gui {Tools > External > Text > Notepad} or \gui vi, depending on your
|
||||
system.
|
||||
\gui Tools > \gui External > \gui Text > \gui {Edit with Notepad} or
|
||||
\gui {Edit with vi}, depending on your system.
|
||||
|
||||
\QC looks for the editor path in the PATH environment variable
|
||||
of your operating system.
|
||||
|
@@ -194,6 +194,11 @@
|
||||
\row
|
||||
\o Toggle \gui{Compile Output} pane
|
||||
\o Alt+4 (Cmd+4 on Mac OS X)
|
||||
\row
|
||||
\o Toggle other output panes
|
||||
\o Alt+number (Cmd+number on Mac OS X)
|
||||
|
||||
Where the number is the number of the output pane.
|
||||
\row
|
||||
\o Activate \gui Bookmarks pane
|
||||
\o Alt+M
|
||||
|
@@ -100,6 +100,10 @@
|
||||
|
||||
\endlist
|
||||
|
||||
To open the other output panes, such as \gui{General Messages} and
|
||||
\gui{Version Control}, select \gui Window > \gui {Output Panes}. The menu
|
||||
items also display the keyboard shortcuts that you can use.
|
||||
|
||||
For more information about output panes, see \l{Viewing Output}.
|
||||
|
||||
\section1 Using Keyboard Shortcuts
|
||||
|
2
doc/templates/style/narrow.css
vendored
2
doc/templates/style/narrow.css
vendored
@@ -187,7 +187,7 @@
|
||||
}
|
||||
|
||||
.narrow #narrowsearch {
|
||||
background: url("http://doc.qt.nokia.com/prototype/html/images/sprites-combined.png") no-repeat scroll -6px -348px transparent;
|
||||
background: url("http://doc.qt.digia.com/prototype/html/images/sprites-combined.png") no-repeat scroll -6px -348px transparent;
|
||||
height: 21px;
|
||||
padding: 2px 0 0 5px;
|
||||
width: 167px;
|
||||
|
@@ -184,3 +184,5 @@ qt:greaterThan(QT_MAJOR_VERSION, 4) {
|
||||
contains(QT, gui): QT += widgets
|
||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x040900
|
||||
}
|
||||
|
||||
OTHER_FILES += $$replace(_PRO_FILE_, \\.pro$, .qbs)
|
||||
|
@@ -15,7 +15,9 @@ SUBDIRS = src share lib/qtcreator/qtcomponents
|
||||
unix:!macx:!isEmpty(copydata):SUBDIRS += bin
|
||||
|
||||
OTHER_FILES += dist/copyright_template.txt \
|
||||
$$files(dist/changes-*)
|
||||
$$files(dist/changes-*) \
|
||||
qtcreator.qbp \
|
||||
qbs/pluginspec/pluginspec.qbs
|
||||
|
||||
macx: PLATFORM = "mac"
|
||||
else:win32: PLATFORM = "windows"
|
||||
@@ -52,7 +54,7 @@ bindist.commands = 7z a -mx9 $$OUT_PWD/qt-creator-$${PATTERN}.7z \"$$BINDIST_SOU
|
||||
bindist_installer.depends = deployqt
|
||||
bindist_installer.commands = 7z a -mx9 $$OUT_PWD/qt-creator-$${PATTERN}-installer-archive.7z \"$$BINDIST_INSTALLER_SOURCE\"
|
||||
installer.depends = bindist_installer
|
||||
installer.commands = $$PWD/scripts/packageIfw.py -i \"$(IFW_PATH)\" -v $${QTCREATOR_VERSION} -a \"$$INSTALLER_ARCHIVE\" "qt-creator-$${PATTERN}-installer"
|
||||
installer.commands = $$PWD/scripts/packageIfw.py -i \"$(IFW_PATH)\" -v $${QTCREATOR_VERSION} -a \"$$INSTALLER_ARCHIVE\" "qt-creator-$${PATTERN}"
|
||||
|
||||
win32 {
|
||||
deployqt.commands ~= s,/,\\\\,g
|
||||
|
@@ -93,6 +93,7 @@ def main():
|
||||
config_postfix = '-windows'
|
||||
if sys.platform.startswith('linux'):
|
||||
config_postfix = '-linux'
|
||||
installer_name = installer_name + '.bin'
|
||||
|
||||
config_name = 'config' + config_postfix + '.xml'
|
||||
|
||||
|
@@ -61,6 +61,9 @@ QString QmlApplicationViewerPrivate::adjustPath(const QString &path)
|
||||
if (!QDir::isAbsolutePath(path))
|
||||
return QString::fromLatin1("%1/../Resources/%2")
|
||||
.arg(QCoreApplication::applicationDirPath(), path);
|
||||
#elif defined(Q_OS_QNX)
|
||||
if (!QDir::isAbsolutePath(path))
|
||||
return QString::fromLatin1("app/native/%1").arg(path);
|
||||
#elif !defined(Q_OS_ANDROID)
|
||||
const QString pathInInstallDir =
|
||||
QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
|
||||
@@ -154,7 +157,7 @@ void QmlApplicationViewer::showExpanded()
|
||||
{
|
||||
#if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR)
|
||||
showFullScreen();
|
||||
#elif defined(Q_WS_MAEMO_5)
|
||||
#elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX)
|
||||
showMaximized();
|
||||
#else
|
||||
show();
|
||||
|
@@ -1,20 +1,15 @@
|
||||
#include <QApplication>
|
||||
#include <QDeclarativeView>
|
||||
#include <QObject>
|
||||
#include "qmlapplicationviewer.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
QScopedPointer<QApplication> app(createApplication(argc, argv));
|
||||
|
||||
QDeclarativeView view;
|
||||
#ifdef Q_OS_QNX
|
||||
view.setSource(QUrl("app/native/qml/main.qml"));
|
||||
#else
|
||||
view.setSource(QUrl("qml/main.qml"));
|
||||
#endif
|
||||
view.setAttribute(Qt::WA_AutoOrientation, true);
|
||||
view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
|
||||
view.showMaximized();
|
||||
QmlApplicationViewer viewer;
|
||||
viewer.addImportPath(QLatin1String("modules")); // ADDIMPORTPATH
|
||||
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); // ORIENTATION
|
||||
viewer.setMainQmlFile(QLatin1String("qml/main.qml")); // MAINQML
|
||||
viewer.showExpanded();
|
||||
|
||||
return a.exec();
|
||||
return app->exec();
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
TEMPLATE = app
|
||||
|
||||
QT += declarative
|
||||
# Please do not modify the following line.
|
||||
include(qmlapplicationviewer/qmlapplicationviewer.pri)
|
||||
|
||||
# Additional import path used to resolve QML modules in Creator's code model
|
||||
QML_IMPORT_PATH =
|
||||
|
@@ -42,5 +42,8 @@
|
||||
<file source="qml/main.qml" openeditor="true"/>
|
||||
<file source="bar-descriptor.xml" openeditor="true"/>
|
||||
<file source="project.pro" target="%ProjectName%.pro" openproject="true"/>
|
||||
<file source="../../qtquickapp/qmlapplicationviewer/qmlapplicationviewer.h" target="qmlapplicationviewer/qmlapplicationviewer.h" />
|
||||
<file source="../../qtquickapp/qmlapplicationviewer/qmlapplicationviewer.cpp" target="qmlapplicationviewer/qmlapplicationviewer.cpp" />
|
||||
<file source="../../qtquickapp/qmlapplicationviewer/qmlapplicationviewer.pri" target="qmlapplicationviewer/qmlapplicationviewer.pri" />
|
||||
</files>
|
||||
</wizard>
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,5 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS = qtcreator/static.pro \
|
||||
qtcreator/translations
|
||||
OTHER_FILES += share.qbs \
|
||||
../src/share/share.qbs
|
||||
|
@@ -676,10 +676,20 @@ void Snapshot::insert(Document::Ptr doc)
|
||||
_documents.insert(doc->fileName(), doc);
|
||||
}
|
||||
|
||||
QByteArray Snapshot::preprocessedCode(const QString &source, const QString &fileName) const
|
||||
Document::Ptr Snapshot::preprocessedDocument(const QString &source, const QString &fileName) const
|
||||
{
|
||||
Document::Ptr newDoc = Document::create(fileName);
|
||||
if (Document::Ptr thisDocument = document(fileName)) {
|
||||
newDoc->_revision = thisDocument->_revision;
|
||||
newDoc->_editorRevision = thisDocument->_editorRevision;
|
||||
newDoc->_lastModified = thisDocument->_lastModified;
|
||||
newDoc->_includes = thisDocument->_includes;
|
||||
}
|
||||
|
||||
FastPreprocessor pp(*this);
|
||||
return pp.run(fileName, source);
|
||||
const QByteArray preprocessedCode = pp.run(newDoc, source);
|
||||
newDoc->setUtf8Source(preprocessedCode);
|
||||
return newDoc;
|
||||
}
|
||||
|
||||
Document::Ptr Snapshot::documentFromSource(const QByteArray &preprocessedCode,
|
||||
|
@@ -79,7 +79,8 @@ public:
|
||||
|
||||
void appendMacro(const Macro ¯o);
|
||||
void addMacroUse(const Macro ¯o, unsigned offset, unsigned length,
|
||||
unsigned beginLine, const QVector<MacroArgumentReference> &range);
|
||||
unsigned beginLine,
|
||||
const QVector<MacroArgumentReference> &range);
|
||||
void addUndefinedMacroUse(const QByteArray &name, unsigned offset);
|
||||
|
||||
Control *control() const;
|
||||
@@ -254,8 +255,7 @@ public:
|
||||
unsigned _beginLine;
|
||||
|
||||
public:
|
||||
inline MacroUse(const Macro ¯o,
|
||||
unsigned begin, unsigned end, unsigned beginLine)
|
||||
inline MacroUse(const Macro ¯o, unsigned begin, unsigned end, unsigned beginLine)
|
||||
: Block(begin, end),
|
||||
_macro(macro),
|
||||
_beginLine(beginLine)
|
||||
@@ -371,10 +371,10 @@ public:
|
||||
|
||||
Snapshot simplified(Document::Ptr doc) const;
|
||||
|
||||
QByteArray preprocessedCode(const QString &source,
|
||||
Document::Ptr preprocessedDocument(const QString &source,
|
||||
const QString &fileName) const;
|
||||
|
||||
Document::Ptr documentFromSource(const QByteArray &preprocessedCode,
|
||||
Document::Ptr documentFromSource(const QByteArray &preprocessedDocument,
|
||||
const QString &fileName) const;
|
||||
|
||||
private:
|
||||
|
@@ -39,8 +39,10 @@ FastPreprocessor::FastPreprocessor(const Snapshot &snapshot)
|
||||
_preproc(this, &_env)
|
||||
{ }
|
||||
|
||||
QByteArray FastPreprocessor::run(QString fileName, const QString &source)
|
||||
QByteArray FastPreprocessor::run(Document::Ptr newDoc, const QString &source)
|
||||
{
|
||||
std::swap(newDoc, _currentDoc);
|
||||
const QString fileName = _currentDoc->fileName();
|
||||
_preproc.setExpandFunctionlikeMacros(false);
|
||||
_preproc.setKeepComments(true);
|
||||
|
||||
@@ -54,11 +56,17 @@ QByteArray FastPreprocessor::run(QString fileName, const QString &source)
|
||||
|
||||
const QByteArray preprocessed = _preproc.run(fileName, source);
|
||||
// qDebug("FastPreprocessor::run for %s produced [[%s]]", fileName.toUtf8().constData(), preprocessed.constData());
|
||||
std::swap(newDoc, _currentDoc);
|
||||
return preprocessed;
|
||||
}
|
||||
|
||||
void FastPreprocessor::sourceNeeded(unsigned, QString &fileName, IncludeType)
|
||||
{ mergeEnvironment(fileName); }
|
||||
void FastPreprocessor::sourceNeeded(unsigned line, QString &fileName, IncludeType)
|
||||
{
|
||||
Q_ASSERT(_currentDoc);
|
||||
_currentDoc->addIncludeFile(fileName, line);
|
||||
|
||||
mergeEnvironment(fileName);
|
||||
}
|
||||
|
||||
void FastPreprocessor::mergeEnvironment(const QString &fileName)
|
||||
{
|
||||
@@ -73,3 +81,56 @@ void FastPreprocessor::mergeEnvironment(const QString &fileName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FastPreprocessor::macroAdded(const Macro ¯o)
|
||||
{
|
||||
Q_ASSERT(_currentDoc);
|
||||
|
||||
_currentDoc->appendMacro(macro);
|
||||
}
|
||||
|
||||
static const Macro revision(const Snapshot &s, const Macro &m)
|
||||
{
|
||||
if (Document::Ptr d = s.document(m.fileName())) {
|
||||
Macro newMacro(m);
|
||||
newMacro.setFileRevision(d->revision());
|
||||
return newMacro;
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
void FastPreprocessor::passedMacroDefinitionCheck(unsigned offset, unsigned line, const Macro ¯o)
|
||||
{
|
||||
Q_ASSERT(_currentDoc);
|
||||
|
||||
_currentDoc->addMacroUse(revision(_snapshot, macro),
|
||||
offset, macro.name().length(), line,
|
||||
QVector<MacroArgumentReference>());
|
||||
}
|
||||
|
||||
void FastPreprocessor::failedMacroDefinitionCheck(unsigned offset, const ByteArrayRef &name)
|
||||
{
|
||||
Q_ASSERT(_currentDoc);
|
||||
|
||||
_currentDoc->addUndefinedMacroUse(QByteArray(name.start(), name.size()), offset);
|
||||
}
|
||||
|
||||
void FastPreprocessor::notifyMacroReference(unsigned offset, unsigned line, const Macro ¯o)
|
||||
{
|
||||
Q_ASSERT(_currentDoc);
|
||||
|
||||
_currentDoc->addMacroUse(revision(_snapshot, macro),
|
||||
offset, macro.name().length(), line,
|
||||
QVector<MacroArgumentReference>());
|
||||
}
|
||||
|
||||
void FastPreprocessor::startExpandingMacro(unsigned offset, unsigned line,
|
||||
const Macro ¯o,
|
||||
const QVector<MacroArgumentReference> &actuals)
|
||||
{
|
||||
Q_ASSERT(_currentDoc);
|
||||
|
||||
_currentDoc->addMacroUse(revision(_snapshot, macro),
|
||||
offset, macro.name().length(), line, actuals);
|
||||
}
|
||||
|
@@ -47,28 +47,29 @@ class CPLUSPLUS_EXPORT FastPreprocessor: public Client
|
||||
Snapshot _snapshot;
|
||||
Preprocessor _preproc;
|
||||
QSet<QString> _merged;
|
||||
Document::Ptr _currentDoc;
|
||||
|
||||
void mergeEnvironment(const QString &fileName);
|
||||
|
||||
public:
|
||||
FastPreprocessor(const Snapshot &snapshot);
|
||||
|
||||
QByteArray run(QString fileName, const QString &source);
|
||||
QByteArray run(Document::Ptr newDoc, const QString &source);
|
||||
|
||||
// CPlusPlus::Client
|
||||
virtual void sourceNeeded(unsigned, QString &fileName, IncludeType);
|
||||
virtual void sourceNeeded(unsigned line, QString &fileName, IncludeType);
|
||||
|
||||
virtual void macroAdded(const Macro &) {}
|
||||
virtual void macroAdded(const Macro &);
|
||||
|
||||
virtual void passedMacroDefinitionCheck(unsigned, unsigned, const Macro &) {}
|
||||
virtual void failedMacroDefinitionCheck(unsigned, const ByteArrayRef &) {}
|
||||
virtual void passedMacroDefinitionCheck(unsigned, unsigned, const Macro &);
|
||||
virtual void failedMacroDefinitionCheck(unsigned, const ByteArrayRef &);
|
||||
|
||||
virtual void notifyMacroReference(unsigned, unsigned, const Macro &) {}
|
||||
virtual void notifyMacroReference(unsigned, unsigned, const Macro &);
|
||||
|
||||
virtual void startExpandingMacro(unsigned,
|
||||
unsigned,
|
||||
const Macro &,
|
||||
const QVector<MacroArgumentReference> &) {}
|
||||
const QVector<MacroArgumentReference> &);
|
||||
virtual void stopExpandingMacro(unsigned, const Macro &) {}
|
||||
|
||||
virtual void startSkippingBlocks(unsigned) {}
|
||||
|
@@ -53,6 +53,7 @@ using namespace CPlusPlus;
|
||||
Macro::Macro()
|
||||
: _next(0),
|
||||
_hashcode(0),
|
||||
_fileRevision(0),
|
||||
_line(0),
|
||||
_offset(0),
|
||||
_length(0),
|
||||
|
@@ -95,6 +95,12 @@ public:
|
||||
void setFileName(const QString &fileName)
|
||||
{ _fileName = fileName; }
|
||||
|
||||
unsigned fileRevision() const
|
||||
{ return _fileRevision; }
|
||||
|
||||
void setFileRevision(unsigned fileRevision)
|
||||
{ _fileRevision = fileRevision; }
|
||||
|
||||
unsigned line() const
|
||||
{ return _line; }
|
||||
|
||||
@@ -154,6 +160,7 @@ private:
|
||||
QVector<PPToken> _definitionTokens;
|
||||
QVector<QByteArray> _formals;
|
||||
QString _fileName;
|
||||
unsigned _fileRevision;
|
||||
unsigned _line;
|
||||
unsigned _offset;
|
||||
unsigned _length;
|
||||
|
@@ -52,15 +52,6 @@ static bool shouldOverrideChar(QChar ch)
|
||||
}
|
||||
}
|
||||
|
||||
// disable gcc warning:
|
||||
//
|
||||
// qstring.h:1175:39: warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false
|
||||
//
|
||||
// caused by Q_ASSERT in QStringRef::at()
|
||||
#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL)
|
||||
# pragma GCC diagnostic ignored "-Wstrict-overflow"
|
||||
#endif
|
||||
|
||||
static bool isCompleteStringLiteral(const BackwardsScanner &tk, int index)
|
||||
{
|
||||
const QStringRef text = tk.textRef(index);
|
||||
|
@@ -812,6 +812,9 @@ bool Preprocessor::handleIdentifier(PPToken *tk)
|
||||
if (!expandFunctionlikeMacros()
|
||||
// Still expand if this originally started with an object-like macro.
|
||||
&& m_state.m_expansionStatus != Expanding) {
|
||||
m_client->notifyMacroReference(m_state.m_offsetRef + idTk.offset,
|
||||
idTk.lineno,
|
||||
*macro);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -142,7 +142,6 @@ ProjectExplorer::IOutputParser *CMakeBuildConfiguration::createOutputParser() co
|
||||
Utils::Environment CMakeBuildConfiguration::baseEnvironment() const
|
||||
{
|
||||
Utils::Environment env = BuildConfiguration::baseEnvironment();
|
||||
target()->kit()->addToEnvironment(env);
|
||||
return env;
|
||||
}
|
||||
|
||||
|
@@ -203,32 +203,23 @@ QList<GeneratorInfo> GeneratorInfo::generatorInfosFor(ProjectExplorer::Kit *k, N
|
||||
CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, Utils::Environment env)
|
||||
: m_cmakeManager(cmakeManager),
|
||||
m_sourceDirectory(sourceDirectory),
|
||||
m_creatingCbpFiles(false),
|
||||
m_environment(env),
|
||||
m_useNinja(false),
|
||||
m_kit(0)
|
||||
{
|
||||
int startid;
|
||||
if (hasInSourceBuild()) {
|
||||
startid = InSourcePageId;
|
||||
m_buildDirectory = m_sourceDirectory;
|
||||
addPage(new InSourceBuildPage(this));
|
||||
} else {
|
||||
startid = ShadowBuildPageId;
|
||||
m_buildDirectory = m_sourceDirectory + QLatin1String("-build");
|
||||
addPage(new ShadowBuildPage(this));
|
||||
}
|
||||
|
||||
setPage(InSourcePageId, new InSourceBuildPage(this));
|
||||
setPage(ShadowBuildPageId, new ShadowBuildPage(this));
|
||||
setPage(CMakeRunPageId, new CMakeRunPage(this));
|
||||
if (!m_cmakeManager->isCMakeExecutableValid())
|
||||
addPage(new ChooseCMakePage(this));
|
||||
|
||||
Utils::WizardProgress *wp = wizardProgress();
|
||||
Utils::WizardProgressItem *inSourceItem = wp->item(InSourcePageId);
|
||||
Utils::WizardProgressItem *shadowBuildItem = wp->item(ShadowBuildPageId);
|
||||
Utils::WizardProgressItem *cmakeRunItem = wp->item(CMakeRunPageId);
|
||||
inSourceItem->setNextItems(QList<Utils::WizardProgressItem *>() << cmakeRunItem);
|
||||
shadowBuildItem->setNextItems(QList<Utils::WizardProgressItem *>() << cmakeRunItem);
|
||||
addPage(new CMakeRunPage(this));
|
||||
|
||||
setStartId(startid);
|
||||
init();
|
||||
}
|
||||
|
||||
@@ -236,7 +227,6 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, CMake
|
||||
const BuildInfo &info)
|
||||
: m_cmakeManager(cmakeManager),
|
||||
m_sourceDirectory(info.sourceDirectory),
|
||||
m_creatingCbpFiles(true),
|
||||
m_environment(info.environment),
|
||||
m_useNinja(info.useNinja),
|
||||
m_kit(info.kit)
|
||||
@@ -255,6 +245,8 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, CMake
|
||||
m_buildDirectory = info.buildDirectory;
|
||||
addPage(new ShadowBuildPage(this, true));
|
||||
}
|
||||
if (!m_cmakeManager->isCMakeExecutableValid())
|
||||
addPage(new ChooseCMakePage(this));
|
||||
|
||||
addPage(new CMakeRunPage(this, rmode, info.buildDirectory));
|
||||
init();
|
||||
@@ -271,20 +263,6 @@ CMakeManager *CMakeOpenProjectWizard::cmakeManager() const
|
||||
return m_cmakeManager;
|
||||
}
|
||||
|
||||
int CMakeOpenProjectWizard::nextId() const
|
||||
{
|
||||
if (m_creatingCbpFiles)
|
||||
return QWizard::nextId();
|
||||
int cid = currentId();
|
||||
if (cid == InSourcePageId) {
|
||||
return CMakeRunPageId;
|
||||
} else if (cid == ShadowBuildPageId) {
|
||||
return CMakeRunPageId;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
bool CMakeOpenProjectWizard::hasInSourceBuild() const
|
||||
{
|
||||
QFileInfo fi(m_sourceDirectory + "/CMakeCache.txt");
|
||||
@@ -401,6 +379,61 @@ void ShadowBuildPage::buildDirectoryChanged()
|
||||
m_cmakeWizard->setBuildDirectory(m_pc->path());
|
||||
}
|
||||
|
||||
ChooseCMakePage::ChooseCMakePage(CMakeOpenProjectWizard *cmakeWizard)
|
||||
: QWizardPage(cmakeWizard), m_cmakeWizard(cmakeWizard)
|
||||
{
|
||||
QFormLayout *fl = new QFormLayout;
|
||||
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
setLayout(fl);
|
||||
|
||||
m_cmakeLabel = new QLabel;
|
||||
m_cmakeLabel->setWordWrap(true);
|
||||
fl->addRow(m_cmakeLabel);
|
||||
// Show a field for the user to enter
|
||||
m_cmakeExecutable = new Utils::PathChooser(this);
|
||||
m_cmakeExecutable->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
||||
fl->addRow("cmake Executable:", m_cmakeExecutable);
|
||||
|
||||
connect(m_cmakeExecutable, SIGNAL(editingFinished()),
|
||||
this, SLOT(cmakeExecutableChanged()));
|
||||
connect(m_cmakeExecutable, SIGNAL(browsingFinished()),
|
||||
this, SLOT(cmakeExecutableChanged()));
|
||||
|
||||
setTitle(tr("Choose Cmake Executable"));
|
||||
}
|
||||
|
||||
void ChooseCMakePage::updateErrorText()
|
||||
{
|
||||
QString cmakeExecutable = m_cmakeWizard->cmakeManager()->cmakeExecutable();
|
||||
if (m_cmakeWizard->cmakeManager()->isCMakeExecutableValid()) {
|
||||
m_cmakeLabel->setText(tr("The cmake executable is valid."));
|
||||
} else {
|
||||
QString text = tr("Please specify the path to the cmake executable. No cmake executable was found in the path.");
|
||||
if (!cmakeExecutable.isEmpty()) {
|
||||
QFileInfo fi(cmakeExecutable);
|
||||
if (!fi.exists())
|
||||
text += tr(" The cmake executable (%1) does not exist.").arg(cmakeExecutable);
|
||||
else if (!fi.isExecutable())
|
||||
text += tr(" The path %1 is not a executable.").arg(cmakeExecutable);
|
||||
else
|
||||
text += tr(" The path %1 is not a valid cmake.").arg(cmakeExecutable);
|
||||
}
|
||||
m_cmakeLabel->setText(text);
|
||||
}
|
||||
}
|
||||
|
||||
void ChooseCMakePage::cmakeExecutableChanged()
|
||||
{
|
||||
m_cmakeWizard->cmakeManager()->setCMakeExecutable(m_cmakeExecutable->path());
|
||||
updateErrorText();
|
||||
emit completeChanged();
|
||||
}
|
||||
|
||||
bool ChooseCMakePage::isComplete() const
|
||||
{
|
||||
return m_cmakeWizard->cmakeManager()->isCMakeExecutableValid();
|
||||
}
|
||||
|
||||
CMakeRunPage::CMakeRunPage(CMakeOpenProjectWizard *cmakeWizard, Mode mode, const QString &buildDirectory)
|
||||
: QWizardPage(cmakeWizard),
|
||||
m_cmakeWizard(cmakeWizard),
|
||||
@@ -423,30 +456,6 @@ void CMakeRunPage::initWidgets()
|
||||
|
||||
fl->addRow(m_descriptionLabel);
|
||||
|
||||
if (m_cmakeWizard->cmakeManager()->isCMakeExecutableValid()) {
|
||||
m_cmakeExecutable = 0;
|
||||
} else {
|
||||
QString text = tr("Please specify the path to the cmake executable. No cmake executable was found in the path.");
|
||||
QString cmakeExecutable = m_cmakeWizard->cmakeManager()->cmakeExecutable();
|
||||
if (!cmakeExecutable.isEmpty()) {
|
||||
QFileInfo fi(cmakeExecutable);
|
||||
if (!fi.exists())
|
||||
text += tr(" The cmake executable (%1) does not exist.").arg(cmakeExecutable);
|
||||
else if (!fi.isExecutable())
|
||||
text += tr(" The path %1 is not a executable.").arg(cmakeExecutable);
|
||||
else
|
||||
text += tr(" The path %1 is not a valid cmake.").arg(cmakeExecutable);
|
||||
}
|
||||
|
||||
QLabel *cmakeLabel = new QLabel(text);
|
||||
cmakeLabel->setWordWrap(true);
|
||||
fl->addRow(cmakeLabel);
|
||||
// Show a field for the user to enter
|
||||
m_cmakeExecutable = new Utils::PathChooser(this);
|
||||
m_cmakeExecutable->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
||||
fl->addRow("cmake Executable:", m_cmakeExecutable);
|
||||
}
|
||||
|
||||
// Run CMake Line (with arguments)
|
||||
m_argumentsLineEdit = new Utils::FancyLineEdit(this);
|
||||
m_argumentsLineEdit->setHistoryCompleter(QLatin1String("CMakeArgumentsLineEdit"));
|
||||
@@ -612,10 +621,6 @@ bool CMakeRunPage::validatePage()
|
||||
|
||||
void CMakeRunPage::runCMake()
|
||||
{
|
||||
if (m_cmakeExecutable)
|
||||
// We asked the user for the cmake executable
|
||||
m_cmakeWizard->cmakeManager()->setCMakeExecutable(m_cmakeExecutable->path());
|
||||
|
||||
m_optionalCMake = false;
|
||||
m_complete = false;
|
||||
|
||||
|
@@ -62,12 +62,6 @@ class CMakeOpenProjectWizard : public Utils::Wizard
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum PageId {
|
||||
InSourcePageId,
|
||||
ShadowBuildPageId,
|
||||
CMakeRunPageId
|
||||
};
|
||||
|
||||
enum Mode {
|
||||
Nothing,
|
||||
NeedToCreate,
|
||||
@@ -105,8 +99,6 @@ public:
|
||||
/// Also used to change the build directory of one buildconfiguration or create a new buildconfiguration
|
||||
CMakeOpenProjectWizard(CMakeManager *cmakeManager, Mode mode, const BuildInfo &info);
|
||||
|
||||
|
||||
virtual int nextId() const;
|
||||
QString buildDirectory() const;
|
||||
QString sourceDirectory() const;
|
||||
void setBuildDirectory(const QString &directory);
|
||||
@@ -127,7 +119,6 @@ private:
|
||||
QString m_buildDirectory;
|
||||
QString m_sourceDirectory;
|
||||
QString m_arguments;
|
||||
bool m_creatingCbpFiles;
|
||||
Utils::Environment m_environment;
|
||||
bool m_useNinja;
|
||||
ProjectExplorer::Kit *m_kit;
|
||||
@@ -154,6 +145,22 @@ private:
|
||||
Utils::PathChooser *m_pc;
|
||||
};
|
||||
|
||||
class ChooseCMakePage : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ChooseCMakePage(CMakeOpenProjectWizard *cmakeWizard);
|
||||
|
||||
virtual bool isComplete() const;
|
||||
public slots:
|
||||
void cmakeExecutableChanged();
|
||||
private:
|
||||
void updateErrorText();
|
||||
QLabel *m_cmakeLabel;
|
||||
CMakeOpenProjectWizard *m_cmakeWizard;
|
||||
Utils::PathChooser *m_cmakeExecutable;
|
||||
};
|
||||
|
||||
class CMakeRunPage : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -178,7 +185,6 @@ private:
|
||||
QPushButton *m_runCMake;
|
||||
Utils::QtcProcess *m_cmakeProcess;
|
||||
Utils::FancyLineEdit *m_argumentsLineEdit;
|
||||
Utils::PathChooser *m_cmakeExecutable;
|
||||
QComboBox *m_generatorComboBox;
|
||||
QLabel *m_descriptionLabel;
|
||||
QLabel *m_exitCodeLabel;
|
||||
|
@@ -257,7 +257,7 @@ void OutputWindow::appendText(const QString &textIn, const QTextCharFormat &form
|
||||
{
|
||||
QString text = textIn;
|
||||
text.remove(QLatin1Char('\r'));
|
||||
if (m_maxLineCount > 0 && document()->blockCount() > m_maxLineCount)
|
||||
if (m_maxLineCount > 0 && document()->blockCount() >= m_maxLineCount)
|
||||
return;
|
||||
const bool atBottom = isScrollbarAtBottom();
|
||||
QTextCursor cursor = QTextCursor(document());
|
||||
@@ -265,10 +265,10 @@ void OutputWindow::appendText(const QString &textIn, const QTextCharFormat &form
|
||||
cursor.beginEditBlock();
|
||||
cursor.insertText(doNewlineEnfocement(text), format);
|
||||
|
||||
if (m_maxLineCount > 0 && document()->blockCount() > m_maxLineCount) {
|
||||
if (m_maxLineCount > 0 && document()->blockCount() >= m_maxLineCount) {
|
||||
QTextCharFormat tmp;
|
||||
tmp.setFontWeight(QFont::Bold);
|
||||
cursor.insertText(tr("Additional output omitted\n"), tmp);
|
||||
cursor.insertText(doNewlineEnfocement(tr("Additional output omitted\n")), tmp);
|
||||
}
|
||||
|
||||
cursor.endEditBlock();
|
||||
|
@@ -2140,10 +2140,7 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source)
|
||||
if (! semanticInfo.doc) {
|
||||
semanticInfo.snapshot = source.snapshot;
|
||||
if (source.snapshot.contains(source.fileName)) {
|
||||
const QByteArray &preprocessedCode =
|
||||
source.snapshot.preprocessedCode(source.code, source.fileName);
|
||||
Document::Ptr doc =
|
||||
source.snapshot.documentFromSource(preprocessedCode, source.fileName);
|
||||
Document::Ptr doc = source.snapshot.preprocessedDocument(source.code, source.fileName);
|
||||
doc->control()->setTopLevelDeclarationProcessor(this);
|
||||
doc->check();
|
||||
semanticInfo.doc = doc;
|
||||
|
@@ -128,14 +128,12 @@ public:
|
||||
return usages; // skip this document, it's not using symbolId.
|
||||
}
|
||||
Document::Ptr doc;
|
||||
QByteArray source;
|
||||
const QString unpreprocessedSource = getSource(fileName, workingCopy);
|
||||
|
||||
if (symbolDocument && fileName == symbolDocument->fileName()) {
|
||||
doc = symbolDocument;
|
||||
} else {
|
||||
source = snapshot.preprocessedCode(unpreprocessedSource, fileName);
|
||||
doc = snapshot.documentFromSource(source, fileName);
|
||||
doc = snapshot.preprocessedDocument(unpreprocessedSource, fileName);
|
||||
doc->tokenize();
|
||||
}
|
||||
|
||||
@@ -458,10 +456,8 @@ bool CppFindReferences::findSymbol(CppFindReferencesParameters *parameters,
|
||||
Document::Ptr newSymbolDocument = snapshot.document(symbolFile);
|
||||
// document is not parsed and has no bindings yet, do it
|
||||
QString source = getSource(newSymbolDocument->fileName(), _modelManager->workingCopy());
|
||||
const QByteArray &preprocessedCode =
|
||||
snapshot.preprocessedCode(source, newSymbolDocument->fileName());
|
||||
Document::Ptr doc =
|
||||
snapshot.documentFromSource(preprocessedCode, newSymbolDocument->fileName());
|
||||
snapshot.preprocessedDocument(source, newSymbolDocument->fileName());
|
||||
doc->check();
|
||||
|
||||
// construct id of old symbol
|
||||
@@ -563,21 +559,31 @@ public:
|
||||
QList<Usage> operator()(const QString &fileName)
|
||||
{
|
||||
QList<Usage> usages;
|
||||
Document::Ptr doc = snapshot.document(fileName);
|
||||
QString source;
|
||||
|
||||
_Lrestart:
|
||||
if (future->isPaused())
|
||||
future->waitForResume();
|
||||
if (future->isCanceled())
|
||||
return usages;
|
||||
|
||||
const Document::Ptr &doc = snapshot.document(fileName);
|
||||
QByteArray source;
|
||||
|
||||
usages.clear();
|
||||
foreach (const Document::MacroUse &use, doc->macroUses()) {
|
||||
const Macro &useMacro = use.macro();
|
||||
if (useMacro.line() == macro.line()
|
||||
&& useMacro.fileName() == macro.fileName())
|
||||
{
|
||||
|
||||
if (useMacro.fileName() == macro.fileName()) { // Check if this is a match, but possibly against an outdated document.
|
||||
if (macro.fileRevision() > useMacro.fileRevision()) {
|
||||
// yes, it is outdated, so re-preprocess and start from scratch for this file.
|
||||
source = getSource(fileName, workingCopy).toLatin1();
|
||||
doc = snapshot.preprocessedDocument(source, fileName);
|
||||
goto _Lrestart;
|
||||
}
|
||||
}
|
||||
|
||||
if (useMacro.fileName() == macro.fileName() && macro.name() == useMacro.name()) {
|
||||
if (source.isEmpty())
|
||||
source = getSource(fileName, workingCopy).toLatin1(); // ### FIXME: Encoding?
|
||||
source = getSource(fileName, workingCopy);
|
||||
|
||||
unsigned lineStart;
|
||||
const QString &lineSource = matchingLine(use.begin(), source, &lineStart);
|
||||
@@ -591,30 +597,18 @@ public:
|
||||
return usages;
|
||||
}
|
||||
|
||||
// ### FIXME: Pretty close to FindUsages::matchingLine.
|
||||
static QString matchingLine(unsigned position, const QByteArray &source,
|
||||
static QString matchingLine(unsigned position, const QString &source,
|
||||
unsigned *lineStart = 0)
|
||||
{
|
||||
const char *beg = source.constData();
|
||||
const char *start = beg + position;
|
||||
for (; start != beg - 1; --start) {
|
||||
if (*start == '\n')
|
||||
break;
|
||||
}
|
||||
|
||||
++start;
|
||||
|
||||
const char *end = start + 1;
|
||||
for (; *end; ++end) {
|
||||
if (*end == '\n')
|
||||
break;
|
||||
}
|
||||
int lineBegin = source.lastIndexOf(QLatin1Char('\n'), position) + 1;
|
||||
int lineEnd = source.indexOf(QLatin1Char('\n'), position);
|
||||
if (lineEnd == -1)
|
||||
lineEnd = source.length();
|
||||
|
||||
if (lineStart)
|
||||
*lineStart = start - beg;
|
||||
*lineStart = lineBegin;
|
||||
|
||||
// ### FIXME: Encoding?
|
||||
const QString matchingLine = QString::fromUtf8(start, end - start);
|
||||
const QString matchingLine = source.mid(lineBegin, lineEnd - lineBegin);
|
||||
return matchingLine;
|
||||
}
|
||||
};
|
||||
@@ -636,7 +630,6 @@ static void findMacroUses_helper(QFutureInterface<Usage> &future,
|
||||
files.removeDuplicates();
|
||||
|
||||
future.setProgressRange(0, files.size());
|
||||
|
||||
FindMacroUsesInFile process(workingCopy, snapshot, macro, &future);
|
||||
UpdateUI reduce(&future);
|
||||
// This thread waits for blockingMappedReduced to finish, so reduce the pool's used thread count
|
||||
@@ -678,15 +671,11 @@ void CppFindReferences::findMacroUses(const Macro ¯o, const QString &replace
|
||||
|
||||
// add the macro definition itself
|
||||
{
|
||||
// ### FIXME: Encoding?
|
||||
const QByteArray &source = getSource(macro.fileName(), workingCopy).toLatin1();
|
||||
int lineBegin = source.lastIndexOf('\n', macro.offset()) + 1;
|
||||
int lineEnd = source.indexOf('\n', macro.offset());
|
||||
if (lineEnd == -1)
|
||||
lineEnd = source.length();
|
||||
const QByteArray line = source.mid(lineBegin, lineEnd - lineBegin);
|
||||
const QString &source = getSource(macro.fileName(), workingCopy);
|
||||
unsigned lineStart;
|
||||
const QString line = FindMacroUsesInFile::matchingLine(macro.offset(), source, &lineStart);
|
||||
search->addResult(macro.fileName(), macro.line(), line,
|
||||
line.indexOf(macro.name()), macro.name().length());
|
||||
macro.offset() - lineStart, macro.name().length());
|
||||
}
|
||||
|
||||
QFuture<Usage> result;
|
||||
|
@@ -480,12 +480,19 @@ void CppPreprocessor::macroAdded(const Macro ¯o)
|
||||
m_currentDoc->appendMacro(macro);
|
||||
}
|
||||
|
||||
static inline const Macro revision(const CppModelManagerInterface::WorkingCopy &s, const Macro ¯o)
|
||||
{
|
||||
Macro newMacro(macro);
|
||||
newMacro.setFileRevision(s.get(macro.fileName()).second);
|
||||
return newMacro;
|
||||
}
|
||||
|
||||
void CppPreprocessor::passedMacroDefinitionCheck(unsigned offset, unsigned line, const Macro ¯o)
|
||||
{
|
||||
if (! m_currentDoc)
|
||||
return;
|
||||
|
||||
m_currentDoc->addMacroUse(macro, offset, macro.name().length(), line,
|
||||
m_currentDoc->addMacroUse(revision(m_workingCopy, macro), offset, macro.name().length(), line,
|
||||
QVector<MacroArgumentReference>());
|
||||
}
|
||||
|
||||
@@ -502,7 +509,7 @@ void CppPreprocessor::notifyMacroReference(unsigned offset, unsigned line, const
|
||||
if (! m_currentDoc)
|
||||
return;
|
||||
|
||||
m_currentDoc->addMacroUse(macro, offset, macro.name().length(), line,
|
||||
m_currentDoc->addMacroUse(revision(m_workingCopy, macro), offset, macro.name().length(), line,
|
||||
QVector<MacroArgumentReference>());
|
||||
}
|
||||
|
||||
@@ -513,7 +520,7 @@ void CppPreprocessor::startExpandingMacro(unsigned offset, unsigned line,
|
||||
if (! m_currentDoc)
|
||||
return;
|
||||
|
||||
m_currentDoc->addMacroUse(macro, offset, macro.name().length(), line, actuals);
|
||||
m_currentDoc->addMacroUse(revision(m_workingCopy, macro), offset, macro.name().length(), line, actuals);
|
||||
}
|
||||
|
||||
void CppPreprocessor::stopExpandingMacro(unsigned, const Macro &)
|
||||
|
@@ -156,8 +156,7 @@ Document::Ptr CppRefactoringFile::cppDocument() const
|
||||
const QString name = fileName();
|
||||
const Snapshot &snapshot = data()->m_snapshot;
|
||||
|
||||
const QByteArray contents = snapshot.preprocessedCode(source, name);
|
||||
m_cppDocument = snapshot.documentFromSource(contents, name);
|
||||
m_cppDocument = snapshot.preprocessedDocument(source, name);
|
||||
m_cppDocument->check();
|
||||
}
|
||||
|
||||
|
@@ -2626,9 +2626,7 @@ static CPlusPlus::Document::Ptr getParsedDocument(const QString &fileName,
|
||||
src = QString::fromLocal8Bit(reader.data()); // ### FIXME encoding
|
||||
}
|
||||
|
||||
QByteArray source = snapshot.preprocessedCode(src, fileName);
|
||||
|
||||
CPlusPlus::Document::Ptr doc = snapshot.documentFromSource(source, fileName);
|
||||
CPlusPlus::Document::Ptr doc = snapshot.preprocessedDocument(src, fileName);
|
||||
doc->parse();
|
||||
return doc;
|
||||
}
|
||||
|
@@ -207,7 +207,7 @@ QString StartApplicationParameters::displayName() const
|
||||
|
||||
void StartApplicationParameters::toSettings(QSettings *settings) const
|
||||
{
|
||||
settings->setValue(_("LastProfileId"), kitId.toString());
|
||||
settings->setValue(_("LastKitId"), kitId.toString());
|
||||
settings->setValue(_("LastServerPort"), serverPort);
|
||||
settings->setValue(_("LastExternalExecutable"), localExecutable);
|
||||
settings->setValue(_("LastExternalExecutableArguments"), processArgs);
|
||||
@@ -220,7 +220,7 @@ void StartApplicationParameters::toSettings(QSettings *settings) const
|
||||
|
||||
void StartApplicationParameters::fromSettings(const QSettings *settings)
|
||||
{
|
||||
const QString kitIdString = settings->value(_("LastProfileId")).toString();
|
||||
const QString kitIdString = settings->value(_("LastKitId")).toString();
|
||||
kitId = kitIdString.isEmpty() ? Id() : Id(kitIdString);
|
||||
serverPort = settings->value(_("LastServerPort")).toUInt();
|
||||
localExecutable = settings->value(_("LastExternalExecutable")).toString();
|
||||
@@ -264,7 +264,7 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent)
|
||||
|
||||
d->runInTerminalCheckBox = new QCheckBox(this);
|
||||
|
||||
d->kitChooser = new DebuggerKitChooser(DebuggerKitChooser::LocalDebugging, this);
|
||||
d->kitChooser = new KitChooser(this);
|
||||
d->kitChooser->populate();
|
||||
|
||||
d->breakAtMainCheckBox = new QCheckBox(this);
|
||||
@@ -384,10 +384,9 @@ bool StartApplicationDialog::run(QWidget *parent, QSettings *settings, DebuggerS
|
||||
StartApplicationDialog dialog(parent);
|
||||
dialog.setHistory(history);
|
||||
dialog.setParameters(history.back());
|
||||
if (attachRemote) {
|
||||
if (!attachRemote) {
|
||||
dialog.d->serverStartScriptPathChooser->setVisible(false);
|
||||
dialog.d->serverStartScriptLabel->setVisible(false);
|
||||
} else {
|
||||
dialog.d->serverPortSpinBox->setVisible(false);
|
||||
dialog.d->serverPortLabel->setVisible(false);
|
||||
}
|
||||
@@ -423,8 +422,8 @@ bool StartApplicationDialog::run(QWidget *parent, QSettings *settings, DebuggerS
|
||||
sp->serverStartScript = newParameters.serverStartScript;
|
||||
sp->debugInfoLocation = newParameters.debugInfoLocation;
|
||||
|
||||
bool isLocal = DeviceKitInformation::device(kit)->type()
|
||||
== ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
|
||||
IDevice::ConstPtr dev = DeviceKitInformation::device(kit);
|
||||
bool isLocal = !dev || (dev->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
|
||||
if (!attachRemote)
|
||||
sp->startMode = isLocal ? StartExternal : StartRemoteProcess;
|
||||
return true;
|
||||
|
@@ -64,13 +64,12 @@ static const char dgbToolsDownloadLink64C[] = "http://www.microsoft.com/whdc/dev
|
||||
// DebuggerKitConfigWidget:
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
DebuggerKitConfigWidget::DebuggerKitConfigWidget(ProjectExplorer::Kit *k,
|
||||
DebuggerKitConfigWidget::DebuggerKitConfigWidget(ProjectExplorer::Kit *workingCopy,
|
||||
const DebuggerKitInformation *ki,
|
||||
QWidget *parent) :
|
||||
ProjectExplorer::KitConfigWidget(parent),
|
||||
m_kit(k),
|
||||
m_kit(workingCopy),
|
||||
m_info(ki),
|
||||
m_dirty(false),
|
||||
m_label(new QLabel(this)),
|
||||
m_button(new QPushButton(tr("Manage..."), this))
|
||||
{
|
||||
@@ -88,7 +87,7 @@ DebuggerKitConfigWidget::DebuggerKitConfigWidget(ProjectExplorer::Kit *k,
|
||||
connect(changeAction, SIGNAL(triggered()), this, SLOT(showDialog()));
|
||||
m_button->setMenu(buttonMenu);
|
||||
|
||||
discard();
|
||||
refresh();
|
||||
}
|
||||
|
||||
QWidget *DebuggerKitConfigWidget::buttonWidget() const
|
||||
@@ -106,45 +105,23 @@ void DebuggerKitConfigWidget::makeReadOnly()
|
||||
m_button->setEnabled(false);
|
||||
}
|
||||
|
||||
void DebuggerKitConfigWidget::apply()
|
||||
void DebuggerKitConfigWidget::refresh()
|
||||
{
|
||||
DebuggerKitInformation::setDebuggerItem(m_kit, m_item);
|
||||
m_dirty = false;
|
||||
}
|
||||
|
||||
void DebuggerKitConfigWidget::discard()
|
||||
{
|
||||
doSetItem(DebuggerKitInformation::debuggerItem(m_kit));
|
||||
m_dirty = false;
|
||||
m_label->setText(DebuggerKitInformation::userOutput(DebuggerKitInformation::debuggerItem(m_kit)));
|
||||
}
|
||||
|
||||
void DebuggerKitConfigWidget::autoDetectDebugger()
|
||||
{
|
||||
setItem(DebuggerKitInformation::autoDetectItem(m_kit));
|
||||
}
|
||||
|
||||
void DebuggerKitConfigWidget::doSetItem(const DebuggerKitInformation::DebuggerItem &item)
|
||||
{
|
||||
m_item = item;
|
||||
m_label->setText(DebuggerKitInformation::userOutput(m_item));
|
||||
}
|
||||
|
||||
void DebuggerKitConfigWidget::setItem(const DebuggerKitInformation::DebuggerItem &item)
|
||||
{
|
||||
if (m_item != item) {
|
||||
m_dirty = true;
|
||||
doSetItem(item);
|
||||
emit dirty();
|
||||
}
|
||||
DebuggerKitInformation::setDebuggerItem(m_kit, DebuggerKitInformation::autoDetectItem(m_kit));
|
||||
}
|
||||
|
||||
void DebuggerKitConfigWidget::showDialog()
|
||||
{
|
||||
DebuggerKitConfigDialog dialog;
|
||||
dialog.setWindowTitle(tr("Debugger for \"%1\"").arg(m_kit->displayName()));
|
||||
dialog.setDebuggerItem(m_item);
|
||||
dialog.setDebuggerItem(DebuggerKitInformation::debuggerItem(m_kit));
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
setItem(dialog.item());
|
||||
DebuggerKitInformation::setDebuggerItem(m_kit, dialog.item());
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
@@ -61,7 +61,7 @@ class DebuggerKitConfigWidget : public ProjectExplorer::KitConfigWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DebuggerKitConfigWidget(ProjectExplorer::Kit *k,
|
||||
DebuggerKitConfigWidget(ProjectExplorer::Kit *workingCopy,
|
||||
const DebuggerKitInformation *ki,
|
||||
QWidget *parent = 0);
|
||||
|
||||
@@ -69,9 +69,8 @@ public:
|
||||
|
||||
void makeReadOnly();
|
||||
|
||||
void apply();
|
||||
void discard();
|
||||
bool isDirty() const { return m_dirty; }
|
||||
void refresh();
|
||||
|
||||
QWidget *buttonWidget() const;
|
||||
|
||||
private slots:
|
||||
@@ -79,13 +78,8 @@ private slots:
|
||||
void showDialog();
|
||||
|
||||
private:
|
||||
void setItem(const DebuggerKitInformation::DebuggerItem &item);
|
||||
void doSetItem(const DebuggerKitInformation::DebuggerItem &item);
|
||||
|
||||
ProjectExplorer::Kit *m_kit;
|
||||
const DebuggerKitInformation *m_info;
|
||||
DebuggerKitInformation::DebuggerItem m_item;
|
||||
bool m_dirty;
|
||||
QLabel *m_label;
|
||||
QPushButton *m_button;
|
||||
};
|
||||
|
@@ -62,7 +62,7 @@ public:
|
||||
QVariant defaultValue(ProjectExplorer::Kit *k) const
|
||||
{ return DebuggerKitInformation::itemToVariant(DebuggerKitInformation::autoDetectItem(k)); }
|
||||
|
||||
QList<ProjectExplorer::Task> validate(ProjectExplorer::Kit *k) const
|
||||
QList<ProjectExplorer::Task> validate(const ProjectExplorer::Kit *k) const
|
||||
{ return DebuggerKitInformation::validateDebugger(k); }
|
||||
|
||||
static QList<ProjectExplorer::Task> validateDebugger(const ProjectExplorer::Kit *k);
|
||||
|
@@ -644,6 +644,9 @@ void GdbEngine::handleResponse(const QByteArray &buff)
|
||||
if (!handler->isOneShot(id))
|
||||
handler->removeAlienBreakpoint(id);
|
||||
}
|
||||
} else if (asyncClass == "cmd-param-changed") {
|
||||
// New since 2012-08-09
|
||||
// "{param="debug remote",value="1"}"
|
||||
} else {
|
||||
qDebug() << "IGNORED ASYNC OUTPUT"
|
||||
<< asyncClass << result.toString();
|
||||
|
@@ -123,6 +123,7 @@ SelectRemoteFileDialog::SelectRemoteFileDialog(QWidget *parent)
|
||||
m_fileSystemView = new QTreeView(this);
|
||||
m_fileSystemView->setModel(&m_model);
|
||||
m_fileSystemView->setSortingEnabled(true);
|
||||
m_fileSystemView->sortByColumn(1, Qt::AscendingOrder);
|
||||
m_fileSystemView->setUniformRowHeights(true);
|
||||
m_fileSystemView->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
m_fileSystemView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
|
@@ -511,9 +511,7 @@ static Document::Ptr getParsedDocument(const QString &fileName, CppModelManagerI
|
||||
src = QString::fromLocal8Bit(reader.data()); // ### FIXME encoding
|
||||
}
|
||||
|
||||
QByteArray source = snapshot.preprocessedCode(src, fileName);
|
||||
|
||||
Document::Ptr doc = snapshot.documentFromSource(source, fileName);
|
||||
Document::Ptr doc = snapshot.preprocessedDocument(src, fileName);
|
||||
doc->check();
|
||||
snapshot.insert(doc);
|
||||
return doc;
|
||||
|
@@ -36,6 +36,7 @@
|
||||
#include "kitmanager.h"
|
||||
#include "target.h"
|
||||
#include "project.h"
|
||||
#include "kit.h"
|
||||
|
||||
#include <coreplugin/variablemanager.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
@@ -203,6 +204,7 @@ Utils::Environment BuildConfiguration::baseEnvironment() const
|
||||
Utils::Environment result;
|
||||
if (useSystemEnvironment())
|
||||
result = Utils::Environment::systemEnvironment();
|
||||
target()->kit()->addToEnvironment(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@@ -44,6 +44,7 @@ public:
|
||||
const DeviceManager *deviceManager;
|
||||
QList<IDevice::ConstPtr> devices;
|
||||
QList<Core::Id> filter;
|
||||
Core::Id typeToKeep;
|
||||
};
|
||||
} // namespace Internal
|
||||
|
||||
@@ -69,6 +70,14 @@ void DeviceManagerModel::setFilter(const QList<Core::Id> filter)
|
||||
handleDeviceListChanged();
|
||||
}
|
||||
|
||||
void DeviceManagerModel::setTypeFilter(const Core::Id &type)
|
||||
{
|
||||
if (d->typeToKeep == type)
|
||||
return;
|
||||
d->typeToKeep = type;
|
||||
handleDeviceListChanged();
|
||||
}
|
||||
|
||||
void DeviceManagerModel::updateDevice(Core::Id id)
|
||||
{
|
||||
handleDeviceUpdated(id);
|
||||
@@ -93,7 +102,6 @@ int DeviceManagerModel::indexOf(IDevice::ConstPtr dev) const
|
||||
{
|
||||
if (dev.isNull())
|
||||
return -1;
|
||||
|
||||
for (int i = 0; i < d->devices.count(); ++i) {
|
||||
IDevice::ConstPtr current = d->devices.at(i);
|
||||
if (current->id() == dev->id())
|
||||
@@ -104,8 +112,14 @@ int DeviceManagerModel::indexOf(IDevice::ConstPtr dev) const
|
||||
|
||||
void DeviceManagerModel::handleDeviceAdded(Core::Id id)
|
||||
{
|
||||
if (d->filter.contains(id))
|
||||
return;
|
||||
IDevice::ConstPtr dev = d->deviceManager->find(id);
|
||||
if (!matchesTypeFilter(dev))
|
||||
return;
|
||||
|
||||
beginInsertRows(QModelIndex(), rowCount(), rowCount());
|
||||
d->devices << d->deviceManager->find(id);
|
||||
d->devices << dev;
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
@@ -136,6 +150,8 @@ void DeviceManagerModel::handleDeviceListChanged()
|
||||
IDevice::ConstPtr dev = d->deviceManager->deviceAt(i);
|
||||
if (d->filter.contains(dev->id()))
|
||||
continue;
|
||||
if (!matchesTypeFilter(dev))
|
||||
continue;
|
||||
d->devices << dev;
|
||||
}
|
||||
endResetModel();
|
||||
@@ -164,6 +180,11 @@ QVariant DeviceManagerModel::data(const QModelIndex &index, int role) const
|
||||
return name;
|
||||
}
|
||||
|
||||
bool DeviceManagerModel::matchesTypeFilter(const IDevice::ConstPtr &dev) const
|
||||
{
|
||||
return !d->typeToKeep.isValid() || dev->type() == d->typeToKeep;
|
||||
}
|
||||
|
||||
int DeviceManagerModel::indexForId(Core::Id id) const
|
||||
{
|
||||
for (int i = 0; i < d->devices.count(); ++i) {
|
||||
@@ -171,7 +192,6 @@ int DeviceManagerModel::indexForId(Core::Id id) const
|
||||
return i;
|
||||
}
|
||||
|
||||
qWarning("%s: Invalid id %s.", Q_FUNC_INFO, qPrintable(id.toString()));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@@ -49,6 +49,7 @@ public:
|
||||
~DeviceManagerModel();
|
||||
|
||||
void setFilter(const QList<Core::Id> filter);
|
||||
void setTypeFilter(const Core::Id &type);
|
||||
|
||||
IDevice::ConstPtr device(int pos) const;
|
||||
Core::Id deviceId(int pos) const;
|
||||
@@ -66,6 +67,7 @@ private slots:
|
||||
|
||||
private:
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
bool matchesTypeFilter(const IDevice::ConstPtr &dev) const;
|
||||
|
||||
Internal::DeviceManagerModelPrivate * const d;
|
||||
};
|
||||
|
@@ -35,6 +35,8 @@
|
||||
#include "project.h"
|
||||
#include "toolchainmanager.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QIcon>
|
||||
#include <QStyle>
|
||||
@@ -53,6 +55,22 @@ const char ICON_KEY[] = "PE.Profile.Icon";
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Helper:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
static QString cleanName(const QString &name)
|
||||
{
|
||||
QString result = name;
|
||||
result.replace(QRegExp("\\W"), QLatin1String("_"));
|
||||
result.replace(QRegExp("_+"), "_"); // compact _
|
||||
result.remove(QRegExp("^_*")); // remove leading _
|
||||
result.remove(QRegExp("_+$")); // remove trailing _
|
||||
if (result.isEmpty())
|
||||
result = QLatin1String("unknown");
|
||||
return result;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// KitPrivate
|
||||
// -------------------------------------------------------------------------
|
||||
@@ -62,11 +80,16 @@ namespace Internal {
|
||||
class KitPrivate
|
||||
{
|
||||
public:
|
||||
KitPrivate() :
|
||||
m_id(QUuid::createUuid().toString().toLatin1().constData()),
|
||||
KitPrivate(Core::Id id) :
|
||||
m_id(id),
|
||||
m_autodetected(false),
|
||||
m_isValid(true)
|
||||
{ }
|
||||
m_isValid(true),
|
||||
m_nestedBlockingLevel(0),
|
||||
m_mustNotify(false)
|
||||
{
|
||||
if (!id.isValid())
|
||||
m_id = Core::Id(QUuid::createUuid().toString().toLatin1().constData());
|
||||
}
|
||||
|
||||
QString m_displayName;
|
||||
Core::Id m_id;
|
||||
@@ -74,6 +97,8 @@ public:
|
||||
bool m_isValid;
|
||||
QIcon m_icon;
|
||||
QString m_iconPath;
|
||||
int m_nestedBlockingLevel;
|
||||
bool m_mustNotify;
|
||||
|
||||
QHash<Core::Id, QVariant> m_data;
|
||||
};
|
||||
@@ -84,12 +109,13 @@ public:
|
||||
// Kit:
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Kit::Kit() :
|
||||
d(new Internal::KitPrivate)
|
||||
Kit::Kit(Core::Id id) :
|
||||
d(new Internal::KitPrivate(id))
|
||||
{
|
||||
KitManager *stm = KitManager::instance();
|
||||
KitGuard g(this);
|
||||
foreach (KitInformation *sti, stm->kitInformation())
|
||||
d->m_data.insert(sti->dataId(), sti->defaultValue(this));
|
||||
setValue(sti->dataId(), sti->defaultValue(this));
|
||||
|
||||
setDisplayName(QCoreApplication::translate("ProjectExplorer::Kit", "Unnamed"));
|
||||
setIconPath(QLatin1String(":///DESKTOP///"));
|
||||
@@ -100,6 +126,21 @@ Kit::~Kit()
|
||||
delete d;
|
||||
}
|
||||
|
||||
void Kit::blockNotification()
|
||||
{
|
||||
++d->m_nestedBlockingLevel;
|
||||
}
|
||||
|
||||
void Kit::unblockNotification()
|
||||
{
|
||||
--d->m_nestedBlockingLevel;
|
||||
if (d->m_nestedBlockingLevel > 0)
|
||||
return;
|
||||
if (d->m_mustNotify)
|
||||
kitUpdated();
|
||||
d->m_mustNotify = false;
|
||||
}
|
||||
|
||||
Kit *Kit::clone(bool keepName) const
|
||||
{
|
||||
Kit *k = new Kit;
|
||||
@@ -116,20 +157,45 @@ Kit *Kit::clone(bool keepName) const
|
||||
return k;
|
||||
}
|
||||
|
||||
void Kit::copyFrom(const Kit *k)
|
||||
{
|
||||
KitGuard g(this);
|
||||
d->m_data = k->d->m_data;
|
||||
d->m_iconPath = k->d->m_iconPath;
|
||||
d->m_icon = k->d->m_icon;
|
||||
d->m_autodetected = k->d->m_autodetected;
|
||||
d->m_displayName = k->d->m_displayName;
|
||||
}
|
||||
|
||||
bool Kit::isValid() const
|
||||
{
|
||||
return d->m_id.isValid() && d->m_isValid;
|
||||
}
|
||||
|
||||
QList<Task> Kit::validate()
|
||||
QList<Task> Kit::validate() const
|
||||
{
|
||||
QList<Task> result;
|
||||
QList<KitInformation *> infoList = KitManager::instance()->kitInformation();
|
||||
foreach (KitInformation *i, infoList)
|
||||
result.append(i->validate(this));
|
||||
d->m_isValid = true;
|
||||
foreach (KitInformation *i, infoList) {
|
||||
QList<Task> tmp = i->validate(this);
|
||||
foreach (const Task &t, tmp) {
|
||||
if (t.type == Task::Error)
|
||||
d->m_isValid = false;
|
||||
}
|
||||
result.append(tmp);
|
||||
}
|
||||
qSort(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void Kit::fix()
|
||||
{
|
||||
KitGuard g(this);
|
||||
foreach (KitInformation *i, KitManager::instance()->kitInformation())
|
||||
i->fix(this);
|
||||
}
|
||||
|
||||
QString Kit::displayName() const
|
||||
{
|
||||
return d->m_displayName;
|
||||
@@ -185,6 +251,22 @@ void Kit::setDisplayName(const QString &name)
|
||||
kitUpdated();
|
||||
}
|
||||
|
||||
QString Kit::fileSystemFriendlyName() const
|
||||
{
|
||||
QString name = cleanName(displayName());
|
||||
foreach (Kit *i, KitManager::instance()->kits()) {
|
||||
if (i == this)
|
||||
continue;
|
||||
if (name == cleanName(i->displayName())) {
|
||||
// append part of the kit id: That should be unique enough;-)
|
||||
// Leading { will be turned into _ which should be fine.
|
||||
name = cleanName(name + QLatin1Char('_') + (id().toString().left(7)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
bool Kit::isAutoDetected() const
|
||||
{
|
||||
return d->m_autodetected;
|
||||
@@ -245,6 +327,18 @@ void Kit::removeKey(const Core::Id &key)
|
||||
kitUpdated();
|
||||
}
|
||||
|
||||
bool Kit::isDataEqual(const Kit *other) const
|
||||
{
|
||||
return d->m_data == other->d->m_data;
|
||||
}
|
||||
|
||||
bool Kit::isEqual(const Kit *other) const
|
||||
{
|
||||
return isDataEqual(other)
|
||||
&& d->m_iconPath == other->d->m_iconPath
|
||||
&& d->m_displayName == other->d->m_displayName;
|
||||
}
|
||||
|
||||
QVariantMap Kit::toMap() const
|
||||
{
|
||||
QVariantMap data;
|
||||
@@ -261,11 +355,6 @@ QVariantMap Kit::toMap() const
|
||||
return data;
|
||||
}
|
||||
|
||||
bool Kit::operator==(const Kit &other) const
|
||||
{
|
||||
return d->m_data == other.d->m_data;
|
||||
}
|
||||
|
||||
void Kit::addToEnvironment(Utils::Environment &env) const
|
||||
{
|
||||
QList<KitInformation *> infoList = KitManager::instance()->kitInformation();
|
||||
@@ -288,10 +377,10 @@ QString Kit::toHtml()
|
||||
str << "<b>";
|
||||
switch (t.type) {
|
||||
case Task::Error:
|
||||
QCoreApplication::translate("ProjectExplorer::Kit", "Error:");
|
||||
str << QCoreApplication::translate("ProjectExplorer::Kit", "Error:");
|
||||
break;
|
||||
case Task::Warning:
|
||||
QCoreApplication::translate("ProjectExplorer::Kit", "Warning:");
|
||||
str << QCoreApplication::translate("ProjectExplorer::Kit", "Warning:");
|
||||
break;
|
||||
case Task::Unknown:
|
||||
default:
|
||||
@@ -314,17 +403,18 @@ QString Kit::toHtml()
|
||||
|
||||
bool Kit::fromMap(const QVariantMap &data)
|
||||
{
|
||||
KitGuard g(this);
|
||||
const QString id = data.value(QLatin1String(ID_KEY)).toString();
|
||||
if (id.isEmpty())
|
||||
return false;
|
||||
d->m_id = Core::Id(id);
|
||||
d->m_displayName = data.value(QLatin1String(DISPLAYNAME_KEY)).toString();
|
||||
d->m_autodetected = data.value(QLatin1String(AUTODETECTED_KEY)).toBool();
|
||||
setDisplayName(data.value(QLatin1String(DISPLAYNAME_KEY)).toString());
|
||||
setIconPath(data.value(QLatin1String(ICON_KEY)).toString());
|
||||
|
||||
QVariantMap extra = data.value(QLatin1String(DATA_KEY)).toMap();
|
||||
foreach (const QString &key, extra.keys())
|
||||
d->m_data.insert(Core::Id(key), extra.value(key));
|
||||
setValue(Core::Id(key), extra.value(key));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -334,13 +424,13 @@ void Kit::setAutoDetected(bool detected)
|
||||
d->m_autodetected = detected;
|
||||
}
|
||||
|
||||
void Kit::setValid(bool valid)
|
||||
{
|
||||
d->m_isValid = valid;
|
||||
}
|
||||
|
||||
void Kit::kitUpdated()
|
||||
{
|
||||
if (d->m_nestedBlockingLevel > 0) {
|
||||
d->m_mustNotify = true;
|
||||
return;
|
||||
}
|
||||
validate();
|
||||
KitManager::instance()->notifyAboutUpdate(this);
|
||||
}
|
||||
|
||||
|
@@ -55,15 +55,23 @@ class KitPrivate;
|
||||
class PROJECTEXPLORER_EXPORT Kit
|
||||
{
|
||||
public:
|
||||
Kit();
|
||||
Kit(Core::Id id = Core::Id());
|
||||
~Kit();
|
||||
|
||||
// Do not trigger evaluations
|
||||
void blockNotification();
|
||||
// Trigger evaluations again.
|
||||
void unblockNotification();
|
||||
|
||||
bool isValid() const;
|
||||
QList<Task> validate();
|
||||
QList<Task> validate() const;
|
||||
void fix();
|
||||
|
||||
QString displayName() const;
|
||||
void setDisplayName(const QString &name);
|
||||
|
||||
QString fileSystemFriendlyName() const;
|
||||
|
||||
bool isAutoDetected() const;
|
||||
Core::Id id() const;
|
||||
|
||||
@@ -76,12 +84,14 @@ public:
|
||||
void setValue(const Core::Id &key, const QVariant &value);
|
||||
void removeKey(const Core::Id &key);
|
||||
|
||||
bool operator==(const Kit &other) const;
|
||||
bool isDataEqual(const Kit *other) const;
|
||||
bool isEqual(const Kit *other) const;
|
||||
|
||||
void addToEnvironment(Utils::Environment &env) const;
|
||||
|
||||
QString toHtml();
|
||||
Kit *clone(bool keepName = false) const;
|
||||
void copyFrom(const Kit *k);
|
||||
|
||||
private:
|
||||
// Unimplemented.
|
||||
@@ -89,7 +99,6 @@ private:
|
||||
void operator=(const Kit &other);
|
||||
|
||||
void setAutoDetected(bool detected);
|
||||
void setValid(bool valid);
|
||||
|
||||
void kitUpdated();
|
||||
|
||||
@@ -99,7 +108,17 @@ private:
|
||||
Internal::KitPrivate *d;
|
||||
|
||||
friend class KitManager;
|
||||
friend class Internal::KitManagerPrivate;
|
||||
};
|
||||
|
||||
class KitGuard
|
||||
{
|
||||
public:
|
||||
KitGuard(Kit *k) : m_kit(k)
|
||||
{ k->blockNotification(); }
|
||||
|
||||
~KitGuard() { m_kit->unblockNotification(); }
|
||||
private:
|
||||
Kit *m_kit;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -52,10 +52,7 @@ public:
|
||||
|
||||
virtual QString displayName() const = 0;
|
||||
virtual void makeReadOnly() = 0;
|
||||
|
||||
virtual void apply() = 0;
|
||||
virtual void discard() = 0;
|
||||
virtual bool isDirty() const = 0;
|
||||
virtual void refresh() = 0;
|
||||
|
||||
virtual QWidget *buttonWidget() const { return 0; }
|
||||
|
||||
|
@@ -76,7 +76,7 @@ QVariant SysRootKitInformation::defaultValue(Kit *k) const
|
||||
return QString();
|
||||
}
|
||||
|
||||
QList<Task> SysRootKitInformation::validate(Kit *k) const
|
||||
QList<Task> SysRootKitInformation::validate(const Kit *k) const
|
||||
{
|
||||
QList<Task> result;
|
||||
const Utils::FileName dir = SysRootKitInformation::sysRoot(k);
|
||||
@@ -160,19 +160,26 @@ QVariant ToolChainKitInformation::defaultValue(Kit *k) const
|
||||
return tcList.at(0)->id();
|
||||
}
|
||||
|
||||
QList<Task> ToolChainKitInformation::validate(Kit *k) const
|
||||
QList<Task> ToolChainKitInformation::validate(const Kit *k) const
|
||||
{
|
||||
QList<Task> result;
|
||||
if (!toolChain(k)) {
|
||||
qWarning("Tool chain is no longer known, removing from kit \"%s\".",
|
||||
qPrintable(k->displayName()));
|
||||
setToolChain(k, 0); // make sure to clear out no longer known tool chains
|
||||
result << Task(Task::Error, ToolChainKitInformation::msgNoToolChainInTarget(),
|
||||
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void ToolChainKitInformation::fix(Kit *k)
|
||||
{
|
||||
if (toolChain(k))
|
||||
return;
|
||||
|
||||
qWarning("Tool chain is no longer known, removing from kit \"%s\".",
|
||||
qPrintable(k->displayName()));
|
||||
setToolChain(k, 0); // make sure to clear out no longer known tool chains
|
||||
}
|
||||
|
||||
KitConfigWidget *ToolChainKitInformation::createConfigWidget(Kit *k) const
|
||||
{
|
||||
Q_ASSERT(k);
|
||||
@@ -256,14 +263,10 @@ QVariant DeviceTypeKitInformation::defaultValue(Kit *k) const
|
||||
return QByteArray(Constants::DESKTOP_DEVICE_TYPE);
|
||||
}
|
||||
|
||||
QList<Task> DeviceTypeKitInformation::validate(Kit *k) const
|
||||
QList<Task> DeviceTypeKitInformation::validate(const Kit *k) const
|
||||
{
|
||||
IDevice::ConstPtr dev = DeviceKitInformation::device(k);
|
||||
QList<Task> result;
|
||||
if (!dev.isNull() && dev->type() != DeviceTypeKitInformation::deviceTypeId(k))
|
||||
result.append(Task(Task::Error, tr("Device does not match device type."),
|
||||
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)));
|
||||
return result;
|
||||
Q_UNUSED(k);
|
||||
return QList<Task>();
|
||||
}
|
||||
|
||||
KitConfigWidget *DeviceTypeKitInformation::createConfigWidget(Kit *k) const
|
||||
@@ -329,17 +332,34 @@ unsigned int DeviceKitInformation::priority() const
|
||||
|
||||
QVariant DeviceKitInformation::defaultValue(Kit *k) const
|
||||
{
|
||||
Q_UNUSED(k);
|
||||
return QByteArray(Constants::DESKTOP_DEVICE_ID);
|
||||
Core::Id type = DeviceTypeKitInformation::deviceTypeId(k);
|
||||
IDevice::ConstPtr dev = DeviceManager::instance()->defaultDevice(type);
|
||||
return dev.isNull() ? QString() : dev->id().toString();
|
||||
}
|
||||
|
||||
QList<Task> DeviceKitInformation::validate(Kit *k) const
|
||||
QList<Task> DeviceKitInformation::validate(const Kit *k) const
|
||||
{
|
||||
Q_UNUSED(k);
|
||||
IDevice::ConstPtr dev = DeviceKitInformation::device(k);
|
||||
QList<Task> result;
|
||||
if (!dev.isNull() && dev->type() != DeviceTypeKitInformation::deviceTypeId(k))
|
||||
result.append(Task(Task::Error, tr("Device does not match device type."),
|
||||
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)));
|
||||
if (dev.isNull())
|
||||
result.append(Task(Task::Warning, tr("No Device set."),
|
||||
Utils::FileName(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)));
|
||||
return result;
|
||||
}
|
||||
|
||||
void DeviceKitInformation::fix(Kit *k)
|
||||
{
|
||||
IDevice::ConstPtr dev = DeviceKitInformation::device(k);
|
||||
if (!dev.isNull() && dev->type() == DeviceTypeKitInformation::deviceTypeId(k))
|
||||
return;
|
||||
|
||||
const QString id = defaultValue(k).toString();
|
||||
setDeviceId(k, id.isEmpty() ? Core::Id() : Core::Id(id));
|
||||
}
|
||||
|
||||
KitConfigWidget *DeviceKitInformation::createConfigWidget(Kit *k) const
|
||||
{
|
||||
Q_ASSERT(k);
|
||||
|
@@ -60,7 +60,7 @@ public:
|
||||
|
||||
QVariant defaultValue(Kit *k) const;
|
||||
|
||||
QList<Task> validate(Kit *k) const;
|
||||
QList<Task> validate(const Kit *k) const;
|
||||
|
||||
KitConfigWidget *createConfigWidget(Kit *k) const;
|
||||
|
||||
@@ -102,7 +102,8 @@ public:
|
||||
|
||||
QVariant defaultValue(Kit *k) const;
|
||||
|
||||
QList<Task> validate(Kit *k) const;
|
||||
QList<Task> validate(const Kit *k) const;
|
||||
void fix(Kit *k);
|
||||
|
||||
KitConfigWidget *createConfigWidget(Kit *k) const;
|
||||
|
||||
@@ -149,7 +150,7 @@ public:
|
||||
|
||||
QVariant defaultValue(Kit *k) const;
|
||||
|
||||
QList<Task> validate(Kit *k) const;
|
||||
QList<Task> validate(const Kit *k) const;
|
||||
|
||||
KitConfigWidget *createConfigWidget(Kit *k) const;
|
||||
|
||||
@@ -193,7 +194,8 @@ public:
|
||||
|
||||
QVariant defaultValue(Kit *k) const;
|
||||
|
||||
QList<Task> validate(Kit *k) const;
|
||||
QList<Task> validate(const Kit *k) const;
|
||||
void fix(Kit *k);
|
||||
|
||||
KitConfigWidget *createConfigWidget(Kit *k) const;
|
||||
|
||||
|
@@ -69,7 +69,7 @@ SysRootInformationConfigWidget::SysRootInformationConfigWidget(Kit *k, QWidget *
|
||||
|
||||
m_chooser->setFileName(SysRootKitInformation::sysRoot(k));
|
||||
|
||||
connect(m_chooser, SIGNAL(changed(QString)), this, SIGNAL(dirty()));
|
||||
connect(m_chooser, SIGNAL(changed(QString)), this, SLOT(pathWasChanged()));
|
||||
}
|
||||
|
||||
QString SysRootInformationConfigWidget::displayName() const
|
||||
@@ -77,21 +77,11 @@ QString SysRootInformationConfigWidget::displayName() const
|
||||
return tr("Sysroot:");
|
||||
}
|
||||
|
||||
void SysRootInformationConfigWidget::apply()
|
||||
{
|
||||
SysRootKitInformation::setSysRoot(m_kit, m_chooser->fileName());
|
||||
}
|
||||
|
||||
void SysRootInformationConfigWidget::discard()
|
||||
void SysRootInformationConfigWidget::refresh()
|
||||
{
|
||||
m_chooser->setFileName(SysRootKitInformation::sysRoot(m_kit));
|
||||
}
|
||||
|
||||
bool SysRootInformationConfigWidget::isDirty() const
|
||||
{
|
||||
return SysRootKitInformation::sysRoot(m_kit) != m_chooser->fileName();
|
||||
}
|
||||
|
||||
void SysRootInformationConfigWidget::makeReadOnly()
|
||||
{
|
||||
m_chooser->setEnabled(false);
|
||||
@@ -102,6 +92,11 @@ QWidget *SysRootInformationConfigWidget::buttonWidget() const
|
||||
return m_chooser->buttonAtIndex(0);
|
||||
}
|
||||
|
||||
void SysRootInformationConfigWidget::pathWasChanged()
|
||||
{
|
||||
SysRootKitInformation::setSysRoot(m_kit, m_chooser->fileName());
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// ToolChainInformationConfigWidget:
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -128,8 +123,8 @@ ToolChainInformationConfigWidget::ToolChainInformationConfigWidget(Kit *k, QWidg
|
||||
|
||||
updateComboBox();
|
||||
|
||||
discard();
|
||||
connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(dirty()));
|
||||
refresh();
|
||||
connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(currentToolChainChanged(int)));
|
||||
|
||||
m_manageButton->setContentsMargins(0, 0, 0, 0);
|
||||
m_manageButton->setText(tr("Manage..."));
|
||||
@@ -148,25 +143,11 @@ QString ToolChainInformationConfigWidget::displayName() const
|
||||
return tr("Compiler:");
|
||||
}
|
||||
|
||||
void ToolChainInformationConfigWidget::apply()
|
||||
{
|
||||
const QString id = m_comboBox->itemData(m_comboBox->currentIndex()).toString();
|
||||
ToolChain *tc = ToolChainManager::instance()->findToolChain(id);
|
||||
ToolChainKitInformation::setToolChain(m_kit, tc);
|
||||
}
|
||||
|
||||
void ToolChainInformationConfigWidget::discard()
|
||||
void ToolChainInformationConfigWidget::refresh()
|
||||
{
|
||||
m_comboBox->setCurrentIndex(indexOf(ToolChainKitInformation::toolChain(m_kit)));
|
||||
}
|
||||
|
||||
bool ToolChainInformationConfigWidget::isDirty() const
|
||||
{
|
||||
ToolChain *tc = ToolChainKitInformation::toolChain(m_kit);
|
||||
return (m_comboBox->itemData(m_comboBox->currentIndex()).toString())
|
||||
!= (tc ? tc->id() : QString());
|
||||
}
|
||||
|
||||
void ToolChainInformationConfigWidget::makeReadOnly()
|
||||
{
|
||||
m_comboBox->setEnabled(false);
|
||||
@@ -205,6 +186,13 @@ void ToolChainInformationConfigWidget::manageToolChains()
|
||||
QLatin1String(ProjectExplorer::Constants::TOOLCHAIN_SETTINGS_PAGE_ID));
|
||||
}
|
||||
|
||||
void ToolChainInformationConfigWidget::currentToolChainChanged(int idx)
|
||||
{
|
||||
const QString id = m_comboBox->itemData(idx).toString();
|
||||
ToolChain *tc = ToolChainManager::instance()->findToolChain(id);
|
||||
ToolChainKitInformation::setToolChain(m_kit, tc);
|
||||
}
|
||||
|
||||
void ToolChainInformationConfigWidget::updateComboBox()
|
||||
{
|
||||
// remove unavailable tool chain:
|
||||
@@ -234,9 +222,9 @@ int ToolChainInformationConfigWidget::indexOf(const ToolChain *tc)
|
||||
// DeviceTypeInformationConfigWidget:
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
DeviceTypeInformationConfigWidget::DeviceTypeInformationConfigWidget(Kit *k, QWidget *parent) :
|
||||
DeviceTypeInformationConfigWidget::DeviceTypeInformationConfigWidget(Kit *workingCopy, QWidget *parent) :
|
||||
KitConfigWidget(parent),
|
||||
m_isReadOnly(false), m_kit(k),
|
||||
m_isReadOnly(false), m_kit(workingCopy),
|
||||
m_comboBox(new QComboBox)
|
||||
{
|
||||
setToolTip(tr("The type of device to run applications on."));
|
||||
@@ -250,12 +238,12 @@ DeviceTypeInformationConfigWidget::DeviceTypeInformationConfigWidget(Kit *k, QWi
|
||||
= ExtensionSystem::PluginManager::instance()->getObjects<IDeviceFactory>();
|
||||
foreach (IDeviceFactory *factory, factories) {
|
||||
foreach (Core::Id id, factory->availableCreationIds()) {
|
||||
m_comboBox->addItem(factory->displayNameForId(id), QVariant::fromValue(id));
|
||||
m_comboBox->addItem(factory->displayNameForId(id), id.uniqueIdentifier());
|
||||
}
|
||||
}
|
||||
|
||||
discard();
|
||||
connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(dirty()));
|
||||
refresh();
|
||||
connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(currentTypeChanged(int)));
|
||||
}
|
||||
|
||||
QString DeviceTypeInformationConfigWidget::displayName() const
|
||||
@@ -263,47 +251,37 @@ QString DeviceTypeInformationConfigWidget::displayName() const
|
||||
return tr("Device type:");
|
||||
}
|
||||
|
||||
void DeviceTypeInformationConfigWidget::apply()
|
||||
{
|
||||
Core::Id devType;
|
||||
if (m_comboBox->currentIndex() >= 0)
|
||||
devType = m_comboBox->itemData(m_comboBox->currentIndex()).value<Core::Id>();
|
||||
DeviceTypeKitInformation::setDeviceTypeId(m_kit, devType);
|
||||
}
|
||||
|
||||
void DeviceTypeInformationConfigWidget::discard()
|
||||
void DeviceTypeInformationConfigWidget::refresh()
|
||||
{
|
||||
Core::Id devType = DeviceTypeKitInformation::deviceTypeId(m_kit);
|
||||
if (!devType.isValid())
|
||||
m_comboBox->setCurrentIndex(-1);
|
||||
for (int i = 0; i < m_comboBox->count(); ++i) {
|
||||
if (m_comboBox->itemData(i).value<Core::Id>() == devType) {
|
||||
if (m_comboBox->itemData(i).toInt() == devType.uniqueIdentifier()) {
|
||||
m_comboBox->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool DeviceTypeInformationConfigWidget::isDirty() const
|
||||
{
|
||||
Core::Id devType;
|
||||
if (m_comboBox->currentIndex() >= 0)
|
||||
devType = m_comboBox->itemData(m_comboBox->currentIndex()).value<Core::Id>();
|
||||
return DeviceTypeKitInformation::deviceTypeId(m_kit) != devType;
|
||||
}
|
||||
|
||||
void DeviceTypeInformationConfigWidget::makeReadOnly()
|
||||
{
|
||||
m_comboBox->setEnabled(false);
|
||||
}
|
||||
|
||||
void DeviceTypeInformationConfigWidget::currentTypeChanged(int idx)
|
||||
{
|
||||
Core::Id type = idx < 0 ? Core::Id() : Core::Id::fromUniqueIdentifier(m_comboBox->itemData(idx).toInt());
|
||||
DeviceTypeKitInformation::setDeviceTypeId(m_kit, type);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// DeviceInformationConfigWidget:
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
DeviceInformationConfigWidget::DeviceInformationConfigWidget(Kit *k, QWidget *parent) :
|
||||
DeviceInformationConfigWidget::DeviceInformationConfigWidget(Kit *workingCopy, QWidget *parent) :
|
||||
KitConfigWidget(parent),
|
||||
m_isReadOnly(false), m_kit(k),
|
||||
m_isReadOnly(false), m_kit(workingCopy),
|
||||
m_comboBox(new QComboBox), m_manageButton(new QPushButton(this)),
|
||||
m_model(new DeviceManagerModel(DeviceManager::instance()))
|
||||
{
|
||||
@@ -323,8 +301,8 @@ DeviceInformationConfigWidget::DeviceInformationConfigWidget(Kit *k, QWidget *pa
|
||||
m_manageButton->setContentsMargins(0, 0, 0, 0);
|
||||
m_manageButton->setText(tr("Manage..."));
|
||||
|
||||
discard();
|
||||
connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(dirty()));
|
||||
refresh();
|
||||
connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(currentDeviceChanged()));
|
||||
|
||||
connect(m_manageButton, SIGNAL(clicked()), this, SLOT(manageDevices()));
|
||||
}
|
||||
@@ -334,26 +312,12 @@ QString DeviceInformationConfigWidget::displayName() const
|
||||
return tr("Device:");
|
||||
}
|
||||
|
||||
void DeviceInformationConfigWidget::apply()
|
||||
{
|
||||
int idx = m_comboBox->currentIndex();
|
||||
if (idx >= 0)
|
||||
DeviceKitInformation::setDeviceId(m_kit, m_model->deviceId(idx));
|
||||
else
|
||||
DeviceKitInformation::setDeviceId(m_kit, IDevice::invalidId());
|
||||
}
|
||||
|
||||
void DeviceInformationConfigWidget::discard()
|
||||
void DeviceInformationConfigWidget::refresh()
|
||||
{
|
||||
m_model->setTypeFilter(DeviceTypeKitInformation::deviceTypeId(m_kit));
|
||||
m_comboBox->setCurrentIndex(m_model->indexOf(DeviceKitInformation::device(m_kit)));
|
||||
}
|
||||
|
||||
bool DeviceInformationConfigWidget::isDirty() const
|
||||
{
|
||||
Core::Id devId = DeviceKitInformation::deviceId(m_kit);
|
||||
return devId != m_model->deviceId(m_comboBox->currentIndex());
|
||||
}
|
||||
|
||||
void DeviceInformationConfigWidget::makeReadOnly()
|
||||
{
|
||||
m_comboBox->setEnabled(false);
|
||||
@@ -380,5 +344,10 @@ void DeviceInformationConfigWidget::modelReset()
|
||||
m_comboBox->setCurrentIndex(m_model->indexForId(m_selectedId));
|
||||
}
|
||||
|
||||
void DeviceInformationConfigWidget::currentDeviceChanged()
|
||||
{
|
||||
DeviceKitInformation::setDeviceId(m_kit, m_model->deviceId(m_comboBox->currentIndex()));
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -61,12 +61,13 @@ public:
|
||||
explicit SysRootInformationConfigWidget(Kit *k, QWidget *parent = 0);
|
||||
|
||||
QString displayName() const;
|
||||
void apply();
|
||||
void discard();
|
||||
bool isDirty() const;
|
||||
void refresh();
|
||||
void makeReadOnly();
|
||||
QWidget *buttonWidget() const;
|
||||
|
||||
private slots:
|
||||
void pathWasChanged();
|
||||
|
||||
private:
|
||||
Kit *m_kit;
|
||||
Utils::PathChooser *m_chooser;
|
||||
@@ -84,9 +85,7 @@ public:
|
||||
explicit ToolChainInformationConfigWidget(Kit *k, QWidget *parent = 0);
|
||||
|
||||
QString displayName() const;
|
||||
void apply();
|
||||
void discard();
|
||||
bool isDirty() const;
|
||||
void refresh();
|
||||
void makeReadOnly();
|
||||
QWidget *buttonWidget() const;
|
||||
|
||||
@@ -95,6 +94,7 @@ private slots:
|
||||
void toolChainRemoved(ProjectExplorer::ToolChain *tc);
|
||||
void toolChainUpdated(ProjectExplorer::ToolChain *tc);
|
||||
void manageToolChains();
|
||||
void currentToolChainChanged(int idx);
|
||||
|
||||
private:
|
||||
void updateComboBox();
|
||||
@@ -115,14 +115,15 @@ class DeviceTypeInformationConfigWidget : public KitConfigWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DeviceTypeInformationConfigWidget(Kit *k, QWidget *parent = 0);
|
||||
explicit DeviceTypeInformationConfigWidget(Kit *workingCopy, QWidget *parent = 0);
|
||||
|
||||
QString displayName() const;
|
||||
void apply();
|
||||
void discard();
|
||||
bool isDirty() const;
|
||||
void refresh();
|
||||
void makeReadOnly();
|
||||
|
||||
private slots:
|
||||
void currentTypeChanged(int idx);
|
||||
|
||||
private:
|
||||
bool m_isReadOnly;
|
||||
Kit *m_kit;
|
||||
@@ -138,12 +139,10 @@ class DeviceInformationConfigWidget : public KitConfigWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DeviceInformationConfigWidget(Kit *k, QWidget *parent = 0);
|
||||
explicit DeviceInformationConfigWidget(Kit *workingCopy, QWidget *parent = 0);
|
||||
|
||||
QString displayName() const;
|
||||
void apply();
|
||||
void discard();
|
||||
bool isDirty() const;
|
||||
void refresh();
|
||||
void makeReadOnly();
|
||||
QWidget *buttonWidget() const;
|
||||
|
||||
@@ -151,6 +150,7 @@ private slots:
|
||||
void manageDevices();
|
||||
void modelAboutToReset();
|
||||
void modelReset();
|
||||
void currentDeviceChanged();
|
||||
|
||||
private:
|
||||
bool m_isReadOnly;
|
||||
|
@@ -80,7 +80,6 @@ class KitManagerPrivate
|
||||
public:
|
||||
KitManagerPrivate();
|
||||
~KitManagerPrivate();
|
||||
QList<Task> validateKit(Kit *k) const;
|
||||
|
||||
Kit *m_defaultKit;
|
||||
bool m_initialized;
|
||||
@@ -101,22 +100,6 @@ KitManagerPrivate::~KitManagerPrivate()
|
||||
delete m_writer;
|
||||
}
|
||||
|
||||
QList<Task> KitManagerPrivate::validateKit(Kit *k) const
|
||||
{
|
||||
Q_ASSERT(k);
|
||||
QList<Task> result;
|
||||
bool hasError = false;
|
||||
foreach (KitInformation *ki, m_informationList) {
|
||||
QList<Task> tmp = ki->validate(k);
|
||||
foreach (const Task &t, tmp)
|
||||
if (t.type == Task::Error)
|
||||
hasError = true;
|
||||
result << tmp;
|
||||
}
|
||||
k->setValid(!hasError);
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -265,6 +248,8 @@ void KitManager::registerKitInformation(KitInformation *ki)
|
||||
foreach (Kit *k, kits()) {
|
||||
if (!k->hasValue(ki->dataId()))
|
||||
k->setValue(ki->dataId(), ki->defaultValue(k));
|
||||
else
|
||||
ki->fix(k);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -375,22 +360,21 @@ QList<KitInformation *> KitManager::kitInformation() const
|
||||
|
||||
Internal::KitManagerConfigWidget *KitManager::createConfigWidget(Kit *k) const
|
||||
{
|
||||
if (!k)
|
||||
return 0;
|
||||
|
||||
Internal::KitManagerConfigWidget *result = new Internal::KitManagerConfigWidget(k);
|
||||
foreach (KitInformation *ki, d->m_informationList)
|
||||
result->addConfigWidget(ki->createConfigWidget(k));
|
||||
result->addConfigWidget(ki->createConfigWidget(result->workingCopy()));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void KitManager::notifyAboutUpdate(ProjectExplorer::Kit *k)
|
||||
{
|
||||
if (!k || !kits().contains(k))
|
||||
if (!k)
|
||||
return;
|
||||
d->validateKit(k);
|
||||
if (kits().contains(k))
|
||||
emit kitUpdated(k);
|
||||
else
|
||||
emit unmanagedKitUpdated(k);
|
||||
}
|
||||
|
||||
bool KitManager::registerKit(ProjectExplorer::Kit *k)
|
||||
@@ -403,11 +387,6 @@ bool KitManager::registerKit(ProjectExplorer::Kit *k)
|
||||
}
|
||||
|
||||
// make sure we have all the information in our kits:
|
||||
foreach (KitInformation *ki, d->m_informationList) {
|
||||
if (!k->hasValue(ki->dataId()))
|
||||
k->setValue(ki->dataId(), ki->defaultValue(k));
|
||||
}
|
||||
|
||||
addKit(k);
|
||||
emit kitAdded(k);
|
||||
return true;
|
||||
@@ -433,13 +412,6 @@ void KitManager::deregisterKit(Kit *k)
|
||||
delete k;
|
||||
}
|
||||
|
||||
QList<Task> KitManager::validateKit(Kit *k)
|
||||
{
|
||||
QList<Task> result = d->validateKit(k);
|
||||
qSort(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void KitManager::setDefaultKit(Kit *k)
|
||||
{
|
||||
if (d->m_defaultKit == k)
|
||||
@@ -453,15 +425,22 @@ void KitManager::setDefaultKit(Kit *k)
|
||||
void KitManager::validateKits()
|
||||
{
|
||||
foreach (Kit *k, kits())
|
||||
d->validateKit(k);
|
||||
k->validate();
|
||||
}
|
||||
|
||||
void KitManager::addKit(Kit *k)
|
||||
{
|
||||
if (!k)
|
||||
return;
|
||||
k->setDisplayName(k->displayName()); // make name unique
|
||||
d->validateKit(k);
|
||||
|
||||
KitGuard g(k);
|
||||
foreach (KitInformation *ki, d->m_informationList) {
|
||||
if (!k->hasValue(ki->dataId()))
|
||||
k->setValue(ki->dataId(), ki->defaultValue(k));
|
||||
else
|
||||
ki->fix(k);
|
||||
}
|
||||
|
||||
d->m_kitList.append(k);
|
||||
if (!d->m_defaultKit ||
|
||||
(!d->m_defaultKit->isValid() && k->isValid()))
|
||||
|
@@ -74,7 +74,8 @@ public:
|
||||
virtual bool visibleIn(Kit *) { return true; }
|
||||
virtual QVariant defaultValue(Kit *) const = 0;
|
||||
|
||||
virtual QList<Task> validate(Kit *) const = 0;
|
||||
virtual QList<Task> validate(const Kit *) const = 0;
|
||||
virtual void fix(Kit *) { return; }
|
||||
|
||||
virtual ItemList toUserOutput(Kit *) const = 0;
|
||||
|
||||
@@ -115,7 +116,6 @@ public:
|
||||
public slots:
|
||||
bool registerKit(ProjectExplorer::Kit *k);
|
||||
void deregisterKit(ProjectExplorer::Kit *k);
|
||||
QList<Task> validateKit(ProjectExplorer::Kit *k);
|
||||
void setDefaultKit(ProjectExplorer::Kit *k);
|
||||
|
||||
void saveKits();
|
||||
@@ -129,6 +129,7 @@ signals:
|
||||
void kitRemoved(ProjectExplorer::Kit *);
|
||||
// Kit was updated.
|
||||
void kitUpdated(ProjectExplorer::Kit *);
|
||||
void unmanagedKitUpdated(ProjectExplorer::Kit *);
|
||||
// Default kit was changed.
|
||||
void defaultkitChanged();
|
||||
// Something changed.
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "kitmanagerconfigwidget.h"
|
||||
|
||||
#include "kit.h"
|
||||
#include "kitmanager.h"
|
||||
|
||||
#include <utils/detailswidget.h>
|
||||
|
||||
@@ -43,16 +44,20 @@
|
||||
#include <QSizePolicy>
|
||||
#include <QStyle>
|
||||
|
||||
static const char WORKING_COPY_KIT_ID[] = "modified kit";
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
namespace Internal {
|
||||
|
||||
KitManagerConfigWidget::KitManagerConfigWidget(Kit *k, QWidget *parent) :
|
||||
KitConfigWidget(parent),
|
||||
QWidget(parent),
|
||||
m_layout(new QGridLayout),
|
||||
m_iconButton(new QToolButton),
|
||||
m_nameEdit(new QLineEdit),
|
||||
m_kit(k)
|
||||
m_kit(k),
|
||||
m_modifiedKit(new Kit(Core::Id(WORKING_COPY_KIT_ID))),
|
||||
m_fixingKit(false)
|
||||
{
|
||||
QVBoxLayout *top = new QVBoxLayout(this);
|
||||
top->setMargin(0);
|
||||
@@ -81,7 +86,21 @@ KitManagerConfigWidget::KitManagerConfigWidget(Kit *k, QWidget *parent) :
|
||||
discard();
|
||||
|
||||
connect(m_iconButton, SIGNAL(clicked()), this, SLOT(setIcon()));
|
||||
connect(m_nameEdit, SIGNAL(textChanged(QString)), this, SIGNAL(dirty()));
|
||||
connect(m_nameEdit, SIGNAL(textChanged(QString)), this, SLOT(setDisplayName()));
|
||||
|
||||
KitManager *km = KitManager::instance();
|
||||
connect(km, SIGNAL(unmanagedKitUpdated(ProjectExplorer::Kit*)),
|
||||
this, SLOT(workingCopyWasUpdated(ProjectExplorer::Kit*)));
|
||||
connect(km, SIGNAL(kitUpdated(ProjectExplorer::Kit*)),
|
||||
this, SLOT(kitWasUpdated(ProjectExplorer::Kit*)));
|
||||
}
|
||||
|
||||
KitManagerConfigWidget::~KitManagerConfigWidget()
|
||||
{
|
||||
delete m_modifiedKit;
|
||||
// Make sure our workingCopy did not get registered somehow:
|
||||
foreach (const Kit *k, KitManager::instance()->kits())
|
||||
Q_ASSERT(k->id() != Core::Id(WORKING_COPY_KIT_ID));
|
||||
}
|
||||
|
||||
QString KitManagerConfigWidget::displayName() const
|
||||
@@ -91,27 +110,51 @@ QString KitManagerConfigWidget::displayName() const
|
||||
|
||||
void KitManagerConfigWidget::apply()
|
||||
{
|
||||
foreach (KitConfigWidget *w, m_widgets)
|
||||
w->apply();
|
||||
m_kit->setIconPath(m_iconPath);
|
||||
m_kit->setDisplayName(m_nameEdit->text());
|
||||
KitManager *km = KitManager::instance();
|
||||
bool mustRegister = false;
|
||||
if (!m_kit) {
|
||||
mustRegister = true;
|
||||
m_kit = new Kit;
|
||||
}
|
||||
m_kit->copyFrom(m_modifiedKit);
|
||||
if (mustRegister)
|
||||
km->registerKit(m_kit);
|
||||
|
||||
if (m_isDefaultKit)
|
||||
km->setDefaultKit(m_kit);
|
||||
emit dirty();
|
||||
}
|
||||
|
||||
void KitManagerConfigWidget::discard()
|
||||
{
|
||||
foreach (KitConfigWidget *w, m_widgets)
|
||||
w->discard();
|
||||
m_iconButton->setIcon(m_kit->icon());
|
||||
m_iconPath = m_kit->iconPath();
|
||||
m_nameEdit->setText(m_kit->displayName());
|
||||
if (m_kit) {
|
||||
m_modifiedKit->copyFrom(m_kit);
|
||||
m_isDefaultKit = (m_kit == KitManager::instance()->defaultKit());
|
||||
} else {
|
||||
// This branch will only ever get reached once during setup of widget for a not-yet-existing
|
||||
// kit.
|
||||
m_isDefaultKit = false;
|
||||
}
|
||||
m_iconButton->setIcon(m_modifiedKit->icon());
|
||||
m_nameEdit->setText(m_modifiedKit->displayName());
|
||||
emit dirty();
|
||||
}
|
||||
|
||||
bool KitManagerConfigWidget::isDirty() const
|
||||
{
|
||||
foreach (KitConfigWidget *w, m_widgets)
|
||||
if (w->isDirty())
|
||||
return true;
|
||||
return (m_kit->iconPath() != m_iconPath) || (m_kit->displayName() != m_nameEdit->text());
|
||||
return !m_kit
|
||||
|| !m_kit->isEqual(m_modifiedKit)
|
||||
|| m_isDefaultKit != (KitManager::instance()->defaultKit() == m_kit);
|
||||
}
|
||||
|
||||
bool KitManagerConfigWidget::isValid() const
|
||||
{
|
||||
return m_modifiedKit->isValid();
|
||||
}
|
||||
|
||||
QString KitManagerConfigWidget::validityMessage() const
|
||||
{
|
||||
return m_modifiedKit->toHtml();
|
||||
}
|
||||
|
||||
void KitManagerConfigWidget::addConfigWidget(ProjectExplorer::KitConfigWidget *widget)
|
||||
@@ -119,8 +162,6 @@ void KitManagerConfigWidget::addConfigWidget(ProjectExplorer::KitConfigWidget *w
|
||||
Q_ASSERT(widget);
|
||||
Q_ASSERT(!m_widgets.contains(widget));
|
||||
|
||||
connect(widget, SIGNAL(dirty()), this, SIGNAL(dirty()));
|
||||
|
||||
addToLayout(widget->displayName(), widget->toolTip(), widget, widget->buttonWidget());
|
||||
m_widgets.append(widget);
|
||||
}
|
||||
@@ -133,9 +174,39 @@ void KitManagerConfigWidget::makeReadOnly()
|
||||
m_nameEdit->setEnabled(false);
|
||||
}
|
||||
|
||||
Kit *KitManagerConfigWidget::workingCopy() const
|
||||
{
|
||||
return m_modifiedKit;
|
||||
}
|
||||
|
||||
bool KitManagerConfigWidget::configures(Kit *k) const
|
||||
{
|
||||
return m_kit == k;
|
||||
}
|
||||
|
||||
void KitManagerConfigWidget::setIsDefaultKit(bool d)
|
||||
{
|
||||
if (m_isDefaultKit != d)
|
||||
return;
|
||||
m_isDefaultKit = d;
|
||||
emit dirty();
|
||||
}
|
||||
|
||||
bool KitManagerConfigWidget::isDefaultKit() const
|
||||
{
|
||||
return m_isDefaultKit;
|
||||
}
|
||||
|
||||
void KitManagerConfigWidget::removeKit()
|
||||
{
|
||||
if (!m_kit)
|
||||
return;
|
||||
KitManager::instance()->deregisterKit(m_kit);
|
||||
}
|
||||
|
||||
void KitManagerConfigWidget::setIcon()
|
||||
{
|
||||
const QString path = QFileDialog::getOpenFileName(this, tr("Select Icon"), m_iconPath, tr("Images (*.png *.xpm *.jpg)"));
|
||||
const QString path = QFileDialog::getOpenFileName(this, tr("Select Icon"), m_modifiedKit->iconPath(), tr("Images (*.png *.xpm *.jpg)"));
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -144,10 +215,37 @@ void KitManagerConfigWidget::setIcon()
|
||||
return;
|
||||
|
||||
m_iconButton->setIcon(icon);
|
||||
m_iconPath = path;
|
||||
m_modifiedKit->setIconPath(path);
|
||||
emit dirty();
|
||||
}
|
||||
|
||||
void KitManagerConfigWidget::setDisplayName()
|
||||
{
|
||||
m_modifiedKit->setDisplayName(m_nameEdit->text());
|
||||
}
|
||||
|
||||
void KitManagerConfigWidget::workingCopyWasUpdated(Kit *k)
|
||||
{
|
||||
if (k != m_modifiedKit || m_fixingKit)
|
||||
return;
|
||||
|
||||
m_fixingKit = true;
|
||||
k->fix();
|
||||
m_fixingKit = false;
|
||||
|
||||
foreach (KitConfigWidget *w, m_widgets)
|
||||
w->refresh();
|
||||
m_nameEdit->setText(k->displayName());
|
||||
m_iconButton->setIcon(k->icon());
|
||||
emit dirty();
|
||||
}
|
||||
|
||||
void KitManagerConfigWidget::kitWasUpdated(Kit *k)
|
||||
{
|
||||
if (m_kit == k)
|
||||
discard();
|
||||
}
|
||||
|
||||
void KitManagerConfigWidget::addToLayout(const QString &name, const QString &toolTip,
|
||||
QWidget *widget, QWidget *button)
|
||||
{
|
||||
|
@@ -44,23 +44,40 @@ class Kit;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class KitManagerConfigWidget : public ProjectExplorer::KitConfigWidget
|
||||
class KitManagerConfigWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit KitManagerConfigWidget(Kit *k, QWidget *parent = 0);
|
||||
~KitManagerConfigWidget();
|
||||
|
||||
QString displayName() const;
|
||||
|
||||
void apply();
|
||||
void discard();
|
||||
bool isDirty() const;
|
||||
bool isValid() const;
|
||||
QString validityMessage() const;
|
||||
void addConfigWidget(ProjectExplorer::KitConfigWidget *widget);
|
||||
void makeReadOnly();
|
||||
|
||||
Kit *workingCopy() const;
|
||||
bool configures(ProjectExplorer::Kit *k) const;
|
||||
void setIsDefaultKit(bool d);
|
||||
bool isDefaultKit() const;
|
||||
void removeKit();
|
||||
|
||||
public slots:
|
||||
|
||||
signals:
|
||||
void dirty();
|
||||
|
||||
private slots:
|
||||
void setIcon();
|
||||
void setDisplayName();
|
||||
void workingCopyWasUpdated(ProjectExplorer::Kit *k);
|
||||
void kitWasUpdated(ProjectExplorer::Kit *k);
|
||||
|
||||
private:
|
||||
enum LayoutColumns {
|
||||
@@ -80,7 +97,9 @@ private:
|
||||
QLineEdit *m_nameEdit;
|
||||
QList<KitConfigWidget *> m_widgets;
|
||||
Kit *m_kit;
|
||||
QString m_iconPath;
|
||||
Kit *m_modifiedKit;
|
||||
bool m_isDefaultKit;
|
||||
bool m_fixingKit;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -45,11 +45,19 @@ namespace Internal {
|
||||
class KitNode
|
||||
{
|
||||
public:
|
||||
explicit KitNode(KitNode *kn, Kit *k = 0, bool c = false) :
|
||||
parent(kn), kit(k), changed(c)
|
||||
KitNode(KitNode *kn) :
|
||||
parent(kn), widget(0)
|
||||
{
|
||||
if (kn)
|
||||
kn->childNodes.append(this);
|
||||
}
|
||||
|
||||
KitNode(KitNode *kn, Kit *k) :
|
||||
parent(kn)
|
||||
{
|
||||
if (kn)
|
||||
kn->childNodes.append(this);
|
||||
|
||||
widget = KitManager::instance()->createConfigWidget(k);
|
||||
if (widget) {
|
||||
if (k && k->isAutoDetected())
|
||||
@@ -62,6 +70,7 @@ public:
|
||||
{
|
||||
if (parent)
|
||||
parent->childNodes.removeOne(this);
|
||||
delete widget;
|
||||
|
||||
// deleting a child removes it from childNodes
|
||||
// so operate on a temporary list
|
||||
@@ -72,9 +81,7 @@ public:
|
||||
|
||||
KitNode *parent;
|
||||
QList<KitNode *> childNodes;
|
||||
Kit *kit;
|
||||
KitManagerConfigWidget *widget;
|
||||
bool changed;
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -92,8 +99,6 @@ KitModel::KitModel(QBoxLayout *parentLayout, QObject *parent) :
|
||||
this, SLOT(addKit(ProjectExplorer::Kit*)));
|
||||
connect(KitManager::instance(), SIGNAL(kitRemoved(ProjectExplorer::Kit*)),
|
||||
this, SLOT(removeKit(ProjectExplorer::Kit*)));
|
||||
connect(KitManager::instance(), SIGNAL(kitUpdated(ProjectExplorer::Kit*)),
|
||||
this, SLOT(updateKit(ProjectExplorer::Kit*)));
|
||||
connect(KitManager::instance(), SIGNAL(defaultkitChanged()),
|
||||
this, SLOT(changeDefaultKit()));
|
||||
|
||||
@@ -162,10 +167,10 @@ QVariant KitModel::data(const QModelIndex &index, int role) const
|
||||
return tr("Auto-detected");
|
||||
if (node == m_manualRoot && role == Qt::DisplayRole)
|
||||
return tr("Manual");
|
||||
if (node->kit) {
|
||||
if (node->widget) {
|
||||
if (role == Qt::FontRole) {
|
||||
QFont f = QApplication::font();
|
||||
if (node->changed)
|
||||
if (node->widget->isDirty())
|
||||
f.setBold(!f.bold());
|
||||
if (node == m_defaultNode)
|
||||
f.setItalic(f.style() != QFont::StyleItalic);
|
||||
@@ -177,9 +182,9 @@ QVariant KitModel::data(const QModelIndex &index, int role) const
|
||||
baseName = tr("%1 (default)").arg(baseName);
|
||||
return baseName;
|
||||
} else if (role == Qt::DecorationRole) {
|
||||
return node->kit->isValid() ? QIcon() : warningIcon;
|
||||
return node->widget->isValid() ? QIcon() : warningIcon;
|
||||
} else if (role == Qt::ToolTipRole) {
|
||||
return node->kit->toHtml();
|
||||
return node->widget->validityMessage();
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
@@ -192,7 +197,7 @@ Qt::ItemFlags KitModel::flags(const QModelIndex &index) const
|
||||
|
||||
KitNode *node = static_cast<KitNode *>(index.internalPointer());
|
||||
Q_ASSERT(node);
|
||||
if (!node->kit)
|
||||
if (!node->widget)
|
||||
return Qt::ItemIsEnabled;
|
||||
|
||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||
@@ -212,12 +217,12 @@ Kit *KitModel::kit(const QModelIndex &index)
|
||||
return 0;
|
||||
KitNode *node = static_cast<KitNode *>(index.internalPointer());
|
||||
Q_ASSERT(node);
|
||||
return node->kit;
|
||||
return node->widget->workingCopy();
|
||||
}
|
||||
|
||||
QModelIndex KitModel::indexOf(Kit *k) const
|
||||
{
|
||||
KitNode *n = find(k);
|
||||
KitNode *n = findWorkingCopy(k);
|
||||
return n ? index(n) : QModelIndex();
|
||||
}
|
||||
|
||||
@@ -227,7 +232,7 @@ void KitModel::setDefaultKit(const QModelIndex &index)
|
||||
return;
|
||||
KitNode *node = static_cast<KitNode *>(index.internalPointer());
|
||||
Q_ASSERT(node);
|
||||
if (node->kit)
|
||||
if (node->widget)
|
||||
setDefaultNode(node);
|
||||
}
|
||||
|
||||
@@ -236,7 +241,7 @@ bool KitModel::isDefaultKit(const QModelIndex &index)
|
||||
return m_defaultNode == static_cast<KitNode *>(index.internalPointer());
|
||||
}
|
||||
|
||||
KitConfigWidget *KitModel::widget(const QModelIndex &index)
|
||||
KitManagerConfigWidget *KitModel::widget(const QModelIndex &index)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return 0;
|
||||
@@ -248,7 +253,7 @@ KitConfigWidget *KitModel::widget(const QModelIndex &index)
|
||||
bool KitModel::isDirty() const
|
||||
{
|
||||
foreach (KitNode *n, m_manualRoot->childNodes) {
|
||||
if (n->changed)
|
||||
if (n->widget->isDirty())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -256,19 +261,19 @@ bool KitModel::isDirty() const
|
||||
|
||||
bool KitModel::isDirty(Kit *k) const
|
||||
{
|
||||
KitNode *n = find(k);
|
||||
return n ? !n->changed : false;
|
||||
KitNode *n = findWorkingCopy(k);
|
||||
return n ? n->widget->isDirty() : false;
|
||||
}
|
||||
|
||||
void KitModel::setDirty()
|
||||
{
|
||||
KitConfigWidget *w = qobject_cast<KitConfigWidget *>(sender());
|
||||
foreach (KitNode *n, m_manualRoot->childNodes) {
|
||||
if (n->widget == w) {
|
||||
n->changed = n->widget->isDirty();
|
||||
KitManagerConfigWidget *w = qobject_cast<KitManagerConfigWidget *>(sender());
|
||||
QList<KitNode *> nodes = m_manualRoot->childNodes;
|
||||
nodes << m_autoRoot->childNodes;
|
||||
foreach (KitNode *n, nodes) {
|
||||
if (n->widget == w)
|
||||
emit dataChanged(index(n, 0), index(n, columnCount(QModelIndex())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void KitModel::apply()
|
||||
@@ -277,61 +282,24 @@ void KitModel::apply()
|
||||
QList<KitNode *> nodes = m_toRemoveList;
|
||||
foreach (KitNode *n, nodes) {
|
||||
Q_ASSERT(!n->parent);
|
||||
KitManager::instance()->deregisterKit(n->kit);
|
||||
n->widget->removeKit();
|
||||
}
|
||||
Q_ASSERT(m_toRemoveList.isEmpty());
|
||||
|
||||
// Update kits:
|
||||
foreach (KitNode *n, m_manualRoot->childNodes) {
|
||||
Q_ASSERT(n);
|
||||
Q_ASSERT(n->kit);
|
||||
if (n->changed) {
|
||||
KitManager::instance()->blockSignals(true);
|
||||
if (n->widget)
|
||||
Q_ASSERT(n->widget);
|
||||
if (n->widget->isDirty()) {
|
||||
n->widget->apply();
|
||||
n->changed = false;
|
||||
|
||||
KitManager::instance()->blockSignals(false);
|
||||
KitManager::instance()->notifyAboutUpdate(n->kit);
|
||||
emit dataChanged(index(n, 0), index(n, columnCount(QModelIndex())));
|
||||
}
|
||||
}
|
||||
|
||||
// Add new (and already updated) kits
|
||||
QStringList removedSts;
|
||||
nodes = m_toAddList;
|
||||
foreach (KitNode *n, nodes) {
|
||||
if (!KitManager::instance()->registerKit(n->kit))
|
||||
removedSts << n->kit->displayName();
|
||||
}
|
||||
|
||||
foreach (KitNode *n, m_toAddList)
|
||||
markForRemoval(n->kit);
|
||||
|
||||
if (removedSts.count() == 1) {
|
||||
QMessageBox::warning(0,
|
||||
tr("Duplicate Kit Detected"),
|
||||
tr("The kit<br> %1<br>"
|
||||
" was already configured. It was not configured again.")
|
||||
.arg(removedSts.at(0)));
|
||||
|
||||
} else if (!removedSts.isEmpty()) {
|
||||
QMessageBox::warning(0,
|
||||
tr("Duplicate Kits Detected"),
|
||||
tr("The following kits were already configured:<br>"
|
||||
" %1<br>"
|
||||
"They were not configured again.")
|
||||
.arg(removedSts.join(QLatin1String(",<br> "))));
|
||||
}
|
||||
|
||||
// Set default kit:
|
||||
if (m_defaultNode)
|
||||
KitManager::instance()->setDefaultKit(m_defaultNode->kit);
|
||||
}
|
||||
|
||||
void KitModel::markForRemoval(Kit *k)
|
||||
{
|
||||
KitNode *node = find(k);
|
||||
KitNode *node = findWorkingCopy(k);
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
@@ -347,29 +315,31 @@ void KitModel::markForRemoval(Kit *k)
|
||||
beginRemoveRows(index(m_manualRoot), m_manualRoot->childNodes.indexOf(node), m_manualRoot->childNodes.indexOf(node));
|
||||
m_manualRoot->childNodes.removeOne(node);
|
||||
node->parent = 0;
|
||||
if (m_toAddList.contains(node)) {
|
||||
delete node->kit;
|
||||
node->kit = 0;
|
||||
m_toAddList.removeOne(node);
|
||||
if (node->widget->configures(0))
|
||||
delete node;
|
||||
} else {
|
||||
else
|
||||
m_toRemoveList.append(node);
|
||||
}
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
void KitModel::markForAddition(Kit *k)
|
||||
Kit *KitModel::markForAddition(Kit *baseKit)
|
||||
{
|
||||
int pos = m_manualRoot->childNodes.size();
|
||||
beginInsertRows(index(m_manualRoot), pos, pos);
|
||||
|
||||
KitNode *node = createNode(m_manualRoot, k, true);
|
||||
m_toAddList.append(node);
|
||||
KitNode *node = createNode(m_manualRoot, 0);
|
||||
if (baseKit) {
|
||||
Kit *k = node->widget->workingCopy();
|
||||
k->copyFrom(baseKit);
|
||||
k->setDisplayName(tr("Clone of %1").arg(k->displayName()));
|
||||
}
|
||||
|
||||
if (!m_defaultNode)
|
||||
setDefaultNode(node);
|
||||
|
||||
endInsertRows();
|
||||
|
||||
return node->widget->workingCopy();
|
||||
}
|
||||
|
||||
QModelIndex KitModel::index(KitNode *node, int column) const
|
||||
@@ -382,56 +352,48 @@ QModelIndex KitModel::index(KitNode *node, int column) const
|
||||
return index(node->parent->childNodes.indexOf(node), column, index(node->parent));
|
||||
}
|
||||
|
||||
KitNode *KitModel::find(Kit *k) const
|
||||
KitNode *KitModel::findWorkingCopy(Kit *k) const
|
||||
{
|
||||
foreach (KitNode *n, m_autoRoot->childNodes) {
|
||||
if (n->kit == k)
|
||||
if (n->widget->workingCopy() == k)
|
||||
return n;
|
||||
}
|
||||
foreach (KitNode *n, m_manualRoot->childNodes) {
|
||||
if (n->kit == k)
|
||||
if (n->widget->workingCopy() == k)
|
||||
return n;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
KitNode *KitModel::createNode(KitNode *parent, Kit *k, bool changed)
|
||||
KitNode *KitModel::createNode(KitNode *parent, Kit *k)
|
||||
{
|
||||
KitNode *node = new KitNode(parent, k, changed);
|
||||
if (node->widget) {
|
||||
KitNode *node = new KitNode(parent, k);
|
||||
node->widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
m_parentLayout->addWidget(node->widget, 10);
|
||||
connect(node->widget, SIGNAL(dirty()),
|
||||
this, SLOT(setDirty()));
|
||||
}
|
||||
connect(node->widget, SIGNAL(dirty()), this, SLOT(setDirty()));
|
||||
return node;
|
||||
}
|
||||
|
||||
void KitModel::setDefaultNode(KitNode *node)
|
||||
{
|
||||
if (m_defaultNode) {
|
||||
QModelIndex idx = index(m_defaultNode);
|
||||
if (idx.isValid())
|
||||
emit dataChanged(idx, idx);
|
||||
m_defaultNode->widget->setIsDefaultKit(false);
|
||||
emit dataChanged(index(m_defaultNode), index(m_defaultNode));
|
||||
}
|
||||
m_defaultNode = node;
|
||||
if (m_defaultNode) {
|
||||
QModelIndex idx = index(m_defaultNode);
|
||||
if (idx.isValid())
|
||||
emit dataChanged(idx, idx);
|
||||
m_defaultNode->widget->setIsDefaultKit(true);
|
||||
emit dataChanged(index(m_defaultNode), index(m_defaultNode));
|
||||
}
|
||||
}
|
||||
|
||||
void KitModel::addKit(Kit *k)
|
||||
{
|
||||
QList<KitNode *> nodes = m_toAddList;
|
||||
foreach (KitNode *n, nodes) {
|
||||
if (n->kit == k) {
|
||||
m_toAddList.removeOne(n);
|
||||
// do not delete n: Still used elsewhere!
|
||||
foreach (KitNode *n, m_manualRoot->childNodes) {
|
||||
// Was added by us
|
||||
if (n->widget->configures(k))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
KitNode *parent = m_manualRoot;
|
||||
if (k->isAutoDetected())
|
||||
@@ -439,7 +401,7 @@ void KitModel::addKit(Kit *k)
|
||||
int row = parent->childNodes.count();
|
||||
|
||||
beginInsertRows(index(parent), row, row);
|
||||
createNode(parent, k, false);
|
||||
createNode(parent, k);
|
||||
endInsertRows();
|
||||
|
||||
emit kitStateChanged();
|
||||
@@ -449,8 +411,10 @@ void KitModel::removeKit(Kit *k)
|
||||
{
|
||||
QList<KitNode *> nodes = m_toRemoveList;
|
||||
foreach (KitNode *n, nodes) {
|
||||
if (n->kit == k) {
|
||||
if (n->widget->configures(k)) {
|
||||
m_toRemoveList.removeOne(n);
|
||||
if (m_defaultNode == n)
|
||||
m_defaultNode = 0;
|
||||
delete n;
|
||||
return;
|
||||
}
|
||||
@@ -462,7 +426,7 @@ void KitModel::removeKit(Kit *k)
|
||||
int row = 0;
|
||||
KitNode *node = 0;
|
||||
foreach (KitNode *current, parent->childNodes) {
|
||||
if (current->kit == k) {
|
||||
if (current->widget->configures(k)) {
|
||||
node = current;
|
||||
break;
|
||||
}
|
||||
@@ -471,27 +435,25 @@ void KitModel::removeKit(Kit *k)
|
||||
|
||||
beginRemoveRows(index(parent), row, row);
|
||||
parent->childNodes.removeAt(row);
|
||||
delete node;
|
||||
if (m_defaultNode == node)
|
||||
m_defaultNode = 0;
|
||||
endRemoveRows();
|
||||
delete node;
|
||||
|
||||
emit kitStateChanged();
|
||||
}
|
||||
|
||||
void KitModel::updateKit(Kit *k)
|
||||
{
|
||||
KitNode *n = find(k);
|
||||
// This can happen if Qt Versions and kits are removed simultaneously.
|
||||
if (!n)
|
||||
return;
|
||||
if (n->widget)
|
||||
n->widget->discard();
|
||||
QModelIndex idx = index(n);
|
||||
emit dataChanged(idx, idx);
|
||||
}
|
||||
|
||||
void KitModel::changeDefaultKit()
|
||||
{
|
||||
setDefaultNode(find(KitManager::instance()->defaultKit()));
|
||||
Kit *defaultKit = KitManager::instance()->defaultKit();
|
||||
QList<KitNode *> nodes = m_autoRoot->childNodes;
|
||||
nodes << m_manualRoot->childNodes;
|
||||
foreach (KitNode *n, nodes) {
|
||||
if (n->widget->configures(defaultKit)) {
|
||||
setDefaultNode(n);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -42,11 +42,11 @@ QT_END_NAMESPACE
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class Kit;
|
||||
class KitConfigWidget;
|
||||
class KitFactory;
|
||||
class KitManager;
|
||||
|
||||
namespace Internal {
|
||||
class KitManagerConfigWidget;
|
||||
|
||||
class KitNode;
|
||||
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
void setDefaultKit(const QModelIndex &index);
|
||||
bool isDefaultKit(const QModelIndex &index);
|
||||
|
||||
KitConfigWidget *widget(const QModelIndex &);
|
||||
ProjectExplorer::Internal::KitManagerConfigWidget *widget(const QModelIndex &);
|
||||
|
||||
bool isDirty() const;
|
||||
bool isDirty(Kit *k) const;
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
void apply();
|
||||
|
||||
void markForRemoval(Kit *k);
|
||||
void markForAddition(Kit *k);
|
||||
Kit *markForAddition(Kit *baseKit);
|
||||
|
||||
signals:
|
||||
void kitStateChanged();
|
||||
@@ -93,21 +93,19 @@ signals:
|
||||
private slots:
|
||||
void addKit(ProjectExplorer::Kit *k);
|
||||
void removeKit(ProjectExplorer::Kit *k);
|
||||
void updateKit(ProjectExplorer::Kit *k);
|
||||
void changeDefaultKit();
|
||||
void setDirty();
|
||||
|
||||
private:
|
||||
QModelIndex index(KitNode *, int column = 0) const;
|
||||
KitNode *find(Kit *k) const;
|
||||
KitNode *createNode(KitNode *parent, Kit *k, bool changed);
|
||||
KitNode *findWorkingCopy(Kit *k) const;
|
||||
KitNode *createNode(KitNode *parent, Kit *k);
|
||||
void setDefaultNode(KitNode *node);
|
||||
|
||||
KitNode *m_root;
|
||||
KitNode *m_autoRoot;
|
||||
KitNode *m_manualRoot;
|
||||
|
||||
QList<KitNode *> m_toAddList;
|
||||
QList<KitNode *> m_toRemoveList;
|
||||
|
||||
QBoxLayout *m_parentLayout;
|
||||
|
@@ -32,7 +32,7 @@
|
||||
#include "kitmodel.h"
|
||||
#include "kit.h"
|
||||
#include "projectexplorerconstants.h"
|
||||
#include "kitconfigwidget.h"
|
||||
#include "kitmanagerconfigwidget.h"
|
||||
#include "kitmanager.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -173,18 +173,18 @@ void KitOptionsPage::kitSelectionChanged()
|
||||
QModelIndex current = currentIndex();
|
||||
m_currentWidget = current.isValid() ? m_model->widget(current) : 0;
|
||||
|
||||
if (m_currentWidget)
|
||||
if (m_currentWidget) {
|
||||
m_currentWidget->setVisible(true);
|
||||
m_kitsView->scrollTo(current);
|
||||
}
|
||||
updateState();
|
||||
}
|
||||
|
||||
void KitOptionsPage::addNewKit()
|
||||
{
|
||||
Kit *k = new Kit;
|
||||
m_model->markForAddition(k);
|
||||
Kit *k = m_model->markForAddition(0);
|
||||
|
||||
QModelIndex newIdx = m_model->indexOf(k);
|
||||
m_kitsView->scrollTo(newIdx);
|
||||
m_selectionModel->select(newIdx,
|
||||
QItemSelectionModel::Clear
|
||||
| QItemSelectionModel::SelectCurrent
|
||||
@@ -197,10 +197,7 @@ void KitOptionsPage::cloneKit()
|
||||
if (!current)
|
||||
return;
|
||||
|
||||
Kit *k = current->clone();
|
||||
|
||||
m_model->markForAddition(k);
|
||||
|
||||
Kit *k = m_model->markForAddition(current);
|
||||
QModelIndex newIdx = m_model->indexOf(k);
|
||||
m_kitsView->scrollTo(newIdx);
|
||||
m_selectionModel->select(newIdx,
|
||||
@@ -234,7 +231,7 @@ void KitOptionsPage::updateState()
|
||||
QModelIndex index = currentIndex();
|
||||
Kit *k = m_model->kit(index);
|
||||
if (k) {
|
||||
canCopy = k->isValid();
|
||||
canCopy = true;
|
||||
canDelete = !k->isAutoDetected();
|
||||
canMakeDefault = !m_model->isDefaultKit(index);
|
||||
}
|
||||
|
@@ -105,6 +105,22 @@ void MsvcParser::stdOutput(const QString &line)
|
||||
|
||||
if (processCompileLine(line))
|
||||
return;
|
||||
if (line.startsWith("Error:")) {
|
||||
m_lastTask = Task(Task::Error,
|
||||
line.mid(6).trimmed(), /* description */
|
||||
Utils::FileName(), /* fileName */
|
||||
-1, /* linenumber */
|
||||
Core::Id(Constants::TASK_CATEGORY_COMPILE));
|
||||
return;
|
||||
}
|
||||
if (line.startsWith("Warning:")) {
|
||||
m_lastTask = Task(Task::Warning,
|
||||
line.mid(8).trimmed(), /* description */
|
||||
Utils::FileName(), /* fileName */
|
||||
-1, /* linenumber */
|
||||
Core::Id(Constants::TASK_CATEGORY_COMPILE));
|
||||
return;
|
||||
}
|
||||
if (infoPos > -1) {
|
||||
m_lastTask = Task(Task::Unknown,
|
||||
m_additionalInfoRegExp.cap(3).trimmed(), /* description */
|
||||
@@ -280,6 +296,17 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
|
||||
Utils::FileName::fromUserInput("debug\\Experimentation.exe"), -1,
|
||||
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_COMPILE)))
|
||||
<< QString();
|
||||
QTest::newRow("Linker error 3")
|
||||
<< QString::fromLatin1("Error: dependent '..\\..\\..\\..\\creator-2.5\\src\\plugins\\coreplugin\\ifile.h' does not exist.")
|
||||
<< OutputParserTester::STDOUT
|
||||
<< QString() << QString()
|
||||
<< (QList<ProjectExplorer::Task>()
|
||||
<< Task(Task::Error,
|
||||
QLatin1String("dependent '..\\..\\..\\..\\creator-2.5\\src\\plugins\\coreplugin\\ifile.h' does not exist."),
|
||||
Utils::FileName(), -1,
|
||||
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_COMPILE)))
|
||||
<< QString();
|
||||
|
||||
QTest::newRow("Multiline error")
|
||||
<< QString::fromLatin1("c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\INCLUDE\\xutility(2227) : warning C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'\n"
|
||||
" c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\INCLUDE\\xutility(2212) : see declaration of 'std::_Copy_impl'\n"
|
||||
|
@@ -74,6 +74,9 @@ QmlProject::QmlProject(Internal::Manager *manager, const QString &fileName)
|
||||
Core::DocumentManager::addDocument(m_file, true);
|
||||
|
||||
m_manager->registerProject(this);
|
||||
|
||||
connect(this, SIGNAL(addedTarget(ProjectExplorer::Target*)),
|
||||
this, SLOT(addedTarget(ProjectExplorer::Target*)));
|
||||
}
|
||||
|
||||
QmlProject::~QmlProject()
|
||||
@@ -86,6 +89,23 @@ QmlProject::~QmlProject()
|
||||
delete m_rootNode;
|
||||
}
|
||||
|
||||
void QmlProject::addedTarget(ProjectExplorer::Target *target)
|
||||
{
|
||||
connect(target, SIGNAL(addedRunConfiguration(ProjectExplorer::RunConfiguration*)),
|
||||
this, SLOT(addedRunConfiguration(ProjectExplorer::RunConfiguration*)));
|
||||
foreach (ProjectExplorer::RunConfiguration *rc, target->runConfigurations())
|
||||
addedRunConfiguration(rc);
|
||||
}
|
||||
|
||||
void QmlProject::addedRunConfiguration(ProjectExplorer::RunConfiguration *rc)
|
||||
{
|
||||
// The enabled state of qml runconfigurations can only be decided after
|
||||
// they have been added to a project
|
||||
QmlProjectRunConfiguration *qmlrc = qobject_cast<QmlProjectRunConfiguration *>(rc);
|
||||
if (qmlrc)
|
||||
qmlrc->updateEnabled();
|
||||
}
|
||||
|
||||
QDir QmlProject::projectDir() const
|
||||
{
|
||||
return QFileInfo(document()->fileName()).dir();
|
||||
@@ -309,13 +329,6 @@ bool QmlProject::fromMap(const QVariantMap &map)
|
||||
addTarget(createTarget(defaultKit));
|
||||
|
||||
refresh(Everything);
|
||||
// FIXME workaround to guarantee that run/debug actions are enabled if a valid file exists
|
||||
if (activeTarget()) {
|
||||
QmlProjectRunConfiguration *runConfig = qobject_cast<QmlProjectRunConfiguration*>(activeTarget()->activeRunConfiguration());
|
||||
if (runConfig)
|
||||
runConfig->changeCurrentFile(0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#include <QDeclarativeEngine>
|
||||
#include <QPointer>
|
||||
|
||||
namespace ProjectExplorer { class RunConfiguration; }
|
||||
namespace QmlJS { class ModelManagerInterface; }
|
||||
namespace Utils { class FileSystemWatcher; }
|
||||
|
||||
@@ -95,6 +96,8 @@ public:
|
||||
|
||||
private slots:
|
||||
void refreshFiles(const QSet<QString> &added, const QSet<QString> &removed);
|
||||
void addedTarget(ProjectExplorer::Target *target);
|
||||
void addedRunConfiguration(ProjectExplorer::RunConfiguration *);
|
||||
|
||||
protected:
|
||||
bool fromMap(const QVariantMap &map);
|
||||
|
@@ -50,6 +50,7 @@ namespace Utils {
|
||||
namespace QtSupport { class BaseQtVersion; }
|
||||
|
||||
namespace QmlProjectManager {
|
||||
class QmlProject;
|
||||
|
||||
namespace Internal {
|
||||
class QmlProjectRunConfigurationFactory;
|
||||
@@ -61,6 +62,7 @@ class QMLPROJECTMANAGER_EXPORT QmlProjectRunConfiguration : public ProjectExplor
|
||||
Q_OBJECT
|
||||
friend class Internal::QmlProjectRunConfigurationFactory;
|
||||
friend class Internal::QmlProjectRunConfigurationWidget;
|
||||
friend class QmlProject; // to call updateEnabled()
|
||||
|
||||
public:
|
||||
QmlProjectRunConfiguration(ProjectExplorer::Target *parent, Core::Id id);
|
||||
@@ -93,10 +95,8 @@ public:
|
||||
|
||||
ProjectExplorer::Abi abi() const;
|
||||
|
||||
public slots:
|
||||
void changeCurrentFile(Core::IEditor*);
|
||||
|
||||
private slots:
|
||||
void changeCurrentFile(Core::IEditor*);
|
||||
void updateEnabled();
|
||||
|
||||
protected:
|
||||
|
@@ -77,7 +77,7 @@ QtSupport::BaseQtVersion *BlackBerryQtVersionFactory::create(const Utils::FileNa
|
||||
if (!fi.exists() || !fi.isExecutable() || !fi.isFile())
|
||||
return 0;
|
||||
|
||||
if (evaluator->value(QLatin1String("CONFIG")).contains(QLatin1String("blackberry"))) {
|
||||
if (evaluator->values(QLatin1String("CONFIG")).contains(QLatin1String("blackberry"))) {
|
||||
QString cpuDir = evaluator->value(QLatin1String("QNX_CPUDIR"));
|
||||
return new BlackBerryQtVersion(QnxUtils::cpudirToArch(cpuDir), qmakePath,
|
||||
isAutoDetected, autoDetectionSource);
|
||||
|
@@ -54,8 +54,8 @@ QmakeKitConfigWidget::QmakeKitConfigWidget(ProjectExplorer::Kit *k, QWidget *par
|
||||
m_lineEdit->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addWidget(m_lineEdit);
|
||||
|
||||
discard(); // set up everything according to kit
|
||||
connect(m_lineEdit, SIGNAL(textEdited(QString)), this, SIGNAL(dirty()));
|
||||
refresh(); // set up everything according to kit
|
||||
connect(m_lineEdit, SIGNAL(textEdited(QString)), this, SLOT(mkspecWasChanged(QString)));
|
||||
}
|
||||
|
||||
QString QmakeKitConfigWidget::displayName() const
|
||||
@@ -68,19 +68,14 @@ void QmakeKitConfigWidget::makeReadOnly()
|
||||
m_lineEdit->setEnabled(false);
|
||||
}
|
||||
|
||||
void QmakeKitConfigWidget::apply()
|
||||
{
|
||||
QmakeKitInformation::setMkspec(m_kit, Utils::FileName::fromString(m_lineEdit->text()));
|
||||
}
|
||||
|
||||
void QmakeKitConfigWidget::discard()
|
||||
void QmakeKitConfigWidget::refresh()
|
||||
{
|
||||
m_lineEdit->setText(QmakeKitInformation::mkspec(m_kit).toString());
|
||||
}
|
||||
|
||||
bool QmakeKitConfigWidget::isDirty() const
|
||||
void QmakeKitConfigWidget::mkspecWasChanged(const QString &text)
|
||||
{
|
||||
return m_lineEdit->text() != QmakeKitInformation::mkspec(m_kit).toString();
|
||||
QmakeKitInformation::setMkspec(m_kit, Utils::FileName::fromString(text));
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -52,9 +52,10 @@ public:
|
||||
|
||||
void makeReadOnly();
|
||||
|
||||
void apply();
|
||||
void discard();
|
||||
bool isDirty() const;
|
||||
void refresh();
|
||||
|
||||
private slots:
|
||||
void mkspecWasChanged(const QString &text);
|
||||
|
||||
private:
|
||||
int findQtVersion(const int id) const;
|
||||
|
@@ -64,7 +64,7 @@ QVariant QmakeKitInformation::defaultValue(ProjectExplorer::Kit *k) const
|
||||
return QString();
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::Task> QmakeKitInformation::validate(ProjectExplorer::Kit *k) const
|
||||
QList<ProjectExplorer::Task> QmakeKitInformation::validate(const ProjectExplorer::Kit *k) const
|
||||
{
|
||||
QList<ProjectExplorer::Task> result;
|
||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
|
||||
|
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
QVariant defaultValue(ProjectExplorer::Kit *k) const;
|
||||
|
||||
QList<ProjectExplorer::Task> validate(ProjectExplorer::Kit *k) const;
|
||||
QList<ProjectExplorer::Task> validate(const ProjectExplorer::Kit *k) const;
|
||||
|
||||
ProjectExplorer::KitConfigWidget *createConfigWidget(ProjectExplorer::Kit *k) const;
|
||||
|
||||
|
@@ -161,7 +161,6 @@ void Qt4BuildConfiguration::emitBuildDirectoryChanged()
|
||||
Environment Qt4BuildConfiguration::baseEnvironment() const
|
||||
{
|
||||
Environment env = BuildConfiguration::baseEnvironment();
|
||||
target()->kit()->addToEnvironment(env);
|
||||
return env;
|
||||
}
|
||||
|
||||
|
@@ -1412,7 +1412,8 @@ QString Qt4Project::buildNameFor(const Kit *k)
|
||||
{
|
||||
if (!k)
|
||||
return QLatin1String("unknown");
|
||||
return QString::fromLatin1(k->id().name()).mid(31, 6); // part of the UUID, should be pretty unique;-)
|
||||
|
||||
return k->fileSystemFriendlyName();
|
||||
}
|
||||
|
||||
Target *Qt4Project::createTarget(Kit *k, const QList<BuildConfigurationInfo> &infoList)
|
||||
|
@@ -303,12 +303,6 @@ QList<ProjectExplorer::Task> BaseQtVersion::validateKit(const ProjectExplorer::K
|
||||
Q_ASSERT(version == this);
|
||||
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
|
||||
if (!tc)
|
||||
result << ProjectExplorer::Task(ProjectExplorer::Task::Error,
|
||||
ProjectExplorer::ToolChainKitInformation::msgNoToolChainInTarget(),
|
||||
FileName(), -1,
|
||||
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
|
||||
|
||||
const QList<ProjectExplorer::Abi> qtAbis = version->qtAbis();
|
||||
if (tc && !qtAbis.contains(tc->targetAbi())) {
|
||||
|
@@ -73,13 +73,11 @@ QtKitConfigWidget::QtKitConfigWidget(ProjectExplorer::Kit *k, QWidget *parent) :
|
||||
versionIds.append(v->uniqueId());
|
||||
versionsChanged(versionIds, QList<int>(), QList<int>());
|
||||
|
||||
discard();
|
||||
connect(m_combo, SIGNAL(currentIndexChanged(int)), this, SIGNAL(dirty()));
|
||||
refresh();
|
||||
connect(m_combo, SIGNAL(currentIndexChanged(int)), this, SLOT(currentWasChanged(int)));
|
||||
|
||||
connect(mgr, SIGNAL(qtVersionsChanged(QList<int>,QList<int>,QList<int>)),
|
||||
this, SLOT(versionsChanged(QList<int>,QList<int>,QList<int>)));
|
||||
connect(ProjectExplorer::KitManager::instance(), SIGNAL(kitUpdated(ProjectExplorer::Kit*)),
|
||||
this, SLOT(kitUpdated(ProjectExplorer::Kit*)));
|
||||
|
||||
connect(m_manageButton, SIGNAL(clicked()), this, SLOT(manageQtVersions()));
|
||||
}
|
||||
@@ -94,23 +92,11 @@ void QtKitConfigWidget::makeReadOnly()
|
||||
m_combo->setEnabled(false);
|
||||
}
|
||||
|
||||
void QtKitConfigWidget::apply()
|
||||
{
|
||||
int id = m_combo->itemData(m_combo->currentIndex()).toInt();
|
||||
QtKitInformation::setQtVersionId(m_kit, id);
|
||||
}
|
||||
|
||||
void QtKitConfigWidget::discard()
|
||||
void QtKitConfigWidget::refresh()
|
||||
{
|
||||
m_combo->setCurrentIndex(findQtVersion(QtKitInformation::qtVersionId(m_kit)));
|
||||
}
|
||||
|
||||
bool QtKitConfigWidget::isDirty() const
|
||||
{
|
||||
int id = m_combo->itemData(m_combo->currentIndex()).toInt();
|
||||
return id != QtKitInformation::qtVersionId(m_kit);
|
||||
}
|
||||
|
||||
QWidget *QtKitConfigWidget::buttonWidget() const
|
||||
{
|
||||
return m_manageButton;
|
||||
@@ -141,27 +127,17 @@ void QtKitConfigWidget::versionsChanged(const QList<int> &added, const QList<int
|
||||
}
|
||||
}
|
||||
|
||||
void QtKitConfigWidget::kitUpdated(ProjectExplorer::Kit *k)
|
||||
{
|
||||
if (k != m_kit)
|
||||
return;
|
||||
|
||||
int id = QtKitInformation::qtVersionId(k);
|
||||
|
||||
for (int i = 0; i < m_combo->count(); ++i) {
|
||||
if (m_combo->itemData(i).toInt() == id) {
|
||||
m_combo->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QtKitConfigWidget::manageQtVersions()
|
||||
{
|
||||
Core::ICore::showOptionsDialog(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY),
|
||||
QLatin1String(QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID));
|
||||
}
|
||||
|
||||
void QtKitConfigWidget::currentWasChanged(int idx)
|
||||
{
|
||||
QtKitInformation::setQtVersionId(m_kit, m_combo->itemData(idx).toInt());
|
||||
}
|
||||
|
||||
int QtKitConfigWidget::findQtVersion(const int id) const
|
||||
{
|
||||
for (int i = 0; i < m_combo->count(); ++i) {
|
||||
|
@@ -53,15 +53,13 @@ public:
|
||||
|
||||
void makeReadOnly();
|
||||
|
||||
void apply();
|
||||
void discard();
|
||||
bool isDirty() const;
|
||||
void refresh();
|
||||
QWidget *buttonWidget() const;
|
||||
|
||||
private slots:
|
||||
void versionsChanged(const QList<int> &added, const QList<int> &removed, const QList<int> &changed);
|
||||
void kitUpdated(ProjectExplorer::Kit *k);
|
||||
void manageQtVersions();
|
||||
void currentWasChanged(int idx);
|
||||
|
||||
private:
|
||||
int findQtVersion(const int id) const;
|
||||
|
@@ -84,19 +84,21 @@ QVariant QtKitInformation::defaultValue(ProjectExplorer::Kit *k) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::Task> QtKitInformation::validate(ProjectExplorer::Kit *k) const
|
||||
QList<ProjectExplorer::Task> QtKitInformation::validate(const ProjectExplorer::Kit *k) const
|
||||
{
|
||||
int id = qtVersionId(k);
|
||||
if (id == -1)
|
||||
BaseQtVersion *version = qtVersion(k);
|
||||
if (!version)
|
||||
return QList<ProjectExplorer::Task>();
|
||||
BaseQtVersion *version = QtVersionManager::instance()->version(id);
|
||||
if (!version) {
|
||||
setQtVersionId(k, -1);
|
||||
return QList<ProjectExplorer::Task>();
|
||||
}
|
||||
return version->validateKit(k);
|
||||
}
|
||||
|
||||
void QtKitInformation::fix(ProjectExplorer::Kit *k)
|
||||
{
|
||||
BaseQtVersion *version = qtVersion(k);
|
||||
if (!version)
|
||||
setQtVersionId(k, -1);
|
||||
}
|
||||
|
||||
ProjectExplorer::KitConfigWidget *QtKitInformation::createConfigWidget(ProjectExplorer::Kit *k) const
|
||||
{
|
||||
return new Internal::QtKitConfigWidget(k);
|
||||
|
@@ -51,7 +51,8 @@ public:
|
||||
|
||||
QVariant defaultValue(ProjectExplorer::Kit *k) const;
|
||||
|
||||
QList<ProjectExplorer::Task> validate(ProjectExplorer::Kit *k) const;
|
||||
QList<ProjectExplorer::Task> validate(const ProjectExplorer::Kit *k) const;
|
||||
void fix(ProjectExplorer::Kit *);
|
||||
|
||||
ProjectExplorer::KitConfigWidget *createConfigWidget(ProjectExplorer::Kit *k) const;
|
||||
|
||||
|
@@ -695,15 +695,18 @@ static bool byStartOfRange(const QTextLayout::FormatRange &range, const QTextLay
|
||||
void SyntaxHighlighter::setExtraAdditionalFormats(const QTextBlock& block,
|
||||
const QList<QTextLayout::FormatRange> &fmts)
|
||||
{
|
||||
|
||||
// qDebug() << "setAdditionalFormats() on block" << block.blockNumber();
|
||||
// qDebug() << " is valid:" << (block.isValid() ? "Yes" : "No");
|
||||
// qDebug() << " has layout:" << (block.layout() ? "Yes" : "No");
|
||||
// if (block.layout()) qDebug() << " has text:" << (block.text().isEmpty() ? "No" : "Yes");
|
||||
|
||||
// for (int i = 0; i < overrides.count(); ++i)
|
||||
// qDebug() << " from " << overrides.at(i).start << "length"
|
||||
// << overrides.at(i).length
|
||||
// << "color:" << overrides.at(i).format.foreground().color();
|
||||
Q_D(SyntaxHighlighter);
|
||||
|
||||
if (block.layout() == 0)
|
||||
if (block.layout() == 0 || block.text().isEmpty())
|
||||
return;
|
||||
|
||||
QList<QTextLayout::FormatRange> formats;
|
||||
|
@@ -1205,10 +1205,11 @@ void QMakeEvaluator::setupProject()
|
||||
{
|
||||
setTemplate();
|
||||
ProValueMap &vars = m_valuemapStack.top();
|
||||
vars[ProKey("TARGET")] << ProString(QFileInfo(currentFileName()).baseName());
|
||||
vars[ProKey("_PRO_FILE_")] << ProString(currentFileName());
|
||||
vars[ProKey("_PRO_FILE_PWD_")] << ProString(currentDirectory());
|
||||
vars[ProKey("OUT_PWD")] << ProString(m_outputDir);
|
||||
ProFile *proFile = currentProFile();
|
||||
vars[ProKey("TARGET")] << ProString(QFileInfo(currentFileName()).baseName()).setSource(proFile);
|
||||
vars[ProKey("_PRO_FILE_")] << ProString(currentFileName()).setSource(proFile);
|
||||
vars[ProKey("_PRO_FILE_PWD_")] << ProString(currentDirectory()).setSource(proFile);
|
||||
vars[ProKey("OUT_PWD")] << ProString(m_outputDir).setSource(proFile);
|
||||
}
|
||||
|
||||
void QMakeEvaluator::evaluateCommand(const QString &cmds, const QString &where)
|
||||
|
@@ -46,8 +46,8 @@ def main():
|
||||
"text='Online Community'")),
|
||||
"Verifying: Link to Qt forums exists.")
|
||||
test.verify(checkIfObjectExists(getQmlItem("LinkedText", ":Qt Creator_QDeclarativeView", False,
|
||||
"text='Labs'")),
|
||||
"Verifying: Link to Qt Labs – Developers blog exists.")
|
||||
"text='Blogs'")),
|
||||
"Verifying: Link to Planet Qt exists.")
|
||||
qmlItem = getQmlItem("Text", ":Qt Creator_QDeclarativeView", False, "text='IDE Overview'")
|
||||
expectedText = "QtCreator : IDE Overview"
|
||||
testDetails = "Verifying: Help with IDE Overview topic is being opened."
|
||||
|
Reference in New Issue
Block a user