summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@digia.com>2013-11-19 07:41:47 +0100
committerEike Ziller <eike.ziller@digia.com>2013-11-19 07:41:47 +0100
commit8fe04ce0ade7758892a9171e8dc599762cf862c9 (patch)
tree286904ba648d1002240f4b00aaa49927b78aa3e8 /src
parent72e81db349de4d6b168f18cca327134873110593 (diff)
parentd190e7ca914c836dd2236b305ba26b4732d00ab5 (diff)
downloadqt-creator-8fe04ce0ade7758892a9171e8dc599762cf862c9.tar.gz
Merge remote-tracking branch 'origin/3.0'
Diffstat (limited to 'src')
-rw-r--r--src/libs/3rdparty/cplusplus/TranslationUnit.cpp2
-rw-r--r--src/libs/extensionsystem/extensionsystem.pro2
-rw-r--r--src/libs/qtcreatorcdbext/symbolgroupvalue.cpp16
-rw-r--r--src/libs/utils/pathchooser.cpp9
-rw-r--r--src/libs/utils/textfileformat.cpp34
-rw-r--r--src/libs/utils/textfileformat.h4
-rw-r--r--src/plugins/android/androidconfigurations.cpp22
-rw-r--r--src/plugins/android/androidconfigurations.h1
-rw-r--r--src/plugins/android/androidsettingswidget.cpp6
-rw-r--r--src/plugins/coreplugin/dialogs/shortcutsettings.cpp2
-rw-r--r--src/plugins/coreplugin/editormanager/editormanager.cpp1
-rw-r--r--src/plugins/coreplugin/generalsettings.cpp3
-rw-r--r--src/plugins/coreplugin/manhattanstyle.cpp1
-rw-r--r--src/plugins/coreplugin/progressmanager/progressmanager.cpp2
-rw-r--r--src/plugins/coreplugin/styleanimator.h2
-rw-r--r--src/plugins/cppeditor/cppeditor.pro3
-rw-r--r--src/plugins/cppeditor/cppeditor.qbs1
-rw-r--r--src/plugins/cppeditor/cppeditorplugin.h5
-rw-r--r--src/plugins/cppeditor/cppincludehierarchy_test.cpp134
-rw-r--r--src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp43
-rw-r--r--src/plugins/cpptools/cpppreprocessor.cpp21
-rw-r--r--src/plugins/cpptools/cpppreprocessor.h6
-rw-r--r--src/plugins/debugger/debuggerprotocol.cpp5
-rw-r--r--src/plugins/debugger/gdb/gdbengine.cpp4
-rw-r--r--src/plugins/debugger/gdb/pythongdbengine.cpp6
-rw-r--r--src/plugins/debugger/gdb/remotegdbserveradapter.cpp2
-rw-r--r--src/plugins/debugger/threaddata.h1
-rw-r--r--src/plugins/debugger/threadshandler.cpp84
-rw-r--r--src/plugins/debugger/threadshandler.h6
-rw-r--r--src/plugins/find/searchresulttreeitemdelegate.cpp55
-rw-r--r--src/plugins/find/searchresulttreeitemdelegate.h2
-rw-r--r--src/plugins/git/gitclient.cpp12
-rw-r--r--src/plugins/git/gitclient.h5
-rw-r--r--src/plugins/git/gitversioncontrol.cpp3
-rw-r--r--src/plugins/projectexplorer/msvcparser.cpp35
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp8
-rw-r--r--src/plugins/qbsprojectmanager/qbsnodes.cpp10
-rw-r--r--src/plugins/qbsprojectmanager/qbsnodes.h1
-rw-r--r--src/plugins/qbsprojectmanager/qbsproject.cpp4
-rw-r--r--src/plugins/qmldesigner/componentsplugin/components.metainfo10
-rw-r--r--src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp15
-rw-r--r--src/plugins/qmldesigner/qtquickplugin/quick.metainfo27
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertraceview.cpp49
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertraceview.h23
-rw-r--r--src/plugins/qmlprofiler/qv8profilereventview.cpp9
-rw-r--r--src/plugins/qmlprofiler/qv8profilereventview.h1
-rw-r--r--src/plugins/qnx/blackberryndksettingswidget.cpp9
-rw-r--r--src/plugins/qnx/blackberryndksettingswidget.h2
-rw-r--r--src/plugins/qnx/blackberrysetupwizardpages.cpp2
-rw-r--r--src/plugins/qnx/qnxdebugsupport.cpp29
-rw-r--r--src/plugins/qnx/qnxdebugsupport.h8
-rw-r--r--src/plugins/qnx/qnxutils.cpp2
-rw-r--r--src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp4
-rw-r--r--src/plugins/texteditor/generichighlighter/highlighter.cpp6
-rw-r--r--src/shared/proparser/qmakebuiltins.cpp58
-rw-r--r--src/shared/proparser/qmakeevaluator.cpp112
-rw-r--r--src/shared/proparser/qmakeevaluator.h1
-rw-r--r--src/shared/proparser/qmakeglobals.h3
58 files changed, 602 insertions, 331 deletions
diff --git a/src/libs/3rdparty/cplusplus/TranslationUnit.cpp b/src/libs/3rdparty/cplusplus/TranslationUnit.cpp
index 7b3b59f19e..9d949acbcf 100644
--- a/src/libs/3rdparty/cplusplus/TranslationUnit.cpp
+++ b/src/libs/3rdparty/cplusplus/TranslationUnit.cpp
@@ -449,7 +449,7 @@ void TranslationUnit::message(DiagnosticClient::Level level, unsigned index, con
if (DiagnosticClient *client = control()->diagnosticClient()) {
client->report(level, fileName, line, column, format, args);
} else {
- fprintf(stderr, "%s:%d: ", fileName->chars(), line);
+ fprintf(stderr, "%s:%u: ", fileName->chars(), line);
const char *l = "error";
if (level == DiagnosticClient::Warning)
l = "warning";
diff --git a/src/libs/extensionsystem/extensionsystem.pro b/src/libs/extensionsystem/extensionsystem.pro
index b7f6bc22eb..cd492543a3 100644
--- a/src/libs/extensionsystem/extensionsystem.pro
+++ b/src/libs/extensionsystem/extensionsystem.pro
@@ -1,7 +1,7 @@
DEFINES += EXTENSIONSYSTEM_LIBRARY
include(../../qtcreatorlibrary.pri)
-unix:!macx:!freebsd*:LIBS += -ldl
+unix:LIBS += $$QMAKE_LIBS_DYNLOAD
!isEmpty(vcproj) {
DEFINES += IDE_TEST_DIR=\"$$IDE_SOURCE_TREE\"
diff --git a/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp b/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp
index 2caaa38ab6..19635c4212 100644
--- a/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp
+++ b/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp
@@ -1844,14 +1844,16 @@ static inline bool dumpQRegExp(const SymbolGroupValue &v, std::wostream &str)
static inline bool dumpQFile(const SymbolGroupValue &v, std::wostream &str)
{
// Get address of the file name string, obtain value by dumping a QString at address
- static unsigned qIoDevicePrivateSize = 0;
- if (!qIoDevicePrivateSize) {
- const std::string qIoDevicePrivateType = QtInfo::get(v.context()).prependQtCoreModule("QIODevicePrivate");
- qIoDevicePrivateSize = padOffset(SymbolGroupValue::sizeOf(qIoDevicePrivateType.c_str()));
- }
- if (!qIoDevicePrivateSize)
+ static unsigned qFileBasePrivateSize = 0;
+ if (!qFileBasePrivateSize) {
+ const QtInfo info = QtInfo::get(v.context());
+ const std::string qIoDevicePrivateType =info.prependQtCoreModule(
+ info.version < 5 ? "QIODevicePrivate" : "QFileDevicePrivate");
+ qFileBasePrivateSize = padOffset(SymbolGroupValue::sizeOf(qIoDevicePrivateType.c_str()));
+ }
+ if (!qFileBasePrivateSize)
return false;
- return dumpQStringFromQPrivateClass(v, QPDM_qVirtual, qIoDevicePrivateSize, str);
+ return dumpQStringFromQPrivateClass(v, QPDM_qVirtual, qFileBasePrivateSize, str);
}
/* Dump QHostAddress, for whose private class no debugging information is available.
diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp
index d6e3a59301..6ff1e3efce 100644
--- a/src/libs/utils/pathchooser.cpp
+++ b/src/libs/utils/pathchooser.cpp
@@ -387,6 +387,15 @@ void PathChooser::slotBrowse()
newPath = QFileDialog::getOpenFileName(this,
makeDialogTitle(tr("Choose Executable")), predefined,
d->m_dialogFilter);
+ if (HostOsInfo::hostOs() == OsTypeMac && newPath.endsWith(QLatin1String(".app"))) {
+ // possibly expand to Foo.app/Contents/MacOS/Foo
+ QFileInfo info(newPath);
+ if (info.isDir()) {
+ QString exePath = newPath + QLatin1String("/Contents/MacOS/") + info.completeBaseName();
+ if (QFileInfo(exePath).isExecutable())
+ newPath = exePath;
+ }
+ }
break;
case PathChooser::File: // fall through
newPath = QFileDialog::getOpenFileName(this,
diff --git a/src/libs/utils/textfileformat.cpp b/src/libs/utils/textfileformat.cpp
index bbd90e7a8a..c4b26695b3 100644
--- a/src/libs/utils/textfileformat.cpp
+++ b/src/libs/utils/textfileformat.cpp
@@ -304,6 +304,40 @@ TextFileFormat::ReadResult TextFileFormat::readFileUTF8(const QString &fileName,
return TextFileFormat::ReadSuccess;
}
+TextFileFormat::ReadResult TextFileFormat::readFileUTF8(const QString &fileName,
+ const QTextCodec *defaultCodec,
+ QByteArray *plainText, QString *errorString)
+{
+ QByteArray data;
+ try {
+ Utils::FileReader reader;
+ if (!reader.fetch(fileName, errorString))
+ return Utils::TextFileFormat::ReadIOError;
+ data = reader.data();
+ } catch (const std::bad_alloc &) {
+ *errorString = QCoreApplication::translate("Utils::TextFileFormat", "Out of memory.");
+ return Utils::TextFileFormat::ReadMemoryAllocationError;
+ }
+
+ Utils::TextFileFormat format = Utils::TextFileFormat::detect(data);
+ if (!format.codec)
+ format.codec = defaultCodec ? defaultCodec : QTextCodec::codecForLocale();
+ if (format.codec->name() == "UTF-8") {
+ if (format.hasUtf8Bom)
+ data.remove(0, 3);
+ *plainText = data;
+ return Utils::TextFileFormat::ReadSuccess;
+ }
+
+ QString target;
+ if (!format.decode(data, &target)) {
+ *errorString = QCoreApplication::translate("Utils::TextFileFormat", "An encoding error was encountered.");
+ return Utils::TextFileFormat::ReadEncodingError;
+ }
+ *plainText = target.toUtf8();
+ return Utils::TextFileFormat::ReadSuccess;
+}
+
/*!
Writes out a text file.
*/
diff --git a/src/libs/utils/textfileformat.h b/src/libs/utils/textfileformat.h
index 91121c9a9d..9ca55042e1 100644
--- a/src/libs/utils/textfileformat.h
+++ b/src/libs/utils/textfileformat.h
@@ -77,7 +77,9 @@ public:
QString *plainText, TextFileFormat *format, QString *errorString,
QByteArray *decodingErrorSample = 0);
static ReadResult readFileUTF8(const QString &fileName, QByteArray *plainText,
- QString *errorString);
+ QString *errorString); // TODO: Remove this version.
+ static ReadResult readFileUTF8(const QString &fileName, const QTextCodec *defaultCodec,
+ QByteArray *plainText, QString *errorString);
bool writeFile(const QString &fileName, QString plainText, QString *errorString) const;
diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp
index 9db1a4f864..ddbfdf05bc 100644
--- a/src/plugins/android/androidconfigurations.cpp
+++ b/src/plugins/android/androidconfigurations.cpp
@@ -470,6 +470,8 @@ QVector<AndroidDeviceInfo> AndroidConfigurations::connectedDevices(QString *erro
foreach (const QByteArray &device, adbDevs) {
const QString serialNo = QString::fromLatin1(device.left(device.indexOf('\t')).trimmed());
const QString deviceType = QString::fromLatin1(device.mid(device.indexOf('\t'))).trimmed();
+ if (isBootToQt(serialNo))
+ continue;
AndroidDeviceInfo dev;
dev.serialNumber = serialNo;
dev.type = serialNo.startsWith(QLatin1String("emulator")) ? AndroidDeviceInfo::Emulator : AndroidDeviceInfo::Hardware;
@@ -702,6 +704,22 @@ QString AndroidConfigurations::waitForAvd(int apiLevel, const QString &cpuAbi, c
return QString();
}
+bool AndroidConfigurations::isBootToQt(const QString &device) const
+{
+ // workaround for '????????????' serial numbers
+ QStringList arguments = AndroidDeviceInfo::adbSelector(device);
+ arguments << QLatin1String("shell")
+ << QLatin1String("ls -l /system/bin/appcontroller || ls -l /usr/bin/appcontroller && echo Boot2Qt");
+
+ QProcess adbProc;
+ adbProc.start(adbToolPath().toString(), arguments);
+ if (!adbProc.waitForFinished(-1)) {
+ adbProc.kill();
+ return -1;
+ }
+ return adbProc.readAll().contains("Boot2Qt");
+}
+
int AndroidConfigurations::getSDKVersion(const QString &device) const
{
// workaround for '????????????' serial numbers
@@ -767,8 +785,7 @@ bool AndroidConfigurations::hasFinishedBooting(const QString &device) const
QStringList AndroidConfigurations::getAbis(const QString &device) const
{
QStringList result;
- int i = 1;
- while (true) {
+ for (int i = 1; i < 6; ++i) {
QStringList arguments = AndroidDeviceInfo::adbSelector(device);
arguments << QLatin1String("shell") << QLatin1String("getprop");
if (i == 1)
@@ -786,7 +803,6 @@ QStringList AndroidConfigurations::getAbis(const QString &device) const
if (abi.isEmpty())
break;
result << abi;
- ++i;
}
return result;
}
diff --git a/src/plugins/android/androidconfigurations.h b/src/plugins/android/androidconfigurations.h
index c858cb2d90..bbca09ce86 100644
--- a/src/plugins/android/androidconfigurations.h
+++ b/src/plugins/android/androidconfigurations.h
@@ -150,6 +150,7 @@ private:
int getSDKVersion(const QString &device) const;
QStringList getAbis(const QString &device) const;
+ bool isBootToQt(const QString &device) const;
void updateAvailableNdkPlatforms();
void updateAvailableSdkPlatforms();
diff --git a/src/plugins/android/androidsettingswidget.cpp b/src/plugins/android/androidsettingswidget.cpp
index 6668d0a783..7e72ee3b6a 100644
--- a/src/plugins/android/androidsettingswidget.cpp
+++ b/src/plugins/android/androidsettingswidget.cpp
@@ -316,7 +316,11 @@ void AndroidSettingsWidget::searchForAnt(const QString &location)
foreach (const QString &file, parentFolder.entryList()) {
if (file.startsWith(QLatin1String("apache-ant"))) {
Utils::FileName ant = Utils::FileName::fromString(parentFolder.absolutePath());
- ant.appendPath(file).appendPath(QLatin1String("bin")).appendPath(QLatin1String("ant.bat"));
+ ant.appendPath(file).appendPath(QLatin1String("bin"));
+ if (Utils::HostOsInfo::isWindowsHost())
+ ant.appendPath(QLatin1String("ant.bat"));
+ else
+ ant.appendPath(QLatin1String("ant"));
if (ant.toFileInfo().exists()) {
m_androidConfig.antLocation = ant;
m_ui->AntLocationLineEdit->setText(ant.toUserOutput());
diff --git a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp
index 26aebb407d..a774587f92 100644
--- a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp
+++ b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp
@@ -158,7 +158,7 @@ void ShortcutSettings::targetIdentifierChanged()
void ShortcutSettings::setKeySequence(const QKeySequence &key)
{
- m_keyNum = m_key[0] = m_key[1] = m_key[2] = m_key[3] = 0;
+ m_key[0] = m_key[1] = m_key[2] = m_key[3] = 0;
m_keyNum = key.count();
for (int i = 0; i < m_keyNum; ++i) {
m_key[i] = key[i];
diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index f86b8308ea..fb7620213f 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -1253,6 +1253,7 @@ Core::IEditor *EditorManager::placeEditor(Core::Internal::EditorView *view, Core
if (replacementView)
replacementView->removeEditor(replacement);
sourceView->addEditor(replacement);
+ sourceView->setCurrentEditor(replacement);
}
}
return editor;
diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp
index 1e11947db3..834879c172 100644
--- a/src/plugins/coreplugin/generalsettings.cpp
+++ b/src/plugins/coreplugin/generalsettings.cpp
@@ -116,10 +116,9 @@ QWidget *GeneralSettings::createPage(QWidget *parent)
QSettings *settings = Core::ICore::settings();
const QStringList availableTerminals = ConsoleProcess::availableTerminalEmulators();
const QString currentTerminal = ConsoleProcess::terminalEmulator(settings, false);
- const QString currentTerminalExplicit = ConsoleProcess::terminalEmulator(settings, true);
m_page->terminalComboBox->addItems(availableTerminals);
m_page->terminalComboBox->lineEdit()->setText(currentTerminal);
- m_page->terminalComboBox->lineEdit()->setPlaceholderText(currentTerminalExplicit);
+ m_page->terminalComboBox->lineEdit()->setPlaceholderText(ConsoleProcess::defaultTerminalEmulator());
} else {
m_page->terminalLabel->hide();
m_page->terminalComboBox->hide();
diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp
index 15fcbfc977..2bec68c320 100644
--- a/src/plugins/coreplugin/manhattanstyle.cpp
+++ b/src/plugins/coreplugin/manhattanstyle.cpp
@@ -779,7 +779,6 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
{
QRect rect = option->rect;
bool horizontal = option->state & State_Horizontal;
- rect = option->rect;
// Map offset for global window gradient
QPoint offset = widget->window()->mapToGlobal(option->rect.topLeft()) -
diff --git a/src/plugins/coreplugin/progressmanager/progressmanager.cpp b/src/plugins/coreplugin/progressmanager/progressmanager.cpp
index 419d8be0b7..06ccacecd4 100644
--- a/src/plugins/coreplugin/progressmanager/progressmanager.cpp
+++ b/src/plugins/coreplugin/progressmanager/progressmanager.cpp
@@ -67,7 +67,7 @@ using namespace Core::Internal;
for running tasks in Qt Creator.
It tracks the progress of a task that it is told
- about, and shows a progress indicator in the left hand tool bar
+ about, and shows a progress indicator in the lower right
of Qt Creator's main window to the user.
The progress indicator also allows the user to cancel the task.
diff --git a/src/plugins/coreplugin/styleanimator.h b/src/plugins/coreplugin/styleanimator.h
index 37b25b5baf..a16e38758d 100644
--- a/src/plugins/coreplugin/styleanimator.h
+++ b/src/plugins/coreplugin/styleanimator.h
@@ -71,7 +71,7 @@ protected:
class Transition : public Animation
{
public :
- Transition() : Animation() {}
+ Transition() : Animation(), m_duration(100) {}
virtual ~Transition() {}
void setDuration(int duration) { m_duration = duration; }
void setStartImage(const QImage &image) { m_primaryImage = image; }
diff --git a/src/plugins/cppeditor/cppeditor.pro b/src/plugins/cppeditor/cppeditor.pro
index f7fe4eb9af..6257e2c165 100644
--- a/src/plugins/cppeditor/cppeditor.pro
+++ b/src/plugins/cppeditor/cppeditor.pro
@@ -63,7 +63,8 @@ equals(TEST, 1) {
cppquickfix_test_utils.cpp \
cppdoxygen_test.cpp \
fileandtokenactions_test.cpp \
- followsymbol_switchmethoddecldef_test.cpp
+ followsymbol_switchmethoddecldef_test.cpp \
+ cppincludehierarchy_test.cpp
DEFINES += SRCDIR=\\\"$$PWD\\\"
}
diff --git a/src/plugins/cppeditor/cppeditor.qbs b/src/plugins/cppeditor/cppeditor.qbs
index 920b3a834b..a92808d279 100644
--- a/src/plugins/cppeditor/cppeditor.qbs
+++ b/src/plugins/cppeditor/cppeditor.qbs
@@ -79,6 +79,7 @@ QtcPlugin {
"cppquickfix_test_utils.h",
"fileandtokenactions_test.cpp",
"followsymbol_switchmethoddecldef_test.cpp",
+ "cppincludehierarchy_test.cpp",
]
cpp.defines: outer.concat(['SRCDIR="' + FileInfo.path(filePath) + '"'])
diff --git a/src/plugins/cppeditor/cppeditorplugin.h b/src/plugins/cppeditor/cppeditorplugin.h
index 96339e1040..6ef49d92dc 100644
--- a/src/plugins/cppeditor/cppeditorplugin.h
+++ b/src/plugins/cppeditor/cppeditorplugin.h
@@ -308,6 +308,11 @@ private slots:
void test_functionhelper_virtualFunctions();
void test_functionhelper_virtualFunctions_data();
+ // tests for "Include Hiererchy"
+ void test_includeHierarchyModel_simpleIncludes();
+ void test_includeHierarchyModel_simpleIncludedBy();
+ void test_includeHierarchyModel_simpleIncludesAndIncludedBy();
+
// The following tests depend on the projects that are loaded on startup
// and will be skipped in case no projects are loaded.
void test_openEachFile();
diff --git a/src/plugins/cppeditor/cppincludehierarchy_test.cpp b/src/plugins/cppeditor/cppincludehierarchy_test.cpp
new file mode 100644
index 0000000000..e52273743c
--- /dev/null
+++ b/src/plugins/cppeditor/cppincludehierarchy_test.cpp
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "cppeditorplugin.h"
+#include "cppincludehierarchymodel.h"
+
+#include <cpptools/cppmodelmanagerinterface.h>
+#include <utils/fileutils.h>
+
+#include <QByteArray>
+#include <QList>
+#include <QtTest>
+
+using namespace CPlusPlus;
+using namespace CppEditor::Internal;
+using namespace CppTools;
+
+namespace {
+class TestCase
+{
+public:
+ TestCase(const QList<QByteArray> &sourceList)
+ : m_cmm(CppModelManagerInterface::instance())
+ {
+ QStringList filePaths;
+ const int sourceListSize = sourceList.size();
+ for (int i = 0; i < sourceListSize; ++i) {
+ const QByteArray &source = sourceList.at(i);
+
+ // Write source to file
+ const QString fileName = QString::fromLatin1("%1/file%2.h").arg(QDir::tempPath())
+ .arg(i+1);
+ Utils::FileSaver srcSaver(fileName);
+ srcSaver.write(source);
+ srcSaver.finalize();
+
+ filePaths << fileName;
+ }
+
+ // Update Code Model
+ m_cmm->updateSourceFiles(filePaths);
+
+ // Wait for the parser in the future to give us the document
+ QStringList filePathsNotYetInSnapshot(filePaths);
+ forever {
+ const Snapshot snapshot = m_cmm->snapshot();
+ foreach (const QString &filePath, filePathsNotYetInSnapshot) {
+ if (snapshot.contains(filePath))
+ filePathsNotYetInSnapshot.removeOne(filePath);
+ }
+ if (filePathsNotYetInSnapshot.isEmpty())
+ break;
+ QCoreApplication::processEvents();
+ }
+ }
+
+ ~TestCase()
+ {
+ m_cmm->GC();
+ QVERIFY(m_cmm->snapshot().isEmpty());
+ }
+
+ void run(int includesCount, int includedByCount) const
+ {
+ const QString fileName = QDir::tempPath() + QLatin1String("/file1.h");
+
+ CppIncludeHierarchyModel model(0);
+ model.buildHierarchy(fileName);
+ QCOMPARE(model.rowCount(model.index(0, 0)), includesCount);
+ QCOMPARE(model.rowCount(model.index(1, 0)), includedByCount);
+ }
+
+private:
+ CppModelManagerInterface *m_cmm;
+};
+}
+
+void CppEditorPlugin::test_includeHierarchyModel_simpleIncludes()
+{
+ QList<QByteArray> sourceList;
+ sourceList.append(QByteArray("#include \"file2.h\"\n"));
+ sourceList.append(QByteArray());
+
+ TestCase testCase(sourceList);
+ testCase.run(1, 0);
+}
+
+void CppEditorPlugin::test_includeHierarchyModel_simpleIncludedBy()
+{
+ QList<QByteArray> sourceList;
+ sourceList.append(QByteArray());
+ sourceList.append(QByteArray("#include \"file1.h\"\n"));
+
+ TestCase testCase(sourceList);
+ testCase.run(0, 1);
+}
+
+void CppEditorPlugin::test_includeHierarchyModel_simpleIncludesAndIncludedBy()
+{
+ QList<QByteArray> sourceList;
+ QByteArray source;
+ sourceList.append(QByteArray("#include \"file2.h\"\n"));
+ sourceList.append(QByteArray());
+ sourceList.append(QByteArray("#include \"file1.h\"\n"));
+
+ TestCase testCase(sourceList);
+ testCase.run(1, 1);
+}
diff --git a/src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp b/src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp
index f3151d6487..1e0f45334f 100644
--- a/src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp
+++ b/src/plugins/cppeditor/cppvirtualfunctionassistprovider.cpp
@@ -227,9 +227,12 @@ static bool isVirtualFunction_helper(const Function *function,
LookupContext context(document, snapshot);
QList<LookupItem> results = context.lookup(function->name(), function->enclosingScope());
if (!results.isEmpty()) {
+ const bool isDestructor = function->name()->isDestructorNameId();
foreach (const LookupItem &item, results) {
if (Symbol *symbol = item.declaration()) {
if (Function *functionType = symbol->type()->asFunctionType()) {
+ if (functionType->name()->isDestructorNameId() != isDestructor)
+ continue;
if (functionType == function) // already tested
continue;
if (functionType->isFinal())
@@ -255,35 +258,6 @@ bool FunctionHelper::isPureVirtualFunction(const Function *function, const Snaps
return isVirtualFunction_helper(function, snapshot, PureVirtual);
}
-static bool isDerivedOf(Class *derivedClassCandidate, Class *baseClass,
- const Snapshot &snapshot)
-{
- QTC_ASSERT(derivedClassCandidate && baseClass, return false);
-
- QList<CppClass> l = QList<CppClass>() << CppClass(derivedClassCandidate);
-
- while (!l.isEmpty()) {
- CppClass clazz = l.takeFirst();
- QTC_ASSERT(clazz.declaration, continue);
-
- const QString fileName = QString::fromUtf8(clazz.declaration->fileName());
- const Document::Ptr document = snapshot.document(fileName);
- if (!document)
- continue;
- const LookupContext context(document, snapshot);
- clazz.lookupBases(clazz.declaration, context);
-
- foreach (const CppClass &base, clazz.bases) {
- if (base.declaration == baseClass)
- return true;
- if (!l.contains(base))
- l << base;
- }
- }
-
- return false;
-}
-
QList<Symbol *> FunctionHelper::overrides(Function *function, Class *functionsClass,
Class *staticClass, const Snapshot &snapshot)
{
@@ -296,7 +270,7 @@ QList<Symbol *> FunctionHelper::overrides(Function *function, Class *functionsCl
// Find overrides
CppEditor::Internal::CppClass cppClass = CppClass(functionsClass);
- cppClass.lookupDerived(functionsClass, snapshot);
+ cppClass.lookupDerived(staticClass, snapshot);
QList<CppClass> l;
l << cppClass;
@@ -309,11 +283,6 @@ QList<Symbol *> FunctionHelper::overrides(Function *function, Class *functionsCl
Class *c = clazz.declaration->asClass();
QTC_ASSERT(c, continue);
- if (c != functionsClass && c != staticClass) {
- if (!isDerivedOf(c, staticClass, snapshot))
- continue;
- }
-
foreach (const CppClass &d, clazz.derived) {
if (!l.contains(d))
l << d;
@@ -443,6 +412,10 @@ void CppEditorPlugin::test_functionhelper_virtualFunctions_data()
"struct Derived : Base { virtual void foo() final {} };\n"
"struct Derived2 : Derived { void foo() {} };")
<< (VirtualityList() << Virtual << Virtual << NotVirtual);
+
+ QTest::newRow("ctor-virtual-dtor")
+ << _("struct Base { Base() {} virtual ~Base() {} };\n")
+ << (VirtualityList() << NotVirtual << Virtual);
}
} // namespace Internal
diff --git a/src/plugins/cpptools/cpppreprocessor.cpp b/src/plugins/cpptools/cpppreprocessor.cpp
index 56668fe644..f8d14bf123 100644
--- a/src/plugins/cpptools/cpppreprocessor.cpp
+++ b/src/plugins/cpptools/cpppreprocessor.cpp
@@ -2,11 +2,15 @@
#include "cppmodelmanager.h"
+#include <coreplugin/editormanager/editormanager.h>
+
+#include <utils/fileutils.h>
#include <utils/hostosinfo.h>
#include <utils/textfileformat.h>
#include <QCoreApplication>
#include <QCryptographicHash>
+#include <QTextCodec>
/*!
* \class CppTools::Internal::CppPreprocessor
@@ -30,7 +34,8 @@ CppPreprocessor::CppPreprocessor(QPointer<CppModelManager> modelManager,
m_modelManager(modelManager),
m_dumpFileNameWhileParsing(dumpFileNameWhileParsing),
m_preprocess(this, &m_env),
- m_revision(0)
+ m_revision(0),
+ m_defaultCodec(Core::EditorManager::defaultTextCodec())
{
m_preprocess.setKeepComments(true);
}
@@ -41,7 +46,8 @@ CppPreprocessor::CppPreprocessor(QPointer<CppModelManager> modelManager, const S
m_modelManager(modelManager),
m_dumpFileNameWhileParsing(dumpFileNameWhileParsing),
m_preprocess(this, &m_env),
- m_revision(0)
+ m_revision(0),
+ m_defaultCodec(Core::EditorManager::defaultTextCodec())
{
m_preprocess.setKeepComments(true);
}
@@ -182,9 +188,14 @@ void CppPreprocessor::getFileContents(const QString &absoluteFilePath,
return;
}
- QString errStr;
- if (contents)
- Utils::TextFileFormat::readFileUTF8(absoluteFilePath, contents, &errStr);
+ if (contents) {
+ QString error;
+ if (Utils::TextFileFormat::readFileUTF8(absoluteFilePath, m_defaultCodec, contents, &error)
+ != Utils::TextFileFormat::ReadSuccess) {
+ qWarning("Error reading file \"%s\": \"%s\".", qPrintable(absoluteFilePath),
+ qPrintable(error));
+ }
+ }
if (revision)
*revision = 0;
}
diff --git a/src/plugins/cpptools/cpppreprocessor.h b/src/plugins/cpptools/cpppreprocessor.h
index d0d84ac8e3..40a9509701 100644
--- a/src/plugins/cpptools/cpppreprocessor.h
+++ b/src/plugins/cpptools/cpppreprocessor.h
@@ -9,6 +9,10 @@
#include <QHash>
#include <QPointer>
+QT_BEGIN_NAMESPACE
+class QTextCodec;
+QT_END_NAMESPACE
+
namespace CppTools {
namespace Internal {
@@ -75,6 +79,7 @@ protected:
virtual void sourceNeeded(unsigned line, const QString &fileName, IncludeType type);
private:
+ CppPreprocessor();
void addFrameworkPath(const QString &frameworkPath);
CPlusPlus::Snapshot m_snapshot;
@@ -92,6 +97,7 @@ private:
QSet<QString> m_processed;
unsigned m_revision;
QHash<QString, QString> m_fileNameCache;
+ QTextCodec *m_defaultCodec;
};
} // namespace Internal
diff --git a/src/plugins/debugger/debuggerprotocol.cpp b/src/plugins/debugger/debuggerprotocol.cpp
index 991e83324f..a65f4f2997 100644
--- a/src/plugins/debugger/debuggerprotocol.cpp
+++ b/src/plugins/debugger/debuggerprotocol.cpp
@@ -630,7 +630,10 @@ QString decodeData(const QByteArray &ba, int encoding)
return QString::fromUtf8(decodedBa);
}
case MillisecondsSinceEpoch: {
- const qint64 ms = ba.toLongLong();
+ bool ok = false;
+ const qint64 ms = ba.toLongLong(&ok);
+ if (!ok)
+ return QLatin1String(ba);
QDateTime d;
d.setTimeSpec(Qt::UTC);
d.setMSecsSinceEpoch(ms);
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 05978ecbc1..ae83e0801f 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -1829,10 +1829,6 @@ void GdbEngine::handlePythonSetup(const GdbResponse &response)
postCommand("bbsetup");
}
- postCommand("python qqStringCutOff = "
- + debuggerCore()->action(MaximalStringLength)->value().toByteArray(),
- ConsoleCommand|NonCriticalResponse);
-
m_hasPython = true;
GdbMi data;
data.fromStringMultiple(response.consoleStreamOutput);
diff --git a/src/plugins/debugger/gdb/pythongdbengine.cpp b/src/plugins/debugger/gdb/pythongdbengine.cpp
index 1c79150c40..3fd1283799 100644
--- a/src/plugins/debugger/gdb/pythongdbengine.cpp
+++ b/src/plugins/debugger/gdb/pythongdbengine.cpp
@@ -37,6 +37,7 @@
#include <debugger/stackhandler.h>
+#include <utils/savedaction.h>
#include <utils/qtcassert.h>
#define PRECONDITION QTC_CHECK(hasPython())
@@ -58,6 +59,9 @@ void GdbEngine::updateLocalsPython(const UpdateParameters &params)
expanded += "typeformats:" + handler->typeFormatRequests() + ' ';
expanded += "formats:" + handler->individualFormatRequests();
+ QByteArray cutOff = " stringcutoff:"
+ + debuggerCore()->action(MaximalStringLength)->value().toByteArray();
+
QByteArray watchers;
const QString fileName = stackHandler()->currentFrame().file;
const QString function = stackHandler()->currentFrame().function;
@@ -127,7 +131,7 @@ void GdbEngine::updateLocalsPython(const UpdateParameters &params)
resultVar = "resultvarname:" + m_resultVarName + ' ';
postCommand("bb options:" + options + " vars:" + params.varList + ' '
- + resultVar + expanded + " watchers:" + watchers.toHex(),
+ + resultVar + expanded + " watchers:" + watchers.toHex() + cutOff,
Discardable, CB(handleStackFramePython), QVariant(params.tryPartial));
}
diff --git a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp
index a32387a577..5cec6a3572 100644
--- a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp
+++ b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp
@@ -182,7 +182,7 @@ void GdbRemoteServerEngine::setupInferior()
//const QByteArray sysroot = sp.sysroot.toLocal8Bit();
//const QByteArray remoteArch = sp.remoteArchitecture.toLatin1();
- const QString args = sp.processArgs;
+ const QString args = isMasterEngine() ? startParameters().processArgs : masterEngine()->startParameters().processArgs;
// if (!remoteArch.isEmpty())
// postCommand("set architecture " + remoteArch);
diff --git a/src/plugins/debugger/threaddata.h b/src/plugins/debugger/threaddata.h
index 15927dc174..5362cad03b 100644
--- a/src/plugins/debugger/threaddata.h
+++ b/src/plugins/debugger/threaddata.h
@@ -52,6 +52,7 @@ public:
bool isValid() const { return m_id != -1; }
qint64 raw() const { return m_id; }
bool operator==(const ThreadId other) const { return m_id == other.m_id; }
+ bool operator!=(const ThreadId other) const { return m_id != other.m_id; }
private:
qint64 m_id;
diff --git a/src/plugins/debugger/threadshandler.cpp b/src/plugins/debugger/threadshandler.cpp
index 45504decd6..e5f21ef227 100644
--- a/src/plugins/debugger/threadshandler.cpp
+++ b/src/plugins/debugger/threadshandler.cpp
@@ -130,7 +130,7 @@ static QString threadToolTip(const ThreadData &thread)
*/
ThreadsHandler::ThreadsHandler()
- : m_currentIndex(-1),
+ : m_currentId(),
m_positionIcon(QLatin1String(":/debugger/images/location_16.png")),
m_emptyIcon(QLatin1String(":/debugger/images/debugger_empty_14.png"))
{
@@ -140,6 +140,11 @@ ThreadsHandler::ThreadsHandler()
// m_proxyModel->setSourceModel(this);
}
+int ThreadsHandler::currentThreadIndex() const
+{
+ return indexOf(m_currentId);
+}
+
int ThreadsHandler::rowCount(const QModelIndex &parent) const
{
// Since the stack is not a tree, row count is 0 for any valid parent.
@@ -196,7 +201,7 @@ QVariant ThreadsHandler::data(const QModelIndex &index, int role) const
case Qt::DecorationRole:
// Return icon that indicates whether this is the active stack frame.
if (index.column() == 0)
- return (index.row() == m_currentIndex) ? m_positionIcon : m_emptyIcon;
+ return (thread.id == m_currentId) ? m_positionIcon : m_emptyIcon;
break;
case ThreadData::IdRole:
return thread.id.raw();
@@ -246,9 +251,7 @@ Qt::ItemFlags ThreadsHandler::flags(const QModelIndex &index) const
ThreadId ThreadsHandler::currentThread() const
{
- if (m_currentIndex < 0 || m_currentIndex >= m_threads.size())
- return ThreadId();
- return m_threads[m_currentIndex].id;
+ return m_currentId;
}
ThreadId ThreadsHandler::threadAt(int index) const
@@ -259,23 +262,22 @@ ThreadId ThreadsHandler::threadAt(int index) const
void ThreadsHandler::setCurrentThread(ThreadId id)
{
- const int index = indexOf(id);
- if (index == m_currentIndex)
+ if (id == m_currentId)
return;
+ const int index = indexOf(id);
if (index == -1) {
qWarning("ThreadsHandler::setCurrentThreadId: No such thread %d.", int(id.raw()));
return;
}
// Emit changed for previous frame.
- if (m_currentIndex != -1)
- dataChanged(m_currentIndex);
+ threadDataChanged(m_currentId);
- m_currentIndex = index;
+ m_currentId = id;
// Emit changed for new frame.
- dataChanged(m_currentIndex);
+ threadDataChanged(m_currentId);
updateThreadBox();
}
@@ -297,7 +299,7 @@ void ThreadsHandler::updateThread(const ThreadData &thread)
endInsertRows();
} else {
mergeThreadData(m_threads[i], thread);
- dataChanged(i);
+ threadDataChanged(thread.id);
}
}
@@ -315,8 +317,14 @@ void ThreadsHandler::setThreads(const Threads &threads)
{
beginResetModel();
m_threads = threads;
- if (m_currentIndex >= m_threads.size())
- m_currentIndex = -1;
+ bool found = false;
+ for (int i = 0, n = m_threads.size(); i < n; ++i)
+ if (threads.at(i).id == m_currentId) {
+ found = true;
+ break;
+ }
+ if (!found)
+ m_currentId = ThreadId();
m_resetLocationScheduled = false;
endResetModel();
updateThreadBox();
@@ -327,13 +335,17 @@ void ThreadsHandler::updateThreadBox()
QStringList list;
foreach (const ThreadData &thread, m_threads)
list.append(QString::fromLatin1("#%1 %2").arg(thread.id.raw()).arg(thread.name));
- debuggerCore()->setThreads(list, m_currentIndex);
+ debuggerCore()->setThreads(list, indexOf(m_currentId));
}
-void ThreadsHandler::dataChanged(int index)
+void ThreadsHandler::threadDataChanged(ThreadId id)
{
- Q_UNUSED(index);
- layoutChanged();
+ int row = indexOf(id);
+ if (row < 0)
+ return;
+ QModelIndex l = index(row, 0);
+ QModelIndex r = index(row, ThreadData::ColumnCount - 1);
+ dataChanged(l, r);
}
Threads ThreadsHandler::threads() const
@@ -351,7 +363,7 @@ void ThreadsHandler::removeAll()
{
beginResetModel();
m_threads.clear();
- m_currentIndex = -1;
+ m_currentId = ThreadId();
endResetModel();
}
@@ -381,7 +393,7 @@ void ThreadsHandler::notifyRunning(ThreadId id)
int i = indexOf(id);
if (i >= 0) {
m_threads[i].notifyRunning();
- dataChanged(i);
+ threadDataChanged(id);
}
}
@@ -411,7 +423,7 @@ void ThreadsHandler::notifyStopped(ThreadId id)
int i = indexOf(id);
if (i >= 0) {
m_threads[i].stopped = true;
- dataChanged(i);
+ threadDataChanged(id);
}
}
@@ -423,15 +435,10 @@ void ThreadsHandler::updateThreads(const GdbMi &data)
// state="stopped",core="0"}],current-thread-id="1"
// Emit changed for previous frame.
- if (m_currentIndex != -1) {
- dataChanged(m_currentIndex);
- m_currentIndex = -1;
- }
-
- ThreadId currentId;
- const GdbMi current = data["current-thread-id"];
- if (current.isValid())
- currentId = ThreadId(current.data().toLongLong());
+// if (m_currentIndex != -1) {
+// rowChanged(m_currentIndex);
+// m_currentIndex = -1;
+// }
const QList<GdbMi> items = data["threads"].children();
const int n = items.size();
@@ -449,17 +456,20 @@ void ThreadsHandler::updateThreads(const GdbMi &data)
thread.fileName = frame["fullname"].toLatin1();
thread.lineNumber = frame["line"].toInt();
thread.module = QString::fromLocal8Bit(frame["from"].data());
- thread.stopped = true;
thread.name = item["name"].toLatin1();
- if (thread.state == QLatin1String("running"))
- thread.stopped = false;
- if (thread.id == currentId)
- m_currentIndex = index;
+ thread.stopped = thread.state != QLatin1String("running");
updateThread(thread);
}
- if (m_currentIndex != -1)
- dataChanged(m_currentIndex);
+ const GdbMi current = data["current-thread-id"];
+ if (current.isValid()) {
+ ThreadId currentId = ThreadId(current.data().toLongLong());
+ if (currentId != m_currentId) {
+ threadDataChanged(m_currentId);
+ m_currentId = currentId;
+ threadDataChanged(m_currentId);
+ }
+ }
updateThreadBox();
}
diff --git a/src/plugins/debugger/threadshandler.h b/src/plugins/debugger/threadshandler.h
index 4b717eae31..2720ef4f11 100644
--- a/src/plugins/debugger/threadshandler.h
+++ b/src/plugins/debugger/threadshandler.h
@@ -57,7 +57,7 @@ class ThreadsHandler : public QAbstractTableModel
public:
ThreadsHandler();
- int currentThreadIndex() const { return m_currentIndex; }
+ int currentThreadIndex() const;
ThreadId currentThread() const;
ThreadId threadAt(int index) const;
void setCurrentThread(ThreadId id);
@@ -93,10 +93,10 @@ private:
int role = Qt::DisplayRole) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
void updateThreadBox();
- void dataChanged(int index);
+ void threadDataChanged(ThreadId id);
Threads m_threads;
- int m_currentIndex;
+ ThreadId m_currentId;
const QIcon m_positionIcon;
const QIcon m_emptyIcon;
diff --git a/src/plugins/find/searchresulttreeitemdelegate.cpp b/src/plugins/find/searchresulttreeitemdelegate.cpp
index b4333e9e07..a1cf8f778a 100644
--- a/src/plugins/find/searchresulttreeitemdelegate.cpp
+++ b/src/plugins/find/searchresulttreeitemdelegate.cpp
@@ -144,7 +144,7 @@ int SearchResultTreeItemDelegate::drawLineNumber(QPainter *painter, const QStyle
}
void SearchResultTreeItemDelegate::drawText(QPainter *painter,
- const QStyleOptionViewItem &opt,
+ const QStyleOptionViewItem &option,
const QRect &rect,
const QModelIndex &index) const
{
@@ -159,7 +159,7 @@ void SearchResultTreeItemDelegate::drawText(QPainter *painter,
const int searchTermStart = index.model()->data(index, ItemDataRoles::SearchTermStartRole).toInt();
int searchTermLength = index.model()->data(index, ItemDataRoles::SearchTermLengthRole).toInt();
if (searchTermStart < 0 || searchTermStart >= text.length() || searchTermLength < 1) {
- QItemDelegate::drawDisplay(painter, opt, rect, text);
+ QItemDelegate::drawDisplay(painter, option, rect, text);
return;
}
// clip searchTermLength to end of line
@@ -168,29 +168,48 @@ void SearchResultTreeItemDelegate::drawText(QPainter *painter,
int searchTermStartPixels = painter->fontMetrics().width(text.left(searchTermStart));
int searchTermLengthPixels = painter->fontMetrics().width(text.mid(searchTermStart, searchTermLength));
- // Text before the highlighting
+ // rects
QRect beforeHighlightRect(rect);
beforeHighlightRect.setRight(beforeHighlightRect.left() + searchTermStartPixels);
- QStyleOptionViewItem noHighlightOpt = opt;
+
+ QRect resultHighlightRect(rect);
+ resultHighlightRect.setLeft(beforeHighlightRect.right());
+ resultHighlightRect.setRight(resultHighlightRect.left() + searchTermLengthPixels);
+
+ QRect afterHighlightRect(rect);
+ afterHighlightRect.setLeft(resultHighlightRect.right());
+
+ // paint all highlight backgrounds
+ // qitemdelegate has problems with painting background when highlighted
+ // (highlighted background at wrong position because text is offset with textMargin)
+ // so we duplicate a lot here, see qitemdelegate for reference
+ bool isSelected = option.state & QStyle::State_Selected;
+ QPalette::ColorGroup cg = option.state & QStyle::State_Enabled
+ ? QPalette::Normal : QPalette::Disabled;
+ if (cg == QPalette::Normal && !(option.state & QStyle::State_Active))
+ cg = QPalette::Inactive;
+ QStyleOptionViewItem baseOption = option;
+ baseOption.state &= ~QStyle::State_Selected;
+ if (isSelected) {
+ painter->fillRect(beforeHighlightRect.adjusted(textMargin, 0, textMargin, 0),
+ option.palette.brush(cg, QPalette::Highlight));
+ painter->fillRect(afterHighlightRect.adjusted(textMargin, 0, textMargin, 0),
+ option.palette.brush(cg, QPalette::Highlight));
+ }
+ const QColor highlightBackground =
+ index.model()->data(index, ItemDataRoles::ResultHighlightBackgroundColor).value<QColor>();
+ painter->fillRect(resultHighlightRect.adjusted(textMargin, 0, textMargin - 1, 0), QBrush(highlightBackground));
+
+ // Text before the highlighting
+ QStyleOptionViewItem noHighlightOpt = baseOption;
noHighlightOpt.rect = beforeHighlightRect;
noHighlightOpt.textElideMode = Qt::ElideNone;
+ if (isSelected)
+ noHighlightOpt.palette.setColor(QPalette::Text, noHighlightOpt.palette.color(cg, QPalette::HighlightedText));
QItemDelegate::drawDisplay(painter, noHighlightOpt,
beforeHighlightRect, text.mid(0, searchTermStart));
- // Highlight background
- QRect highlightBackgroundRect(rect);
- highlightBackgroundRect.setLeft(highlightBackgroundRect.left()
- + searchTermStartPixels + textMargin - 1); // -1: Cosmetics
- highlightBackgroundRect.setRight(highlightBackgroundRect.left()
- + searchTermLengthPixels + 1); // +1: Cosmetics
- const QColor highlightBackground =
- index.model()->data(index, ItemDataRoles::ResultHighlightBackgroundColor).value<QColor>();
- painter->fillRect(highlightBackgroundRect, QBrush(highlightBackground));
-
// Highlight text
- QRect resultHighlightRect(rect);
- resultHighlightRect.setLeft(beforeHighlightRect.right());
- resultHighlightRect.setRight(resultHighlightRect.left() + searchTermLengthPixels + textMargin);
QStyleOptionViewItem highlightOpt = noHighlightOpt;
const QColor highlightForeground =
index.model()->data(index, ItemDataRoles::ResultHighlightForegroundColor).value<QColor>();
@@ -199,8 +218,6 @@ void SearchResultTreeItemDelegate::drawText(QPainter *painter,
text.mid(searchTermStart, searchTermLength));
// Text after the Highlight
- QRect afterHighlightRect(rect);
- afterHighlightRect.setLeft(resultHighlightRect.right());
noHighlightOpt.rect = afterHighlightRect;
QItemDelegate::drawDisplay(painter, noHighlightOpt, afterHighlightRect,
text.mid(searchTermStart + searchTermLength));
diff --git a/src/plugins/find/searchresulttreeitemdelegate.h b/src/plugins/find/searchresulttreeitemdelegate.h
index d1659df148..ecef309835 100644
--- a/src/plugins/find/searchresulttreeitemdelegate.h
+++ b/src/plugins/find/searchresulttreeitemdelegate.h
@@ -43,7 +43,7 @@ public:
private:
int drawLineNumber(QPainter *painter, const QStyleOptionViewItemV3 &option, const QRect &rect, const QModelIndex &index) const;
- void drawText(QPainter *painter, const QStyleOptionViewItem &opt,
+ void drawText(QPainter *painter, const QStyleOptionViewItem &option,
const QRect &rect, const QModelIndex &index) const;
static const int m_minimumLineNumberDigits = 6;
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index c534a3425d..c37ff7c12e 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -1663,18 +1663,12 @@ bool GitClient::synchronousLog(const QString &workingDirectory, const QStringLis
return rc;
}
-// Warning: 'intendToAdd' works only from 1.6.1 onwards
-bool GitClient::synchronousAdd(const QString &workingDirectory,
- bool intendToAdd,
- const QStringList &files)
+bool GitClient::synchronousAdd(const QString &workingDirectory, const QStringList &files)
{
QByteArray outputText;
QByteArray errorText;
QStringList arguments;
- arguments << QLatin1String("add");
- if (intendToAdd)
- arguments << QLatin1String("--intent-to-add");
- arguments.append(files);
+ arguments << QLatin1String("add") << files;
const bool rc = fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText);
if (!rc) {
msgCannotRun(tr("Cannot add %n file(s) to \"%1\": %2", 0, files.size())
@@ -3160,7 +3154,7 @@ bool GitClient::addAndCommit(const QString &repositoryDirectory,
if (!filesToRemove.isEmpty() && !synchronousDelete(repositoryDirectory, true, filesToRemove))
return false;
- if (!filesToAdd.isEmpty() && !synchronousAdd(repositoryDirectory, false, filesToAdd))
+ if (!filesToAdd.isEmpty() && !synchronousAdd(repositoryDirectory, filesToAdd))
return false;
// Do the final commit
diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h
index 5d0d4da9fd..de86aea73b 100644
--- a/src/plugins/git/gitclient.h
+++ b/src/plugins/git/gitclient.h
@@ -162,10 +162,7 @@ public:
bool synchronousLog(const QString &workingDirectory,
const QStringList &arguments,
QString *output, QString *errorMessage = 0);
- bool synchronousAdd(const QString &workingDirectory,
- // Warning: Works only from 1.6.1 onwards
- bool intendToAdd,
- const QStringList &files);
+ bool synchronousAdd(const QString &workingDirectory, const QStringList &files);
bool synchronousDelete(const QString &workingDirectory,
bool force,
const QStringList &files);
diff --git a/src/plugins/git/gitversioncontrol.cpp b/src/plugins/git/gitversioncontrol.cpp
index b43c3b0a2d..95c4890b5f 100644
--- a/src/plugins/git/gitversioncontrol.cpp
+++ b/src/plugins/git/gitversioncontrol.cpp
@@ -86,9 +86,8 @@ bool GitVersionControl::vcsOpen(const QString & /*fileName*/)
bool GitVersionControl::vcsAdd(const QString & fileName)
{
- // Implement in terms of using "--intent-to-add"
const QFileInfo fi(fileName);
- return m_client->synchronousAdd(fi.absolutePath(), true, QStringList(fi.fileName()));
+ return m_client->synchronousAdd(fi.absolutePath(), QStringList(fi.fileName()));
}
bool GitVersionControl::vcsDelete(const QString & fileName)
diff --git a/src/plugins/projectexplorer/msvcparser.cpp b/src/plugins/projectexplorer/msvcparser.cpp
index 653d9e30f7..8244363a6d 100644
--- a/src/plugins/projectexplorer/msvcparser.cpp
+++ b/src/plugins/projectexplorer/msvcparser.cpp
@@ -70,8 +70,7 @@ MsvcParser::MsvcParser()
+ QLatin1String(ERROR_PATTERN) + QLatin1String(".*)$"));
m_compileRegExp.setMinimal(true);
QTC_CHECK(m_compileRegExp.isValid());
- m_additionalInfoRegExp.setPattern(QString::fromLatin1("^ (.*)\\((\\d+)\\) : (.*)$"));
- m_additionalInfoRegExp.setMinimal(true);
+ m_additionalInfoRegExp.setPattern(QString::fromLatin1("^ (?:(could be |or )\\s*')?(.*)\\((\\d+)\\) : (.*)$"));
QTC_CHECK(m_additionalInfoRegExp.isValid());
}
@@ -123,10 +122,13 @@ void MsvcParser::stdOutput(const QString &line)
return;
}
if (infoPos > -1) {
- m_lastTask = Task(Task::Unknown,
- m_additionalInfoRegExp.cap(3).trimmed(), /* description */
- Utils::FileName::fromUserInput(m_additionalInfoRegExp.cap(1)), /* fileName */
- m_additionalInfoRegExp.cap(2).toInt(), /* linenumber */
+ QString description = m_additionalInfoRegExp.cap(1)
+ + m_additionalInfoRegExp.cap(4).trimmed();
+ if (!m_additionalInfoRegExp.cap(1).isEmpty())
+ description.chop(1); // Remove trailing quote
+ m_lastTask = Task(Task::Unknown, description,
+ Utils::FileName::fromUserInput(m_additionalInfoRegExp.cap(2)), /* fileName */
+ m_additionalInfoRegExp.cap(3).toInt(), /* linenumber */
Constants::TASK_CATEGORY_COMPILE);
return;
}
@@ -362,6 +364,27 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
Utils::FileName::fromUserInput(QLatin1String("symbolgroupvalue.cpp")), 2314,
Constants::TASK_CATEGORY_COMPILE))
<< QString();
+
+ QTest::newRow("Ambiguous symbol")
+ << QString::fromLatin1("D:\\Project\\file.h(98) : error C2872: 'UINT64' : ambiguous symbol\n"
+ " could be 'C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\include\\basetsd.h(83) : unsigned __int64 UINT64'\n"
+ " or 'D:\\Project\\types.h(71) : Types::UINT64'")
+ << OutputParserTester::STDOUT
+ << QString() << QString()
+ << (QList<Task>()
+ << Task(Task::Error,
+ QLatin1String("C2872: 'UINT64' : ambiguous symbol"),
+ Utils::FileName::fromUserInput(QLatin1String("D:\\Project\\file.h")), 98,
+ Constants::TASK_CATEGORY_COMPILE)
+ << Task(Task::Unknown,
+ QLatin1String("could be unsigned __int64 UINT64"),
+ Utils::FileName::fromUserInput(QLatin1String("C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\include\\basetsd.h")), 83,
+ Constants::TASK_CATEGORY_COMPILE)
+ << Task(Task::Unknown,
+ QLatin1String("or Types::UINT64"),
+ Utils::FileName::fromUserInput(QLatin1String("D:\\Project\\types.h")), 71,
+ Constants::TASK_CATEGORY_COMPILE))
+ << QString();
}
void ProjectExplorerPlugin::testMsvcOutputParsers()
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index ace7379aae..3b373d128f 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -1367,10 +1367,12 @@ QList<Project *> ProjectExplorerPlugin::openProjects(const QStringList &fileName
QTC_ASSERT(!fileName.isEmpty(), continue);
QFileInfo fi = QFileInfo(fileName);
- QString canonicalFilePath = fi.canonicalFilePath();
+ QString filePath = fileName;
+ if (fi.exists()) // canonicalFilePath will be empty otherwise!
+ filePath = fi.canonicalFilePath();
bool found = false;
foreach (Project *pi, SessionManager::projects()) {
- if (canonicalFilePath == pi->projectFilePath()) {
+ if (filePath == pi->projectFilePath()) {
found = true;
break;
}
@@ -1386,7 +1388,7 @@ QList<Project *> ProjectExplorerPlugin::openProjects(const QStringList &fileName
foreach (IProjectManager *manager, projectManagers) {
if (manager->mimeType() == mt.type()) {
QString tmp;
- if (Project *pro = manager->openProject(canonicalFilePath, &tmp)) {
+ if (Project *pro = manager->openProject(filePath, &tmp)) {
if (pro->restoreSettings()) {
connect(pro, SIGNAL(fileListChanged()), this, SIGNAL(fileListChanged()));
SessionManager::addProject(pro);
diff --git a/src/plugins/qbsprojectmanager/qbsnodes.cpp b/src/plugins/qbsprojectmanager/qbsnodes.cpp
index 54afff6f22..432228bb11 100644
--- a/src/plugins/qbsprojectmanager/qbsnodes.cpp
+++ b/src/plugins/qbsprojectmanager/qbsnodes.cpp
@@ -256,9 +256,6 @@ QbsBaseProjectNode::QbsBaseProjectNode(const QString &path) :
bool QbsBaseProjectNode::hasBuildTargets() const
{
- foreach (ProjectNode *n, subProjectNodes())
- if (n->hasBuildTargets())
- return true;
return false;
}
@@ -486,6 +483,11 @@ bool QbsProductNode::isEnabled() const
return m_qbsProductData.isEnabled();
}
+bool QbsProductNode::hasBuildTargets() const
+{
+ return true;
+}
+
void QbsProductNode::setQbsProductData(const qbs::ProductData prd)
{
if (m_qbsProductData == prd)
@@ -604,7 +606,7 @@ void QbsProjectNode::update(const qbs::ProjectData &prjData)
foreach (const qbs::ProjectData &subData, prjData.subProjects()) {
QbsProjectNode *qn = findProjectNode(subData.name());
if (!qn) {
- QbsProjectNode *subProject = new QbsProjectNode(prjData.location().fileName());
+ QbsProjectNode *subProject = new QbsProjectNode(subData.location().fileName());
subProject->update(subData);
toAdd << subProject;
} else {
diff --git a/src/plugins/qbsprojectmanager/qbsnodes.h b/src/plugins/qbsprojectmanager/qbsnodes.h
index 268f636468..368317098d 100644
--- a/src/plugins/qbsprojectmanager/qbsnodes.h
+++ b/src/plugins/qbsprojectmanager/qbsnodes.h
@@ -144,6 +144,7 @@ public:
explicit QbsProductNode(const qbs::ProductData &prd);
bool isEnabled() const;
+ bool hasBuildTargets() const;
void setQbsProductData(const qbs::ProductData prd);
const qbs::ProductData qbsProductData() const { return m_qbsProductData; }
diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp
index 67500faedd..9c4184c539 100644
--- a/src/plugins/qbsprojectmanager/qbsproject.cpp
+++ b/src/plugins/qbsprojectmanager/qbsproject.cpp
@@ -479,8 +479,10 @@ void QbsProject::prepareForParsing()
m_forceParsing = false;
TaskHub::clearTasks(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
- if (m_qbsUpdateFutureInterface)
+ if (m_qbsUpdateFutureInterface) {
m_qbsUpdateFutureInterface->reportCanceled();
+ m_qbsUpdateFutureInterface->reportFinished();
+ }
delete m_qbsUpdateFutureInterface;
m_qbsUpdateFutureInterface = 0;
diff --git a/src/plugins/qmldesigner/componentsplugin/components.metainfo b/src/plugins/qmldesigner/componentsplugin/components.metainfo
index af484dda6b..cbd5a5835b 100644
--- a/src/plugins/qmldesigner/componentsplugin/components.metainfo
+++ b/src/plugins/qmldesigner/componentsplugin/components.metainfo
@@ -11,7 +11,7 @@ MetaInfo {
version: "1.0"
requiredImport: "QtQuick.Controls"
- Property { name: "text"; type: "QString"; value: "Button"; }
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Button\")"; }
}
}
@@ -39,7 +39,7 @@ MetaInfo {
version: "1.0"
requiredImport: "QtQuick.Controls"
- Property { name: "text"; type: "QString"; value: "Check Box"; }
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Check Box\")"; }
}
}
@@ -54,7 +54,7 @@ MetaInfo {
version: "1.0"
requiredImport: "QtQuick.Controls"
- Property { name: "text"; type: "QString"; value: "Radio Button"; }
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Radio Button\")"; }
}
}
@@ -108,7 +108,7 @@ MetaInfo {
version: "1.0"
requiredImport: "QtQuick.Controls"
- Property { name: "text"; type: "QString"; value: "Label"; }
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Label\")"; }
}
}
@@ -123,7 +123,7 @@ MetaInfo {
version: "1.0"
requiredImport: "QtQuick.Controls"
- Property { name: "placeholderText"; type: "QString"; value: "Text Field"; }
+ Property { name: "placeholderText"; type: "binding"; value: "qsTr(\"Text Field\")"; }
}
}
diff --git a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
index 2c883dbcb7..32ae0d8159 100644
--- a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
+++ b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
@@ -32,6 +32,7 @@
#include "qmlchangeset.h"
#include "nodelistproperty.h"
#include "variantproperty.h"
+#include "bindingproperty.h"
#include "qmlanchors.h"
#include "invalidmodelnodeexception.h"
#include "itemlibraryinfo.h"
@@ -134,13 +135,20 @@ QmlItemNode QmlItemNode::createQmlItemNode(AbstractView *view, const ItemLibrary
}
}
+ typedef QPair<PropertyName, QString> PropertyBindingEntry;
+ QList<PropertyBindingEntry> propertyBindingList;
if (itemLibraryEntry.qmlSource().isEmpty()) {
QList<QPair<PropertyName, QVariant> > propertyPairList;
propertyPairList.append(qMakePair(PropertyName("x"), QVariant(qRound(position.x()))));
propertyPairList.append(qMakePair(PropertyName("y"), QVariant(qRound(position.y()))));
- foreach (const PropertyContainer &property, itemLibraryEntry.properties())
- propertyPairList.append(qMakePair(property.name(), property.value()));
+ foreach (const PropertyContainer &property, itemLibraryEntry.properties()) {
+ if (property.type() == QLatin1String("binding")) {
+ propertyBindingList.append(PropertyBindingEntry(property.name(), property.value().toString()));
+ } else {
+ propertyPairList.append(qMakePair(property.name(), property.value()));
+ }
+ }
newQmlItemNode = QmlItemNode(view->createModelNode(itemLibraryEntry.typeName(), majorVersion, minorVersion, propertyPairList));
} else {
@@ -160,6 +168,9 @@ QmlItemNode QmlItemNode::createQmlItemNode(AbstractView *view, const ItemLibrary
newQmlItemNode.setVariantProperty("opacity", 1);
}
+ foreach (const PropertyBindingEntry &propertyBindingEntry, propertyBindingList)
+ newQmlItemNode.modelNode().bindingProperty(propertyBindingEntry.first).setExpression(propertyBindingEntry.second);
+
Q_ASSERT(newQmlItemNode.isValid());
}
catch (RewritingException &e) {
diff --git a/src/plugins/qmldesigner/qtquickplugin/quick.metainfo b/src/plugins/qmldesigner/qtquickplugin/quick.metainfo
index 31a1b97a3d..bd8a6b2dc1 100644
--- a/src/plugins/qmldesigner/qtquickplugin/quick.metainfo
+++ b/src/plugins/qmldesigner/qtquickplugin/quick.metainfo
@@ -63,7 +63,8 @@ MetaInfo {
libraryIcon: ":/qtquickplugin/images/text-icon.png"
version: "1.0"
- QmlSource { source: ":/qtquickplugin/source/text.qml" }
+ Property { name: "font.pixelSize"; type: "int"; value: 12; }
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Text\")"; }
}
ItemLibraryEntry {
@@ -72,7 +73,8 @@ MetaInfo {
libraryIcon: ":/qtquickplugin/images/text-icon.png"
version: "2.0"
- QmlSource { source: ":/qtquickplugin/source/textv2.qml" }
+ Property { name: "font.pixelSize"; type: "int"; value: 12; }
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Text\")"; }
}
}
@@ -86,7 +88,11 @@ MetaInfo {
libraryIcon: ":/qtquickplugin/images/text-edit-icon.png"
version: "1.0"
- QmlSource { source: ":/qtquickplugin/source/textedit.qml" }
+ Property { name: "width"; type: "int"; value: 80; }
+ Property { name: "height"; type: "int"; value: 20; }
+ Property { name: "font.pixelSize"; type: "int"; value: 12; }
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Text Edit\")"; }
+
}
ItemLibraryEntry {
@@ -95,7 +101,10 @@ MetaInfo {
libraryIcon: ":/qtquickplugin/images/text-edit-icon.png"
version: "2.0"
- QmlSource { source: ":/qtquickplugin/source/texteditv2.qml" }
+ Property { name: "width"; type: "int"; value: 80; }
+ Property { name: "height"; type: "int"; value: 20; }
+ Property { name: "font.pixelSize"; type: "int"; value: 12; }
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Text Edit\")"; }
}
}
@@ -109,7 +118,10 @@ MetaInfo {
libraryIcon: ":/qtquickplugin/images/text-edit-icon.png"
version: "1.0"
- QmlSource { source: ":/qtquickplugin/source/textinput.qml" }
+ Property { name: "width"; type: "int"; value: 80; }
+ Property { name: "height"; type: "int"; value: 20; }
+ Property { name: "font.pixelSize"; type: "int"; value: 12; }
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Text Input\")"; }
}
ItemLibraryEntry {
@@ -118,7 +130,10 @@ MetaInfo {
libraryIcon: ":/qtquickplugin/images/text-input-icon.png"
version: "2.0"
- QmlSource { source: ":/qtquickplugin/source/textinput.qml" }
+ Property { name: "width"; type: "int"; value: 80; }
+ Property { name: "height"; type: "int"; value: 20; }
+ Property { name: "font.pixelSize"; type: "int"; value: 12; }
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Text Input\")"; }
}
}
diff --git a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp
index ce110327a4..645c17b60b 100644
--- a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp
@@ -60,19 +60,6 @@ namespace QmlProfiler {
namespace Internal {
/////////////////////////////////////////////////////////
-bool MouseWheelResizer::eventFilter(QObject *obj, QEvent *event)
-{
- if (event->type() == QEvent::Wheel) {
- QWheelEvent *ev = static_cast<QWheelEvent *>(event);
- if (ev->modifiers() & Qt::ControlModifier) {
- emit mouseWheelMoved(ev->pos().x(), ev->pos().y(), ev->delta());
- return true;
- }
- }
- return QObject::eventFilter(obj, event);
-}
-
-/////////////////////////////////////////////////////////
void ZoomControl::setRange(qint64 startTime, qint64 endTime)
{
if (m_startTime != startTime || m_endTime != endTime) {
@@ -83,25 +70,6 @@ void ZoomControl::setRange(qint64 startTime, qint64 endTime)
}
/////////////////////////////////////////////////////////
-ScrollableQuickView::ScrollableQuickView(QQuickView *parent)
- : QQuickView(parent)
-{
-}
-
-ScrollableQuickView::~ScrollableQuickView()
-{
-}
-
-void ScrollableQuickView::scrollContentsBy(int /*dx*/, int dy)
-{
- // special workaround to track the scrollbar
- if (rootObject()) {
- int scrollY = rootObject()->property("scrollY").toInt();
- rootObject()->setProperty("scrollY", QVariant(scrollY - dy));
- }
-}
-
-/////////////////////////////////////////////////////////
class QmlProfilerTraceView::QmlProfilerTraceViewPrivate
{
public:
@@ -121,7 +89,7 @@ public:
QSize m_sizeHint;
- ScrollableQuickView *m_mainView;
+ QQuickView *m_mainView;
QQuickView *m_timebar;
QQuickView *m_overview;
QmlProfilerModelManager *m_modelManager;
@@ -146,13 +114,10 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerT
groupLayout->setContentsMargins(0, 0, 0, 0);
groupLayout->setSpacing(0);
- d->m_mainView = new ScrollableQuickView();
+ d->m_mainView = new QQuickView();
d->m_mainView->setResizeMode(QQuickView::SizeRootObjectToView);
QWidget *mainViewContainer = QWidget::createWindowContainer(d->m_mainView);
- MouseWheelResizer *resizer = new MouseWheelResizer(this);
- connect(resizer,SIGNAL(mouseWheelMoved(int,int,int)), this, SLOT(mouseWheelMoved(int,int,int)));
-
QHBoxLayout *toolsLayout = new QHBoxLayout;
d->m_timebar = new QQuickView();
@@ -414,16 +379,6 @@ void QmlProfilerTraceView::updateRange()
QMetaObject::invokeMethod(d->m_mainView->rootObject()->findChild<QObject*>(QLatin1String("zoomSliderToolBar")), "updateZoomLevel");
}
-void QmlProfilerTraceView::mouseWheelMoved(int mouseX, int mouseY, int wheelDelta)
-{
- Q_UNUSED(mouseY);
- QQuickItem *rootObject = d->m_mainView->rootObject();
- if (rootObject) {
- QMetaObject::invokeMethod(rootObject, "wheelZoom",
- Q_ARG(QVariant, QVariant(mouseX)),
- Q_ARG(QVariant, QVariant(wheelDelta)));
- }
-}
////////////////////////////////////////////////////////
void QmlProfilerTraceView::updateToolTip(const QString &text)
{
diff --git a/src/plugins/qmlprofiler/qmlprofilertraceview.h b/src/plugins/qmlprofiler/qmlprofilertraceview.h
index 9a956d9fe4..da8f66966a 100644
--- a/src/plugins/qmlprofiler/qmlprofilertraceview.h
+++ b/src/plugins/qmlprofiler/qmlprofilertraceview.h
@@ -45,17 +45,6 @@ namespace Internal {
class QmlProfilerStateManager;
class QmlProfilerViewManager;
-// capture mouse wheel events
-class MouseWheelResizer : public QObject {
- Q_OBJECT
-public:
- MouseWheelResizer(QObject *parent=0):QObject(parent){}
-protected:
- bool eventFilter(QObject *obj, QEvent *event);
-signals:
- void mouseWheelMoved(int x, int y, int delta);
-};
-
// centralized zoom control
class ZoomControl : public QObject {
Q_OBJECT
@@ -75,17 +64,6 @@ private:
qint64 m_endTime;
};
-class ScrollableQuickView : public QQuickView
-{
- Q_OBJECT
-public:
- explicit ScrollableQuickView(QQuickView *parent = 0);
- ~ScrollableQuickView();
-protected:
- void scrollContentsBy(int dx, int dy);
-};
-
-
class QmlProfilerTraceView : public QWidget
{
Q_OBJECT
@@ -113,7 +91,6 @@ private slots:
void updateLockButton();
void updateRange();
- void mouseWheelMoved(int mouseX, int mouseY, int wheelDelta);
void updateToolTip(const QString &text);
void profilerDataModelStateChanged();
diff --git a/src/plugins/qmlprofiler/qv8profilereventview.cpp b/src/plugins/qmlprofiler/qv8profilereventview.cpp
index fdc3ee9592..5b3226b557 100644
--- a/src/plugins/qmlprofiler/qv8profilereventview.cpp
+++ b/src/plugins/qmlprofiler/qv8profilereventview.cpp
@@ -135,6 +135,7 @@ QV8ProfilerEventsWidget::QV8ProfilerEventsWidget(QWidget *parent,
connect(d->m_eventTree, SIGNAL(eventSelected(int)), d->m_eventParents, SLOT(displayEvent(int)));
connect(d->m_eventChildren, SIGNAL(eventClicked(int)), d->m_eventTree, SLOT(selectEvent(int)));
connect(d->m_eventParents, SIGNAL(eventClicked(int)), d->m_eventTree, SLOT(selectEvent(int)));
+ connect(d->v8Model, SIGNAL(changed()), this, SLOT(updateEnabledState()));
// widget arrangement
QVBoxLayout *groupLayout = new QVBoxLayout;
@@ -156,7 +157,7 @@ QV8ProfilerEventsWidget::QV8ProfilerEventsWidget(QWidget *parent,
d->m_profilerTool = profilerTool;
d->m_viewContainer = container;
-
+ setEnabled(false);
}
QV8ProfilerEventsWidget::~QV8ProfilerEventsWidget()
@@ -164,11 +165,17 @@ QV8ProfilerEventsWidget::~QV8ProfilerEventsWidget()
delete d;
}
+void QV8ProfilerEventsWidget::updateEnabledState()
+{
+ setEnabled(!d->v8Model->isEmpty());
+}
+
void QV8ProfilerEventsWidget::clear()
{
d->m_eventTree->clear();
d->m_eventChildren->clear();
d->m_eventParents->clear();
+ setEnabled(false);
}
QModelIndex QV8ProfilerEventsWidget::selectedItem() const
diff --git a/src/plugins/qmlprofiler/qv8profilereventview.h b/src/plugins/qmlprofiler/qv8profilereventview.h
index d32b499c1c..2d36675093 100644
--- a/src/plugins/qmlprofiler/qv8profilereventview.h
+++ b/src/plugins/qmlprofiler/qv8profilereventview.h
@@ -74,6 +74,7 @@ signals:
public slots:
void updateSelectedEvent(int eventId) const;
void selectBySourceLocation(const QString &filename, int line, int column);
+ void updateEnabledState();
protected:
void contextMenuEvent(QContextMenuEvent *ev);
diff --git a/src/plugins/qnx/blackberryndksettingswidget.cpp b/src/plugins/qnx/blackberryndksettingswidget.cpp
index c0182a2bd4..9ca62b4aa6 100644
--- a/src/plugins/qnx/blackberryndksettingswidget.cpp
+++ b/src/plugins/qnx/blackberryndksettingswidget.cpp
@@ -184,6 +184,7 @@ void BlackBerryNDKSettingsWidget::updateNdkList()
void BlackBerryNDKSettingsWidget::addNdkTarget()
{
launchBlackBerryInstallerWizard(BlackBerryInstallerDataHandler::InstallMode);
+ emit targetsUpdated();
}
void BlackBerryNDKSettingsWidget::removeNdkTarget()
@@ -200,6 +201,7 @@ void BlackBerryNDKSettingsWidget::removeNdkTarget()
if (config->isAutoDetected()) {
uninstallNdkTarget();
+ emit targetsUpdated();
return;
}
@@ -214,6 +216,7 @@ void BlackBerryNDKSettingsWidget::removeNdkTarget()
m_deactivatedTargets.removeOne(config);
m_bbConfigManager->removeConfiguration(config);
m_manualNdks->removeChild(m_ui->ndksTreeWidget->currentItem());
+ emit targetsUpdated();
}
}
@@ -231,6 +234,7 @@ void BlackBerryNDKSettingsWidget::activateNdkTarget()
m_deactivatedTargets.removeAt(m_deactivatedTargets.indexOf(config));
updateUi(m_ui->ndksTreeWidget->currentItem(), config);
+ emit targetsUpdated();
}
}
@@ -246,6 +250,7 @@ void BlackBerryNDKSettingsWidget::deactivateNdkTarget()
m_deactivatedTargets << config;
m_activatedTargets.removeAt(m_activatedTargets.indexOf(config));
updateUi(m_ui->ndksTreeWidget->currentItem(), config);
+ emit targetsUpdated();
}
}
@@ -262,7 +267,9 @@ void BlackBerryNDKSettingsWidget::updateUi(QTreeWidgetItem *item, BlackBerryConf
m_ui->activateNdkTargetButton->setEnabled(!m_activatedTargets.contains(config));
m_ui->deactivateNdkTargetButton->setEnabled(m_activatedTargets.contains(config)
&& m_activatedTargets.size() > 1);
- m_ui->removeNdkButton->setEnabled(true);
+ // Disable remove button for auto detected pre-10.2 NDKs (uninstall wizard doesn't handle them)
+ m_ui->removeNdkButton->setEnabled(!(config->isAutoDetected()
+ && QnxUtils::sdkInstallerPath(config->ndkPath()).isEmpty()));
}
void BlackBerryNDKSettingsWidget::uninstallNdkTarget()
diff --git a/src/plugins/qnx/blackberryndksettingswidget.h b/src/plugins/qnx/blackberryndksettingswidget.h
index 4bacfa5413..1105d2fae7 100644
--- a/src/plugins/qnx/blackberryndksettingswidget.h
+++ b/src/plugins/qnx/blackberryndksettingswidget.h
@@ -62,7 +62,7 @@ public:
QList<BlackBerryConfiguration *> deactivatedTargets();
signals:
- void kitsUpdated();
+ void targetsUpdated();
public slots:
void launchBlackBerrySetupWizard() const;
diff --git a/src/plugins/qnx/blackberrysetupwizardpages.cpp b/src/plugins/qnx/blackberrysetupwizardpages.cpp
index 4284591a3c..21cbe93a9f 100644
--- a/src/plugins/qnx/blackberrysetupwizardpages.cpp
+++ b/src/plugins/qnx/blackberrysetupwizardpages.cpp
@@ -86,7 +86,7 @@ BlackBerrySetupWizardNdkPage::BlackBerrySetupWizardNdkPage(QWidget *parent) :
m_widget = new BlackBerryNDKSettingsWidget(this);
m_widget->setWizardMessageVisible(false);
- connect(m_widget, SIGNAL(kitsUpdated()), this, SIGNAL(completeChanged()));
+ connect(m_widget, SIGNAL(targetsUpdated()), this, SIGNAL(completeChanged()));
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(m_widget);
diff --git a/src/plugins/qnx/qnxdebugsupport.cpp b/src/plugins/qnx/qnxdebugsupport.cpp
index ecea328c80..33d9c53889 100644
--- a/src/plugins/qnx/qnxdebugsupport.cpp
+++ b/src/plugins/qnx/qnxdebugsupport.cpp
@@ -31,10 +31,13 @@
#include "qnxdebugsupport.h"
#include "qnxconstants.h"
+#include "qnxdeviceconfiguration.h"
#include "qnxrunconfiguration.h"
+#include "slog2inforunner.h"
#include <debugger/debuggerengine.h>
#include <debugger/debuggerrunconfigurationaspect.h>
+#include <debugger/debuggerrunner.h>
#include <debugger/debuggerstartparameters.h>
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
@@ -43,6 +46,8 @@
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
+#include <QFileInfo>
+
using namespace ProjectExplorer;
using namespace RemoteLinux;
@@ -66,6 +71,16 @@ QnxDebugSupport::QnxDebugSupport(QnxRunConfiguration *runConfig, Debugger::Debug
connect(runner, SIGNAL(remoteStderr(QByteArray)), SLOT(handleRemoteOutput(QByteArray)));
connect(m_engine, SIGNAL(requestRemoteSetup()), this, SLOT(handleAdapterSetupRequested()));
+
+ const QString applicationId = QFileInfo(runConfig->remoteExecutableFilePath()).fileName();
+ ProjectExplorer::IDevice::ConstPtr dev = ProjectExplorer::DeviceKitInformation::device(runConfig->target()->kit());
+ QnxDeviceConfiguration::ConstPtr qnxDevice = dev.dynamicCast<const QnxDeviceConfiguration>();
+
+ m_slog2Info = new Slog2InfoRunner(applicationId, qnxDevice, this);
+ connect(m_slog2Info, SIGNAL(output(QString,Utils::OutputFormat)), this, SLOT(handleApplicationOutput(QString,Utils::OutputFormat)));
+ connect(runner, SIGNAL(remoteProcessStarted()), m_slog2Info, SLOT(start()));
+ if (qnxDevice->qnxVersion() > 0x060500)
+ connect(m_slog2Info, SIGNAL(commandMissing()), this, SLOT(printMissingWarning()));
}
void QnxDebugSupport::handleAdapterSetupRequested()
@@ -130,6 +145,7 @@ void QnxDebugSupport::handleDebuggingFinished()
// the inferior process, as invoking "kill" in gdb doesn't work
// on QNX gdb
setFinished();
+ m_slog2Info->stop();
killInferiorProcess();
}
@@ -170,3 +186,16 @@ void QnxDebugSupport::handleError(const QString &error)
m_engine->notifyEngineRemoteSetupFailed(tr("Initial setup failed: %1").arg(error));
}
}
+
+void QnxDebugSupport::printMissingWarning()
+{
+ if (m_engine)
+ m_engine->showMessage(tr("Warning: \"slog2info\" is not found on the device, debug output not available!"), Debugger::AppError);
+}
+
+void QnxDebugSupport::handleApplicationOutput(const QString &msg, Utils::OutputFormat outputFormat)
+{
+ Q_UNUSED(outputFormat);
+ if (m_engine)
+ m_engine->showMessage(msg, Debugger::AppOutput);
+}
diff --git a/src/plugins/qnx/qnxdebugsupport.h b/src/plugins/qnx/qnxdebugsupport.h
index fa5a9dde26..9e5ad96427 100644
--- a/src/plugins/qnx/qnxdebugsupport.h
+++ b/src/plugins/qnx/qnxdebugsupport.h
@@ -34,12 +34,15 @@
#include "qnxabstractrunsupport.h"
+#include <utils/outputformat.h>
+
namespace Debugger { class DebuggerEngine; }
namespace Qnx {
namespace Internal {
class QnxRunConfiguration;
+class Slog2InfoRunner;
class QnxDebugSupport : public QnxAbstractRunSupport
{
@@ -60,6 +63,9 @@ private slots:
void handleRemoteOutput(const QByteArray &output);
void handleError(const QString &error);
+ void printMissingWarning();
+ void handleApplicationOutput(const QString &msg, Utils::OutputFormat outputFormat);
+
private:
void startExecution();
@@ -67,6 +73,8 @@ private:
void killInferiorProcess();
+ Slog2InfoRunner *m_slog2Info;
+
Debugger::DebuggerEngine *m_engine;
int m_pdebugPort;
int m_qmlPort;
diff --git a/src/plugins/qnx/qnxutils.cpp b/src/plugins/qnx/qnxutils.cpp
index 74fa5e1480..c15696ad8b 100644
--- a/src/plugins/qnx/qnxutils.cpp
+++ b/src/plugins/qnx/qnxutils.cpp
@@ -284,7 +284,7 @@ QString QnxUtils::sdkInstallerPath(const QString &ndkPath)
QString QnxUtils::qdeInstallProcess(const QString &ndkPath, const QString &option, const QString &version)
{
QString installerPath = sdkInstallerPath(ndkPath);
- if (ndkPath.isEmpty())
+ if (installerPath.isEmpty())
return QString();
return QString::fromLatin1("%1 -nosplash -application com.qnx.tools.ide.sdk.manager.core.SDKInstallerApplication "
diff --git a/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp b/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp
index b064fb57ab..e653997035 100644
--- a/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp
+++ b/src/plugins/remotelinux/genericlinuxdeviceconfigurationfactory.cpp
@@ -32,6 +32,8 @@
#include "linuxdevice.h"
#include "remotelinux_constants.h"
+#include <coreplugin/icore.h>
+
#include <utils/qtcassert.h>
using namespace ProjectExplorer;
@@ -57,7 +59,7 @@ QList<Core::Id> GenericLinuxDeviceConfigurationFactory::availableCreationIds() c
IDevice::Ptr GenericLinuxDeviceConfigurationFactory::create(Core::Id id) const
{
QTC_ASSERT(id == Constants::GenericLinuxOsType, return IDevice::Ptr());
- GenericLinuxDeviceConfigurationWizard wizard;
+ GenericLinuxDeviceConfigurationWizard wizard(Core::ICore::mainWindow());
if (wizard.exec() != QDialog::Accepted)
return IDevice::Ptr();
return wizard.device();
diff --git a/src/plugins/texteditor/generichighlighter/highlighter.cpp b/src/plugins/texteditor/generichighlighter/highlighter.cpp
index 787b1fc1b8..19211acdbb 100644
--- a/src/plugins/texteditor/generichighlighter/highlighter.cpp
+++ b/src/plugins/texteditor/generichighlighter/highlighter.cpp
@@ -71,9 +71,9 @@ Highlighter::Highlighter(QTextDocument *parent) :
<< TextEditor::C_NUMBER
<< TextEditor::C_STRING
<< TextEditor::C_STRING
- << TextEditor::C_TEXT
- << TextEditor::C_TEXT
- << TextEditor::C_TEXT
+ << TextEditor::C_TEXT // TODO : add style for alert (eg. yellow background)
+ << TextEditor::C_TEXT // TODO : add style for error (eg. red underline)
+ << TextEditor::C_FUNCTION
<< TextEditor::C_TEXT
<< TextEditor::C_TEXT;
}
diff --git a/src/shared/proparser/qmakebuiltins.cpp b/src/shared/proparser/qmakebuiltins.cpp
index 36515f1132..955b7e6cf6 100644
--- a/src/shared/proparser/qmakebuiltins.cpp
+++ b/src/shared/proparser/qmakebuiltins.cpp
@@ -1580,11 +1580,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
}
case T_CACHE: {
if (args.count() > 3) {
- evalError(fL1S("cache(var, [set|add|sub] [transient] [super], [srcvar]) requires one to three arguments."));
+ evalError(fL1S("cache(var, [set|add|sub] [transient] [super|stash], [srcvar]) requires one to three arguments."));
return ReturnFalse;
}
bool persist = true;
- bool super = false;
+ enum { TargetStash, TargetCache, TargetSuper } target = TargetCache;
enum { CacheSet, CacheAdd, CacheSub } mode = CacheSet;
ProKey srcvar;
if (args.count() >= 2) {
@@ -1593,7 +1593,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
if (m_tmp3 == QLatin1String("transient")) {
persist = false;
} else if (m_tmp3 == QLatin1String("super")) {
- super = true;
+ target = TargetSuper;
+ } else if (m_tmp3 == QLatin1String("stash")) {
+ target = TargetStash;
} else if (m_tmp3 == QLatin1String("set")) {
mode = CacheSet;
} else if (m_tmp3 == QLatin1String("add")) {
@@ -1632,7 +1634,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
m_option->mutex.lock();
#endif
QMakeBaseEnv *baseEnv =
- m_option->baseEnvs.value(QMakeBaseKey(m_buildRoot, hostBuild));
+ m_option->baseEnvs.value(QMakeBaseKey(m_buildRoot, m_stashfile, hostBuild));
#ifdef PROEVALUATOR_THREAD_SAFE
// It's ok to unlock this before locking baseEnv,
// as we have no intention to initialize the env.
@@ -1665,21 +1667,23 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
removeEach(&newval, diffval);
}
if (oldval != newval) {
- baseEval->valuesRef(dstvar) = newval;
- if (super) {
- do {
- if (dstvar == QLatin1String("QMAKEPATH")) {
- baseEval->m_qmakepath = newval.toQStringList();
- baseEval->updateMkspecPaths();
- } else if (dstvar == QLatin1String("QMAKEFEATURES")) {
- baseEval->m_qmakefeatures = newval.toQStringList();
- } else {
- break;
- }
- baseEval->updateFeaturePaths();
- if (hostBuild == m_hostBuild)
- m_featureRoots = baseEval->m_featureRoots;
- } while (false);
+ if (target != TargetStash || !m_stashfile.isEmpty()) {
+ baseEval->valuesRef(dstvar) = newval;
+ if (target == TargetSuper) {
+ do {
+ if (dstvar == QLatin1String("QMAKEPATH")) {
+ baseEval->m_qmakepath = newval.toQStringList();
+ baseEval->updateMkspecPaths();
+ } else if (dstvar == QLatin1String("QMAKEFEATURES")) {
+ baseEval->m_qmakefeatures = newval.toQStringList();
+ } else {
+ break;
+ }
+ baseEval->updateFeaturePaths();
+ if (hostBuild == m_hostBuild)
+ m_featureRoots = baseEval->m_featureRoots;
+ } while (false);
+ }
}
changed = true;
}
@@ -1710,16 +1714,16 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
varstr += QLatin1Char('\n');
}
QString fn;
- if (super) {
+ if (target == TargetSuper) {
if (m_superfile.isEmpty()) {
- m_superfile = m_outputDir + QLatin1String("/.qmake.super");
+ m_superfile = QDir::cleanPath(m_outputDir + QLatin1String("/.qmake.super"));
printf("Info: creating super cache file %s\n", qPrintable(m_superfile));
valuesRef(ProKey("_QMAKE_SUPER_CACHE_")) << ProString(m_superfile);
}
fn = m_superfile;
- } else {
+ } else if (target == TargetCache) {
if (m_cachefile.isEmpty()) {
- m_cachefile = m_outputDir + QLatin1String("/.qmake.cache");
+ m_cachefile = QDir::cleanPath(m_outputDir + QLatin1String("/.qmake.cache"));
printf("Info: creating cache file %s\n", qPrintable(m_cachefile));
valuesRef(ProKey("_QMAKE_CACHE_")) << ProString(m_cachefile);
// We could update m_{source,build}Root and m_featureRoots here, or even
@@ -1729,6 +1733,14 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
// The sub-projects will find the new cache all by themselves.
}
fn = m_cachefile;
+ } else {
+ fn = m_stashfile;
+ if (fn.isEmpty())
+ fn = QDir::cleanPath(m_outputDir + QLatin1String("/.qmake.stash"));
+ if (!m_vfs->exists(fn)) {
+ printf("Info: creating stash file %s\n", qPrintable(fn));
+ valuesRef(ProKey("_QMAKE_STASH_")) << ProString(fn);
+ }
}
return writeFile(fL1S("cache "), fn, QIODevice::Append, varstr);
}
diff --git a/src/shared/proparser/qmakeevaluator.cpp b/src/shared/proparser/qmakeevaluator.cpp
index 0df4406391..f2f45b06c6 100644
--- a/src/shared/proparser/qmakeevaluator.cpp
+++ b/src/shared/proparser/qmakeevaluator.cpp
@@ -67,19 +67,19 @@ QT_BEGIN_NAMESPACE
#define fL1S(s) QString::fromLatin1(s)
-QMakeBaseKey::QMakeBaseKey(const QString &_root, bool _hostBuild)
- : root(_root), hostBuild(_hostBuild)
+QMakeBaseKey::QMakeBaseKey(const QString &_root, const QString &_stash, bool _hostBuild)
+ : root(_root), stash(_stash), hostBuild(_hostBuild)
{
}
uint qHash(const QMakeBaseKey &key)
{
- return qHash(key.root) ^ (uint)key.hostBuild;
+ return qHash(key.root) ^ qHash(key.stash) ^ (uint)key.hostBuild;
}
bool operator==(const QMakeBaseKey &one, const QMakeBaseKey &two)
{
- return one.root == two.root && one.hostBuild == two.hostBuild;
+ return one.root == two.root && one.stash == two.stash && one.hostBuild == two.hostBuild;
}
QMakeBaseEnv::QMakeBaseEnv()
@@ -882,30 +882,9 @@ void QMakeEvaluator::visitProVariable(
default: // whatever - cannot happen
case TokAssign: // =
zipEmpty(&varVal);
- if (!m_cumulative) {
- // FIXME: add check+warning about accidental value removal.
- // This may be a bit too noisy, though.
- m_valuemapStack.top()[varName] = varVal;
- } else {
- if (!varVal.isEmpty()) {
- // We are greedy for values. But avoid exponential growth.
- ProStringList &v = valuesRef(varName);
- if (v.isEmpty()) {
- v = varVal;
- } else {
- ProStringList old = v;
- v = varVal;
- QSet<ProString> has;
- has.reserve(v.size());
- foreach (const ProString &s, v)
- has.insert(s);
- v.reserve(v.size() + old.size());
- foreach (const ProString &s, old)
- if (!has.contains(s))
- v << s;
- }
- }
- }
+ // FIXME: add check+warning about accidental value removal.
+ // This may be a bit too noisy, though.
+ m_valuemapStack.top()[varName] = varVal;
debugMsg(2, "assigning");
break;
case TokAppendUnique: // *=
@@ -921,7 +900,7 @@ void QMakeEvaluator::visitProVariable(
if (!m_cumulative) {
removeEach(&valuesRef(varName), varVal);
} else {
- // We are stingy with our values, too.
+ // We are stingy with our values.
}
debugMsg(2, "removing");
break;
@@ -1132,6 +1111,19 @@ bool QMakeEvaluator::prepareProject(const QString &inDir)
dir = qdfi.path();
}
+ dir = m_outputDir;
+ forever {
+ QString stashfile = dir + QLatin1String("/.qmake.stash");
+ if (dir == (!superdir.isEmpty() ? superdir : m_buildRoot) || m_vfs->exists(stashfile)) {
+ m_stashfile = QDir::cleanPath(stashfile);
+ break;
+ }
+ QFileInfo qdfi(dir);
+ if (qdfi.isRoot())
+ break;
+ dir = qdfi.path();
+ }
+
return true;
}
@@ -1181,23 +1173,18 @@ bool QMakeEvaluator::loadSpec()
QMakeEvaluator evaluator(m_option, m_parser, m_vfs, m_handler);
evaluator.m_sourceRoot = m_sourceRoot;
evaluator.m_buildRoot = m_buildRoot;
- if (!m_superfile.isEmpty()) {
- valuesRef(ProKey("_QMAKE_SUPER_CACHE_")) << ProString(m_superfile);
- if (evaluator.evaluateFile(
- m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue)
- return false;
+
+ if (!m_superfile.isEmpty() && evaluator.evaluateFile(
+ m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly|LoadHidden) != ReturnTrue) {
+ return false;
}
- if (!m_conffile.isEmpty()) {
- valuesRef(ProKey("_QMAKE_CONF_")) << ProString(m_conffile);
- if (evaluator.evaluateFile(
- m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue)
- return false;
+ if (!m_conffile.isEmpty() && evaluator.evaluateFile(
+ m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly|LoadHidden) != ReturnTrue) {
+ return false;
}
- if (!m_cachefile.isEmpty()) {
- valuesRef(ProKey("_QMAKE_CACHE_")) << ProString(m_cachefile);
- if (evaluator.evaluateFile(
- m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue)
- return false;
+ if (!m_cachefile.isEmpty() && evaluator.evaluateFile(
+ m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly|LoadHidden) != ReturnTrue) {
+ return false;
}
if (qmakespec.isEmpty()) {
if (!m_hostBuild)
@@ -1231,19 +1218,31 @@ bool QMakeEvaluator::loadSpec()
cool:
m_qmakespec = QDir::cleanPath(qmakespec);
- if (!m_superfile.isEmpty()
- && evaluateFile(m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly|LoadHidden) != ReturnTrue) {
- return false;
+ if (!m_superfile.isEmpty()) {
+ valuesRef(ProKey("_QMAKE_SUPER_CACHE_")) << ProString(m_superfile);
+ if (evaluateFile(
+ m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly|LoadHidden) != ReturnTrue)
+ return false;
}
if (!loadSpecInternal())
return false;
- if (!m_conffile.isEmpty()
- && evaluateFile(m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) {
- return false;
+ if (!m_conffile.isEmpty()) {
+ valuesRef(ProKey("_QMAKE_CONF_")) << ProString(m_conffile);
+ if (evaluateFile(
+ m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue)
+ return false;
}
- if (!m_cachefile.isEmpty()
- && evaluateFile(m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) {
- return false;
+ if (!m_cachefile.isEmpty()) {
+ valuesRef(ProKey("_QMAKE_CACHE_")) << ProString(m_cachefile);
+ if (evaluateFile(
+ m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue)
+ return false;
+ }
+ if (!m_stashfile.isEmpty() && m_vfs->exists(m_stashfile)) {
+ valuesRef(ProKey("_QMAKE_STASH_")) << ProString(m_stashfile);
+ if (evaluateFile(
+ m_stashfile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue)
+ return false;
}
return true;
}
@@ -1322,7 +1321,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
#ifdef PROEVALUATOR_THREAD_SAFE
m_option->mutex.lock();
#endif
- QMakeBaseEnv **baseEnvPtr = &m_option->baseEnvs[QMakeBaseKey(m_buildRoot, m_hostBuild)];
+ QMakeBaseEnv **baseEnvPtr = &m_option->baseEnvs[QMakeBaseKey(m_buildRoot, m_stashfile, m_hostBuild)];
if (!*baseEnvPtr)
*baseEnvPtr = new QMakeBaseEnv;
QMakeBaseEnv *baseEnv = *baseEnvPtr;
@@ -1349,6 +1348,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
baseEval->m_superfile = m_superfile;
baseEval->m_conffile = m_conffile;
baseEval->m_cachefile = m_cachefile;
+ baseEval->m_stashfile = m_stashfile;
baseEval->m_sourceRoot = m_sourceRoot;
baseEval->m_buildRoot = m_buildRoot;
baseEval->m_hostBuild = m_hostBuild;
@@ -1843,14 +1843,12 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFile(
VisitReturn ok = visitProFile(pro, type, flags);
m_current = m_locationStack.pop();
pro->deref();
-#ifdef PROEVALUATOR_FULL
if (ok == ReturnTrue && !(flags & LoadHidden)) {
ProStringList &iif = m_valuemapStack.first()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")];
ProString ifn(fileName);
if (!iif.contains(ifn))
iif << ifn;
}
-#endif
return ok;
} else {
return ReturnFalse;
@@ -1963,13 +1961,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFileInto(
if (ret != ReturnTrue)
return ret;
*values = visitor.m_valuemapStack.top();
-#ifdef PROEVALUATOR_FULL
ProKey qiif("QMAKE_INTERNAL_INCLUDED_FILES");
ProStringList &iif = m_valuemapStack.first()[qiif];
foreach (const ProString &ifn, values->value(qiif))
if (!iif.contains(ifn))
iif << ifn;
-#endif
return ReturnTrue;
}
diff --git a/src/shared/proparser/qmakeevaluator.h b/src/shared/proparser/qmakeevaluator.h
index 70b7fe4007..9f1811a615 100644
--- a/src/shared/proparser/qmakeevaluator.h
+++ b/src/shared/proparser/qmakeevaluator.h
@@ -286,6 +286,7 @@ public:
QString m_superfile;
QString m_conffile;
QString m_cachefile;
+ QString m_stashfile;
QString m_sourceRoot;
QString m_buildRoot;
QStringList m_qmakepath;
diff --git a/src/shared/proparser/qmakeglobals.h b/src/shared/proparser/qmakeglobals.h
index 0f2b37ed26..d633e94d4e 100644
--- a/src/shared/proparser/qmakeglobals.h
+++ b/src/shared/proparser/qmakeglobals.h
@@ -54,9 +54,10 @@ class QMakeEvaluator;
class QMakeBaseKey
{
public:
- QMakeBaseKey(const QString &_root, bool _hostBuild);
+ QMakeBaseKey(const QString &_root, const QString &_stash, bool _hostBuild);
QString root;
+ QString stash;
bool hostBuild;
};