Merge remote-tracking branch 'origin/3.2'

This commit is contained in:
Eike Ziller
2014-06-30 12:03:41 +02:00
129 changed files with 690 additions and 1339 deletions

1
.gitignore vendored
View File

@@ -144,6 +144,7 @@ tmp/
/tests/auto/cplusplus/checksymbols/tst_checksymbols /tests/auto/cplusplus/checksymbols/tst_checksymbols
/tests/auto/cplusplus/codegen/tst_codegen /tests/auto/cplusplus/codegen/tst_codegen
/tests/auto/cplusplus/cxx11/tst_cxx11 /tests/auto/cplusplus/cxx11/tst_cxx11
/tests/auto/cplusplus/cxx11/tst_c99
/tests/auto/cplusplus/lexer/tst_lexer /tests/auto/cplusplus/lexer/tst_lexer
/tests/auto/cplusplus/misc/tst_misc /tests/auto/cplusplus/misc/tst_misc
/tests/auto/cplusplus/simplifytypes/tst_simplifytypes /tests/auto/cplusplus/simplifytypes/tst_simplifytypes

8
README
View File

@@ -10,16 +10,14 @@ Windows XP SP3 or later
(K)Ubuntu Linux 11.10 (32-bit and 64-bit) or later (K)Ubuntu Linux 11.10 (32-bit and 64-bit) or later
Mac OS X 10.7 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, 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. 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 Compiling Qt Creator
==================== ====================
Prerequisites: 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: * On Windows:
- ActiveState Active Perl - ActiveState Active Perl
- MinGW or Visual Studio 2010 or later - 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 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: 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. 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 Thus, if you want to work on Qt Creator using Qt Creator, you need a

View File

