forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.6'
Change-Id: I0813763b7618c682b5fbb197273a1c8911cd3d7d
This commit is contained in:
@@ -55,9 +55,10 @@ Module {
|
||||
|
||||
validate: {
|
||||
if (!clangProbe.found) {
|
||||
console.warn("Set LLVM_INSTALL_DIR to build the Clang Code Model."
|
||||
console.warn("No usable libclang version found."
|
||||
+ " Set LLVM_INSTALL_DIR to build the Clang Code Model."
|
||||
+ " For details, see doc/src/editors/creator-clang-codemodel.qdoc.");
|
||||
throw "No usable libclang found";
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -414,7 +414,7 @@ int main(int argc, char **argv)
|
||||
const QString &creatorTrPath = resourcePath() + "/translations";
|
||||
foreach (QString locale, uiLanguages) {
|
||||
locale = QLocale(locale).name();
|
||||
if (translator.load(QString::fromLatin1(Core::Constants::IDE_ID) + "_" + locale, creatorTrPath)) {
|
||||
if (translator.load("qtcreator_" + locale, creatorTrPath)) {
|
||||
const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
||||
const QString &qtTrFile = QLatin1String("qt_") + locale;
|
||||
// Binary installer puts Qt tr files into creatorTrPath
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#include <QMouseEvent>
|
||||
#include <QScrollArea>
|
||||
#include <QSlider>
|
||||
#include <QStyle>
|
||||
#include <QToolButton>
|
||||
#include <QDebug>
|
||||
|
||||
|
@@ -127,8 +127,7 @@ namespace {
|
||||
|
||||
static QString sdkSettingsFileName()
|
||||
{
|
||||
return QFileInfo(Core::ICore::settings(QSettings::SystemScope)->fileName()).absolutePath()
|
||||
+ QLatin1String("/qtcreator/android.xml");
|
||||
return Core::ICore::installerResourcePath() + "/android.xml";
|
||||
}
|
||||
|
||||
static bool is32BitUserSpace()
|
||||
|
@@ -47,19 +47,13 @@ namespace Internal {
|
||||
const char dataKeyC[] = "GdbServerProvider.";
|
||||
const char countKeyC[] = "GdbServerProvider.Count";
|
||||
const char fileVersionKeyC[] = "Version";
|
||||
const char fileNameKeyC[] = "/qtcreator/gdbserverproviders.xml";
|
||||
|
||||
static Utils::FileName settingsFileName(const QString &path)
|
||||
{
|
||||
const QFileInfo settingsLocation(Core::ICore::settings()->fileName());
|
||||
return Utils::FileName::fromString(settingsLocation.absolutePath() + path);
|
||||
}
|
||||
const char fileNameKeyC[] = "/gdbserverproviders.xml";
|
||||
|
||||
static GdbServerProviderManager *m_instance = 0;
|
||||
|
||||
GdbServerProviderManager::GdbServerProviderManager(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_configFile(settingsFileName(QLatin1String(fileNameKeyC)))
|
||||
, m_configFile(Utils::FileName::fromString(Core::ICore::userResourcePath() + fileNameKeyC))
|
||||
, m_factories({new DefaultGdbServerProviderFactory,
|
||||
new OpenOcdGdbServerProviderFactory,
|
||||
new StLinkUtilGdbServerProviderFactory})
|
||||
|
@@ -500,7 +500,7 @@ Bookmark *BookmarkManager::bookmarkForIndex(const QModelIndex &index) const
|
||||
return m_bookmarksList.at(index.row());
|
||||
}
|
||||
|
||||
bool BookmarkManager::gotoBookmark(Bookmark *bookmark)
|
||||
bool BookmarkManager::gotoBookmark(const Bookmark *bookmark) const
|
||||
{
|
||||
if (IEditor *editor = EditorManager::openEditorAt(bookmark->fileName(), bookmark->lineNumber()))
|
||||
return editor->currentLine() == bookmark->lineNumber();
|
||||
|
@@ -96,7 +96,7 @@ public:
|
||||
void moveDown();
|
||||
void edit();
|
||||
void editByFileAndLine(const Utils::FileName &fileName, int lineNumber);
|
||||
bool gotoBookmark(Bookmark *bookmark);
|
||||
bool gotoBookmark(const Bookmark *bookmark) const;
|
||||
|
||||
signals:
|
||||
void updateActions(bool enableToggle, int state);
|
||||
|
@@ -46,7 +46,7 @@ const char CMAKETOOL_COUNT_KEY[] = "CMakeTools.Count";
|
||||
const char CMAKETOOL_DEFAULT_KEY[] = "CMakeTools.Default";
|
||||
const char CMAKETOOL_DATA_KEY[] = "CMakeTools.";
|
||||
const char CMAKETOOL_FILE_VERSION_KEY[] = "Version";
|
||||
const char CMAKETOOL_FILENAME[] = "/qtcreator/cmaketools.xml";
|
||||
const char CMAKETOOL_FILENAME[] = "/cmaketools.xml";
|
||||
|
||||
class CMakeToolManagerPrivate
|
||||
{
|
||||
@@ -71,8 +71,7 @@ static void addCMakeTool(CMakeTool *item)
|
||||
|
||||
static FileName userSettingsFileName()
|
||||
{
|
||||
QFileInfo settingsLocation(ICore::settings()->fileName());
|
||||
return FileName::fromString(settingsLocation.absolutePath() + QLatin1String(CMAKETOOL_FILENAME));
|
||||
return FileName::fromString(ICore::userResourcePath() + CMAKETOOL_FILENAME);
|
||||
}
|
||||
|
||||
static QList<CMakeTool *> readCMakeTools(const FileName &fileName, Core::Id *defaultId, bool fromSDK)
|
||||
@@ -325,9 +324,8 @@ void CMakeToolManager::restoreCMakeTools()
|
||||
{
|
||||
Core::Id defaultId;
|
||||
|
||||
QFileInfo systemSettingsFile(ICore::settings(QSettings::SystemScope)->fileName());
|
||||
FileName sdkSettingsFile = FileName::fromString(systemSettingsFile.absolutePath()
|
||||
+ QLatin1String(CMAKETOOL_FILENAME));
|
||||
FileName sdkSettingsFile = FileName::fromString(ICore::installerResourcePath()
|
||||
+ CMAKETOOL_FILENAME);
|
||||
|
||||
QList<CMakeTool *> toolsToRegister = readCMakeTools(sdkSettingsFile, &defaultId, true);
|
||||
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/stringutils.h>
|
||||
|
||||
#include <QButtonGroup>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QMap>
|
||||
|
@@ -45,6 +45,7 @@
|
||||
#include <QDebug>
|
||||
#include <QSettings>
|
||||
|
||||
#include <QAbstractItemView>
|
||||
#include <QCheckBox>
|
||||
#include <QClipboard>
|
||||
#include <QCompleter>
|
||||
|
@@ -410,7 +410,7 @@ QString ICore::userResourcePath()
|
||||
{
|
||||
// Create qtcreator dir if it doesn't yet exist
|
||||
const QString configDir = QFileInfo(settings(QSettings::UserScope)->fileName()).path();
|
||||
const QString urp = configDir + QLatin1String("/qtcreator");
|
||||
const QString urp = configDir + '/' + QLatin1String(Constants::IDE_ID);
|
||||
|
||||
if (!QFileInfo::exists(urp + QLatin1Char('/'))) {
|
||||
QDir dir;
|
||||
@@ -421,6 +421,12 @@ QString ICore::userResourcePath()
|
||||
return urp;
|
||||
}
|
||||
|
||||
QString ICore::installerResourcePath()
|
||||
{
|
||||
return QFileInfo(settings(QSettings::SystemScope)->fileName()).path() + '/'
|
||||
+ Constants::IDE_ID;
|
||||
}
|
||||
|
||||
QString ICore::documentationPath()
|
||||
{
|
||||
return QDir::cleanPath(QCoreApplication::applicationDirPath() + '/' + RELATIVE_DOC_PATH);
|
||||
@@ -486,7 +492,7 @@ QWidget *ICore::currentContextWidget()
|
||||
}
|
||||
|
||||
|
||||
QWidget *ICore::mainWindow()
|
||||
QMainWindow *ICore::mainWindow()
|
||||
{
|
||||
return m_mainwindow;
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include "core_global.h"
|
||||
#include "id.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QObject>
|
||||
#include <QRect>
|
||||
#include <QSettings>
|
||||
@@ -93,13 +94,14 @@ public:
|
||||
|
||||
static QString resourcePath();
|
||||
static QString userResourcePath();
|
||||
static QString installerResourcePath();
|
||||
static QString documentationPath();
|
||||
static QString libexecPath();
|
||||
|
||||
static QString versionString();
|
||||
static QString buildCompatibilityString();
|
||||
|
||||
static QWidget *mainWindow();
|
||||
static QMainWindow *mainWindow();
|
||||
static QWidget *dialogParent();
|
||||
static QStatusBar *statusBar();
|
||||
/* Raises and activates the window for the widget. This contains workarounds for X11. */
|
||||
|
@@ -71,9 +71,9 @@ namespace Internal {
|
||||
|
||||
const char DEBUGGER_COUNT_KEY[] = "DebuggerItem.Count";
|
||||
const char DEBUGGER_DATA_KEY[] = "DebuggerItem.";
|
||||
const char DEBUGGER_LEGACY_FILENAME[] = "/qtcreator/profiles.xml";
|
||||
const char DEBUGGER_LEGACY_FILENAME[] = "/profiles.xml";
|
||||
const char DEBUGGER_FILE_VERSION_KEY[] = "Version";
|
||||
const char DEBUGGER_FILENAME[] = "/qtcreator/debuggers.xml";
|
||||
const char DEBUGGER_FILENAME[] = "/debuggers.xml";
|
||||
const char debuggingToolsWikiLinkC[] = "http://wiki.qt.io/Qt_Creator_Windows_Debugging";
|
||||
|
||||
class DebuggerItemModel;
|
||||
@@ -821,8 +821,7 @@ void DebuggerItemManagerPrivate::readLegacyDebuggers(const FileName &file)
|
||||
|
||||
static FileName userSettingsFileName()
|
||||
{
|
||||
QFileInfo settingsLocation(ICore::settings()->fileName());
|
||||
return FileName::fromString(settingsLocation.absolutePath() + QLatin1String(DEBUGGER_FILENAME));
|
||||
return FileName::fromString(ICore::userResourcePath() + DEBUGGER_FILENAME);
|
||||
}
|
||||
|
||||
DebuggerItemManagerPrivate::DebuggerItemManagerPrivate()
|
||||
@@ -918,8 +917,7 @@ void DebuggerItemManagerPrivate::readDebuggers(const FileName &fileName, bool is
|
||||
void DebuggerItemManagerPrivate::restoreDebuggers()
|
||||
{
|
||||
// Read debuggers from SDK
|
||||
QFileInfo systemSettingsFile(ICore::settings(QSettings::SystemScope)->fileName());
|
||||
readDebuggers(FileName::fromString(systemSettingsFile.absolutePath() + DEBUGGER_FILENAME), true);
|
||||
readDebuggers(FileName::fromString(ICore::installerResourcePath() + DEBUGGER_FILENAME), true);
|
||||
|
||||
// Read all debuggers from user file.
|
||||
readDebuggers(userSettingsFileName(), false);
|
||||
@@ -929,10 +927,8 @@ void DebuggerItemManagerPrivate::restoreDebuggers()
|
||||
autoDetectGdbOrLldbDebuggers();
|
||||
|
||||
// Add debuggers from pre-3.x profiles.xml
|
||||
QFileInfo systemLocation(ICore::settings(QSettings::SystemScope)->fileName());
|
||||
readLegacyDebuggers(FileName::fromString(systemLocation.absolutePath() + QLatin1String(DEBUGGER_LEGACY_FILENAME)));
|
||||
QFileInfo userLocation(ICore::settings()->fileName());
|
||||
readLegacyDebuggers(FileName::fromString(userLocation.absolutePath() + QLatin1String(DEBUGGER_LEGACY_FILENAME)));
|
||||
readLegacyDebuggers(FileName::fromString(ICore::installerResourcePath() + DEBUGGER_LEGACY_FILENAME));
|
||||
readLegacyDebuggers(FileName::fromString(ICore::userResourcePath() + DEBUGGER_LEGACY_FILENAME));
|
||||
}
|
||||
|
||||
void DebuggerItemManagerPrivate::saveDebuggers()
|
||||
|
@@ -5,6 +5,7 @@ QtcPlugin {
|
||||
|
||||
Depends { name: "Qt"; submodules: ["help", "network", "sql"]; }
|
||||
Depends { name: "Qt.printsupport" }
|
||||
Depends { name: "Qt.webenginewidgets"; required: false }
|
||||
|
||||
Depends { name: "Aggregation" }
|
||||
Depends { name: "Utils" }
|
||||
@@ -16,6 +17,8 @@ QtcPlugin {
|
||||
|
||||
cpp.defines: {
|
||||
var defines = base.concat(["QT_CLUCENE_SUPPORT"]);
|
||||
if (Qt.webenginewidgets.present)
|
||||
defines.push("QTC_WEBENGINE_HELPVIEWER");
|
||||
return defines;
|
||||
}
|
||||
|
||||
@@ -50,6 +53,14 @@ QtcPlugin {
|
||||
]
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "WebEngine Sources"
|
||||
condition: Qt.webenginewidgets.present
|
||||
files: [
|
||||
"webenginehelpviewer.cpp", "webenginehelpviewer.h"
|
||||
]
|
||||
}
|
||||
|
||||
Group {
|
||||
id: sharedSources
|
||||
name: "Shared Sources"
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#include <coreplugin/actionmanager/command.h>
|
||||
#include <coreplugin/id.h>
|
||||
|
||||
#include <QAction>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QTreeWidget>
|
||||
|
@@ -31,6 +31,8 @@
|
||||
#include <utils/portlist.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QRegExpValidator>
|
||||
|
||||
using namespace ProjectExplorer::Constants;
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
@@ -150,7 +150,7 @@ void DeviceManager::load()
|
||||
// read devices file from global settings path
|
||||
QHash<Core::Id, Core::Id> defaultDevices;
|
||||
QList<IDevice::Ptr> sdkDevices;
|
||||
if (reader.load(systemSettingsFilePath(QLatin1String("/qtcreator/devices.xml"))))
|
||||
if (reader.load(systemSettingsFilePath(QLatin1String("/devices.xml"))))
|
||||
sdkDevices = fromMap(reader.restoreValues().value(DeviceManagerKey).toMap(), &defaultDevices);
|
||||
// read devices file from user settings path
|
||||
QList<IDevice::Ptr> userDevices;
|
||||
@@ -230,8 +230,7 @@ Utils::FileName DeviceManager::settingsFilePath(const QString &extension)
|
||||
|
||||
Utils::FileName DeviceManager::systemSettingsFilePath(const QString &deviceFileRelativePath)
|
||||
{
|
||||
return Utils::FileName::fromString(
|
||||
QFileInfo(Core::ICore::settings(QSettings::SystemScope)->fileName()).absolutePath()
|
||||
return Utils::FileName::fromString(Core::ICore::installerResourcePath()
|
||||
+ deviceFileRelativePath);
|
||||
}
|
||||
|
||||
|
@@ -53,12 +53,11 @@ const char KIT_DATA_KEY[] = "Profile.";
|
||||
const char KIT_COUNT_KEY[] = "Profile.Count";
|
||||
const char KIT_FILE_VERSION_KEY[] = "Version";
|
||||
const char KIT_DEFAULT_KEY[] = "Profile.Default";
|
||||
const char KIT_FILENAME[] = "/qtcreator/profiles.xml";
|
||||
const char KIT_FILENAME[] = "/profiles.xml";
|
||||
|
||||
static FileName settingsFileName()
|
||||
{
|
||||
QFileInfo settingsLocation(ICore::settings()->fileName());
|
||||
return FileName::fromString(settingsLocation.absolutePath() + QLatin1String(KIT_FILENAME));
|
||||
return FileName::fromString(ICore::resourcePath() + KIT_FILENAME);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -131,8 +130,7 @@ void KitManager::restoreKits()
|
||||
QList<Kit *> sdkKits;
|
||||
|
||||
// read all kits from SDK
|
||||
QFileInfo systemSettingsFile(ICore::settings(QSettings::SystemScope)->fileName());
|
||||
QFileInfo kitFile(systemSettingsFile.absolutePath() + QLatin1String(KIT_FILENAME));
|
||||
QFileInfo kitFile(ICore::installerResourcePath() + KIT_FILENAME);
|
||||
if (kitFile.exists()) {
|
||||
KitList system = restoreKits(FileName(kitFile));
|
||||
// make sure we mark these as autodetected and run additional setup logic
|
||||
|
@@ -44,14 +44,13 @@
|
||||
static const char TOOLCHAIN_DATA_KEY[] = "ToolChain.";
|
||||
static const char TOOLCHAIN_COUNT_KEY[] = "ToolChain.Count";
|
||||
static const char TOOLCHAIN_FILE_VERSION_KEY[] = "Version";
|
||||
static const char TOOLCHAIN_FILENAME[] = "/qtcreator/toolchains.xml";
|
||||
static const char TOOLCHAIN_FILENAME[] = "/toolchains.xml";
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
static FileName settingsFileName(const QString &path)
|
||||
{
|
||||
QFileInfo settingsLocation(Core::ICore::settings()->fileName());
|
||||
return FileName::fromString(settingsLocation.absolutePath() + path);
|
||||
return FileName::fromString(Core::ICore::resourcePath() + path);
|
||||
}
|
||||
|
||||
namespace ProjectExplorer {
|
||||
@@ -304,9 +303,8 @@ void ToolChainManager::restoreToolChains()
|
||||
|
||||
QList<ToolChain *> ToolChainManager::readSystemFileToolChains()
|
||||
{
|
||||
QFileInfo systemSettingsFile(Core::ICore::settings(QSettings::SystemScope)->fileName());
|
||||
QList<ToolChain *> systemTcs
|
||||
= restoreFromFile(FileName::fromString(systemSettingsFile.absolutePath() + QLatin1String(TOOLCHAIN_FILENAME)));
|
||||
QList<ToolChain *> systemTcs = restoreFromFile(
|
||||
FileName::fromString(Core::ICore::installerResourcePath() + TOOLCHAIN_FILENAME));
|
||||
|
||||
foreach (ToolChain *tc, systemTcs)
|
||||
tc->setDetection(ToolChain::AutoDetection);
|
||||
|
@@ -1571,8 +1571,7 @@ static QString maddeRoot(const QString &qmakePath)
|
||||
void UserFileVersion11Upgrader::parseQtversionFile()
|
||||
{
|
||||
PersistentSettingsReader reader;
|
||||
QFileInfo settingsLocation = QFileInfo(Core::ICore::settings()->fileName());
|
||||
reader.load(FileName::fromString(settingsLocation.absolutePath() + "/qtversion.xml"));
|
||||
reader.load(FileName::fromString(Core::ICore::userResourcePath() + "/../qtversion.xml"));
|
||||
QVariantMap data = reader.restoreValues();
|
||||
|
||||
int count = data.value("QtVersion.Count", 0).toInt();
|
||||
@@ -1610,8 +1609,7 @@ void UserFileVersion11Upgrader::parseQtversionFile()
|
||||
void UserFileVersion11Upgrader::parseToolChainFile()
|
||||
{
|
||||
PersistentSettingsReader reader;
|
||||
QFileInfo settingsLocation(Core::ICore::settings()->fileName());
|
||||
reader.load(FileName::fromString(settingsLocation.absolutePath() + "/toolChains.xml"));
|
||||
reader.load(FileName::fromString(Core::ICore::userResourcePath() + "/../toolChains.xml"));
|
||||
QVariantMap data = reader.restoreValues();
|
||||
int count = data.value("ToolChain.Count", 0).toInt();
|
||||
for (int i = 0; i < count; ++i) {
|
||||
|
@@ -382,60 +382,11 @@ void DesignDocument::deleteSelected()
|
||||
|
||||
void DesignDocument::copySelected()
|
||||
{
|
||||
QScopedPointer<Model> copyModel(Model::create("QtQuick.Rectangle", 1, 0, currentModel()));
|
||||
copyModel->setFileUrl(currentModel()->fileUrl());
|
||||
copyModel->changeImports(currentModel()->imports(), {});
|
||||
|
||||
Q_ASSERT(copyModel);
|
||||
|
||||
DesignDocumentView view;
|
||||
|
||||
currentModel()->attachView(&view);
|
||||
|
||||
if (view.selectedModelNodes().isEmpty())
|
||||
return;
|
||||
|
||||
QList<ModelNode> selectedNodes(view.selectedModelNodes());
|
||||
|
||||
foreach (const ModelNode &node, selectedNodes) {
|
||||
foreach (const ModelNode &node2, selectedNodes) {
|
||||
if (node.isAncestorOf(node2))
|
||||
selectedNodes.removeAll(node2);
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedNodes.count() == 1) {
|
||||
ModelNode selectedNode(selectedNodes.first());
|
||||
|
||||
if (!selectedNode.isValid())
|
||||
return;
|
||||
|
||||
currentModel()->detachView(&view);
|
||||
|
||||
copyModel->attachView(&view);
|
||||
view.replaceModel(selectedNode);
|
||||
|
||||
Q_ASSERT(view.rootModelNode().isValid());
|
||||
Q_ASSERT(view.rootModelNode().type() != "empty");
|
||||
|
||||
view.toClipboard();
|
||||
} else { //multi items selected
|
||||
currentModel()->detachView(&view);
|
||||
copyModel->attachView(&view);
|
||||
|
||||
foreach (ModelNode node, view.rootModelNode().directSubModelNodes()) {
|
||||
node.destroy();
|
||||
}
|
||||
view.changeRootNodeType("QtQuick.Rectangle", 1, 0);
|
||||
view.rootModelNode().setIdWithRefactoring(QLatin1String("designer__Selection"));
|
||||
|
||||
foreach (const ModelNode &selectedNode, selectedNodes) {
|
||||
ModelNode newNode(view.insertModel(selectedNode));
|
||||
view.rootModelNode().nodeListProperty("data").reparentHere(newNode);
|
||||
}
|
||||
|
||||
view.toClipboard();
|
||||
}
|
||||
DesignDocumentView::copyModelNodes(view.selectedModelNodes());
|
||||
}
|
||||
|
||||
void DesignDocument::cutSelected()
|
||||
@@ -479,28 +430,21 @@ static void scatterItem(const ModelNode &pastedNode, const ModelNode &targetNode
|
||||
|
||||
void DesignDocument::paste()
|
||||
{
|
||||
QScopedPointer<Model> pasteModel(Model::create("empty", 1, 0, currentModel()));
|
||||
pasteModel->setFileUrl(currentModel()->fileUrl());
|
||||
pasteModel->changeImports(currentModel()->imports(), {});
|
||||
|
||||
Q_ASSERT(pasteModel);
|
||||
QScopedPointer<Model> pasteModel(DesignDocumentView::pasteToModel());
|
||||
|
||||
if (!pasteModel)
|
||||
return;
|
||||
|
||||
DesignDocumentView view;
|
||||
pasteModel->attachView(&view);
|
||||
|
||||
view.fromClipboard();
|
||||
|
||||
ModelNode rootNode(view.rootModelNode());
|
||||
QList<ModelNode> selectedNodes = rootNode.directSubModelNodes();
|
||||
pasteModel->detachView(&view);
|
||||
|
||||
if (rootNode.type() == "empty")
|
||||
return;
|
||||
|
||||
if (rootNode.id() == QLatin1String("designer__Selection")) {
|
||||
QList<ModelNode> selectedNodes = rootNode.directSubModelNodes();
|
||||
pasteModel->detachView(&view);
|
||||
if (rootNode.id() == "designer__Selection") {
|
||||
currentModel()->attachView(&view);
|
||||
|
||||
ModelNode targetNode;
|
||||
@@ -546,7 +490,6 @@ void DesignDocument::paste()
|
||||
try {
|
||||
RewriterTransaction transaction(rewriterView(), QByteArrayLiteral("DesignDocument::paste2"));
|
||||
|
||||
pasteModel->detachView(&view);
|
||||
currentModel()->attachView(&view);
|
||||
ModelNode pastedNode(view.insertModel(rootNode));
|
||||
ModelNode targetNode;
|
||||
|
@@ -26,6 +26,11 @@
|
||||
#include "designdocumentview.h"
|
||||
#include <rewriterview.h>
|
||||
#include <basetexteditmodifier.h>
|
||||
#include <modelmerger.h>
|
||||
|
||||
#include "designdocument.h"
|
||||
#include <qmldesignerplugin.h>
|
||||
#include <nodelistproperty.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QPlainTextEdit>
|
||||
@@ -33,10 +38,12 @@
|
||||
#include <QMimeData>
|
||||
#include <QDebug>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
DesignDocumentView::DesignDocumentView(QObject *parent)
|
||||
: AbstractView(parent), m_modelMerger(this)
|
||||
: AbstractView(parent), m_modelMerger(new ModelMerger(this))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -44,6 +51,16 @@ DesignDocumentView::~DesignDocumentView()
|
||||
{
|
||||
}
|
||||
|
||||
ModelNode DesignDocumentView::insertModel(const ModelNode &modelNode)
|
||||
{
|
||||
return m_modelMerger->insertModel(modelNode);
|
||||
}
|
||||
|
||||
void DesignDocumentView::replaceModel(const ModelNode &modelNode)
|
||||
{
|
||||
m_modelMerger->replaceModel(modelNode);
|
||||
}
|
||||
|
||||
static QStringList arrayToStringList(const QByteArray &byteArray)
|
||||
{
|
||||
QString str(QString::fromUtf8(byteArray));
|
||||
@@ -140,4 +157,95 @@ void DesignDocumentView::fromText(QString text)
|
||||
}
|
||||
}
|
||||
|
||||
static Model *currentModel()
|
||||
{
|
||||
DesignDocument *document = QmlDesignerPlugin::instance()->viewManager().currentDesignDocument();
|
||||
if (document)
|
||||
return document->currentModel();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Model *DesignDocumentView::pasteToModel()
|
||||
{
|
||||
Model *parentModel = currentModel();
|
||||
|
||||
QTC_ASSERT(parentModel, return 0);
|
||||
|
||||
Model *pasteModel(Model::create("empty", 1, 0, parentModel));
|
||||
|
||||
pasteModel->setFileUrl(parentModel->fileUrl());
|
||||
pasteModel->changeImports(parentModel->imports(), {});
|
||||
|
||||
Q_ASSERT(pasteModel);
|
||||
|
||||
if (!pasteModel)
|
||||
return 0;
|
||||
|
||||
DesignDocumentView view;
|
||||
pasteModel->attachView(&view);
|
||||
|
||||
view.fromClipboard();
|
||||
|
||||
return pasteModel;
|
||||
}
|
||||
|
||||
void DesignDocumentView::copyModelNodes(const QList<ModelNode> &nodesToCopy)
|
||||
{
|
||||
Model *parentModel = currentModel();
|
||||
|
||||
QTC_ASSERT(parentModel, return);
|
||||
|
||||
QScopedPointer<Model> copyModel(Model::create("QtQuick.Rectangle", 1, 0, parentModel));
|
||||
|
||||
copyModel->setFileUrl(parentModel->fileUrl());
|
||||
copyModel->changeImports(parentModel->imports(), {});
|
||||
|
||||
Q_ASSERT(copyModel);
|
||||
|
||||
QList<ModelNode> selectedNodes = nodesToCopy;
|
||||
|
||||
if (selectedNodes.isEmpty())
|
||||
return;
|
||||
|
||||
foreach (const ModelNode &node, selectedNodes) {
|
||||
foreach (const ModelNode &node2, selectedNodes) {
|
||||
if (node.isAncestorOf(node2))
|
||||
selectedNodes.removeAll(node2);
|
||||
}
|
||||
}
|
||||
|
||||
DesignDocumentView view;
|
||||
copyModel->attachView(&view);
|
||||
|
||||
if (selectedNodes.count() == 1) {
|
||||
ModelNode selectedNode(selectedNodes.first());
|
||||
|
||||
if (!selectedNode.isValid())
|
||||
return;
|
||||
|
||||
view.replaceModel(selectedNode);
|
||||
|
||||
Q_ASSERT(view.rootModelNode().isValid());
|
||||
Q_ASSERT(view.rootModelNode().type() != "empty");
|
||||
|
||||
view.toClipboard();
|
||||
} else { //multi items selected
|
||||
|
||||
foreach (ModelNode node, view.rootModelNode().directSubModelNodes()) {
|
||||
node.destroy();
|
||||
}
|
||||
view.changeRootNodeType("QtQuick.Rectangle", 2, 0);
|
||||
view.rootModelNode().setIdWithRefactoring("designer__Selection");
|
||||
|
||||
foreach (const ModelNode &selectedNode, selectedNodes) {
|
||||
ModelNode newNode(view.insertModel(selectedNode));
|
||||
view.rootModelNode().nodeListProperty("data").reparentHere(newNode);
|
||||
}
|
||||
|
||||
view.toClipboard();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}// namespace QmlDesigner
|
||||
|
@@ -26,21 +26,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <abstractview.h>
|
||||
#include <modelmerger.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
class DesignDocumentView : public AbstractView
|
||||
class ModelMerger;
|
||||
|
||||
class QMLDESIGNERCORE_EXPORT DesignDocumentView : public AbstractView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DesignDocumentView(QObject *parent = 0);
|
||||
~DesignDocumentView();
|
||||
|
||||
ModelNode insertModel(const ModelNode &modelNode)
|
||||
{ return m_modelMerger.insertModel(modelNode); }
|
||||
void replaceModel(const ModelNode &modelNode)
|
||||
{ m_modelMerger.replaceModel(modelNode); }
|
||||
ModelNode insertModel(const ModelNode &modelNode);
|
||||
void replaceModel(const ModelNode &modelNode);
|
||||
|
||||
void toClipboard() const;
|
||||
void fromClipboard();
|
||||
@@ -48,8 +49,11 @@ public:
|
||||
QString toText() const;
|
||||
void fromText(QString text);
|
||||
|
||||
static Model *pasteToModel();
|
||||
static void copyModelNodes(const QList<ModelNode> &nodesToCopy);
|
||||
|
||||
private:
|
||||
ModelMerger m_modelMerger;
|
||||
std::unique_ptr<ModelMerger> m_modelMerger;
|
||||
};
|
||||
|
||||
}// namespace QmlDesigner
|
||||
|
@@ -66,6 +66,7 @@ public:
|
||||
const QList<ModelNode> keyframePositions() const;
|
||||
|
||||
static bool isValidKeyframe(const ModelNode &node);
|
||||
static bool checkKeyframesType(const ModelNode &node);
|
||||
static QmlTimelineFrames keyframesForKeyframe(const ModelNode &node);
|
||||
|
||||
void moveAllFrames(qreal offset);
|
||||
|
@@ -96,6 +96,7 @@ public:
|
||||
void toggleStatesViewExpanded();
|
||||
|
||||
QString qmlJSEditorHelpId() const;
|
||||
DesignDocument *currentDesignDocument() const;
|
||||
|
||||
private: // functions
|
||||
Q_DISABLE_COPY(ViewManager)
|
||||
@@ -107,7 +108,6 @@ private: // functions
|
||||
|
||||
Model *currentModel() const;
|
||||
Model *documentModel() const;
|
||||
DesignDocument *currentDesignDocument() const;
|
||||
QString pathToQt() const;
|
||||
|
||||
void switchStateEditorViewToBaseState();
|
||||
|
@@ -55,8 +55,7 @@ bool QmlTimelineFrames::isValid() const
|
||||
|
||||
bool QmlTimelineFrames::isValidQmlTimelineFrames(const ModelNode &modelNode)
|
||||
{
|
||||
return isValidQmlModelNodeFacade(modelNode)
|
||||
&& modelNode.metaInfo().isValid()
|
||||
return modelNode.isValid() && modelNode.metaInfo().isValid()
|
||||
&& modelNode.metaInfo().isSubclassOf("QtQuick.Timeline.Keyframes");
|
||||
}
|
||||
|
||||
@@ -219,6 +218,11 @@ bool QmlTimelineFrames::isValidKeyframe(const ModelNode &node)
|
||||
&& node.metaInfo().isSubclassOf("QtQuick.Timeline.Keyframe");
|
||||
}
|
||||
|
||||
bool QmlTimelineFrames::checkKeyframesType(const ModelNode &node)
|
||||
{
|
||||
return node.isValid() && node.type() == "QtQuick.Timeline.Keyframes";
|
||||
}
|
||||
|
||||
QmlTimelineFrames QmlTimelineFrames::keyframesForKeyframe(const ModelNode &node)
|
||||
{
|
||||
if (isValidKeyframe(node) && node.hasParentProperty()) {
|
||||
|
@@ -63,7 +63,7 @@ using namespace Internal;
|
||||
const char QTVERSION_DATA_KEY[] = "QtVersion.";
|
||||
const char QTVERSION_TYPE_KEY[] = "QtVersion.Type";
|
||||
const char QTVERSION_FILE_VERSION_KEY[] = "Version";
|
||||
const char QTVERSION_FILENAME[] = "/qtcreator/qtversion.xml";
|
||||
const char QTVERSION_FILENAME[] = "/qtversion.xml";
|
||||
|
||||
static QMap<int, BaseQtVersion *> m_versions;
|
||||
static int m_idcount = 0;
|
||||
@@ -77,16 +77,12 @@ enum { debug = 0 };
|
||||
|
||||
static FileName globalSettingsFileName()
|
||||
{
|
||||
QSettings *globalSettings = ExtensionSystem::PluginManager::globalSettings();
|
||||
return FileName::fromString(QFileInfo(globalSettings->fileName()).absolutePath()
|
||||
+ QLatin1String(QTVERSION_FILENAME));
|
||||
return FileName::fromString(Core::ICore::installerResourcePath() + QTVERSION_FILENAME);
|
||||
}
|
||||
|
||||
static FileName settingsFileName(const QString &path)
|
||||
{
|
||||
QSettings *settings = ExtensionSystem::PluginManager::settings();
|
||||
QFileInfo settingsLocation(settings->fileName());
|
||||
return FileName::fromString(settingsLocation.absolutePath() + path);
|
||||
return FileName::fromString(Core::ICore::resourcePath() + path);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include <QClipboard>
|
||||
#include <QIcon>
|
||||
#include <QSettings>
|
||||
#include <QStyle>
|
||||
|
||||
static const char SettingsApplication[] = "QtCreator";
|
||||
static const char SettingsKeySkipWarningAbortingBacktrace[]
|
||||
|
@@ -51,7 +51,7 @@ Settings::Settings() :
|
||||
sdkPath.appendPath(QLatin1String(DATA_PATH));
|
||||
sdkPath = Utils::FileName::fromString(QDir::cleanPath(sdkPath.toString()));
|
||||
sdkPath.appendPath(QLatin1String(Core::Constants::IDE_SETTINGSVARIANT_STR)
|
||||
+ QLatin1String("/qtcreator"));
|
||||
+ '/' + Core::Constants::IDE_ID);
|
||||
}
|
||||
|
||||
Utils::FileName Settings::getPath(const QString &file)
|
||||
|
Reference in New Issue
Block a user