diff options
Diffstat (limited to 'src')
445 files changed, 5612 insertions, 4475 deletions
diff --git a/src/libs/3rdparty/botan/build/botan/build.h b/src/libs/3rdparty/botan/build/botan/build.h index f674283e72..cea0132dc9 100644 --- a/src/libs/3rdparty/botan/build/botan/build.h +++ b/src/libs/3rdparty/botan/build/botan/build.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/libs/3rdparty/precompiled_headers/botan_pch.h b/src/libs/3rdparty/precompiled_headers/botan_pch.h index 034a5845fc..6a2aa431ee 100644 --- a/src/libs/3rdparty/precompiled_headers/botan_pch.h +++ b/src/libs/3rdparty/precompiled_headers/botan_pch.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/libs/aggregation/examples/text/main.cpp b/src/libs/aggregation/examples/text/main.cpp index 81d88727ca..30a4a1d91b 100644 --- a/src/libs/aggregation/examples/text/main.cpp +++ b/src/libs/aggregation/examples/text/main.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/libs/aggregation/examples/text/main.h b/src/libs/aggregation/examples/text/main.h index 3c80fea8c6..111f55df41 100644 --- a/src/libs/aggregation/examples/text/main.h +++ b/src/libs/aggregation/examples/text/main.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/libs/aggregation/examples/text/myinterfaces.h b/src/libs/aggregation/examples/text/myinterfaces.h index 7834af3d47..9180feaed5 100644 --- a/src/libs/aggregation/examples/text/myinterfaces.h +++ b/src/libs/aggregation/examples/text/myinterfaces.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/libs/extensionsystem/test/manual/pluginview/plugindialog.cpp b/src/libs/extensionsystem/test/manual/pluginview/plugindialog.cpp index 37b53ed11d..ab2042488b 100644 --- a/src/libs/extensionsystem/test/manual/pluginview/plugindialog.cpp +++ b/src/libs/extensionsystem/test/manual/pluginview/plugindialog.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/libs/extensionsystem/test/manual/pluginview/plugindialog.h b/src/libs/extensionsystem/test/manual/pluginview/plugindialog.h index 2a98c84af4..a8c2b098d6 100644 --- a/src/libs/extensionsystem/test/manual/pluginview/plugindialog.h +++ b/src/libs/extensionsystem/test/manual/pluginview/plugindialog.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin1/plugin1.cpp b/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin1/plugin1.cpp index 0bdf6d2b51..e9cb065554 100644 --- a/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin1/plugin1.cpp +++ b/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin1/plugin1.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin1/plugin1.h b/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin1/plugin1.h index 63e3825566..b28470e5df 100644 --- a/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin1/plugin1.h +++ b/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin1/plugin1.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin2/plugin2.cpp b/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin2/plugin2.cpp index 204bf391d3..f177ff2fa5 100644 --- a/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin2/plugin2.cpp +++ b/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin2/plugin2.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin2/plugin2.h b/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin2/plugin2.h index 21819e498d..421a35e769 100644 --- a/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin2/plugin2.h +++ b/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin2/plugin2.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin3/plugin3.cpp b/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin3/plugin3.cpp index f385aae4d4..00138f33a5 100644 --- a/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin3/plugin3.cpp +++ b/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin3/plugin3.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin3/plugin3.h b/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin3/plugin3.h index a323129bd2..500d38b61b 100644 --- a/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin3/plugin3.h +++ b/src/libs/extensionsystem/test/manual/pluginview/plugins/plugin3/plugin3.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/libs/libs.pro b/src/libs/libs.pro index 3e34c766e5..f33e687774 100644 --- a/src/libs/libs.pro +++ b/src/libs/libs.pro @@ -16,11 +16,6 @@ SUBDIRS = \ qmleditorwidgets \ symbianutils - -!win32 { - SUBDIRS += valgrind -} - # Windows: Compile Qt Creator CDB extension if Debugging tools can be detected. win32 { include(qtcreatorcdbext/cdb_detect.pri) diff --git a/src/libs/qmljs/qmljstypedescriptionreader.cpp b/src/libs/qmljs/qmljstypedescriptionreader.cpp index c95dc74101..d3f392c71b 100644 --- a/src/libs/qmljs/qmljstypedescriptionreader.cpp +++ b/src/libs/qmljs/qmljstypedescriptionreader.cpp @@ -120,7 +120,7 @@ void TypeDescriptionReader::readDocument(UiProgram *ast) versionString.mid(dotIdx + 1).toInt()); } if (version > ComponentVersion(1, 1)) { - addError(import->versionToken, "Expected version 1.1 or higher"); + addError(import->versionToken, "Expected version 1.1 or lower"); return; } diff --git a/src/libs/qtconcurrent/QtConcurrentTools b/src/libs/qtconcurrent/QtConcurrentTools index 96cda38316..ca634a4bce 100644 --- a/src/libs/qtconcurrent/QtConcurrentTools +++ b/src/libs/qtconcurrent/QtConcurrentTools @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/libs/qtcreatorcdbext/qtcreatorcdbext.pro b/src/libs/qtcreatorcdbext/qtcreatorcdbext.pro index c8dfa333ae..f9da7617b6 100644 --- a/src/libs/qtcreatorcdbext/qtcreatorcdbext.pro +++ b/src/libs/qtcreatorcdbext/qtcreatorcdbext.pro @@ -22,12 +22,18 @@ DEF_FILE=$$PWD/qtcreatorcdbext.def IDE_BASE_PATH=$$dirname(IDE_APP_PATH) -# Find out 64/32bit and determine target directories accordingly. -# TODO: This is an ugly hack. Better check compiler (stderr) or something? -ENV_LIB_PATH=$$(LIBPATH) - - -contains(ENV_LIB_PATH, ^.*amd64.*$) { +# Find out whether we are _building_ 64/32bit and determine target +# directories accordingly. +# +# Newer MSVC versions set CPU, olders do not, so use hacky check on +# LIBPATH if CPU is not available +ENV_CPU=$$(CPU) +ENV_LIBPATH=$$(LIBPATH) + +contains(ENV_CPU, ^AMD64$) { + DESTDIR=$$IDE_BASE_PATH/lib/$${BASENAME}64 + CDB_PLATFORM=amd64 +} else:isEmpty(ENV_CPU):contains(ENV_LIBPATH, ^.*amd64.*$) { DESTDIR=$$IDE_BASE_PATH/lib/$${BASENAME}64 CDB_PLATFORM=amd64 } else { diff --git a/src/libs/utils/detailsbutton.cpp b/src/libs/utils/detailsbutton.cpp index ef38d9b409..5aa4ef91fc 100644 --- a/src/libs/utils/detailsbutton.cpp +++ b/src/libs/utils/detailsbutton.cpp @@ -80,10 +80,11 @@ DetailsButton::DetailsButton(QWidget *parent) : QAbstractButton(parent), m_fader QSize DetailsButton::sizeHint() const { // TODO: Adjust this when icons become available! + const int w = fontMetrics().width(text()) + 32; #ifdef Q_WS_MAC - return QSize(80, 34); + return QSize(w, 34); #else - return QSize(80, 22); + return QSize(w, 22); #endif } @@ -171,6 +172,7 @@ QPixmap DetailsButton::cacheRendering(const QSize &size, bool checked) QRect textRect = p.fontMetrics().boundingRect(text()); textRect.setWidth(textRect.width() + 15); + textRect.setHeight(textRect.height() + 4); textRect.moveCenter(rect().center()); p.drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, text()); diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp index 871e5ebb52..b4eb010a4a 100644 --- a/src/libs/utils/fileutils.cpp +++ b/src/libs/utils/fileutils.cpp @@ -38,12 +38,152 @@ #include <QtCore/QDir> #include <QtCore/QFileInfo> #include <QtCore/QTemporaryFile> +#include <QtCore/QDateTime> #include <QtCore/QDataStream> #include <QtCore/QTextStream> #include <QtGui/QMessageBox> namespace Utils { +/*! \class Utils::FileUtils + + \brief File- and directory-related convenience functions. + + File- and directory-related convenience functions. +*/ + +/*! + \fn Utils::FileUtils::removeRecursively(const QString &filePath, QString *error) + + Removes the directory \a filePath and its subdirectories recursively. + + \note The \a error parameter is optional. + + \return Whether the operation succeeded. +*/ + +/*! + \fn Utils::FileUtils::copyRecursively(const QString &srcFilePath, const QString &tgtFilePath, QString *error) + + Copies the directory specified by \a srcFilePath recursively to \a tgtFilePath. \a tgtFilePath will contain + the target directory, which will be created. Example usage: + + \code + QString error; + book ok = Utils::FileUtils::copyRecursively("/foo/bar", "/foo/baz", &error); + if (!ok) + qDebug() << error; + \endcode + + This will copy the contents of /foo/bar into to the baz directory under /foo, which will be created in the process. + + \note The \a error parameter is optional. + + \return Whether the operation succeeded. +*/ + +/*! + \fn Utils::FileUtils::isFileNewerThan(const QString &filePath, const QDateTime &timeStamp) + + If \a filePath is a directory, the function will recursively check all files and return + true if one of them is newer than \a timeStamp. If \a filePath is a single file, true will + be returned if the file is newer than \timeStamp. + + \return Whether at least one file in \a filePath has a newer date than \a timeStamp. +*/ + +bool FileUtils::removeRecursively(const QString &filePath, QString *error) +{ + QFileInfo fileInfo(filePath); + if (!fileInfo.exists()) + return true; + QFile::setPermissions(filePath, fileInfo.permissions() | QFile::WriteUser); + if (fileInfo.isDir()) { + QDir dir(filePath); + QStringList fileNames = dir.entryList(QDir::Files | QDir::Hidden + | QDir::System | QDir::Dirs | QDir::NoDotAndDotDot); + foreach (const QString &fileName, fileNames) { + if (!removeRecursively(filePath + QLatin1Char('/') + fileName, error)) + return false; + } + dir.cdUp(); + if (!dir.rmdir(fileInfo.fileName())) { + if (error) { + *error = QCoreApplication::translate("Utils::FileUtils", "Failed to remove directory '%1'.") + .arg(QDir::toNativeSeparators(filePath)); + } + return false; + } + } else { + if (!QFile::remove(filePath)) { + if (error) { + *error = QCoreApplication::translate("Utils::FileUtils", "Failed to remove file '%1'.") + .arg(QDir::toNativeSeparators(filePath)); + } + return false; + } + } + return true; +} + +bool FileUtils::copyRecursively(const QString &srcFilePath, + const QString &tgtFilePath, QString *error) +{ + QFileInfo srcFileInfo(srcFilePath); + if (srcFileInfo.isDir()) { + QDir targetDir(tgtFilePath); + targetDir.cdUp(); + if (!targetDir.mkdir(QFileInfo(tgtFilePath).fileName())) { + if (error) { + *error = QCoreApplication::translate("Utils::FileUtils", "Failed to create directory '%1'.") + .arg(QDir::toNativeSeparators(tgtFilePath)); + return false; + } + } + QDir sourceDir(srcFilePath); + QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System); + foreach (const QString &fileName, fileNames) { + const QString newSrcFilePath + = srcFilePath + QLatin1Char('/') + fileName; + const QString newTgtFilePath + = tgtFilePath + QLatin1Char('/') + fileName; + if (!copyRecursively(newSrcFilePath, newTgtFilePath, error)) + return false; + } + } else { + if (!QFile::copy(srcFilePath, tgtFilePath)) { + if (error) { + *error = QCoreApplication::translate("Utils::FileUtils", "Could not copy file '%1' to '%2'.") + .arg(QDir::toNativeSeparators(srcFilePath), + QDir::toNativeSeparators(tgtFilePath)); + } + return false; + } + } + return true; +} + +bool FileUtils::isFileNewerThan(const QString &filePath, + const QDateTime &timeStamp) +{ + QFileInfo fileInfo(filePath); + if (!fileInfo.exists() || fileInfo.lastModified() >= timeStamp) + return true; + if (fileInfo.isDir()) { + const QStringList dirContents = QDir(filePath) + .entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot); + foreach (const QString &curFileName, dirContents) { + const QString curFilePath + = filePath + QLatin1Char('/') + curFileName; + if (isFileNewerThan(curFilePath, timeStamp)) + return true; + } + } + return false; +} + + + QByteArray FileReader::fetchQrc(const QString &fileName) { QTC_ASSERT(fileName.startsWith(QLatin1Char(':')), return QByteArray()) diff --git a/src/libs/utils/fileutils.h b/src/libs/utils/fileutils.h index 21f5eee3f2..d6b4e57ef2 100644 --- a/src/libs/utils/fileutils.h +++ b/src/libs/utils/fileutils.h @@ -45,10 +45,20 @@ class QTemporaryFile; class QWidget; class QTextStream; class QDataStream; +class QDateTime; QT_END_NAMESPACE namespace Utils { +class QTCREATOR_UTILS_EXPORT FileUtils { +public: + static bool removeRecursively(const QString &filePath, QString *error = 0); + static bool copyRecursively(const QString &srcFilePath, + const QString &tgtFilePath, QString *error = 0); + static bool isFileNewerThan(const QString &filePath, + const QDateTime &timeStamp); +}; + class QTCREATOR_UTILS_EXPORT FileReader { Q_DECLARE_TR_FUNCTIONS(Utils::FileUtils) // sic! diff --git a/src/libs/utils/iwelcomepage.h b/src/libs/utils/iwelcomepage.h index d2dd6129a1..4363beb78e 100644 --- a/src/libs/utils/iwelcomepage.h +++ b/src/libs/utils/iwelcomepage.h @@ -36,6 +36,7 @@ #include <QtCore/QObject> #include <QtCore/QMetaType> +#include <QtCore/QUrl> #include "utils_global.h" @@ -52,14 +53,14 @@ class QTCREATOR_UTILS_EXPORT IWelcomePage : public QObject Q_OBJECT Q_PROPERTY(QString title READ title CONSTANT) - Q_PROPERTY(QString pageLocation READ pageLocation CONSTANT) + Q_PROPERTY(QUrl pageLocation READ pageLocation CONSTANT) Q_PROPERTY(int priority READ priority CONSTANT) public: IWelcomePage(); virtual ~IWelcomePage(); - virtual QString pageLocation() const = 0; + virtual QUrl pageLocation() const = 0; virtual QString title() const = 0; virtual int priority() const { return 0; } virtual void facilitateQml(QDeclarativeEngine *) {} diff --git a/src/libs/utils/qtcprocess.cpp b/src/libs/utils/qtcprocess.cpp index e730fd98cf..6c54a9cb00 100644 --- a/src/libs/utils/qtcprocess.cpp +++ b/src/libs/utils/qtcprocess.cpp @@ -568,7 +568,10 @@ QString QtcProcess::quoteArg(const QString &arg) // The argument must not end with a \ since this would be interpreted // as escaping the quote -- rather put the \ behind the quote: e.g. // rather use "foo"\ than "foo\" - ret.replace(QRegExp(QLatin1String("(\\\\*)$")), QLatin1String("\"\\1")); + int i = ret.length(); + while (i > 0 && ret.at(i - 1) == QLatin1Char('\\')) + --i; + ret.insert(i, QLatin1Char('"')); ret.prepend(QLatin1Char('"')); } // FIXME: Without this, quoting is not foolproof. But it needs support in the process setup, etc. diff --git a/src/libs/utils/settingsutils.h b/src/libs/utils/settingsutils.h index 6c0f494af5..fb0d8271ab 100644 --- a/src/libs/utils/settingsutils.h +++ b/src/libs/utils/settingsutils.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/libs/utils/ssh/sshconnection.cpp b/src/libs/utils/ssh/sshconnection.cpp index 6a712817ed..5ff083e6d2 100644 --- a/src/libs/utils/ssh/sshconnection.cpp +++ b/src/libs/utils/ssh/sshconnection.cpp @@ -48,6 +48,7 @@ #include <QtCore/QFile> #include <QtCore/QMutex> +#include <QtCore/QMutexLocker> #include <QtNetwork/QNetworkProxy> #include <QtNetwork/QTcpSocket> @@ -70,15 +71,12 @@ namespace { void doStaticInitializationsIfNecessary() { + QMutexLocker locker(&staticInitMutex); if (!staticInitializationsDone) { - staticInitMutex.lock(); - if (!staticInitializationsDone) { - Botan::LibraryInitializer::initialize("thread_safe=true"); - qRegisterMetaType<Utils::SshError>("Utils::SshError"); - qRegisterMetaType<Utils::SftpJobId>("Utils::SftpJobId"); - staticInitializationsDone = true; - } - staticInitMutex.unlock(); + Botan::LibraryInitializer::initialize("thread_safe=true"); + qRegisterMetaType<Utils::SshError>("Utils::SshError"); + qRegisterMetaType<Utils::SftpJobId>("Utils::SftpJobId"); + staticInitializationsDone = true; } } } // anonymous namespace @@ -620,6 +618,8 @@ void SshConnectionPrivate::sendKeepAlivePacket() void SshConnectionPrivate::connectToHost() { + QTC_ASSERT(m_state == SocketUnconnected, return); + m_incomingData.clear(); m_incomingPacket.reset(); m_sendFacility.reset(); diff --git a/src/libs/utils/ssh/sshremoteprocessrunner.cpp b/src/libs/utils/ssh/sshremoteprocessrunner.cpp index 0d5fa24e93..6a751cc37e 100644 --- a/src/libs/utils/ssh/sshremoteprocessrunner.cpp +++ b/src/libs/utils/ssh/sshremoteprocessrunner.cpp @@ -145,7 +145,8 @@ void SshRemoteProcessRunnerPrivate::run(const QByteArray &command) } else { connect(m_connection.data(), SIGNAL(connected()), SLOT(handleConnected())); - m_connection->connectToHost(); + if (m_connection->state() == SshConnection::Unconnected) + m_connection->connectToHost(); } } diff --git a/src/libs/valgrind/valgrind.pri b/src/libs/valgrind/valgrind.pri deleted file mode 100644 index 7647eeacb0..0000000000 --- a/src/libs/valgrind/valgrind.pri +++ /dev/null @@ -1 +0,0 @@ -LIBS *= -l$$qtLibraryName(Valgrind) diff --git a/src/libs/valgrind/valgrind.pro b/src/libs/valgrind/valgrind.pro deleted file mode 100644 index b670b92bff..0000000000 --- a/src/libs/valgrind/valgrind.pro +++ /dev/null @@ -1,71 +0,0 @@ -TEMPLATE = lib -TARGET = Valgrind - -include(../../qtcreatorlibrary.pri) -include(../utils/utils.pri) - -TEMPLATE = lib - -DEFINES += VALGRIND_LIBRARY - -QT += network - -HEADERS += valgrind_global.h \ - xmlprotocol/frame.h \ - xmlprotocol/parser.h \ - xmlprotocol/error.h \ - xmlprotocol/status.h \ - xmlprotocol/suppression.h \ - xmlprotocol/threadedparser.h \ - xmlprotocol/announcethread.h \ - xmlprotocol/stack.h \ - xmlprotocol/errorlistmodel.h \ - xmlprotocol/stackmodel.h \ - xmlprotocol/modelhelpers.h \ - callgrind/callgrindparser.h \ - callgrind/callgrindparsedata.h \ - callgrind/callgrindfunction.h \ - callgrind/callgrindfunction_p.h \ - callgrind/callgrindfunctioncycle.h \ - callgrind/callgrindfunctioncall.h \ - callgrind/callgrindcostitem.h \ - callgrind/callgrinddatamodel.h \ - callgrind/callgrindabstractmodel.h \ - callgrind/callgrindcallmodel.h \ - callgrind/callgrindcontroller.h \ - callgrind/callgrindcycledetection.h \ - callgrind/callgrindproxymodel.h \ - callgrind/callgrindstackbrowser.h \ - callgrind/callgrindrunner.h \ - memcheck/memcheckrunner.h \ - valgrindrunner.h \ - valgrindprocess.h - -SOURCES += xmlprotocol/error.cpp \ - xmlprotocol/frame.cpp \ - xmlprotocol/parser.cpp \ - xmlprotocol/status.cpp \ - xmlprotocol/suppression.cpp \ - xmlprotocol/threadedparser.cpp \ - xmlprotocol/announcethread.cpp \ - xmlprotocol/stack.cpp \ - xmlprotocol/errorlistmodel.cpp \ - xmlprotocol/stackmodel.cpp \ - xmlprotocol/modelhelpers.cpp \ - callgrind/callgrindparser.cpp \ - callgrind/callgrindparsedata.cpp \ - callgrind/callgrindfunction.cpp \ - callgrind/callgrindfunctioncycle.cpp \ - callgrind/callgrindfunctioncall.cpp \ - callgrind/callgrindcostitem.cpp \ - callgrind/callgrindabstractmodel.cpp \ - callgrind/callgrinddatamodel.cpp \ - callgrind/callgrindcallmodel.cpp \ - callgrind/callgrindcontroller.cpp \ - callgrind/callgrindcycledetection.cpp \ - callgrind/callgrindproxymodel.cpp \ - callgrind/callgrindrunner.cpp \ - callgrind/callgrindstackbrowser.cpp \ - memcheck/memcheckrunner.cpp \ - valgrindrunner.cpp \ - valgrindprocess.cpp diff --git a/src/plugins/analyzerbase/analyzerbase.pro b/src/plugins/analyzerbase/analyzerbase.pro index ad33056b15..e42ee34fa8 100644 --- a/src/plugins/analyzerbase/analyzerbase.pro +++ b/src/plugins/analyzerbase/analyzerbase.pro @@ -15,7 +15,6 @@ SOURCES += \ ianalyzertool.cpp \ analyzerplugin.cpp \ analyzerruncontrol.cpp \ - analyzerruncontrolfactory.cpp \ analyzermanager.cpp \ analyzersettings.cpp \ analyzeroptionspage.cpp \ @@ -30,7 +29,6 @@ HEADERS += \ analyzerconstants.h \ analyzerplugin.h \ analyzerruncontrol.h \ - analyzerruncontrolfactory.h \ analyzermanager.h \ analyzersettings.h \ analyzerstartparameters.h \ diff --git a/src/plugins/analyzerbase/analyzerconstants.h b/src/plugins/analyzerbase/analyzerconstants.h index 883f77b9cf..23f15e7b80 100644 --- a/src/plugins/analyzerbase/analyzerconstants.h +++ b/src/plugins/analyzerbase/analyzerconstants.h @@ -39,16 +39,22 @@ namespace Analyzer { -enum AnalyzerStartMode +// Special values for currently used modes. +// Their meaning is interpreted by the individual tools. +// FIXME: The plan is to remove this entirely from the +// public interface and let the tools handle that internally. + +enum StartMode { - StartLocal, - StartRemote + StartLocal = -1, + StartRemote = -2, + StartQml = -3 }; namespace Constants { // modes and their priorities -const char * const MODE_ANALYZE = "Analyzer.Mode.Analyze"; +const char * const MODE_ANALYZE = "Mode.Analyze"; const int P_MODE_ANALYZE = 76; // context @@ -61,6 +67,10 @@ const char * const START = "Analyzer.Start"; const char * const STARTREMOTE = "Analyzer.StartRemote"; const char * const STOP = "Analyzer.Stop"; +const char * const G_ANALYZER_CONTROL = "Menu.Group.Analyzer.Control"; +const char * const G_ANALYZER_TOOLS = "Menu.Group.Analyzer.Tools"; +const char * const G_ANALYZER_REMOTE_TOOLS = "Menu.Group.Analyzer.RemoteTools"; + // options dialog const char * const ANALYZER_SETTINGS_CATEGORY = "T.Analyzer"; const char * const ANALYZER_SETTINGS_TR_CATEGORY = @@ -76,9 +86,6 @@ const char * const ANALYZER_CONTROL_STOP_ICON = const char * const ANALYZERTASK_ID = "Analyzer.TaskId"; -// private -const char * const ANALYZER_DUMMYWIDGET_ID = "Analyzer.DummyWidget"; - } // namespace Constants } // namespace Analyzer diff --git a/src/plugins/analyzerbase/analyzermanager.cpp b/src/plugins/analyzerbase/analyzermanager.cpp index 8553afab86..cdf4e5d167 100644 --- a/src/plugins/analyzerbase/analyzermanager.cpp +++ b/src/plugins/analyzerbase/analyzermanager.cpp @@ -37,12 +37,10 @@ #include "analyzerconstants.h" #include "analyzerplugin.h" #include "analyzerruncontrol.h" -#include "analyzerruncontrolfactory.h" #include "analyzeroptionspage.h" #include "analyzerstartparameters.h" #include "analyzerutils.h" #include "ianalyzertool.h" -#include "startremotedialog.h" #include <coreplugin/coreconstants.h> #include <coreplugin/findplaceholder.h> @@ -76,8 +74,6 @@ #include <utils/statuslabel.h> #include <utils/ssh/sshconnection.h> -#include <cmakeprojectmanager/cmakeprojectconstants.h> - #include <QtCore/QVariant> #include <QtCore/QDebug> #include <QtGui/QHBoxLayout> @@ -98,18 +94,20 @@ #include <QtGui/QPushButton> using namespace Core; -using namespace Analyzer; using namespace Analyzer::Internal; +using namespace ProjectExplorer; namespace Analyzer { namespace Internal { -const char lastActiveToolC[] = "Analyzer.Plugin.LastActiveTool"; -const char G_ANALYZER_TOOLS[] = "Menu.Group.Analyzer.Tools"; -const char G_ANALYZER_REMOTE_TOOLS[] = "Menu.Group.Analyzer.RemoteTools"; +const char LAST_ACTIVE_TOOL[] = "Analyzer.Plugin.LastActiveTool"; const char INITIAL_DOCK_AREA[] = "initial_dock_area"; -// AnalyzerMode //////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////// +// +// AnalyzerMode +// +//////////////////////////////////////////////////////////////////// class AnalyzerMode : public Core::IMode { @@ -142,7 +140,6 @@ public: }; } // namespace Internal -} // namespace Analyzer //////////////////////////////////////////////////////////////////// // @@ -150,7 +147,7 @@ public: // //////////////////////////////////////////////////////////////////// -class AnalyzerManager::AnalyzerManagerPrivate : public QObject +class AnalyzerManagerPrivate : public QObject { Q_OBJECT @@ -169,60 +166,52 @@ public: void delayedInit(); void setupActions(); - QWidget *createModeContents(); - QWidget *createModeMainWindow(); + void createModeMainWindow(); bool showPromptDialog(const QString &title, const QString &text, const QString &stopButtonText, const QString &cancelButtonText) const; - void addDock(Qt::DockWidgetArea area, QDockWidget *dockWidget); - void startAction(int tool); - void addTool(IAnalyzerTool *tool); - void addToolAction(IAnalyzerTool *tool, bool local); - int indexOf(IAnalyzerTool *tool) const; - int indexOf(QAction *action) const; - IAnalyzerTool *toolAt(int idx) const; + void activateDock(Qt::DockWidgetArea area, QDockWidget *dockWidget); + void deactivateDock(QDockWidget *dockWidget); + void addTool(IAnalyzerTool *tool, const StartModes &modes); + void selectSavedTool(); + void selectTool(IAnalyzerTool *tool, StartMode mode); + void handleToolStarted(); + void handleToolFinished(); + void saveToolSettings(IAnalyzerTool *tool, StartMode mode); + void loadToolSettings(IAnalyzerTool *tool); + QAction *actionFromToolAndMode(IAnalyzerTool *tool, StartMode mode); + + // Convenience. + void startLocalTool(IAnalyzerTool *tool, StartMode mode); public slots: - void startAction() { startAction(m_currentIndex); } - void startToolRemote(); - void stopTool(); - - void handleToolFinished(); - void selectAction(); - void selectAction(int); - void selectAction(QAction *); + void startTool(); + void selectToolboxAction(int); + void selectMenuAction(); void modeChanged(Core::IMode *mode); - void runControlCreated(Analyzer::AnalyzerRunControl *); void resetLayout(); - void saveToolSettings(Analyzer::IAnalyzerTool *tool); - void loadToolSettings(Analyzer::IAnalyzerTool *tool); void updateRunActions(); - void registerRunControlFactory(ProjectExplorer::IRunControlFactory *factory); public: - struct ToolData { - IAnalyzerTool *tool; - QAction *action; - bool local; - }; - AnalyzerManager *q; AnalyzerMode *m_mode; - AnalyzerRunControlFactory *m_runControlFactory; - ProjectExplorer::RunControl *m_currentRunControl; + bool m_isRunning; Utils::FancyMainWindow *m_mainWindow; - int m_currentIndex; - QList<ToolData> m_actions; + IAnalyzerTool *m_currentTool; + StartMode m_currentMode; + QHash<QAction *, IAnalyzerTool *> m_toolFromAction; + QHash<QAction *, StartMode> m_modeFromAction; QList<IAnalyzerTool *> m_tools; + QList<QAction *> m_actions; QAction *m_startAction; QAction *m_stopAction; ActionContainer *m_menu; QComboBox *m_toolBox; - QStackedWidget *m_controlsWidget; - ActionContainer *m_viewsMenu; + QStackedWidget *m_controlsStackWidget; Utils::StatusLabel *m_statusLabel; typedef QMap<IAnalyzerTool *, FancyMainWindowSettings> MainWindowSettingsMap; - QMap<IAnalyzerTool *, QList<QDockWidget *> > m_toolWidgets; + QHash<IAnalyzerTool *, QList<QDockWidget *> > m_toolWidgets; + QHash<IAnalyzerTool *, QWidget *> m_controlsWidgetFromTool; MainWindowSettingsMap m_defaultSettings; // list of dock widgets to prevent memory leak @@ -230,42 +219,35 @@ public: QList<DockPtr> m_dockWidgets; bool m_restartOnStop; - bool m_initialized; }; -AnalyzerManager::AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager *qq): +AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager *qq): q(qq), m_mode(0), - m_runControlFactory(0), - m_currentRunControl(0), + m_isRunning(false), m_mainWindow(0), - m_currentIndex(-1), + m_currentTool(0), + m_currentMode(), m_startAction(0), m_stopAction(0), m_menu(0), m_toolBox(new QComboBox), - m_controlsWidget(new QStackedWidget), - m_viewsMenu(0), + m_controlsStackWidget(new QStackedWidget), m_statusLabel(new Utils::StatusLabel), - m_restartOnStop(false), - m_initialized(false) + m_restartOnStop(false) { m_toolBox->setObjectName(QLatin1String("AnalyzerManagerToolBox")); - connect(m_toolBox, SIGNAL(currentIndexChanged(int)), SLOT(selectAction(int))); - - m_runControlFactory = new AnalyzerRunControlFactory(); - registerRunControlFactory(m_runControlFactory); + connect(m_toolBox, SIGNAL(activated(int)), SLOT(selectToolboxAction(int))); setupActions(); connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)), this, SLOT(modeChanged(Core::IMode*))); - ProjectExplorer::ProjectExplorerPlugin *pe = - ProjectExplorer::ProjectExplorerPlugin::instance(); + ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance(); connect(pe, SIGNAL(updateRunActions()), SLOT(updateRunActions())); } -AnalyzerManager::AnalyzerManagerPrivate::~AnalyzerManagerPrivate() +AnalyzerManagerPrivate::~AnalyzerManagerPrivate() { // as we have to setParent(0) on dock widget that are not selected, // we keep track of all and make sure we don't leak any @@ -275,15 +257,7 @@ AnalyzerManager::AnalyzerManagerPrivate::~AnalyzerManagerPrivate() } } -void AnalyzerManager::AnalyzerManagerPrivate::registerRunControlFactory - (ProjectExplorer::IRunControlFactory *factory) -{ - AnalyzerPlugin::instance()->addAutoReleasedObject(factory); - connect(factory, SIGNAL(runControlCreated(Analyzer::AnalyzerRunControl*)), - this, SLOT(runControlCreated(Analyzer::AnalyzerRunControl*))); -} - -void AnalyzerManager::AnalyzerManagerPrivate::setupActions() +void AnalyzerManagerPrivate::setupActions() { Core::ICore *core = Core::ICore::instance(); Core::ActionManager *am = core->actionManager(); @@ -295,8 +269,9 @@ void AnalyzerManager::AnalyzerManagerPrivate::setupActions() m_menu->menu()->setTitle(tr("&Analyze")); m_menu->menu()->setEnabled(true); - m_menu->appendGroup(G_ANALYZER_TOOLS); - m_menu->appendGroup(G_ANALYZER_REMOTE_TOOLS); + m_menu->appendGroup(Constants::G_ANALYZER_CONTROL); + m_menu->appendGroup(Constants::G_ANALYZER_TOOLS); + m_menu->appendGroup(Constants::G_ANALYZER_REMOTE_TOOLS); Core::ActionContainer *menubar = am->actionContainer(Core::Constants::MENU_BAR); @@ -307,52 +282,52 @@ void AnalyzerManager::AnalyzerManagerPrivate::setupActions() m_startAction = new QAction(tr("Start"), m_menu); m_startAction->setIcon(QIcon(Constants::ANALYZER_CONTROL_START_ICON)); command = am->registerAction(m_startAction, Constants::START, globalcontext); - connect(m_startAction, SIGNAL(triggered()), this, SLOT(startAction())); + connect(m_startAction, SIGNAL(triggered()), this, SLOT(startTool())); m_stopAction = new QAction(tr("Stop"), m_menu); m_stopAction->setEnabled(false); m_stopAction->setIcon(QIcon(Constants::ANALYZER_CONTROL_STOP_ICON)); command = am->registerAction(m_stopAction, Constants::STOP, globalcontext); - connect(m_stopAction, SIGNAL(triggered()), this, SLOT(stopTool())); + m_menu->addAction(command, Constants::G_ANALYZER_CONTROL); - QAction *separatorAction = new QAction(m_menu); - separatorAction->setSeparator(true); - command = am->registerAction(separatorAction, - "Menu.Action.Analyzer.Tools.Separator", globalcontext); - m_menu->addAction(command, G_ANALYZER_REMOTE_TOOLS); + QAction *separatorAction1 = new QAction(m_menu); + separatorAction1->setSeparator(true); + command = am->registerAction(separatorAction1, + "Menu.Action.Analyzer.Tools.Separator1", globalcontext); + m_menu->addAction(command, Constants::G_ANALYZER_TOOLS); - m_viewsMenu = am->actionContainer(Core::Id(Core::Constants::M_WINDOW_VIEWS)); + QAction *separatorAction2 = new QAction(m_menu); + separatorAction2->setSeparator(true); + command = am->registerAction(separatorAction2, + "Menu.Action.Analyzer.Tools.Separator2", globalcontext); + m_menu->addAction(command, Constants::G_ANALYZER_REMOTE_TOOLS); } -void AnalyzerManager::AnalyzerManagerPrivate::delayedInit() +void AnalyzerManagerPrivate::delayedInit() { - if (m_initialized) + if (m_mode) return; m_mode = new AnalyzerMode(q); - m_mode->setWidget(createModeContents()); - AnalyzerPlugin::instance()->addAutoReleasedObject(m_mode); - - m_initialized = true; -} + createModeMainWindow(); -QWidget *AnalyzerManager::AnalyzerManagerPrivate::createModeContents() -{ - // right-side window with editor, output etc. + // Right-side window with editor, output etc. MiniSplitter *mainWindowSplitter = new MiniSplitter; - mainWindowSplitter->addWidget(createModeMainWindow()); + mainWindowSplitter->addWidget(m_mainWindow); mainWindowSplitter->addWidget(new OutputPanePlaceHolder(m_mode, mainWindowSplitter)); mainWindowSplitter->setStretchFactor(0, 10); mainWindowSplitter->setStretchFactor(1, 0); mainWindowSplitter->setOrientation(Qt::Vertical); - // navigation + right-side window + // Navigation + right-side window. MiniSplitter *splitter = new MiniSplitter; splitter->addWidget(new NavigationWidgetPlaceHolder(m_mode)); splitter->addWidget(mainWindowSplitter); splitter->setStretchFactor(0, 0); splitter->setStretchFactor(1, 1); - return splitter; + m_mode->setWidget(splitter); + + AnalyzerPlugin::instance()->addAutoReleasedObject(m_mode); } static QToolButton *toolButton(QAction *action) @@ -362,14 +337,13 @@ static QToolButton *toolButton(QAction *action) return button; } -QWidget *AnalyzerManager::AnalyzerManagerPrivate::createModeMainWindow() +void AnalyzerManagerPrivate::createModeMainWindow() { m_mainWindow = new Utils::FancyMainWindow(); m_mainWindow->setObjectName(QLatin1String("AnalyzerManagerMainWindow")); m_mainWindow->setDocumentMode(true); m_mainWindow->setDockNestingEnabled(true); - m_mainWindow->setDockActionsVisible(ModeManager::instance()->currentMode()->id() == - Constants::MODE_ANALYZE); + m_mainWindow->setDockActionsVisible(false); connect(m_mainWindow, SIGNAL(resetLayout()), SLOT(resetLayout())); QBoxLayout *editorHolderLayout = new QVBoxLayout; @@ -396,7 +370,7 @@ QWidget *AnalyzerManager::AnalyzerManagerPrivate::createModeMainWindow() analyzeToolBarLayout->addWidget(toolButton(m_stopAction)); analyzeToolBarLayout->addWidget(new Utils::StyledSeparator); analyzeToolBarLayout->addWidget(m_toolBox); - analyzeToolBarLayout->addWidget(m_controlsWidget); + analyzeToolBarLayout->addWidget(m_controlsStackWidget); analyzeToolBarLayout->addWidget(m_statusLabel); analyzeToolBarLayout->addStretch(); @@ -421,12 +395,9 @@ QWidget *AnalyzerManager::AnalyzerManagerPrivate::createModeMainWindow() centralLayout->addWidget(documentAndRightPane); centralLayout->setStretch(0, 1); centralLayout->setStretch(1, 0); - - return m_mainWindow; } -void AnalyzerManager::AnalyzerManagerPrivate::addDock(Qt::DockWidgetArea area, - QDockWidget *dockWidget) +void AnalyzerManagerPrivate::activateDock(Qt::DockWidgetArea area, QDockWidget *dockWidget) { dockWidget->setParent(m_mainWindow); m_mainWindow->addDockWidget(area, dockWidget); @@ -436,32 +407,44 @@ void AnalyzerManager::AnalyzerManagerPrivate::addDock(Qt::DockWidgetArea area, ActionManager *am = ICore::instance()->actionManager(); QAction *toggleViewAction = dockWidget->toggleViewAction(); toggleViewAction->setText(dockWidget->windowTitle()); - Command *cmd = am->registerAction(toggleViewAction, QString("Analyzer." + dockWidget->objectName()), - globalContext); + Command *cmd = am->registerAction(toggleViewAction, + QString("Analyzer." + dockWidget->objectName()), globalContext); cmd->setAttribute(Command::CA_Hide); - m_viewsMenu->addAction(cmd); + + ActionContainer *viewsMenu = + am->actionContainer(Core::Id(Core::Constants::M_WINDOW_VIEWS)); + viewsMenu->addAction(cmd); +} + +void AnalyzerManagerPrivate::deactivateDock(QDockWidget *dockWidget) +{ + ActionManager *am = ICore::instance()->actionManager(); + QAction *toggleViewAction = dockWidget->toggleViewAction(); + am->unregisterAction(toggleViewAction, QString("Analyzer." + dockWidget->objectName())); + m_mainWindow->removeDockWidget(dockWidget); + dockWidget->hide(); + // Prevent saveState storing the data of the wrong children. + dockWidget->setParent(0); } bool buildTypeAccepted(IAnalyzerTool::ToolMode toolMode, - ProjectExplorer::BuildConfiguration::BuildType buildType) + BuildConfiguration::BuildType buildType) { if (toolMode == IAnalyzerTool::AnyMode) return true; - if (buildType == ProjectExplorer::BuildConfiguration::Unknown) + if (buildType == BuildConfiguration::Unknown) return true; - if (buildType == ProjectExplorer::BuildConfiguration::Debug + if (buildType == BuildConfiguration::Debug && toolMode == IAnalyzerTool::DebugMode) return true; - if (buildType == ProjectExplorer::BuildConfiguration::Release + if (buildType == BuildConfiguration::Release && toolMode == IAnalyzerTool::ReleaseMode) return true; return false; } -bool AnalyzerManager::AnalyzerManagerPrivate::showPromptDialog(const QString &title, - const QString &text, - const QString &stopButtonText, - const QString &cancelButtonText) const +bool AnalyzerManagerPrivate::showPromptDialog(const QString &title, const QString &text, + const QString &stopButtonText, const QString &cancelButtonText) const { Utils::CheckableMessageBox messageBox(Core::ICore::instance()->mainWindow()); messageBox.setWindowTitle(title); @@ -477,52 +460,27 @@ bool AnalyzerManager::AnalyzerManagerPrivate::showPromptDialog(const QString &ti return messageBox.clickedStandardButton() == QDialogButtonBox::Yes; } -void AnalyzerManager::AnalyzerManagerPrivate::startToolRemote() -{ - StartRemoteDialog dlg; - if (dlg.exec() != QDialog::Accepted) - return; - - AnalyzerStartParameters sp; - sp.connParams = dlg.sshParams(); - sp.debuggee = dlg.executable(); - sp.debuggeeArgs = dlg.arguments(); - sp.displayName = dlg.executable(); - sp.startMode = StartRemote; - sp.workingDirectory = dlg.workingDirectory(); - - AnalyzerRunControl *runControl = m_runControlFactory->create(sp, 0); - - QTC_ASSERT(runControl, return); - ProjectExplorer::ProjectExplorerPlugin::instance() - ->startRunControl(runControl, Constants::MODE_ANALYZE); -} - -void AnalyzerManager::AnalyzerManagerPrivate::startAction(int index) +void AnalyzerManagerPrivate::startLocalTool(IAnalyzerTool *tool, StartMode) { + int index = m_tools.indexOf(tool); QTC_ASSERT(index >= 0, return); - QTC_ASSERT(index < m_actions.size(), return); - QTC_ASSERT(index == m_currentIndex, return); + QTC_ASSERT(index < m_tools.size(), return); + QTC_ASSERT(tool == m_currentTool, return); - if (!m_actions.at(index).local) { - startToolRemote(); - return; - } - - // make sure mode is shown + // Make sure mode is shown. q->showMode(); - ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance(); + ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance(); // ### not sure if we're supposed to check if the RunConFiguration isEnabled - ProjectExplorer::Project *pro = pe->startupProject(); - const ProjectExplorer::RunConfiguration *runConfig = 0; - ProjectExplorer::BuildConfiguration::BuildType buildType = ProjectExplorer::BuildConfiguration::Unknown; + Project *pro = pe->startupProject(); + const RunConfiguration *runConfig = 0; + BuildConfiguration::BuildType buildType = BuildConfiguration::Unknown; if (pro) { - if (const ProjectExplorer::Target *target = pro->activeTarget()) { + if (const Target *target = pro->activeTarget()) { runConfig = target->activeRunConfiguration(); // Build configuration is 0 for QML projects. - if (const ProjectExplorer::BuildConfiguration *buildConfig = target->activeBuildConfiguration()) + if (const BuildConfiguration *buildConfig = target->activeBuildConfiguration()) buildType = buildConfig->buildType(); } } @@ -530,12 +488,12 @@ void AnalyzerManager::AnalyzerManagerPrivate::startAction(int index) return; // Check if there already is an analyzer run. - if (m_currentRunControl) { + if (m_isRunning) { // ask if user wants to restart the analyzer const QString msg = tr("<html><head/><body><center><i>%1</i> is still running. " "You have to quit the Analyzer before being able to run another instance." "<center/><center>Force it to quit?</center></body></html>") - .arg(m_currentRunControl->displayName()); + .arg(m_currentTool->displayName()); bool stopRequested = showPromptDialog(tr("Analyzer Still Running"), msg, tr("Stop Active Run"), tr("Keep Running")); if (!stopRequested) @@ -543,37 +501,47 @@ void AnalyzerManager::AnalyzerManagerPrivate::startAction(int index) // user selected to stop the active run. stop it, activate restart on stop m_restartOnStop = true; - stopTool(); + q->stopTool(); return; } - IAnalyzerTool *tool = toolAt(index); - IAnalyzerTool::ToolMode toolMode = tool->mode(); + IAnalyzerTool::ToolMode toolMode = tool->toolMode(); // Check the project for whether the build config is in the correct mode // if not, notify the user and urge him to use the correct mode. if (!buildTypeAccepted(toolMode, buildType)) { - const QString &toolName = tool->displayName(); - const QString &toolMode = IAnalyzerTool::modeString(tool->mode()); - const QString currentMode = buildType == ProjectExplorer::BuildConfiguration::Debug ? tr("Debug") : tr("Release"); + const QString toolName = tool->displayName(); + const QString currentMode = + buildType == BuildConfiguration::Debug ? tr("Debug") : tr("Release"); QSettings *settings = Core::ICore::instance()->settings(); - const QString configKey = QLatin1String(Constants::MODE_ANALYZE) + QLatin1Char('/') + QLatin1String("AnalyzeCorrectMode"); + const QString configKey = QLatin1String("Analyzer.AnalyzeCorrectMode"); int ret; if (settings->contains(configKey)) { ret = settings->value(configKey, QDialog::Accepted).toInt(); } else { + QString toolModeString; + switch (toolMode) { + case IAnalyzerTool::DebugMode: + toolModeString = tr("Debug"); + case IAnalyzerTool::ReleaseMode: + toolModeString = tr("Release"); + case IAnalyzerTool::AnyMode: + break; + } const QString title = tr("Run %1 in %2 Mode?").arg(toolName).arg(currentMode); - const QString message = tr("<html><head/><body><p>You are trying to run the tool '%1' on an application in %2 mode. " - "The tool is designed to be used in %3 mode.</p><p>" - "Do you want to continue and run it in %2 mode?</p></body></html>"). - arg(toolName).arg(currentMode).arg(toolMode); + const QString message = tr("<html><head/><body><p>You are trying " + "to run the tool \"%1\" on an application in %2 mode. " + "The tool is designed to be used in %3 mode.</p><p>" + "Do you want to continue and run it in %2 mode?</p></body></html>") + .arg(toolName).arg(currentMode).arg(toolModeString); const QString checkBoxText = tr("&Do not ask again"); bool checkBoxSetting = false; const QDialogButtonBox::StandardButton button = - Utils::CheckableMessageBox::question(Core::ICore::instance()->mainWindow(), title, message, checkBoxText, - &checkBoxSetting, QDialogButtonBox::Yes|QDialogButtonBox::Cancel, - QDialogButtonBox::Cancel); + Utils::CheckableMessageBox::question(Core::ICore::instance()->mainWindow(), + title, message, checkBoxText, + &checkBoxSetting, QDialogButtonBox::Yes|QDialogButtonBox::Cancel, + QDialogButtonBox::Cancel); ret = button == QDialogButtonBox::Yes ? QDialog::Accepted : QDialog::Rejected; if (checkBoxSetting && ret == QDialog::Accepted) @@ -583,173 +551,154 @@ void AnalyzerManager::AnalyzerManagerPrivate::startAction(int index) return; } - pe->runProject(pro, Constants::MODE_ANALYZE); - + m_isRunning = true; + pe->runProject(pro, tool->id()); updateRunActions(); } - -void AnalyzerManager::AnalyzerManagerPrivate::stopTool() +void AnalyzerManagerPrivate::startTool() { - if (m_currentRunControl) - return; - - // be sure to call handleToolFinished only once, and only when the engine is really finished - if (m_currentRunControl->stop() == ProjectExplorer::RunControl::StoppedSynchronously) - handleToolFinished(); - // else: wait for the finished() signal to trigger handleToolFinished() + m_currentTool->startTool(m_currentMode); } -void AnalyzerManager::AnalyzerManagerPrivate::modeChanged(IMode *mode) +void AnalyzerManagerPrivate::modeChanged(IMode *mode) { - if (!m_mainWindow) - return; - const bool makeVisible = mode->id() == Constants::MODE_ANALYZE; - if (!makeVisible) - return; - m_mainWindow->setDockActionsVisible(makeVisible); -} - -void AnalyzerManager::AnalyzerManagerPrivate::selectAction(int idx) -{ - QTC_ASSERT(idx >= 0, return); - if (m_currentIndex == idx) - return; - - if (m_currentIndex != -1) { - IAnalyzerTool *oldTool = toolAt(m_currentIndex); - saveToolSettings(oldTool); - - ActionManager *am = ICore::instance()->actionManager(); - - foreach (QDockWidget *widget, m_toolWidgets.value(oldTool)) { - QAction *toggleViewAction = widget->toggleViewAction(); - am->unregisterAction(toggleViewAction, - QString("Analyzer." + widget->objectName())); - m_mainWindow->removeDockWidget(widget); - ///NOTE: QMainWindow (and FancyMainWindow) just look at - /// @c findChildren<QDockWidget*>() - ///if we don't do this, all kind of havoc might happen, including: - ///- improper saveState/restoreState - ///- improper list of qdockwidgets in popup menu - ///- ... - widget->setParent(0); - } - oldTool->toolDeselected(); - } - - m_currentIndex = idx; - - m_toolBox->setCurrentIndex(idx); - m_controlsWidget->setCurrentIndex(idx); - - IAnalyzerTool *newTool = toolAt(idx); - - const bool firstTime = !m_defaultSettings.contains(newTool); - if (firstTime) { - newTool->initializeDockWidgets(); - m_defaultSettings.insert(newTool, m_mainWindow->saveSettings()); + if (mode && mode == m_mode) { + m_mainWindow->setDockActionsVisible(true); + static bool firstTime = true; + if (firstTime) + selectSavedTool(); + firstTime = false; + updateRunActions(); } else { - foreach (QDockWidget *widget, m_toolWidgets.value(newTool)) - addDock(Qt::DockWidgetArea(widget->property(INITIAL_DOCK_AREA).toInt()), widget); + m_mainWindow->setDockActionsVisible(false); } - - loadToolSettings(newTool); - updateRunActions(); } -void AnalyzerManager::AnalyzerManagerPrivate::selectAction() +QAction *AnalyzerManagerPrivate::actionFromToolAndMode(IAnalyzerTool *tool, StartMode mode) { - selectAction(qobject_cast<QAction *>(sender())); + foreach (QAction *action, m_actions) + if (m_toolFromAction.value(action) == tool && m_modeFromAction[action] == mode) + return action; + QTC_ASSERT(false, /**/); + return 0; } -void AnalyzerManager::AnalyzerManagerPrivate::selectAction(QAction *action) +void AnalyzerManagerPrivate::selectSavedTool() { - selectAction(indexOf(action)); + const QSettings *settings = Core::ICore::instance()->settings(); + const QByteArray lastActiveAction = + settings->value(QLatin1String(LAST_ACTIVE_TOOL), QString()).toByteArray(); + foreach (QAction *action, m_actions) { + IAnalyzerTool *tool = m_toolFromAction.value(action); + StartMode mode = m_modeFromAction.value(action); + if (tool->actionId(mode) == lastActiveAction) { + selectTool(tool, mode); + break; + } + } } -int AnalyzerManager::AnalyzerManagerPrivate::indexOf(QAction *action) const +void AnalyzerManagerPrivate::selectMenuAction() { - for (int i = 0; i != m_actions.size(); ++i) - if (m_actions.at(i).action == action) - return i; - return -1; + QAction *action = qobject_cast<QAction *>(sender()); + QTC_ASSERT(action, return); + IAnalyzerTool *tool = m_toolFromAction.value(action); + StartMode mode = m_modeFromAction.value(action); + selectTool(tool, mode); + tool->startTool(mode); } -int AnalyzerManager::AnalyzerManagerPrivate::indexOf(IAnalyzerTool *tool) const +void AnalyzerManagerPrivate::selectToolboxAction(int index) { - for (int i = 0; i != m_actions.size(); ++i) - if (toolAt(i) == tool) - return i; - return -1; + QAction *action = m_actions[index]; + selectTool(m_toolFromAction.value(action), m_modeFromAction.value(action)); } -IAnalyzerTool *AnalyzerManager::AnalyzerManagerPrivate::toolAt(int idx) const +void AnalyzerManagerPrivate::selectTool(IAnalyzerTool *tool, StartMode mode) { - QTC_ASSERT(idx >= 0, return 0); - QTC_ASSERT(idx < m_actions.size(), return 0); - return m_actions.at(idx).tool; -} + if (m_currentTool == tool && m_currentMode == mode) + return; -void AnalyzerManager::AnalyzerManagerPrivate::addToolAction(IAnalyzerTool *tool, bool local) -{ - ActionManager *am = Core::ICore::instance()->actionManager(); + QAction *action = actionFromToolAndMode(tool, mode); + const int actionIndex = m_actions.indexOf(action); + QTC_ASSERT(actionIndex >= 0, return); - QString actionId = QString("Action.Analyzer.Tools.%1").arg(m_actions.size()); - QString displayName = tool->displayName() + (local ? QString() : tr(" (Remote)")); - QAction *action = new QAction(displayName, 0); + // Clean up old tool. + if (m_currentTool) { + saveToolSettings(m_currentTool, m_currentMode); + foreach (QDockWidget *widget, m_toolWidgets.value(m_currentTool)) + deactivateDock(widget); + m_currentTool->toolDeselected(); + } - ToolData data; - data.tool = tool; - data.local = local; - data.action = action; - m_actions.append(data); + // Now change the tool. + m_currentTool = tool; + m_currentMode = mode; + + if (!m_defaultSettings.contains(tool)) { + QWidget *widget = tool->createWidgets(); + QTC_ASSERT(widget, /**/); + m_defaultSettings.insert(tool, m_mainWindow->saveSettings()); + QTC_ASSERT(!m_controlsWidgetFromTool.contains(tool), /**/); + m_controlsWidgetFromTool[tool] = widget; + m_controlsStackWidget->addWidget(widget); + } + foreach (QDockWidget *widget, m_toolWidgets.value(tool)) + activateDock(Qt::DockWidgetArea(widget->property(INITIAL_DOCK_AREA).toInt()), widget); - Core::Command *command = am->registerAction(action, actionId, - Core::Context(Core::Constants::C_GLOBAL)); - m_menu->addAction(command, local ? G_ANALYZER_TOOLS : G_ANALYZER_REMOTE_TOOLS); - connect(action, SIGNAL(triggered()), SLOT(selectAction())); + loadToolSettings(tool); - const bool blocked = m_toolBox->blockSignals(true); // Do not make current. - m_toolBox->addItem(displayName); - m_toolBox->blockSignals(blocked); - m_toolBox->setEnabled(true); + QTC_ASSERT(m_controlsWidgetFromTool.contains(tool), /**/); + m_controlsStackWidget->setCurrentWidget(m_controlsWidgetFromTool.value(tool)); + m_toolBox->setCurrentIndex(actionIndex); + + updateRunActions(); } -void AnalyzerManager::AnalyzerManagerPrivate::addTool(IAnalyzerTool *tool) +void AnalyzerManagerPrivate::addTool(IAnalyzerTool *tool, const StartModes &modes) { - delayedInit(); // be sure that there is a valid IMode instance + delayedInit(); // Make sure that there is a valid IMode instance. + + const bool blocked = m_toolBox->blockSignals(true); // Do not make current. + ActionManager *am = Core::ICore::instance()->actionManager(); + foreach (StartMode mode, modes) { + QString actionName = tool->actionName(mode); + QString menuGroup = tool->menuGroup(mode); + QString actionId = tool->actionId(mode); + QAction *action = new QAction(actionName, 0); + Core::Command *command = am->registerAction(action, actionId, + Core::Context(Core::Constants::C_GLOBAL)); + m_menu->addAction(command, menuGroup); + m_actions.append(action); + m_toolFromAction[action] = tool; + m_modeFromAction[action] = mode; + m_toolBox->addItem(actionName); + m_toolBox->blockSignals(blocked); + connect(action, SIGNAL(triggered()), SLOT(selectMenuAction())); + } m_tools.append(tool); - if (tool->canRunLocally()) - addToolAction(tool, true); - if (tool->canRunRemotely()) - addToolAction(tool, false); - // Populate controls widget. - QWidget *controlWidget = tool->createControlWidget(); // might be 0 - m_controlsWidget->addWidget(controlWidget - ? controlWidget : AnalyzerUtils::createDummyWidget()); - tool->initialize(); + m_toolBox->setEnabled(true); } -void AnalyzerManager::AnalyzerManagerPrivate::runControlCreated(AnalyzerRunControl *rc) +void AnalyzerManagerPrivate::handleToolStarted() { - QTC_ASSERT(!m_currentRunControl, /**/); - m_currentRunControl = rc; - connect(rc, SIGNAL(finished()), this, SLOT(handleToolFinished())); + m_isRunning = true; // FIXME: Make less global. + updateRunActions(); } -void AnalyzerManager::AnalyzerManagerPrivate::handleToolFinished() +void AnalyzerManagerPrivate::handleToolFinished() { - m_currentRunControl = 0; + m_isRunning = false; updateRunActions(); if (m_restartOnStop) { - startAction(m_currentIndex); + m_currentTool->startTool(m_currentMode); m_restartOnStop = false; } } -void AnalyzerManager::AnalyzerManagerPrivate::loadToolSettings(IAnalyzerTool *tool) +void AnalyzerManagerPrivate::loadToolSettings(IAnalyzerTool *tool) { QTC_ASSERT(m_mainWindow, return); QSettings *settings = Core::ICore::instance()->settings(); @@ -759,7 +708,7 @@ void AnalyzerManager::AnalyzerManagerPrivate::loadToolSettings(IAnalyzerTool *to settings->endGroup(); } -void AnalyzerManager::AnalyzerManagerPrivate::saveToolSettings(IAnalyzerTool *tool) +void AnalyzerManagerPrivate::saveToolSettings(IAnalyzerTool *tool, StartMode mode) { if (!tool) return; // no active tool, do nothing @@ -770,31 +719,38 @@ void AnalyzerManager::AnalyzerManagerPrivate::saveToolSettings(IAnalyzerTool *to m_mainWindow->saveSettings(settings); settings->setValue("ToolSettingsSaved", true); settings->endGroup(); - settings->setValue(QLatin1String(lastActiveToolC), tool->id()); + settings->setValue(QLatin1String(LAST_ACTIVE_TOOL), tool->actionId(mode)); } -void AnalyzerManager::AnalyzerManagerPrivate::updateRunActions() +void AnalyzerManagerPrivate::updateRunActions() { - ProjectExplorer::ProjectExplorerPlugin *pe = - ProjectExplorer::ProjectExplorerPlugin::instance(); - ProjectExplorer::Project *project = pe->startupProject(); + static bool previousRunning = true; + static IAnalyzerTool *previousTool = 0; + if (previousRunning == m_isRunning && previousTool == m_currentTool) + return; + previousTool = m_currentTool; + previousRunning = m_isRunning; + + ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance(); + Project *project = pe->startupProject(); - bool startEnabled = !m_currentRunControl - && pe->canRun(project, Constants::MODE_ANALYZE) - && m_currentIndex >= 0; + bool startEnabled = !m_isRunning + && m_currentTool && pe->canRun(project, m_currentTool->id()); QString disabledReason; - if (m_currentRunControl) + if (m_isRunning) disabledReason = tr("An analysis is still in progress."); - else if (m_currentIndex == -1) + else if (!m_currentTool) disabledReason = tr("No analyzer tool selected."); else - disabledReason = pe->cannotRunReason(project, Constants::MODE_ANALYZE); + disabledReason = pe->cannotRunReason(project, m_currentTool->id()); m_startAction->setEnabled(startEnabled); m_startAction->setToolTip(disabledReason); - m_toolBox->setEnabled(!m_currentRunControl); - m_stopAction->setEnabled(m_currentRunControl); + m_toolBox->setEnabled(!m_isRunning); + m_stopAction->setEnabled(m_isRunning); + foreach (QAction *action, m_actions) + action->setEnabled(!m_isRunning); } //////////////////////////////////////////////////////////////////// @@ -822,85 +778,57 @@ void AnalyzerManager::extensionsInitialized() if (d->m_tools.isEmpty()) return; - const QSettings *settings = Core::ICore::instance()->settings(); - const QString lastActiveToolId = - settings->value(QLatin1String(lastActiveToolC), QString()).toString(); - int lastAction = 0; - - foreach (IAnalyzerTool *tool, d->m_tools) { + foreach (IAnalyzerTool *tool, d->m_tools) tool->extensionsInitialized(); - if (tool->id() == lastActiveToolId) - lastAction = d->indexOf(tool); - } - - d->selectAction(lastAction); } void AnalyzerManager::shutdown() { - d->saveToolSettings(d->m_actions[d->m_currentIndex].tool); + d->saveToolSettings(d->m_currentTool, d->m_currentMode); } -AnalyzerManager *AnalyzerManager::instance() +void AnalyzerManager::addTool(IAnalyzerTool *tool, const StartModes &modes) { - return m_instance; -} - -void AnalyzerManager::registerRunControlFactory(ProjectExplorer::IRunControlFactory *factory) -{ - d->registerRunControlFactory(factory); -} - -void AnalyzerManager::addTool(IAnalyzerTool *tool) -{ - d->addTool(tool); + m_instance->d->addTool(tool, modes); } QDockWidget *AnalyzerManager::createDockWidget(IAnalyzerTool *tool, const QString &title, QWidget *widget, Qt::DockWidgetArea area) { - QTC_ASSERT(!widget->objectName().isEmpty(), return 0;); - + QTC_ASSERT(!widget->objectName().isEmpty(), return 0); + AnalyzerManagerPrivate *d = m_instance->d; QDockWidget *dockWidget = d->m_mainWindow->addDockForWidget(widget); dockWidget->setProperty(INITIAL_DOCK_AREA, int(area)); d->m_dockWidgets.append(AnalyzerManagerPrivate::DockPtr(dockWidget)); dockWidget->setWindowTitle(title); d->m_toolWidgets[tool].push_back(dockWidget); - d->addDock(area, dockWidget); return dockWidget; } -IAnalyzerEngine *AnalyzerManager::createEngine(const AnalyzerStartParameters &sp, - ProjectExplorer::RunConfiguration *runConfiguration) +void AnalyzerManager::selectTool(IAnalyzerTool *tool, StartMode mode) { - IAnalyzerTool *tool = d->toolAt(d->m_currentIndex); - QTC_ASSERT(tool, return 0); - return tool->createEngine(sp, runConfiguration); + m_instance->d->selectTool(tool, mode); } -void AnalyzerManager::selectTool(IAnalyzerTool *tool) +void AnalyzerManager::startTool(IAnalyzerTool *tool, StartMode mode) { - d->selectAction(d->indexOf(tool)); + QTC_ASSERT(tool == m_instance->d->m_currentTool, return); + tool->startTool(mode); } -void AnalyzerManager::startTool(IAnalyzerTool *tool) +Utils::FancyMainWindow *AnalyzerManager::mainWindow() { - d->startAction(d->indexOf(tool)); + return m_instance->d->m_mainWindow; } -Utils::FancyMainWindow *AnalyzerManager::mainWindow() const +void AnalyzerManagerPrivate::resetLayout() { - return d->m_mainWindow; -} - -void AnalyzerManager::AnalyzerManagerPrivate::resetLayout() -{ - m_mainWindow->restoreSettings(m_defaultSettings.value(toolAt(m_currentIndex))); + m_mainWindow->restoreSettings(m_defaultSettings.value(m_currentTool)); } void AnalyzerManager::showStatusMessage(const QString &message, int timeoutMS) { - d->m_statusLabel->showStatusMessage(message, timeoutMS); + m_instance->d->m_statusLabel->showStatusMessage(message, timeoutMS); } void AnalyzerManager::showPermanentStatusMessage(const QString &message) @@ -922,13 +850,44 @@ QString AnalyzerManager::msgToolFinished(const QString &name, int issuesFound) void AnalyzerManager::showMode() { - if (d->m_mode) - ModeManager::instance()->activateMode(d->m_mode->id()); + if (m_instance->d->m_mode) + ModeManager::instance()->activateMode(m_instance->d->m_mode->id()); } void AnalyzerManager::stopTool() { - d->stopTool(); + stopAction()->trigger(); } +void AnalyzerManager::startLocalTool(IAnalyzerTool *tool, StartMode mode) +{ + m_instance->d->startLocalTool(tool, mode); +} + +QAction *AnalyzerManager::stopAction() +{ + return m_instance->d->m_stopAction; +} + +void AnalyzerManager::handleToolStarted() +{ + m_instance->d->handleToolStarted(); +} + +void AnalyzerManager::handleToolFinished() +{ + m_instance->d->handleToolFinished(); +} + +IAnalyzerTool *AnalyzerManager::toolFromId(const QByteArray &id) +{ + foreach (IAnalyzerTool *tool, m_instance->d->m_tools) + if (id.startsWith(tool->id())) + return tool; + QTC_ASSERT(false, qDebug() << "NO ANAYLYZER TOOL FOUND FOR ID" << id); + return 0; +} + +} // namespace Analyzer + #include "analyzermanager.moc" diff --git a/src/plugins/analyzerbase/analyzermanager.h b/src/plugins/analyzerbase/analyzermanager.h index a46ce59cb1..42700cac90 100644 --- a/src/plugins/analyzerbase/analyzermanager.h +++ b/src/plugins/analyzerbase/analyzermanager.h @@ -36,6 +36,7 @@ #define ANALYZERMANAGER_H #include "analyzerbase_global.h" +#include "analyzerconstants.h" #include "projectexplorer/runconfiguration.h" #include <QtCore/QObject> @@ -48,14 +49,12 @@ namespace Utils { class FancyMainWindow; } -namespace ProjectExplorer { -class RunConfiguration; -} - namespace Analyzer { + +typedef QList<StartMode> StartModes; + class IAnalyzerTool; -class IAnalyzerEngine; -class AnalyzerStartParameters; +class AnalyzerManagerPrivate; class ANALYZER_EXPORT AnalyzerManager : public QObject { @@ -65,40 +64,39 @@ public: explicit AnalyzerManager(QObject *parent = 0); ~AnalyzerManager(); - static AnalyzerManager *instance(); - void registerRunControlFactory(ProjectExplorer::IRunControlFactory *factory); - void extensionsInitialized(); void shutdown(); - /** - * Register a tool and initialize it. - */ - void addTool(Analyzer::IAnalyzerTool *tool); + // Register a tool and initialize it. + static void addTool(IAnalyzerTool *tool, const StartModes &mode); + static IAnalyzerTool *toolFromId(const QByteArray &id); + static StartMode modeFromId(const QByteArray &id); // Dockwidgets are registered to the main window. - QDockWidget *createDockWidget(IAnalyzerTool *tool, const QString &title, + static QDockWidget *createDockWidget(IAnalyzerTool *tool, const QString &title, QWidget *widget, Qt::DockWidgetArea area = Qt::TopDockWidgetArea); - Utils::FancyMainWindow *mainWindow() const; + static Utils::FancyMainWindow *mainWindow(); + + static void showMode(); + static void selectTool(IAnalyzerTool *tool, StartMode mode); + static void startTool(IAnalyzerTool *tool, StartMode mode); + static void stopTool(); - void showMode(); - void selectTool(IAnalyzerTool *tool); - void startTool(IAnalyzerTool *tool); - void stopTool(); + // Convenience functions. + static void startLocalTool(IAnalyzerTool *tool, StartMode mode); static QString msgToolStarted(const QString &name); static QString msgToolFinished(const QString &name, int issuesFound); - IAnalyzerEngine *createEngine(const AnalyzerStartParameters &sp, - ProjectExplorer::RunConfiguration *runConfiguration); + static void showStatusMessage(const QString &message, int timeoutMS = 10000); + static void showPermanentStatusMessage(const QString &message); -public slots: - void showStatusMessage(const QString &message, int timeoutMS = 10000); - void showPermanentStatusMessage(const QString &message); + static void handleToolStarted(); + static void handleToolFinished(); + static QAction *stopAction(); private: - class AnalyzerManagerPrivate; friend class AnalyzerManagerPrivate; AnalyzerManagerPrivate *const d; }; diff --git a/src/plugins/analyzerbase/analyzerruncontrol.cpp b/src/plugins/analyzerbase/analyzerruncontrol.cpp index 920c62ef10..889b2a911b 100644 --- a/src/plugins/analyzerbase/analyzerruncontrol.cpp +++ b/src/plugins/analyzerbase/analyzerruncontrol.cpp @@ -48,9 +48,15 @@ #include <QtCore/QDebug> -using namespace Analyzer; +using namespace ProjectExplorer; -// AnalyzerRunControl::Private /////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +// +// AnalyzerRunControl::Private +// +////////////////////////////////////////////////////////////////////////// + +namespace Analyzer { class AnalyzerRunControl::Private { @@ -66,13 +72,18 @@ AnalyzerRunControl::Private::Private() {} -// AnalyzerRunControl //////////////////////////////////////////////////// -AnalyzerRunControl::AnalyzerRunControl(const AnalyzerStartParameters &sp, - RunConfiguration *runConfiguration) - : RunControl(runConfiguration, Constants::MODE_ANALYZE), +////////////////////////////////////////////////////////////////////////// +// +// AnalyzerRunControl +// +////////////////////////////////////////////////////////////////////////// + +AnalyzerRunControl::AnalyzerRunControl(IAnalyzerTool *tool, + const AnalyzerStartParameters &sp, RunConfiguration *runConfiguration) + : RunControl(runConfiguration, tool->id()), d(new Private) { - d->m_engine = AnalyzerManager::instance()->createEngine(sp, runConfiguration); + d->m_engine = tool->createEngine(sp, runConfiguration); if (!d->m_engine) return; @@ -83,6 +94,7 @@ AnalyzerRunControl::AnalyzerRunControl(const AnalyzerStartParameters &sp, SLOT(addTask(ProjectExplorer::Task::TaskType,QString,QString,int))); connect(d->m_engine, SIGNAL(finished()), SLOT(engineFinished())); + connect(this, SIGNAL(finished()), SLOT(runControlFinished()), Qt::QueuedConnection); } AnalyzerRunControl::~AnalyzerRunControl() @@ -92,6 +104,7 @@ AnalyzerRunControl::~AnalyzerRunControl() delete d->m_engine; d->m_engine = 0; + delete d; } void AnalyzerRunControl::start() @@ -103,7 +116,7 @@ void AnalyzerRunControl::start() // clear about-to-be-outdated tasks ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - ProjectExplorer::TaskHub *hub = pm->getObject<ProjectExplorer::TaskHub>(); + TaskHub *hub = pm->getObject<TaskHub>(); hub->clearTasks(Constants::ANALYZERTASK_ID); d->m_isRunning = true; @@ -111,7 +124,7 @@ void AnalyzerRunControl::start() d->m_engine->start(); } -ProjectExplorer::RunControl::StopResult AnalyzerRunControl::stop() +RunControl::StopResult AnalyzerRunControl::stop() { if (!d->m_engine || !d->m_isRunning) return StoppedSynchronously; @@ -121,12 +134,23 @@ ProjectExplorer::RunControl::StopResult AnalyzerRunControl::stop() return AsynchronousStop; } +void AnalyzerRunControl::stopIt() +{ + if (stop() == RunControl::StoppedSynchronously) + AnalyzerManager::handleToolFinished(); +} + void AnalyzerRunControl::engineFinished() { d->m_isRunning = false; emit finished(); } +void AnalyzerRunControl::runControlFinished() +{ + AnalyzerManager::handleToolFinished(); +} + bool AnalyzerRunControl::isRunning() const { return d->m_isRunning; @@ -149,12 +173,12 @@ void AnalyzerRunControl::receiveOutput(const QString &text, Utils::OutputFormat appendMessage(text, format); } -void AnalyzerRunControl::addTask(ProjectExplorer::Task::TaskType type, const QString &description, +void AnalyzerRunControl::addTask(Task::TaskType type, const QString &description, const QString &file, int line) { ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - ProjectExplorer::TaskHub *hub = pm->getObject<ProjectExplorer::TaskHub>(); - hub->addTask(ProjectExplorer::Task(type, description, file, line, Constants::ANALYZERTASK_ID)); + TaskHub *hub = pm->getObject<TaskHub>(); + hub->addTask(Task(type, description, file, line, Constants::ANALYZERTASK_ID)); ///FIXME: get a better API for this into Qt Creator QList<Core::IOutputPane *> panes = pm->getObjects<Core::IOutputPane>(); @@ -165,3 +189,5 @@ void AnalyzerRunControl::addTask(ProjectExplorer::Task::TaskType type, const QSt } } } + +} // namespace Analyzer diff --git a/src/plugins/analyzerbase/analyzerruncontrol.h b/src/plugins/analyzerbase/analyzerruncontrol.h index 59a2a2e720..ff320a4e2b 100644 --- a/src/plugins/analyzerbase/analyzerruncontrol.h +++ b/src/plugins/analyzerbase/analyzerruncontrol.h @@ -45,18 +45,18 @@ namespace Analyzer { class AnalyzerStartParameters; +class IAnalyzerTool; -class ANALYZER_EXPORT AnalyzerRunControl: public ProjectExplorer::RunControl +class ANALYZER_EXPORT AnalyzerRunControl : public ProjectExplorer::RunControl { Q_OBJECT public: - typedef ProjectExplorer::RunConfiguration RunConfiguration; - // the constructor is likely to gain more arguments later - explicit AnalyzerRunControl(const AnalyzerStartParameters &sp, RunConfiguration *runConfiguration); + AnalyzerRunControl(IAnalyzerTool *tool, const AnalyzerStartParameters &sp, + ProjectExplorer::RunConfiguration *runConfiguration); ~AnalyzerRunControl(); - // pure virtuals from ProjectExplorer::RunControl + // ProjectExplorer::RunControl void start(); StopResult stop(); bool isRunning() const; @@ -64,16 +64,18 @@ public: QIcon icon() const; private slots: + void stopIt(); void receiveOutput(const QString &, Utils::OutputFormat format); void addTask(ProjectExplorer::Task::TaskType type, const QString &description, const QString &file, int line); void engineFinished(); + void runControlFinished(); private: class Private; - QScopedPointer<Private> d; + Private *d; }; } // namespace Analyzer diff --git a/src/plugins/analyzerbase/analyzerruncontrolfactory.cpp b/src/plugins/analyzerbase/analyzerruncontrolfactory.cpp deleted file mode 100644 index 3e7efb81e8..0000000000 --- a/src/plugins/analyzerbase/analyzerruncontrolfactory.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "analyzerruncontrolfactory.h" -#include "analyzerruncontrol.h" -#include "analyzerconstants.h" -#include "analyzerrunconfigwidget.h" -#include "analyzersettings.h" -#include "analyzerstartparameters.h" - -#include <utils/qtcassert.h> - -#include <projectexplorer/applicationrunconfiguration.h> - -#include <remotelinux/linuxdeviceconfiguration.h> -#include <remotelinux/remotelinuxrunconfiguration.h> - -#include <QtCore/QDebug> - -using namespace Analyzer; -using namespace Analyzer::Internal; - -AnalyzerStartParameters localStartParameters(ProjectExplorer::RunConfiguration *runConfiguration) -{ - AnalyzerStartParameters sp; - QTC_ASSERT(runConfiguration, return sp); - ProjectExplorer::LocalApplicationRunConfiguration *rc = - qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration); - QTC_ASSERT(rc, return sp); - - sp.startMode = StartLocal; - sp.environment = rc->environment(); - sp.workingDirectory = rc->workingDirectory(); - sp.debuggee = rc->executable(); - sp.debuggeeArgs = rc->commandLineArguments(); - sp.displayName = rc->displayName(); - sp.connParams.host = QLatin1String("localhost"); - sp.connParams.port = rc->qmlDebugServerPort(); - return sp; -} - -AnalyzerStartParameters remoteLinuxStartParameters(ProjectExplorer::RunConfiguration *runConfiguration) -{ - AnalyzerStartParameters sp; - RemoteLinux::RemoteLinuxRunConfiguration * const rc - = qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration); - QTC_ASSERT(rc, return sp); - - sp.debuggee = rc->remoteExecutableFilePath(); - sp.debuggeeArgs = rc->arguments(); - sp.connParams = rc->deviceConfig()->sshParameters(); - sp.analyzerCmdPrefix = rc->commandPrefix(); - sp.startMode = StartRemote; - sp.displayName = rc->displayName(); - return sp; -} - - -// AnalyzerRunControlFactory //////////////////////////////////////////////////// -AnalyzerRunControlFactory::AnalyzerRunControlFactory(QObject *parent) - : IRunControlFactory(parent) -{ -} - -bool AnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const -{ - return runConfiguration->isEnabled() && mode == Constants::MODE_ANALYZE; -} - -ProjectExplorer::RunControl *AnalyzerRunControlFactory::create(RunConfiguration *runConfiguration, - const QString &mode) -{ - QTC_ASSERT(canRun(runConfiguration, mode), return 0); - - AnalyzerStartParameters sp; - if (qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration)) { - sp = localStartParameters(runConfiguration); - } else if (qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) { - sp = remoteLinuxStartParameters(runConfiguration); - } else { - // might be S60DeviceRunfiguration, or something else ... - sp.startMode = StartRemote; - } - - return create(sp, runConfiguration); -} - -AnalyzerRunControl *AnalyzerRunControlFactory::create(const AnalyzerStartParameters &sp, - RunConfiguration *runConfiguration) -{ - AnalyzerRunControl *rc = new AnalyzerRunControl(sp, runConfiguration); - emit runControlCreated(rc); - return rc; -} - -QString AnalyzerRunControlFactory::displayName() const -{ - return tr("Analyzer"); -} - -ProjectExplorer::IRunConfigurationAspect *AnalyzerRunControlFactory::createRunConfigurationAspect() -{ - return new AnalyzerProjectSettings; -} - -ProjectExplorer::RunConfigWidget *AnalyzerRunControlFactory::createConfigurationWidget(RunConfiguration - *runConfiguration) -{ - ProjectExplorer::LocalApplicationRunConfiguration *localRc = - qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration); - if (!localRc) - return 0; - AnalyzerProjectSettings *settings = runConfiguration->extraAspect<AnalyzerProjectSettings>(); - if (!settings) - return 0; - - AnalyzerRunConfigWidget *ret = new AnalyzerRunConfigWidget; - ret->setRunConfiguration(runConfiguration); - return ret; -} diff --git a/src/plugins/analyzerbase/analyzersettings.cpp b/src/plugins/analyzerbase/analyzersettings.cpp index fa00ab55d0..89fa68b1c2 100644 --- a/src/plugins/analyzerbase/analyzersettings.cpp +++ b/src/plugins/analyzerbase/analyzersettings.cpp @@ -40,7 +40,6 @@ #include "analyzeroptionspage.h" #include <coreplugin/icore.h> -#include <valgrind/xmlprotocol/error.h> #include <utils/qtcassert.h> #include <QtCore/QSettings> diff --git a/src/plugins/analyzerbase/analyzerstartparameters.h b/src/plugins/analyzerbase/analyzerstartparameters.h index a867108c42..5265e7099f 100644 --- a/src/plugins/analyzerbase/analyzerstartparameters.h +++ b/src/plugins/analyzerbase/analyzerstartparameters.h @@ -50,19 +50,16 @@ class ANALYZER_EXPORT AnalyzerStartParameters { public: AnalyzerStartParameters() - : startMode(StartLocal) - , connParams(Utils::SshConnectionParameters::NoProxy) - { } + : connParams(Utils::SshConnectionParameters::NoProxy) + {} - AnalyzerStartMode startMode; + StartMode startMode; Utils::SshConnectionParameters connParams; + QByteArray toolId; QString debuggee; QString debuggeeArgs; QString analyzerCmdPrefix; - QString remoteMountPoint; - QString localMountDir; - QString remoteSourcesDir; QString displayName; Utils::Environment environment; QString workingDirectory; diff --git a/src/plugins/analyzerbase/analyzerutils.cpp b/src/plugins/analyzerbase/analyzerutils.cpp index 532a3c559f..83107e8312 100644 --- a/src/plugins/analyzerbase/analyzerutils.cpp +++ b/src/plugins/analyzerbase/analyzerutils.cpp @@ -116,10 +116,3 @@ CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor() const CPlusPlus::LookupItem &lookupItem = lookupItems.first(); // ### TODO: select best candidate. return lookupItem.declaration(); } - -QWidget *AnalyzerUtils::createDummyWidget() -{ - QWidget *widget = new QWidget; - widget->setProperty(Constants::ANALYZER_DUMMYWIDGET_ID, QVariant(true)); - return widget; -} diff --git a/src/plugins/analyzerbase/analyzerutils.h b/src/plugins/analyzerbase/analyzerutils.h index cece97438f..61f6b8a98d 100644 --- a/src/plugins/analyzerbase/analyzerutils.h +++ b/src/plugins/analyzerbase/analyzerutils.h @@ -46,8 +46,6 @@ class Symbol; namespace AnalyzerUtils { ANALYZER_EXPORT CPlusPlus::Symbol *findSymbolUnderCursor(); - - ANALYZER_EXPORT QWidget *createDummyWidget(); } #endif // ANALYZERUTILS_H diff --git a/src/plugins/analyzerbase/ianalyzerengine.cpp b/src/plugins/analyzerbase/ianalyzerengine.cpp index 1da091d93c..91da9d098f 100644 --- a/src/plugins/analyzerbase/ianalyzerengine.cpp +++ b/src/plugins/analyzerbase/ianalyzerengine.cpp @@ -36,21 +36,19 @@ namespace Analyzer { -IAnalyzerEngine::IAnalyzerEngine(const AnalyzerStartParameters &sp, - ProjectExplorer::RunConfiguration *runConfiguration) - : m_runConfig(runConfiguration) - , m_sp(sp) +IAnalyzerEngine::IAnalyzerEngine(IAnalyzerTool *tool, const AnalyzerStartParameters &sp, + ProjectExplorer::RunConfiguration *runConfiguration) { + m_runConfig = runConfiguration; + m_sp = sp; + m_tool = tool; } -ProjectExplorer::RunConfiguration *IAnalyzerEngine::runConfiguration() const +IAnalyzerEngine::IAnalyzerEngine(IAnalyzerTool *tool, + ProjectExplorer::RunConfiguration *runConfiguration) { - return m_runConfig; -} - -AnalyzerStartParameters IAnalyzerEngine::startParameters() const -{ - return m_sp; + m_runConfig = runConfiguration; + m_tool = tool; } } // namespace Analyzer diff --git a/src/plugins/analyzerbase/ianalyzerengine.h b/src/plugins/analyzerbase/ianalyzerengine.h index d8a9bd8895..29c2d0f0b8 100644 --- a/src/plugins/analyzerbase/ianalyzerengine.h +++ b/src/plugins/analyzerbase/ianalyzerengine.h @@ -51,6 +51,8 @@ class RunConfiguration; namespace Analyzer { +class IAnalyzerTool; + /** * An IAnalyzerEngine instance handles the launch of an analyzation tool. * @@ -61,40 +63,47 @@ class ANALYZER_EXPORT IAnalyzerEngine : public QObject Q_OBJECT public: - explicit IAnalyzerEngine(const AnalyzerStartParameters &sp, + IAnalyzerEngine(IAnalyzerTool *tool, const AnalyzerStartParameters &sp, ProjectExplorer::RunConfiguration *runConfiguration = 0); + IAnalyzerEngine(IAnalyzerTool *tool, + ProjectExplorer::RunConfiguration *runConfiguration); - /// start analyzation process + /// Start analyzation process. virtual void start() = 0; - /// trigger async stop of the analyzation process + /// Trigger async stop of the analyzation process. virtual void stop() = 0; - /// controller actions + /// Controller actions. virtual bool canPause() const { return false; } virtual void pause() {} virtual void unpause() {} - /// the active run configuration for this engine, might be zero - ProjectExplorer::RunConfiguration *runConfiguration() const; + /// The active run configuration for this engine, might be zero. + ProjectExplorer::RunConfiguration *runConfiguration() const { return m_runConfig; } + + /// The start parameters for this engine. + const AnalyzerStartParameters &startParameters() const { return m_sp; } - /// the start parameters for this engine - AnalyzerStartParameters startParameters() const; + /// The tool this engine is associated with. + IAnalyzerTool *tool() const { return m_tool; } + StartMode mode() const { return m_sp.startMode; } signals: - /// should be emitted when the debuggee outputted something + /// Should be emitted when the debuggee outputted something. void outputReceived(const QString &, Utils::OutputFormat format); - /// can be emitted when you want to show a task, e.g. to display an error + /// Can be emitted when you want to show a task, e.g. to display an error. void taskToBeAdded(ProjectExplorer::Task::TaskType type, const QString &description, const QString &file, int line); - /// must be emitted when the engine finished + /// Must be emitted when the engine finished. void finished(); - /// must be emitted when the engine is starting + /// Must be emitted when the engine is starting. void starting(const Analyzer::IAnalyzerEngine *); private: ProjectExplorer::RunConfiguration *m_runConfig; AnalyzerStartParameters m_sp; + IAnalyzerTool *m_tool; }; } // namespace Analyzer diff --git a/src/plugins/analyzerbase/ianalyzertool.cpp b/src/plugins/analyzerbase/ianalyzertool.cpp index 600d18f844..f0dce04541 100644 --- a/src/plugins/analyzerbase/ianalyzertool.cpp +++ b/src/plugins/analyzerbase/ianalyzertool.cpp @@ -33,6 +33,7 @@ **************************************************************************/ #include "ianalyzertool.h" +#include "analyzermanager.h" namespace Analyzer { @@ -40,26 +41,27 @@ IAnalyzerTool::IAnalyzerTool(QObject *parent) : QObject(parent) {} -QString IAnalyzerTool::modeString(ToolMode mode) +QByteArray IAnalyzerTool::defaultMenuGroup(StartMode mode) { - switch (mode) { - case IAnalyzerTool::DebugMode: - return tr("Debug"); - case IAnalyzerTool::ReleaseMode: - return tr("Release"); - case IAnalyzerTool::AnyMode: - break; - } - return QString(); + if (mode == StartRemote) + return Analyzer::Constants::G_ANALYZER_REMOTE_TOOLS; + return Analyzer::Constants::G_ANALYZER_TOOLS; } -void IAnalyzerTool::initializeDockWidgets() +QByteArray IAnalyzerTool::defaultActionId(const IAnalyzerTool *tool, StartMode mode) { + QByteArray id = tool->id(); + if (mode == StartRemote) + return "Action." + id + ".RemoteStart." + QByteArray::number(mode); + return "Action." + id + ".LocalStart." + QByteArray::number(mode); } -QWidget *IAnalyzerTool::createControlWidget() +QString IAnalyzerTool::defaultActionName(const IAnalyzerTool *tool, StartMode mode) { - return 0; + QString base = tool->displayName(); + if (mode == StartRemote) + return base + tr(" (Remote)"); + return base; } } // namespace Analyzer diff --git a/src/plugins/analyzerbase/ianalyzertool.h b/src/plugins/analyzerbase/ianalyzertool.h index 0e77b82199..8b7e489ad8 100644 --- a/src/plugins/analyzerbase/ianalyzertool.h +++ b/src/plugins/analyzerbase/ianalyzertool.h @@ -36,6 +36,7 @@ #define IANALYZERTOOL_H #include "analyzerbase_global.h" +#include "analyzerconstants.h" #include <QtCore/QObject> @@ -49,8 +50,12 @@ class AnalyzerStartParameters; class IAnalyzerOutputPaneAdapter; class IAnalyzerEngine; + /** * This class represents an analyzation tool, e.g. "Valgrind Memcheck". + * + * Each tool can run in different run modes. The modes are specific to the mode. + * * @code * bool YourPlugin::initialize(const QStringList &arguments, QString *errorString) * { @@ -67,16 +72,25 @@ public: explicit IAnalyzerTool(QObject *parent = 0); /// Returns a unique ID for this tool. - virtual QString id() const = 0; + virtual QByteArray id() const = 0; /// Returns a short user readable display name for this tool. virtual QString displayName() const = 0; /// Returns a user readable description name for this tool. virtual QString description() const = 0; + /// Returns an id for the start action. + virtual QByteArray actionId(StartMode mode) const + { return defaultActionId(this, mode); } + /// Returns the menu group the start action should go to. + virtual QByteArray menuGroup(StartMode mode) const + { return defaultMenuGroup(mode); } + /// Returns a short user readable action name for this tool. + virtual QString actionName(StartMode mode) const + { return defaultActionName(this, mode); } /** * The mode in which this tool should preferably be run * - * The memcheckt tool, for example, requires debug symbols, hence DebugMode + * The memcheck tool, for example, requires debug symbols, hence DebugMode * is preferred. On the other hand, callgrind should look at optimized code, * hence ReleaseMode. */ @@ -85,38 +99,27 @@ public: ReleaseMode, AnyMode }; - virtual ToolMode mode() const = 0; + virtual ToolMode toolMode() const = 0; - static QString modeString(ToolMode mode); + /// Convenience implementation. + static QByteArray defaultMenuGroup(StartMode mode); + static QByteArray defaultActionId(const IAnalyzerTool *tool, StartMode mode); + static QString defaultActionName(const IAnalyzerTool *tool, StartMode mode); - /** - * The implementation should setup widgets for the output pane here and - * optionally add dock widgets in the analyzation mode if wanted. - */ - virtual void initialize() = 0; /// This gets called after all analyzation tools where initialized. virtual void extensionsInitialized() = 0; - /** - * This is called to add all dock widgets if tool becomes active first time. - * \sa AnalzyerManager::createDockWidget - */ - virtual void initializeDockWidgets(); - - /// Returns a control widget which will be shown - /// in the output pane when this tool is selected. - virtual QWidget *createControlWidget(); + /// Creates all widgets used by the tool. + /// Returns a control widget which will be shown in the status bar when + /// this tool is selected. Must be non-zero. + virtual QWidget *createWidgets() = 0; /// Returns a new engine for the given start parameters. /// Called each time the tool is launched. virtual IAnalyzerEngine *createEngine(const AnalyzerStartParameters &sp, ProjectExplorer::RunConfiguration *runConfiguration = 0) = 0; - /// Returns true when this tool can be run on the loca machine. - virtual bool canRunLocally() const = 0; - - /// Returns true when this tool can be run on a remote machine. - virtual bool canRunRemotely() const = 0; + virtual void startTool(StartMode mode) = 0; /// Called when tools gets selected. virtual void toolSelected() const {} diff --git a/src/plugins/analyzerbase/startremotedialog.cpp b/src/plugins/analyzerbase/startremotedialog.cpp index cfb2859576..2fdec91bea 100644 --- a/src/plugins/analyzerbase/startremotedialog.cpp +++ b/src/plugins/analyzerbase/startremotedialog.cpp @@ -40,8 +40,8 @@ namespace Analyzer { -StartRemoteDialog::StartRemoteDialog(QWidget *parent, Qt::WindowFlags f) - : QDialog(parent, f) +StartRemoteDialog::StartRemoteDialog(QWidget *parent) + : QDialog(parent) , m_ui(new Ui::StartRemoteDialog) { m_ui->setupUi(this); diff --git a/src/plugins/analyzerbase/startremotedialog.h b/src/plugins/analyzerbase/startremotedialog.h index 24f32b775f..258d45554f 100644 --- a/src/plugins/analyzerbase/startremotedialog.h +++ b/src/plugins/analyzerbase/startremotedialog.h @@ -33,12 +33,11 @@ #ifndef STARTREMOTEDIALOG_H #define STARTREMOTEDIALOG_H -#include <QtGui/QDialog> +#include "analyzerbase_global.h" #include <utils/ssh/sshconnection.h> -QT_BEGIN_NAMESPACE -QT_END_NAMESPACE +#include <QtGui/QDialog> namespace Analyzer { @@ -46,11 +45,12 @@ namespace Ui { class StartRemoteDialog; } -class StartRemoteDialog : public QDialog { +class ANALYZER_EXPORT StartRemoteDialog : public QDialog +{ Q_OBJECT public: - explicit StartRemoteDialog(QWidget *parent = 0, Qt::WindowFlags f = 0); + explicit StartRemoteDialog(QWidget *parent = 0); virtual ~StartRemoteDialog(); Utils::SshConnectionParameters sshParams() const; @@ -66,6 +66,6 @@ private: Ui::StartRemoteDialog *m_ui; }; -} +} // namespace Analyzer #endif // STARTREMOTEDIALOG_H diff --git a/src/plugins/coreplugin/generalsettings.ui b/src/plugins/coreplugin/generalsettings.ui index 82398e3e19..960d05b098 100644 --- a/src/plugins/coreplugin/generalsettings.ui +++ b/src/plugins/coreplugin/generalsettings.ui @@ -78,7 +78,7 @@ <item> <widget class="QPushButton" name="resetButton"> <property name="toolTip"> - <string>Reset to default.</string> + <string comment="Color">Reset to default.</string> </property> <property name="text"> <string>Reset</string> @@ -196,7 +196,7 @@ <item row="0" column="2"> <widget class="QPushButton" name="resetTerminalButton"> <property name="toolTip"> - <string>Reset to default.</string> + <string comment="Terminal">Reset to default.</string> </property> <property name="text"> <string>Reset</string> @@ -206,7 +206,7 @@ <item row="1" column="2"> <widget class="QPushButton" name="resetFileBrowserButton"> <property name="toolTip"> - <string>Reset to default.</string> + <string comment="File Browser">Reset to default.</string> </property> <property name="text"> <string>Reset</string> diff --git a/src/plugins/coreplugin/infobar.cpp b/src/plugins/coreplugin/infobar.cpp index 29d15a02fe..bf107416bf 100644 --- a/src/plugins/coreplugin/infobar.cpp +++ b/src/plugins/coreplugin/infobar.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/coreplugin/infobar.h b/src/plugins/coreplugin/infobar.h index af8e12395b..0d8e63249a 100644 --- a/src/plugins/coreplugin/infobar.h +++ b/src/plugins/coreplugin/infobar.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/coreplugin/multifeedrssmodel.cpp b/src/plugins/coreplugin/multifeedrssmodel.cpp index 66fe94822c..64b3ad2eeb 100644 --- a/src/plugins/coreplugin/multifeedrssmodel.cpp +++ b/src/plugins/coreplugin/multifeedrssmodel.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "multifeedrssmodel.h" #include <QtCore/QTimer> diff --git a/src/plugins/coreplugin/multifeedrssmodel.h b/src/plugins/coreplugin/multifeedrssmodel.h index 1d0d0363a8..a6a125565b 100644 --- a/src/plugins/coreplugin/multifeedrssmodel.h +++ b/src/plugins/coreplugin/multifeedrssmodel.h @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #ifndef MULTIFEEDRSSMODEL_H #define MULTIFEEDRSSMODEL_H diff --git a/src/plugins/coreplugin/networkaccessmanager.cpp b/src/plugins/coreplugin/networkaccessmanager.cpp index 8297e94e13..88dec43e00 100644 --- a/src/plugins/coreplugin/networkaccessmanager.cpp +++ b/src/plugins/coreplugin/networkaccessmanager.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "networkaccessmanager.h" #include <QtCore/QLocale> diff --git a/src/plugins/coreplugin/networkaccessmanager.h b/src/plugins/coreplugin/networkaccessmanager.h index cd4a8aa60e..a45ad3fa32 100644 --- a/src/plugins/coreplugin/networkaccessmanager.h +++ b/src/plugins/coreplugin/networkaccessmanager.h @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "core_global.h" #include <QtCore/QUrl> diff --git a/src/plugins/coreplugin/outputpane.cpp b/src/plugins/coreplugin/outputpane.cpp index 782c5ed029..aee055b9bc 100644 --- a/src/plugins/coreplugin/outputpane.cpp +++ b/src/plugins/coreplugin/outputpane.cpp @@ -48,12 +48,12 @@ struct OutputPanePlaceHolderPrivate { Core::IMode *m_mode; QSplitter *m_splitter; - bool m_closeable; + int m_lastNonMaxSize; static OutputPanePlaceHolder* m_current; }; OutputPanePlaceHolderPrivate::OutputPanePlaceHolderPrivate(Core::IMode *mode, QSplitter *parent) : - m_mode(mode), m_splitter(parent), m_closeable(true) + m_mode(mode), m_splitter(parent), m_lastNonMaxSize(0) { } @@ -85,16 +85,6 @@ OutputPanePlaceHolder::~OutputPanePlaceHolder() } } -void OutputPanePlaceHolder::setCloseable(bool b) -{ - d->m_closeable = b; -} - -bool OutputPanePlaceHolder::closeable() -{ - return d->m_closeable; -} - void OutputPanePlaceHolder::currentModeChanged(Core::IMode *mode) { if (d->m_current == this) { @@ -110,7 +100,6 @@ void OutputPanePlaceHolder::currentModeChanged(Core::IMode *mode) layout()->addWidget(om); om->show(); om->updateStatusButtons(isVisible()); - om->setCloseable(d->m_closeable); } } @@ -125,6 +114,7 @@ void OutputPanePlaceHolder::maximizeOrMinimize(bool maximize) QList<int> sizes = d->m_splitter->sizes(); if (maximize) { + d->m_lastNonMaxSize = sizes[idx]; int sum = 0; foreach(int s, sizes) sum += s; @@ -133,7 +123,7 @@ void OutputPanePlaceHolder::maximizeOrMinimize(bool maximize) } sizes[idx] = sum - (sizes.count()-1) * 32; } else { - int target = sizeHint().height(); + int target = d->m_lastNonMaxSize > 0 ? d->m_lastNonMaxSize : sizeHint().height(); int space = sizes[idx] - target; if (space > 0) { for (int i = 0; i < sizes.count(); ++i) { diff --git a/src/plugins/coreplugin/outputpane.h b/src/plugins/coreplugin/outputpane.h index 69b7af71af..1de9343a5a 100644 --- a/src/plugins/coreplugin/outputpane.h +++ b/src/plugins/coreplugin/outputpane.h @@ -60,8 +60,6 @@ public: explicit OutputPanePlaceHolder(Core::IMode *mode, QSplitter *parent = 0); ~OutputPanePlaceHolder(); - void setCloseable(bool b); - bool closeable(); static OutputPanePlaceHolder *getCurrent(); static bool isCurrentVisible(); diff --git a/src/plugins/coreplugin/outputpanemanager.cpp b/src/plugins/coreplugin/outputpanemanager.cpp index 561e6020dc..a7e1279166 100644 --- a/src/plugins/coreplugin/outputpanemanager.cpp +++ b/src/plugins/coreplugin/outputpanemanager.cpp @@ -349,8 +349,7 @@ void OutputPaneManager::buttonTriggered() int idx = it.key(); if (m_widgetComboBox->itemData(m_widgetComboBox->currentIndex()).toInt() == idx && - OutputPanePlaceHolder::isCurrentVisible() - && OutputPanePlaceHolder::getCurrent()->closeable()) { + OutputPanePlaceHolder::isCurrentVisible()) { // we should toggle and the page is already visible and we are actually closeable slotHide(); } else { @@ -464,16 +463,6 @@ void OutputPaneManager::togglePage(bool focus) } } -void OutputPaneManager::setCloseable(bool b) -{ - m_closeButton->setVisible(b); -} - -bool OutputPaneManager::closeable() -{ - return m_closeButton->isVisibleTo(m_closeButton->parentWidget()); -} - void OutputPaneManager::focusInEvent(QFocusEvent *e) { if (m_outputWidgetPane->currentWidget()) diff --git a/src/plugins/coreplugin/outputpanemanager.h b/src/plugins/coreplugin/outputpanemanager.h index f71985d9cb..921e21dd12 100644 --- a/src/plugins/coreplugin/outputpanemanager.h +++ b/src/plugins/coreplugin/outputpanemanager.h @@ -62,8 +62,6 @@ class OutputPaneManager : public QWidget public: void init(); static OutputPaneManager *instance(); - void setCloseable(bool b); - bool closeable(); QWidget *buttonsWidget(); void updateStatusButtons(bool visible); diff --git a/src/plugins/coreplugin/variablechooser.cpp b/src/plugins/coreplugin/variablechooser.cpp index ec8e45f3d5..09528d0654 100644 --- a/src/plugins/coreplugin/variablechooser.cpp +++ b/src/plugins/coreplugin/variablechooser.cpp @@ -52,6 +52,7 @@ VariableChooser::VariableChooser(QWidget *parent) : ui->variableList->setAttribute(Qt::WA_MacShowFocusRect, false); ui->variableDescription->setAttribute(Qt::WA_MacSmallSize); setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint); + setFocusPolicy(Qt::StrongFocus); setFocusProxy(ui->variableList); VariableManager *vm = VariableManager::instance(); @@ -155,6 +156,8 @@ void VariableChooser::updatePositionAndShow() move(parentCenter.x() - width()/2, parentCenter.y() - height()/2); } show(); + raise(); + activateWindow(); } void VariableChooser::handleItemActivated(QListWidgetItem *item) diff --git a/src/plugins/cpptools/cppcodeformatter.cpp b/src/plugins/cpptools/cppcodeformatter.cpp index 4a355f6ffb..41e70725f7 100644 --- a/src/plugins/cpptools/cppcodeformatter.cpp +++ b/src/plugins/cpptools/cppcodeformatter.cpp @@ -1058,6 +1058,14 @@ int QtStyleCodeFormatter::loadLexerState(const QTextBlock &block) const return BaseTextDocumentLayout::lexerState(block); } +void QtStyleCodeFormatter::addContinuationIndent(int *paddingDepth) const +{ + if (*paddingDepth == 0) + *paddingDepth = 2*m_tabSettings.m_indentSize; + else + *paddingDepth += m_tabSettings.m_indentSize; +} + void QtStyleCodeFormatter::onEnter(int newState, int *indentDepth, int *savedIndentDepth, int *paddingDepth, int *savedPaddingDepth) const { const State &parentState = state(); @@ -1094,12 +1102,8 @@ void QtStyleCodeFormatter::onEnter(int newState, int *indentDepth, int *savedInd case template_param: if (!lastToken) *paddingDepth = nextTokenPosition-*indentDepth; - else { - if (*paddingDepth == 0) - *paddingDepth = 2*m_tabSettings.m_indentSize; - else - *paddingDepth += m_tabSettings.m_indentSize; - } + else + addContinuationIndent(paddingDepth); break; case statement_with_condition: @@ -1140,17 +1144,18 @@ void QtStyleCodeFormatter::onEnter(int newState, int *indentDepth, int *savedInd case arglist_open: case condition_paren_open: + case member_init_paren_open: if (!lastToken) *paddingDepth = nextTokenPosition-*indentDepth; else - *paddingDepth += m_tabSettings.m_indentSize; + addContinuationIndent(paddingDepth); break; case ternary_op: if (!lastToken) *paddingDepth = spaceOrNextTokenPosition-*indentDepth; else - *paddingDepth += m_tabSettings.m_indentSize; + addContinuationIndent(paddingDepth); break; case stream_op: @@ -1175,10 +1180,6 @@ void QtStyleCodeFormatter::onEnter(int newState, int *indentDepth, int *savedInd *paddingDepth += 2; // savedIndentDepth is the position of ':' break; - case member_init_paren_open: - *paddingDepth += m_tabSettings.m_indentSize; - break; - case case_cont: if (m_styleSettings.indentStatementsRelativeToSwitchLabels) *indentDepth += m_tabSettings.m_indentSize; diff --git a/src/plugins/cpptools/cppcodeformatter.h b/src/plugins/cpptools/cppcodeformatter.h index 21f06135a8..dae19a2e24 100644 --- a/src/plugins/cpptools/cppcodeformatter.h +++ b/src/plugins/cpptools/cppcodeformatter.h @@ -278,6 +278,8 @@ protected: static bool shouldClearPaddingOnEnter(int state); private: + void addContinuationIndent(int *paddingDepth) const; + TextEditor::TabSettings m_tabSettings; CppCodeStyleSettings m_styleSettings; }; diff --git a/src/plugins/cpptools/cppcodestylepreferences.cpp b/src/plugins/cpptools/cppcodestylepreferences.cpp index 981216c5b2..5e3e27a8aa 100644 --- a/src/plugins/cpptools/cppcodestylepreferences.cpp +++ b/src/plugins/cpptools/cppcodestylepreferences.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "cppcodestylepreferences.h" using namespace CppTools; diff --git a/src/plugins/cpptools/cppcodestylepreferences.h b/src/plugins/cpptools/cppcodestylepreferences.h index 991e15f017..022d623e5f 100644 --- a/src/plugins/cpptools/cppcodestylepreferences.h +++ b/src/plugins/cpptools/cppcodestylepreferences.h @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #ifndef CPPCODESTYLEPREFERENCES_H #define CPPCODESTYLEPREFERENCES_H diff --git a/src/plugins/cpptools/cppcodestylesettings.cpp b/src/plugins/cpptools/cppcodestylesettings.cpp index 13a06e2633..40efe1254c 100644 --- a/src/plugins/cpptools/cppcodestylesettings.cpp +++ b/src/plugins/cpptools/cppcodestylesettings.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "cppcodestylesettings.h" #include <utils/settingsutils.h> diff --git a/src/plugins/cpptools/cppcodestylesettings.h b/src/plugins/cpptools/cppcodestylesettings.h index 320c99471f..ea934814b4 100644 --- a/src/plugins/cpptools/cppcodestylesettings.h +++ b/src/plugins/cpptools/cppcodestylesettings.h @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #ifndef CPPCODESTYLESETTINGS_H #define CPPCODESTYLESETTINGS_H diff --git a/src/plugins/cpptools/cppcodestylesettingsfactory.cpp b/src/plugins/cpptools/cppcodestylesettingsfactory.cpp index b794ace895..dc2e3ab0b3 100644 --- a/src/plugins/cpptools/cppcodestylesettingsfactory.cpp +++ b/src/plugins/cpptools/cppcodestylesettingsfactory.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "cppcodestylesettingsfactory.h" #include "cppcodestylesettings.h" #include "cppcodestylesettingspage.h" diff --git a/src/plugins/cpptools/cppcodestylesettingsfactory.h b/src/plugins/cpptools/cppcodestylesettingsfactory.h index 53681d6dd0..85c59d55ea 100644 --- a/src/plugins/cpptools/cppcodestylesettingsfactory.h +++ b/src/plugins/cpptools/cppcodestylesettingsfactory.h @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #ifndef CPPCODESTYLESETTINGSFACTORY_H #define CPPCODESTYLESETTINGSFACTORY_H diff --git a/src/plugins/cpptools/cppcodestylesettingspage.cpp b/src/plugins/cpptools/cppcodestylesettingspage.cpp index 6bb2013efc..426d3da5d2 100644 --- a/src/plugins/cpptools/cppcodestylesettingspage.cpp +++ b/src/plugins/cpptools/cppcodestylesettingspage.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "cppcodestylesettingspage.h" #include "cppcodestylepreferences.h" #include "ui_cppcodestylesettingspage.h" diff --git a/src/plugins/cpptools/cppcodestylesettingspage.h b/src/plugins/cpptools/cppcodestylesettingspage.h index b632f1cccc..dce545eede 100644 --- a/src/plugins/cpptools/cppcodestylesettingspage.h +++ b/src/plugins/cpptools/cppcodestylesettingspage.h @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #ifndef CPPCODESTYLESETTINGSPAGE_H #define CPPCODESTYLESETTINGSPAGE_H diff --git a/src/plugins/cpptools/cpptoolssettings.cpp b/src/plugins/cpptools/cpptoolssettings.cpp index c203b9e582..4160801161 100644 --- a/src/plugins/cpptools/cpptoolssettings.cpp +++ b/src/plugins/cpptools/cpptoolssettings.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "cpptoolssettings.h" #include "cpptoolsconstants.h" #include "cppcodestylepreferences.h" diff --git a/src/plugins/cpptools/cpptoolssettings.h b/src/plugins/cpptools/cpptoolssettings.h index 48712012af..cc0004bd7d 100644 --- a/src/plugins/cpptools/cpptoolssettings.h +++ b/src/plugins/cpptools/cpptoolssettings.h @@ -4,30 +4,29 @@ ** ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/debugger/breakpoint.cpp b/src/plugins/debugger/breakpoint.cpp index c8285f3f42..4d1f9c5be7 100644 --- a/src/plugins/debugger/breakpoint.cpp +++ b/src/plugins/debugger/breakpoint.cpp @@ -36,6 +36,7 @@ #include <QtCore/QByteArray> #include <QtCore/QDebug> +#include <QtCore/QFileInfo> namespace Debugger { namespace Internal { @@ -51,6 +52,9 @@ namespace Internal { This identifies a breakpoint in the \c BreakHandler. The major parts are strictly increasing over time. + + The minor part identifies a multiple breakpoint + set for example by gdb in constructors. */ @@ -105,6 +109,10 @@ BreakpointModelId BreakpointModelId::child(int row) const This is what the external debuggers use to identify a breakpoint. It is only valid for one debugger run. + + In gdb, the breakpoint number is used, which is constant + during a session. CDB's breakpoint numbers vary if breakpoints + are deleted, so, the ID is used. */ BreakpointResponseId::BreakpointResponseId(const QByteArray &ba) @@ -227,12 +235,17 @@ bool BreakpointParameters::conditionsMatch(const QByteArray &other) const return s1 == s2; } -void BreakpointParameters::setLocation(const QByteArray &location) +void BreakpointParameters::updateLocation(const QByteArray &location) { if (location.size()) { int pos = location.indexOf(':'); lineNumber = location.mid(pos + 1).toInt(); - fileName = QString::fromUtf8(location.left(pos)); + QString file = QString::fromUtf8(location.left(pos)); + if (file.startsWith(QLatin1Char('"')) && file.endsWith(QLatin1Char('"'))) + file = file.mid(1, file.size() - 2); + QFileInfo fi(file); + if (fi.isReadable()) + fileName = fi.absoluteFilePath(); } } diff --git a/src/plugins/debugger/breakpoint.h b/src/plugins/debugger/breakpoint.h index 8283132036..7e1fbe5856 100644 --- a/src/plugins/debugger/breakpoint.h +++ b/src/plugins/debugger/breakpoint.h @@ -209,7 +209,7 @@ public: bool isBreakpoint() const { return !isWatchpoint() && !isTracepoint(); } bool isTracepoint() const { return tracepoint; } QString toString() const; - void setLocation(const QByteArray &location); // file.cpp:42 + void updateLocation(const QByteArray &location); // file.cpp:42 bool operator==(const BreakpointParameters &p) const { return equals(p); } bool operator!=(const BreakpointParameters &p) const { return !equals(p); } diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index a2ea611039..9d2d1e3026 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -478,6 +478,7 @@ void CdbEngine::init() m_extensionMessageBuffer.clear(); m_pendingBreakpointMap.clear(); m_customSpecialStopData.clear(); + m_symbolAddressCache.clear(); // Create local list of mappings in native separators m_sourcePathMappings.clear(); @@ -1532,16 +1533,149 @@ void CdbEngine::selectThread(int index) postBuiltinCommand(cmd, 0, &CdbEngine::dummyHandler, CommandListStack); } +// Default address range for showing disassembly. +enum { DisassemblerRange = 512 }; + +/* Try to emulate gdb's behaviour: When passed an address, display + * the disassembled function. CDB's 'u' (disassemble) command takes a symbol, + * but does not display the whole function, only 10 lines per default. + * So, to ensure the agent's + * address is in that range, resolve the function symbol, cache it and + * request the disassembly for a range that contains the agent's address. */ + void CdbEngine::fetchDisassembler(DisassemblerAgent *agent) { QTC_ASSERT(m_accessible, return;) + const QString function = agent->location().functionName(); + const QString module = agent->location().from(); + const QVariant cookie = qVariantFromValue<DisassemblerAgent*>(agent); + if (function.isEmpty() || module.isEmpty()) { + // No function, display a default range. + postDisassemblerCommand(agent->address(), cookie); + } else { + postResolveSymbol(module, function, cookie); + } +} + +void CdbEngine::postDisassemblerCommand(quint64 address, const QVariant &cookie) +{ + postDisassemblerCommand(address - DisassemblerRange / 2, + address + DisassemblerRange / 2, cookie); +} + +void CdbEngine::postDisassemblerCommand(quint64 address, quint64 endAddress, + const QVariant &cookie) +{ QByteArray cmd; ByteArrayInputStream str(cmd); - str << "u " << hex << hexPrefixOn << agent->address() << " L40"; - const QVariant cookie = qVariantFromValue<DisassemblerAgent*>(agent); + str << "u " << hex <<hexPrefixOn << address << ' ' << endAddress; postBuiltinCommand(cmd, 0, &CdbEngine::handleDisassembler, 0, cookie); } +void CdbEngine::postResolveSymbol(const QString &module, const QString &function, + const QVariant &cookie) +{ + const QString symbol = module + QLatin1Char('!') + function; + const QList<quint64> addresses = m_symbolAddressCache.values(symbol); + if (addresses.isEmpty()) { + QVariantList cookieList; + cookieList << QVariant(symbol) << cookie; + showMessage(QLatin1String("Resolving symbol: ") + symbol, LogMisc); + postBuiltinCommand(QByteArray("x ") + symbol.toLatin1(), 0, + &CdbEngine::handleResolveSymbol, 0, + QVariant(cookieList)); + } else { + showMessage(QString::fromLatin1("Using cached addresses for %1."). + arg(symbol), LogMisc); + handleResolveSymbol(addresses, cookie); + } +} + +// Parse address from 'x' response. +// "00000001`3f7ebe80 module!foo (void)" +static inline quint64 resolvedAddress(const QByteArray &line) +{ + const int blankPos = line.indexOf(' '); + if (blankPos >= 0) { + QByteArray addressBA = line.left(blankPos); + if (addressBA.size() > 9 && addressBA.at(8) == '`') + addressBA.remove(8, 1); + bool ok; + const quint64 address = addressBA.toULongLong(&ok, 16); + if (ok) + return address; + } + return 0; +} + +void CdbEngine::handleResolveSymbol(const CdbBuiltinCommandPtr &command) +{ + QTC_ASSERT(command->cookie.type() == QVariant::List, return; ); + const QVariantList cookieList = command->cookie.toList(); + const QString symbol = cookieList.front().toString(); + // Insert all matches of (potentially) ambiguous symbols + if (const int size = command->reply.size()) { + for (int i = 0; i < size; i++) { + if (const quint64 address = resolvedAddress(command->reply.at(i))) { + m_symbolAddressCache.insert(symbol, address); + showMessage(QString::fromLatin1("Obtained 0x%1 for %2 (#%3)"). + arg(address, 0, 16).arg(symbol).arg(i + 1), LogMisc); + } + } + } else { + showMessage(QLatin1String("Symbol resolution failed: ") + + QString::fromLatin1(command->joinedReply()), + LogError); + } + handleResolveSymbol(m_symbolAddressCache.values(symbol), cookieList.back()); +} + +// Find the function address matching needle in a list of function +// addresses obtained from the 'x' command. Check for the +// mimimum POSITIVE offset (needle >= function address.) +static inline quint64 findClosestFunctionAddress(const QList<quint64> &addresses, + quint64 needle) +{ + const int size = addresses.size(); + if (!size) + return 0; + if (size == 1) + return addresses.front(); + int closestIndex = 0; + quint64 closestOffset = 0xFFFFFFFF; + for (int i = 0; i < size; i++) { + if (addresses.at(i) <= needle) { + const quint64 offset = needle - addresses.at(i); + if (offset < offset) { + closestOffset = offset; + closestIndex = i; + } + } + } + return addresses.at(closestIndex); +} + +void CdbEngine::handleResolveSymbol(const QList<quint64> &addresses, const QVariant &cookie) +{ + // Disassembly mode: Determine suitable range containing the + // agent's address within the function to display. + if (qVariantCanConvert<DisassemblerAgent*>(cookie)) { + DisassemblerAgent *agent = cookie.value<DisassemblerAgent *>(); + const quint64 agentAddress = agent->address(); + const quint64 functionAddress + = findClosestFunctionAddress(addresses, agentAddress); + if (functionAddress > 0 && functionAddress <= agentAddress) { + quint64 endAddress = agentAddress + DisassemblerRange / 2; + if (const quint64 remainder = endAddress % 8) + endAddress += 8 - remainder; + postDisassemblerCommand(functionAddress, endAddress, cookie); + } else { + postDisassemblerCommand(agentAddress, cookie); + } + return; + } +} + // Parse: "00000000`77606060 cc int 3" void CdbEngine::handleDisassembler(const CdbBuiltinCommandPtr &command) { @@ -2512,6 +2646,7 @@ void CdbEngine::attemptBreakpointSynchronization() BreakpointParameters parameters = handler->breakpointData(id); BreakpointResponse response; response.fromParameters(parameters); + response.id = BreakpointResponseId(id.majorPart(), id.minorPart()); // If we encountered that file and have a module for it: Add it. if (parameters.type == BreakpointByFileAndLine && parameters.module.isEmpty()) { const QHash<QString, QString>::const_iterator it = m_fileNameModuleHash.constFind(parameters.fileName); @@ -2833,14 +2968,14 @@ void CdbEngine::handleBreakPoints(const GdbMi &value) BreakHandler *handler = breakHandler(); foreach (const GdbMi &breakPointG, value.children()) { BreakpointResponse reportedResponse; - const BreakpointResponseId id = parseBreakPoint(breakPointG, &reportedResponse); + parseBreakPoint(breakPointG, &reportedResponse); if (debugBreakpoints) - qDebug(" Parsed %d: pending=%d %s\n", id.majorPart(), + qDebug(" Parsed %d: pending=%d %s\n", reportedResponse.id.majorPart(), reportedResponse.pending, qPrintable(reportedResponse.toString())); - - if (!reportedResponse.pending) { - BreakpointModelId mid = handler->findBreakpointByResponseId(id); + if (reportedResponse.id.isValid() && !reportedResponse.pending) { + const BreakpointModelId mid = handler->findBreakpointByResponseId(reportedResponse.id); + QTC_ASSERT(mid.isValid(), continue; ) const PendingBreakPointMap::iterator it = m_pendingBreakpointMap.find(mid); if (it != m_pendingBreakpointMap.end()) { // Complete the response and set on handler. @@ -2852,9 +2987,8 @@ void CdbEngine::handleBreakPoints(const GdbMi &value) currentResponse.enabled = reportedResponse.enabled; formatCdbBreakPointResponse(mid, currentResponse, str); if (debugBreakpoints) - qDebug(" Setting for %d: %s\n", id.majorPart(), + qDebug(" Setting for %d: %s\n", currentResponse.id.majorPart(), qPrintable(currentResponse.toString())); - BreakpointModelId mid = handler->findBreakpointByResponseId(id); handler->setResponse(mid, currentResponse); m_pendingBreakpointMap.erase(it); } diff --git a/src/plugins/debugger/cdb/cdbengine.h b/src/plugins/debugger/cdb/cdbengine.h index ef97f1fc72..9c21dd4b0a 100644 --- a/src/plugins/debugger/cdb/cdbengine.h +++ b/src/plugins/debugger/cdb/cdbengine.h @@ -40,6 +40,7 @@ #include <QtCore/QProcess> #include <QtCore/QVariantList> #include <QtCore/QMap> +#include <QtCore/QMultiHash> #include <QtCore/QTime> #include <QtCore/QPair> #include <QtCore/QList> @@ -211,8 +212,12 @@ private: void postWidgetAtCommand(); void handleCustomSpecialStop(const QVariant &v); void postFetchMemory(const MemoryViewCookie &c); + inline void postDisassemblerCommand(quint64 address, const QVariant &cookie = QVariant()); + void postDisassemblerCommand(quint64 address, quint64 endAddress, + const QVariant &cookie = QVariant()); + void postResolveSymbol(const QString &module, const QString &function, + const QVariant &cookie = QVariant()); void evaluateExpression(QByteArray exp, const QVariant &cookie = QVariant()); - // Builtin commands void dummyHandler(const CdbBuiltinCommandPtr &); void handleStackTrace(const CdbExtensionCommandPtr &); @@ -220,7 +225,10 @@ private: void handleDisassembler(const CdbBuiltinCommandPtr &); void handleJumpToLineAddressResolution(const CdbBuiltinCommandPtr &); void handleExpression(const CdbExtensionCommandPtr &); + void handleResolveSymbol(const CdbBuiltinCommandPtr &command); + void handleResolveSymbol(const QList<quint64> &addresses, const QVariant &cookie); void jumpToAddress(quint64 address); + // Extension commands void handleThreads(const CdbExtensionCommandPtr &); void handlePid(const CdbExtensionCommandPtr &reply); @@ -270,6 +278,7 @@ private: int m_watchPointY; PendingBreakPointMap m_pendingBreakpointMap; QHash<QString, QString> m_fileNameModuleHash; + QMultiHash<QString, quint64> m_symbolAddressCache; bool m_ignoreCdbOutput; QVariantList m_customSpecialStopData; QList<SourcePathMapping> m_sourcePathMappings; diff --git a/src/plugins/debugger/cdb/cdbparsehelpers.cpp b/src/plugins/debugger/cdb/cdbparsehelpers.cpp index 92cc42090b..bade3a09a9 100644 --- a/src/plugins/debugger/cdb/cdbparsehelpers.cpp +++ b/src/plugins/debugger/cdb/cdbparsehelpers.cpp @@ -298,21 +298,18 @@ static inline bool gdbmiChildToBool(const GdbMi &parent, const char *childName, // Parse extension command listing breakpoints. // Note that not all fields are returned, since file, line, function are encoded // in the expression (that is in addition deleted on resolving for a bp-type breakpoint). -BreakpointResponseId parseBreakPoint(const GdbMi &gdbmi, BreakpointResponse *r, - QString *expression /* = 0 */) +void parseBreakPoint(const GdbMi &gdbmi, BreakpointResponse *r, + QString *expression /* = 0 */) { - BreakpointResponseId id = BreakpointResponseId(-1); - int majorPart = 0; - gdbmiChildToInt(gdbmi, "number", &majorPart); gdbmiChildToBool(gdbmi, "enabled", &(r->enabled)); gdbmiChildToBool(gdbmi, "deferred", &(r->pending)); - r->id = BreakpointResponseId(majorPart); + r->id = BreakpointResponseId(); const GdbMi idG = gdbmi.findChild("id"); if (idG.isValid()) { // Might not be valid if there is not id bool ok; - const BreakpointResponseId cid(idG.data().toInt(&ok)); + const int id = idG.data().toInt(&ok); if (ok) - id = cid; + r->id = BreakpointResponseId(id); } const GdbMi moduleG = gdbmi.findChild("module"); if (moduleG.isValid()) @@ -328,7 +325,6 @@ BreakpointResponseId parseBreakPoint(const GdbMi &gdbmi, BreakpointResponse *r, if (gdbmiChildToInt(gdbmi, "passcount", &(r->ignoreCount))) r->ignoreCount--; gdbmiChildToInt(gdbmi, "thread", &(r->threadSpec)); - return id; } QByteArray cdbWriteMemoryCommand(quint64 addr, const QByteArray &data) diff --git a/src/plugins/debugger/cdb/cdbparsehelpers.h b/src/plugins/debugger/cdb/cdbparsehelpers.h index 66f453b1d6..15a281a878 100644 --- a/src/plugins/debugger/cdb/cdbparsehelpers.h +++ b/src/plugins/debugger/cdb/cdbparsehelpers.h @@ -69,7 +69,7 @@ QByteArray cdbAddBreakpointCommand(const BreakpointParameters &d, // Parse extension command listing breakpoints. // Note that not all fields are returned, since file, line, function are encoded // in the expression (that is in addition deleted on resolving for a bp-type breakpoint). -BreakpointResponseId parseBreakPoint(const GdbMi &gdbmi, BreakpointResponse *r, QString *expression = 0); +void parseBreakPoint(const GdbMi &gdbmi, BreakpointResponse *r, QString *expression = 0); // Convert a CDB integer value: '00000000`0012a290' -> '12a290', '0n10' ->'10' QByteArray fixCdbIntegerValue(QByteArray t, bool stripLeadingZeros = false, int *basePtr = 0); diff --git a/src/plugins/debugger/debuggerconstants.h b/src/plugins/debugger/debuggerconstants.h index 7ff518a5b3..14e71f2d2e 100644 --- a/src/plugins/debugger/debuggerconstants.h +++ b/src/plugins/debugger/debuggerconstants.h @@ -39,7 +39,7 @@ namespace Debugger { namespace Constants { // Debug mode -const char * const MODE_DEBUG = "Debugger.Mode.Debug"; +const char * const MODE_DEBUG = "Mode.Debug"; // Contexts const char * const C_DEBUGMODE = "Debugger.DebugMode"; @@ -48,7 +48,7 @@ const char * const C_QMLDEBUGGER = "Qml/JavaScript Debugger"; // Project Explorer run mode (RUN/DEBUG) const char * const DEBUGMODE = "Debugger.DebugMode"; -const char * const DEBUGMODE2 = "Debugger.DebugMode2"; +const char * const DEBUGMODE2 = "Debugger.DebugMode2"; // Breaks on main. // Common actions (accessed by QML inspector) const char * const INTERRUPT = "Debugger.Interrupt"; diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index a46841c2f1..904ced3355 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -97,6 +97,7 @@ Internal::Location::Location(const StackFrame &frame, bool marker) m_functionName = frame.function; m_hasDebugInfo = frame.isUsable(); m_address = frame.address; + m_from = frame.from; } QDebug operator<<(QDebug d, DebuggerState state) @@ -1508,7 +1509,7 @@ QString DebuggerEngine::msgWatchpointByExpressionTriggered(BreakpointModelId id, return id ? tr("Data breakpoint %1 (%2) at %3 in thread %4 triggered.") .arg(id.toString()).arg(number).arg(expr).arg(threadId) - : tr("Internal data breakpoint %1 at %2 in thread %4 triggered.") + : tr("Internal data breakpoint %1 at %2 in thread %3 triggered.") .arg(number).arg(expr).arg(threadId); } diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index 8fc593c8e9..7fabfd253d 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -100,6 +100,7 @@ public: Location(const StackFrame &frame, bool marker = true); QString fileName() const { return m_fileName; } QString functionName() const { return m_functionName; } + QString from() const { return m_from; } int lineNumber() const { return m_lineNumber; } void setNeedsRaise(bool on) { m_needsRaise = on; } void setNeedsMarker(bool on) { m_needsMarker = on; } @@ -118,6 +119,7 @@ private: int m_lineNumber; QString m_fileName; QString m_functionName; + QString m_from; quint64 m_address; }; diff --git a/src/plugins/debugger/debuggersourcepathmappingwidget.cpp b/src/plugins/debugger/debuggersourcepathmappingwidget.cpp index c26c690d34..645d4baeef 100644 --- a/src/plugins/debugger/debuggersourcepathmappingwidget.cpp +++ b/src/plugins/debugger/debuggersourcepathmappingwidget.cpp @@ -361,7 +361,7 @@ void DebuggerSourcePathMappingWidget::slotAddQt() if (qtSourcesPath.isEmpty()) return; const size_t buildPathCount = sizeof(qtBuildPaths)/sizeof(qtBuildPaths[0]); - for (size_t i = 0; i < buildPathCount; ++i) + for (size_t i = 0; i != buildPathCount; ++i) // use != to avoid 0<0 which triggers warning on Mac m_model->addMapping(QString::fromLatin1(qtBuildPaths[i]), qtSourcesPath); resizeColumns(); setCurrentRow(m_model->rowCount() - 1); @@ -403,7 +403,7 @@ DebuggerSourcePathMappingWidget::SourcePathMap if (qtInstallPath.isEmpty() || buildPathCount == 0) return rc; - for (size_t i = 0; i < buildPathCount; i++) { + for (size_t i = 0; i != buildPathCount; ++i) { // use != to avoid 0<0 which triggers warning on Mac const QString buildPath = QString::fromLatin1(qtBuildPaths[i]); if (!rc.contains(buildPath)) // Do not overwrite user settings. rc.insert(buildPath, qtInstallPath); diff --git a/src/plugins/debugger/disassembleragent.cpp b/src/plugins/debugger/disassembleragent.cpp index ca63193ee7..80d58ad7f2 100644 --- a/src/plugins/debugger/disassembleragent.cpp +++ b/src/plugins/debugger/disassembleragent.cpp @@ -56,6 +56,8 @@ #include <QtGui/QTextBlock> #include <QtGui/QIcon> #include <QtCore/QPointer> +#include <QtCore/QPair> +#include <QtCore/QDir> using namespace Core; using namespace TextEditor; @@ -69,6 +71,27 @@ namespace Internal { // /////////////////////////////////////////////////////////////////////// +class FrameKey +{ +public: + FrameKey() : startAddress(0), endAddress(0) {} + inline bool matches(const Location &loc) const; + + QString functionName; + QString fileName; + quint64 startAddress; + quint64 endAddress; +}; + +bool FrameKey::matches(const Location &loc) const +{ + return loc.address() >= startAddress + && loc.address() < endAddress + && loc.fileName() == fileName && loc.functionName() == functionName; +} + +typedef QPair<FrameKey, DisassemblerLines> CacheEntry; + class DisassemblerAgentPrivate { public: @@ -83,8 +106,9 @@ public: QPointer<DebuggerEngine> engine; ITextMark *locationMark; QList<ITextMark *> breakpointMarks; - - QHash<QString, DisassemblerLines> cache; + + QList<CacheEntry> cache; + QString mimeType; bool m_resetLocationScheduled; }; @@ -130,6 +154,14 @@ DisassemblerAgent::~DisassemblerAgent() d = 0; } +int DisassemblerAgent::indexOf(const Location &loc) const +{ + for (int i = 0; i < d->cache.size(); i++) + if (d->cache.at(i).first.matches(loc)) + return i; + return -1; +} + void DisassemblerAgent::cleanup() { d->cache.clear(); @@ -150,12 +182,6 @@ void DisassemblerAgent::resetLocation() } } -static QString frameKey(const Location &loc) -{ - return _("%1:%2:%3").arg(loc.functionName()) - .arg(loc.fileName()).arg(loc.address()); -} - const Location &DisassemblerAgent::location() const { return d->location; @@ -172,20 +198,28 @@ bool DisassemblerAgent::isMixed() const void DisassemblerAgent::setLocation(const Location &loc) { d->location = loc; - if (isMixed()) { - QHash<QString, DisassemblerLines>::ConstIterator it = - d->cache.find(frameKey(loc)); - if (it != d->cache.end()) { - QString msg = _("Use cache disassembler for '%1' in '%2'") - .arg(loc.functionName()).arg(loc.fileName()); - d->engine->showMessage(msg); - setContents(*it); - updateBreakpointMarkers(); - updateLocationMarker(); - return; + int index = indexOf(loc); + if (index != -1) { + // Refresh when not displaying a function and there is not sufficient + // context left past the address. + if (!isMixed() && d->cache.at(index).first.endAddress - loc.address() < 24) { + index = -1; + d->cache.removeAt(index); } } - d->engine->fetchDisassembler(this); + if (index != -1) { + const FrameKey &key = d->cache.at(index).first; + const QString msg = + _("Using cached disassembly for 0x%1 (0x%2-0x%3) in '%4'/ '%5'") + .arg(loc.address(), 0, 16) + .arg(key.startAddress, 0, 16).arg(key.endAddress, 0, 16) + .arg(loc.functionName(), QDir::toNativeSeparators(loc.fileName())); + d->engine->showMessage(msg); + setContentsToEditor(d->cache.at(index).second); + d->m_resetLocationScheduled = false; // In case reset from previous run still pending. + } else { + d->engine->fetchDisassembler(this); + } } void DisassemblerAgentPrivate::configureMimeType() @@ -225,6 +259,24 @@ void DisassemblerAgent::setMimeType(const QString &mt) void DisassemblerAgent::setContents(const DisassemblerLines &contents) { QTC_ASSERT(d, return); + if (contents.size()) { + const quint64 startAddress = contents.startAddress(); + const quint64 endAddress = contents.endAddress(); + if (startAddress) { + FrameKey key; + key.fileName = d->location.fileName(); + key.functionName = d->location.functionName(); + key.startAddress = startAddress; + key.endAddress = endAddress; + d->cache.append(CacheEntry(key, contents)); + } + } + setContentsToEditor(contents); +} + +void DisassemblerAgent::setContentsToEditor(const DisassemblerLines &contents) +{ + QTC_ASSERT(d, return); using namespace Core; using namespace TextEditor; @@ -260,7 +312,6 @@ void DisassemblerAgent::setContents(const DisassemblerLines &contents) plainTextEdit->setPlainText(str); plainTextEdit->setReadOnly(true); - d->cache.insert(frameKey(d->location), contents); d->editor->setDisplayName(_("Disassembler (%1)") .arg(d->location.functionName())); @@ -272,9 +323,10 @@ void DisassemblerAgent::updateLocationMarker() { QTC_ASSERT(d->editor, return); - const DisassemblerLines &contents = d->cache.value(frameKey(d->location)); + const int index = indexOf(d->location); + const DisassemblerLines contents = index != -1 ? + d->cache.at(index).second : DisassemblerLines(); int lineNumber = contents.lineForAddress(d->location.address()); - if (d->location.needsMarker()) { d->editor->markableInterface()->removeMark(d->locationMark); if (lineNumber) @@ -300,8 +352,9 @@ void DisassemblerAgent::updateBreakpointMarkers() if (ids.isEmpty()) return; - const DisassemblerLines &contents = d->cache.value(frameKey(d->location)); - + const int index = indexOf(d->location); + const DisassemblerLines contents = index != -1 ? + d->cache.at(index).second : DisassemblerLines(); foreach (TextEditor::ITextMark *marker, d->breakpointMarks) d->editor->markableInterface()->removeMark(marker); d->breakpointMarks.clear(); diff --git a/src/plugins/debugger/disassembleragent.h b/src/plugins/debugger/disassembleragent.h index 71665e4221..fea7c84882 100644 --- a/src/plugins/debugger/disassembleragent.h +++ b/src/plugins/debugger/disassembleragent.h @@ -72,6 +72,9 @@ public: bool isMixed() const; private: + void setContentsToEditor(const DisassemblerLines &contents); + int indexOf(const Location &loc) const; + DisassemblerAgentPrivate *d; }; diff --git a/src/plugins/debugger/disassemblerlines.cpp b/src/plugins/debugger/disassemblerlines.cpp index 2e2bad655e..4beee54169 100644 --- a/src/plugins/debugger/disassemblerlines.cpp +++ b/src/plugins/debugger/disassemblerlines.cpp @@ -80,6 +80,22 @@ quint64 DisassemblerLine::addressFromDisassemblyLine(const QString &line) return l.address; } +quint64 DisassemblerLines::startAddress() const +{ + for (int i = 0; i < m_data.size(); ++i) + if (m_data.at(i).address) + return m_data.at(i).address; + return 0; +} + +quint64 DisassemblerLines::endAddress() const +{ + for (int i = m_data.size()- 1; i >= 0; --i) + if (m_data.at(i).address) + return m_data.at(i).address; + return 0; +} + int DisassemblerLines::lineForAddress(quint64 address) const { return m_rowCache.value(address); diff --git a/src/plugins/debugger/disassemblerlines.h b/src/plugins/debugger/disassemblerlines.h index ae0160e638..59cf0a1255 100644 --- a/src/plugins/debugger/disassemblerlines.h +++ b/src/plugins/debugger/disassemblerlines.h @@ -83,6 +83,9 @@ public: const DisassemblerLine &at(int i) const { return m_data.at(i); } int lineForAddress(quint64 address) const; + quint64 startAddress() const; + quint64 endAddress() const; + private: QString m_lastFunction; QVector<DisassemblerLine> m_data; diff --git a/src/plugins/debugger/gdb/abstractplaingdbadapter.cpp b/src/plugins/debugger/gdb/abstractplaingdbadapter.cpp index f492bcd378..6fe2477253 100644 --- a/src/plugins/debugger/gdb/abstractplaingdbadapter.cpp +++ b/src/plugins/debugger/gdb/abstractplaingdbadapter.cpp @@ -120,7 +120,7 @@ void AbstractPlainGdbAdapter::handleInfoTarget(const GdbResponse &response) // [some leading stdout here] // >&" Entry point: 0x80831f0 0x08048134 - 0x08048147 is .interp\n" // [some trailing stdout here] - QString msg = _(response.data.findChild("consolestreamoutput").data()); + QString msg = _(response.consoleStreamOutput); QRegExp needle(_("\\bEntry point: 0x([0-9a-f]+)\\b")); if (needle.indexIn(msg) != -1) { m_engine->m_entryPoint = diff --git a/src/plugins/debugger/gdb/classicgdbengine.cpp b/src/plugins/debugger/gdb/classicgdbengine.cpp index 8912bb8848..51ee1b6be1 100644 --- a/src/plugins/debugger/gdb/classicgdbengine.cpp +++ b/src/plugins/debugger/gdb/classicgdbengine.cpp @@ -676,8 +676,7 @@ static bool isAccessSpecifier(const QByteArray &ba) // reads a MI-encoded item frome the consolestream static bool parseConsoleStream(const GdbResponse &response, GdbMi *contents) { - GdbMi output = response.data.findChild("consolestreamoutput"); - QByteArray out = output.data(); + QByteArray out = response.consoleStreamOutput; int markerPos = out.indexOf('"') + 1; // position of 'success marker' if (markerPos == 0 || out.at(markerPos) == 'f') { // 't' or 'f' @@ -1016,7 +1015,7 @@ void GdbEngine::handleDebuggingHelperValue3Classic(const GdbResponse &response) { if (response.resultClass == GdbResultDone) { WatchData data = response.cookie.value<WatchData>(); - QByteArray out = response.data.findChild("consolestreamoutput").data(); + QByteArray out = response.consoleStreamOutput; while (out.endsWith(' ') || out.endsWith('\n')) out.chop(1); QList<QByteArray> list = out.split(' '); diff --git a/src/plugins/debugger/gdb/coregdbadapter.cpp b/src/plugins/debugger/gdb/coregdbadapter.cpp index 7527795c99..6b80ce102c 100644 --- a/src/plugins/debugger/gdb/coregdbadapter.cpp +++ b/src/plugins/debugger/gdb/coregdbadapter.cpp @@ -124,16 +124,16 @@ void CoreGdbAdapter::handleTemporaryTargetCore(const GdbResponse &response) return; } - GdbMi console = response.data.findChild("consolestreamoutput"); - int pos1 = console.data().indexOf('`'); - int pos2 = console.data().indexOf('\''); + QByteArray console = response.consoleStreamOutput; + int pos1 = console.indexOf('`'); + int pos2 = console.indexOf('\''); if (pos1 == -1 || pos2 == -1) { showMessage(tr("Attach to core failed."), StatusBar); m_engine->notifyEngineSetupFailed(); return; } - m_executable = console.data().mid(pos1 + 1, pos2 - pos1 - 1); + m_executable = console.mid(pos1 + 1, pos2 - pos1 - 1); // Strip off command line arguments. FIXME: make robust. int idx = m_executable.indexOf(_c(' ')); if (idx >= 0) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 2227b12ae3..f956c22cf8 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -171,8 +171,7 @@ static int ¤tToken() static QByteArray parsePlainConsoleStream(const GdbResponse &response) { - GdbMi output = response.data.findChild("consolestreamoutput"); - QByteArray out = output.data(); + QByteArray out = response.consoleStreamOutput; // FIXME: proper decoding needed if (out.endsWith("\\n")) out.chop(2); @@ -653,10 +652,8 @@ void GdbEngine::handleResponse(const QByteArray &buff) //qDebug() << "\nLOG STREAM:" + m_pendingLogStreamOutput; //qDebug() << "\nCONSOLE STREAM:" + m_pendingConsoleStreamOutput; - response.data.setStreamOutput("logstreamoutput", - m_pendingLogStreamOutput); - response.data.setStreamOutput("consolestreamoutput", - m_pendingConsoleStreamOutput); + response.logStreamOutput = m_pendingLogStreamOutput; + response.consoleStreamOutput = m_pendingConsoleStreamOutput; m_pendingLogStreamOutput.clear(); m_pendingConsoleStreamOutput.clear(); @@ -1070,8 +1067,8 @@ void GdbEngine::handleResultRecord(GdbResponse *response) // Happens with some incarnations of gdb 6.8 for "jump to line" // (response->resultClass == GdbResultDone && cmd.command.startsWith("jump")) // (response->resultClass == GdbResultDone && cmd.command.startsWith("detach")) - // Happens when stepping finishes very quickly and issues *stopped/^done - // instead of ^running/*stopped + // Happens when stepping finishes very quickly and issues *stopped and ^done + // instead of ^running and *stopped // (response->resultClass == GdbResultDone && (cmd.flags & RunRequest)); if (!isExpectedResult) { @@ -1688,7 +1685,7 @@ void GdbEngine::handleInfoProc(const GdbResponse &response) if (response.resultClass == GdbResultDone) { static QRegExp re(_("\\bprocess ([0-9]+)\n")); QTC_ASSERT(re.isValid(), return); - if (re.indexIn(_(response.data.findChild("consolestreamoutput").data())) != -1) + if (re.indexIn(_(response.consoleStreamOutput)) != -1) maybeHandleInferiorPidChanged(re.cap(1)); } } @@ -1700,8 +1697,7 @@ void GdbEngine::handleShowVersion(const GdbResponse &response) m_gdbVersion = 100; m_gdbBuildVersion = -1; m_isMacGdb = false; - GdbMi version = response.data.findChild("consolestreamoutput"); - QString msg = QString::fromLocal8Bit(version.data()); + QString msg = QString::fromLocal8Bit(response.consoleStreamOutput); extractGdbVersion(msg, &m_gdbVersion, &m_gdbBuildVersion, &m_isMacGdb); if (m_gdbVersion > 60500 && m_gdbVersion < 200000) @@ -1726,9 +1722,8 @@ void GdbEngine::handleHasPython(const GdbResponse &response) { if (response.resultClass == GdbResultDone) { m_hasPython = true; - GdbMi contents = response.data.findChild("consolestreamoutput"); GdbMi data; - data.fromStringMultiple(contents.data()); + data.fromStringMultiple(response.consoleStreamOutput); const GdbMi dumpers = data.findChild("dumpers"); foreach (const GdbMi &dumper, dumpers.children()) { QByteArray type = dumper.findChild("type").data(); @@ -2386,7 +2381,7 @@ void GdbEngine::updateResponse(BreakpointResponse &response, const GdbMi &bkpt) response.fileName = name; if (response.fileName.isEmpty()) - response.setLocation(originalLocation); + response.updateLocation(originalLocation); } QString GdbEngine::breakLocation(const QString &file) const @@ -2442,7 +2437,7 @@ void GdbEngine::handleWatchInsert(const GdbResponse &response) BreakHandler *handler = breakHandler(); BreakpointResponse br = handler->response(id); // "Hardware watchpoint 2: *0xbfffed40\n" - QByteArray ba = response.data.findChild("consolestreamoutput").data(); + QByteArray ba = response.consoleStreamOutput; GdbMi wpt = response.data.findChild("wpt"); if (wpt.isValid()) { // Mac yields: @@ -2517,6 +2512,7 @@ void GdbEngine::handleBreakInsert1(const GdbResponse &response) foreach (const GdbMi bkpt, response.data.children()) { nr = bkpt.findChild("number").data(); rid = BreakpointResponseId(nr); + QTC_ASSERT(rid.isValid(), continue); if (nr.contains('.')) { // A sub-breakpoint. BreakpointResponse sub; @@ -2664,8 +2660,7 @@ void GdbEngine::handleBreakListMultiple(const GdbResponse &response) { QTC_ASSERT(response.resultClass == GdbResultDone, /**/) const BreakpointModelId id = response.cookie.value<BreakpointModelId>(); - const QString str = QString::fromLocal8Bit( - response.data.findChild("consolestreamoutput").data()); + const QString str = QString::fromLocal8Bit(response.consoleStreamOutput); extractDataFromInfoBreak(str, id); } @@ -2720,7 +2715,7 @@ void GdbEngine::handleBreakIgnore(const GdbResponse &response) // // gdb 6.3 does not produce any console output QTC_ASSERT(response.resultClass == GdbResultDone, /**/) - QString msg = _(response.data.findChild("consolestreamoutput").data()); + //QString msg = _(response.consoleStreamOutput); BreakpointModelId id = response.cookie.value<BreakpointModelId>(); BreakHandler *handler = breakHandler(); BreakpointResponse br = handler->response(id); @@ -2847,8 +2842,8 @@ void GdbEngine::extractDataFromInfoBreak(const QString &output, BreakpointModelI BreakpointResponse sub; sub.address = address; sub.functionName = QString::fromUtf8(function); - sub.setLocation(location); - sub.id = subId; + sub.updateLocation(location); + sub.id = BreakpointResponseId(majorPart, minorPart); sub.type = response.type; sub.address = address; handler->insertSubBreakpoint(id, sub); @@ -2863,7 +2858,20 @@ void GdbEngine::extractDataFromInfoBreak(const QString &output, BreakpointModelI } } } - // Commit main data. + if (minorPart) { + // Commit last chunk. + BreakpointResponse sub; + sub.address = address; + sub.functionName = QString::fromUtf8(function); + sub.updateLocation(location); + sub.id = BreakpointResponseId(majorPart, minorPart); + sub.type = response.type; + sub.address = address; + handler->insertSubBreakpoint(id, sub); + location.clear(); + function.clear(); + address = 0; + } } else { qDebug() << "COULD NOT MATCH" << output; response.id = BreakpointResponseId(); // Unavailable. @@ -2877,7 +2885,7 @@ void GdbEngine::handleInfoLine(const GdbResponse &response) // Old-style output: "Line 1102 of \"simple/app.cpp\" starts // at address 0x80526aa <_Z10...+131> and ends at 0x80526b5 // <_Z10testQStackv+142>.\n" - QByteArray ba = response.data.findChild("consolestreamoutput").data(); + QByteArray ba = response.consoleStreamOutput; const BreakpointModelId id = response.cookie.value<BreakpointModelId>(); const int pos = ba.indexOf(' ', 5); if (ba.startsWith("Line ") && pos != -1) { @@ -3201,8 +3209,7 @@ void GdbEngine::handleModulesList(const GdbResponse &response) if (response.resultClass == GdbResultDone) { // That's console-based output, likely Linux or Windows, // but we can avoid the target dependency here. - QString data = QString::fromLocal8Bit( - response.data.findChild("consolestreamoutput").data()); + QString data = QString::fromLocal8Bit(response.consoleStreamOutput); QTextStream ts(&data, QIODevice::ReadOnly); while (!ts.atEnd()) { QString line = ts.readLine(); @@ -3378,7 +3385,7 @@ void GdbEngine::handleStackListFrames(const GdbResponse &response) if (!handleIt) { // That always happens on symbian gdb with // ^error,data={msg="Previous frame identical to this frame (corrupt stack?)" - // logstreamoutput="Previous frame identical to this frame (corrupt stack?)\n" + // logStreamOutput: "Previous frame identical to this frame (corrupt stack?)\n" //qDebug() << "LISTING STACK FAILED: " << response.toString(); reloadRegisters(); return; @@ -3504,9 +3511,8 @@ void GdbEngine::handleThreadListIds(const GdbResponse &response) void GdbEngine::handleThreadNames(const GdbResponse &response) { if (response.resultClass == GdbResultDone) { - GdbMi contents = response.data.findChild("consolestreamoutput"); GdbMi names; - names.fromString(contents.data()); + names.fromString(response.consoleStreamOutput); Threads threads = threadsHandler()->threads(); @@ -4406,28 +4412,26 @@ DisassemblerLines GdbEngine::parseMiDisassembler(const GdbMi &lines) return result; } -DisassemblerLines GdbEngine::parseCliDisassembler(const GdbMi &output) +DisassemblerLines GdbEngine::parseCliDisassembler(const QByteArray &output) { - const QString someSpace = _(" "); // First line is something like // "Dump of assembler code from 0xb7ff598f to 0xb7ff5a07:" DisassemblerLines dlines; - foreach (const QByteArray &line, output.data().split('\n')) + foreach (const QByteArray &line, output.split('\n')) dlines.appendUnparsed(_(line)); return dlines; } -DisassemblerLines GdbEngine::parseDisassembler(const GdbMi &data) +DisassemblerLines GdbEngine::parseDisassembler(const GdbResponse &response) { // Apple's gdb produces MI output even for CLI commands. // FIXME: Check whether wrapping this into -interpreter-exec console // (i.e. usgind the 'ConsoleCommand' GdbCommandFlag makes a // difference. - GdbMi lines = data.findChild("asm_insns"); + GdbMi lines = response.data.findChild("asm_insns"); if (lines.isValid()) return parseMiDisassembler(lines); - GdbMi output = data.findChild("consolestreamoutput"); - return parseCliDisassembler(output); + return parseCliDisassembler(response.consoleStreamOutput); } void GdbEngine::handleDisassemblerCheck(const GdbResponse &response) @@ -4441,7 +4445,7 @@ void GdbEngine::handleFetchDisassemblerByCliPointMixed(const GdbResponse &respon QTC_ASSERT(ac.agent, return); if (response.resultClass == GdbResultDone) { - DisassemblerLines dlines = parseDisassembler(response.data); + DisassemblerLines dlines = parseDisassembler(response); if (dlines.coversAddress(ac.agent->address())) { ac.agent->setContents(dlines); return; @@ -4456,7 +4460,7 @@ void GdbEngine::handleFetchDisassemblerByCliPointPlain(const GdbResponse &respon QTC_ASSERT(ac.agent, return); if (response.resultClass == GdbResultDone) { - DisassemblerLines dlines = parseDisassembler(response.data); + DisassemblerLines dlines = parseDisassembler(response); if (dlines.coversAddress(ac.agent->address())) { ac.agent->setContents(dlines); return; @@ -4474,7 +4478,7 @@ void GdbEngine::handleFetchDisassemblerByCliRangeMixed(const GdbResponse &respon QTC_ASSERT(ac.agent, return); if (response.resultClass == GdbResultDone) { - DisassemblerLines dlines = parseDisassembler(response.data); + DisassemblerLines dlines = parseDisassembler(response); if (dlines.coversAddress(ac.agent->address())) { ac.agent->setContents(dlines); return; @@ -4489,7 +4493,7 @@ void GdbEngine::handleFetchDisassemblerByCliRangePlain(const GdbResponse &respon QTC_ASSERT(ac.agent, return); if (response.resultClass == GdbResultDone) { - DisassemblerLines dlines = parseDisassembler(response.data); + DisassemblerLines dlines = parseDisassembler(response); if (dlines.size()) { ac.agent->setContents(dlines); return; @@ -4992,8 +4996,7 @@ void GdbEngine::handleCreateFullBacktrace(const GdbResponse &response) { if (response.resultClass == GdbResultDone) { debuggerCore()->openTextEditor(_("Backtrace $"), - _(response.data.findChild("consolestreamoutput").data() - + response.data.findChild("logstreamoutput").data())); + _(response.consoleStreamOutput + response.logStreamOutput)); } } @@ -5040,8 +5043,8 @@ void GdbEngine::handleSetQmlStepBreakpoint(const GdbResponse &response) { //QTC_ASSERT(state() == EngineRunRequested, qDebug() << state()); if (response.resultClass == GdbResultDone) { - // "{logstreamoutput="tbreak 'myns::QScript::FunctionWrapper::proxyCall'\n" - //,consolestreamoutput="Temporary breakpoint 1 at 0xf166e7: + // logStreamOutput: "tbreak 'myns::QScript::FunctionWrapper::proxyCall'\n" + // consoleStreamOutput: "Temporary breakpoint 1 at 0xf166e7: // file bridge/qscriptfunction.cpp, line 75.\n"} QByteArray ba = parsePlainConsoleStream(response); const int pos2 = ba.indexOf(" at 0x"); diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index 3c610ca034..99d869e388 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -568,9 +568,9 @@ private: ////////// View & Data Stuff ////////// //void handleFetchDisassemblerByMiRangePlain(const GdbResponse &response); void handleDisassemblerCheck(const GdbResponse &response); void handleBreakOnQFatal(const GdbResponse &response); - DisassemblerLines parseDisassembler(const GdbMi &data); - DisassemblerLines parseCliDisassembler(const GdbMi &lines); - DisassemblerLines parseMiDisassembler(const GdbMi &lines); + DisassemblerLines parseDisassembler(const GdbResponse &response); + DisassemblerLines parseCliDisassembler(const QByteArray &response); + DisassemblerLines parseMiDisassembler(const GdbMi &response); bool m_disassembleUsesComma; diff --git a/src/plugins/debugger/gdb/gdbmi.cpp b/src/plugins/debugger/gdb/gdbmi.cpp index 17abe88637..080916037a 100644 --- a/src/plugins/debugger/gdb/gdbmi.cpp +++ b/src/plugins/debugger/gdb/gdbmi.cpp @@ -228,19 +228,6 @@ void GdbMi::parseList(const char *&from, const char *to) } } -void GdbMi::setStreamOutput(const QByteArray &name, const QByteArray &content) -{ - if (content.isEmpty()) - return; - GdbMi child; - child.m_type = Const; - child.m_name = name; - child.m_data = content; - m_children += child; - if (m_type == Invalid) - m_type = Tuple; -} - static QByteArray ind(int indent) { return QByteArray(2 * indent, ' '); diff --git a/src/plugins/debugger/gdb/gdbmi.h b/src/plugins/debugger/gdb/gdbmi.h index 09cc4cc98a..c975ba1cad 100644 --- a/src/plugins/debugger/gdb/gdbmi.h +++ b/src/plugins/debugger/gdb/gdbmi.h @@ -130,7 +130,6 @@ public: qulonglong toAddress() const; void fromString(const QByteArray &str); void fromStringMultiple(const QByteArray &str); - void setStreamOutput(const QByteArray &name, const QByteArray &content); private: friend class GdbResponse; @@ -170,6 +169,8 @@ public: GdbResultClass resultClass; GdbMi data; QVariant cookie; + QByteArray logStreamOutput; + QByteArray consoleStreamOutput; }; void extractGdbVersion(const QString &msg, diff --git a/src/plugins/debugger/gdb/gdboptionspage.ui b/src/plugins/debugger/gdb/gdboptionspage.ui index 9445a0d837..6fb810fca1 100644 --- a/src/plugins/debugger/gdb/gdboptionspage.ui +++ b/src/plugins/debugger/gdb/gdboptionspage.ui @@ -154,7 +154,7 @@ on slow machines. In this case, the value should be increased.</string> <string>This is the slowest but safest option.</string> </property> <property name="text"> - <string>Try to set breakpoints in plugins always automatically</string> + <string>Always try to set breakpoints in plugins automatically</string> </property> </widget> </item> diff --git a/src/plugins/debugger/gdb/pythongdbengine.cpp b/src/plugins/debugger/gdb/pythongdbengine.cpp index 50ffd4bc0d..81d5ca302b 100644 --- a/src/plugins/debugger/gdb/pythongdbengine.cpp +++ b/src/plugins/debugger/gdb/pythongdbengine.cpp @@ -135,7 +135,7 @@ void GdbEngine::handleStackFramePython(const GdbResponse &response) PRECONDITION; if (response.resultClass == GdbResultDone) { const bool partial = response.cookie.toBool(); - QByteArray out = response.data.findChild("consolestreamoutput").data(); + QByteArray out = response.consoleStreamOutput; while (out.endsWith(' ') || out.endsWith('\n')) out.chop(1); int pos = out.indexOf("data="); diff --git a/src/plugins/debugger/gdb/remotegdbprocess.cpp b/src/plugins/debugger/gdb/remotegdbprocess.cpp index f32af660e0..124e43f620 100644 --- a/src/plugins/debugger/gdb/remotegdbprocess.cpp +++ b/src/plugins/debugger/gdb/remotegdbprocess.cpp @@ -98,7 +98,8 @@ void RemoteGdbProcess::realStart(const QString &cmd, const QStringList &args, handleConnected(); } else { connect(m_conn.data(), SIGNAL(connected()), this, SLOT(handleConnected())); - m_conn->connectToHost(); + if (m_conn->state() == SshConnection::Unconnected) + m_conn->connectToHost(); } } diff --git a/src/plugins/debugger/stackwindow.cpp b/src/plugins/debugger/stackwindow.cpp index d547b6a423..92e0722e7a 100644 --- a/src/plugins/debugger/stackwindow.cpp +++ b/src/plugins/debugger/stackwindow.cpp @@ -173,7 +173,7 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev) else if (act == actAdjust) resizeColumnsToContents(); else if (act == actShowMemory) { - const QString title = tr("Memory at Frame #%1 (%2) 0x%3)"). + const QString title = tr("Memory at Frame #%1 (%2) 0x%3"). arg(row).arg(frame.function).arg(address, 0, 16); QList<MemoryMarkup> ml; ml.push_back(MemoryMarkup(address, 1, QColor(Qt::blue).lighter(), diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index 10ed4fe1e6..9bad66fcf9 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -462,7 +462,7 @@ static inline void addStackLayoutMemoryView(DebuggerEngine *engine, regMap, true, background); const unsigned flags = separateView ? (DebuggerEngine::MemoryView|DebuggerEngine::MemoryReadOnly) : 0; const QString title = - WatchWindow::tr("Memory Layout of Local Variables at 0x%2").arg(start, 0, 16); + WatchWindow::tr("Memory Layout of Local Variables at 0x%1").arg(start, 0, 16); engine->openMemoryView(start, flags, markup, p, title, parent); } diff --git a/src/plugins/designer/qt_private/abstractnewformwidget_p.h b/src/plugins/designer/qt_private/abstractnewformwidget_p.h index 7ac5dd2937..aaf1d1086e 100644 --- a/src/plugins/designer/qt_private/abstractnewformwidget_p.h +++ b/src/plugins/designer/qt_private/abstractnewformwidget_p.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/designer/qt_private/abstractoptionspage_p.h b/src/plugins/designer/qt_private/abstractoptionspage_p.h index 242f00f413..e0b0fd75c4 100644 --- a/src/plugins/designer/qt_private/abstractoptionspage_p.h +++ b/src/plugins/designer/qt_private/abstractoptionspage_p.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/designer/qt_private/abstractsettings_p.h b/src/plugins/designer/qt_private/abstractsettings_p.h index 736907f411..ca7615049c 100644 --- a/src/plugins/designer/qt_private/abstractsettings_p.h +++ b/src/plugins/designer/qt_private/abstractsettings_p.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/designer/qt_private/formwindowbase_p.h b/src/plugins/designer/qt_private/formwindowbase_p.h index 56a02babe1..99239adb91 100644 --- a/src/plugins/designer/qt_private/formwindowbase_p.h +++ b/src/plugins/designer/qt_private/formwindowbase_p.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/designer/qt_private/iconloader_p.h b/src/plugins/designer/qt_private/iconloader_p.h index 7cdd4a8105..b2eca12a9d 100644 --- a/src/plugins/designer/qt_private/iconloader_p.h +++ b/src/plugins/designer/qt_private/iconloader_p.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/designer/qt_private/pluginmanager_p.h b/src/plugins/designer/qt_private/pluginmanager_p.h index 6ca5003296..f1edc70836 100644 --- a/src/plugins/designer/qt_private/pluginmanager_p.h +++ b/src/plugins/designer/qt_private/pluginmanager_p.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/designer/qt_private/qdesigner_formwindowmanager_p.h b/src/plugins/designer/qt_private/qdesigner_formwindowmanager_p.h index 8c3a95d5ca..539a3a99aa 100644 --- a/src/plugins/designer/qt_private/qdesigner_formwindowmanager_p.h +++ b/src/plugins/designer/qt_private/qdesigner_formwindowmanager_p.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/designer/qt_private/qdesigner_integration_p.h b/src/plugins/designer/qt_private/qdesigner_integration_p.h index 3014b00d39..af6ad5c9a4 100644 --- a/src/plugins/designer/qt_private/qdesigner_integration_p.h +++ b/src/plugins/designer/qt_private/qdesigner_integration_p.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/designer/qt_private/qsimpleresource_p.h b/src/plugins/designer/qt_private/qsimpleresource_p.h index 19cf8d5239..506efaf61c 100644 --- a/src/plugins/designer/qt_private/qsimpleresource_p.h +++ b/src/plugins/designer/qt_private/qsimpleresource_p.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/designer/qt_private/qtresourcemodel_p.h b/src/plugins/designer/qt_private/qtresourcemodel_p.h index 8361642052..b132eeb8b2 100644 --- a/src/plugins/designer/qt_private/qtresourcemodel_p.h +++ b/src/plugins/designer/qt_private/qtresourcemodel_p.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/designer/qt_private/shared_enums_p.h b/src/plugins/designer/qt_private/shared_enums_p.h index 7bc821c8b3..24296f7de6 100644 --- a/src/plugins/designer/qt_private/shared_enums_p.h +++ b/src/plugins/designer/qt_private/shared_enums_p.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/designer/qt_private/shared_global_p.h b/src/plugins/designer/qt_private/shared_global_p.h index 587f628097..41ead1158a 100644 --- a/src/plugins/designer/qt_private/shared_global_p.h +++ b/src/plugins/designer/qt_private/shared_global_p.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp b/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp index 941738c50a..9b0741dd1d 100644 --- a/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp +++ b/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp @@ -179,6 +179,6 @@ bool ProjectFilesDocument::save(QString *errorString, const QString &name, bool return false; if (!autoSave) - m_manager->notifyChanged(name); + m_manager->notifyChanged(name.isEmpty() ? fileName() : name); return true; } diff --git a/src/plugins/genericprojectmanager/selectablefilesmodel.cpp b/src/plugins/genericprojectmanager/selectablefilesmodel.cpp index 4c516f3375..a9b5582f2f 100644 --- a/src/plugins/genericprojectmanager/selectablefilesmodel.cpp +++ b/src/plugins/genericprojectmanager/selectablefilesmodel.cpp @@ -58,6 +58,12 @@ SelectableFilesModel::SelectableFilesModel(const QString &baseDir, QObject *pare void SelectableFilesModel::setInitialMarkedFiles(const QStringList &files) { m_files = files.toSet(); + m_outOfBaseDirFiles.clear(); + QString base = m_baseDir + '/'; + foreach (const QString &file, m_files) + if (!file.startsWith(base)) + m_outOfBaseDirFiles.append(file); + m_allFiles = false; } @@ -333,11 +339,16 @@ void SelectableFilesModel::collectPaths(Tree *root, QStringList *result) const QStringList SelectableFilesModel::selectedFiles() const { - QStringList result; + QStringList result = m_outOfBaseDirFiles; collectFiles(m_root, &result); return result; } +QStringList SelectableFilesModel::preservedFiles() const +{ + return m_outOfBaseDirFiles; +} + void SelectableFilesModel::collectFiles(Tree *root, QStringList *result) const { if (root->checked == Qt::Unchecked) @@ -526,6 +537,10 @@ SelectableFilesDialog::SelectableFilesDialog(const QString &path, const QStringL m_view->hide(); layout->addWidget(m_view); + m_preservedFiles = new QLabel; + m_preservedFiles->hide(); + layout->addWidget(m_preservedFiles); + m_progressLabel = new QLabel(this); m_progressLabel->setMaximumWidth(500); layout->addWidget(m_progressLabel); @@ -569,6 +584,13 @@ void SelectableFilesDialog::parsingFinished() m_view->expand(QModelIndex()); smartExpand(m_selectableFilesModel->index(0,0, QModelIndex())); applyFilter(); + const QStringList &preservedFiles = m_selectableFilesModel->preservedFiles(); + if (preservedFiles.isEmpty()) { + m_preservedFiles->hide(); + } else { + m_preservedFiles->show(); + m_preservedFiles->setText(tr("Not showing %n files that are outside of the base directory.\nThese files are preserved.", 0, preservedFiles.count())); + } } void SelectableFilesDialog::smartExpand(const QModelIndex &index) diff --git a/src/plugins/genericprojectmanager/selectablefilesmodel.h b/src/plugins/genericprojectmanager/selectablefilesmodel.h index 6b81e238fc..f85b4c5672 100644 --- a/src/plugins/genericprojectmanager/selectablefilesmodel.h +++ b/src/plugins/genericprojectmanager/selectablefilesmodel.h @@ -88,6 +88,7 @@ public: QStringList selectedFiles() const; QStringList selectedPaths() const; + QStringList preservedFiles() const; // only call this once void startParsing(); @@ -115,6 +116,7 @@ private: // Used in the future thread need to all not used after calling startParsing QString m_baseDir; QSet<QString> m_files; + QStringList m_outOfBaseDirFiles; QSet<QString> m_suffixes; QFutureWatcher<void> m_watcher; Tree *m_rootForFuture; @@ -143,6 +145,7 @@ private: QLineEdit *m_filterLineEdit; QPushButton *m_applyFilterButton; QTreeView *m_view; + QLabel *m_preservedFiles; QLabel *m_progressLabel; }; diff --git a/src/plugins/git/branchadddialog.cpp b/src/plugins/git/branchadddialog.cpp index 64e2d32b2e..4a4981f2ab 100644 --- a/src/plugins/git/branchadddialog.cpp +++ b/src/plugins/git/branchadddialog.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "branchadddialog.h" #include "ui_branchadddialog.h" diff --git a/src/plugins/git/branchadddialog.h b/src/plugins/git/branchadddialog.h index 9fec0966a3..301c3e521c 100644 --- a/src/plugins/git/branchadddialog.h +++ b/src/plugins/git/branchadddialog.h @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #ifndef BRANCHADDDIALOG_H #define BRANCHADDDIALOG_H diff --git a/src/plugins/locator/locatorplugin.cpp b/src/plugins/locator/locatorplugin.cpp index 2158540444..43831ebc56 100644 --- a/src/plugins/locator/locatorplugin.cpp +++ b/src/plugins/locator/locatorplugin.cpp @@ -45,12 +45,12 @@ #include <coreplugin/icore.h> #include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actioncontainer.h> -#include <coreplugin/actionmanager/command.h> #include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/futureprogress.h> #include <coreplugin/uniqueidmanager.h> #include <extensionsystem/pluginmanager.h> #include <qtconcurrent/QtConcurrentTools> +#include <utils/qtcassert.h> #include <QtCore/QSettings> #include <QtCore/QtPlugin> @@ -119,6 +119,8 @@ bool LocatorPlugin::initialize(const QStringList &, QString *) ->registerAction(action, "QtCreator.Locate", Core::Context(Core::Constants::C_GLOBAL)); cmd->setDefaultKeySequence(QKeySequence("Ctrl+K")); connect(action, SIGNAL(triggered()), this, SLOT(openLocator())); + connect(cmd, SIGNAL(keySequenceChanged()), this, SLOT(updatePlaceholderText())); + updatePlaceholderText(cmd); Core::ActionContainer *mtools = core->actionManager()->actionContainer(Core::Constants::M_TOOLS); mtools->addAction(cmd); @@ -137,6 +139,18 @@ bool LocatorPlugin::initialize(const QStringList &, QString *) return true; } +void LocatorPlugin::updatePlaceholderText(Core::Command *command) +{ + if (!command) + command = qobject_cast<Core::Command *>(sender()); + QTC_ASSERT(command, return); + if (command->keySequence().isEmpty()) + m_locatorWidget->setPlaceholderText(tr("Type to locate")); + else + m_locatorWidget->setPlaceholderText(tr("Type to locate (%1)").arg( + command->keySequence().toString(QKeySequence::NativeText))); +} + void LocatorPlugin::openLocator() { m_locatorWidget->show(""); diff --git a/src/plugins/locator/locatorplugin.h b/src/plugins/locator/locatorplugin.h index 11020fa864..0d2ec895c0 100644 --- a/src/plugins/locator/locatorplugin.h +++ b/src/plugins/locator/locatorplugin.h @@ -37,6 +37,7 @@ #include "directoryfilter.h" #include <extensionsystem/iplugin.h> +#include <coreplugin/actionmanager/command.h> #include <QtCore/QObject> #include <QtCore/QTimer> @@ -77,6 +78,7 @@ public slots: private slots: void startSettingsLoad(); void settingsLoaded(); + void updatePlaceholderText(Core::Command *command = 0); private: void loadSettings(); diff --git a/src/plugins/locator/locatorwidget.cpp b/src/plugins/locator/locatorwidget.cpp index d9b83a04c3..5e9024c48b 100644 --- a/src/plugins/locator/locatorwidget.cpp +++ b/src/plugins/locator/locatorwidget.cpp @@ -306,7 +306,6 @@ LocatorWidget::LocatorWidget(LocatorPlugin *qop) : setWindowIcon(QIcon(QLatin1String(":/locator/images/locator.png"))); QPixmap image(Core::Constants::ICON_MAGNIFIER); m_fileLineEdit->setButtonPixmap(Utils::FancyLineEdit::Left, image); - m_fileLineEdit->setPlaceholderText(tr("Type to locate")); m_fileLineEdit->setButtonToolTip(Utils::FancyLineEdit::Left, tr("Options")); m_fileLineEdit->setFocusPolicy(Qt::ClickFocus); m_fileLineEdit->setButtonVisible(Utils::FancyLineEdit::Left, true); @@ -343,6 +342,11 @@ LocatorWidget::LocatorWidget(LocatorPlugin *qop) : connect(m_showPopupTimer, SIGNAL(timeout()), SLOT(showPopupNow())); } +void LocatorWidget::setPlaceholderText(const QString &text) +{ + m_fileLineEdit->setPlaceholderText(text); +} + void LocatorWidget::updateFilterList() { m_filterMenu->clear(); diff --git a/src/plugins/locator/locatorwidget.h b/src/plugins/locator/locatorwidget.h index f7dd2508e4..bdf053f413 100644 --- a/src/plugins/locator/locatorwidget.h +++ b/src/plugins/locator/locatorwidget.h @@ -67,6 +67,8 @@ public: void show(const QString &text, int selectionStart = -1, int selectionLength = 0); + void setPlaceholderText(const QString &text); + private slots: void showPopup(); void showPopupNow(); diff --git a/src/plugins/projectexplorer/clangparser.cpp b/src/plugins/projectexplorer/clangparser.cpp index 577943fabf..f89a374baa 100644 --- a/src/plugins/projectexplorer/clangparser.cpp +++ b/src/plugins/projectexplorer/clangparser.cpp @@ -35,8 +35,6 @@ #include "taskwindow.h" #include "projectexplorerconstants.h" -#include <QtCore/QDir> - using namespace ProjectExplorer; namespace { diff --git a/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp b/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp index 414d01c8a6..496cb289bb 100644 --- a/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "codestylesettingspropertiespage.h" #include "editorconfiguration.h" #include "project.h" diff --git a/src/plugins/projectexplorer/codestylesettingspropertiespage.h b/src/plugins/projectexplorer/codestylesettingspropertiespage.h index 07ba4ae4b7..873c7faaf0 100644 --- a/src/plugins/projectexplorer/codestylesettingspropertiespage.h +++ b/src/plugins/projectexplorer/codestylesettingspropertiespage.h @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #ifndef CODESTYLESETTINGSPROPERTIESPAGE_H #define CODESTYLESETTINGSPROPERTIESPAGE_H diff --git a/src/plugins/projectexplorer/gccparser.cpp b/src/plugins/projectexplorer/gccparser.cpp index 845bb58c6f..9efca403d5 100644 --- a/src/plugins/projectexplorer/gccparser.cpp +++ b/src/plugins/projectexplorer/gccparser.cpp @@ -35,8 +35,6 @@ #include "taskwindow.h" #include "projectexplorerconstants.h" -#include <QtCore/QDir> - using namespace ProjectExplorer; namespace { @@ -105,7 +103,7 @@ void GccParser::stdError(const QString &line) int lineno = m_regExp.cap(3).toInt(); Task task(Task::Unknown, m_regExp.cap(8) /* description */, - QDir::fromNativeSeparators(filename), lineno, + filename, lineno, Constants::TASK_CATEGORY_COMPILE); if (m_regExp.cap(7) == QLatin1String("warning")) task.type = Task::Warning; @@ -123,7 +121,7 @@ void GccParser::stdError(const QString &line) } else if (m_regExpIncluded.indexIn(lne) > -1) { emit addTask(Task(Task::Unknown, lne /* description */, - QDir::fromNativeSeparators(m_regExpIncluded.cap(1)) /* filename */, + m_regExpIncluded.cap(1) /* filename */, m_regExpIncluded.cap(3).toInt() /* linenumber */, Constants::TASK_CATEGORY_COMPILE)); return; @@ -207,7 +205,7 @@ void ProjectExplorerPlugin::testGccOutputParsers_data() << QString() << QString() << (QList<ProjectExplorer::Task>() << Task(Task::Error, QLatin1String("#error Symbian error"), - QLatin1String("C:/temp/test/untitled8/main.cpp"), 7, + QLatin1String("C:\\temp\\test\\untitled8\\main.cpp"), 7, Constants::TASK_CATEGORY_COMPILE)) << QString(); // Symbian reports #warning(s) twice (using different syntax). @@ -217,7 +215,7 @@ void ProjectExplorerPlugin::testGccOutputParsers_data() << QString() << QString() << (QList<ProjectExplorer::Task>() << Task(Task::Warning, QLatin1String("#warning Symbian warning"), - QLatin1String("C:/temp/test/untitled8/main.cpp"), 8, + QLatin1String("C:\\temp\\test\\untitled8\\main.cpp"), 8, Constants::TASK_CATEGORY_COMPILE)) << QString(); QTest::newRow("GCCE #warning2") @@ -242,7 +240,7 @@ void ProjectExplorerPlugin::testGccOutputParsers_data() Constants::TASK_CATEGORY_COMPILE) << Task(Task::Error, QLatin1String("undefined reference to `MainWindow::doSomething()'"), - QLatin1String("C:/temp/test/untitled8/main.cpp"), 8, + QLatin1String("C:\\temp\\test\\untitled8/main.cpp"), 8, Constants::TASK_CATEGORY_COMPILE) << Task(Task::Error, QLatin1String("collect2: ld returned 1 exit status"), @@ -263,7 +261,7 @@ void ProjectExplorerPlugin::testGccOutputParsers_data() Constants::TASK_CATEGORY_COMPILE) << Task(Task::Error, QLatin1String("undefined reference to `MainWindow::doSomething()'"), - QLatin1String("C:/temp/test/untitled8/main.cpp"), -1, + QLatin1String("C:\\temp\\test\\untitled8/main.cpp"), -1, Constants::TASK_CATEGORY_COMPILE) << Task(Task::Error, QLatin1String("collect2: ld returned 1 exit status"), @@ -278,7 +276,7 @@ void ProjectExplorerPlugin::testGccOutputParsers_data() << (QList<ProjectExplorer::Task>() << Task(Task::Error, QLatin1String("file not recognized: File format not recognized"), - QLatin1String("c:/Qt/4.6/lib/QtGuid4.dll"), -1, + QLatin1String("c:\\Qt\\4.6\\lib/QtGuid4.dll"), -1, Constants::TASK_CATEGORY_COMPILE)) << QString(); QTest::newRow("Invalid rpath") @@ -510,11 +508,11 @@ void ProjectExplorerPlugin::testGccOutputParsers_data() Constants::TASK_CATEGORY_COMPILE) << Task(Task::Error, QLatin1String("undefined reference to `vtable for QPlotAxis'"), - QLatin1String("M:/Development/x64/QtPlot/qplotaxis.cpp"), 26, + QLatin1String("M:\\Development\\x64\\QtPlot/qplotaxis.cpp"), 26, Constants::TASK_CATEGORY_COMPILE) << Task(Task::Error, QLatin1String("undefined reference to `vtable for QPlotAxis'"), - QLatin1String("M:/Development/x64/QtPlot/qplotaxis.cpp"), 26, + QLatin1String("M:\\Development\\x64\\QtPlot/qplotaxis.cpp"), 26, Constants::TASK_CATEGORY_COMPILE) << Task(Task::Error, QLatin1String("collect2: ld returned 1 exit status"), diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index a0976771f7..1c62f61b03 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -189,7 +189,7 @@ static QList<ProjectExplorer::Abi> guessGccAbi(const QString &m) || p == QLatin1String("i686") || p == QLatin1String("x86")) { arch = ProjectExplorer::Abi::X86Architecture; width = 32; - } else if (p == QLatin1String("arm") || p == QLatin1String("armv5tel")) { + } else if (p.startsWith(QLatin1String("arm"))) { arch = ProjectExplorer::Abi::ArmArchitecture; width = 32; } else if (p == QLatin1String("mipsel")) { @@ -1014,6 +1014,10 @@ void ProjectExplorerPlugin::testGccAbiGuessing_data() QTest::newRow("Linux 7") // Meego << QString::fromLatin1("armv5tel-meego-linux-gnueabi") << (QStringList() << QLatin1String("arm-linux-meego-elf-32bit")); + QTest::newRow("Linux 8") + << QString::fromLatin1("armv5tl-montavista-linux-gnueabi") + << (QStringList() << QLatin1String("arm-linux-generic-elf-32bit")); + QTest::newRow("Mingw 1") << QString::fromLatin1("i686-w64-mingw32") << (QStringList() << QLatin1String("x86-windows-msys-pe-64bit") diff --git a/src/plugins/projectexplorer/gnumakeparser.cpp b/src/plugins/projectexplorer/gnumakeparser.cpp index 6d01af617f..ca81054127 100644 --- a/src/plugins/projectexplorer/gnumakeparser.cpp +++ b/src/plugins/projectexplorer/gnumakeparser.cpp @@ -95,7 +95,7 @@ void GnuMakeParser::stdError(const QString &line) m_suppressIssues = true; addTask(Task(Task::Error, m_makefileError.cap(3), - QDir::fromNativeSeparators(m_makefileError.cap(1)), + m_makefileError.cap(1), m_makefileError.cap(2).toInt(), Constants::TASK_CATEGORY_BUILDSYSTEM)); } diff --git a/src/plugins/projectexplorer/ldparser.cpp b/src/plugins/projectexplorer/ldparser.cpp index a1d7980ca0..a3272b0f16 100644 --- a/src/plugins/projectexplorer/ldparser.cpp +++ b/src/plugins/projectexplorer/ldparser.cpp @@ -34,8 +34,6 @@ #include "projectexplorerconstants.h" #include "taskwindow.h" -#include <QtCore/QDir> - using namespace ProjectExplorer; namespace { @@ -103,7 +101,7 @@ void LdParser::stdError(const QString &line) && !m_regExpLinker.cap(4).startsWith(QLatin1String("(.text+0x"))) filename = m_regExpLinker.cap(4); QString description = m_regExpLinker.cap(8).trimmed(); - Task task(Task::Error, description, QDir::fromNativeSeparators(filename), lineno, + Task task(Task::Error, description, filename, lineno, Constants::TASK_CATEGORY_COMPILE); if (m_regExpInFunction.indexIn(description) > -1 || description.startsWith(QLatin1String("At global scope")) || diff --git a/src/plugins/projectexplorer/linuxiccparser.cpp b/src/plugins/projectexplorer/linuxiccparser.cpp index 074eaf4352..d29d2f76ad 100644 --- a/src/plugins/projectexplorer/linuxiccparser.cpp +++ b/src/plugins/projectexplorer/linuxiccparser.cpp @@ -35,8 +35,6 @@ #include "taskwindow.h" #include "projectexplorerconstants.h" -#include <QtCore/QDir> - using namespace ProjectExplorer; LinuxIccParser::LinuxIccParser() @@ -75,7 +73,7 @@ void LinuxIccParser::stdError(const QString &line) if (m_expectFirstLine && m_firstLine.indexIn(line) != -1) { // Clear out old task m_temporary = ProjectExplorer::Task(Task::Unknown, m_firstLine.cap(6).trimmed(), - QDir::fromNativeSeparators(m_firstLine.cap(1)), + m_firstLine.cap(1), m_firstLine.cap(2).toInt(), QLatin1String(Constants::TASK_CATEGORY_COMPILE)); QString category = m_firstLine.cap(4); diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp index a1a8683cef..beb512dfbe 100644 --- a/src/plugins/projectexplorer/msvctoolchain.cpp +++ b/src/plugins/projectexplorer/msvctoolchain.cpp @@ -610,7 +610,6 @@ QList<ToolChain *> MsvcToolChainFactory::autoDetect() tmp.append(new MsvcToolChain(generateDisplayName(name, MsvcToolChain::WindowsSDK, MsvcToolChain::s32), findAbiOfMsvc(MsvcToolChain::WindowsSDK, MsvcToolChain::s32, version), sdkVcVarsBat, QLatin1String("/x86"), true)); -#ifdef Q_OS_WIN64 // Add all platforms tmp.append(new MsvcToolChain(generateDisplayName(name, MsvcToolChain::WindowsSDK, MsvcToolChain::s64), findAbiOfMsvc(MsvcToolChain::WindowsSDK, MsvcToolChain::s64, version), @@ -618,7 +617,6 @@ QList<ToolChain *> MsvcToolChainFactory::autoDetect() tmp.append(new MsvcToolChain(generateDisplayName(name, MsvcToolChain::WindowsSDK, MsvcToolChain::ia64), findAbiOfMsvc(MsvcToolChain::WindowsSDK, MsvcToolChain::ia64, version), sdkVcVarsBat, QLatin1String("/ia64"), true)); -#endif // Make sure the default is front. if (folder == defaultSdkPath) results = tmp + results; diff --git a/src/plugins/projectexplorer/projecttreewidget.cpp b/src/plugins/projectexplorer/projecttreewidget.cpp index 2e326022cc..1d3b8da6d6 100644 --- a/src/plugins/projectexplorer/projecttreewidget.cpp +++ b/src/plugins/projectexplorer/projecttreewidget.cpp @@ -101,8 +101,7 @@ ProjectTreeWidget::ProjectTreeWidget(QWidget *parent) m_model(0), m_filterProjectsAction(0), m_autoSync(false), - m_autoExpand(true), - m_currentItemLocked(0) + m_autoExpand(true) { m_model = new FlatModel(m_explorer->session()->sessionNode(), this); Project *pro = m_explorer->session()->startupProject(); @@ -282,13 +281,6 @@ void ProjectTreeWidget::setCurrentItem(Node *node, Project *project) if (debug) qDebug() << "ProjectTreeWidget::setCurrentItem(" << (project ? project->displayName() : "0") << ", " << (node ? node->path() : "0") << ")"; - if (m_currentItemLocked) { - if (m_currentItemLocked == node) { - m_currentItemLocked = 0; - return; - } - m_currentItemLocked = 0; - } if (!project) { return; @@ -326,10 +318,6 @@ void ProjectTreeWidget::showContextMenu(const QPoint &pos) void ProjectTreeWidget::handleProjectAdded(ProjectExplorer::Project *project) { - // We disable auto-synchronization for the current node so that the project - // is selected until another file is opened - m_currentItemLocked = m_model->nodeForIndex(m_view->currentIndex()); - Node *node = project->rootProjectNode(); QModelIndex idx = m_model->indexForNode(node); if (m_autoExpand) // disabled while session restoring diff --git a/src/plugins/projectexplorer/projecttreewidget.h b/src/plugins/projectexplorer/projecttreewidget.h index 9a15cc9169..570aa7fc00 100644 --- a/src/plugins/projectexplorer/projecttreewidget.h +++ b/src/plugins/projectexplorer/projecttreewidget.h @@ -101,7 +101,6 @@ private: QString m_modelId; bool m_autoSync; bool m_autoExpand; - Node *m_currentItemLocked; friend class ProjectTreeWidgetFactory; }; diff --git a/src/plugins/projectexplorer/projectwelcomepage.cpp b/src/plugins/projectexplorer/projectwelcomepage.cpp index 63807deccf..e24c7a22ca 100644 --- a/src/plugins/projectexplorer/projectwelcomepage.cpp +++ b/src/plugins/projectexplorer/projectwelcomepage.cpp @@ -58,7 +58,7 @@ SessionModel::SessionModel(SessionManager *manager, QObject *parent) int SessionModel::rowCount(const QModelIndex &) const { - return qMin(m_manager->sessions().count(), 12); + return m_manager->sessions().count(); } QVariant SessionModel::data(const QModelIndex &index, int role) const @@ -95,7 +95,7 @@ ProjectModel::ProjectModel(ProjectExplorerPlugin *plugin, QObject *parent) int ProjectModel::rowCount(const QModelIndex &) const { - return qMin(m_plugin->recentProjects().count(), 6); + return m_plugin->recentProjects().count(); } QVariant ProjectModel::data(const QModelIndex &index, int role) const diff --git a/src/plugins/projectexplorer/projectwelcomepage.h b/src/plugins/projectexplorer/projectwelcomepage.h index 5b3d2da2cb..f63009f898 100644 --- a/src/plugins/projectexplorer/projectwelcomepage.h +++ b/src/plugins/projectexplorer/projectwelcomepage.h @@ -103,7 +103,7 @@ public: ProjectWelcomePage(); void facilitateQml(QDeclarativeEngine *engine); - QString pageLocation() const { return Core::ICore::instance()->resourcePath() + QLatin1String("/welcomescreen/develop.qml"); } + QUrl pageLocation() const { return QUrl::fromLocalFile(Core::ICore::instance()->resourcePath() + QLatin1String("/welcomescreen/develop.qml")); } QWidget *page() { return 0; } QString title() const { return tr("Develop"); } int priority() const { return 20; } diff --git a/src/plugins/projectexplorer/task.cpp b/src/plugins/projectexplorer/task.cpp index a1571b91b8..24e3bf56eb 100644 --- a/src/plugins/projectexplorer/task.cpp +++ b/src/plugins/projectexplorer/task.cpp @@ -32,6 +32,8 @@ #include "task.h" +#include <QtCore/QDir> + namespace ProjectExplorer { @@ -48,8 +50,7 @@ Task::Task() : taskId(0), type(Unknown), line(-1) Task::Task(TaskType type_, const QString &description_, const QString &file_, int line_, const QString &category_) : - taskId(s_nextId), type(type_), description(description_), file(file_), - line(line_), category(category_) + taskId(s_nextId), type(type_), description(description_), file(QDir::fromNativeSeparators(file_)), line(line_), category(category_) { ++s_nextId; } diff --git a/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.h b/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.h index eed1ec3088..f61ef51631 100644 --- a/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.h +++ b/src/plugins/qmldesigner/components/formeditor/abstractformeditortool.h @@ -82,6 +82,7 @@ public: virtual void formEditorItemsChanged(const QList<FormEditorItem*> &itemList) = 0; virtual void instancesCompleted(const QList<FormEditorItem*> &itemList) = 0; + virtual void instancesParentChanged(const QList<FormEditorItem*> &itemList) = 0; void setItems(const QList<FormEditorItem*> &itemList); QList<FormEditorItem*> items() const; diff --git a/src/plugins/qmldesigner/components/formeditor/anchortool.cpp b/src/plugins/qmldesigner/components/formeditor/anchortool.cpp index 85d3707e69..b058a50249 100644 --- a/src/plugins/qmldesigner/components/formeditor/anchortool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/anchortool.cpp @@ -220,6 +220,10 @@ void AnchorTool::instancesCompleted(const QList<FormEditorItem*> &/*itemList*/) { } +void AnchorTool::instancesParentChanged(const QList<FormEditorItem *> &/*itemList*/) +{ +} + AnchorLineHandleItem* AnchorTool::topAnchorLineHandleItem(const QList<QGraphicsItem*> & itemList) { foreach (QGraphicsItem *item, itemList) { diff --git a/src/plugins/qmldesigner/components/formeditor/anchortool.h b/src/plugins/qmldesigner/components/formeditor/anchortool.h index b5a19a4c79..27fc531fca 100644 --- a/src/plugins/qmldesigner/components/formeditor/anchortool.h +++ b/src/plugins/qmldesigner/components/formeditor/anchortool.h @@ -74,6 +74,8 @@ public: void formEditorItemsChanged(const QList<FormEditorItem*> &itemList); void instancesCompleted(const QList<FormEditorItem*> &itemList); + void instancesParentChanged(const QList<FormEditorItem *> &itemList); + static AnchorLineHandleItem* topAnchorLineHandleItem(const QList<QGraphicsItem*> & itemList); diff --git a/src/plugins/qmldesigner/components/formeditor/dragtool.cpp b/src/plugins/qmldesigner/components/formeditor/dragtool.cpp index ec62f391f1..38556c08cb 100644 --- a/src/plugins/qmldesigner/components/formeditor/dragtool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/dragtool.cpp @@ -217,6 +217,12 @@ void DragTool::instancesCompleted(const QList<FormEditorItem*> &itemList) QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::hide(); } +void DragTool::instancesParentChanged(const QList<FormEditorItem *> &itemList) +{ + m_moveManipulator.synchronizeInstanceParent(itemList); +} + + void DragTool::clearMoveDelay() { if (!m_blockMove) @@ -291,7 +297,7 @@ void DragTool::dragEnterEvent(QGraphicsSceneDragDropEvent * event) const QString newImportVersion = QString("%1.%2").arg(QString::number(itemLibraryEntry.majorVersion()), QString::number(itemLibraryEntry.minorVersion())); Import newImport = Import::createLibraryImport(newImportUrl, newImportVersion); - if (!view()->model()->hasImport(newImport, true)) { + if (!view()->model()->hasImport(newImport, true, true)) { importToBeAddedList.append(newImport); } @@ -381,6 +387,7 @@ void DragTool::dragMoveEvent(QGraphicsSceneDragDropEvent * event) QTimer::singleShot(1000, m_timerHandler.data(), SLOT(clearMoveDelay())); } } + if (event->mimeData()->hasFormat("application/vnd.bauhaus.libraryresource")) { } } diff --git a/src/plugins/qmldesigner/components/formeditor/dragtool.h b/src/plugins/qmldesigner/components/formeditor/dragtool.h index d397c73158..f2a8db7f10 100644 --- a/src/plugins/qmldesigner/components/formeditor/dragtool.h +++ b/src/plugins/qmldesigner/components/formeditor/dragtool.h @@ -86,6 +86,7 @@ public: void itemsAboutToRemoved(const QList<FormEditorItem*> &itemList); void selectedItemsChanged(const QList<FormEditorItem*> &itemList); + void instancesParentChanged(const QList<FormEditorItem *> &itemList); void updateMoveManipulator(); diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp index 52623f7716..c3b6993659 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp @@ -46,8 +46,7 @@ FormEditorGraphicsView::FormEditorGraphicsView(QWidget *parent) : setTransformationAnchor(QGraphicsView::AnchorUnderMouse); setResizeAnchor(QGraphicsView::AnchorViewCenter); setAlignment(Qt::AlignCenter); - setCacheMode(QGraphicsView::CacheBackground); -// setCacheMode(QGraphicsView::CacheBackground); + setCacheMode(QGraphicsView::CacheNone); setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate); setOptimizationFlags(QGraphicsView::DontSavePainterState); // setViewportUpdateMode(QGraphicsView::NoViewportUpdate); diff --git a/src/plugins/qmldesigner/components/formeditor/formeditornodeinstanceview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditornodeinstanceview.cpp index 4724c10edc..28331eeba2 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditornodeinstanceview.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditornodeinstanceview.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/components/formeditor/formeditornodeinstanceview.h b/src/plugins/qmldesigner/components/formeditor/formeditornodeinstanceview.h index d6ed7b223f..acd68af923 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditornodeinstanceview.h +++ b/src/plugins/qmldesigner/components/formeditor/formeditornodeinstanceview.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorscene.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorscene.cpp index bb257b3278..1b429d0dd9 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorscene.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorscene.cpp @@ -196,6 +196,9 @@ void FormEditorScene::synchronizeOtherProperty(const QmlItemNode &qmlItemNode, c if (propertyName == "clip") item->setFlag(QGraphicsItem::ItemClipsChildrenToShape, qmlItemNode.instanceValue("clip").toBool()); + if (propertyName == "z") + item->setZValue(qmlItemNode.instanceValue("z").toDouble()); + if (!qmlItemNode.isRootNode()) { if (propertyName == "visible") item->setContentVisible(qmlItemNode.instanceValue("visible").toBool()); diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorsubwindow.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorsubwindow.cpp index 49a780fddf..8ba8533649 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorsubwindow.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorsubwindow.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorsubwindow.h b/src/plugins/qmldesigner/components/formeditor/formeditorsubwindow.h index 0c902b2586..5cded6394c 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorsubwindow.h +++ b/src/plugins/qmldesigner/components/formeditor/formeditorsubwindow.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp index 3e0ebe06c4..a2ed9a8554 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp @@ -56,6 +56,7 @@ #include <zoomaction.h> #include <nodeabstractproperty.h> #include <nodelistproperty.h> +#include <commondefines.h> namespace QmlDesigner { @@ -489,6 +490,10 @@ void FormEditorView::instancesPreviewImageChanged(const QVector<ModelNode> &/*no } +void FormEditorView::instancesToken(const QString &/*tokenName*/, int /*tokenNumber*/, const QVector<ModelNode> &/*nodeVector*/) +{ +} + void FormEditorView::instancesChildrenChanged(const QVector<ModelNode> &nodeList) { QList<FormEditorItem*> itemNodeList; @@ -502,6 +507,7 @@ void FormEditorView::instancesChildrenChanged(const QVector<ModelNode> &nodeList } m_currentTool->formEditorItemsChanged(itemNodeList); + m_currentTool->instancesParentChanged(itemNodeList); } void FormEditorView::rewriterBeginTransaction() @@ -573,16 +579,22 @@ QmlItemNode findRecursiveQmlItemNode(const QmlObjectNode &firstQmlObjectNode) return QmlItemNode(); } -void FormEditorView::otherPropertyChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName) +void FormEditorView::instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList) { - Q_ASSERT(qmlObjectNode.isValid()); - - QmlItemNode itemNode = findRecursiveQmlItemNode(qmlObjectNode); - - if (itemNode.isValid() && scene()->hasItemForQmlItemNode(itemNode)) { - m_scene->synchronizeOtherProperty(itemNode, propertyName); - m_currentTool->formEditorItemsChanged(QList<FormEditorItem*>() << m_scene->itemForQmlItemNode(itemNode)); + typedef QPair<ModelNode, QString> NodePropertyPair; + foreach (const NodePropertyPair &nodePropertyPair, propertyList) { + const QmlItemNode itemNode(nodePropertyPair.first); + const QString propertyName = nodePropertyPair.second; + if (itemNode.isValid() && scene()->hasItemForQmlItemNode(itemNode)) { + static QStringList skipList = QStringList() << "x" << "y" << "width" << "height"; + if (!skipList.contains(propertyName)) { + m_scene->synchronizeOtherProperty(itemNode, propertyName); + m_currentTool->formEditorItemsChanged(QList<FormEditorItem*>() << m_scene->itemForQmlItemNode(itemNode)); + } + } } + + QmlModelView::instancePropertyChange(propertyList); } void FormEditorView::updateGraphicsIndicators() diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorview.h b/src/plugins/qmldesigner/components/formeditor/formeditorview.h index 2657d6ae3b..b723c4bcef 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorview.h +++ b/src/plugins/qmldesigner/components/formeditor/formeditorview.h @@ -108,6 +108,8 @@ public: void instancesRenderImageChanged(const QVector<ModelNode> &nodeList); void instancesPreviewImageChanged(const QVector<ModelNode> &nodeList); void instancesChildrenChanged(const QVector<ModelNode> &nodeList); + void instancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList); + void instancesToken(const QString &tokenName, int tokenNumber, const QVector<ModelNode> &nodeVector); void rewriterBeginTransaction(); void rewriterEndTransaction(); @@ -123,7 +125,6 @@ signals: void ItemCreatorDeActivated(); protected: - void otherPropertyChanged(const QmlObjectNode &qmlObjectNode, const QString &propertyName); void stateChanged(const QmlModelState &newQmlModelState, const QmlModelState &oldQmlModelState); void reset(); diff --git a/src/plugins/qmldesigner/components/formeditor/itemcreatortool.cpp b/src/plugins/qmldesigner/components/formeditor/itemcreatortool.cpp index 4d6c3a769f..398dbe1f4d 100644 --- a/src/plugins/qmldesigner/components/formeditor/itemcreatortool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/itemcreatortool.cpp @@ -145,6 +145,10 @@ void ItemCreatorTool::instancesCompleted(const QList<FormEditorItem*> &/*itemLis { } +void ItemCreatorTool::instancesParentChanged(const QList<FormEditorItem *> &/*itemList*/) +{ +} + void ItemCreatorTool::setItemString(const QString &itemString) { m_itemString = itemString; diff --git a/src/plugins/qmldesigner/components/formeditor/itemcreatortool.h b/src/plugins/qmldesigner/components/formeditor/itemcreatortool.h index 6c41176020..cd678b2647 100644 --- a/src/plugins/qmldesigner/components/formeditor/itemcreatortool.h +++ b/src/plugins/qmldesigner/components/formeditor/itemcreatortool.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ @@ -71,6 +71,7 @@ public: void formEditorItemsChanged(const QList<FormEditorItem*> &itemList); void instancesCompleted(const QList<FormEditorItem*> &itemList); + void instancesParentChanged(const QList<FormEditorItem *> &itemList); void setItemString(const QString &itemString); diff --git a/src/plugins/qmldesigner/components/formeditor/manipulatorlayeritem.h b/src/plugins/qmldesigner/components/formeditor/manipulatorlayeritem.h index ae91b5ef35..53478d01d7 100644 --- a/src/plugins/qmldesigner/components/formeditor/manipulatorlayeritem.h +++ b/src/plugins/qmldesigner/components/formeditor/manipulatorlayeritem.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp b/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp index 14bcc54256..91926dc5df 100644 --- a/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp +++ b/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp @@ -88,6 +88,35 @@ void MoveManipulator::setItems(const QList<FormEditorItem*> &itemList) } } +void MoveManipulator::synchronizeParent(const QList<FormEditorItem*> &itemList, const ModelNode &parentNode) +{ + bool snapperUpdated = false; + + foreach (FormEditorItem *item, itemList) { + if (m_itemList.contains(item)) { + QmlItemNode parentItemNode = QmlItemNode(parentNode); + if (parentItemNode.isValid()) { + if (snapperUpdated == false && m_snapper.containerFormEditorItem() != m_view->scene()->itemForQmlItemNode(parentItemNode)) { + m_snapper.setContainerFormEditorItem(m_view->scene()->itemForQmlItemNode(parentItemNode)); + m_snapper.setTransformtionSpaceFormEditorItem(m_snapper.containerFormEditorItem()); + m_snapper.updateSnappingLines(m_itemList); + updateHashes(); + snapperUpdated = true; + } + } + } + } + + update(m_lastPosition, NoSnapping, UseBaseState); +} + +void MoveManipulator::synchronizeInstanceParent(const QList<FormEditorItem*> &itemList) +{ + if (m_view->model() && !m_itemList.isEmpty()) + synchronizeParent(itemList, m_itemList.first()->qmlItemNode().instanceParent()); + +} + void MoveManipulator::updateHashes() { // foreach (FormEditorItem* item, m_itemList) @@ -239,6 +268,7 @@ QHash<FormEditorItem*, QRectF> MoveManipulator::tanslatedBoundingRects(const QHa */ void MoveManipulator::update(const QPointF& updatePoint, Snapping useSnapping, State stateToBeManipulated) { + m_lastPosition = updatePoint; deleteSnapLines(); //Since they position is changed and the item is moved the snapping lines are //are obsolete. The new updated snapping lines (color and visibility) will be //calculated in snapPoint() called in moveNode() later @@ -311,6 +341,7 @@ void MoveManipulator::clear() m_beginPositionHash.clear(); m_beginPositionInSceneSpaceHash.clear(); m_itemList.clear(); + m_lastPosition = QPointF(); m_rewriterTransaction.commit(); @@ -332,24 +363,30 @@ void MoveManipulator::reparentTo(FormEditorItem *newParent) if (!itemsCanReparented()) return; - foreach (FormEditorItem* item, m_itemList) { - if (!item || !item->qmlItemNode().isValid()) - continue; + QVector<ModelNode> nodeReparentVector; + NodeAbstractProperty parentProperty; - QmlItemNode parent(newParent->qmlItemNode()); - if (parent.isValid()) { - if (parent.hasDefaultProperty()) - item->qmlItemNode().setParentProperty(parent.nodeAbstractProperty(parent.defaultProperty())); - else - item->qmlItemNode().setParentProperty(parent.nodeAbstractProperty("data")); + QmlItemNode parent(newParent->qmlItemNode()); + if (parent.isValid()) { + if (parent.hasDefaultProperty()) { + parentProperty = parent.nodeAbstractProperty(parent.defaultProperty()); + } else { + parentProperty = parent.nodeAbstractProperty("data"); } - } - if (m_view->model()) { - m_snapper.setContainerFormEditorItem(newParent); - m_snapper.setTransformtionSpaceFormEditorItem(m_snapper.containerFormEditorItem()); - m_snapper.updateSnappingLines(m_itemList); - updateHashes(); + foreach (FormEditorItem* item, m_itemList) { + if (!item || !item->qmlItemNode().isValid()) + continue; + + if (parentProperty != item->qmlItemNode().modelNode().parentProperty()) + nodeReparentVector.append(item->qmlItemNode().modelNode()); + + } + + foreach (const ModelNode &nodeToReparented, nodeReparentVector) + parentProperty.reparentHere(nodeToReparented); + + synchronizeParent(m_itemList, parentProperty.parentModelNode()); } } diff --git a/src/plugins/qmldesigner/components/formeditor/movemanipulator.h b/src/plugins/qmldesigner/components/formeditor/movemanipulator.h index d24cb50716..671feef038 100644 --- a/src/plugins/qmldesigner/components/formeditor/movemanipulator.h +++ b/src/plugins/qmldesigner/components/formeditor/movemanipulator.h @@ -69,7 +69,8 @@ public: ~MoveManipulator(); void setItems(const QList<FormEditorItem*> &itemList); void setItem(FormEditorItem* item); - + void synchronizeInstanceParent(const QList<FormEditorItem*> &itemList); + void synchronizeParent(const QList<FormEditorItem*> &itemList, const ModelNode &parentNode); void begin(const QPointF& beginPoint); void update(const QPointF& updatePoint, Snapping useSnapping, State stateToBeManipulated = UseActualState); void reparentTo(FormEditorItem *newParent); @@ -122,6 +123,7 @@ private: QList<QGraphicsItem*> m_graphicsLineList; bool m_isActive; RewriterTransaction m_rewriterTransaction; + QPointF m_lastPosition; }; } diff --git a/src/plugins/qmldesigner/components/formeditor/movetool.cpp b/src/plugins/qmldesigner/components/formeditor/movetool.cpp index 5b8226fff4..0b68938bc6 100644 --- a/src/plugins/qmldesigner/components/formeditor/movetool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/movetool.cpp @@ -256,6 +256,11 @@ void MoveTool::instancesCompleted(const QList<FormEditorItem*> & /*itemList*/) { } +void MoveTool::instancesParentChanged(const QList<FormEditorItem *> &itemList) +{ + m_moveManipulator.synchronizeInstanceParent(itemList); +} + bool MoveTool::haveSameParent(const QList<FormEditorItem*> &itemList) { if (itemList.isEmpty()) diff --git a/src/plugins/qmldesigner/components/formeditor/movetool.h b/src/plugins/qmldesigner/components/formeditor/movetool.h index be9227f714..9225e09890 100644 --- a/src/plugins/qmldesigner/components/formeditor/movetool.h +++ b/src/plugins/qmldesigner/components/formeditor/movetool.h @@ -67,7 +67,8 @@ public: void selectedItemsChanged(const QList<FormEditorItem*> &itemList); - void instancesCompleted(const QList<FormEditorItem*> &/*itemList*/); + void instancesCompleted(const QList<FormEditorItem*> &itemList); + void instancesParentChanged(const QList<FormEditorItem *> &itemList); void updateMoveManipulator(); diff --git a/src/plugins/qmldesigner/components/formeditor/resizetool.cpp b/src/plugins/qmldesigner/components/formeditor/resizetool.cpp index 3063daff4f..fca319def1 100644 --- a/src/plugins/qmldesigner/components/formeditor/resizetool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/resizetool.cpp @@ -196,8 +196,14 @@ void ResizeTool::formEditorItemsChanged(const QList<FormEditorItem*> &itemList) m_resizeIndicator.updateItems(itemList); } - void ResizeTool::instancesCompleted(const QList<FormEditorItem*> &/*itemList*/) - { - } +void ResizeTool::instancesCompleted(const QList<FormEditorItem*> &/*itemList*/) +{ +} + + +void ResizeTool::instancesParentChanged(const QList<FormEditorItem *> &/*itemList*/) +{ + +} } diff --git a/src/plugins/qmldesigner/components/formeditor/resizetool.h b/src/plugins/qmldesigner/components/formeditor/resizetool.h index d7ffa7a050..68c935b676 100644 --- a/src/plugins/qmldesigner/components/formeditor/resizetool.h +++ b/src/plugins/qmldesigner/components/formeditor/resizetool.h @@ -67,9 +67,11 @@ public: void clear(); void formEditorItemsChanged(const QList<FormEditorItem*> &itemList); + void instancesParentChanged(const QList<FormEditorItem *> &itemList); void instancesCompleted(const QList<FormEditorItem*> &itemList); + private: SelectionIndicator m_selectionIndicator; ResizeIndicator m_resizeIndicator; diff --git a/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp b/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp index 110c751293..b79bf484ab 100644 --- a/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp @@ -275,6 +275,11 @@ void SelectionTool::instancesCompleted(const QList<FormEditorItem*> &/*itemList* { } +void SelectionTool::instancesParentChanged(const QList<FormEditorItem *> &/*itemList*/) +{ + +} + void SelectionTool::selectUnderPoint(QGraphicsSceneMouseEvent *event) { m_singleSelectionManipulator.begin(event->scenePos()); diff --git a/src/plugins/qmldesigner/components/formeditor/selectiontool.h b/src/plugins/qmldesigner/components/formeditor/selectiontool.h index d9b1edcc37..a08c38dcae 100644 --- a/src/plugins/qmldesigner/components/formeditor/selectiontool.h +++ b/src/plugins/qmldesigner/components/formeditor/selectiontool.h @@ -80,6 +80,8 @@ public: void formEditorItemsChanged(const QList<FormEditorItem*> &itemList); void instancesCompleted(const QList<FormEditorItem*> &itemList); + void instancesParentChanged(const QList<FormEditorItem *> &itemList); + void selectUnderPoint(QGraphicsSceneMouseEvent *event); diff --git a/src/plugins/qmldesigner/components/integration/componentview.cpp b/src/plugins/qmldesigner/components/integration/componentview.cpp index a2d818d4dd..539c57578d 100644 --- a/src/plugins/qmldesigner/components/integration/componentview.cpp +++ b/src/plugins/qmldesigner/components/integration/componentview.cpp @@ -212,6 +212,8 @@ void ComponentView::instanceInformationsChange(const QMultiHash<ModelNode, Infor void ComponentView::instancesRenderImageChanged(const QVector<ModelNode> &/*nodeList*/) {} void ComponentView::instancesPreviewImageChanged(const QVector<ModelNode> &/*nodeList*/) {} void ComponentView::instancesChildrenChanged(const QVector<ModelNode> &/*nodeList*/) {} +void ComponentView::instancesToken(const QString &/*tokenName*/, int /*tokenNumber*/, const QVector<ModelNode> &/*nodeVector*/) {} + void ComponentView::nodeSourceChanged(const ModelNode &, const QString & /*newNodeSource*/) {} void ComponentView::rewriterBeginTransaction() {} diff --git a/src/plugins/qmldesigner/components/integration/componentview.h b/src/plugins/qmldesigner/components/integration/componentview.h index fef34556b5..3541fbc760 100644 --- a/src/plugins/qmldesigner/components/integration/componentview.h +++ b/src/plugins/qmldesigner/components/integration/componentview.h @@ -81,6 +81,8 @@ public: 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(); diff --git a/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.cpp b/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.cpp index ead2ab44a1..41c0e819cc 100644 --- a/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.cpp @@ -92,6 +92,11 @@ void DesignDocumentControllerView::instancesChildrenChanged(const QVector<ModelN } +void DesignDocumentControllerView::instancesToken(const QString &/*tokenName*/, int /*tokenNumber*/, const QVector<ModelNode> &/*nodeVector*/) +{ + +} + void DesignDocumentControllerView::nodeSourceChanged(const ModelNode &, const QString & /*newNodeSource*/) { diff --git a/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.h b/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.h index a915eeb4cd..6725ab4ea4 100644 --- a/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.h +++ b/src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.h @@ -68,6 +68,8 @@ public: 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(); diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp index 0987c3fb31..c454f45cd7 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarymodel.cpp @@ -408,7 +408,7 @@ void ItemLibraryModel::update(ItemLibraryInfo *itemLibraryInfo, Model *model) bool valid = model->metaInfo(entry.typeName(), entry.majorVersion(), entry.minorVersion()).isValid(); - if (valid && (entry.requiredImport().isEmpty() || model->hasImport(entryToImport(entry), true) || entry.forceImport())) { + if (valid && (entry.requiredImport().isEmpty() || model->hasImport(entryToImport(entry), true, true) || entry.forceImport())) { QString itemSectionName = entry.category(); ItemLibrarySectionModel *sectionModel; ItemLibraryItemModel *itemModel; diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.cpp index 611257b27f..27133cffde 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.cpp @@ -172,6 +172,11 @@ void ItemLibraryView::instancesChildrenChanged(const QVector<ModelNode> &/*nodeL } +void ItemLibraryView::instancesToken(const QString &/*tokenName*/, int /*tokenNumber*/, const QVector<ModelNode> &/*nodeVector*/) +{ + +} + void ItemLibraryView::nodeSourceChanged(const ModelNode &, const QString & /*newNodeSource*/) { diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.h b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.h index 3c61139efe..576de22546 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.h +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.h @@ -84,6 +84,8 @@ public: 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(); diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp index 4b5c64a783..3fe167f2ee 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp @@ -379,6 +379,7 @@ void ItemLibraryWidget::emitImportChecked() void ItemLibraryWidget::setImportFilter(FilterChangeFlag flag) { + return; static bool block = false; if (!m_d->model) diff --git a/src/plugins/qmldesigner/components/logger/logger.cpp b/src/plugins/qmldesigner/components/logger/logger.cpp index 5b3a331ae6..42c4013b27 100644 --- a/src/plugins/qmldesigner/components/logger/logger.cpp +++ b/src/plugins/qmldesigner/components/logger/logger.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/components/logger/logger.h b/src/plugins/qmldesigner/components/logger/logger.h index 9f574b8175..e5ff44d293 100644 --- a/src/plugins/qmldesigner/components/logger/logger.h +++ b/src/plugins/qmldesigner/components/logger/logger.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/components/propertyeditor/genericpropertieswidget.cpp b/src/plugins/qmldesigner/components/propertyeditor/genericpropertieswidget.cpp index 0d9e194219..884ee0894b 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/genericpropertieswidget.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/genericpropertieswidget.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/components/propertyeditor/genericpropertieswidget.h b/src/plugins/qmldesigner/components/propertyeditor/genericpropertieswidget.h index a5340bbf28..70d5293562 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/genericpropertieswidget.h +++ b/src/plugins/qmldesigner/components/propertyeditor/genericpropertieswidget.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/components/stateseditor/HorizontalScrollBar.qml b/src/plugins/qmldesigner/components/stateseditor/HorizontalScrollBar.qml index 699fdeef6a..738d521e06 100644 --- a/src/plugins/qmldesigner/components/stateseditor/HorizontalScrollBar.qml +++ b/src/plugins/qmldesigner/components/stateseditor/HorizontalScrollBar.qml @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + import Qt 4.7 Item { diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorimageprovider.h b/src/plugins/qmldesigner/components/stateseditor/stateseditorimageprovider.h index f688102d4a..f41c825f90 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorimageprovider.h +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorimageprovider.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/components/stateseditor/stateslist.qml b/src/plugins/qmldesigner/components/stateseditor/stateslist.qml index 19b6bfb068..924258029e 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateslist.qml +++ b/src/plugins/qmldesigner/components/stateseditor/stateslist.qml @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + import Qt 4.7 Rectangle { diff --git a/src/plugins/qmldesigner/components/themeloader/qts60stylethemeio.cpp b/src/plugins/qmldesigner/components/themeloader/qts60stylethemeio.cpp index db005b6267..21013ecb0e 100644 --- a/src/plugins/qmldesigner/components/themeloader/qts60stylethemeio.cpp +++ b/src/plugins/qmldesigner/components/themeloader/qts60stylethemeio.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/components/themeloader/qts60stylethemeio.h b/src/plugins/qmldesigner/components/themeloader/qts60stylethemeio.h index f68b5b422a..bc27f95f88 100644 --- a/src/plugins/qmldesigner/components/themeloader/qts60stylethemeio.h +++ b/src/plugins/qmldesigner/components/themeloader/qts60stylethemeio.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/exceptions/modificationgroupexception.cpp b/src/plugins/qmldesigner/designercore/exceptions/modificationgroupexception.cpp index 20dde948b6..57655ce687 100644 --- a/src/plugins/qmldesigner/designercore/exceptions/modificationgroupexception.cpp +++ b/src/plugins/qmldesigner/designercore/exceptions/modificationgroupexception.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/include/abstractview.h b/src/plugins/qmldesigner/designercore/include/abstractview.h index 88fc9204c9..45b2a064d6 100644 --- a/src/plugins/qmldesigner/designercore/include/abstractview.h +++ b/src/plugins/qmldesigner/designercore/include/abstractview.h @@ -121,8 +121,11 @@ public: void emitInstancesChildrenChanged(const QVector<ModelNode> &nodeList); void emitRewriterBeginTransaction(); void emitRewriterEndTransaction(); + void emitInstanceToken(const QString &token, int number, const QVector<ModelNode> &nodeVector); void emitActualStateChanged(const ModelNode &node); + void sendTokenToInstances(const QString &token, int number, const QVector<ModelNode> &nodeVector); + virtual void modelAttached(Model *model); virtual void modelAboutToBeDetached(Model *model); @@ -144,6 +147,8 @@ public: virtual void instancesRenderImageChanged(const QVector<ModelNode> &nodeList) = 0; virtual void instancesPreviewImageChanged(const QVector<ModelNode> &nodeList) = 0; virtual void instancesChildrenChanged(const QVector<ModelNode> &nodeList) = 0; + virtual void instancesToken(const QString &tokenName, int tokenNumber, const QVector<ModelNode> &nodeVector) = 0; + virtual void nodeSourceChanged(const ModelNode &modelNode, const QString &newNodeSource) = 0; virtual void rewriterBeginTransaction() = 0; diff --git a/src/plugins/qmldesigner/designercore/include/anchorline.h b/src/plugins/qmldesigner/designercore/include/anchorline.h index 54d317719a..c41cebda88 100644 --- a/src/plugins/qmldesigner/designercore/include/anchorline.h +++ b/src/plugins/qmldesigner/designercore/include/anchorline.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/include/bytearraymodifier.h b/src/plugins/qmldesigner/designercore/include/bytearraymodifier.h index bfa2eb6a2d..9110036c17 100644 --- a/src/plugins/qmldesigner/designercore/include/bytearraymodifier.h +++ b/src/plugins/qmldesigner/designercore/include/bytearraymodifier.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/include/model.h b/src/plugins/qmldesigner/designercore/include/model.h index e5ce969dbe..b2d51001a4 100644 --- a/src/plugins/qmldesigner/designercore/include/model.h +++ b/src/plugins/qmldesigner/designercore/include/model.h @@ -104,7 +104,7 @@ public: // Imports: QList<Import> imports() const; void changeImports(const QList<Import> &importsToBeAdded, const QList<Import> &importsToBeRemoved); - bool hasImport(const Import &import, bool ignoreAlias = true); + bool hasImport(const Import &import, bool ignoreAlias = true, bool allowHigherVersion = false); RewriterView *rewriterView() const; diff --git a/src/plugins/qmldesigner/designercore/include/modificationgroupexception.h b/src/plugins/qmldesigner/designercore/include/modificationgroupexception.h index b709522b26..fbfc93bc79 100644 --- a/src/plugins/qmldesigner/designercore/include/modificationgroupexception.h +++ b/src/plugins/qmldesigner/designercore/include/modificationgroupexception.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/include/modificationgrouptoken.h b/src/plugins/qmldesigner/designercore/include/modificationgrouptoken.h index 56baa0e420..08ec189174 100644 --- a/src/plugins/qmldesigner/designercore/include/modificationgrouptoken.h +++ b/src/plugins/qmldesigner/designercore/include/modificationgrouptoken.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/include/nodeabstractproperty.h b/src/plugins/qmldesigner/designercore/include/nodeabstractproperty.h index 6260a3461c..9e69201688 100644 --- a/src/plugins/qmldesigner/designercore/include/nodeabstractproperty.h +++ b/src/plugins/qmldesigner/designercore/include/nodeabstractproperty.h @@ -47,6 +47,11 @@ class NodeAbstractProperty : public AbstractProperty friend class QmlDesigner::ModelNode; friend class QmlDesigner::Internal::ModelPrivate; friend class QmlDesigner::AbstractProperty; + + friend CORESHARED_EXPORT bool operator ==(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2); + friend CORESHARED_EXPORT bool operator !=(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2); + friend CORESHARED_EXPORT uint qHash(const NodeAbstractProperty& property); + public: NodeAbstractProperty(); NodeAbstractProperty(const NodeAbstractProperty &property, AbstractView *view); @@ -63,6 +68,13 @@ protected: void reparentHere(const ModelNode &modelNode, bool isNodeList); }; + +CORESHARED_EXPORT bool operator ==(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2); +CORESHARED_EXPORT bool operator !=(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2); +CORESHARED_EXPORT uint qHash(const NodeAbstractProperty& property); +CORESHARED_EXPORT QTextStream& operator<<(QTextStream &stream, const NodeAbstractProperty &property); +CORESHARED_EXPORT QDebug operator<<(QDebug debug, const NodeAbstractProperty &property); + } // namespace QmlDesigner #endif // NODEABSTRACTPROPERTY_H diff --git a/src/plugins/qmldesigner/designercore/include/nodeanchors.h b/src/plugins/qmldesigner/designercore/include/nodeanchors.h index 8b09513a4d..4486ccceae 100644 --- a/src/plugins/qmldesigner/designercore/include/nodeanchors.h +++ b/src/plugins/qmldesigner/designercore/include/nodeanchors.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h b/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h index 1cc469b411..053da698e2 100644 --- a/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h +++ b/src/plugins/qmldesigner/designercore/include/nodeinstanceview.h @@ -69,6 +69,8 @@ class ChangeIdsCommand; class RemoveInstancesCommand; class RemovePropertiesCommand; class CompleteComponentCommand; +class InformationContainer; +class TokenCommand; class CORESHARED_EXPORT NodeInstanceView : public AbstractView, public NodeInstanceClientInterface { @@ -106,10 +108,12 @@ public: 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 auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data); void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data); void nodeSourceChanged(const ModelNode &modelNode, const QString &newNodeSource); + void rewriterBeginTransaction(); void rewriterEndTransaction(); @@ -135,11 +139,14 @@ public: void childrenChanged(const ChildrenChangedCommand &command); void statePreviewImagesChanged(const StatePreviewImageChangedCommand &command); void componentCompleted(const ComponentCompletedCommand &command); + void token(const TokenCommand &command); QImage statePreviewImage(const ModelNode &stateNode) const; void setPathToQt(const QString &pathToQt); + void sendToken(const QString &token, int number, const QVector<ModelNode> &nodeVector); + signals: void qmlPuppetCrashed(); @@ -161,6 +168,8 @@ private: // functions void clearStateInstance(); NodeInstanceServerInterface *nodeInstanceServer() const; + QMultiHash<ModelNode, InformationName> informationChanged(const QVector<InformationContainer> &containerVector); + CreateSceneCommand createCreateSceneCommand(); ClearSceneCommand createClearSceneCommand() const; diff --git a/src/plugins/qmldesigner/designercore/include/objectpropertybinding.h b/src/plugins/qmldesigner/designercore/include/objectpropertybinding.h index 562a425f8a..db43ab5940 100644 --- a/src/plugins/qmldesigner/designercore/include/objectpropertybinding.h +++ b/src/plugins/qmldesigner/designercore/include/objectpropertybinding.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/include/propertybinding.h b/src/plugins/qmldesigner/designercore/include/propertybinding.h index 775e124530..85487a1e4f 100644 --- a/src/plugins/qmldesigner/designercore/include/propertybinding.h +++ b/src/plugins/qmldesigner/designercore/include/propertybinding.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/include/qmlmodelview.h b/src/plugins/qmldesigner/designercore/include/qmlmodelview.h index 4b72f12481..d77bfbb6cb 100644 --- a/src/plugins/qmldesigner/designercore/include/qmlmodelview.h +++ b/src/plugins/qmldesigner/designercore/include/qmlmodelview.h @@ -98,6 +98,7 @@ public: 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 rewriterBeginTransaction(); void rewriterEndTransaction(); diff --git a/src/plugins/qmldesigner/designercore/include/replaceallobjectdefinitionsvisitor.h b/src/plugins/qmldesigner/designercore/include/replaceallobjectdefinitionsvisitor.h index baa92ffc6a..98d901f119 100644 --- a/src/plugins/qmldesigner/designercore/include/replaceallobjectdefinitionsvisitor.h +++ b/src/plugins/qmldesigner/designercore/include/replaceallobjectdefinitionsvisitor.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/include/rewriterview.h b/src/plugins/qmldesigner/designercore/include/rewriterview.h index 2f3bf35e5c..e78b6e733a 100644 --- a/src/plugins/qmldesigner/designercore/include/rewriterview.h +++ b/src/plugins/qmldesigner/designercore/include/rewriterview.h @@ -143,6 +143,8 @@ public: 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(); diff --git a/src/plugins/qmldesigner/designercore/include/stylemanager.h b/src/plugins/qmldesigner/designercore/include/stylemanager.h index 8af2b28f20..838e720d8a 100644 --- a/src/plugins/qmldesigner/designercore/include/stylemanager.h +++ b/src/plugins/qmldesigner/designercore/include/stylemanager.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/include/widgetplugin_helper.h b/src/plugins/qmldesigner/designercore/include/widgetplugin_helper.h index 211c31b06c..83414ab514 100644 --- a/src/plugins/qmldesigner/designercore/include/widgetplugin_helper.h +++ b/src/plugins/qmldesigner/designercore/include/widgetplugin_helper.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/include/widgetqueryview.h b/src/plugins/qmldesigner/designercore/include/widgetqueryview.h index 42de5494eb..5a87046bfb 100644 --- a/src/plugins/qmldesigner/designercore/include/widgetqueryview.h +++ b/src/plugins/qmldesigner/designercore/include/widgetqueryview.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp index daccbb77c8..8c8f1bef42 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp @@ -65,6 +65,7 @@ #include "imagecontainer.h" #include "statepreviewimagechangedcommand.h" #include "componentcompletedcommand.h" +#include "tokencommand.h" #include "synchronizecommand.h" @@ -203,7 +204,7 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV QMessageBox::warning(0, tr("Cannot Find QML Puppet Executable"), tr("The executable of the QML Puppet process (%1) cannot be found. " "Please check your installation. " - "QML Puppet is a process which runs in the background to render the the items."). + "QML Puppet is a process which runs in the background to render the items."). arg(applicationPath)); } } @@ -241,6 +242,7 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command) static const int statePreviewImageChangedCommandType = QMetaType::type("StatePreviewImageChangedCommand"); static const int componentCompletedCommandType = QMetaType::type("ComponentCompletedCommand"); static const int synchronizeCommandType = QMetaType::type("SynchronizeCommand"); + static const int tokenCommandType = QMetaType::type("TokenCommand"); if (command.userType() == informationChangedCommandType) nodeInstanceClient()->informationChanged(command.value<InformationChangedCommand>()); @@ -254,6 +256,8 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command) nodeInstanceClient()->statePreviewImagesChanged(command.value<StatePreviewImageChangedCommand>()); else if (command.userType() == componentCompletedCommandType) nodeInstanceClient()->componentCompleted(command.value<ComponentCompletedCommand>()); + else if (command.userType() == tokenCommandType) + nodeInstanceClient()->token(command.value<TokenCommand>()); else if (command.userType() == synchronizeCommandType) { SynchronizeCommand synchronizeCommand = command.value<SynchronizeCommand>(); m_synchronizeId = synchronizeCommand.synchronizeId(); @@ -523,4 +527,9 @@ void NodeInstanceServerProxy::changeNodeSource(const ChangeNodeSourceCommand &co writeCommand(QVariant::fromValue(command)); } +void NodeInstanceServerProxy::token(const TokenCommand &command) +{ + writeCommand(QVariant::fromValue(command)); +} + } // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h index 6197694df0..42bf3e95ce 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.h @@ -71,6 +71,7 @@ public: void changeState(const ChangeStateCommand &command); void completeComponent(const CompleteComponentCommand &command); void changeNodeSource(const ChangeNodeSourceCommand &command); + void token(const TokenCommand &command); protected: void writeCommand(const QVariant &command); diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp index 65c5a1bfba..b21add18e2 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp @@ -80,6 +80,7 @@ #include "statepreviewimagechangedcommand.h" #include "completecomponentcommand.h" #include "componentcompletedcommand.h" +#include "tokencommand.h" #include "nodeinstanceserverproxy.h" @@ -483,6 +484,11 @@ void NodeInstanceView::instancesChildrenChanged(const QVector<ModelNode> &/*node } +void NodeInstanceView::instancesToken(const QString &/*tokenName*/, int /*tokenNumber*/, const QVector<ModelNode> &/*nodeVector*/) +{ + +} + void NodeInstanceView::auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data) { if (node.isRootNode() && (name == "width" || name == "height")) { @@ -1058,14 +1064,11 @@ void NodeInstanceView::pixmapChanged(const PixmapChangedCommand &command) emitInstancesRenderImageChanged(renderImageChangeSet.toList().toVector()); } -void NodeInstanceView::informationChanged(const InformationChangedCommand &command) +QMultiHash<ModelNode, InformationName> NodeInstanceView::informationChanged(const QVector<InformationContainer> &containerVector) { - if (!model()) - return; - QMultiHash<ModelNode, InformationName> informationChangeHash; - foreach(const InformationContainer &container, command.informations()) { + foreach (const InformationContainer &container, containerVector) { if (hasInstanceForId(container.instanceId())) { NodeInstance instance = instanceForId(container.instanceId()); if (instance.isValid()) { @@ -1076,6 +1079,16 @@ void NodeInstanceView::informationChanged(const InformationChangedCommand &comma } } + return informationChangeHash; +} + +void NodeInstanceView::informationChanged(const InformationChangedCommand &command) +{ + if (!model()) + return; + + QMultiHash<ModelNode, InformationName> informationChangeHash = informationChanged(command.informations()); + if (!informationChangeHash.isEmpty()) emitInstanceInformationsChange(informationChangeHash); } @@ -1138,6 +1151,7 @@ void NodeInstanceView::childrenChanged(const ChildrenChangedCommand &command) if (!model()) return; + QVector<ModelNode> childNodeVector; foreach(qint32 instanceId, command.childrenInstances()) { @@ -1148,8 +1162,39 @@ void NodeInstanceView::childrenChanged(const ChildrenChangedCommand &command) } } + QMultiHash<ModelNode, InformationName> informationChangeHash = informationChanged(command.informations()); + + if (!informationChangeHash.isEmpty()) + emitInstanceInformationsChange(informationChangeHash); + if (!childNodeVector.isEmpty()) emitInstancesChildrenChanged(childNodeVector); } +void NodeInstanceView::token(const TokenCommand &command) +{ + if (!model()) + return; + + QVector<ModelNode> nodeVector; + + foreach (const qint32 &instanceId, command.instances()) { + if (hasModelNodeForInternalId(instanceId)) { + nodeVector.append(modelNodeForInternalId(instanceId)); + } + } + + + emitInstanceToken(command.tokenName(), command.tokenNumber(), nodeVector); +} + +void NodeInstanceView::sendToken(const QString &token, int number, const QVector<ModelNode> &nodeVector) +{ + QVector<qint32> instanceIdVector; + foreach (const ModelNode &node, nodeVector) + instanceIdVector.append(node.internalId()); + + nodeInstanceServer()->token(TokenCommand(token, number, instanceIdVector)); +} + } diff --git a/src/plugins/qmldesigner/designercore/model/abstractview.cpp b/src/plugins/qmldesigner/designercore/model/abstractview.cpp index 4117986b1e..b8f589b669 100644 --- a/src/plugins/qmldesigner/designercore/model/abstractview.cpp +++ b/src/plugins/qmldesigner/designercore/model/abstractview.cpp @@ -429,6 +429,18 @@ void AbstractView::emitRewriterBeginTransaction() model()->m_d->notifyRewriterBeginTransaction(); } +void AbstractView::sendTokenToInstances(const QString &token, int number, const QVector<ModelNode> &nodeVector) +{ + if (nodeInstanceView()) + nodeInstanceView()->sendToken(token, number, nodeVector); +} + +void AbstractView::emitInstanceToken(const QString &token, int number, const QVector<ModelNode> &nodeVector) +{ + if (nodeInstanceView()) + model()->m_d->notifyInstanceToken(token, number, nodeVector); +} + void AbstractView::emitRewriterEndTransaction() { if (model()) diff --git a/src/plugins/qmldesigner/designercore/model/anchorline.cpp b/src/plugins/qmldesigner/designercore/model/anchorline.cpp index ee8159ec50..b8fccdd4a8 100644 --- a/src/plugins/qmldesigner/designercore/model/anchorline.cpp +++ b/src/plugins/qmldesigner/designercore/model/anchorline.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/model/bytearraymodifier.cpp b/src/plugins/qmldesigner/designercore/model/bytearraymodifier.cpp index 2df0d4246b..c067653070 100644 --- a/src/plugins/qmldesigner/designercore/model/bytearraymodifier.cpp +++ b/src/plugins/qmldesigner/designercore/model/bytearraymodifier.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/model/copyhelper.cpp b/src/plugins/qmldesigner/designercore/model/copyhelper.cpp index 7a9502c658..1a7ea3b7a0 100644 --- a/src/plugins/qmldesigner/designercore/model/copyhelper.cpp +++ b/src/plugins/qmldesigner/designercore/model/copyhelper.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/model/copyhelper.h b/src/plugins/qmldesigner/designercore/model/copyhelper.h index bdfd9c8de5..61f531320e 100644 --- a/src/plugins/qmldesigner/designercore/model/copyhelper.h +++ b/src/plugins/qmldesigner/designercore/model/copyhelper.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/model/model.cpp b/src/plugins/qmldesigner/designercore/model/model.cpp index 18404c3054..938026c3f9 100644 --- a/src/plugins/qmldesigner/designercore/model/model.cpp +++ b/src/plugins/qmldesigner/designercore/model/model.cpp @@ -681,6 +681,36 @@ void ModelPrivate::notifyRewriterEndTransaction() } } +void ModelPrivate::notifyInstanceToken(const QString &token, int number, const QVector<ModelNode> &nodeVector) +{ + bool resetModel = false; + QString description; + + QVector<Internal::InternalNode::Pointer> internalVector(toInternalNodeVector(nodeVector)); + + + try { + if (rewriterView()) + rewriterView()->instancesToken(token, number, toModelNodeVector(internalVector, rewriterView())); + } catch (RewritingException &e) { + description = e.description(); + resetModel = true; + } + + foreach (const QWeakPointer<AbstractView> &view, m_viewList) { + Q_ASSERT(view != 0); + view->instancesToken(token, number, toModelNodeVector(internalVector, view.data())); + } + + if (nodeInstanceView()) { + nodeInstanceView()->instancesToken(token, number, toModelNodeVector(internalVector, nodeInstanceView())); + } + + if (resetModel) { + resetModelByRewriter(description); + } +} + void ModelPrivate::notifyCustomNotification(const AbstractView *senderView, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data) { bool resetModel = false; @@ -1742,7 +1772,39 @@ void Model::changeImports(const QList<Import> &importsToBeAdded, const QList<Imp m_d->changeImports(importsToBeAdded, importsToBeRemoved); } -bool Model::hasImport(const Import &import, bool ignoreAlias) + +static bool compareVersions(const QString &version1, const QString &version2, bool allowHigherVersion) +{ + if (version1 == version2) + return true; + if (!allowHigherVersion) + return false; + QStringList version1List = version1.split('.'); + QStringList version2List = version2.split('.'); + if (version1List.count() == 2 && version2List.count() == 2) { + bool ok; + int major1 = version1List.first().toInt(&ok); + if (!ok) + return false; + int major2 = version2List.first().toInt(&ok); + if (!ok) + return false; + if (major1 >= major2) { + int minor1 = version1List.last().toInt(&ok); + if (!ok) + return false; + int minor2 = version2List.last().toInt(&ok); + if (!ok) + return false; + if (minor1 >= minor2) + return true; + } + } + + return false; +} + +bool Model::hasImport(const Import &import, bool ignoreAlias, bool allowHigherVersion) { if (imports().contains(import)) return true; @@ -1751,10 +1813,10 @@ bool Model::hasImport(const Import &import, bool ignoreAlias) foreach (const Import &existingImport, imports()) { if (existingImport.isFileImport() && import.isFileImport()) - if (existingImport.file() == import.file() && existingImport.version() == import.version()) + if (existingImport.file() == import.file() && compareVersions(existingImport.version(), import.version(), allowHigherVersion)) return true; if (existingImport.isLibraryImport() && import.isLibraryImport()) - if (existingImport.url() == import.url() && existingImport.version() == import.version()) + if (existingImport.url() == import.url() && compareVersions(existingImport.version(), import.version(), allowHigherVersion)) return true; } return false; diff --git a/src/plugins/qmldesigner/designercore/model/model_p.h b/src/plugins/qmldesigner/designercore/model/model_p.h index c806b1b82a..bc6ff14564 100644 --- a/src/plugins/qmldesigner/designercore/model/model_p.h +++ b/src/plugins/qmldesigner/designercore/model/model_p.h @@ -156,12 +156,13 @@ public: void notifyInstancesRenderImageChanged(const QVector<ModelNode> &nodeList); void notifyInstancesPreviewImageChanged(const QVector<ModelNode> &nodeList); void notifyInstancesChildrenChanged(const QVector<ModelNode> &nodeList); + void notifyInstanceToken(const QString &token, int number, const QVector<ModelNode> &nodeVector); + void notifyActualStateChanged(const ModelNode &node); void notifyRewriterBeginTransaction(); void notifyRewriterEndTransaction(); - void setSelectedNodes(const QList<InternalNodePointer> &selectedNodeList); void clearSelectedNodes(); QList<InternalNodePointer> selectedNodes() const; diff --git a/src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.cpp b/src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.cpp index 780c090730..88cb7278a5 100644 --- a/src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.cpp +++ b/src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "modelnodecontextmenu.h" #include <QApplication> #include <coreplugin/editormanager/editormanager.h> diff --git a/src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.h b/src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.h index bbec61c210..df37142954 100644 --- a/src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.h +++ b/src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.h @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #ifndef MODELNODECONTEXTMENU_H #define MODELNODECONTEXTMENU_H diff --git a/src/plugins/qmldesigner/designercore/model/modelrewriter.cpp b/src/plugins/qmldesigner/designercore/model/modelrewriter.cpp index e57f6f2417..a13345493f 100644 --- a/src/plugins/qmldesigner/designercore/model/modelrewriter.cpp +++ b/src/plugins/qmldesigner/designercore/model/modelrewriter.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/model/modelrewriter.h b/src/plugins/qmldesigner/designercore/model/modelrewriter.h index fdbb214848..05f358fa98 100644 --- a/src/plugins/qmldesigner/designercore/model/modelrewriter.h +++ b/src/plugins/qmldesigner/designercore/model/modelrewriter.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/model/modificationgrouptoken.cpp b/src/plugins/qmldesigner/designercore/model/modificationgrouptoken.cpp index 5451717da3..dbadf522ce 100644 --- a/src/plugins/qmldesigner/designercore/model/modificationgrouptoken.cpp +++ b/src/plugins/qmldesigner/designercore/model/modificationgrouptoken.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/model/nodeabstractproperty.cpp b/src/plugins/qmldesigner/designercore/model/nodeabstractproperty.cpp index 530269f22a..8ebd1d4a7e 100644 --- a/src/plugins/qmldesigner/designercore/model/nodeabstractproperty.cpp +++ b/src/plugins/qmldesigner/designercore/model/nodeabstractproperty.cpp @@ -141,4 +141,36 @@ QList<ModelNode> NodeAbstractProperty::allSubNodes() return toModelNodeList(property->allSubNodes(), view()); } +/*! + \brief Returns if the the two property handles reference the same property in the same node +*/ +bool operator ==(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2) +{ + return AbstractProperty(property1) == AbstractProperty(property2); +} + +/*! + \brief Returns if the the two property handles do not reference the same property in the same node + */ +bool operator !=(const NodeAbstractProperty &property1, const NodeAbstractProperty &property2) +{ + return !(property1 == property2); +} + +uint qHash(const NodeAbstractProperty &property) +{ + return qHash(AbstractProperty(property)); +} + +QDebug operator<<(QDebug debug, const NodeAbstractProperty &property) +{ + return debug.nospace() << "NodeAbstractProperty(" << (property.isValid() ? property.name() : QLatin1String("invalid")) << ')'; +} + +QTextStream& operator<<(QTextStream &stream, const NodeAbstractProperty &property) +{ + stream << "NodeAbstractProperty(" << property.name() << ')'; + + return stream; +} } // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/designercore/model/nodeanchors.cpp b/src/plugins/qmldesigner/designercore/model/nodeanchors.cpp index 83a1ac5144..e58778d5be 100644 --- a/src/plugins/qmldesigner/designercore/model/nodeanchors.cpp +++ b/src/plugins/qmldesigner/designercore/model/nodeanchors.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/model/objectpropertybinding.cpp b/src/plugins/qmldesigner/designercore/model/objectpropertybinding.cpp index 771b0f0146..f541abb87e 100644 --- a/src/plugins/qmldesigner/designercore/model/objectpropertybinding.cpp +++ b/src/plugins/qmldesigner/designercore/model/objectpropertybinding.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/model/parsedqml.cpp b/src/plugins/qmldesigner/designercore/model/parsedqml.cpp index 733c31c38f..543703df04 100644 --- a/src/plugins/qmldesigner/designercore/model/parsedqml.cpp +++ b/src/plugins/qmldesigner/designercore/model/parsedqml.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/model/parsedqml.h b/src/plugins/qmldesigner/designercore/model/parsedqml.h index 0bba6c57b8..9b4cbecc7d 100644 --- a/src/plugins/qmldesigner/designercore/model/parsedqml.h +++ b/src/plugins/qmldesigner/designercore/model/parsedqml.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/model/paster.cpp b/src/plugins/qmldesigner/designercore/model/paster.cpp index d8dcb79f3f..52f29146c6 100644 --- a/src/plugins/qmldesigner/designercore/model/paster.cpp +++ b/src/plugins/qmldesigner/designercore/model/paster.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/model/paster.h b/src/plugins/qmldesigner/designercore/model/paster.h index 38ccc01b9e..3f9d07c392 100644 --- a/src/plugins/qmldesigner/designercore/model/paster.h +++ b/src/plugins/qmldesigner/designercore/model/paster.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/model/propertybinding.cpp b/src/plugins/qmldesigner/designercore/model/propertybinding.cpp index 792321f0d3..d88ce07e8c 100644 --- a/src/plugins/qmldesigner/designercore/model/propertybinding.cpp +++ b/src/plugins/qmldesigner/designercore/model/propertybinding.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp b/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp index 682a6e2d4a..ceec3fbd21 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp @@ -196,7 +196,7 @@ QmlItemNode QmlModelView::createQmlItemNode(const ItemLibraryEntry &itemLibraryE } } - if (!model()->hasImport(newImport, true)) { + if (!model()->hasImport(newImport, true, true)) { model()->changeImports(QList<Import>() << newImport, QList<Import>()); } } @@ -414,6 +414,11 @@ void QmlModelView::importsChanged(const QList<Import> &/*addedImports*/, const Q } +void QmlModelView::instancesToken(const QString &/*tokenName*/, int /*tokenNumber*/, const QVector<ModelNode> &/*nodeVector*/) +{ + +} + void QmlModelView::nodeSourceChanged(const ModelNode &, const QString & /*newNodeSource*/) { diff --git a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp index 6b1d820012..a2ce780006 100644 --- a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp +++ b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp @@ -407,6 +407,11 @@ void RewriterView::instancesChildrenChanged(const QVector<ModelNode> & /*nodeLis } +void RewriterView::instancesToken(const QString &/*tokenName*/, int /*tokenNumber*/, const QVector<ModelNode> &/*nodeVector*/) +{ + +} + void RewriterView::nodeSourceChanged(const ModelNode &, const QString & /*newNodeSource*/) { diff --git a/src/plugins/qmldesigner/designercore/model/viewlogger.cpp b/src/plugins/qmldesigner/designercore/model/viewlogger.cpp index b49a2358a9..2bb3e4eadc 100644 --- a/src/plugins/qmldesigner/designercore/model/viewlogger.cpp +++ b/src/plugins/qmldesigner/designercore/model/viewlogger.cpp @@ -260,6 +260,13 @@ void ViewLogger::instancesChildrenChanged(const QVector<ModelNode> &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; diff --git a/src/plugins/qmldesigner/designercore/model/viewlogger.h b/src/plugins/qmldesigner/designercore/model/viewlogger.h index 01fc89ca25..2ca8ffa5e7 100644 --- a/src/plugins/qmldesigner/designercore/model/viewlogger.h +++ b/src/plugins/qmldesigner/designercore/model/viewlogger.h @@ -81,6 +81,8 @@ public: 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(); diff --git a/src/plugins/qmldesigner/designercore/preview/stylemanager.cpp b/src/plugins/qmldesigner/designercore/preview/stylemanager.cpp index 3957af5ff6..09e89a6df8 100644 --- a/src/plugins/qmldesigner/designercore/preview/stylemanager.cpp +++ b/src/plugins/qmldesigner/designercore/preview/stylemanager.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/qmlcontextpane.cpp b/src/plugins/qmldesigner/qmlcontextpane.cpp index 64cac4cf49..447a69fbe3 100644 --- a/src/plugins/qmldesigner/qmlcontextpane.cpp +++ b/src/plugins/qmldesigner/qmlcontextpane.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/qmlcontextpane.h b/src/plugins/qmldesigner/qmlcontextpane.h index 63d334c6db..9bc72eb950 100644 --- a/src/plugins/qmldesigner/qmlcontextpane.h +++ b/src/plugins/qmldesigner/qmlcontextpane.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmldesigner/qtquickplugin/source/gridview.qml b/src/plugins/qmldesigner/qtquickplugin/source/gridview.qml index 508edc8b83..3fd0503bb7 100644 --- a/src/plugins/qmldesigner/qtquickplugin/source/gridview.qml +++ b/src/plugins/qmldesigner/qtquickplugin/source/gridview.qml @@ -1,8 +1,42 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + import QtQuick 1.0 GridView { - width: 200 - height: 200 + width: 140 + height: 140 + cellWidth: 70 + cellHeight: 70 model: ListModel { diff --git a/src/plugins/qmldesigner/qtquickplugin/source/listview.qml b/src/plugins/qmldesigner/qtquickplugin/source/listview.qml index 3f4f90abd3..5c5277e1f4 100644 --- a/src/plugins/qmldesigner/qtquickplugin/source/listview.qml +++ b/src/plugins/qmldesigner/qtquickplugin/source/listview.qml @@ -1,7 +1,39 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + import QtQuick 1.0 ListView { - width: 160 + width: 110 height: 160 model: ListModel { ListElement { diff --git a/src/plugins/qmldesigner/qtquickplugin/source/pathview.qml b/src/plugins/qmldesigner/qtquickplugin/source/pathview.qml index 13b3f543c5..2eea6619e5 100644 --- a/src/plugins/qmldesigner/qtquickplugin/source/pathview.qml +++ b/src/plugins/qmldesigner/qtquickplugin/source/pathview.qml @@ -1,8 +1,40 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + import QtQuick 1.0 PathView { width: 250 - height: 200 + height: 130 path: Path { startX: 120 diff --git a/src/plugins/qmldesigner/qtquickplugin/source/text.qml b/src/plugins/qmldesigner/qtquickplugin/source/text.qml index 088dfdd124..10a9aabc82 100644 --- a/src/plugins/qmldesigner/qtquickplugin/source/text.qml +++ b/src/plugins/qmldesigner/qtquickplugin/source/text.qml @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + import QtQuick 1.0 Text { diff --git a/src/plugins/qmldesigner/qtquickplugin/source/textedit.qml b/src/plugins/qmldesigner/qtquickplugin/source/textedit.qml index ac1bc18b44..87254f21c4 100644 --- a/src/plugins/qmldesigner/qtquickplugin/source/textedit.qml +++ b/src/plugins/qmldesigner/qtquickplugin/source/textedit.qml @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + import QtQuick 1.0 Text { diff --git a/src/plugins/qmldesigner/qtquickplugin/source/textinput.qml b/src/plugins/qmldesigner/qtquickplugin/source/textinput.qml index d78a430d03..423e599993 100644 --- a/src/plugins/qmldesigner/qtquickplugin/source/textinput.qml +++ b/src/plugins/qmldesigner/qtquickplugin/source/textinput.qml @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + import QtQuick 1.0 Text { diff --git a/src/plugins/qmljseditor/qmljscompletionassist.cpp b/src/plugins/qmljseditor/qmljscompletionassist.cpp index bda56d06c3..1784c3cb9d 100644 --- a/src/plugins/qmljseditor/qmljscompletionassist.cpp +++ b/src/plugins/qmljseditor/qmljscompletionassist.cpp @@ -777,7 +777,9 @@ void QmlJSCompletionAssistProcessor::addCompletionsPropertyLhs(const QHash<QStri it.next(); QString itemText = it.key(); - QLatin1String postfix(": "); + QString postfix; + if (!itemText.isEmpty() && itemText.at(0).isLower()) + postfix = QLatin1String(": "); if (afterOn) postfix = QLatin1String(" {"); if (const Interpreter::QmlObjectValue *qmlValue = diff --git a/src/plugins/qmljstools/qmljscodestylesettingsfactory.cpp b/src/plugins/qmljstools/qmljscodestylesettingsfactory.cpp index d372482298..60a2a29f2d 100644 --- a/src/plugins/qmljstools/qmljscodestylesettingsfactory.cpp +++ b/src/plugins/qmljstools/qmljscodestylesettingsfactory.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "qmljscodestylesettingsfactory.h" #include "qmljscodestylesettingspage.h" #include "qmljstoolsconstants.h" diff --git a/src/plugins/qmljstools/qmljscodestylesettingsfactory.h b/src/plugins/qmljstools/qmljscodestylesettingsfactory.h index 321f564e92..7efba77933 100644 --- a/src/plugins/qmljstools/qmljscodestylesettingsfactory.h +++ b/src/plugins/qmljstools/qmljscodestylesettingsfactory.h @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #ifndef QMLJSCODESTYLESETTINGSFACTORY_H #define QMLJSCODESTYLESETTINGSFACTORY_H diff --git a/src/plugins/qmljstools/qmljscodestylesettingspage.cpp b/src/plugins/qmljstools/qmljscodestylesettingspage.cpp index 40f2eccdb3..7be5e33184 100644 --- a/src/plugins/qmljstools/qmljscodestylesettingspage.cpp +++ b/src/plugins/qmljstools/qmljscodestylesettingspage.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "qmljscodestylesettingspage.h" #include "ui_qmljscodestylesettingspage.h" #include "qmljstoolsconstants.h" diff --git a/src/plugins/qmljstools/qmljscodestylesettingspage.h b/src/plugins/qmljstools/qmljscodestylesettingspage.h index 733160ba43..7629233203 100644 --- a/src/plugins/qmljstools/qmljscodestylesettingspage.h +++ b/src/plugins/qmljstools/qmljscodestylesettingspage.h @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #ifndef QMLJSCODESTYLESETTINGSPAGE_H #define QMLJSCODESTYLESETTINGSPAGE_H diff --git a/src/plugins/qmljstools/qmljstoolssettings.cpp b/src/plugins/qmljstools/qmljstoolssettings.cpp index d471b7e18e..e1f161f129 100644 --- a/src/plugins/qmljstools/qmljstoolssettings.cpp +++ b/src/plugins/qmljstools/qmljstoolssettings.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "qmljstoolssettings.h" #include "qmljstoolsconstants.h" diff --git a/src/plugins/qmljstools/qmljstoolssettings.h b/src/plugins/qmljstools/qmljstoolssettings.h index 9eb8b657c5..8bc0e10461 100644 --- a/src/plugins/qmljstools/qmljstoolssettings.h +++ b/src/plugins/qmljstools/qmljstoolssettings.h @@ -4,30 +4,29 @@ ** ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativecanvas.cpp b/src/plugins/qmlprofiler/canvas/qdeclarativecanvas.cpp index e66ef7c3dd..06c27d12b4 100644 --- a/src/plugins/qmlprofiler/canvas/qdeclarativecanvas.cpp +++ b/src/plugins/qmlprofiler/canvas/qdeclarativecanvas.cpp @@ -1,43 +1,34 @@ -/**************************************************************************** +/************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (info@qt.nokia.com) +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** -** This file is part of the QtDeclarative module of the Qt Toolkit. +** Contact: Nokia Corporation (info@qt.nokia.com) ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** +** Other Usage ** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. ** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. ** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +**************************************************************************/ #include "qdeclarativecanvas_p.h" #include "qdeclarativecanvastimer_p.h" diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativecanvas_p.h b/src/plugins/qmlprofiler/canvas/qdeclarativecanvas_p.h index d7601d35e3..b43eefecef 100644 --- a/src/plugins/qmlprofiler/canvas/qdeclarativecanvas_p.h +++ b/src/plugins/qmlprofiler/canvas/qdeclarativecanvas_p.h @@ -1,43 +1,34 @@ -/**************************************************************************** +/************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (info@qt.nokia.com) +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** -** This file is part of the QtDeclarative module of the Qt Toolkit. +** Contact: Nokia Corporation (info@qt.nokia.com) ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** +** Other Usage ** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. ** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. ** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +**************************************************************************/ #ifndef QDECLARATIVECANVAS_P_H #define QDECLARATIVECANVAS_P_H diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer.cpp b/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer.cpp index c5efd4f1b4..44a3d3b56b 100644 --- a/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer.cpp +++ b/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer.cpp @@ -1,43 +1,34 @@ -/**************************************************************************** +/************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (info@qt.nokia.com) +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** -** This file is part of the QtDeclarative module of the Qt Toolkit. +** Contact: Nokia Corporation (info@qt.nokia.com) ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** +** Other Usage ** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. ** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. ** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +**************************************************************************/ #include <QtScript/qscriptengine.h> #include <QtScript/qscriptvalue.h> diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer_p.h b/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer_p.h index f77a5685cb..17ad439adf 100644 --- a/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer_p.h +++ b/src/plugins/qmlprofiler/canvas/qdeclarativecanvastimer_p.h @@ -1,43 +1,34 @@ -/**************************************************************************** +/************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (info@qt.nokia.com) +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** -** This file is part of the QtDeclarative module of the Qt Toolkit. +** Contact: Nokia Corporation (info@qt.nokia.com) ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** +** Other Usage ** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. ** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. ** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +**************************************************************************/ #ifndef QDECLARATIVECANVASTIMER_P_H #define QDECLARATIVECANVASTIMER_P_H diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp b/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp index ed9d73d3ff..ddaa3d4d95 100644 --- a/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp +++ b/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d.cpp @@ -1,43 +1,34 @@ -/**************************************************************************** +/************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (info@qt.nokia.com) +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** -** This file is part of the QtDeclarative module of the Qt Toolkit. +** Contact: Nokia Corporation (info@qt.nokia.com) ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** +** Other Usage ** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. ** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. ** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +**************************************************************************/ #include "qdeclarativecontext2d_p.h" diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d_p.h b/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d_p.h index 73575fdb61..5d6048d449 100644 --- a/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d_p.h +++ b/src/plugins/qmlprofiler/canvas/qdeclarativecontext2d_p.h @@ -1,43 +1,34 @@ -/**************************************************************************** +/************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (info@qt.nokia.com) +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** -** This file is part of the QtDeclarative module of the Qt Toolkit. +** Contact: Nokia Corporation (info@qt.nokia.com) ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** +** Other Usage ** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. ** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. ** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +**************************************************************************/ #ifndef QDECLARATIVECONTEXT2D_P_H #define QDECLARATIVECONTEXT2D_P_H diff --git a/src/plugins/qmlprofiler/canvas/qdeclarativetiledcanvas_p.h b/src/plugins/qmlprofiler/canvas/qdeclarativetiledcanvas_p.h index ce8346007b..6a0a21ee19 100644 --- a/src/plugins/qmlprofiler/canvas/qdeclarativetiledcanvas_p.h +++ b/src/plugins/qmlprofiler/canvas/qdeclarativetiledcanvas_p.h @@ -1,43 +1,34 @@ -/**************************************************************************** +/************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (info@qt.nokia.com) +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** -** This file is part of the QtDeclarative module of the Qt Toolkit. +** Contact: Nokia Corporation (info@qt.nokia.com) ** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -** +** Other Usage ** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. ** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. ** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +**************************************************************************/ #ifndef QDECLARATIVETILEDCANVAS_P_H #define QDECLARATIVETILEDCANVAS_P_H @@ -52,7 +43,37 @@ QT_MODULE(Declarative) class Context2D; class TiledCanvas : public QDeclarativeItem { - Q_OBJECT + Q_OBJECT/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ Q_PROPERTY(QSizeF canvasSize READ canvasSize WRITE setCanvasSize NOTIFY canvasSizeChanged) Q_PROPERTY(QSize tileSize READ tileSize WRITE setTileSize NOTIFY tileSizeChanged) diff --git a/src/plugins/qmlprofiler/codaqmlprofilerrunner.cpp b/src/plugins/qmlprofiler/codaqmlprofilerrunner.cpp index 4e4b91559c..a2414b8f3b 100644 --- a/src/plugins/qmlprofiler/codaqmlprofilerrunner.cpp +++ b/src/plugins/qmlprofiler/codaqmlprofilerrunner.cpp @@ -4,30 +4,29 @@ ** ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ @@ -50,7 +49,7 @@ CodaQmlProfilerRunner::CodaQmlProfilerRunner(S60DeviceRunConfiguration *configur QObject *parent) : AbstractQmlProfilerRunner(parent), m_configuration(configuration), - m_runControl(new CodaRunControl(configuration, Analyzer::Constants::MODE_ANALYZE)) + m_runControl(new CodaRunControl(configuration, "QmlProfiler")) { connect(m_runControl, SIGNAL(finished()), this, SIGNAL(stopped())); connect(m_runControl, diff --git a/src/plugins/qmlprofiler/codaqmlprofilerrunner.h b/src/plugins/qmlprofiler/codaqmlprofilerrunner.h index 82dbe97d39..e9e931713f 100644 --- a/src/plugins/qmlprofiler/codaqmlprofilerrunner.h +++ b/src/plugins/qmlprofiler/codaqmlprofilerrunner.h @@ -6,26 +6,25 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** diff --git a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp index 38eb80e78d..98762b82e8 100644 --- a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp +++ b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp @@ -6,26 +6,25 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** diff --git a/src/plugins/qmlprofiler/localqmlprofilerrunner.h b/src/plugins/qmlprofiler/localqmlprofilerrunner.h index c50ed76202..2a8b7031b2 100644 --- a/src/plugins/qmlprofiler/localqmlprofilerrunner.h +++ b/src/plugins/qmlprofiler/localqmlprofilerrunner.h @@ -6,26 +6,25 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** diff --git a/src/plugins/qmlprofiler/qml/Detail.qml b/src/plugins/qmlprofiler/qml/Detail.qml index 815130c6af..c0ec386b84 100644 --- a/src/plugins/qmlprofiler/qml/Detail.qml +++ b/src/plugins/qmlprofiler/qml/Detail.qml @@ -6,26 +6,25 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** diff --git a/src/plugins/qmlprofiler/qml/Label.qml b/src/plugins/qmlprofiler/qml/Label.qml index f1fa86b567..abe28391bb 100644 --- a/src/plugins/qmlprofiler/qml/Label.qml +++ b/src/plugins/qmlprofiler/qml/Label.qml @@ -6,26 +6,25 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** diff --git a/src/plugins/qmlprofiler/qml/MainView.js b/src/plugins/qmlprofiler/qml/MainView.js index bbdc25cfa9..bd4752d071 100644 --- a/src/plugins/qmlprofiler/qml/MainView.js +++ b/src/plugins/qmlprofiler/qml/MainView.js @@ -36,7 +36,6 @@ var values = [ ]; //events var ranges = [ ]; var frameFps = [ ]; -var valuesdone = false; var xmargin = 0; var ymargin = 0; var drawFpsGraph = false; @@ -55,7 +54,6 @@ function reset() frameFps = []; xmargin = 0; ymargin = 0; - valuesdone = false; nestingDepth = []; } diff --git a/src/plugins/qmlprofiler/qml/MainView.qml b/src/plugins/qmlprofiler/qml/MainView.qml index 635b4ef8fb..b66c73396b 100644 --- a/src/plugins/qmlprofiler/qml/MainView.qml +++ b/src/plugins/qmlprofiler/qml/MainView.qml @@ -6,26 +6,25 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** @@ -38,9 +37,7 @@ import "MainView.js" as Plotter Rectangle { id: root - property variant colors: Plotter.colors //the colors used for the timeline data - property bool xRay: false //useful for seeing "nested" ranges (but redraw is buggy -- QGV problem?) - property Item currentItem //currently selected item in the view + property bool dataAvailable: false; // move the cursor in the editor signal updateCursorPosition @@ -55,6 +52,7 @@ Rectangle { function clearData() { Plotter.reset(); view.clearData(); + root.dataAvailable = false; rangeMover.x = 2 rangeMover.opacity = 0 } @@ -62,7 +60,6 @@ Rectangle { function clearAll() { clearData(); selectedEventIndex = -1; - Plotter.valuesdone = false; canvas.requestPaint(); view.visible = false; root.elapsedTime = 0; @@ -132,21 +129,21 @@ Rectangle { Connections { target: connection onEvent: { - if (Plotter.valuesdone) { + if (root.dataAvailable) { root.clearData(); } - if (!Plotter.valuesdone && event === 0) //### only handle paint event + if (!root.dataAvailable && event === 0) //### only handle paint event Plotter.values.push(time); } onRange: { - if (Plotter.valuesdone) { + if (root.dataAvailable) { root.clearData(); } // todo: consider nestingLevel - if (!Plotter.valuesdone) { + if (!root.dataAvailable) { if (!Plotter.nestingDepth[type]) Plotter.nestingDepth[type] = nestingInType; else @@ -158,7 +155,7 @@ Rectangle { } onComplete: { - Plotter.valuesdone = true; + root.dataAvailable = true; Plotter.calcFps(); view.visible = true; view.setRanges(Plotter.ranges); @@ -264,7 +261,7 @@ Rectangle { delegate: Rectangle { id: obj - property color baseColor: colors[type] + property color baseColor: Plotter.colors[type] property color myColor: baseColor function conditionalHide() { @@ -302,7 +299,6 @@ Rectangle { } function enableSelected(x,y) { - currentItem = obj myColor = Qt.darker(baseColor, 1.2) rangeDetails.duration = duration rangeDetails.label = label @@ -429,7 +425,7 @@ Rectangle { canvasWindow.height: height onDrawRegion: { - if (Plotter.valuesdone) + if (root.dataAvailable) Plotter.plot(canvas, ctxt, region); else Plotter.drawGraph(canvas, ctxt, region) //just draw the background diff --git a/src/plugins/qmlprofiler/qml/RangeDetails.qml b/src/plugins/qmlprofiler/qml/RangeDetails.qml index 3b817e28c9..7b4207f0af 100644 --- a/src/plugins/qmlprofiler/qml/RangeDetails.qml +++ b/src/plugins/qmlprofiler/qml/RangeDetails.qml @@ -6,26 +6,25 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** diff --git a/src/plugins/qmlprofiler/qml/RangeMover.qml b/src/plugins/qmlprofiler/qml/RangeMover.qml index 193921c688..14443783b8 100644 --- a/src/plugins/qmlprofiler/qml/RangeMover.qml +++ b/src/plugins/qmlprofiler/qml/RangeMover.qml @@ -6,26 +6,25 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** diff --git a/src/plugins/qmlprofiler/qml/TimeDisplay.qml b/src/plugins/qmlprofiler/qml/TimeDisplay.qml index 026846f900..24dd47d8cf 100644 --- a/src/plugins/qmlprofiler/qml/TimeDisplay.qml +++ b/src/plugins/qmlprofiler/qml/TimeDisplay.qml @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + import QtQuick 1.0 import Monitor 1.0 import "MainView.js" as Plotter @@ -126,7 +158,7 @@ TiledCanvas { var timeDisplayBeginTime = Math.min(bt, et); var timeDisplayEndTime = Math.max(bt, et); - timeDisplayText.text = qsTr("length:")+detailedPrintTime(timeDisplayEndTime-timeDisplayBeginTime); + timeDisplayText.text = qsTr("length: %1").arg(detailedPrintTime(timeDisplayEndTime-timeDisplayBeginTime)); timeDisplayEnd.visible = true; timeDisplayEnd.x = xpos + flick.x } diff --git a/src/plugins/qmlprofiler/qml/analyzer_category_small.png b/src/plugins/qmlprofiler/qml/analyzer_category_small.png Binary files differdeleted file mode 100644 index 5bc90fbf91..0000000000 --- a/src/plugins/qmlprofiler/qml/analyzer_category_small.png +++ /dev/null diff --git a/src/plugins/qmlprofiler/qml/qml.qrc b/src/plugins/qmlprofiler/qml/qml.qrc index 822e2096d0..acb92c1d77 100644 --- a/src/plugins/qmlprofiler/qml/qml.qrc +++ b/src/plugins/qmlprofiler/qml/qml.qrc @@ -5,16 +5,15 @@ <file>MainView.js</file> <file>MainView.qml</file> <file>popup.png</file> - <file>range.png</file> <file>RangeDetails.qml</file> <file>RangeMover.qml</file> - <file>analyzer_category_small.png</file> <file>TimeDisplay.qml</file> <file>clean_pane_small.png</file> <file>prev.png</file> <file>next.png</file> - <file>toolbarbg.png</file> <file>magnifier-minus.png</file> <file>magnifier-plus.png</file> + <file>recordOff.png</file> + <file>recordOn.png</file> </qresource> </RCC> diff --git a/src/plugins/qmlprofiler/qml/range.png b/src/plugins/qmlprofiler/qml/range.png Binary files differdeleted file mode 100644 index 2ac200fe18..0000000000 --- a/src/plugins/qmlprofiler/qml/range.png +++ /dev/null diff --git a/src/plugins/qmlprofiler/qml/recordOff.png b/src/plugins/qmlprofiler/qml/recordOff.png Binary files differnew file mode 100644 index 0000000000..66f4e3b36b --- /dev/null +++ b/src/plugins/qmlprofiler/qml/recordOff.png diff --git a/src/plugins/qmlprofiler/qml/recordOn.png b/src/plugins/qmlprofiler/qml/recordOn.png Binary files differnew file mode 100644 index 0000000000..5d4b77f0f2 --- /dev/null +++ b/src/plugins/qmlprofiler/qml/recordOn.png diff --git a/src/plugins/qmlprofiler/qml/toolbarbg.png b/src/plugins/qmlprofiler/qml/toolbarbg.png Binary files differdeleted file mode 100644 index a94d5465b5..0000000000 --- a/src/plugins/qmlprofiler/qml/toolbarbg.png +++ /dev/null diff --git a/src/plugins/qmlprofiler/qmlprofiler.pro b/src/plugins/qmlprofiler/qmlprofiler.pro index 1aa41fbe83..69ed6b3c45 100644 --- a/src/plugins/qmlprofiler/qmlprofiler.pro +++ b/src/plugins/qmlprofiler/qmlprofiler.pro @@ -23,14 +23,12 @@ SOURCES += \ tracewindow.cpp \ timelineview.cpp \ qmlprofilerattachdialog.cpp \ - qmlprofilersummaryview.cpp \ - qmlprojectanalyzerruncontrolfactory.cpp \ localqmlprofilerrunner.cpp \ codaqmlprofilerrunner.cpp \ remotelinuxqmlprofilerrunner.cpp \ - qmlprofilercalleeview.cpp \ - qmlprofilercallerview.cpp \ - qmlprofilertraceclient.cpp + qmlprofilertraceclient.cpp \ + qmlprofilereventview.cpp \ + qmlprofilerruncontrolfactory.cpp HEADERS += \ qmlprofilerconstants.h \ @@ -41,15 +39,14 @@ HEADERS += \ tracewindow.h \ timelineview.h \ qmlprofilerattachdialog.h \ - qmlprofilersummaryview.h \ - qmlprojectanalyzerruncontrolfactory.h \ abstractqmlprofilerrunner.h \ localqmlprofilerrunner.h \ codaqmlprofilerrunner.h \ remotelinuxqmlprofilerrunner.h \ - qmlprofilercalleeview.h \ - qmlprofilercallerview.h \ - qmlprofilertraceclient.h + qmlprofilertraceclient.h \ + qmlprofilereventview.h \ + qmlprofilereventtypes.h \ + qmlprofilerruncontrolfactory.h RESOURCES += \ qml/qml.qrc diff --git a/src/plugins/qmlprofiler/qmlprofiler_global.h b/src/plugins/qmlprofiler/qmlprofiler_global.h index ac97df4bf4..a241f0615f 100644 --- a/src/plugins/qmlprofiler/qmlprofiler_global.h +++ b/src/plugins/qmlprofiler/qmlprofiler_global.h @@ -6,26 +6,25 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** diff --git a/src/plugins/qmlprofiler/qmlprofilercalleeview.cpp b/src/plugins/qmlprofiler/qmlprofilercalleeview.cpp deleted file mode 100644 index 71fd7677b9..0000000000 --- a/src/plugins/qmlprofiler/qmlprofilercalleeview.cpp +++ /dev/null @@ -1,292 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "qmlprofilercalleeview.h" - -#include <QtCore/QUrl> -#include <QtCore/QHash> - -#include <QtGui/QHeaderView> -#include <QtGui/QStandardItemModel> - -using namespace QmlProfiler::Internal; - -struct BindingData -{ - BindingData() : - displayname(0), filename(0), location(0), details(0), - line(-1), rangeType(-1), level(-1), childrenHash(0), parentBinding(0) {} - - ~BindingData() { - delete displayname; - delete filename; - delete location; - delete childrenHash; - } - QString *displayname; - QString *filename; - QString *location; - QString *details; - int line; - int rangeType; - qint64 level; - QHash<QString, BindingData *> *childrenHash; - - // reference to parent binding stored in the hash - BindingData *parentBinding; -}; - -typedef QHash<QString, BindingData *> BindingHash; - -enum ItemRole { - LocationRole = Qt::UserRole+1, - FilenameRole = Qt::UserRole+2, - LineRole = Qt::UserRole+3 -}; - -class QmlProfilerCalleeView::QmlProfilerCalleeViewPrivate -{ -public: - QmlProfilerCalleeViewPrivate(QmlProfilerCalleeView *qq) : q(qq) {} - - void recursiveClearHash(BindingHash *hash); - void buildModelFromHash( BindingHash *hash, QStandardItem *parentItem ); - - QmlProfilerCalleeView *q; - - QStandardItemModel *m_model; -// ToDo: avoid unnecessary allocations by using global hash -// BindingHash m_globalHash; - BindingHash m_rootHash; - QList<BindingData *> m_bindingBuffer; -}; - -QmlProfilerCalleeView::QmlProfilerCalleeView(QWidget *parent) : - QTreeView(parent), d(new QmlProfilerCalleeViewPrivate(this)) -{ - setObjectName("QmlProfilerCalleeView"); - setRootIsDecorated(true); - header()->setResizeMode(QHeaderView::Interactive); - header()->setMinimumSectionSize(50); - setSortingEnabled(false); - setFrameStyle(QFrame::NoFrame); - - d->m_model = new QStandardItemModel(this); - - setModel(d->m_model); - - d->m_model->setColumnCount(3); - setHeaderLabels(); - - connect(this,SIGNAL(clicked(QModelIndex)), this,SLOT(jumpToItem(QModelIndex))); -} - -QmlProfilerCalleeView::~QmlProfilerCalleeView() -{ - clean(); - delete d->m_model; -} - -void QmlProfilerCalleeView::clean() -{ - d->m_model->clear(); - d->m_model->setColumnCount(3); - - // clean the hashes - d->recursiveClearHash(&d->m_rootHash); - - setHeaderLabels(); - setSortingEnabled(false); -} - -void QmlProfilerCalleeView::addRangedEvent(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length, - const QStringList &data, const QString &fileName, int line) -{ - Q_UNUSED(startTime); - Q_UNUSED(nestingInType); - Q_UNUSED(length); - - const QChar colon = QLatin1Char(':'); - QString localName, displayName, location, details; - - if (fileName.isEmpty()) { - displayName = tr("<bytecode>"); - location = QLatin1String("--"); - - } else { - localName = QUrl(fileName).toLocalFile(); - displayName = localName.mid(localName.lastIndexOf(QChar('/')) + 1) + colon + QString::number(line); - location = fileName+colon+QString::number(line); - } - - if (data.isEmpty()) - details = tr("Source code not available"); - else - details = data.join(" ").replace('\n'," "); - - // ToDo: instead of allocating each new event, store them in the global hash - BindingData *newBinding = new BindingData; - newBinding->displayname = new QString(displayName); - newBinding->filename = new QString(fileName); - newBinding->line = line; - newBinding->level = nestingLevel; - newBinding->rangeType = type; - newBinding->location = new QString(location); - newBinding->details = new QString(details); - newBinding->childrenHash = 0; - - d->m_bindingBuffer.prepend(newBinding); - - if (nestingLevel == 1) { - // top level: insert buffered stuff - BindingHash *currentHash = &(d->m_rootHash); - BindingData *lastBinding = 0; - int lastLevel = 0; - - while (d->m_bindingBuffer.length()) { - BindingData *bindingInfo = d->m_bindingBuffer.at(0); - // find the data's place - if (bindingInfo->level > lastLevel) { - currentHash = lastBinding ? lastBinding->childrenHash : &(d->m_rootHash); - bindingInfo->parentBinding = lastBinding; - ++lastLevel; - } else if (bindingInfo->level == lastLevel) { - bindingInfo->parentBinding = lastBinding->parentBinding; - } else if (bindingInfo->level < lastLevel) { - while (bindingInfo->level < lastLevel) { - bindingInfo->parentBinding = lastBinding->parentBinding ? lastBinding->parentBinding->parentBinding : 0; - currentHash = bindingInfo->parentBinding ? bindingInfo->parentBinding->childrenHash : &(d->m_rootHash); - --lastLevel; - } - } - - BindingHash::iterator it = currentHash->find(*bindingInfo->location); - if (it == currentHash->end()) { - bindingInfo->childrenHash = new BindingHash; - currentHash->insert(*bindingInfo->location, bindingInfo); - lastBinding = bindingInfo; - } else { - lastBinding = it.value(); - delete bindingInfo; - } - - d->m_bindingBuffer.removeFirst(); - } - } -} - -void QmlProfilerCalleeView::complete() -{ - // build the model from the hashed data - d->buildModelFromHash( &d->m_rootHash, d->m_model->invisibleRootItem()); - - expandAll(); - resizeColumnToContents(0); - resizeColumnToContents(1); -} - -void QmlProfilerCalleeView::jumpToItem(const QModelIndex &index) -{ - QStandardItem *clickedItem = d->m_model->itemFromIndex(index); - QStandardItem *infoItem; - if (clickedItem->parent()) - infoItem = clickedItem->parent()->child(clickedItem->row(), 0); - else - infoItem = d->m_model->item(index.row(), 0); - - int line = infoItem->data(LineRole).toInt(); - if (line == -1) - return; - QString fileName = infoItem->data(FilenameRole).toString(); - emit gotoSourceLocation(fileName, line); -} - -void QmlProfilerCalleeView::setHeaderLabels() -{ - d->m_model->setHeaderData(0, Qt::Horizontal, QVariant(tr("Location"))); - d->m_model->setHeaderData(1, Qt::Horizontal, QVariant(tr("Type"))); - d->m_model->setHeaderData(2, Qt::Horizontal, QVariant(tr("Details"))); -} - -void QmlProfilerCalleeView::QmlProfilerCalleeViewPrivate::recursiveClearHash(BindingHash *hash) { - QHashIterator<QString, BindingData *> it(*hash); - while (it.hasNext()) { - it.next(); - if (it.value()->childrenHash) - recursiveClearHash(it.value()->childrenHash); - delete it.value(); - } - hash->clear(); -} - -inline QString nameForType(int typeNumber) -{ - switch (typeNumber) { - case 0: return QmlProfilerCalleeView::tr("Paint"); - case 1: return QmlProfilerCalleeView::tr("Compile"); - case 2: return QmlProfilerCalleeView::tr("Create"); - case 3: return QmlProfilerCalleeView::tr("Binding"); - case 4: return QmlProfilerCalleeView::tr("Signal"); - } - return QString(); -} - -void QmlProfilerCalleeView::QmlProfilerCalleeViewPrivate::buildModelFromHash( BindingHash *hash, QStandardItem *parentItem ) -{ - QHashIterator<QString, BindingData *> it(*hash); - - while (it.hasNext()) { - it.next(); - BindingData *binding = it.value(); - - QStandardItem *nameColumn = new QStandardItem(*binding->displayname); - nameColumn->setEditable(false); - - QStandardItem *typeColumn = new QStandardItem(nameForType(binding->rangeType)); - typeColumn->setEditable(false); - - QStandardItem *detailsColumn = new QStandardItem(*binding->details); - detailsColumn->setEditable(false); - - QStandardItem *firstColumn = nameColumn; - firstColumn->setData(QVariant(*binding->location),LocationRole); - firstColumn->setData(QVariant(*binding->filename),FilenameRole); - firstColumn->setData(QVariant(binding->line),LineRole); - - QList<QStandardItem *> newRow; - newRow << nameColumn << typeColumn << detailsColumn; - parentItem->appendRow(newRow); - if (!binding->childrenHash->isEmpty()) - buildModelFromHash(binding->childrenHash, nameColumn); - } -} diff --git a/src/plugins/qmlprofiler/qmlprofilercalleeview.h b/src/plugins/qmlprofiler/qmlprofilercalleeview.h deleted file mode 100644 index 715a006edd..0000000000 --- a/src/plugins/qmlprofiler/qmlprofilercalleeview.h +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QMLPROFILERCALLEEVIEW_H -#define QMLPROFILERCALLEEVIEW_H - -#include <QTreeView> - -namespace QmlProfiler { -namespace Internal { - -class QmlProfilerCalleeView : public QTreeView -{ - Q_OBJECT - -public: - explicit QmlProfilerCalleeView(QWidget *parent = 0); - ~QmlProfilerCalleeView(); - -signals: - void gotoSourceLocation(const QString &fileName, int lineNumber); - -public slots: - void clean(); - - void addRangedEvent(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length, - const QStringList &data, const QString &fileName, int line); - void complete(); - void jumpToItem(const QModelIndex &index); - -private: - class QmlProfilerCalleeViewPrivate; - QmlProfilerCalleeViewPrivate *d; - - void setHeaderLabels(); -}; - -} // namespace Internal -} // namespace QmlProfiler - -#endif // QMLPROFILERCALLEEVIEW_H diff --git a/src/plugins/qmlprofiler/qmlprofilercallerview.cpp b/src/plugins/qmlprofiler/qmlprofilercallerview.cpp deleted file mode 100644 index 92cece6058..0000000000 --- a/src/plugins/qmlprofiler/qmlprofilercallerview.cpp +++ /dev/null @@ -1,288 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "qmlprofilercallerview.h" - -#include <QtCore/QUrl> -#include <QtCore/QHash> - -#include <QtGui/QHeaderView> -#include <QtGui/QStandardItemModel> - -using namespace QmlProfiler::Internal; - -struct BindingData -{ - BindingData() : displayname(0) , filename(0) , location(0) , details(0), - line(0), rangeType(0), level(-1), parentList(0) {} - ~BindingData() { - delete displayname; - delete filename; - delete location; - delete parentList; - } - QString *displayname; - QString *filename; - QString *location; - QString *details; - int line; - int rangeType; - qint64 level; - QList< BindingData *> *parentList; -}; - -typedef QHash<QString, BindingData *> BindingHash; -typedef QList<BindingData *> BindingList; - -enum ItemRole { - LocationRole = Qt::UserRole+1, - FilenameRole = Qt::UserRole+2, - LineRole = Qt::UserRole+3 -}; - -class QmlProfilerCallerView::QmlProfilerCallerViewPrivate -{ -public: - QmlProfilerCallerViewPrivate(QmlProfilerCallerView *qq) : q(qq) {} - - void recursiveClearHash(BindingHash *hash); - void buildModelFromList( BindingList *list, QStandardItem *parentItem, BindingList *listSoFar ); - - QmlProfilerCallerView *q; - - QStandardItemModel *m_model; - BindingHash m_rootHash; - QHash<int, BindingList> m_pendingChildren; - int m_lastLevel; -}; - -QmlProfilerCallerView::QmlProfilerCallerView(QWidget *parent) : - QTreeView(parent), d(new QmlProfilerCallerViewPrivate(this)) -{ - setObjectName("QmlProfilerCallerView"); - setRootIsDecorated(true); - header()->setResizeMode(QHeaderView::Interactive); - header()->setMinimumSectionSize(50); - setSortingEnabled(false); - setFrameStyle(QFrame::NoFrame); - - d->m_model = new QStandardItemModel(this); - - setModel(d->m_model); - - d->m_model->setColumnCount(3); - setHeaderLabels(); - - connect(this,SIGNAL(clicked(QModelIndex)), this,SLOT(jumpToItem(QModelIndex))); - - d->m_lastLevel = -1; -} - -QmlProfilerCallerView::~QmlProfilerCallerView() -{ - clean(); - delete d->m_model; -} - -void QmlProfilerCallerView::clean() -{ - d->m_model->clear(); - d->m_model->setColumnCount(3); - - foreach (int levelNumber, d->m_pendingChildren.keys()) - d->m_pendingChildren[levelNumber].clear(); - - d->m_lastLevel = -1; - - // clean the hashes - d->recursiveClearHash(&d->m_rootHash); - - setHeaderLabels(); - setSortingEnabled(false); -} - -void QmlProfilerCallerView::addRangedEvent(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length, - const QStringList &data, const QString &fileName, int line) -{ - Q_UNUSED(startTime); - Q_UNUSED(nestingInType); - Q_UNUSED(length); - - const QChar colon = QLatin1Char(':'); - QString localName, displayName, location, details; - - if (fileName.isEmpty()) { - displayName = tr("<bytecode>"); - location = QLatin1String("--"); - - } else { - localName = QUrl(fileName).toLocalFile(); - displayName = localName.mid(localName.lastIndexOf(QChar('/')) + 1) + colon + QString::number(line); - location = fileName+colon+QString::number(line); - } - - if (data.isEmpty()) - details = tr("Source code not available"); - else - details = data.join(" ").replace('\n'," "); - - - // New Data: if it's not in the hash, put it there - // if it's in the hash, get the reference from the hash - BindingData *newBinding; - BindingHash::iterator it = d->m_rootHash.find(location); - if (it != d->m_rootHash.end()) { - newBinding = it.value(); - } else { - newBinding = new BindingData; - newBinding->displayname = new QString(displayName); - newBinding->filename = new QString(fileName); - newBinding->line = line; - newBinding->level = nestingLevel; - newBinding->rangeType = type; - newBinding->location = new QString(location); - newBinding->details = new QString(details); - newBinding->parentList = new BindingList(); - d->m_rootHash.insert(location, newBinding); - } - - if (nestingLevel < d->m_lastLevel) { - // I'm the parent of the former - if (d->m_pendingChildren.contains(nestingLevel+1)) { - foreach (BindingData *child, d->m_pendingChildren[nestingLevel + 1]) { - if (!child->parentList->contains(newBinding)) - child->parentList->append(newBinding); - } - d->m_pendingChildren[nestingLevel + 1].clear(); - } - - } - - if (nestingLevel > 1 && !d->m_pendingChildren[nestingLevel].contains(newBinding)) { - // I'm not root... there will come a parent later - d->m_pendingChildren[nestingLevel].append(newBinding); - } - - d->m_lastLevel = nestingLevel; -} - -void QmlProfilerCallerView::complete() -{ - // build the model from the hashed data - BindingList bindingList = d->m_rootHash.values(); - BindingList emptyList; - d->buildModelFromList(&bindingList, d->m_model->invisibleRootItem(), &emptyList); - - expandAll(); - resizeColumnToContents(0); - resizeColumnToContents(1); - collapseAll(); -} - -void QmlProfilerCallerView::jumpToItem(const QModelIndex &index) -{ - QStandardItem *clickedItem = d->m_model->itemFromIndex(index); - QStandardItem *infoItem; - if (clickedItem->parent()) - infoItem = clickedItem->parent()->child(clickedItem->row(), 0); - else - infoItem = d->m_model->item(index.row(), 0); - - int line = infoItem->data(Qt::UserRole+3).toInt(); - if (line == -1) - return; - QString fileName = infoItem->data(Qt::UserRole+2).toString(); - emit gotoSourceLocation(fileName, line); -} - -void QmlProfilerCallerView::setHeaderLabels() -{ - d->m_model->setHeaderData(0, Qt::Horizontal, QVariant(tr("Location"))); - d->m_model->setHeaderData(1, Qt::Horizontal, QVariant(tr("Type"))); - d->m_model->setHeaderData(2, Qt::Horizontal, QVariant(tr("Details"))); -} - -// ToDo: property clean the stored data -void QmlProfilerCallerView::QmlProfilerCallerViewPrivate::recursiveClearHash(BindingHash *hash) { - QHashIterator<QString, BindingData *> it(*hash); - while (it.hasNext()) { - it.next(); - delete it.value(); - } - hash->clear(); -} - -inline QString nameForType(int typeNumber) -{ - switch (typeNumber) { - case 0: return QmlProfilerCallerView::tr("Paint"); - case 1: return QmlProfilerCallerView::tr("Compile"); - case 2: return QmlProfilerCallerView::tr("Create"); - case 3: return QmlProfilerCallerView::tr("Binding"); - case 4: return QmlProfilerCallerView::tr("Signal"); - } - return QString(); -} - -void QmlProfilerCallerView::QmlProfilerCallerViewPrivate::buildModelFromList( BindingList *list, QStandardItem *parentItem, BindingList *listSoFar ) -{ - foreach (BindingData *binding, *list) { - if (listSoFar->contains(binding)) - continue; - - QStandardItem *nameColumn = new QStandardItem(*binding->displayname); - nameColumn->setEditable(false); - - QStandardItem *typeColumn = new QStandardItem(nameForType(binding->rangeType)); - typeColumn->setEditable(false); - - QStandardItem *detailsColumn = new QStandardItem(*binding->details); - detailsColumn->setEditable(false); - - QStandardItem *firstColumn = nameColumn; - firstColumn->setData(QVariant(*binding->location),LocationRole); - firstColumn->setData(QVariant(*binding->filename),FilenameRole); - firstColumn->setData(QVariant(binding->line),LineRole); - - QList<QStandardItem *> newRow; - newRow << nameColumn << typeColumn << detailsColumn; - parentItem->appendRow(newRow); - if (!binding->parentList->isEmpty()) { - // avoid infinite loops due to recursive functions - BindingList newParentList(*listSoFar); - newParentList.append(binding); - - buildModelFromList(binding->parentList, nameColumn, &newParentList); - } - } -} diff --git a/src/plugins/qmlprofiler/qmlprofilercallerview.h b/src/plugins/qmlprofiler/qmlprofilercallerview.h deleted file mode 100644 index 7f9416fea9..0000000000 --- a/src/plugins/qmlprofiler/qmlprofilercallerview.h +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QMLPROFILERCALLERVIEW_H -#define QMLPROFILERCALLERVIEW_H - -#include <QTreeView> - -namespace QmlProfiler { -namespace Internal { - -class QmlProfilerCallerView : public QTreeView -{ - Q_OBJECT - -public: - explicit QmlProfilerCallerView(QWidget *parent = 0); - ~QmlProfilerCallerView(); - -signals: - void gotoSourceLocation(const QString &fileName, int lineNumber); - -public slots: - void clean(); - - void addRangedEvent(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length, - const QStringList &data, const QString &fileName, int line); - void complete(); - void jumpToItem(const QModelIndex &index); - -private: - class QmlProfilerCallerViewPrivate; - QmlProfilerCallerViewPrivate *d; - - void setHeaderLabels(); -}; - -} // namespace Internal -} // namespace QmlProfiler - -#endif // QMLPROFILERCALLERVIEW_H diff --git a/src/plugins/qmlprofiler/qmlprofilerconstants.h b/src/plugins/qmlprofiler/qmlprofilerconstants.h index ea7d06df2d..0a21fd7ad5 100644 --- a/src/plugins/qmlprofiler/qmlprofilerconstants.h +++ b/src/plugins/qmlprofiler/qmlprofilerconstants.h @@ -6,26 +6,25 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.cpp b/src/plugins/qmlprofiler/qmlprofilerengine.cpp index 8d0f1ec981..27f34056ff 100644 --- a/src/plugins/qmlprofiler/qmlprofilerengine.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerengine.cpp @@ -6,26 +6,25 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** @@ -46,10 +45,18 @@ #include <coreplugin/icore.h> #include <utils/qtcassert.h> #include <coreplugin/helpmanager.h> +#include <qmlprojectmanager/qmlprojectrunconfiguration.h> +#include <projectexplorer/localapplicationruncontrol.h> +#include <projectexplorer/applicationrunconfiguration.h> +#include <qt4projectmanager/qt-s60/s60devicedebugruncontrol.h> +#include <qt4projectmanager/qt-s60/s60devicerunconfiguration.h> #include <QtGui/QMainWindow> #include <QtGui/QMessageBox> +using namespace Analyzer; +using namespace ProjectExplorer; + namespace QmlProfiler { namespace Internal { @@ -65,12 +72,11 @@ public: bool attach(const QString &address, uint port); static AbstractQmlProfilerRunner *createRunner(ProjectExplorer::RunConfiguration *runConfiguration, - const Analyzer::AnalyzerStartParameters &m_params, QObject *parent); QmlProfilerEngine *q; - Analyzer::AnalyzerStartParameters m_params; + //AnalyzerStartParameters m_params; AbstractQmlProfilerRunner *m_runner; bool m_running; bool m_fetchingData; @@ -78,28 +84,38 @@ public: }; AbstractQmlProfilerRunner * -QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunConfiguration *configuration, - const Analyzer::AnalyzerStartParameters &m_params, +QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunConfiguration *runConfiguration, QObject *parent) { AbstractQmlProfilerRunner *runner = 0; - if (m_params.startMode == Analyzer::StartLocal) { - LocalQmlProfilerRunner::Configuration configuration; - configuration.executable = m_params.debuggee; - configuration.executableArguments = m_params.debuggeeArgs; - configuration.workingDirectory = m_params.workingDirectory; - configuration.environment = m_params.environment; - configuration.port = m_params.connParams.port; - - runner = new LocalQmlProfilerRunner(configuration, parent); - } else if (m_params.startMode == Analyzer::StartRemote) { - if (Qt4ProjectManager::S60DeviceRunConfiguration *s60Config - = qobject_cast<Qt4ProjectManager::S60DeviceRunConfiguration*>(configuration)) { - runner = new CodaQmlProfilerRunner(s60Config, parent); - } else if (RemoteLinux::RemoteLinuxRunConfiguration *rmConfig - = qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration*>(configuration)){ - runner = new RemoteLinuxQmlProfilerRunner(rmConfig, parent); - } + if (QmlProjectManager::QmlProjectRunConfiguration *rc1 = + qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration)) { + // This is a "plain" .qmlproject. + LocalQmlProfilerRunner::Configuration conf; + conf.executable = rc1->observerPath(); + conf.executableArguments = rc1->viewerArguments(); + conf.workingDirectory = rc1->workingDirectory(); + conf.environment = rc1->environment(); + conf.port = rc1->qmlDebugServerPort(); + runner = new LocalQmlProfilerRunner(conf, parent); + } else if (LocalApplicationRunConfiguration *rc2 = + qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) { + // FIXME: Check. + LocalQmlProfilerRunner::Configuration conf; + conf.executable = rc2->executable(); + conf.executableArguments = rc2->commandLineArguments(); + conf.workingDirectory = rc2->workingDirectory(); + conf.environment = rc2->environment(); + conf.port = rc2->qmlDebugServerPort(); + runner = new LocalQmlProfilerRunner(conf, parent); + } else if (Qt4ProjectManager::S60DeviceRunConfiguration *s60Config = + qobject_cast<Qt4ProjectManager::S60DeviceRunConfiguration*>(runConfiguration)) { + runner = new CodaQmlProfilerRunner(s60Config, parent); + } else if (RemoteLinux::RemoteLinuxRunConfiguration *rmConfig = + qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) { + runner = new RemoteLinuxQmlProfilerRunner(rmConfig, parent); + } else { + QTC_ASSERT(false, /**/); } return runner; } @@ -108,12 +124,11 @@ QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunCo // QmlProfilerEngine // -QmlProfilerEngine::QmlProfilerEngine(const Analyzer::AnalyzerStartParameters &sp, - ProjectExplorer::RunConfiguration *runConfiguration) - : IAnalyzerEngine(sp, runConfiguration) +QmlProfilerEngine::QmlProfilerEngine(IAnalyzerTool *tool, + ProjectExplorer::RunConfiguration *runConfiguration) + : IAnalyzerEngine(tool, runConfiguration) , d(new QmlProfilerEnginePrivate(this)) { - d->m_params = sp; d->m_running = false; d->m_fetchingData = false; d->m_delayedDelete = false; @@ -129,8 +144,8 @@ QmlProfilerEngine::~QmlProfilerEngine() void QmlProfilerEngine::start() { QTC_ASSERT(!d->m_runner, return); - d->m_runner = QmlProfilerEnginePrivate::createRunner(runConfiguration(), d->m_params, this); - QTC_ASSERT(d->m_runner, return); + d->m_runner = QmlProfilerEnginePrivate::createRunner(runConfiguration(), this); + connect(d->m_runner, SIGNAL(stopped()), this, SLOT(stopped())); connect(d->m_runner, SIGNAL(appendMessage(QString,Utils::OutputFormat)), @@ -140,6 +155,8 @@ void QmlProfilerEngine::start() d->m_running = true; d->m_delayedDelete = false; + + AnalyzerManager::handleToolStarted(); } void QmlProfilerEngine::stop() @@ -157,7 +174,7 @@ void QmlProfilerEngine::stop() void QmlProfilerEngine::stopped() { d->m_running = false; - Analyzer::AnalyzerManager::instance()->stopTool(); + AnalyzerManager::stopTool(); // FIXME: Needed? emit finished(); } diff --git a/src/plugins/qmlprofiler/qmlprofilerengine.h b/src/plugins/qmlprofiler/qmlprofilerengine.h index 85a041dfe5..02dceaf8e2 100644 --- a/src/plugins/qmlprofiler/qmlprofilerengine.h +++ b/src/plugins/qmlprofiler/qmlprofilerengine.h @@ -6,26 +6,25 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** @@ -43,9 +42,10 @@ namespace Internal { class QmlProfilerEngine : public Analyzer::IAnalyzerEngine { Q_OBJECT + public: - explicit QmlProfilerEngine(const Analyzer::AnalyzerStartParameters &sp, - ProjectExplorer::RunConfiguration *runConfiguration); + QmlProfilerEngine(Analyzer::IAnalyzerTool *tool, + ProjectExplorer::RunConfiguration *runConfiguration); ~QmlProfilerEngine(); signals: diff --git a/src/libs/valgrind/valgrind_global.h b/src/plugins/qmlprofiler/qmlprofilereventtypes.h index c09c7814ff..1739f90aef 100644 --- a/src/libs/valgrind/valgrind_global.h +++ b/src/plugins/qmlprofiler/qmlprofilereventtypes.h @@ -4,8 +4,6 @@ ** ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** -** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@kdab.com) -** ** Contact: Nokia Corporation (info@qt.nokia.com) ** ** @@ -32,15 +30,23 @@ ** **************************************************************************/ -#ifndef VALGRIND_GLOBAL_H -#define VALGRIND_GLOBAL_H +#ifndef QMLPROFILEREVENTTYPES_H +#define QMLPROFILEREVENTTYPES_H + +namespace QmlProfiler { +namespace Internal { + +enum QmlEventType { + Painting, + Compiling, + Creating, + Binding, + HandlingSignal, -#include <QtCore/QtGlobal> + MaximumQmlEventType +}; -#if defined(VALGRIND_LIBRARY) -# define VALGRINDSHARED_EXPORT Q_DECL_EXPORT -#else -# define VALGRINDSHARED_EXPORT Q_DECL_IMPORT -#endif +} +} -#endif // VALGRIND_GLOBAL_H +#endif //QMLPROFILEREVENTTYPES_H diff --git a/src/plugins/qmlprofiler/qmlprofilereventview.cpp b/src/plugins/qmlprofiler/qmlprofilereventview.cpp new file mode 100644 index 0000000000..dc75dd5cb8 --- /dev/null +++ b/src/plugins/qmlprofiler/qmlprofilereventview.cpp @@ -0,0 +1,543 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + +#include "qmlprofilereventview.h" + +#include <QtCore/QUrl> +#include <QtCore/QHash> + +#include <QtGui/QHeaderView> +#include <QtGui/QStandardItemModel> + +namespace QmlProfiler { +namespace Internal { + +class EventsViewItem : public QStandardItem +{ +public: + EventsViewItem(const QString &text) : QStandardItem(text) {} + + virtual bool operator<(const QStandardItem &other) const + { + if (data().type() == QVariant::String) { + // first column + return data(FilenameRole).toString() == other.data(FilenameRole).toString() ? + data(LineRole).toInt() < other.data(LineRole).toInt() : + data(FilenameRole).toString() < other.data(FilenameRole).toString(); + } + + return data().toDouble() < other.data().toDouble(); + } +}; + + +//////////////////////////////////////////////////////////////////////////////////// + +class QmlProfilerEventStatistics::QmlProfilerEventStatisticsPrivate +{ +public: + QmlProfilerEventStatisticsPrivate(QmlProfilerEventStatistics *qq) : q(qq) {} + + void postProcess(); + + QmlProfilerEventStatistics *q; + QmlEventHash m_rootHash; + QHash<int, QmlEventList> m_pendingEvents; + int m_lastLevel; +}; + + +//////////////////////////////////////////////////////////////////////////////////// + +class QmlProfilerEventsView::QmlProfilerEventsViewPrivate +{ +public: + QmlProfilerEventsViewPrivate(QmlProfilerEventsView *qq) : q(qq) {} + + void buildModelFromList(const QmlEventList &list, QStandardItem *parentItem, const QmlEventList &visitedFunctionsList = QmlEventList() ); + int getFieldCount(); + QString displayTime(double time) const; + QString nameForType(int typeNumber) const; + + + QmlProfilerEventsView *q; + + QmlProfilerEventStatistics *m_eventStatistics; + QStandardItemModel *m_model; + QList<bool> m_fieldShown; + bool m_showAnonymous; + int m_firstNumericColumn; +}; + + +//////////////////////////////////////////////////////////////////////////////////// + +QmlProfilerEventStatistics::QmlProfilerEventStatistics(QObject *parent) : + QObject(parent), d(new QmlProfilerEventStatisticsPrivate(this)) +{ + setObjectName("QmlProfilerEventStatistics"); + d->m_lastLevel = -1; +} + +QmlProfilerEventStatistics::~QmlProfilerEventStatistics() +{ + clear(); +} + +void QmlProfilerEventStatistics::clear() +{ + foreach (int levelNumber, d->m_pendingEvents.keys()) + d->m_pendingEvents[levelNumber].clear(); + + d->m_lastLevel = -1; + + foreach (QmlEventData *binding, d->m_rootHash.values()) + delete binding; + d->m_rootHash.clear(); +} + +QList <QmlEventData *> QmlProfilerEventStatistics::getEventList() +{ + return d->m_rootHash.values(); +} + +void QmlProfilerEventStatistics::addRangedEvent(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length, + const QStringList &data, const QString &fileName, int line) +{ + Q_UNUSED(startTime); + Q_UNUSED(nestingInType); + + const QChar colon = QLatin1Char(':'); + QString localName, displayName, location, details; + + if (data.isEmpty()) + details = tr("Source code not available"); + else { + details = data.join(" ").replace('\n'," ").simplified(); + QRegExp rewrite("\\(function \\$(\\w+)\\(\\) \\{ (return |)(.+) \\}\\)"); + bool match = rewrite.exactMatch(details); + if (match) { + details = rewrite.cap(1) + ": " + rewrite.cap(3); + } + if (details.startsWith(QString("file://"))) + details = details.mid(details.lastIndexOf(QChar('/')) + 1); + } + + if (fileName.isEmpty()) { + displayName = tr("<bytecode>"); + location = QString("--:%1:%2").arg(QString::number(type), details); + } else { + localName = QUrl(fileName).toLocalFile(); + displayName = localName.mid(localName.lastIndexOf(QChar('/')) + 1) + colon + QString::number(line); + location = fileName+colon+QString::number(line); + } + + + // New Data: if it's not in the hash, put it there + // if it's in the hash, get the reference from the hash + QmlEventData *newBinding; + QmlEventHash::iterator it = d->m_rootHash.find(location); + if (it != d->m_rootHash.end()) { + newBinding = it.value(); + newBinding->duration += length; + newBinding->calls++; + if (newBinding->maxTime < length) + newBinding->maxTime = length; + if (newBinding->minTime > length) + newBinding->minTime = length; + } else { + newBinding = new QmlEventData; + newBinding->calls = 1; + newBinding->duration = length; + newBinding->displayname = new QString(displayName); + newBinding->filename = new QString(fileName); + newBinding->location = new QString(location); + newBinding->line = line; + newBinding->minTime = length; + newBinding->maxTime = length; + newBinding->level = nestingLevel; + newBinding->eventType = (QmlEventType)type; + newBinding->details = new QString(details); + newBinding->parentList = new QmlEventList(); + newBinding->childrenList = new QmlEventList(); + d->m_rootHash.insert(location, newBinding); + } + + if (nestingLevel < d->m_lastLevel) { + // I'm the parent of the former + if (d->m_pendingEvents.contains(nestingLevel+1)) { + foreach (QmlEventData *child, d->m_pendingEvents[nestingLevel + 1]) { + if (!newBinding->childrenList->contains(child)) + newBinding->childrenList->append(child); + if (!child->parentList->contains(newBinding)) + child->parentList->append(newBinding); + } + d->m_pendingEvents[nestingLevel + 1].clear(); + } + + } + + if (nestingLevel > 1 && !d->m_pendingEvents[nestingLevel].contains(newBinding)) { + // I'm not root... there will come a parent later + d->m_pendingEvents[nestingLevel].append(newBinding); + } + + d->m_lastLevel = nestingLevel; +} + +void QmlProfilerEventStatistics::complete() +{ + d->postProcess(); + emit dataReady(); +} + +void QmlProfilerEventStatistics::QmlProfilerEventStatisticsPrivate::postProcess() +{ + double totalTime = 0; + + foreach (QmlEventData *binding, m_rootHash.values()) + totalTime += binding->duration; + + foreach (QmlEventData *binding, m_rootHash.values()) { + binding->percentOfTime = binding->duration * 100.0 / totalTime; + binding->timePerCall = binding->calls > 0 ? double(binding->duration) / binding->calls : 0; + } +} + +//////////////////////////////////////////////////////////////////////////////////// + +QmlProfilerEventsView::QmlProfilerEventsView(QWidget *parent, QmlProfilerEventStatistics *model) : + QTreeView(parent), d(new QmlProfilerEventsViewPrivate(this)) +{ + setObjectName("QmlProfilerEventsView"); + header()->setResizeMode(QHeaderView::Interactive); + header()->setDefaultSectionSize(100); + header()->setMinimumSectionSize(50); + setSortingEnabled(false); + setFrameStyle(QFrame::NoFrame); + + d->m_model = new QStandardItemModel(this); + setModel(d->m_model); + connect(this,SIGNAL(clicked(QModelIndex)), this,SLOT(jumpToItem(QModelIndex))); + + d->m_eventStatistics = 0; + setEventStatisticsModel(model); + + d->m_showAnonymous = false; + d->m_firstNumericColumn = 0; + + // default view + setViewType(EventsView); +} + +QmlProfilerEventsView::~QmlProfilerEventsView() +{ + clear(); + delete d->m_model; +} + +void QmlProfilerEventsView::setEventStatisticsModel( QmlProfilerEventStatistics *model ) +{ + if (d->m_eventStatistics) + disconnect(d->m_eventStatistics,SIGNAL(dataReady()),this,SLOT(buildModel())); + d->m_eventStatistics = model; + connect(d->m_eventStatistics,SIGNAL(dataReady()),this,SLOT(buildModel())); +} + +void QmlProfilerEventsView::setFieldViewable(Fields field, bool show) +{ + if (field < MaxFields) { + int length = d->m_fieldShown.count(); + if (field >= length) { + for (int i=length; i<MaxFields; i++) + d->m_fieldShown << false; + } + d->m_fieldShown[field] = show; + } +} + +void QmlProfilerEventsView::setViewType(ViewTypes type) +{ + switch (type) { + case EventsView: { + setObjectName("QmlProfilerEventsView"); + setFieldViewable(Name, true); + setFieldViewable(Type, true); + setFieldViewable(Percent, true); + setFieldViewable(TotalDuration, true); + setFieldViewable(CallCount, true); + setFieldViewable(TimePerCall, true); + setFieldViewable(MaxTime, true); + setFieldViewable(MinTime, true); + setFieldViewable(Details, false); + setFieldViewable(Parents, false); + setFieldViewable(Children, false); + setShowAnonymousEvents(false); + break; + } + case CallersView: { + setObjectName("QmlProfilerCallersView"); + setFieldViewable(Name, true); + setFieldViewable(Type, true); + setFieldViewable(Percent, false); + setFieldViewable(TotalDuration, false); + setFieldViewable(CallCount, false); + setFieldViewable(TimePerCall, false); + setFieldViewable(MaxTime, false); + setFieldViewable(MinTime, false); + setFieldViewable(Details, true); + setFieldViewable(Parents, true); + setFieldViewable(Children, false); + setShowAnonymousEvents(true); + break; + } + case CalleesView: { + setObjectName("QmlProfilerCalleesView"); + setFieldViewable(Name, true); + setFieldViewable(Type, true); + setFieldViewable(Percent, false); + setFieldViewable(TotalDuration, false); + setFieldViewable(CallCount, false); + setFieldViewable(TimePerCall, false); + setFieldViewable(MaxTime, false); + setFieldViewable(MinTime, false); + setFieldViewable(Details, true); + setFieldViewable(Parents, false); + setFieldViewable(Children, true); + setShowAnonymousEvents(true); + break; + } + default: break; + } + + buildModel(); +} + +void QmlProfilerEventsView::setShowAnonymousEvents( bool showThem ) +{ + d->m_showAnonymous = showThem; +} + +void QmlProfilerEventsView::setHeaderLabels() +{ + int fieldIndex = 0; + d->m_firstNumericColumn = 0; + + if (d->m_fieldShown[Name]) { + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Location"))); + d->m_firstNumericColumn++; + } + if (d->m_fieldShown[Type]) { + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Type"))); + d->m_firstNumericColumn++; + } + if (d->m_fieldShown[Percent]) + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Time in Percent"))); + if (d->m_fieldShown[TotalDuration]) + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Total Time"))); + if (d->m_fieldShown[CallCount]) + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Calls"))); + if (d->m_fieldShown[TimePerCall]) + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Time per Call"))); + if (d->m_fieldShown[MaxTime]) + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Longest Time"))); + if (d->m_fieldShown[MinTime]) + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Shortest Time"))); + if (d->m_fieldShown[Details]) + d->m_model->setHeaderData(fieldIndex++, Qt::Horizontal, QVariant(tr("Details"))); +} + +void QmlProfilerEventsView::clear() +{ + d->m_model->clear(); + d->m_model->setColumnCount(d->getFieldCount()); + + setHeaderLabels(); + setSortingEnabled(false); +} + +int QmlProfilerEventsView::QmlProfilerEventsViewPrivate::getFieldCount() +{ + int count = 0; + for (int i=0; i < m_fieldShown.count(); ++i) + if (m_fieldShown[i] && i != Parents && i != Children) + count++; + return count; +} + +void QmlProfilerEventsView::buildModel() +{ + if (d->m_eventStatistics) { + clear(); + d->buildModelFromList( d->m_eventStatistics->getEventList(), d->m_model->invisibleRootItem() ); + + bool hasBranches = d->m_fieldShown[Parents] || d->m_fieldShown[Children]; + setRootIsDecorated(hasBranches); + + setSortingEnabled(!hasBranches); + + if (!hasBranches) + sortByColumn(d->m_firstNumericColumn,Qt::DescendingOrder); + + expandAll(); + if (d->m_fieldShown[Name]) + resizeColumnToContents(0); + + if (d->m_fieldShown[Type]) + resizeColumnToContents(d->m_fieldShown[Name]?1:0); + collapseAll(); + } +} + +void QmlProfilerEventsView::QmlProfilerEventsViewPrivate::buildModelFromList( const QmlEventList &list, QStandardItem *parentItem, const QmlEventList &visitedFunctionsList ) +{ + foreach (QmlEventData *binding, list) { + if (visitedFunctionsList.contains(binding)) + continue; + + if ((!m_showAnonymous) && binding->filename->isEmpty()) + continue; + + QList<QStandardItem *> newRow; + if (m_fieldShown[Name]) { + newRow << new EventsViewItem(*binding->displayname); + } + + if (m_fieldShown[Type]) { + newRow << new EventsViewItem(nameForType(binding->eventType)); + newRow.last()->setData(QVariant(binding->eventType)); + } + + if (m_fieldShown[Percent]) { + newRow << new EventsViewItem(QString::number(binding->percentOfTime,'f',2)+QLatin1String(" %")); + newRow.last()->setData(QVariant(binding->eventType)); + } + + if (m_fieldShown[TotalDuration]) { + newRow << new EventsViewItem(displayTime(binding->duration)); + newRow.last()->setData(QVariant(binding->duration)); + } + + if (m_fieldShown[CallCount]) { + newRow << new EventsViewItem(QString::number(binding->calls)); + newRow.last()->setData(QVariant(binding->calls)); + } + + if (m_fieldShown[TimePerCall]) { + newRow << new EventsViewItem(displayTime(binding->timePerCall)); + newRow.last()->setData(QVariant(binding->timePerCall)); + } + + if (m_fieldShown[MaxTime]) { + newRow << new EventsViewItem(displayTime(binding->maxTime)); + newRow.last()->setData(QVariant(binding->maxTime)); + } + + if (m_fieldShown[MinTime]) { + newRow << new EventsViewItem(displayTime(binding->minTime)); + newRow.last()->setData(QVariant(binding->minTime)); + } + + if (m_fieldShown[Details]) { + newRow << new EventsViewItem(*binding->details); + } + + if (!newRow.isEmpty()) { + // no edit + foreach (QStandardItem *item, newRow) + item->setEditable(false); + + // metadata + newRow.at(0)->setData(QVariant(*binding->location),LocationRole); + newRow.at(0)->setData(QVariant(*binding->filename),FilenameRole); + newRow.at(0)->setData(QVariant(binding->line),LineRole); + + // append + parentItem->appendRow(newRow); + + if (m_fieldShown[Parents] && !binding->parentList->isEmpty()) { + QmlEventList newParentList(visitedFunctionsList); + newParentList.append(binding); + + buildModelFromList(*binding->parentList, newRow.at(0), newParentList); + } + + if (m_fieldShown[Children] && !binding->childrenList->isEmpty()) { + QmlEventList newChildrenList(visitedFunctionsList); + newChildrenList.append(binding); + + buildModelFromList(*binding->childrenList, newRow.at(0), newChildrenList); + } + } + } +} + +QString QmlProfilerEventsView::QmlProfilerEventsViewPrivate::displayTime(double time) const +{ + if (time < 1e6) + return QString::number(time/1e3,'f',3) + QString::fromWCharArray(L" \u03BCs"); + if (time < 1e9) + return QString::number(time/1e6,'f',3) + QLatin1String(" ms"); + + return QString::number(time/1e9,'f',3) + QLatin1String(" s"); +} + +QString QmlProfilerEventsView::QmlProfilerEventsViewPrivate::nameForType(int typeNumber) const +{ + switch (typeNumber) { + case 0: return QmlProfilerEventsView::tr("Paint"); + case 1: return QmlProfilerEventsView::tr("Compile"); + case 2: return QmlProfilerEventsView::tr("Create"); + case 3: return QmlProfilerEventsView::tr("Binding"); + case 4: return QmlProfilerEventsView::tr("Signal"); + } + return QString(); +} + +void QmlProfilerEventsView::jumpToItem(const QModelIndex &index) +{ + QStandardItem *clickedItem = d->m_model->itemFromIndex(index); + QStandardItem *infoItem; + if (clickedItem->parent()) + infoItem = clickedItem->parent()->child(clickedItem->row(), 0); + else + infoItem = d->m_model->item(index.row(), 0); + + int line = infoItem->data(LineRole).toInt(); + if (line == -1) + return; + QString fileName = infoItem->data(FilenameRole).toString(); + emit gotoSourceLocation(fileName, line); +} + +} // namespace Internal +} // namespace QmlProfiler diff --git a/src/plugins/qmlprofiler/qmlprofilereventview.h b/src/plugins/qmlprofiler/qmlprofilereventview.h new file mode 100644 index 0000000000..eac510a9e2 --- /dev/null +++ b/src/plugins/qmlprofiler/qmlprofilereventview.h @@ -0,0 +1,160 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + +#ifndef QMLPROFILEREVENTVIEW_H +#define QMLPROFILEREVENTVIEW_H + +#include <QTreeView> +#include "qmlprofilereventtypes.h" + +namespace QmlProfiler { +namespace Internal { + +struct QmlEventData +{ + QmlEventData() : displayname(0) , filename(0) , location(0) , details(0), + line(0), eventType(MaximumQmlEventType), level(-1), parentList(0), childrenList(0) {} + ~QmlEventData() { + delete displayname; + delete filename; + delete location; + delete parentList; + delete childrenList; + } + QString *displayname; + QString *filename; + QString *location; + QString *details; + int line; + QmlEventType eventType; + qint64 level; + QList< QmlEventData *> *parentList; + QList< QmlEventData *> *childrenList; + qint64 duration; + qint64 calls; + qint64 minTime; + qint64 maxTime; + double timePerCall; + double percentOfTime; +}; + + +typedef QHash<QString, QmlEventData *> QmlEventHash; +typedef QList<QmlEventData *> QmlEventList; + +enum ItemRole { + LocationRole = Qt::UserRole+1, + FilenameRole = Qt::UserRole+2, + LineRole = Qt::UserRole+3 +}; + +class QmlProfilerEventStatistics : public QObject +{ + Q_OBJECT +public: + + explicit QmlProfilerEventStatistics(QObject *parent = 0); + ~QmlProfilerEventStatistics(); + + QmlEventList getEventList(); + +signals: + void dataReady(); + +public slots: + void clear(); + void addRangedEvent(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length, + const QStringList &data, const QString &fileName, int line); + void complete(); + +private: + class QmlProfilerEventStatisticsPrivate; + QmlProfilerEventStatisticsPrivate *d; +}; + +class QmlProfilerEventsView : public QTreeView +{ + Q_OBJECT +public: + enum Fields { + Name, + Type, + Percent, + TotalDuration, + CallCount, + TimePerCall, + MaxTime, + MinTime, + Details, + Parents, + Children, + + MaxFields + }; + + enum ViewTypes { + EventsView, + CallersView, + CalleesView, + + MaxViewTypes + }; + + explicit QmlProfilerEventsView(QWidget *parent, QmlProfilerEventStatistics *model); + ~QmlProfilerEventsView(); + + void setEventStatisticsModel( QmlProfilerEventStatistics *model ); + void setFieldViewable(Fields field, bool show); + void setViewType(ViewTypes type); + void setShowAnonymousEvents( bool showThem ); + +signals: + void gotoSourceLocation(const QString &fileName, int lineNumber); + +public slots: + void clear(); + void jumpToItem(const QModelIndex &index); + void buildModel(); + +private: + void setHeaderLabels(); + +private: + class QmlProfilerEventsViewPrivate; + QmlProfilerEventsViewPrivate *d; + +}; + +} // namespace Internal +} // namespace QmlProfiler + +#endif // QMLPROFILEREVENTVIEW_H diff --git a/src/plugins/qmlprofiler/qmlprofilerplugin.cpp b/src/plugins/qmlprofiler/qmlprofilerplugin.cpp index 3f2dd50369..995a13cb5d 100644 --- a/src/plugins/qmlprofiler/qmlprofilerplugin.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerplugin.cpp @@ -6,124 +6,71 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** **************************************************************************/ #include "qmlprofilerplugin.h" -#include "qmlprofilerconstants.h" -#include "qmlprojectanalyzerruncontrolfactory.h" -#include <coreplugin/icore.h> -#include <coreplugin/icontext.h> -#include <coreplugin/actionmanager/actionmanager.h> -#include <coreplugin/actionmanager/command.h> -#include <coreplugin/actionmanager/actioncontainer.h> -#include <coreplugin/coreconstants.h> +#include "qmlprofilertool.h" +#include "qmlprofilerruncontrolfactory.h" #include <analyzerbase/analyzermanager.h> -#include <QtGui/QAction> -#include <QtGui/QMessageBox> -#include <QtGui/QMainWindow> -#include <QtGui/QMenu> - #include <QtCore/QtPlugin> -#include "qmlprofilertool.h" - using namespace Analyzer; using namespace QmlProfiler::Internal; -QmlProfilerPlugin *QmlProfilerPlugin::m_instance = 0; bool QmlProfilerPlugin::debugOutput = false; - -class QmlProfilerPlugin::QmlProfilerPluginPrivate -{ -public: - QmlProfilerPluginPrivate(QmlProfilerPlugin *qq): - q(qq) - {} - - void initialize(const QStringList &arguments, QString *errorString); - - QmlProjectAnalyzerRunControlFactory *m_runControlFactory; - QmlProfilerPlugin *q; -}; - -void QmlProfilerPlugin::QmlProfilerPluginPrivate::initialize(const QStringList &arguments, QString *errorString) +bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorString) { Q_UNUSED(arguments) Q_UNUSED(errorString) - - m_runControlFactory = new QmlProjectAnalyzerRunControlFactory(); - Analyzer::AnalyzerManager::instance()->registerRunControlFactory(m_runControlFactory); -} - - - -QmlProfilerPlugin::QmlProfilerPlugin() - : d(new QmlProfilerPluginPrivate(this)) -{ - m_instance = this; -} - -QmlProfilerPlugin::~QmlProfilerPlugin() -{ - delete d; - m_instance = 0; -} - -bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorString) -{ - d->initialize(arguments, errorString); - - AnalyzerManager::instance()->addTool(new QmlProfilerTool(this)); - + addAutoReleasedObject(new QmlProfilerRunControlFactory()); + StartModes modes; + // They are handled the same actually. + //modes.append(StartMode(StartRemote)); + modes.append(StartMode(StartLocal)); + AnalyzerManager::addTool(new QmlProfilerTool(this), modes); return true; } void QmlProfilerPlugin::extensionsInitialized() { - // Retrieve objects from the plugin manager's object pool + // Retrieve objects from the plugin manager's object pool. // "In the extensionsInitialized method, a plugin can be sure that all // plugins that depend on it are completely initialized." } ExtensionSystem::IPlugin::ShutdownFlag QmlProfilerPlugin::aboutToShutdown() { - // Save settings + // Save settings. // Disconnect from signals that are not needed during shutdown // Hide UI (if you add UI that is not in the main window directly) return SynchronousShutdown; } -QmlProfilerPlugin *QmlProfilerPlugin::instance() -{ - return m_instance; -} - Q_EXPORT_PLUGIN(QmlProfilerPlugin) diff --git a/src/plugins/qmlprofiler/qmlprofilerplugin.h b/src/plugins/qmlprofiler/qmlprofilerplugin.h index aa6a749c83..e6ce2b1d9c 100644 --- a/src/plugins/qmlprofiler/qmlprofilerplugin.h +++ b/src/plugins/qmlprofiler/qmlprofilerplugin.h @@ -6,26 +6,25 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** @@ -46,22 +45,13 @@ class QmlProfilerPlugin : public ExtensionSystem::IPlugin Q_OBJECT public: - static QmlProfilerPlugin *instance(); - - QmlProfilerPlugin(); - ~QmlProfilerPlugin(); + QmlProfilerPlugin() {} bool initialize(const QStringList &arguments, QString *errorString); void extensionsInitialized(); ShutdownFlag aboutToShutdown(); static bool debugOutput; - -private: - class QmlProfilerPluginPrivate; - QmlProfilerPluginPrivate *d; - - static QmlProfilerPlugin *m_instance; }; } // namespace Internal diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp b/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp new file mode 100644 index 0000000000..1b0edfeef4 --- /dev/null +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp @@ -0,0 +1,158 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + +#include "qmlprofilerruncontrolfactory.h" +#include "qmlprojectmanager/qmlprojectrunconfiguration.h" + +#include <analyzerbase/analyzerstartparameters.h> +#include <analyzerbase/analyzermanager.h> +#include <analyzerbase/analyzersettings.h> +#include <analyzerbase/analyzerrunconfigwidget.h> + +#include <projectexplorer/applicationrunconfiguration.h> +#include <projectexplorer/projectexplorer.h> + +#include <remotelinux/linuxdeviceconfiguration.h> +#include <remotelinux/remotelinuxrunconfiguration.h> +#include <qt4projectmanager/qt-s60/s60devicedebugruncontrol.h> +#include <qt4projectmanager/qt-s60/s60devicerunconfiguration.h> + +#include <utils/qtcassert.h> + +#include <QtGui/QAction> + +using namespace Analyzer; +using namespace ProjectExplorer; +using namespace QmlProfiler::Internal; +using namespace QmlProjectManager; + +QmlProfilerRunControlFactory::QmlProfilerRunControlFactory(QObject *parent) + : IRunControlFactory(parent) +{ + setObjectName(QLatin1String("QmlProfilerRunControlFactory")); +} + +bool QmlProfilerRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const +{ + // FIXME: Should this just accept all mode == QLatin1String("QmlProfiler"); ? + if (qobject_cast<QmlProjectRunConfiguration *>(runConfiguration)) + return mode == QLatin1String("QmlProfiler"); + if (qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) + return mode == QLatin1String("QmlProfiler"); + if (qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) + return mode == QLatin1String("QmlProfiler"); + if (qobject_cast<Qt4ProjectManager::S60DeviceRunConfiguration *>(runConfiguration)) + return mode == QLatin1String("QmlProfiler"); + return false; +} + +RunControl *QmlProfilerRunControlFactory::create(RunConfiguration *runConfiguration, const QString &mode) +{ + QTC_ASSERT(canRun(runConfiguration, mode), return 0); + AnalyzerStartParameters sp; + sp.toolId = "QmlProfiler"; + sp.startMode = StartQml; // FIXME: The parameter struct is not needed/not used. + + + // FIXME: This is only used to communicate the connParams settings. + if (QmlProjectRunConfiguration *rc1 = + qobject_cast<QmlProjectRunConfiguration *>(runConfiguration)) { + // This is a "plain" .qmlproject. + sp.environment = rc1->environment(); + sp.workingDirectory = rc1->workingDirectory(); + sp.debuggee = rc1->observerPath(); + sp.debuggeeArgs = rc1->viewerArguments(); + sp.displayName = rc1->displayName(); + sp.connParams.host = QLatin1String("localhost"); + sp.connParams.port = rc1->qmlDebugServerPort(); + } else if (LocalApplicationRunConfiguration *rc2 = + qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) { + sp.environment = rc2->environment(); + sp.workingDirectory = rc2->workingDirectory(); + sp.debuggee = rc2->executable(); + sp.debuggeeArgs = rc2->commandLineArguments(); + sp.displayName = rc2->displayName(); + sp.connParams.host = QLatin1String("localhost"); + sp.connParams.port = rc2->qmlDebugServerPort(); + } else if (RemoteLinux::RemoteLinuxRunConfiguration *rc3 = + qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) { + sp.debuggee = rc3->remoteExecutableFilePath(); + sp.debuggeeArgs = rc3->arguments(); + sp.connParams = rc3->deviceConfig()->sshParameters(); + sp.analyzerCmdPrefix = rc3->commandPrefix(); + sp.displayName = rc3->displayName(); + } else if (Qt4ProjectManager::S60DeviceRunConfiguration *rc4 = + qobject_cast<Qt4ProjectManager::S60DeviceRunConfiguration *>(runConfiguration)) { + //sp.environment = rc4->environment(); + //sp.workingDirectory = rc4->workingDirectory(); + //sp.debuggee = rc4->executable(); + sp.debuggeeArgs = rc4->commandLineArguments(); + sp.displayName = rc4->displayName(); + sp.connParams.host = QLatin1String("localhost"); + sp.connParams.port = rc4->qmlDebugServerPort(); + } else { + // What could that be? + QTC_ASSERT(false, return 0); + } + + IAnalyzerTool *tool = AnalyzerManager::toolFromId(mode.toLatin1()); + AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, runConfiguration); + QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt())); + return rc; +} + +QString QmlProfilerRunControlFactory::displayName() const +{ + return tr("QML Profiler"); +} + +IRunConfigurationAspect *QmlProfilerRunControlFactory::createRunConfigurationAspect() +{ + return new AnalyzerProjectSettings; +} + +RunConfigWidget *QmlProfilerRunControlFactory::createConfigurationWidget(RunConfiguration *runConfiguration) +{ + QmlProjectManager::QmlProjectRunConfiguration *localRc = + qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration); + if (!localRc) + return 0; + + AnalyzerProjectSettings *settings = runConfiguration->extraAspect<AnalyzerProjectSettings>(); + if (!settings) + return 0; + + Analyzer::AnalyzerRunConfigWidget *ret = new Analyzer::AnalyzerRunConfigWidget; + + ret->setRunConfiguration(runConfiguration); + return ret; +} diff --git a/src/plugins/analyzerbase/analyzerruncontrolfactory.h b/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.h index 7c518f15cc..d360fb3ae9 100644 --- a/src/plugins/analyzerbase/analyzerruncontrolfactory.h +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.h @@ -30,34 +30,28 @@ ** **************************************************************************/ -#ifndef ANALYZERRUNCONTROLFACTORY_H -#define ANALYZERRUNCONTROLFACTORY_H +#ifndef QMLPROFILERRUNCONTROLFACTORY_H +#define QMLPROFILERRUNCONTROLFACTORY_H +#include <analyzerbase/analyzerruncontrol.h> #include <projectexplorer/runconfiguration.h> -namespace Analyzer { - -class AnalyzerRunControl; -class AnalyzerStartParameters; - +namespace QmlProfiler { namespace Internal { -class AnalyzerRunControlFactory: public ProjectExplorer::IRunControlFactory +class QmlProfilerRunControlFactory : public ProjectExplorer::IRunControlFactory { Q_OBJECT public: - AnalyzerRunControlFactory(QObject *parent = 0); - typedef ProjectExplorer::RunConfiguration RunConfiguration; - typedef ProjectExplorer::RunControl RunControl; - // virtuals from IRunControlFactory - bool canRun(RunConfiguration *runConfiguration, const QString &mode) const; - RunControl *create(RunConfiguration *runConfiguration, const QString &mode); - AnalyzerRunControl *create(const AnalyzerStartParameters &sp, RunConfiguration *rc = 0); - QString displayName() const; + QmlProfilerRunControlFactory(QObject *parent = 0); + // IRunControlFactory implementation + QString displayName() const; + bool canRun(RunConfiguration *runConfiguration, const QString &mode) const; + ProjectExplorer::RunControl *create(RunConfiguration *runConfiguration, const QString &mode); ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect(); ProjectExplorer::RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration); @@ -66,6 +60,6 @@ signals: }; } // namespace Internal -} // namespace Analyzer +} // namespace QmlProfiler -#endif // ANALYZERRUNCONTROLFACTORY_H +#endif // QMLPROFILERRUNCONTROLFACTORY_H diff --git a/src/plugins/qmlprofiler/qmlprofilersummaryview.cpp b/src/plugins/qmlprofiler/qmlprofilersummaryview.cpp deleted file mode 100644 index 307d920c57..0000000000 --- a/src/plugins/qmlprofiler/qmlprofilersummaryview.cpp +++ /dev/null @@ -1,283 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "qmlprofilersummaryview.h" - -#include <QtCore/QUrl> -#include <QtCore/QHash> - -#include <QtGui/QHeaderView> -#include <QtGui/QStandardItemModel> - -using namespace QmlProfiler::Internal; - -struct BindingData -{ - QString displayname; - QString filename; - int line; - qint64 duration; - qint64 calls; - qint64 minTime; - qint64 maxTime; - double tpc; - double percent; -}; - -class QmlProfilerSummaryView::QmlProfilerSummaryViewPrivate -{ -public: - QmlProfilerSummaryViewPrivate(QmlProfilerSummaryView *qq) : q(qq) {} - - QmlProfilerSummaryView *q; - - QStandardItemModel *m_model; - QHash<QString, BindingData *> m_bindingHash; - - enum RangeType { - Painting, - Compiling, - Creating, - Binding, - HandlingSignal, - - MaximumRangeType - }; -}; - -class ProfilerItem : public QStandardItem -{ -public: - ProfilerItem(const QString &text) : QStandardItem(text) {} - - virtual bool operator<(const QStandardItem &other) const - { - if (data().type() == QVariant::String) { - // first column - return data(Qt::UserRole+2).toString() == other.data(Qt::UserRole+2).toString() ? - data(Qt::UserRole+3).toInt() < other.data(Qt::UserRole+3).toInt() : - data(Qt::UserRole+2).toString() < other.data(Qt::UserRole+2).toString(); - } - - return data().toDouble() < other.data().toDouble(); - } -}; - -QmlProfilerSummaryView::QmlProfilerSummaryView(QWidget *parent) : - QTreeView(parent), d(new QmlProfilerSummaryViewPrivate(this)) -{ - setObjectName("QmlProfilerSummaryView"); - setRootIsDecorated(false); - header()->setResizeMode(QHeaderView::Interactive); - header()->setMinimumSectionSize(100); - setSortingEnabled(false); - setFrameStyle(QFrame::NoFrame); - - d->m_model = new QStandardItemModel(this); - - setModel(d->m_model); - - d->m_model->setColumnCount(7); - setHeaderLabels(); - - connect(this,SIGNAL(clicked(QModelIndex)), this,SLOT(jumpToItem(QModelIndex))); -} - -QmlProfilerSummaryView::~QmlProfilerSummaryView() -{ - delete d->m_model; -} - -void QmlProfilerSummaryView::clean() -{ - d->m_model->clear(); - d->m_model->setColumnCount(7); - - // clean the hash - QHashIterator<QString, BindingData *> it(d->m_bindingHash); - while (it.hasNext()) { - it.next(); - delete it.value(); - } - d->m_bindingHash.clear(); - - setHeaderLabels(); - setSortingEnabled(false); -} - -void QmlProfilerSummaryView::addRangedEvent(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length, - const QStringList &data, const QString &fileName, int line) -{ - Q_UNUSED(startTime); - Q_UNUSED(data); - Q_UNUSED(nestingLevel); - Q_UNUSED(nestingInType); - - if (type != QmlProfilerSummaryViewPrivate::Binding && type != QmlProfilerSummaryViewPrivate::HandlingSignal) - return; - - if (fileName.isEmpty()) - return; - const QChar colon = QLatin1Char(':'); - QString localName = QUrl(fileName).toLocalFile(); - QString displayName = localName.mid(localName.lastIndexOf(QChar('/'))+1)+colon+QString::number(line); - QString location = fileName+colon+QString::number(line); - - QHash<QString, BindingData *>::iterator it = d->m_bindingHash.find(location); - if (it != d->m_bindingHash.end()) { - BindingData *bindingInfo = it.value(); - bindingInfo->duration += length; - bindingInfo->calls++; - if (bindingInfo->maxTime < length) - bindingInfo->maxTime = length; - if (bindingInfo->minTime > length) - bindingInfo->minTime = length; - } else { - BindingData *newBinding = new BindingData; - newBinding->calls = 1; - newBinding->duration = length; - newBinding->displayname = displayName; - newBinding->filename = fileName; - newBinding->line = line; - newBinding->minTime = length; - newBinding->maxTime = length; - - d->m_bindingHash.insert(location, newBinding); - } -} - -void QmlProfilerSummaryView::complete() -{ - // compute percentages - double totalTime = 0; - - QHashIterator<QString, BindingData *> it(d->m_bindingHash); - - while (it.hasNext()) { - it.next(); - totalTime += it.value()->duration; - } - - it.toFront(); - - while (it.hasNext()) { - it.next(); - BindingData *binding = it.value(); - binding->percent = binding->duration * 100.0 / totalTime; - binding->tpc = binding->calls > 0 ? double(binding->duration) / binding->calls : 0; - - appendRow(binding->displayname, - binding->filename, - binding->line, - binding->percent, - binding->duration, - binding->calls, - binding->tpc, - binding->maxTime, - binding->minTime); - - } - setSortingEnabled(true); - sortByColumn(1,Qt::DescendingOrder); - resizeColumnToContents(0); -} - -void QmlProfilerSummaryView::jumpToItem(const QModelIndex &index) -{ - int line = d->m_model->item(index.row(),0)->data(Qt::UserRole+3).toInt(); - if (line == -1) - return; - QString fileName = d->m_model->item(index.row(),0)->data(Qt::UserRole+2).toString(); - emit gotoSourceLocation(fileName, line); -} - -void QmlProfilerSummaryView::appendRow(const QString &displayName, - const QString &fileName, - int line, - double percentTime, - double totalTime, - int nCalls, - double timePerCall, - double maxTime, - double minTime) -{ - QString location = fileName + QLatin1Char(':') + QString::number(line); - ProfilerItem *locationColumn = new ProfilerItem(displayName); - locationColumn->setData(QVariant(location),Qt::UserRole+1); - locationColumn->setData(QVariant(fileName),Qt::UserRole+2); - locationColumn->setData(QVariant(line),Qt::UserRole+3); - locationColumn->setEditable(false); - ProfilerItem *percentColumn = new ProfilerItem(QString::number(percentTime,'f',2)+QLatin1String(" %")); - percentColumn->setData(QVariant(percentTime)); - percentColumn->setEditable(false); - ProfilerItem *timeColumn = new ProfilerItem(displayTime(totalTime)); - timeColumn->setData(QVariant(totalTime)); - timeColumn->setEditable(false); - ProfilerItem *callsColumn = new ProfilerItem(QString::number(nCalls)); - callsColumn->setData(QVariant(nCalls)); - callsColumn->setEditable(false); - ProfilerItem *tpcColumn = new ProfilerItem(displayTime(timePerCall)); - tpcColumn->setData(QVariant(timePerCall)); - tpcColumn->setEditable(false); - ProfilerItem *maxTimeColumn = new ProfilerItem(displayTime(maxTime)); - maxTimeColumn->setData(QVariant(maxTime)); - maxTimeColumn->setEditable(false); - ProfilerItem *minTimeColumn = new ProfilerItem(displayTime(minTime)); - minTimeColumn->setData(QVariant(minTime)); - minTimeColumn->setEditable(false); - - QList<QStandardItem *> newRow; - newRow << locationColumn << percentColumn << timeColumn << callsColumn << tpcColumn << maxTimeColumn << minTimeColumn; - d->m_model->appendRow(newRow); -} - -QString QmlProfilerSummaryView::displayTime(double time) const -{ - if (time < 1e6) - return QString::number(time/1e3,'f',3) + QString::fromWCharArray(L" \u03BCs"); - if (time < 1e9) - return QString::number(time/1e6,'f',3) + QLatin1String(" ms"); - - return QString::number(time/1e9,'f',3) + QLatin1String(" s"); -} - -void QmlProfilerSummaryView::setHeaderLabels() -{ - d->m_model->setHeaderData(0, Qt::Horizontal, QVariant(tr("Location"))); - d->m_model->setHeaderData(1, Qt::Horizontal, QVariant(tr("Time in Percent"))); - d->m_model->setHeaderData(2, Qt::Horizontal, QVariant(tr("Total Time"))); - d->m_model->setHeaderData(3, Qt::Horizontal, QVariant(tr("Calls"))); - d->m_model->setHeaderData(4, Qt::Horizontal, QVariant(tr("Time per Call"))); - d->m_model->setHeaderData(5, Qt::Horizontal, QVariant(tr("Longest Time"))); - d->m_model->setHeaderData(6, Qt::Horizontal, QVariant(tr("Shortest Time"))); -} diff --git a/src/plugins/qmlprofiler/qmlprofilersummaryview.h b/src/plugins/qmlprofiler/qmlprofilersummaryview.h deleted file mode 100644 index 8de750d806..0000000000 --- a/src/plugins/qmlprofiler/qmlprofilersummaryview.h +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QMLPROFILERSUMMARYVIEW_H -#define QMLPROFILERSUMMARYVIEW_H - -#include <QTreeView> - -namespace QmlProfiler { -namespace Internal { - -class QmlProfilerSummaryView : public QTreeView -{ - Q_OBJECT - -public: - explicit QmlProfilerSummaryView(QWidget *parent = 0); - ~QmlProfilerSummaryView(); - -signals: - void gotoSourceLocation(const QString &fileName, int lineNumber); - -public slots: - void clean(); - void addRangedEvent(int type, int nestingLevel, int nestingInType, qint64 startTime, qint64 length, - const QStringList &data, const QString &fileName, int line); - void complete(); - void jumpToItem(const QModelIndex &index); - -private: - class QmlProfilerSummaryViewPrivate; - QmlProfilerSummaryViewPrivate *d; - - void appendRow(const QString &displayname, - const QString &filename, - int line, - double percentTime, - double totalTime, - int ncalls, - double timepercall, - double maxtime, - double mintime); - void setHeaderLabels(); - QString displayTime(double time) const; -}; - -} // namespace Internal -} // namespace QmlProfiler - -#endif // QMLPROFILERSUMMARYVIEW_H diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index bb810d04e8..fd004b7ae0 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -6,26 +6,25 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** @@ -36,9 +35,7 @@ #include "qmlprofilerplugin.h" #include "qmlprofilerconstants.h" #include "qmlprofilerattachdialog.h" -#include "qmlprofilersummaryview.h" -#include "qmlprofilercalleeview.h" -#include "qmlprofilercallerview.h" +#include "qmlprofilereventview.h" #include "tracewindow.h" #include "timelineview.h" @@ -96,9 +93,10 @@ public: QTimer m_connectionTimer; int m_connectionAttempts; TraceWindow *m_traceWindow; - QmlProfilerSummaryView *m_summary; - QmlProfilerCalleeView *m_calleetree; - QmlProfilerCallerView *m_callertree; + QmlProfilerEventStatistics *m_statistics; + QmlProfilerEventsView *m_eventsView; + QmlProfilerEventsView *m_calleeView; + QmlProfilerEventsView *m_callerView; ProjectExplorer::Project *m_project; Utils::FileInProjectFinder m_projectFinder; ProjectExplorer::RunConfiguration *m_runConfiguration; @@ -121,6 +119,7 @@ public: QmlProfilerTool::QmlProfilerTool(QObject *parent) : IAnalyzerTool(parent), d(new QmlProfilerToolPrivate(this)) { + setObjectName("QmlProfilerTool"); d->m_client = 0; d->m_connectionAttempts = 0; d->m_traceWindow = 0; @@ -132,6 +131,13 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent) d->m_connectionTimer.setInterval(200); connect(&d->m_connectionTimer, SIGNAL(timeout()), SLOT(tryToConnect())); + + qmlRegisterType<Canvas>("Monitor", 1, 0, "Canvas"); + qmlRegisterType<TiledCanvas>("Monitor", 1, 0, "TiledCanvas"); + qmlRegisterType<Context2D>(); + qmlRegisterType<CanvasImage>(); + qmlRegisterType<CanvasGradient>(); + qmlRegisterType<TimelineView>("Monitor", 1, 0,"TimelineView"); } QmlProfilerTool::~QmlProfilerTool() @@ -140,7 +146,7 @@ QmlProfilerTool::~QmlProfilerTool() delete d; } -QString QmlProfilerTool::id() const +QByteArray QmlProfilerTool::id() const { return "QmlProfiler"; } @@ -156,7 +162,7 @@ QString QmlProfilerTool::description() const "applications using QML."); } -IAnalyzerTool::ToolMode QmlProfilerTool::mode() const +IAnalyzerTool::ToolMode QmlProfilerTool::toolMode() const { return AnyMode; } @@ -164,7 +170,7 @@ IAnalyzerTool::ToolMode QmlProfilerTool::mode() const IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp, ProjectExplorer::RunConfiguration *runConfiguration) { - QmlProfilerEngine *engine = new QmlProfilerEngine(sp, runConfiguration); + QmlProfilerEngine *engine = new QmlProfilerEngine(this, runConfiguration); // Check minimum Qt Version. We cannot really be sure what the Qt version // at runtime is, but guess that the active build configuraiton has been used. @@ -194,6 +200,7 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp } } + // FIXME: Check that there's something sensible in sp.connParams if (d->m_connectMode == QmlProfilerToolPrivate::TcpConnection) { d->m_tcpHost = sp.connParams.host; d->m_tcpPort = sp.connParams.port; @@ -218,24 +225,25 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp return engine; } -void QmlProfilerTool::initialize() +void QmlProfilerTool::toolSelected() { - qmlRegisterType<Canvas>("Monitor", 1, 0, "Canvas"); - qmlRegisterType<TiledCanvas>("Monitor", 1, 0, "TiledCanvas"); - qmlRegisterType<Context2D>(); - qmlRegisterType<CanvasImage>(); - qmlRegisterType<CanvasGradient>(); - qmlRegisterType<TimelineView>("Monitor", 1, 0,"TimelineView"); + updateAttachAction(true); } -void QmlProfilerTool::extensionsInitialized() +void QmlProfilerTool::toolDeselected() { + updateAttachAction(false); } -void QmlProfilerTool::initializeDockWidgets() +QWidget *QmlProfilerTool::createWidgets() { - Analyzer::AnalyzerManager *analyzerMgr = Analyzer::AnalyzerManager::instance(); - Utils::FancyMainWindow *mw = analyzerMgr->mainWindow(); + QTC_ASSERT(!d->m_traceWindow, return 0); + + // + // DockWidgets + // + + Utils::FancyMainWindow *mw = AnalyzerManager::mainWindow(); d->m_traceWindow = new TraceWindow(mw); d->m_traceWindow->reset(d->m_client); @@ -243,29 +251,25 @@ void QmlProfilerTool::initializeDockWidgets() connect(d->m_traceWindow, SIGNAL(gotoSourceLocation(QString,int)),this, SLOT(gotoSourceLocation(QString,int))); connect(d->m_traceWindow, SIGNAL(timeChanged(qreal)), this, SLOT(updateTimer(qreal))); - d->m_summary = new QmlProfilerSummaryView(mw); + d->m_statistics = new QmlProfilerEventStatistics(mw); + d->m_eventsView = new QmlProfilerEventsView(mw, d->m_statistics); + d->m_eventsView->setViewType(QmlProfilerEventsView::EventsView); connect(d->m_traceWindow, SIGNAL(range(int,int,int,qint64,qint64,QStringList,QString,int)), - d->m_summary, SLOT(addRangedEvent(int,int,int,qint64,qint64,QStringList,QString,int))); + d->m_statistics, SLOT(addRangedEvent(int,int,int,qint64,qint64,QStringList,QString,int))); connect(d->m_traceWindow, SIGNAL(viewUpdated()), - d->m_summary, SLOT(complete())); - connect(d->m_summary, SIGNAL(gotoSourceLocation(QString,int)), + d->m_statistics, SLOT(complete())); + connect(d->m_eventsView, SIGNAL(gotoSourceLocation(QString,int)), this, SLOT(gotoSourceLocation(QString,int))); - d->m_calleetree = new QmlProfilerCalleeView(mw); - connect(d->m_traceWindow, SIGNAL(range(int,int,int,qint64,qint64,QStringList,QString,int)), - d->m_calleetree, SLOT(addRangedEvent(int,int,int,qint64,qint64,QStringList,QString,int))); - connect(d->m_traceWindow, SIGNAL(viewUpdated()), - d->m_calleetree, SLOT(complete())); - connect(d->m_calleetree, SIGNAL(gotoSourceLocation(QString,int)), + d->m_calleeView = new QmlProfilerEventsView(mw, d->m_statistics); + d->m_calleeView->setViewType(QmlProfilerEventsView::CalleesView); + connect(d->m_calleeView, SIGNAL(gotoSourceLocation(QString,int)), this, SLOT(gotoSourceLocation(QString,int))); - d->m_callertree = new QmlProfilerCallerView(mw); - connect(d->m_traceWindow, SIGNAL(range(int,int,int,qint64,qint64,QStringList,QString,int)), - d->m_callertree, SLOT(addRangedEvent(int,int,int,qint64,qint64,QStringList,QString,int))); - connect(d->m_traceWindow, SIGNAL(viewUpdated()), - d->m_callertree, SLOT(complete())); - connect(d->m_callertree, SIGNAL(gotoSourceLocation(QString,int)), + d->m_callerView = new QmlProfilerEventsView(mw, d->m_statistics); + d->m_callerView->setViewType(QmlProfilerEventsView::CallersView); + connect(d->m_callerView, SIGNAL(gotoSourceLocation(QString,int)), this, SLOT(gotoSourceLocation(QString,int))); Core::ICore *core = Core::ICore::instance(); @@ -282,41 +286,23 @@ void QmlProfilerTool::initializeDockWidgets() updateAttachAction(false); - QDockWidget *summaryDock = - analyzerMgr->createDockWidget(this, tr("Bindings"), - d->m_summary, Qt::BottomDockWidgetArea); - - QDockWidget *timelineDock = - analyzerMgr->createDockWidget(this, tr("Timeline"), - d->m_traceWindow, Qt::BottomDockWidgetArea); - - QDockWidget *calleeDock = - analyzerMgr->createDockWidget(this, tr("Callees"), - d->m_calleetree, Qt::BottomDockWidgetArea); - - QDockWidget *callerDock = - analyzerMgr->createDockWidget(this, tr("Callers"), - d->m_callertree, Qt::BottomDockWidgetArea); - - mw->splitDockWidget(mw->toolBarDockWidget(), summaryDock, Qt::Vertical); - mw->tabifyDockWidget(summaryDock, timelineDock); + QDockWidget *eventsDock = AnalyzerManager::createDockWidget + (this, tr("Events"), d->m_eventsView, Qt::BottomDockWidgetArea); + QDockWidget *timelineDock = AnalyzerManager::createDockWidget + (this, tr("Timeline"), d->m_traceWindow, Qt::BottomDockWidgetArea); + QDockWidget *calleeDock = AnalyzerManager::createDockWidget + (this, tr("Callees"), d->m_calleeView, Qt::BottomDockWidgetArea); + QDockWidget *callerDock = AnalyzerManager::createDockWidget + (this, tr("Callers"), d->m_callerView, Qt::BottomDockWidgetArea); + + mw->splitDockWidget(mw->toolBarDockWidget(), eventsDock, Qt::Vertical); + mw->tabifyDockWidget(eventsDock, timelineDock); mw->tabifyDockWidget(timelineDock, calleeDock); mw->tabifyDockWidget(calleeDock, callerDock); -} - -void QmlProfilerTool::toolSelected() -{ - updateAttachAction(true); -} -void QmlProfilerTool::toolDeselected() -{ - updateAttachAction(false); -} - -QWidget *QmlProfilerTool::createControlWidget() -{ - // custom toolbar (TODO) + // + // Toolbar + // QWidget *toolbarWidget = new QWidget; toolbarWidget->setObjectName(QLatin1String("QmlProfilerToolBarWidget")); @@ -325,8 +311,7 @@ QWidget *QmlProfilerTool::createControlWidget() layout->setSpacing(0); d->m_recordButton = new QToolButton(toolbarWidget); - - d->m_recordButton->setIcon(QIcon(QLatin1String(":/qmlprofiler/analyzer_category_small.png"))); + // icon and tooltip set in setRecording(), called later d->m_recordButton->setCheckable(true); connect(d->m_recordButton,SIGNAL(toggled(bool)), this, SLOT(setRecording(bool))); @@ -335,6 +320,7 @@ QWidget *QmlProfilerTool::createControlWidget() d->m_clearButton = new QToolButton(toolbarWidget); d->m_clearButton->setIcon(QIcon(QLatin1String(":/qmlprofiler/clean_pane_small.png"))); + d->m_clearButton->setToolTip(tr("Discard data")); connect(d->m_clearButton,SIGNAL(clicked()), this, SLOT(clearDisplay())); layout->addWidget(d->m_clearButton); @@ -409,6 +395,12 @@ void QmlProfilerTool::stopRecording() void QmlProfilerTool::setRecording(bool recording) { d->m_recordingEnabled = recording; + + // update record button + d->m_recordButton->setToolTip( d->m_recordingEnabled ? tr("Disable profiling") : tr("Enable profiling")); + d->m_recordButton->setIcon(QIcon(d->m_recordingEnabled ? QLatin1String(":/qmlprofiler/recordOn.png") : + QLatin1String(":/qmlprofiler/recordOff.png"))); + if (recording) startRecording(); else @@ -447,23 +439,13 @@ void QmlProfilerTool::updateProjectFileList() d->m_project->files(ProjectExplorer::Project::ExcludeGeneratedFiles)); } -bool QmlProfilerTool::canRunRemotely() const -{ - // TODO: Is this correct? - return true; -} - -bool QmlProfilerTool::canRunLocally() const -{ - return true; -} - void QmlProfilerTool::clearDisplay() { d->m_traceWindow->clearDisplay(); - d->m_summary->clean(); - d->m_calleetree->clean(); - d->m_callertree->clean(); + d->m_statistics->clear(); + d->m_eventsView->clear(); + d->m_calleeView->clear(); + d->m_callerView->clear(); } void QmlProfilerTool::attach() @@ -479,7 +461,7 @@ void QmlProfilerTool::attach() d->m_tcpHost = dialog.address(); connectClient(d->m_tcpPort); - AnalyzerManager::instance()->showMode(); + AnalyzerManager::showMode(); } else { stopRecording(); } @@ -566,3 +548,18 @@ void QmlProfilerTool::updateRecordingState() if (d->m_traceWindow->isRecording()) clearDisplay(); } + +void QmlProfilerTool::startTool(StartMode mode) +{ + Q_UNUSED(mode); + + using namespace ProjectExplorer; + + // Make sure mode is shown. + AnalyzerManager::showMode(); + + ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance(); + // ### not sure if we're supposed to check if the RunConFiguration isEnabled + Project *pro = pe->startupProject(); + pe->runProject(pro, id()); +} diff --git a/src/plugins/qmlprofiler/qmlprofilertool.h b/src/plugins/qmlprofiler/qmlprofilertool.h index 13e34375cd..c4520d5a65 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.h +++ b/src/plugins/qmlprofiler/qmlprofilertool.h @@ -6,26 +6,25 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** @@ -45,27 +44,23 @@ class QmlProfilerTool : public Analyzer::IAnalyzerTool Q_OBJECT public: - explicit QmlProfilerTool(QObject *parent = 0); + explicit QmlProfilerTool(QObject *parent); ~QmlProfilerTool(); - QString id() const; + QByteArray id() const; QString displayName() const; QString description() const; - ToolMode mode() const; + ToolMode toolMode() const; - void initialize(); - void extensionsInitialized(); - void initializeDockWidgets(); + void extensionsInitialized() {} void toolSelected(); void toolDeselected(); Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp, ProjectExplorer::RunConfiguration *runConfiguration = 0); - QWidget *createControlWidget(); - - bool canRunRemotely() const; - bool canRunLocally() const; + QWidget *createWidgets(); + void startTool(Analyzer::StartMode mode); public slots: void connectClient(int port); @@ -95,6 +90,7 @@ private: void updateAttachAction(bool isCurrentTool); void connectToClient(); void updateRecordingState(); + void ensureWidgets(); class QmlProfilerToolPrivate; QmlProfilerToolPrivate *d; diff --git a/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp b/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp index cfc69dad55..9e663d7c21 100644 --- a/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp @@ -6,26 +6,25 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** @@ -42,14 +41,14 @@ QmlProfilerTraceClient::QmlProfilerTraceClient(QDeclarativeDebugConnection *clie : QDeclarativeDebugClient(QLatin1String("CanvasFrameRate"), client), m_inProgressRanges(0), m_maximumTime(0), m_recording(false), m_nestingLevel(0) { - ::memset(m_rangeCount, 0, MaximumRangeType * sizeof(int)); - ::memset(m_nestingInType, 0, MaximumRangeType * sizeof(int)); + ::memset(m_rangeCount, 0, MaximumQmlEventType * sizeof(int)); + ::memset(m_nestingInType, 0, MaximumQmlEventType * sizeof(int)); } void QmlProfilerTraceClient::clearView() { - ::memset(m_rangeCount, 0, MaximumRangeType * sizeof(int)); - ::memset(m_nestingInType, 0, MaximumRangeType * sizeof(int)); + ::memset(m_rangeCount, 0, MaximumQmlEventType * sizeof(int)); + ::memset(m_nestingInType, 0, MaximumQmlEventType * sizeof(int)); m_nestingLevel = 0; emit clear(); } @@ -111,7 +110,7 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data) int range; stream >> range; - if (range >= MaximumRangeType) + if (range >= MaximumQmlEventType) return; if (messageType == RangeStart) { @@ -150,7 +149,7 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data) Location location = m_rangeLocations[range].count() ? m_rangeLocations[range].pop() : Location(); qint64 startTime = m_rangeStartTimes[range].pop(); - emit this->range((RangeType)range, m_nestingLevel, m_nestingInType[range], startTime, + emit this->range((QmlEventType)range, m_nestingLevel, m_nestingInType[range], startTime, time - startTime, data, location.fileName, location.line); --m_nestingLevel; --m_nestingInType[range]; diff --git a/src/plugins/qmlprofiler/qmlprofilertraceclient.h b/src/plugins/qmlprofiler/qmlprofilertraceclient.h index 207f63e9d6..39a3a92969 100644 --- a/src/plugins/qmlprofiler/qmlprofilertraceclient.h +++ b/src/plugins/qmlprofiler/qmlprofilertraceclient.h @@ -6,26 +6,25 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** @@ -38,6 +37,8 @@ #include <QtCore/QStack> #include <QtCore/QStringList> +#include "qmlprofilereventtypes.h" + namespace QmlProfiler { namespace Internal { @@ -76,16 +77,6 @@ public: MaximumMessage }; - enum RangeType { - Painting, - Compiling, - Creating, - Binding, - HandlingSignal, - - MaximumRangeType - }; - bool isRecording() const { return m_recording; } public slots: @@ -112,14 +103,14 @@ protected: private: qint64 m_inProgressRanges; - QStack<qint64> m_rangeStartTimes[MaximumRangeType]; - QStack<QStringList> m_rangeDatas[MaximumRangeType]; - QStack<Location> m_rangeLocations[MaximumRangeType]; - int m_rangeCount[MaximumRangeType]; + QStack<qint64> m_rangeStartTimes[MaximumQmlEventType]; + QStack<QStringList> m_rangeDatas[MaximumQmlEventType]; + QStack<Location> m_rangeLocations[MaximumQmlEventType]; + int m_rangeCount[MaximumQmlEventType]; qint64 m_maximumTime; bool m_recording; int m_nestingLevel; - int m_nestingInType[MaximumRangeType]; + int m_nestingInType[MaximumQmlEventType]; }; } // namespace Internal diff --git a/src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.cpp b/src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.cpp deleted file mode 100644 index aad9d920f1..0000000000 --- a/src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "qmlprojectanalyzerruncontrolfactory.h" -#include "qmlprojectmanager/qmlprojectrunconfiguration.h" -#include <analyzerbase/analyzerstartparameters.h> -#include <analyzerbase/analyzersettings.h> -#include <analyzerbase/analyzerrunconfigwidget.h> - -#include <utils/qtcassert.h> - -using namespace Analyzer; -using namespace ProjectExplorer; -using namespace QmlProfiler::Internal; - -AnalyzerStartParameters localStartParameters(ProjectExplorer::RunConfiguration *runConfiguration) -{ - AnalyzerStartParameters sp; - QTC_ASSERT(runConfiguration, return sp); - QmlProjectManager::QmlProjectRunConfiguration *rc = - qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration); - QTC_ASSERT(rc, return sp); - - sp.startMode = StartLocal; - sp.environment = rc->environment(); - sp.workingDirectory = rc->workingDirectory(); - sp.debuggee = rc->observerPath(); - sp.debuggeeArgs = rc->viewerArguments(); - sp.displayName = rc->displayName(); - sp.connParams.host = QLatin1String("localhost"); - sp.connParams.port = rc->qmlDebugServerPort(); - return sp; -} - -QmlProjectAnalyzerRunControlFactory::QmlProjectAnalyzerRunControlFactory(QObject *parent) - : IRunControlFactory(parent) -{ -} - -bool QmlProjectAnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const -{ - if (!qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration)) - return false; - return mode == Constants::MODE_ANALYZE; -} - -RunControl *QmlProjectAnalyzerRunControlFactory::create(RunConfiguration *runConfiguration, const QString &mode) -{ - if (!qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration) - || mode != Constants::MODE_ANALYZE) { - return 0; - } - const AnalyzerStartParameters sp = localStartParameters(runConfiguration); - return create(sp, runConfiguration); -} - -AnalyzerRunControl *QmlProjectAnalyzerRunControlFactory::create(const Analyzer::AnalyzerStartParameters &sp, RunConfiguration *runConfiguration) -{ - AnalyzerRunControl *rc = new AnalyzerRunControl(sp, runConfiguration); - emit runControlCreated(rc); - return rc; -} - -QString QmlProjectAnalyzerRunControlFactory::displayName() const -{ - return tr("QML Profiler"); -} - -IRunConfigurationAspect *QmlProjectAnalyzerRunControlFactory::createRunConfigurationAspect() -{ - return new AnalyzerProjectSettings; -} - -RunConfigWidget *QmlProjectAnalyzerRunControlFactory::createConfigurationWidget(RunConfiguration *runConfiguration) -{ - QmlProjectManager::QmlProjectRunConfiguration *localRc = - qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration); - if (!localRc) - return 0; - - AnalyzerProjectSettings *settings = runConfiguration->extraAspect<AnalyzerProjectSettings>(); - if (!settings) - return 0; - - Analyzer::AnalyzerRunConfigWidget *ret = new Analyzer::AnalyzerRunConfigWidget; - ret->setRunConfiguration(runConfiguration); - return ret; -} diff --git a/src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.h b/src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.h deleted file mode 100644 index c4de8f60de..0000000000 --- a/src/plugins/qmlprofiler/qmlprojectanalyzerruncontrolfactory.h +++ /dev/null @@ -1,69 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef QMLPROJECTANALYZERRUNCONTROLFACTORY_H -#define QMLPROJECTANALYZERRUNCONTROLFACTORY_H - -#include <analyzerbase/analyzerruncontrol.h> -//#include <analyzerbase/analyzerruncontrolfactory.h> -#include <projectexplorer/runconfiguration.h> - -namespace QmlProfiler { -namespace Internal { - -class QmlProjectAnalyzerRunControlFactory : public ProjectExplorer::IRunControlFactory -{ - Q_OBJECT - -public: - typedef ProjectExplorer::RunConfiguration RunConfiguration; - - QmlProjectAnalyzerRunControlFactory(QObject *parent = 0); - - // IRunControlFactory implementation - bool canRun(RunConfiguration *runConfiguration, const QString &mode) const; - ProjectExplorer::RunControl *create(RunConfiguration *runConfiguration, const QString &mode); - Analyzer::AnalyzerRunControl *create(const Analyzer::AnalyzerStartParameters &sp, RunConfiguration *runConfiguration = 0); - QString displayName() const; - - ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect(); - ProjectExplorer::RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration); - -signals: - void runControlCreated(Analyzer::AnalyzerRunControl *); -}; - -} // namespace Internal -} // namespace QmlProfiler - -#endif // QMLPROJECTANALYZERRUNCONTROLFACTORY_H diff --git a/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.cpp b/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.cpp index aecb8940ab..efccff105c 100644 --- a/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.cpp +++ b/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.cpp @@ -4,30 +4,29 @@ ** ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.h b/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.h index a6b24f7e6e..cf7a444a6f 100644 --- a/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.h +++ b/src/plugins/qmlprofiler/remotelinuxqmlprofilerrunner.h @@ -6,26 +6,25 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** diff --git a/src/plugins/qmlprofiler/timelineview.cpp b/src/plugins/qmlprofiler/timelineview.cpp index 4af994fb22..79afcf2cc2 100644 --- a/src/plugins/qmlprofiler/timelineview.cpp +++ b/src/plugins/qmlprofiler/timelineview.cpp @@ -6,26 +6,25 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** diff --git a/src/plugins/qmlprofiler/timelineview.h b/src/plugins/qmlprofiler/timelineview.h index 327ec5112c..ca0bffc792 100644 --- a/src/plugins/qmlprofiler/timelineview.h +++ b/src/plugins/qmlprofiler/timelineview.h @@ -6,26 +6,25 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** diff --git a/src/plugins/qmlprofiler/tracewindow.cpp b/src/plugins/qmlprofiler/tracewindow.cpp index dda54f327b..f5dee6e244 100644 --- a/src/plugins/qmlprofiler/tracewindow.cpp +++ b/src/plugins/qmlprofiler/tracewindow.cpp @@ -6,26 +6,25 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** @@ -72,21 +71,32 @@ TraceWindow::TraceWindow(QWidget *parent) toolBarLayout->setSpacing(0); QToolButton *buttonPrev= new QToolButton; buttonPrev->setIcon(QIcon(":/qmlprofiler/prev.png")); + buttonPrev->setToolTip(tr("Jump to previous event")); connect(buttonPrev, SIGNAL(clicked()), this, SIGNAL(jumpToPrev())); + connect(this, SIGNAL(enableToolbar(bool)), buttonPrev, SLOT(setEnabled(bool))); QToolButton *buttonNext= new QToolButton; buttonNext->setIcon(QIcon(":/qmlprofiler/next.png")); + buttonNext->setToolTip(tr("Jump to next event")); connect(buttonNext, SIGNAL(clicked()), this, SIGNAL(jumpToNext())); + connect(this, SIGNAL(enableToolbar(bool)), buttonNext, SLOT(setEnabled(bool))); QToolButton *buttonZoomIn = new QToolButton; buttonZoomIn->setIcon(QIcon(":/qmlprofiler/magnifier-plus.png")); + buttonZoomIn->setToolTip(tr("Zoom in 10%")); connect(buttonZoomIn, SIGNAL(clicked()), this, SIGNAL(zoomIn())); + connect(this, SIGNAL(enableToolbar(bool)), buttonZoomIn, SLOT(setEnabled(bool))); QToolButton *buttonZoomOut = new QToolButton; buttonZoomOut->setIcon(QIcon(":/qmlprofiler/magnifier-minus.png")); + buttonZoomOut->setToolTip(tr("Zoom out 10%")); connect(buttonZoomOut, SIGNAL(clicked()), this, SIGNAL(zoomOut())); + connect(this, SIGNAL(enableToolbar(bool)), buttonZoomOut, SLOT(setEnabled(bool))); + toolBarLayout->addWidget(buttonPrev); toolBarLayout->addWidget(buttonNext); toolBarLayout->addWidget(buttonZoomIn); toolBarLayout->addWidget(buttonZoomOut); + + m_view->setResizeMode(QDeclarativeView::SizeRootObjectToView); m_view->setFocus(); groupLayout->addWidget(m_view); @@ -115,8 +125,11 @@ void TraceWindow::reset(QmlJsDebugClient::QDeclarativeDebugConnection *conn) m_view->rootContext()->setContextProperty("connection", m_plugin.data()); m_view->setSource(QUrl("qrc:/qmlprofiler/MainView.qml")); + updateToolbar(); + connect(m_view->rootObject(), SIGNAL(updateCursorPosition()), this, SLOT(updateCursorPosition())); connect(m_view->rootObject(), SIGNAL(updateTimer()), this, SLOT(updateTimer())); + connect(m_view->rootObject(), SIGNAL(dataAvailableChanged()), this, SLOT(updateToolbar())); connect(this, SIGNAL(jumpToPrev()), m_view->rootObject(), SLOT(prevEvent())); connect(this, SIGNAL(jumpToNext()), m_view->rootObject(), SLOT(nextEvent())); connect(this, SIGNAL(zoomIn()), m_view->rootObject(), SLOT(zoomIn())); @@ -144,6 +157,12 @@ void TraceWindow::clearDisplay() emit internalClearDisplay(); } +void TraceWindow::updateToolbar() +{ + bool dataAvailable = m_view->rootObject()->property("dataAvailable").toBool(); + emit enableToolbar(dataAvailable); +} + void TraceWindow::setRecording(bool recording) { if (m_plugin) diff --git a/src/plugins/qmlprofiler/tracewindow.h b/src/plugins/qmlprofiler/tracewindow.h index f76fea15f7..ffd414d9ca 100644 --- a/src/plugins/qmlprofiler/tracewindow.h +++ b/src/plugins/qmlprofiler/tracewindow.h @@ -6,26 +6,25 @@ ** ** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact ** Nokia at info@qt.nokia.com. ** @@ -64,6 +63,7 @@ public slots: void updateCursorPosition(); void updateTimer(); void clearDisplay(); + void updateToolbar(); signals: void viewUpdated(); @@ -76,6 +76,7 @@ signals: void jumpToNext(); void zoomIn(); void zoomOut(); + void enableToolbar(bool); private: QWeakPointer<QmlProfilerTraceClient> m_plugin; diff --git a/src/plugins/qt4projectmanager/applicationlauncher.h b/src/plugins/qt4projectmanager/applicationlauncher.h index 0315b68c6f..a17f479fd8 100644 --- a/src/plugins/qt4projectmanager/applicationlauncher.h +++ b/src/plugins/qt4projectmanager/applicationlauncher.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qt4projectmanager/qmakeparser.cpp b/src/plugins/qt4projectmanager/qmakeparser.cpp index 19d8e7332d..dfc2514547 100644 --- a/src/plugins/qt4projectmanager/qmakeparser.cpp +++ b/src/plugins/qt4projectmanager/qmakeparser.cpp @@ -37,8 +37,6 @@ #include <projectexplorer/projectexplorerconstants.h> #include <utils/qtcassert.h> -#include <QtCore/QDir> - using namespace Qt4ProjectManager; using namespace Qt4ProjectManager::Internal; using ProjectExplorer::Task; @@ -73,7 +71,7 @@ void QMakeParser::stdError(const QString &line) return; } if (m_error.indexIn(lne) > -1) { - QString fileName = QDir::fromNativeSeparators(m_error.cap(1)); + QString fileName = m_error.cap(1); Task::TaskType type = Task::Error; if (fileName.startsWith("WARNING: ")) { type = Task::Warning; @@ -143,7 +141,7 @@ void Qt4ProjectManagerPlugin::testQmakeOutputParsers_data() << (QList<ProjectExplorer::Task>() << Task(Task::Error, QLatin1String("Parse Error ('sth odd')"), - QDir::fromNativeSeparators(QLatin1String("e:\\project.pro")), + QLatin1String("e:\\project.pro"), 14, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)) << QString(); @@ -166,7 +164,7 @@ void Qt4ProjectManagerPlugin::testQmakeOutputParsers_data() << (QList<ProjectExplorer::Task>() << Task(Task::Warning, QLatin1String("Unescaped backslashes are deprecated."), - QLatin1String("e:/NokiaQtSDK/Simulator/Qt/msvc2008/lib/qtmaind.prl"), 1, + QLatin1String("e:\\NokiaQtSDK\\Simulator\\Qt\\msvc2008\\lib\\qtmaind.prl"), 1, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)) << QString(); } diff --git a/src/plugins/qt4projectmanager/qt-s60/abldparser.cpp b/src/plugins/qt4projectmanager/qt-s60/abldparser.cpp index c54786eec2..504ac65200 100644 --- a/src/plugins/qt4projectmanager/qt-s60/abldparser.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/abldparser.cpp @@ -35,8 +35,6 @@ #include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/taskwindow.h> -#include <QtCore/QDir> - using namespace Qt4ProjectManager; using namespace ProjectExplorer; using namespace ProjectExplorer::Constants; @@ -78,7 +76,7 @@ void AbldParser::stdOutput(const QString &line) if (m_perlIssue.indexIn(lne) > -1) { m_waitingForStdOutContinuation = true; - m_currentFile = QDir::fromNativeSeparators(m_perlIssue.cap(2)); + m_currentFile = m_perlIssue.cap(2); m_currentLine = m_perlIssue.cap(3).toInt(); Task task(Task::Unknown, @@ -148,7 +146,7 @@ void AbldParser::stdError(const QString &line) } if (lne.startsWith(QLatin1String("MMPFILE \""))) { - m_currentFile = QDir::fromNativeSeparators(lne.mid(9, lne.size() - 10)); + m_currentFile = lne.mid(9, lne.size() - 10); m_waitingForStdErrContinuation = false; return; } diff --git a/src/plugins/qt4projectmanager/qt-s60/rvctparser.cpp b/src/plugins/qt4projectmanager/qt-s60/rvctparser.cpp index 54b1e4ecfb..c783b4abc2 100644 --- a/src/plugins/qt4projectmanager/qt-s60/rvctparser.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/rvctparser.cpp @@ -34,8 +34,6 @@ #include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/taskwindow.h> -#include <QtCore/QDir> - using namespace ProjectExplorer; using namespace ProjectExplorer::Constants; using namespace Qt4ProjectManager; @@ -85,7 +83,7 @@ void RvctParser::stdError(const QString &line) m_task = new Task(Task::Unknown, m_warningOrError.cap(5) /* description */, - QDir::fromNativeSeparators(m_warningOrError.cap(1)) /* file */, + m_warningOrError.cap(1) /* file */, m_warningOrError.cap(2).toInt() /* line */, TASK_CATEGORY_COMPILE); if (m_warningOrError.cap(4) == "Warning") diff --git a/src/plugins/qt4projectmanager/qt-s60/s60createpackageparser.cpp b/src/plugins/qt4projectmanager/qt-s60/s60createpackageparser.cpp index 47c52dedba..5dfea8114e 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60createpackageparser.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60createpackageparser.cpp @@ -35,8 +35,6 @@ #include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/taskwindow.h> -#include <QtCore/QDebug> - using namespace Qt4ProjectManager::Internal; S60CreatePackageParser::S60CreatePackageParser(const QString &packageName) : diff --git a/src/plugins/qt4projectmanager/qt-s60/s60deployconfigurationwidget.cpp b/src/plugins/qt4projectmanager/qt-s60/s60deployconfigurationwidget.cpp index c1e748f555..25e94091b0 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60deployconfigurationwidget.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60deployconfigurationwidget.cpp @@ -633,13 +633,13 @@ void S60DeployConfigurationWidget::getInstalledPackagesResult(const Coda::CodaCo break; case QTMOBILITY_UID: { if (error) - addErrorToTable(str, tr("QtMobility version: "), tr("Error reading QtMobility version")); + addErrorToTable(str, tr("Qt Mobility version: "), tr("Error reading Qt Mobility version")); else - addToTable(str, tr("QtMobility version: "), versionString); + addToTable(str, tr("Qt Mobility version: "), versionString); } break; case QTCOMPONENTS_UID: { - addToTable(str, tr("QtQuick components version: "), error ? tr("Not installed") : versionString); + addToTable(str, tr("Qt Quick components version: "), error ? tr("Not installed") : versionString); } break; default: break; diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp index d43a455b5f..35eb8df7b4 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.cpp @@ -4,30 +4,29 @@ ** ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.h b/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.h index d316bf7793..d608635f35 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.h +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicedebugruncontrol.h @@ -4,30 +4,29 @@ ** ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Nokia Corporation (info@qt.nokia.com) ** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. ** ** 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. +** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception +** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qt4projectmanager/qt-s60/winscwparser.cpp b/src/plugins/qt4projectmanager/qt-s60/winscwparser.cpp index 4fa0e50096..b2f2c8d962 100644 --- a/src/plugins/qt4projectmanager/qt-s60/winscwparser.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/winscwparser.cpp @@ -34,8 +34,6 @@ #include <projectexplorer/projectexplorerconstants.h> -#include <QtCore/QDir> - using namespace Qt4ProjectManager; using namespace ProjectExplorer; using namespace ProjectExplorer::Constants; @@ -59,7 +57,7 @@ void WinscwParser::stdOutput(const QString &line) if (m_compilerProblem.indexIn(lne) > -1) { Task task(Task::Error, m_compilerProblem.cap(3) /* description */, - QDir::fromNativeSeparators(m_compilerProblem.cap(1)) /* filename */, + m_compilerProblem.cap(1) /* filename */, m_compilerProblem.cap(2).toInt() /* linenumber */, TASK_CATEGORY_COMPILE); if (task.description.startsWith(QLatin1String("warning: "))) { @@ -79,7 +77,7 @@ void WinscwParser::stdError(const QString &line) if (m_linkerProblem.indexIn(lne) > -1) { emit addTask(Task(Task::Error, m_linkerProblem.cap(2) /* description */, - QDir::fromNativeSeparators(m_linkerProblem.cap(1)) /* filename */, + m_linkerProblem.cap(1) /* filename */, -1 /* linenumber */, TASK_CATEGORY_COMPILE)); return; diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp index b53bac567e..ebf2d0bade 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.cpp +++ b/src/plugins/qt4projectmanager/qt4nodes.cpp @@ -619,8 +619,8 @@ void Qt4PriFileNode::update(ProFile *includeFileExact, QtSupport::ProFileReader for (int i = 0; i < fileTypes.size(); ++i) { FileType type = fileTypes.at(i).type; - QSet<QString> newFilePaths = foundFiles[type]; - newFilePaths += filterFiles(type, m_recursiveEnumerateFiles); + QSet<QString> newFilePaths = filterFilesProVariables(type, foundFiles[type]); + newFilePaths += filterFilesRecursiveEnumerata(type, m_recursiveEnumerateFiles); // We only need to save this information if // we are watching folders @@ -694,8 +694,8 @@ void Qt4PriFileNode::folderChanged(const QString &folder) const QVector<Qt4NodeStaticData::FileTypeData> &fileTypes = qt4NodeStaticData()->fileTypeData; for (int i = 0; i < fileTypes.size(); ++i) { FileType type = fileTypes.at(i).type; - QSet<QString> add = filterFiles(type, addedFiles); - QSet<QString> remove = filterFiles(type, removedFiles); + QSet<QString> add = filterFilesRecursiveEnumerata(type, addedFiles); + QSet<QString> remove = filterFilesRecursiveEnumerata(type, removedFiles); if (!add.isEmpty() || !remove.isEmpty()) { // Scream :) @@ -1227,7 +1227,26 @@ QStringList Qt4PriFileNode::dynamicVarNames(QtSupport::ProFileReader *readerExac return result; } -QSet<QString> Qt4PriFileNode::filterFiles(ProjectExplorer::FileType fileType, const QSet<QString> &files) +QSet<QString> Qt4PriFileNode::filterFilesProVariables(ProjectExplorer::FileType fileType, const QSet<QString> &files) +{ + if (fileType != ProjectExplorer::QMLType && fileType != ProjectExplorer::UnknownFileType) + return files; + QSet<QString> result; + if (fileType != ProjectExplorer::QMLType && fileType != ProjectExplorer::UnknownFileType) + return result; + if (fileType == ProjectExplorer::QMLType) { + foreach (const QString &file, files) + if (file.endsWith(".qml")) + result << file; + } else { + foreach (const QString &file, files) + if (!file.endsWith(".qml")) + result << file; + } + return result; +} + +QSet<QString> Qt4PriFileNode::filterFilesRecursiveEnumerata(ProjectExplorer::FileType fileType, const QSet<QString> &files) { QSet<QString> result; if (fileType != ProjectExplorer::QMLType && fileType != ProjectExplorer::UnknownFileType) diff --git a/src/plugins/qt4projectmanager/qt4nodes.h b/src/plugins/qt4projectmanager/qt4nodes.h index d674a75899..3f2d1e7b8a 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.h +++ b/src/plugins/qt4projectmanager/qt4nodes.h @@ -153,7 +153,8 @@ protected: void clear(); static QStringList varNames(FileType type); static QStringList dynamicVarNames(QtSupport::ProFileReader *readerExact, QtSupport::ProFileReader *readerCumulative); - static QSet<QString> filterFiles(ProjectExplorer::FileType fileType, const QSet<QString> &files); + static QSet<QString> filterFilesProVariables(ProjectExplorer::FileType fileType, const QSet<QString> &files); + static QSet<QString> filterFilesRecursiveEnumerata(ProjectExplorer::FileType fileType, const QSet<QString> &files); enum ChangeType { AddToProFile, diff --git a/src/plugins/qtestlib/qtestlibplugin.cpp b/src/plugins/qtestlib/qtestlibplugin.cpp index 91d443e7f2..972ec25f7f 100644 --- a/src/plugins/qtestlib/qtestlibplugin.cpp +++ b/src/plugins/qtestlib/qtestlibplugin.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qtestlib/qtestlibplugin.h b/src/plugins/qtestlib/qtestlibplugin.h index 7e89b4c0dd..612b99e8aa 100644 --- a/src/plugins/qtestlib/qtestlibplugin.h +++ b/src/plugins/qtestlib/qtestlibplugin.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp index c1700dc4f4..03a84f504b 100644 --- a/src/plugins/qtsupport/exampleslistmodel.cpp +++ b/src/plugins/qtsupport/exampleslistmodel.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "exampleslistmodel.h" #include <QtCore/QFile> @@ -7,6 +39,7 @@ #include <QDebug> #include <coreplugin/icore.h> +#include <coreplugin/helpmanager.h> #include <qtsupport/qtversionmanager.h> #include <algorithm> @@ -35,7 +68,9 @@ ExamplesListModel::ExamplesListModel(QObject *parent) : setRoleNames(roleNames); connect(QtVersionManager::instance(), SIGNAL(updateExamples(QString,QString,QString)), - SLOT(readNewsItems(QString,QString,QString))); + SLOT(cacheExamplesPath(QString,QString,QString))); + connect(Core::HelpManager::instance(), SIGNAL(setupFinished()), + SLOT(helpInitialized())); } QList<ExampleItem> ExamplesListModel::parseExamples(QXmlStreamReader* reader, const QString& projectsOffset) @@ -230,7 +265,7 @@ QStringList ExamplesListModel::exampleSources() const // Try Creator-provided XML file only if (sources.isEmpty()) { - qDebug() << Q_FUNC_INFO << "falling through to Creator-provided XML file"; + // qDebug() << Q_FUNC_INFO << "falling through to Creator-provided XML file"; sources << QString(resourceDir + QLatin1String("/examples_fallback.xml")); } @@ -305,6 +340,20 @@ QVariant ExamplesListModel::data(const QModelIndex &index, int role) const } +void ExamplesListModel::cacheExamplesPath(const QString &examplesPath, const QString &demosPath, const QString &sourcePath) +{ + m_cache = QMakePathCache(examplesPath, demosPath, sourcePath); +} + +void ExamplesListModel::helpInitialized() +{ + disconnect(this, SLOT(cacheExamplesPath(QString, QString, QString))); + connect(QtVersionManager::instance(), SIGNAL(updateExamples(QString,QString,QString)), + SLOT(readNewsItems(QString,QString,QString))); + readNewsItems(m_cache.examplesPath, m_cache.demosPath, m_cache.examplesPath); +} + + ExamplesListModelFilter::ExamplesListModelFilter(QObject *parent) : QSortFilterProxyModel(parent), m_showTutorialsOnly(true) { diff --git a/src/plugins/qtsupport/exampleslistmodel.h b/src/plugins/qtsupport/exampleslistmodel.h index 97811764b3..fc36970f0b 100644 --- a/src/plugins/qtsupport/exampleslistmodel.h +++ b/src/plugins/qtsupport/exampleslistmodel.h @@ -1,15 +1,43 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #ifndef EXAMPLESLISTMODEL_H #define EXAMPLESLISTMODEL_H #include <QAbstractListModel> #include <QStringList> +#include <QtCore/QXmlStreamReader> #include <QtGui/QSortFilterProxyModel> - -QT_BEGIN_NAMESPACE -class QXmlStreamReader; -QT_END_NAMESPACE - namespace QtSupport { namespace Internal { @@ -32,6 +60,15 @@ struct ExampleItem { bool hasSourceCode; }; +struct QMakePathCache { + QString examplesPath; + QString demosPath; + QString sourcePath; + QMakePathCache() {} + QMakePathCache(const QString &_examplesPath, const QString &_demosPath, const QString &_sourcePath) + : examplesPath(_examplesPath), demosPath(_demosPath), sourcePath(_sourcePath) {} +}; + class ExamplesListModel : public QAbstractListModel { Q_OBJECT public: @@ -43,12 +80,15 @@ public: QStringList tags() const { return m_tags; } -public slots: - void readNewsItems(const QString &examplesPath, const QString &demosPath, const QString &sourcePath); signals: void tagsUpdated(); +public slots: + void readNewsItems(const QString &examplesPath, const QString &demosPath, const QString &sourcePath); + void cacheExamplesPath(const QString &examplesPath, const QString &demosPath, const QString &sourcePath); + void helpInitialized(); + private: QList<ExampleItem> parseExamples(QXmlStreamReader* reader, const QString& projectsOffset); QList<ExampleItem> parseDemos(QXmlStreamReader* reader, const QString& projectsOffset); @@ -57,6 +97,8 @@ private: QStringList exampleSources() const; QList<ExampleItem> exampleItems; QStringList m_tags; + QMakePathCache m_cache; + }; class ExamplesListModelFilter : public QSortFilterProxyModel { diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.h b/src/plugins/qtsupport/gettingstartedwelcomepage.h index 1c421d024a..b67d62c5c9 100644 --- a/src/plugins/qtsupport/gettingstartedwelcomepage.h +++ b/src/plugins/qtsupport/gettingstartedwelcomepage.h @@ -56,7 +56,7 @@ class GettingStartedWelcomePage : public Utils::IWelcomePage public: GettingStartedWelcomePage(); - QString pageLocation() const { return Core::ICore::instance()->resourcePath() + QLatin1String("/welcomescreen/gettingstarted.qml"); } + QUrl pageLocation() const { return QUrl::fromLocalFile(Core::ICore::instance()->resourcePath() + QLatin1String("/welcomescreen/gettingstarted.qml")); } QString title() const { return tr("Getting Started");} int priority() const { return 10; } void facilitateQml(QDeclarativeEngine *); @@ -68,8 +68,6 @@ signals: public slots: void openSplitHelp(const QUrl &help); void openProject(const QString& projectFile, const QStringList& additionalFilesToOpen, const QUrl& help); - -public slots: void updateTagsModel(); private: diff --git a/src/plugins/qtsupport/gettingstartedwelcomepagewidget.cpp b/src/plugins/qtsupport/gettingstartedwelcomepagewidget.cpp deleted file mode 100644 index 1458c4ec50..0000000000 --- a/src/plugins/qtsupport/gettingstartedwelcomepagewidget.cpp +++ /dev/null @@ -1,591 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#include "gettingstartedwelcomepagewidget.h" -#include "ui_gettingstartedwelcomepagewidget.h" - -#include <coreplugin/icore.h> -#include <coreplugin/helpmanager.h> -#include <coreplugin/coreconstants.h> -#include <coreplugin/editormanager/editormanager.h> -#include <coreplugin/rssfetcher.h> -#include <coreplugin/dialogs/iwizard.h> -#include <projectexplorer/projectexplorer.h> - -#include <utils/pathchooser.h> -#include <utils/qtcassert.h> - -#include <extensionsystem/pluginmanager.h> - -#include <QtCore/QDateTime> -#include <QtCore/QDir> -#include <QtCore/QFileInfo> -#include <QtCore/QDebug> -#include <QtCore/QStringBuilder> -#include <QtCore/QUrl> -#include <QtCore/QTimer> -#include <QtCore/QSettings> -#include <QtCore/QXmlStreamReader> -#include <QtCore/QScopedPointer> -#include <QtGui/QDialogButtonBox> -#include <QtGui/QFont> -#include <QtGui/QMessageBox> -#include <QtGui/QPushButton> -#include <QtGui/QMenu> -#include <QtGui/QDesktopServices> - -namespace Qt4ProjectManager { -namespace Internal { - -const char ExamplePathPropertyName[] = "__qt_ExamplePath"; -const char HelpPathPropertyName[] = "__qt_HelpPath"; -const char QmlMainFileName[] = "__qt_QmlMainFileName"; - -void PixmapDownloader::populatePixmap(QNetworkReply *reply) { - QImage image; - image.loadFromData(reply->readAll()); - m_label->setScaledContents(false); - m_label->setPixmap(QPixmap::fromImage(image)); - deleteLater(); -} - -GettingStartedWelcomePageWidget::GettingStartedWelcomePageWidget(QWidget *parent) : - QWidget(parent), ui(new Ui::GettingStartedWelcomePageWidget), - m_currentFeature(0), m_rssFetcher(0) -{ - ui->setupUi(this); - - ui->didYouKnowTextBrowser->viewport()->setAutoFillBackground(false); - ui->detailsLabel->hide(); - - connect(ui->tutorialTreeWidget, SIGNAL(activated(QString)), SLOT(slotOpenHelpPage(const QString&))); - - QFontMetrics fm = fontMetrics(); - const int margins = 30; - int width = ui->tutorialTreeWidget->minimumWidth() - margins; - - QString itemText = tr("The Qt Creator User Interface"); - QString url = QLatin1String("qthelp://com.nokia.qtcreator/doc/creator-quick-tour.html"); - ui->tutorialTreeWidget->addItem(fm.elidedText(itemText, Qt::ElideRight, width), url, itemText); - - itemText = tr("Building and Running an Example"); - url = QLatin1String("qthelp://com.nokia.qtcreator/doc/creator-build-example-application.html?view=split"); - ui->tutorialTreeWidget->addItem(fm.elidedText(itemText, Qt::ElideRight, width), url, itemText); - - itemText = tr("Creating a Qt C++ Application"); - url = QLatin1String("qthelp://com.nokia.qtcreator/doc/creator-writing-program.html?view=split"); - ui->tutorialTreeWidget->addItem(fm.elidedText(itemText, Qt::ElideRight, width), url, itemText); - - itemText = tr("Creating a Mobile Application"); - url = QLatin1String("qthelp://com.nokia.qtcreator/doc/creator-mobile-example.html?view=split"); - ui->tutorialTreeWidget->addItem(fm.elidedText(itemText, Qt::ElideRight, width), url, itemText); - - itemText = tr("Creating a Qt Quick Application"); - url = QLatin1String("qthelp://com.nokia.qtcreator/doc/creator-qml-application.html?view=split"); - ui->tutorialTreeWidget->addItem(fm.elidedText(itemText, Qt::ElideRight, width), url, itemText); - - srand(QDateTime::currentDateTime().toTime_t()); - QStringList tips = tipsOfTheDay(); - m_currentTip = rand()%tips.count(); - - QTextDocument *doc = ui->didYouKnowTextBrowser->document(); - doc->setDefaultStyleSheet("* {color:black;};"); - ui->didYouKnowTextBrowser->setDocument(doc); - ui->didYouKnowTextBrowser->setText(tips.at(m_currentTip)); - - connect(ui->nextTipBtn, SIGNAL(clicked()), this, SLOT(slotNextTip())); - connect(ui->prevTipBtn, SIGNAL(clicked()), this, SLOT(slotPrevTip())); - connect(ui->openProjectButton, SIGNAL(clicked()), - ProjectExplorer::ProjectExplorerPlugin::instance(), - SLOT(openOpenProjectDialog())); - connect(ui->createNewProjectButton, SIGNAL(clicked()), this, SLOT(slotCreateNewProject())); - - ui->createNewProjectButton->setIcon( - QIcon::fromTheme(QLatin1String("document-new"), ui->createNewProjectButton->icon())); - ui->openProjectButton->setIcon( - QIcon::fromTheme(QLatin1String("document-open"), ui->openProjectButton->icon())); - - m_rssFetcher = new Core::RssFetcher; - connect (m_rssFetcher, SIGNAL(rssItemReady(Core::RssItem)), SLOT(addToFeatures(Core::RssItem))); - connect (m_rssFetcher, SIGNAL(finished(bool)), SLOT(showFeature()), Qt::QueuedConnection); - connect(this, SIGNAL(startRssFetching(QUrl)), m_rssFetcher, SLOT(fetch(QUrl)), Qt::QueuedConnection); - m_rssFetcher->start(QThread::LowestPriority); - const QString featureRssFile = Core::ICore::instance()->resourcePath()+QLatin1String("/rss/featured.rss"); - emit startRssFetching(QUrl::fromLocalFile(featureRssFile)); - - ui->nextFeatureBtn->hide(); - ui->prevFeatureBtn->hide(); - connect(ui->nextFeatureBtn, SIGNAL(clicked()), this, SLOT(slotNextFeature())); - connect(ui->prevFeatureBtn, SIGNAL(clicked()), this, SLOT(slotPrevFeature())); -} - -GettingStartedWelcomePageWidget::~GettingStartedWelcomePageWidget() -{ - m_rssFetcher->exit(); - m_rssFetcher->wait(); - delete m_rssFetcher; - delete ui; -} - -void GettingStartedWelcomePageWidget::parseXmlFile(QFile *file, QMenuHash &cppSubMenuHash, QMenuHash &qmlSubMenuHash, - const QString &examplePath, const QString &sourcePath) -{ - QMenu *cppSubMenu = 0; - QMenu *qmlSubMenu = 0; - bool inExamples = false; - QString dirName; - - QXmlStreamReader reader(file); - - while (!reader.atEnd()) { - switch (reader.readNext()) { - case QXmlStreamReader::StartElement: - if (reader.name() == QLatin1String("category")) { - QString name = reader.attributes().value(QLatin1String("name")).toString(); - if (name.contains(QLatin1String("Tutorial"))) - break; - dirName = reader.attributes().value(QLatin1String("dirname")).toString(); - if (!cppSubMenuHash.contains(dirName)) { - cppSubMenu = new QMenu(name, this); - cppSubMenu->setObjectName(dirName); - cppSubMenuHash.insert(dirName, cppSubMenu); - } else { - cppSubMenu = cppSubMenuHash.value(dirName); - } - if (!qmlSubMenuHash.contains(dirName)) { - qmlSubMenu = new QMenu(name, this); - qmlSubMenu->setObjectName(dirName); - qmlSubMenuHash.insert(dirName, qmlSubMenu); - } else { - qmlSubMenu = qmlSubMenuHash.value(dirName); - } - inExamples = true; - } - if (inExamples && reader.name() == QLatin1String("example")) { - const QChar slash = QLatin1Char('/'); - const QString name = reader.attributes().value(QLatin1String("name")).toString(); - const bool isQml = reader.attributes().value(QLatin1String("qml")).toString() == "true"; - const QString localDir = reader.attributes().value(QLatin1String("filename")).toString(); - const QString fileName = localDir.section('/', -1); - QString replacedFileName = fileName; - replacedFileName.replace(QLatin1Char('-'), QString()); - QString relativeProPath = slash + dirName + slash + localDir + slash + replacedFileName; - - QString finalFileName = examplePath + relativeProPath + QLatin1String(".pro"); - - if (!QFile::exists(finalFileName)) - finalFileName = sourcePath + QLatin1String("/examples") + relativeProPath + QLatin1String(".pro"); - - if (isQml && !QFile::exists(finalFileName)) { - // maybe it's an old-style QML project? - relativeProPath = slash + dirName + slash + localDir + slash + fileName; - finalFileName = examplePath + relativeProPath + QLatin1String(".qmlproject"); - - if (!QFile::exists(finalFileName)) - finalFileName = sourcePath + QLatin1String("/examples") + relativeProPath + QLatin1String(".qmlproject");; - } - - if (!QFile::exists(finalFileName)) - break; - - QString dirNameforHelp = dirName; - dirNameforHelp.replace(slash, QLatin1Char('-')); - QString helpPath = QLatin1String("qthelp://com.trolltech.qt/qdoc/") + - dirNameforHelp + - QLatin1Char('-') + fileName + QLatin1String(".html"); - - QAction *exampleAction = 0; - QAction *beforeAction = 0; - bool duplicate = false; - QMenu *subMenu; - subMenu = isQml ? qmlSubMenu : cppSubMenu; - - foreach (beforeAction, subMenu->actions()) { - int res = beforeAction->text().compare(name, Qt::CaseInsensitive); - if (res==0) { - duplicate = true; - break; - } else if (res<0) - beforeAction = 0; - else if (res>0) { - break; - } - } - - if (!duplicate) { - exampleAction = new QAction(name, subMenu); - subMenu->insertAction(beforeAction, exampleAction); - connect(exampleAction, SIGNAL(triggered()), SLOT(slotOpenExample())); - exampleAction->setProperty(ExamplePathPropertyName, finalFileName); - exampleAction->setProperty(HelpPathPropertyName, helpPath); - if (isQml) - exampleAction->setProperty(QmlMainFileName, fileName); - } - } - break; - case QXmlStreamReader::EndElement: - if (inExamples && reader.name() == QLatin1String("category")) { - if (cppSubMenu->actions().isEmpty()) - delete cppSubMenuHash.take(dirName); - - if (qmlSubMenu->actions().isEmpty()) - delete qmlSubMenuHash.take(dirName); - - inExamples = false; - } - break; - default: - break; - } - } -} - -bool menuEntryCompare(QMenu* first, QMenu* second) -{ - return (QString::localeAwareCompare(first->title(), second->title()) < 0); -} - -void GettingStartedWelcomePageWidget::updateExamples(const QString &examplePath, - const QString &demosPath, - const QString &sourcePath) -{ - - QString demoXml = demosPath + "/qtdemo/xml/examples.xml"; - if (!QFile::exists(demoXml)) { - demoXml = sourcePath + "/demos/qtdemo/xml/examples.xml"; - if (!QFile::exists(demoXml)) - return; - } - - QMenuHash cppSubMenuHash; - QMenuHash qmlSubMenuHash; - - const QString dropDownLabel = tr("Choose an Example..."); - QMenu *cppMenu = new QMenu(ui->cppExamplesButton); - ui->cppExamplesButton->setMenu(cppMenu); - QMenu *qmlMenu = new QMenu(ui->qmlExamplesButton); - - - // let Creator's files take precedence - QString localQmlExamplesXml = - Core::ICore::instance()->resourcePath()+QLatin1String("/examplebrowser/qmlexamples.xml"); - - QFile localDescriptions(localQmlExamplesXml); - if (localDescriptions.open(QFile::ReadOnly)) { - parseXmlFile(&localDescriptions, cppSubMenuHash, qmlSubMenuHash, examplePath, sourcePath); - } - - QFile descriptions(demoXml); - if (!descriptions.open(QFile::ReadOnly)) - return; - - ui->cppExamplesButton->setEnabled(true); - ui->cppExamplesButton->setText(dropDownLabel); - - parseXmlFile(&descriptions, cppSubMenuHash, qmlSubMenuHash, examplePath, sourcePath); - - QList<QMenu*> cppSubMenus = cppSubMenuHash.values(); - qSort(cppSubMenus.begin(), cppSubMenus.end(), menuEntryCompare); - QList<QMenu*> qmlSubMenus = qmlSubMenuHash.values(); - qSort(qmlSubMenus.begin(), qmlSubMenus.end(), menuEntryCompare); - - foreach (QMenu *menu, cppSubMenus) - cppMenu->addMenu(menu); - foreach (QMenu *menu, qmlSubMenus) - qmlMenu->addMenu(menu); - - if (!qmlMenu->isEmpty()) { - ui->qmlExamplesButton->setMenu(qmlMenu); - ui->qmlExamplesButton->setEnabled(true); - ui->qmlExamplesButton->setText(dropDownLabel); - } -} - -namespace { -void copyRecursive(const QDir& from, const QDir& to, const QString& dir) -{ - QDir dest(to); - dest.mkdir(dir); - dest.cd(dir); - QDir src(from); - src.cd(dir); - foreach(const QFileInfo& roFile, src.entryInfoList(QDir::Files)) { - QFile::copy(roFile.absoluteFilePath(), dest.absolutePath() + '/' + roFile.fileName()); - } - foreach(const QString& roDir, src.entryList(QDir::NoDotAndDotDot|QDir::Dirs)) { - copyRecursive(src, dest, QDir(roDir).dirName()); - } -} -} // namespace - -void GettingStartedWelcomePageWidget::slotOpenExample() -{ - QAction *action = qobject_cast<QAction*>(sender()); - if (!action) - return; - - QString helpFile = action->property(HelpPathPropertyName).toString(); - QString proFile = action->property(ExamplePathPropertyName).toString(); - QString qmlMainFileName; - bool isQmlProject = false; - if (action->dynamicPropertyNames().contains(QmlMainFileName)) { - qmlMainFileName = action->property(QmlMainFileName).toString(); - isQmlProject = true; - } - QStringList files; - - QFileInfo proFileInfo(proFile); - // If the Qt is a distro Qt on Linux, it will not be writable, hence compilation will fail - if (!proFileInfo.isWritable()) - { - QDialog d; - QGridLayout *lay = new QGridLayout(&d); - QLabel *descrLbl = new QLabel; - d.setWindowTitle(tr("Copy Project to writable Location?")); - descrLbl->setTextFormat(Qt::RichText); - descrLbl->setWordWrap(true); - descrLbl->setText(tr("<p>The project you are about to open is located in the " - "write-protected location:</p><blockquote>%1</blockquote>" - "<p>Please select a writable location below and click \"Copy Project and Open\" " - "to open a modifiable copy of the project or click \"Keep Project and Open\" " - "to open the project in location.</p><p><b>Note:</b> You will not " - "be able to alter or compile your project in the current location.</p>") - .arg(QDir::toNativeSeparators(proFileInfo.dir().absolutePath()))); - lay->addWidget(descrLbl, 0, 0, 1, 2); - QLabel *txt = new QLabel(tr("&Location:")); - Utils::PathChooser *chooser = new Utils::PathChooser; - txt->setBuddy(chooser); - chooser->setExpectedKind(Utils::PathChooser::ExistingDirectory); - QSettings *settings = Core::ICore::instance()->settings(); - chooser->setPath(settings->value( - QString::fromLatin1("General/ProjectsFallbackRoot"), QDir::homePath()).toString()); - lay->addWidget(txt, 1, 0); - lay->addWidget(chooser, 1, 1); - QDialogButtonBox *bb = new QDialogButtonBox; - connect(bb, SIGNAL(accepted()), &d, SLOT(accept())); - connect(bb, SIGNAL(rejected()), &d, SLOT(reject())); - QPushButton *copyBtn = bb->addButton(tr("&Copy Project and Open"), QDialogButtonBox::AcceptRole); - copyBtn->setDefault(true); - bb->addButton(tr("&Keep Project and Open"), QDialogButtonBox::RejectRole); - lay->addWidget(bb, 2, 0, 1, 2); - connect(chooser, SIGNAL(validChanged(bool)), copyBtn, SLOT(setEnabled(bool))); - if (d.exec() == QDialog::Accepted) { - QString exampleDirName = proFileInfo.dir().dirName(); - QString toDir = chooser->path(); - settings->setValue(QString::fromLatin1("General/ProjectsFallbackRoot"), toDir); - QDir toDirWithExamplesDir(toDir); - if (toDirWithExamplesDir.cd(exampleDirName)) { - toDirWithExamplesDir.cdUp(); // step out, just to not be in the way - QMessageBox::warning(topLevelWidget(), tr("Warning"), - tr("The specified location already exists. " - "Please specify a valid location."), - QMessageBox::Ok, QMessageBox::NoButton); - return; - } else { - QDir from = proFileInfo.dir(); - from.cdUp(); - copyRecursive(from, toDir, exampleDirName); - // set vars to new location - proFileInfo = QFileInfo(toDir + '/'+ exampleDirName + '/' + proFileInfo.fileName()); - proFile = proFileInfo.absoluteFilePath(); - } - } - } - - QString tryFile; - if (isQmlProject) { - tryFile = proFileInfo.path() + '/' + "/main.qml"; - if(!QFile::exists(tryFile)) - tryFile = proFileInfo.path() + "/qml/" + qmlMainFileName + ".qml"; - // legacy qmlproject case - if(!QFile::exists(tryFile)) - tryFile = proFileInfo.path() + '/' + qmlMainFileName + ".qml"; - if(QFile::exists(tryFile)) - files << tryFile; - } else { - tryFile = proFileInfo.path() + "/main.cpp"; - if(!QFile::exists(tryFile)) - tryFile = proFileInfo.path() + '/' + proFileInfo.baseName() + ".cpp"; - files << tryFile; - } - if (ProjectExplorer::ProjectExplorerPlugin::instance()->openProject(proFile)) { - Core::ICore::instance()->openFiles(files); - if (!helpFile.isEmpty()) { - // queue this to make sure it gets executed after the editor widget - // has been drawn, so we know whether to show a split help or not - QMetaObject::invokeMethod(this, "slotOpenContextHelpPage", - Qt::QueuedConnection, Q_ARG(QString, helpFile)); - } - } -} - -void GettingStartedWelcomePageWidget::slotOpenHelpPage(const QString& url) -{ - Core::HelpManager *helpManager = Core::HelpManager::instance(); - Q_ASSERT(helpManager); - helpManager->handleHelpRequest(url); -} -void GettingStartedWelcomePageWidget::slotOpenContextHelpPage(const QString& url) -{ - Core::HelpManager *helpManager = Core::HelpManager::instance(); - Q_ASSERT(helpManager); - helpManager->handleHelpRequest(url % QLatin1String("?view=split")); -} - -void GettingStartedWelcomePageWidget::slotCreateNewProject() -{ - Core::ICore::instance()->showNewItemDialog(tr("New Project"), - Core::IWizard::wizardsOfKind(Core::IWizard::ProjectWizard)); -} - -void GettingStartedWelcomePageWidget::slotNextTip() -{ - QStringList tips = tipsOfTheDay(); - m_currentTip = ((m_currentTip+1)%tips.count()); - ui->didYouKnowTextBrowser->setText(tips.at(m_currentTip)); -} - -void GettingStartedWelcomePageWidget::slotPrevTip() -{ - QStringList tips = tipsOfTheDay(); - m_currentTip = ((m_currentTip-1)+tips.count())%tips.count(); - ui->didYouKnowTextBrowser->setText(tips.at(m_currentTip)); -} - -QStringList GettingStartedWelcomePageWidget::tipsOfTheDay() -{ - static QStringList tips; - if (tips.isEmpty()) { - QString altShortcut = -#ifdef Q_WS_MAC - tr("Cmd", "Shortcut key"); -#else - tr("Alt", "Shortcut key"); -#endif - - QString ctrlShortcut = -#ifdef Q_WS_MAC - tr("Cmd", "Shortcut key"); -#else - tr("Ctrl", "Shortcut key"); -#endif - - //:%1 gets replaced by Alt (Win/Unix) or Cmd (Mac) - tips.append(tr("You can show and hide the side bar using <tt>%1+0<tt>.").arg(altShortcut)); - tips.append(tr("You can fine tune the <tt>Find</tt> function by selecting "Whole Words" " - "or "Case Sensitive". Simply click on the icons on the right end of the line edit.")); - tips.append(tr("If you add external libraries to your project, Qt Creator will automatically offer syntax highlighting " - "and code completion.")); - tips.append(tr("The code completion is CamelCase-aware. For example, to complete <tt>namespaceUri</tt> " - "you can just type <tt>nU</tt> and hit <tt>Ctrl+Space</tt>.")); - tips.append(tr("You can force code completion at any time using <tt>Ctrl+Space</tt>.")); - tips.append(tr("You can start Qt Creator with a session by calling <tt>qtcreator <sessionname></tt>.")); - tips.append(tr("You can return to edit mode from any other mode at any time by hitting <tt>Escape</tt>.")); - //:%1 gets replaced by Alt (Win/Unix) or Cmd (Mac) - tips.append(tr("You can switch between the output pane by hitting <tt>%1+n</tt> where n is the number denoted " - "on the buttons at the window bottom: <br /><br />" - "1: Build Issues, 2: Search Results, 3: Application Output, " - "4: Compile Output").arg(altShortcut)); - tips.append(tr("You can quickly search methods, classes, help and more using the " - "<a href=\"qthelp://com.nokia.qtcreator/doc/creator-editor-locator.html\">Locator bar</a> (<tt>%1+K</tt>).").arg(ctrlShortcut)); - tips.append(tr("You can add custom build steps in the " - "<a href=\"qthelp://com.nokia.qtcreator/doc/creator-build-settings.html\">build settings</a>.")); - tips.append(tr("Within a session, you can add " - "<a href=\"qthelp://com.nokia.qtcreator/doc/creator-build-dependencies.html\">dependencies</a> between projects.")); - tips.append(tr("You can set the preferred editor encoding for every project in <tt>Projects -> Editor Settings -> Default Encoding</tt>.")); - tips.append(tr("You can use Qt Creator with a number of <a href=\"qthelp://com.nokia.qtcreator/doc/creator-version-control.html\">" - "revision control systems</a> such as Subversion, Perforce, CVS and Git.")); - tips.append(tr("In the editor, <tt>F2</tt> follows symbol definition, <tt>Shift+F2</tt> toggles declaration and definition " - "while <tt>F4</tt> toggles header file and source file.")); - } - return tips; -} - -void GettingStartedWelcomePageWidget::addToFeatures(const Core::RssItem &feature) -{ - m_featuredItems.append(feature); - if (m_featuredItems.count() > 1) { - ui->nextFeatureBtn->show(); - ui->prevFeatureBtn->show(); - } -} - -void GettingStartedWelcomePageWidget::showFeature(int feature) -{ - if (m_featuredItems.isEmpty()) - return; - - if (feature == -1) { - srand(QDateTime::currentDateTime().toTime_t()); - m_currentFeature = rand()%m_featuredItems.count(); - } - - const Core::RssItem &item = m_featuredItems.at(m_currentFeature); - ui->featuredTextLabel->setTextFormat(Qt::RichText); - QString text = QString::fromLatin1("<b style='color: rgb(85, 85, 85);'>%1</b><br><b>%2</b><br/><br/>%3").arg(item.category).arg(item.title).arg(item.description); - ui->featuredTextLabel->setText(text); - QString imagePath = item.imagePath; - if (!imagePath.startsWith("http")) { - imagePath = Core::ICore::instance()->resourcePath() + "/rss/" + item.imagePath; - ui->featuredImage->setPixmap(QPixmap(imagePath)); - } else { - new PixmapDownloader(QUrl(imagePath), ui->featuredImage); - } - - if (item.category == QLatin1String("Event")) { - ui->detailsLabel->setText(tr("<a href='%1'>Details...</a>").arg(item.url)); - ui->detailsLabel->show(); - ui->detailsLabel->setOpenExternalLinks(true); - } - else if (item.category == QLatin1String("Tutorial")) { - ui->detailsLabel->setText(tr("<a href='%1'>Take Tutorial</a>").arg(item.url+"?view=split")); - ui->detailsLabel->show(); - ui->detailsLabel->setOpenExternalLinks(true); - } -} - -void GettingStartedWelcomePageWidget::slotNextFeature() -{ - QTC_ASSERT(!m_featuredItems.isEmpty(), return); - m_currentFeature = (m_currentFeature+1) % m_featuredItems.count(); - showFeature(m_currentFeature); -} - -void GettingStartedWelcomePageWidget::slotPrevFeature() -{ - QTC_ASSERT(!m_featuredItems.isEmpty(), return); - m_currentFeature = ((m_currentFeature-1)+m_featuredItems.count()) % m_featuredItems.count(); - showFeature(m_currentFeature); -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qtsupport/gettingstartedwelcomepagewidget.h b/src/plugins/qtsupport/gettingstartedwelcomepagewidget.h deleted file mode 100644 index 1fe4e8277e..0000000000 --- a/src/plugins/qtsupport/gettingstartedwelcomepagewidget.h +++ /dev/null @@ -1,120 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef GETTINGSTARTEDWELCOMEPAGEWIDGET_H -#define GETTINGSTARTEDWELCOMEPAGEWIDGET_H - -#include <QtGui/QWidget> -#include <QtNetwork/QNetworkAccessManager> -#include <QtNetwork/QNetworkReply> - -QT_BEGIN_NAMESPACE -class QUrl; -class QLabel; -class QFile; -class QMenu; -QT_END_NAMESPACE - -namespace Core { -class RssFetcher; -class RssItem; -} - -namespace Qt4ProjectManager { -namespace Internal { - -namespace Ui { - class GettingStartedWelcomePageWidget; -} - -typedef QHash<QString, QMenu*> QMenuHash; - -class PixmapDownloader : public QNetworkAccessManager { - Q_OBJECT -public: - PixmapDownloader(const QUrl& url, QLabel* label, QObject *parent = 0) - : QNetworkAccessManager(parent), m_url(url), m_label(label) - { - connect(this, SIGNAL(finished(QNetworkReply*)), SLOT(populatePixmap(QNetworkReply*))); - get(QNetworkRequest(url)); - } -public slots: - void populatePixmap(QNetworkReply* reply); - -private: - QUrl m_url; - QLabel *m_label; - -}; - -class GettingStartedWelcomePageWidget : public QWidget -{ - Q_OBJECT -public: - GettingStartedWelcomePageWidget(QWidget *parent = 0); - ~GettingStartedWelcomePageWidget(); - -public slots: - void updateExamples(const QString &examplePath, - const QString &demosPath, - const QString &sourcePath); - -private slots: - void slotOpenHelpPage(const QString &url); - void slotOpenContextHelpPage(const QString &url); - void slotOpenExample(); - void slotNextTip(); - void slotPrevTip(); - void slotNextFeature(); - void slotPrevFeature(); - void slotCreateNewProject(); - void addToFeatures(const Core::RssItem&); - void showFeature(int feature = -1); - -signals: - void startRssFetching(const QUrl&); - -private: - void parseXmlFile(QFile *file, QMenuHash &cppSubMenuHash, QMenuHash &qmlSubMenuHash, - const QString &examplePath, const QString &sourcePath); - QStringList tipsOfTheDay(); - Ui::GettingStartedWelcomePageWidget *ui; - int m_currentTip; - int m_currentFeature; - QList<Core::RssItem> m_featuredItems; - Core::RssFetcher *m_rssFetcher; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // GETTINGSTARTEDWELCOMEPAGEWIDGET_H diff --git a/src/plugins/qtsupport/qtoptionspage.cpp b/src/plugins/qtsupport/qtoptionspage.cpp index 411d04675a..40febd9410 100644 --- a/src/plugins/qtsupport/qtoptionspage.cpp +++ b/src/plugins/qtsupport/qtoptionspage.cpp @@ -48,6 +48,7 @@ #include <utils/qtcassert.h> #include <utils/buildablehelperlibrary.h> #include <utils/pathchooser.h> +#include <projectexplorer/toolchainmanager.h> #include <qtconcurrent/runextensions.h> #include <QtCore/QDir> @@ -129,6 +130,7 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<BaseQtVersion *> , m_versionUi(new Internal::Ui::QtVersionInfo()) , m_debuggingHelperUi(new Internal::Ui::DebuggingHelper()) , m_invalidVersionIcon(":/projectexplorer/images/compile_error.png") + , m_warningVersionIcon(":/projectexplorer/images/compile_warning.png") , m_configurationWidget(0) { // Initialize m_versions @@ -169,7 +171,8 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<BaseQtVersion *> item->setText(0, version->displayName()); item->setText(1, QDir::toNativeSeparators(version->qmakeCommand())); item->setData(0, VersionIdRole, version->uniqueId()); - item->setIcon(0, version->isValid()? m_validVersionIcon : m_invalidVersionIcon); + const ValidityInfo info = validInformation(version); + item->setIcon(0, info.icon); } m_ui->qtdirList->expandAll(); @@ -207,6 +210,9 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<BaseQtVersion *> connect(QtVersionManager::instance(), SIGNAL(dumpUpdatedFor(QString)), this, SLOT(qtVersionsDumpUpdated(QString))); + + connect(ProjectExplorer::ToolChainManager::instance(), SIGNAL(toolChainsChanged()), + this, SLOT(toolChainsUpdated())); } bool QtOptionsPageWidget::eventFilter(QObject *o, QEvent *e) @@ -320,6 +326,19 @@ void QtOptionsPageWidget::cleanUpQtVersions() updateCleanUpButton(); } +void QtOptionsPageWidget::toolChainsUpdated() +{ + for (int i = 0; i < m_versions.count(); ++i) { + QTreeWidgetItem *item = treeItemForIndex(i); + if (item == m_ui->qtdirList->currentItem()) + updateDescriptionLabel(); + else { + const ValidityInfo info = validInformation(m_versions.at(i)); + item->setIcon(0, info.icon); + } + } +} + void QtOptionsPageWidget::qtVersionsDumpUpdated(const QString &qmakeCommand) { foreach (BaseQtVersion *version, m_versions) { @@ -334,6 +353,49 @@ void QtOptionsPageWidget::qtVersionsDumpUpdated(const QString &qmakeCommand) } } +QtOptionsPageWidget::ValidityInfo QtOptionsPageWidget::validInformation(const BaseQtVersion *version) +{ + ValidityInfo info; + info.icon = m_validVersionIcon; + + if (!version) + return info; + + if (!version->isValid()) { + info.icon = m_invalidVersionIcon; + info.message = version->invalidReason(); + return info; + } + + // Do we have tool chain issues? + QStringList missingToolChains; + int abiCount = 0; + foreach (const ProjectExplorer::Abi &a, version->qtAbis()) { + // Ignore symbian emulator since we do not support it. + if (a.osFlavor() == ProjectExplorer::Abi::SymbianEmulatorFlavor) + continue; + if (ProjectExplorer::ToolChainManager::instance()->findToolChains(a).isEmpty()) + missingToolChains.append(a.toString()); + ++abiCount; + } + + if (missingToolChains.isEmpty()) { + // No: + info.message = tr("Qt version %1 for %2").arg(version->qtVersionString(), version->description()); + } else if (missingToolChains.count() == abiCount) { + // Yes, this Qt version can't be used at all! + info.message = tr("No tool chain can produce code for this Qt version. Please define one or more tool chains."); + info.icon = m_invalidVersionIcon; + } else { + // Yes, some ABIs are unsupported + info.message = tr("Not all possible target environments can be supported due to missing tool chains."); + info.toolTip = tr("The following ABIs are currently not supported:<ul><li>%1</li></ul>") + .arg(missingToolChains.join(QLatin1String("</li><li>"))); + info.icon = m_warningVersionIcon; + } + return info; +} + void QtOptionsPageWidget::buildDebuggingHelper(DebuggingHelperBuildTask::Tools tools) { const int index = currentIndex(); @@ -725,17 +787,11 @@ void QtOptionsPageWidget::qtVersionChanged() void QtOptionsPageWidget::updateDescriptionLabel() { QTreeWidgetItem *item = m_ui->qtdirList->currentItem(); - const BaseQtVersion *version = currentVersion(); - if (!version) { - m_versionUi->errorLabel->setText(QString()); - } else if (version->isValid()) { - m_versionUi->errorLabel->setText( tr("Qt version %1 for %2").arg(version->qtVersionString(), - version->description())); - item->setIcon(0, m_validVersionIcon); - } else { - m_versionUi->errorLabel->setText(version->invalidReason()); - item->setIcon(0, m_invalidVersionIcon); - } + const ValidityInfo info = validInformation(currentVersion()); + m_versionUi->errorLabel->setText(info.message); + m_versionUi->errorLabel->setToolTip(info.toolTip); + if (item) + item->setIcon(0, info.icon); } int QtOptionsPageWidget::indexForTreeItem(const QTreeWidgetItem *item) const diff --git a/src/plugins/qtsupport/qtoptionspage.h b/src/plugins/qtsupport/qtoptionspage.h index df89b2c79c..64bc3ba08c 100644 --- a/src/plugins/qtsupport/qtoptionspage.h +++ b/src/plugins/qtsupport/qtoptionspage.h @@ -88,6 +88,7 @@ private: QList<BaseQtVersion *> m_versions; int m_defaultVersion; QIcon m_invalidVersionIcon; + QIcon m_warningVersionIcon; QIcon m_validVersionIcon; QtConfigWidget *m_configurationWidget; @@ -108,8 +109,17 @@ private slots: void slotShowDebuggingBuildLog(); void debuggingHelperBuildFinished(int qtVersionId, const QString &output, DebuggingHelperBuildTask::Tools tools); void cleanUpQtVersions(); + void toolChainsUpdated(); void qtVersionsDumpUpdated(const QString &qmakeCommand); + +private: + struct ValidityInfo { + QString message; + QString toolTip; + QIcon icon; + }; + ValidityInfo validInformation(const BaseQtVersion *version); }; class QtOptionsPage : public Core::IOptionsPage diff --git a/src/plugins/qtsupport/qtversioninfo.ui b/src/plugins/qtsupport/qtversioninfo.ui index 0e597e6782..9df6f277aa 100644 --- a/src/plugins/qtsupport/qtversioninfo.ui +++ b/src/plugins/qtsupport/qtversioninfo.ui @@ -55,7 +55,7 @@ </item> </layout> </item> - <item row="2" column="0"> + <item row="2" column="0" colspan="2"> <widget class="QLabel" name="errorLabel"> <property name="text"> <string/> diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp index 8195f8deda..a259363c17 100644 --- a/src/plugins/qtsupport/qtversionmanager.cpp +++ b/src/plugins/qtsupport/qtversionmanager.cpp @@ -131,7 +131,6 @@ void QtVersionManager::extensionsInitialized() // and add it to the qt versions findSystemQt(); } - updateDocumentation(); updateSettings(); saveQtVersions(); @@ -429,8 +428,7 @@ bool QtVersionManager::legacyRestore() } s->endArray(); - // TODO add removal of old settings - // s->remove(QtVersionsSectionName); + s->remove(QtVersionsSectionName); return true; } diff --git a/src/plugins/regexp/regexpplugin.cpp b/src/plugins/regexp/regexpplugin.cpp index f774121bd8..f027c92b0b 100644 --- a/src/plugins/regexp/regexpplugin.cpp +++ b/src/plugins/regexp/regexpplugin.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/regexp/regexpplugin.h b/src/plugins/regexp/regexpplugin.h index f508450960..6343dc923a 100644 --- a/src/plugins/regexp/regexpplugin.h +++ b/src/plugins/regexp/regexpplugin.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/regexp/regexpwindow.cpp b/src/plugins/regexp/regexpwindow.cpp index 7497409e09..fe9ff1f1c9 100644 --- a/src/plugins/regexp/regexpwindow.cpp +++ b/src/plugins/regexp/regexpwindow.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/regexp/regexpwindow.h b/src/plugins/regexp/regexpwindow.h index 75e2e7cf3d..9b09259443 100644 --- a/src/plugins/regexp/regexpwindow.h +++ b/src/plugins/regexp/regexpwindow.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/regexp/settings.cpp b/src/plugins/regexp/settings.cpp index 18c0820068..0a58010f0f 100644 --- a/src/plugins/regexp/settings.cpp +++ b/src/plugins/regexp/settings.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/regexp/settings.h b/src/plugins/regexp/settings.h index ba7b65fc4c..56e3543159 100644 --- a/src/plugins/regexp/settings.h +++ b/src/plugins/regexp/settings.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/plugins/remotelinux/abstractmaemodeploystep.cpp b/src/plugins/remotelinux/abstractmaemodeploystep.cpp index e305bdc719..3275550245 100644 --- a/src/plugins/remotelinux/abstractmaemodeploystep.cpp +++ b/src/plugins/remotelinux/abstractmaemodeploystep.cpp @@ -298,7 +298,8 @@ void AbstractMaemoDeployStep::connectToDevice() connect(m_connection.data(), SIGNAL(connected()), this, SLOT(handleConnected())); writeOutput(tr("Connecting to device...")); - m_connection->connectToHost(); + if (m_connection->state() == SshConnection::Unconnected) + m_connection->connectToHost(); } } diff --git a/src/plugins/remotelinux/maemodeployconfigurationwidget.cpp b/src/plugins/remotelinux/maemodeployconfigurationwidget.cpp index cf6b530bb1..796be2f874 100644 --- a/src/plugins/remotelinux/maemodeployconfigurationwidget.cpp +++ b/src/plugins/remotelinux/maemodeployconfigurationwidget.cpp @@ -78,6 +78,7 @@ void MaemoDeployConfigurationWidget::init(DeployConfiguration *dc) SLOT(handleSelectedDeviceConfigurationChanged(int))); connect(m_deployConfig, SIGNAL(deviceConfigurationListChanged()), SLOT(handleDeviceConfigurationListChanged())); + handleDeviceConfigurationListChanged(); ui->projectsComboBox->setModel(m_deployConfig->deploymentInfo().data()); connect(m_deployConfig->deploymentInfo().data(), SIGNAL(modelAboutToBeReset()), diff --git a/src/plugins/remotelinux/maemodeploystepfactory.cpp b/src/plugins/remotelinux/maemodeploystepfactory.cpp index a907660129..82b90fbe34 100644 --- a/src/plugins/remotelinux/maemodeploystepfactory.cpp +++ b/src/plugins/remotelinux/maemodeploystepfactory.cpp @@ -63,6 +63,9 @@ MaemoDeployStepFactory::MaemoDeployStepFactory(QObject *parent) QStringList MaemoDeployStepFactory::availableCreationIds(BuildStepList *parent) const { QStringList ids; + if (!qobject_cast<Qt4MaemoDeployConfiguration *>(parent->parent())) + return ids; + AbstractQt4MaemoTarget * const maemoTarget = qobject_cast<AbstractQt4MaemoTarget *>(parent->target()); if (maemoTarget) diff --git a/src/plugins/remotelinux/maemodeviceconfigwizard.cpp b/src/plugins/remotelinux/maemodeviceconfigwizard.cpp index 60a8605ea1..969515a75c 100644 --- a/src/plugins/remotelinux/maemodeviceconfigwizard.cpp +++ b/src/plugins/remotelinux/maemodeviceconfigwizard.cpp @@ -82,6 +82,7 @@ struct WizardData QString publicKeyFilePath; QString userName; QString password; + int sshPort; }; enum PageId { @@ -119,6 +120,9 @@ public: m_ui->hwButton->setChecked(true); handleDeviceTypeChanged(); m_ui->hostNameLineEdit->setText(defaultHost(deviceType())); + m_ui->sshPortSpinBox->setMinimum(1); + m_ui->sshPortSpinBox->setMaximum(65535); + m_ui->sshPortSpinBox->setValue(22); connect(m_ui->nameLineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(completeChanged())); connect(m_ui->hostNameLineEdit, SIGNAL(textChanged(QString)), this, @@ -150,12 +154,20 @@ public: ? LinuxDeviceConfiguration::Physical : LinuxDeviceConfiguration::Emulator; } + int sshPort() const + { + return deviceType() == LinuxDeviceConfiguration::Emulator + ? 6666 : m_ui->sshPortSpinBox->value(); + } + private slots: void handleDeviceTypeChanged() { const bool enable = deviceType() == LinuxDeviceConfiguration::Physical; m_ui->hostNameLabel->setEnabled(enable); m_ui->hostNameLineEdit->setEnabled(enable); + m_ui->sshPortLabel->setEnabled(enable); + m_ui->sshPortSpinBox->setEnabled(enable); } private: @@ -495,9 +507,9 @@ private: SshConnectionParameters sshParams(SshConnectionParameters::NoProxy); sshParams.authenticationType = SshConnectionParameters::AuthenticationByPassword; sshParams.host = hostAddress(); - sshParams.port = 22; + sshParams.port = m_wizardData.sshPort; sshParams.password = password(); - sshParams.timeout = 30; + sshParams.timeout = 10; sshParams.userName = defaultUser(m_wizardData.osType); m_ui->statusLabel->setText(tr("Deploying... ")); m_keyDeployer->deployPublicKey(sshParams, m_wizardData.publicKeyFilePath); @@ -609,18 +621,17 @@ LinuxDeviceConfiguration::Ptr MaemoDeviceConfigWizard::deviceConfiguration() Utils::SshConnectionParameters sshParams(Utils::SshConnectionParameters::NoProxy); sshParams.userName = defaultUser(d->wizardData.osType); sshParams.host = d->wizardData.hostName; + sshParams.port = d->wizardData.sshPort; if (d->wizardData.deviceType == LinuxDeviceConfiguration::Emulator) { sshParams.authenticationType = Utils::SshConnectionParameters::AuthenticationByPassword; sshParams.password = d->wizardData.osType == LinuxDeviceConfiguration::MeeGoOsType ? QLatin1String("meego") : QString(); - sshParams.port = 6666; sshParams.timeout = 30; freePortsSpec = QLatin1String("13219,14168"); doTest = false; } else { sshParams.authenticationType = Utils::SshConnectionParameters::AuthenticationByKey; sshParams.privateKeyFile = d->wizardData.privateKeyFilePath; - sshParams.port = 22; sshParams.timeout = 10; freePortsSpec = QLatin1String("10000-10100"); doTest = true; @@ -643,7 +654,7 @@ int MaemoDeviceConfigWizard::nextId() const d->wizardData.osType = d->startPage.osType(); d->wizardData.deviceType = d->startPage.deviceType(); d->wizardData.hostName = d->startPage.hostName(); - + d->wizardData.sshPort = d->startPage.sshPort(); if (d->wizardData.deviceType == LinuxDeviceConfiguration::Emulator) return FinalPageId; return PreviousKeySetupCheckPageId; diff --git a/src/plugins/remotelinux/maemodeviceconfigwizardstartpage.ui b/src/plugins/remotelinux/maemodeviceconfigwizardstartpage.ui index dc89ebe98f..062a89c4d1 100644 --- a/src/plugins/remotelinux/maemodeviceconfigwizardstartpage.ui +++ b/src/plugins/remotelinux/maemodeviceconfigwizardstartpage.ui @@ -6,17 +6,14 @@ <rect> <x>0</x> <y>0</y> - <width>727</width> - <height>136</height> + <width>721</width> + <height>176</height> </rect> </property> <property name="windowTitle"> <string>WizardPage</string> </property> <layout class="QFormLayout" name="formLayout"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> <item row="0" column="0"> <widget class="QLabel" name="nameLabel"> <property name="text"> @@ -102,6 +99,33 @@ <item row="3" column="1"> <widget class="QLineEdit" name="hostNameLineEdit"/> </item> + <item row="4" column="0"> + <widget class="QLabel" name="sshPortLabel"> + <property name="text"> + <string>The SSH port:</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QSpinBox" name="sshPortSpinBox"/> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> </layout> </widget> <resources/> diff --git a/src/plugins/remotelinux/maemoglobal.cpp b/src/plugins/remotelinux/maemoglobal.cpp index 6d22c179ee..e022aafd0d 100644 --- a/src/plugins/remotelinux/maemoglobal.cpp +++ b/src/plugins/remotelinux/maemoglobal.cpp @@ -286,93 +286,6 @@ QString MaemoGlobal::architecture(const QString &qmakePath) return arch; } -bool MaemoGlobal::removeRecursively(const QString &filePath, QString &error) -{ - error.clear(); - QFileInfo fileInfo(filePath); - if (!fileInfo.exists()) - return true; - QFile::setPermissions(filePath, fileInfo.permissions() | QFile::WriteUser); - if (fileInfo.isDir()) { - QDir dir(filePath); - QStringList fileNames = dir.entryList(QDir::Files | QDir::Hidden - | QDir::System | QDir::Dirs | QDir::NoDotAndDotDot); - foreach (const QString &fileName, fileNames) { - if (!removeRecursively(filePath + QLatin1Char('/') + fileName, error)) - return false; - } - dir.cdUp(); - if (!dir.rmdir(fileInfo.fileName())) { - error = tr("Failed to remove directory '%1'.") - .arg(QDir::toNativeSeparators(filePath)); - return false; - } - } else { - if (!QFile::remove(filePath)) { - error = tr("Failed to remove file '%1'.") - .arg(QDir::toNativeSeparators(filePath)); - return false; - } - } - return true; -} - -bool MaemoGlobal::copyRecursively(const QString &srcFilePath, - const QString &tgtFilePath, QString *error) -{ - QFileInfo srcFileInfo(srcFilePath); - if (srcFileInfo.isDir()) { - QDir targetDir(tgtFilePath); - targetDir.cdUp(); - if (!targetDir.mkdir(QFileInfo(tgtFilePath).fileName())) { - if (error) { - *error = tr("Failed to create directory '%1'.") - .arg(QDir::toNativeSeparators(tgtFilePath)); - return false; - } - } - QDir sourceDir(srcFilePath); - QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot); - foreach (const QString &fileName, fileNames) { - const QString newSrcFilePath - = srcFilePath + QLatin1Char('/') + fileName; - const QString newTgtFilePath - = tgtFilePath + QLatin1Char('/') + fileName; - if (!copyRecursively(newSrcFilePath, newTgtFilePath)) - return false; - } - } else { - if (!QFile::copy(srcFilePath, tgtFilePath)) { - if (error) { - *error = tr("Could not copy file '%1' to '%2'.") - .arg(QDir::toNativeSeparators(srcFilePath), - QDir::toNativeSeparators(tgtFilePath)); - } - return false; - } - } - return true; -} - -bool MaemoGlobal::isFileNewerThan(const QString &filePath, - const QDateTime &timeStamp) -{ - QFileInfo fileInfo(filePath); - if (!fileInfo.exists() || fileInfo.lastModified() >= timeStamp) - return true; - if (fileInfo.isDir()) { - const QStringList dirContents = QDir(filePath) - .entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot); - foreach (const QString &curFileName, dirContents) { - const QString curFilePath - = filePath + QLatin1Char('/') + curFileName; - if (isFileNewerThan(curFilePath, timeStamp)) - return true; - } - } - return false; -} - void MaemoGlobal::addMaddeEnvironment(Utils::Environment &env, const QString &qmakePath) { Utils::Environment maddeEnv; diff --git a/src/plugins/remotelinux/maemoglobal.h b/src/plugins/remotelinux/maemoglobal.h index c185acce5d..f9751c6505 100644 --- a/src/plugins/remotelinux/maemoglobal.h +++ b/src/plugins/remotelinux/maemoglobal.h @@ -137,13 +137,6 @@ public: static PackagingSystem packagingSystem(const QString &osType); - static bool removeRecursively(const QString &filePath, QString &error); - static bool copyRecursively(const QString &srcFilePath, - const QString &tgtFilePath, QString *error = 0); - - static bool isFileNewerThan(const QString &filePath, - const QDateTime &timeStamp); - template<class T> static T *earlierBuildStep(const ProjectExplorer::DeployConfiguration *dc, const ProjectExplorer::BuildStep *laterBuildStep) { diff --git a/src/plugins/remotelinux/maemoinstalltosysrootstep.cpp b/src/plugins/remotelinux/maemoinstalltosysrootstep.cpp index c4111de49d..ed10d87c9a 100644 --- a/src/plugins/remotelinux/maemoinstalltosysrootstep.cpp +++ b/src/plugins/remotelinux/maemoinstalltosysrootstep.cpp @@ -38,6 +38,8 @@ #include "maemoqtversion.h" #include "qt4maemodeployconfiguration.h" +#include <utils/fileutils.h> + #include <qt4projectmanager/qt4buildconfiguration.h> #include <qt4projectmanager/qt4target.h> #include <qtsupport/baseqtversion.h> @@ -323,8 +325,8 @@ void MaemoCopyToSysrootStep::run(QFutureInterface<bool> &fi) + deployable.remoteDir + sep + localFileInfo.fileName(); sysrootDir.mkpath(deployable.remoteDir.mid(1)); QString errorMsg; - MaemoGlobal::removeRecursively(targetFilePath, errorMsg); - if (!MaemoGlobal::copyRecursively(deployable.localFilePath, + Utils::FileUtils::removeRecursively(targetFilePath, &errorMsg); + if (!Utils::FileUtils::copyRecursively(deployable.localFilePath, targetFilePath, &errorMsg)) { emit addOutput(tr("Sysroot installation failed: %1\n" " Continuing anyway.").arg(errorMsg), ErrorMessageOutput); diff --git a/src/plugins/remotelinux/maemopackagecreationfactory.cpp b/src/plugins/remotelinux/maemopackagecreationfactory.cpp index bab364abe6..cccb44521c 100644 --- a/src/plugins/remotelinux/maemopackagecreationfactory.cpp +++ b/src/plugins/remotelinux/maemopackagecreationfactory.cpp @@ -63,6 +63,8 @@ QStringList MaemoPackageCreationFactory::availableCreationIds(ProjectExplorer::B QStringList ids; if (!MaemoGlobal::hasLinuxQt(parent->target())) return ids; + if (!qobject_cast<Qt4MaemoDeployConfiguration *>(parent->parent())) + return ids; if (qobject_cast<AbstractDebBasedQt4MaemoTarget *>(parent->target()) && !parent->contains(MaemoDebianPackageCreationStep::CreatePackageId)) { ids << MaemoDebianPackageCreationStep::CreatePackageId; diff --git a/src/plugins/remotelinux/maemopackagecreationstep.cpp b/src/plugins/remotelinux/maemopackagecreationstep.cpp index f48b456000..044b9b71f6 100644 --- a/src/plugins/remotelinux/maemopackagecreationstep.cpp +++ b/src/plugins/remotelinux/maemopackagecreationstep.cpp @@ -205,7 +205,7 @@ bool AbstractMaemoPackageCreationStep::packagingNeeded() const const int deployableCount = deploymentInfo->deployableCount(); for (int i = 0; i < deployableCount; ++i) { - if (MaemoGlobal::isFileNewerThan(deploymentInfo->deployableAt(i).localFilePath, + if (Utils::FileUtils::isFileNewerThan(deploymentInfo->deployableAt(i).localFilePath, packageInfo.lastModified())) return true; } @@ -427,7 +427,7 @@ bool MaemoDebianPackageCreationStep::copyDebianFiles(bool inSourceBuild) return false; } QString error; - if (!MaemoGlobal::removeRecursively(debianDirPath, error)) { + if (!Utils::FileUtils::removeRecursively(debianDirPath, &error)) { raiseError(tr("Packaging failed."), tr("Could not remove directory '%1': %2").arg(debianDirPath, error)); return false; @@ -640,7 +640,7 @@ MaemoTarPackageCreationStep::MaemoTarPackageCreationStep(BuildStepList *buildCon void MaemoTarPackageCreationStep::ctor() { - setDefaultDisplayName(tr("Create tar ball")); + setDefaultDisplayName(tr("Create tarball")); } bool MaemoTarPackageCreationStep::createPackage(QProcess *buildProc, diff --git a/src/plugins/remotelinux/maemopublisherfremantlefree.cpp b/src/plugins/remotelinux/maemopublisherfremantlefree.cpp index 36f6f28bd5..45ab841723 100644 --- a/src/plugins/remotelinux/maemopublisherfremantlefree.cpp +++ b/src/plugins/remotelinux/maemopublisherfremantlefree.cpp @@ -127,7 +127,7 @@ void MaemoPublisherFremantleFree::createPackage() if (QFileInfo(tmpDirContainer()).exists()) { emit progressReport(tr("Removing left-over temporary directory ...")); QString error; - if (!MaemoGlobal::removeRecursively(tmpDirContainer(), error)) { + if (!Utils::FileUtils::removeRecursively(tmpDirContainer(), &error)) { finishWithFailure(tr("Error removing temporary directory: %1").arg(error), tr("Publishing failed: Could not create source package.")); return; @@ -360,7 +360,7 @@ void MaemoPublisherFremantleFree::runDpkgBuildPackage() } foreach (const QString &filePath, d.filesToExclude()) { QString error; - if (!MaemoGlobal::removeRecursively(filePath, error)) { + if (!Utils::FileUtils::removeRecursively(filePath, &error)) { finishWithFailure(error, tr("Publishing failed: Could not create package.")); } diff --git a/src/plugins/remotelinux/maemouploadandinstalldeploystep.cpp b/src/plugins/remotelinux/maemouploadandinstalldeploystep.cpp index 5101ffb063..09c2227033 100644 --- a/src/plugins/remotelinux/maemouploadandinstalldeploystep.cpp +++ b/src/plugins/remotelinux/maemouploadandinstalldeploystep.cpp @@ -277,7 +277,7 @@ const QString MaemoUploadAndInstallTarPackageStep::Id("MaemoUploadAndInstallTarP QString MaemoUploadAndInstallTarPackageStep::displayName() { - return tr("Deploy tar package via SFTP upload"); + return tr("Deploy tarball via SFTP upload"); } } // namespace Internal diff --git a/src/plugins/remotelinux/maemousedportsgatherer.cpp b/src/plugins/remotelinux/maemousedportsgatherer.cpp index b5711b5db6..c72371989c 100644 --- a/src/plugins/remotelinux/maemousedportsgatherer.cpp +++ b/src/plugins/remotelinux/maemousedportsgatherer.cpp @@ -64,10 +64,12 @@ void MaemoUsedPortsGatherer::start(const Utils::SshConnection::Ptr &connection, SLOT(handleRemoteStdOut(QByteArray))); connect(m_procRunner.data(), SIGNAL(processErrorOutputAvailable(QByteArray)), SLOT(handleRemoteStdErr(QByteArray))); - const QString command = MaemoGlobal::remoteSudo(devConf->osType(), - m_procRunner->connection()->connectionParameters().userName) - + QLatin1String(" lsof -nPi4tcp:") + devConf->freePorts().toString() + QString command = QLatin1String("lsof -nPi4tcp:") + devConf->freePorts().toString() + QLatin1String(" -F n |grep '^n' |sed -r 's/[^:]*:([[:digit:]]+).*/\\1/g' |sort -n |uniq"); + if (devConf->osType() != LinuxDeviceConfiguration::HarmattanOsType) { // devrootsh is broken on Harmattan + command.prepend(MaemoGlobal::remoteSudo(devConf->osType(), + devConf->sshParameters().userName) + QLatin1Char(' ')); + } m_procRunner->run(command.toUtf8()); m_running = true; } diff --git a/src/plugins/remotelinux/publickeydeploymentdialog.cpp b/src/plugins/remotelinux/publickeydeploymentdialog.cpp index 9fe831e1a5..5107b867af 100644 --- a/src/plugins/remotelinux/publickeydeploymentdialog.cpp +++ b/src/plugins/remotelinux/publickeydeploymentdialog.cpp @@ -64,7 +64,7 @@ PublicKeyDeploymentDialog::PublicKeyDeploymentDialog(const LinuxDeviceConfigurat const QString &dir = QFileInfo(sshParams.privateKeyFile).path(); QString publicKeyFileName = QFileDialog::getOpenFileName(this, tr("Choose Public Key File"), dir, - tr("Public Key Files(*.pub);;All Files (*)")); + tr("Public Key Files (*.pub);;All Files (*)")); if (publicKeyFileName.isEmpty()) { reject(); return; diff --git a/src/plugins/remotelinux/qt4maemodeployconfiguration.cpp b/src/plugins/remotelinux/qt4maemodeployconfiguration.cpp index c022de7226..c7f039fe17 100644 --- a/src/plugins/remotelinux/qt4maemodeployconfiguration.cpp +++ b/src/plugins/remotelinux/qt4maemodeployconfiguration.cpp @@ -196,15 +196,15 @@ QStringList Qt4MaemoDeployConfigurationFactory::availableCreationIds(Target *par QString Qt4MaemoDeployConfigurationFactory::displayNameForId(const QString &id) const { if (id == Qt4MaemoDeployConfiguration::FremantleWithoutPackagingId) - return tr("Copy files to Maemo5 device"); + return tr("Copy Files to Maemo5 Device"); else if (id == Qt4MaemoDeployConfiguration::FremantleWithPackagingId) - return tr("Build Debian package and install to Maemo5 device"); + return tr("Build Debian Package and Install to Maemo5 Device"); else if (id == Qt4MaemoDeployConfiguration::HarmattanId) - return tr("Build Debian package and install to Harmattan device"); + return tr("Build Debian Package and Install to Harmattan Device"); else if (id == Qt4MaemoDeployConfiguration::MeegoId) - return tr("Build RPM package and install to Meego device"); + return tr("Build RPM Package and Install to MeeGo Device"); else if (id == Qt4MaemoDeployConfiguration::GenericLinuxId) - return tr("Build tarball and install to Linux host"); + return tr("Build Tarball and Install to Linux Host"); return QString(); } diff --git a/src/plugins/remotelinux/qt4maemotarget.cpp b/src/plugins/remotelinux/qt4maemotarget.cpp index 1a8ed325bc..92a675c7e8 100644 --- a/src/plugins/remotelinux/qt4maemotarget.cpp +++ b/src/plugins/remotelinux/qt4maemotarget.cpp @@ -311,7 +311,7 @@ void AbstractQt4MaemoTarget::handleTargetToBeRemoved(ProjectExplorer::Target *ta const QStringList otherContents = QDir(packagingPath).entryList(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot); if (otherContents.isEmpty()) { - if (!MaemoGlobal::removeRecursively(packagingPath, error)) + if (!Utils::FileUtils::removeRecursively(packagingPath, &error)) qDebug("%s", qPrintable(error)); } } @@ -684,7 +684,7 @@ bool AbstractDebBasedQt4MaemoTarget::targetCanBeRemoved() const void AbstractDebBasedQt4MaemoTarget::removeTarget() { QString error; - if (!MaemoGlobal::removeRecursively(debianDirPath(), error)) + if (!Utils::FileUtils::removeRecursively(debianDirPath(), &error)) qDebug("%s", qPrintable(error)); } @@ -705,7 +705,7 @@ AbstractQt4MaemoTarget::ActionStatus AbstractDebBasedQt4MaemoTarget::createSpeci projectDir.path() + QLatin1Char('/') + PackagingDirName); const QString dhMakeDebianDir = projectDir.path() + QLatin1Char('/') + PackagingDirName + QLatin1String("/debian"); - MaemoGlobal::removeRecursively(dhMakeDebianDir, error); + Utils::FileUtils::removeRecursively(dhMakeDebianDir, &error); const QStringList dh_makeArgs = QStringList() << QLatin1String("dh_make") << QLatin1String("-s") << QLatin1String("-n") << QLatin1String("-p") << (defaultPackageFileName() + QLatin1Char('_') @@ -733,7 +733,7 @@ AbstractQt4MaemoTarget::ActionStatus AbstractDebBasedQt4MaemoTarget::createSpeci if (!QFile::rename(dhMakeDebianDir, debianDirPath())) { raiseError(tr("Unable to move new debian directory to '%1'.") .arg(QDir::toNativeSeparators(debianDirPath()))); - MaemoGlobal::removeRecursively(dhMakeDebianDir, error); + Utils::FileUtils::removeRecursively(dhMakeDebianDir, &error); return ActionFailed; } diff --git a/src/plugins/remotelinux/remotelinux.pro b/src/plugins/remotelinux/remotelinux.pro index 1039af7e31..cc5a0a3429 100644 --- a/src/plugins/remotelinux/remotelinux.pro +++ b/src/plugins/remotelinux/remotelinux.pro @@ -4,8 +4,6 @@ TARGET = RemoteLinux include(../../qtcreatorplugin.pri) include(remotelinux_dependencies.pri) -message(target.path = $$target.path) - HEADERS += \ remotelinuxplugin.h \ remotelinux_export.h \ diff --git a/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp b/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp index 919238e3d0..f758c27bc9 100644 --- a/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp +++ b/src/plugins/remotelinux/remotelinuxapplicationrunner.cpp @@ -375,7 +375,8 @@ void RemoteLinuxApplicationRunner::handleDeviceSetupDone(bool success) handleConnected(); } else { emit reportProgress(tr("Connecting to device...")); - m_connection->connectToHost(); + if (m_connection->state() == Utils::SshConnection::Unconnected) + m_connection->connectToHost(); } } diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp index b7a86df3f7..b159e052c0 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp @@ -181,12 +181,16 @@ void AbstractRemoteLinuxDebugSupport::startExecution() void AbstractRemoteLinuxDebugSupport::handleRemoteProcessFinished(qint64 exitCode) { - if (!m_engine || m_state == Inactive || exitCode == 0) + if (!m_engine || m_state == Inactive) return; if (m_state == Debugging) { - if (m_debuggingType != RemoteLinuxRunConfiguration::DebugQmlOnly) + // The QML engine does not realize on its own that the application has finished. + if (m_debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly) + m_engine->quitDebugger(); + else if (exitCode != 0) m_engine->notifyInferiorIll(); + } else { const QString errorMsg = m_debuggingType == RemoteLinuxRunConfiguration::DebugQmlOnly ? tr("Remote application failed with exit code %1.").arg(exitCode) diff --git a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp index f2c8c97445..2a2d0a967b 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfigurationfactory.cpp @@ -102,7 +102,7 @@ QStringList RemoteLinuxRunConfigurationFactory::availableCreationIds(Target *par QString RemoteLinuxRunConfigurationFactory::displayNameForId(const QString &id) const { return QFileInfo(pathFromId(id)).completeBaseName() - + QLatin1String(" (on remote generic Linux device)"); + + tr(" (on Remote Generic Linux Host)"); } RunConfiguration *RemoteLinuxRunConfigurationFactory::create(Target *parent, const QString &id) diff --git a/src/plugins/texteditor/codestylepreferencesmanager.cpp b/src/plugins/texteditor/codestylepreferencesmanager.cpp index f3e3199590..93b0200abc 100644 --- a/src/plugins/texteditor/codestylepreferencesmanager.cpp +++ b/src/plugins/texteditor/codestylepreferencesmanager.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "codestylepreferencesmanager.h" #include "icodestylepreferencesfactory.h" diff --git a/src/plugins/texteditor/codestylepreferencesmanager.h b/src/plugins/texteditor/codestylepreferencesmanager.h index 1b26228d0b..a17cf6a274 100644 --- a/src/plugins/texteditor/codestylepreferencesmanager.h +++ b/src/plugins/texteditor/codestylepreferencesmanager.h @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #ifndef CODESTYLEPREFERENCESMANAGER_H #define CODESTYLEPREFERENCESMANAGER_H diff --git a/src/plugins/texteditor/fallbackselectorwidget.cpp b/src/plugins/texteditor/fallbackselectorwidget.cpp index af931fe137..8abacb092a 100644 --- a/src/plugins/texteditor/fallbackselectorwidget.cpp +++ b/src/plugins/texteditor/fallbackselectorwidget.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "fallbackselectorwidget.h" #include "ifallbackpreferences.h" diff --git a/src/plugins/texteditor/fallbackselectorwidget.h b/src/plugins/texteditor/fallbackselectorwidget.h index 795112b660..205b4a6ebd 100644 --- a/src/plugins/texteditor/fallbackselectorwidget.h +++ b/src/plugins/texteditor/fallbackselectorwidget.h @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #ifndef FALLBACKSELECTORWIDGET_H #define FALLBACKSELECTORWIDGET_H diff --git a/src/plugins/texteditor/icodestylepreferencesfactory.cpp b/src/plugins/texteditor/icodestylepreferencesfactory.cpp index 888bd01336..fe4b193296 100644 --- a/src/plugins/texteditor/icodestylepreferencesfactory.cpp +++ b/src/plugins/texteditor/icodestylepreferencesfactory.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "icodestylepreferencesfactory.h" using namespace TextEditor; diff --git a/src/plugins/texteditor/icodestylepreferencesfactory.h b/src/plugins/texteditor/icodestylepreferencesfactory.h index d0c49d884e..da5c35f134 100644 --- a/src/plugins/texteditor/icodestylepreferencesfactory.h +++ b/src/plugins/texteditor/icodestylepreferencesfactory.h @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #ifndef ICODESTYLEPREFERENCESFACTORY_H #define ICODESTYLEPREFERENCESFACTORY_H diff --git a/src/plugins/texteditor/ifallbackpreferences.cpp b/src/plugins/texteditor/ifallbackpreferences.cpp index 4dcb2f6f66..95bfd49d62 100644 --- a/src/plugins/texteditor/ifallbackpreferences.cpp +++ b/src/plugins/texteditor/ifallbackpreferences.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "ifallbackpreferences.h" #include <utils/settingsutils.h> diff --git a/src/plugins/texteditor/ifallbackpreferences.h b/src/plugins/texteditor/ifallbackpreferences.h index a6339abe4e..435c21a992 100644 --- a/src/plugins/texteditor/ifallbackpreferences.h +++ b/src/plugins/texteditor/ifallbackpreferences.h @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #ifndef IFALLBACKPREFERENCES_H #define IFALLBACKPREFERENCES_H diff --git a/src/plugins/texteditor/tabpreferences.cpp b/src/plugins/texteditor/tabpreferences.cpp index bb3d439def..93458d5e83 100644 --- a/src/plugins/texteditor/tabpreferences.cpp +++ b/src/plugins/texteditor/tabpreferences.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "tabpreferences.h" #include "tabsettings.h" #include "texteditorconstants.h" diff --git a/src/plugins/texteditor/tabpreferences.h b/src/plugins/texteditor/tabpreferences.h index 37a2b7b4c4..c553ab344d 100644 --- a/src/plugins/texteditor/tabpreferences.h +++ b/src/plugins/texteditor/tabpreferences.h @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #ifndef TABPREFERENCES_H #define TABPREFERENCES_H diff --git a/src/plugins/texteditor/tabpreferenceswidget.cpp b/src/plugins/texteditor/tabpreferenceswidget.cpp index ec559a91f6..a542a9e5c9 100644 --- a/src/plugins/texteditor/tabpreferenceswidget.cpp +++ b/src/plugins/texteditor/tabpreferenceswidget.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "tabpreferenceswidget.h" #include "ui_tabpreferenceswidget.h" #include "tabpreferences.h" diff --git a/src/plugins/texteditor/tabpreferenceswidget.h b/src/plugins/texteditor/tabpreferenceswidget.h index 20132e41af..a11f6ccad8 100644 --- a/src/plugins/texteditor/tabpreferenceswidget.h +++ b/src/plugins/texteditor/tabpreferenceswidget.h @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #ifndef TABPREFERENCESWIDGET_H #define TABPREFERENCESWIDGET_H diff --git a/src/plugins/texteditor/tabsettingswidget.cpp b/src/plugins/texteditor/tabsettingswidget.cpp index 9e4336902f..60cc37caf8 100644 --- a/src/plugins/texteditor/tabsettingswidget.cpp +++ b/src/plugins/texteditor/tabsettingswidget.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "tabsettingswidget.h" #include "ui_tabsettingswidget.h" #include "tabsettings.h" diff --git a/src/plugins/texteditor/tabsettingswidget.h b/src/plugins/texteditor/tabsettingswidget.h index ff79a9d8f8..db4818e6f4 100644 --- a/src/plugins/texteditor/tabsettingswidget.h +++ b/src/plugins/texteditor/tabsettingswidget.h @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #ifndef TEXTEDITOR_TABSETTINGSWIDGET_H #define TEXTEDITOR_TABSETTINGSWIDGET_H diff --git a/src/plugins/valgrind/callgrindengine.cpp b/src/plugins/valgrind/callgrindengine.cpp index 9fc18f85f0..988c709329 100644 --- a/src/plugins/valgrind/callgrindengine.cpp +++ b/src/plugins/valgrind/callgrindengine.cpp @@ -45,22 +45,24 @@ using namespace Analyzer; using namespace Valgrind; using namespace Valgrind::Internal; -CallgrindEngine::CallgrindEngine(const AnalyzerStartParameters &sp, - ProjectExplorer::RunConfiguration *runConfiguration) - : ValgrindEngine(sp, runConfiguration) +CallgrindEngine::CallgrindEngine(IAnalyzerTool *tool, const AnalyzerStartParameters &sp, + ProjectExplorer::RunConfiguration *runConfiguration) + : ValgrindEngine(tool, sp, runConfiguration) , m_markAsPaused(false) { connect(&m_runner, SIGNAL(finished()), this, SLOT(slotFinished())); connect(&m_runner, SIGNAL(started()), this, SLOT(slotStarted())); - connect(m_runner.parser(), SIGNAL(parserDataReady()), this, SLOT(slotFinished())); - - connect(&m_runner, SIGNAL(statusMessage(QString)), - Analyzer::AnalyzerManager::instance(), SLOT(showStatusMessage(QString))); + connect(&m_runner, SIGNAL(statusMessage(QString)), SLOT(showStatusMessage(QString))); m_progress->setProgressRange(0, 2); } +void CallgrindEngine::showStatusMessage(const QString &msg) +{ + AnalyzerManager::showStatusMessage(msg); +} + QStringList CallgrindEngine::toolArguments() const { QStringList arguments; diff --git a/src/plugins/valgrind/callgrindengine.h b/src/plugins/valgrind/callgrindengine.h index 33e8d426ca..53a10a8a41 100644 --- a/src/plugins/valgrind/callgrindengine.h +++ b/src/plugins/valgrind/callgrindengine.h @@ -46,8 +46,8 @@ class CallgrindEngine : public Valgrind::Internal::ValgrindEngine Q_OBJECT public: - explicit CallgrindEngine(const Analyzer::AnalyzerStartParameters &sp, - ProjectExplorer::RunConfiguration *runConfiguration); + CallgrindEngine(Analyzer::IAnalyzerTool *tool, const Analyzer::AnalyzerStartParameters &sp, + ProjectExplorer::RunConfiguration *runConfiguration); void start(); @@ -79,15 +79,16 @@ protected: signals: void parserDataReady(CallgrindEngine *engine); +private slots: + void slotFinished(); + void slotStarted(); + void showStatusMessage(const QString &msg); + private: Valgrind::Callgrind::CallgrindRunner m_runner; bool m_markAsPaused; QStringList m_extraArguments; - -private slots: - void slotFinished(); - void slotStarted(); }; } // namespace Internal diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index 874a4fc00c..d89632d6c7 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -47,6 +47,7 @@ #include <valgrind/callgrind/callgrindparsedata.h> #include <valgrind/callgrind/callgrindproxymodel.h> #include <valgrind/callgrind/callgrindstackbrowser.h> +#include <valgrind/valgrindplugin.h> #include <analyzerbase/analyzermanager.h> #include <analyzerbase/analyzersettings.h> @@ -114,10 +115,8 @@ public: void setParseData(ParseData *data); CostDelegate::CostFormat costFormat() const; - QWidget *createControlWidget(); - void initializeDockWidgets(); + QWidget *createWidgets(); - void ensureDockWidgets(); void doClear(bool clearParseData); void updateEventCombo(); @@ -501,9 +500,9 @@ CallgrindTool::CallgrindTool(QObject *parent) : Analyzer::IAnalyzerTool(parent) { d = new CallgrindToolPrivate(this); - Core::ICore *core = Core::ICore::instance(); + setObjectName(QLatin1String("CallgrindTool")); - // EditorManager + Core::ICore *core = Core::ICore::instance(); QObject *editorManager = core->editorManager(); connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)), d, SLOT(editorOpened(Core::IEditor*))); @@ -514,7 +513,7 @@ CallgrindTool::~CallgrindTool() delete d; } -QString CallgrindTool::id() const +QByteArray CallgrindTool::id() const { return "Callgrind"; } @@ -530,15 +529,11 @@ QString CallgrindTool::description() const "record function calls when a program runs."); } -IAnalyzerTool::ToolMode CallgrindTool::mode() const +IAnalyzerTool::ToolMode CallgrindTool::toolMode() const { return ReleaseMode; } -void CallgrindTool::initialize() -{ -} - void CallgrindTool::extensionsInitialized() { Core::ICore *core = Core::ICore::instance(); @@ -570,25 +565,78 @@ void CallgrindTool::extensionsInitialized() } } -void CallgrindTool::initializeDockWidgets() +IAnalyzerEngine *CallgrindTool::createEngine(const AnalyzerStartParameters &sp, + ProjectExplorer::RunConfiguration *runConfiguration) +{ + return d->createEngine(sp, runConfiguration); +} + +IAnalyzerEngine *CallgrindToolPrivate::createEngine(const AnalyzerStartParameters &sp, + ProjectExplorer::RunConfiguration *runConfiguration) +{ + CallgrindEngine *engine = new CallgrindEngine(q, sp, runConfiguration); + + connect(engine, SIGNAL(parserDataReady(CallgrindEngine *)), + SLOT(takeParserData(CallgrindEngine *))); + connect(engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)), + SLOT(engineStarting(const Analyzer::IAnalyzerEngine*))); + connect(engine, SIGNAL(finished()), + SLOT(engineFinished())); + + connect(this, SIGNAL(dumpRequested()), engine, SLOT(dump())); + connect(this, SIGNAL(resetRequested()), engine, SLOT(reset())); + connect(this, SIGNAL(pauseToggled(bool)), engine, SLOT(setPaused(bool))); + + // initialize engine + engine->setPaused(m_pauseAction->isChecked()); + + // we may want to toggle collect for one function only in this run + engine->setToggleCollectFunction(m_toggleCollectFunction); + m_toggleCollectFunction.clear(); + + AnalyzerManager::showStatusMessage(AnalyzerManager::msgToolStarted(q->displayName())); + + // apply project settings + AnalyzerProjectSettings *analyzerSettings = runConfiguration->extraAspect<AnalyzerProjectSettings>(); + CallgrindProjectSettings *settings = analyzerSettings->subConfig<CallgrindProjectSettings>(); + QTC_ASSERT(settings, return engine) + + QTC_ASSERT(m_visualisation, return engine); + m_visualisation->setMinimumInclusiveCostRatio(settings->visualisationMinimumInclusiveCostRatio() / 100.0); + m_proxyModel->setMinimumInclusiveCostRatio(settings->minimumInclusiveCostRatio() / 100.0); + m_dataModel->setVerboseToolTipsEnabled(settings->enableEventToolTips()); + + return engine; +} + +void CallgrindTool::startTool(StartMode mode) +{ + ValgrindPlugin::startValgrindTool(this, mode); +} + +QWidget *CallgrindTool::createWidgets() { - d->initializeDockWidgets(); + return d->createWidgets(); } -void CallgrindToolPrivate::initializeDockWidgets() +QWidget *CallgrindToolPrivate::createWidgets() { - AnalyzerManager *am = AnalyzerManager::instance(); - Utils::FancyMainWindow *mw = am->mainWindow(); + QTC_ASSERT(!m_visualisation, return 0); + + // + // DockWidgets + // + Utils::FancyMainWindow *mw = AnalyzerManager::mainWindow(); m_visualisation = new Visualisation(mw); m_visualisation->setFrameStyle(QFrame::NoFrame); - m_visualisation->setObjectName("Valgrind.CallgrindToolPrivate.Visualisation"); + m_visualisation->setObjectName("Valgrind.CallgrindTool.Visualisation"); m_visualisation->setModel(m_dataModel); connect(m_visualisation, SIGNAL(functionActivated(const Valgrind::Callgrind::Function*)), this, SLOT(visualisationFunctionSelected(const Valgrind::Callgrind::Function*))); m_callersView = new CostView(mw); + m_callersView->setObjectName("Valgrind.CallgrindTool.CallersView"); m_callersView->sortByColumn(CallModel::CostColumn); - m_callersView->setObjectName("Valgrind.CallgrindToolPrivate.CallersView"); m_callersView->setFrameStyle(QFrame::NoFrame); // enable sorting QSortFilterProxyModel *callerProxy = new QSortFilterProxyModel(m_callersModel); @@ -599,8 +647,8 @@ void CallgrindToolPrivate::initializeDockWidgets() this, SLOT(callerFunctionSelected(QModelIndex))); m_calleesView = new CostView(mw); + m_calleesView->setObjectName("Valgrind.CallgrindTool.CalleesView"); m_calleesView->sortByColumn(CallModel::CostColumn); - m_calleesView->setObjectName("Valgrind.CallgrindToolPrivate.CalleesView"); m_calleesView->setFrameStyle(QFrame::NoFrame); // enable sorting QSortFilterProxyModel *calleeProxy = new QSortFilterProxyModel(m_calleesModel); @@ -611,90 +659,40 @@ void CallgrindToolPrivate::initializeDockWidgets() this, SLOT(calleeFunctionSelected(QModelIndex))); m_flatView = new CostView(mw); + m_flatView->setObjectName("Valgrind.CallgrindTool.FlatView"); m_flatView->sortByColumn(DataModel::SelfCostColumn); m_flatView->setFrameStyle(QFrame::NoFrame); m_flatView->setAttribute(Qt::WA_MacShowFocusRect, false); m_flatView->setModel(m_proxyModel); - m_flatView->setObjectName("Valgrind.CallgrindToolPrivate.FlatView"); connect(m_flatView, SIGNAL(activated(QModelIndex)), this, SLOT(dataFunctionSelected(QModelIndex))); updateCostFormat(); - QDockWidget *callersDock = - am->createDockWidget(q, tr("Callers"), m_callersView, - Qt::BottomDockWidgetArea); + QDockWidget *callersDock = AnalyzerManager::createDockWidget + (q, tr("Callers"), m_callersView, Qt::BottomDockWidgetArea); + + QDockWidget *flatDock = AnalyzerManager::createDockWidget + (q, tr("Functions"), m_flatView, Qt::BottomDockWidgetArea); - QDockWidget *flatDock = - am->createDockWidget(q, tr("Functions"), m_flatView, - Qt::BottomDockWidgetArea); + QDockWidget *calleesDock = AnalyzerManager::createDockWidget + (q, tr("Callees"), m_calleesView, Qt::BottomDockWidgetArea); - QDockWidget *calleesDock = - am->createDockWidget(q, tr("Callees"), m_calleesView, - Qt::BottomDockWidgetArea); + QDockWidget *visualizationDock = AnalyzerManager::createDockWidget + (q, tr("Visualization"), m_visualisation, Qt::RightDockWidgetArea); - QDockWidget *visualizationDock = - am->createDockWidget(q, tr("Visualization"), m_visualisation, - Qt::RightDockWidgetArea); + callersDock->show(); + calleesDock->show(); + flatDock->show(); visualizationDock->hide(); - mw->splitDockWidget(mw->toolBarDockWidget(), calleesDock, Qt::Vertical); - mw->splitDockWidget(mw->toolBarDockWidget(), callersDock, Qt::Vertical); mw->splitDockWidget(mw->toolBarDockWidget(), flatDock, Qt::Vertical); - mw->tabifyDockWidget(callersDock, calleesDock); -} - -IAnalyzerEngine *CallgrindTool::createEngine(const AnalyzerStartParameters &sp, - ProjectExplorer::RunConfiguration *runConfiguration) -{ - return d->createEngine(sp, runConfiguration); -} - -IAnalyzerEngine *CallgrindToolPrivate::createEngine(const AnalyzerStartParameters &sp, - ProjectExplorer::RunConfiguration *runConfiguration) -{ - CallgrindEngine *engine = new CallgrindEngine(sp, runConfiguration); - - connect(engine, SIGNAL(parserDataReady(CallgrindEngine *)), - SLOT(takeParserData(CallgrindEngine *))); - connect(engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)), - SLOT(engineStarting(const Analyzer::IAnalyzerEngine*))); - connect(engine, SIGNAL(finished()), - SLOT(engineFinished())); - - connect(this, SIGNAL(dumpRequested()), engine, SLOT(dump())); - connect(this, SIGNAL(resetRequested()), engine, SLOT(reset())); - connect(this, SIGNAL(pauseToggled(bool)), engine, SLOT(setPaused(bool))); - - // initialize engine - engine->setPaused(m_pauseAction->isChecked()); - - // we may want to toggle collect for one function only in this run - engine->setToggleCollectFunction(m_toggleCollectFunction); - m_toggleCollectFunction.clear(); - - AnalyzerManager::instance()->showStatusMessage(AnalyzerManager::msgToolStarted(q->displayName())); - - // apply project settings - AnalyzerProjectSettings *analyzerSettings = runConfiguration->extraAspect<AnalyzerProjectSettings>(); - CallgrindProjectSettings *settings = analyzerSettings->subConfig<CallgrindProjectSettings>(); - QTC_ASSERT(settings, return engine) - - QTC_ASSERT(m_visualisation, return engine); - m_visualisation->setMinimumInclusiveCostRatio(settings->visualisationMinimumInclusiveCostRatio() / 100.0); - m_proxyModel->setMinimumInclusiveCostRatio(settings->minimumInclusiveCostRatio() / 100.0); - m_dataModel->setVerboseToolTipsEnabled(settings->enableEventToolTips()); - - return engine; -} - -QWidget *CallgrindTool::createControlWidget() -{ - return d->createControlWidget(); -} + mw->splitDockWidget(mw->toolBarDockWidget(), calleesDock, Qt::Vertical); + mw->splitDockWidget(calleesDock, callersDock, Qt::Horizontal); -QWidget *CallgrindToolPrivate::createControlWidget() -{ + // + // Control Widget + // QAction *action = 0; QWidget *widget = new QWidget; QHBoxLayout *layout = new QHBoxLayout; @@ -862,7 +860,7 @@ void CallgrindToolPrivate::engineFinished() if (data) showParserResults(data); else - AnalyzerManager::instance()->showStatusMessage(tr("Profiling aborted.")); + AnalyzerManager::showStatusMessage(tr("Profiling aborted.")); } void CallgrindToolPrivate::showParserResults(const ParseData *data) @@ -879,7 +877,7 @@ void CallgrindToolPrivate::showParserResults(const ParseData *data) } else { msg = tr("Parsing failed."); } - AnalyzerManager::instance()->showStatusMessage(msg); + AnalyzerManager::showStatusMessage(msg); } void CallgrindToolPrivate::editorOpened(Core::IEditor *editor) @@ -938,8 +936,8 @@ void CallgrindToolPrivate::handleShowCostsOfFunction() m_toggleCollectFunction = QString("%1()").arg(qualifiedFunctionName); - AnalyzerManager::instance()->selectTool(q); - AnalyzerManager::instance()->startTool(q); + AnalyzerManager::selectTool(q, StartMode(StartLocal)); + AnalyzerManager::startTool(q, StartMode(StartLocal)); } void CallgrindToolPrivate::slotRequestDump() @@ -999,15 +997,6 @@ void CallgrindToolPrivate::createTextMarks() } } -bool CallgrindTool::canRunLocally() const -{ -#ifdef Q_OS_WINDOWS - return false; -#else - return true; -#endif -} - } // namespace Internal } // namespace Valgrind diff --git a/src/plugins/valgrind/callgrindtool.h b/src/plugins/valgrind/callgrindtool.h index e3a438b70a..35da11be71 100644 --- a/src/plugins/valgrind/callgrindtool.h +++ b/src/plugins/valgrind/callgrindtool.h @@ -45,24 +45,21 @@ class CallgrindTool : public Analyzer::IAnalyzerTool Q_OBJECT public: - explicit CallgrindTool(QObject *parent = 0); + CallgrindTool(QObject *parent); ~CallgrindTool(); - QString id() const; + QByteArray id() const; QString displayName() const; QString description() const; - ToolMode mode() const; + ToolMode toolMode() const; - void initialize(); void extensionsInitialized(); - void initializeDockWidgets(); Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp, ProjectExplorer::RunConfiguration *runConfiguration = 0); - QWidget *createControlWidget(); + QWidget *createWidgets(); - bool canRunRemotely() const { return true; } - bool canRunLocally() const; + void startTool(Analyzer::StartMode mode); private: CallgrindToolPrivate *d; diff --git a/src/plugins/valgrind/memcheckengine.cpp b/src/plugins/valgrind/memcheckengine.cpp index 10e82fc1db..341b7a5470 100644 --- a/src/plugins/valgrind/memcheckengine.cpp +++ b/src/plugins/valgrind/memcheckengine.cpp @@ -49,9 +49,9 @@ using namespace Valgrind::XmlProtocol; namespace Valgrind { namespace Internal { -MemcheckEngine::MemcheckEngine(const Analyzer::AnalyzerStartParameters &sp, - ProjectExplorer::RunConfiguration *runConfiguration) - : ValgrindEngine(sp, runConfiguration) +MemcheckEngine::MemcheckEngine(IAnalyzerTool *tool, const AnalyzerStartParameters &sp, + ProjectExplorer::RunConfiguration *runConfiguration) + : ValgrindEngine(tool, sp, runConfiguration) { connect(&m_parser, SIGNAL(error(Valgrind::XmlProtocol::Error)), SIGNAL(parserError(Valgrind::XmlProtocol::Error))); diff --git a/src/plugins/valgrind/memcheckengine.h b/src/plugins/valgrind/memcheckengine.h index de21bdf5cd..6fb21599db 100644 --- a/src/plugins/valgrind/memcheckengine.h +++ b/src/plugins/valgrind/memcheckengine.h @@ -46,9 +46,10 @@ namespace Internal { class MemcheckEngine : public ValgrindEngine { Q_OBJECT + public: - explicit MemcheckEngine(const Analyzer::AnalyzerStartParameters &sp, - ProjectExplorer::RunConfiguration *runConfiguration); + MemcheckEngine(Analyzer::IAnalyzerTool *tool, const Analyzer::AnalyzerStartParameters &sp, + ProjectExplorer::RunConfiguration *runConfiguration); void start(); void stop(); diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp index 109029a15b..9c2e89a817 100644 --- a/src/plugins/valgrind/memchecktool.cpp +++ b/src/plugins/valgrind/memchecktool.cpp @@ -37,6 +37,7 @@ #include "memcheckerrorview.h" #include "memchecksettings.h" #include "valgrindsettings.h" +#include "valgrindplugin.h" #include <analyzerbase/analyzermanager.h> #include <analyzerbase/analyzerconstants.h> @@ -229,15 +230,8 @@ void MemcheckTool::settingsDestroyed(QObject *settings) m_settings = AnalyzerGlobalSettings::instance(); } -void MemcheckTool::extensionsInitialized() -{ - //ensureWidgets(); // FIXME: Try to do that later. -} - void MemcheckTool::maybeActiveRunConfigurationChanged() { - ensureWidgets(); - AnalyzerSettings *settings = 0; ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance(); if (ProjectExplorer::Project *project = pe->startupProject()) { @@ -292,9 +286,9 @@ void MemcheckTool::maybeActiveRunConfigurationChanged() m_errorProxyModel->setFilterExternalIssues(memcheckSettings->filterExternalIssues()); } -QString MemcheckTool::id() const +QByteArray MemcheckTool::id() const { - return "Memcheck"; + return "MemcheckLocal"; } QString MemcheckTool::displayName() const @@ -308,7 +302,7 @@ QString MemcheckTool::description() const "memory leaks"); } -IAnalyzerTool::ToolMode MemcheckTool::mode() const +IAnalyzerTool::ToolMode MemcheckTool::toolMode() const { return DebugMode; } @@ -359,18 +353,12 @@ private: QStringList m_projectFiles; }; -void MemcheckTool::initializeDockWidgets() -{ - ensureWidgets(); -} -void MemcheckTool::ensureWidgets() +QWidget *MemcheckTool::createWidgets() { - if (m_errorView) - return; + QTC_ASSERT(!m_errorView, return 0); - AnalyzerManager *am = AnalyzerManager::instance(); - Utils::FancyMainWindow *mw = am->mainWindow(); + Utils::FancyMainWindow *mw = AnalyzerManager::mainWindow(); m_errorView = new MemcheckErrorView; m_errorView->setObjectName(QLatin1String("MemcheckErrorView")); @@ -390,19 +378,16 @@ void MemcheckTool::ensureWidgets() m_errorView->setAutoScroll(false); m_errorView->setObjectName("Valgrind.MemcheckTool.ErrorView"); - QDockWidget *errorDock = - am->createDockWidget(this, tr("Memory Issues"), m_errorView, - Qt::BottomDockWidgetArea); + QDockWidget *errorDock = AnalyzerManager::createDockWidget + (this, tr("Memory Issues"), m_errorView, Qt::BottomDockWidgetArea); mw->splitDockWidget(mw->toolBarDockWidget(), errorDock, Qt::Vertical); connect(ProjectExplorer::ProjectExplorerPlugin::instance(), SIGNAL(updateRunActions()), SLOT(maybeActiveRunConfigurationChanged())); -} - -QWidget *MemcheckTool::createControlWidget() -{ - ensureWidgets(); + // + // The Control Widget. + // QAction *action = 0; QHBoxLayout *layout = new QHBoxLayout; QToolButton *button = 0; @@ -457,9 +442,10 @@ QWidget *MemcheckTool::createControlWidget() IAnalyzerEngine *MemcheckTool::createEngine(const AnalyzerStartParameters &sp, ProjectExplorer::RunConfiguration *runConfiguration) { - m_frameFinder->setFiles(runConfiguration ? runConfiguration->target()->project()->files(ProjectExplorer::Project::AllFiles) : QStringList()); + m_frameFinder->setFiles(runConfiguration ? runConfiguration->target() + ->project()->files(ProjectExplorer::Project::AllFiles) : QStringList()); - MemcheckEngine *engine = new MemcheckEngine(sp, runConfiguration); + MemcheckEngine *engine = new MemcheckEngine(this, sp, runConfiguration); connect(engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)), this, SLOT(engineStarting(const Analyzer::IAnalyzerEngine*))); @@ -468,10 +454,15 @@ IAnalyzerEngine *MemcheckTool::createEngine(const AnalyzerStartParameters &sp, connect(engine, SIGNAL(internalParserError(QString)), this, SLOT(internalParserError(QString))); connect(engine, SIGNAL(finished()), this, SLOT(finished())); - AnalyzerManager::instance()->showStatusMessage(AnalyzerManager::msgToolStarted(displayName())); + AnalyzerManager::showStatusMessage(AnalyzerManager::msgToolStarted(displayName())); return engine; } +void MemcheckTool::startTool(StartMode mode) +{ + ValgrindPlugin::startValgrindTool(this, mode); +} + void MemcheckTool::engineStarting(const IAnalyzerEngine *engine) { clearErrorView(); @@ -519,7 +510,7 @@ void MemcheckTool::internalParserError(const QString &errorString) void MemcheckTool::clearErrorView() { - ensureWidgets(); + QTC_ASSERT(m_errorView, return); m_errorModel->clear(); qDeleteAll(m_suppressionActions); @@ -529,7 +520,7 @@ void MemcheckTool::clearErrorView() void MemcheckTool::updateErrorFilter() { - ensureWidgets(); + QTC_ASSERT(m_errorView, return); QTC_ASSERT(m_settings, return); AbstractMemcheckSettings *memcheckSettings = m_settings->subConfig<AbstractMemcheckSettings>(); @@ -556,21 +547,7 @@ void MemcheckTool::finished() m_goBack->setEnabled(n > 0); m_goNext->setEnabled(n > 0); const QString msg = AnalyzerManager::msgToolFinished(displayName(), n); - AnalyzerManager::instance()->showStatusMessage(msg); -} - -bool MemcheckTool::canRunRemotely() const -{ - return true; -} - -bool MemcheckTool::canRunLocally() const -{ -#ifdef Q_OS_WINDOWS - return false; -#else - return true; -#endif + AnalyzerManager::showStatusMessage(msg); } } // namespace Internal diff --git a/src/plugins/valgrind/memchecktool.h b/src/plugins/valgrind/memchecktool.h index 611471290c..60fa684292 100644 --- a/src/plugins/valgrind/memchecktool.h +++ b/src/plugins/valgrind/memchecktool.h @@ -91,12 +91,11 @@ class MemcheckTool : public Analyzer::IAnalyzerTool Q_OBJECT public: - explicit MemcheckTool(QObject *parent = 0); + MemcheckTool(QObject *parent); - QString id() const; + QByteArray id() const; QString displayName() const; QString description() const; - ToolMode mode() const; private slots: void settingsDestroyed(QObject *settings); @@ -111,19 +110,17 @@ private slots: void suppressionActionTriggered(); private: - void ensureWidgets(); - bool canRunRemotely() const; - bool canRunLocally() const; - void initializeDockWidgets(); - void initialize() {} - void extensionsInitialized(); - QWidget *createControlWidget(); + ToolMode toolMode() const; + void extensionsInitialized() {} + QWidget *createWidgets(); Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp, ProjectExplorer::RunConfiguration *runConfiguration = 0); + void startTool(Analyzer::StartMode mode); void clearErrorView(); +private: Analyzer::AnalyzerSettings *m_settings; QMenu *m_filterMenu; diff --git a/src/plugins/valgrind/valgrind.pro b/src/plugins/valgrind/valgrind.pro index 18bdb64441..e07d06ee74 100644 --- a/src/plugins/valgrind/valgrind.pro +++ b/src/plugins/valgrind/valgrind.pro @@ -1,20 +1,18 @@ TEMPLATE = lib TARGET = Valgrind -DEFINES += VALGRIND_LIBRARY - include(../../qtcreatorplugin.pri) -include(valgrind.pri) +include(valgrind_dependencies.pri) +include(valgrind/valgrind.pri) +QT *= network -QT += network +INCLUDEPATH *= $$PWD HEADERS += \ valgrindplugin.h \ - valgrind_global.h \ valgrindengine.h \ valgrindconfigwidget.h \ valgrindsettings.h \ - \ callgrindconfigwidget.h \ callgrindcostdelegate.h \ callgrindcostview.h \ @@ -51,7 +49,6 @@ SOURCES += \ callgrindengine.cpp \ workarounds.cpp \ callgrindtextmark.cpp \ - \ memchecktool.cpp \ memcheckengine.cpp \ memcheckerrorview.cpp \ diff --git a/src/libs/valgrind/callgrind/callgrindabstractmodel.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindabstractmodel.cpp index 08f815034d..08f815034d 100644 --- a/src/libs/valgrind/callgrind/callgrindabstractmodel.cpp +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindabstractmodel.cpp diff --git a/src/libs/valgrind/callgrind/callgrindabstractmodel.h b/src/plugins/valgrind/valgrind/callgrind/callgrindabstractmodel.h index 8ae9f5826e..90518e9a09 100644 --- a/src/libs/valgrind/callgrind/callgrindabstractmodel.h +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindabstractmodel.h @@ -33,8 +33,6 @@ #ifndef LIBVALGRIND_CALLGRINDABSTRACTMODEL_H #define LIBVALGRIND_CALLGRINDABSTRACTMODEL_H -#include "../valgrind_global.h" - #include <QtGui/QAbstractItemView> namespace Valgrind { diff --git a/src/libs/valgrind/callgrind/callgrindcallmodel.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindcallmodel.cpp index d2be2c250c..d2be2c250c 100644 --- a/src/libs/valgrind/callgrind/callgrindcallmodel.cpp +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindcallmodel.cpp diff --git a/src/libs/valgrind/callgrind/callgrindcallmodel.h b/src/plugins/valgrind/valgrind/callgrind/callgrindcallmodel.h index ecac253723..77bc69b850 100644 --- a/src/libs/valgrind/callgrind/callgrindcallmodel.h +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindcallmodel.h @@ -35,8 +35,6 @@ #include <QtCore/QAbstractItemModel> -#include "../valgrind_global.h" - #include "callgrindabstractmodel.h" namespace Valgrind { @@ -48,7 +46,7 @@ class Function; /** * Model to display list of function calls. */ -class VALGRINDSHARED_EXPORT CallModel : public QAbstractItemModel +class CallModel : public QAbstractItemModel { Q_OBJECT public: diff --git a/src/libs/valgrind/callgrind/callgrindcontroller.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindcontroller.cpp index d3532c700a..c968cfa1de 100644 --- a/src/libs/valgrind/callgrind/callgrindcontroller.cpp +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindcontroller.cpp @@ -35,7 +35,7 @@ #include <QDebug> #include <QDir> -#include <valgrind/valgrindprocess.h> +#include <valgrindprocess.h> #include <utils/qtcassert.h> #include <utils/ssh/sftpchannel.h> @@ -138,8 +138,13 @@ void CallgrindController::run(Option option) #if CALLGRIND_CONTROL_DEBUG m_process->setProcessChannelMode(QProcess::ForwardedChannels); #endif +#ifdef Q_OS_WIN + int pid = 0; +#else + const int pid = m_valgrindProc->pid(); +#endif m_process->run(CALLGRIND_CONTROL_BINARY, - QStringList() << optionString << QString::number(m_valgrindProc->pid()), + QStringList() << optionString << QString::number(pid), QString(), QString()); } @@ -200,7 +205,8 @@ void CallgrindController::getLocalDataFile() QTC_ASSERT(m_valgrindProc, return); // we look for callgrind.out.PID, but there may be updated ones called ~.PID.NUM - QString baseFileName = QString("callgrind.out.%1").arg(m_valgrindProc->pid()); + QString baseFileName = QString("callgrind.out.%1"). + arg(m_valgrindProc->pid()); const QString workingDir = m_valgrindProc->workingDirectory(); // first, set the to-be-parsed file to callgrind.out.PID QString fileName = workingDir.isEmpty() ? baseFileName : (workingDir + QDir::separator() + baseFileName); diff --git a/src/libs/valgrind/callgrind/callgrindcontroller.h b/src/plugins/valgrind/valgrind/callgrind/callgrindcontroller.h index 4a648b571d..0368f5316f 100644 --- a/src/libs/valgrind/callgrind/callgrindcontroller.h +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindcontroller.h @@ -41,15 +41,13 @@ #include <utils/ssh/sshremoteprocess.h> #include <utils/ssh/sftpchannel.h> -#include <valgrind/valgrind_global.h> - namespace Valgrind { class ValgrindProcess; namespace Callgrind { -class VALGRINDSHARED_EXPORT CallgrindController : public QObject +class CallgrindController : public QObject { Q_OBJECT Q_ENUMS(Option) diff --git a/src/libs/valgrind/callgrind/callgrindcostitem.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindcostitem.cpp index a463ee75fa..a463ee75fa 100644 --- a/src/libs/valgrind/callgrind/callgrindcostitem.cpp +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindcostitem.cpp diff --git a/src/libs/valgrind/callgrind/callgrindcostitem.h b/src/plugins/valgrind/valgrind/callgrind/callgrindcostitem.h index 2bc789e3bb..c0804606b0 100644 --- a/src/libs/valgrind/callgrind/callgrindcostitem.h +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindcostitem.h @@ -33,7 +33,7 @@ #ifndef LIBVALGRIND_CALLGRIND_COSTITEM_H #define LIBVALGRIND_CALLGRIND_COSTITEM_H -#include "../valgrind_global.h" +#include <QtCore/QtGlobal> QT_BEGIN_NAMESPACE class QString; @@ -49,7 +49,7 @@ class ParseData; /** * This class represents the cost(s) at given position(s). */ -class VALGRINDSHARED_EXPORT CostItem +class CostItem { public: /// @p data the file data this cost item was parsed in. diff --git a/src/libs/valgrind/callgrind/callgrindcycledetection.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindcycledetection.cpp index 424bfa182b..424bfa182b 100644 --- a/src/libs/valgrind/callgrind/callgrindcycledetection.cpp +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindcycledetection.cpp diff --git a/src/libs/valgrind/callgrind/callgrindcycledetection.h b/src/plugins/valgrind/valgrind/callgrind/callgrindcycledetection.h index 1420145612..1420145612 100644 --- a/src/libs/valgrind/callgrind/callgrindcycledetection.h +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindcycledetection.h diff --git a/src/libs/valgrind/callgrind/callgrinddatamodel.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrinddatamodel.cpp index f72d6fae58..f72d6fae58 100644 --- a/src/libs/valgrind/callgrind/callgrinddatamodel.cpp +++ b/src/plugins/valgrind/valgrind/callgrind/callgrinddatamodel.cpp diff --git a/src/libs/valgrind/callgrind/callgrinddatamodel.h b/src/plugins/valgrind/valgrind/callgrind/callgrinddatamodel.h index 9035159b67..c155ef661c 100644 --- a/src/libs/valgrind/callgrind/callgrinddatamodel.h +++ b/src/plugins/valgrind/valgrind/callgrind/callgrinddatamodel.h @@ -33,8 +33,6 @@ #ifndef VALGRIND_CALLGRIND_CALLGRINDDATAMODEL_H #define VALGRIND_CALLGRIND_CALLGRINDDATAMODEL_H -#include "../valgrind_global.h" - #include "callgrindabstractmodel.h" #include <QtCore/QAbstractItemModel> @@ -45,7 +43,7 @@ namespace Callgrind { class Function; class ParseData; -class VALGRINDSHARED_EXPORT DataModel : public QAbstractItemModel +class DataModel : public QAbstractItemModel { Q_OBJECT diff --git a/src/libs/valgrind/callgrind/callgrindfunction.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindfunction.cpp index 49069c9cf2..49069c9cf2 100644 --- a/src/libs/valgrind/callgrind/callgrindfunction.cpp +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindfunction.cpp diff --git a/src/libs/valgrind/callgrind/callgrindfunction.h b/src/plugins/valgrind/valgrind/callgrind/callgrindfunction.h index c52863ff9a..50a84b9218 100644 --- a/src/libs/valgrind/callgrind/callgrindfunction.h +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindfunction.h @@ -33,8 +33,6 @@ #ifndef LIBVALGRIND_CALLGRIND_FUNCTION_H #define LIBVALGRIND_CALLGRIND_FUNCTION_H -#include "../valgrind_global.h" - #include <QtCore/QMetaType> QT_BEGIN_NAMESPACE @@ -50,7 +48,7 @@ class FunctionCall; class CostItem; class ParseData; -class VALGRINDSHARED_EXPORT Function +class Function { public: /// @p data the ParseData for the file this function was part of diff --git a/src/libs/valgrind/callgrind/callgrindfunction_p.h b/src/plugins/valgrind/valgrind/callgrind/callgrindfunction_p.h index b7fac85811..b7fac85811 100644 --- a/src/libs/valgrind/callgrind/callgrindfunction_p.h +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindfunction_p.h diff --git a/src/libs/valgrind/callgrind/callgrindfunctioncall.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncall.cpp index 69dbce2b7c..69dbce2b7c 100644 --- a/src/libs/valgrind/callgrind/callgrindfunctioncall.cpp +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncall.cpp diff --git a/src/libs/valgrind/callgrind/callgrindfunctioncall.h b/src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncall.h index e84aa30f5e..2e825ebca3 100644 --- a/src/libs/valgrind/callgrind/callgrindfunctioncall.h +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncall.h @@ -33,8 +33,6 @@ #ifndef LIBVALGRIND_CALLGRIND_CALLEE_H #define LIBVALGRIND_CALLGRIND_CALLEE_H -#include "../valgrind_global.h" - #include <QtCore/QMetaType> QT_BEGIN_NAMESPACE @@ -49,7 +47,7 @@ class Function; /** * This represents a function call. */ -class VALGRINDSHARED_EXPORT FunctionCall +class FunctionCall { public: explicit FunctionCall(); diff --git a/src/libs/valgrind/callgrind/callgrindfunctioncycle.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncycle.cpp index 952f6d48d9..952f6d48d9 100644 --- a/src/libs/valgrind/callgrind/callgrindfunctioncycle.cpp +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncycle.cpp diff --git a/src/libs/valgrind/callgrind/callgrindfunctioncycle.h b/src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncycle.h index 249087efa5..d4feaca2c0 100644 --- a/src/libs/valgrind/callgrind/callgrindfunctioncycle.h +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindfunctioncycle.h @@ -46,7 +46,7 @@ namespace Callgrind { * excluding calees inside the cycle * inclusive cost of a function cycle: sum of inclusive cost of callees of the cycle (see above) */ -class VALGRINDSHARED_EXPORT FunctionCycle : public Function +class FunctionCycle : public Function { public: explicit FunctionCycle(const ParseData *data); diff --git a/src/libs/valgrind/callgrind/callgrindparsedata.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindparsedata.cpp index 57f09d3701..57f09d3701 100644 --- a/src/libs/valgrind/callgrind/callgrindparsedata.cpp +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindparsedata.cpp diff --git a/src/libs/valgrind/callgrind/callgrindparsedata.h b/src/plugins/valgrind/valgrind/callgrind/callgrindparsedata.h index 5110461a35..a77f638f6f 100644 --- a/src/libs/valgrind/callgrind/callgrindparsedata.h +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindparsedata.h @@ -33,7 +33,7 @@ #ifndef LIBVALGRIND_CALLGRIND_PARSEDATA_P_H #define LIBVALGRIND_CALLGRIND_PARSEDATA_P_H -#include "../valgrind_global.h" +#include <QtCore/QtGlobal> QT_BEGIN_NAMESPACE class QString; @@ -49,7 +49,7 @@ class Function; /** * Represents all the information extracted from a callgrind data file. */ -class VALGRINDSHARED_EXPORT ParseData +class ParseData { public: explicit ParseData(); diff --git a/src/libs/valgrind/callgrind/callgrindparser.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindparser.cpp index 50a6a4db3d..50a6a4db3d 100644 --- a/src/libs/valgrind/callgrind/callgrindparser.cpp +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindparser.cpp diff --git a/src/libs/valgrind/callgrind/callgrindparser.h b/src/plugins/valgrind/valgrind/callgrind/callgrindparser.h index 12629928fd..40ee223524 100644 --- a/src/libs/valgrind/callgrind/callgrindparser.h +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindparser.h @@ -33,8 +33,6 @@ #ifndef LIBVALGRIND_CALLGRIND_PARSER_H #define LIBVALGRIND_CALLGRIND_PARSER_H -#include "../valgrind_global.h" - #include <QObject> QT_BEGIN_NAMESPACE @@ -55,7 +53,7 @@ class ParseData; * the rest is assumed to be zero." * */ -class VALGRINDSHARED_EXPORT Parser : public QObject +class Parser : public QObject { Q_OBJECT diff --git a/src/libs/valgrind/callgrind/callgrindproxymodel.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindproxymodel.cpp index 44318ce406..44318ce406 100644 --- a/src/libs/valgrind/callgrind/callgrindproxymodel.cpp +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindproxymodel.cpp diff --git a/src/libs/valgrind/callgrind/callgrindproxymodel.h b/src/plugins/valgrind/valgrind/callgrind/callgrindproxymodel.h index a4967584a5..c4c99e9e7f 100644 --- a/src/libs/valgrind/callgrind/callgrindproxymodel.h +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindproxymodel.h @@ -33,8 +33,6 @@ #ifndef VALGRIND_CALLGRIND_CALLGRINDPROXYMODEL_H #define VALGRIND_CALLGRIND_CALLGRINDPROXYMODEL_H -#include "../valgrind_global.h" - #include <QSortFilterProxyModel> namespace Valgrind { @@ -43,7 +41,7 @@ namespace Callgrind { class DataModel; class Function; -class VALGRINDSHARED_EXPORT DataProxyModel : public QSortFilterProxyModel +class DataProxyModel : public QSortFilterProxyModel { Q_OBJECT diff --git a/src/libs/valgrind/callgrind/callgrindrunner.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindrunner.cpp index a42b825967..a42b825967 100644 --- a/src/libs/valgrind/callgrind/callgrindrunner.cpp +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindrunner.cpp diff --git a/src/libs/valgrind/callgrind/callgrindrunner.h b/src/plugins/valgrind/valgrind/callgrind/callgrindrunner.h index 0a42c3ef49..fb7da49db4 100644 --- a/src/libs/valgrind/callgrind/callgrindrunner.h +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindrunner.h @@ -33,8 +33,7 @@ #ifndef VALGRIND_CALLGRIND_CALLGRINDRUNNER_H #define VALGRIND_CALLGRIND_CALLGRINDRUNNER_H -#include <valgrind/valgrindrunner.h> -#include <valgrind/valgrind_global.h> +#include <valgrindrunner.h> #include "callgrindcontroller.h" @@ -44,7 +43,7 @@ namespace Callgrind { class Parser; class CallgrindController; -class VALGRINDSHARED_EXPORT CallgrindRunner : public ValgrindRunner +class CallgrindRunner : public ValgrindRunner { Q_OBJECT diff --git a/src/libs/valgrind/callgrind/callgrindstackbrowser.cpp b/src/plugins/valgrind/valgrind/callgrind/callgrindstackbrowser.cpp index b448b2f23d..b448b2f23d 100644 --- a/src/libs/valgrind/callgrind/callgrindstackbrowser.cpp +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindstackbrowser.cpp diff --git a/src/libs/valgrind/callgrind/callgrindstackbrowser.h b/src/plugins/valgrind/valgrind/callgrind/callgrindstackbrowser.h index 637ea213a1..a7b239ef4b 100644 --- a/src/libs/valgrind/callgrind/callgrindstackbrowser.h +++ b/src/plugins/valgrind/valgrind/callgrind/callgrindstackbrowser.h @@ -33,8 +33,6 @@ #ifndef CALLGRINDSTACKBROWSER_H #define CALLGRINDSTACKBROWSER_H -#include "../valgrind_global.h" - #include <QObject> #include <QStack> @@ -43,7 +41,7 @@ namespace Callgrind { class Function; -class VALGRINDSHARED_EXPORT StackBrowser : public QObject +class StackBrowser : public QObject { Q_OBJECT diff --git a/src/libs/valgrind/memcheck/memcheckrunner.cpp b/src/plugins/valgrind/valgrind/memcheck/memcheckrunner.cpp index 2786451d93..2786451d93 100644 --- a/src/libs/valgrind/memcheck/memcheckrunner.cpp +++ b/src/plugins/valgrind/valgrind/memcheck/memcheckrunner.cpp diff --git a/src/libs/valgrind/memcheck/memcheckrunner.h b/src/plugins/valgrind/valgrind/memcheck/memcheckrunner.h index 6354ea9b32..9fa5957061 100644 --- a/src/libs/valgrind/memcheck/memcheckrunner.h +++ b/src/plugins/valgrind/valgrind/memcheck/memcheckrunner.h @@ -35,8 +35,7 @@ #ifndef VALGRIND_PROTOCOL_MEMCHECKRUNNER_H #define VALGRIND_PROTOCOL_MEMCHECKRUNNER_H -#include <valgrind/valgrind_global.h> -#include <valgrind/valgrindrunner.h> +#include <valgrindrunner.h> namespace Valgrind { @@ -46,7 +45,7 @@ class ThreadedParser; namespace Memcheck { -class VALGRINDSHARED_EXPORT MemcheckRunner : public ValgrindRunner +class MemcheckRunner : public ValgrindRunner { Q_OBJECT diff --git a/src/plugins/valgrind/valgrind/valgrind.pri b/src/plugins/valgrind/valgrind/valgrind.pri new file mode 100644 index 0000000000..73cb4fcdbf --- /dev/null +++ b/src/plugins/valgrind/valgrind/valgrind.pri @@ -0,0 +1,63 @@ +QT *= network + +INCLUDEPATH *= $$PWD + +HEADERS += \ + $$PWD/xmlprotocol/frame.h \ + $$PWD/xmlprotocol/parser.h \ + $$PWD/xmlprotocol/error.h \ + $$PWD/xmlprotocol/status.h \ + $$PWD/xmlprotocol/suppression.h \ + $$PWD/xmlprotocol/threadedparser.h \ + $$PWD/xmlprotocol/announcethread.h \ + $$PWD/xmlprotocol/stack.h \ + $$PWD/xmlprotocol/errorlistmodel.h \ + $$PWD/xmlprotocol/stackmodel.h \ + $$PWD/xmlprotocol/modelhelpers.h \ + $$PWD/callgrind/callgrindparser.h \ + $$PWD/callgrind/callgrindparsedata.h \ + $$PWD/callgrind/callgrindfunction.h \ + $$PWD/callgrind/callgrindfunction_p.h \ + $$PWD/callgrind/callgrindfunctioncycle.h \ + $$PWD/callgrind/callgrindfunctioncall.h \ + $$PWD/callgrind/callgrindcostitem.h \ + $$PWD/callgrind/callgrinddatamodel.h \ + $$PWD/callgrind/callgrindabstractmodel.h \ + $$PWD/callgrind/callgrindcallmodel.h \ + $$PWD/callgrind/callgrindcontroller.h \ + $$PWD/callgrind/callgrindcycledetection.h \ + $$PWD/callgrind/callgrindproxymodel.h \ + $$PWD/callgrind/callgrindstackbrowser.h \ + $$PWD/callgrind/callgrindrunner.h \ + $$PWD/memcheck/memcheckrunner.h \ + $$PWD/valgrindrunner.h \ + $$PWD/valgrindprocess.h + +SOURCES += $$PWD/xmlprotocol/error.cpp \ + $$PWD/xmlprotocol/frame.cpp \ + $$PWD/xmlprotocol/parser.cpp \ + $$PWD/xmlprotocol/status.cpp \ + $$PWD/xmlprotocol/suppression.cpp \ + $$PWD/xmlprotocol/threadedparser.cpp \ + $$PWD/xmlprotocol/announcethread.cpp \ + $$PWD/xmlprotocol/stack.cpp \ + $$PWD/xmlprotocol/errorlistmodel.cpp \ + $$PWD/xmlprotocol/stackmodel.cpp \ + $$PWD/xmlprotocol/modelhelpers.cpp \ + $$PWD/callgrind/callgrindparser.cpp \ + $$PWD/callgrind/callgrindparsedata.cpp \ + $$PWD/callgrind/callgrindfunction.cpp \ + $$PWD/callgrind/callgrindfunctioncycle.cpp \ + $$PWD/callgrind/callgrindfunctioncall.cpp \ + $$PWD/callgrind/callgrindcostitem.cpp \ + $$PWD/callgrind/callgrindabstractmodel.cpp \ + $$PWD/callgrind/callgrinddatamodel.cpp \ + $$PWD/callgrind/callgrindcallmodel.cpp \ + $$PWD/callgrind/callgrindcontroller.cpp \ + $$PWD/callgrind/callgrindcycledetection.cpp \ + $$PWD/callgrind/callgrindproxymodel.cpp \ + $$PWD/callgrind/callgrindrunner.cpp \ + $$PWD/callgrind/callgrindstackbrowser.cpp \ + $$PWD/memcheck/memcheckrunner.cpp \ + $$PWD/valgrindrunner.cpp \ + $$PWD/valgrindprocess.cpp diff --git a/src/libs/valgrind/valgrindprocess.cpp b/src/plugins/valgrind/valgrind/valgrindprocess.cpp index c57877cd3d..b2da5551f2 100644 --- a/src/libs/valgrind/valgrindprocess.cpp +++ b/src/plugins/valgrind/valgrind/valgrindprocess.cpp @@ -40,6 +40,10 @@ #include <utils/qtcassert.h> +#ifdef Q_OS_WIN +# include <QtCore/qt_windows.h> +#endif + namespace Valgrind { ValgrindProcess::ValgrindProcess(QObject *parent) @@ -106,7 +110,11 @@ void LocalValgrindProcess::run(const QString &valgrindExecutable, const QStringL m_process.setCommand(valgrindExecutable, arguments); m_process.start(); m_process.waitForStarted(); +#ifdef Q_OS_WIN + m_pid = m_process.pid()->dwProcessId; +#else m_pid = m_process.pid(); +#endif } QString LocalValgrindProcess::errorString() const @@ -119,7 +127,7 @@ QProcess::ProcessError LocalValgrindProcess::error() const return m_process.error(); } -Q_PID LocalValgrindProcess::pid() const +qint64 LocalValgrindProcess::pid() const { return m_pid; } @@ -178,7 +186,8 @@ void RemoteValgrindProcess::run(const QString &valgrindExecutable, const QString this, SLOT(connected())); connect(m_connection.data(), SIGNAL(error(Utils::SshError)), this, SLOT(error(Utils::SshError))); - m_connection->connectToHost(); + if (m_connection->state() == Utils::SshConnection::Unconnected) + m_connection->connectToHost(); } else { connected(); } @@ -353,7 +362,7 @@ QString RemoteValgrindProcess::workingDirectory() const return m_workingDir; } -Q_PID RemoteValgrindProcess::pid() const +qint64 RemoteValgrindProcess::pid() const { return m_pid; } diff --git a/src/libs/valgrind/valgrindprocess.h b/src/plugins/valgrind/valgrind/valgrindprocess.h index 903f931ecd..f4230bcd58 100644 --- a/src/libs/valgrind/valgrindprocess.h +++ b/src/plugins/valgrind/valgrind/valgrindprocess.h @@ -35,8 +35,6 @@ #ifndef VALGRIND_RUNNER_P_H #define VALGRIND_RUNNER_P_H -#include "valgrind_global.h" - #include <utils/qtcprocess.h> #include <utils/ssh/sshremoteprocess.h> #include <utils/ssh/sshconnection.h> @@ -47,7 +45,7 @@ namespace Valgrind { /** * Abstract process that can be subclassed to supply local and remote valgrind runs */ -class VALGRINDSHARED_EXPORT ValgrindProcess : public QObject +class ValgrindProcess : public QObject { Q_OBJECT @@ -68,7 +66,7 @@ public: virtual QString workingDirectory() const = 0; virtual void setEnvironment(const Utils::Environment &environment) = 0; - virtual Q_PID pid() const = 0; + virtual qint64 pid() const = 0; signals: void started(); @@ -80,7 +78,7 @@ signals: /** * Run valgrind on the local machine */ -class VALGRINDSHARED_EXPORT LocalValgrindProcess : public ValgrindProcess +class LocalValgrindProcess : public ValgrindProcess { Q_OBJECT @@ -101,7 +99,7 @@ public: virtual QString workingDirectory() const; virtual void setEnvironment(const Utils::Environment &environment); - virtual Q_PID pid() const; + virtual qint64 pid() const; private slots: void readyReadStandardError(); @@ -109,13 +107,13 @@ private slots: private: Utils::QtcProcess m_process; - Q_PID m_pid; + qint64 m_pid; }; /** * Run valgrind on a remote machine via SSH */ -class VALGRINDSHARED_EXPORT RemoteValgrindProcess : public ValgrindProcess +class RemoteValgrindProcess : public ValgrindProcess { Q_OBJECT @@ -139,7 +137,7 @@ public: virtual QString workingDirectory() const; virtual void setEnvironment(const Utils::Environment &environment); - virtual Q_PID pid() const; + virtual qint64 pid() const; Utils::SshConnection::Ptr connection() const; @@ -163,7 +161,7 @@ private: QString m_debuggeeArgs; QString m_errorString; QProcess::ProcessError m_error; - Q_PID m_pid; + qint64 m_pid; Utils::SshRemoteProcess::Ptr m_findPID; }; diff --git a/src/libs/valgrind/valgrindrunner.cpp b/src/plugins/valgrind/valgrind/valgrindrunner.cpp index 8fdb69542e..8fdb69542e 100644 --- a/src/libs/valgrind/valgrindrunner.cpp +++ b/src/plugins/valgrind/valgrind/valgrindrunner.cpp diff --git a/src/libs/valgrind/valgrindrunner.h b/src/plugins/valgrind/valgrind/valgrindrunner.h index 09563533ca..3b866dfc54 100644 --- a/src/libs/valgrind/valgrindrunner.h +++ b/src/plugins/valgrind/valgrind/valgrindrunner.h @@ -38,8 +38,6 @@ #include <QtCore/QProcess> #include <utils/outputformat.h> -#include "valgrind_global.h" - namespace Utils { class Environment; class SshConnectionParameters; @@ -49,7 +47,7 @@ namespace Valgrind { class ValgrindProcess; -class VALGRINDSHARED_EXPORT ValgrindRunner : public QObject +class ValgrindRunner : public QObject { Q_OBJECT diff --git a/src/libs/valgrind/xmlprotocol/announcethread.cpp b/src/plugins/valgrind/valgrind/xmlprotocol/announcethread.cpp index c4219652b0..c4219652b0 100644 --- a/src/libs/valgrind/xmlprotocol/announcethread.cpp +++ b/src/plugins/valgrind/valgrind/xmlprotocol/announcethread.cpp diff --git a/src/libs/valgrind/xmlprotocol/announcethread.h b/src/plugins/valgrind/valgrind/xmlprotocol/announcethread.h index c46c90ebc5..529e798d87 100644 --- a/src/libs/valgrind/xmlprotocol/announcethread.h +++ b/src/plugins/valgrind/valgrind/xmlprotocol/announcethread.h @@ -35,8 +35,6 @@ #ifndef LIBVALGRIND_PROTOCOL_ANNOUNCETHREAD_H #define LIBVALGRIND_PROTOCOL_ANNOUNCETHREAD_H -#include "../valgrind_global.h" - #include <QtCore/QSharedDataPointer> QT_BEGIN_NAMESPACE @@ -48,7 +46,7 @@ namespace XmlProtocol { class Frame; -class VALGRINDSHARED_EXPORT AnnounceThread { +class AnnounceThread { public: AnnounceThread(); AnnounceThread(const AnnounceThread &other); diff --git a/src/libs/valgrind/xmlprotocol/error.cpp b/src/plugins/valgrind/valgrind/xmlprotocol/error.cpp index 3742456142..3742456142 100644 --- a/src/libs/valgrind/xmlprotocol/error.cpp +++ b/src/plugins/valgrind/valgrind/xmlprotocol/error.cpp diff --git a/src/libs/valgrind/xmlprotocol/error.h b/src/plugins/valgrind/valgrind/xmlprotocol/error.h index 4275924d4e..910098809d 100644 --- a/src/libs/valgrind/xmlprotocol/error.h +++ b/src/plugins/valgrind/valgrind/xmlprotocol/error.h @@ -35,8 +35,6 @@ #ifndef LIBVALGRIND_PROTOCOL_ERROR_H #define LIBVALGRIND_PROTOCOL_ERROR_H -#include "../valgrind_global.h" - #include <QtCore/QMetaType> #include <QtCore/QSharedDataPointer> @@ -94,7 +92,7 @@ enum HelgrindErrorKind Misc }; -class VALGRINDSHARED_EXPORT Error +class Error { public: Error(); diff --git a/src/libs/valgrind/xmlprotocol/errorlistmodel.cpp b/src/plugins/valgrind/valgrind/xmlprotocol/errorlistmodel.cpp index 08794bd742..08794bd742 100644 --- a/src/libs/valgrind/xmlprotocol/errorlistmodel.cpp +++ b/src/plugins/valgrind/valgrind/xmlprotocol/errorlistmodel.cpp diff --git a/src/libs/valgrind/xmlprotocol/errorlistmodel.h b/src/plugins/valgrind/valgrind/xmlprotocol/errorlistmodel.h index e524ab4ce9..fe758ed01a 100644 --- a/src/libs/valgrind/xmlprotocol/errorlistmodel.h +++ b/src/plugins/valgrind/valgrind/xmlprotocol/errorlistmodel.h @@ -35,8 +35,6 @@ #ifndef LIBVALGRIND_PROTOCOL_ERRORLISTMODEL_H #define LIBVALGRIND_PROTOCOL_ERRORLISTMODEL_H -#include "../valgrind_global.h" - #include <QtCore/QAbstractItemModel> #include <QtCore/QSharedPointer> @@ -46,7 +44,7 @@ namespace XmlProtocol { class Error; class Frame; -class VALGRINDSHARED_EXPORT ErrorListModel : public QAbstractItemModel +class ErrorListModel : public QAbstractItemModel { Q_OBJECT public: diff --git a/src/libs/valgrind/xmlprotocol/frame.cpp b/src/plugins/valgrind/valgrind/xmlprotocol/frame.cpp index 9b36a4a368..9b36a4a368 100644 --- a/src/libs/valgrind/xmlprotocol/frame.cpp +++ b/src/plugins/valgrind/valgrind/xmlprotocol/frame.cpp diff --git a/src/libs/valgrind/xmlprotocol/frame.h b/src/plugins/valgrind/valgrind/xmlprotocol/frame.h index 7bd3ebcedf..e7b5cd649a 100644 --- a/src/libs/valgrind/xmlprotocol/frame.h +++ b/src/plugins/valgrind/valgrind/xmlprotocol/frame.h @@ -35,14 +35,12 @@ #ifndef LIBVALGRIND_PROTOCOL_FRAME_H #define LIBVALGRIND_PROTOCOL_FRAME_H -#include "../valgrind_global.h" - #include <QtCore/QSharedDataPointer> namespace Valgrind { namespace XmlProtocol { -class VALGRINDSHARED_EXPORT Frame +class Frame { public: Frame(); diff --git a/src/libs/valgrind/xmlprotocol/modelhelpers.cpp b/src/plugins/valgrind/valgrind/xmlprotocol/modelhelpers.cpp index bb8151485b..bb8151485b 100644 --- a/src/libs/valgrind/xmlprotocol/modelhelpers.cpp +++ b/src/plugins/valgrind/valgrind/xmlprotocol/modelhelpers.cpp diff --git a/src/libs/valgrind/xmlprotocol/modelhelpers.h b/src/plugins/valgrind/valgrind/xmlprotocol/modelhelpers.h index 2792771841..6c2a57f155 100644 --- a/src/libs/valgrind/xmlprotocol/modelhelpers.h +++ b/src/plugins/valgrind/valgrind/xmlprotocol/modelhelpers.h @@ -35,7 +35,7 @@ #ifndef LIBVALGRIND_PROTOCOL_MODELHELPERS_H #define LIBVALGRIND_PROTOCOL_MODELHELPERS_H -#include "../valgrind_global.h" +#include <QtCore/QtGlobal> QT_BEGIN_NAMESPACE class QString; @@ -46,7 +46,7 @@ namespace XmlProtocol { class Frame; -VALGRINDSHARED_EXPORT QString toolTipForFrame(const Frame &frame); +QString toolTipForFrame(const Frame &frame); } // namespace XmlProtocol } // namespace Valgrind diff --git a/src/libs/valgrind/xmlprotocol/parser.cpp b/src/plugins/valgrind/valgrind/xmlprotocol/parser.cpp index 6d602c9602..6d602c9602 100644 --- a/src/libs/valgrind/xmlprotocol/parser.cpp +++ b/src/plugins/valgrind/valgrind/xmlprotocol/parser.cpp diff --git a/src/libs/valgrind/xmlprotocol/parser.h b/src/plugins/valgrind/valgrind/xmlprotocol/parser.h index ca68a0d69f..0fed01dad9 100644 --- a/src/libs/valgrind/xmlprotocol/parser.h +++ b/src/plugins/valgrind/valgrind/xmlprotocol/parser.h @@ -35,8 +35,6 @@ #ifndef LIBVALGRIND_PROTOCOL_PARSER_H #define LIBVALGRIND_PROTOCOL_PARSER_H -#include "../valgrind_global.h" - #include <QtCore/QObject> QT_BEGIN_NAMESPACE @@ -53,7 +51,7 @@ class Status; /** * Parser for the Valgrind Output XML Protocol 4 */ -class VALGRINDSHARED_EXPORT Parser : public QObject +class Parser : public QObject { Q_OBJECT diff --git a/src/libs/valgrind/xmlprotocol/stack.cpp b/src/plugins/valgrind/valgrind/xmlprotocol/stack.cpp index 8c2de28ff3..8c2de28ff3 100644 --- a/src/libs/valgrind/xmlprotocol/stack.cpp +++ b/src/plugins/valgrind/valgrind/xmlprotocol/stack.cpp diff --git a/src/libs/valgrind/xmlprotocol/stack.h b/src/plugins/valgrind/valgrind/xmlprotocol/stack.h index b26d733d79..72330007f1 100644 --- a/src/libs/valgrind/xmlprotocol/stack.h +++ b/src/plugins/valgrind/valgrind/xmlprotocol/stack.h @@ -35,8 +35,6 @@ #ifndef LIBVALGRIND_PROTOCOL_STACK_H #define LIBVALGRIND_PROTOCOL_STACK_H -#include "../valgrind_global.h" - #include <QtCore/QSharedDataPointer> QT_BEGIN_NAMESPACE @@ -48,7 +46,7 @@ namespace XmlProtocol { class Frame; -class VALGRINDSHARED_EXPORT Stack +class Stack { public: Stack(); diff --git a/src/libs/valgrind/xmlprotocol/stackmodel.cpp b/src/plugins/valgrind/valgrind/xmlprotocol/stackmodel.cpp index ef20cd940a..ef20cd940a 100644 --- a/src/libs/valgrind/xmlprotocol/stackmodel.cpp +++ b/src/plugins/valgrind/valgrind/xmlprotocol/stackmodel.cpp diff --git a/src/libs/valgrind/xmlprotocol/stackmodel.h b/src/plugins/valgrind/valgrind/xmlprotocol/stackmodel.h index e9e6662e3b..df6574fcd0 100644 --- a/src/libs/valgrind/xmlprotocol/stackmodel.h +++ b/src/plugins/valgrind/valgrind/xmlprotocol/stackmodel.h @@ -35,8 +35,6 @@ #ifndef LIBVALGRIND_PROTOCOL_STACKMODEL_H #define LIBVALGRIND_PROTOCOL_STACKMODEL_H -#include "../valgrind_global.h" - #include <QtCore/QAbstractItemModel> namespace Valgrind { @@ -44,7 +42,7 @@ namespace XmlProtocol { class Error; -class VALGRINDSHARED_EXPORT StackModel : public QAbstractItemModel +class StackModel : public QAbstractItemModel { Q_OBJECT public: diff --git a/src/libs/valgrind/xmlprotocol/status.cpp b/src/plugins/valgrind/valgrind/xmlprotocol/status.cpp index 2991dd3d2f..2991dd3d2f 100644 --- a/src/libs/valgrind/xmlprotocol/status.cpp +++ b/src/plugins/valgrind/valgrind/xmlprotocol/status.cpp diff --git a/src/libs/valgrind/xmlprotocol/status.h b/src/plugins/valgrind/valgrind/xmlprotocol/status.h index bc3def7264..1c1089d0e9 100644 --- a/src/libs/valgrind/xmlprotocol/status.h +++ b/src/plugins/valgrind/valgrind/xmlprotocol/status.h @@ -35,15 +35,13 @@ #ifndef LIBVALGRIND_PROTOCOL_STATUS_H #define LIBVALGRIND_PROTOCOL_STATUS_H -#include "../valgrind_global.h" - #include <QtCore/QMetaType> #include <QtCore/QSharedDataPointer> namespace Valgrind { namespace XmlProtocol { -class VALGRINDSHARED_EXPORT Status +class Status { public: enum State { diff --git a/src/libs/valgrind/xmlprotocol/suppression.cpp b/src/plugins/valgrind/valgrind/xmlprotocol/suppression.cpp index 3720c41999..3720c41999 100644 --- a/src/libs/valgrind/xmlprotocol/suppression.cpp +++ b/src/plugins/valgrind/valgrind/xmlprotocol/suppression.cpp diff --git a/src/libs/valgrind/xmlprotocol/suppression.h b/src/plugins/valgrind/valgrind/xmlprotocol/suppression.h index eb7456a6b9..82d781ff76 100644 --- a/src/libs/valgrind/xmlprotocol/suppression.h +++ b/src/plugins/valgrind/valgrind/xmlprotocol/suppression.h @@ -35,8 +35,6 @@ #ifndef LIBVALGRIND_PROTOCOL_SUPPRESSION_H #define LIBVALGRIND_PROTOCOL_SUPPRESSION_H -#include "../valgrind_global.h" - #include <QtCore/QSharedDataPointer> QT_BEGIN_NAMESPACE @@ -47,7 +45,7 @@ QT_END_NAMESPACE namespace Valgrind { namespace XmlProtocol { -class VALGRINDSHARED_EXPORT SuppressionFrame +class SuppressionFrame { public: SuppressionFrame(); @@ -76,7 +74,7 @@ private: typedef QVector<SuppressionFrame> SuppressionFrames; -class VALGRINDSHARED_EXPORT Suppression +class Suppression { public: Suppression(); diff --git a/src/libs/valgrind/xmlprotocol/threadedparser.cpp b/src/plugins/valgrind/valgrind/xmlprotocol/threadedparser.cpp index 29968356af..29968356af 100644 --- a/src/libs/valgrind/xmlprotocol/threadedparser.cpp +++ b/src/plugins/valgrind/valgrind/xmlprotocol/threadedparser.cpp diff --git a/src/libs/valgrind/xmlprotocol/threadedparser.h b/src/plugins/valgrind/valgrind/xmlprotocol/threadedparser.h index 0cb274fa8d..49d6d11509 100644 --- a/src/libs/valgrind/xmlprotocol/threadedparser.h +++ b/src/plugins/valgrind/valgrind/xmlprotocol/threadedparser.h @@ -35,8 +35,6 @@ #ifndef LIBVALGRIND_PROTOCOL_THREADEDPARSER_H #define LIBVALGRIND_PROTOCOL_THREADEDPARSER_H -#include "../valgrind_global.h" - #include <QtCore/QObject> QT_BEGIN_NAMESPACE @@ -52,7 +50,7 @@ class Status; /** * ThreadedParser for the Valgrind Output XmlProtocol 4 */ -class VALGRINDSHARED_EXPORT ThreadedParser : public QObject +class ThreadedParser : public QObject { Q_OBJECT diff --git a/src/plugins/valgrind/valgrind_dependencies.pri b/src/plugins/valgrind/valgrind_dependencies.pri index 04786e9e89..b6b5ec7ed6 100644 --- a/src/plugins/valgrind/valgrind_dependencies.pri +++ b/src/plugins/valgrind/valgrind_dependencies.pri @@ -2,3 +2,4 @@ include(../../libs/cplusplus/cplusplus.pri) include(../../plugins/analyzerbase/analyzerbase.pri) include(../../plugins/coreplugin/coreplugin.pri) include(../../plugins/texteditor/texteditor.pri) +include(../../libs/utils/utils.pri) diff --git a/src/plugins/valgrind/valgrind_global.h b/src/plugins/valgrind/valgrind_global.h deleted file mode 100644 index 27ce52a837..0000000000 --- a/src/plugins/valgrind/valgrind_global.h +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@kdab.com) -** -** Contact: Nokia Corporation (info@qt.nokia.com) -** -** -** GNU Lesser General Public License Usage -** -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** Other Usage -** -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** If you have questions regarding the use of this file, please contact -** Nokia at info@qt.nokia.com. -** -**************************************************************************/ - -#ifndef VALGRINDTOOLBASE_GLOBAL_H -#define VALGRINDTOOLBASE_GLOBAL_H - -#include <QtCore/qglobal.h> - -#if defined(VALGRINDTOOLBASE_LIBRARY) -# define VALGRINDTOOLBASE_EXPORT Q_DECL_EXPORT -#else -# define VALGRINDTOOLBASE_EXPORT Q_DECL_IMPORT -#endif - -#endif // VALGRINDTOOLBASE_GLOBAL_H diff --git a/src/plugins/valgrind/valgrindengine.cpp b/src/plugins/valgrind/valgrindengine.cpp index e4cddcfd89..3b7279d6fc 100644 --- a/src/plugins/valgrind/valgrindengine.cpp +++ b/src/plugins/valgrind/valgrindengine.cpp @@ -52,9 +52,9 @@ using namespace Analyzer; using namespace Valgrind::Internal; using namespace Utils; -ValgrindEngine::ValgrindEngine(const AnalyzerStartParameters &sp, - ProjectExplorer::RunConfiguration *runConfiguration) - : IAnalyzerEngine(sp, runConfiguration), +ValgrindEngine::ValgrindEngine(IAnalyzerTool *tool, const AnalyzerStartParameters &sp, + ProjectExplorer::RunConfiguration *runConfiguration) + : IAnalyzerEngine(tool, sp, runConfiguration), m_settings(0), m_progress(new QFutureInterface<void>()), m_progressWatcher(new QFutureWatcher<void>()), @@ -130,7 +130,7 @@ QString ValgrindEngine::executable() const void ValgrindEngine::handleProgressCanceled() { - AnalyzerManager::instance()->stopTool(); + AnalyzerManager::stopTool(); } void ValgrindEngine::handleProgressFinished() diff --git a/src/plugins/valgrind/valgrindengine.h b/src/plugins/valgrind/valgrindengine.h index 2a790a59ed..72901fe648 100644 --- a/src/plugins/valgrind/valgrindengine.h +++ b/src/plugins/valgrind/valgrindengine.h @@ -35,9 +35,6 @@ #ifndef VALGRINDENGINE_H #define VALGRINDENGINE_H -#include "valgrind_global.h" - -#include <analyzerbase/ianalyzerengine.h> #include <analyzerbase/ianalyzerengine.h> #include <utils/environment.h> @@ -56,13 +53,15 @@ class AnalyzerSettings; namespace Valgrind { namespace Internal { -class VALGRINDTOOLBASE_EXPORT ValgrindEngine : public Analyzer::IAnalyzerEngine +class ValgrindEngine : public Analyzer::IAnalyzerEngine { Q_OBJECT + public: - explicit ValgrindEngine(const Analyzer::AnalyzerStartParameters &sp, - ProjectExplorer::RunConfiguration *runConfiguration); - virtual ~ValgrindEngine(); + ValgrindEngine(Analyzer::IAnalyzerTool *tool, + const Analyzer::AnalyzerStartParameters &sp, + ProjectExplorer::RunConfiguration *runConfiguration); + ~ValgrindEngine(); void start(); void stop(); diff --git a/src/plugins/valgrind/valgrindplugin.cpp b/src/plugins/valgrind/valgrindplugin.cpp index e9f13d0265..86ac42e97f 100644 --- a/src/plugins/valgrind/valgrindplugin.cpp +++ b/src/plugins/valgrind/valgrindplugin.cpp @@ -33,21 +33,171 @@ **************************************************************************/ #include "valgrindplugin.h" -#include "valgrindsettings.h" -#include "callgrindtool.h" + #include "callgrindsettings.h" -#include "memchecktool.h" +#include "callgrindtool.h" #include "memchecksettings.h" +#include "memchecktool.h" +#include "valgrindsettings.h" -#include <analyzerbase/analyzersettings.h> +#include <analyzerbase/analyzerconstants.h> #include <analyzerbase/analyzermanager.h> +#include <analyzerbase/analyzerrunconfigwidget.h> +#include <analyzerbase/analyzerruncontrol.h> +#include <analyzerbase/analyzersettings.h> +#include <analyzerbase/analyzerstartparameters.h> +#include <analyzerbase/startremotedialog.h> + +#include <projectexplorer/applicationrunconfiguration.h> +#include <projectexplorer/projectexplorer.h> + +#include <remotelinux/linuxdeviceconfiguration.h> +#include <remotelinux/remotelinuxrunconfiguration.h> +#include <utils/qtcassert.h> + +#include <QtCore/QDebug> #include <QtCore/QStringList> #include <QtCore/QtPlugin> +#include <QtGui/QAction> using namespace Analyzer; using namespace Valgrind::Internal; +using namespace ProjectExplorer; + +///////////////////////////////////////////////////////////////////////////////// +// +// ValgrindRunControlFactory +// +///////////////////////////////////////////////////////////////////////////////// + +namespace Valgrind { +namespace Internal { +class ValgrindRunControlFactory : public ProjectExplorer::IRunControlFactory +{ + Q_OBJECT + +public: + ValgrindRunControlFactory(QObject *parent = 0); + + // IRunControlFactory + bool canRun(RunConfiguration *runConfiguration, const QString &mode) const; + RunControl *create(RunConfiguration *runConfiguration, const QString &mode); + QString displayName() const; + + IRunConfigurationAspect *createRunConfigurationAspect(); + RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration); +}; + +ValgrindRunControlFactory::ValgrindRunControlFactory(QObject *parent) + : IRunControlFactory(parent) +{ + setObjectName(QLatin1String("ValgrindRunControlFactory")); +} + +bool ValgrindRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const +{ + Q_UNUSED(runConfiguration); + return mode.startsWith("Callgrind") || mode.startsWith("Memcheck"); +} + +RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration, const QString &mode) +{ + QTC_ASSERT(canRun(runConfiguration, mode), return 0); + + AnalyzerStartParameters sp; + if (LocalApplicationRunConfiguration *rc1 = + qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) { + sp.startMode = StartLocal; + sp.environment = rc1->environment(); + sp.workingDirectory = rc1->workingDirectory(); + sp.debuggee = rc1->executable(); + sp.debuggeeArgs = rc1->commandLineArguments(); + sp.displayName = rc1->displayName(); + sp.connParams.host = QLatin1String("localhost"); + sp.connParams.port = rc1->qmlDebugServerPort(); + } else if (RemoteLinux::RemoteLinuxRunConfiguration *rc2 = + qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) { + sp.startMode = StartRemote; + sp.debuggee = rc2->remoteExecutableFilePath(); + sp.debuggeeArgs = rc2->arguments(); + sp.connParams = rc2->deviceConfig()->sshParameters(); + sp.analyzerCmdPrefix = rc2->commandPrefix(); + sp.displayName = rc2->displayName(); + } else { + // Might be S60DeviceRunfiguration, or something else ... + //sp.startMode = StartRemote; + sp.startMode = StartRemote; + } + + IAnalyzerTool *tool = AnalyzerManager::toolFromId(mode.toLatin1()); + AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, runConfiguration); + QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt())); + return rc; +} + +QString ValgrindRunControlFactory::displayName() const +{ + return tr("Analyzer"); +} + +IRunConfigurationAspect *ValgrindRunControlFactory::createRunConfigurationAspect() +{ + return new AnalyzerProjectSettings; +} + +RunConfigWidget *ValgrindRunControlFactory::createConfigurationWidget(RunConfiguration *runConfiguration) +{ + LocalApplicationRunConfiguration *localRc = + qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration); + if (!localRc) + return 0; + AnalyzerProjectSettings *settings = runConfiguration->extraAspect<AnalyzerProjectSettings>(); + if (!settings) + return 0; + + AnalyzerRunConfigWidget *ret = new AnalyzerRunConfigWidget; + ret->setRunConfiguration(runConfiguration); + return ret; +} + +///////////////////////////////////////////////////////////////////////////////// +// +// ValgrindPlugin +// +///////////////////////////////////////////////////////////////////////////////// + +static void startRemoteTool(IAnalyzerTool *tool, StartMode mode) +{ + Q_UNUSED(tool); + StartRemoteDialog dlg; + if (dlg.exec() != QDialog::Accepted) + return; + + AnalyzerStartParameters sp; + sp.toolId = tool->id(); + sp.startMode = mode; + sp.connParams = dlg.sshParams(); + sp.debuggee = dlg.executable(); + sp.debuggeeArgs = dlg.arguments(); + sp.displayName = dlg.executable(); + sp.workingDirectory = dlg.workingDirectory(); + + AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, 0); + //m_currentRunControl = rc; + QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt())); + + ProjectExplorerPlugin::instance()->startRunControl(rc, tool->id()); +} + +void ValgrindPlugin::startValgrindTool(IAnalyzerTool *tool, StartMode mode) +{ + if (mode == StartLocal) + AnalyzerManager::startLocalTool(tool, mode); + if (mode == StartRemote) + startRemoteTool(tool, mode); +} static AbstractAnalyzerSubConfig *valgrindConfigFactory() { @@ -80,14 +230,25 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *) AnalyzerGlobalSettings::instance()->registerSubConfigs(&globalCallgrindFactory, &projectCallgrindFactory); AnalyzerGlobalSettings::instance()->registerSubConfigs(&globalMemcheckFactory, &projectMemcheckFactory); - AnalyzerManager::instance()->addTool(new MemcheckTool(this)); - AnalyzerManager::instance()->addTool(new CallgrindTool(this)); + StartModes modes; +#ifndef Q_OS_WIN + modes.append(StartMode(StartLocal)); +#endif + modes.append(StartMode(StartRemote)); + + AnalyzerManager::addTool(new MemcheckTool(this), modes); + AnalyzerManager::addTool(new CallgrindTool(this), modes); + + ValgrindRunControlFactory *factory = new ValgrindRunControlFactory(); + addAutoReleasedObject(factory); + return true; } +} // namespace Internal +} // namespace Valgrind -void ValgrindPlugin::extensionsInitialized() -{ -} Q_EXPORT_PLUGIN(Valgrind::Internal::ValgrindPlugin) + +#include "valgrindplugin.moc" diff --git a/src/plugins/valgrind/valgrindplugin.h b/src/plugins/valgrind/valgrindplugin.h index 6dee7dd544..9598572bd3 100644 --- a/src/plugins/valgrind/valgrindplugin.h +++ b/src/plugins/valgrind/valgrindplugin.h @@ -36,6 +36,7 @@ #define VALGRINDTOOLBASEPLUGIN_H #include <extensionsystem/iplugin.h> +#include <analyzerbase/ianalyzertool.h> namespace Valgrind { namespace Internal { @@ -48,7 +49,9 @@ public: ValgrindPlugin() {} virtual bool initialize(const QStringList &arguments, QString *errorString); - virtual void extensionsInitialized(); + virtual void extensionsInitialized() {} + + static void startValgrindTool(Analyzer::IAnalyzerTool *tool, Analyzer::StartMode mode); }; } // namespace Internal diff --git a/src/plugins/valgrind/valgrindsettings.h b/src/plugins/valgrind/valgrindsettings.h index c01fc74595..0e4b5dfe38 100644 --- a/src/plugins/valgrind/valgrindsettings.h +++ b/src/plugins/valgrind/valgrindsettings.h @@ -35,8 +35,6 @@ #ifndef ANALYZER_INTERNAL_VALGRINDSETTINGS_H #define ANALYZER_INTERNAL_VALGRINDSETTINGS_H -#include "valgrind_global.h" - #include <analyzerbase/analyzersettings.h> #include <QtCore/QObject> @@ -48,7 +46,7 @@ namespace Internal { /** * Generic Valgrind settings shared by all tools. */ -class VALGRINDTOOLBASE_EXPORT ValgrindSettings : public Analyzer::AbstractAnalyzerSubConfig +class ValgrindSettings : public Analyzer::AbstractAnalyzerSubConfig { Q_OBJECT public: diff --git a/src/plugins/welcome/images/center_frame_header.png b/src/plugins/welcome/images/center_frame_header.png Binary files differindex 4d840b48f9..ce88366718 100644 --- a/src/plugins/welcome/images/center_frame_header.png +++ b/src/plugins/welcome/images/center_frame_header.png diff --git a/src/plugins/welcome/welcomeplugin.cpp b/src/plugins/welcome/welcomeplugin.cpp index 2c6e2b6e6e..0196bda808 100644 --- a/src/plugins/welcome/welcomeplugin.cpp +++ b/src/plugins/welcome/welcomeplugin.cpp @@ -97,6 +97,8 @@ public: void initPlugins(); int activePlugin() const { return m_activePlugin; } + Q_SCRIPTABLE QString platform() const; + public slots: void sendFeedback(); void newProject(); @@ -182,6 +184,7 @@ void WelcomeMode::initPlugins() QDeclarativeEngine *engine = m_welcomePage->engine(); engine->setNetworkAccessManagerFactory(new NetworkAccessManagerFactory); + engine->addImportPath(Core::ICore::instance()->resourcePath() + "/welcomescreen"); foreach (Utils::IWelcomePage *plugin, plugins) { plugin->facilitateQml(engine); m_pluginList.append(plugin); @@ -194,6 +197,21 @@ void WelcomeMode::initPlugins() QUrl::fromLocalFile(Core::ICore::instance()->resourcePath() + "/welcomescreen/welcomescreen.qml")); } +QString WelcomeMode::platform() const +{ +#if defined(Q_OS_WIN) + return QLatin1String("windows"); +#elif defined(Q_OS_MAC) + return QLatin1String("mac"); +#elif defined(Q_OS_LINUX) + return QLatin1String("linux"); +#elif defined(Q_OS_UNIX) + return QLatin1String("unix"); +#else + return QLatin1String("other") +#endif +} + void WelcomeMode::welcomePluginAdded(QObject *obj) { if (Utils::IWelcomePage *plugin = qobject_cast<Utils::IWelcomePage*>(obj)) { diff --git a/src/shared/qrceditor/test/main.cpp b/src/shared/qrceditor/test/main.cpp index 7d1ce834b8..964abe9ba8 100644 --- a/src/shared/qrceditor/test/main.cpp +++ b/src/shared/qrceditor/test/main.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/shared/qrceditor/test/mainwindow.cpp b/src/shared/qrceditor/test/mainwindow.cpp index 6593687136..0b52d2ae4b 100644 --- a/src/shared/qrceditor/test/mainwindow.cpp +++ b/src/shared/qrceditor/test/mainwindow.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/shared/qrceditor/test/mainwindow.h b/src/shared/qrceditor/test/mainwindow.h index 7b9d5a88df..f5555ca99a 100644 --- a/src/shared/qrceditor/test/mainwindow.h +++ b/src/shared/qrceditor/test/mainwindow.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/shared/qtcreator_gui_pch.h b/src/shared/qtcreator_gui_pch.h index 07274b2407..9402640d26 100644 --- a/src/shared/qtcreator_gui_pch.h +++ b/src/shared/qtcreator_gui_pch.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/shared/qtcreator_pch.h b/src/shared/qtcreator_pch.h index 56e395ebcb..6ce7c9c5be 100644 --- a/src/shared/qtcreator_pch.h +++ b/src/shared/qtcreator_pch.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/shared/qtsingleapplication/qtsinglecoreapplication.cpp b/src/shared/qtsingleapplication/qtsinglecoreapplication.cpp index f988a62f8a..60dbb66aed 100644 --- a/src/shared/qtsingleapplication/qtsinglecoreapplication.cpp +++ b/src/shared/qtsingleapplication/qtsinglecoreapplication.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/shared/qtsingleapplication/qtsinglecoreapplication.h b/src/shared/qtsingleapplication/qtsinglecoreapplication.h index b51998bb12..d8817749c7 100644 --- a/src/shared/qtsingleapplication/qtsinglecoreapplication.h +++ b/src/shared/qtsingleapplication/qtsinglecoreapplication.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/shared/scriptwrapper/interface_wrap_helpers.h b/src/shared/scriptwrapper/interface_wrap_helpers.h index cee2a4e9b1..2ef7e0b669 100644 --- a/src/shared/scriptwrapper/interface_wrap_helpers.h +++ b/src/shared/scriptwrapper/interface_wrap_helpers.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/tools/examplesscanner/helpextractor.cpp b/src/tools/examplesscanner/helpextractor.cpp index 7fad855197..741d3b9cb8 100644 --- a/src/tools/examplesscanner/helpextractor.cpp +++ b/src/tools/examplesscanner/helpextractor.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include "helpextractor.h" #include <QtGui> diff --git a/src/tools/examplesscanner/helpextractor.h b/src/tools/examplesscanner/helpextractor.h index 4210a6635d..c81578a814 100644 --- a/src/tools/examplesscanner/helpextractor.h +++ b/src/tools/examplesscanner/helpextractor.h @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #ifndef HELPEXTRACTOR_H #define HELPEXTRACTOR_H diff --git a/src/tools/examplesscanner/main.cpp b/src/tools/examplesscanner/main.cpp index 5c47a9788b..b958eadafe 100644 --- a/src/tools/examplesscanner/main.cpp +++ b/src/tools/examplesscanner/main.cpp @@ -1,3 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ + #include <QtCore> #include "helpextractor.h" diff --git a/src/tools/gen-cpp-ast/generate-ast.cpp b/src/tools/gen-cpp-ast/generate-ast.cpp index ef50686a5f..012b35cfa9 100644 --- a/src/tools/gen-cpp-ast/generate-ast.cpp +++ b/src/tools/gen-cpp-ast/generate-ast.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/tools/makespy/main.cpp b/src/tools/makespy/main.cpp index d4056652cf..55c17b9bfb 100644 --- a/src/tools/makespy/main.cpp +++ b/src/tools/makespy/main.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/tools/mkvisitor/main.cpp b/src/tools/mkvisitor/main.cpp index 7b3b46bb4b..1d61e67bfa 100644 --- a/src/tools/mkvisitor/main.cpp +++ b/src/tools/mkvisitor/main.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/tools/qpatch/qpatch.cpp b/src/tools/qpatch/qpatch.cpp index 1e3fb49104..a4362849d1 100644 --- a/src/tools/qpatch/qpatch.cpp +++ b/src/tools/qpatch/qpatch.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/tools/qtcreatorwidgets/customwidget.h b/src/tools/qtcreatorwidgets/customwidget.h index 242e542cd2..a71ff7448b 100644 --- a/src/tools/qtcreatorwidgets/customwidget.h +++ b/src/tools/qtcreatorwidgets/customwidget.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/tools/qtcreatorwidgets/customwidgets.cpp b/src/tools/qtcreatorwidgets/customwidgets.cpp index 266ef52345..ac4f2f68f3 100644 --- a/src/tools/qtcreatorwidgets/customwidgets.cpp +++ b/src/tools/qtcreatorwidgets/customwidgets.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/tools/qtcreatorwidgets/customwidgets.h b/src/tools/qtcreatorwidgets/customwidgets.h index 6c62f43c09..2fbee7448a 100644 --- a/src/tools/qtcreatorwidgets/customwidgets.h +++ b/src/tools/qtcreatorwidgets/customwidgets.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/tools/qtlibspatcher/binpatch.cpp b/src/tools/qtlibspatcher/binpatch.cpp index ce20038684..5a6ff176c4 100644 --- a/src/tools/qtlibspatcher/binpatch.cpp +++ b/src/tools/qtlibspatcher/binpatch.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/tools/qtlibspatcher/binpatch.h b/src/tools/qtlibspatcher/binpatch.h index 04f2a2b91a..40e4dad799 100644 --- a/src/tools/qtlibspatcher/binpatch.h +++ b/src/tools/qtlibspatcher/binpatch.h @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/tools/qtlibspatcher/qtlibspatchermain.cpp b/src/tools/qtlibspatcher/qtlibspatchermain.cpp index 41b930aeda..c752d937c2 100644 --- a/src/tools/qtlibspatcher/qtlibspatchermain.cpp +++ b/src/tools/qtlibspatcher/qtlibspatchermain.cpp @@ -26,7 +26,7 @@ ** conditions contained in a signed written agreement between you and Nokia. ** ** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. +** Nokia at info@qt.nokia.com. ** **************************************************************************/ diff --git a/src/tools/qtpromaker/main.cpp b/src/tools/qtpromaker/main.cpp index 4c6e28cf58..beed3bd4ca 100644 --- a/src/tools/qtpromaker/main.cpp +++ b/src/tools/qtpromaker/main.cpp @@ -1,3 +1,34 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at info@qt.nokia.com. +** +**************************************************************************/ #include <QCoreApplication> #include <QDebug> |
