Merge remote-tracking branch 'origin/2.7'

Conflicts:
	src/plugins/android/androidrunner.cpp
	src/plugins/clearcase/clearcasesync.cpp
	src/plugins/fakevim/fakevimhandler.cpp
	tests/auto/ioutils/ioutils.pro

Change-Id: I31587b8a4dd6aacc1e76803159da51a972878370
This commit is contained in:
Eike Ziller
2013-04-08 13:26:37 +02:00
113 changed files with 5845 additions and 1194 deletions

7
.gitignore vendored
View File

@@ -92,14 +92,15 @@ release/
/doc/api/html/
/doc/pluginhowto/html/
/dist/gdb/python/
/dist/gdb/qtcreator-*/
/dist/gdb/source/
/dist/gdb/staging/
/dist/gdb/*.gz
.moc/
.obj/
.pch/
.rcc/
.uic/
/dist/gdb/qtcreator-*/
/dist/gdb/source/
/dist/gdb/staging/
ipch/
tmp/
# ignore both a directory as well as a symlink

View File

@@ -40,7 +40,7 @@
You can also specify indentation settings separately for C++ and QML files
either globally or for the open project. For more information, see
\l{Indenting Code}.
\l{Indenting Text or Code}.
You can perform the following configuration actions:
@@ -53,7 +53,7 @@
{definition files for syntax highlighting} for other types of files
than C++ or QML in \gui{Generic Highlighter}.
\li Set \l{Indenting Code}{tabs, indentation, the handling of
\li Set \l{Indenting Text or Code}{tabs, indentation, the handling of
whitespace, and mouse operations} in \gui Behavior.
\li Set various display properties, for example,

View File

@@ -63,10 +63,10 @@
\QC anticipates what you are going to write and completes code
and code snippets for elements, properties, and IDs.
\li \l{Indenting Code}
\li \l{Indenting Text or Code}
\QC indents code according to rules that you specify either
globally for all files or separately for text, C++, or QML files.
\QC indents text and code according to rules that you specify separately for
files that contain C++ or QML code and for other text files.
\li \l{Using Qt Quick Toolbars}

View File

@@ -1004,44 +1004,29 @@
\page creator-indenting-code.html
\nextpage qt-quick-toolbars.html
\title Indenting Code
\title Indenting Text or Code
When you type code, it is indented automatically according to the selected
text editor and code style options. Select a block to indent it when you
When you type text or code, it is indented automatically according to the selected
text editor or code style options. Select a block to indent it when you
press \key Tab. Press \key {Shift+Tab} to decrease the indentation. You
can disable automatic indentation.
You can specify indentation either globally for all files or separately
for:
You can specify indentation for:
\list
\li Text files
\li C++ files
\li QML files
\li Other text files
\endlist
You can also specify indentation separately for each project. You can
specify several sets of code style settings and easily switch between them.
In addition, you can import and export code style settings.
\section1 Indenting Text Files
To specify global indentation settings for the text editor, select
\gui {Tools > Options > Text Editor > Behavior}. You can also use these
settings globally for all editors and files.
\image qtcreator-indentation.png "Text Editor Behavior options"
To specify settings for a particular project, select \gui {Projects >
Editor Settings}.
You can specify how to interpret the \key Tab and \key Backspace key
presses and how to align continuation lines.
\section1 Indenting C++ Files
To specify indentation settings for the C++ editor:
@@ -1082,12 +1067,12 @@
You can use the live preview to see how the options change the indentation.
To specify the settings for a particular project, select \gui {Projects >
To specify different settings for a particular project, select \gui {Projects >
Code Style Settings}.
\section1 Indenting QML Files
To specify global settings for the Qt Quick editor:
To specify settings for the Qt Quick editor:
\list 1
@@ -1109,26 +1094,39 @@
You can specify how to interpret the \key Tab key presses and how to align
continuation lines.
To specify the settings for a particular project, select \gui {Projects >
To specify different settings for a particular project, select \gui {Projects >
Code Style Settings}.
\section1 Indenting Other Text Files
To specify indentation settings for text files that do not contain C++ or QML code (such
as Python code files), select \gui {Tools > Options > Text Editor > Behavior}.
\image qtcreator-indentation.png "Text Editor Behavior options"
To specify different settings for a particular project, select \gui {Projects >
Editor Settings}.
You can specify how to interpret the \key Tab and \key Backspace key
presses and how to align continuation lines.
\section1 Specifying Tab Settings
You can specify tab settings at the following levels:
\list
\li Global settings for all files
\li For all C++ files
\li Global C++ settings for C++ files
\li For all QML files
\li Global Qt Quick settings for QML files
\li For all other text files
\li Project specific settings for all editors of files in the project
\li For C++ files in a project
\li Project specific settings for C++ files in the project
\li For QML files in a project
\li Project specific settings for QML files in the project
\li For other text files in a project
\endlist
@@ -1150,8 +1148,8 @@
\section2 Speficying Typing Options
When you type code, it is indented automatically according to the selected
text editor and code style options. Specify typing options in the
When you type text or code, it is indented automatically according to the selected
text editor or code style options. Specify typing options in the
\gui Typing group. To disable automatic indentation, deselect the
\gui {Enable automatic indentation} check box.

View File

@@ -160,6 +160,9 @@
a list of all projects open in the current session. The files for each
project are grouped according to their file type.
If the project is under version control, information from the version control system
might be displayed in brackets after the project name. This is currently implemented for
Git (the branch name or a tag is displayed) and ClearCase (the view name is displayed).
You can use the project tree in the following ways:

View File

@@ -70,6 +70,6 @@
\endlist
For more information about the settings, see \l{Indenting Code}.
For more information about the settings, see \l{Indenting Text or Code}.
*/

View File

@@ -59,7 +59,7 @@
\list
\li \l{Indenting Code}
\li \l{Indenting Text or Code}
\li \l{File Encoding}

View File

@@ -209,7 +209,7 @@
\li \l{Semantic Highlighting}
\li \l{Checking Code Syntax}
\li \l{Completing Code}
\li \l{Indenting Code}
\li \l{Indenting Text or Code}
\li \l{Using Qt Quick Toolbars}
\li \l{Pasting and Fetching Code Snippets}
\li \l{Using Text Editing Macros}

View File

@@ -21,7 +21,7 @@ OTHER_FILES += dist/copyright_template.txt \
qbs/pluginspec/pluginspec.qbs
qmake_cache = $$targetPath($$IDE_BUILD_TREE/.qmake.cache)
equals(QMAKE_DIR_SEP, /): {
!equals(QMAKE_HOST.os, Windows) {
maybe_quote = "\""
maybe_backslash = "\\"
}

View File

@@ -1948,6 +1948,8 @@ class PlainDumper:
lister = getattr(printer, "children", None)
children = [] if lister is None else list(lister())
d.putType(self.printer.name)
val = printer.to_string().encode("hex")
d.putValue(val, Hex2EncodedLatin1)
d.putValue(printer.to_string())
d.putNumChild(len(children))
if d.isExpanded():

View File

@@ -17,8 +17,9 @@
<env var="QML2_IMPORT_PATH" value="app/native/imports"/>
<env var="QT_PLUGIN_PATH" value="app/native/plugins"/>
<env var="LD_LIBRARY_PATH" value="app/native/lib"/>
<arg>-style</arg>
<arg>qnxlight</arg>
<arg>-platform</arg>
<arg>qnx</arg>
<action system="true">run_native</action>

File diff suppressed because it is too large Load Diff

View File

@@ -702,6 +702,7 @@ QByteArray Preprocessor::run(const QString &fileName,
m_scratchBuffer.clear();
QByteArray preprocessed, includeGuardMacroName;
preprocessed.reserve(source.size() * 2); // multiply by 2 because we insert #gen lines.
preprocess(fileName, source, &preprocessed, &includeGuardMacroName, noLines,
markGeneratedTokens, false);
if (!includeGuardMacroName.isEmpty())

View File

@@ -334,7 +334,6 @@ public:
delete connection;
return kDNSServiceErr_Unknown;
}
typedef void (*AvahiSimplePollSetFuncPtr)(AvahiSimplePoll *s, AvahiPollFunc func, void *userdata);
m_simplePollSetFunc(connection->simple_poll, &cAvahiPollFunction, mainConnection);
/* Allocate a new client */
int error;

View File

@@ -143,7 +143,11 @@ AndroidDebugSupport::AndroidDebugSupport(AndroidRunConfiguration *runConfig,
m_runner, SLOT(start()));
connect(m_runControl, SIGNAL(finished()),
m_runner, SLOT(stop()));
connect(m_runControl->engine(), SIGNAL(aboutToNotifyInferiorSetupOk()),
m_runner, SLOT(handleGdbRunning()));
connect(m_runner, SIGNAL(remoteServerRunning(QByteArray,int)),
SLOT(handleRemoteServerRunning(QByteArray,int)));
connect(m_runner, SIGNAL(remoteProcessStarted(int,int)),
SLOT(handleRemoteProcessStarted(int,int)));
connect(m_runner, SIGNAL(remoteProcessFinished(QString)),
@@ -155,6 +159,11 @@ AndroidDebugSupport::AndroidDebugSupport(AndroidRunConfiguration *runConfig,
SLOT(handleRemoteOutput(QByteArray)));
}
void AndroidDebugSupport::handleRemoteServerRunning(const QByteArray &serverChannel, int pid)
{
m_runControl->engine()->notifyEngineRemoteServerRunning(serverChannel, pid);
}
void AndroidDebugSupport::handleRemoteProcessStarted(int gdbServerPort, int qmlPort)
{
disconnect(m_runner, SIGNAL(remoteProcessStarted(int,int)),

View File

@@ -53,7 +53,8 @@ public:
Debugger::DebuggerRunControl *runControl);
private slots:
void handleRemoteProcessStarted(int gdbServerPort = -1, int qmlPort = -1);
void handleRemoteServerRunning(const QByteArray &serverChannel, int pid);
void handleRemoteProcessStarted(int gdbServerPort, int qmlPort);
void handleRemoteProcessFinished(const QString &errorMsg);
void handleRemoteOutput(const QByteArray &output);

View File

@@ -69,7 +69,7 @@ IDeviceWidget *AndroidDevice::createWidget()
QList<Core::Id> AndroidDevice::actionIds() const
{
return QList<Core::Id>()<<Core::Id(Constants::ANDROID_DEVICE_ID);
return QList<Core::Id>();
}
QString AndroidDevice::displayNameForActionId(Core::Id actionId) const

View File

@@ -440,6 +440,8 @@ bool AndroidPackageCreationStep::createPackage()
QFile::remove(m_gdbServerDestination.toString());
if (m_debugBuild || !m_certificateAlias.length()) {
build << QLatin1String("debug");
QDir dir;
dir.mkpath(m_gdbServerDestination.toFileInfo().absolutePath());
if (!QFile::copy(m_gdbServerSource.toString(), m_gdbServerDestination.toString())) {
raiseError(tr("Can't copy gdbserver from '%1' to '%2'").arg(m_gdbServerSource.toUserOutput())
.arg(m_gdbServerDestination.toUserOutput()));

View File

@@ -37,21 +37,29 @@
#include <debugger/debuggerrunconfigurationaspect.h>
#include <projectexplorer/target.h>
#include <utils/qtcassert.h>
#include <QTime>
#include <QtConcurrentRun>
#include <QTemporaryFile>
namespace Android {
namespace Internal {
typedef QLatin1String _;
AndroidRunner::AndroidRunner(QObject *parent, AndroidRunConfiguration *runConfig, bool debuggingMode)
: QThread(parent)
{
m_wasStarted = false;
Debugger::DebuggerRunConfigurationAspect *aspect
= runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>();
m_useCppDebugger = debuggingMode && aspect->useCppDebugger();
m_useQmlDebugger = debuggingMode && aspect->useQmlDebugger();
m_remoteGdbChannel = runConfig->remoteChannel();
QString channel = runConfig->remoteChannel();
QTC_CHECK(channel.startsWith(QLatin1Char(':')));
m_localGdbServerPort = channel.mid(1).toUShort();
QTC_CHECK(m_localGdbServerPort);
m_qmlPort = aspect->qmlDebugServerPort();
ProjectExplorer::Target *target = runConfig->target();
AndroidDeployStep *ds = runConfig->deployStep();
@@ -64,204 +72,258 @@ AndroidRunner::AndroidRunner(QObject *parent, AndroidRunConfiguration *runConfig
m_packageName = m_intentName.left(m_intentName.indexOf(QLatin1Char('/')));
m_deviceSerialNumber = ds->deviceSerialNumber();
m_processPID = -1;
m_gdbserverPID = -1;
connect(&m_checkPIDTimer, SIGNAL(timeout()), SLOT(checkPID()));
m_adb = AndroidConfigurations::instance().adbToolPath().toString();
m_selector = AndroidDeviceInfo::adbSelector(m_deviceSerialNumber);
QString packageDir = _("/data/data/") + m_packageName;
m_pingFile = packageDir + _("/debug-ping");
m_pongFile = _("/data/local/tmp/qt/debug-pong-") + m_packageName;
m_gdbserverSocket = packageDir + _("/debug-socket");
m_gdbserverPath = packageDir + _("/lib/gdbserver");
m_gdbserverCommand = m_gdbserverPath + _(" --multi +") + m_gdbserverSocket;
// Detect busybox, as we need to pass -w to ps to get wide output.
QProcess psProc;
psProc.start(m_adb, selector() << _("shell") << _("readlink") << _("$(which ps)"));
psProc.waitForFinished();
QByteArray which = psProc.readAll();
m_isBusyBox = which.startsWith("busybox");
connect(&m_adbLogcatProcess, SIGNAL(readyReadStandardOutput()), SLOT(logcatReadStandardOutput()));
connect(&m_adbLogcatProcess, SIGNAL(readyReadStandardError()) , SLOT(logcatReadStandardError()));
connect(&m_adbLogcatProcess, SIGNAL(readyReadStandardError()), SLOT(logcatReadStandardError()));
connect(&m_checkPIDTimer, SIGNAL(timeout()), SLOT(checkPID()));
}
AndroidRunner::~AndroidRunner()
{
stop();
//stop();
}
static int extractPidFromChunk(const QByteArray &chunk, int from)
{
int pos1 = chunk.indexOf(' ', from);
if (pos1 == -1)
return -1;
while (chunk[pos1] == ' ')
++pos1;
int pos3 = chunk.indexOf(' ', pos1);
int pid = chunk.mid(pos1, pos3 - pos1).toInt();
return pid;
}
static int extractPid(const QString &exeName, const QByteArray &psOutput)
{
const QByteArray needle = exeName.toUtf8() + '\r';
const int to = psOutput.indexOf(needle);
if (to == -1)
return -1;
const int from = psOutput.lastIndexOf('\n', to);
if (from == -1)
return -1;
return extractPidFromChunk(psOutput, from);
}
QByteArray AndroidRunner::runPs()
{
QProcess psProc;
QStringList args = m_selector;
args << _("shell") << _("ps");
if (m_isBusyBox)
args << _("-w");
psProc.start(m_adb, args);
psProc.waitForFinished();
return psProc.readAll();
}
void AndroidRunner::checkPID()
{
QProcess psProc;
QLatin1String psCmd = QLatin1String("ps");
QLatin1String psPidRx = QLatin1String("\\d+\\s+(\\d+)");
// Detect busybox, as we need to pass -w to it to get wide output.
psProc.start(AndroidConfigurations::instance().adbToolPath().toString(),
AndroidDeviceInfo::adbSelector(m_deviceSerialNumber)
<< QLatin1String("shell") << QLatin1String("readlink") << QLatin1String("$(which ps)"));
if (!psProc.waitForFinished(-1)) {
psProc.kill();
if (!m_wasStarted)
return;
}
QByteArray which = psProc.readAll();
if (which.startsWith("busybox")) {
psCmd = QLatin1String("ps -w");
psPidRx = QLatin1String("(\\d+)");
}
psProc.start(AndroidConfigurations::instance().adbToolPath().toString(),
AndroidDeviceInfo::adbSelector(m_deviceSerialNumber)
<< QLatin1String("shell") << psCmd);
if (!psProc.waitForFinished(-1)) {
psProc.kill();
return;
}
QRegExp rx(psPidRx);
qint64 pid = -1;
QList<QByteArray> procs = psProc.readAll().split('\n');
foreach (const QByteArray &proc, procs) {
if (proc.trimmed().endsWith(m_packageName.toLatin1())) {
if (rx.indexIn(QLatin1String(proc)) > -1) {
pid = rx.cap(1).toLongLong();
break;
}
}
}
if (-1 != m_processPID && pid == -1) {
m_processPID = -1;
QByteArray psOut = runPs();
m_processPID = extractPid(m_packageName, psOut);
if (m_processPID == -1)
emit remoteProcessFinished(tr("\n\n'%1' died.").arg(m_packageName));
return;
}
m_processPID = pid;
}
if (!m_useCppDebugger)
return;
m_gdbserverPID = -1;
foreach (const QByteArray &proc, procs) {
if (proc.trimmed().endsWith("gdbserver")) {
if (rx.indexIn(QLatin1String(proc)) > -1) {
m_gdbserverPID = rx.cap(1).toLongLong();
break;
}
}
}
void AndroidRunner::forceStop()
{
QProcess proc;
proc.start(m_adb, selector() << _("shell") << _("am") << _("force-stop"));
proc.waitForFinished();
}
void AndroidRunner::killPID()
{
checkPID(); //updates m_processPID and m_gdbserverPID
for (int tries = 0; tries < 10 && (m_processPID != -1 || m_gdbserverPID != -1); ++tries) {
if (m_processPID != -1) {
adbKill(m_processPID, m_deviceSerialNumber, 2000);
adbKill(m_processPID, m_deviceSerialNumber, 2000, m_packageName);
const QByteArray out = runPs();
int from = 0;
while (1) {
const int to = out.indexOf('\n', from);
if (to == -1)
break;
QString line = QString::fromUtf8(out.data() + from, to - from - 1);
if (line.endsWith(m_packageName) || line.endsWith(m_gdbserverPath)) {
int pid = extractPidFromChunk(out, from);
adbKill(pid);
}
if (m_gdbserverPID != -1) {
adbKill(m_gdbserverPID, m_deviceSerialNumber, 2000);
adbKill(m_gdbserverPID, m_deviceSerialNumber, 2000, m_packageName);
}
checkPID();
from = to + 1;
}
}
void AndroidRunner::start()
{
QtConcurrent::run(this,&AndroidRunner::asyncStart);
m_adbLogcatProcess.start(m_adb, selector() << _("logcat"));
m_wasStarted = false;
m_checkPIDTimer.start(1000); // check if the application is alive every 1 seconds
QtConcurrent::run(this, &AndroidRunner::asyncStart);
}
void AndroidRunner::asyncStart()
{
QMutexLocker locker(&m_mutex);
m_processPID = -1;
killPID(); // kill any process with this name
QString extraParams;
QProcess adbStarProc;
forceStop();
killPID();
if (m_useCppDebugger) {
QStringList arguments = AndroidDeviceInfo::adbSelector(m_deviceSerialNumber);
arguments << QLatin1String("forward") << QString::fromLatin1("tcp%1").arg(m_remoteGdbChannel)
<< QString::fromLatin1("localfilesystem:/data/data/%1/debug-socket").arg(m_packageName);
adbStarProc.start(AndroidConfigurations::instance().adbToolPath().toString(), arguments);
if (!adbStarProc.waitForStarted()) {
emit remoteProcessFinished(tr("Failed to forward C++ debugging ports. Reason: %1.").arg(adbStarProc.errorString()));
// Remove pong file.
QProcess adb;
adb.start(m_adb, selector() << _("shell") << _("rm") << m_pongFile);
adb.waitForFinished();
}
QStringList args = selector();
args << _("shell") << _("am") << _("start") << _("-n") << m_intentName;
if (m_useCppDebugger) {
QProcess adb;
adb.start(m_adb, selector() << _("forward")
<< QString::fromLatin1("tcp:%1").arg(m_localGdbServerPort)
<< _("localfilesystem:") + m_gdbserverSocket);
if (!adb.waitForStarted()) {
emit remoteProcessFinished(tr("Failed to forward C++ debugging ports. Reason: %1.").arg(adb.errorString()));
return;
}
if (!adbStarProc.waitForFinished(-1)) {
if (!adb.waitForFinished(-1)) {
emit remoteProcessFinished(tr("Failed to forward C++ debugging ports."));
return;
}
extraParams = QLatin1String("-e native_debug true -e gdbserver_socket +debug-socket");
args << _("-e") << _("debug_ping") << _("true");
args << _("-e") << _("ping_file") << m_pingFile;
args << _("-e") << _("pong_file") << m_pongFile;
args << _("-e") << _("gdbserver_command") << m_gdbserverCommand;
args << _("-e") << _("gdbserver_socket") << m_gdbserverSocket;
}
if (m_useQmlDebugger) {
QStringList arguments = AndroidDeviceInfo::adbSelector(m_deviceSerialNumber);
// currently forward to same port on device and host
QString port = QString::fromLatin1("tcp:%1").arg(m_qmlPort);
arguments << QLatin1String("forward") << port << port; // currently forward to same port on device and host
adbStarProc.start(AndroidConfigurations::instance().adbToolPath().toString(), arguments);
if (!adbStarProc.waitForStarted()) {
emit remoteProcessFinished(tr("Failed to forward QML debugging ports. Reason: %1.").arg(adbStarProc.errorString()));
QProcess adb;
adb.start(m_adb, selector() << _("forward") << port << port);
if (!adb.waitForStarted()) {
emit remoteProcessFinished(tr("Failed to forward QML debugging ports. Reason: %1.").arg(adb.errorString()));
return;
}
if (!adbStarProc.waitForFinished(-1)) {
if (!adb.waitForFinished()) {
emit remoteProcessFinished(tr("Failed to forward QML debugging ports."));
return;
}
extraParams+=QString::fromLatin1(" -e qml_debug true -e qmljsdebugger port:%1")
.arg(m_qmlPort);
args << _("-e") << _("qml_debug") << _("true");
args << _("-e") << _("qmljsdebugger") << QString::fromLatin1("port:%1").arg(m_qmlPort);
}
if (m_useLocalQtLibs) {
extraParams += QLatin1String(" -e use_local_qt_libs true");
extraParams += QLatin1String(" -e libs_prefix /data/local/tmp/qt/");
extraParams += QLatin1String(" -e load_local_libs ") + m_localLibs;
extraParams += QLatin1String(" -e load_local_jars ") + m_localJars;
args << _("-e") << _("use_local_qt_libs") << _("true");
args << _("-e") << _("libs_prefix") << _("/data/local/tmp/qt/");
args << _("-e") << _("load_local_libs") << m_localLibs;
args << _("-e") << _("load_local_jars") << m_localJars;
if (!m_localJarsInitClasses.isEmpty())
extraParams += QLatin1String(" -e static_init_classes ") + m_localJarsInitClasses;
args << _("-e") << _("static_init_classes") << m_localJarsInitClasses;
}
extraParams = extraParams.trimmed();
QStringList arguments = AndroidDeviceInfo::adbSelector(m_deviceSerialNumber);
arguments << QLatin1String("shell") << QLatin1String("am")
<< QLatin1String("start") << QLatin1String("-n") << m_intentName;
if (extraParams.length())
arguments << extraParams.split(QLatin1Char(' '));
adbStarProc.start(AndroidConfigurations::instance().adbToolPath().toString(), arguments);
if (!adbStarProc.waitForStarted()) {
emit remoteProcessFinished(tr("Failed to start the activity. Reason: %1.").arg(adbStarProc.errorString()));
QProcess adb;
adb.start(m_adb, args);
if (!adb.waitForStarted()) {
emit remoteProcessFinished(tr("Failed to start the activity. Reason: %1.").arg(adb.errorString()));
return;
}
if (!adbStarProc.waitForFinished(-1)) {
adbStarProc.terminate();
if (!adb.waitForFinished(-1)) {
adb.terminate();
emit remoteProcessFinished(tr("Unable to start '%1'.").arg(m_packageName));
return;
}
QTime startTime = QTime::currentTime();
while (m_processPID == -1 && startTime.secsTo(QTime::currentTime()) < 10) { // wait up to 10 seconds for application to start
checkPID();
if (m_useCppDebugger || m_useQmlDebugger) {
// Handling ping.
for (int i = 0; ; ++i) {
QTemporaryFile tmp(_("pingpong"));
tmp.open();
tmp.close();
QProcess process;
process.start(m_adb, selector() << _("pull") << m_pingFile << tmp.fileName());
process.waitForFinished();
QFile res(tmp.fileName());
const bool doBreak = res.size();
res.remove();
if (doBreak)
break;
if (i == 20) {
emit remoteProcessFinished(tr("Unable to start '%1'.").arg(m_packageName));
return;
}
qDebug() << "WAITING FOR " << tmp.fileName();
QThread::msleep(500);
}
}
QByteArray psOut = runPs();
m_processPID = extractPid(m_packageName, psOut);
if (m_processPID == -1) {
emit remoteProcessFinished(tr("Cannot find %1 process.").arg(m_packageName));
emit remoteProcessFinished(tr("Unable to start '%1'.").arg(m_packageName));
return;
}
if (m_useCppDebugger) {
startTime = QTime::currentTime();
while (m_gdbserverPID == -1 && startTime.secsTo(QTime::currentTime()) < 25) { // wait up to 25 seconds to connect
checkPID();
}
msleep(200); // give gdbserver more time to start
m_wasStarted = true;
if (m_useCppDebugger || m_useQmlDebugger) {
// This will be funneled to the engine to actually start and attach
// gdb. Afterwards this ends up in handleGdbRunning() below.
QByteArray serverChannel = ':' + QByteArray::number(m_localGdbServerPort);
emit remoteServerRunning(serverChannel, m_processPID);
} else {
// Start without debugging.
emit remoteProcessStarted(-1, -1);
}
QMetaObject::invokeMethod(this, "startLogcat", Qt::QueuedConnection);
}
void AndroidRunner::startLogcat()
void AndroidRunner::handleGdbRunning()
{
m_checkPIDTimer.start(1000); // check if the application is alive every 1 seconds
m_adbLogcatProcess.start(AndroidConfigurations::instance().adbToolPath().toString(),
AndroidDeviceInfo::adbSelector(m_deviceSerialNumber)
<< QLatin1String("logcat"));
emit remoteProcessStarted(5039);
QTemporaryFile tmp(_("pingpong"));
tmp.open();
QProcess process;
process.start(m_adb, selector() << _("push") << tmp.fileName() << m_pongFile);
process.waitForFinished();
QTC_CHECK(m_processPID != -1);
emit remoteProcessStarted(m_localGdbServerPort, -1);
}
void AndroidRunner::stop()
{
QMutexLocker locker(&m_mutex);
m_checkPIDTimer.stop();
if (m_processPID == -1) {
m_adbLogcatProcess.kill();
return; // don't emit another signal
if (m_processPID != -1) {
killPID();
emit remoteProcessFinished(tr("\n\n'%1' terminated.").arg(m_packageName));
}
killPID();
//QObject::disconnect(&m_adbLogcatProcess, 0, this, 0);
m_adbLogcatProcess.kill();
m_adbLogcatProcess.waitForFinished(-1);
m_adbLogcatProcess.waitForFinished();
}
void AndroidRunner::logcatReadStandardError()
@@ -291,20 +353,21 @@ void AndroidRunner::logcatReadStandardOutput()
m_logcat = line;
}
void AndroidRunner::adbKill(qint64 pid, const QString &device, int timeout, const QString &runAsPackageName)
void AndroidRunner::adbKill(qint64 pid)
{
QProcess process;
QStringList arguments = AndroidDeviceInfo::adbSelector(device);
arguments << QLatin1String("shell");
if (runAsPackageName.size())
arguments << QLatin1String("run-as") << runAsPackageName;
arguments << QLatin1String("kill") << QLatin1String("-9");
arguments << QString::number(pid);
process.start(AndroidConfigurations::instance().adbToolPath().toString(), arguments);
if (!process.waitForFinished(timeout))
process.kill();
{
QProcess process;
process.start(m_adb, selector() << _("shell")
<< _("kill") << QLatin1String("-9") << QString::number(pid));
process.waitForFinished();
}
{
QProcess process;
process.start(m_adb, selector() << _("shell")
<< _("run-as") << m_packageName
<< _("kill") << QLatin1String("-9") << QString::number(pid));
process.waitForFinished();
}
}
QString AndroidRunner::displayName() const

View File

@@ -56,9 +56,11 @@ public:
public slots:
void start();
void stop();
void handleGdbRunning();
signals:
void remoteProcessStarted(int gdbServerPort = -1, int qmlPort = -1);
void remoteServerRunning(const QByteArray &serverChannel, int pid);
void remoteProcessStarted(int gdbServerPort, int qmlPort);
void remoteProcessFinished(const QString &errString = QString());
void remoteOutput(const QByteArray &output);
@@ -69,29 +71,41 @@ private slots:
void checkPID();
void logcatReadStandardError();
void logcatReadStandardOutput();
void startLogcat();
void asyncStart();
private:
void adbKill(qint64 pid, const QString &device, int timeout = 2000, const QString &runAsPackageName = QString());
void adbKill(qint64 pid);
QStringList selector() const { return m_selector; }
void forceStop();
QByteArray runPs();
void findPs();
private:
QProcess m_adbLogcatProcess;
QTimer m_checkPIDTimer;
bool m_wasStarted;
QByteArray m_logcat;
QString m_intentName;
QString m_packageName;
QString m_deviceSerialNumber;
qint64 m_processPID;
qint64 m_gdbserverPID;
QTimer m_checkPIDTimer;
bool m_useCppDebugger;
bool m_useQmlDebugger;
QString m_remoteGdbChannel;
ushort m_localGdbServerPort; // Local end of forwarded debug socket.
uint m_qmlPort;
bool m_useLocalQtLibs;
QString m_pingFile;
QString m_pongFile;
QString m_gdbserverPath;
QString m_gdbserverCommand;
QString m_gdbserverSocket;
QString m_localLibs;
QString m_localJars;
QString m_localJarsInitClasses;
QString m_adb;
bool m_isBusyBox;
QStringList m_selector;
QMutex m_mutex;
};

View File

@@ -130,21 +130,21 @@ void ClearCaseSync::run(QFutureInterface<void> &future, const QString &topLevel,
if (atatpos != -1) { // probably managed file
// find first whitespace. anything before that is not interesting
const int wspos = buffer.indexOf(QRegExp(QLatin1String("\\s")));
const QString file = QDir::fromNativeSeparators(buffer.left(atatpos));
const QString relFile = topLevelDir.relativeFilePath(QDir::fromNativeSeparators(buffer.left(atatpos)));
QString ccState;
const QRegExp reState(QLatin1String("^\\s*\\[[^\\]]*\\]")); // [hijacked]; [loaded but missing]
if (reState.indexIn(buffer, wspos + 1, QRegExp::CaretAtOffset) != -1) {
ccState = reState.cap();
if (ccState.indexOf(QLatin1String("hijacked")) != -1)
m_plugin->setStatus(file, FileStatus::Hijacked, true);
m_plugin->setStatus(relFile, FileStatus::Hijacked, true);
else if (ccState.indexOf(QLatin1String("loaded but missing")) != -1)
m_plugin->setStatus(file, FileStatus::Missing, false);
m_plugin->setStatus(relFile, FileStatus::Missing, false);
}
else if (buffer.lastIndexOf(QLatin1String("CHECKEDOUT"), wspos) != -1)
m_plugin->setStatus(file, FileStatus::CheckedOut, true);
m_plugin->setStatus(relFile, FileStatus::CheckedOut, true);
// don't care about checked-in files not listed in project
else if (m_statusMap->contains(file))
m_plugin->setStatus(file, FileStatus::CheckedIn, true);
else if (m_statusMap->contains(relFile))
m_plugin->setStatus(relFile, FileStatus::CheckedIn, true);
}
buffer.clear();
future.setProgressValue(qMin(total, ++processed));

View File

@@ -187,8 +187,6 @@ NewDialog::NewDialog(QWidget *parent) :
m_ui(new Core::Internal::Ui::NewDialog),
m_okButton(0)
{
typedef QMap<QString, QStandardItem *> CategoryItemMap;
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_ui->setupUi(this);
QPalette p = m_ui->frame->palette();

View File

@@ -876,6 +876,11 @@ void DebuggerEngine::notifyEngineRequestRemoteSetup()
emit requestRemoteSetup();
}
void DebuggerEngine::notifyEngineRemoteServerRunning(const QByteArray &, int /*pid*/)
{
showMessage(_("NOTE: REMOTE SERVER RUNNING IN MULTIMODE"));
}
void DebuggerEngine::notifyEngineRemoteSetupDone(int gdbServerPort, int qmlPort)
{
showMessage(_("NOTE: REMOTE SETUP DONE: GDB SERVER PORT: %1 QML PORT %2")

View File

@@ -298,6 +298,7 @@ protected:
virtual void notifyEngineRequestRemoteSetup();
public:
virtual void notifyEngineRemoteServerRunning(const QByteArray &, int pid);
virtual void notifyEngineRemoteSetupDone(int gdbServerPort, int qmlPort);
virtual void notifyEngineRemoteSetupFailed(const QString &message);

View File

@@ -58,6 +58,12 @@ void GdbAttachEngine::setupEngine()
{
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
showMessage(_("TRYING TO START ADAPTER"));
if (!startParameters().workingDirectory.isEmpty())
m_gdbProc.setWorkingDirectory(startParameters().workingDirectory);
if (startParameters().environment.size())
m_gdbProc.setEnvironment(startParameters().environment.toStringList());
startGdb();
}

View File

@@ -1249,6 +1249,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
bool GdbEngine::acceptsDebuggerCommands() const
{
return true;
return state() == InferiorStopOk
|| state() == InferiorUnrunnable;
}
@@ -3728,7 +3729,7 @@ void GdbEngine::handleThreadInfo(const GdbResponse &response)
selectThread(other);
}
updateViews(); // Adjust Threads combobox.
if (m_hasInferiorThreadList && debuggerCore()->boolSetting(ShowThreadNames)) {
if (false && m_hasInferiorThreadList && debuggerCore()->boolSetting(ShowThreadNames)) {
postCommand("threadnames " +
debuggerCore()->action(MaximalStackDepth)->value().toByteArray(),
Discardable, CB(handleThreadNames));

View File

@@ -58,6 +58,8 @@ namespace Internal {
GdbRemoteServerEngine::GdbRemoteServerEngine(const DebuggerStartParameters &startParameters)
: GdbEngine(startParameters)
{
m_isMulti = false;
m_targetPid = -1;
connect(&m_uploadProc, SIGNAL(error(QProcess::ProcessError)),
SLOT(uploadProcError(QProcess::ProcessError)));
connect(&m_uploadProc, SIGNAL(readyReadStandardOutput()),
@@ -93,6 +95,11 @@ void GdbRemoteServerEngine::setupEngine()
m_uploadProc.start(_("/bin/sh ") + arglist);
m_uploadProc.waitForStarted();
}
if (!startParameters().workingDirectory.isEmpty())
m_gdbProc.setWorkingDirectory(startParameters().workingDirectory);
if (startParameters().environment.size())
m_gdbProc.setEnvironment(startParameters().environment.toStringList());
if (startParameters().remoteSetupNeeded)
notifyEngineRequestRemoteSetup();
else
@@ -254,13 +261,8 @@ void GdbRemoteServerEngine::handleFileExecAndSymbols(const GdbResponse &response
void GdbRemoteServerEngine::callTargetRemote()
{
//m_breakHandler->clearBreakMarkers();
// "target remote" does three things:
// (1) connects to the gdb server
// (2) starts the remote application
// (3) stops the remote application (early, e.g. in the dynamic linker)
QByteArray channel = startParameters().remoteChannel.toLatin1();
QByteArray rawChannel = startParameters().remoteChannel.toLatin1();
QByteArray channel = rawChannel;
// Don't touch channels with explicitly set protocols.
if (!channel.startsWith("tcp:") && !channel.startsWith("udp:")
@@ -276,14 +278,16 @@ void GdbRemoteServerEngine::callTargetRemote()
if (m_isQnxGdb)
postCommand("target qnx " + channel, CB(handleTargetQnx));
else if (m_isMulti)
postCommand("target extended-remote " + m_serverChannel, CB(handleTargetExtendedRemote));
else
postCommand("target remote " + channel, CB(handleTargetRemote));
postCommand("target remote " + channel, CB(handleTargetRemote), 10);
}
void GdbRemoteServerEngine::handleTargetRemote(const GdbResponse &record)
void GdbRemoteServerEngine::handleTargetRemote(const GdbResponse &response)
{
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
if (record.resultClass == GdbResultDone) {
if (response.resultClass == GdbResultDone) {
// gdb server will stop the remote application itself.
showMessage(_("INFERIOR STARTED"));
showMessage(msgAttachedToStoppedInferior(), StatusBar);
@@ -296,11 +300,50 @@ void GdbRemoteServerEngine::handleTargetRemote(const GdbResponse &record)
} else {
// 16^error,msg="hd:5555: Connection timed out."
QString msg = msgConnectRemoteServerFailed(
QString::fromLocal8Bit(record.data.findChild("msg").data()));
QString::fromLocal8Bit(response.data.findChild("msg").data()));
notifyInferiorSetupFailed(msg);
}
}
void GdbRemoteServerEngine::handleTargetExtendedRemote(const GdbResponse &response)
{
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
if (response.resultClass == GdbResultDone) {
// gdb server will stop the remote application itself.
showMessage(_("ATTACHED TO GDB SERVER STARTED"));
showMessage(msgAttachedToStoppedInferior(), StatusBar);
QString postAttachCommands = debuggerCore()->stringSetting(GdbPostAttachCommands);
if (!postAttachCommands.isEmpty()) {
foreach (const QString &cmd, postAttachCommands.split(QLatin1Char('\n')))
postCommand(cmd.toLatin1());
}
postCommand("attach " + QByteArray::number(m_targetPid), CB(handleTargetExtendedAttach));
} else {
QString msg = msgConnectRemoteServerFailed(
QString::fromLocal8Bit(response.data.findChild("msg").data()));
notifyInferiorSetupFailed(msg);
}
}
void GdbRemoteServerEngine::handleTargetExtendedAttach(const GdbResponse &response)
{
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
if (response.resultClass == GdbResultDone) {
// gdb server will stop the remote application itself.
handleInferiorPrepared();
} else {
QString msg = msgConnectRemoteServerFailed(
QString::fromLocal8Bit(response.data.findChild("msg").data()));
notifyInferiorSetupFailed(msg);
}
}
void GdbRemoteServerEngine::notifyInferiorSetupOk()
{
emit aboutToNotifyInferiorSetupOk();
GdbEngine::notifyInferiorSetupOk();
}
void GdbRemoteServerEngine::handleTargetQnx(const GdbResponse &response)
{
QTC_ASSERT(m_isQnxGdb, qDebug() << m_isQnxGdb);
@@ -410,22 +453,36 @@ void GdbRemoteServerEngine::shutdownEngine()
notifyAdapterShutdownOk();
}
void GdbRemoteServerEngine::notifyEngineRemoteServerRunning
(const QByteArray &serverChannel, int inferiorPid)
{
showMessage(_("NOTE: REMOTE SERVER RUNNING IN MULTIMODE"));
m_isMulti = true;
m_targetPid = inferiorPid;
m_serverChannel = serverChannel;
startGdb();
}
void GdbRemoteServerEngine::notifyEngineRemoteSetupDone(int gdbServerPort, int qmlPort)
{
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
DebuggerEngine::notifyEngineRemoteSetupDone(gdbServerPort, qmlPort);
if (qmlPort != -1)
startParameters().qmlServerPort = qmlPort;
if (gdbServerPort != -1) {
QString &rc = startParameters().remoteChannel;
const int sepIndex = rc.lastIndexOf(QLatin1Char(':'));
if (sepIndex != -1) {
rc.replace(sepIndex + 1, rc.count() - sepIndex - 1,
QString::number(gdbServerPort));
if (m_isMulti) {
// Has been done in notifyEngineRemoteServerRunning
} else {
if (qmlPort != -1)
startParameters().qmlServerPort = qmlPort;
if (gdbServerPort != -1) {
QString &rc = startParameters().remoteChannel;
const int sepIndex = rc.lastIndexOf(QLatin1Char(':'));
if (sepIndex != -1) {
rc.replace(sepIndex + 1, rc.count() - sepIndex - 1,
QString::number(gdbServerPort));
}
}
startGdb();
}
startGdb();
}
void GdbRemoteServerEngine::notifyEngineRemoteSetupFailed(const QString &reason)

View File

@@ -70,20 +70,25 @@ signals:
* a server start script should be used, but none is given.
*/
void requestSetup();
void aboutToNotifyInferiorSetupOk();
private:
Q_SLOT void readUploadStandardOutput();
Q_SLOT void readUploadStandardError();
Q_SLOT void uploadProcError(QProcess::ProcessError error);
Q_SLOT void uploadProcFinished();
Q_SLOT void callTargetRemote();
virtual void notifyEngineRemoteSetupDone(int gdbServerPort, int qmlPort);
virtual void notifyEngineRemoteSetupFailed(const QString &reason);
void notifyEngineRemoteSetupDone(int gdbServerPort, int qmlPort);
void notifyEngineRemoteSetupFailed(const QString &reason);
void notifyEngineRemoteServerRunning(const QByteArray &serverChannel, int inferiorPid);
void notifyInferiorSetupOk();
void handleSetTargetAsync(const GdbResponse &response);
void handleFileExecAndSymbols(const GdbResponse &response);
void callTargetRemote();
void handleTargetRemote(const GdbResponse &response);
void handleTargetExtendedRemote(const GdbResponse &response);
void handleTargetExtendedAttach(const GdbResponse &response);
void handleTargetQnx(const GdbResponse &response);
void handleAttach(const GdbResponse &response);
void handleInterruptInferior(const GdbResponse &response);
@@ -91,6 +96,9 @@ private:
QProcess m_uploadProc;
LocalGdbProcess m_gdbProc;
bool m_isMulti;
int m_targetPid;
QByteArray m_serverChannel;
};
} // namespace Internal

View File

@@ -398,7 +398,6 @@ static void addVariableMemoryView(DebuggerEngine *engine, bool separateView,
static void addStackLayoutMemoryView(DebuggerEngine *engine, bool separateView,
const QAbstractItemModel *m, const QPoint &p, QWidget *parent)
{
typedef QPair<quint64, QString> RegisterValueNamePair;
QTC_ASSERT(engine && m, return);
// Determine suitable address range from locals.

View File

@@ -856,7 +856,7 @@ public:
}
// Set text only if input is ascii key without control modifier.
if (m_text.isEmpty() && k <= 0x7f && (m & (HostOsInfo::controlModifier())) == 0) {
if (m_text.isEmpty() && k >= 0 && k <= 0x7f && (m & (HostOsInfo::controlModifier())) == 0) {
QChar c = QChar::fromLatin1(k);
m_text = QString((m & ShiftModifier) != 0 ? c.toUpper() : c.toLower());
}

View File

@@ -245,7 +245,7 @@ void MergeTool::readData()
} else if (m_merging && line.startsWith("Continue merging")) {
if (QMessageBox::question(0, tr("Continue Merging"),
tr("Continue merging other unresolved paths?"),
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) {
QMessageBox::Yes|QMessageBox::No, QMessageBox::No) == QMessageBox::Yes) {
m_process->write("y\n");
} else {
m_process->write("n\n");

View File

@@ -87,9 +87,6 @@ static bool
const QMap<QString, QString> &fieldMap,
QString *stdOut /* = 0 */, QString *errorMessage)
{
typedef QSharedPointer<QTemporaryFile> TemporaryFilePtr;
typedef QList<TemporaryFilePtr> TemporaryFilePtrList;
QProcess process;
const QString binary = script.front();
QStringList arguments;

View File

@@ -292,6 +292,7 @@ void DeviceTypeInformationConfigWidget::currentTypeChanged(int idx)
DeviceInformationConfigWidget::DeviceInformationConfigWidget(Kit *workingCopy) :
KitConfigWidget(workingCopy),
m_isReadOnly(false),
m_ignoreChange(false),
m_comboBox(new QComboBox),
m_model(new DeviceManagerModel(DeviceManager::instance()))
{

View File

@@ -34,6 +34,7 @@
#include <designersettings.h>
#include <bindingproperty.h>
#include <signalhandlerproperty.h>
#include <nodeabstractproperty.h>
#include <variantproperty.h>
@@ -185,6 +186,19 @@ void DebugView::bindingPropertiesChanged(const QList<BindingProperty> &propertyL
}
}
void DebugView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> &propertyList, AbstractView::PropertyChangeFlags /*propertyChange*/)
{
if (isDebugViewEnabled()) {
QTextStream message;
QString string;
message.setString(&string);
foreach (const SignalHandlerProperty &property, propertyList) {
message << property;
}
log(tr("SignalHandlerProperties changed:"), string);
}
}
void DebugView::rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion)
{
if (isDebugViewEnabled()) {

View File

@@ -31,6 +31,7 @@
#define DEBUGVIEW_H
#include <qmlmodelview.h>
#include <QPointer>
namespace QmlDesigner {
@@ -60,6 +61,7 @@ public:
void propertiesAboutToBeRemoved(const QList<AbstractProperty>& propertyList) QTC_OVERRIDE;
void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion) QTC_OVERRIDE;
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
@@ -90,7 +92,7 @@ protected:
void logInstance(const QString &title, const QString &message, bool highlight = false);
private: //variables
QWeakPointer<DebugViewWidget> m_debugViewWidget;
QPointer<DebugViewWidget> m_debugViewWidget;
};
} // namespace Internal

View File

@@ -279,6 +279,10 @@ void FormEditorView::bindingPropertiesChanged(const QList<BindingProperty>& prop
QmlModelView::bindingPropertiesChanged(propertyList, propertyChange);
}
void FormEditorView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> & /*propertyList*/, AbstractView::PropertyChangeFlags /*propertyChange*/)
{
}
WidgetInfo FormEditorView::widgetInfo()
{
return createWidgetInfo(m_formEditorWidget.data(), 0, "FormEditor", WidgetInfo::CentralPane, 0, tr("Form Editor"));

View File

@@ -78,6 +78,7 @@ public:
void propertiesAboutToBeRemoved(const QList<AbstractProperty>& propertyList) QTC_OVERRIDE;
void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion) QTC_OVERRIDE;
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,

View File

@@ -38,8 +38,27 @@
namespace QmlDesigner {
class ResizeControllerData
{
public:
ResizeControllerData(LayerItem *layerItem,
FormEditorItem *formEditorItem);
ResizeControllerData(const ResizeControllerData &other);
~ResizeControllerData();
QWeakPointer<LayerItem> layerItem;
QWeakPointer<FormEditorItem> formEditorItem;
QSharedPointer<ResizeHandleItem> topLeftItem;
QSharedPointer<ResizeHandleItem> topRightItem;
QSharedPointer<ResizeHandleItem> bottomLeftItem;
QSharedPointer<ResizeHandleItem> bottomRightItem;
QSharedPointer<ResizeHandleItem> topItem;
QSharedPointer<ResizeHandleItem> leftItem;
QSharedPointer<ResizeHandleItem> rightItem;
QSharedPointer<ResizeHandleItem> bottomItem;
};
ResizeControllerData::ResizeControllerData(LayerItem *layerItem, FormEditorItem *formEditorItem)
: layerItem(layerItem),
formEditorItem(formEditorItem),
@@ -71,14 +90,14 @@ ResizeControllerData::ResizeControllerData(const ResizeControllerData &other)
ResizeControllerData::~ResizeControllerData()
{
if (layerItem) {
layerItem->scene()->removeItem(topLeftItem);
layerItem->scene()->removeItem(topRightItem);
layerItem->scene()->removeItem(bottomLeftItem);
layerItem->scene()->removeItem(bottomRightItem);
layerItem->scene()->removeItem(topItem);
layerItem->scene()->removeItem(leftItem);
layerItem->scene()->removeItem(rightItem);
layerItem->scene()->removeItem(bottomItem);
layerItem->scene()->removeItem(topLeftItem.data());
layerItem->scene()->removeItem(topRightItem.data());
layerItem->scene()->removeItem(bottomLeftItem.data());
layerItem->scene()->removeItem(bottomRightItem.data());
layerItem->scene()->removeItem(topItem.data());
layerItem->scene()->removeItem(leftItem.data());
layerItem->scene()->removeItem(rightItem.data());
layerItem->scene()->removeItem(bottomItem.data());
}
}
@@ -98,41 +117,56 @@ ResizeController::ResizeController(const QSharedPointer<ResizeControllerData> &d
ResizeController::ResizeController(LayerItem *layerItem, FormEditorItem *formEditorItem)
: m_data(new ResizeControllerData(layerItem, formEditorItem))
{
m_data->topLeftItem = new ResizeHandleItem(layerItem, *this);
m_data->topLeftItem = QSharedPointer<ResizeHandleItem>(new ResizeHandleItem(layerItem, *this));
m_data->topLeftItem->setZValue(302);
m_data->topLeftItem->setCursor(Qt::SizeFDiagCursor);
m_data->topRightItem = new ResizeHandleItem(layerItem, *this);
m_data->topRightItem = QSharedPointer<ResizeHandleItem>(new ResizeHandleItem(layerItem, *this));
m_data->topRightItem->setZValue(301);
m_data->topRightItem->setCursor(Qt::SizeBDiagCursor);
m_data->bottomLeftItem = new ResizeHandleItem(layerItem, *this);
m_data->bottomLeftItem = QSharedPointer<ResizeHandleItem>(new ResizeHandleItem(layerItem, *this));
m_data->bottomLeftItem->setZValue(301);
m_data->bottomLeftItem->setCursor(Qt::SizeBDiagCursor);
m_data->bottomRightItem = new ResizeHandleItem(layerItem, *this);
m_data->bottomRightItem = QSharedPointer<ResizeHandleItem>(new ResizeHandleItem(layerItem, *this));
m_data->bottomRightItem->setZValue(305);
m_data->bottomRightItem->setCursor(Qt::SizeFDiagCursor);
m_data->topItem = new ResizeHandleItem(layerItem, *this);
m_data->topItem = QSharedPointer<ResizeHandleItem>(new ResizeHandleItem(layerItem, *this));
m_data->topItem->setZValue(300);
m_data->topItem->setCursor(Qt::SizeVerCursor);
m_data->leftItem = new ResizeHandleItem(layerItem, *this);
m_data->leftItem = QSharedPointer<ResizeHandleItem>(new ResizeHandleItem(layerItem, *this));
m_data->leftItem->setZValue(300);
m_data->leftItem->setCursor(Qt::SizeHorCursor);
m_data->rightItem = new ResizeHandleItem(layerItem, *this);
m_data->rightItem = QSharedPointer<ResizeHandleItem>(new ResizeHandleItem(layerItem, *this));
m_data->rightItem->setZValue(300);
m_data->rightItem->setCursor(Qt::SizeHorCursor);
m_data->bottomItem = new ResizeHandleItem(layerItem, *this);
m_data->bottomItem = QSharedPointer<ResizeHandleItem>(new ResizeHandleItem(layerItem, *this));
m_data->bottomItem->setZValue(300);
m_data->bottomItem->setCursor(Qt::SizeVerCursor);
updatePosition();
}
ResizeController::ResizeController(const ResizeController &other)
: m_data(other.m_data)
{
}
ResizeController::~ResizeController()
{
}
ResizeController &ResizeController::operator =(const ResizeController &other)
{
m_data = other.m_data;
}
bool ResizeController::isValid() const
{

View File

@@ -40,30 +40,7 @@ class FormEditorItem;
class LayerItem;
class ResizeHandleItem;
class ResizeControllerData
{
public:
ResizeControllerData(LayerItem *layerItem,
FormEditorItem *formEditorItem);
ResizeControllerData(const ResizeControllerData &other);
~ResizeControllerData();
QWeakPointer<LayerItem> layerItem;
QWeakPointer<FormEditorItem> formEditorItem;
ResizeHandleItem *topLeftItem;
ResizeHandleItem *topRightItem;
ResizeHandleItem *bottomLeftItem;
ResizeHandleItem *bottomRightItem;
ResizeHandleItem *topItem;
ResizeHandleItem *leftItem;
ResizeHandleItem *rightItem;
ResizeHandleItem *bottomItem;
};
class ResizeControllerData;
class ResizeController
{
@@ -72,6 +49,10 @@ public:
ResizeController();
ResizeController(LayerItem *layerItem, FormEditorItem *formEditorItem);
ResizeController(const ResizeController &resizeController);
~ResizeController();
ResizeController& operator=(const ResizeController &other);
void show();
void hide();

View File

@@ -63,8 +63,10 @@ void SelectionIndicator::hide()
void SelectionIndicator::clear()
{
if (m_layerItem) {
foreach (QGraphicsItem *item, m_indicatorShapeHash.values())
foreach (QGraphicsItem *item, m_indicatorShapeHash.values()) {
m_layerItem->scene()->removeItem(item);
delete item;
}
}
m_indicatorShapeHash.clear();
}

View File

@@ -138,8 +138,10 @@ void SelectionTool::hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
return;
}
if (topSelectedItemIsMovable(itemList))
if (topSelectedItemIsMovable(itemList)) {
view()->changeToMoveTool();
return;
}
}
FormEditorItem *topSelectableItem = 0;

View File

@@ -188,6 +188,7 @@ void ComponentView::propertiesAboutToBeRemoved(const QList<AbstractProperty>& /*
void ComponentView::propertiesRemoved(const QList<AbstractProperty>& /*propertyList*/) {}
void ComponentView::variantPropertiesChanged(const QList<VariantProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/) {}
void ComponentView::bindingPropertiesChanged(const QList<BindingProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/) {}
void ComponentView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> & /*propertyList*/, AbstractView::PropertyChangeFlags /*propertyChange*/) {}
void ComponentView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/) {}
void ComponentView::scriptFunctionsChanged(const ModelNode &/*node*/, const QStringList &/*scriptFunctionList*/) {}
void ComponentView::instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &/*propertyList*/) {}

View File

@@ -78,6 +78,8 @@ public:
PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList,
PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList,
PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion) QTC_OVERRIDE;
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList) QTC_OVERRIDE;
void instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList) QTC_OVERRIDE;

View File

@@ -35,7 +35,6 @@
#include <basetexteditmodifier.h>
#include <componenttextmodifier.h>
#include <subcomponentmanager.h>
#include <model/viewlogger.h>
#include <QObject>
#include <QString>

View File

@@ -59,6 +59,9 @@ void DesignDocumentView::propertiesAboutToBeRemoved(const QList<AbstractProperty
void DesignDocumentView::propertiesRemoved(const QList<AbstractProperty>& /*propertyList*/) {}
void DesignDocumentView::variantPropertiesChanged(const QList<VariantProperty>& /*propertyList*/, AbstractView::PropertyChangeFlags /*propertyChange*/) {}
void DesignDocumentView::bindingPropertiesChanged(const QList<BindingProperty>& /*propertyList*/, AbstractView::PropertyChangeFlags /*propertyChange*/) {}
void DesignDocumentView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> & /*propertyList*/,
AbstractView::PropertyChangeFlags /*propertyChange*/)
{}
void DesignDocumentView::rootNodeTypeChanged(const QString & /*type*/, int /*majorVersion*/, int /*minorVersion*/) {}
void DesignDocumentView::selectedNodesChanged(const QList<ModelNode> & /*selectedNodeList*/,

View File

@@ -58,6 +58,7 @@ public:
virtual void propertiesRemoved(const QList<AbstractProperty>& propertyList) QTC_OVERRIDE;
virtual void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
virtual void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
virtual void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
virtual void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion) QTC_OVERRIDE;
virtual void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,

View File

@@ -103,6 +103,10 @@ void ItemLibraryView::bindingPropertiesChanged(const QList<BindingProperty> &, P
}
void ItemLibraryView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> &, AbstractView::PropertyChangeFlags)
{
}
void ItemLibraryView::nodeAboutToBeRemoved(const ModelNode &)
{

View File

@@ -65,6 +65,8 @@ public:
PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void bindingPropertiesChanged(const QList<BindingProperty> &propertyList,
PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList,
PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void nodeAboutToBeRemoved(const ModelNode &removedNode) QTC_OVERRIDE;
void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex) QTC_OVERRIDE;

View File

@@ -162,6 +162,11 @@ void NavigatorView::bindingPropertiesChanged(const QList<BindingProperty> & /*pr
{
}
void NavigatorView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> & /*propertyList*/,
AbstractView::PropertyChangeFlags /*propertyChange*/)
{
}
void NavigatorView::nodeAboutToBeRemoved(const ModelNode &removedNode)
{
if (m_treeModel->isInTree(removedNode))

View File

@@ -70,6 +70,7 @@ public:
void propertiesRemoved(const QList<AbstractProperty> &propertyList) QTC_OVERRIDE;
void variantPropertiesChanged(const QList<VariantProperty> &propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void bindingPropertiesChanged(const QList<BindingProperty> &propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList,PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void nodeAboutToBeRemoved(const ModelNode &removedNode) QTC_OVERRIDE;
void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex) QTC_OVERRIDE;

View File

@@ -916,6 +916,11 @@ void PropertyEditor::bindingPropertiesChanged(const QList<BindingProperty>& prop
}
}
void PropertyEditor::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> & /*propertyList*/,
AbstractView::PropertyChangeFlags /*propertyChange*/)
{
}
void PropertyEditor::instanceInformationsChange(const QMultiHash<ModelNode, InformationName> &informationChangeHash)
{

View File

@@ -100,6 +100,7 @@ public:
void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList,PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void instanceInformationsChange(const QMultiHash<ModelNode, InformationName> &informationChangeHash) QTC_OVERRIDE;

View File

@@ -342,6 +342,12 @@ void StatesEditorView::bindingPropertiesChanged(const QList<BindingProperty> &/*
}
void StatesEditorView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> & /*propertyList*/,
AbstractView::PropertyChangeFlags /*propertyChange*/)
{
}
void StatesEditorView::selectedNodesChanged(const QList<ModelNode> &/*selectedNodeList*/, const QList<ModelNode> &/*lastSelectedNodeList*/)
{

View File

@@ -76,6 +76,7 @@ public:
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList) QTC_OVERRIDE;
void nodeIdChanged(const ModelNode &node, const QString &newId, const QString &oldId) QTC_OVERRIDE;
void bindingPropertiesChanged(const QList<BindingProperty> &propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList,PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList, const QList<ModelNode> &lastSelectedNodeList) QTC_OVERRIDE;
void instancesPreviewImageChanged(const QVector<ModelNode> &nodeList) QTC_OVERRIDE;

View File

@@ -44,7 +44,6 @@ SOURCES += $$PWD/model/abstractview.cpp \
$$PWD/exceptions/invalidslideindexexception.cpp \
$$PWD/model/import.cpp \
$$PWD/exceptions/invalidqmlsourceexception.cpp \
$$PWD/model/viewlogger.cpp \
$$PWD/model/internalvariantproperty.cpp \
$$PWD/model/internalnodelistproperty.cpp \
$$PWD/model/variantproperty.cpp \
@@ -76,7 +75,9 @@ SOURCES += $$PWD/model/abstractview.cpp \
$$PWD/model/qmltextgenerator.cpp \
$$PWD/model/modelmerger.cpp \
$$PWD/exceptions/rewritingexception.cpp \
$$PWD/model/viewmanager.cpp
$$PWD/model/viewmanager.cpp \
$$PWD/model/signalhandlerproperty.cpp \
$$PWD/model/internalsignalhandlerproperty.cpp
HEADERS += $$PWD/include/qmldesignercorelib_global.h \
$$PWD/include/abstractview.h \
@@ -112,7 +113,6 @@ HEADERS += $$PWD/include/qmldesignercorelib_global.h \
$$PWD/include/invalidslideindexexception.h \
$$PWD/include/import.h \
$$PWD/include/invalidqmlsourceexception.h \
$$PWD/model/viewlogger.h \
$$PWD/model/internalvariantproperty.h \
$$PWD/model/internalnodelistproperty.h \
$$PWD/include/variantproperty.h \
@@ -147,7 +147,9 @@ HEADERS += $$PWD/include/qmldesignercorelib_global.h \
$$PWD/include/mathutils.h \
$$PWD/include/customnotifications.h \
$$PWD/include/rewritingexception.h \
$$PWD/include/viewmanager.h
$$PWD/include/viewmanager.h \
$$PWD/include/signalhandlerproperty.h \
$$PWD/model/internalsignalhandlerproperty.h
contains(CONFIG, plugin) {
# If core.pri has been included in the qmldesigner plugin

View File

@@ -57,6 +57,7 @@ class QMLDESIGNERCORE_EXPORT NodeListProperty;
class QMLDESIGNERCORE_EXPORT NodeAbstractProperty;
class QMLDESIGNERCORE_EXPORT BindingProperty;
class QMLDESIGNERCORE_EXPORT NodeProperty;
class QMLDESIGNERCORE_EXPORT SignalHandlerProperty;
class QmlObjectNode;
@@ -93,12 +94,14 @@ public:
NodeAbstractProperty toNodeAbstractProperty() const;
BindingProperty toBindingProperty() const;
NodeProperty toNodeProperty() const;
SignalHandlerProperty toSignalHandlerProperty() const;
bool isVariantProperty() const;
bool isNodeListProperty() const;
bool isNodeAbstractProperty() const;
bool isBindingProperty() const;
bool isNodeProperty() const;
bool isSignalHandlerProperty() const;
bool isDynamic() const;
TypeName dynamicTypeName() const;

View File

@@ -68,6 +68,9 @@ public:
{}
virtual QList<QToolButton*> createToolBarWidgets() = 0;
virtual ~ToolBarWidgetFactoryInterface()
{}
};
template <class T>
@@ -186,6 +189,7 @@ public:
virtual void propertiesRemoved(const QList<AbstractProperty>& propertyList) = 0;
virtual void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange) = 0;
virtual void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) = 0;
virtual void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList, PropertyChangeFlags propertyChange) = 0;
virtual void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion) = 0;
virtual void instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList) = 0;

View File

@@ -62,6 +62,7 @@ public:
void propertiesRemoved(const QList<AbstractProperty>& propertyList);
void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange);
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange);
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList,PropertyChangeFlags propertyChange);
void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion);
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
@@ -185,6 +186,12 @@ void ForwardView<ViewType>::bindingPropertiesChanged(const QList<BindingProperty
view->bindingPropertiesChanged(adjustedList(propertyList, view.data()), propertyChange);
}
void ForwardView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> &propertyList, AbstractView::PropertyChangeFlags propertyChange)
{
foreach (const ViewTypePointer &view, m_targetViewList)
view->signalHandlerPropertiesChanged(adjustedList(propertyList, view.data()), propertyChange);
}
template <class ViewType>
void ForwardView<ViewType>::rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion)
{

View File

@@ -56,6 +56,7 @@ class NodeMetaInfo;
class AbstractProperty;
class BindingProperty;
class VariantProperty;
class SignalHandlerProperty;
class Model;
class AbstractView;
class NodeListProperty;
@@ -120,6 +121,7 @@ public:
AbstractProperty property(const PropertyName &name) const;
VariantProperty variantProperty(const PropertyName &name) const;
BindingProperty bindingProperty(const PropertyName &name) const;
SignalHandlerProperty signalHandlerProperty(const PropertyName &name) const;
NodeListProperty nodeListProperty(const PropertyName &name) const;
NodeProperty nodeProperty(const PropertyName &name) const;
NodeAbstractProperty nodeAbstractProperty(const PropertyName &name) const;

View File

@@ -91,6 +91,7 @@ public:
void propertiesRemoved(const QList<AbstractProperty>& propertyList) QTC_OVERRIDE;
void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> &propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void nodeAboutToBeReparented(const ModelNode &node,
const NodeAbstractProperty &newPropertyParent,
const NodeAbstractProperty &oldPropertyParent,

View File

@@ -71,6 +71,7 @@ public:
bool isFileComponent() const;
bool hasProperty(const PropertyName &propertyName) const;
PropertyNameList propertyNames() const;
PropertyNameList signalNames() const;
PropertyNameList directPropertyNames() const;
PropertyName defaultPropertyName() const;
bool hasDefaultProperty() const;

View File

@@ -46,7 +46,7 @@ class QmlAnchors;
class QMLDESIGNERCORE_EXPORT QmlItemNode : public QmlObjectNode
{
friend class QMLDESIGNERCORE_EXPORT QmlAnchors;
friend class QmlAnchors;
public:
QmlItemNode() : QmlObjectNode() {}
QmlItemNode(const ModelNode &modelNode) : QmlObjectNode(modelNode) {}

View File

@@ -45,8 +45,8 @@ class ItemLibraryEntry;
class QMLDESIGNERCORE_EXPORT QmlModelView : public AbstractView
{
Q_OBJECT
friend QMLDESIGNERCORE_EXPORT class QmlObjectNode;
friend QMLDESIGNERCORE_EXPORT class QmlModelNodeFacade;
friend class QmlObjectNode;
friend class QmlModelNodeFacade;
public:
QmlModelView(QObject *parent) ;
@@ -118,6 +118,7 @@ public:
void propertiesRemoved(const QList<AbstractProperty>& propertyList) QTC_OVERRIDE;
void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList,PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList) QTC_OVERRIDE;
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList, const QList<ModelNode> &lastSelectedNodeList) QTC_OVERRIDE;

View File

@@ -42,7 +42,7 @@ class QmlObjectNode;
class QMLDESIGNERCORE_EXPORT QmlModelState : public QmlModelNodeFacade
{
friend class QMLDESIGNERCORE_EXPORT QmlModelView;
friend class QmlModelView;
public:
QmlModelState();

View File

@@ -126,6 +126,7 @@ public:
void propertiesRemoved(const QList<AbstractProperty>& propertyList) QTC_OVERRIDE;
void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList,PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void nodeAboutToBeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent,
const NodeAbstractProperty &oldPropertyParent,
AbstractView::PropertyChangeFlags propertyChange) QTC_OVERRIDE;

View File

@@ -0,0 +1,58 @@
/****************************************************************************
**
** Copyright (C) 2013 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 SIGNALHANDLERPROPERTY_H
#define SIGNALHANDLERPROPERTY_H
#include "qmldesignercorelib_global.h"
#include "abstractproperty.h"
namespace QmlDesigner {
class QMLDESIGNERCORE_EXPORT SignalHandlerProperty : public QmlDesigner::AbstractProperty
{
friend class QmlDesigner::ModelNode;
friend class QmlDesigner::Internal::ModelPrivate;
friend class QmlDesigner::AbstractProperty;
public:
void setSource(const QString &source);
QString source() const;
SignalHandlerProperty& operator= (const QString &source);
SignalHandlerProperty();
SignalHandlerProperty(const SignalHandlerProperty &property, AbstractView *view);
protected:
SignalHandlerProperty(const PropertyName &propertyName, const Internal::InternalNodePointer &internalNode, Model* model, AbstractView *view);
};
} // namespace QmlDesigner
#endif // SIGNALHANDLERPROPERTY_H

View File

@@ -41,7 +41,6 @@
#include <propertyeditor.h>
#include <componentview.h>
#include <debugview.h>
#include <model/viewlogger.h>
namespace QmlDesigner {
@@ -105,7 +104,6 @@ private: // functions
private: // variables
QmlModelState m_savedState;
Internal::ViewLogger m_viewLogger;
Internal::DebugView m_debugView;
ComponentView m_componentView;
FormEditorView m_formEditorView;

View File

@@ -376,6 +376,11 @@ void NodeInstanceView::bindingPropertiesChanged(const QList<BindingProperty>& pr
nodeInstanceServer()->changePropertyBindings(createChangeBindingCommand(propertyList));
}
void NodeInstanceView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> & /*propertyList*/,
AbstractView::PropertyChangeFlags /*propertyChange*/)
{
}
/*! \brief Notifing the view that a AbstractProperty value was changed to a ModelNode.
The property will be set for the NodeInstance.

View File

@@ -164,10 +164,19 @@ public:
return true;
}
virtual bool processSignal(const QString &name, const Value * /*value*/)
{
m_signals.append(name.toUtf8());
return true;
}
QList<PropertyInfo> properties() const { return m_properties; }
PropertyNameList signalList() const { return m_signals; }
private:
QList<PropertyInfo> m_properties;
PropertyNameList m_signals;
const ContextPtr m_context;
};
@@ -278,6 +287,32 @@ QList<PropertyInfo> getQmlTypes(const CppComponentValue *objectValue, const Cont
return propertyList;
}
PropertyNameList getSignals(const ObjectValue *objectValue, const ContextPtr &context, bool local = false)
{
PropertyNameList signalList;
if (!objectValue)
return signalList;
if (objectValue->className().isEmpty())
return signalList;
PropertyMemberProcessor processor(context);
objectValue->processMembers(&processor);
signalList.append(processor.signalList());
if (!local) {
const ObjectValue* prototype = objectValue->prototype(context);
if (prototype == objectValue)
return signalList;
signalList.append(getSignals(prototype, context));
}
return signalList;
}
QList<PropertyInfo> getTypes(const ObjectValue *objectValue, const ContextPtr &context, bool local = false)
{
QList<PropertyInfo> propertyList;
@@ -334,6 +369,7 @@ public:
bool isFileComponent() const;
PropertyNameList properties() const;
PropertyNameList localProperties() const;
PropertyNameList signalNames() const;
PropertyName defaultPropertyName() const;
TypeName propertyType(const PropertyName &propertyName) const;
@@ -386,6 +422,7 @@ private:
bool m_isValid;
bool m_isFileComponent;
PropertyNameList m_properties;
PropertyNameList m_signals;
QList<TypeName> m_propertyTypes;
PropertyNameList m_localProperties;
PropertyName m_defaultPropertyName;
@@ -418,6 +455,11 @@ PropertyNameList NodeMetaInfoPrivate::localProperties() const
return m_localProperties;
}
PropertyNameList NodeMetaInfoPrivate::signalNames() const
{
return m_signals;
}
QSet<QString> &NodeMetaInfoPrivate::prototypeCachePositives()
{
return m_prototypeCachePositives;
@@ -484,6 +526,7 @@ NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, TypeName type, int maj, i
m_defaultPropertyName = objectValue->defaultPropertyName().toUtf8();
m_isValid = true;
setupPrototypes();
m_signals = getSignals(objectValue, context());
} else {
const ObjectValue *objectValue = getObjectValue();
if (objectValue) {
@@ -512,6 +555,7 @@ NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, TypeName type, int maj, i
m_defaultPropertyName = context()->defaultPropertyName(objectValue).toUtf8();
m_isValid = true;
setupPrototypes();
m_signals = getSignals(objectValue, context());
}
}
}
@@ -1045,6 +1089,11 @@ PropertyNameList NodeMetaInfo::propertyNames() const
return m_privateData->properties();
}
PropertyNameList NodeMetaInfo::signalNames() const
{
return m_privateData->signalNames();
}
PropertyNameList NodeMetaInfo::directPropertyNames() const
{
return m_privateData->localProperties();

View File

@@ -37,6 +37,7 @@
#include "invalidpropertyexception.h"
#include "variantproperty.h"
#include "bindingproperty.h"
#include "signalhandlerproperty.h"
#include "nodeproperty.h"
#include "nodeabstractproperty.h"
#include "nodelistproperty.h"
@@ -257,6 +258,19 @@ NodeProperty AbstractProperty::toNodeProperty() const
return NodeProperty();
}
SignalHandlerProperty AbstractProperty::toSignalHandlerProperty() const
{
if (!isValid())
throw InvalidPropertyException(__LINE__, __FUNCTION__, __FILE__, m_propertyName);
SignalHandlerProperty propertyNode(name(), internalNode(), model(), view());
if (propertyNode.isSignalHandlerProperty())
return propertyNode;
return SignalHandlerProperty();
}
NodeListProperty AbstractProperty::toNodeListProperty() const
{
if (!isValid())
@@ -348,6 +362,19 @@ bool AbstractProperty::isNodeProperty() const
return false;
}
bool AbstractProperty::isSignalHandlerProperty() const
{
if (!isValid())
throw InvalidPropertyException(__LINE__, __FUNCTION__, __FILE__, m_propertyName);
if (internalNode()->hasProperty(name())) {
Q_ASSERT(internalNode()->property(name()));
return internalNode()->property(name())->isSignalHandlerProperty();
}
return false;
}
bool AbstractProperty::isBindingProperty() const
{

View File

@@ -200,6 +200,15 @@ InternalBindingProperty::Pointer InternalNode::bindingProperty(const PropertyNam
return InternalBindingProperty::Pointer();
}
InternalSignalHandlerProperty::Pointer InternalNode::signalHandlerProperty(const PropertyName &name) const
{
InternalProperty::Pointer property = m_namePropertyHash.value(name);
if (property->isSignalHandlerProperty())
return property.staticCast<InternalSignalHandlerProperty>();
return InternalSignalHandlerProperty::Pointer();
}
InternalVariantProperty::Pointer InternalNode::variantProperty(const PropertyName &name) const
{
InternalProperty::Pointer property = m_namePropertyHash.value(name);
@@ -215,6 +224,12 @@ void InternalNode::addBindingProperty(const PropertyName &name)
m_namePropertyHash.insert(name, newProperty);
}
void InternalNode::addSignalHandlerProperty(const PropertyName &name)
{
InternalProperty::Pointer newProperty(InternalSignalHandlerProperty::create(name, internalPointer()));
m_namePropertyHash.insert(name, newProperty);
}
InternalNodeListProperty::Pointer InternalNode::nodeListProperty(const PropertyName &name) const
{
InternalProperty::Pointer property = m_namePropertyHash.value(name);

View File

@@ -38,6 +38,7 @@
#include "internalproperty.h"
#include "internalvariantproperty.h"
#include "internalbindingproperty.h"
#include "internalsignalhandlerproperty.h"
#include "internalnodelistproperty.h"
#include "internalnodeproperty.h"
#include "internalnodeabstractproperty.h"
@@ -93,12 +94,14 @@ public:
InternalProperty::Pointer property(const PropertyName &name) const;
InternalBindingProperty::Pointer bindingProperty(const PropertyName &name) const;
InternalSignalHandlerProperty::Pointer signalHandlerProperty(const PropertyName &name) const;
InternalVariantProperty::Pointer variantProperty(const PropertyName &name) const;
InternalNodeListProperty::Pointer nodeListProperty(const PropertyName &name) const;
InternalNodeAbstractProperty::Pointer nodeAbstractProperty(const PropertyName &name) const;
InternalNodeProperty::Pointer nodeProperty(const PropertyName &name) const;
void addBindingProperty(const PropertyName &name);
void addSignalHandlerProperty(const PropertyName &name);
void addNodeListProperty(const PropertyName &name);
void addVariantProperty(const PropertyName &name);
void addNodeProperty(const PropertyName &name);

View File

@@ -86,6 +86,7 @@ InternalNode::Pointer InternalNodeProperty::node() const
void InternalNodeProperty::remove(const InternalNode::Pointer &node)
{
Q_UNUSED(node)
Q_ASSERT(m_node == node);
m_node.clear();

View File

@@ -32,6 +32,7 @@
#include "internalvariantproperty.h"
#include "internalnodelistproperty.h"
#include "internalnodeproperty.h"
#include "internalsignalhandlerproperty.h"
#include "internalnode_p.h"
#include <QVariant>
#include <QString>
@@ -116,6 +117,11 @@ bool InternalProperty::isNodeAbstractProperty() const
return false;
}
bool InternalProperty::isSignalHandlerProperty() const
{
return false;
}
QSharedPointer<InternalVariantProperty> InternalProperty::toVariantProperty() const
{
@@ -146,6 +152,12 @@ QSharedPointer<InternalNodeAbstractProperty> InternalProperty::toNodeAbstractPro
return internalPointer().staticCast<InternalNodeAbstractProperty>();
}
QSharedPointer<InternalSignalHandlerProperty> InternalProperty::toSignalHandlerProperty() const
{
Q_ASSERT(internalPointer().dynamicCast<InternalSignalHandlerProperty>());
return internalPointer().staticCast<InternalSignalHandlerProperty>();
}
void InternalProperty::remove()
{
propertyOwner()->removeProperty(name());

View File

@@ -46,6 +46,7 @@ namespace QmlDesigner {
namespace Internal {
class InternalBindingProperty;
class InternalSignalHandlerProperty;
class InternalVariantProperty;
class InternalNodeListProperty;
class InternalNodeProperty;
@@ -74,12 +75,14 @@ public:
virtual bool isNodeListProperty() const;
virtual bool isNodeProperty() const;
virtual bool isNodeAbstractProperty() const;
virtual bool isSignalHandlerProperty() const;
QSharedPointer<InternalBindingProperty> toBindingProperty() const;
QSharedPointer<InternalVariantProperty> toVariantProperty() const;
QSharedPointer<InternalNodeListProperty> toNodeListProperty() const;
QSharedPointer<InternalNodeProperty> toNodeProperty() const;
QSharedPointer<InternalNodeAbstractProperty> toNodeAbstractProperty() const;
QSharedPointer<InternalSignalHandlerProperty> toSignalHandlerProperty() const;
InternalNodePointer propertyOwner() const;

View File

@@ -0,0 +1,71 @@
/****************************************************************************
**
** Copyright (C) 2013 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 "internalsignalhandlerproperty.h"
namespace QmlDesigner {
namespace Internal {
InternalSignalHandlerProperty::InternalSignalHandlerProperty(const PropertyName &name, const InternalNodePointer &propertyOwner)
: InternalProperty(name, propertyOwner)
{
}
InternalSignalHandlerProperty::Pointer InternalSignalHandlerProperty::create(const PropertyName &name, const InternalNodePointer &propertyOwner)
{
InternalSignalHandlerProperty *newPointer(new InternalSignalHandlerProperty(name, propertyOwner));
InternalSignalHandlerProperty::Pointer smartPointer(newPointer);
newPointer->setInternalWeakPointer(smartPointer);
return smartPointer;
}
bool InternalSignalHandlerProperty::isValid() const
{
return InternalProperty::isValid() && isSignalHandlerProperty();
}
QString InternalSignalHandlerProperty::source() const
{
return m_source;
}
void InternalSignalHandlerProperty::setSource(const QString &source)
{
m_source = source;
}
bool InternalSignalHandlerProperty::isSignalHandlerProperty() const
{
return true;
}
} // namespace Internal
} // namespace QmlDesigner

View File

@@ -0,0 +1,62 @@
/****************************************************************************
**
** Copyright (C) 2013 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 INTERNALSIGNALHANDLERPROPERTY_H
#define INTERNALSIGNALHANDLERPROPERTY_H
#include "internalproperty.h"
namespace QmlDesigner {
namespace Internal {
class InternalSignalHandlerProperty : public InternalProperty
{
public:
typedef QSharedPointer<InternalSignalHandlerProperty> Pointer;
static Pointer create(const PropertyName &name, const InternalNodePointer &propertyOwner);
bool isValid() const;
QString source() const;
void setSource(const QString &source);
bool isSignalHandlerProperty() const;
protected:
InternalSignalHandlerProperty(const PropertyName &name, const InternalNodePointer &propertyOwner);
private:
QString m_source;
};
} // namespace Internal
} // namespace QmlDesigner
#endif // INTERNALSIGNALHANDLERPROPERTY_H

View File

@@ -52,6 +52,7 @@
#include "subcomponentmanager.h"
#include "internalproperty.h"
#include "internalnodelistproperty.h"
#include "internalsignalhandlerproperty.h"
#include "internalnodeabstractproperty.h"
#include "invalidmodelnodeexception.h"
#include "invalidmodelstateexception.h"
@@ -60,6 +61,7 @@
#include "abstractproperty.h"
#include "variantproperty.h"
#include "bindingproperty.h"
#include "signalhandlerproperty.h"
#include "nodeabstractproperty.h"
#include "nodelistproperty.h"
#include "rewritertransaction.h"
@@ -1009,6 +1011,46 @@ void ModelPrivate::notifyBindingPropertiesChanged(const QList<InternalBindingPro
resetModelByRewriter(description);
}
void ModelPrivate::notifySignalHandlerPropertiesChanged(const QVector<InternalSignalHandlerPropertyPointer> &internalPropertyList, AbstractView::PropertyChangeFlags propertyChange)
{
bool resetModel = false;
QString description;
try {
if (rewriterView()) {
QVector<SignalHandlerProperty> propertyList;
foreach (const InternalSignalHandlerPropertyPointer &signalHandlerProperty, internalPropertyList) {
propertyList.append(SignalHandlerProperty(signalHandlerProperty->name(), signalHandlerProperty->propertyOwner(), model(), rewriterView()));
}
rewriterView()->signalHandlerPropertiesChanged(propertyList, propertyChange);
}
} catch (RewritingException &e) {
description = e.description();
resetModel = true;
}
foreach (const QWeakPointer<AbstractView> &view, m_viewList) {
Q_ASSERT(view != 0);
QVector<SignalHandlerProperty> propertyList;
foreach (const InternalSignalHandlerPropertyPointer &signalHandlerProperty, internalPropertyList) {
propertyList.append(SignalHandlerProperty(signalHandlerProperty->name(), signalHandlerProperty->propertyOwner(), model(), view.data()));
}
view->signalHandlerPropertiesChanged(propertyList, propertyChange);
}
if (nodeInstanceView()) {
QVector<SignalHandlerProperty> propertyList;
foreach (const InternalSignalHandlerPropertyPointer &signalHandlerProperty, internalPropertyList) {
propertyList.append(SignalHandlerProperty(signalHandlerProperty->name(), signalHandlerProperty->propertyOwner(), model(), nodeInstanceView()));
}
nodeInstanceView()->signalHandlerPropertiesChanged(propertyList, propertyChange);
}
if (resetModel)
resetModelByRewriter(description);
}
void ModelPrivate::notifyScriptFunctionsChanged(const InternalNodePointer &internalNodePointer, const QStringList &scriptFunctionList)
{
bool resetModel = false;
@@ -1392,6 +1434,19 @@ void ModelPrivate::setBindingProperty(const InternalNode::Pointer &internalNode,
notifyBindingPropertiesChanged(QList<InternalBindingPropertyPointer>() << bindingProperty, propertyChange);
}
void ModelPrivate::setSignalHandlerProperty(const InternalNodePointer &internalNode, const PropertyName &name, const QString &source)
{
AbstractView::PropertyChangeFlags propertyChange = AbstractView::NoAdditionalChanges;
if (!internalNode->hasProperty(name)) {
internalNode->addSignalHandlerProperty(name);
propertyChange = AbstractView::PropertiesAdded;
}
InternalSignalHandlerProperty::Pointer signalHandlerProperty = internalNode->signalHandlerProperty(name);
signalHandlerProperty->setSource(source);
notifySignalHandlerPropertiesChanged(QVector<InternalSignalHandlerPropertyPointer>() << signalHandlerProperty, propertyChange);
}
void ModelPrivate::setVariantProperty(const InternalNode::Pointer &internalNode, const PropertyName &name, const QVariant &value)
{
AbstractView::PropertyChangeFlags propertyChange = AbstractView::NoAdditionalChanges;

View File

@@ -56,6 +56,7 @@ namespace Internal {
class InternalNode;
class InternalProperty;
class InternalBindingProperty;
class InternalSignalHandlerProperty;
class InternalVariantProperty;
class InternalNodeAbstractProperty;
class InternalNodeListProperty;
@@ -63,6 +64,7 @@ class InternalNodeListProperty;
typedef QSharedPointer<InternalNode> InternalNodePointer;
typedef QSharedPointer<InternalProperty> InternalPropertyPointer;
typedef QSharedPointer<InternalBindingProperty> InternalBindingPropertyPointer;
typedef QSharedPointer<InternalSignalHandlerProperty> InternalSignalHandlerPropertyPointer;
typedef QSharedPointer<InternalVariantProperty> InternalVariantPropertyPointer;
typedef QSharedPointer<InternalNodeAbstractProperty> InternalNodeAbstractPropertyPointer;
typedef QSharedPointer<InternalNodeListProperty> InternalNodeListPropertyPointer;
@@ -137,6 +139,7 @@ public:
void notifyPropertiesRemoved(const QList<PropertyPair> &propertyList);
void notifyPropertiesAboutToBeRemoved(const QList<InternalPropertyPointer> &propertyList);
void notifyBindingPropertiesChanged(const QList<InternalBindingPropertyPointer> &propertyList, AbstractView::PropertyChangeFlags propertyChange);
void notifySignalHandlerPropertiesChanged(const QVector<InternalSignalHandlerPropertyPointer> &propertyList, AbstractView::PropertyChangeFlags propertyChange);
void notifyVariantPropertiesChanged(const InternalNodePointer &internalNodePointer, const PropertyNameList &propertyNameList, AbstractView::PropertyChangeFlags propertyChange);
void notifyScriptFunctionsChanged(const InternalNodePointer &internalNodePointer, const QStringList &scriptFunctionList);
@@ -187,6 +190,7 @@ public:
void removeProperty(const InternalPropertyPointer &property);
void setBindingProperty(const InternalNodePointer &internalNode, const PropertyName &name, const QString &expression);
void setSignalHandlerProperty(const InternalNodePointer &internalNode, const PropertyName &name, const QString &source);
void setVariantProperty(const InternalNodePointer &internalNode, const PropertyName &name, const QVariant &value);
void setDynamicVariantProperty(const InternalNodePointer &internalNode, const PropertyName &name, const TypeName &propertyType, const QVariant &value);
void setDynamicBindingProperty(const InternalNodePointer &internalNode, const PropertyName &name, const TypeName &dynamicPropertyType, const QString &expression);

View File

@@ -44,6 +44,7 @@
#include "model_p.h"
#include "variantproperty.h"
#include "bindingproperty.h"
#include "signalhandlerproperty.h"
#include "nodeabstractproperty.h"
#include "nodelistproperty.h"
#include "nodeproperty.h"
@@ -404,6 +405,14 @@ BindingProperty ModelNode::bindingProperty(const PropertyName &name) const
return BindingProperty(name, m_internalNode, model(), view());
}
SignalHandlerProperty ModelNode::signalHandlerProperty(const PropertyName &name) const
{
if (!isValid())
throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__);
return SignalHandlerProperty(name, m_internalNode, model(), view());
}
/*!
\brief Returns a NodeProperty

View File

@@ -315,7 +315,7 @@ void ModelToTextMerger::schedule(RewriteAction *action)
QmlDesigner::QmlRefactoring::PropertyType ModelToTextMerger::propertyType(const AbstractProperty &property, const QString &textValue)
{
if (property.isBindingProperty()) {
if (property.isBindingProperty() || property.isSignalHandlerProperty()) {
QString val = textValue.trimmed();
if (val.isEmpty())
return QmlDesigner::QmlRefactoring::ObjectBinding;

View File

@@ -366,6 +366,7 @@ void QmlModelView::propertiesAboutToBeRemoved(const QList<AbstractProperty>& /*p
void QmlModelView::propertiesRemoved(const QList<AbstractProperty>& /*propertyList*/) {}
void QmlModelView::variantPropertiesChanged(const QList<VariantProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/) {}
void QmlModelView::bindingPropertiesChanged(const QList<BindingProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/) {}
void QmlModelView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> & /*propertyList*/, AbstractView::PropertyChangeFlags /*propertyChange*/) {}
void QmlModelView::rootNodeTypeChanged(const QString &/*type*/, int, int /*minorVersion*/) {}
void QmlModelView::scriptFunctionsChanged(const ModelNode &/*node*/, const QStringList &/*scriptFunctionList*/) {}
void QmlModelView::selectedNodesChanged(const QList<ModelNode> &/*selectedNodeList*/, const QList<ModelNode> &/*lastSelectedNodeList*/) {}

View File

@@ -33,6 +33,7 @@
#include <QColor>
#include "bindingproperty.h"
#include "signalhandlerproperty.h"
#include "nodeproperty.h"
#include "nodelistproperty.h"
#include "variantproperty.h"
@@ -74,6 +75,8 @@ QString QmlTextGenerator::toQml(const AbstractProperty &property, int indentDept
{
if (property.isBindingProperty()) {
return property.toBindingProperty().expression();
} else if (property.isSignalHandlerProperty()) {
return property.toSignalHandlerProperty().source();
} else if (property.isNodeProperty()) {
return toQml(property.toNodeProperty().modelNode(), indentDepth);
} else if (property.isNodeListProperty()) {

View File

@@ -43,6 +43,7 @@
#include "modeltotextmerger.h"
#include "nodelistproperty.h"
#include "nodeproperty.h"
#include "signalhandlerproperty.h"
#include "invalidmodelnodeexception.h"
@@ -259,6 +260,22 @@ void RewriterView::bindingPropertiesChanged(const QList<BindingProperty>& proper
applyChanges();
}
void RewriterView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> &propertyList, AbstractView::PropertyChangeFlags propertyChange)
{
Q_ASSERT(textModifier());
if (textToModelMerger()->isActive())
return;
QList<AbstractProperty> usefulPropertyList;
foreach (const SignalHandlerProperty &property, propertyList)
usefulPropertyList.append(property);
modelToTextMerger()->propertiesChanged(usefulPropertyList, propertyChange);
if (!isModificationGroupActive())
applyChanges();
}
void RewriterView::nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange)
{
Q_ASSERT(textModifier());

View File

@@ -0,0 +1,102 @@
/****************************************************************************
**
** Copyright (C) 2013 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 "signalhandlerproperty.h"
#include "nodeabstractproperty.h"
#include "nodeproperty.h"
#include "internalproperty.h"
#include "internalsignalhandlerproperty.h"
#include "invalidmodelnodeexception.h"
#include "invalidpropertyexception.h"
#include "invalidargumentexception.h"
#include "internalnode_p.h"
#include "model.h"
#include "model_p.h"
namespace QmlDesigner {
SignalHandlerProperty::SignalHandlerProperty()
{
}
SignalHandlerProperty::SignalHandlerProperty(const SignalHandlerProperty &property, AbstractView *view)
: AbstractProperty(property.name(), property.internalNode(), property.model(), view)
{
}
SignalHandlerProperty::SignalHandlerProperty(const PropertyName &propertyName, const Internal::InternalNodePointer &internalNode, Model* model, AbstractView *view)
: AbstractProperty(propertyName, internalNode, model, view)
{
}
void SignalHandlerProperty::setSource(const QString &source)
{
Internal::WriteLocker locker(model());
if (!isValid())
throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__);
if (name() == "id") { // the ID for a node is independent of the state, so it has to be set with ModelNode::setId
throw InvalidPropertyException(__LINE__, __FUNCTION__, __FILE__, name());
}
if (source.isEmpty())
throw InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, name());
if (internalNode()->hasProperty(name())) { //check if oldValue != value
Internal::InternalProperty::Pointer internalProperty = internalNode()->property(name());
if (internalProperty->isSignalHandlerProperty()
&& internalProperty->toSignalHandlerProperty()->source() == source)
return;
}
if (internalNode()->hasProperty(name()) && !internalNode()->property(name())->isSignalHandlerProperty())
model()->d->removeProperty(internalNode()->property(name()));
model()->d->setSignalHandlerProperty(internalNode(), name(), source);
}
QString SignalHandlerProperty::source() const
{
if (internalNode()->hasProperty(name())
&& internalNode()->property(name())->isSignalHandlerProperty())
return internalNode()->signalHandlerProperty(name())->source();
return QString();
}
SignalHandlerProperty& SignalHandlerProperty::operator= (const QString &source)
{
setSource(source);
return *this;
}
} // namespace QmlDesigner

View File

@@ -40,6 +40,7 @@
#include "textmodifier.h"
#include "rewriterview.h"
#include "variantproperty.h"
#include "signalhandlerproperty.h"
#include "nodemetainfo.h"
#include "qmldesignercorelib_global.h"
@@ -263,6 +264,11 @@ static bool isPropertyChangesType(const QmlDesigner::TypeName &type)
return type == "PropertyChanges" || type == "QtQuick.PropertyChanges" || type == "Qt.PropertyChanges";
}
static bool isConnectionsType(const QmlDesigner::TypeName &type)
{
return type == "Connections" || type == "QtQuick.Connections" || type == "Qt.Connections";
}
static bool propertyIsComponentType(const QmlDesigner::NodeAbstractProperty &property, const QmlDesigner::TypeName &type, QmlDesigner::Model *model)
{
if (model->metaInfo(type, -1, -1).isSubclassOf("QtQuick.Component", -1, -1) && !isComponentType(type))
@@ -916,7 +922,7 @@ void TextToModelMerger::syncNode(ModelNode &modelNode,
if (UiArrayBinding *array = cast<UiArrayBinding *>(member)) {
const QString astPropertyName = toString(array->qualifiedId);
if (isPropertyChangesType(typeName) || context->lookupProperty(QString(), array->qualifiedId)) {
if (isPropertyChangesType(typeName) || isConnectionsType(typeName) || context->lookupProperty(QString(), array->qualifiedId)) {
AbstractProperty modelProperty = modelNode.property(astPropertyName.toUtf8());
QList<UiObjectMember *> arrayMembers;
for (UiArrayMemberList *iter = array->members; iter; iter = iter->next)
@@ -950,7 +956,9 @@ void TextToModelMerger::syncNode(ModelNode &modelNode,
const Value *propertyType = 0;
const ObjectValue *containingObject = 0;
QString name;
if (context->lookupProperty(QString(), binding->qualifiedId, &propertyType, &containingObject, &name) || isPropertyChangesType(typeName)) {
if (context->lookupProperty(QString(), binding->qualifiedId, &propertyType, &containingObject, &name)
|| isPropertyChangesType(typeName)
|| isConnectionsType(typeName)) {
AbstractProperty modelProperty = modelNode.property(astPropertyName.toUtf8());
if (context->isArrayProperty(propertyType, containingObject, name))
syncArrayProperty(modelProperty, QList<QmlJS::AST::UiObjectMember*>() << member, context, differenceHandler);
@@ -1050,11 +1058,15 @@ QmlDesigner::PropertyName TextToModelMerger::syncScriptBinding(ModelNode &modelN
return astPropertyName.toUtf8();
}
if (isSignalPropertyName(astPropertyName))
return PropertyName();
if (isSignalPropertyName(astPropertyName)) {
AbstractProperty modelProperty = modelNode.property(astPropertyName.toUtf8());
syncSignalHandler(modelProperty, astValue, differenceHandler);
return astPropertyName.toUtf8();
}
if (isLiteralValue(script)) {
if (isPropertyChangesType(modelNode.type())) {
if (isPropertyChangesType(modelNode.type())
|| isConnectionsType(modelNode.type())) {
AbstractProperty modelProperty = modelNode.property(astPropertyName.toUtf8());
const QVariant variantValue(deEscape(stripQuotes(astValue)));
syncVariantProperty(modelProperty, variantValue, TypeName(), differenceHandler);
@@ -1079,7 +1091,9 @@ QmlDesigner::PropertyName TextToModelMerger::syncScriptBinding(ModelNode &modelN
syncVariantProperty(modelProperty, enumValue, TypeName(), differenceHandler); // TODO: parse type
return astPropertyName.toUtf8();
} else { // Not an enum, so:
if (isPropertyChangesType(modelNode.type()) || context->lookupProperty(prefix, script->qualifiedId)) {
if (isPropertyChangesType(modelNode.type())
|| isConnectionsType(modelNode.type())
|| context->lookupProperty(prefix, script->qualifiedId)) {
AbstractProperty modelProperty = modelNode.property(astPropertyName.toUtf8());
syncExpressionProperty(modelProperty, astValue, TypeName(), differenceHandler); // TODO: parse type
return astPropertyName.toUtf8();
@@ -1159,6 +1173,21 @@ void TextToModelMerger::syncExpressionProperty(AbstractProperty &modelProperty,
}
}
void TextToModelMerger::syncSignalHandler(AbstractProperty &modelProperty,
const QString &javascript,
DifferenceHandler &differenceHandler)
{
if (modelProperty.isSignalHandlerProperty()) {
SignalHandlerProperty signalHandlerProperty = modelProperty.toSignalHandlerProperty();
if (signalHandlerProperty.source() != javascript) {
differenceHandler.signalHandlerSourceDiffer(signalHandlerProperty, javascript);
}
} else {
differenceHandler.shouldBeSignalHandlerProperty(modelProperty, javascript);
}
}
void TextToModelMerger::syncArrayProperty(AbstractProperty &modelProperty,
const QList<UiObjectMember *> &arrayMembers,
ReadingContext *context,
@@ -1321,6 +1350,21 @@ void ModelValidator::shouldBeBindingProperty(AbstractProperty &modelProperty,
Q_ASSERT(0);
}
void ModelValidator::signalHandlerSourceDiffer(SignalHandlerProperty &modelProperty, const QString &javascript)
{
Q_UNUSED(modelProperty)
Q_UNUSED(javascript)
Q_ASSERT(modelProperty.source() == javascript);
Q_ASSERT(0);
}
void ModelValidator::shouldBeSignalHandlerProperty(AbstractProperty &modelProperty, const QString &javascript)
{
Q_UNUSED(modelProperty)
Q_ASSERT(modelProperty.isSignalHandlerProperty());
Q_ASSERT(0);
}
void ModelValidator::shouldBeNodeListProperty(AbstractProperty &modelProperty,
const QList<UiObjectMember *> /*arrayMembers*/,
ReadingContext * /*context*/)
@@ -1450,6 +1494,18 @@ void ModelAmender::shouldBeBindingProperty(AbstractProperty &modelProperty,
newModelProperty.setDynamicTypeNameAndExpression(astType, javascript);
}
void ModelAmender::signalHandlerSourceDiffer(SignalHandlerProperty &modelProperty, const QString &javascript)
{
modelProperty.setSource(javascript);
}
void ModelAmender::shouldBeSignalHandlerProperty(AbstractProperty &modelProperty, const QString &javascript)
{
ModelNode theNode = modelProperty.parentModelNode();
SignalHandlerProperty newModelProperty = theNode.signalHandlerProperty(modelProperty.name());
newModelProperty.setSource(javascript);
}
void ModelAmender::shouldBeNodeListProperty(AbstractProperty &modelProperty,
const QList<UiObjectMember *> arrayMembers,
ReadingContext *context)

View File

@@ -94,6 +94,9 @@ public:
const QString &javascript,
const TypeName &astType,
DifferenceHandler &differenceHandler);
void syncSignalHandler(AbstractProperty &modelProperty,
const QString &javascript,
DifferenceHandler &differenceHandler);
void syncArrayProperty(AbstractProperty &modelProperty,
const QList<QmlJS::AST::UiObjectMember *> &arrayMembers,
ReadingContext *context,
@@ -123,7 +126,6 @@ public:
void setupCustomParserNodeDelayed(const ModelNode &node, bool synchron);
void delayedSetup();
private:
void setupCustomParserNode(const ModelNode &node);
void setupComponent(const ModelNode &node);
@@ -158,9 +160,13 @@ public:
virtual void bindingExpressionsDiffer(BindingProperty &modelProperty,
const QString &javascript,
const TypeName &astType) = 0;
virtual void signalHandlerSourceDiffer(SignalHandlerProperty &modelProperty,
const QString &javascript) = 0;
virtual void shouldBeBindingProperty(AbstractProperty &modelProperty,
const QString &javascript,
const TypeName &astType) = 0;
virtual void shouldBeSignalHandlerProperty(AbstractProperty &modelProperty,
const QString &javascript) = 0;
virtual void shouldBeNodeListProperty(AbstractProperty &modelProperty,
const QList<QmlJS::AST::UiObjectMember *> arrayMembers,
ReadingContext *context) = 0;
@@ -208,6 +214,10 @@ public:
virtual void shouldBeBindingProperty(AbstractProperty &modelProperty,
const QString &javascript,
const TypeName &astType);
virtual void signalHandlerSourceDiffer(SignalHandlerProperty &modelProperty,
const QString &javascript);
virtual void shouldBeSignalHandlerProperty(AbstractProperty &modelProperty,
const QString &javascript);
virtual void shouldBeNodeListProperty(AbstractProperty &modelProperty,
const QList<QmlJS::AST::UiObjectMember *> arrayMembers,
ReadingContext *context);
@@ -252,6 +262,10 @@ public:
virtual void shouldBeBindingProperty(AbstractProperty &modelProperty,
const QString &javascript,
const TypeName &astType);
virtual void signalHandlerSourceDiffer(SignalHandlerProperty &modelProperty,
const QString &javascript);
virtual void shouldBeSignalHandlerProperty(AbstractProperty &modelProperty,
const QString &javascript);
virtual void shouldBeNodeListProperty(AbstractProperty &modelProperty,
const QList<QmlJS::AST::UiObjectMember *> arrayMembers,
ReadingContext *context);

View File

@@ -1,291 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2013 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 "viewlogger.h"
#include <QDebug>
#include <QTemporaryFile>
#include <QDir>
#include <QUrl>
#include <variantproperty.h>
#include <bindingproperty.h>
#include <nodeabstractproperty.h>
#include <nodelistproperty.h>
namespace QmlDesigner {
namespace Internal {
static QString serialize(AbstractView::PropertyChangeFlags change)
{
QStringList tokenList;
if (change.testFlag(AbstractView::PropertiesAdded))
tokenList.append(QLatin1String("PropertiesAdded"));
if (change.testFlag(AbstractView::EmptyPropertiesRemoved))
tokenList.append(QLatin1String("EmptyPropertiesRemoved"));
return tokenList.join(" ");
}
static QString indent(const QString &name = QString()) {
return name.leftJustified(30, ' ');
}
QString ViewLogger::time() const
{
return QString::number(m_timer.elapsed()).leftJustified(7, ' ');
}
ViewLogger::ViewLogger(QObject *parent)
: AbstractView(parent)
{
m_timer.start();
}
void ViewLogger::modelAttached(Model *model)
{
static const QString path = QDir::tempPath() + QString("/qmldesigner-logger-%1-XXXXXX.txt").
arg(QDateTime::currentDateTime().toString(Qt::ISODate).
replace(':', '-'));
static QTemporaryFile *temporaryFile = new QTemporaryFile(path, this);
temporaryFile->setAutoRemove(false);
static bool fileOpen = temporaryFile->open();
if (fileOpen) {
qDebug() << "QmlDesigner: Log file is:" << temporaryFile->fileName();
m_output.setDevice(temporaryFile);
} else {
qDebug() << "QmlDesigner: failed to open:" << temporaryFile->fileName();
}
m_output << time() << indent("modelAttached:") << model << endl;
AbstractView::modelAttached(model);
}
void ViewLogger::modelAboutToBeDetached(Model *model)
{
m_output << time() << indent("modelAboutToBeDetached:") << model << endl;
AbstractView::modelAboutToBeDetached(model);
}
void ViewLogger::nodeCreated(const ModelNode &createdNode)
{
m_output << time() << indent("nodeCreated:") << createdNode << endl;
}
void ViewLogger::nodeAboutToBeRemoved(const ModelNode &removedNode)
{
m_output << time() << indent("nodeAboutToBeRemoved:") << removedNode << endl;
}
void ViewLogger::nodeRemoved(const ModelNode &removedNode, const NodeAbstractProperty &parentProperty, PropertyChangeFlags propertyChange)
{
m_output << time() << indent("nodeRemoved:") << removedNode << parentProperty << serialize(propertyChange) << endl;
}
void ViewLogger::nodeAboutToBeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange)
{
m_output << time() << indent("nodeAboutToBeReparented:") << node << "\t" << newPropertyParent << "\t" << oldPropertyParent << "\t" << serialize(propertyChange) << endl;
}
void ViewLogger::nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange)
{
m_output << time() << indent("nodeReparented:") << node << "\t" << newPropertyParent << "\t" << oldPropertyParent << "\t" << serialize(propertyChange) << endl;
}
void ViewLogger::nodeIdChanged(const ModelNode& node, const QString& newId, const QString& oldId)
{
m_output << time() << indent("nodeIdChanged:") << node << "\t" << newId << "\t" << oldId << endl;
}
void ViewLogger::propertiesAboutToBeRemoved(const QList<AbstractProperty>& propertyList)
{
m_output << time() << indent("propertiesAboutToBeRemoved:") << endl;
foreach (const AbstractProperty &property, propertyList)
m_output << time() << indent() << property << endl;
}
void ViewLogger::propertiesRemoved(const QList<AbstractProperty> &propertyList)
{
m_output << time() << indent("propertiesRemoved:") << endl;
foreach (const AbstractProperty &property, propertyList)
m_output << time() << indent() << property << endl;
}
void ViewLogger::variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange)
{
m_output << time() << indent("variantPropertiesChanged:") << serialize(propertyChange) << endl;
foreach (const VariantProperty &property, propertyList)
m_output << time() << indent() << property << endl;
}
void ViewLogger::bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange)
{
m_output << time() << indent("bindingPropertiesChanged:") << serialize(propertyChange) << endl;
foreach (const BindingProperty &property, propertyList)
m_output << time() << indent() << property << endl;
}
void ViewLogger::rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion)
{
m_output << time() << indent("rootNodeTypeChanged:") << rootModelNode() << type << majorVersion << minorVersion << endl;
}
void ViewLogger::selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
const QList<ModelNode> &lastSelectedNodeList)
{
m_output << time() << indent("selectedNodesChanged:") << endl;
foreach (const ModelNode &node, selectedNodeList)
m_output << time() << indent("new: ") << node << endl;
foreach (const ModelNode &node, lastSelectedNodeList)
m_output << time() << indent("old: ") << node << endl;
}
void ViewLogger::fileUrlChanged(const QUrl &oldUrl, const QUrl &newUrl)
{
m_output << time() << indent("fileUrlChanged:") << oldUrl.toString() << "\t" << newUrl.toString() << endl;
}
void ViewLogger::nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex)
{
m_output << time() << indent("nodeOrderChanged:") << listProperty << movedNode << oldIndex << endl;
}
void ViewLogger::auxiliaryDataChanged(const ModelNode &node, const PropertyName &name, const QVariant &data)
{
m_output << time() << indent("auxiliaryDataChanged:") << node << "\t" << name << "\t" << data.toString() << endl;
}
void ViewLogger::importsChanged(const QList<Import> &addedImports, const QList<Import> &removedImports)
{
m_output << time() << indent("importsChanged:") << endl;
foreach (const Import &import, addedImports)
m_output << time() << indent("import added: ") << import.toString() << endl;
foreach (const Import &import, removedImports)
m_output << time() << indent("import removed: ") << import.toString() << endl;
}
void ViewLogger::customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data)
{
m_output << time() << indent("customNotification:") << view << identifier << endl;
foreach (const ModelNode &node, nodeList)
m_output << time() << indent("node: ") << node << endl;
foreach (const QVariant &variant, data)
m_output << time() << indent("data: ") << variant.toString() << endl;
}
void ViewLogger::scriptFunctionsChanged(const ModelNode &node, const QStringList &/*scriptFunctionList*/)
{
m_output << time() << indent("function scripts changed:") << node << endl;
}
void ViewLogger::instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList)
{
typedef QPair<ModelNode, PropertyName> PropertyPair;
m_output << time() << indent("instancePropertyChange:") << endl;
foreach (const PropertyPair &propertyPair, propertyList)
m_output << time() << indent("property: ") << propertyPair.first << propertyPair.second << endl;
}
void ViewLogger::instancesCompleted(const QVector<ModelNode> &completedNodeList)
{
m_output << time() << indent("instancesCompleted:") << endl;
foreach (const ModelNode &node, completedNodeList)
m_output << time() << indent("node: ") << node << endl;
}
void ViewLogger::instanceInformationsChange(const QMultiHash<ModelNode, InformationName> &informationChangeHash)
{
m_output << time() << indent("instanceInformationsChange:") << endl;
QHashIterator<ModelNode, InformationName> informationChangeHashIterator(informationChangeHash);
while (informationChangeHashIterator.hasNext()) {
informationChangeHashIterator.next();
m_output << time() << indent("node: ") << informationChangeHashIterator.key() << "\tinformation: " << informationChangeHashIterator.value() << endl;
}
}
void ViewLogger::instancesRenderImageChanged(const QVector<ModelNode> &nodeList)
{
m_output << time() << indent("instancesRenderImageChanged:") << endl;
foreach (const ModelNode &node, nodeList)
m_output << time() << indent("node: ") << node << endl;
}
void ViewLogger::instancesPreviewImageChanged(const QVector<ModelNode> &nodeList)
{
m_output << time() << indent("instancesPreviewImageChanged:") << endl;
foreach (const ModelNode &node, nodeList)
m_output << time() << indent("node: ") << node << endl;
}
void ViewLogger::instancesChildrenChanged(const QVector<ModelNode> &nodeList)
{
m_output << time() << indent("instancesChildrenChanged:") << endl;
foreach (const ModelNode &node, nodeList)
m_output << time() << indent("node: ") << node << endl;
}
void ViewLogger::instancesToken(const QString &tokenName, int tokenNumber, const QVector<ModelNode> &nodeVector)
{
m_output << time() << indent("instancesToken:") << tokenName << tokenNumber << endl;
foreach (const ModelNode &node, nodeVector)
m_output << time() << indent("node: ") << node << endl;
}
void ViewLogger::nodeSourceChanged(const ModelNode &node, const QString & /*newNodeSource*/)
{
m_output << time() << indent("nodeSourceChanged:") << endl;
m_output << time() << indent("node: ") << node << endl;
}
void ViewLogger::rewriterBeginTransaction()
{
m_output << time() << indent("rewriterBeginTransaction:") << endl;
}
void ViewLogger::rewriterEndTransaction()
{
m_output << time() << indent("rewriterEndTransaction:") << endl;
}
void ViewLogger::actualStateChanged(const ModelNode &node)
{
m_output << time() << indent("actualStateChanged:") << node << endl;
}
} // namespace Internal
} // namespace QmlDesigner

View File

@@ -1,101 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2013 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 VIEWLOGGER_H
#define VIEWLOGGER_H
#include "abstractview.h"
#include <QTextStream>
#include <QTime>
namespace QmlDesigner {
namespace Internal {
class ViewLogger : public QmlDesigner::AbstractView
{
Q_OBJECT
public:
ViewLogger(QObject *parent = 0);
void modelAttached(Model *model);
void modelAboutToBeDetached(Model *model);
void nodeCreated(const ModelNode &createdNode);
void nodeAboutToBeRemoved(const ModelNode &removedNode);
void nodeRemoved(const ModelNode &removedNode, const NodeAbstractProperty &parentProperty, PropertyChangeFlags propertyChange);
void nodeAboutToBeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange);
void nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange);
void nodeIdChanged(const ModelNode& node, const QString& newId, const QString& oldId);
void propertiesAboutToBeRemoved(const QList<AbstractProperty>& propertyList);
void propertiesRemoved(const QList<AbstractProperty>& propertyList);
void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange);
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange);
void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion);
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
const QList<ModelNode> &lastSelectedNodeList);
void fileUrlChanged(const QUrl &oldUrl, const QUrl &newUrl);
void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex);
void importsChanged(const QList<Import> &addedImports, const QList<Import> &removedImports);
void auxiliaryDataChanged(const ModelNode &node, const PropertyName &name, const QVariant &data);
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList);
void instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList);
void instancesCompleted(const QVector<ModelNode> &completedNodeList);
void instanceInformationsChange(const QMultiHash<ModelNode, InformationName> &informationChangeHash);
void instancesRenderImageChanged(const QVector<ModelNode> &nodeList);
void instancesPreviewImageChanged(const QVector<ModelNode> &nodeList);
void instancesChildrenChanged(const QVector<ModelNode> &nodeList);
void instancesToken(const QString &tokenName, int tokenNumber, const QVector<ModelNode> &nodeVector);
void nodeSourceChanged(const ModelNode &modelNode, const QString &newNodeSource);
void rewriterBeginTransaction();
void rewriterEndTransaction();
void actualStateChanged(const ModelNode &node);
protected:
QString time() const;
private:
QTextStream m_output;
QTime m_timer;
};
} // namespace Internal
} // namespace QmlDesigner
#endif // VIEWLOGGER_H