@@ -25,7 +25,8 @@ QtcProduct {
cpp.defines: base.concat([name.toUpperCase() + "_LIBRARY"]) cpp.defines: base.concat([name.toUpperCase() + "_LIBRARY"])
cpp.installNamePrefix: "@rpath/PlugIns/" cpp.installNamePrefix: "@rpath/PlugIns/"
cpp.rpaths: qbs.targetOS.contains("osx") ? ["@loader_path/..", "@executable_path/.."] cpp.rpaths: qbs.targetOS.contains("osx")
? ["@loader_path/..", "@loader_path/", "@executable_path/.."]
: ["$ORIGIN", "$ORIGIN/.."] : ["$ORIGIN", "$ORIGIN/.."]
cpp.linkerFlags: { cpp.linkerFlags: {
var flags = base; var flags = base;

View File

@@ -41,21 +41,26 @@ exists(src/shared/qbs/qbs.pro) {
system("echo QBSLIBDIR = $${maybe_backslash}\"$${IDE_LIBRARY_PATH}$${maybe_backslash}\" >> $$qmake_cache") system("echo QBSLIBDIR = $${maybe_backslash}\"$${IDE_LIBRARY_PATH}$${maybe_backslash}\" >> $$qmake_cache")
system("echo QBS_INSTALL_PREFIX = $${QTC_PREFIX} >> $$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_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") system("echo QBS_RESOURCES_INSTALL_DIR = $${QTC_PREFIX}/share/qtcreator/qbs >> $$qmake_cache")
macx { 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") system("echo QBS_APPS_RPATH_DIR = @loader_path/../PlugIns >> $$qmake_cache")
} else { } 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_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_PLUGINS_INSTALL_DIR = $${QTC_PREFIX}/$${IDE_LIBRARY_BASENAME}/qtcreator >> $$qmake_cache")
system("echo QBS_LIBRARY_DIRNAME = $${IDE_LIBRARY_BASENAME} >> $$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_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) QBS_RELATIVE_PLUGINS_PATH = $$relative_path($$QBS_PLUGINS_BUILD_DIR, $$QBS_APPS_DESTDIR$$)
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) 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") system("echo CONFIG += qbs_no_dev_install >> $$qmake_cache")
} }

View File

@@ -753,13 +753,19 @@ class DumperBase:
self.putType(type) self.putType(type)
self.putNumChild(1) self.putNumChild(1)
format = self.currentItemFormat() format = self.currentItemFormat()
isDefault = format == None and str(innerType.unqualified()) == "char" isDefault1 = format == None and str(innerType.unqualified()) == "char"
if isDefault or format == 0 or format == 1 or format == 2: 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) blob = self.readMemory(self.addressOf(value), type.sizeof)
if isDefault: if isDefault1:
# Use Latin1 as default for char []. # Use Latin1 as default for char [].
self.putValue(blob, Hex2EncodedLatin1) self.putValue(blob, Hex2EncodedLatin1)
elif isDefault2:
if type.sizeof == 2:
self.putValue(blob, Hex4EncodedLittleEndian)
else:
self.putValue(blob, Hex8EncodedLittleEndian)
elif format == 0: elif format == 0:
# Explicitly requested Latin1 formatting. # Explicitly requested Latin1 formatting.
self.putValue(blob, Hex2EncodedLatin1) self.putValue(blob, Hex2EncodedLatin1)

View File

@@ -58,7 +58,7 @@ Row {
property variant backendValue: backendValues.horizontalAlignment; property variant backendValue: backendValues.horizontalAlignment;
property variant value: backendValue.value property variant value: backendValue.enumeration
property bool baseStateFlag: isBaseState; property bool baseStateFlag: isBaseState;

View File

@@ -59,7 +59,7 @@ Row {
property variant backendValue: backendValues.verticalAlignment; property variant backendValue: backendValues.verticalAlignment;
property variant value: backendValue.value property variant value: backendValue.enumeration
property bool baseStateFlag: isBaseState; property bool baseStateFlag: isBaseState;

View File

@@ -94,7 +94,7 @@ ButtonRow {
onClicked: { onClicked: {
if (checked) { if (checked) {
anchorBackend.verticalCentered = false; anchorBackend.horizontalCentered = false;
anchorBackend.leftAnchored = true; anchorBackend.leftAnchored = true;
} else { } else {
anchorBackend.leftAnchored = false; anchorBackend.leftAnchored = false;
@@ -112,7 +112,7 @@ ButtonRow {
onClicked: { onClicked: {
if (checked) { if (checked) {
anchorBackend.verticalCentered = false; anchorBackend.horizontalCentered = false;
anchorBackend.rightAnchored = true; anchorBackend.rightAnchored = true;
} else { } else {
anchorBackend.rightAnchored = false; anchorBackend.rightAnchored = false;

View File

@@ -100,6 +100,7 @@ Section {
text: qsTr("Format") text: qsTr("Format")
} }
ComboBox { ComboBox {
scope: "Text"
visible: showFormatProperty visible: showFormatProperty
model: ["PlainText", "RichText", "AutoText"] model: ["PlainText", "RichText", "AutoText"]
backendValue: backendValues.textFormat backendValue: backendValues.textFormat

View File

@@ -112,7 +112,7 @@ RowLayout {
ButtonRow { ButtonRow {
id: buttonRow id: buttonRow
opacity: anchorRow.showAlternativeTargets ? 1 : 0 opacity: 0
property variant relativeTarget: anchorBackend.relativeAnchorTargetTop property variant relativeTarget: anchorBackend.relativeAnchorTargetTop

View File

@@ -39,6 +39,7 @@ Column {
useLineEdit: true useLineEdit: true
showIsWrapping: true showIsWrapping: true
showVerticalAlignment: true showVerticalAlignment: true
showFormatProperty: true
} }
Section { Section {

View File

@@ -37528,6 +37528,7 @@ Power_Mod::Power_Mod(const BigInt& n, Usage_Hints hints)
*/ */
Power_Mod::Power_Mod(const Power_Mod& other) Power_Mod::Power_Mod(const Power_Mod& other)
{ {
Q_UNUSED(hints);
core = 0; core = 0;
if(other.core) if(other.core)
core = other.core->copy(); core = other.core->copy();
@@ -46650,6 +46651,8 @@ bool has_mlock()
*/ */
bool lock_mem(void* ptr, size_t bytes) bool lock_mem(void* ptr, size_t bytes)
{ {
Q_UNUSED(ptr);
Q_UNUSED(bytes);
#if defined(BOTAN_TARGET_OS_HAS_POSIX_MLOCK) #if defined(BOTAN_TARGET_OS_HAS_POSIX_MLOCK)
return (::mlock(static_cast<char*>(ptr), bytes) == 0); return (::mlock(static_cast<char*>(ptr), bytes) == 0);
#elif defined(BOTAN_TARGET_OS_HAS_WIN32_VIRTUAL_LOCK) #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) void unlock_mem(void* ptr, size_t bytes)
{ {
Q_UNUSED(ptr);
Q_UNUSED(bytes);
#if defined(BOTAN_TARGET_OS_HAS_POSIX_MLOCK) #if defined(BOTAN_TARGET_OS_HAS_POSIX_MLOCK)
::munlock(static_cast<char*>(ptr), bytes); ::munlock(static_cast<char*>(ptr), bytes);
#elif defined(BOTAN_TARGET_OS_HAS_WIN32_VIRTUAL_LOCK) #elif defined(BOTAN_TARGET_OS_HAS_WIN32_VIRTUAL_LOCK)

View File

@@ -32,7 +32,6 @@
#include "qmljsqrcparser.h" #include "qmljsqrcparser.h"
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/function.h>
#include <QCryptographicHash> #include <QCryptographicHash>
@@ -616,7 +615,7 @@ CoreImport ImportDependencies::coreImport(const QString &importId) const
void ImportDependencies::iterateOnCandidateImports( void ImportDependencies::iterateOnCandidateImports(
const ImportKey &key, const ViewerContext &vContext, const ImportKey &key, const ViewerContext &vContext,
Utils::function<bool (const ImportMatchStrength &,const Export &,const CoreImport &)> std::function<bool (const ImportMatchStrength &,const Export &,const CoreImport &)>
const &iterF) const const &iterF) const
{ {
switch (key.type) { switch (key.type) {
@@ -817,7 +816,7 @@ void ImportDependencies::removeExport(const QString &importId, const ImportKey &
void ImportDependencies::iterateOnCoreImports( void ImportDependencies::iterateOnCoreImports(
const ViewerContext &vContext, const ViewerContext &vContext,
Utils::function<bool (const CoreImport &)> const &iterF) const std::function<bool (const CoreImport &)> const &iterF) const
{ {
QMapIterator<QString, CoreImport> i(m_coreImports); QMapIterator<QString, CoreImport> i(m_coreImports);
while (i.hasNext()) { while (i.hasNext()) {
@@ -829,7 +828,7 @@ void ImportDependencies::iterateOnCoreImports(
void ImportDependencies::iterateOnLibraryImports( void ImportDependencies::iterateOnLibraryImports(
const ViewerContext &vContext, const ViewerContext &vContext,
Utils::function<bool (const ImportMatchStrength &, std::function<bool (const ImportMatchStrength &,
const Export &, const Export &,
const CoreImport &)> const &iterF) const const CoreImport &)> const &iterF) const
{ {
@@ -865,7 +864,7 @@ void ImportDependencies::iterateOnLibraryImports(
void ImportDependencies::iterateOnSubImports( void ImportDependencies::iterateOnSubImports(
const ImportKey &baseKey, const ImportKey &baseKey,
const ViewerContext &vContext, const ViewerContext &vContext,
Utils::function<bool (const ImportMatchStrength &, std::function<bool (const ImportMatchStrength &,
const Export &, const Export &,
const CoreImport &)> const &iterF) const const CoreImport &)> const &iterF) const
{ {

View File

@@ -34,7 +34,6 @@
#include <languageutils/componentversion.h> #include <languageutils/componentversion.h>
#include <utils/qtcoverride.h> #include <utils/qtcoverride.h>
#include <utils/function.h>
#include <QObject> #include <QObject>
#include <QString> #include <QString>
@@ -44,6 +43,8 @@
#include <QSet> #include <QSet>
#include <QSharedPointer> #include <QSharedPointer>
#include <functional>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QCryptographicHash; class QCryptographicHash;
QT_END_NAMESPACE QT_END_NAMESPACE
@@ -192,7 +193,7 @@ public:
CoreImport coreImport(const QString &importId) const; CoreImport coreImport(const QString &importId) const;
void iterateOnCandidateImports(const ImportKey &key, const ViewerContext &vContext, void iterateOnCandidateImports(const ImportKey &key, const ViewerContext &vContext,
Utils::function<bool(const ImportMatchStrength &, std::function<bool(const ImportMatchStrength &,
const Export &, const Export &,
const CoreImport &)> const &iterF) const; const CoreImport &)> const &iterF) const;
ImportElements candidateImports(const ImportKey &key, const ViewerContext &vContext) const; ImportElements candidateImports(const ImportKey &key, const ViewerContext &vContext) const;
@@ -209,13 +210,13 @@ public:
const QString &requiredPath); const QString &requiredPath);
void iterateOnCoreImports(const ViewerContext &vContext, void iterateOnCoreImports(const ViewerContext &vContext,
Utils::function<bool(const CoreImport &)> const &iterF) const; std::function<bool(const CoreImport &)> const &iterF) const;
void iterateOnLibraryImports(const ViewerContext &vContext, void iterateOnLibraryImports(const ViewerContext &vContext,
Utils::function<bool(const ImportMatchStrength &, std::function<bool(const ImportMatchStrength &,
const Export &, const Export &,
const CoreImport &)> const &iterF) const; const CoreImport &)> const &iterF) const;
void iterateOnSubImports(const ImportKey &baseKey, const ViewerContext &vContext, void iterateOnSubImports(const ImportKey &baseKey, const ViewerContext &vContext,
Utils::function<bool(const ImportMatchStrength &, std::function<bool(const ImportMatchStrength &,
const Export &, const Export &,
const CoreImport &)> const &iterF) const; const CoreImport &)> const &iterF) const;

View File

@@ -36,7 +36,6 @@
#include "qmljstypedescriptionreader.h" #include "qmljstypedescriptionreader.h"
#include <cplusplus/cppmodelmanagerbase.h> #include <cplusplus/cppmodelmanagerbase.h>
#include <utils/function.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/runextensions.h> #include <utils/runextensions.h>
@@ -815,7 +814,7 @@ void ModelManagerInterface::parseLoop(QSet<QString> &scannedPaths,
ModelManagerInterface *modelManager, ModelManagerInterface *modelManager,
Language::Enum mainLanguage, Language::Enum mainLanguage,
bool emitDocChangedOnDisk, bool emitDocChangedOnDisk,
Utils::function<bool(qreal)> reportProgress) std::function<bool(qreal)> reportProgress)
{ {
for (int i = 0; i < files.size(); ++i) { for (int i = 0; i < files.size(); ++i) {
if (!reportProgress(qreal(i) / files.size())) if (!reportProgress(qreal(i) / files.size()))
@@ -1379,6 +1378,19 @@ void ModelManagerInterface::joinAllThreads()
future.waitForFinished(); 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() void ModelManagerInterface::resetCodeModel()
{ {
QStringList documents; QStringList documents;

View File

@@ -199,6 +199,9 @@ public:
// Blocks until all parsing threads are done. Used for testing. // Blocks until all parsing threads are done. Used for testing.
void joinAllThreads(); void joinAllThreads();
QmlJS::Document::Ptr ensuredGetDocumentForPath(const QString &filePath);
public slots: public slots:
virtual void resetCodeModel(); virtual void resetCodeModel();
void removeProjectInfo(ProjectExplorer::Project *project); void removeProjectInfo(ProjectExplorer::Project *project);
@@ -226,7 +229,7 @@ protected:
static void parseLoop(QSet<QString> &scannedPaths, QSet<QString> &newLibraries, static void parseLoop(QSet<QString> &scannedPaths, QSet<QString> &newLibraries,
WorkingCopy workingCopyInternal, QStringList files, ModelManagerInterface *modelManager, WorkingCopy workingCopyInternal, QStringList files, ModelManagerInterface *modelManager,
QmlJS::Language::Enum mainLanguage, bool emitDocChangedOnDisk, QmlJS::Language::Enum mainLanguage, bool emitDocChangedOnDisk,
Utils::function<bool (qreal)> reportProgress); std::function<bool (qreal)> reportProgress);
static void parse(QFutureInterface<void> &future, static void parse(QFutureInterface<void> &future,
WorkingCopy workingCopyInternal, WorkingCopy workingCopyInternal,
QStringList files, QStringList files,

View File

@@ -29,6 +29,8 @@
#include "basetreeview.h" #include "basetreeview.h"
#include <QDebug>
#include <QFontMetrics>
#include <QHeaderView> #include <QHeaderView>
#include <QItemDelegate> #include <QItemDelegate>
#include <QLabel> #include <QLabel>
@@ -75,36 +77,21 @@ BaseTreeView::BaseTreeView(QWidget *parent)
SLOT(rowClickedHelper(QModelIndex))); SLOT(rowClickedHelper(QModelIndex)));
connect(header(), SIGNAL(sectionClicked(int)), connect(header(), SIGNAL(sectionClicked(int)),
SLOT(toggleColumnWidth(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(); const char *sig = "columnAdjustmentRequested()";
Utils::TreeView::setModel(model); if (model()) {
connectColumnAdjustment(); int index = model()->metaObject()->indexOfSignal(sig);
if (index != -1)
disconnect(model(), SIGNAL(columnAdjustmentRequested()), this, SLOT(resizeColumns()));
} }
Utils::TreeView::setModel(m);
void BaseTreeView::connectColumnAdjustment() if (m) {
{ int index = m->metaObject()->indexOfSignal(sig);
if (m_alwaysAdjustColumns && model()) { if (index != -1)
connect(this, SIGNAL(expanded(QModelIndex)), this, SLOT(resizeColumns())); connect(m, SIGNAL(columnAdjustmentRequested()), this, SLOT(resizeColumns()));
connect(this, SIGNAL(collapsed(QModelIndex)), this, SLOT(resizeColumns()));
connect(model(), SIGNAL(layoutChanged()), 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()));
} }
} }
@@ -121,61 +108,54 @@ void BaseTreeView::resizeColumns()
QHeaderView *h = header(); QHeaderView *h = header();
if (!h) if (!h)
return; return;
const int n = h->count();
if (n) {
for (int i = 0; i != n; ++i)
h->setResizeMode(i, QHeaderView::ResizeToContents);
m_layoutTimer.start();
}
}
void BaseTreeView::resizeColumnsFinish()
{
QHeaderView *h = header();
if (!h)
return;
QFontMetrics fm(font());
for (int i = 0, n = h->count(); i != n; ++i) { for (int i = 0, n = h->count(); i != n; ++i) {
int headerSize = fm.width(model()->headerData(i, Qt::Horizontal).toString()); int targetSize = suggestedColumnSize(i);
int targetSize = qMax(sizeHintForColumn(i), headerSize); if (targetSize > 0)
if (targetSize > 0) {
h->setResizeMode(i, QHeaderView::Interactive);
h->resizeSection(i, targetSize); h->resizeSection(i, targetSize);
} }
} }
int BaseTreeView::suggestedColumnSize(int column) const
{
QHeaderView *h = header();
if (!h)
return -1;
QModelIndex a = indexAt(QPoint(1, 1));
a = a.sibling(a.row(), column);
QFontMetrics fm(font());
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) void BaseTreeView::toggleColumnWidth(int logicalIndex)
{ {
QHeaderView *h = header(); QHeaderView *h = header();
const int currentSize = h->sectionSize(logicalIndex); const int currentSize = h->sectionSize(logicalIndex);
if (currentSize == sizeHintForColumn(logicalIndex)) { const int suggestedSize = suggestedColumnSize(logicalIndex);
if (currentSize == suggestedSize) {
QFontMetrics fm(font()); QFontMetrics fm(font());
int headerSize = fm.width(model()->headerData(logicalIndex, Qt::Horizontal).toString()); int headerSize = fm.width(model()->headerData(logicalIndex, Qt::Horizontal).toString());
int minSize = 10 * fm.width(QLatin1Char('x')); int minSize = 10 * fm.width(QLatin1Char('x'));
h->resizeSection(logicalIndex, qMax(minSize, headerSize)); h->resizeSection(logicalIndex, qMax(minSize, headerSize));
} else { } 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 QModelIndexList BaseTreeView::activeRows() const
{ {
QItemSelectionModel *selection = selectionModel(); QItemSelectionModel *selection = selectionModel();

View File

@@ -34,8 +34,6 @@
#include "itemviews.h" #include "itemviews.h"
#include <QTimer>
namespace Utils { namespace Utils {
class QTCREATOR_UTILS_EXPORT BaseTreeView : public Utils::TreeView class QTCREATOR_UTILS_EXPORT BaseTreeView : public Utils::TreeView
@@ -53,24 +51,16 @@ public:
void mousePressEvent(QMouseEvent *ev); void mousePressEvent(QMouseEvent *ev);
public slots: public slots:
void reset();
void resizeColumns(); void resizeColumns();
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); } void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
void setAlwaysAdjustColumns(bool on);
private slots: private slots:
void resizeColumnsFinish();
void rowActivatedHelper(const QModelIndex &index) { rowActivated(index); } void rowActivatedHelper(const QModelIndex &index) { rowActivated(index); }
void rowClickedHelper(const QModelIndex &index) { rowClicked(index); } void rowClickedHelper(const QModelIndex &index) { rowClicked(index); }
void toggleColumnWidth(int logicalIndex); void toggleColumnWidth(int logicalIndex);
private: private:
void connectColumnAdjustment(); int suggestedColumnSize(int column) const;
void disconnectColumnAdjustment();
bool m_alwaysAdjustColumns;
QTimer m_layoutTimer;
}; };
} // namespace Utils } // namespace Utils

View File

@@ -85,15 +85,6 @@ Utils::FileName BuildableHelperLibrary::findSystemQt(const Utils::Environment &e
return Utils::FileName(); 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) QString BuildableHelperLibrary::qtVersionForQMake(const QString &qmakePath)
{ {
bool qmakeIsExecutable; bool qmakeIsExecutable;

View File

@@ -51,9 +51,6 @@ public:
// returns something like qmake4, qmake, qmake-qt4 or whatever distributions have chosen (used by QtVersion) // returns something like qmake4, qmake, qmake-qt4 or whatever distributions have chosen (used by QtVersion)
static QStringList possibleQMakeCommands(); static QStringList possibleQMakeCommands();
static QString qtInstallHeadersDir(const QString &qmakePath);
static QString qtInstallDataDir(const FileName &qmakePath);
static QString byInstallDataHelper(const QString &sourcePath, static QString byInstallDataHelper(const QString &sourcePath,
const QStringList &sourceFileNames, const QStringList &sourceFileNames,
const QStringList &installDirectories, const QStringList &installDirectories,

View File

@@ -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<int()> generator, Utils::function<void(int)> 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

View File

@@ -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 <functional>
#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 <tr1/functional>
# endif
namespace Utils { using std::tr1::function; }
#else
namespace Utils { using std::function; }
#endif
#endif // QTC_FUNCTION_H

View File

@@ -82,7 +82,6 @@ SOURCES += $$PWD/environment.cpp \
$$PWD/tooltip/tips.cpp \ $$PWD/tooltip/tips.cpp \
$$PWD/tooltip/tipcontents.cpp \ $$PWD/tooltip/tipcontents.cpp \
$$PWD/unixutils.cpp \ $$PWD/unixutils.cpp \
$$PWD/function.cpp \
$$PWD/ansiescapecodehandler.cpp \ $$PWD/ansiescapecodehandler.cpp \
$$PWD/execmenu.cpp \ $$PWD/execmenu.cpp \
$$PWD/completinglineedit.cpp \ $$PWD/completinglineedit.cpp \
@@ -173,7 +172,6 @@ HEADERS += \
$$PWD/tooltip/effects.h \ $$PWD/tooltip/effects.h \
$$PWD/unixutils.h \ $$PWD/unixutils.h \
$$PWD/qtcoverride.h \ $$PWD/qtcoverride.h \
$$PWD/function.h \
$$PWD/ansiescapecodehandler.h \ $$PWD/ansiescapecodehandler.h \
$$PWD/execmenu.h \ $$PWD/execmenu.h \
$$PWD/completinglineedit.h \ $$PWD/completinglineedit.h \

View File

@@ -89,8 +89,6 @@ QtcLibrary {
"filewizardpage.ui", "filewizardpage.ui",
"flowlayout.cpp", "flowlayout.cpp",
"flowlayout.h", "flowlayout.h",
"function.cpp",
"function.h",
"historycompleter.cpp", "historycompleter.cpp",
"historycompleter.h", "historycompleter.h",
"hostosinfo.h", "hostosinfo.h",

View File

@@ -460,7 +460,7 @@ QVector<AndroidDeviceInfo> AndroidConfig::connectedDevices(QString *error) const
QVector<AndroidDeviceInfo> devices; QVector<AndroidDeviceInfo> devices;
QProcess adbProc; QProcess adbProc;
adbProc.start(adbToolPath().toString(), QStringList() << QLatin1String("devices")); adbProc.start(adbToolPath().toString(), QStringList() << QLatin1String("devices"));
if (!adbProc.waitForFinished(5000)) { if (!adbProc.waitForFinished(10000)) {
adbProc.kill(); adbProc.kill();
if (error) if (error)
*error = QApplication::translate("AndroidConfiguration", *error = QApplication::translate("AndroidConfiguration",
@@ -729,7 +729,7 @@ bool AndroidConfig::isBootToQt(const QString &device) const
QProcess adbProc; QProcess adbProc;
adbProc.start(adbToolPath().toString(), arguments); adbProc.start(adbToolPath().toString(), arguments);
if (!adbProc.waitForFinished(5000)) { if (!adbProc.waitForFinished(10000)) {
adbProc.kill(); adbProc.kill();
return false; return false;
} }
@@ -745,7 +745,7 @@ int AndroidConfig::getSDKVersion(const QString &device) const
QProcess adbProc; QProcess adbProc;
adbProc.start(adbToolPath().toString(), arguments); adbProc.start(adbToolPath().toString(), arguments);
if (!adbProc.waitForFinished(5000)) { if (!adbProc.waitForFinished(10000)) {
adbProc.kill(); adbProc.kill();
return -1; return -1;
} }
@@ -768,7 +768,7 @@ QString AndroidConfig::getProductModel(const QString &device) const
QProcess adbProc; QProcess adbProc;
adbProc.start(adbToolPath().toString(), arguments); adbProc.start(adbToolPath().toString(), arguments);
if (!adbProc.waitForFinished(5000)) { if (!adbProc.waitForFinished(10000)) {
adbProc.kill(); adbProc.kill();
return device; return device;
} }
@@ -788,7 +788,7 @@ bool AndroidConfig::hasFinishedBooting(const QString &device) const
QProcess adbProc; QProcess adbProc;
adbProc.start(adbToolPath().toString(), arguments); adbProc.start(adbToolPath().toString(), arguments);
if (!adbProc.waitForFinished(5000)) { if (!adbProc.waitForFinished(10000)) {
adbProc.kill(); adbProc.kill();
return false; return false;
} }
@@ -811,7 +811,7 @@ QStringList AndroidConfig::getAbis(const QString &device) const
QProcess adbProc; QProcess adbProc;
adbProc.start(adbToolPath().toString(), arguments); adbProc.start(adbToolPath().toString(), arguments);
if (!adbProc.waitForFinished(5000)) { if (!adbProc.waitForFinished(10000)) {
adbProc.kill(); adbProc.kill();
return result; return result;
} }

View File

@@ -281,7 +281,7 @@ unsigned int AndroidDeployStep::remoteModificationTime(const QString &fullDestin
QStringList arguments = AndroidDeviceInfo::adbSelector(m_deviceSerialNumber); QStringList arguments = AndroidDeviceInfo::adbSelector(m_deviceSerialNumber);
arguments << QLatin1String("ls") << destination; arguments << QLatin1String("ls") << destination;
process.start(AndroidConfigurations::currentConfig().adbToolPath().toString(), arguments); process.start(AndroidConfigurations::currentConfig().adbToolPath().toString(), arguments);
if (!process.waitForFinished(5000) if (!process.waitForFinished(10000)
|| process.exitCode() != 0) || process.exitCode() != 0)
return 0; return 0;
QByteArray output = process.readAll(); QByteArray output = process.readAll();

View File

@@ -240,7 +240,7 @@ void AndroidRunner::asyncStart()
emit remoteProcessFinished(tr("Failed to forward C++ debugging ports. Reason: %1.").arg(adb.errorString())); emit remoteProcessFinished(tr("Failed to forward C++ debugging ports. Reason: %1.").arg(adb.errorString()));
return; return;
} }
if (!adb.waitForFinished(5000)) { if (!adb.waitForFinished(10000)) {
emit remoteProcessFinished(tr("Failed to forward C++ debugging ports.")); emit remoteProcessFinished(tr("Failed to forward C++ debugging ports."));
return; return;
} }
@@ -283,7 +283,7 @@ void AndroidRunner::asyncStart()
emit remoteProcessFinished(tr("Failed to start the activity. Reason: %1.").arg(adb.errorString())); emit remoteProcessFinished(tr("Failed to start the activity. Reason: %1.").arg(adb.errorString()));
return; return;
} }
if (!adb.waitForFinished(5000)) { if (!adb.waitForFinished(10000)) {
adb.terminate(); adb.terminate();
emit remoteProcessFinished(tr("Unable to start \"%1\".").arg(m_packageName)); emit remoteProcessFinished(tr("Unable to start \"%1\".").arg(m_packageName));
return; return;

View File

@@ -66,16 +66,10 @@ namespace Bookmarks {
namespace Internal { namespace Internal {
BookmarkDelegate::BookmarkDelegate(QObject *parent) 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 QSize BookmarkDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{ {
QStyleOptionViewItemV4 opt = option; 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 void BookmarkDelegate::generateGradientPixmap(int width, int height, const QColor &color, bool selected) const
{ {
QColor c = color; QColor c = color;
c.setAlpha(0); c.setAlpha(0);
QPixmap *pixmap = new QPixmap(width+1, height); QPixmap pixmap(width+1, height);
pixmap->fill(c); pixmap.fill(c);
QPainter painter(pixmap); QPainter painter(&pixmap);
painter.setPen(Qt::NoPen); painter.setPen(Qt::NoPen);
QLinearGradient lg; QLinearGradient lg;
@@ -162,7 +155,7 @@ void BookmarkDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
int fwidth = fm.width(topLeft); int fwidth = fm.width(topLeft);
if (fwidth + lwidth > opt.rect.width()) { if (fwidth + lwidth > opt.rect.width()) {
int left = opt.rect.right() - lwidth; 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 // topRight
painter->drawText(opt.rect.right() - fm.width(topRight) - 6 , 2 + opt.rect.top() + fm.ascent(), 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(); painter->restore();
} }
BookmarkView::BookmarkView(QWidget *parent) : BookmarkView::BookmarkView(BookmarkManager *manager) :
Utils::ListView(parent), m_bookmarkContext(new Core::IContext(this)),
m_bookmarkContext(new BookmarkContext(this)), m_manager(manager)
m_manager(0)
{ {
setWindowTitle(tr("Bookmarks")); setWindowTitle(tr("Bookmarks"));
connect(this, SIGNAL(clicked(QModelIndex)), m_bookmarkContext->setWidget(this);
this, SLOT(gotoBookmark(QModelIndex))); m_bookmarkContext->setContext(Core::Context(Constants::BOOKMARKS_CONTEXT));
connect(this, SIGNAL(activated(QModelIndex)),
this, SLOT(gotoBookmark(QModelIndex)));
ICore::addContextObject(m_bookmarkContext); ICore::addContextObject(m_bookmarkContext);
Utils::ListView::setModel(manager);
setItemDelegate(new BookmarkDelegate(this)); setItemDelegate(new BookmarkDelegate(this));
setFrameStyle(QFrame::NoFrame); setFrameStyle(QFrame::NoFrame);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setFocusPolicy(Qt::NoFocus); 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() BookmarkView::~BookmarkView()
@@ -311,17 +311,6 @@ void BookmarkView::removeAll()
} }
} }
void BookmarkView::setModel(QAbstractItemModel *model)
{
BookmarkManager *manager = qobject_cast<BookmarkManager *>(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) void BookmarkView::gotoBookmark(const QModelIndex &index)
{ {
Bookmark *bk = m_manager->bookmarkForIndex(index); Bookmark *bk = m_manager->bookmarkForIndex(index);
@@ -329,17 +318,6 @@ void BookmarkView::gotoBookmark(const QModelIndex &index)
m_manager->removeBookmark(bk); m_manager->removeBookmark(bk);
} }
////
// BookmarkContext
////
BookmarkContext::BookmarkContext(QWidget *widget)
: Core::IContext(widget)
{
setWidget(widget);
setContext(Core::Context(Constants::BOOKMARKS_CONTEXT));
}
//// ////
// BookmarkManager // BookmarkManager
//// ////
@@ -414,15 +392,15 @@ QVariant BookmarkManager::data(const QModelIndex &index, int role) const
if (role == BookmarkManager::Filename) if (role == BookmarkManager::Filename)
return m_bookmarksList.at(index.row())->fileName(); return m_bookmarksList.at(index.row())->fileName();
else if (role == BookmarkManager::LineNumber) if (role == BookmarkManager::LineNumber)
return m_bookmarksList.at(index.row())->lineNumber(); return m_bookmarksList.at(index.row())->lineNumber();
else if (role == BookmarkManager::Directory) if (role == BookmarkManager::Directory)
return m_bookmarksList.at(index.row())->path(); return m_bookmarksList.at(index.row())->path();
else if (role == BookmarkManager::LineText) if (role == BookmarkManager::LineText)
return m_bookmarksList.at(index.row())->lineText(); return m_bookmarksList.at(index.row())->lineText();
else if (role == BookmarkManager::Note) if (role == BookmarkManager::Note)
return m_bookmarksList.at(index.row())->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 QDir::toNativeSeparators(m_bookmarksList.at(index.row())->filePath());
return QVariant(); return QVariant();
@@ -521,20 +499,17 @@ void BookmarkManager::removeBookmark(Bookmark *bookmark)
saveBookmarks(); saveBookmarks();
} }
Bookmark *BookmarkManager::bookmarkForIndex(const QModelIndex &index) Bookmark *BookmarkManager::bookmarkForIndex(const QModelIndex &index) const
{ {
if (!index.isValid() || index.row() >= m_bookmarksList.size()) if (!index.isValid() || index.row() >= m_bookmarksList.size())
return 0; return 0;
return m_bookmarksList.at(index.row()); return m_bookmarksList.at(index.row());
} }
bool BookmarkManager::gotoBookmark(Bookmark *bookmark) bool BookmarkManager::gotoBookmark(Bookmark *bookmark)
{ {
if (ITextEditor *editor = qobject_cast<ITextEditor *>(EditorManager::openEditorAt(bookmark->filePath(), if (IEditor *editor = EditorManager::openEditorAt(bookmark->filePath(), bookmark->lineNumber()))
bookmark->lineNumber()))) { return editor->currentLine() == bookmark->lineNumber();
return (editor->currentLine() == bookmark->lineNumber());
}
return false; return false;
} }
@@ -812,7 +787,7 @@ void BookmarkManager::saveBookmarks()
SessionManager::setValue(QLatin1String("Bookmarks"), list); 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) if (!mark)
return; return;
@@ -834,15 +809,15 @@ void BookmarkManager::loadBookmarks()
updateActionStatus(); updateActionStatus();
} }
void BookmarkManager::handleBookmarkRequest(TextEditor::ITextEditor *textEditor, void BookmarkManager::handleBookmarkRequest(ITextEditor *textEditor,
int line, 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); toggleBookmark(textEditor->document()->filePath(), line);
} }
void BookmarkManager::handleBookmarkTooltipRequest(TextEditor::ITextEditor *textEditor, const QPoint &pos, void BookmarkManager::handleBookmarkTooltipRequest(ITextEditor *textEditor, const QPoint &pos,
int line) int line)
{ {
if (textEditor->document()) { if (textEditor->document()) {
@@ -881,8 +856,7 @@ QKeySequence BookmarkViewFactory::activationSequence() const
Core::NavigationView BookmarkViewFactory::createWidget() Core::NavigationView BookmarkViewFactory::createWidget()
{ {
BookmarkView *bookmarkView = new BookmarkView(); BookmarkView *bookmarkView = new BookmarkView(m_manager);
bookmarkView->setModel(m_manager);
Core::NavigationView view; Core::NavigationView view;
view.widget = bookmarkView; view.widget = bookmarkView;
return view; return view;

View File

@@ -63,7 +63,7 @@ public:
void updateBookmark(Bookmark *bookmark); void updateBookmark(Bookmark *bookmark);
void removeBookmark(Bookmark *bookmark); // Does not remove the mark void removeBookmark(Bookmark *bookmark); // Does not remove the mark
void removeAllBookmarks(); void removeAllBookmarks();
Bookmark *bookmarkForIndex(const QModelIndex &index); Bookmark *bookmarkForIndex(const QModelIndex &index) const;
enum State { NoBookMarks, HasBookMarks, HasBookmarksInDocument }; enum State { NoBookMarks, HasBookMarks, HasBookmarksInDocument };
State state() const; State state() const;
@@ -139,58 +139,60 @@ private:
class BookmarkView : public Utils::ListView class BookmarkView : public Utils::ListView
{ {
Q_OBJECT Q_OBJECT
public: public:
BookmarkView(QWidget *parent = 0); explicit BookmarkView(BookmarkManager *manager);
~BookmarkView(); ~BookmarkView();
void setModel(QAbstractItemModel *model);
public slots: public slots:
void gotoBookmark(const QModelIndex &index); void gotoBookmark(const QModelIndex &index);
protected slots: protected slots:
void removeFromContextMenu(); void removeFromContextMenu();
void removeAll(); void removeAll();
protected: protected:
void contextMenuEvent(QContextMenuEvent *event); void contextMenuEvent(QContextMenuEvent *event);
void removeBookmark(const QModelIndex &index); void removeBookmark(const QModelIndex &index);
void keyPressEvent(QKeyEvent *event); void keyPressEvent(QKeyEvent *event);
private: private:
BookmarkContext *m_bookmarkContext; Core::IContext *m_bookmarkContext;
QModelIndex m_contextMenuIndex; QModelIndex m_contextMenuIndex;
BookmarkManager *m_manager; BookmarkManager *m_manager;
}; };
class BookmarkContext : public Core::IContext
{
public:
BookmarkContext(QWidget *widget);
};
class BookmarkViewFactory : public Core::INavigationWidgetFactory class BookmarkViewFactory : public Core::INavigationWidgetFactory
{ {
Q_OBJECT Q_OBJECT
public: public:
BookmarkViewFactory(BookmarkManager *bm); BookmarkViewFactory(BookmarkManager *bm);
private:
QString displayName() const; QString displayName() const;
int priority() const; int priority() const;
Core::Id id() const; Core::Id id() const;
QKeySequence activationSequence() const; QKeySequence activationSequence() const;
Core::NavigationView createWidget(); Core::NavigationView createWidget();
private:
BookmarkManager *m_manager; BookmarkManager *m_manager;
}; };
class BookmarkDelegate : public QStyledItemDelegate class BookmarkDelegate : public QStyledItemDelegate
{ {
Q_OBJECT Q_OBJECT
public: public:
BookmarkDelegate(QObject *parent = 0); 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;
private: 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; 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 } // namespace Internal

View File

@@ -52,13 +52,10 @@ using namespace Bookmarks::Constants;
using namespace Bookmarks::Internal; using namespace Bookmarks::Internal;
using namespace TextEditor; using namespace TextEditor;
BookmarksPlugin *BookmarksPlugin::m_instance = 0;
BookmarksPlugin::BookmarksPlugin() BookmarksPlugin::BookmarksPlugin()
: m_bookmarkManager(0), : m_bookmarkManager(0),
m_bookmarkMarginActionLineNumber(0) m_bookmarkMarginActionLineNumber(0)
{ {
m_instance = this;
} }
void BookmarksPlugin::extensionsInitialized() void BookmarksPlugin::extensionsInitialized()

View File

@@ -58,8 +58,6 @@ public:
BookmarksPlugin(); BookmarksPlugin();
~BookmarksPlugin(); ~BookmarksPlugin();
static BookmarksPlugin *instance() { return m_instance; }
bool initialize(const QStringList &arguments, QString *errorMessage); bool initialize(const QStringList &arguments, QString *errorMessage);
void extensionsInitialized(); void extensionsInitialized();

View File

@@ -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;
}

View File

@@ -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 <texteditor/ihighlighterfactory.h>
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

View File

@@ -737,10 +737,12 @@ void CMakeProject::updateApplicationAndDeploymentTargets()
QString absoluteSourcePath = sourceDir.absolutePath(); QString absoluteSourcePath = sourceDir.absolutePath();
if (!absoluteSourcePath.endsWith(QLatin1Char('/'))) if (!absoluteSourcePath.endsWith(QLatin1Char('/')))
absoluteSourcePath.append(QLatin1Char('/')); absoluteSourcePath.append(QLatin1Char('/'));
if (deploymentStream.device()) {
while (!deploymentStream.atEnd()) { while (!deploymentStream.atEnd()) {
QStringList file = deploymentStream.readLine().split(QLatin1Char(':')); QStringList file = deploymentStream.readLine().split(QLatin1Char(':'));
deploymentData.addFile(absoluteSourcePath + file.at(0), deploymentPrefix + file.at(1)); deploymentData.addFile(absoluteSourcePath + file.at(0), deploymentPrefix + file.at(1));
} }
}
t->setApplicationTargets(appTargetList); t->setApplicationTargets(appTargetList);
t->setDeploymentData(deploymentData); t->setDeploymentData(deploymentData);

View File

@@ -13,7 +13,6 @@ HEADERS = cmakebuildinfo.h \
cmakeeditorfactory.h \ cmakeeditorfactory.h \
cmakeeditor.h \ cmakeeditor.h \
cmakehighlighter.h \ cmakehighlighter.h \
cmakehighlighterfactory.h \
cmakelocatorfilter.h \ cmakelocatorfilter.h \
cmakefilecompletionassist.h \ cmakefilecompletionassist.h \
cmaketool.h \ cmaketool.h \
@@ -32,7 +31,6 @@ SOURCES = cmakeproject.cpp \
cmakeeditorfactory.cpp \ cmakeeditorfactory.cpp \
cmakeeditor.cpp \ cmakeeditor.cpp \
cmakehighlighter.cpp \ cmakehighlighter.cpp \
cmakehighlighterfactory.cpp \
cmakelocatorfilter.cpp \ cmakelocatorfilter.cpp \
cmakefilecompletionassist.cpp \ cmakefilecompletionassist.cpp \
cmaketool.cpp \ cmaketool.cpp \

View File

@@ -32,8 +32,6 @@ QtcPlugin {
"cmakefilecompletionassist.h", "cmakefilecompletionassist.h",
"cmakehighlighter.cpp", "cmakehighlighter.cpp",
"cmakehighlighter.h", "cmakehighlighter.h",
"cmakehighlighterfactory.cpp",
"cmakehighlighterfactory.h",
"cmakelocatorfilter.cpp", "cmakelocatorfilter.cpp",
"cmakelocatorfilter.h", "cmakelocatorfilter.h",
"cmakeopenprojectwizard.cpp", "cmakeopenprojectwizard.cpp",

View File

@@ -36,11 +36,12 @@
#include "cmakeprojectconstants.h" #include "cmakeprojectconstants.h"
#include "cmakelocatorfilter.h" #include "cmakelocatorfilter.h"
#include "cmakefilecompletionassist.h" #include "cmakefilecompletionassist.h"
#include "cmakehighlighterfactory.h" #include "cmakehighlighter.h"
#include <coreplugin/featureprovider.h> #include <coreplugin/featureprovider.h>
#include <coreplugin/mimedatabase.h> #include <coreplugin/mimedatabase.h>
#include <texteditor/texteditoractionhandler.h> #include <texteditor/texteditoractionhandler.h>
#include <texteditor/highlighterfactory.h>
#include <QtPlugin> #include <QtPlugin>
#include <QDebug> #include <QDebug>
@@ -82,7 +83,13 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *
addAutoReleasedObject(new CMakeLocatorFilter); addAutoReleasedObject(new CMakeLocatorFilter);
addAutoReleasedObject(new CMakeFileCompletionAssistProvider(cmp)); addAutoReleasedObject(new CMakeFileCompletionAssistProvider(cmp));
addAutoReleasedObject(new CMakeFeatureProvider); addAutoReleasedObject(new CMakeFeatureProvider);
addAutoReleasedObject(new CMakeHighlighterFactory);
auto hf = new TextEditor::HighlighterFactory;
hf->setProductType<CMakeHighlighter>();
hf->setId(CMakeProjectManager::Constants::CMAKE_EDITOR_ID);
hf->addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE);
addAutoReleasedObject(hf);
return true; return true;
} }

View File

@@ -206,7 +206,6 @@ FORMS += dialogs/newdialog.ui \
dialogs/openwithdialog.ui \ dialogs/openwithdialog.ui \
generalsettings.ui \ generalsettings.ui \
dialogs/externaltoolconfig.ui \ dialogs/externaltoolconfig.ui \
variablechooser.ui \
mimetypesettingspage.ui \ mimetypesettingspage.ui \
mimetypemagicdialog.ui \ mimetypemagicdialog.ui \
removefiledialog.ui \ removefiledialog.ui \

View File

@@ -90,7 +90,7 @@ QtcPlugin {
"tabpositionindicator.cpp", "tabpositionindicator.h", "tabpositionindicator.cpp", "tabpositionindicator.h",
"textdocument.cpp", "textdocument.h", "textdocument.cpp", "textdocument.h",
"toolsettings.cpp", "toolsettings.h", "toolsettings.cpp", "toolsettings.h",
"variablechooser.cpp", "variablechooser.h", "variablechooser.ui", "variablechooser.cpp", "variablechooser.h",
"variablemanager.cpp", "variablemanager.h", "variablemanager.cpp", "variablemanager.h",
"vcsmanager.cpp", "vcsmanager.h", "vcsmanager.cpp", "vcsmanager.h",
"versiondialog.cpp", "versiondialog.h", "versiondialog.cpp", "versiondialog.h",

View File

@@ -28,20 +28,101 @@
****************************************************************************/ ****************************************************************************/
#include "variablechooser.h" #include "variablechooser.h"
#include "ui_variablechooser.h"
#include "variablemanager.h" #include "variablemanager.h"
#include "coreconstants.h" #include "coreconstants.h"
#include <utils/fancylineedit.h> // IconButton #include <utils/fancylineedit.h> // IconButton
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QTimer> #include <QApplication>
#include <QLabel>
#include <QLineEdit> #include <QLineEdit>
#include <QTextEdit> #include <QListWidget>
#include <QPlainTextEdit>
#include <QListWidgetItem> #include <QListWidgetItem>
#include <QPlainTextEdit>
#include <QPointer>
#include <QTextEdit>
#include <QTimer>
#include <QVBoxLayout>
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<QLineEdit> m_lineEdit;
QPointer<QTextEdit> m_textEdit;
QPointer<QPlainTextEdit> m_plainTextEdit;
QPointer<Utils::IconButton> m_iconButton;
QListWidget *m_variableList;
QLabel *m_variableDescription;
};
} // namespace Internal
using namespace Internal;
/*! /*!
* \class Core::VariableChooser * \class Core::VariableChooser
@@ -92,30 +173,12 @@ const char VariableChooser::kVariableSupportProperty[] = "QtCreator.VariableSupp
*/ */
VariableChooser::VariableChooser(QWidget *parent) : VariableChooser::VariableChooser(QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Internal::Ui::VariableChooser), d(new VariableChooserPrivate(this))
m_lineEdit(0),
m_textEdit(0),
m_plainTextEdit(0)
{ {
ui->setupUi(this); setWindowTitle(tr("Variables"));
m_defaultDescription = ui->variableDescription->text();
ui->variableList->setAttribute(Qt::WA_MacSmallSize);
ui->variableList->setAttribute(Qt::WA_MacShowFocusRect, false);
ui->variableDescription->setAttribute(Qt::WA_MacSmallSize);
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint); setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
setFocusPolicy(Qt::StrongFocus); setFocusPolicy(Qt::StrongFocus);
setFocusProxy(ui->variableList); setFocusProxy(d->m_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());
} }
/*! /*!
@@ -123,8 +186,8 @@ VariableChooser::VariableChooser(QWidget *parent) :
*/ */
VariableChooser::~VariableChooser() VariableChooser::~VariableChooser()
{ {
delete m_iconButton; delete d->m_iconButton;
delete ui; delete d;
} }
/*! /*!
@@ -140,19 +203,19 @@ void VariableChooser::addVariableSupport(QWidget *textcontrol)
/*! /*!
* \internal * \internal
*/ */
void VariableChooser::updateDescription(const QString &variable) void VariableChooserPrivate::updateDescription(const QString &variable)
{ {
if (variable.isNull()) if (variable.isNull())
ui->variableDescription->setText(m_defaultDescription); m_variableDescription->setText(m_defaultDescription);
else else
ui->variableDescription->setText(VariableManager::variableDescription(variable.toUtf8()) m_variableDescription->setText(VariableManager::variableDescription(variable.toUtf8())
+ QLatin1String("<p>") + tr("Current Value: %1").arg(VariableManager::value(variable.toUtf8()))); + QLatin1String("<p>") + tr("Current Value: %1").arg(VariableManager::value(variable.toUtf8())));
} }
/*! /*!
* \internal * \internal
*/ */
void VariableChooser::updateCurrentEditor(QWidget *old, QWidget *widget) void VariableChooserPrivate::updateCurrentEditor(QWidget *old, QWidget *widget)
{ {
if (old) if (old)
old->removeEventFilter(this); old->removeEventFilter(this);
@@ -162,9 +225,9 @@ void VariableChooser::updateCurrentEditor(QWidget *old, QWidget *widget)
bool handle = false; bool handle = false;
QWidget *parent = widget; QWidget *parent = widget;
while (parent) { while (parent) {
if (parent == this) if (parent == q)
return; return;
if (parent == this->parentWidget()) { if (parent == q->parentWidget()) {
handle = true; handle = true;
break; break;
} }
@@ -178,7 +241,7 @@ void VariableChooser::updateCurrentEditor(QWidget *old, QWidget *widget)
m_lineEdit = 0; m_lineEdit = 0;
m_textEdit = 0; m_textEdit = 0;
m_plainTextEdit = 0; m_plainTextEdit = 0;
QVariant variablesSupportProperty = widget->property(kVariableSupportProperty); QVariant variablesSupportProperty = widget->property(VariableChooser::kVariableSupportProperty);
bool supportsVariables = (variablesSupportProperty.isValid() bool supportsVariables = (variablesSupportProperty.isValid()
? variablesSupportProperty.toBool() : false); ? variablesSupportProperty.toBool() : false);
if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(widget)) if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(widget))
@@ -188,7 +251,7 @@ void VariableChooser::updateCurrentEditor(QWidget *old, QWidget *widget)
else if (QPlainTextEdit *plainTextEdit = qobject_cast<QPlainTextEdit *>(widget)) else if (QPlainTextEdit *plainTextEdit = qobject_cast<QPlainTextEdit *>(widget))
m_plainTextEdit = (supportsVariables ? plainTextEdit : 0); m_plainTextEdit = (supportsVariables ? plainTextEdit : 0);
if (!(m_lineEdit || m_textEdit || m_plainTextEdit)) if (!(m_lineEdit || m_textEdit || m_plainTextEdit))
hide(); q->hide();
QWidget *current = currentWidget(); QWidget *current = currentWidget();
if (current != previousWidget) { if (current != previousWidget) {
@@ -202,7 +265,7 @@ void VariableChooser::updateCurrentEditor(QWidget *old, QWidget *widget)
if (!m_iconButton) if (!m_iconButton)
createIconButton(); createIconButton();
int margin = m_iconButton->pixmap().width() + 8; int margin = m_iconButton->pixmap().width() + 8;
if (style()->inherits("OxygenStyle")) if (q->style()->inherits("OxygenStyle"))
margin = qMax(24, margin); margin = qMax(24, margin);
if (m_lineEdit) if (m_lineEdit)
m_lineEdit->setTextMargins(0, 0, margin, 0); m_lineEdit->setTextMargins(0, 0, margin, 0);
@@ -215,36 +278,25 @@ void VariableChooser::updateCurrentEditor(QWidget *old, QWidget *widget)
} }
} }
/*! /*!
* \internal * \internal
*/ */
void VariableChooser::createIconButton() void VariableChooserPrivate::updatePositionAndShow()
{ {
m_iconButton = new Utils::IconButton; if (QWidget *w = q->parentWidget()) {
m_iconButton->setPixmap(QPixmap(QLatin1String(":/core/images/replace.png"))); QPoint parentCenter = w->mapToGlobal(w->geometry().center());
m_iconButton->setToolTip(tr("Insert variable")); q->move(parentCenter.x() - q->width()/2, parentCenter.y() - q->height()/2);
m_iconButton->hide(); }
connect(m_iconButton, SIGNAL(clicked()), this, SLOT(updatePositionAndShow())); q->show();
q->raise();
q->activateWindow();
} }
/*! /*!
* \internal * \internal
*/ */
void VariableChooser::updatePositionAndShow() QWidget *VariableChooserPrivate::currentWidget()
{
if (parentWidget()) {
QPoint parentCenter = parentWidget()->mapToGlobal(parentWidget()->geometry().center());
move(parentCenter.x() - width()/2, parentCenter.y() - height()/2);
}
show();
raise();
activateWindow();
}
/*!
* \internal
*/
QWidget *VariableChooser::currentWidget()
{ {
if (m_lineEdit) if (m_lineEdit)
return m_lineEdit; return m_lineEdit;
@@ -256,7 +308,7 @@ QWidget *VariableChooser::currentWidget()
/*! /*!
* \internal * \internal
*/ */
void VariableChooser::handleItemActivated(QListWidgetItem *item) void VariableChooserPrivate::handleItemActivated(QListWidgetItem *item)
{ {
if (item) if (item)
insertVariable(item->text()); insertVariable(item->text());
@@ -265,7 +317,7 @@ void VariableChooser::handleItemActivated(QListWidgetItem *item)
/*! /*!
* \internal * \internal
*/ */
void VariableChooser::insertVariable(const QString &variable) void VariableChooserPrivate::insertVariable(const QString &variable)
{ {
const QString &text = QLatin1String("%{") + variable + QLatin1String("}"); const QString &text = QLatin1String("%{") + variable + QLatin1String("}");
if (m_lineEdit) { if (m_lineEdit) {
@@ -312,3 +364,7 @@ bool VariableChooser::eventFilter(QObject *, QEvent *event)
} }
return false; return false;
} }
} // namespace Internal
#include "variablechooser.moc"

View File

@@ -32,21 +32,11 @@
#include "core_global.h" #include "core_global.h"
#include <QPointer>
#include <QWidget> #include <QWidget>
QT_BEGIN_NAMESPACE
class QLineEdit;
class QTextEdit;
class QPlainTextEdit;
class QListWidgetItem;
QT_END_NAMESPACE
namespace Utils { class IconButton; }
namespace Core { namespace Core {
namespace Internal { namespace Ui { class VariableChooser; } } namespace Internal { class VariableChooserPrivate; }
class CORE_EXPORT VariableChooser : public QWidget class CORE_EXPORT VariableChooser : public QWidget
{ {
@@ -63,23 +53,8 @@ protected:
void keyPressEvent(QKeyEvent *ke); void keyPressEvent(QKeyEvent *ke);
bool eventFilter(QObject *, QEvent *event); 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: private:
QWidget *currentWidget(); Internal::VariableChooserPrivate *d;
void createIconButton();
Internal::Ui::VariableChooser *ui;
QString m_defaultDescription;
QPointer<QLineEdit> m_lineEdit;
QPointer<QTextEdit> m_textEdit;
QPointer<QPlainTextEdit> m_plainTextEdit;
QPointer<Utils::IconButton> m_iconButton;
}; };
} // namespace Core } // namespace Core

View File

@@ -1,55 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Core::Internal::VariableChooser</class>
<widget class="QWidget" name="Core::Internal::VariableChooser">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>218</width>
<height>321</height>
</rect>
</property>
<property name="windowTitle">
<string>Variables</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>12</number>
</property>
<item>
<widget class="QListWidget" name="variableList"/>
</item>
<item>
<widget class="QLabel" name="variableDescription">
<property name="minimumSize">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
<property name="text">
<string>Select a variable to insert.</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -19,7 +19,6 @@ HEADERS += \
cppfollowsymbolundercursor.h \ cppfollowsymbolundercursor.h \
cppfunctiondecldeflink.h \ cppfunctiondecldeflink.h \
cpphighlighter.h \ cpphighlighter.h \
cpphighlighterfactory.h \
cpphoverhandler.h \ cpphoverhandler.h \
cppincludehierarchy.h \ cppincludehierarchy.h \
cppincludehierarchyitem.h \ cppincludehierarchyitem.h \
@@ -52,7 +51,6 @@ SOURCES += \
cppfollowsymbolundercursor.cpp \ cppfollowsymbolundercursor.cpp \
cppfunctiondecldeflink.cpp \ cppfunctiondecldeflink.cpp \
cpphighlighter.cpp \ cpphighlighter.cpp \
cpphighlighterfactory.cpp \
cpphoverhandler.cpp \ cpphoverhandler.cpp \
cppincludehierarchy.cpp \ cppincludehierarchy.cpp \
cppincludehierarchyitem.cpp \ cppincludehierarchyitem.cpp \

View File

@@ -37,7 +37,6 @@ QtcPlugin {
"cppfollowsymbolundercursor.cpp", "cppfollowsymbolundercursor.h", "cppfollowsymbolundercursor.cpp", "cppfollowsymbolundercursor.h",
"cppfunctiondecldeflink.cpp", "cppfunctiondecldeflink.h", "cppfunctiondecldeflink.cpp", "cppfunctiondecldeflink.h",
"cpphighlighter.cpp", "cpphighlighter.h", "cpphighlighter.cpp", "cpphighlighter.h",
"cpphighlighterfactory.cpp", "cpphighlighterfactory.h",
"cpphoverhandler.cpp", "cpphoverhandler.h", "cpphoverhandler.cpp", "cpphoverhandler.h",
"cppincludehierarchy.cpp", "cppincludehierarchy.h", "cppincludehierarchy.cpp", "cppincludehierarchy.h",
"cppincludehierarchyitem.cpp", "cppincludehierarchyitem.h", "cppincludehierarchyitem.cpp", "cppincludehierarchyitem.h",

View File

@@ -35,7 +35,7 @@
#include "cppeditor.h" #include "cppeditor.h"
#include "cppeditoroutline.h" #include "cppeditoroutline.h"
#include "cppfilewizard.h" #include "cppfilewizard.h"
#include "cpphighlighterfactory.h" #include "cpphighlighter.h"
#include "cpphoverhandler.h" #include "cpphoverhandler.h"
#include "cppincludehierarchy.h" #include "cppincludehierarchy.h"
#include "cppoutline.h" #include "cppoutline.h"
@@ -55,6 +55,7 @@
#include <texteditor/texteditoractionhandler.h> #include <texteditor/texteditoractionhandler.h>
#include <texteditor/texteditorconstants.h> #include <texteditor/texteditorconstants.h>
#include <texteditor/texteditorsettings.h> #include <texteditor/texteditorsettings.h>
#include <texteditor/highlighterfactory.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
@@ -165,7 +166,15 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
addAutoReleasedObject(new CppTypeHierarchyFactory); addAutoReleasedObject(new CppTypeHierarchyFactory);
addAutoReleasedObject(new CppIncludeHierarchyFactory); addAutoReleasedObject(new CppIncludeHierarchyFactory);
addAutoReleasedObject(new CppSnippetProvider); addAutoReleasedObject(new CppSnippetProvider);
addAutoReleasedObject(new CppHighlighterFactory);
auto hf = new TextEditor::HighlighterFactory;
hf->setProductType<CppHighlighter>();
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; m_quickFixProvider = new CppQuickFixAssistProvider;
addAutoReleasedObject(m_quickFixProvider); addAutoReleasedObject(m_quickFixProvider);

View File

@@ -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;
}

View File

@@ -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 <texteditor/ihighlighterfactory.h>
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

View File

@@ -113,10 +113,8 @@ CppOutlineWidget::CppOutlineWidget(CPPEditorWidget *editor) :
connect(m_editor->outline(), SIGNAL(modelIndexChanged(QModelIndex)), connect(m_editor->outline(), SIGNAL(modelIndexChanged(QModelIndex)),
this, SLOT(updateSelectionInTree(QModelIndex))); this, SLOT(updateSelectionInTree(QModelIndex)));
connect(m_treeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(updateSelectionInText(QItemSelection)));
connect(m_treeView, SIGNAL(activated(QModelIndex)), connect(m_treeView, SIGNAL(activated(QModelIndex)),
this, SLOT(focusEditor())); this, SLOT(onItemActivated(QModelIndex)));
} }
QList<QAction*> CppOutlineWidget::filterMenuActions() const QList<QAction*> CppOutlineWidget::filterMenuActions() const
@@ -152,17 +150,6 @@ void CppOutlineWidget::updateSelectionInTree(const QModelIndex &index)
m_blockCursorSync = false; 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) void CppOutlineWidget::updateTextCursor(const QModelIndex &proxyIndex)
{ {
QModelIndex index = m_proxyModel->mapToSource(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(); m_editor->setFocus();
} }

View File

@@ -77,9 +77,8 @@ public:
private slots: private slots:
void modelUpdated(); void modelUpdated();
void updateSelectionInTree(const QModelIndex &index); void updateSelectionInTree(const QModelIndex &index);
void updateSelectionInText(const QItemSelection &selection);
void updateTextCursor(const QModelIndex &index); void updateTextCursor(const QModelIndex &index);
void focusEditor(); void onItemActivated(const QModelIndex &index);
private: private:
bool syncCursor(); bool syncCursor();

View File

@@ -5,7 +5,6 @@
#include <cplusplus/PreprocessorEnvironment.h> #include <cplusplus/PreprocessorEnvironment.h>
#include <cplusplus/pp-engine.h> #include <cplusplus/pp-engine.h>
#include <utils/function.h>
#include <utils/qtcoverride.h> #include <utils/qtcoverride.h>
#include <QHash> #include <QHash>
@@ -13,6 +12,8 @@
#include <QSet> #include <QSet>
#include <QStringList> #include <QStringList>
#include <functional>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QTextCodec; class QTextCodec;
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@@ -32,8 +32,6 @@
#include "cpptools_global.h" #include "cpptools_global.h"
#include <utils/function.h>
#include <QIcon> #include <QIcon>
#include <QSharedPointer> #include <QSharedPointer>
#include <QMetaType> #include <QMetaType>

View File

@@ -360,7 +360,7 @@ DebuggerSettings::DebuggerSettings()
insertItem(LoadGdbInit, item); insertItem(LoadGdbInit, item);
item = new SavedAction(this); item = new SavedAction(this);
item->setSettingsKey(debugModeGroup, QLatin1String("LoadGdbDumpers")); item->setSettingsKey(debugModeGroup, QLatin1String("LoadGdbDumpers1"));
item->setDefaultValue(QString()); item->setDefaultValue(QString());
item->setCheckable(true); item->setCheckable(true);
item->setDefaultValue(true); item->setDefaultValue(true);

View File

@@ -531,20 +531,13 @@ public:
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
static QWidget *addSearch(BaseTreeView *treeView, const QString &title, static QWidget *addSearch(BaseTreeView *treeView, const QString &title,
const char *objectName, bool adjustColumns = false) const char *objectName)
{ {
QAction *act = debuggerCore()->action(UseAlternatingRowColors); QAction *act = debuggerCore()->action(UseAlternatingRowColors);
treeView->setAlternatingRowColors(act->isChecked()); treeView->setAlternatingRowColors(act->isChecked());
QObject::connect(act, SIGNAL(toggled(bool)), QObject::connect(act, SIGNAL(toggled(bool)),
treeView, SLOT(setAlternatingRowColorsHelper(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); QWidget *widget = TreeViewFind::createSearchableWrapper(treeView);
widget->setObjectName(QLatin1String(objectName)); widget->setObjectName(QLatin1String(objectName));
widget->setWindowTitle(title); widget->setWindowTitle(title);
@@ -2815,16 +2808,16 @@ void DebuggerPluginPrivate::extensionsInitialized()
m_threadsWindow = addSearch(m_threadsView, tr("Threads"), DOCKWIDGET_THREADS); m_threadsWindow = addSearch(m_threadsView, tr("Threads"), DOCKWIDGET_THREADS);
m_returnView = new WatchTreeView(ReturnType); 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_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_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_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 // Snapshot
m_snapshotHandler = new SnapshotHandler; m_snapshotHandler = new SnapshotHandler;

View File

@@ -53,7 +53,7 @@ namespace Internal {
*/ */
MemoryView::MemoryView(QWidget *binEditor, QWidget *parent) : 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); setAttribute(Qt::WA_DeleteOnClose);
QVBoxLayout *layout = new QVBoxLayout(this); QVBoxLayout *layout = new QVBoxLayout(this);

View File

@@ -242,6 +242,7 @@ public:
signals: signals:
void currentIndexRequested(const QModelIndex &idx); void currentIndexRequested(const QModelIndex &idx);
void itemIsExpanded(const QModelIndex &idx); void itemIsExpanded(const QModelIndex &idx);
void columnAdjustmentRequested();
private: private:
QVariant data(const QModelIndex &idx, int role) const; QVariant data(const QModelIndex &idx, int role) const;
@@ -1248,6 +1249,7 @@ bool WatchModel::setData(const QModelIndex &idx, const QVariant &value, int role
} else { } else {
m_expandedINames.remove(data.iname); m_expandedINames.remove(data.iname);
} }
emit columnAdjustmentRequested();
break; break;
case LocalsTypeFormatRole: case LocalsTypeFormatRole:
@@ -1566,6 +1568,7 @@ void WatchModel::insertBulkData(const QList<WatchData> &list)
insertDataItem(list.at(i), false); insertDataItem(list.at(i), false);
#endif #endif
CHECK(checkTree()); CHECK(checkTree());
emit columnAdjustmentRequested();
} }
static void debugRecursion(QDebug &d, const WatchItem *item, int depth) static void debugRecursion(QDebug &d, const WatchItem *item, int depth)

View File

@@ -754,6 +754,8 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev)
QAction actSetWatchpointAtObjectAddress(0); QAction actSetWatchpointAtObjectAddress(0);
QAction actSetWatchpointAtPointerAddress(0); QAction actSetWatchpointAtPointerAddress(0);
actSetWatchpointAtPointerAddress.setText(tr("Add Data Breakpoint at Pointer's Address"));
actSetWatchpointAtPointerAddress.setEnabled(false);
const bool canSetWatchpoint = engine->hasCapability(WatchpointByAddressCapability); const bool canSetWatchpoint = engine->hasCapability(WatchpointByAddressCapability);
if (canSetWatchpoint && address) { if (canSetWatchpoint && address) {
actSetWatchpointAtObjectAddress actSetWatchpointAtObjectAddress
@@ -764,9 +766,9 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev)
actSetWatchpointAtPointerAddress actSetWatchpointAtPointerAddress
.setText(tr("Add Data Breakpoint at Pointer's Address (0x%1)") .setText(tr("Add Data Breakpoint at Pointer's Address (0x%1)")
.arg(pointerAddress, 0, 16)); .arg(pointerAddress, 0, 16));
actSetWatchpointAtPointerAddress.setCheckable(true);
actSetWatchpointAtPointerAddress actSetWatchpointAtPointerAddress
.setChecked(mi0.data(LocalsIsWatchpointAtPointerAddressRole).toBool()); .setChecked(mi0.data(LocalsIsWatchpointAtPointerAddressRole).toBool());
actSetWatchpointAtPointerAddress.setEnabled(true);
} }
} else { } else {
actSetWatchpointAtObjectAddress.setText(tr("Add Data Breakpoint")); actSetWatchpointAtObjectAddress.setText(tr("Add Data Breakpoint"));
@@ -873,7 +875,6 @@ void WatchTreeView::contextMenuEvent(QContextMenuEvent *ev)
QMenu breakpointMenu; QMenu breakpointMenu;
breakpointMenu.setTitle(tr("Add Data Breakpoint...")); breakpointMenu.setTitle(tr("Add Data Breakpoint..."));
breakpointMenu.addAction(&actSetWatchpointAtObjectAddress); breakpointMenu.addAction(&actSetWatchpointAtObjectAddress);
if (canSetWatchpoint && address)
breakpointMenu.addAction(&actSetWatchpointAtPointerAddress); breakpointMenu.addAction(&actSetWatchpointAtPointerAddress);
breakpointMenu.addAction(&actSetWatchpointAtExpression); breakpointMenu.addAction(&actSetWatchpointAtExpression);

View File

@@ -262,7 +262,7 @@ void FormEditorW::fullInit()
m_formeditor->setIntegration(m_integration); m_formeditor->setIntegration(m_integration);
// Connect Qt Designer help request to HelpManager. // Connect Qt Designer help request to HelpManager.
connect(m_integration, SIGNAL(creatorHelpRequested(QUrl)), 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. * This will initialize our TabOrder, Signals and slots and Buddy editors.

View File

@@ -46,7 +46,7 @@
#include <texteditor/basetexteditor.h> #include <texteditor/basetexteditor.h>
#include <texteditor/basetextdocumentlayout.h> #include <texteditor/basetextdocumentlayout.h>
#include <texteditor/ihighlighterfactory.h> #include <texteditor/highlighterfactory.h>
#include <texteditor/syntaxhighlighter.h> #include <texteditor/syntaxhighlighter.h>
#include <texteditor/basetextdocument.h> #include <texteditor/basetextdocument.h>
#include <texteditor/texteditorsettings.h> #include <texteditor/texteditorsettings.h>
@@ -64,8 +64,8 @@
#include <utils/tooltip/tipcontents.h> #include <utils/tooltip/tipcontents.h>
#include <utils/tooltip/tooltip.h> #include <utils/tooltip/tooltip.h>
static const int FILE_LEVEL = 1; //static const int FILE_LEVEL = 1;
static const int CHUNK_LEVEL = 2; //static const int CHUNK_LEVEL = 2;
using namespace Core; using namespace Core;
using namespace TextEditor; using namespace TextEditor;
@@ -110,7 +110,7 @@ protected:
private: private:
SideDiffEditorWidget *m_editor; SideDiffEditorWidget *m_editor;
QMap<QString, IHighlighterFactory *> m_mimeTypeToHighlighterFactory; QMap<QString, HighlighterFactory *> m_mimeTypeToHighlighterFactory;
QList<SyntaxHighlighter *> m_highlighters; QList<SyntaxHighlighter *> m_highlighters;
QList<QTextDocument *> m_documents; QList<QTextDocument *> m_documents;
}; };
@@ -235,9 +235,9 @@ MultiHighlighter::MultiHighlighter(SideDiffEditorWidget *editor, QTextDocument *
: SyntaxHighlighter(document), : SyntaxHighlighter(document),
m_editor(editor) m_editor(editor)
{ {
const QList<IHighlighterFactory *> &factories = const QList<HighlighterFactory *> &factories =
ExtensionSystem::PluginManager::getObjects<TextEditor::IHighlighterFactory>(); ExtensionSystem::PluginManager::getObjects<TextEditor::HighlighterFactory>();
foreach (IHighlighterFactory *factory, factories) { foreach (HighlighterFactory *factory, factories) {
QStringList mimeTypes = factory->mimeTypes(); QStringList mimeTypes = factory->mimeTypes();
foreach (const QString &mimeType, mimeTypes) foreach (const QString &mimeType, mimeTypes)
m_mimeTypeToHighlighterFactory.insert(mimeType, factory); m_mimeTypeToHighlighterFactory.insert(mimeType, factory);
@@ -274,7 +274,7 @@ void MultiHighlighter::setDocuments(const QList<QPair<DiffFileInfo, QString> > &
QTextDocument *document = new QTextDocument(contents); QTextDocument *document = new QTextDocument(contents);
const MimeType mimeType = MimeDatabase::findByFile(QFileInfo(fileInfo.fileName)); const MimeType mimeType = MimeDatabase::findByFile(QFileInfo(fileInfo.fileName));
SyntaxHighlighter *highlighter = 0; SyntaxHighlighter *highlighter = 0;
if (const IHighlighterFactory *factory = m_mimeTypeToHighlighterFactory.value(mimeType.type())) { if (const HighlighterFactory *factory = m_mimeTypeToHighlighterFactory.value(mimeType.type())) {
highlighter = factory->createHighlighter(); highlighter = factory->createHighlighter();
if (highlighter) if (highlighter)
highlighter->setDocument(document); highlighter->setDocument(document);

View File

@@ -45,7 +45,7 @@
#include <texteditor/basetexteditor.h> #include <texteditor/basetexteditor.h>
#include <texteditor/basetextdocumentlayout.h> #include <texteditor/basetextdocumentlayout.h>
#include <texteditor/ihighlighterfactory.h> #include <texteditor/highlighterfactory.h>
#include <texteditor/syntaxhighlighter.h> #include <texteditor/syntaxhighlighter.h>
#include <texteditor/basetextdocument.h> #include <texteditor/basetextdocument.h>
#include <texteditor/texteditorsettings.h> #include <texteditor/texteditorsettings.h>
@@ -63,8 +63,8 @@
#include <utils/tooltip/tipcontents.h> #include <utils/tooltip/tipcontents.h>
#include <utils/tooltip/tooltip.h> #include <utils/tooltip/tooltip.h>
static const int FILE_LEVEL = 1; //static const int FILE_LEVEL = 1;
static const int CHUNK_LEVEL = 2; //static const int CHUNK_LEVEL = 2;
using namespace Core; using namespace Core;
using namespace TextEditor; using namespace TextEditor;

View File

@@ -369,11 +369,8 @@ GitDiffEditorReloader::GitDiffEditorReloader(QObject *parent)
void GitDiffEditorReloader::reload() void GitDiffEditorReloader::reload()
{ {
const QString workingDirectory = m_diffType == DiffShow
? m_gitClient->findRepositoryForDirectory(m_workingDirectory)
: m_workingDirectory;
GitDiffHandler *handler = new GitDiffHandler(diffEditorController(), GitDiffHandler *handler = new GitDiffHandler(diffEditorController(),
workingDirectory); m_workingDirectory);
connect(handler, SIGNAL(destroyed()), this, SLOT(reloadFinished())); connect(handler, SIGNAL(destroyed()), this, SLOT(reloadFinished()));
switch (m_diffType) { switch (m_diffType) {

View File

@@ -11,7 +11,6 @@ glsleditorfactory.h \
glsleditorplugin.h \ glsleditorplugin.h \
glslfilewizard.h \ glslfilewizard.h \
glslhighlighter.h \ glslhighlighter.h \
glslhighlighterfactory.h \
glslautocompleter.h \ glslautocompleter.h \
glslindenter.h \ glslindenter.h \
glslhoverhandler.h \ glslhoverhandler.h \
@@ -25,7 +24,6 @@ glsleditorfactory.cpp \
glsleditorplugin.cpp \ glsleditorplugin.cpp \
glslfilewizard.cpp \ glslfilewizard.cpp \
glslhighlighter.cpp \ glslhighlighter.cpp \
glslhighlighterfactory.cpp \
glslautocompleter.cpp \ glslautocompleter.cpp \
glslindenter.cpp \ glslindenter.cpp \
glslhoverhandler.cpp \ glslhoverhandler.cpp \

View File

@@ -34,8 +34,6 @@ QtcPlugin {
"glslfilewizard.h", "glslfilewizard.h",
"glslhighlighter.cpp", "glslhighlighter.cpp",
"glslhighlighter.h", "glslhighlighter.h",
"glslhighlighterfactory.cpp",
"glslhighlighterfactory.h",
"glslhoverhandler.cpp", "glslhoverhandler.cpp",
"glslhoverhandler.h", "glslhoverhandler.h",
"glslindenter.cpp", "glslindenter.cpp",

View File

@@ -69,7 +69,3 @@ Core::IEditor *GLSLEditorFactory::createEditor()
TextEditor::TextEditorSettings::initializeEditor(rc); TextEditor::TextEditorSettings::initializeEditor(rc);
return rc->editor(); return rc->editor();
} }
void GLSLEditorFactory::updateEditorInfoBar(Core::IEditor *)
{
}

View File

@@ -43,9 +43,6 @@ public:
GLSLEditorFactory(QObject *parent); GLSLEditorFactory(QObject *parent);
Core::IEditor *createEditor(); Core::IEditor *createEditor();
private slots:
void updateEditorInfoBar(Core::IEditor *editor);
}; };
} // namespace Internal } // namespace Internal

View File

@@ -34,7 +34,7 @@
#include "glslfilewizard.h" #include "glslfilewizard.h"
#include "glslhoverhandler.h" #include "glslhoverhandler.h"
#include "glslcompletionassist.h" #include "glslcompletionassist.h"
#include "glslhighlighterfactory.h" #include "glslhighlighter.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
@@ -47,6 +47,7 @@
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <projectexplorer/taskhub.h> #include <projectexplorer/taskhub.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <texteditor/highlighterfactory.h>
#include <texteditor/texteditorconstants.h> #include <texteditor/texteditorconstants.h>
#include <texteditor/textfilewizard.h> #include <texteditor/textfilewizard.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -219,7 +220,15 @@ bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *er
wizard->setId(QLatin1String("K.GLSL")); wizard->setId(QLatin1String("K.GLSL"));
addAutoReleasedObject(wizard); addAutoReleasedObject(wizard);
addAutoReleasedObject(new GLSLHighlighterFactory); auto hf = new TextEditor::HighlighterFactory;
hf->setProductType<Highlighter>();
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; return true;
} }

View File

@@ -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;
}

View File

@@ -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 <texteditor/ihighlighterfactory.h>
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

View File

@@ -466,7 +466,8 @@ void HelpPlugin::setupUi()
m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Core::Constants::ICON_TOGGLE_SIDEBAR)), m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Core::Constants::ICON_TOGGLE_SIDEBAR)),
tr("Show Sidebar"), this); tr("Show Sidebar"), this);
m_toggleSideBarAction->setCheckable(true); 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); cmd = ActionManager::registerAction(m_toggleSideBarAction, Core::Constants::TOGGLE_SIDEBAR, modecontext);
} }
@@ -606,9 +607,11 @@ void HelpPlugin::slotHideRightPane()
RightPaneWidget::instance()->setShown(false); 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(); onSideBarVisibilityChanged();
} }
@@ -1004,6 +1007,7 @@ void HelpPlugin::slotReportBug()
void HelpPlugin::onSideBarVisibilityChanged() void HelpPlugin::onSideBarVisibilityChanged()
{ {
m_isSidebarVisible = m_sideBar->isVisible(); m_isSidebarVisible = m_sideBar->isVisible();
m_toggleSideBarAction->setChecked(m_isSidebarVisible);
m_toggleSideBarAction->setToolTip(m_isSidebarVisible ? tr("Hide Sidebar") : tr("Show Sidebar")); m_toggleSideBarAction->setToolTip(m_isSidebarVisible ? tr("Hide Sidebar") : tr("Show Sidebar"));
} }

View File

@@ -103,7 +103,7 @@ private slots:
void saveExternalWindowSettings(); void saveExternalWindowSettings();
void switchToHelpMode(const QUrl &source); void switchToHelpMode(const QUrl &source);
void slotHideRightPane(); void slotHideRightPane();
void showHideSidebar(); void setSideBarVisible(bool visible);
void updateSideBarSource(); void updateSideBarSource();
void updateSideBarSource(const QUrl &newUrl); void updateSideBarSource(const QUrl &newUrl);

View File

@@ -18,7 +18,6 @@ HEADERS += \
wizard/pythonclasswizarddialog.h \ wizard/pythonclasswizarddialog.h \
wizard/pythonsourcegenerator.h \ wizard/pythonsourcegenerator.h \
tools/pythonhighlighter.h \ tools/pythonhighlighter.h \
tools/pythonhighlighterfactory.h \
tools/pythonindenter.h \ tools/pythonindenter.h \
tools/lexical/pythonformattoken.h \ tools/lexical/pythonformattoken.h \
tools/lexical/pythonscanner.h \ tools/lexical/pythonscanner.h \
@@ -35,6 +34,5 @@ SOURCES += \
wizard/pythonclassnamepage.cpp \ wizard/pythonclassnamepage.cpp \
wizard/pythonsourcegenerator.cpp \ wizard/pythonsourcegenerator.cpp \
tools/pythonhighlighter.cpp \ tools/pythonhighlighter.cpp \
tools/pythonhighlighterfactory.cpp \
tools/pythonindenter.cpp \ tools/pythonindenter.cpp \
tools/lexical/pythonscanner.cpp tools/lexical/pythonscanner.cpp

View File

@@ -33,7 +33,6 @@ QtcPlugin {
"lexical/pythonscanner.h", "lexical/pythonscanner.cpp", "lexical/pythonscanner.h", "lexical/pythonscanner.cpp",
"lexical/sourcecodestream.h", "lexical/sourcecodestream.h",
"pythonhighlighter.h", "pythonhighlighter.cpp", "pythonhighlighter.h", "pythonhighlighter.cpp",
"pythonhighlighterfactory.h", "pythonhighlighterfactory.cpp",
"pythonindenter.cpp", "pythonindenter.h" "pythonindenter.cpp", "pythonindenter.h"
] ]
} }

View File

@@ -33,7 +33,7 @@
#include "wizard/pythonclasswizard.h" #include "wizard/pythonclasswizard.h"
#include "pythoneditorwidget.h" #include "pythoneditorwidget.h"
#include "pythoneditorfactory.h" #include "pythoneditorfactory.h"
#include "tools/pythonhighlighterfactory.h" #include "tools/pythonhighlighter.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
@@ -43,6 +43,7 @@
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <texteditor/texteditorconstants.h> #include <texteditor/texteditorconstants.h>
#include <texteditor/highlighterfactory.h>
#include <QtPlugin> #include <QtPlugin>
#include <QCoreApplication> #include <QCoreApplication>
@@ -229,7 +230,12 @@ bool PythonEditorPlugin::initialize(const QStringList &arguments, QString *error
// Add Python files and classes creation dialogs // Add Python files and classes creation dialogs
addAutoReleasedObject(new FileWizard); addAutoReleasedObject(new FileWizard);
addAutoReleasedObject(new ClassWizard); addAutoReleasedObject(new ClassWizard);
addAutoReleasedObject(new Internal::PythonHighlighterFactory);
auto hf = new TextEditor::HighlighterFactory;
hf->setId(Constants::C_PYTHONEDITOR_ID);
hf->setProductType<PythonHighlighter>();
hf->addMimeType(QLatin1String(Constants::C_PY_MIMETYPE));
addAutoReleasedObject(hf);
return true; return true;
} }

View File

@@ -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;
}

View File

@@ -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 <texteditor/ihighlighterfactory.h>
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

View File

@@ -6,7 +6,7 @@ isEmpty(QBS_INSTALL_DIR) {
QBS_SOURCE_DIR = $$PWD/../../shared/qbs QBS_SOURCE_DIR = $$PWD/../../shared/qbs
include($$QBS_SOURCE_DIR/src/lib/corelib/use_corelib.pri) include($$QBS_SOURCE_DIR/src/lib/corelib/use_corelib.pri)
include($$QBS_SOURCE_DIR/src/lib/qtprofilesetup/use_qtprofilesetup.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 { } else {
include($${QBS_INSTALL_DIR}/include/qbs/use_installed_corelib.pri) include($${QBS_INSTALL_DIR}/include/qbs/use_installed_corelib.pri)
include($${QBS_INSTALL_DIR}/include/qbs/use_installed_qtprofilesetup.pri) include($${QBS_INSTALL_DIR}/include/qbs/use_installed_qtprofilesetup.pri)

View File

@@ -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;
}

View File

@@ -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 <texteditor/ihighlighterfactory.h>
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

View File

@@ -16,7 +16,6 @@ HEADERS += \
qmakenodes.h \ qmakenodes.h \
profileeditor.h \ profileeditor.h \
profilehighlighter.h \ profilehighlighter.h \
profilehighlighterfactory.h \
profileeditorfactory.h \ profileeditorfactory.h \
profilehoverhandler.h \ profilehoverhandler.h \
wizards/qtprojectparameters.h \ wizards/qtprojectparameters.h \
@@ -68,7 +67,6 @@ SOURCES += \
qmakenodes.cpp \ qmakenodes.cpp \
profileeditor.cpp \ profileeditor.cpp \
profilehighlighter.cpp \ profilehighlighter.cpp \
profilehighlighterfactory.cpp \
profileeditorfactory.cpp \ profileeditorfactory.cpp \
profilehoverhandler.cpp \ profilehoverhandler.cpp \
wizards/qtprojectparameters.cpp \ wizards/qtprojectparameters.cpp \

View File

@@ -36,7 +36,6 @@ QtcPlugin {
"profileeditor.cpp", "profileeditor.h", "profileeditor.cpp", "profileeditor.h",
"profileeditorfactory.cpp", "profileeditorfactory.h", "profileeditorfactory.cpp", "profileeditorfactory.h",
"profilehighlighter.cpp", "profilehighlighter.h", "profilehighlighter.cpp", "profilehighlighter.h",
"profilehighlighterfactory.cpp", "profilehighlighterfactory.h",
"profilehoverhandler.cpp", "profilehoverhandler.h", "profilehoverhandler.cpp", "profilehoverhandler.h",
"qmakebuildinfo.h", "qmakebuildinfo.h",
"qmakeparser.cpp", "qmakeparser.h", "qmakeparser.cpp", "qmakeparser.h",

View File

@@ -50,7 +50,7 @@
#include "externaleditors.h" #include "externaleditors.h"
#include "profilecompletionassist.h" #include "profilecompletionassist.h"
#include "qmakekitinformation.h" #include "qmakekitinformation.h"
#include "profilehighlighterfactory.h" #include "profilehighlighter.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <projectexplorer/buildmanager.h> #include <projectexplorer/buildmanager.h>
@@ -65,6 +65,7 @@
#include <coreplugin/editormanager/ieditor.h> #include <coreplugin/editormanager/ieditor.h>
#include <texteditor/texteditoractionhandler.h> #include <texteditor/texteditoractionhandler.h>
#include <texteditor/texteditorconstants.h> #include <texteditor/texteditorconstants.h>
#include <texteditor/highlighterfactory.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/parameteraction.h> #include <utils/parameteraction.h>
@@ -142,7 +143,14 @@ bool QmakeProjectManagerPlugin::initialize(const QStringList &arguments, QString
addAutoReleasedObject(new ProFileCompletionAssistProvider); addAutoReleasedObject(new ProFileCompletionAssistProvider);
addAutoReleasedObject(new ProFileHoverHandler(this)); addAutoReleasedObject(new ProFileHoverHandler(this));
addAutoReleasedObject(new ProFileHighlighterFactory);
auto hf = new TextEditor::HighlighterFactory;
hf->setProductType<ProFileHighlighter>();
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 //menus
Core::ActionContainer *mbuild = Core::ActionContainer *mbuild =

View File

@@ -33,6 +33,8 @@
#include <nodeabstractproperty.h> #include <nodeabstractproperty.h>
#include <coreplugin/documentmanager.h>
#include <QVariant> #include <QVariant>
#include <QtDebug> #include <QtDebug>
@@ -129,6 +131,27 @@ Utils::CrumblePath *CrumbleBar::crumblePath()
return m_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) void CrumbleBar::onCrumblePathElementClicked(const QVariant &data)
{ {
CrumbleBarInfo clickedCrumbleBarInfo = data.value<CrumbleBarInfo>(); CrumbleBarInfo clickedCrumbleBarInfo = data.value<CrumbleBarInfo>();
@@ -149,6 +172,7 @@ void CrumbleBar::onCrumblePathElementClicked(const QVariant &data)
currentDesignDocument()->changeToDocumentModel(); currentDesignDocument()->changeToDocumentModel();
QmlDesignerPlugin::instance()->viewManager().setComponentViewToMaster(); QmlDesignerPlugin::instance()->viewManager().setComponentViewToMaster();
} else { } else {
showSaveDialog();
crumblePath()->popElement(); crumblePath()->popElement();
nextFileIsCalledInternally(); nextFileIsCalledInternally();
Core::EditorManager::openEditor(clickedCrumbleBarInfo.fileName, Core::Id(), Core::EditorManager::openEditor(clickedCrumbleBarInfo.fileName, Core::Id(),

View File

@@ -54,6 +54,7 @@ private slots:
private: private:
void updateVisibility(); void updateVisibility();
void showSaveDialog();
private: private:
bool m_isInternalCalled; bool m_isInternalCalled;

View File

@@ -315,11 +315,11 @@ void DragTool::dragLeaveEvent(QGraphicsSceneDragDropEvent * event)
if (event->mimeData()->hasFormat("application/vnd.bauhaus.itemlibraryinfo") || if (event->mimeData()->hasFormat("application/vnd.bauhaus.itemlibraryinfo") ||
event->mimeData()->hasFormat("application/vnd.bauhaus.libraryresource")) { event->mimeData()->hasFormat("application/vnd.bauhaus.libraryresource")) {
event->accept(); event->accept();
if (m_dragNode.isValid())
m_dragNode.destroy();
m_moveManipulator.end(); m_moveManipulator.end();
clear(); clear();
if (m_dragNode.isValid())
m_dragNode.destroy();
commitTransaction(); commitTransaction();

View File

@@ -91,7 +91,10 @@ QUrl FileResourcesModel::path() const
void FileResourcesModel::setFilter(const QString &filter) void FileResourcesModel::setFilter(const QString &filter)
{ {
if (m_filter != filter) {
m_filter = filter; m_filter = filter;
setupModel();
}
} }
QString FileResourcesModel::filter() const QString FileResourcesModel::filter() const
@@ -173,4 +176,6 @@ void FileResourcesModel::setupModel()
} }
m_lock = false; m_lock = false;
emit fileModelChanged();
} }

View File

@@ -45,7 +45,7 @@ class FileResourcesModel : public QObject
Q_PROPERTY(QString filter READ filter WRITE setFilter) Q_PROPERTY(QString filter READ filter WRITE setFilter)
Q_PROPERTY(QVariant modelNodeBackendProperty READ modelNodeBackend WRITE setModelNodeBackend NOTIFY modelNodeBackendChanged) Q_PROPERTY(QVariant modelNodeBackendProperty READ modelNodeBackend WRITE setModelNodeBackend NOTIFY modelNodeBackendChanged)
Q_PROPERTY(QUrl path READ path WRITE setPath) 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: public:
explicit FileResourcesModel(QObject *parent = 0); explicit FileResourcesModel(QObject *parent = 0);
@@ -68,6 +68,7 @@ public:
signals: signals:
void fileNameChanged(const QUrl &fileName); void fileNameChanged(const QUrl &fileName);
void modelNodeBackendChanged(); void modelNodeBackendChanged();
void fileModelChanged();
public slots: public slots:

View File

@@ -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) void PropertyEditorValue::setValueWithEmit(const QVariant &value)
{ {
if (m_value != value || isBound()) { if (!compareVariants(value, m_value ) || isBound()) {
QVariant newValue = value; QVariant newValue = value;
if (modelNode().isValid() && modelNode().metaInfo().isValid() && modelNode().metaInfo().hasProperty(name())) if (modelNode().isValid() && modelNode().metaInfo().isValid() && modelNode().metaInfo().hasProperty(name()))
if (modelNode().metaInfo().propertyTypeName(name()) == "QUrl") if (modelNode().metaInfo().propertyTypeName(name()) == "QUrl")
@@ -129,6 +140,7 @@ void PropertyEditorValue::setValueWithEmit(const QVariant &value)
return; return;
if (cleverColorCompare(newValue, m_value)) if (cleverColorCompare(newValue, m_value))
return; return;
setValue(newValue); setValue(newValue);
m_isBound = false; m_isBound = false;
emit valueChanged(name(), value); emit valueChanged(name(), value);
@@ -139,7 +151,7 @@ void PropertyEditorValue::setValueWithEmit(const QVariant &value)
void PropertyEditorValue::setValue(const QVariant &value) void PropertyEditorValue::setValue(const QVariant &value)
{ {
if ((m_value != value) && if (!compareVariants(m_value, value) &&
!cleverDoubleCompare(value, m_value) && !cleverDoubleCompare(value, m_value) &&
!cleverColorCompare(value, m_value)) !cleverColorCompare(value, m_value))

View File

@@ -45,8 +45,6 @@ ComponentsPlugin::ComponentsPlugin()
{ {
TabViewIndexModel::registerDeclarativeType(); TabViewIndexModel::registerDeclarativeType();
DesignerActionManager *actionManager = &QmlDesignerPlugin::instance()->viewManager().designerActionManager(); DesignerActionManager *actionManager = &QmlDesignerPlugin::instance()->viewManager().designerActionManager();
actionManager->addDesignerAction(new AddTabDesignerAction);
actionManager->addDesignerAction(new EnterTabDesignerAction);
} }
QString ComponentsPlugin::pluginName() const QString ComponentsPlugin::pluginName() const

View File

@@ -56,7 +56,7 @@ public /*slots*/:
}; };
EnterTabDesignerAction::EnterTabDesignerAction() 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); QmlDesigner::QmlItemNode itemNode(modelNode);
if (itemNode.isValid()) { 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()); arg(itemNode.instanceValue("title").toString());
EnterTabAction *selectionAction = new EnterTabAction(what); EnterTabAction *selectionAction = new EnterTabAction(what);

View File

@@ -34,18 +34,10 @@
#include <cxxabi.h> #include <cxxabi.h>
#endif #endif
#include <coreplugin/icore.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QMessageBox> #include <QMessageBox>
static void showAsyncWarning(const QString &title, const QString &desciption) #include <qmldesignerwarning.h>
{
QMessageBox *messageBox = new QMessageBox(QMessageBox::Warning, title, desciption, QMessageBox::Ok, Core::ICore::dialogParent());
messageBox->setAttribute(Qt::WA_DeleteOnClose);
messageBox->setModal(true);
messageBox->show();
}
/*! /*!
\defgroup CoreExceptions \defgroup CoreExceptions
@@ -163,7 +155,7 @@ QString Exception::description() const
void Exception::showException(const QString &title) const void Exception::showException(const QString &title) const
{ {
QString composedTitle = title.isEmpty() ? QCoreApplication::translate("QmlDesigner", "Error") : title; QString composedTitle = title.isEmpty() ? QCoreApplication::translate("QmlDesigner", "Error") : title;
showAsyncWarning(composedTitle, description()); QmlDesignerWarning::show(composedTitle, description());
} }
/*! /*!

View File

@@ -34,7 +34,6 @@
#include "propertycontainer.h" #include "propertycontainer.h"
#include <QPointer> #include <QPointer>
#include <qqml.h>
namespace QmlDesigner { namespace QmlDesigner {

View File

@@ -34,6 +34,7 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QCryptographicHash> #include <QCryptographicHash>
#include <QDateTime> #include <QDateTime>
#include <QMessageBox>
#include <projectexplorer/kit.h> #include <projectexplorer/kit.h>
#include <projectexplorer/toolchain.h> #include <projectexplorer/toolchain.h>
@@ -42,10 +43,11 @@
#include <qtsupport/baseqtversion.h> #include <qtsupport/baseqtversion.h>
#include <qtsupport/qtkitinformation.h> #include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtsupportconstants.h> #include <qtsupport/qtsupportconstants.h>
#include <coreplugin/icore.h>
#include <qmldesignerwarning.h>
#include "puppetbuildprogressdialog.h" #include "puppetbuildprogressdialog.h"
#include <QtDebug>
namespace QmlDesigner { namespace QmlDesigner {
@@ -130,6 +132,11 @@ QProcess *PuppetCreator::puppetProcess(const QString &puppetPath,
} }
puppetProcess->start(puppetPath, QStringList() << socketToken << puppetMode << "-graphicssystem raster"); 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; return puppetProcess;
} }
@@ -160,9 +167,22 @@ bool PuppetCreator::build(const QString &qmlPuppetProjectFilePath) const
buildSucceeded = startBuildProcess(buildDirectory.path(), buildCommand(), QStringList(), &progressDialog); buildSucceeded = startBuildProcess(buildDirectory.path(), buildCommand(), QStringList(), &progressDialog);
progressDialog.hide(); 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; return buildSucceeded;
@@ -302,7 +322,7 @@ bool PuppetCreator::startBuildProcess(const QString &buildDirectoryPath,
process.waitForFinished(); process.waitForFinished();
if (process.exitStatus() == QProcess::NormalExit || process.exitCode() == 0) if (process.exitStatus() == QProcess::NormalExit && process.exitCode() == 0)
return true; return true;
else else
return false; return false;

View File

@@ -42,7 +42,8 @@ DesignerSettings::DesignerSettings()
warningsInDesigner(true), warningsInDesigner(true),
designerWarningsInEditor(false), designerWarningsInEditor(false),
showDebugView(false), showDebugView(false),
enableDebugView(false) enableDebugView(false),
alwaysSaveInCrumbleBar(false)
{} {}
void DesignerSettings::fromSettings(QSettings *settings) void DesignerSettings::fromSettings(QSettings *settings)
@@ -63,6 +64,8 @@ void DesignerSettings::fromSettings(QSettings *settings)
QLatin1String(QmlDesigner::Constants::QML_SHOW_DEBUGVIEW), QVariant(false)).toBool(); QLatin1String(QmlDesigner::Constants::QML_SHOW_DEBUGVIEW), QVariant(false)).toBool();
enableDebugView = settings->value( enableDebugView = settings->value(
QLatin1String(QmlDesigner::Constants::QML_ENABLE_DEBUGVIEW), QVariant(false)).toBool(); 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();
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_WARNIN_FOR_DESIGNER_FEATURES_IN_EDITOR_KEY), designerWarningsInEditor);
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_SHOW_DEBUGVIEW), showDebugView); settings->setValue(QLatin1String(QmlDesigner::Constants::QML_SHOW_DEBUGVIEW), showDebugView);
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_ENABLE_DEBUGVIEW), enableDebugView); settings->setValue(QLatin1String(QmlDesigner::Constants::QML_ENABLE_DEBUGVIEW), enableDebugView);
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_ALWAYS_SAFE_IN_CRUMBLEBAR), alwaysSaveInCrumbleBar);
settings->endGroup(); settings->endGroup();
settings->endGroup(); settings->endGroup();
@@ -93,5 +97,6 @@ bool DesignerSettings::equals(const DesignerSettings &other) const
&& warningsInDesigner == other.warningsInDesigner && warningsInDesigner == other.warningsInDesigner
&& designerWarningsInEditor == other.designerWarningsInEditor && designerWarningsInEditor == other.designerWarningsInEditor
&& showDebugView == other.showDebugView && showDebugView == other.showDebugView
&& enableDebugView == other.enableDebugView; && enableDebugView == other.enableDebugView
&& alwaysSaveInCrumbleBar == other.alwaysSaveInCrumbleBar;
} }

View File

@@ -55,6 +55,7 @@ public:
bool designerWarningsInEditor; bool designerWarningsInEditor;
bool showDebugView; bool showDebugView;
bool enableDebugView; bool enableDebugView;
bool alwaysSaveInCrumbleBar;
}; };
inline bool operator==(const DesignerSettings &s1, const DesignerSettings &s2) inline bool operator==(const DesignerSettings &s1, const DesignerSettings &s2)

View File

@@ -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_WARNIN_FOR_DESIGNER_FEATURES_IN_EDITOR_KEY[] = "WarnAboutQtQuickDesignerFeaturesInCodeEditor";
const char QML_SHOW_DEBUGVIEW[] = "ShowQtQuickDesignerDebugView"; const char QML_SHOW_DEBUGVIEW[] = "ShowQtQuickDesignerDebugView";
const char QML_ENABLE_DEBUGVIEW[] = "EnableQtQuickDesignerDebugView"; const char QML_ENABLE_DEBUGVIEW[] = "EnableQtQuickDesignerDebugView";
const char QML_ALWAYS_SAFE_IN_CRUMBLEBAR[] = "AlwaysSafeInCrumbleBar";
const char QML_DESIGNER_SUBFOLDER[] = "/designer/"; const char QML_DESIGNER_SUBFOLDER[] = "/designer/";

View File

@@ -270,14 +270,14 @@ void QmlDesignerPlugin::jumpTextCursorToSelectedModelNode()
{ {
// visual editor -> text editor // visual editor -> text editor
ModelNode selectedNode; ModelNode selectedNode;
if (!currentDesignDocument()->rewriterView()->selectedModelNodes().isEmpty()) if (!rewriterView()->selectedModelNodes().isEmpty())
selectedNode = currentDesignDocument()->rewriterView()->selectedModelNodes().first(); selectedNode = rewriterView()->selectedModelNodes().first();
if (selectedNode.isValid()) { if (selectedNode.isValid()) {
const int nodeOffset = currentDesignDocument()->rewriterView()->nodeOffset(selectedNode); const int nodeOffset = rewriterView()->nodeOffset(selectedNode);
if (nodeOffset > 0) { if (nodeOffset > 0) {
const ModelNode currentSelectedNode const ModelNode currentSelectedNode
= currentDesignDocument()->rewriterView()->nodeAtTextCursorPosition(currentDesignDocument()->plainTextEdit()->textCursor().position()); = rewriterView()->nodeAtTextCursorPosition(currentDesignDocument()->plainTextEdit()->textCursor().position());
if (currentSelectedNode != selectedNode) { if (currentSelectedNode != selectedNode) {
int line, column; int line, column;
currentDesignDocument()->textEditor()->convertPosition(nodeOffset, &line, &column); currentDesignDocument()->textEditor()->convertPosition(nodeOffset, &line, &column);
@@ -290,9 +290,9 @@ void QmlDesignerPlugin::jumpTextCursorToSelectedModelNode()
void QmlDesignerPlugin::selectModelNodeUnderTextCursor() void QmlDesignerPlugin::selectModelNodeUnderTextCursor()
{ {
const int cursorPosition = currentDesignDocument()->plainTextEdit()->textCursor().position(); const int cursorPosition = currentDesignDocument()->plainTextEdit()->textCursor().position();
ModelNode modelNode = currentDesignDocument()->rewriterView()->nodeAtTextCursorPosition(cursorPosition); ModelNode modelNode = rewriterView()->nodeAtTextCursorPosition(cursorPosition);
if (modelNode.isValid()) if (modelNode.isValid())
currentDesignDocument()->rewriterView()->setSelectedModelNode(modelNode); rewriterView()->setSelectedModelNode(modelNode);
} }
void QmlDesignerPlugin::activateAutoSynchronization() void QmlDesignerPlugin::activateAutoSynchronization()
@@ -321,7 +321,7 @@ void QmlDesignerPlugin::activateAutoSynchronization()
currentDesignDocument()->updateSubcomponentManager(); currentDesignDocument()->updateSubcomponentManager();
connect(currentDesignDocument()->rewriterView(), connect(rewriterView(),
SIGNAL(errorsChanged(QList<RewriterView::Error>)), SIGNAL(errorsChanged(QList<RewriterView::Error>)),
data->mainWidget, data->mainWidget,
SLOT(updateErrorStatus(QList<RewriterView::Error>))); SLOT(updateErrorStatus(QList<RewriterView::Error>)));
@@ -334,7 +334,7 @@ void QmlDesignerPlugin::deactivateAutoSynchronization()
viewManager().detachRewriterView(); viewManager().detachRewriterView();
documentManager().currentDesignDocument()->resetToDocumentModel(); documentManager().currentDesignDocument()->resetToDocumentModel();
disconnect(currentDesignDocument()->rewriterView(), disconnect(rewriterView(),
SIGNAL(errorsChanged(QList<RewriterView::Error>)), SIGNAL(errorsChanged(QList<RewriterView::Error>)),
data->mainWidget, data->mainWidget,
SLOT(updateErrorStatus(QList<RewriterView::Error>))); SLOT(updateErrorStatus(QList<RewriterView::Error>)));
@@ -343,14 +343,21 @@ void QmlDesignerPlugin::deactivateAutoSynchronization()
void QmlDesignerPlugin::resetModelSelection() void QmlDesignerPlugin::resetModelSelection()
{ {
if (currentDesignDocument()->rewriterView() && currentDesignDocument()->currentModel()) if (rewriterView() && currentDesignDocument()->currentModel())
currentDesignDocument()->rewriterView()->setSelectedModelNodes(QList<ModelNode>()); rewriterView()->setSelectedModelNodes(QList<ModelNode>());
}
RewriterView *QmlDesignerPlugin::rewriterView() const
{
return currentDesignDocument()->rewriterView();
} }
static bool checkIfEditorIsQtQuick(Core::IEditor *editor) static bool checkIfEditorIsQtQuick(Core::IEditor *editor)
{ {
if (editor)
if (editor && editor->document()->id() == QmlJSEditor::Constants::C_QMLJSEDITOR_ID) { 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()) if (!document.isNull())
return document->language() == QmlJS::Language::QmlQtQuick1 return document->language() == QmlJS::Language::QmlQtQuick1
|| document->language() == QmlJS::Language::QmlQtQuick2 || document->language() == QmlJS::Language::QmlQtQuick2

View File

@@ -113,6 +113,7 @@ private: // functions
void activateAutoSynchronization(); void activateAutoSynchronization();
void deactivateAutoSynchronization(); void deactivateAutoSynchronization();
void resetModelSelection(); void resetModelSelection();
RewriterView *rewriterView() const;
private: // variables private: // variables
QmlDesignerPluginData *data; QmlDesignerPluginData *data;

View File

@@ -6,80 +6,14 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>684</width> <width>726</width>
<height>607</height> <height>774</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="3" column="0">
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Debugging</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout_4">
<item row="0" column="1">
<widget class="QCheckBox" name="designerShowDebuggerCheckBox">
<property name="text">
<string>Show the debugging view</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="designerEnableDebuggerCheckBox">
<property name="text">
<string>Enable the debugging view</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Warnings</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QFormLayout" name="formLayout_3">
<item row="0" column="1">
<widget class="QCheckBox" name="designerWarningsCheckBox">
<property name="toolTip">
<string>Warns about QML features which are not properly supported by the Qt Quick Designer.</string>
</property>
<property name="text">
<string>Warn about unsupported features in the Qt Quick Designer</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="designerWarningsInEditorCheckBox">
<property name="toolTip">
<string>Also warns in the code editor about QML features which are not properly supported by the Qt Quick Designer.</string>
</property>
<property name="text">
<string>Warn about unsupported features of Qt Quick Designer in the code editor</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QGroupBox" name="groupBox_3"> <widget class="QGroupBox" name="groupBox_3">
<property name="title"> <property name="title">
@@ -199,6 +133,72 @@
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="4" column="0">
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Debugging</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout_4">
<item row="0" column="1">
<widget class="QCheckBox" name="designerShowDebuggerCheckBox">
<property name="text">
<string>Show the debugging view</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="designerEnableDebuggerCheckBox">
<property name="text">
<string>Enable the debugging view</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Warnings</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QFormLayout" name="formLayout_3">
<item row="0" column="1">
<widget class="QCheckBox" name="designerWarningsCheckBox">
<property name="toolTip">
<string>Warns about QML features which are not properly supported by the Qt Quick Designer.</string>
</property>
<property name="text">
<string>Warn about unsupported features in the Qt Quick Designer</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="designerWarningsInEditorCheckBox">
<property name="toolTip">
<string>Also warns in the code editor about QML features which are not properly supported by the Qt Quick Designer.</string>
</property>
<property name="text">
<string>Warn about unsupported features of Qt Quick Designer in the code editor</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="5" column="0">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@@ -211,6 +211,28 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="2" column="0">
<widget class="QGroupBox" name="groupBox_5">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>Subcomponents</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>Always save when leaving subcomponent in bread crumb</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>

View File

@@ -13,7 +13,6 @@ HEADERS += \
qmlexpressionundercursor.h \ qmlexpressionundercursor.h \
qmlfilewizard.h \ qmlfilewizard.h \
qmljshighlighter.h \ qmljshighlighter.h \
qmljshighlighterfactory.h \
qmljshoverhandler.h \ qmljshoverhandler.h \
qmljspreviewrunner.h \ qmljspreviewrunner.h \
qmljscomponentfromobjectdef.h \ qmljscomponentfromobjectdef.h \
@@ -46,7 +45,6 @@ SOURCES += \
qmlexpressionundercursor.cpp \ qmlexpressionundercursor.cpp \
qmlfilewizard.cpp \ qmlfilewizard.cpp \
qmljshighlighter.cpp \ qmljshighlighter.cpp \
qmljshighlighterfactory.cpp \
qmljshoverhandler.cpp \ qmljshoverhandler.cpp \
qmljspreviewrunner.cpp \ qmljspreviewrunner.cpp \
qmljscomponentfromobjectdef.cpp \ qmljscomponentfromobjectdef.cpp \

View File

@@ -51,8 +51,6 @@ QtcPlugin {
"qmljsfindreferences.h", "qmljsfindreferences.h",
"qmljshighlighter.cpp", "qmljshighlighter.cpp",
"qmljshighlighter.h", "qmljshighlighter.h",
"qmljshighlighterfactory.cpp",
"qmljshighlighterfactory.h",
"qmljshoverhandler.cpp", "qmljshoverhandler.cpp",
"qmljshoverhandler.h", "qmljshoverhandler.h",
"qmljsoutline.cpp", "qmljsoutline.cpp",

View File

@@ -44,7 +44,6 @@
#include "quicktoolbarsettingspage.h" #include "quicktoolbarsettingspage.h"
#include "qmljscompletionassist.h" #include "qmljscompletionassist.h"
#include "qmljsquickfixassist.h" #include "qmljsquickfixassist.h"
#include "qmljshighlighterfactory.h"
#include <qmljs/qmljsicons.h> #include <qmljs/qmljsicons.h>
#include <qmljs/qmljsmodelmanagerinterface.h> #include <qmljs/qmljsmodelmanagerinterface.h>
@@ -64,6 +63,7 @@
#include <projectexplorer/taskhub.h> #include <projectexplorer/taskhub.h>
#include <texteditor/texteditorconstants.h> #include <texteditor/texteditorconstants.h>
#include <texteditor/textfilewizard.h> #include <texteditor/textfilewizard.h>
#include <texteditor/highlighterfactory.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/json.h> #include <utils/json.h>
@@ -114,7 +114,17 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
{ {
m_modelManager = QmlJS::ModelManagerInterface::instance(); m_modelManager = QmlJS::ModelManagerInterface::instance();
addAutoReleasedObject(new QmlJSSnippetProvider); addAutoReleasedObject(new QmlJSSnippetProvider);
addAutoReleasedObject(new QmlJSHighlighterFactory);
auto hf = new TextEditor::HighlighterFactory;
hf->setProductType<Highlighter>();
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 // QML task updating manager
m_qmlTaskManager = new QmlTaskManager; m_qmlTaskManager = new QmlTaskManager;

Some files were not shown because too many files have changed in this diff Show More