diff --git a/.gitignore b/.gitignore index 4c74575e8e3..75cc6190192 100644 --- a/.gitignore +++ b/.gitignore @@ -144,6 +144,7 @@ tmp/ /tests/auto/cplusplus/checksymbols/tst_checksymbols /tests/auto/cplusplus/codegen/tst_codegen /tests/auto/cplusplus/cxx11/tst_cxx11 +/tests/auto/cplusplus/cxx11/tst_c99 /tests/auto/cplusplus/lexer/tst_lexer /tests/auto/cplusplus/misc/tst_misc /tests/auto/cplusplus/simplifytypes/tst_simplifytypes diff --git a/README b/README index ebc8a6c03ca..610cd8eed08 100644 --- a/README +++ b/README @@ -10,16 +10,14 @@ Windows XP SP3 or later (K)Ubuntu Linux 11.10 (32-bit and 64-bit) or later Mac OS X 10.7 or later -Building the sources requires Qt 5.2.0 or later. +Building the sources requires Qt 5.3.1 or later. It is also possible to build with Qt 4.8.x, but in that case the Welcome mode, QML Profiler, and the WinRT and Qbs support are disabled. -The Qt Quick Designer can only be compiled with Qt 5.3.1 or later , because -it requires QQuickWidget. Compiling Qt Creator ==================== Prerequisites: - * Qt 5.2.0 or later (with restrictions also Qt 4.8.x) + * Qt 5.3.1 or later (with restrictions also Qt 4.8.x) * On Windows: - ActiveState Active Perl - MinGW or Visual Studio 2010 or later @@ -191,7 +189,7 @@ http://qt-project.org/wiki/Building_Qt_5_from_Git . able to find all dependent Qt-libraries and plugins when being launched by the system. The easiest way to provide them for Qt 5 is to run the tool windeployqt: - windeployqt -svg -xml -designercomponents -script -concurrent -network -quick -test -sql -printsupport -qthelp -qmldir share\qtcreator -qmldir src\plugins\qmlprofiler bin\qtcreator.exe + windeployqt -svg -xml -designercomponents -script -concurrent -network -quick -quickwidgets -test -sql -printsupport -qthelp -qmldir share\qtcreator -qmldir src\plugins\qmlprofiler bin\qtcreator.exe Note that unlike on Unix, you cannot overwrite executables that are running. Thus, if you want to work on Qt Creator using Qt Creator, you need a diff --git a/qbs/imports/QtcPlugin.qbs b/qbs/imports/QtcPlugin.qbs index 14d8f909fe5..ff06cdfa546 100644 --- a/qbs/imports/QtcPlugin.qbs +++ b/qbs/imports/QtcPlugin.qbs @@ -25,8 +25,9 @@ QtcProduct { cpp.defines: base.concat([name.toUpperCase() + "_LIBRARY"]) cpp.installNamePrefix: "@rpath/PlugIns/" - cpp.rpaths: qbs.targetOS.contains("osx") ? ["@loader_path/..", "@executable_path/.."] - : ["$ORIGIN", "$ORIGIN/.."] + cpp.rpaths: qbs.targetOS.contains("osx") + ? ["@loader_path/..", "@loader_path/", "@executable_path/.."] + : ["$ORIGIN", "$ORIGIN/.."] cpp.linkerFlags: { var flags = base; if (qbs.buildVariant == "debug" && qbs.toolchain.contains("msvc")) diff --git a/qtcreator.pro b/qtcreator.pro index 702b46ae18b..9f1591526d1 100644 --- a/qtcreator.pro +++ b/qtcreator.pro @@ -41,21 +41,26 @@ exists(src/shared/qbs/qbs.pro) { system("echo QBSLIBDIR = $${maybe_backslash}\"$${IDE_LIBRARY_PATH}$${maybe_backslash}\" >> $$qmake_cache") system("echo QBS_INSTALL_PREFIX = $${QTC_PREFIX} >> $$qmake_cache") system("echo QBS_LIB_INSTALL_DIR = $${QTC_PREFIX}/$${IDE_LIBRARY_BASENAME}/qtcreator >> $$qmake_cache") - system("echo QBS_RESOURCES_BUILD_DIR = $${maybe_backslash}\"$${IDE_DATA_PATH}/qbs$${maybe_backslash}\" >> $$qmake_cache") + QBS_RESOURCES_BUILD_DIR = $${IDE_DATA_PATH}/qbs + system("echo QBS_RESOURCES_BUILD_DIR = $${maybe_backslash}\"$${QBS_RESOURCES_BUILD_DIR}$${maybe_backslash}\" >> $$qmake_cache") system("echo QBS_RESOURCES_INSTALL_DIR = $${QTC_PREFIX}/share/qtcreator/qbs >> $$qmake_cache") macx { - system("echo QBS_PLUGINS_BUILD_DIR = $${maybe_backslash}\"$${IDE_LIBRARY_PATH}$${maybe_backslash}\" >> $$qmake_cache") + QBS_PLUGINS_BUILD_DIR = $${IDE_LIBRARY_PATH} system("echo QBS_APPS_RPATH_DIR = @loader_path/../PlugIns >> $$qmake_cache") } else { - system("echo QBS_PLUGINS_BUILD_DIR = $${maybe_backslash}\"$${IDE_BUILD_TREE}/$${IDE_LIBRARY_BASENAME}/qtcreator/$${maybe_backslash}\" >> $$qmake_cache") + QBS_PLUGINS_BUILD_DIR = $${IDE_BUILD_TREE}/$${IDE_LIBRARY_BASENAME}/qtcreator system("echo QBS_APPS_RPATH_DIR = '\\\$\\\$ORIGIN/../'/lib/qtcreator >> $$qmake_cache") } + system("echo QBS_PLUGINS_BUILD_DIR = $${maybe_backslash}\"$${QBS_PLUGINS_BUILD_DIR}$${maybe_backslash}\" >> $$qmake_cache") system("echo QBS_PLUGINS_INSTALL_DIR = $${QTC_PREFIX}/$${IDE_LIBRARY_BASENAME}/qtcreator >> $$qmake_cache") system("echo QBS_LIBRARY_DIRNAME = $${IDE_LIBRARY_BASENAME} >> $$qmake_cache") - system("echo QBS_APPS_DESTDIR = $${maybe_backslash}\"$${IDE_BIN_PATH}$${maybe_backslash}\">> $$qmake_cache") + QBS_APPS_DESTDIR = $${IDE_BIN_PATH} + system("echo QBS_APPS_DESTDIR = $${maybe_backslash}\"$${QBS_APPS_DESTDIR}$${maybe_backslash}\">> $$qmake_cache") system("echo QBS_APPS_INSTALL_DIR = $${QTC_PREFIX}/bin >> $$qmake_cache") - system("echo QBS_RELATIVE_PLUGINS_PATH = $${maybe_backslash}\$$${maybe_backslash}\$relative_path$${maybe_backslash}\($${maybe_backslash}\$$${maybe_backslash}\$QBS_PLUGINS_BUILD_DIR, $${maybe_backslash}\$$${maybe_backslash}\$QBS_APPS_DESTDIR$${maybe_backslash}\)" >> $$qmake_cache) - system("echo QBS_RELATIVE_SEARCH_PATH = $${maybe_backslash}\$$${maybe_backslash}\$relative_path$${maybe_backslash}\($${maybe_backslash}\$$${maybe_backslash}\$QBS_RESOURCES_BUILD_DIR, $${maybe_backslash}\$$${maybe_backslash}\$QBS_APPS_DESTDIR$${maybe_backslash}\)" >> $$qmake_cache) + QBS_RELATIVE_PLUGINS_PATH = $$relative_path($$QBS_PLUGINS_BUILD_DIR, $$QBS_APPS_DESTDIR$$) + system("echo QBS_RELATIVE_PLUGINS_PATH = $${QBS_RELATIVE_PLUGINS_PATH}" >> $$qmake_cache) + QBS_RELATIVE_SEARCH_PATH = $$relative_path($$QBS_RESOURCES_BUILD_DIR, $$QBS_APPS_DESTDIR) + system("echo QBS_RELATIVE_SEARCH_PATH = $${QBS_RELATIVE_SEARCH_PATH}" >> $$qmake_cache) system("echo CONFIG += qbs_no_dev_install >> $$qmake_cache") } diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py index f743e970490..9b9c4308b95 100644 --- a/share/qtcreator/debugger/dumper.py +++ b/share/qtcreator/debugger/dumper.py @@ -753,13 +753,19 @@ class DumperBase: self.putType(type) self.putNumChild(1) format = self.currentItemFormat() - isDefault = format == None and str(innerType.unqualified()) == "char" - if isDefault or format == 0 or format == 1 or format == 2: + isDefault1 = format == None and str(innerType.unqualified()) == "char" + isDefault2 = format == None and str(innerType.unqualified()) == "wchar_t" + if isDefault1 or isDefault2 or format == 0 or format == 1 or format == 2: blob = self.readMemory(self.addressOf(value), type.sizeof) - if isDefault: + if isDefault1: # Use Latin1 as default for char []. self.putValue(blob, Hex2EncodedLatin1) + elif isDefault2: + if type.sizeof == 2: + self.putValue(blob, Hex4EncodedLittleEndian) + else: + self.putValue(blob, Hex8EncodedLittleEndian) elif format == 0: # Explicitly requested Latin1 formatting. self.putValue(blob, Hex2EncodedLatin1) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/AligmentHorizontalButtons.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/AligmentHorizontalButtons.qml index 6a7f731a748..f02a4d46e94 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/AligmentHorizontalButtons.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/AligmentHorizontalButtons.qml @@ -58,7 +58,7 @@ Row { property variant backendValue: backendValues.horizontalAlignment; - property variant value: backendValue.value + property variant value: backendValue.enumeration property bool baseStateFlag: isBaseState; diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/AligmentVerticalButtons.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/AligmentVerticalButtons.qml index b01bff41043..de69f40bb32 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/AligmentVerticalButtons.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/AligmentVerticalButtons.qml @@ -59,7 +59,7 @@ Row { property variant backendValue: backendValues.verticalAlignment; - property variant value: backendValue.value + property variant value: backendValue.enumeration property bool baseStateFlag: isBaseState; diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/AnchorButtons.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/AnchorButtons.qml index 5e93a588195..ebc1cdae880 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/AnchorButtons.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/AnchorButtons.qml @@ -94,7 +94,7 @@ ButtonRow { onClicked: { if (checked) { - anchorBackend.verticalCentered = false; + anchorBackend.horizontalCentered = false; anchorBackend.leftAnchored = true; } else { anchorBackend.leftAnchored = false; @@ -112,7 +112,7 @@ ButtonRow { onClicked: { if (checked) { - anchorBackend.verticalCentered = false; + anchorBackend.horizontalCentered = false; anchorBackend.rightAnchored = true; } else { anchorBackend.rightAnchored = false; diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/StandardTextSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/StandardTextSection.qml index 0cf32ce7d4b..2c7e0137d80 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/StandardTextSection.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/StandardTextSection.qml @@ -100,6 +100,7 @@ Section { text: qsTr("Format") } ComboBox { + scope: "Text" visible: showFormatProperty model: ["PlainText", "RichText", "AutoText"] backendValue: backendValues.textFormat diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnchorRow.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnchorRow.qml index bcf1955d78e..b41d99d7683 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnchorRow.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnchorRow.qml @@ -112,7 +112,7 @@ RowLayout { ButtonRow { id: buttonRow - opacity: anchorRow.showAlternativeTargets ? 1 : 0 + opacity: 0 property variant relativeTarget: anchorBackend.relativeAnchorTargetTop diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextSpecifics.qml index 173cf745d22..b25a7b0d4aa 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextSpecifics.qml @@ -39,6 +39,7 @@ Column { useLineEdit: true showIsWrapping: true showVerticalAlignment: true + showFormatProperty: true } Section { diff --git a/src/libs/3rdparty/botan/botan.cpp b/src/libs/3rdparty/botan/botan.cpp index 084c850d189..9715a56f6a1 100644 --- a/src/libs/3rdparty/botan/botan.cpp +++ b/src/libs/3rdparty/botan/botan.cpp @@ -37528,6 +37528,7 @@ Power_Mod::Power_Mod(const BigInt& n, Usage_Hints hints) */ Power_Mod::Power_Mod(const Power_Mod& other) { + Q_UNUSED(hints); core = 0; if(other.core) core = other.core->copy(); @@ -46650,6 +46651,8 @@ bool has_mlock() */ bool lock_mem(void* ptr, size_t bytes) { + Q_UNUSED(ptr); + Q_UNUSED(bytes); #if defined(BOTAN_TARGET_OS_HAS_POSIX_MLOCK) return (::mlock(static_cast(ptr), bytes) == 0); #elif defined(BOTAN_TARGET_OS_HAS_WIN32_VIRTUAL_LOCK) @@ -46664,6 +46667,8 @@ bool lock_mem(void* ptr, size_t bytes) */ void unlock_mem(void* ptr, size_t bytes) { + Q_UNUSED(ptr); + Q_UNUSED(bytes); #if defined(BOTAN_TARGET_OS_HAS_POSIX_MLOCK) ::munlock(static_cast(ptr), bytes); #elif defined(BOTAN_TARGET_OS_HAS_WIN32_VIRTUAL_LOCK) diff --git a/src/libs/qmljs/qmljsimportdependencies.cpp b/src/libs/qmljs/qmljsimportdependencies.cpp index 198a2dbd433..27a0595e341 100644 --- a/src/libs/qmljs/qmljsimportdependencies.cpp +++ b/src/libs/qmljs/qmljsimportdependencies.cpp @@ -32,7 +32,6 @@ #include "qmljsqrcparser.h" #include -#include #include @@ -616,7 +615,7 @@ CoreImport ImportDependencies::coreImport(const QString &importId) const void ImportDependencies::iterateOnCandidateImports( const ImportKey &key, const ViewerContext &vContext, - Utils::function + std::function const &iterF) const { switch (key.type) { @@ -817,7 +816,7 @@ void ImportDependencies::removeExport(const QString &importId, const ImportKey & void ImportDependencies::iterateOnCoreImports( const ViewerContext &vContext, - Utils::function const &iterF) const + std::function const &iterF) const { QMapIterator i(m_coreImports); while (i.hasNext()) { @@ -829,9 +828,9 @@ void ImportDependencies::iterateOnCoreImports( void ImportDependencies::iterateOnLibraryImports( const ViewerContext &vContext, - Utils::function const &iterF) const + std::function const &iterF) const { typedef QMap::const_iterator iter_t; ImportKey firstLib; @@ -865,9 +864,9 @@ void ImportDependencies::iterateOnLibraryImports( void ImportDependencies::iterateOnSubImports( const ImportKey &baseKey, const ViewerContext &vContext, - Utils::function const &iterF) const + std::function const &iterF) const { typedef QMap::const_iterator iter_t; iter_t i = m_importCache.lowerBound(baseKey); diff --git a/src/libs/qmljs/qmljsimportdependencies.h b/src/libs/qmljs/qmljsimportdependencies.h index c77b42dfd05..0ca0dbcf34a 100644 --- a/src/libs/qmljs/qmljsimportdependencies.h +++ b/src/libs/qmljs/qmljsimportdependencies.h @@ -34,7 +34,6 @@ #include #include -#include #include #include @@ -44,6 +43,8 @@ #include #include +#include + QT_BEGIN_NAMESPACE class QCryptographicHash; QT_END_NAMESPACE @@ -192,7 +193,7 @@ public: CoreImport coreImport(const QString &importId) const; void iterateOnCandidateImports(const ImportKey &key, const ViewerContext &vContext, - Utils::function const &iterF) const; ImportElements candidateImports(const ImportKey &key, const ViewerContext &vContext) const; @@ -209,13 +210,13 @@ public: const QString &requiredPath); void iterateOnCoreImports(const ViewerContext &vContext, - Utils::function const &iterF) const; + std::function const &iterF) const; void iterateOnLibraryImports(const ViewerContext &vContext, - Utils::function const &iterF) const; void iterateOnSubImports(const ImportKey &baseKey, const ViewerContext &vContext, - Utils::function const &iterF) const; diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp index 34ca7fa672c..6a9068807e0 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp @@ -36,7 +36,6 @@ #include "qmljstypedescriptionreader.h" #include -#include #include #include @@ -815,7 +814,7 @@ void ModelManagerInterface::parseLoop(QSet &scannedPaths, ModelManagerInterface *modelManager, Language::Enum mainLanguage, bool emitDocChangedOnDisk, - Utils::function reportProgress) + std::function reportProgress) { for (int i = 0; i < files.size(); ++i) { if (!reportProgress(qreal(i) / files.size())) @@ -1379,6 +1378,19 @@ void ModelManagerInterface::joinAllThreads() future.waitForFinished(); } +Document::Ptr ModelManagerInterface::ensuredGetDocumentForPath(const QString &filePath) +{ + QmlJS::Document::Ptr document = newestSnapshot().document(filePath); + if (!document) { + document = QmlJS::Document::create(filePath, QmlJS::Language::Qml); + QMutexLocker lock(&m_mutex); + + m_newestSnapshot.insert(document); + } + + return document; +} + void ModelManagerInterface::resetCodeModel() { QStringList documents; diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.h b/src/libs/qmljs/qmljsmodelmanagerinterface.h index 425f7bc2eb1..5b3f771cf9a 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.h +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.h @@ -199,6 +199,9 @@ public: // Blocks until all parsing threads are done. Used for testing. void joinAllThreads(); + + QmlJS::Document::Ptr ensuredGetDocumentForPath(const QString &filePath); + public slots: virtual void resetCodeModel(); void removeProjectInfo(ProjectExplorer::Project *project); @@ -226,7 +229,7 @@ protected: static void parseLoop(QSet &scannedPaths, QSet &newLibraries, WorkingCopy workingCopyInternal, QStringList files, ModelManagerInterface *modelManager, QmlJS::Language::Enum mainLanguage, bool emitDocChangedOnDisk, - Utils::function reportProgress); + std::function reportProgress); static void parse(QFutureInterface &future, WorkingCopy workingCopyInternal, QStringList files, diff --git a/src/libs/utils/basetreeview.cpp b/src/libs/utils/basetreeview.cpp index 1bced761d2e..7114021e63b 100644 --- a/src/libs/utils/basetreeview.cpp +++ b/src/libs/utils/basetreeview.cpp @@ -29,6 +29,8 @@ #include "basetreeview.h" +#include +#include #include #include #include @@ -75,36 +77,21 @@ BaseTreeView::BaseTreeView(QWidget *parent) SLOT(rowClickedHelper(QModelIndex))); connect(header(), SIGNAL(sectionClicked(int)), SLOT(toggleColumnWidth(int))); - - m_alwaysAdjustColumns = false; - - m_layoutTimer.setSingleShot(true); - m_layoutTimer.setInterval(20); - connect(&m_layoutTimer, SIGNAL(timeout()), this, SLOT(resizeColumnsFinish())); } -void BaseTreeView::setModel(QAbstractItemModel *model) +void BaseTreeView::setModel(QAbstractItemModel *m) { - disconnectColumnAdjustment(); - Utils::TreeView::setModel(model); - connectColumnAdjustment(); -} - -void BaseTreeView::connectColumnAdjustment() -{ - if (m_alwaysAdjustColumns && model()) { - connect(this, SIGNAL(expanded(QModelIndex)), this, SLOT(resizeColumns())); - connect(this, SIGNAL(collapsed(QModelIndex)), this, SLOT(resizeColumns())); - connect(model(), SIGNAL(layoutChanged()), this, SLOT(resizeColumns())); + const char *sig = "columnAdjustmentRequested()"; + if (model()) { + int index = model()->metaObject()->indexOfSignal(sig); + if (index != -1) + disconnect(model(), SIGNAL(columnAdjustmentRequested()), this, SLOT(resizeColumns())); } -} - -void BaseTreeView::disconnectColumnAdjustment() -{ - if (m_alwaysAdjustColumns && model()) { - disconnect(this, SIGNAL(expanded(QModelIndex)), this, SLOT(resizeColumns())); - disconnect(this, SIGNAL(collapsed(QModelIndex)), this, SLOT(resizeColumns())); - disconnect(model(), SIGNAL(layoutChanged()), this, SLOT(resizeColumns())); + Utils::TreeView::setModel(m); + if (m) { + int index = m->metaObject()->indexOfSignal(sig); + if (index != -1) + connect(m, SIGNAL(columnAdjustmentRequested()), this, SLOT(resizeColumns())); } } @@ -121,61 +108,54 @@ void BaseTreeView::resizeColumns() QHeaderView *h = header(); if (!h) return; - const int n = h->count(); - if (n) { - for (int i = 0; i != n; ++i) - h->setResizeMode(i, QHeaderView::ResizeToContents); - m_layoutTimer.start(); + + for (int i = 0, n = h->count(); i != n; ++i) { + int targetSize = suggestedColumnSize(i); + if (targetSize > 0) + h->resizeSection(i, targetSize); } } -void BaseTreeView::resizeColumnsFinish() +int BaseTreeView::suggestedColumnSize(int column) const { QHeaderView *h = header(); if (!h) - return; + return -1; + QModelIndex a = indexAt(QPoint(1, 1)); + a = a.sibling(a.row(), column); QFontMetrics fm(font()); - for (int i = 0, n = h->count(); i != n; ++i) { - int headerSize = fm.width(model()->headerData(i, Qt::Horizontal).toString()); - int targetSize = qMax(sizeHintForColumn(i), headerSize); - if (targetSize > 0) { - h->setResizeMode(i, QHeaderView::Interactive); - h->resizeSection(i, targetSize); + int m = fm.width(model()->headerData(column, Qt::Horizontal).toString()); + const int ind = indentation(); + for (int i = 0; i < 100 && a.isValid(); ++i) { + const QString s = model()->data(a).toString(); + int w = fm.width(s) + 10; + if (column == 0) { + for (QModelIndex b = a.parent(); b.isValid(); b = b.parent()) + w += ind; } + if (w > m) + m = w; + a = indexBelow(a); } + return m; } void BaseTreeView::toggleColumnWidth(int logicalIndex) { QHeaderView *h = header(); const int currentSize = h->sectionSize(logicalIndex); - if (currentSize == sizeHintForColumn(logicalIndex)) { + const int suggestedSize = suggestedColumnSize(logicalIndex); + if (currentSize == suggestedSize) { QFontMetrics fm(font()); int headerSize = fm.width(model()->headerData(logicalIndex, Qt::Horizontal).toString()); int minSize = 10 * fm.width(QLatin1Char('x')); h->resizeSection(logicalIndex, qMax(minSize, headerSize)); } else { - resizeColumnToContents(logicalIndex); + h->resizeSection(logicalIndex, suggestedSize); } } -void BaseTreeView::reset() -{ - Utils::TreeView::reset(); - if (m_alwaysAdjustColumns) - resizeColumns(); -} - -void BaseTreeView::setAlwaysAdjustColumns(bool on) -{ - if (on == m_alwaysAdjustColumns) - return; - disconnectColumnAdjustment(); - m_alwaysAdjustColumns = on; - connectColumnAdjustment(); -} - QModelIndexList BaseTreeView::activeRows() const { QItemSelectionModel *selection = selectionModel(); diff --git a/src/libs/utils/basetreeview.h b/src/libs/utils/basetreeview.h index cdfd1ce7dd7..f034abb1dbc 100644 --- a/src/libs/utils/basetreeview.h +++ b/src/libs/utils/basetreeview.h @@ -34,8 +34,6 @@ #include "itemviews.h" -#include - namespace Utils { class QTCREATOR_UTILS_EXPORT BaseTreeView : public Utils::TreeView @@ -53,24 +51,16 @@ public: void mousePressEvent(QMouseEvent *ev); public slots: - void reset(); - void resizeColumns(); void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); } - void setAlwaysAdjustColumns(bool on); private slots: - void resizeColumnsFinish(); void rowActivatedHelper(const QModelIndex &index) { rowActivated(index); } void rowClickedHelper(const QModelIndex &index) { rowClicked(index); } void toggleColumnWidth(int logicalIndex); private: - void connectColumnAdjustment(); - void disconnectColumnAdjustment(); - - bool m_alwaysAdjustColumns; - QTimer m_layoutTimer; + int suggestedColumnSize(int column) const; }; } // namespace Utils diff --git a/src/libs/utils/buildablehelperlibrary.cpp b/src/libs/utils/buildablehelperlibrary.cpp index b6f0331246d..967ef75fe91 100644 --- a/src/libs/utils/buildablehelperlibrary.cpp +++ b/src/libs/utils/buildablehelperlibrary.cpp @@ -85,15 +85,6 @@ Utils::FileName BuildableHelperLibrary::findSystemQt(const Utils::Environment &e return Utils::FileName(); } -QString BuildableHelperLibrary::qtInstallDataDir(const Utils::FileName &qmakePath) -{ - QProcess proc; - proc.start(qmakePath.toString(), QStringList() << QLatin1String("-query") << QLatin1String("QT_INSTALL_DATA")); - if (proc.waitForFinished()) - return QString::fromLocal8Bit(proc.readAll()).trimmed(); - return QString(); -} - QString BuildableHelperLibrary::qtVersionForQMake(const QString &qmakePath) { bool qmakeIsExecutable; diff --git a/src/libs/utils/buildablehelperlibrary.h b/src/libs/utils/buildablehelperlibrary.h index ff30146e8ea..c01a45d231e 100644 --- a/src/libs/utils/buildablehelperlibrary.h +++ b/src/libs/utils/buildablehelperlibrary.h @@ -51,9 +51,6 @@ public: // returns something like qmake4, qmake, qmake-qt4 or whatever distributions have chosen (used by QtVersion) static QStringList possibleQMakeCommands(); - static QString qtInstallHeadersDir(const QString &qmakePath); - static QString qtInstallDataDir(const FileName &qmakePath); - static QString byInstallDataHelper(const QString &sourcePath, const QStringList &sourceFileNames, const QStringList &installDirectories, diff --git a/src/libs/utils/function.cpp b/src/libs/utils/function.cpp deleted file mode 100644 index 037cd8824c5..00000000000 --- a/src/libs/utils/function.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** 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 "function.h" - -namespace { -// just compilation tests - -void test(); - -void functionUser(Utils::function generator, Utils::function consumer) -{ - consumer(generator()); -} - -struct GenFunctor -{ - int operator()() { return 29; } -}; - -struct ConsumerFunctor -{ - void operator()(int) {} -}; - -int generatorF() -{ - return 42; -} - -void consumerF(int i) -{ - if (i < 0) - test(); -} - -void test() -{ - functionUser(GenFunctor(), ConsumerFunctor()); - functionUser(&generatorF, &consumerF); -} - -} // end namespace diff --git a/src/libs/utils/function.h b/src/libs/utils/function.h deleted file mode 100644 index 0edc9b6029e..00000000000 --- a/src/libs/utils/function.h +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** 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. -** -****************************************************************************/ - -#ifndef QTC_FUNCTION_H -#define QTC_FUNCTION_H - -#include -#if !(__cplusplus > 199711L || __GXX_EXPERIMENTAL_CXX0X__ || _MSC_VER >= 1600 || defined( _LIBCPP_VERSION )) || \ - (defined(__GNUC_LIBSTD__) && ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402)) -#define USE_TR1 -#endif - -#ifdef USE_TR1 -# ifdef __GNUC__ -# include -# endif -namespace Utils { using std::tr1::function; } -#else -namespace Utils { using std::function; } -#endif - -#endif // QTC_FUNCTION_H diff --git a/src/libs/utils/utils-lib.pri b/src/libs/utils/utils-lib.pri index 5237d7ec48b..ca6da2708b2 100644 --- a/src/libs/utils/utils-lib.pri +++ b/src/libs/utils/utils-lib.pri @@ -82,7 +82,6 @@ SOURCES += $$PWD/environment.cpp \ $$PWD/tooltip/tips.cpp \ $$PWD/tooltip/tipcontents.cpp \ $$PWD/unixutils.cpp \ - $$PWD/function.cpp \ $$PWD/ansiescapecodehandler.cpp \ $$PWD/execmenu.cpp \ $$PWD/completinglineedit.cpp \ @@ -173,7 +172,6 @@ HEADERS += \ $$PWD/tooltip/effects.h \ $$PWD/unixutils.h \ $$PWD/qtcoverride.h \ - $$PWD/function.h \ $$PWD/ansiescapecodehandler.h \ $$PWD/execmenu.h \ $$PWD/completinglineedit.h \ diff --git a/src/libs/utils/utils.qbs b/src/libs/utils/utils.qbs index 1bcc17aaa58..6a17f6bcc93 100644 --- a/src/libs/utils/utils.qbs +++ b/src/libs/utils/utils.qbs @@ -89,8 +89,6 @@ QtcLibrary { "filewizardpage.ui", "flowlayout.cpp", "flowlayout.h", - "function.cpp", - "function.h", "historycompleter.cpp", "historycompleter.h", "hostosinfo.h", diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp index 70890dfc791..b2021b34a1f 100644 --- a/src/plugins/android/androidconfigurations.cpp +++ b/src/plugins/android/androidconfigurations.cpp @@ -460,7 +460,7 @@ QVector AndroidConfig::connectedDevices(QString *error) const QVector devices; QProcess adbProc; adbProc.start(adbToolPath().toString(), QStringList() << QLatin1String("devices")); - if (!adbProc.waitForFinished(5000)) { + if (!adbProc.waitForFinished(10000)) { adbProc.kill(); if (error) *error = QApplication::translate("AndroidConfiguration", @@ -729,7 +729,7 @@ bool AndroidConfig::isBootToQt(const QString &device) const QProcess adbProc; adbProc.start(adbToolPath().toString(), arguments); - if (!adbProc.waitForFinished(5000)) { + if (!adbProc.waitForFinished(10000)) { adbProc.kill(); return false; } @@ -745,7 +745,7 @@ int AndroidConfig::getSDKVersion(const QString &device) const QProcess adbProc; adbProc.start(adbToolPath().toString(), arguments); - if (!adbProc.waitForFinished(5000)) { + if (!adbProc.waitForFinished(10000)) { adbProc.kill(); return -1; } @@ -768,7 +768,7 @@ QString AndroidConfig::getProductModel(const QString &device) const QProcess adbProc; adbProc.start(adbToolPath().toString(), arguments); - if (!adbProc.waitForFinished(5000)) { + if (!adbProc.waitForFinished(10000)) { adbProc.kill(); return device; } @@ -788,7 +788,7 @@ bool AndroidConfig::hasFinishedBooting(const QString &device) const QProcess adbProc; adbProc.start(adbToolPath().toString(), arguments); - if (!adbProc.waitForFinished(5000)) { + if (!adbProc.waitForFinished(10000)) { adbProc.kill(); return false; } @@ -811,7 +811,7 @@ QStringList AndroidConfig::getAbis(const QString &device) const QProcess adbProc; adbProc.start(adbToolPath().toString(), arguments); - if (!adbProc.waitForFinished(5000)) { + if (!adbProc.waitForFinished(10000)) { adbProc.kill(); return result; } diff --git a/src/plugins/android/androiddeploystep.cpp b/src/plugins/android/androiddeploystep.cpp index d3bdaf9dd29..565466a266e 100644 --- a/src/plugins/android/androiddeploystep.cpp +++ b/src/plugins/android/androiddeploystep.cpp @@ -281,7 +281,7 @@ unsigned int AndroidDeployStep::remoteModificationTime(const QString &fullDestin QStringList arguments = AndroidDeviceInfo::adbSelector(m_deviceSerialNumber); arguments << QLatin1String("ls") << destination; process.start(AndroidConfigurations::currentConfig().adbToolPath().toString(), arguments); - if (!process.waitForFinished(5000) + if (!process.waitForFinished(10000) || process.exitCode() != 0) return 0; QByteArray output = process.readAll(); diff --git a/src/plugins/android/androidrunner.cpp b/src/plugins/android/androidrunner.cpp index c04664f56bb..4958b1be8d4 100644 --- a/src/plugins/android/androidrunner.cpp +++ b/src/plugins/android/androidrunner.cpp @@ -240,7 +240,7 @@ void AndroidRunner::asyncStart() emit remoteProcessFinished(tr("Failed to forward C++ debugging ports. Reason: %1.").arg(adb.errorString())); return; } - if (!adb.waitForFinished(5000)) { + if (!adb.waitForFinished(10000)) { emit remoteProcessFinished(tr("Failed to forward C++ debugging ports.")); return; } @@ -283,7 +283,7 @@ void AndroidRunner::asyncStart() emit remoteProcessFinished(tr("Failed to start the activity. Reason: %1.").arg(adb.errorString())); return; } - if (!adb.waitForFinished(5000)) { + if (!adb.waitForFinished(10000)) { adb.terminate(); emit remoteProcessFinished(tr("Unable to start \"%1\".").arg(m_packageName)); return; diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp index d1b220da134..0001e4c764d 100644 --- a/src/plugins/bookmarks/bookmarkmanager.cpp +++ b/src/plugins/bookmarks/bookmarkmanager.cpp @@ -66,16 +66,10 @@ namespace Bookmarks { namespace Internal { BookmarkDelegate::BookmarkDelegate(QObject *parent) - : QStyledItemDelegate(parent), m_normalPixmap(0), m_selectedPixmap(0) + : QStyledItemDelegate(parent) { } -BookmarkDelegate::~BookmarkDelegate() -{ - delete m_normalPixmap; - delete m_selectedPixmap; -} - QSize BookmarkDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const { QStyleOptionViewItemV4 opt = option; @@ -90,14 +84,13 @@ QSize BookmarkDelegate::sizeHint(const QStyleOptionViewItem &option, const QMode void BookmarkDelegate::generateGradientPixmap(int width, int height, const QColor &color, bool selected) const { - QColor c = color; c.setAlpha(0); - QPixmap *pixmap = new QPixmap(width+1, height); - pixmap->fill(c); + QPixmap pixmap(width+1, height); + pixmap.fill(c); - QPainter painter(pixmap); + QPainter painter(&pixmap); painter.setPen(Qt::NoPen); QLinearGradient lg; @@ -107,7 +100,7 @@ void BookmarkDelegate::generateGradientPixmap(int width, int height, const QColo lg.setColorAt(0, c); lg.setColorAt(0.4, color); - painter.setBrush(lg); + painter.setBrush(lg); painter.drawRect(0, 0, width+1, height); if (selected) @@ -154,7 +147,7 @@ void BookmarkDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti // TopLeft - QString topLeft = index.data(BookmarkManager::Filename ).toString(); + QString topLeft = index.data(BookmarkManager::Filename).toString(); painter->drawText(6, 2 + opt.rect.top() + fm.ascent(), topLeft); QString topRight = index.data(BookmarkManager::LineNumber).toString(); @@ -162,7 +155,7 @@ void BookmarkDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti int fwidth = fm.width(topLeft); if (fwidth + lwidth > opt.rect.width()) { int left = opt.rect.right() - lwidth; - painter->drawPixmap(left, opt.rect.top(), selected? *m_selectedPixmap : *m_normalPixmap); + painter->drawPixmap(left, opt.rect.top(), selected ? m_selectedPixmap : m_normalPixmap); } // topRight painter->drawText(opt.rect.right() - fm.width(topRight) - 6 , 2 + opt.rect.top() + fm.ascent(), topRight); @@ -213,24 +206,31 @@ void BookmarkDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti painter->restore(); } -BookmarkView::BookmarkView(QWidget *parent) : - Utils::ListView(parent), - m_bookmarkContext(new BookmarkContext(this)), - m_manager(0) +BookmarkView::BookmarkView(BookmarkManager *manager) : + m_bookmarkContext(new Core::IContext(this)), + m_manager(manager) { setWindowTitle(tr("Bookmarks")); - connect(this, SIGNAL(clicked(QModelIndex)), - this, SLOT(gotoBookmark(QModelIndex))); - connect(this, SIGNAL(activated(QModelIndex)), - this, SLOT(gotoBookmark(QModelIndex))); + m_bookmarkContext->setWidget(this); + m_bookmarkContext->setContext(Core::Context(Constants::BOOKMARKS_CONTEXT)); ICore::addContextObject(m_bookmarkContext); + Utils::ListView::setModel(manager); + setItemDelegate(new BookmarkDelegate(this)); setFrameStyle(QFrame::NoFrame); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setFocusPolicy(Qt::NoFocus); + setSelectionModel(manager->selectionModel()); + setSelectionMode(QAbstractItemView::SingleSelection); + setSelectionBehavior(QAbstractItemView::SelectRows); + + connect(this, SIGNAL(clicked(QModelIndex)), + this, SLOT(gotoBookmark(QModelIndex))); + connect(this, SIGNAL(activated(QModelIndex)), + this, SLOT(gotoBookmark(QModelIndex))); } BookmarkView::~BookmarkView() @@ -311,17 +311,6 @@ void BookmarkView::removeAll() } } -void BookmarkView::setModel(QAbstractItemModel *model) -{ - BookmarkManager *manager = qobject_cast(model); - QTC_ASSERT(manager, return); - m_manager = manager; - Utils::ListView::setModel(model); - setSelectionModel(manager->selectionModel()); - setSelectionMode(QAbstractItemView::SingleSelection); - setSelectionBehavior(QAbstractItemView::SelectRows); -} - void BookmarkView::gotoBookmark(const QModelIndex &index) { Bookmark *bk = m_manager->bookmarkForIndex(index); @@ -329,17 +318,6 @@ void BookmarkView::gotoBookmark(const QModelIndex &index) m_manager->removeBookmark(bk); } -//// -// BookmarkContext -//// - -BookmarkContext::BookmarkContext(QWidget *widget) - : Core::IContext(widget) -{ - setWidget(widget); - setContext(Core::Context(Constants::BOOKMARKS_CONTEXT)); -} - //// // BookmarkManager //// @@ -414,15 +392,15 @@ QVariant BookmarkManager::data(const QModelIndex &index, int role) const if (role == BookmarkManager::Filename) return m_bookmarksList.at(index.row())->fileName(); - else if (role == BookmarkManager::LineNumber) + if (role == BookmarkManager::LineNumber) return m_bookmarksList.at(index.row())->lineNumber(); - else if (role == BookmarkManager::Directory) + if (role == BookmarkManager::Directory) return m_bookmarksList.at(index.row())->path(); - else if (role == BookmarkManager::LineText) + if (role == BookmarkManager::LineText) return m_bookmarksList.at(index.row())->lineText(); - else if (role == BookmarkManager::Note) + if (role == BookmarkManager::Note) return m_bookmarksList.at(index.row())->note(); - else if (role == Qt::ToolTipRole) + if (role == Qt::ToolTipRole) return QDir::toNativeSeparators(m_bookmarksList.at(index.row())->filePath()); return QVariant(); @@ -521,20 +499,17 @@ void BookmarkManager::removeBookmark(Bookmark *bookmark) saveBookmarks(); } -Bookmark *BookmarkManager::bookmarkForIndex(const QModelIndex &index) +Bookmark *BookmarkManager::bookmarkForIndex(const QModelIndex &index) const { if (!index.isValid() || index.row() >= m_bookmarksList.size()) return 0; return m_bookmarksList.at(index.row()); } - bool BookmarkManager::gotoBookmark(Bookmark *bookmark) { - if (ITextEditor *editor = qobject_cast(EditorManager::openEditorAt(bookmark->filePath(), - bookmark->lineNumber()))) { - return (editor->currentLine() == bookmark->lineNumber()); - } + if (IEditor *editor = EditorManager::openEditorAt(bookmark->filePath(), bookmark->lineNumber())) + return editor->currentLine() == bookmark->lineNumber(); return false; } @@ -807,12 +782,12 @@ void BookmarkManager::saveBookmarks() { QStringList list; foreach (const Bookmark *bookmark, m_bookmarksList) - list << bookmarkToString(bookmark); + list << bookmarkToString(bookmark); SessionManager::setValue(QLatin1String("Bookmarks"), list); } -void BookmarkManager::operateTooltip(TextEditor::ITextEditor *textEditor, const QPoint &pos, Bookmark *mark) +void BookmarkManager::operateTooltip(ITextEditor *textEditor, const QPoint &pos, Bookmark *mark) { if (!mark) return; @@ -834,15 +809,15 @@ void BookmarkManager::loadBookmarks() updateActionStatus(); } -void BookmarkManager::handleBookmarkRequest(TextEditor::ITextEditor *textEditor, +void BookmarkManager::handleBookmarkRequest(ITextEditor *textEditor, int line, - TextEditor::ITextEditor::MarkRequestKind kind) + ITextEditor::MarkRequestKind kind) { - if (kind == TextEditor::ITextEditor::BookmarkRequest && textEditor->document()) + if (kind == ITextEditor::BookmarkRequest && textEditor->document()) toggleBookmark(textEditor->document()->filePath(), line); } -void BookmarkManager::handleBookmarkTooltipRequest(TextEditor::ITextEditor *textEditor, const QPoint &pos, +void BookmarkManager::handleBookmarkTooltipRequest(ITextEditor *textEditor, const QPoint &pos, int line) { if (textEditor->document()) { @@ -881,8 +856,7 @@ QKeySequence BookmarkViewFactory::activationSequence() const Core::NavigationView BookmarkViewFactory::createWidget() { - BookmarkView *bookmarkView = new BookmarkView(); - bookmarkView->setModel(m_manager); + BookmarkView *bookmarkView = new BookmarkView(m_manager); Core::NavigationView view; view.widget = bookmarkView; return view; diff --git a/src/plugins/bookmarks/bookmarkmanager.h b/src/plugins/bookmarks/bookmarkmanager.h index e927738a12f..88f6a178f59 100644 --- a/src/plugins/bookmarks/bookmarkmanager.h +++ b/src/plugins/bookmarks/bookmarkmanager.h @@ -63,7 +63,7 @@ public: void updateBookmark(Bookmark *bookmark); void removeBookmark(Bookmark *bookmark); // Does not remove the mark void removeAllBookmarks(); - Bookmark *bookmarkForIndex(const QModelIndex &index); + Bookmark *bookmarkForIndex(const QModelIndex &index) const; enum State { NoBookMarks, HasBookMarks, HasBookmarksInDocument }; State state() const; @@ -118,7 +118,7 @@ private slots: private: void documentPrevNext(bool next); - Bookmark* findBookmark(const QString &path, const QString &fileName, int lineNumber); + Bookmark *findBookmark(const QString &path, const QString &fileName, int lineNumber); void addBookmark(Bookmark *bookmark, bool userset = true); void addBookmark(const QString &s); static QString bookmarkToString(const Bookmark *b); @@ -139,58 +139,60 @@ private: class BookmarkView : public Utils::ListView { Q_OBJECT + public: - BookmarkView(QWidget *parent = 0); + explicit BookmarkView(BookmarkManager *manager); ~BookmarkView(); - void setModel(QAbstractItemModel *model); + public slots: void gotoBookmark(const QModelIndex &index); + protected slots: void removeFromContextMenu(); void removeAll(); + protected: void contextMenuEvent(QContextMenuEvent *event); void removeBookmark(const QModelIndex &index); void keyPressEvent(QKeyEvent *event); + private: - BookmarkContext *m_bookmarkContext; + Core::IContext *m_bookmarkContext; QModelIndex m_contextMenuIndex; BookmarkManager *m_manager; }; -class BookmarkContext : public Core::IContext -{ -public: - BookmarkContext(QWidget *widget); -}; - class BookmarkViewFactory : public Core::INavigationWidgetFactory { Q_OBJECT + public: BookmarkViewFactory(BookmarkManager *bm); + +private: QString displayName() const; int priority() const; Core::Id id() const; QKeySequence activationSequence() const; Core::NavigationView createWidget(); -private: + BookmarkManager *m_manager; }; class BookmarkDelegate : public QStyledItemDelegate { Q_OBJECT + public: - BookmarkDelegate(QObject * parent = 0); - ~BookmarkDelegate(); - void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; - QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; + BookmarkDelegate(QObject *parent = 0); private: + void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; + QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; void generateGradientPixmap(int width, int height, const QColor &color, bool selected) const; - mutable QPixmap *m_normalPixmap; - mutable QPixmap *m_selectedPixmap; + + mutable QPixmap m_normalPixmap; + mutable QPixmap m_selectedPixmap; }; } // namespace Internal diff --git a/src/plugins/bookmarks/bookmarksplugin.cpp b/src/plugins/bookmarks/bookmarksplugin.cpp index 7083c8bec3c..caa3c25642b 100644 --- a/src/plugins/bookmarks/bookmarksplugin.cpp +++ b/src/plugins/bookmarks/bookmarksplugin.cpp @@ -52,13 +52,10 @@ using namespace Bookmarks::Constants; using namespace Bookmarks::Internal; using namespace TextEditor; -BookmarksPlugin *BookmarksPlugin::m_instance = 0; - BookmarksPlugin::BookmarksPlugin() : m_bookmarkManager(0), m_bookmarkMarginActionLineNumber(0) { - m_instance = this; } void BookmarksPlugin::extensionsInitialized() diff --git a/src/plugins/bookmarks/bookmarksplugin.h b/src/plugins/bookmarks/bookmarksplugin.h index bfc42a30198..d417dda3bdf 100644 --- a/src/plugins/bookmarks/bookmarksplugin.h +++ b/src/plugins/bookmarks/bookmarksplugin.h @@ -58,8 +58,6 @@ public: BookmarksPlugin(); ~BookmarksPlugin(); - static BookmarksPlugin *instance() { return m_instance; } - bool initialize(const QStringList &arguments, QString *errorMessage); void extensionsInitialized(); diff --git a/src/plugins/cmakeprojectmanager/cmakehighlighterfactory.cpp b/src/plugins/cmakeprojectmanager/cmakehighlighterfactory.cpp deleted file mode 100644 index 6cb28fcb05f..00000000000 --- a/src/plugins/cmakeprojectmanager/cmakehighlighterfactory.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** 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 "cmakehighlighterfactory.h" -#include "cmakeprojectconstants.h" -#include "cmakehighlighter.h" - -using namespace CMakeProjectManager::Internal; - -CMakeHighlighterFactory::CMakeHighlighterFactory() -{ - setId(CMakeProjectManager::Constants::CMAKE_EDITOR_ID); - addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE); -} - -TextEditor::SyntaxHighlighter *CMakeHighlighterFactory::createHighlighter() const -{ - return new CMakeHighlighter; -} diff --git a/src/plugins/cmakeprojectmanager/cmakehighlighterfactory.h b/src/plugins/cmakeprojectmanager/cmakehighlighterfactory.h deleted file mode 100644 index bd5371b2efc..00000000000 --- a/src/plugins/cmakeprojectmanager/cmakehighlighterfactory.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** 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. -** -****************************************************************************/ - -#ifndef CMAKEHIGHLIGHTERFACTORY_H -#define CMAKEHIGHLIGHTERFACTORY_H - -#include - -namespace CMakeProjectManager { -namespace Internal { - -class CMakeHighlighterFactory : public TextEditor::IHighlighterFactory -{ - Q_OBJECT - -public: - CMakeHighlighterFactory(); - - virtual TextEditor::SyntaxHighlighter *createHighlighter() const; -}; - -} // namespace Internal -} // namespace CMakeProjectManager - -#endif // CMAKEHIGHLIGHTERFACTORY_H diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index 857cd919d53..ef775db9625 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -737,9 +737,11 @@ void CMakeProject::updateApplicationAndDeploymentTargets() QString absoluteSourcePath = sourceDir.absolutePath(); if (!absoluteSourcePath.endsWith(QLatin1Char('/'))) absoluteSourcePath.append(QLatin1Char('/')); - while (!deploymentStream.atEnd()) { - QStringList file = deploymentStream.readLine().split(QLatin1Char(':')); - deploymentData.addFile(absoluteSourcePath + file.at(0), deploymentPrefix + file.at(1)); + if (deploymentStream.device()) { + while (!deploymentStream.atEnd()) { + QStringList file = deploymentStream.readLine().split(QLatin1Char(':')); + deploymentData.addFile(absoluteSourcePath + file.at(0), deploymentPrefix + file.at(1)); + } } t->setApplicationTargets(appTargetList); diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro index 953dfbb7478..79096afd0fd 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro @@ -13,7 +13,6 @@ HEADERS = cmakebuildinfo.h \ cmakeeditorfactory.h \ cmakeeditor.h \ cmakehighlighter.h \ - cmakehighlighterfactory.h \ cmakelocatorfilter.h \ cmakefilecompletionassist.h \ cmaketool.h \ @@ -32,7 +31,6 @@ SOURCES = cmakeproject.cpp \ cmakeeditorfactory.cpp \ cmakeeditor.cpp \ cmakehighlighter.cpp \ - cmakehighlighterfactory.cpp \ cmakelocatorfilter.cpp \ cmakefilecompletionassist.cpp \ cmaketool.cpp \ diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs index aaa7e9c65b6..2fd4f5719b4 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs @@ -32,8 +32,6 @@ QtcPlugin { "cmakefilecompletionassist.h", "cmakehighlighter.cpp", "cmakehighlighter.h", - "cmakehighlighterfactory.cpp", - "cmakehighlighterfactory.h", "cmakelocatorfilter.cpp", "cmakelocatorfilter.h", "cmakeopenprojectwizard.cpp", diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp index 91e3b7a9102..bbe3a19c20e 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp @@ -36,11 +36,12 @@ #include "cmakeprojectconstants.h" #include "cmakelocatorfilter.h" #include "cmakefilecompletionassist.h" -#include "cmakehighlighterfactory.h" +#include "cmakehighlighter.h" #include #include #include +#include #include #include @@ -82,7 +83,13 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString * addAutoReleasedObject(new CMakeLocatorFilter); addAutoReleasedObject(new CMakeFileCompletionAssistProvider(cmp)); addAutoReleasedObject(new CMakeFeatureProvider); - addAutoReleasedObject(new CMakeHighlighterFactory); + + auto hf = new TextEditor::HighlighterFactory; + hf->setProductType(); + hf->setId(CMakeProjectManager::Constants::CMAKE_EDITOR_ID); + hf->addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE); + addAutoReleasedObject(hf); + return true; } diff --git a/src/plugins/coreplugin/coreplugin.pro b/src/plugins/coreplugin/coreplugin.pro index 0c6768909f4..7b23ff5211d 100644 --- a/src/plugins/coreplugin/coreplugin.pro +++ b/src/plugins/coreplugin/coreplugin.pro @@ -206,7 +206,6 @@ FORMS += dialogs/newdialog.ui \ dialogs/openwithdialog.ui \ generalsettings.ui \ dialogs/externaltoolconfig.ui \ - variablechooser.ui \ mimetypesettingspage.ui \ mimetypemagicdialog.ui \ removefiledialog.ui \ diff --git a/src/plugins/coreplugin/coreplugin.qbs b/src/plugins/coreplugin/coreplugin.qbs index aff6e3f2523..6406600478e 100644 --- a/src/plugins/coreplugin/coreplugin.qbs +++ b/src/plugins/coreplugin/coreplugin.qbs @@ -90,7 +90,7 @@ QtcPlugin { "tabpositionindicator.cpp", "tabpositionindicator.h", "textdocument.cpp", "textdocument.h", "toolsettings.cpp", "toolsettings.h", - "variablechooser.cpp", "variablechooser.h", "variablechooser.ui", + "variablechooser.cpp", "variablechooser.h", "variablemanager.cpp", "variablemanager.h", "vcsmanager.cpp", "vcsmanager.h", "versiondialog.cpp", "versiondialog.h", diff --git a/src/plugins/coreplugin/variablechooser.cpp b/src/plugins/coreplugin/variablechooser.cpp index 7955a5aa67f..12819f7e35e 100644 --- a/src/plugins/coreplugin/variablechooser.cpp +++ b/src/plugins/coreplugin/variablechooser.cpp @@ -28,20 +28,101 @@ ****************************************************************************/ #include "variablechooser.h" -#include "ui_variablechooser.h" #include "variablemanager.h" #include "coreconstants.h" #include // IconButton #include -#include +#include +#include #include -#include -#include +#include #include +#include +#include +#include +#include +#include -using namespace Core; +namespace Core { +namespace Internal { + +/*! + * \internal + */ +class VariableChooserPrivate : public QObject +{ + Q_OBJECT + +public: + VariableChooserPrivate(VariableChooser *parent) + : q(parent), + m_defaultDescription(tr("Select a variable to insert.")), + m_lineEdit(0), + m_textEdit(0), + m_plainTextEdit(0) + { + m_variableList = new QListWidget(q); + m_variableList->setAttribute(Qt::WA_MacSmallSize); + m_variableList->setAttribute(Qt::WA_MacShowFocusRect, false); + foreach (const QByteArray &variable, VariableManager::variables()) + m_variableList->addItem(QString::fromLatin1(variable)); + + m_variableDescription = new QLabel(q); + m_variableDescription->setText(m_defaultDescription); + m_variableDescription->setMinimumSize(QSize(0, 60)); + m_variableDescription->setAlignment(Qt::AlignLeft|Qt::AlignTop); + m_variableDescription->setWordWrap(true); + m_variableDescription->setAttribute(Qt::WA_MacSmallSize); + + QVBoxLayout *verticalLayout = new QVBoxLayout(q); + verticalLayout->setContentsMargins(3, 3, 3, 12); + verticalLayout->addWidget(m_variableList); + verticalLayout->addWidget(m_variableDescription); + + connect(m_variableList, SIGNAL(currentTextChanged(QString)), + this, SLOT(updateDescription(QString))); + connect(m_variableList, SIGNAL(itemActivated(QListWidgetItem*)), + this, SLOT(handleItemActivated(QListWidgetItem*))); + connect(qApp, SIGNAL(focusChanged(QWidget*,QWidget*)), + this, SLOT(updateCurrentEditor(QWidget*,QWidget*))); + updateCurrentEditor(0, qApp->focusWidget()); + } + + void createIconButton() + { + m_iconButton = new Utils::IconButton; + m_iconButton->setPixmap(QPixmap(QLatin1String(":/core/images/replace.png"))); + m_iconButton->setToolTip(tr("Insert variable")); + m_iconButton->hide(); + connect(m_iconButton, SIGNAL(clicked()), this, SLOT(updatePositionAndShow())); + } + +public slots: + void updateDescription(const QString &variable); + void updateCurrentEditor(QWidget *old, QWidget *widget); + void handleItemActivated(QListWidgetItem *item); + void insertVariable(const QString &variable); + void updatePositionAndShow(); + +public: + QWidget *currentWidget(); + + VariableChooser *q; + QString m_defaultDescription; + QPointer m_lineEdit; + QPointer m_textEdit; + QPointer m_plainTextEdit; + QPointer m_iconButton; + + QListWidget *m_variableList; + QLabel *m_variableDescription; +}; + +} // namespace Internal + +using namespace Internal; /*! * \class Core::VariableChooser @@ -92,30 +173,12 @@ const char VariableChooser::kVariableSupportProperty[] = "QtCreator.VariableSupp */ VariableChooser::VariableChooser(QWidget *parent) : QWidget(parent), - ui(new Internal::Ui::VariableChooser), - m_lineEdit(0), - m_textEdit(0), - m_plainTextEdit(0) + d(new VariableChooserPrivate(this)) { - ui->setupUi(this); - m_defaultDescription = ui->variableDescription->text(); - ui->variableList->setAttribute(Qt::WA_MacSmallSize); - ui->variableList->setAttribute(Qt::WA_MacShowFocusRect, false); - ui->variableDescription->setAttribute(Qt::WA_MacSmallSize); + setWindowTitle(tr("Variables")); setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint); setFocusPolicy(Qt::StrongFocus); - setFocusProxy(ui->variableList); - - foreach (const QByteArray &variable, VariableManager::variables()) - ui->variableList->addItem(QString::fromLatin1(variable)); - - connect(ui->variableList, SIGNAL(currentTextChanged(QString)), - this, SLOT(updateDescription(QString))); - connect(ui->variableList, SIGNAL(itemActivated(QListWidgetItem*)), - this, SLOT(handleItemActivated(QListWidgetItem*))); - connect(qApp, SIGNAL(focusChanged(QWidget*,QWidget*)), - this, SLOT(updateCurrentEditor(QWidget*,QWidget*))); - updateCurrentEditor(0, qApp->focusWidget()); + setFocusProxy(d->m_variableList); } /*! @@ -123,8 +186,8 @@ VariableChooser::VariableChooser(QWidget *parent) : */ VariableChooser::~VariableChooser() { - delete m_iconButton; - delete ui; + delete d->m_iconButton; + delete d; } /*! @@ -140,19 +203,19 @@ void VariableChooser::addVariableSupport(QWidget *textcontrol) /*! * \internal */ -void VariableChooser::updateDescription(const QString &variable) +void VariableChooserPrivate::updateDescription(const QString &variable) { if (variable.isNull()) - ui->variableDescription->setText(m_defaultDescription); + m_variableDescription->setText(m_defaultDescription); else - ui->variableDescription->setText(VariableManager::variableDescription(variable.toUtf8()) + m_variableDescription->setText(VariableManager::variableDescription(variable.toUtf8()) + QLatin1String("