View File

@@ -112,10 +112,6 @@ void ViewManager::detachViewsExceptRewriterAndComponetView()
if (m_debugView.isAttached())
currentModel()->detachView(&m_debugView);
currentModel()->setNodeInstanceView(0);
static bool enableViewLogger = !qgetenv("QTC_ENABLE_QMLDESIGNER_LOGGER").isEmpty();
if (enableViewLogger)
currentModel()->detachView(&m_viewLogger);
}
void ViewManager::attachItemLibraryView()
@@ -150,10 +146,6 @@ void ViewManager::detachComponentView()
void ViewManager::attachViewsExceptRewriterAndComponetView()
{
static bool enableViewLogger = !qgetenv("QTC_ENABLE_QMLDESIGNER_LOGGER").isEmpty();
if (enableViewLogger)
currentModel()->attachView(&m_viewLogger);
if (QmlDesignerPlugin::instance()->settings().enableDebugView)
currentModel()->attachView(&m_debugView);
attachNodeInstanceView();

View File

@@ -280,8 +280,6 @@ QtcPlugin {
"model/texttomodelmerger.cpp",
"model/texttomodelmerger.h",
"model/variantproperty.cpp",
"model/viewlogger.cpp",
"model/viewlogger.h",
"pluginmanager/widgetpluginmanager.cpp",
"pluginmanager/widgetpluginmanager.h",
"pluginmanager/widgetpluginpath.cpp",

View File

@@ -296,8 +296,6 @@ int Highlighter::onBlockStart()
void Highlighter::onBlockEnd(int state)
{
typedef TextEditor::TextBlockUserData TextEditorBlockData;
setCurrentBlockState((m_braceDepth << 8) | state);
TextEditor::BaseTextDocumentLayout::setParentheses(currentBlock(), m_currentBlockParentheses);
TextEditor::BaseTextDocumentLayout::setFoldingIndent(currentBlock(), m_foldingIndent);

View File

@@ -100,7 +100,7 @@ void QtKitInformation::fix(ProjectExplorer::Kit *k)
{
QTC_ASSERT(QtVersionManager::instance()->isLoaded(), return);
BaseQtVersion *version = qtVersion(k);
if (!version) {
if (!version && qtVersionId(k) >= 0) {
qWarning("Qt version is no longer known, removing from kit \"%s\".", qPrintable(k->displayName()));
setQtVersionId(k, -1);
}

View File

@@ -12,7 +12,7 @@ After installing the QtSDK you should use the package manager of the QtSDK (SDKM
You'll need at least Desktop Qt versions 4.7.4, 4.8.0, Harmattan stuff (except QEmu), Maemo Toolchain, Qt Examples, Simulator, Documentation files.
Third - some of the test suites/test cases expect Qt 5.0.1 installed in its default location.
On Linux/Mac this is ~/Qt5.0.1, and on Windows this is C:\Qt\5.0.1.
On Linux/Mac this is ~/Qt5.0.1, and on Windows this is C:\Qt\Qt5.0.1.
Fourth - you'll have to provide some additional repositories (and for the hooking into subprocesses even some more Squish bundles, see below).
These additional repositories are located inside ~/QtSDK/src or C:\QtSDK\src (depending on the OS you're on).

View File

@@ -97,7 +97,7 @@
<valuemap type="QVariantMap">
<value type="int" key="Id">18</value>
<value type="QString" key="Name">Desktop Qt 5.0.1 (msvc2010)</value>
<value type="QString" key="QMakePath">C:/Qt/5.0.1/5.0.1/msvc2010/bin/qmake.exe</value>
<value type="QString" key="QMakePath">C:/Qt/Qt5.0.1/5.0.1/msvc2010/bin/qmake.exe</value>
<value type="QString" key="QtVersion.Type">Qt4ProjectManager.QtVersion.Desktop</value>
<value type="bool" key="isAutodetected">false</value>
</valuemap>

View File

@@ -158,13 +158,14 @@ def iterateBuildConfigs(kitCount, filter = ""):
# param targetCount specifies the number of targets currently defined (must be correct!)
# param currentTarget specifies the target for which to switch into the specified settings (zero based index)
# param configName is the name of the configuration that should be selected
# returns information about the selected kit, see getQtInformationForBuildSettings
def selectBuildConfig(targetCount, currentTarget, configName):
switchViewTo(ViewConstants.PROJECTS)
switchToBuildOrRunSettingsFor(targetCount, currentTarget, ProjectSettings.BUILD)
if selectFromCombo(":scrollArea.Edit build configuration:_QComboBox", configName):
waitForSignal("{type='CppTools::Internal::CppModelManager' unnamed='1'}",
"sourceFilesRefreshed(QStringList)")
switchViewTo(ViewConstants.EDIT)
return getQtInformationForBuildSettings(targetCount, True, ViewConstants.EDIT)
# This will not trigger a rebuild. If needed, caller has to do this.
def verifyBuildConfig(targetCount, currentTarget, shouldBeDebug=False, enableShadowBuild=False, enableQmlDebug=False):

View File

@@ -16,7 +16,8 @@ class QtQuickConstants:
@staticmethod
def desktopTargetClasses():
desktopTargets = QtQuickConstants.Targets.DESKTOP_474_GCC
desktopTargets = QtQuickConstants.Targets.DESKTOP_474_GCC \
| QtQuickConstants.Targets.DESKTOP_501_DEFAULT
if platform.system() in ('Windows', 'Microsoft'):
desktopTargets |= QtQuickConstants.Targets.DESKTOP_474_MSVC2008
return desktopTargets

View File

@@ -64,7 +64,7 @@ def widgetContainsPoint(widget, point):
def openContextMenuOnTextCursorPosition(editor):
rect = editor.cursorRect(editor.textCursor())
if platform.system() == 'Darwin':
JIRA.performWorkaroundIfStillOpen(6918, JIRA.Bug.CREATOR, editor)
JIRA.performWorkaroundIfStillOpen(8735, JIRA.Bug.CREATOR, editor)
openContextMenu(editor, rect.x+rect.width/2, rect.y+rect.height/2, 0)
menuInList = [None]
waitFor("menuVisibleAtEditor(editor, menuInList)", 5000)
@@ -311,3 +311,31 @@ def openDocument(treeElement):
return True
except:
return False
def earlyExit(details="No additional information"):
test.fail("Something went wrong running this test", details)
invokeMenuItem("File", "Save All")
invokeMenuItem("File", "Exit")
def openDocumentPlaceCursor(doc, line, additionalFunction=None):
cppEditorStr = ":Qt Creator_CppEditor::Internal::CPPEditorWidget"
if openDocument(doc) and placeCursorToLine(cppEditorStr, line):
if additionalFunction:
additionalFunction()
return str(waitForObject(cppEditorStr).plainText)
else:
earlyExit("Open %s or placing cursor to line (%s) failed." % (doc, line))
return None
# Replaces a line in the editor with another
# param fileSpec a string specifying a file in Projects view
# param oldLine a string holding the line to be replaced
# param newLine a string holding the line to be inserted
def replaceLine(fileSpec, oldLine, newLine):
if openDocumentPlaceCursor(fileSpec, oldLine) == None:
return False
editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
for i in range(len(oldLine)):
type(editor, "<Backspace>")
type(editor, newLine)
return True

View File

@@ -139,7 +139,7 @@ def getQtInformationForBuildSettings(kitCount, alreadyOnProjectsBuildSettings=Fa
qtLibPath = getQtInformationByQMakeCall(qtDir, QtInformation.QT_LIBPATH)
qtBinPath = getQtInformationByQMakeCall(qtDir, QtInformation.QT_BINPATH)
if afterSwitchTo:
if ViewConstants.WELCOME <= afterSwitchTo <= ViewConstans.LAST_AVAILABLE:
if ViewConstants.WELCOME <= afterSwitchTo <= ViewConstants.LAST_AVAILABLE:
switchViewTo(afterSwitchTo)
else:
test.warning("Don't know where you trying to switch to (%s)" % afterSwitchTo)

View File

@@ -33,13 +33,6 @@ def checkSyntaxError(issuesView, expectedTextsArray, warnIfMoreIssues = True):
return True
return False
# wait and verify if object exists/not exists
def checkIfObjectExists(name, shouldExist = True, timeout = 3000, verboseOnFail = False):
result = waitFor("object.exists(name) == shouldExist", timeout)
if verboseOnFail and not result:
test.log("checkIfObjectExists() failed for '%s'" % name)
return result
# change autocomplete options to manual
def changeAutocompleteToManual():
invokeMenuItem("Tools", "Options...")

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