") + tr("Current Value: %1").arg(VariableManager::value(variable.toUtf8()))); } /*! * \internal */ -void VariableChooser::updateCurrentEditor(QWidget *old, QWidget *widget) +void VariableChooserPrivate::updateCurrentEditor(QWidget *old, QWidget *widget) { if (old) old->removeEventFilter(this); @@ -162,9 +225,9 @@ void VariableChooser::updateCurrentEditor(QWidget *old, QWidget *widget) bool handle = false; QWidget *parent = widget; while (parent) { - if (parent == this) + if (parent == q) return; - if (parent == this->parentWidget()) { + if (parent == q->parentWidget()) { handle = true; break; } @@ -178,7 +241,7 @@ void VariableChooser::updateCurrentEditor(QWidget *old, QWidget *widget) m_lineEdit = 0; m_textEdit = 0; m_plainTextEdit = 0; - QVariant variablesSupportProperty = widget->property(kVariableSupportProperty); + QVariant variablesSupportProperty = widget->property(VariableChooser::kVariableSupportProperty); bool supportsVariables = (variablesSupportProperty.isValid() ? variablesSupportProperty.toBool() : false); if (QLineEdit *lineEdit = qobject_cast(widget)) @@ -188,7 +251,7 @@ void VariableChooser::updateCurrentEditor(QWidget *old, QWidget *widget) else if (QPlainTextEdit *plainTextEdit = qobject_cast(widget)) m_plainTextEdit = (supportsVariables ? plainTextEdit : 0); if (!(m_lineEdit || m_textEdit || m_plainTextEdit)) - hide(); + q->hide(); QWidget *current = currentWidget(); if (current != previousWidget) { @@ -202,7 +265,7 @@ void VariableChooser::updateCurrentEditor(QWidget *old, QWidget *widget) if (!m_iconButton) createIconButton(); int margin = m_iconButton->pixmap().width() + 8; - if (style()->inherits("OxygenStyle")) + if (q->style()->inherits("OxygenStyle")) margin = qMax(24, margin); if (m_lineEdit) m_lineEdit->setTextMargins(0, 0, margin, 0); @@ -215,36 +278,25 @@ void VariableChooser::updateCurrentEditor(QWidget *old, QWidget *widget) } } -/*! - * \internal - */ -void VariableChooser::createIconButton() -{ - m_iconButton = new Utils::IconButton; - m_iconButton->setPixmap(QPixmap(QLatin1String(":/core/images/replace.png"))); - m_iconButton->setToolTip(tr("Insert variable")); - m_iconButton->hide(); - connect(m_iconButton, SIGNAL(clicked()), this, SLOT(updatePositionAndShow())); -} /*! * \internal */ -void VariableChooser::updatePositionAndShow() +void VariableChooserPrivate::updatePositionAndShow() { - if (parentWidget()) { - QPoint parentCenter = parentWidget()->mapToGlobal(parentWidget()->geometry().center()); - move(parentCenter.x() - width()/2, parentCenter.y() - height()/2); + if (QWidget *w = q->parentWidget()) { + QPoint parentCenter = w->mapToGlobal(w->geometry().center()); + q->move(parentCenter.x() - q->width()/2, parentCenter.y() - q->height()/2); } - show(); - raise(); - activateWindow(); + q->show(); + q->raise(); + q->activateWindow(); } /*! * \internal */ -QWidget *VariableChooser::currentWidget() +QWidget *VariableChooserPrivate::currentWidget() { if (m_lineEdit) return m_lineEdit; @@ -256,7 +308,7 @@ QWidget *VariableChooser::currentWidget() /*! * \internal */ -void VariableChooser::handleItemActivated(QListWidgetItem *item) +void VariableChooserPrivate::handleItemActivated(QListWidgetItem *item) { if (item) insertVariable(item->text()); @@ -265,7 +317,7 @@ void VariableChooser::handleItemActivated(QListWidgetItem *item) /*! * \internal */ -void VariableChooser::insertVariable(const QString &variable) +void VariableChooserPrivate::insertVariable(const QString &variable) { const QString &text = QLatin1String("%{") + variable + QLatin1String("}"); if (m_lineEdit) { @@ -312,3 +364,7 @@ bool VariableChooser::eventFilter(QObject *, QEvent *event) } return false; } + +} // namespace Internal + +#include "variablechooser.moc" diff --git a/src/plugins/coreplugin/variablechooser.h b/src/plugins/coreplugin/variablechooser.h index d8f76d8a143..726b0779429 100644 --- a/src/plugins/coreplugin/variablechooser.h +++ b/src/plugins/coreplugin/variablechooser.h @@ -32,21 +32,11 @@ #include "core_global.h" -#include #include -QT_BEGIN_NAMESPACE -class QLineEdit; -class QTextEdit; -class QPlainTextEdit; -class QListWidgetItem; -QT_END_NAMESPACE - -namespace Utils { class IconButton; } - namespace Core { -namespace Internal { namespace Ui { class VariableChooser; } } +namespace Internal { class VariableChooserPrivate; } class CORE_EXPORT VariableChooser : public QWidget { @@ -63,23 +53,8 @@ protected: void keyPressEvent(QKeyEvent *ke); bool eventFilter(QObject *, QEvent *event); -private slots: - void updateDescription(const QString &variable); - void updateCurrentEditor(QWidget *old, QWidget *widget); - void handleItemActivated(QListWidgetItem *item); - void insertVariable(const QString &variable); - void updatePositionAndShow(); - private: - QWidget *currentWidget(); - void createIconButton(); - - Internal::Ui::VariableChooser *ui; - QString m_defaultDescription; - QPointer m_lineEdit; - QPointer m_textEdit; - QPointer m_plainTextEdit; - QPointer m_iconButton; + Internal::VariableChooserPrivate *d; }; } // namespace Core diff --git a/src/plugins/coreplugin/variablechooser.ui b/src/plugins/coreplugin/variablechooser.ui deleted file mode 100644 index d7aaf5e1971..00000000000 --- a/src/plugins/coreplugin/variablechooser.ui +++ /dev/null @@ -1,55 +0,0 @@ - - - Core::Internal::VariableChooser - - - - 0 - 0 - 218 - 321 - - - - Variables - - - - 3 - - - 3 - - - 3 - - - 12 - - - - - - - - - 0 - 60 - - - - Select a variable to insert. - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - - - - diff --git a/src/plugins/cppeditor/cppeditor.pro b/src/plugins/cppeditor/cppeditor.pro index f193965cff7..60879a983d5 100644 --- a/src/plugins/cppeditor/cppeditor.pro +++ b/src/plugins/cppeditor/cppeditor.pro @@ -19,7 +19,6 @@ HEADERS += \ cppfollowsymbolundercursor.h \ cppfunctiondecldeflink.h \ cpphighlighter.h \ - cpphighlighterfactory.h \ cpphoverhandler.h \ cppincludehierarchy.h \ cppincludehierarchyitem.h \ @@ -52,7 +51,6 @@ SOURCES += \ cppfollowsymbolundercursor.cpp \ cppfunctiondecldeflink.cpp \ cpphighlighter.cpp \ - cpphighlighterfactory.cpp \ cpphoverhandler.cpp \ cppincludehierarchy.cpp \ cppincludehierarchyitem.cpp \ diff --git a/src/plugins/cppeditor/cppeditor.qbs b/src/plugins/cppeditor/cppeditor.qbs index 73dd841d4f0..75d62cf271a 100644 --- a/src/plugins/cppeditor/cppeditor.qbs +++ b/src/plugins/cppeditor/cppeditor.qbs @@ -37,7 +37,6 @@ QtcPlugin { "cppfollowsymbolundercursor.cpp", "cppfollowsymbolundercursor.h", "cppfunctiondecldeflink.cpp", "cppfunctiondecldeflink.h", "cpphighlighter.cpp", "cpphighlighter.h", - "cpphighlighterfactory.cpp", "cpphighlighterfactory.h", "cpphoverhandler.cpp", "cpphoverhandler.h", "cppincludehierarchy.cpp", "cppincludehierarchy.h", "cppincludehierarchyitem.cpp", "cppincludehierarchyitem.h", diff --git a/src/plugins/cppeditor/cppeditorplugin.cpp b/src/plugins/cppeditor/cppeditorplugin.cpp index cd0b053fa33..3cd16607be5 100644 --- a/src/plugins/cppeditor/cppeditorplugin.cpp +++ b/src/plugins/cppeditor/cppeditorplugin.cpp @@ -35,7 +35,7 @@ #include "cppeditor.h" #include "cppeditoroutline.h" #include "cppfilewizard.h" -#include "cpphighlighterfactory.h" +#include "cpphighlighter.h" #include "cpphoverhandler.h" #include "cppincludehierarchy.h" #include "cppoutline.h" @@ -55,6 +55,7 @@ #include #include #include +#include #include @@ -165,7 +166,15 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err addAutoReleasedObject(new CppTypeHierarchyFactory); addAutoReleasedObject(new CppIncludeHierarchyFactory); addAutoReleasedObject(new CppSnippetProvider); - addAutoReleasedObject(new CppHighlighterFactory); + + auto hf = new TextEditor::HighlighterFactory; + hf->setProductType(); + hf->setId(CppEditor::Constants::CPPEDITOR_ID); + hf->addMimeType(CppEditor::Constants::C_SOURCE_MIMETYPE); + hf->addMimeType(CppEditor::Constants::C_HEADER_MIMETYPE); + hf->addMimeType(CppEditor::Constants::CPP_SOURCE_MIMETYPE); + hf->addMimeType(CppEditor::Constants::CPP_HEADER_MIMETYPE); + addAutoReleasedObject(hf); m_quickFixProvider = new CppQuickFixAssistProvider; addAutoReleasedObject(m_quickFixProvider); diff --git a/src/plugins/cppeditor/cpphighlighterfactory.cpp b/src/plugins/cppeditor/cpphighlighterfactory.cpp deleted file mode 100644 index d4abb8cedc4..00000000000 --- a/src/plugins/cppeditor/cpphighlighterfactory.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** 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 "cpphighlighterfactory.h" -#include "cppeditorconstants.h" -#include "cpphighlighter.h" - -using namespace CppEditor::Internal; - -CppHighlighterFactory::CppHighlighterFactory() -{ - setId(CppEditor::Constants::CPPEDITOR_ID); - addMimeType(CppEditor::Constants::C_SOURCE_MIMETYPE); - addMimeType(CppEditor::Constants::C_HEADER_MIMETYPE); - addMimeType(CppEditor::Constants::CPP_SOURCE_MIMETYPE); - addMimeType(CppEditor::Constants::CPP_HEADER_MIMETYPE); -} - -TextEditor::SyntaxHighlighter *CppHighlighterFactory::createHighlighter() const -{ - return new CppHighlighter; -} diff --git a/src/plugins/cppeditor/cpphighlighterfactory.h b/src/plugins/cppeditor/cpphighlighterfactory.h deleted file mode 100644 index bf73d2aa14f..00000000000 --- a/src/plugins/cppeditor/cpphighlighterfactory.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** 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. -** -****************************************************************************/ - -#ifndef CPPHIGHLIGHTERFACTORY_H -#define CPPHIGHLIGHTERFACTORY_H - -#include - -namespace CppEditor { -namespace Internal { - -class CppHighlighterFactory : public TextEditor::IHighlighterFactory -{ - Q_OBJECT - -public: - CppHighlighterFactory(); - - virtual TextEditor::SyntaxHighlighter *createHighlighter() const; -}; - -} // namespace Internal -} // namespace CppEditor - -#endif // CPPHIGHLIGHTERFACTORY_H diff --git a/src/plugins/cppeditor/cppoutline.cpp b/src/plugins/cppeditor/cppoutline.cpp index 31c6cdee697..145d9606cf9 100644 --- a/src/plugins/cppeditor/cppoutline.cpp +++ b/src/plugins/cppeditor/cppoutline.cpp @@ -113,10 +113,8 @@ CppOutlineWidget::CppOutlineWidget(CPPEditorWidget *editor) : connect(m_editor->outline(), SIGNAL(modelIndexChanged(QModelIndex)), this, SLOT(updateSelectionInTree(QModelIndex))); - connect(m_treeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(updateSelectionInText(QItemSelection))); connect(m_treeView, SIGNAL(activated(QModelIndex)), - this, SLOT(focusEditor())); + this, SLOT(onItemActivated(QModelIndex))); } QList CppOutlineWidget::filterMenuActions() const @@ -152,17 +150,6 @@ void CppOutlineWidget::updateSelectionInTree(const QModelIndex &index) m_blockCursorSync = false; } -void CppOutlineWidget::updateSelectionInText(const QItemSelection &selection) -{ - if (!syncCursor()) - return; - - if (!selection.indexes().isEmpty()) { - QModelIndex proxyIndex = selection.indexes().first(); - updateTextCursor(proxyIndex); - } -} - void CppOutlineWidget::updateTextCursor(const QModelIndex &proxyIndex) { QModelIndex index = m_proxyModel->mapToSource(proxyIndex); @@ -182,8 +169,12 @@ void CppOutlineWidget::updateTextCursor(const QModelIndex &proxyIndex) } } -void CppOutlineWidget::focusEditor() +void CppOutlineWidget::onItemActivated(const QModelIndex &index) { + if (!index.isValid()) + return; + + updateTextCursor(index); m_editor->setFocus(); } diff --git a/src/plugins/cppeditor/cppoutline.h b/src/plugins/cppeditor/cppoutline.h index 12ca590c142..291f0a59cb7 100644 --- a/src/plugins/cppeditor/cppoutline.h +++ b/src/plugins/cppeditor/cppoutline.h @@ -77,9 +77,8 @@ public: private slots: void modelUpdated(); void updateSelectionInTree(const QModelIndex &index); - void updateSelectionInText(const QItemSelection &selection); void updateTextCursor(const QModelIndex &index); - void focusEditor(); + void onItemActivated(const QModelIndex &index); private: bool syncCursor(); diff --git a/src/plugins/cpptools/cppsourceprocessor.h b/src/plugins/cpptools/cppsourceprocessor.h index b5db3b7f493..2b8aed6acb2 100644 --- a/src/plugins/cpptools/cppsourceprocessor.h +++ b/src/plugins/cpptools/cppsourceprocessor.h @@ -5,7 +5,6 @@ #include #include -#include #include #include @@ -13,6 +12,8 @@ #include #include +#include + QT_BEGIN_NAMESPACE class QTextCodec; QT_END_NAMESPACE diff --git a/src/plugins/cpptools/indexitem.h b/src/plugins/cpptools/indexitem.h index 40b9782e8c0..78f15aa9602 100644 --- a/src/plugins/cpptools/indexitem.h +++ b/src/plugins/cpptools/indexitem.h @@ -32,8 +32,6 @@ #include "cpptools_global.h" -#include - #include #include #include diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index 976453e5d27..4fbbecb1ba6 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -360,7 +360,7 @@ DebuggerSettings::DebuggerSettings() insertItem(LoadGdbInit, item); item = new SavedAction(this); - item->setSettingsKey(debugModeGroup, QLatin1String("LoadGdbDumpers")); + item->setSettingsKey(debugModeGroup, QLatin1String("LoadGdbDumpers1")); item->setDefaultValue(QString()); item->setCheckable(true); item->setDefaultValue(true); diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 59c018f2796..378461135f9 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -531,20 +531,13 @@ public: /////////////////////////////////////////////////////////////////////// static QWidget *addSearch(BaseTreeView *treeView, const QString &title, - const char *objectName, bool adjustColumns = false) + const char *objectName) { QAction *act = debuggerCore()->action(UseAlternatingRowColors); treeView->setAlternatingRowColors(act->isChecked()); QObject::connect(act, SIGNAL(toggled(bool)), treeView, SLOT(setAlternatingRowColorsHelper(bool))); - if (adjustColumns) { - act = debuggerCore()->action(AlwaysAdjustColumnWidths); - treeView->setAlwaysAdjustColumns(act->isChecked()); - QObject::connect(act, SIGNAL(toggled(bool)), - treeView, SLOT(setAlwaysAdjustColumns(bool))); - } - QWidget *widget = TreeViewFind::createSearchableWrapper(treeView); widget->setObjectName(QLatin1String(objectName)); widget->setWindowTitle(title); @@ -2815,16 +2808,16 @@ void DebuggerPluginPrivate::extensionsInitialized() m_threadsWindow = addSearch(m_threadsView, tr("Threads"), DOCKWIDGET_THREADS); m_returnView = new WatchTreeView(ReturnType); - m_returnWindow = addSearch(m_returnView, tr("Locals and Expressions"), "CppDebugReturn", true); + m_returnWindow = addSearch(m_returnView, tr("Locals and Expressions"), "CppDebugReturn"); m_localsView = new WatchTreeView(LocalsType); - m_localsWindow = addSearch(m_localsView, tr("Locals and Expressions"), "CppDebugLocals", true); + m_localsWindow = addSearch(m_localsView, tr("Locals and Expressions"), "CppDebugLocals"); m_watchersView = new WatchTreeView(WatchersType); - m_watchersWindow = addSearch(m_watchersView, tr("Locals and Expressions"), "CppDebugWatchers", true); + m_watchersWindow = addSearch(m_watchersView, tr("Locals and Expressions"), "CppDebugWatchers"); m_inspectorView = new WatchTreeView(InspectType); - m_inspectorWindow = addSearch(m_inspectorView, tr("Locals and Expressions"), "Inspector", true); + m_inspectorWindow = addSearch(m_inspectorView, tr("Locals and Expressions"), "Inspector"); // Snapshot m_snapshotHandler = new SnapshotHandler; diff --git a/src/plugins/debugger/memoryview.cpp b/src/plugins/debugger/memoryview.cpp index b3e86152f2b..42231ea1c91 100644 --- a/src/plugins/debugger/memoryview.cpp +++ b/src/plugins/debugger/memoryview.cpp @@ -53,7 +53,7 @@ namespace Internal { */ MemoryView::MemoryView(QWidget *binEditor, QWidget *parent) : - QWidget(parent, Qt::Tool|Qt::WindowStaysOnTopHint), m_binEditor(binEditor) + QWidget(parent, Qt::Tool), m_binEditor(binEditor) { setAttribute(Qt::WA_DeleteOnClose); QVBoxLayout *layout = new QVBoxLayout(this); diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index ec1e6623c6f..754e09b67b5 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -242,6 +242,7 @@ public: signals: void currentIndexRequested(const QModelIndex &idx); void itemIsExpanded(const QModelIndex &idx); + void columnAdjustmentRequested(); private: QVariant data(const QModelIndex &idx, int role) const; @@ -1248,6 +1249,7 @@ bool WatchModel::setData(const QModelIndex &idx, const QVariant &value, int role } else { m_expandedINames.remove(data.iname); } + emit columnAdjustmentRequested(); break; case LocalsTypeFormatRole: @@ -1566,6 +1568,7 @@ void WatchModel::insertBulkData(const QList &list) insertDataItem(list.at(i), false); #endif CHECK(checkTree()); + emit columnAdjustmentRequested(); } static void debugRecursion(QDebug &d, const WatchItem *item, int depth) diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index d6fe5511992..2f887680f87 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -754,6 +754,8 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev) QAction actSetWatchpointAtObjectAddress(0); QAction actSetWatchpointAtPointerAddress(0); + actSetWatchpointAtPointerAddress.setText(tr("Add Data Breakpoint at Pointer's Address")); + actSetWatchpointAtPointerAddress.setEnabled(false); const bool canSetWatchpoint = engine->hasCapability(WatchpointByAddressCapability); if (canSetWatchpoint && address) { actSetWatchpointAtObjectAddress @@ -764,9 +766,9 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev) actSetWatchpointAtPointerAddress .setText(tr("Add Data Breakpoint at Pointer's Address (0x%1)") .arg(pointerAddress, 0, 16)); - actSetWatchpointAtPointerAddress.setCheckable(true); actSetWatchpointAtPointerAddress .setChecked(mi0.data(LocalsIsWatchpointAtPointerAddressRole).toBool()); + actSetWatchpointAtPointerAddress.setEnabled(true); } } else { actSetWatchpointAtObjectAddress.setText(tr("Add Data Breakpoint")); @@ -873,8 +875,7 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev) QMenu breakpointMenu; breakpointMenu.setTitle(tr("Add Data Breakpoint...")); breakpointMenu.addAction(&actSetWatchpointAtObjectAddress); - if (canSetWatchpoint && address) - breakpointMenu.addAction(&actSetWatchpointAtPointerAddress); + breakpointMenu.addAction(&actSetWatchpointAtPointerAddress); breakpointMenu.addAction(&actSetWatchpointAtExpression); QAction actCopy(tr("Copy View Contents to Clipboard"), 0); diff --git a/src/plugins/designer/formeditorw.cpp b/src/plugins/designer/formeditorw.cpp index 22abee56052..80361c55d98 100644 --- a/src/plugins/designer/formeditorw.cpp +++ b/src/plugins/designer/formeditorw.cpp @@ -262,7 +262,7 @@ void FormEditorW::fullInit() m_formeditor->setIntegration(m_integration); // Connect Qt Designer help request to HelpManager. connect(m_integration, SIGNAL(creatorHelpRequested(QUrl)), - HelpManager::instance(), SIGNAL(helpRequested(QUrl))); + HelpManager::instance(), SLOT(handleHelpRequest(QUrl))); /** * This will initialize our TabOrder, Signals and slots and Buddy editors. diff --git a/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp b/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp index 357eac2fe2f..7ff3037a602 100644 --- a/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp +++ b/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp @@ -46,7 +46,7 @@ #include #include -#include +#include #include #include #include @@ -64,8 +64,8 @@ #include #include -static const int FILE_LEVEL = 1; -static const int CHUNK_LEVEL = 2; +//static const int FILE_LEVEL = 1; +//static const int CHUNK_LEVEL = 2; using namespace Core; using namespace TextEditor; @@ -110,7 +110,7 @@ protected: private: SideDiffEditorWidget *m_editor; - QMap m_mimeTypeToHighlighterFactory; + QMap m_mimeTypeToHighlighterFactory; QList m_highlighters; QList m_documents; }; @@ -235,9 +235,9 @@ MultiHighlighter::MultiHighlighter(SideDiffEditorWidget *editor, QTextDocument * : SyntaxHighlighter(document), m_editor(editor) { - const QList &factories = - ExtensionSystem::PluginManager::getObjects(); - foreach (IHighlighterFactory *factory, factories) { + const QList &factories = + ExtensionSystem::PluginManager::getObjects(); + foreach (HighlighterFactory *factory, factories) { QStringList mimeTypes = factory->mimeTypes(); foreach (const QString &mimeType, mimeTypes) m_mimeTypeToHighlighterFactory.insert(mimeType, factory); @@ -274,7 +274,7 @@ void MultiHighlighter::setDocuments(const QList > & QTextDocument *document = new QTextDocument(contents); const MimeType mimeType = MimeDatabase::findByFile(QFileInfo(fileInfo.fileName)); SyntaxHighlighter *highlighter = 0; - if (const IHighlighterFactory *factory = m_mimeTypeToHighlighterFactory.value(mimeType.type())) { + if (const HighlighterFactory *factory = m_mimeTypeToHighlighterFactory.value(mimeType.type())) { highlighter = factory->createHighlighter(); if (highlighter) highlighter->setDocument(document); diff --git a/src/plugins/diffeditor/unifieddiffeditorwidget.cpp b/src/plugins/diffeditor/unifieddiffeditorwidget.cpp index ec887c6d727..def29363082 100644 --- a/src/plugins/diffeditor/unifieddiffeditorwidget.cpp +++ b/src/plugins/diffeditor/unifieddiffeditorwidget.cpp @@ -45,7 +45,7 @@ #include #include -#include +#include #include #include #include @@ -63,8 +63,8 @@ #include #include -static const int FILE_LEVEL = 1; -static const int CHUNK_LEVEL = 2; +//static const int FILE_LEVEL = 1; +//static const int CHUNK_LEVEL = 2; using namespace Core; using namespace TextEditor; diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 43601b187ce..699e1325b8d 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -369,11 +369,8 @@ GitDiffEditorReloader::GitDiffEditorReloader(QObject *parent) void GitDiffEditorReloader::reload() { - const QString workingDirectory = m_diffType == DiffShow - ? m_gitClient->findRepositoryForDirectory(m_workingDirectory) - : m_workingDirectory; GitDiffHandler *handler = new GitDiffHandler(diffEditorController(), - workingDirectory); + m_workingDirectory); connect(handler, SIGNAL(destroyed()), this, SLOT(reloadFinished())); switch (m_diffType) { diff --git a/src/plugins/glsleditor/glsleditor.pro b/src/plugins/glsleditor/glsleditor.pro index e7f5375a74a..ad353b0b462 100644 --- a/src/plugins/glsleditor/glsleditor.pro +++ b/src/plugins/glsleditor/glsleditor.pro @@ -11,7 +11,6 @@ glsleditorfactory.h \ glsleditorplugin.h \ glslfilewizard.h \ glslhighlighter.h \ -glslhighlighterfactory.h \ glslautocompleter.h \ glslindenter.h \ glslhoverhandler.h \ @@ -25,7 +24,6 @@ glsleditorfactory.cpp \ glsleditorplugin.cpp \ glslfilewizard.cpp \ glslhighlighter.cpp \ -glslhighlighterfactory.cpp \ glslautocompleter.cpp \ glslindenter.cpp \ glslhoverhandler.cpp \ diff --git a/src/plugins/glsleditor/glsleditor.qbs b/src/plugins/glsleditor/glsleditor.qbs index 7bdb7069246..79f0dd0a6af 100644 --- a/src/plugins/glsleditor/glsleditor.qbs +++ b/src/plugins/glsleditor/glsleditor.qbs @@ -34,8 +34,6 @@ QtcPlugin { "glslfilewizard.h", "glslhighlighter.cpp", "glslhighlighter.h", - "glslhighlighterfactory.cpp", - "glslhighlighterfactory.h", "glslhoverhandler.cpp", "glslhoverhandler.h", "glslindenter.cpp", diff --git a/src/plugins/glsleditor/glsleditorfactory.cpp b/src/plugins/glsleditor/glsleditorfactory.cpp index 502d2dd3ef8..47283799e82 100644 --- a/src/plugins/glsleditor/glsleditorfactory.cpp +++ b/src/plugins/glsleditor/glsleditorfactory.cpp @@ -69,7 +69,3 @@ Core::IEditor *GLSLEditorFactory::createEditor() TextEditor::TextEditorSettings::initializeEditor(rc); return rc->editor(); } - -void GLSLEditorFactory::updateEditorInfoBar(Core::IEditor *) -{ -} diff --git a/src/plugins/glsleditor/glsleditorfactory.h b/src/plugins/glsleditor/glsleditorfactory.h index 01a507b7486..698fa77bd1e 100644 --- a/src/plugins/glsleditor/glsleditorfactory.h +++ b/src/plugins/glsleditor/glsleditorfactory.h @@ -43,9 +43,6 @@ public: GLSLEditorFactory(QObject *parent); Core::IEditor *createEditor(); - -private slots: - void updateEditorInfoBar(Core::IEditor *editor); }; } // namespace Internal diff --git a/src/plugins/glsleditor/glsleditorplugin.cpp b/src/plugins/glsleditor/glsleditorplugin.cpp index 9b79c19ae19..a8ecc376591 100644 --- a/src/plugins/glsleditor/glsleditorplugin.cpp +++ b/src/plugins/glsleditor/glsleditorplugin.cpp @@ -34,7 +34,7 @@ #include "glslfilewizard.h" #include "glslhoverhandler.h" #include "glslcompletionassist.h" -#include "glslhighlighterfactory.h" +#include "glslhighlighter.h" #include #include @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -219,7 +220,15 @@ bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *er wizard->setId(QLatin1String("K.GLSL")); addAutoReleasedObject(wizard); - addAutoReleasedObject(new GLSLHighlighterFactory); + auto hf = new TextEditor::HighlighterFactory; + hf->setProductType(); + hf->setId(GLSLEditor::Constants::C_GLSLEDITOR_ID); + hf->addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE); + hf->addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_VERT); + hf->addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG); + hf->addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_VERT_ES); + hf->addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG_ES); + addAutoReleasedObject(hf); return true; } diff --git a/src/plugins/glsleditor/glslhighlighterfactory.cpp b/src/plugins/glsleditor/glslhighlighterfactory.cpp deleted file mode 100644 index 2ca6bb12c9d..00000000000 --- a/src/plugins/glsleditor/glslhighlighterfactory.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** 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 "glslhighlighterfactory.h" -#include "glsleditorconstants.h" -#include "glslhighlighter.h" - -using namespace GLSLEditor::Internal; - -GLSLHighlighterFactory::GLSLHighlighterFactory() -{ - setId(GLSLEditor::Constants::C_GLSLEDITOR_ID); - addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE); - addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_VERT); - addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG); - addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_VERT_ES); - addMimeType(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG_ES); -} - -TextEditor::SyntaxHighlighter *GLSLHighlighterFactory::createHighlighter() const -{ - return new Highlighter; -} diff --git a/src/plugins/glsleditor/glslhighlighterfactory.h b/src/plugins/glsleditor/glslhighlighterfactory.h deleted file mode 100644 index a5233e5f78b..00000000000 --- a/src/plugins/glsleditor/glslhighlighterfactory.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** 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. -** -****************************************************************************/ - -#ifndef GLSLHIGHLIGHTERFACTORY_H -#define GLSLHIGHLIGHTERFACTORY_H - -#include - -namespace GLSLEditor { -namespace Internal { - -class GLSLHighlighterFactory : public TextEditor::IHighlighterFactory -{ - Q_OBJECT - -public: - GLSLHighlighterFactory(); - - virtual TextEditor::SyntaxHighlighter *createHighlighter() const; -}; - -} // namespace Internal -} // namespace GLSLEditor - -#endif // GLSLHIGHLIGHTERFACTORY_H diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index c68c71d84ea..3857d69d8f4 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -466,7 +466,8 @@ void HelpPlugin::setupUi() m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Core::Constants::ICON_TOGGLE_SIDEBAR)), tr("Show Sidebar"), this); m_toggleSideBarAction->setCheckable(true); - connect(m_toggleSideBarAction, SIGNAL(triggered(bool)), this, SLOT(showHideSidebar())); + m_toggleSideBarAction->setChecked(m_isSidebarVisible); + connect(m_toggleSideBarAction, SIGNAL(triggered(bool)), this, SLOT(setSideBarVisible(bool))); cmd = ActionManager::registerAction(m_toggleSideBarAction, Core::Constants::TOGGLE_SIDEBAR, modecontext); } @@ -606,9 +607,11 @@ void HelpPlugin::slotHideRightPane() RightPaneWidget::instance()->setShown(false); } -void HelpPlugin::showHideSidebar() +void HelpPlugin::setSideBarVisible(bool visible) { - m_sideBar->setVisible(!m_sideBar->isVisible()); + if (visible == m_sideBar->isVisible()) + return; + m_sideBar->setVisible(visible); onSideBarVisibilityChanged(); } @@ -1004,6 +1007,7 @@ void HelpPlugin::slotReportBug() void HelpPlugin::onSideBarVisibilityChanged() { m_isSidebarVisible = m_sideBar->isVisible(); + m_toggleSideBarAction->setChecked(m_isSidebarVisible); m_toggleSideBarAction->setToolTip(m_isSidebarVisible ? tr("Hide Sidebar") : tr("Show Sidebar")); } diff --git a/src/plugins/help/helpplugin.h b/src/plugins/help/helpplugin.h index 1170e2733b9..856892e8e5e 100644 --- a/src/plugins/help/helpplugin.h +++ b/src/plugins/help/helpplugin.h @@ -103,7 +103,7 @@ private slots: void saveExternalWindowSettings(); void switchToHelpMode(const QUrl &source); void slotHideRightPane(); - void showHideSidebar(); + void setSideBarVisible(bool visible); void updateSideBarSource(); void updateSideBarSource(const QUrl &newUrl); diff --git a/src/plugins/pythoneditor/pythoneditor.pro b/src/plugins/pythoneditor/pythoneditor.pro index 9d87e03a12a..0e7e02672fd 100644 --- a/src/plugins/pythoneditor/pythoneditor.pro +++ b/src/plugins/pythoneditor/pythoneditor.pro @@ -18,7 +18,6 @@ HEADERS += \ wizard/pythonclasswizarddialog.h \ wizard/pythonsourcegenerator.h \ tools/pythonhighlighter.h \ - tools/pythonhighlighterfactory.h \ tools/pythonindenter.h \ tools/lexical/pythonformattoken.h \ tools/lexical/pythonscanner.h \ @@ -35,6 +34,5 @@ SOURCES += \ wizard/pythonclassnamepage.cpp \ wizard/pythonsourcegenerator.cpp \ tools/pythonhighlighter.cpp \ - tools/pythonhighlighterfactory.cpp \ tools/pythonindenter.cpp \ tools/lexical/pythonscanner.cpp diff --git a/src/plugins/pythoneditor/pythoneditor.qbs b/src/plugins/pythoneditor/pythoneditor.qbs index f7452298c59..b4fa33999ec 100644 --- a/src/plugins/pythoneditor/pythoneditor.qbs +++ b/src/plugins/pythoneditor/pythoneditor.qbs @@ -33,7 +33,6 @@ QtcPlugin { "lexical/pythonscanner.h", "lexical/pythonscanner.cpp", "lexical/sourcecodestream.h", "pythonhighlighter.h", "pythonhighlighter.cpp", - "pythonhighlighterfactory.h", "pythonhighlighterfactory.cpp", "pythonindenter.cpp", "pythonindenter.h" ] } diff --git a/src/plugins/pythoneditor/pythoneditorplugin.cpp b/src/plugins/pythoneditor/pythoneditorplugin.cpp index 4be66910696..3b1c3bccce2 100644 --- a/src/plugins/pythoneditor/pythoneditorplugin.cpp +++ b/src/plugins/pythoneditor/pythoneditorplugin.cpp @@ -33,7 +33,7 @@ #include "wizard/pythonclasswizard.h" #include "pythoneditorwidget.h" #include "pythoneditorfactory.h" -#include "tools/pythonhighlighterfactory.h" +#include "tools/pythonhighlighter.h" #include #include @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -229,7 +230,12 @@ bool PythonEditorPlugin::initialize(const QStringList &arguments, QString *error // Add Python files and classes creation dialogs addAutoReleasedObject(new FileWizard); addAutoReleasedObject(new ClassWizard); - addAutoReleasedObject(new Internal::PythonHighlighterFactory); + + auto hf = new TextEditor::HighlighterFactory; + hf->setId(Constants::C_PYTHONEDITOR_ID); + hf->setProductType(); + hf->addMimeType(QLatin1String(Constants::C_PY_MIMETYPE)); + addAutoReleasedObject(hf); return true; } diff --git a/src/plugins/pythoneditor/tools/pythonhighlighterfactory.cpp b/src/plugins/pythoneditor/tools/pythonhighlighterfactory.cpp deleted file mode 100644 index 8ed05e42797..00000000000 --- a/src/plugins/pythoneditor/tools/pythonhighlighterfactory.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** 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 "pythonhighlighterfactory.h" -#include "../pythoneditorconstants.h" -#include "pythonhighlighter.h" - -using namespace PythonEditor::Internal; - -PythonHighlighterFactory::PythonHighlighterFactory() -{ - setId(Constants::C_PYTHONEDITOR_ID); - addMimeType(QLatin1String(Constants::C_PY_MIMETYPE)); -} - -TextEditor::SyntaxHighlighter *PythonHighlighterFactory::createHighlighter() const -{ - return new PythonHighlighter; -} diff --git a/src/plugins/pythoneditor/tools/pythonhighlighterfactory.h b/src/plugins/pythoneditor/tools/pythonhighlighterfactory.h deleted file mode 100644 index 5b54b12375b..00000000000 --- a/src/plugins/pythoneditor/tools/pythonhighlighterfactory.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** 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. -** -****************************************************************************/ - -#ifndef PYTHONHIGHLIGHTERFACTORY_H -#define PYTHONHIGHLIGHTERFACTORY_H - -#include - -namespace PythonEditor { -namespace Internal { - -class PythonHighlighterFactory : public TextEditor::IHighlighterFactory -{ - Q_OBJECT - -public: - PythonHighlighterFactory(); - - virtual TextEditor::SyntaxHighlighter *createHighlighter() const; -}; - -} // namespace Internal -} // namespace PythonEditor - -#endif // PYTHONHIGHLIGHTERFACTORY_H diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.pro b/src/plugins/qbsprojectmanager/qbsprojectmanager.pro index 34975875501..406c85e15b0 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager.pro +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.pro @@ -6,7 +6,7 @@ isEmpty(QBS_INSTALL_DIR) { QBS_SOURCE_DIR = $$PWD/../../shared/qbs include($$QBS_SOURCE_DIR/src/lib/corelib/use_corelib.pri) include($$QBS_SOURCE_DIR/src/lib/qtprofilesetup/use_qtprofilesetup.pri) - macx:QMAKE_LFLAGS += -Wl,-rpath,@loader_path/../ # Mac: fix rpath for qbscore soname + macx:QMAKE_LFLAGS += -Wl,-rpath,@loader_path/ # Mac: fix rpath for qbscore soname } else { include($${QBS_INSTALL_DIR}/include/qbs/use_installed_corelib.pri) include($${QBS_INSTALL_DIR}/include/qbs/use_installed_qtprofilesetup.pri) diff --git a/src/plugins/qmakeprojectmanager/profilehighlighterfactory.cpp b/src/plugins/qmakeprojectmanager/profilehighlighterfactory.cpp deleted file mode 100644 index 904745a7f64..00000000000 --- a/src/plugins/qmakeprojectmanager/profilehighlighterfactory.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** 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 "profilehighlighterfactory.h" -#include "qmakeprojectmanagerconstants.h" -#include "profilehighlighter.h" - -using namespace QmakeProjectManager::Internal; - -ProFileHighlighterFactory::ProFileHighlighterFactory() -{ - setId(QmakeProjectManager::Constants::PROFILE_EDITOR_ID); - addMimeType(QmakeProjectManager::Constants::PROFILE_MIMETYPE); - addMimeType(QmakeProjectManager::Constants::PROINCLUDEFILE_MIMETYPE); - addMimeType(QmakeProjectManager::Constants::PROFEATUREFILE_MIMETYPE); -} - -TextEditor::SyntaxHighlighter *ProFileHighlighterFactory::createHighlighter() const -{ - return new ProFileHighlighter; -} diff --git a/src/plugins/qmakeprojectmanager/profilehighlighterfactory.h b/src/plugins/qmakeprojectmanager/profilehighlighterfactory.h deleted file mode 100644 index bfeafaa6b76..00000000000 --- a/src/plugins/qmakeprojectmanager/profilehighlighterfactory.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** 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. -** -****************************************************************************/ - -#ifndef PROFILEHIGHLIGHTERFACTORY_H -#define PROFILEHIGHLIGHTERFACTORY_H - -#include - -namespace QmakeProjectManager { -namespace Internal { - -class ProFileHighlighterFactory : public TextEditor::IHighlighterFactory -{ - Q_OBJECT - -public: - ProFileHighlighterFactory(); - - virtual TextEditor::SyntaxHighlighter *createHighlighter() const; -}; - -} // namespace Internal -} // namespace QmakeProjectManager - -#endif // PROFILEHIGHLIGHTERFACTORY_H diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro index c115379c673..7146c0f11b1 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro @@ -16,7 +16,6 @@ HEADERS += \ qmakenodes.h \ profileeditor.h \ profilehighlighter.h \ - profilehighlighterfactory.h \ profileeditorfactory.h \ profilehoverhandler.h \ wizards/qtprojectparameters.h \ @@ -68,7 +67,6 @@ SOURCES += \ qmakenodes.cpp \ profileeditor.cpp \ profilehighlighter.cpp \ - profilehighlighterfactory.cpp \ profileeditorfactory.cpp \ profilehoverhandler.cpp \ wizards/qtprojectparameters.cpp \ diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs index a6d4d6ce575..dc98d61df25 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs @@ -36,7 +36,6 @@ QtcPlugin { "profileeditor.cpp", "profileeditor.h", "profileeditorfactory.cpp", "profileeditorfactory.h", "profilehighlighter.cpp", "profilehighlighter.h", - "profilehighlighterfactory.cpp", "profilehighlighterfactory.h", "profilehoverhandler.cpp", "profilehoverhandler.h", "qmakebuildinfo.h", "qmakeparser.cpp", "qmakeparser.h", diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp index 0895a8d758e..83df8908f64 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp @@ -50,7 +50,7 @@ #include "externaleditors.h" #include "profilecompletionassist.h" #include "qmakekitinformation.h" -#include "profilehighlighterfactory.h" +#include "profilehighlighter.h" #include #include @@ -65,6 +65,7 @@ #include #include #include +#include #include #include @@ -142,7 +143,14 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString addAutoReleasedObject(new ProFileCompletionAssistProvider); addAutoReleasedObject(new ProFileHoverHandler(this)); - addAutoReleasedObject(new ProFileHighlighterFactory); + + auto hf = new TextEditor::HighlighterFactory; + hf->setProductType(); + hf->setId(QmakeProjectManager::Constants::PROFILE_EDITOR_ID); + hf->addMimeType(QmakeProjectManager::Constants::PROFILE_MIMETYPE); + hf->addMimeType(QmakeProjectManager::Constants::PROINCLUDEFILE_MIMETYPE); + hf->addMimeType(QmakeProjectManager::Constants::PROFEATUREFILE_MIMETYPE); + addAutoReleasedObject(hf); //menus Core::ActionContainer *mbuild = diff --git a/src/plugins/qmldesigner/components/componentcore/crumblebar.cpp b/src/plugins/qmldesigner/components/componentcore/crumblebar.cpp index c7aedaa00ed..e2cd34c802a 100644 --- a/src/plugins/qmldesigner/components/componentcore/crumblebar.cpp +++ b/src/plugins/qmldesigner/components/componentcore/crumblebar.cpp @@ -33,6 +33,8 @@ #include +#include + #include #include @@ -129,6 +131,27 @@ Utils::CrumblePath *CrumbleBar::crumblePath() return m_crumblePath; } +void CrumbleBar::showSaveDialog() +{ + DesignerSettings settings = QmlDesignerPlugin::instance()->settings(); + + if (settings.alwaysSaveInCrumbleBar) { + Core::DocumentManager::saveModifiedDocumentSilently(currentDesignDocument()->editor()->document()); + } else { + bool alwaysSave; + bool canceled; + + Core::DocumentManager::saveModifiedDocument(currentDesignDocument()->editor()->document(), + tr("Save the changes to preview them correctly."), + &canceled, + tr("Always save when leaving subcomponent"), + &alwaysSave); + + settings.alwaysSaveInCrumbleBar = alwaysSave; + QmlDesignerPlugin::instance()->setSettings(settings); + } +} + void CrumbleBar::onCrumblePathElementClicked(const QVariant &data) { CrumbleBarInfo clickedCrumbleBarInfo = data.value(); @@ -149,6 +172,7 @@ void CrumbleBar::onCrumblePathElementClicked(const QVariant &data) currentDesignDocument()->changeToDocumentModel(); QmlDesignerPlugin::instance()->viewManager().setComponentViewToMaster(); } else { + showSaveDialog(); crumblePath()->popElement(); nextFileIsCalledInternally(); Core::EditorManager::openEditor(clickedCrumbleBarInfo.fileName, Core::Id(), diff --git a/src/plugins/qmldesigner/components/componentcore/crumblebar.h b/src/plugins/qmldesigner/components/componentcore/crumblebar.h index a1e9986ac66..53fecf8b15f 100644 --- a/src/plugins/qmldesigner/components/componentcore/crumblebar.h +++ b/src/plugins/qmldesigner/components/componentcore/crumblebar.h @@ -54,6 +54,7 @@ private slots: private: void updateVisibility(); + void showSaveDialog(); private: bool m_isInternalCalled; diff --git a/src/plugins/qmldesigner/components/formeditor/dragtool.cpp b/src/plugins/qmldesigner/components/formeditor/dragtool.cpp index 16534e92ced..f2c4ce7de92 100644 --- a/src/plugins/qmldesigner/components/formeditor/dragtool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/dragtool.cpp @@ -315,11 +315,11 @@ void DragTool::dragLeaveEvent(QGraphicsSceneDragDropEvent * event) if (event->mimeData()->hasFormat("application/vnd.bauhaus.itemlibraryinfo") || event->mimeData()->hasFormat("application/vnd.bauhaus.libraryresource")) { event->accept(); - if (m_dragNode.isValid()) - m_dragNode.destroy(); m_moveManipulator.end(); clear(); + if (m_dragNode.isValid()) + m_dragNode.destroy(); commitTransaction(); diff --git a/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp b/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp index 6c142517976..5e075677b46 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.cpp @@ -91,7 +91,10 @@ QUrl FileResourcesModel::path() const void FileResourcesModel::setFilter(const QString &filter) { - m_filter = filter; + if (m_filter != filter) { + m_filter = filter; + setupModel(); + } } QString FileResourcesModel::filter() const @@ -173,4 +176,6 @@ void FileResourcesModel::setupModel() } m_lock = false; + + emit fileModelChanged(); } diff --git a/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.h b/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.h index 71d2c167005..798e0c3bfdd 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.h +++ b/src/plugins/qmldesigner/components/propertyeditor/fileresourcesmodel.h @@ -45,7 +45,7 @@ class FileResourcesModel : public QObject Q_PROPERTY(QString filter READ filter WRITE setFilter) Q_PROPERTY(QVariant modelNodeBackendProperty READ modelNodeBackend WRITE setModelNodeBackend NOTIFY modelNodeBackendChanged) Q_PROPERTY(QUrl path READ path WRITE setPath) - Q_PROPERTY(QStringList fileModel READ fileModel NOTIFY modelNodeBackendChanged) + Q_PROPERTY(QStringList fileModel READ fileModel NOTIFY fileModelChanged) public: explicit FileResourcesModel(QObject *parent = 0); @@ -68,6 +68,7 @@ public: signals: void fileNameChanged(const QUrl &fileName); void modelNodeBackendChanged(); + void fileModelChanged(); public slots: diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp index e041836113c..9fbe7ea5211 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp @@ -117,9 +117,20 @@ static void fixUrl(const QmlDesigner::ModelNode &modelNode, const QmlDesigner::P } } +static bool compareVariants(const QVariant &value1, const QVariant &value2) +/* The comparison of variants is not symmetric because of implicit conversion. + * QVariant(string) == QVariant(QColor) does for example ignore the alpha channel, + * because the color is converted to a string ignoring the alpha channel. + * By comparing the variants in both directions we gain a symmetric comparison. + */ +{ + return (value1 == value2) + && (value2 == value1); +} + void PropertyEditorValue::setValueWithEmit(const QVariant &value) { - if (m_value != value || isBound()) { + if (!compareVariants(value, m_value ) || isBound()) { QVariant newValue = value; if (modelNode().isValid() && modelNode().metaInfo().isValid() && modelNode().metaInfo().hasProperty(name())) if (modelNode().metaInfo().propertyTypeName(name()) == "QUrl") @@ -129,6 +140,7 @@ void PropertyEditorValue::setValueWithEmit(const QVariant &value) return; if (cleverColorCompare(newValue, m_value)) return; + setValue(newValue); m_isBound = false; emit valueChanged(name(), value); @@ -139,7 +151,7 @@ void PropertyEditorValue::setValueWithEmit(const QVariant &value) void PropertyEditorValue::setValue(const QVariant &value) { - if ((m_value != value) && + if (!compareVariants(m_value, value) && !cleverDoubleCompare(value, m_value) && !cleverColorCompare(value, m_value)) diff --git a/src/plugins/qmldesigner/componentsplugin/componentsplugin.cpp b/src/plugins/qmldesigner/componentsplugin/componentsplugin.cpp index 8bdb0c90478..9aee25f6e07 100644 --- a/src/plugins/qmldesigner/componentsplugin/componentsplugin.cpp +++ b/src/plugins/qmldesigner/componentsplugin/componentsplugin.cpp @@ -45,8 +45,6 @@ ComponentsPlugin::ComponentsPlugin() { TabViewIndexModel::registerDeclarativeType(); DesignerActionManager *actionManager = &QmlDesignerPlugin::instance()->viewManager().designerActionManager(); - actionManager->addDesignerAction(new AddTabDesignerAction); - actionManager->addDesignerAction(new EnterTabDesignerAction); } QString ComponentsPlugin::pluginName() const diff --git a/src/plugins/qmldesigner/componentsplugin/entertabdesigneraction.cpp b/src/plugins/qmldesigner/componentsplugin/entertabdesigneraction.cpp index fd3c689ea7d..6894e5df23f 100644 --- a/src/plugins/qmldesigner/componentsplugin/entertabdesigneraction.cpp +++ b/src/plugins/qmldesigner/componentsplugin/entertabdesigneraction.cpp @@ -56,7 +56,7 @@ public /*slots*/: }; EnterTabDesignerAction::EnterTabDesignerAction() - : AbstractActionGroup(QCoreApplication::translate("TabViewToolAction", "Edit Tab")) + : AbstractActionGroup(QCoreApplication::translate("TabViewToolAction", "Step into Tab")) { } @@ -126,7 +126,7 @@ void EnterTabDesignerAction::createActionForTab(const ModelNode &modelNode) QmlDesigner::QmlItemNode itemNode(modelNode); if (itemNode.isValid()) { - QString what = QString(QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Edit: %1")). + QString what = QString(QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Step into: %1")). arg(itemNode.instanceValue("title").toString()); EnterTabAction *selectionAction = new EnterTabAction(what); diff --git a/src/plugins/qmldesigner/designercore/exceptions/exception.cpp b/src/plugins/qmldesigner/designercore/exceptions/exception.cpp index 2bbdab38423..07fabc3220b 100644 --- a/src/plugins/qmldesigner/designercore/exceptions/exception.cpp +++ b/src/plugins/qmldesigner/designercore/exceptions/exception.cpp @@ -34,18 +34,10 @@ #include #endif -#include - #include #include -static void showAsyncWarning(const QString &title, const QString &desciption) -{ - QMessageBox *messageBox = new QMessageBox(QMessageBox::Warning, title, desciption, QMessageBox::Ok, Core::ICore::dialogParent()); - messageBox->setAttribute(Qt::WA_DeleteOnClose); - messageBox->setModal(true); - messageBox->show(); -} +#include /*! \defgroup CoreExceptions @@ -163,7 +155,7 @@ QString Exception::description() const void Exception::showException(const QString &title) const { QString composedTitle = title.isEmpty() ? QCoreApplication::translate("QmlDesigner", "Error") : title; - showAsyncWarning(composedTitle, description()); + QmlDesignerWarning::show(composedTitle, description()); } /*! diff --git a/src/plugins/qmldesigner/designercore/include/itemlibraryinfo.h b/src/plugins/qmldesigner/designercore/include/itemlibraryinfo.h index 09461b41089..34666b6b56a 100644 --- a/src/plugins/qmldesigner/designercore/include/itemlibraryinfo.h +++ b/src/plugins/qmldesigner/designercore/include/itemlibraryinfo.h @@ -34,7 +34,6 @@ #include "propertycontainer.h" #include -#include namespace QmlDesigner { diff --git a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp index 635d75ab154..475032cba51 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp +++ b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -42,10 +43,11 @@ #include #include #include +#include +#include #include "puppetbuildprogressdialog.h" -#include namespace QmlDesigner { @@ -130,6 +132,11 @@ QProcess *PuppetCreator::puppetProcess(const QString &puppetPath, } puppetProcess->start(puppetPath, QStringList() << socketToken << puppetMode << "-graphicssystem raster"); + if (!qgetenv("DEBUG_QML_PUPPET").isEmpty()) + QMessageBox::information(Core::ICore::dialogParent(), + QStringLiteral("Puppet is starting ..."), + QStringLiteral("You can now attach your debugger to the puppet.")); + return puppetProcess; } @@ -160,9 +167,22 @@ bool PuppetCreator::build(const QString &qmlPuppetProjectFilePath) const buildSucceeded = startBuildProcess(buildDirectory.path(), buildCommand(), QStringList(), &progressDialog); progressDialog.hide(); } - } else { - buildSucceeded = true; + + if (!buildSucceeded) + QmlDesignerWarning::show(QCoreApplication::translate("PuppetCreator", "Emulation layer building was unsuccessful"), + QCoreApplication::translate("PuppetCreator", + "The emulation layer(Qml Puppet) cannot was built. " + "So now the fallback version will be used " + "which is not supporting all features." + )); } + } else { + QmlDesignerWarning::show(QCoreApplication::translate("PuppetCreator", "Qt Version is not supported"), + QCoreApplication::translate("PuppetCreator", + "The emulation layer(Qml Puppet) cannot be built because the Qt version is to old " + "or it can not run native on your computer. So now the fallback version will be used " + "which is not supporting all features." + )); } return buildSucceeded; @@ -302,7 +322,7 @@ bool PuppetCreator::startBuildProcess(const QString &buildDirectoryPath, process.waitForFinished(); - if (process.exitStatus() == QProcess::NormalExit || process.exitCode() == 0) + if (process.exitStatus() == QProcess::NormalExit && process.exitCode() == 0) return true; else return false; diff --git a/src/plugins/qmldesigner/designersettings.cpp b/src/plugins/qmldesigner/designersettings.cpp index 8efe36daa91..94d30aca6f1 100644 --- a/src/plugins/qmldesigner/designersettings.cpp +++ b/src/plugins/qmldesigner/designersettings.cpp @@ -42,7 +42,8 @@ DesignerSettings::DesignerSettings() warningsInDesigner(true), designerWarningsInEditor(false), showDebugView(false), - enableDebugView(false) + enableDebugView(false), + alwaysSaveInCrumbleBar(false) {} void DesignerSettings::fromSettings(QSettings *settings) @@ -63,6 +64,8 @@ void DesignerSettings::fromSettings(QSettings *settings) QLatin1String(QmlDesigner::Constants::QML_SHOW_DEBUGVIEW), QVariant(false)).toBool(); enableDebugView = settings->value( QLatin1String(QmlDesigner::Constants::QML_ENABLE_DEBUGVIEW), QVariant(false)).toBool(); + alwaysSaveInCrumbleBar = settings->value( + QLatin1String(QmlDesigner::Constants::QML_ALWAYS_SAFE_IN_CRUMBLEBAR), QVariant(false)).toBool(); settings->endGroup(); settings->endGroup(); @@ -80,6 +83,7 @@ void DesignerSettings::toSettings(QSettings *settings) const settings->setValue(QLatin1String(QmlDesigner::Constants::QML_WARNIN_FOR_DESIGNER_FEATURES_IN_EDITOR_KEY), designerWarningsInEditor); settings->setValue(QLatin1String(QmlDesigner::Constants::QML_SHOW_DEBUGVIEW), showDebugView); settings->setValue(QLatin1String(QmlDesigner::Constants::QML_ENABLE_DEBUGVIEW), enableDebugView); + settings->setValue(QLatin1String(QmlDesigner::Constants::QML_ALWAYS_SAFE_IN_CRUMBLEBAR), alwaysSaveInCrumbleBar); settings->endGroup(); settings->endGroup(); @@ -93,5 +97,6 @@ bool DesignerSettings::equals(const DesignerSettings &other) const && warningsInDesigner == other.warningsInDesigner && designerWarningsInEditor == other.designerWarningsInEditor && showDebugView == other.showDebugView - && enableDebugView == other.enableDebugView; + && enableDebugView == other.enableDebugView + && alwaysSaveInCrumbleBar == other.alwaysSaveInCrumbleBar; } diff --git a/src/plugins/qmldesigner/designersettings.h b/src/plugins/qmldesigner/designersettings.h index d9b338d516d..829e92dc7ca 100644 --- a/src/plugins/qmldesigner/designersettings.h +++ b/src/plugins/qmldesigner/designersettings.h @@ -55,6 +55,7 @@ public: bool designerWarningsInEditor; bool showDebugView; bool enableDebugView; + bool alwaysSaveInCrumbleBar; }; inline bool operator==(const DesignerSettings &s1, const DesignerSettings &s2) diff --git a/src/plugins/qmldesigner/qmldesignerconstants.h b/src/plugins/qmldesigner/qmldesignerconstants.h index 0ba6a5e299c..7a6c9c1be30 100644 --- a/src/plugins/qmldesigner/qmldesignerconstants.h +++ b/src/plugins/qmldesigner/qmldesignerconstants.h @@ -64,6 +64,7 @@ const char QML_WARNIN_FOR_FEATURES_IN_DESIGNER_KEY[] = "WarnAboutQtQuickFeatures const char QML_WARNIN_FOR_DESIGNER_FEATURES_IN_EDITOR_KEY[] = "WarnAboutQtQuickDesignerFeaturesInCodeEditor"; const char QML_SHOW_DEBUGVIEW[] = "ShowQtQuickDesignerDebugView"; const char QML_ENABLE_DEBUGVIEW[] = "EnableQtQuickDesignerDebugView"; +const char QML_ALWAYS_SAFE_IN_CRUMBLEBAR[] = "AlwaysSafeInCrumbleBar"; const char QML_DESIGNER_SUBFOLDER[] = "/designer/"; diff --git a/src/plugins/qmldesigner/qmldesignerplugin.cpp b/src/plugins/qmldesigner/qmldesignerplugin.cpp index c197ad66d6d..a7705075990 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.cpp +++ b/src/plugins/qmldesigner/qmldesignerplugin.cpp @@ -270,14 +270,14 @@ void QmlDesignerPlugin::jumpTextCursorToSelectedModelNode() { // visual editor -> text editor ModelNode selectedNode; - if (!currentDesignDocument()->rewriterView()->selectedModelNodes().isEmpty()) - selectedNode = currentDesignDocument()->rewriterView()->selectedModelNodes().first(); + if (!rewriterView()->selectedModelNodes().isEmpty()) + selectedNode = rewriterView()->selectedModelNodes().first(); if (selectedNode.isValid()) { - const int nodeOffset = currentDesignDocument()->rewriterView()->nodeOffset(selectedNode); + const int nodeOffset = rewriterView()->nodeOffset(selectedNode); if (nodeOffset > 0) { const ModelNode currentSelectedNode - = currentDesignDocument()->rewriterView()->nodeAtTextCursorPosition(currentDesignDocument()->plainTextEdit()->textCursor().position()); + = rewriterView()->nodeAtTextCursorPosition(currentDesignDocument()->plainTextEdit()->textCursor().position()); if (currentSelectedNode != selectedNode) { int line, column; currentDesignDocument()->textEditor()->convertPosition(nodeOffset, &line, &column); @@ -290,9 +290,9 @@ void QmlDesignerPlugin::jumpTextCursorToSelectedModelNode() void QmlDesignerPlugin::selectModelNodeUnderTextCursor() { const int cursorPosition = currentDesignDocument()->plainTextEdit()->textCursor().position(); - ModelNode modelNode = currentDesignDocument()->rewriterView()->nodeAtTextCursorPosition(cursorPosition); + ModelNode modelNode = rewriterView()->nodeAtTextCursorPosition(cursorPosition); if (modelNode.isValid()) - currentDesignDocument()->rewriterView()->setSelectedModelNode(modelNode); + rewriterView()->setSelectedModelNode(modelNode); } void QmlDesignerPlugin::activateAutoSynchronization() @@ -321,7 +321,7 @@ void QmlDesignerPlugin::activateAutoSynchronization() currentDesignDocument()->updateSubcomponentManager(); - connect(currentDesignDocument()->rewriterView(), + connect(rewriterView(), SIGNAL(errorsChanged(QList)), data->mainWidget, SLOT(updateErrorStatus(QList))); @@ -334,7 +334,7 @@ void QmlDesignerPlugin::deactivateAutoSynchronization() viewManager().detachRewriterView(); documentManager().currentDesignDocument()->resetToDocumentModel(); - disconnect(currentDesignDocument()->rewriterView(), + disconnect(rewriterView(), SIGNAL(errorsChanged(QList)), data->mainWidget, SLOT(updateErrorStatus(QList))); @@ -343,14 +343,21 @@ void QmlDesignerPlugin::deactivateAutoSynchronization() void QmlDesignerPlugin::resetModelSelection() { - if (currentDesignDocument()->rewriterView() && currentDesignDocument()->currentModel()) - currentDesignDocument()->rewriterView()->setSelectedModelNodes(QList()); + if (rewriterView() && currentDesignDocument()->currentModel()) + rewriterView()->setSelectedModelNodes(QList()); +} + +RewriterView *QmlDesignerPlugin::rewriterView() const +{ + return currentDesignDocument()->rewriterView(); } static bool checkIfEditorIsQtQuick(Core::IEditor *editor) { + if (editor) if (editor && editor->document()->id() == QmlJSEditor::Constants::C_QMLJSEDITOR_ID) { - QmlJS::Document::Ptr document = QmlJS::ModelManagerInterface::instance()->snapshot().document(editor->document()->filePath()); + QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance(); + QmlJS::Document::Ptr document = modelManager->ensuredGetDocumentForPath(editor->document()->filePath()); if (!document.isNull()) return document->language() == QmlJS::Language::QmlQtQuick1 || document->language() == QmlJS::Language::QmlQtQuick2 diff --git a/src/plugins/qmldesigner/qmldesignerplugin.h b/src/plugins/qmldesigner/qmldesignerplugin.h index e497328de6e..9a96b8400ef 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.h +++ b/src/plugins/qmldesigner/qmldesignerplugin.h @@ -113,6 +113,7 @@ private: // functions void activateAutoSynchronization(); void deactivateAutoSynchronization(); void resetModelSelection(); + RewriterView *rewriterView() const; private: // variables QmlDesignerPluginData *data; diff --git a/src/plugins/qmldesigner/settingspage.ui b/src/plugins/qmldesigner/settingspage.ui index 05c203a429f..23b3b8df72f 100644 --- a/src/plugins/qmldesigner/settingspage.ui +++ b/src/plugins/qmldesigner/settingspage.ui @@ -6,80 +6,14 @@ 0 0 - 684 - 607 + 726 + 774 Form - - - - Debugging - - - - - - - - Show the debugging view - - - - - - - Enable the debugging view - - - - - - - - - - - - - 0 - 0 - - - - Warnings - - - - - - - - Warns about QML features which are not properly supported by the Qt Quick Designer. - - - Warn about unsupported features in the Qt Quick Designer - - - - - - - Also warns in the code editor about QML features which are not properly supported by the Qt Quick Designer. - - - Warn about unsupported features of Qt Quick Designer in the code editor - - - - - - - - @@ -199,6 +133,72 @@ + + + Debugging + + + + + + + + Show the debugging view + + + + + + + Enable the debugging view + + + + + + + + + + + + + 0 + 0 + + + + Warnings + + + + + + + + Warns about QML features which are not properly supported by the Qt Quick Designer. + + + Warn about unsupported features in the Qt Quick Designer + + + + + + + Also warns in the code editor about QML features which are not properly supported by the Qt Quick Designer. + + + Warn about unsupported features of Qt Quick Designer in the code editor + + + + + + + + + Qt::Vertical @@ -211,6 +211,28 @@ + + + + + 0 + 0 + + + + Subcomponents + + + + + + Always save when leaving subcomponent in bread crumb + + + + + + diff --git a/src/plugins/qmljseditor/qmljseditor.pro b/src/plugins/qmljseditor/qmljseditor.pro index 6b93b7913db..c09ce621e70 100644 --- a/src/plugins/qmljseditor/qmljseditor.pro +++ b/src/plugins/qmljseditor/qmljseditor.pro @@ -13,7 +13,6 @@ HEADERS += \ qmlexpressionundercursor.h \ qmlfilewizard.h \ qmljshighlighter.h \ - qmljshighlighterfactory.h \ qmljshoverhandler.h \ qmljspreviewrunner.h \ qmljscomponentfromobjectdef.h \ @@ -46,7 +45,6 @@ SOURCES += \ qmlexpressionundercursor.cpp \ qmlfilewizard.cpp \ qmljshighlighter.cpp \ - qmljshighlighterfactory.cpp \ qmljshoverhandler.cpp \ qmljspreviewrunner.cpp \ qmljscomponentfromobjectdef.cpp \ diff --git a/src/plugins/qmljseditor/qmljseditor.qbs b/src/plugins/qmljseditor/qmljseditor.qbs index 67f23d2fc08..6bde46b85a5 100644 --- a/src/plugins/qmljseditor/qmljseditor.qbs +++ b/src/plugins/qmljseditor/qmljseditor.qbs @@ -51,8 +51,6 @@ QtcPlugin { "qmljsfindreferences.h", "qmljshighlighter.cpp", "qmljshighlighter.h", - "qmljshighlighterfactory.cpp", - "qmljshighlighterfactory.h", "qmljshoverhandler.cpp", "qmljshoverhandler.h", "qmljsoutline.cpp", diff --git a/src/plugins/qmljseditor/qmljseditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp index 752dab8730a..0e3442c6c0f 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.cpp +++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp @@ -44,7 +44,6 @@ #include "quicktoolbarsettingspage.h" #include "qmljscompletionassist.h" #include "qmljsquickfixassist.h" -#include "qmljshighlighterfactory.h" #include #include @@ -64,6 +63,7 @@ #include #include #include +#include #include #include @@ -114,7 +114,17 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e { m_modelManager = QmlJS::ModelManagerInterface::instance(); addAutoReleasedObject(new QmlJSSnippetProvider); - addAutoReleasedObject(new QmlJSHighlighterFactory); + + auto hf = new TextEditor::HighlighterFactory; + hf->setProductType(); + hf->setId(Constants::C_QMLJSEDITOR_ID); + hf->addMimeType(QmlJSTools::Constants::QML_MIMETYPE); + hf->addMimeType(QmlJSTools::Constants::QMLPROJECT_MIMETYPE); + hf->addMimeType(QmlJSTools::Constants::QBS_MIMETYPE); + hf->addMimeType(QmlJSTools::Constants::QMLTYPES_MIMETYPE); + hf->addMimeType(QmlJSTools::Constants::JS_MIMETYPE); + hf->addMimeType(QmlJSTools::Constants::JSON_MIMETYPE); + addAutoReleasedObject(hf); // QML task updating manager m_qmlTaskManager = new QmlTaskManager; diff --git a/src/plugins/qmljseditor/qmljshighlighterfactory.cpp b/src/plugins/qmljseditor/qmljshighlighterfactory.cpp deleted file mode 100644 index 0de134616a2..00000000000 --- a/src/plugins/qmljseditor/qmljshighlighterfactory.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** 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 "qmljshighlighterfactory.h" -#include "qmljseditorconstants.h" -#include "qmljshighlighter.h" -#include - -using namespace QmlJSEditor::Internal; - -QmlJSHighlighterFactory::QmlJSHighlighterFactory() -{ - setId(Constants::C_QMLJSEDITOR_ID); - addMimeType(QmlJSTools::Constants::QML_MIMETYPE); - addMimeType(QmlJSTools::Constants::QMLPROJECT_MIMETYPE); - addMimeType(QmlJSTools::Constants::QBS_MIMETYPE); - addMimeType(QmlJSTools::Constants::QMLTYPES_MIMETYPE); - addMimeType(QmlJSTools::Constants::JS_MIMETYPE); - addMimeType(QmlJSTools::Constants::JSON_MIMETYPE); -} - -TextEditor::SyntaxHighlighter *QmlJSHighlighterFactory::createHighlighter() const -{ - return new Highlighter; -} diff --git a/src/plugins/qmljseditor/qmljshighlighterfactory.h b/src/plugins/qmljseditor/qmljshighlighterfactory.h deleted file mode 100644 index 842e5dcef9b..00000000000 --- a/src/plugins/qmljseditor/qmljshighlighterfactory.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** 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. -** -****************************************************************************/ - -#ifndef QMLJSHIGHLIGHTERFACTORY_H -#define QMLJSHIGHLIGHTERFACTORY_H - -#include - -namespace QmlJSEditor { -namespace Internal { - -class QmlJSHighlighterFactory : public TextEditor::IHighlighterFactory -{ - Q_OBJECT - -public: - QmlJSHighlighterFactory(); - - virtual TextEditor::SyntaxHighlighter *createHighlighter() const; -}; - -} // namespace Internal -} // namespace QmlJSEditor - -#endif // QMLJSHIGHLIGHTERFACTORY_H diff --git a/src/plugins/qmljseditor/qmloutlinemodel.cpp b/src/plugins/qmljseditor/qmloutlinemodel.cpp index 6269be9d9e5..badde4ef699 100644 --- a/src/plugins/qmljseditor/qmloutlinemodel.cpp +++ b/src/plugins/qmljseditor/qmloutlinemodel.cpp @@ -298,9 +298,9 @@ private: int indent; }; -QmlOutlineModel::QmlOutlineModel(QmlJSEditorDocument *editor) : - QStandardItemModel(editor), - m_editorDocument(editor) +QmlOutlineModel::QmlOutlineModel(QmlJSEditorDocument *document) : + QStandardItemModel(document), + m_editorDocument(document) { m_icons = Icons::instance(); const QString resourcePath = Core::ICore::resourcePath(); diff --git a/src/plugins/qmljseditor/qmloutlinemodel.h b/src/plugins/qmljseditor/qmloutlinemodel.h index 9aeda58cc10..a127a92a494 100644 --- a/src/plugins/qmljseditor/qmloutlinemodel.h +++ b/src/plugins/qmljseditor/qmloutlinemodel.h @@ -81,7 +81,7 @@ public: NonElementBindingType // can be filtered out }; - QmlOutlineModel(QmlJSEditorDocument *editor); + QmlOutlineModel(QmlJSEditorDocument *document); // QStandardItemModel QStringList mimeTypes() const; diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index dce5e4b811f..da51a627acf 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -49,7 +49,6 @@ #include #include #include -#include #include #include diff --git a/src/plugins/texteditor/basetextmark.cpp b/src/plugins/texteditor/basetextmark.cpp index 12e947414f3..45eba8de4b1 100644 --- a/src/plugins/texteditor/basetextmark.cpp +++ b/src/plugins/texteditor/basetextmark.cpp @@ -135,13 +135,13 @@ BaseTextMark::BaseTextMark(const QString &fileName, int lineNumber) // which might be set in the derived constructor void BaseTextMark::init() { - Internal::TextEditorPlugin::instance()->baseTextMarkRegistry()->add(this); + Internal::TextEditorPlugin::baseTextMarkRegistry()->add(this); } BaseTextMark::~BaseTextMark() { // oha we are deleted - bool b = Internal::TextEditorPlugin::instance()->baseTextMarkRegistry()->remove(this); + bool b = Internal::TextEditorPlugin::baseTextMarkRegistry()->remove(this); // If you get a assertion in this line, init() was never called QTC_CHECK(b); } diff --git a/src/plugins/texteditor/generichighlighter/manager.cpp b/src/plugins/texteditor/generichighlighter/manager.cpp index d5f63db28da..49363cd7af6 100644 --- a/src/plugins/texteditor/generichighlighter/manager.cpp +++ b/src/plugins/texteditor/generichighlighter/manager.cpp @@ -321,7 +321,7 @@ void Manager::registerMimeTypesFinished() const QPair > &result = m_registeringWatcher.result(); m_register = result.first; - PlainTextEditorFactory *factory = TextEditorPlugin::instance()->editorFactory(); + PlainTextEditorFactory *factory = TextEditorPlugin::editorFactory(); const QSet &inFactory = factory->mimeTypes().toSet(); foreach (const MimeType &mimeType, result.second) { MimeDatabase::addMimeType(mimeType); diff --git a/src/plugins/texteditor/ihighlighterfactory.h b/src/plugins/texteditor/highlighterfactory.h similarity index 83% rename from src/plugins/texteditor/ihighlighterfactory.h rename to src/plugins/texteditor/highlighterfactory.h index a3c39e635b4..5576480824d 100644 --- a/src/plugins/texteditor/ihighlighterfactory.h +++ b/src/plugins/texteditor/highlighterfactory.h @@ -27,8 +27,8 @@ ** ****************************************************************************/ -#ifndef IHIGHLIGHTERFACTORY_H -#define IHIGHLIGHTERFACTORY_H +#ifndef HIGHLIGHTERFACTORY_H +#define HIGHLIGHTERFACTORY_H #include #include @@ -36,20 +36,24 @@ #include #include +#include + namespace TextEditor { class SyntaxHighlighter; -class TEXTEDITOR_EXPORT IHighlighterFactory : public QObject +class TEXTEDITOR_EXPORT HighlighterFactory : public QObject { Q_OBJECT -public: - virtual TextEditor::SyntaxHighlighter *createHighlighter() const = 0; +public: + typedef std::function Creator; + TextEditor::SyntaxHighlighter *createHighlighter() const { return m_creator(); } + + template void setProductType() { m_creator = []() { return new T; }; } Core::Id id() const { return m_id; } QStringList mimeTypes() const { return m_mimeTypes; } -protected: void setId(Core::Id id) { m_id = id; } void setMimeTypes(const QStringList &mimeTypes) { m_mimeTypes = mimeTypes; } void addMimeType(const char *mimeType) { m_mimeTypes.append(QLatin1String(mimeType)); } @@ -58,9 +62,10 @@ protected: private: Core::Id m_id; QStringList m_mimeTypes; + Creator m_creator; }; } // TextEditor -#endif // IHIGHLIGHTERFACTORY_H +#endif // HIGHLIGHTERFACTORY_H diff --git a/src/plugins/texteditor/outlinefactory.cpp b/src/plugins/texteditor/outlinefactory.cpp index a1b53767826..3fc3d2b1dbe 100644 --- a/src/plugins/texteditor/outlinefactory.cpp +++ b/src/plugins/texteditor/outlinefactory.cpp @@ -138,7 +138,7 @@ void OutlineWidgetStack::updateFilterMenu() m_filterMenu->addAction(filterAction); } } - m_filterButton->setEnabled(!m_filterMenu->actions().isEmpty()); + m_filterButton->setVisible(!m_filterMenu->actions().isEmpty()); } void OutlineWidgetStack::updateCurrentEditor(Core::IEditor *editor) diff --git a/src/plugins/texteditor/texteditor.pro b/src/plugins/texteditor/texteditor.pro index a580e286bb0..8e226aec200 100644 --- a/src/plugins/texteditor/texteditor.pro +++ b/src/plugins/texteditor/texteditor.pro @@ -146,7 +146,7 @@ HEADERS += texteditorplugin.h \ normalindenter.h \ indenter.h \ quickfix.h \ - ihighlighterfactory.h \ + highlighterfactory.h \ syntaxhighlighter.h \ highlighterutils.h \ generichighlighter/reuse.h \ diff --git a/src/plugins/texteditor/texteditor.qbs b/src/plugins/texteditor/texteditor.qbs index a695c2af8d8..c630ae0715d 100644 --- a/src/plugins/texteditor/texteditor.qbs +++ b/src/plugins/texteditor/texteditor.qbs @@ -87,7 +87,7 @@ QtcPlugin { "icodestylepreferences.h", "icodestylepreferencesfactory.cpp", "icodestylepreferencesfactory.h", - "ihighlighterfactory.h", + "highlighterfactory.h", "indenter.cpp", "indenter.h", "ioutlinewidget.h", diff --git a/src/plugins/texteditor/texteditoractionhandler.cpp b/src/plugins/texteditor/texteditoractionhandler.cpp index 0c823fe1618..5ea1d31e052 100644 --- a/src/plugins/texteditor/texteditoractionhandler.cpp +++ b/src/plugins/texteditor/texteditoractionhandler.cpp @@ -442,7 +442,7 @@ void TextEditorActionHandler::updateCopyAction() void TextEditorActionHandler::gotoAction() { - QString locatorString = TextEditorPlugin::instance()->lineNumberFilter()->shortcutString(); + QString locatorString = TextEditorPlugin::lineNumberFilter()->shortcutString(); locatorString += QLatin1Char(' '); const int selectionStart = locatorString.size(); locatorString += tr(":"); diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp index 42e493960d7..4436499e6ad 100644 --- a/src/plugins/texteditor/texteditorplugin.cpp +++ b/src/plugins/texteditor/texteditorplugin.cpp @@ -66,7 +66,7 @@ static const char kCurrentDocumentRowCount[] = "CurrentDocument:RowCount"; static const char kCurrentDocumentColumnCount[] = "CurrentDocument:ColumnCount"; static const char kCurrentDocumentFontSize[] = "CurrentDocument:FontSize"; -TextEditorPlugin *TextEditorPlugin::m_instance = 0; +static TextEditorPlugin *m_instance = 0; TextEditorPlugin::TextEditorPlugin() : m_settings(0), @@ -83,11 +83,6 @@ TextEditorPlugin::~TextEditorPlugin() m_instance = 0; } -TextEditorPlugin *TextEditorPlugin::instance() -{ - return m_instance; -} - static const char wizardCategoryC[] = "U.General"; static inline QString wizardDisplayCategory() @@ -266,6 +261,21 @@ void TextEditorPlugin::extensionsInitialized() this, SLOT(updateCurrentSelection(QString))); } +PlainTextEditorFactory *TextEditorPlugin::editorFactory() +{ + return m_instance->m_editorFactory; +} + +LineNumberFilter *TextEditorPlugin::lineNumberFilter() +{ + return m_instance->m_lineNumberFilter; +} + +BaseTextMarkRegistry *TextEditorPlugin::baseTextMarkRegistry() +{ + return m_instance->m_baseTextMarkRegistry; +} + void TextEditorPlugin::invokeCompletion() { Core::IEditor *iface = Core::EditorManager::currentEditor(); diff --git a/src/plugins/texteditor/texteditorplugin.h b/src/plugins/texteditor/texteditorplugin.h index dcbdc843770..82075b989cc 100644 --- a/src/plugins/texteditor/texteditorplugin.h +++ b/src/plugins/texteditor/texteditorplugin.h @@ -56,15 +56,13 @@ public: TextEditorPlugin(); virtual ~TextEditorPlugin(); - static TextEditorPlugin *instance(); - // ExtensionSystem::PluginInterface bool initialize(const QStringList &arguments, QString *errorMessage); void extensionsInitialized(); - PlainTextEditorFactory *editorFactory() { return m_editorFactory; } - LineNumberFilter *lineNumberFilter() { return m_lineNumberFilter; } - BaseTextMarkRegistry *baseTextMarkRegistry() { return m_baseTextMarkRegistry; } + static PlainTextEditorFactory *editorFactory(); + static LineNumberFilter *lineNumberFilter(); + static BaseTextMarkRegistry *baseTextMarkRegistry(); private slots: void invokeCompletion(); @@ -73,7 +71,6 @@ private slots: void updateCurrentSelection(const QString &text); private: - static TextEditorPlugin *m_instance; TextEditorSettings *m_settings; PlainTextEditorFactory *m_editorFactory; LineNumberFilter *m_lineNumberFilter; diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp index 49042f71d54..5a4c16ba4c5 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.cpp +++ b/src/plugins/vcsbase/vcsbaseplugin.cpp @@ -747,14 +747,15 @@ bool VcsBasePlugin::isSshPromptConfigured() static const char SOURCE_PROPERTY[] = "qtcreator_source"; -void VcsBasePlugin::setSource(Core::IDocument *editor, const QString &source) +void VcsBasePlugin::setSource(Core::IDocument *document, const QString &source) { - editor->setProperty(SOURCE_PROPERTY, source); + document->setProperty(SOURCE_PROPERTY, source); + VcsBasePluginPrivate::m_listener->slotStateChanged(); } -QString VcsBasePlugin::source(Core::IDocument *editor) +QString VcsBasePlugin::source(Core::IDocument *document) { - return editor->property(SOURCE_PROPERTY).toString(); + return document->property(SOURCE_PROPERTY).toString(); } void VcsBasePlugin::setProcessEnvironment(QProcessEnvironment *e, diff --git a/src/shared/proparser/ioutils.cpp b/src/shared/proparser/ioutils.cpp index ff61e481905..096a25854f7 100644 --- a/src/shared/proparser/ioutils.cpp +++ b/src/shared/proparser/ioutils.cpp @@ -64,6 +64,10 @@ bool IoUtils::isRelativePath(const QString &path) { if (path.startsWith(QLatin1Char('/'))) return false; +#ifdef QMAKE_BUILTIN_PRFS + if (path.startsWith(QLatin1String(":/"))) + return false; +#endif #ifdef Q_OS_WIN if (path.startsWith(QLatin1Char('\\'))) return false; diff --git a/src/src.qbs b/src/src.qbs index 5301b6a4f5a..3680e8d0068 100644 --- a/src/src.qbs +++ b/src/src.qbs @@ -29,7 +29,9 @@ Project { ? ["@loader_path/" + FileInfo.relativePath(appInstallDir, libInstallDir)] : ["$ORIGIN/..", "$ORIGIN/../" + project.ide_library_path] property string resourcesInstallDir: project.ide_data_path + "/qbs" - property string pluginsInstallDir: project.libDirName + "/qtcreator" + property string pluginsInstallDir: qbs.targetOS.contains("windows") + ? project.libDirName + "/qtcreator" + : project.ide_library_path property string appInstallDir: project.ide_bin_path property string relativePluginsPath: FileInfo.relativePath(appInstallDir, pluginsInstallDir) property string relativeSearchPath: FileInfo.relativePath(appInstallDir, diff --git a/tests/manual/debugger/simple/simple_test_app.cpp b/tests/manual/debugger/simple/simple_test_app.cpp index 7c92102d65f..c7f46d44294 100644 --- a/tests/manual/debugger/simple/simple_test_app.cpp +++ b/tests/manual/debugger/simple/simple_test_app.cpp @@ -5352,7 +5352,11 @@ namespace basic { // Locals and Expressions view. It is only support on gdb with Python. const char *s = "aöa"; + const char cs[] = "aöa"; + char cc[] = "aöa"; const wchar_t *w = L"aöa"; + const wchar_t cw[] = L"aöa"; + wchar_t ww[] = L"aöa"; QString u; BREAK_HERE; // Expand s. @@ -5372,7 +5376,7 @@ namespace basic { u = QString::fromUtf16((ushort *)w); // Make sure to undo "Change Format". - dummyStatement(s, w); + dummyStatement(s, w, &ww, &cw, &cc, &cs); } typedef void *VoidPtr; diff --git a/tests/system/objects.map b/tests/system/objects.map index a67704818e2..c8e30b6187e 100644 --- a/tests/system/objects.map +++ b/tests/system/objects.map @@ -88,13 +88,13 @@ :FormEditorStack_qdesigner_internal::FormWindow {container=':*Qt Creator.FormEditorStack_Designer::Internal::FormEditorStack' type='qdesigner_internal::FormWindow' unnamed='1' visible='1'} :FormEditorStack_qdesigner_internal::PropertyLineEdit {container=':*Qt Creator.FormEditorStack_Designer::Internal::FormEditorStack' type='qdesigner_internal::PropertyLineEdit' unnamed='1' visible='1'} :Generator:_QComboBox {buddy=':CMake Wizard.Generator:_QLabel' type='QComboBox' unnamed='1' visible='1'} -:Git Repository Clone.Cancel_QPushButton {text='Cancel' type='QPushButton' visible='1' window=':Git Repository Clone_VcsBase::Internal::CheckoutWizardDialog'} -:Git Repository Clone.Finish_QPushButton {text~='(Finish|Done)' type='QPushButton' visible='1' window=':Git Repository Clone_VcsBase::Internal::CheckoutWizardDialog'} -:Git Repository Clone.Repository_QGroupBox {name='repositoryGroupBox' title='Repository' type='QGroupBox' visible='1' window=':Git Repository Clone_VcsBase::Internal::CheckoutWizardDialog'} -:Git Repository Clone.Result._QLabel {type='QLabel' unnamed='1' visible='1' window=':Git Repository Clone_VcsBase::Internal::CheckoutWizardDialog'} -:Git Repository Clone.Working Copy_QGroupBox {name='localGroupBox' title='Working Copy' type='QGroupBox' visible='1' window=':Git Repository Clone_VcsBase::Internal::CheckoutWizardDialog'} -:Git Repository Clone.logPlainTextEdit_QPlainTextEdit {type='QPlainTextEdit' unnamed='1' visible='1' window=':Git Repository Clone_VcsBase::Internal::CheckoutWizardDialog'} -:Git Repository Clone_VcsBase::Internal::CheckoutWizardDialog {type='VcsBase::Internal::CheckoutWizardDialog' unnamed='1' visible='1' windowTitle='Git Repository Clone'} +:Git Repository Clone.Cancel_QPushButton {text='Cancel' type='QPushButton' visible='1' window=':Git Repository Clone_Git::Internal::CloneWizard'} +:Git Repository Clone.Finish_QPushButton {text~='(Finish|Done)' type='QPushButton' visible='1' window=':Git Repository Clone_Git::Internal::CloneWizard'} +:Git Repository Clone.Repository_QGroupBox {name='repositoryGroupBox' title='Repository' type='QGroupBox' visible='1' window=':Git Repository Clone_Git::Internal::CloneWizard'} +:Git Repository Clone.Result._QLabel {type='QLabel' unnamed='1' visible='1' window=':Git Repository Clone_Git::Internal::CloneWizard'} +:Git Repository Clone.Working Copy_QGroupBox {name='localGroupBox' title='Working Copy' type='QGroupBox' visible='1' window=':Git Repository Clone_Git::Internal::CloneWizard'} +:Git Repository Clone.logPlainTextEdit_QPlainTextEdit {type='QPlainTextEdit' unnamed='1' visible='1' window=':Git Repository Clone_Git::Internal::CloneWizard'} +:Git Repository Clone_Git::Internal::CloneWizard {type='Git::Internal::CloneWizard' unnamed='1' visible='1' windowTitle='Git Repository Clone'} :Go to slot.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Go to slot_QDialog'} :Go to slot.Select signal_QGroupBox {name='groupBox' title='Select signal' type='QGroupBox' visible='1' window=':Go to slot_QDialog'} :Go to slot_QDialog {name='SelectSignalDialog' type='QDialog' visible='1' windowTitle='Go to slot'} @@ -103,9 +103,9 @@ :JavaScript.QmlProfilerEventsTable_QmlProfiler::Internal::QV8ProfilerEventsMainView {container=':*Qt Creator.JavaScript_QDockWidget' name='QmlProfilerEventsTable' type='QmlProfiler::Internal::QV8ProfilerEventsMainView' visible='1'} :Kits_QtVersion_QComboBox {container=':qt_tabwidget_stackedwidget_QWidget' occurrence='5' type='QComboBox' unnamed='1' visible='1'} :Locals and Expressions_Debugger::Internal::WatchTreeView {container=':DebugModeWidget.Locals and Expressions_QDockWidget' name='WatchWindow' type='Debugger::Internal::WatchTreeView' visible='1' windowTitle='Locals and Expressions'} -:New Text File.Add to project:_QLabel {name='projectLabel' text='Add to project:' type='QLabel' visible='1' window=':New Text File_Utils::FileWizardDialog'} -:New Text File.nameLineEdit_Utils::FileNameValidatingLineEdit {name='nameLineEdit' type='Utils::FileNameValidatingLineEdit' visible='1' window=':New Text File_Utils::FileWizardDialog'} -:New Text File_Utils::FileWizardDialog {type='Utils::FileWizardDialog' unnamed='1' visible='1' windowTitle='New Text File'} +:New Text File.Add to project:_QLabel {name='projectLabel' text='Add to project:' type='QLabel' visible='1' window=':New Text File_Core::BaseFileWizard'} +:New Text File.nameLineEdit_Utils::FileNameValidatingLineEdit {name='nameLineEdit' type='Utils::FileNameValidatingLineEdit' visible='1' window=':New Text File_Core::BaseFileWizard'} +:New Text File_Core::BaseFileWizard {type='Core::BaseFileWizard' unnamed='1' visible='1' windowTitle='New Text File'} :New.comboBox_QComboBox {name='comboBox' type='QComboBox' visible='1' window=':New_Core::Internal::NewDialog'} :New.frame_QFrame {name='frame' type='QFrame' visible='1' window=':New_Core::Internal::NewDialog'} :New.templateCategoryView_QTreeView {name='templateCategoryView' type='QTreeView' visible='1' window=':New_Core::Internal::NewDialog'} @@ -221,13 +221,14 @@ :qt_tabwidget_stackedwidget.Form_QWidget {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' name='Help__Internal__GeneralSettingsPage' type='QWidget' visible='1' windowTitle='Form'} :qt_tabwidget_stackedwidget.QtSupport__Internal__QtVersionManager_QtSupport::Internal::QtOptionsPageWidget {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' name='QtSupport__Internal__QtVersionManager' type='QtSupport::Internal::QtOptionsPageWidget' visible='1'} :qt_tabwidget_stackedwidget_QWidget {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' type='QWidget' unnamed='1' visible='1'} +:scrollArea.Clear system environment_QCheckBox {container=':Qt Creator.scrollArea_QScrollArea' text='Clear system environment' type='QCheckBox' unnamed='1' visible='1'} :scrollArea.Details_Utils::DetailsButton {text='Details' type='Utils::DetailsButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :scrollArea.Edit build configuration:_QComboBox {leftWidget=':scrollArea.Edit build configuration:_QLabel' type='QComboBox' unnamed='1' visible='1'} :scrollArea.Edit build configuration:_QLabel {text='Edit build configuration:' type='QLabel' unnamed='1' visible='1'} :scrollArea.Executable:_QLabel {container=':Qt Creator.scrollArea_QScrollArea' text='Executable:' type='QLabel' unnamed='1' visible='1'} :scrollArea.Library not available_QLabel {name='qmlDebuggingWarningText' text?='Library not available*' type='QLabel' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} +:scrollArea.environment_QTreeView {aboveWidget=':scrollArea.Clear system environment_QCheckBox' container=':Qt Creator.scrollArea_QScrollArea' type='QTreeView' unnamed='1' visible='1'} :scrollArea.qmlDebuggingLibraryCheckBox_QCheckBox {name='qmlDebuggingLibraryCheckBox' type='QCheckBox' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} -:scrollArea_QTableView {type='QTableView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :sourceFileLineEdit_Utils::FileNameValidatingLineEdit {buddy=':Qt Gui Application.Source file:_QLabel' name='sourceFileLineEdit' type='Utils::FileNameValidatingLineEdit' visible='1'} :splitter.Commit File(s)_VcsBase::QActionPushButton {container=':Qt Creator.splitter_QSplitter' text~='(Commit .+/.+ File.*)' type='VcsBase::QActionPushButton' unnamed='1' visible='1'} :splitter.Description_QGroupBox {container=':Qt Creator.splitter_QSplitter' name='descriptionBox' title='Description' type='QGroupBox' visible='1'} diff --git a/tests/system/shared/hook_utils.py b/tests/system/shared/hook_utils.py index 540c0702dc8..c87873d441f 100644 --- a/tests/system/shared/hook_utils.py +++ b/tests/system/shared/hook_utils.py @@ -47,7 +47,7 @@ def modifyRunSettingsForHookInto(projectName, kitCount, port): result = __configureCustomExecutable__(projectName, port, mkspec, qtVersion) if result: ensureChecked(":RunSettingsEnvironmentDetails_Utils::DetailsButton") - envVarsTableView = waitForObject("{type='QTableView' visible='1' unnamed='1'}") + envVarsTableView = waitForObject("{type='QTreeView' visible='1' unnamed='1'}") model = envVarsTableView.model() changingVars = [] for index in dumpIndices(model): diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index 07e0317cfed..3e62cccb85c 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -719,7 +719,7 @@ def addCPlusPlusFileToCurrentProject(name, template, forceOverwrite=False, addTo test.fatal("File must have a name - got None.") return __createProjectOrFileSelectType__(" C++", template, isProject=False) - window = "{type='Utils::FileWizardDialog' unnamed='1' visible='1'}" + window = "{type='Core::BaseFileWizard' unnamed='1' visible='1'}" basePath = str(waitForObject("{type='Utils::FancyLineEdit' unnamed='1' visible='1' " "window=%s}" % window).text) lineEdit = waitForObject("{name='nameLineEdit' type='Utils::FileNameValidatingLineEdit' " diff --git a/tests/system/shared/project_explorer.py b/tests/system/shared/project_explorer.py index f6f0a78635b..92e69d08f19 100644 --- a/tests/system/shared/project_explorer.py +++ b/tests/system/shared/project_explorer.py @@ -149,7 +149,7 @@ def getQtInformationForBuildSettings(kitCount, alreadyOnProjectsBuildSettings=Fa switchViewTo(ViewConstants.PROJECTS) switchToBuildOrRunSettingsFor(kitCount, 0, ProjectSettings.BUILD) clickButton(waitForObject(":Qt Creator_SystemSettings.Details_Utils::DetailsButton")) - model = waitForObject(":scrollArea_QTableView").model() + model = waitForObject(":scrollArea.environment_QTreeView").model() qtDir = None for row in range(model.rowCount()): index = model.index(row, 0) diff --git a/tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt48.tsv b/tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt48.tsv index bff0ad765ca..f343052ac2d 100644 --- a/tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt48.tsv +++ b/tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt48.tsv @@ -1,8 +1,8 @@ "0" "1" "4" "9" -"" "Binding" "1" "Main Program" +"" "" "1" "Main Program" "main.qml:12" "Signal" "2" "triggered(): { runCount += 1; var i; for (i = 1; i < 2500; ++i) { var j = i * i; console.log(j); } }" "main.qml:1" "Create" "1" "main.qml" "main.qml:1" "Compile" "1" "main.qml" "main.qml:31" "Binding" "1" "text: qsTr(""Hello World"")" -"" "Binding" "2" "Source code not available." +"" "Binding" "2" "" "main.qml:11" "Binding" "3" "running: runCount < 2" diff --git a/tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt48_nonOptimized.tsv b/tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt48_nonOptimized.tsv index 754e315949e..661b87864f3 100644 --- a/tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt48_nonOptimized.tsv +++ b/tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt48_nonOptimized.tsv @@ -1,5 +1,5 @@ "0" "1" "4" "9" -"" "Binding" "1" "Main Program" +"" "" "1" "Main Program" "main.qml:12" "Signal" "2" "triggered(): { runCount += 1; var i; for (i = 1; i < 2500; ++i) { var j = i * i; console.log(j); } }" "main.qml:1" "Create" "1" "main.qml" "main.qml:1" "Compile" "1" "main.qml" diff --git a/tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt50.tsv b/tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt50.tsv index bb77fca202b..7f1b3ab4f7e 100644 --- a/tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt50.tsv +++ b/tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt50.tsv @@ -1,8 +1,8 @@ "0" "1" "4" "9" -"" "Binding" "1" "Main Program" +"" "" "1" "Main Program" "main.qml:1" "Create" "1" "main.qml" "main.qml:12" "Signal" "2" "triggered(): { runCount += 1; var i; for (i = 1; i < 2500; ++i) { var j = i * i; console.log(j); } }" "main.qml:1" "Compile" "1" "main.qml" "main.qml:31" "Binding" "1" "text: qsTr(""Hello World"")" -"" "Binding" "2" "Source code not available." +"" "Binding" "2" "" "main.qml:11" "Binding" "3" "running: runCount < 2" diff --git a/tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt50_nonOptimized.tsv b/tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt50_nonOptimized.tsv index 72c37667a9b..9b1f613781b 100644 --- a/tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt50_nonOptimized.tsv +++ b/tests/system/suite_debugger/tst_simple_analyze/testdata/events_qt50_nonOptimized.tsv @@ -1,5 +1,5 @@ "0" "1" "4" "9" -"" "Binding" "1" "Main Program" +"" "" "1" "Main Program" "main.qml:1" "Create" "1" "main.qml" "main.qml:12" "Signal" "2" "triggered(): { runCount += 1; var i; for (i = 1; i < 2500; ++i) { var j = i * i; console.log(j); } }" "main.qml:1" "Compile" "1" "main.qml" diff --git a/tests/system/suite_editors/tst_generic_highlighter/test.py b/tests/system/suite_editors/tst_generic_highlighter/test.py index 335eb1a825c..3b6591ca822 100644 --- a/tests/system/suite_editors/tst_generic_highlighter/test.py +++ b/tests/system/suite_editors/tst_generic_highlighter/test.py @@ -34,12 +34,12 @@ def createFile(folder, filename): replaceEditorContent(waitForObject("{name='nameLineEdit' visible='1' " "type='Utils::FileNameValidatingLineEdit'}"), filename) replaceEditorContent(waitForObject("{type='Utils::FancyLineEdit' unnamed='1' visible='1' " - "window=':New Text File_Utils::FileWizardDialog'}"), folder) + "window=':New Text File_Core::BaseFileWizard'}"), folder) clickButton(waitForObject(":Next_QPushButton")) __createProjectHandleLastPage__() def clickTableGetPatternLineEdit(table, row): - clickItem(table, "%d/0" % row, 5, 5, 0, Qt.LeftButton) + clickItem(table, row, 5, 5, 0, Qt.LeftButton) return waitForObject("{name='patternsLineEdit' type='QLineEdit' visible='1'}") def getOrModifyFilePatternsFor(mimeType, filter='', toBePresent=None): @@ -54,11 +54,11 @@ def getOrModifyFilePatternsFor(mimeType, filter='', toBePresent=None): clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "MIME Types") replaceEditorContent(waitForObject("{name='filterLineEdit' type='QLineEdit' visible='1'}"), filter) - mimeTypeTable = waitForObject("{name='mimeTypesTableView' type='QTableView' visible='1'}") + mimeTypeTable = waitForObject("{name='mimeTypesTreeView' type='QTreeView' visible='1'}") model = mimeTypeTable.model() if filter == '': - for row in range(model.rowCount()): - if str(model.data(model.index(row, 0)).toString()) == mimeType: + for row in dumpItems(model): + if row == mimeType: result = toSuffixArray(str(clickTableGetPatternLineEdit(mimeTypeTable, row).text)) break clickButton(":Options.Cancel_QPushButton") @@ -67,7 +67,7 @@ def getOrModifyFilePatternsFor(mimeType, filter='', toBePresent=None): return result waitFor('model.rowCount() == 1', 2000) if model.rowCount() == 1: - patternsLineEd = clickTableGetPatternLineEdit(mimeTypeTable, 0) + patternsLineEd = clickTableGetPatternLineEdit(mimeTypeTable, dumpItems(model)[0]) patterns = str(patternsLineEd.text) if toBePresent: actualSuffixes = toSuffixArray(patterns) diff --git a/tests/system/suite_general/tst_default_settings/test.py b/tests/system/suite_general/tst_default_settings/test.py index 696c594d8d9..5156036e0c8 100644 --- a/tests/system/suite_general/tst_default_settings/test.py +++ b/tests/system/suite_general/tst_default_settings/test.py @@ -230,9 +230,13 @@ def __getCDB__(): possibleLocations = ["C:\\Program Files\\Debugging Tools for Windows (x64)", "C:\\Program Files (x86)\\Debugging Tools for Windows (x86)", "C:\\Program Files (x86)\\Windows Kits\\8.0\\Debuggers\\x86", + "C:\\Program Files (x86)\\Windows Kits\\8.0\\Debuggers\\x64", "C:\\Program Files\\Windows Kits\\8.0\\Debuggers\\x86", + "C:\\Program Files\\Windows Kits\\8.0\\Debuggers\\x64", "C:\\Program Files (x86)\\Windows Kits\\8.1\\Debuggers\\x86", - "C:\\Program Files\\Windows Kits\\8.1\\Debuggers\\x86"] + "C:\\Program Files (x86)\\Windows Kits\\8.1\\Debuggers\\x64", + "C:\\Program Files\\Windows Kits\\8.1\\Debuggers\\x86", + "C:\\Program Files\\Windows Kits\\8.1\\Debuggers\\x64"] for cdbPath in possibleLocations: cdb = os.path.join(cdbPath, "cdb.exe") if os.path.exists(cdb): diff --git a/tests/system/suite_tools/tst_git_clone/test.py b/tests/system/suite_tools/tst_git_clone/test.py index f526714b6a9..50a37ddd30b 100644 --- a/tests/system/suite_tools/tst_git_clone/test.py +++ b/tests/system/suite_tools/tst_git_clone/test.py @@ -60,7 +60,7 @@ def verifyCloneLog(targetDir, canceled): if canceled: test.warning("Could not find resultLabel", "Cloning might have failed before clicking 'Cancel'") - return object.exists(":Git Repository Clone_VcsBase::Internal::CheckoutWizardDialog") + return object.exists(":Git Repository Clone_Git::Internal::CloneWizard") else: test.fail("Could not find resultLabel") return True