diff options
author | Erik Verbruggen <erik.verbruggen@nokia.com> | 2009-07-16 09:43:30 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@nokia.com> | 2009-07-16 09:43:30 +0200 |
commit | 519a1a97b32ea145286ebcc71de9ec987ec4fa00 (patch) | |
tree | 265fe755b8ad4ac9f41153bb4f2713e1c12b5de5 /src | |
parent | c8f155c0fc2fd64f01d50f6c085dd811cfdae17e (diff) | |
parent | fc33e35554fb93dbd2ceabd4f8a60b90cc7fce0e (diff) | |
download | qt-creator-519a1a97b32ea145286ebcc71de9ec987ec4fa00.tar.gz |
Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline
Diffstat (limited to 'src')
113 files changed, 5508 insertions, 1445 deletions
diff --git a/src/app/Info.plist b/src/app/Info.plist index 5e8617cc86..5e1fac5c84 100644 --- a/src/app/Info.plist +++ b/src/app/Info.plist @@ -8,7 +8,7 @@ <key>CFBundleTypeRole</key> <string>Editor</string> <key>CFBundleTypeIconFile</key> - <string>qtcreator.icns</string> + <string>profile.icns</string> <key>CFBundleTypeExtensions</key> <array> <string>pro</string> @@ -21,6 +21,8 @@ <dict> <key>CFBundleTypeRole</key> <string>Editor</string> + <key>CFBundleTypeIconFile</key> + <string>profile.icns</string> <key>CFBundleTypeExtensions</key> <array> <string>pri</string> @@ -47,7 +49,7 @@ <string>Editor</string> <key>CFBundleTypeExtensions</key> <array> - <string>pri</string> + <string>ui</string> </array> <key>CFBundleTypeName</key> <string>Qt UI File</string> diff --git a/src/app/app.pro b/src/app/app.pro index 4f29e1f263..69e34dbc78 100644 --- a/src/app/app.pro +++ b/src/app/app.pro @@ -20,6 +20,9 @@ win32 { ICON = qtcreator.icns QMAKE_INFO_PLIST = Info.plist + FILETYPES.files = profile.icns prifile.icns + FILETYPES.path = Contents/Resources + QMAKE_BUNDLE_DATA += FILETYPES } else { LIBS *= -lExtensionSystem -lAggregation diff --git a/src/app/prifile.icns b/src/app/prifile.icns Binary files differnew file mode 100644 index 0000000000..96386a70aa --- /dev/null +++ b/src/app/prifile.icns diff --git a/src/app/profile.icns b/src/app/profile.icns Binary files differnew file mode 100644 index 0000000000..40a881dac9 --- /dev/null +++ b/src/app/profile.icns diff --git a/src/libs/utils/filesearch.cpp b/src/libs/utils/filesearch.cpp index 2676d06c69..109e4248f2 100644 --- a/src/libs/utils/filesearch.cpp +++ b/src/libs/utils/filesearch.cpp @@ -31,7 +31,6 @@ #include <cctype> #include <QtCore/QFile> -#include <QtCore/QDir> #include <QtCore/QFutureInterface> #include <QtCore/QtConcurrentRun> #include <QtCore/QRegExp> @@ -158,7 +157,7 @@ void runFileSearch(QFutureInterface<FileSearchResult> &future, int n = 0; while (startOfLastLine[i] != '\n' && startOfLastLine[i] != '\r' && i < textLength && n++ < 256) res.append(startOfLastLine[i++]); - future.reportResult(FileSearchResult(QDir::toNativeSeparators(s), lineNr, QString(res), + future.reportResult(FileSearchResult(s, lineNr, QString(res), regionPtr - startOfLastLine, sa.length())); ++numMatches; } @@ -204,7 +203,7 @@ void runFileSearchRegExp(QFutureInterface<FileSearchResult> &future, line = stream.readLine(); int pos = 0; while ((pos = expression.indexIn(line, pos)) != -1) { - future.reportResult(FileSearchResult(QDir::toNativeSeparators(s), lineNr, line, + future.reportResult(FileSearchResult(s, lineNr, line, pos, expression.matchedLength())); pos += expression.matchedLength(); } diff --git a/src/libs/utils/styledbar.cpp b/src/libs/utils/styledbar.cpp new file mode 100644 index 0000000000..39326a17cb --- /dev/null +++ b/src/libs/utils/styledbar.cpp @@ -0,0 +1,65 @@ +#include "styledbar.h" + +#include "stylehelper.h" + +#include <QtCore/QVariant> +#include <QtGui/QPainter> +#include <QtGui/QPixmapCache> + +using namespace Core::Utils; + +StyledBar::StyledBar(QWidget *parent) + : QWidget(parent) +{ + setProperty("panelwidget", true); +} + +void StyledBar::paintEvent(QPaintEvent *event) +{ + // Currently from the style + // Goal should be to migrate that into a Utils::StyledWidget class + Q_UNUSED(event) + QPainter painter(this); + + QRect selfRect = rect(); + QString key; + key.sprintf("mh_toolbar %d %d %d", selfRect.width(), selfRect.height(), StyleHelper::baseColor().rgb());; + + QPixmap pixmap; + QPainter *p = &painter; + if (StyleHelper::usePixmapCache() && !QPixmapCache::find(key, pixmap)) { + pixmap = QPixmap(selfRect.size()); + p = new QPainter(&pixmap); + selfRect = QRect(0, 0, selfRect.width(), selfRect.height()); + } + + // Map offset for global window gradient + QPoint offset = window()->mapToGlobal(selfRect.topLeft()) - + mapToGlobal(selfRect.topLeft()); + QRect gradientSpan; + gradientSpan = QRect(offset, window()->size()); + StyleHelper::horizontalGradient(p, gradientSpan, selfRect); + + p->setPen(StyleHelper::borderColor()); + + // Note: This is a hack to determine if the + // toolbar should draw the top or bottom outline + // (needed for the find toolbar for instance) + QColor lighter(255, 255, 255, 40); + if (property("topBorder").toBool()) { + p->drawLine(selfRect.topLeft(), selfRect.topRight()); + p->setPen(lighter); + p->drawLine(selfRect.topLeft() + QPoint(0, 1), selfRect.topRight() + QPoint(0, 1)); + } else { + p->drawLine(selfRect.bottomLeft(), selfRect.bottomRight()); + p->setPen(lighter); + p->drawLine(selfRect.topLeft(), selfRect.topRight()); + } + + if (StyleHelper::usePixmapCache() && !QPixmapCache::find(key, pixmap)) { + painter.drawPixmap(selfRect.topLeft(), pixmap); + p->end(); + delete p; + QPixmapCache::insert(key, pixmap); + } +} diff --git a/src/libs/utils/styledbar.h b/src/libs/utils/styledbar.h new file mode 100644 index 0000000000..6b93ffe556 --- /dev/null +++ b/src/libs/utils/styledbar.h @@ -0,0 +1,23 @@ +#ifndef STYLEDBAR_H +#define STYLEDBAR_H + +#include "utils_global.h" + +#include <QtGui/QWidget> + +namespace Core { +namespace Utils { + +class QTCREATOR_UTILS_EXPORT StyledBar : public QWidget +{ +public: + StyledBar(QWidget *parent = 0); + +protected: + void paintEvent(QPaintEvent *event); +}; + +} // Utils +} // Core + +#endif // STYLEDBAR_H diff --git a/src/plugins/coreplugin/stylehelper.cpp b/src/libs/utils/stylehelper.cpp index 01f5b6371d..01f5b6371d 100644 --- a/src/plugins/coreplugin/stylehelper.cpp +++ b/src/libs/utils/stylehelper.cpp diff --git a/src/plugins/coreplugin/stylehelper.h b/src/libs/utils/stylehelper.h index 4c29af0253..e42ab67bcd 100644 --- a/src/plugins/coreplugin/stylehelper.h +++ b/src/libs/utils/stylehelper.h @@ -30,7 +30,7 @@ #ifndef STYLEHELPER_H #define STYLEHELPER_H -#include "core_global.h" +#include "utils_global.h" #include <QtCore/QRect> #include <QtGui/QPainter> @@ -40,7 +40,7 @@ // Helper class holding all custom color values -class CORE_EXPORT StyleHelper +class QTCREATOR_UTILS_EXPORT StyleHelper { public: // Height of the project explorer navigation bar diff --git a/src/libs/utils/utils.pro b/src/libs/utils/utils.pro index a52697f890..4efe18705b 100644 --- a/src/libs/utils/utils.pro +++ b/src/libs/utils/utils.pro @@ -29,7 +29,10 @@ SOURCES += reloadpromptutils.cpp \ uncommentselection.cpp \ parameteraction.cpp \ treewidgetcolumnstretcher.cpp \ - checkablemessagebox.cpp + checkablemessagebox.cpp \ + styledbar.cpp \ + stylehelper.cpp + win32 { SOURCES += abstractprocess_win.cpp \ consoleprocess_win.cpp \ @@ -66,7 +69,10 @@ HEADERS += utils_global.h \ parameteraction.h \ treewidgetcolumnstretcher.h \ checkablemessagebox.h \ - qtcassert.h + qtcassert.h \ + styledbar.h \ + stylehelper.h + FORMS += filewizardpage.ui \ projectintropage.ui \ newclasswidget.ui \ diff --git a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp index ae30132b3b..40767c41ba 100644 --- a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp @@ -170,6 +170,12 @@ QString CMakeRunConfiguration::dumperLibrary() const return dhl; } +QStringList CMakeRunConfiguration::dumperLibraryLocations() const +{ + QString qmakePath = ProjectExplorer::DebuggingHelperLibrary::findSystemQt(environment()); + return ProjectExplorer::DebuggingHelperLibrary::debuggingHelperLibraryLocations(qmakePath); +} + ProjectExplorer::Environment CMakeRunConfiguration::baseEnvironment() const { ProjectExplorer::Environment env; diff --git a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h index 57c09a3e4a..35be599c57 100644 --- a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h +++ b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h @@ -70,6 +70,7 @@ public: virtual void save(ProjectExplorer::PersistentSettingsWriter &writer) const; virtual void restore(const ProjectExplorer::PersistentSettingsReader &reader); virtual QString dumperLibrary() const; + virtual QStringList dumperLibraryLocations() const; virtual ProjectExplorer::ToolChain::ToolChainType toolChainType() const; signals: diff --git a/src/plugins/coreplugin/coreplugin.pro b/src/plugins/coreplugin/coreplugin.pro index ae1874438f..fbe1d6cc64 100644 --- a/src/plugins/coreplugin/coreplugin.pro +++ b/src/plugins/coreplugin/coreplugin.pro @@ -65,7 +65,6 @@ SOURCES += mainwindow.cpp \ coreimpl.cpp \ basefilewizard.cpp \ plugindialog.cpp \ - stylehelper.cpp \ inavigationwidgetfactory.cpp \ navigationwidget.cpp \ manhattanstyle.cpp \ @@ -150,7 +149,6 @@ HEADERS += mainwindow.h \ coreimpl.h \ basefilewizard.h \ plugindialog.h \ - stylehelper.h \ inavigationwidgetfactory.h \ navigationwidget.h \ manhattanstyle.h \ diff --git a/src/plugins/coreplugin/fancytabwidget.cpp b/src/plugins/coreplugin/fancytabwidget.cpp index cbd669d023..1767b88feb 100644 --- a/src/plugins/coreplugin/fancytabwidget.cpp +++ b/src/plugins/coreplugin/fancytabwidget.cpp @@ -28,7 +28,7 @@ **************************************************************************/ #include "fancytabwidget.h" -#include "stylehelper.h" +#include <utils/stylehelper.h> #include <QDebug> diff --git a/src/plugins/coreplugin/fileiconprovider.cpp b/src/plugins/coreplugin/fileiconprovider.cpp index 04f5e9589d..a52bc8ec78 100644 --- a/src/plugins/coreplugin/fileiconprovider.cpp +++ b/src/plugins/coreplugin/fileiconprovider.cpp @@ -28,6 +28,8 @@ **************************************************************************/ #include "fileiconprovider.h" +#include "mimedatabase.h" + #include <QtGui/QApplication> #include <QtGui/QStyle> #include <QtGui/QPainter> @@ -88,7 +90,9 @@ QIcon FileIconProvider::icon(const QFileInfo &fileInfo) return icon; } -// Creates a pixmap with baseicon at size and overlayous overlayIcon over it. +/*! + Creates a pixmap with baseicon at size and overlays overlayIcon over it. + */ QPixmap FileIconProvider::overlayIcon(QStyle::StandardPixmap baseIcon, const QIcon &overlayIcon, const QSize &size) const { QPixmap iconPixmap = qApp->style()->standardIcon(baseIcon).pixmap(size); @@ -99,7 +103,7 @@ QPixmap FileIconProvider::overlayIcon(QStyle::StandardPixmap baseIcon, const QIc } /*! - Registers an icon for a given suffix, overlaying the system file icon + Registers an icon for a given suffix, overlaying the system file icon. */ void FileIconProvider::registerIconOverlayForSuffix(const QIcon &icon, const QString &suffix) { @@ -118,12 +122,21 @@ void FileIconProvider::registerIconOverlayForSuffix(const QIcon &icon, const QSt } /*! + Registers an icon for all the suffixes of a given mime type, overlaying the system file icon. + */ +void FileIconProvider::registerIconOverlayForMimeType(const QIcon &icon, const MimeType &mimeType) +{ + foreach (const QString &suffix, mimeType.suffixes()) + registerIconOverlayForSuffix(icon, suffix); +} + +/*! Returns an icon for the given suffix, or an empty one if none registered. */ QIcon FileIconProvider::iconForSuffix(const QString &suffix) const { QIcon icon; -#if defined(Q_WS_WIN) || defined(Q_WS_MAC) // On windows we use the file system icons +#if defined(Q_WS_WIN) || defined(Q_WS_MAC) // On Windows and Mac we use the file system icons Q_UNUSED(suffix) #else if (suffix.isEmpty()) diff --git a/src/plugins/coreplugin/fileiconprovider.h b/src/plugins/coreplugin/fileiconprovider.h index 8d8bb7d1f0..9ee5ed9c61 100644 --- a/src/plugins/coreplugin/fileiconprovider.h +++ b/src/plugins/coreplugin/fileiconprovider.h @@ -40,13 +40,17 @@ namespace Core { -class CORE_EXPORT FileIconProvider { +class MimeType; + +class CORE_EXPORT FileIconProvider +{ public: ~FileIconProvider(); // used to clear the cache QIcon icon(const QFileInfo &fileInfo); QPixmap overlayIcon(QStyle::StandardPixmap baseIcon, const QIcon &overlayIcon, const QSize &size) const; void registerIconOverlayForSuffix(const QIcon &icon, const QString &suffix); + void registerIconOverlayForMimeType(const QIcon &icon, const MimeType &mimeType); static FileIconProvider *instance(); diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp index 5a75f4f9df..eb250422b3 100644 --- a/src/plugins/coreplugin/generalsettings.cpp +++ b/src/plugins/coreplugin/generalsettings.cpp @@ -29,8 +29,8 @@ #include "generalsettings.h" -#include "stylehelper.h" -#include "utils/qtcolorbutton.h" +#include <utils/stylehelper.h> +#include <utils/qtcolorbutton.h> #include <utils/consoleprocess.h> #include <coreplugin/editormanager/editormanager.h> #include <coreplugin/icore.h> diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index b9c3f20464..e841479410 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -51,7 +51,6 @@ #include "scriptmanager_p.h" #include "settingsdialog.h" -#include "stylehelper.h" #include "variablemanager.h" #include "versiondialog.h" #include "viewmanager.h" @@ -68,6 +67,7 @@ #include <coreplugin/findplaceholder.h> #include <coreplugin/settingsdatabase.h> #include <utils/pathchooser.h> +#include <utils/stylehelper.h> #include <extensionsystem/pluginmanager.h> #include <QtCore/QDebug> diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index 4370ab49d5..fda4e51bab 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -29,12 +29,14 @@ #include "manhattanstyle.h" -#include "stylehelper.h" #include "styleanimator.h" #include <QtCore/QDebug> #include <QtCore/QLibrary> +#include <utils/qtcassert.h> +#include <utils/stylehelper.h> + #include <QtGui/QApplication> #include <QtGui/QComboBox> #include <QtGui/QDialog> @@ -56,8 +58,6 @@ #include <QtGui/QToolBar> #include <QtGui/QToolButton> -#include <utils/qtcassert.h> - // We define a currently unused state for indicating animations #define State_Animating 0x00000040 @@ -86,6 +86,8 @@ bool panelWidget(const QWidget *widget) return true; else if (qobject_cast<const QMenuBar *>(p) && styleEnabled(p)) return true; + else if (p->property("panelwidget").toBool()) + return true; p = p->parentWidget(); } return false; diff --git a/src/plugins/coreplugin/minisplitter.cpp b/src/plugins/coreplugin/minisplitter.cpp index bd1551cb7e..2961dec153 100644 --- a/src/plugins/coreplugin/minisplitter.cpp +++ b/src/plugins/coreplugin/minisplitter.cpp @@ -28,7 +28,8 @@ **************************************************************************/ #include "minisplitter.h" -#include "stylehelper.h" + +#include <utils/stylehelper.h> #include <QtGui/QPaintEvent> #include <QtGui/QPainter> diff --git a/src/plugins/coreplugin/progressmanager/progresspie.cpp b/src/plugins/coreplugin/progressmanager/progresspie.cpp index 4f8ffa645f..d4a16a525c 100644 --- a/src/plugins/coreplugin/progressmanager/progresspie.cpp +++ b/src/plugins/coreplugin/progressmanager/progresspie.cpp @@ -28,7 +28,8 @@ **************************************************************************/ #include "progresspie.h" -#include "stylehelper.h" + +#include <utils/stylehelper.h> #include <QtGui/QPainter> #include <QtGui/QFont> diff --git a/src/plugins/cppeditor/cppplugin.cpp b/src/plugins/cppeditor/cppplugin.cpp index b97918b2fc..b1ee04b131 100644 --- a/src/plugins/cppeditor/cppplugin.cpp +++ b/src/plugins/cppeditor/cppplugin.cpp @@ -65,29 +65,19 @@ CppEditorFactory::CppEditorFactory(CppPlugin *owner) : m_owner(owner) { m_mimeTypes << QLatin1String(CppEditor::Constants::C_SOURCE_MIMETYPE) - << QLatin1String(CppEditor::Constants::C_HEADER_MIMETYPE) - << QLatin1String(CppEditor::Constants::CPP_SOURCE_MIMETYPE) - << QLatin1String(CppEditor::Constants::CPP_HEADER_MIMETYPE); - Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance(); + << QLatin1String(CppEditor::Constants::C_HEADER_MIMETYPE) + << QLatin1String(CppEditor::Constants::CPP_SOURCE_MIMETYPE) + << QLatin1String(CppEditor::Constants::CPP_HEADER_MIMETYPE); + #ifndef Q_WS_MAC - // ### It would be really cool if we could get the stuff from the XML file here and not play "catch up" all the time. - QIcon cppIcon(":/cppeditor/images/qt_cpp.png"); - iconProvider->registerIconOverlayForSuffix(cppIcon, QLatin1String("cpp")); - iconProvider->registerIconOverlayForSuffix(cppIcon, QLatin1String("cp")); - iconProvider->registerIconOverlayForSuffix(cppIcon, QLatin1String("cc")); - iconProvider->registerIconOverlayForSuffix(cppIcon, QLatin1String("cxx")); - iconProvider->registerIconOverlayForSuffix(cppIcon, QLatin1String("C")); - iconProvider->registerIconOverlayForSuffix(cppIcon, QLatin1String("c++")); - iconProvider->registerIconOverlayForSuffix(QIcon(":/cppeditor/images/qt_c.png"), - QLatin1String("c")); - QIcon headerIcon(":/cppeditor/images/qt_h.png"); - iconProvider->registerIconOverlayForSuffix(headerIcon, QLatin1String("hpp")); - iconProvider->registerIconOverlayForSuffix(headerIcon, QLatin1String("hh")); - iconProvider->registerIconOverlayForSuffix(headerIcon, QLatin1String("h")); - iconProvider->registerIconOverlayForSuffix(headerIcon, QLatin1String("hxx")); - iconProvider->registerIconOverlayForSuffix(headerIcon, QLatin1String("H")); - iconProvider->registerIconOverlayForSuffix(headerIcon, QLatin1String("hp")); - iconProvider->registerIconOverlayForSuffix(headerIcon, QLatin1String("h++")); + Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance(); + Core::MimeDatabase *mimeDatabase = Core::ICore::instance()->mimeDatabase(); + iconProvider->registerIconOverlayForMimeType(QIcon(":/cppeditor/images/qt_cpp.png"), + mimeDatabase->findByType(QLatin1String(CppEditor::Constants::CPP_SOURCE_MIMETYPE))); + iconProvider->registerIconOverlayForMimeType(QIcon(":/cppeditor/images/qt_c.png"), + mimeDatabase->findByType(QLatin1String(CppEditor::Constants::C_SOURCE_MIMETYPE))); + iconProvider->registerIconOverlayForMimeType(QIcon(":/cppeditor/images/qt_h.png"), + mimeDatabase->findByType(QLatin1String(CppEditor::Constants::CPP_HEADER_MIMETYPE))); #endif } @@ -122,7 +112,6 @@ CppPlugin *CppPlugin::m_instance = 0; CppPlugin::CppPlugin() : m_actionHandler(0), - m_factory(0), m_sortedMethodOverview(false) { m_instance = this; @@ -130,8 +119,6 @@ CppPlugin::CppPlugin() : CppPlugin::~CppPlugin() { - removeObject(m_factory); - delete m_factory; delete m_actionHandler; m_instance = 0; } @@ -174,12 +161,11 @@ bool CppPlugin::sortedMethodOverview() const bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) { Core::ICore *core = Core::ICore::instance(); + if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/cppeditor/CppEditor.mimetypes.xml"), errorMessage)) return false; - m_factory = new CppEditorFactory(this); - addObject(m_factory); - + addAutoReleasedObject(new CppEditorFactory(this)); addAutoReleasedObject(new CppHoverHandler); CppFileWizard::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard); diff --git a/src/plugins/cppeditor/cppplugin.h b/src/plugins/cppeditor/cppplugin.h index ce4f0d0899..9e5cc9eead 100644 --- a/src/plugins/cppeditor/cppplugin.h +++ b/src/plugins/cppeditor/cppplugin.h @@ -44,7 +44,6 @@ namespace CppEditor { namespace Internal { class CPPEditor; -class CppEditorFactory; class CppPlugin : public ExtensionSystem::IPlugin { @@ -76,7 +75,6 @@ private slots: void jumpToDefinition(); private: - friend class CppEditorFactory; Core::IEditor *createEditor(QWidget *parent); void writeSettings(); void readSettings(); @@ -84,7 +82,6 @@ private: static CppPlugin *m_instance; TextEditor::TextEditorActionHandler *m_actionHandler; - CppEditorFactory *m_factory; bool m_sortedMethodOverview; }; diff --git a/src/plugins/cvs/CVS.mimetypes.xml b/src/plugins/cvs/CVS.mimetypes.xml new file mode 100644 index 0000000000..237d8aa67c --- /dev/null +++ b/src/plugins/cvs/CVS.mimetypes.xml @@ -0,0 +1,7 @@ +<?xml version="1.0"?> +<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'> + <mime-type type="application/vnd.nokia.text.cvs.submit"> + <comment>CVS submit template</comment> + <sub-class-of type="text/plain"/> + </mime-type> +</mime-info> diff --git a/src/plugins/cvs/CVS.pluginspec b/src/plugins/cvs/CVS.pluginspec new file mode 100644 index 0000000000..2e28bb38c7 --- /dev/null +++ b/src/plugins/cvs/CVS.pluginspec @@ -0,0 +1,27 @@ +<plugin name="CVS" version="1.2.80" compatVersion="1.2.80"> + <vendor>Nokia Corporation</vendor> + <copyright>(C) 2008-2009 Nokia Corporation</copyright> + <license> +Commercial Usage + +Licensees holding valid Qt Commercial licenses may use this plugin in +accordance with the Qt Commercial License Agreement provided with the +Software or, alternatively, in accordance with the terms contained in +a written agreement between you and Nokia. + +GNU Lesser General Public License Usage + +Alternatively, this plugin may be used under the terms of the GNU Lesser +General Public License version 2.1 as published by the Free Software +Foundation. 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.</license> + <description>CVS integration.</description> + <url>http://www.qtsoftware.com</url> + <dependencyList> + <dependency name="TextEditor" version="1.2.80"/> + <dependency name="ProjectExplorer" version="1.2.80"/> + <dependency name="Core" version="1.2.80"/> + <dependency name="VCSBase" version="1.2.80"/> + </dependencyList> +</plugin> diff --git a/src/plugins/cvs/annotationhighlighter.cpp b/src/plugins/cvs/annotationhighlighter.cpp new file mode 100644 index 0000000000..3214068de7 --- /dev/null +++ b/src/plugins/cvs/annotationhighlighter.cpp @@ -0,0 +1,46 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#include "annotationhighlighter.h" + +using namespace CVS; +using namespace CVS::Internal; + +CVSAnnotationHighlighter::CVSAnnotationHighlighter(const ChangeNumbers &changeNumbers, + QTextDocument *document) : + VCSBase::BaseAnnotationHighlighter(changeNumbers, document), + m_blank(QLatin1Char(' ')) +{ +} + +QString CVSAnnotationHighlighter::changeNumber(const QString &block) const +{ + const int pos = block.indexOf(m_blank); + return pos > 1 ? block.left(pos) : QString(); +} diff --git a/src/plugins/cvs/annotationhighlighter.h b/src/plugins/cvs/annotationhighlighter.h new file mode 100644 index 0000000000..8f52c9ba56 --- /dev/null +++ b/src/plugins/cvs/annotationhighlighter.h @@ -0,0 +1,55 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#ifndef ANNOTATIONHIGHLIGHTER_H +#define ANNOTATIONHIGHLIGHTER_H + +#include <vcsbase/baseannotationhighlighter.h> + +namespace CVS { +namespace Internal { + +// Annotation highlighter for cvs triggering on 'changenumber ' +class CVSAnnotationHighlighter : public VCSBase::BaseAnnotationHighlighter +{ + Q_OBJECT +public: + explicit CVSAnnotationHighlighter(const ChangeNumbers &changeNumbers, + QTextDocument *document = 0); + +private: + virtual QString changeNumber(const QString &block) const; + + const QChar m_blank; +}; + +} // namespace Internal +} // namespace CVS + +#endif // ANNOTATIONHIGHLIGHTER_H diff --git a/src/plugins/cvs/cvs.pro b/src/plugins/cvs/cvs.pro new file mode 100644 index 0000000000..86244a20aa --- /dev/null +++ b/src/plugins/cvs/cvs.pro @@ -0,0 +1,36 @@ +TEMPLATE = lib +TARGET = CVS + +include(../../qtcreatorplugin.pri) +include(../../plugins/projectexplorer/projectexplorer.pri) +include(../../plugins/texteditor/texteditor.pri) +include(../../plugins/coreplugin/coreplugin.pri) +include(../../plugins/vcsbase/vcsbase.pri) +include(../../libs/utils/utils.pri) + +HEADERS += annotationhighlighter.h \ + cvsplugin.h \ + cvscontrol.h \ + cvsoutputwindow.h \ + settingspage.h \ + cvseditor.h \ + cvssubmiteditor.h \ + cvssettings.h \ + cvsutils.h \ + cvsconstants.h + +SOURCES += annotationhighlighter.cpp \ + cvsplugin.cpp \ + cvscontrol.cpp \ + cvsoutputwindow.cpp \ + settingspage.cpp \ + cvseditor.cpp \ + cvssubmiteditor.cpp \ + cvssettings.cpp \ + cvsutils.cpp + +FORMS += settingspage.ui + +RESOURCES += cvs.qrc + +OTHER_FILES += CVS.pluginspec diff --git a/src/plugins/cvs/cvs.qrc b/src/plugins/cvs/cvs.qrc new file mode 100644 index 0000000000..63180dfae7 --- /dev/null +++ b/src/plugins/cvs/cvs.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/trolltech.cvs" > + <file>CVS.mimetypes.xml</file> + </qresource> +</RCC> diff --git a/src/plugins/cvs/cvsconstants.h b/src/plugins/cvs/cvsconstants.h new file mode 100644 index 0000000000..1a2e5248c8 --- /dev/null +++ b/src/plugins/cvs/cvsconstants.h @@ -0,0 +1,48 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#ifndef CVS_CONSTANTS_H +#define CVS_CONSTANTS_H + +namespace CVS { +namespace Constants { + +const char * const CVS_SUBMIT_MIMETYPE = "application/vnd.nokia.text.cvs.submit"; +const char * const CVSEDITOR = "CVS Editor"; +const char * const CVSEDITOR_KIND = "CVS Editor"; +const char * const CVSCOMMITEDITOR = "CVS Commit Editor"; +const char * const CVSCOMMITEDITOR_KIND = "CVS Commit Editor"; +const char * const SUBMIT_CURRENT = "CVS.SubmitCurrentLog"; +const char * const DIFF_SELECTED = "CVS.DiffSelectedFilesInLog"; +enum { debug = 0 }; + +} // namespace Constants +} // namespace SubVersion + +#endif // CVS_CONSTANTS_H diff --git a/src/plugins/cvs/cvscontrol.cpp b/src/plugins/cvs/cvscontrol.cpp new file mode 100644 index 0000000000..49175e86c9 --- /dev/null +++ b/src/plugins/cvs/cvscontrol.cpp @@ -0,0 +1,98 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#include "cvscontrol.h" +#include "cvsplugin.h" + +using namespace CVS; +using namespace CVS::Internal; + +CVSControl::CVSControl(CVSPlugin *plugin) : + m_enabled(true), + m_plugin(plugin) +{ +} + +QString CVSControl::name() const +{ + return QLatin1String("cvs"); +} + +bool CVSControl::isEnabled() const +{ + return m_enabled; +} + +void CVSControl::setEnabled(bool enabled) +{ + if (m_enabled != enabled) { + m_enabled = enabled; + emit enabledChanged(m_enabled); + } +} + +bool CVSControl::supportsOperation(Operation operation) const +{ + bool rc = true; + switch (operation) { + case AddOperation: + case DeleteOperation: + break; + case OpenOperation: + rc = false; + break; + } + return rc; +} + +bool CVSControl::vcsOpen(const QString & /* fileName */) +{ + // Open for edit: N/A + return true; +} + +bool CVSControl::vcsAdd(const QString &fileName) +{ + return m_plugin->vcsAdd(fileName); +} + +bool CVSControl::vcsDelete(const QString &fileName) +{ + return m_plugin->vcsDelete(fileName); +} + +bool CVSControl::managesDirectory(const QString &directory) const +{ + return m_plugin->managesDirectory(directory); +} + +QString CVSControl::findTopLevelForDirectory(const QString &directory) const +{ + return m_plugin->findTopLevelForDirectory(directory); +} diff --git a/src/plugins/cvs/cvscontrol.h b/src/plugins/cvs/cvscontrol.h new file mode 100644 index 0000000000..2249f1a823 --- /dev/null +++ b/src/plugins/cvs/cvscontrol.h @@ -0,0 +1,70 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#ifndef CVSCONTROL_H +#define CVSCONTROL_H + +#include <coreplugin/iversioncontrol.h> + +namespace CVS { +namespace Internal { + +class CVSPlugin; + +// Just a proxy for CVSPlugin +class CVSControl : public Core::IVersionControl +{ + Q_OBJECT +public: + explicit CVSControl(CVSPlugin *plugin); + virtual QString name() const; + + virtual bool isEnabled() const; + virtual void setEnabled(bool enabled); + + virtual bool managesDirectory(const QString &directory) const; + virtual QString findTopLevelForDirectory(const QString &directory) const; + + virtual bool supportsOperation(Operation operation) const; + virtual bool vcsOpen(const QString &fileName); + virtual bool vcsAdd(const QString &fileName); + virtual bool vcsDelete(const QString &filename); + +signals: + void enabledChanged(bool); + +private: + bool m_enabled; + CVSPlugin *m_plugin; +}; + +} // namespace Internal +} // namespace CVS + +#endif // CVSCONTROL_H diff --git a/src/plugins/cvs/cvseditor.cpp b/src/plugins/cvs/cvseditor.cpp new file mode 100644 index 0000000000..35b342446e --- /dev/null +++ b/src/plugins/cvs/cvseditor.cpp @@ -0,0 +1,159 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#include "cvseditor.h" + +#include "annotationhighlighter.h" +#include "cvsconstants.h" + +#include <utils/qtcassert.h> +#include <vcsbase/diffhighlighter.h> + +#include <QtCore/QDebug> +#include <QtGui/QTextCursor> + +namespace CVS { +namespace Internal { + +// Match a CVS revision ("1.1.1.1") +#define CVS_REVISION_PATTERN "[\\d\\.]+" +#define CVS_REVISION_AT_START_PATTERN "^("CVS_REVISION_PATTERN") " + +CVSEditor::CVSEditor(const VCSBase::VCSBaseEditorParameters *type, + QWidget *parent) : + VCSBase::VCSBaseEditor(type, parent), + m_revisionPattern(QLatin1String(CVS_REVISION_AT_START_PATTERN".*$")) +{ + QTC_ASSERT(m_revisionPattern.isValid(), return); +} + +QSet<QString> CVSEditor::annotationChanges() const +{ + QSet<QString> changes; + const QString txt = toPlainText(); + if (txt.isEmpty()) + return changes; + // Hunt for first change number in annotation: "1.1 (author)" + QRegExp r(QLatin1String(CVS_REVISION_AT_START_PATTERN)); + QTC_ASSERT(r.isValid(), return changes); + if (r.indexIn(txt) != -1) { + changes.insert(r.cap(1)); + r.setPattern(QLatin1String("\n("CVS_REVISION_PATTERN") ")); + QTC_ASSERT(r.isValid(), return changes); + int pos = 0; + while ((pos = r.indexIn(txt, pos)) != -1) { + pos += r.matchedLength(); + changes.insert(r.cap(1)); + } + } + if (CVS::Constants::debug) + qDebug() << "CVSEditor::annotationChanges() returns #" << changes.size(); + return changes; +} + +QString CVSEditor::changeUnderCursor(const QTextCursor &c) const +{ + + // Check for a revision number at the beginning of the line. + // Note that "cursor.select(QTextCursor::WordUnderCursor)" will + // only select the part up until the dot. + // Check if we are at the beginning of a line within a reasonable offset. + const QTextBlock block = c.block(); + if (c.atBlockStart() || (c.position() - block.position() < 3)) { + const QString line = block.text(); + if (m_revisionPattern.exactMatch(line)) + return m_revisionPattern.cap(1); + } + return QString(); +} + +/* \code +cvs diff -d -u -r1.1 -r1.2: +--- mainwindow.cpp<\t>13 Jul 2009 13:50:15 -0000 <\t>1.1 ++++ mainwindow.cpp<\t>14 Jul 2009 07:09:24 -0000<\t>1.2 +@@ -6,6 +6,5 @@ +\endcode +*/ + +VCSBase::DiffHighlighter *CVSEditor::createDiffHighlighter() const +{ + const QRegExp filePattern(QLatin1String("^[-+][-+][-+] .*1\\.[\\d\\.]+$")); + QTC_ASSERT(filePattern.isValid(), /**/); + return new VCSBase::DiffHighlighter(filePattern); +} + +VCSBase::BaseAnnotationHighlighter *CVSEditor::createAnnotationHighlighter(const QSet<QString> &changes) const +{ + return new CVSAnnotationHighlighter(changes); +} + +QString CVSEditor::fileNameFromDiffSpecification(const QTextBlock &inBlock) const +{ + // "+++ mainwindow.cpp<\t>13 Jul 2009 13:50:15 -0000 1.1" + // Go back chunks + const QString diffIndicator = QLatin1String("+++ "); + for (QTextBlock block = inBlock; block.isValid() ; block = block.previous()) { + QString diffFileName = block.text(); + if (diffFileName.startsWith(diffIndicator)) { + diffFileName.remove(0, diffIndicator.size()); + const int tabIndex = diffFileName.indexOf(QLatin1Char('\t')); + if (tabIndex != -1) + diffFileName.truncate(tabIndex); + // Add base dir + if (!m_diffBaseDir.isEmpty()) { + diffFileName.insert(0, QLatin1Char('/')); + diffFileName.insert(0, m_diffBaseDir); + } + + if (CVS::Constants::debug) + qDebug() << "fileNameFromDiffSpecification" << m_diffBaseDir << diffFileName; + return diffFileName; + } + } + return QString(); +} + +QString CVSEditor::diffBaseDir() const +{ + return m_diffBaseDir; +} + +void CVSEditor::setDiffBaseDir(const QString &d) +{ + m_diffBaseDir = d; +} + +void CVSEditor::setDiffBaseDir(Core::IEditor *editor, const QString &db) +{ + if (CVSEditor *cvsEditor = qobject_cast<CVSEditor*>(editor->widget())) + cvsEditor->setDiffBaseDir(db); +} + +} +} diff --git a/src/plugins/cvs/cvseditor.h b/src/plugins/cvs/cvseditor.h new file mode 100644 index 0000000000..8acb42ae23 --- /dev/null +++ b/src/plugins/cvs/cvseditor.h @@ -0,0 +1,69 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#ifndef CVSEDITOR_H +#define CVSEDITOR_H + +#include <vcsbase/vcsbaseeditor.h> + +#include <QtCore/QRegExp> + +namespace CVS { +namespace Internal { + +class CVSEditor : public VCSBase::VCSBaseEditor +{ + Q_OBJECT + +public: + explicit CVSEditor(const VCSBase::VCSBaseEditorParameters *type, + QWidget *parent); + + // Diff mode requires a base directory since CVS commands + // are run with relative paths (see plugin). + QString diffBaseDir() const; + void setDiffBaseDir(const QString &d); + + static void setDiffBaseDir(Core::IEditor *editor, const QString &db); + +private: + virtual QSet<QString> annotationChanges() const; + virtual QString changeUnderCursor(const QTextCursor &) const; + virtual VCSBase::DiffHighlighter *createDiffHighlighter() const; + virtual VCSBase::BaseAnnotationHighlighter *createAnnotationHighlighter(const QSet<QString> &changes) const; + virtual QString fileNameFromDiffSpecification(const QTextBlock &diffFileName) const; + + const QRegExp m_revisionPattern; + QString m_diffBaseDir; +}; + +} // namespace Internal +} // namespace CVS + +#endif // CVSEDITOR_H diff --git a/src/plugins/cvs/cvsoutputwindow.cpp b/src/plugins/cvs/cvsoutputwindow.cpp new file mode 100644 index 0000000000..2168a03d33 --- /dev/null +++ b/src/plugins/cvs/cvsoutputwindow.cpp @@ -0,0 +1,127 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#include "cvsoutputwindow.h" +#include "cvsplugin.h" + +#include <QtGui/QListWidget> +#include <QtCore/QDebug> + +using namespace CVS::Internal; + +CVSOutputWindow::CVSOutputWindow(CVSPlugin *cvsPlugin) + : m_cvsPlugin(cvsPlugin) +{ + m_outputListWidget = new QListWidget; + m_outputListWidget->setFrameStyle(QFrame::NoFrame); + m_outputListWidget->setWindowTitle(tr("CVS Output")); + m_outputListWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); +} + +CVSOutputWindow::~CVSOutputWindow() +{ + delete m_outputListWidget; +} + +QWidget *CVSOutputWindow::outputWidget(QWidget *parent) +{ + m_outputListWidget->setParent(parent); + return m_outputListWidget; +} + +QString CVSOutputWindow::name() const +{ + return tr("CVS"); +} + +void CVSOutputWindow::clearContents() +{ + m_outputListWidget->clear(); +} + +int CVSOutputWindow::priorityInStatusBar() const +{ + return -1; +} + +void CVSOutputWindow::visibilityChanged(bool b) +{ + if (b) + m_outputListWidget->setFocus(); +} + +void CVSOutputWindow::append(const QString &txt, bool doPopup) +{ + const QStringList lines = txt.split(QLatin1Char('\n')); + foreach (const QString &s, lines) + m_outputListWidget->addItem(s); + m_outputListWidget->scrollToBottom(); + + if (doPopup) + popup(); +} + +bool CVSOutputWindow::canFocus() +{ + return false; +} + +bool CVSOutputWindow::hasFocus() +{ + return m_outputListWidget->hasFocus(); +} + +void CVSOutputWindow::setFocus() +{ +} + +bool CVSOutputWindow::canNext() +{ + return false; +} + +bool CVSOutputWindow::canPrevious() +{ + return false; +} + +void CVSOutputWindow::goToNext() +{ + +} + +void CVSOutputWindow::goToPrev() +{ + +} + +bool CVSOutputWindow::canNavigate() +{ + return false; +} diff --git a/src/plugins/cvs/cvsoutputwindow.h b/src/plugins/cvs/cvsoutputwindow.h new file mode 100644 index 0000000000..badb98c92b --- /dev/null +++ b/src/plugins/cvs/cvsoutputwindow.h @@ -0,0 +1,84 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#ifndef CVSOUTPUTWINDOW_H +#define CVSOUTPUTWINDOW_H + +#include <coreplugin/ioutputpane.h> + +QT_BEGIN_NAMESPACE +class QListWidget; +QT_END_NAMESPACE + +namespace CVS { +namespace Internal { + +class CVSPlugin; + +class CVSOutputWindow : public Core::IOutputPane +{ + Q_OBJECT + +public: + CVSOutputWindow(CVSPlugin *cvsPlugin); + ~CVSOutputWindow(); + + QWidget *outputWidget(QWidget *parent); + QList<QWidget*> toolBarWidgets() const { + return QList<QWidget *>(); + } + + QString name() const; + void clearContents(); + int priorityInStatusBar() const; + void visibilityChanged(bool visible); + + bool canFocus(); + bool hasFocus(); + void setFocus(); + + bool canNext(); + bool canPrevious(); + void goToNext(); + void goToPrev(); + bool canNavigate(); + +public slots: + void append(const QString &txt, bool popup = false); + +private: + + CVSPlugin *m_cvsPlugin; + QListWidget *m_outputListWidget; +}; + +} // namespace CVS +} // namespace Internal + +#endif // CVSOUTPUTWINDOW_H diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp new file mode 100644 index 0000000000..8e0e4785a1 --- /dev/null +++ b/src/plugins/cvs/cvsplugin.cpp @@ -0,0 +1,1237 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#include "cvsplugin.h" +#include "settingspage.h" +#include "cvseditor.h" +#include "cvsoutputwindow.h" +#include "cvssubmiteditor.h" +#include "cvsconstants.h" +#include "cvscontrol.h" + +#include <vcsbase/basevcseditorfactory.h> +#include <vcsbase/vcsbaseeditor.h> +#include <vcsbase/basevcssubmiteditorfactory.h> +#include <utils/synchronousprocess.h> +#include <utils/parameteraction.h> + +#include <coreplugin/icore.h> +#include <coreplugin/coreconstants.h> +#include <coreplugin/filemanager.h> +#include <coreplugin/messagemanager.h> +#include <coreplugin/mimedatabase.h> +#include <coreplugin/uniqueidmanager.h> +#include <coreplugin/actionmanager/actionmanager.h> +#include <coreplugin/editormanager/editormanager.h> +#include <coreplugin/vcsmanager.h> +#include <projectexplorer/projectexplorer.h> +#include <utils/qtcassert.h> + +#include <QtCore/QDebug> +#include <QtCore/QDate> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtCore/QTemporaryFile> +#include <QtCore/QTextCodec> +#include <QtCore/QtPlugin> +#include <QtGui/QAction> +#include <QtGui/QMainWindow> +#include <QtGui/QMenu> +#include <QtGui/QMessageBox> + +#include <limits.h> + +namespace CVS { + namespace Internal { + +static inline QString msgCannotFindTopLevel(const QString &f) +{ + return CVSPlugin::tr("Cannot find repository for '%1'").arg(f); +} + +static inline QString msgLogParsingFailed() +{ + return CVSPlugin::tr("Parsing of the log output failed"); +} + +// Timeout for normal output commands +enum { cvsShortTimeOut = 10000 }; +// Timeout for submit, update +enum { cvsLongTimeOut = 120000 }; + +static const char * const CMD_ID_CVS_MENU = "CVS.Menu"; +static const char * const CMD_ID_ADD = "CVS.Add"; +static const char * const CMD_ID_DELETE_FILE = "CVS.Delete"; +static const char * const CMD_ID_REVERT = "CVS.Revert"; +static const char * const CMD_ID_SEPARATOR0 = "CVS.Separator0"; +static const char * const CMD_ID_DIFF_PROJECT = "CVS.DiffAll"; +static const char * const CMD_ID_DIFF_CURRENT = "CVS.DiffCurrent"; +static const char * const CMD_ID_SEPARATOR1 = "CVS.Separator1"; +static const char * const CMD_ID_COMMIT_ALL = "CVS.CommitAll"; +static const char * const CMD_ID_COMMIT_CURRENT = "CVS.CommitCurrent"; +static const char * const CMD_ID_SEPARATOR2 = "CVS.Separator2"; +static const char * const CMD_ID_FILELOG_CURRENT = "CVS.FilelogCurrent"; +static const char * const CMD_ID_ANNOTATE_CURRENT = "CVS.AnnotateCurrent"; +static const char * const CMD_ID_SEPARATOR3 = "CVS.Separator3"; +static const char * const CMD_ID_STATUS = "CVS.Status"; +static const char * const CMD_ID_UPDATE = "CVS.Update"; + +static const VCSBase::VCSBaseEditorParameters editorParameters[] = { +{ + VCSBase::RegularCommandOutput, + "CVS Command Log Editor", // kind + "CVS Command Log Editor", // context + "application/vnd.nokia.text.scs_cvs_commandlog", + "scslog"}, +{ VCSBase::LogOutput, + "CVS File Log Editor", // kind + "CVS File Log Editor", // context + "application/vnd.nokia.text.scs_cvs_filelog", + "scsfilelog"}, +{ VCSBase::AnnotateOutput, + "CVS Annotation Editor", // kind + "CVS Annotation Editor", // context + "application/vnd.nokia.text.scs_cvs_annotation", + "scsannotate"}, +{ VCSBase::DiffOutput, + "CVS Diff Editor", // kind + "CVS Diff Editor", // context + "text/x-patch","diff"} +}; + +// Utility to find a parameter set by type +static inline const VCSBase::VCSBaseEditorParameters *findType(int ie) +{ + const VCSBase::EditorContentType et = static_cast<VCSBase::EditorContentType>(ie); + return VCSBase::VCSBaseEditor::findType(editorParameters, sizeof(editorParameters)/sizeof(VCSBase::VCSBaseEditorParameters), et); +} + +static inline QString debugCodec(const QTextCodec *c) +{ + return c ? QString::fromAscii(c->name()) : QString::fromAscii("Null codec"); +} + +Core::IEditor* locateEditor(const char *property, const QString &entry) +{ + foreach (Core::IEditor *ed, Core::EditorManager::instance()->openedEditors()) + if (ed->property(property).toString() == entry) + return ed; + return 0; +} + +// ------------- CVSPlugin +CVSPlugin *CVSPlugin::m_cvsPluginInstance = 0; + +CVSPlugin::CVSPlugin() : + m_versionControl(0), + m_changeTmpFile(0), + m_cvsOutputWindow(0), + m_projectExplorer(0), + m_addAction(0), + m_deleteAction(0), + m_revertAction(0), + m_diffProjectAction(0), + m_diffCurrentAction(0), + m_commitAllAction(0), + m_commitCurrentAction(0), + m_filelogCurrentAction(0), + m_annotateCurrentAction(0), + m_statusAction(0), + m_updateProjectAction(0), + m_submitCurrentLogAction(0), + m_submitDiffAction(0), + m_submitUndoAction(0), + m_submitRedoAction(0), + m_submitActionTriggered(false) +{ +} + +CVSPlugin::~CVSPlugin() +{ + cleanChangeTmpFile(); +} + +void CVSPlugin::cleanChangeTmpFile() +{ + if (m_changeTmpFile) { + if (m_changeTmpFile->isOpen()) + m_changeTmpFile->close(); + delete m_changeTmpFile; + m_changeTmpFile = 0; + } +} + +static const VCSBase::VCSBaseSubmitEditorParameters submitParameters = { + CVS::Constants::CVS_SUBMIT_MIMETYPE, + CVS::Constants::CVSCOMMITEDITOR_KIND, + CVS::Constants::CVSCOMMITEDITOR +}; + +static inline Core::Command *createSeparator(QObject *parent, + Core::ActionManager *ami, + const char*id, + const QList<int> &globalcontext) +{ + QAction *tmpaction = new QAction(parent); + tmpaction->setSeparator(true); + return ami->registerAction(tmpaction, id, globalcontext); +} + +bool CVSPlugin::initialize(const QStringList &arguments, QString *errorMessage) +{ + Q_UNUSED(arguments); + + typedef VCSBase::VCSSubmitEditorFactory<CVSSubmitEditor> CVSSubmitEditorFactory; + typedef VCSBase::VCSEditorFactory<CVSEditor> CVSEditorFactory; + using namespace Constants; + + using namespace Core::Constants; + using namespace ExtensionSystem; + + m_cvsPluginInstance = this; + Core::ICore *core = Core::ICore::instance(); + + if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/trolltech.cvs/CVS.mimetypes.xml"), errorMessage)) + return false; + + + m_versionControl = new CVSControl(this); + addAutoReleasedObject(m_versionControl); + + if (QSettings *settings = core->settings()) + m_settings.fromSettings(settings); + + addAutoReleasedObject(new CoreListener(this)); + + addAutoReleasedObject(new SettingsPage); + + addAutoReleasedObject(new CVSSubmitEditorFactory(&submitParameters)); + + static const char *describeSlotC = SLOT(slotDescribe(QString,QString)); + const int editorCount = sizeof(editorParameters)/sizeof(VCSBase::VCSBaseEditorParameters); + for (int i = 0; i < editorCount; i++) + addAutoReleasedObject(new CVSEditorFactory(editorParameters + i, this, describeSlotC)); + + m_cvsOutputWindow = new CVSOutputWindow(this); + addAutoReleasedObject(m_cvsOutputWindow); + + //register actions + Core::ActionManager *ami = core->actionManager(); + Core::ActionContainer *toolsContainer = ami->actionContainer(M_TOOLS); + + Core::ActionContainer *cvsMenu = + ami->createMenu(QLatin1String(CMD_ID_CVS_MENU)); + cvsMenu->menu()->setTitle(tr("&CVS")); + toolsContainer->addMenu(cvsMenu); + if (QAction *ma = cvsMenu->menu()->menuAction()) { + ma->setEnabled(m_versionControl->isEnabled()); + connect(m_versionControl, SIGNAL(enabledChanged(bool)), ma, SLOT(setVisible(bool))); + } + + QList<int> globalcontext; + globalcontext << core->uniqueIDManager()->uniqueIdentifier(C_GLOBAL); + + Core::Command *command; + m_addAction = new Core::Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + command = ami->registerAction(m_addAction, CMD_ID_ADD, + globalcontext); + command->setAttribute(Core::Command::CA_UpdateText); +#ifndef Q_WS_MAC + command->setDefaultKeySequence(QKeySequence(tr("Alt+C,Alt+A"))); +#endif + connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile())); + cvsMenu->addAction(command); + + m_deleteAction = new Core::Utils::ParameterAction(tr("Delete"), tr("Delete \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + command = ami->registerAction(m_deleteAction, CMD_ID_DELETE_FILE, + globalcontext); + command->setAttribute(Core::Command::CA_UpdateText); + connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(deleteCurrentFile())); + cvsMenu->addAction(command); + + m_revertAction = new Core::Utils::ParameterAction(tr("Revert"), tr("Revert \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + command = ami->registerAction(m_revertAction, CMD_ID_REVERT, + globalcontext); + command->setAttribute(Core::Command::CA_UpdateText); + connect(m_revertAction, SIGNAL(triggered()), this, SLOT(revertCurrentFile())); + cvsMenu->addAction(command); + + cvsMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR0, globalcontext)); + + m_diffProjectAction = new QAction(tr("Diff Project"), this); + command = ami->registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT, + globalcontext); + connect(m_diffProjectAction, SIGNAL(triggered()), this, SLOT(diffProject())); + cvsMenu->addAction(command); + + m_diffCurrentAction = new Core::Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + command = ami->registerAction(m_diffCurrentAction, + CMD_ID_DIFF_CURRENT, globalcontext); + command->setAttribute(Core::Command::CA_UpdateText); +#ifndef Q_WS_MAC + command->setDefaultKeySequence(QKeySequence(tr("Alt+C,Alt+D"))); +#endif + connect(m_diffCurrentAction, SIGNAL(triggered()), this, SLOT(diffCurrentFile())); + cvsMenu->addAction(command); + + cvsMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR1, globalcontext)); + + m_commitAllAction = new QAction(tr("Commit All Files"), this); + command = ami->registerAction(m_commitAllAction, CMD_ID_COMMIT_ALL, + globalcontext); + connect(m_commitAllAction, SIGNAL(triggered()), this, SLOT(startCommitAll())); + cvsMenu->addAction(command); + + m_commitCurrentAction = new Core::Utils::ParameterAction(tr("Commit Current File"), tr("Commit \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + command = ami->registerAction(m_commitCurrentAction, + CMD_ID_COMMIT_CURRENT, globalcontext); + command->setAttribute(Core::Command::CA_UpdateText); +#ifndef Q_WS_MAC + command->setDefaultKeySequence(QKeySequence(tr("Alt+C,Alt+C"))); +#endif + connect(m_commitCurrentAction, SIGNAL(triggered()), this, SLOT(startCommitCurrentFile())); + cvsMenu->addAction(command); + + cvsMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR2, globalcontext)); + + m_filelogCurrentAction = new Core::Utils::ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + command = ami->registerAction(m_filelogCurrentAction, + CMD_ID_FILELOG_CURRENT, globalcontext); + command->setAttribute(Core::Command::CA_UpdateText); + connect(m_filelogCurrentAction, SIGNAL(triggered()), this, + SLOT(filelogCurrentFile())); + cvsMenu->addAction(command); + + m_annotateCurrentAction = new Core::Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + command = ami->registerAction(m_annotateCurrentAction, + CMD_ID_ANNOTATE_CURRENT, globalcontext); + command->setAttribute(Core::Command::CA_UpdateText); + connect(m_annotateCurrentAction, SIGNAL(triggered()), this, + SLOT(annotateCurrentFile())); + cvsMenu->addAction(command); + + cvsMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR3, globalcontext)); + + m_statusAction = new QAction(tr("Project Status"), this); + command = ami->registerAction(m_statusAction, CMD_ID_STATUS, + globalcontext); + connect(m_statusAction, SIGNAL(triggered()), this, SLOT(projectStatus())); + cvsMenu->addAction(command); + + m_updateProjectAction = new QAction(tr("Update Project"), this); + command = ami->registerAction(m_updateProjectAction, CMD_ID_UPDATE, globalcontext); + connect(m_updateProjectAction, SIGNAL(triggered()), this, SLOT(updateProject())); + cvsMenu->addAction(command); + + // Actions of the submit editor + QList<int> cvscommitcontext; + cvscommitcontext << Core::UniqueIDManager::instance()->uniqueIdentifier(Constants::CVSCOMMITEDITOR); + + m_submitCurrentLogAction = new QAction(VCSBase::VCSBaseSubmitEditor::submitIcon(), tr("Commit"), this); + command = ami->registerAction(m_submitCurrentLogAction, Constants::SUBMIT_CURRENT, cvscommitcontext); + connect(m_submitCurrentLogAction, SIGNAL(triggered()), this, SLOT(submitCurrentLog())); + + m_submitDiffAction = new QAction(VCSBase::VCSBaseSubmitEditor::diffIcon(), tr("Diff Selected Files"), this); + command = ami->registerAction(m_submitDiffAction , Constants::DIFF_SELECTED, cvscommitcontext); + + m_submitUndoAction = new QAction(tr("&Undo"), this); + command = ami->registerAction(m_submitUndoAction, Core::Constants::UNDO, cvscommitcontext); + + m_submitRedoAction = new QAction(tr("&Redo"), this); + command = ami->registerAction(m_submitRedoAction, Core::Constants::REDO, cvscommitcontext); + + connect(Core::ICore::instance(), SIGNAL(contextChanged(Core::IContext *)), this, SLOT(updateActions())); + + return true; +} + +void CVSPlugin::extensionsInitialized() +{ + m_projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance(); + if (m_projectExplorer) { + connect(m_projectExplorer, + SIGNAL(currentProjectChanged(ProjectExplorer::Project*)), + m_cvsPluginInstance, SLOT(updateActions())); + } + updateActions(); +} + +bool CVSPlugin::editorAboutToClose(Core::IEditor *iEditor) +{ + if (!m_changeTmpFile || !iEditor || qstrcmp(Constants::CVSCOMMITEDITOR, iEditor->kind())) + return true; + + Core::IFile *fileIFace = iEditor->file(); + const CVSSubmitEditor *editor = qobject_cast<CVSSubmitEditor *>(iEditor); + if (!fileIFace || !editor) + return true; + + // Submit editor closing. Make it write out the commit message + // and retrieve files + const QFileInfo editorFile(fileIFace->fileName()); + const QFileInfo changeFile(m_changeTmpFile->fileName()); + if (editorFile.absoluteFilePath() != changeFile.absoluteFilePath()) + return true; // Oops?! + + // Prompt user. Force a prompt unless submit was actually invoked (that + // is, the editor was closed or shutdown). + CVSSettings newSettings = m_settings; + const VCSBase::VCSBaseSubmitEditor::PromptSubmitResult answer = + editor->promptSubmit(tr("Closing CVS Editor"), + tr("Do you want to commit the change?"), + tr("The commit message check failed. Do you want to commit the change?"), + &newSettings.promptToSubmit, !m_submitActionTriggered); + m_submitActionTriggered = false; + switch (answer) { + case VCSBase::VCSBaseSubmitEditor::SubmitCanceled: + return false; // Keep editing and change file + case VCSBase::VCSBaseSubmitEditor::SubmitDiscarded: + cleanChangeTmpFile(); + return true; // Cancel all + default: + break; + } + setSettings(newSettings); // in case someone turned prompting off + const QStringList fileList = editor->checkedFiles(); + bool closeEditor = true; + if (!fileList.empty()) { + // get message & commit + Core::ICore::instance()->fileManager()->blockFileChange(fileIFace); + fileIFace->save(); + Core::ICore::instance()->fileManager()->unblockFileChange(fileIFace); + closeEditor= commit(m_changeTmpFile->fileName(), fileList); + } + if (closeEditor) + cleanChangeTmpFile(); + return closeEditor; +} + +void CVSPlugin::diffFiles(const QStringList &files) +{ + cvsDiff(files); +} + +void CVSPlugin::cvsDiff(const QStringList &files, QString diffname) +{ + if (CVS::Constants::debug) + qDebug() << Q_FUNC_INFO << files << diffname; + const QString source = files.empty() ? QString() : files.front(); + QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VCSBase::VCSBaseEditor::getCodec(source); + + if (files.count() == 1 && diffname.isEmpty()) + diffname = QFileInfo(files.front()).fileName(); + + QStringList args(QLatin1String("diff")); + args << m_settings.cvsDiffOptions; + + // CVS returns the diff exit code (1 if files differ), which is + // undistinguishable from a "file not found" error, unfortunately. + const CVSResponse response = runCVS(args, files, cvsShortTimeOut, false, codec); + switch (response.result) { + case CVSResponse::NonNullExitCode: + case CVSResponse::Ok: + break; + case CVSResponse::OtherError: + return; + } + + QString output = fixDiffOutput(response.stdOut); + if (output.isEmpty()) + output = tr("The files do not differ."); + // diff of a single file? re-use an existing view if possible to support + // the common usage pattern of continuously changing and diffing a file + if (files.count() == 1) { + // Show in the same editor if diff has been executed before + if (Core::IEditor *editor = locateEditor("originalFileName", files.front())) { + editor->createNew(output); + Core::EditorManager::instance()->activateEditor(editor); + CVSEditor::setDiffBaseDir(editor, response.workingDirectory); + return; + } + } + const QString title = QString::fromLatin1("cvs diff %1").arg(diffname); + Core::IEditor *editor = showOutputInEditor(title, output, VCSBase::DiffOutput, source, codec); + if (files.count() == 1) + editor->setProperty("originalFileName", files.front()); + CVSEditor::setDiffBaseDir(editor, response.workingDirectory); +} + +CVSSubmitEditor *CVSPlugin::openCVSSubmitEditor(const QString &fileName) +{ + Core::IEditor *editor = Core::EditorManager::instance()->openEditor(fileName, QLatin1String(Constants::CVSCOMMITEDITOR_KIND)); + CVSSubmitEditor *submitEditor = qobject_cast<CVSSubmitEditor*>(editor); + QTC_ASSERT(submitEditor, /**/); + submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_submitCurrentLogAction, m_submitDiffAction); + connect(submitEditor, SIGNAL(diffSelectedFiles(QStringList)), this, SLOT(diffFiles(QStringList))); + + return submitEditor; +} + +void CVSPlugin::updateActions() +{ + m_diffProjectAction->setEnabled(true); + m_commitAllAction->setEnabled(true); + m_statusAction->setEnabled(true); + + const QString fileName = currentFileName(); + const QString baseName = fileName.isEmpty() ? fileName : QFileInfo(fileName).fileName(); + + m_addAction->setParameter(baseName); + m_deleteAction->setParameter(baseName); + m_revertAction->setParameter(baseName); + m_diffCurrentAction->setParameter(baseName); + m_commitCurrentAction->setParameter(baseName); + m_filelogCurrentAction->setParameter(baseName); + m_annotateCurrentAction->setParameter(baseName); +} + +void CVSPlugin::addCurrentFile() +{ + const QString file = currentFileName(); + if (!file.isEmpty()) + vcsAdd(file); +} + +void CVSPlugin::deleteCurrentFile() +{ + const QString file = currentFileName(); + if (file.isEmpty()) + return; + if (!Core::ICore::instance()->vcsManager()->showDeleteDialog(file)) + QMessageBox::warning(0, QLatin1String("CVS remove"), tr("The file '%1' could not be deleted.").arg(file), QMessageBox::Ok); +} + +void CVSPlugin::revertCurrentFile() +{ + const QString file = currentFileName(); + if (file.isEmpty()) + return; + + const CVSResponse diffResponse = runCVS(QStringList(QLatin1String("diff")), QStringList(file), cvsShortTimeOut, false); + switch (diffResponse.result) { + case CVSResponse::Ok: + return; // Not modified, diff exit code 0 + case CVSResponse::NonNullExitCode: // Diff exit code != 0 + if (diffResponse.stdOut.isEmpty()) // Paranoia: Something else failed? + return; + break; + case CVSResponse::OtherError: + return; + } + + if (QMessageBox::warning(0, QLatin1String("CVS revert"), tr("The file has been changed. Do you want to revert it?"), + QMessageBox::Yes, QMessageBox::No) == QMessageBox::No) + return; + + Core::FileChangeBlocker fcb(file); + + // revert + QStringList args(QLatin1String("update")); + args.push_back(QLatin1String("-C")); + + const CVSResponse revertResponse = runCVS(args, QStringList(file), cvsShortTimeOut, true); + if (revertResponse.result == CVSResponse::Ok) { + fcb.setModifiedReload(true); + } +} + +// Get a unique set of toplevel directories for the current projects. +// To be used for "diff all" or "commit all". +QStringList CVSPlugin::currentProjectsTopLevels(QString *name) const +{ + typedef QList<ProjectExplorer::Project *> ProjectList; + ProjectList projects; + // Compile list of projects + if (ProjectExplorer::Project *currentProject = m_projectExplorer->currentProject()) { + projects.push_back(currentProject); + } else { + if (const ProjectExplorer::SessionManager *session = m_projectExplorer->session()) + projects.append(session->projects()); + } + // Get unique set of toplevels and concat project names + QStringList toplevels; + const QChar blank(QLatin1Char(' ')); + foreach (const ProjectExplorer::Project *p, projects) { + if (name) { + if (!name->isEmpty()) + name->append(blank); + name->append(p->name()); + } + + const QString projectPath = QFileInfo(p->file()->fileName()).absolutePath(); + const QString topLevel = findTopLevelForDirectory(projectPath); + if (!topLevel.isEmpty() && !toplevels.contains(topLevel)) + toplevels.push_back(topLevel); + } + return toplevels; +} + +void CVSPlugin::diffProject() +{ + QString diffName; + const QStringList topLevels = currentProjectsTopLevels(&diffName); + if (!topLevels.isEmpty()) + cvsDiff(topLevels, diffName); +} + +void CVSPlugin::diffCurrentFile() +{ + cvsDiff(QStringList(currentFileName())); +} + +void CVSPlugin::startCommitCurrentFile() +{ + const QString file = currentFileName(); + if (!file.isEmpty()) + startCommit(file); +} + +void CVSPlugin::startCommitAll() +{ + // Make sure we have only repository for commit + const QStringList files = currentProjectsTopLevels(); + switch (files.size()) { + case 0: + break; + case 1: + startCommit(files.front()); + break; + default: { + const QString msg = tr("The commit list spans several repositories (%1). Please commit them one by one."). + arg(files.join(QString(QLatin1Char(' ')))); + QMessageBox::warning(0, QLatin1String("cvs commit"), msg, QMessageBox::Ok); + } + break; + } +} + +/* Start commit of files of a single repository by displaying + * template and files in a submit editor. On closing, the real + * commit will start. */ +void CVSPlugin::startCommit(const QString &source) +{ + if (source.isEmpty()) + return; + if (VCSBase::VCSBaseSubmitEditor::raiseSubmitEditor()) + return; + if (m_changeTmpFile) { + showOutput(tr("Another commit is currently being executed.")); + return; + } + const QFileInfo sourceFi(source); + const QString sourceDir = sourceFi.isDir() ? source : sourceFi.absolutePath(); + const QString topLevel = findTopLevelForDirectory(sourceDir); + if (topLevel.isEmpty()) { + showOutput(msgCannotFindTopLevel(source), true); + return; + } + // We need the "Examining <subdir>" stderr output to tell + // where we are, so, have stdout/stderr channels merged. + QStringList args = QStringList(QLatin1String("status")); + if (sourceDir == topLevel) { + args.push_back(QString(QLatin1Char('.'))); + } else { + args.push_back(QDir(topLevel).relativeFilePath(source)); + } + const CVSResponse response = runCVS(topLevel, args, cvsShortTimeOut, false, 0, true); + if (response.result != CVSResponse::Ok) + return; + // Get list of added/modified/deleted files + // As we run cvs in the repository directory, we need complete + // the file names by the respective directory. + const StateList statusOutput = parseStatusOutput(topLevel, response.stdOut); + if (CVS::Constants::debug) + qDebug() << Q_FUNC_INFO << '\n' << source << "top" << topLevel; + + if (statusOutput.empty()) { + showOutput(tr("There are no modified files."), true); + return; + } + + // Create a new submit change file containing the submit template + QTemporaryFile *changeTmpFile = new QTemporaryFile(this); + changeTmpFile->setAutoRemove(true); + if (!changeTmpFile->open()) { + showOutput(tr("Cannot create temporary file: %1").arg(changeTmpFile->errorString())); + delete changeTmpFile; + return; + } + m_changeTmpFile = changeTmpFile; + // TODO: Retrieve submit template from + const QString submitTemplate; + // Create a submit + m_changeTmpFile->write(submitTemplate.toUtf8()); + m_changeTmpFile->flush(); + m_changeTmpFile->seek(0); + // Create a submit editor and set file list + CVSSubmitEditor *editor = openCVSSubmitEditor(m_changeTmpFile->fileName()); + editor->setStateList(statusOutput); +} + +bool CVSPlugin::commit(const QString &messageFile, + const QStringList &fileList) +{ + if (CVS::Constants::debug) + qDebug() << Q_FUNC_INFO << messageFile << fileList; + QStringList args = QStringList(QLatin1String("commit")); + args << QLatin1String("-F") << messageFile; + const CVSResponse response = runCVS(args, fileList, cvsLongTimeOut, true); + return response.result == CVSResponse::Ok ; +} + +void CVSPlugin::filelogCurrentFile() +{ + const QString file = currentFileName(); + if (!file.isEmpty()) + filelog(file); +} + +void CVSPlugin::filelog(const QString &file) +{ + QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(file); + // no need for temp file + const CVSResponse response = runCVS(QStringList(QLatin1String("log")), QStringList(file), cvsShortTimeOut, false, codec); + if (response.result != CVSResponse::Ok) + return; + + // Re-use an existing view if possible to support + // the common usage pattern of continuously changing and diffing a file + + if (Core::IEditor *editor = locateEditor("logFileName", file)) { + editor->createNew(response.stdOut); + Core::EditorManager::instance()->activateEditor(editor); + } else { + const QString title = QString::fromLatin1("cvs log %1").arg(QFileInfo(file).fileName()); + Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VCSBase::LogOutput, file, codec); + newEditor->setProperty("logFileName", file); + } +} + +void CVSPlugin::updateProject() +{ + const QStringList topLevels = currentProjectsTopLevels(); + if (!topLevels.empty()) { + QStringList args(QLatin1String("update")); + args.push_back(QLatin1String("-dR")); + runCVS(args, topLevels, cvsLongTimeOut, true); + } +} + +void CVSPlugin::annotateCurrentFile() +{ + const QString file = currentFileName(); + if (!file.isEmpty()) + annotate(file); +} + +void CVSPlugin::annotate(const QString &file) +{ + QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(file); + const CVSResponse response = runCVS(QStringList(QLatin1String("annotate")), QStringList(file), cvsShortTimeOut, false, codec); + if (response.result != CVSResponse::Ok) + return; + + // Re-use an existing view if possible to support + // the common usage pattern of continuously changing and diffing a file + + if (Core::IEditor *editor = locateEditor("annotateFileName", file)) { + editor->createNew(response.stdOut); + Core::EditorManager::instance()->activateEditor(editor); + } else { + const QString title = QString::fromLatin1("cvs annotate %1").arg(QFileInfo(file).fileName()); + Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VCSBase::AnnotateOutput, file, codec); + newEditor->setProperty("annotateFileName", file); + } +} + +void CVSPlugin::projectStatus() +{ + if (!m_projectExplorer) + return; + + const QStringList topLevels = currentProjectsTopLevels(); + if (topLevels.empty()) + return; + + const CVSResponse response = runCVS(QStringList(QLatin1String("status")), topLevels, cvsShortTimeOut, false); + if (response.result == CVSResponse::Ok) + showOutputInEditor(tr("Project status"), response.stdOut, VCSBase::RegularCommandOutput, topLevels.front(), 0); +} + +// Decrement version number "1.2" -> "1.1" +static QString previousRevision(const QString &rev) +{ + const int dotPos = rev.lastIndexOf(QLatin1Char('.')); + if (dotPos == -1) + return rev; + const int minor = rev.mid(dotPos + 1).toInt(); + return rev.left(dotPos + 1) + QString::number(minor - 1); +} + +// Is "[1.2...].1"? +static inline bool isFirstRevision(const QString &r) +{ + return r.endsWith(QLatin1Char('1')); +} + +void CVSPlugin::slotDescribe(const QString &source, const QString &changeNr) +{ + QString errorMessage; + if (!describe(source, changeNr, &errorMessage)) + showOutput(errorMessage, true); +} + +bool CVSPlugin::describe(const QString &file, const QString &changeNr, QString *errorMessage) +{ + // In CVS, revisions of files are normally unrelated, there is + // no global revision/change number. The only thing that groups + // a commit is the "commit-id" (as shown in the log). + // This function makes use of it to find all files related to + // a commit in order to emulate a "describe global change" functionality + // if desired. + if (CVS::Constants::debug) + qDebug() << Q_FUNC_INFO << file << changeNr; + const QString toplevel = findTopLevelForDirectory(QFileInfo(file).absolutePath()); + if (toplevel.isEmpty()) { + *errorMessage = msgCannotFindTopLevel(file); + return false; + } + // Number must be > 1 + if (isFirstRevision(changeNr)) { + *errorMessage = tr("The initial revision %1 cannot be described.").arg(changeNr); + return false; + } + // Run log to obtain commit id and details + QStringList args(QLatin1String("log")); + args.push_back(QLatin1String("-r") + changeNr); + const CVSResponse logResponse = runCVS(args, QStringList(file), cvsShortTimeOut, false); + if (logResponse.result != CVSResponse::Ok) { + *errorMessage = logResponse.message; + return false; + } + const QList<CVS_LogEntry> fileLog = parseLogEntries(logResponse.stdOut, logResponse.workingDirectory); + if (fileLog.empty() || fileLog.front().revisions.empty()) { + *errorMessage = msgLogParsingFailed(); + return false; + } + if (m_settings.describeByCommitId) { + // Run a log command over the repo, filtering by the commit date + // and commit id, collecting all files touched by the commit. + const QString commitId = fileLog.front().revisions.front().commitId; + // Date range "D1<D2" in ISO format "YYYY-MM-DD" + const QString dateS = fileLog.front().revisions.front().date; + const QDate date = QDate::fromString(dateS, Qt::ISODate); + const QString nextDayS = date.addDays(1).toString(Qt::ISODate); + args.clear(); + args << QLatin1String("log") << QLatin1String("-d") << (dateS + QLatin1Char('<') + nextDayS); + const CVSResponse repoLogResponse = runCVS(args, QStringList(toplevel), cvsLongTimeOut, false); + if (repoLogResponse.result != CVSResponse::Ok) { + *errorMessage = repoLogResponse.message; + return false; + } + // Describe all files found, pass on dir to obtain correct absolute paths. + const QList<CVS_LogEntry> repoEntries = parseLogEntries(repoLogResponse.stdOut, QFileInfo(toplevel).absolutePath(), commitId); + if (repoEntries.empty()) { + *errorMessage = tr("Could not find commits of id '%1' on %2.").arg(commitId, dateS); + return false; + } + return describe(toplevel, repoEntries, errorMessage); + } else { + // Just describe that single entry + return describe(toplevel, fileLog, errorMessage); + } + return false; +} + +// Describe a set of files and revisions by +// concatenating log and diffs to previous revisions +bool CVSPlugin::describe(const QString &repositoryPath, QList<CVS_LogEntry> entries, + QString *errorMessage) +{ + // Collect logs + QString output; + const QDir repository(repositoryPath); + QTextCodec *codec = 0; + const QList<CVS_LogEntry>::iterator lend = entries.end(); + for (QList<CVS_LogEntry>::iterator it = entries.begin(); it != lend; ++it) { + // Before fiddling file names, try to find codec + if (!codec) + codec = VCSBase::VCSBaseEditor::getCodec(it->file); + // Make the files relative to the repository directory. + it->file = repository.relativeFilePath(it->file); + // Run log + QStringList args(QLatin1String("log")); + args << (QLatin1String("-r") + it->revisions.front().revision) << it->file; + const CVSResponse logResponse = runCVS(repositoryPath, args, cvsShortTimeOut, false); + if (logResponse.result != CVSResponse::Ok) { + *errorMessage = logResponse.message; + return false; + } + output += logResponse.stdOut; + } + // Collect diffs relative to repository + for (QList<CVS_LogEntry>::iterator it = entries.begin(); it != lend; ++it) { + const QString &revision = it->revisions.front().revision; + if (!isFirstRevision(revision)) { + const QString previousRev = previousRevision(revision); + QStringList args(QLatin1String("diff")); + args << m_settings.cvsDiffOptions << QLatin1String("-r") << previousRev + << QLatin1String("-r") << it->revisions.front().revision + << it->file; + const CVSResponse diffResponse = runCVS(repositoryPath, args, cvsShortTimeOut, false, codec); + switch (diffResponse.result) { + case CVSResponse::Ok: + case CVSResponse::NonNullExitCode: // Diff exit code != 0 + if (diffResponse.stdOut.isEmpty()) { + *errorMessage = diffResponse.message; + return false; // Something else failed. + } + break; + case CVSResponse::OtherError: + *errorMessage = diffResponse.message; + return false; + } + output += fixDiffOutput(diffResponse.stdOut); + } + } + + // Re-use an existing view if possible to support + // the common usage pattern of continuously changing and diffing a file + const QString commitId = entries.front().revisions.front().commitId; + if (Core::IEditor *editor = locateEditor("describeChange", commitId)) { + editor->createNew(output); + Core::EditorManager::instance()->activateEditor(editor); + CVSEditor::setDiffBaseDir(editor, repositoryPath); + } else { + const QString title = QString::fromLatin1("cvs describe %1").arg(commitId); + Core::IEditor *newEditor = showOutputInEditor(title, output, VCSBase::DiffOutput, entries.front().file, codec); + newEditor->setProperty("describeChange", commitId); + CVSEditor::setDiffBaseDir(newEditor, repositoryPath); + } + return true; +} + +void CVSPlugin::submitCurrentLog() +{ + m_submitActionTriggered = true; + Core::EditorManager::instance()->closeEditors(QList<Core::IEditor*>() + << Core::EditorManager::instance()->currentEditor()); +} + +QString CVSPlugin::currentFileName() const +{ + const QString fileName = Core::ICore::instance()->fileManager()->currentFile(); + if (!fileName.isEmpty()) { + const QFileInfo fi(fileName); + if (fi.exists()) + return fi.canonicalFilePath(); + } + return QString(); +} + +static inline QString processStdErr(QProcess &proc) +{ + return QString::fromLocal8Bit(proc.readAllStandardError()).remove(QLatin1Char('\r')); +} + +static inline QString processStdOut(QProcess &proc, QTextCodec *outputCodec = 0) +{ + const QByteArray stdOutData = proc.readAllStandardOutput(); + QString stdOut = outputCodec ? outputCodec->toUnicode(stdOutData) : QString::fromLocal8Bit(stdOutData); + return stdOut.remove(QLatin1Char('\r')); +} + +/* Tortoise CVS does not allow for absolute path names + * (which it claims to be CVS standard behaviour). + * So, try to figure out the common root of the file arguments, + * remove it from the files and return it as working directory for + * the process. Note that it is principle possible to have + * projects with differing repositories open in a session, + * so, trying to find a common repository is not an option. + * Usually, there is only one file argument, which is not + * problematic; it is just split using QFileInfo. */ + +// Figure out length of common start of string ("C:\a", "c:\b" -> "c:\" +static inline int commonPartSize(const QString &s1, const QString &s2) +{ + const int size = qMin(s1.size(), s2.size()); + for (int i = 0; i < size; i++) + if (s1.at(i) != s2.at(i)) + return i; + return size; +} + +static inline QString fixFileArgs(QStringList *files) +{ + switch (files->size()) { + case 0: + return QString(); + case 1: { // Easy, just one + const QFileInfo fi(files->at(0)); + (*files)[0] = fi.fileName(); + return fi.absolutePath(); + } + default: + break; + } + // Figure out common string part: "C:\foo\bar1" "C:\foo\bar2" -> "C:\foo\bar" + int commonLength = INT_MAX; + const int last = files->size() - 1; + for (int i = 0; i < last; i++) + commonLength = qMin(commonLength, commonPartSize(files->at(i), files->at(i + 1))); + if (!commonLength) + return QString(); + // Find directory part: "C:\foo\bar" -> "C:\foo" + QString common = files->at(0).left(commonLength); + int lastSlashPos = common.lastIndexOf(QLatin1Char('/')); + if (lastSlashPos == -1) + lastSlashPos = common.lastIndexOf(QLatin1Char('\\')); + if (lastSlashPos == -1) + return QString(); +#ifdef Q_OS_UNIX + if (lastSlashPos == 0) // leave "/a", "/b" untouched + return QString(); +#endif + common.truncate(lastSlashPos); + // remove up until slash from the files + commonLength = lastSlashPos + 1; + const QStringList::iterator end = files->end(); + for (QStringList::iterator it = files->begin(); it != end; ++it) { + it->remove(0, commonLength); + } + return common; +} + +// Format log entry for command +static inline QString msgExecutionLogEntry(const QString &workingDir, const QString &executable, const QStringList &arguments) +{ + const QString timeStamp = QTime::currentTime().toString(QLatin1String("HH:mm")); + //: <timestamp> Executing: <executable> <arguments> + const QString args = arguments.join(QString(QLatin1Char(' '))); + if (workingDir.isEmpty()) + return CVSPlugin::tr("%1 Executing: %2 %3\n").arg(timeStamp, executable, args); + return CVSPlugin::tr("%1 Executing in %2: %3 %4\n").arg(timeStamp, workingDir, executable, args); +} + +// Figure out a working directory for the process, +// fix the file arguments accordingly and run CVS. +CVSResponse CVSPlugin::runCVS(const QStringList &arguments, + QStringList files, + int timeOut, + bool showStdOutInOutputWindow, + QTextCodec *outputCodec, + bool mergeStderr) +{ + const QString workingDirectory = fixFileArgs(&files); + return runCVS( workingDirectory, arguments + files, timeOut, showStdOutInOutputWindow, outputCodec, mergeStderr); +} + +// Run CVS. At this point, file arguments must be relative to +// the working directory (see above). +CVSResponse CVSPlugin::runCVS(const QString &workingDirectory, + const QStringList &arguments, + int timeOut, + bool showStdOutInOutputWindow, QTextCodec *outputCodec, + bool mergeStderr) +{ + const QString executable = m_settings.cvsCommand; + CVSResponse response; + if (executable.isEmpty()) { + response.result = CVSResponse::OtherError; + response.message =tr("No cvs executable specified!"); + return response; + } + // Fix files and compile complete arguments + response.workingDirectory = workingDirectory; + const QStringList allArgs = m_settings.addOptions(arguments); + + const QString outputText = msgExecutionLogEntry(response.workingDirectory, executable, allArgs); + showOutput(outputText, false); + + if (CVS::Constants::debug) + qDebug() << "runCVS" << timeOut << outputText; + + // Run, connect stderr to the output window + Core::Utils::SynchronousProcess process; + if (!response.workingDirectory.isEmpty()) + process.setWorkingDirectory(response.workingDirectory); + + if (mergeStderr) + process.setProcessChannelMode(QProcess::MergedChannels); + + process.setTimeout(timeOut); + process.setStdOutCodec(outputCodec); + + process.setStdErrBufferedSignalsEnabled(true); + connect(&process, SIGNAL(stdErrBuffered(QString,bool)), m_cvsOutputWindow, SLOT(append(QString,bool))); + + // connect stdout to the output window if desired + if (showStdOutInOutputWindow) { + process.setStdOutBufferedSignalsEnabled(true); + connect(&process, SIGNAL(stdOutBuffered(QString,bool)), m_cvsOutputWindow, SLOT(append(QString,bool))); + } + + const Core::Utils::SynchronousProcessResponse sp_resp = process.run(executable, allArgs); + response.result = CVSResponse::OtherError; + response.stdErr = sp_resp.stdErr; + response.stdOut = sp_resp.stdOut; + switch (sp_resp.result) { + case Core::Utils::SynchronousProcessResponse::Finished: + response.result = CVSResponse::Ok; + break; + case Core::Utils::SynchronousProcessResponse::FinishedError: + response.result = CVSResponse::NonNullExitCode; + response.message = tr("The process terminated with exit code %1.").arg(sp_resp.exitCode); + break; + case Core::Utils::SynchronousProcessResponse::TerminatedAbnormally: + response.message = tr("The process terminated abnormally."); + break; + case Core::Utils::SynchronousProcessResponse::StartFailed: + response.message = tr("Could not start cvs '%1'. Please check your settings in the preferences.").arg(executable); + break; + case Core::Utils::SynchronousProcessResponse::Hang: + response.message = tr("CVS did not respond within timeout limit (%1 ms).").arg(timeOut); + break; + } + if (response.result != CVSResponse::Ok) + m_cvsOutputWindow->append(response.message, true); + + return response; +} + +void CVSPlugin::showOutput(const QString &output, bool bringToForeground) +{ + m_cvsOutputWindow->append(output); + if (bringToForeground) + m_cvsOutputWindow->popup(); +} + +Core::IEditor * CVSPlugin::showOutputInEditor(const QString& title, const QString &output, + int editorType, const QString &source, + QTextCodec *codec) +{ + const VCSBase::VCSBaseEditorParameters *params = findType(editorType); + QTC_ASSERT(params, return 0); + const QString kind = QLatin1String(params->kind); + if (CVS::Constants::debug) + qDebug() << "CVSPlugin::showOutputInEditor" << title << kind << "source=" << source << "Size= " << output.size() << " Type=" << editorType << debugCodec(codec); + QString s = title; + Core::IEditor *editor = Core::EditorManager::instance()->newFile(kind, &s, output.toLocal8Bit()); + CVSEditor *e = qobject_cast<CVSEditor*>(editor->widget()); + if (!e) + return 0; + s.replace(QLatin1Char(' '), QLatin1Char('_')); + e->setSuggestedFileName(s); + if (!source.isEmpty()) + e->setSource(source); + if (codec) + e->setCodec(codec); + Core::IEditor *ie = e->editableInterface(); + Core::EditorManager::instance()->activateEditor(ie); + return ie; +} + +CVSSettings CVSPlugin::settings() const +{ + return m_settings; +} + +void CVSPlugin::setSettings(const CVSSettings &s) +{ + if (s != m_settings) { + m_settings = s; + if (QSettings *settings = Core::ICore::instance()->settings()) + m_settings.toSettings(settings); + } +} + +CVSPlugin *CVSPlugin::cvsPluginInstance() +{ + QTC_ASSERT(m_cvsPluginInstance, return m_cvsPluginInstance); + return m_cvsPluginInstance; +} + +bool CVSPlugin::vcsAdd(const QString &rawFileName) +{ + const CVSResponse response = runCVS(QStringList(QLatin1String("add")), QStringList(rawFileName), cvsShortTimeOut, true); + return response.result == CVSResponse::Ok; +} + +bool CVSPlugin::vcsDelete(const QString &rawFileName) +{ + QStringList args(QLatin1String("remove")); + args << QLatin1String("-f"); + const CVSResponse response = runCVS(args, QStringList(rawFileName), cvsShortTimeOut, true); + return response.result == CVSResponse::Ok; +} + +/* CVS has a "CVS" directory in each directory it manages. The top level + * is the first directory under the directory that does not have it. */ +bool CVSPlugin::managesDirectory(const QString &directory) const +{ + const QDir dir(directory); + const bool rc = dir.exists() && managesDirectory(dir); + if (CVS::Constants::debug) + qDebug() << "CVSPlugin::managesDirectory" << directory << rc; + return rc; +} + +bool CVSPlugin::managesDirectory(const QDir &directory) const +{ + const QString cvsDir = directory.absoluteFilePath(QLatin1String("CVS")); + return QFileInfo(cvsDir).isDir(); +} + +QString CVSPlugin::findTopLevelForDirectory(const QString &directory) const +{ + // Debug wrapper + const QString rc = findTopLevelForDirectoryI(directory); + if (CVS::Constants::debug) + qDebug() << "CVSPlugin::findTopLevelForDirectory" << directory << rc; + return rc; +} + +QString CVSPlugin::findTopLevelForDirectoryI(const QString &directory) const +{ + /* Recursing up, the top level is a child of the first directory that does + * not have a "CVS" directory. The starting directory must be a managed + * one. Go up and try to find the first unmanaged parent dir. */ + QDir lastDirectory = QDir(directory); + if (!lastDirectory.exists() || !managesDirectory(lastDirectory)) + return QString(); + for (QDir parentDir = lastDirectory; parentDir.cdUp() ; lastDirectory = parentDir) { + if (!managesDirectory(parentDir)) + return lastDirectory.absolutePath(); + } + return QString(); +} + +} +} +Q_EXPORT_PLUGIN(CVS::Internal::CVSPlugin) diff --git a/src/plugins/cvs/cvsplugin.h b/src/plugins/cvs/cvsplugin.h new file mode 100644 index 0000000000..ef54049e71 --- /dev/null +++ b/src/plugins/cvs/cvsplugin.h @@ -0,0 +1,208 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#ifndef CVSPLUGIN_H +#define CVSPLUGIN_H + +#include "cvssettings.h" +#include "cvsutils.h" + +#include <coreplugin/icorelistener.h> +#include <extensionsystem/iplugin.h> + +QT_BEGIN_NAMESPACE +class QDir; +class QAction; +class QTemporaryFile; +class QTextCodec; +QT_END_NAMESPACE + +namespace Core { + class IEditorFactory; + class IVersionControl; + namespace Utils { + class ParameterAction; + } +} + +namespace ProjectExplorer { + class ProjectExplorerPlugin; +} + +namespace CVS { +namespace Internal { + +class CVSOutputWindow; +class CVSSubmitEditor; + +struct CVSResponse +{ + enum Result { Ok, NonNullExitCode, OtherError }; + CVSResponse() : result(Ok) {} + + Result result; + QString stdOut; + QString stdErr; + QString message; + QString workingDirectory; +}; + +/* This plugin differs from the other VCS plugins in that it + * runs CVS commands from a working directory using relative + * path specifications, which is a requirement imposed by + * Tortoise CVS. This has to be taken into account; for example, + * the diff editor has an additional property specifying the + * base directory for its interaction to work. */ + +class CVSPlugin : public ExtensionSystem::IPlugin +{ + Q_OBJECT + +public: + CVSPlugin(); + ~CVSPlugin(); + + virtual bool initialize(const QStringList &arguments, QString *error_message); + virtual void extensionsInitialized(); + virtual bool editorAboutToClose(Core::IEditor *editor); + + void cvsDiff(const QStringList &files, QString diffname = QString()); + + CVSSubmitEditor *openCVSSubmitEditor(const QString &fileName); + + CVSSettings settings() const; + void setSettings(const CVSSettings &s); + + // IVersionControl + bool vcsAdd(const QString &fileName); + bool vcsDelete(const QString &fileName); + bool managesDirectory(const QString &directory) const; + QString findTopLevelForDirectory(const QString &directory) const; + + static CVSPlugin *cvsPluginInstance(); + +private slots: + void updateActions(); + void addCurrentFile(); + void deleteCurrentFile(); + void revertCurrentFile(); + void diffProject(); + void diffCurrentFile(); + void startCommitAll(); + void startCommitCurrentFile(); + void filelogCurrentFile(); + void annotateCurrentFile(); + void projectStatus(); + void slotDescribe(const QString &source, const QString &changeNr); + void updateProject(); + void submitCurrentLog(); + void diffFiles(const QStringList &); + +private: + QString currentFileName() const; + Core::IEditor * showOutputInEditor(const QString& title, const QString &output, + int editorType, const QString &source, + QTextCodec *codec); + CVSResponse runCVS(const QStringList &arguments, + QStringList fileArguments, + int timeOut, + bool showStdOutInOutputWindow, QTextCodec *outputCodec = 0, + bool mergeStderr = false); + + CVSResponse runCVS(const QString &workingDirectory, + const QStringList &arguments, + int timeOut, + bool showStdOutInOutputWindow, QTextCodec *outputCodec = 0, + bool mergeStderr = false); + + void showOutput(const QString &output, bool bringToForeground = true); + void annotate(const QString &file); + bool describe(const QString &source, const QString &changeNr, QString *errorMessage); + bool describe(const QString &repository, QList<CVS_LogEntry> entries, QString *errorMessage); + void filelog(const QString &file); + bool managesDirectory(const QDir &directory) const; + QString findTopLevelForDirectoryI(const QString &directory) const; + QStringList currentProjectsTopLevels(QString *name = 0) const; + void startCommit(const QString &file); + bool commit(const QString &messageFile, const QStringList &subVersionFileList); + void cleanChangeTmpFile(); + + CVSSettings m_settings; + Core::IVersionControl *m_versionControl; + QTemporaryFile *m_changeTmpFile; + + CVSOutputWindow *m_cvsOutputWindow; + ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer; + + Core::Utils::ParameterAction *m_addAction; + Core::Utils::ParameterAction *m_deleteAction; + Core::Utils::ParameterAction *m_revertAction; + QAction *m_diffProjectAction; + Core::Utils::ParameterAction *m_diffCurrentAction; + QAction *m_commitAllAction; + Core::Utils::ParameterAction *m_commitCurrentAction; + Core::Utils::ParameterAction *m_filelogCurrentAction; + Core::Utils::ParameterAction *m_annotateCurrentAction; + QAction *m_statusAction; + QAction *m_updateProjectAction; + + QAction *m_submitCurrentLogAction; + QAction *m_submitDiffAction; + QAction *m_submitUndoAction; + QAction *m_submitRedoAction; + bool m_submitActionTriggered; + + static CVSPlugin *m_cvsPluginInstance; +}; + +// Just a proxy for CVSPlugin +class CoreListener : public Core::ICoreListener +{ + Q_OBJECT +public: + CoreListener(CVSPlugin *plugin) : m_plugin(plugin) { } + + // Start commit when submit editor closes + bool editorAboutToClose(Core::IEditor *editor) { + return m_plugin->editorAboutToClose(editor); + } + + // TODO: how to handle that ??? + bool coreAboutToClose() { + return true; + } + +private: + CVSPlugin *m_plugin; +}; + +} // namespace CVS +} // namespace Internal + +#endif // CVSPLUGIN_H diff --git a/src/plugins/cvs/cvssettings.cpp b/src/plugins/cvs/cvssettings.cpp new file mode 100644 index 0000000000..204fbf7225 --- /dev/null +++ b/src/plugins/cvs/cvssettings.cpp @@ -0,0 +1,108 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#include "cvssettings.h" + +#include <QtCore/QSettings> +#include <QtCore/QTextStream> + +static const char *groupC = "CVS"; +static const char *commandKeyC = "Command"; +static const char *rootC = "Root"; +static const char *promptToSubmitKeyC = "PromptForSubmit"; +static const char *diffOptionsKeyC = "DiffOptions"; +static const char *describeByCommitIdKeyC = "DescribeByCommitId"; +static const char *defaultDiffOptions = "-du"; + +static QString defaultCommand() +{ + QString rc; + rc = QLatin1String("cvs"); +#if defined(Q_OS_WIN32) + rc.append(QLatin1String(".exe")); +#endif + return rc; +} + +namespace CVS { + namespace Internal { + +CVSSettings::CVSSettings() : + cvsCommand(defaultCommand()), + cvsDiffOptions(QLatin1String(defaultDiffOptions)), + promptToSubmit(true), + describeByCommitId(true) +{ +} + +void CVSSettings::fromSettings(QSettings *settings) +{ + settings->beginGroup(QLatin1String(groupC)); + cvsCommand = settings->value(QLatin1String(commandKeyC), defaultCommand()).toString(); + promptToSubmit = settings->value(QLatin1String(promptToSubmitKeyC), true).toBool(); + cvsRoot = settings->value(QLatin1String(rootC), QString()).toString(); + cvsDiffOptions = settings->value(QLatin1String(diffOptionsKeyC), QLatin1String(defaultDiffOptions)).toString(); + describeByCommitId = settings->value(QLatin1String(describeByCommitIdKeyC), true).toBool(); + settings->endGroup(); +} + +void CVSSettings::toSettings(QSettings *settings) const +{ + settings->beginGroup(QLatin1String(groupC)); + settings->setValue(QLatin1String(commandKeyC), cvsCommand); + settings->setValue(QLatin1String(promptToSubmitKeyC), promptToSubmit); + settings->setValue(QLatin1String(rootC), cvsRoot); + settings->setValue(QLatin1String(diffOptionsKeyC), cvsDiffOptions); + settings->setValue(QLatin1String(describeByCommitIdKeyC), describeByCommitId); + settings->endGroup(); +} + +bool CVSSettings::equals(const CVSSettings &s) const +{ + return promptToSubmit == promptToSubmit + && describeByCommitId == s.describeByCommitId + && cvsCommand == s.cvsCommand + && cvsRoot == s.cvsRoot + && cvsDiffOptions == s.cvsDiffOptions; +} + +QStringList CVSSettings::addOptions(const QStringList &args) const +{ + if (cvsRoot.isEmpty()) + return args; + + QStringList rc; + rc.push_back(QLatin1String("-d")); + rc.push_back(cvsRoot); + rc.append(args); + return rc; +} + +} +} diff --git a/src/plugins/cvs/cvssettings.h b/src/plugins/cvs/cvssettings.h new file mode 100644 index 0000000000..ff37307f2b --- /dev/null +++ b/src/plugins/cvs/cvssettings.h @@ -0,0 +1,70 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#ifndef CVSSETTINGS_H +#define CVSSETTINGS_H + +#include <QtCore/QStringList> + +QT_BEGIN_NAMESPACE +class QSettings; +QT_END_NAMESPACE + +namespace CVS { +namespace Internal { + +// Todo: Add user name and password? +struct CVSSettings +{ + CVSSettings(); + + void fromSettings(QSettings *); + void toSettings(QSettings *) const; + + // Add common options to the command line + QStringList addOptions(const QStringList &args) const; + + bool equals(const CVSSettings &s) const; + + QString cvsCommand; + QString cvsRoot; + QString cvsDiffOptions; + bool promptToSubmit; + bool describeByCommitId; +}; + +inline bool operator==(const CVSSettings &p1, const CVSSettings &p2) + { return p1.equals(p2); } +inline bool operator!=(const CVSSettings &p1, const CVSSettings &p2) + { return !p1.equals(p2); } + +} // namespace Internal +} // namespace CVS + +#endif // CVSSETTINGS_H diff --git a/src/plugins/cvs/cvssubmiteditor.cpp b/src/plugins/cvs/cvssubmiteditor.cpp new file mode 100644 index 0000000000..5e8a5a0306 --- /dev/null +++ b/src/plugins/cvs/cvssubmiteditor.cpp @@ -0,0 +1,70 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + + +#include "cvssubmiteditor.h" + +#include <utils/submiteditorwidget.h> +#include <vcsbase/submitfilemodel.h> + +using namespace CVS::Internal; + +CVSSubmitEditor::CVSSubmitEditor(const VCSBase::VCSBaseSubmitEditorParameters *parameters, + QWidget *parentWidget) : + VCSBase::VCSBaseSubmitEditor(parameters, new Core::Utils::SubmitEditorWidget(parentWidget)), + m_msgAdded(tr("Added")), + m_msgRemoved(tr("Removed")), + m_msgModified(tr("Modified")) +{ + setDisplayName(tr("CVS Submit")); +} + +QString CVSSubmitEditor::stateName(State st) const +{ + switch (st) { + case LocallyAdded: + return m_msgAdded; + case LocallyModified: + return m_msgModified; + case LocallyRemoved: + return m_msgRemoved; + } + return QString(); +} + +void CVSSubmitEditor::setStateList(const QList<StateFilePair> &statusOutput) +{ + typedef QList<StateFilePair>::const_iterator ConstIterator; + VCSBase::SubmitFileModel *model = new VCSBase::SubmitFileModel(this); + + const ConstIterator cend = statusOutput.constEnd(); + for (ConstIterator it = statusOutput.constBegin(); it != cend; ++it) + model->addFile(it->second, stateName(it->first), true); + setFileModel(model); +} diff --git a/src/plugins/cvs/cvssubmiteditor.h b/src/plugins/cvs/cvssubmiteditor.h new file mode 100644 index 0000000000..0e103513e9 --- /dev/null +++ b/src/plugins/cvs/cvssubmiteditor.h @@ -0,0 +1,64 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#ifndef CVSSUBMITEDITOR_H +#define CVSSUBMITEDITOR_H + +#include <QtCore/QPair> +#include <QtCore/QStringList> + +#include <vcsbase/vcsbasesubmiteditor.h> + +namespace CVS { +namespace Internal { + +class CVSSubmitEditor : public VCSBase::VCSBaseSubmitEditor +{ + Q_OBJECT +public: + enum State { LocallyAdded, LocallyModified, LocallyRemoved }; + // A list of state indicators and file names. + typedef QPair<State, QString> StateFilePair; + + CVSSubmitEditor(const VCSBase::VCSBaseSubmitEditorParameters *parameters, + QWidget *parentWidget = 0); + + void setStateList(const QList<StateFilePair> &statusOutput); + +private: + inline QString stateName(State st) const; + const QString m_msgAdded; + const QString m_msgRemoved; + const QString m_msgModified; +}; + +} // namespace Internal +} // namespace CVS + +#endif // CVSSUBMITEDITOR_H diff --git a/src/plugins/cvs/cvsutils.cpp b/src/plugins/cvs/cvsutils.cpp new file mode 100644 index 0000000000..fcd193dd3f --- /dev/null +++ b/src/plugins/cvs/cvsutils.cpp @@ -0,0 +1,238 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#include "cvsutils.h" + +#include <QtCore/QDebug> +#include <QtCore/QRegExp> +#include <QtCore/QStringList> + +namespace CVS { +namespace Internal { + +CVS_Revision::CVS_Revision(const QString &rev) : + revision(rev) +{ +} + +CVS_LogEntry::CVS_LogEntry(const QString &f) : + file(f) +{ +} + +QDebug operator<<(QDebug d, const CVS_LogEntry &e) +{ + QDebug nospace = d.nospace(); + nospace << "File: " << e.file << e.revisions.size() << '\n'; + foreach(const CVS_Revision &r, e.revisions) + nospace << " " << r.revision << ' ' << r.date << ' ' << r.commitId << '\n'; + return d; +} + +/* Parse: +\code +RCS file: /repo/foo.h +Working file: foo.h +head: 1.2 +... +---------------------------- +revision 1.2 +date: 2009-07-14 13:30:25 +0200; author: <author>; state: dead; lines: +0 -0; commitid: <id>; +<message> +---------------------------- +revision 1.1 +... +============================================================================= +\endcode */ + +QList<CVS_LogEntry> parseLogEntries(const QString &o, + const QString &directory, + const QString filterCommitId) +{ + enum ParseState { FileState, RevisionState, StatusLineState }; + + QList<CVS_LogEntry> rc; + const QStringList lines = o.split(QString(QLatin1Char('\n')), QString::SkipEmptyParts); + ParseState state = FileState; + + const QString workingFilePrefix = QLatin1String("Working file: "); + const QString revisionPrefix = QLatin1String("revision "); + const QString statusPrefix = QLatin1String("date: "); + const QString commitId = QLatin1String("commitid: "); + const QRegExp statusPattern = QRegExp(QLatin1String("^date: ([\\d\\-]+) .*commitid: ([^;]+);$")); + const QRegExp revisionPattern = QRegExp(QLatin1String("^revision ([\\d\\.]+)$")); + const QChar slash = QLatin1Char('/'); + Q_ASSERT(statusPattern.isValid() && revisionPattern.isValid()); + const QString fileSeparator = QLatin1String("============================================================================="); + + // Parse using a state enumeration and regular expressions as not to fall for weird + // commit messages in state 'RevisionState' + foreach(const QString &line, lines) { + switch (state) { + case FileState: + if (line.startsWith(workingFilePrefix)) { + QString file = directory; + if (!file.isEmpty()) + file += slash; + file += line.mid(workingFilePrefix.size()).trimmed(); + rc.push_back(CVS_LogEntry(file)); + state = RevisionState; + } + break; + case RevisionState: + if (revisionPattern.exactMatch(line)) { + rc.back().revisions.push_back(CVS_Revision(revisionPattern.cap(1))); + state = StatusLineState; + } else { + if (line == fileSeparator) + state = FileState; + } + break; + case StatusLineState: + if (statusPattern.exactMatch(line)) { + const QString commitId = statusPattern.cap(2); + if (filterCommitId.isEmpty() || filterCommitId == commitId) { + rc.back().revisions.back().date = statusPattern.cap(1); + rc.back().revisions.back().commitId = commitId; + } else { + rc.back().revisions.pop_back(); + } + state = RevisionState; + } + } + } + // Purge out files with no matching commits + if (!filterCommitId.isEmpty()) { + for (QList<CVS_LogEntry>::iterator it = rc.begin(); it != rc.end(); ) { + if (it->revisions.empty()) { + it = rc.erase(it); + } else { + ++it; + } + } + } + return rc; +} + +QString fixDiffOutput(QString d) +{ + if (d.isEmpty()) + return d; + // Kill all lines starting with '?' + const QChar questionMark = QLatin1Char('?'); + const QChar newLine = QLatin1Char('\n'); + for (int pos = 0; pos < d.size(); ) { + const int endOfLinePos = d.indexOf(newLine, pos); + if (endOfLinePos == -1) + break; + const int nextLinePos = endOfLinePos + 1; + if (d.at(pos) == questionMark) { + d.remove(pos, nextLinePos - pos); + } else { + pos = nextLinePos; + } + } + return d; +} + +// Parse "cvs status" output for added/modified/deleted files +// "File: <foo> Status: Up-to-date" +// "File: <foo> Status: Locally Modified" +// "File: no file <foo> Status: Locally Removed" +// "File: hup Status: Locally Added" +// Not handled for commit purposes: "Needs Patch/Needs Merge" +// In between, we might encounter "cvs status: Examining subdir"... +// As we run the status command from the repository directory, +// we need to add the full path, again. +// stdout/stderr need to be merged to catch directories. + +// Parse out status keywords, return state enum or -1 +inline int stateFromKeyword(const QString &s) +{ + if (s == QLatin1String("Up-to-date")) + return -1; + if (s == QLatin1String("Locally Modified")) + return CVSSubmitEditor::LocallyModified; + if (s == QLatin1String("Locally Added")) + return CVSSubmitEditor::LocallyAdded; + if (s == QLatin1String("Locally Removed")) + return CVSSubmitEditor::LocallyRemoved; + return -1; +} + +StateList parseStatusOutput(const QString &directory, const QString &output) +{ + StateList changeSet; + const QString fileKeyword = QLatin1String("File: "); + const QString statusKeyword = QLatin1String("Status: "); + const QString noFileKeyword = QLatin1String("no file "); + const QString directoryKeyword = QLatin1String("cvs status: Examining "); + const QString dotDir = QString(QLatin1Char('.')); + const QChar slash = QLatin1Char('/'); + + const QStringList list = output.split(QLatin1Char('\n'), QString::SkipEmptyParts); + + QString path = directory; + if (!path.isEmpty()) + path += slash; + foreach (const QString &l, list) { + // Status line containing file + if (l.startsWith(fileKeyword)) { + // Parse state + const int statusPos = l.indexOf(statusKeyword); + if (statusPos == -1) + continue; + const int state = stateFromKeyword(l.mid(statusPos + statusKeyword.size()).trimmed()); + if (state == -1) + continue; + // Concatenate file name, Correct "no file <foo>" + QString fileName = l.mid(fileKeyword.size(), statusPos - fileKeyword.size()).trimmed(); + if (state == CVSSubmitEditor::LocallyRemoved && fileName.startsWith(noFileKeyword)) + fileName.remove(0, noFileKeyword.size()); + changeSet.push_back(CVSSubmitEditor::StateFilePair(static_cast<CVSSubmitEditor::State>(state), path + fileName)); + continue; + } + // Examining a new subdirectory + if (l.startsWith(directoryKeyword)) { + path = directory; + if (!path.isEmpty()) + path += slash; + const QString newSubDir = l.mid(directoryKeyword.size()).trimmed(); + if (newSubDir != dotDir) { // Skip Examining '.' + path += newSubDir; + path += slash; + } + continue; + } + } + return changeSet; +} + +} // namespace Internal +} // namespace CVS diff --git a/src/plugins/cvs/cvsutils.h b/src/plugins/cvs/cvsutils.h new file mode 100644 index 0000000000..4515c96be3 --- /dev/null +++ b/src/plugins/cvs/cvsutils.h @@ -0,0 +1,86 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#ifndef CVSUTILS_H +#define CVSUTILS_H + +#include "cvssubmiteditor.h" + +#include <QtCore/QString> +#include <QtCore/QList> + +QT_BEGIN_NAMESPACE +class QDebug; +QT_END_NAMESPACE + +namespace CVS { +namespace Internal { + +// Utilities to parse output of a CVS log. + +// A revision of a file. +struct CVS_Revision +{ + CVS_Revision(const QString &rev); + + QString revision; + QString date; // ISO-Format (YYYY-MM-DD) + QString commitId; +}; + +// A log entry consisting of the file and its revisions. +struct CVS_LogEntry +{ + CVS_LogEntry(const QString &file); + + QString file; + QList<CVS_Revision> revisions; +}; + +QDebug operator<<(QDebug d, const CVS_LogEntry &); + +// Parse. Pass on a directory to obtain full paths when +// running from the repository directory. +QList<CVS_LogEntry> parseLogEntries(const QString &output, + const QString &directory = QString(), + const QString filterCommitId = QString()); + +// Tortoise CVS outputs unknown files with question marks in +// the diff output on stdout ('? foo'); remove +QString fixDiffOutput(QString d); + +// Parse the status output of CVS (stdout/stderr merged +// to catch directories). +typedef QList<CVSSubmitEditor::StateFilePair> StateList; +StateList parseStatusOutput(const QString &directory, const QString &output); + +} // namespace Internal +} // namespace CVS + +#endif // CVSUTILS_H diff --git a/src/plugins/cvs/settingspage.cpp b/src/plugins/cvs/settingspage.cpp new file mode 100644 index 0000000000..589580859d --- /dev/null +++ b/src/plugins/cvs/settingspage.cpp @@ -0,0 +1,107 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#include "settingspage.h" +#include "cvssettings.h" +#include "cvsplugin.h" + +#include <coreplugin/icore.h> +#include <extensionsystem/pluginmanager.h> +#include <vcsbase/vcsbaseconstants.h> +#include <utils/pathchooser.h> + +#include <QtCore/QCoreApplication> +#include <QtGui/QFileDialog> + +using namespace CVS::Internal; +using namespace Core::Utils; + +SettingsPageWidget::SettingsPageWidget(QWidget *parent) : + QWidget(parent) +{ + m_ui.setupUi(this); + m_ui.commandPathChooser->setExpectedKind(PathChooser::Command); + m_ui.commandPathChooser->setPromptDialogTitle(tr("CVS Command")); +} + +CVSSettings SettingsPageWidget::settings() const +{ + CVSSettings rc; + rc.cvsCommand = m_ui.commandPathChooser->path(); + rc.cvsRoot = m_ui.rootLineEdit->text(); + rc.cvsDiffOptions = m_ui.diffOptionsLineEdit->text(); + rc.promptToSubmit = m_ui.promptToSubmitCheckBox->isChecked(); + rc.describeByCommitId = m_ui.describeByCommitIdCheckBox->isChecked(); + return rc; +} + +void SettingsPageWidget::setSettings(const CVSSettings &s) +{ + m_ui.commandPathChooser->setPath(s.cvsCommand); + m_ui.rootLineEdit->setText(s.cvsRoot); + m_ui.diffOptionsLineEdit->setText(s.cvsDiffOptions); + m_ui.promptToSubmitCheckBox->setChecked(s.promptToSubmit); + m_ui.describeByCommitIdCheckBox->setChecked(s.describeByCommitId); +} + +SettingsPage::SettingsPage() +{ +} + +QString SettingsPage::id() const +{ + return QLatin1String("CVS"); +} + +QString SettingsPage::trName() const +{ + return tr("CVS"); +} + +QString SettingsPage::category() const +{ + return QLatin1String(VCSBase::Constants::VCS_SETTINGS_CATEGORY); +} + +QString SettingsPage::trCategory() const +{ + return QCoreApplication::translate("VCSBase", VCSBase::Constants::VCS_SETTINGS_CATEGORY); +} + +QWidget *SettingsPage::createPage(QWidget *parent) +{ + m_widget = new SettingsPageWidget(parent); + m_widget->setSettings(CVSPlugin::cvsPluginInstance()->settings()); + return m_widget; +} + +void SettingsPage::apply() +{ + CVSPlugin::cvsPluginInstance()->setSettings(m_widget->settings()); +} diff --git a/src/plugins/cvs/settingspage.h b/src/plugins/cvs/settingspage.h new file mode 100644 index 0000000000..e96f806104 --- /dev/null +++ b/src/plugins/cvs/settingspage.h @@ -0,0 +1,86 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#ifndef SETTINGSPAGE_H +#define SETTINGSPAGE_H + +#include "ui_settingspage.h" + +#include <coreplugin/dialogs/ioptionspage.h> + +#include <QtGui/QWidget> +#include <QtCore/QPointer> +#include <QtCore/QString> + +QT_BEGIN_NAMESPACE +class QSettings; +QT_END_NAMESPACE + +namespace CVS { +namespace Internal { + +struct CVSSettings; + +class SettingsPageWidget : public QWidget { + Q_OBJECT +public: + explicit SettingsPageWidget(QWidget *parent = 0); + + CVSSettings settings() const; + void setSettings(const CVSSettings &); + +private: + Ui::SettingsPage m_ui; +}; + + +class SettingsPage : public Core::IOptionsPage +{ + Q_OBJECT + +public: + SettingsPage(); + + QString id() const; + QString trName() const; + QString category() const; + QString trCategory() const; + + QWidget *createPage(QWidget *parent); + void apply(); + void finish() { } + +private: + SettingsPageWidget* m_widget; +}; + +} // namespace CVS +} // namespace Internal + +#endif // SETTINGSPAGE_H diff --git a/src/plugins/cvs/settingspage.ui b/src/plugins/cvs/settingspage.ui new file mode 100644 index 0000000000..6798485edb --- /dev/null +++ b/src/plugins/cvs/settingspage.ui @@ -0,0 +1,130 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>CVS::Internal::SettingsPage</class> + <widget class="QWidget" name="CVS::Internal::SettingsPage"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>575</width> + <height>437</height> + </rect> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QFormLayout" name="formLayout_3"> + <item row="0" column="0" colspan="2"> + <widget class="QCheckBox" name="promptToSubmitCheckBox"> + <property name="text"> + <string>Prompt to submit</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QCheckBox" name="describeByCommitIdCheckBox"> + <property name="toolTip"> + <string>When checked, all files touched by a commit will be displayed when clicking on a revision number in the annotation view (retrieved via commit id). Otherwise, only the respective file will be displayed.</string> + </property> + <property name="text"> + <string>Describe by commit id</string> + </property> + </widget> + </item> + <item> + <spacer name="topverticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QFormLayout" name="formLayout_2"> + <property name="margin"> + <number>0</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="commandLabel"> + <property name="text"> + <string>CVS Command:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="Core::Utils::PathChooser" name="commandPathChooser"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="rootLabel"> + <property name="text"> + <string>CVS Root:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="rootLineEdit"/> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="diffOptionsLabel"> + <property name="text"> + <string>Diff Options:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="diffOptionsLineEdit"/> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>105</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>Core::Utils::PathChooser</class> + <extends>QWidget</extends> + <header location="global">utils/pathchooser.h</header> + <container>1</container> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/src/plugins/debugger/cdb/cdbdebugengine.cpp b/src/plugins/debugger/cdb/cdbdebugengine.cpp index 798f5234ff..365252f876 100644 --- a/src/plugins/debugger/cdb/cdbdebugengine.cpp +++ b/src/plugins/debugger/cdb/cdbdebugengine.cpp @@ -539,12 +539,13 @@ bool CdbDebugEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> const QString dumperLibName = QDir::toNativeSeparators(m_d->m_debuggerManagerAccess->qtDumperLibraryName()); bool dumperEnabled = mode != AttachCore && mode != AttachCrashedExternal - && !dumperLibName.isEmpty() && m_d->m_debuggerManagerAccess->qtDumperLibraryEnabled(); if (dumperEnabled) { const QFileInfo fi(dumperLibName); if (!fi.isFile()) { - const QString msg = tr("The dumper library '%1' does not exist.").arg(dumperLibName); + const QStringList &locations = m_d->m_debuggerManagerAccess->qtDumperLibraryLocations(); + const QString loc = locations.join(QLatin1String(", ")); + const QString msg = tr("The dumper library was not found at %1.").arg(loc); m_d->m_debuggerManagerAccess->showQtDumperLibraryWarning(msg); dumperEnabled = false; } diff --git a/src/plugins/debugger/cdb/cdbexceptionutils.cpp b/src/plugins/debugger/cdb/cdbexceptionutils.cpp index 3839ee8227..1988cf8f6b 100644 --- a/src/plugins/debugger/cdb/cdbexceptionutils.cpp +++ b/src/plugins/debugger/cdb/cdbexceptionutils.cpp @@ -271,6 +271,7 @@ bool isFatalException(LONG code) case startupCompleteTrap: // Mysterious exception at start of application case rpcServerUnavailableExceptionCode: case dllNotFoundExceptionCode: + case cppExceptionCode: return false; default: break; diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 15c586b5bb..a4dadb5191 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -1004,6 +1004,11 @@ void DebuggerManager::setQtDumperLibraryName(const QString &dl) m_dumperLib = dl; } +void DebuggerManager::setQtDumperLibraryLocations(const QStringList &dl) +{ + m_dumperLibLocations = dl; +} + qint64 DebuggerManager::inferiorPid() const { return m_inferiorPid; @@ -1236,11 +1241,12 @@ void DebuggerManager::setStatus(int status) || status == DebuggerInferiorStopRequested || status == DebuggerInferiorStopped; - //const bool starting = status == DebuggerProcessStartingUp; const bool running = status == DebuggerInferiorRunning; const bool ready = status == DebuggerInferiorStopped && startMode() != AttachCore; + if (ready) + QApplication::alert(mainWindow(), 3000); m_watchAction->setEnabled(ready); m_breakAction->setEnabled(true); @@ -1518,6 +1524,15 @@ QString DebuggerManager::qtDumperLibraryName() const return m_dumperLib; } +QStringList DebuggerManager::qtDumperLibraryLocations() const +{ + if (theDebuggerAction(UseCustomDebuggingHelperLocation)->value().toBool()) + return QStringList() << + ( theDebuggerAction(CustomDebuggingHelperLocation)->value().toString() + + tr(" (explicitly set in the Debugger Options)")); + return m_dumperLibLocations; +} + void DebuggerManager::showQtDumperLibraryWarning(const QString &details) { QMessageBox dialog(mainWindow()); diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index c153465c88..cc09c8f6bb 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -236,6 +236,7 @@ private: virtual bool qtDumperLibraryEnabled() const = 0; virtual QString qtDumperLibraryName() const = 0; + virtual QStringList qtDumperLibraryLocations() const = 0; virtual void showQtDumperLibraryWarning(const QString &details = QString()) = 0; virtual bool isReverseDebugging() const = 0; @@ -272,6 +273,7 @@ public slots: virtual qint64 inferiorPid() const; void setQtDumperLibraryName(const QString &dl); // Run Control + void setQtDumperLibraryLocations(const QStringList &dl); void setSimpleDockWidgetArrangement(); void setLocked(bool locked); @@ -376,6 +378,7 @@ private: virtual bool qtDumperLibraryEnabled() const; virtual QString qtDumperLibraryName() const; + virtual QStringList qtDumperLibraryLocations() const; virtual void showQtDumperLibraryWarning(const QString &details = QString()); virtual bool isReverseDebugging() const; @@ -434,6 +437,7 @@ private: QSharedPointer<DebuggerStartParameters> m_startParameters; DebuggerRunControl *m_runControl; QString m_dumperLib; + QStringList m_dumperLibLocations; qint64 m_inferiorPid; diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp index 4b151c52cf..b1d531493e 100644 --- a/src/plugins/debugger/debuggerrunner.cpp +++ b/src/plugins/debugger/debuggerrunner.cpp @@ -158,6 +158,7 @@ void DebuggerRunControl::start() break; } m_manager->setQtDumperLibraryName(rc->dumperLibrary()); + m_manager->setQtDumperLibraryLocations(rc->dumperLibraryLocations()); if (const ProjectExplorer::Project *project = rc->project()) { m_startParameters->buildDir = project->buildDirectory(project->activeBuildConfiguration()); } diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index fa8f9d7a0a..c6611fb484 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -62,7 +62,7 @@ #include <QtCore/QTextStream> #include <QtGui/QAction> -#include <QtGui/QApplication> +#include <QtCore/QCoreApplication> #include <QtGui/QLabel> #include <QtGui/QMainWindow> #include <QtGui/QMessageBox> @@ -1146,7 +1146,6 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) m_currentFrame = _(frame.findChild("addr").data() + '%' + frame.findChild("func").data() + '%'); - QApplication::alert(q->mainWindow(), 3000); if (theDebuggerAction(ListSourceFiles)->value().toBool()) reloadSourceFiles(); postCommand(_("-break-list"), CB(handleBreakList)); @@ -1302,7 +1301,8 @@ void GdbEngine::handleFileExecAndSymbols(const GdbResultRecord &response, const QMessageBox::critical(q->mainWindow(), tr("Error"), tr("Starting executable failed:\n") + msg); QTC_ASSERT(q->status() == DebuggerInferiorRunning, /**/); - interruptInferior(); + //interruptInferior(); + qq->notifyInferiorExited(); } } @@ -1321,7 +1321,8 @@ void GdbEngine::handleExecRun(const GdbResultRecord &response, const QVariant &) QMessageBox::critical(q->mainWindow(), tr("Error"), tr("Starting executable failed:\n") + QString::fromLocal8Bit(msg)); QTC_ASSERT(q->status() == DebuggerInferiorRunning, /**/); - interruptInferior(); + //interruptInferior(); + qq->notifyInferiorExited(); } } } @@ -1589,7 +1590,7 @@ bool GdbEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp) QFileInfo fi2(sp->coreFile); // quoting core name below fails in gdb 6.8-debian QString coreName = fi2.absoluteFilePath(); - postCommand(_("-file-exec-and-symbols ") + fileName); + postCommand(_("-file-exec-and-symbols ") + fileName, CB(handleFileExecAndSymbols)); postCommand(_("target core ") + coreName, CB(handleTargetCore)); qq->breakHandler()->removeAllBreakpoints(); } else if (q->startMode() == StartRemote) { @@ -1598,7 +1599,7 @@ bool GdbEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp) //QFileInfo fi(sp->executable); //QString fileName = fi.absoluteFileName(); QString fileName = sp->executable; - postCommand(_("-file-exec-and-symbols \"%1\"").arg(fileName)); + postCommand(_("-file-exec-and-symbols \"%1\"").arg(fileName), CB(handleFileExecAndSymbols)); // works only for > 6.8 postCommand(_("set target-async on"), CB(handleSetTargetAsync)); } else if (sp->useTerminal) { @@ -2800,7 +2801,7 @@ void GdbEngine::setToolTipExpression(const QPoint &mousePos, //: Variable static const QString strNotInScope = - QApplication::translate("Debugger::Internal::GdbEngine", "<not in scope>"); + QCoreApplication::translate("Debugger::Internal::GdbEngine", "<not in scope>"); static void setWatchDataValue(WatchData &data, const GdbMi &mi, @@ -3855,11 +3856,13 @@ void GdbEngine::tryLoadDebuggingHelpers() if (!qq->qtDumperLibraryEnabled()) return; const QString lib = qq->qtDumperLibraryName(); + const QStringList &locations = qq->qtDumperLibraryLocations(); //qDebug() << "DUMPERLIB:" << lib; // @TODO: same in CDB engine... const QFileInfo fi(lib); if (!fi.exists()) { - const QString msg = tr("The dumper library '%1' does not exist.").arg(lib); + const QString loc = locations.join(QLatin1String(", ")); + const QString msg = tr("The dumper library was not found at %1.").arg(loc); debugMessage(msg); qq->showQtDumperLibraryWarning(msg); return; diff --git a/src/plugins/debugger/watchutils.cpp b/src/plugins/debugger/watchutils.cpp index cd6c7e21b3..d6daad1551 100644 --- a/src/plugins/debugger/watchutils.cpp +++ b/src/plugins/debugger/watchutils.cpp @@ -546,18 +546,22 @@ QList<WatchData> QtDumperResult::toWatchData(int source) const WatchData &wchild = rc.back(); wchild.source = source; wchild.iname = iname; - wchild.iname += dot; - wchild.iname += dchild.name; + // Name can be empty for array-like things + const QString iname = dchild.name.isEmpty() ? QString::number(c) : dchild.name; // Use key entry as name (which is used for map nodes) if (dchild.key.isEmpty()) { - wchild.name = dchild.name; + wchild.name = iname; } else { + // Do not use map keys as iname since they might contain quotes. wchild.name = decodeData(dchild.key, dchild.keyEncoded); if (wchild.name.size() > 13) { wchild.name.truncate(12); wchild.name += QLatin1String("..."); } } + // Append iname to total iname. + wchild.iname += dot; + wchild.iname += iname; wchild.exp = dchild.exp; if (dchild.valueEncountered) { wchild.valuedisabled = dchild.valuedisabled; @@ -1349,7 +1353,7 @@ void QtDumperHelper::evaluationParameters(const WatchData &data, case QAbstractItemType: inner = data.addr.mid(1); break; - case QVectorType: + case QVectorType: if (m_qtVersion >= 0x040600) extraArgs[1] = QString("(char*)&((%1).p->array)-(char*)((%2).p)") .arg(data.exp).arg(data.exp); diff --git a/src/plugins/designer/cpp/formclasswizardparameters.cpp b/src/plugins/designer/cpp/formclasswizardparameters.cpp index 4f0881d948..baa9c2d975 100644 --- a/src/plugins/designer/cpp/formclasswizardparameters.cpp +++ b/src/plugins/designer/cpp/formclasswizardparameters.cpp @@ -39,7 +39,7 @@ #include <QtCore/QDebug> #include <QtCore/QSharedData> -static const char *uiMemberC = "m_ui"; +static const char *uiMemberC = "ui"; static const char *uiNamespaceC = "Ui"; static const char *formClassWizardPageGroupC = "FormClassWizardPage"; diff --git a/src/plugins/duieditor/duieditor.cpp b/src/plugins/duieditor/duieditor.cpp index 9300ba45f3..58624f5561 100644 --- a/src/plugins/duieditor/duieditor.cpp +++ b/src/plugins/duieditor/duieditor.cpp @@ -617,8 +617,10 @@ void ScriptEditor::indentBlock(QTextDocument *, QTextBlock block, QChar typedCha { TextEditor::TabSettings ts = tabSettings(); - if (typedChar == QLatin1Char('}')) { - QTextCursor tc = textCursor(); + if (typedChar == QLatin1Char('}') + || ((typedChar == QChar::Null) && block.text().trimmed() == "}")) { + + QTextCursor tc(block); if (TextEditor::TextBlockUserData::findPreviousBlockOpenParenthesis(&tc)) { const QString text = tc.block().text(); int indent = ts.columnAt(text, ts.firstNonSpace(text)); diff --git a/src/plugins/duieditor/parser/qmljs.g b/src/plugins/duieditor/parser/qmljs.g index f06740c1dd..43cce407e3 100644 --- a/src/plugins/duieditor/parser/qmljs.g +++ b/src/plugins/duieditor/parser/qmljs.g @@ -1,9 +1,9 @@ ---------------------------------------------------------------------------- -- -- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). --- Contact: Nokia Corporation (qt-info@nokia.com) +-- Contact: Qt Software Information (qt-info@nokia.com) -- --- This file is part of the QtScript module of the Qt Toolkit. +-- This file is part of the QtDeclarative module of the Qt Toolkit. -- -- $QT_BEGIN_LICENSE:LGPL$ -- No Commercial Usage @@ -34,7 +34,7 @@ -- met: http://www.gnu.org/copyleft/gpl.html. -- -- If you are unsure which license is appropriate for your use, please --- contact the sales department at http://www.qtsoftware.com/contact. +-- contact the sales department at qt-sales@nokia.com. -- $QT_END_LICENSE$ -- -- This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE @@ -84,18 +84,24 @@ --- context keywords. %token T_PUBLIC "public" %token T_IMPORT "import" +%token T_AS "as" + +--- feed tokens +%token T_FEED_UI_PROGRAM +%token T_FEED_JS_STATEMENT +%token T_FEED_JS_EXPRESSION %nonassoc SHIFT_THERE %nonassoc T_IDENTIFIER T_COLON T_SIGNAL T_PROPERTY %nonassoc REDUCE_HERE -%start UiProgram +%start TopLevel /. /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -128,7 +134,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -148,7 +154,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -181,7 +187,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -254,6 +260,7 @@ public: AST::UiProgram *UiProgram; AST::UiImportList *UiImportList; AST::UiImport *UiImport; + AST::UiParameterList *UiParameterList; AST::UiPublicMember *UiPublicMember; AST::UiObjectDefinition *UiObjectDefinition; AST::UiObjectInitializer *UiObjectInitializer; @@ -270,10 +277,29 @@ public: Parser(Engine *engine); ~Parser(); - bool parse(); + // parse a UI program + bool parse() { return parse(T_FEED_UI_PROGRAM); } + bool parseStatement() { return parse(T_FEED_JS_STATEMENT); } + bool parseExpression() { return parse(T_FEED_JS_EXPRESSION); } + + AST::UiProgram *ast() const + { return AST::cast<AST::UiProgram *>(program); } + + AST::Statement *statement() const + { + if (! program) + return 0; + + return program->statementCast(); + } + + AST::ExpressionNode *expression() const + { + if (! program) + return 0; - AST::UiProgram *ast() - { return program; } + return program->expressionCast(); + } QList<DiagnosticMessage> diagnosticMessages() const { return diagnostic_messages; } @@ -298,6 +324,8 @@ public: { return diagnosticMessage().loc.startColumn; } protected: + bool parse(int startToken); + void reallocateStack(); inline Value &sym(int index) @@ -316,7 +344,7 @@ protected: int *state_stack; AST::SourceLocation *location_stack; - AST::UiProgram *program; + AST::Node *program; // error recovery enum { TOKEN_BUFFER_SIZE = 3 }; @@ -437,14 +465,16 @@ AST::UiQualifiedId *Parser::reparseAsQualifiedId(AST::ExpressionNode *expr) return 0; } -bool Parser::parse() +bool Parser::parse(int startToken) { Lexer *lexer = driver->lexer(); bool hadErrors = false; int yytoken = -1; int action = 0; - first_token = last_token = 0; + token_buffer[0].token = startToken; + first_token = &token_buffer[0]; + last_token = &token_buffer[1]; tos = -1; program = 0; @@ -492,12 +522,35 @@ bool Parser::parse() -- Declarative UI -------------------------------------------------------------------------------------------------------- +TopLevel: T_FEED_UI_PROGRAM UiProgram ; +/. +case $rule_number: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; +} break; +./ + +TopLevel: T_FEED_JS_STATEMENT Statement ; +/. +case $rule_number: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; +} break; +./ + +TopLevel: T_FEED_JS_EXPRESSION Expression ; +/. +case $rule_number: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; +} break; +./ + UiProgram: UiImportListOpt UiRootMember ; /. case $rule_number: { - program = makeAstNode<AST::UiProgram> (driver->nodePool(), sym(1).UiImportList, + sym(1).UiProgram = makeAstNode<AST::UiProgram> (driver->nodePool(), sym(1).UiImportList, sym(2).UiObjectMemberList->finish()); - sym(1).UiProgram = program; } break; ./ @@ -536,6 +589,77 @@ case $rule_number: { } break; ./ +UiImport: T_IMPORT T_STRING_LITERAL T_AS JsIdentifier T_AUTOMATIC_SEMICOLON; +UiImport: T_IMPORT T_STRING_LITERAL T_AS JsIdentifier T_SEMICOLON; +/. +case $rule_number: { + AST::UiImport *node = makeAstNode<AST::UiImport>(driver->nodePool(), sym(2).sval); + node->importId = sym(4).sval; + node->importToken = loc(1); + node->fileNameToken = loc(2); + node->asToken = loc(3); + node->importIdToken = loc(4); + node->semicolonToken = loc(5); + sym(1).Node = node; +} break; +./ + +UiImport: T_IMPORT UiQualifiedId T_AUTOMATIC_SEMICOLON; +UiImport: T_IMPORT UiQualifiedId T_SEMICOLON; +/. +case $rule_number: { + AST::UiImport *node = makeAstNode<AST::UiImport>(driver->nodePool(), sym(2).UiQualifiedId->finish()); + node->importToken = loc(1); + node->fileNameToken = loc(2); + node->semicolonToken = loc(3); + sym(1).Node = node; +} break; +./ + +UiImport: T_IMPORT UiQualifiedId T_NUMERIC_LITERAL T_AUTOMATIC_SEMICOLON; +UiImport: T_IMPORT UiQualifiedId T_NUMERIC_LITERAL T_SEMICOLON; +/. +case $rule_number: { + AST::UiImport *node = makeAstNode<AST::UiImport>(driver->nodePool(), sym(2).UiQualifiedId->finish()); + node->importToken = loc(1); + node->fileNameToken = loc(2); + node->versionToken = loc(3); + node->semicolonToken = loc(4); + sym(1).Node = node; +} break; +./ + +UiImport: T_IMPORT UiQualifiedId T_NUMERIC_LITERAL T_AS JsIdentifier T_AUTOMATIC_SEMICOLON; +UiImport: T_IMPORT UiQualifiedId T_NUMERIC_LITERAL T_AS JsIdentifier T_SEMICOLON; +/. +case $rule_number: { + AST::UiImport *node = makeAstNode<AST::UiImport>(driver->nodePool(), sym(2).UiQualifiedId->finish()); + node->importId = sym(5).sval; + node->importToken = loc(1); + node->fileNameToken = loc(2); + node->versionToken = loc(3); + node->asToken = loc(4); + node->importIdToken = loc(5); + node->semicolonToken = loc(6); + sym(1).Node = node; +} break; +./ + +UiImport: T_IMPORT UiQualifiedId T_AS JsIdentifier T_AUTOMATIC_SEMICOLON; +UiImport: T_IMPORT UiQualifiedId T_AS JsIdentifier T_SEMICOLON; +/. +case $rule_number: { + AST::UiImport *node = makeAstNode<AST::UiImport>(driver->nodePool(), sym(2).UiQualifiedId->finish()); + node->importId = sym(4).sval; + node->importToken = loc(1); + node->fileNameToken = loc(2); + node->asToken = loc(3); + node->importIdToken = loc(4); + node->semicolonToken = loc(5); + sym(1).Node = node; +} break; +./ + Empty: ; /. case $rule_number: { @@ -706,6 +830,52 @@ case $rule_number: { UiPropertyType: T_IDENTIFIER ; +UiParameterListOpt: ; +/. +case $rule_number: { + sym(1).Node = 0; +} break; +./ + +UiParameterListOpt: UiParameterList ; +/. +case $rule_number: { + sym(1).Node = sym(1).UiParameterList->finish (); +} break; +./ + +UiParameterList: UiPropertyType JsIdentifier ; +/. +case $rule_number: { + AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), sym(1).sval, sym(2).sval); + node->identifierToken = loc(2); + sym(1).Node = node; +} break; +./ + +UiParameterList: UiParameterList T_COMMA UiPropertyType JsIdentifier ; +/. +case $rule_number: { + AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), sym(1).UiParameterList, sym(3).sval, sym(4).sval); + node->commaToken = loc(2); + node->identifierToken = loc(4); + sym(1).Node = node; +} break; +./ + +UiObjectMember: T_SIGNAL T_IDENTIFIER T_LPAREN UiParameterListOpt T_RPAREN ; +/. +case $rule_number: { + AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), (NameId *)0, sym(2).sval); + node->type = AST::UiPublicMember::Signal; + node->propertyToken = loc(1); + node->typeToken = loc(2); + node->identifierToken = loc(3); + node->parameters = sym(4).UiParameterList; + sym(1).Node = node; +} break; +./ + UiObjectMember: T_SIGNAL T_IDENTIFIER ; /. case $rule_number: { @@ -2843,7 +3013,8 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ; } for (int tk = 1; tk < TERMINAL_COUNT; ++tk) { - if (tk == T_AUTOMATIC_SEMICOLON) + if (tk == T_AUTOMATIC_SEMICOLON || tk == T_FEED_UI_PROGRAM || + tk == T_FEED_JS_STATEMENT || tk == T_FEED_JS_EXPRESSION) continue; int a = t_action(errorState, tk); diff --git a/src/plugins/duieditor/parser/qmljsast.cpp b/src/plugins/duieditor/parser/qmljsast.cpp index 1d626fc525..d10c07121d 100644 --- a/src/plugins/duieditor/parser/qmljsast.cpp +++ b/src/plugins/duieditor/parser/qmljsast.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/duieditor/parser/qmljsast_p.h b/src/plugins/duieditor/parser/qmljsast_p.h index 35c289ee0b..6d269accf8 100644 --- a/src/plugins/duieditor/parser/qmljsast_p.h +++ b/src/plugins/duieditor/parser/qmljsast_p.h @@ -1,9 +1,9 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -209,6 +209,7 @@ public: Kind_UiObjectMemberList, Kind_UiArrayMemberList, Kind_UiProgram, + Kind_UiParameterList, Kind_UiPublicMember, Kind_UiQualifiedId, Kind_UiScriptBinding, @@ -2220,15 +2221,24 @@ public: QMLJS_DECLARE_AST_NODE(UiImport) UiImport(NameId *fileName) - : fileName(fileName) + : fileName(fileName), importUri(0), importId(0) + { kind = K; } + + UiImport(UiQualifiedId *uri) + : fileName(0), importUri(uri), importId(0) { kind = K; } virtual void accept0(Visitor *visitor); // attributes NameId *fileName; + UiQualifiedId *importUri; + NameId *importId; SourceLocation importToken; SourceLocation fileNameToken; + SourceLocation versionToken; + SourceLocation asToken; + SourceLocation importIdToken; SourceLocation semicolonToken; }; @@ -2351,6 +2361,42 @@ public: SourceLocation rbraceToken; }; +class UiParameterList: public Node +{ +public: + QMLJS_DECLARE_AST_NODE(UiParameterList) + + UiParameterList(NameId *t, NameId *n): + type (t), name (n), next (this) + { kind = K; } + + UiParameterList(UiParameterList *previous, NameId *t, NameId *n): + type (t), name (n) + { + kind = K; + next = previous->next; + previous->next = this; + } + + virtual ~UiParameterList() {} + + virtual void accept0(Visitor *) {} + + inline UiParameterList *finish () + { + UiParameterList *front = next; + next = 0; + return front; + } + +// attributes + NameId *type; + NameId *name; + UiParameterList *next; + SourceLocation commaToken; + SourceLocation identifierToken; +}; + class UiPublicMember: public UiObjectMember { public: @@ -2358,13 +2404,13 @@ public: UiPublicMember(NameId *memberType, NameId *name) - : type(Property), memberType(memberType), name(name), expression(0), isDefaultMember(false) + : type(Property), memberType(memberType), name(name), expression(0), isDefaultMember(false), parameters(0) { kind = K; } UiPublicMember(NameId *memberType, NameId *name, ExpressionNode *expression) - : type(Property), memberType(memberType), name(name), expression(expression), isDefaultMember(false) + : type(Property), memberType(memberType), name(name), expression(expression), isDefaultMember(false), parameters(0) { kind = K; } virtual SourceLocation firstSourceLocation() const @@ -2388,6 +2434,7 @@ public: NameId *name; ExpressionNode *expression; bool isDefaultMember; + UiParameterList *parameters; SourceLocation defaultToken; SourceLocation propertyToken; SourceLocation typeToken; diff --git a/src/plugins/duieditor/parser/qmljsastfwd_p.h b/src/plugins/duieditor/parser/qmljsastfwd_p.h index ac743f4d3e..339bea4880 100644 --- a/src/plugins/duieditor/parser/qmljsastfwd_p.h +++ b/src/plugins/duieditor/parser/qmljsastfwd_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/duieditor/parser/qmljsastvisitor.cpp b/src/plugins/duieditor/parser/qmljsastvisitor.cpp index 4d73d06157..642bcee26b 100644 --- a/src/plugins/duieditor/parser/qmljsastvisitor.cpp +++ b/src/plugins/duieditor/parser/qmljsastvisitor.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/duieditor/parser/qmljsastvisitor_p.h b/src/plugins/duieditor/parser/qmljsastvisitor_p.h index fd89ab4afd..3677b1a1fd 100644 --- a/src/plugins/duieditor/parser/qmljsastvisitor_p.h +++ b/src/plugins/duieditor/parser/qmljsastvisitor_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/duieditor/parser/qmljsengine_p.cpp b/src/plugins/duieditor/parser/qmljsengine_p.cpp index fc22cf99c2..02d9b9cd74 100644 --- a/src/plugins/duieditor/parser/qmljsengine_p.cpp +++ b/src/plugins/duieditor/parser/qmljsengine_p.cpp @@ -1,20 +1,18 @@ -/************************************************************************** +/**************************************************************************** ** -** This file is part of Qt Creator +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) ** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. ** ** 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 @@ -22,10 +20,24 @@ ** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** -**************************************************************************/ +****************************************************************************/ #include "qmljsengine_p.h" #include "qmljsnodepool_p.h" diff --git a/src/plugins/duieditor/parser/qmljsengine_p.h b/src/plugins/duieditor/parser/qmljsengine_p.h index a65f8be253..5aea983ec6 100644 --- a/src/plugins/duieditor/parser/qmljsengine_p.h +++ b/src/plugins/duieditor/parser/qmljsengine_p.h @@ -1,20 +1,18 @@ -/************************************************************************** +/**************************************************************************** ** -** This file is part of Qt Creator +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) ** -** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** This file is part of the QtDeclarative module of the Qt Toolkit. ** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** Commercial Usage -** -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. +** $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 either Technology Preview License Agreement or the +** Beta Release License Agreement. ** ** 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 @@ -22,14 +20,39 @@ ** 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.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ ** -**************************************************************************/ +****************************************************************************/ #ifndef QMLJSENGINE_P_H #define QMLJSENGINE_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QString> #include <QSet> diff --git a/src/plugins/duieditor/parser/qmljsgrammar.cpp b/src/plugins/duieditor/parser/qmljsgrammar.cpp index 50d07d0a10..4fba480c9b 100644 --- a/src/plugins/duieditor/parser/qmljsgrammar.cpp +++ b/src/plugins/duieditor/parser/qmljsgrammar.cpp @@ -2,7 +2,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the QtCore module of the Qt Toolkit. ** @@ -35,7 +35,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -51,627 +51,684 @@ const char *const QmlJSGrammar::spell [] = { "||", "+", "+=", "++", "?", "}", "]", "%", "%=", "return", ")", ";", 0, "*", "*=", "string literal", "property", "signal", "switch", "this", "throw", "~", "try", "typeof", "var", "void", "while", "with", "^", "^=", - "null", "true", "false", "const", "debugger", "reserved word", "multiline string literal", "public", "import", 0, - 0}; + "null", "true", "false", "const", "debugger", "reserved word", "multiline string literal", "public", "import", "as", + 0, 0, 0, 0, 0}; const int QmlJSGrammar::lhs [] = { - 91, 92, 92, 95, 95, 96, 96, 94, 93, 98, - 98, 100, 100, 101, 101, 97, 99, 99, 103, 104, - 104, 99, 99, 99, 99, 99, 99, 99, 111, 111, - 111, 99, 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 102, 102, 114, 114, 114, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 115, 115, 115, 115, 102, 102, 117, 117, 117, 117, - 116, 116, 119, 119, 121, 121, 121, 121, 121, 121, - 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, - 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, - 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, - 122, 123, 123, 124, 124, 124, 124, 124, 127, 127, - 128, 128, 128, 128, 126, 126, 129, 129, 130, 130, - 131, 131, 131, 132, 132, 132, 132, 132, 132, 132, - 132, 132, 132, 133, 133, 133, 133, 134, 134, 134, - 135, 135, 135, 135, 136, 136, 136, 136, 136, 136, - 136, 137, 137, 137, 137, 137, 137, 138, 138, 138, - 138, 138, 139, 139, 139, 139, 139, 140, 140, 141, - 141, 142, 142, 143, 143, 144, 144, 145, 145, 146, - 146, 147, 147, 148, 148, 149, 149, 150, 150, 151, - 151, 120, 120, 152, 152, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 105, 105, 154, - 154, 155, 155, 156, 156, 157, 157, 157, 157, 157, - 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, - 106, 168, 168, 167, 167, 113, 113, 169, 169, 170, - 170, 172, 172, 171, 173, 176, 174, 174, 177, 175, - 175, 107, 108, 108, 110, 110, 158, 158, 158, 158, - 158, 158, 158, 159, 159, 159, 159, 160, 160, 160, - 160, 161, 161, 162, 164, 178, 178, 181, 181, 179, - 179, 182, 180, 163, 163, 163, 165, 165, 166, 166, - 166, 183, 184, 109, 109, 112, 125, 188, 188, 185, - 185, 186, 186, 189, 190, 190, 191, 191, 187, 187, - 118, 118, 192}; + 95, 95, 95, 96, 99, 99, 102, 102, 103, 103, + 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, + 101, 100, 107, 107, 109, 109, 110, 110, 106, 108, + 108, 111, 112, 112, 108, 108, 108, 108, 108, 108, + 108, 118, 118, 118, 119, 119, 120, 120, 108, 108, + 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, + 105, 105, 104, 104, 104, 123, 123, 123, 123, 123, + 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, + 123, 123, 105, 105, 125, 125, 125, 125, 124, 124, + 127, 127, 129, 129, 129, 129, 129, 129, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 131, + 131, 132, 132, 132, 132, 132, 135, 135, 136, 136, + 136, 136, 134, 134, 137, 137, 138, 138, 139, 139, + 139, 140, 140, 140, 140, 140, 140, 140, 140, 140, + 140, 141, 141, 141, 141, 142, 142, 142, 143, 143, + 143, 143, 144, 144, 144, 144, 144, 144, 144, 145, + 145, 145, 145, 145, 145, 146, 146, 146, 146, 146, + 147, 147, 147, 147, 147, 148, 148, 149, 149, 150, + 150, 151, 151, 152, 152, 153, 153, 154, 154, 155, + 155, 156, 156, 157, 157, 158, 158, 159, 159, 128, + 128, 160, 160, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 98, 98, 162, 162, 163, + 163, 164, 164, 97, 97, 97, 97, 97, 97, 97, + 97, 97, 97, 97, 97, 97, 97, 97, 113, 175, + 175, 174, 174, 122, 122, 176, 176, 177, 177, 179, + 179, 178, 180, 183, 181, 181, 184, 182, 182, 114, + 115, 115, 117, 117, 165, 165, 165, 165, 165, 165, + 165, 166, 166, 166, 166, 167, 167, 167, 167, 168, + 168, 169, 171, 185, 185, 188, 188, 186, 186, 189, + 187, 170, 170, 170, 172, 172, 173, 173, 173, 190, + 191, 116, 116, 121, 133, 195, 195, 192, 192, 193, + 193, 196, 197, 197, 198, 198, 194, 194, 126, 126, + 199}; const int QmlJSGrammar:: rhs[] = { - 2, 1, 1, 1, 2, 3, 3, 0, 1, 1, - 2, 1, 3, 2, 3, 2, 1, 5, 1, 2, - 2, 4, 3, 3, 3, 3, 3, 3, 1, 1, - 1, 2, 4, 4, 5, 5, 6, 6, 7, 7, + 2, 2, 2, 2, 1, 1, 1, 2, 3, 3, + 5, 5, 3, 3, 4, 4, 6, 6, 5, 5, + 0, 1, 1, 2, 1, 3, 2, 3, 2, 1, + 5, 1, 2, 2, 4, 3, 3, 3, 3, 3, + 3, 1, 1, 1, 0, 1, 2, 4, 5, 2, + 4, 4, 5, 5, 6, 6, 7, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 2, 3, 3, 4, - 5, 3, 4, 3, 1, 3, 1, 2, 3, 4, - 1, 2, 3, 5, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 2, 3, 3, 4, 5, 3, + 4, 3, 1, 3, 1, 2, 3, 4, 1, 2, + 3, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 4, 3, 5, 1, 2, - 4, 4, 4, 3, 0, 1, 1, 3, 1, 1, - 1, 2, 2, 1, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 1, 3, 3, 3, 1, 3, 3, - 1, 3, 3, 3, 1, 3, 3, 3, 3, 3, - 3, 1, 3, 3, 3, 3, 3, 1, 3, 3, - 3, 3, 1, 3, 3, 3, 3, 1, 3, 1, + 1, 1, 1, 4, 3, 5, 1, 2, 4, 4, + 4, 3, 0, 1, 1, 3, 1, 1, 1, 2, + 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 1, 3, 3, 3, 1, 3, 3, 1, 3, + 3, 3, 1, 3, 3, 3, 3, 3, 3, 1, + 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, + 1, 3, 3, 3, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, - 3, 1, 3, 1, 3, 1, 3, 1, 5, 1, - 5, 1, 3, 1, 3, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 3, 0, - 1, 1, 3, 0, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 3, 1, 2, 0, 1, 3, 3, 1, 1, 1, - 3, 1, 3, 2, 2, 2, 0, 1, 2, 0, - 1, 1, 2, 2, 7, 5, 7, 7, 5, 9, - 10, 7, 8, 2, 2, 3, 3, 2, 2, 3, - 3, 3, 3, 5, 5, 3, 5, 1, 2, 0, - 1, 4, 3, 3, 3, 3, 3, 3, 3, 3, - 4, 5, 2, 2, 2, 8, 8, 1, 3, 0, - 1, 0, 1, 1, 1, 2, 1, 1, 0, 1, - 0, 1, 2}; + 3, 1, 3, 1, 3, 1, 5, 1, 5, 1, + 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 3, 0, 1, 1, + 3, 0, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, + 2, 0, 1, 3, 3, 1, 1, 1, 3, 1, + 3, 2, 2, 2, 0, 1, 2, 0, 1, 1, + 2, 2, 7, 5, 7, 7, 5, 9, 10, 7, + 8, 2, 2, 3, 3, 2, 2, 3, 3, 3, + 3, 5, 5, 3, 5, 1, 2, 0, 1, 4, + 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, + 2, 2, 2, 8, 8, 1, 3, 0, 1, 0, + 1, 1, 1, 2, 1, 1, 0, 1, 0, 1, + 2}; const int QmlJSGrammar::action_default [] = { - 8, 2, 0, 4, 3, 0, 0, 0, 6, 7, - 5, 65, 45, 46, 43, 44, 47, 9, 0, 1, - 0, 0, 16, 66, 41, 248, 0, 0, 46, 14, - 47, 249, 17, 10, 0, 0, 0, 42, 0, 31, - 30, 29, 0, 0, 35, 0, 36, 151, 218, 182, - 190, 186, 130, 202, 178, 0, 115, 49, 131, 194, - 198, 119, 148, 129, 134, 114, 168, 155, 0, 55, - 56, 52, 319, 321, 0, 0, 0, 0, 0, 0, - 50, 53, 0, 0, 54, 48, 0, 51, 0, 0, - 144, 0, 0, 131, 150, 133, 132, 0, 0, 0, - 146, 147, 145, 149, 0, 179, 0, 0, 0, 0, - 169, 0, 0, 0, 0, 0, 0, 159, 0, 0, - 0, 153, 154, 152, 157, 161, 160, 158, 156, 171, - 170, 172, 0, 187, 0, 183, 0, 0, 125, 112, - 124, 113, 81, 82, 83, 108, 84, 109, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 110, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 111, 0, 0, 123, 219, 126, 0, 127, - 0, 128, 122, 39, 40, 0, 215, 208, 206, 213, - 214, 212, 211, 217, 210, 209, 207, 216, 203, 0, - 191, 0, 0, 195, 0, 0, 199, 0, 0, 125, - 117, 0, 116, 0, 121, 135, 0, 320, 310, 311, - 0, 308, 0, 309, 0, 312, 226, 233, 232, 240, - 228, 0, 229, 313, 0, 318, 230, 231, 236, 234, - 315, 314, 317, 237, 0, 0, 0, 0, 0, 319, - 45, 0, 321, 46, 220, 262, 47, 0, 0, 0, - 0, 0, 238, 239, 227, 235, 263, 264, 307, 316, - 0, 278, 279, 280, 281, 0, 274, 275, 276, 277, - 304, 305, 0, 0, 0, 0, 0, 267, 268, 224, - 222, 184, 192, 188, 204, 180, 225, 0, 131, 196, - 200, 173, 162, 0, 0, 181, 0, 0, 0, 0, - 174, 0, 0, 0, 0, 0, 166, 164, 167, 165, - 163, 176, 175, 177, 0, 189, 0, 185, 0, 223, - 131, 0, 205, 220, 221, 0, 220, 0, 0, 270, - 0, 0, 0, 272, 0, 193, 0, 0, 197, 0, - 0, 201, 260, 0, 252, 261, 255, 0, 259, 0, - 220, 253, 0, 220, 0, 0, 271, 0, 0, 0, - 273, 320, 310, 0, 0, 312, 0, 306, 0, 296, - 0, 0, 0, 266, 0, 265, 0, 322, 0, 80, - 242, 245, 0, 81, 248, 84, 109, 86, 87, 52, - 91, 92, 45, 93, 96, 50, 53, 46, 220, 47, - 54, 99, 48, 101, 51, 103, 104, 249, 106, 107, - 111, 0, 73, 0, 0, 75, 79, 77, 63, 76, - 78, 0, 74, 62, 243, 241, 119, 120, 125, 0, - 118, 0, 295, 0, 282, 283, 0, 294, 0, 0, - 0, 285, 290, 288, 291, 0, 0, 289, 290, 0, - 286, 0, 287, 244, 293, 0, 244, 292, 0, 297, - 298, 0, 244, 299, 300, 0, 0, 301, 0, 0, - 0, 302, 303, 137, 136, 0, 0, 0, 269, 0, - 0, 0, 284, 67, 0, 0, 71, 57, 0, 59, - 69, 0, 60, 70, 72, 61, 68, 58, 0, 64, - 141, 139, 143, 140, 138, 142, 0, 0, 0, 33, - 0, 34, 0, 37, 38, 32, 15, 11, 0, 23, - 26, 24, 0, 25, 28, 244, 0, 19, 0, 27, - 22, 81, 248, 84, 109, 86, 87, 52, 91, 92, - 45, 93, 96, 50, 53, 46, 220, 47, 54, 99, - 48, 101, 51, 103, 104, 249, 106, 107, 111, 49, - 0, 12, 0, 18, 13, 20, 21, 257, 250, 0, - 258, 254, 0, 256, 246, 0, 247, 251, 323}; + 0, 0, 0, 21, 0, 169, 236, 200, 208, 204, + 148, 220, 196, 3, 133, 67, 149, 212, 216, 137, + 166, 147, 152, 132, 186, 173, 0, 73, 74, 70, + 337, 63, 339, 0, 0, 0, 0, 0, 0, 68, + 71, 0, 0, 64, 65, 72, 66, 0, 69, 0, + 0, 162, 0, 0, 149, 168, 151, 150, 0, 0, + 0, 164, 165, 163, 167, 0, 197, 0, 0, 0, + 0, 187, 0, 0, 0, 0, 0, 0, 177, 0, + 0, 0, 171, 172, 170, 175, 179, 178, 176, 174, + 189, 188, 190, 0, 205, 0, 201, 0, 0, 143, + 130, 142, 131, 99, 100, 101, 126, 102, 127, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 128, 116, 117, 118, 119, 120, 121, 122, + 123, 124, 125, 129, 0, 0, 141, 237, 144, 0, + 145, 0, 146, 140, 0, 233, 226, 224, 231, 232, + 230, 229, 235, 228, 227, 225, 234, 221, 0, 209, + 0, 0, 213, 0, 0, 217, 0, 0, 143, 135, + 0, 134, 0, 139, 153, 0, 338, 328, 329, 0, + 326, 0, 327, 0, 330, 244, 251, 250, 258, 246, + 0, 247, 331, 0, 336, 248, 249, 254, 252, 333, + 332, 335, 255, 0, 266, 0, 0, 0, 0, 337, + 63, 0, 339, 64, 238, 280, 65, 0, 0, 0, + 267, 0, 0, 256, 257, 0, 245, 253, 281, 282, + 325, 334, 0, 296, 297, 298, 299, 0, 292, 293, + 294, 295, 322, 323, 0, 0, 0, 0, 0, 285, + 286, 242, 240, 202, 210, 206, 222, 198, 243, 0, + 149, 214, 218, 191, 180, 0, 0, 199, 0, 0, + 0, 0, 192, 0, 0, 0, 0, 0, 184, 182, + 185, 183, 181, 194, 193, 195, 0, 207, 0, 203, + 0, 241, 149, 0, 223, 238, 239, 0, 238, 0, + 0, 288, 0, 0, 0, 290, 0, 211, 0, 0, + 215, 0, 0, 219, 278, 0, 270, 279, 273, 0, + 277, 0, 238, 271, 0, 238, 0, 0, 289, 0, + 0, 0, 291, 338, 328, 0, 0, 330, 0, 324, + 0, 314, 0, 0, 0, 284, 0, 283, 0, 340, + 0, 98, 260, 263, 0, 99, 266, 102, 127, 104, + 105, 70, 109, 110, 63, 111, 114, 68, 71, 64, + 238, 65, 72, 117, 66, 119, 69, 121, 122, 267, + 124, 125, 129, 0, 91, 0, 0, 93, 97, 95, + 81, 94, 96, 0, 92, 80, 261, 259, 137, 138, + 143, 0, 136, 0, 313, 0, 300, 301, 0, 312, + 0, 0, 0, 303, 308, 306, 309, 0, 0, 307, + 308, 0, 304, 0, 305, 262, 311, 0, 262, 310, + 0, 315, 316, 0, 262, 317, 318, 0, 0, 319, + 0, 0, 0, 320, 321, 155, 154, 0, 0, 0, + 287, 0, 0, 0, 302, 275, 268, 0, 276, 272, + 0, 274, 264, 0, 265, 269, 85, 0, 0, 89, + 75, 0, 77, 87, 0, 78, 88, 90, 79, 86, + 76, 0, 82, 159, 157, 161, 158, 156, 160, 2, + 5, 0, 7, 6, 0, 1, 83, 61, 62, 0, + 0, 0, 9, 10, 0, 11, 12, 0, 13, 0, + 0, 14, 0, 19, 20, 84, 0, 15, 16, 0, + 17, 18, 8, 22, 0, 4, 0, 29, 59, 0, + 0, 64, 27, 65, 30, 23, 0, 0, 60, 0, + 44, 43, 42, 0, 0, 53, 0, 54, 0, 57, + 58, 0, 0, 0, 51, 0, 52, 0, 55, 56, + 50, 45, 46, 0, 0, 0, 0, 48, 49, 47, + 28, 24, 0, 36, 39, 37, 0, 38, 41, 262, + 0, 32, 0, 40, 35, 99, 266, 102, 127, 104, + 105, 70, 109, 110, 63, 111, 114, 68, 71, 64, + 238, 65, 72, 117, 66, 119, 69, 121, 122, 267, + 124, 125, 129, 67, 0, 25, 0, 31, 26, 33, + 34, 341}; const int QmlJSGrammar::goto_default [] = { - 6, 5, 19, 1, 4, 3, 32, 34, 33, 570, - 22, 18, 538, 539, 231, 226, 230, 232, 229, 236, - 517, 235, 264, 57, 65, 495, 494, 388, 387, 48, - 386, 389, 140, 61, 56, 178, 63, 52, 177, 58, - 64, 90, 62, 47, 67, 66, 301, 54, 295, 49, - 291, 51, 293, 50, 292, 59, 299, 60, 300, 53, - 294, 290, 331, 443, 296, 297, 390, 237, 228, 227, - 239, 265, 238, 243, 262, 263, 392, 391, 36, 579, - 578, 353, 354, 581, 356, 580, 355, 451, 455, 458, - 454, 453, 473, 474, 220, 234, 216, 219, 233, 241, - 240, 0}; + 4, 495, 352, 190, 494, 525, 490, 493, 492, 15, + 524, 534, 536, 535, 614, 527, 582, 583, 185, 189, + 191, 188, 195, 552, 563, 562, 194, 226, 23, 468, + 467, 350, 349, 6, 348, 351, 101, 19, 14, 139, + 21, 10, 138, 16, 22, 51, 20, 5, 25, 24, + 263, 12, 257, 7, 253, 9, 255, 8, 254, 17, + 261, 18, 262, 11, 256, 252, 293, 405, 258, 259, + 196, 187, 186, 198, 227, 197, 202, 223, 224, 354, + 353, 225, 457, 456, 315, 316, 459, 318, 458, 317, + 413, 417, 420, 416, 415, 435, 436, 179, 193, 175, + 178, 192, 200, 199, 0}; const int QmlJSGrammar::action_index [] = { - 8, -91, 14, -91, -15, 296, 67, 94, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, 109, -91, - 184, 408, -91, -91, -91, -91, 45, 125, 170, -91, - 46, -91, -91, -91, 429, 171, 130, -91, 120, -91, - -91, -91, -19, 169, -91, 733, -91, 72, -91, 22, - -26, -59, 173, -91, 278, 174, -91, -91, 574, 51, - 112, 183, 177, -91, -91, -91, 412, 214, 733, -91, - -91, -91, 161, 1566, 980, 733, 733, 733, 653, 733, - -91, -91, 733, 733, -91, -91, 733, -91, 733, 733, - -91, 733, 733, 98, 235, -91, -91, 733, 733, 733, - -91, -91, -91, 230, 733, 276, 733, 733, 733, 733, - 396, 733, 733, 733, 733, 733, 733, 288, 733, 733, - 733, 88, 87, 74, 288, 288, 288, 218, 221, 486, - 372, 362, 733, 4, 733, 76, 1479, 733, 733, -91, - -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, - -91, -91, -91, 102, 733, -91, -91, 60, 3, -91, - 733, -91, -91, -91, -91, 733, -91, -91, -91, -91, - -91, -91, -91, -91, -91, -91, -91, -91, -91, 733, - -6, 733, 733, 30, 32, 733, -91, 1479, 733, 733, - -91, 107, -91, -14, -91, -91, 69, -91, 191, 49, - 18, -91, 233, -91, 47, 1827, -91, -91, -91, -91, - -91, 204, -91, -91, 39, -91, -91, -91, -91, -91, - -91, 1827, -91, -91, 322, 281, 103, 1740, 50, 203, - 77, 40, 2001, 53, 733, -91, 52, 29, 733, 25, - 28, 35, -91, -91, -91, -91, -91, -91, -91, -91, - 113, -91, -91, -91, -91, 106, -91, -91, -91, -91, - -91, -91, 15, 68, 733, 135, 119, -91, -91, 897, - -91, 82, 58, 17, -91, 261, 84, 42, 494, 91, - 79, 304, 288, 208, 733, 245, 733, 733, 733, 733, - 418, 733, 733, 733, 733, 733, 288, 288, 288, 288, - 288, 343, 336, 279, 733, -57, 733, 19, 733, -91, - 574, 733, -91, 733, -7, -30, 733, -60, 1740, -91, - 733, 111, 1740, -91, 733, 2, 733, 733, 43, 37, - 733, -91, 34, 118, 23, -91, -91, 733, -91, 238, - 733, -91, -5, 733, -17, 1740, -91, 733, 133, 1740, - -91, -9, 194, -32, -8, 1827, -25, -91, 1740, -91, - 733, 100, 1740, 21, 1740, -91, 31, 26, -20, -91, - -91, 1740, -38, 283, 41, 291, 85, 733, 1740, -1, - -34, 252, 54, -27, 653, 9, 5, -91, 817, -91, - 6, -21, 7, 733, 11, -28, 733, 1, 733, -33, - -10, 733, -91, 1653, 33, -91, -91, -91, -91, -91, - -91, 733, -91, -91, -91, -91, 172, -91, 733, -24, - -91, 1740, -91, 73, -91, -91, 1740, -91, 733, 93, - 0, -91, 24, -91, 36, 122, 733, -91, 44, 48, - -91, -3, -91, 1740, -91, 110, 1740, -91, 192, -91, - -91, 124, 1740, 27, -91, -12, -29, -91, 155, -53, - -22, -91, -91, -91, -91, 733, 123, 1740, -91, 733, - 92, 1740, -91, -91, 105, 1229, -91, -91, 1146, -91, - -91, 1063, -91, -91, -91, -91, -91, -91, 90, -91, - -91, -91, -91, -91, -91, -91, 71, 70, 222, -91, - 733, -91, 164, -91, -91, -91, -91, -91, 1392, -91, - -91, -91, 268, -91, -91, 1914, 1312, -91, 75, -91, - -91, 350, 55, 303, 108, 733, 1740, 59, 38, 242, - 62, 40, 527, 63, 81, -91, 817, -91, 138, 29, - 65, 733, 78, 56, 733, 80, 733, 61, 66, 57, - 101, -91, 347, -91, -91, -91, -91, 64, -91, 140, - -91, -91, 733, -91, -91, 144, -91, -91, -91, + 236, 824, 1879, -3, 176, 80, -95, 102, 36, -14, + 266, -95, 337, 90, -95, -95, 528, 100, 78, 344, + 220, -95, -95, -95, 565, 177, 824, -95, -95, -95, + 209, -95, 1697, 1083, 824, 824, 824, 740, 824, -95, + -95, 824, 824, -95, -95, -95, -95, 824, -95, 824, + 824, -95, 824, 824, 136, 183, -95, -95, 824, 824, + 824, -95, -95, -95, 146, 824, 342, 824, 824, 690, + 824, 565, 824, 824, 824, 824, 824, 824, 156, 824, + 824, 824, 134, 124, 84, 232, 255, 261, 260, 218, + 487, 472, 565, 824, 49, 824, 73, 1606, 824, 824, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, + -95, -95, -95, -95, 137, 824, -95, -95, 63, 35, + -95, 824, -95, -95, 824, -95, -95, -95, -95, -95, + -95, -95, -95, -95, -95, -95, -95, -95, 824, 38, + 824, 824, 70, 62, 824, -95, 1606, 824, 824, -95, + 104, -95, 37, -95, -95, 40, -95, 198, 67, 46, + -95, 168, -95, 45, 1970, -95, -95, -95, -95, -95, + 205, -95, -95, 44, -95, -95, -95, -95, -95, -95, + 1970, -95, -95, 375, -95, 427, 82, 1879, 32, 243, + 59, 53, 2152, 74, 824, -95, 76, 58, 824, 57, + -95, 65, 64, -95, -95, 300, -95, -95, -95, -95, + -95, -95, 79, -95, -95, -95, -95, 77, -95, -95, + -95, -95, -95, -95, 50, 68, 824, 110, 72, -95, + -95, 996, -95, 60, 34, -8, -95, 421, 71, 19, + 582, 61, 92, 420, 287, 249, 824, 304, 824, 824, + 824, 824, 394, 824, 824, 824, 824, 824, 308, 279, + 286, 293, 294, 379, 373, 493, 824, -5, 824, 66, + 824, -95, 657, 824, -95, 824, 54, 30, 824, 33, + 1879, -95, 824, 117, 1879, -95, 824, 69, 824, 824, + 94, 52, 824, -95, 75, 111, 56, -95, -95, 824, + -95, 278, 824, -95, 55, 824, -15, 1879, -95, 824, + 122, 1879, -95, -22, 305, -42, -27, 1970, -51, -95, + 1879, -95, 824, 113, 1879, -1, 1879, -95, 6, 3, + -45, -95, -95, 1879, -32, 409, 14, 424, 107, 824, + 1879, 2, -34, 318, 81, -35, 740, -4, -7, -95, + 912, -95, 0, -12, 21, 824, 41, 20, 824, 43, + 824, 16, 15, 824, -95, 1788, 31, -95, -95, -95, + -95, -95, -95, 824, -95, -95, -95, -95, 269, -95, + 824, 17, -95, 1879, -95, 86, -95, -95, 1879, -95, + 824, 103, 23, -95, 42, -95, 26, 112, 824, -95, + 28, 25, -95, -25, -95, 1879, -95, 101, 1879, -95, + 281, -95, -95, 109, 1879, 9, -95, -10, 11, -95, + 272, -17, 8, -95, -95, -95, -95, 824, 99, 1879, + -95, 824, 106, 1879, -95, 22, -95, 190, -95, -95, + 824, -95, -95, 229, -95, -95, -95, 105, 1257, -95, + -95, 1344, -95, -95, 1170, -95, -95, -95, -95, -95, + -95, 97, -95, -95, -95, -95, -95, -95, -95, -95, + -95, 468, -95, -39, 334, -95, -95, -95, -95, 201, + 359, 194, -95, -95, 88, -95, -95, 202, -95, 207, + 164, -95, 129, -95, -95, -95, 181, -95, -95, 91, + -95, -95, -95, -95, 121, -95, 491, -95, -95, -9, + 225, 170, -95, 7, -95, -95, 477, 264, -95, 126, + -95, -95, -95, 5, 144, -95, 824, -95, 188, -95, + -95, 4, 13, 158, -95, 824, -95, 180, -95, -95, + 1, 133, 27, -33, 155, 127, 163, -95, -95, -95, + -95, -95, 1428, -95, -95, -95, 329, -95, -95, 2061, + 1515, -95, 125, -95, -95, 398, 51, 384, 118, 824, + 1879, 18, 24, 328, 81, 29, 740, 48, 47, -95, + 912, -95, 39, -28, -2, 824, 12, -11, 824, 10, + 824, -20, -24, -13, 115, -95, 395, -95, -95, -95, + -95, -95, - -102, -102, -102, -102, 19, 103, -102, -102, -102, -102, - -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, - -4, 249, -102, -102, -102, -102, -102, -7, -102, -102, - -102, -102, -102, -102, 257, -102, -13, -102, -11, -102, - -102, -102, -102, -102, -102, -3, -102, -102, -102, -102, - -102, -102, -102, -102, -102, -102, -102, -102, -44, -102, - -102, -102, -102, -102, -102, -102, -102, -102, 141, -102, - -102, -102, -8, -102, 0, 16, 116, 122, 129, 119, - -102, -102, 90, 64, -102, -102, 94, -102, 91, 86, - -102, 71, 79, -102, -102, -102, -102, 159, 81, 76, - -102, -102, -102, -102, 98, -102, 67, 63, 47, 163, - -102, 160, 115, 104, 105, 127, 133, -102, 151, 144, - 130, -102, -102, -102, -102, -102, -102, -102, -102, -102, - -102, -102, 145, -102, 152, -102, 162, 31, 21, -102, - -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, - -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, - -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, - -102, -102, -102, -102, 23, -102, -102, -102, -102, -102, - 29, -102, -102, -102, -102, 34, -102, -102, -102, -102, - -102, -102, -102, -102, -102, -102, -102, -102, -102, 89, - -102, 68, 36, -102, -102, 42, -102, 235, 46, 49, - -102, -102, -102, -102, -102, -102, -102, -102, 33, -102, - -102, -102, 26, -102, -102, -18, -102, -102, -102, -102, - -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, - -102, 53, -102, -102, 8, 20, -102, -5, -102, 32, - -102, -102, -102, -102, 39, -102, -102, -102, 37, 73, - -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, - -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, - -102, -102, -102, -102, 40, -102, -102, -102, -102, 97, - -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, - -102, -102, -102, 41, 213, -102, 186, 199, 203, 209, - -102, 50, 51, 38, 57, 60, -102, -102, -102, -102, - -102, -102, -102, -102, 212, -102, 174, -102, 166, -102, - -102, 168, -102, 125, -102, -102, 61, -102, 1, -102, - 45, -102, -9, -102, 172, -102, 184, 176, -102, -102, - 170, -102, -102, -102, -102, -102, -102, 215, -102, 124, - 132, -102, -102, 178, -102, -29, -102, 25, -102, 2, - -102, -102, 62, -102, -102, 102, -102, -102, -28, -102, - 22, -102, -31, -102, -33, -102, -102, -102, -102, -102, - -102, -34, -102, 17, -102, 18, -102, 111, -20, -102, - -102, 24, -102, -102, 153, -102, -102, -102, 30, -102, - -102, -102, -102, 28, -102, 73, 140, -102, 205, -102, - -102, 5, -102, 44, -102, -102, -102, -102, -102, -102, - -102, 43, -102, -102, -102, -102, -102, -102, 135, -102, - -102, 7, -102, -102, -102, -102, 4, -102, 55, -102, - -102, -102, -102, -102, -25, -102, 48, -102, 9, -102, - -102, -102, -102, -69, -102, -102, -70, -102, -102, -102, - -102, -102, -102, -92, -102, -102, -12, -102, -10, -102, - -1, -102, -102, -102, -102, 11, -102, -40, -102, 14, - -102, -39, -102, -102, -102, -17, -102, -102, 54, -102, - -102, -24, -102, -102, -102, -102, -102, -102, -102, -102, - -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, - 3, -102, -102, -102, -102, -102, -102, -102, 267, -102, - -102, -102, 12, -102, -102, -102, 301, -102, -102, -102, - -102, -19, -102, -15, -102, 59, -64, -102, -102, -2, - -102, -102, 142, -102, -102, -102, -14, -102, -102, -102, - -102, 6, -102, 73, 52, -102, 75, -102, -102, -102, - -102, -102, 128, -102, -102, -102, -102, -102, -102, -102, - -102, -102, -6, -102, -102, 58, -102, -102, -102}; + -105, 21, 23, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -45, -105, -105, -105, + -105, -105, -105, -105, -105, -105, 82, -105, -105, -105, + 35, -105, -105, 31, 33, 179, 161, 176, 165, -105, + -105, 183, 182, -105, -105, -105, -105, 140, -105, 143, + 139, -105, 159, 135, -105, -105, -105, -105, 156, 155, + 152, -105, -105, -105, -105, 90, -105, 126, 128, 130, + 160, -105, 169, 115, 87, 89, 124, 97, -105, 73, + 76, 39, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, 168, -105, 108, -105, 80, 74, 70, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, 62, -105, -105, -105, -105, + -105, 55, -105, -105, 66, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, 100, -105, + 148, -31, -105, -105, -33, -105, 206, 37, 103, -105, + -105, -105, -105, -105, -105, -105, -105, 22, -105, -105, + -105, 19, -105, -105, 28, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + 91, -105, -105, 64, -105, 50, -105, 41, -105, 43, + -105, -105, -105, -105, 54, -105, -105, -105, 42, 67, + -105, -105, -105, -105, -105, 4, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, 34, -105, -105, -105, + -105, 107, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, 17, 197, -105, 230, 234, + 242, 211, -105, 122, 116, 105, 96, 78, -105, -105, + -105, -105, -105, -105, -105, -105, 188, -105, 215, -105, + 214, -105, -105, 203, -105, 153, -105, -105, 273, -105, + 5, -105, 3, -105, 12, -105, 217, -105, 223, 190, + -105, -105, 187, -105, -105, -105, -105, -105, -105, 238, + -105, 129, 186, -105, -105, 189, -105, 52, -105, 53, + -105, 56, -105, -105, 137, -105, -105, 98, -105, -105, + 40, -105, 45, -105, 44, -105, 59, -105, -105, -105, + -105, -105, -105, 61, -105, 57, -105, 60, -105, 109, + 68, -105, -105, 46, -105, -105, 150, -105, -105, -105, + 29, -105, -105, -105, -105, 0, -105, 32, 86, -105, + 123, -105, -105, -6, -105, -26, -105, -105, -105, -105, + -105, -105, -105, -24, -105, -105, -105, -105, -105, -105, + 95, -105, -105, 16, -105, -105, -105, -105, 2, -105, + 8, -105, -105, -105, -105, -105, -19, -105, 75, -105, + -38, -105, -105, -105, -105, -17, -105, -105, -30, -105, + -105, -105, -105, -105, -105, -58, -105, -105, 58, -105, + 51, -105, 49, -105, -105, -105, -105, 171, -105, 72, + -105, 65, -105, 63, -105, -105, -105, -105, -105, -105, + 38, -105, -105, 184, -105, -105, -105, -105, 47, -105, + -105, 147, -105, -105, 48, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, 88, -105, 71, 85, -105, -105, -105, -105, -105, + -105, 1, -105, -105, -105, -105, -105, -4, -105, 6, + -105, -105, -105, -105, -105, -105, 7, -105, -105, -105, + -105, -105, -105, -105, -105, -105, 369, -105, -105, -105, + 10, -105, -105, -105, -105, -105, 278, -105, -105, -22, + -105, -105, -105, -105, -105, -105, 69, -105, -105, -105, + -105, -105, -105, -105, -105, 9, -105, -105, -105, -105, + -105, 24, -105, -105, 11, 18, 25, -105, -105, -105, + -105, -105, 290, -105, -105, -105, 36, -105, -105, -105, + 210, -105, -105, -105, -105, 30, -105, 26, -105, 79, + 27, -105, -105, 13, -105, -105, 77, -105, -105, -105, + 20, -105, -105, -105, -105, 14, -105, 15, 117, -105, + 104, -105, -105, -105, -105, -105, 81, -105, -105, -105, + -105, -105}; const int QmlJSGrammar::action_info [] = { - 338, 174, 289, 485, 472, 472, -89, 480, -105, 380, - 43, 472, -79, -78, -100, 448, -97, 435, -102, 134, - 304, 326, 132, 104, 478, 375, 489, 372, 374, 456, - 377, 336, 199, 452, 423, 433, 440, 384, 421, 205, - 431, 456, 132, 365, 350, 344, 214, 476, -108, 456, - 324, 357, 462, 199, 367, 463, 363, 222, 472, 446, - 441, -75, -108, 182, 485, 448, -89, 588, 180, -75, - -97, 489, -100, 2, 289, 525, 380, 104, 224, 7, - 225, 582, 134, 304, 378, -102, 289, -105, -79, 472, - -65, 283, 328, 344, 268, 326, 2, 485, 174, 518, - 174, 174, 489, 333, 284, 218, 324, 372, 174, 572, - 174, 38, 91, 498, 91, 174, 0, 466, 174, 174, - 0, 0, 0, 92, 20, 92, 359, 91, 91, 346, - 475, 174, 459, 347, 445, 444, 576, 575, 92, 92, - 95, 174, 21, 174, 476, -78, 281, 280, 585, 39, - 509, 96, 491, 450, 12, 9, 8, 573, 175, 12, - 382, 499, 201, 212, 281, 280, 202, 279, 278, 281, - 280, 342, 174, 12, 274, 273, 45, 460, 528, 360, - 288, 287, 174, 487, 12, 0, 20, 207, 136, 97, - 12, 13, 16, 369, 41, 286, 13, 16, 207, 39, - 174, 586, 584, 0, 21, 40, 208, 137, 438, 138, - 13, 16, 174, 12, 0, 0, 0, 208, 0, 209, - 12, 13, 16, 12, 0, 524, 523, 13, 16, 520, - 46, 44, 12, 0, 98, 184, 183, 12, 0, 118, - 99, 119, 97, 118, 41, 119, 118, 97, 119, 0, - 13, 16, 120, 470, 469, 40, 120, 13, 16, 120, - 13, 16, 12, 306, 307, 267, 266, 12, 0, 13, - 16, 12, 0, 0, 13, 16, 174, 0, -319, 306, - 307, 12, 0, 521, 519, 0, 0, 98, -319, 0, - 308, 309, 98, 99, 106, 107, 106, 107, 99, 13, - 16, 21, 311, 312, 13, 16, 308, 309, 13, 16, - 12, 313, 12, 118, 314, 119, 315, 0, 13, 16, - 12, 108, 109, 108, 109, 12, 120, 311, 312, 267, - 266, 0, 12, 0, 0, 0, 313, 0, 0, 314, - 0, 315, 277, 276, 272, 271, 0, 13, 16, 13, - 16, 12, 277, 276, 0, 15, 0, 13, 16, 311, - 312, 0, 13, 16, 277, 276, 311, 312, 313, 13, - 16, 314, 0, 315, 0, 313, 12, 0, 314, 12, - 315, 14, 0, 272, 271, 111, 112, 0, 13, 16, - 0, 0, 0, 113, 114, 111, 112, 115, 0, 116, - 0, 0, 0, 113, 114, 0, 15, 115, 0, 116, - 0, 272, 271, 13, 16, 0, 13, 16, 26, 111, - 112, 0, 0, 0, 0, 0, 0, 113, 114, 0, - 27, 115, 14, 116, 0, 111, 112, 12, 0, 26, - 0, 311, 312, 113, 114, 0, 0, 115, 0, 116, - 313, 27, 0, 314, 0, 315, 0, 0, 12, 0, - 0, 0, 0, 29, 0, 0, 0, 15, 0, 0, - 0, 0, 0, 0, 28, 30, 0, 0, 0, 0, - 0, 0, 31, 0, 526, 0, 0, 0, 15, 0, - 0, 25, 0, 14, 0, 28, 30, 186, 0, 0, - 0, 0, 0, 31, 0, 0, 0, 187, 0, 111, - 112, 188, 25, 0, 14, 0, 0, 113, 114, 0, - 189, 115, 190, 116, 0, 340, 0, 0, 0, 0, - 0, 0, 0, 191, 0, 192, 95, 0, 0, 69, - 70, 0, 0, 193, 0, 0, 194, 96, 0, 72, - 0, 0, 195, 0, 0, 0, 12, 0, 196, 0, - 73, 74, 0, 75, 0, 0, 0, 0, 0, 0, - 78, 0, 0, 197, 81, 0, 0, 186, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 187, 0, 0, - 0, 188, 84, 13, 16, 0, 85, 0, 0, 0, - 189, 0, 190, 0, 0, 0, 0, 80, 87, 71, - 0, 0, 0, 191, 0, 192, 95, 0, 0, 0, - 0, 0, 0, 193, 0, 0, 194, 96, 0, 0, - 0, 0, 195, 0, 0, 0, 0, 0, 196, 0, + -97, 342, 251, -115, 339, -118, 337, -96, 410, -107, + 395, 385, 451, 383, 334, 346, 447, -123, 336, -120, + -83, -126, 434, 397, 410, -107, 440, 568, -118, 438, + 424, 418, 425, 418, 544, 565, 560, 561, 393, 460, + 334, 434, 553, 442, 434, 327, -96, 418, -120, 491, + -123, 451, 447, 434, -97, -115, 414, 539, -126, 312, + 251, 266, 135, 306, 95, 342, 340, 266, 251, 164, + 288, 141, 158, 288, 65, 181, 177, 402, 184, 290, + 295, 403, 286, 408, 93, 491, 93, 329, -93, 342, + 434, 298, 319, 300, 410, 143, 306, 173, 135, 230, + 451, 447, 158, 65, 246, 135, 183, 135, 428, 135, + 0, 135, 135, 471, 135, 437, 325, 286, 135, 321, + 52, 135, 421, 616, 52, 135, 245, 95, 160, 438, + 135, 53, 161, 250, 249, 53, 509, 0, 241, 240, + 236, 235, 308, 243, 242, 135, 309, 407, 406, 506, + 505, 546, 521, 520, 526, 540, 540, 482, 58, 449, + 171, 472, 540, 412, 52, 555, 453, 422, 243, 242, + 248, 617, 322, 344, 52, 53, 621, 304, 56, 243, + 242, 79, 331, 80, 31, 53, 620, 619, 135, 57, + 514, 513, 31, 136, 81, 58, 135, 31, 463, 540, + 542, 542, 79, 59, 80, 547, 545, 542, 0, 60, + 31, 541, 541, 135, 0, 81, 0, 0, 541, 556, + 554, 43, 44, 31, 0, 518, 517, 31, 0, 43, + 44, 31, 58, 0, 43, 44, 31, 0, 31, 0, + 59, 559, 558, 79, 542, 80, 60, 43, 44, 550, + 549, 464, 462, 516, 31, 541, 81, 79, 31, 80, + 43, 44, 503, 502, 43, 44, 229, 228, 43, 44, + 81, 572, 31, 43, 44, 43, 44, 59, 31, 509, + 79, 97, 80, 60, 166, 79, 79, 80, 80, 135, + 501, 43, 44, 81, 0, 43, 44, 526, 81, 81, + 98, 31, 99, 167, 79, 400, 80, 31, 0, 43, + 44, 79, 79, 80, 80, 43, 44, 81, 79, 79, + 80, 80, 268, 269, 81, 81, 3, 2, 1, 31, + 0, 81, 81, 79, 31, 80, 0, 135, 43, 44, + 0, 0, 432, 431, 43, 44, 81, 31, 0, 270, + 271, 0, 0, 0, -337, 67, 68, 31, 0, 166, + 67, 68, 526, 31, -337, 0, 43, 44, 0, 0, + 0, 43, 44, 0, 509, 0, 0, 0, 167, 0, + 168, 0, 69, 70, 43, 44, 0, 69, 70, 0, + 229, 228, 0, 498, 43, 44, 273, 274, 0, 0, + 43, 44, 273, 274, 31, 275, 510, 0, 276, 0, + 277, 275, 0, 31, 276, 0, 277, 273, 274, 497, + 511, 508, 0, 0, 31, 0, 275, 31, 0, 276, + 0, 277, 0, 0, 0, 0, 234, 233, 31, 268, + 269, 43, 44, 273, 274, 239, 238, 0, 507, 0, + 43, 44, 275, 31, 498, 276, 31, 277, 0, 234, + 233, 43, 44, 0, 43, 44, 270, 271, 0, 0, + 234, 233, 0, 0, 0, 43, 44, 0, 0, 0, + 497, 0, 0, 0, 0, 239, 238, 529, 239, 238, + 43, 44, 0, 43, 44, 72, 73, 31, 0, 530, + 0, 529, 0, 74, 75, 0, 31, 76, 0, 77, + 72, 73, 0, 530, 0, 0, 273, 274, 74, 75, + 31, 0, 76, 0, 77, 275, 0, 498, 276, 0, + 277, 145, 570, 499, 43, 44, 498, 0, 0, 0, + 0, 146, 0, 531, 533, 147, 532, 0, 0, 0, + 498, 220, 0, 497, 148, 0, 149, 531, 533, 0, + 204, 0, 497, 0, 0, 220, 0, 150, 0, 151, + 56, 0, 0, 0, 204, 0, 497, 152, 0, 0, + 153, 57, 0, 0, 0, 145, 154, 0, 72, 73, + 0, 0, 155, 0, 0, 146, 74, 75, 0, 147, + 76, 0, 77, 0, 0, 0, 0, 156, 148, 0, + 149, 0, 0, 302, 0, 0, 0, 0, 0, 0, + 0, 150, 0, 151, 56, 0, 0, 0, 0, 0, + 0, 152, 0, 0, 153, 57, 0, 0, 0, 0, + 154, 0, 0, 0, 0, 0, 155, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 145, 156, 0, 0, 0, 0, 0, 0, 0, 0, + 146, 0, 0, 0, 147, 0, 0, 0, 0, 0, + 0, 0, 0, 148, 0, 149, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 150, 0, 151, 56, + 0, 26, 27, 28, 0, 0, 152, 0, 0, 153, + 57, 0, 30, 0, 0, 154, 0, 0, 0, 31, + 0, 155, 0, 32, 33, 0, 34, 0, 0, 0, + 35, 0, 36, 37, 38, 0, 156, 40, 0, 0, + 0, 41, 0, 42, 0, 0, 0, 0, 0, 0, + 0, 0, 27, 28, 0, 45, 43, 44, 0, 46, + 0, 47, 30, 49, 0, 50, 0, 0, 0, 31, + 39, 48, 29, 32, 33, 0, 34, 0, 0, 0, + 0, 0, 0, 37, 0, 0, 0, 40, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 45, 43, 44, 0, 46, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 39, 48, 29, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 26, 27, 28, 0, 0, + 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, + 0, 0, 0, 31, 0, 0, 0, 32, 33, 0, + 34, 0, 0, 0, 35, 0, 36, 37, 38, 0, + 0, 40, 0, 0, 0, 41, 0, 42, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, + 43, 44, 0, 46, 0, 47, 0, 49, 0, 50, + 0, 0, 0, 0, 39, 48, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, -116, + 0, 0, 0, 26, 27, 28, 0, 0, 0, 0, + 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, + 0, 31, 0, 0, 0, 32, 33, 0, 34, 0, + 0, 0, 35, 0, 36, 37, 38, 0, 0, 40, + 0, 0, 0, 41, 0, 42, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 45, 43, 44, + 0, 46, 0, 47, 0, 49, 0, 50, 0, 0, + 0, 0, 39, 48, 29, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 26, 27, 28, + 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, + 0, 0, 0, 0, 0, 31, 0, 0, 0, 32, + 33, 0, 34, 0, 0, 0, 35, 0, 36, 37, + 38, 0, 0, 40, 0, 0, 0, 41, 0, 42, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 45, 43, 44, 0, 46, 0, 47, 0, 49, + 265, 50, 0, 0, 0, 0, 39, 48, 29, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 469, 0, 0, 26, 27, 28, 0, 0, 0, + 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, + 0, 0, 31, 0, 0, 0, 32, 33, 0, 34, + 0, 0, 0, 35, 0, 36, 37, 38, 0, 0, + 40, 0, 0, 0, 41, 0, 42, 0, 0, 470, + 0, 0, 0, 0, 0, 0, 0, 0, 45, 43, + 44, 0, 46, 0, 47, 0, 49, 0, 50, 0, + 0, 0, 0, 39, 48, 29, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 477, 0, + 0, 26, 27, 28, 0, 0, 0, 0, 0, 0, + 0, 0, 30, 0, 0, 0, 0, 0, 0, 31, + 0, 0, 0, 32, 33, 0, 34, 0, 0, 0, + 35, 0, 36, 37, 38, 0, 0, 40, 0, 0, + 0, 41, 0, 42, 0, 0, 478, 0, 0, 0, + 0, 0, 0, 0, 0, 45, 43, 44, 0, 46, + 0, 47, 0, 49, 0, 50, 0, 0, 0, 0, + 39, 48, 29, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 477, 0, 0, 26, 27, + 28, 0, 0, 0, 0, 0, 0, 0, 0, 30, + 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, + 32, 33, 0, 34, 0, 0, 0, 35, 0, 36, + 37, 38, 0, 0, 40, 0, 0, 0, 41, 0, + 42, 0, 0, 480, 0, 0, 0, 0, 0, 0, + 0, 0, 45, 43, 44, 0, 46, 0, 47, 0, + 49, 0, 50, 0, 0, 0, 0, 39, 48, 29, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 469, 0, 0, 26, 27, 28, 0, 0, + 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, + 0, 0, 0, 31, 0, 0, 0, 32, 33, 0, + 34, 0, 0, 0, 35, 0, 36, 37, 38, 0, + 0, 40, 0, 0, 0, 41, 0, 42, 0, 0, + 475, 0, 0, 0, 0, 0, 0, 0, 0, 45, + 43, 44, 0, 46, 0, 47, 0, 49, 0, 50, + 0, 0, 0, 0, 39, 48, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, + 27, 28, 0, 0, 0, 0, 0, 0, 0, 0, + 30, 0, 0, 0, 0, 0, 0, 31, 211, 0, + 0, 579, 580, 0, 34, 0, 0, 0, 35, 0, + 36, 37, 38, 0, 0, 40, 0, 0, 0, 41, + 0, 42, 0, 0, 0, 0, 0, 0, 0, 215, + 0, 0, 0, 45, 43, 44, 0, 46, 0, 47, + 0, 49, 0, 50, 0, 0, 0, 0, 39, 48, + 29, 0, 206, 0, 581, 0, 0, 0, 0, 0, + 0, 0, 0, 469, 0, 0, 26, 27, 28, 0, + 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, + 0, 0, 0, 0, 31, 0, 0, 0, 32, 33, + 0, 34, 0, 0, 0, 35, 0, 36, 37, 38, + 0, 0, 40, 0, 0, 0, 41, 0, 42, 0, + 0, 470, 0, 0, 498, 0, 0, 0, 0, 0, + 45, 43, 44, 0, 46, 0, 47, 0, 49, 0, + 50, 0, 0, 0, 0, 39, 48, 29, 0, 0, + 497, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 103, 104, 105, 0, 0, 107, 109, 110, 0, 0, + 111, 0, 112, 0, 0, 0, 114, 115, 116, 0, + 0, 0, 0, 0, 0, 31, 117, 118, 119, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 197, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 69, 70, 0, 0, 0, - 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, - 0, 0, 12, 0, 0, 0, 73, 74, 0, 75, - 0, 0, 0, 0, 0, 0, 78, 0, 0, 0, - 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 84, 13, - 16, 0, 85, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 80, 87, 71, 0, 0, 0, 0, - 0, 0, 0, 0, 68, 69, 70, 0, 0, 0, - 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, - 0, 0, 12, 0, 0, 0, 73, 74, 0, 75, - 0, 0, 0, 76, 0, 77, 78, 79, 0, 0, - 81, 0, 0, 0, 82, 0, 83, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 84, 13, - 16, 0, 85, 0, 86, 0, 88, 0, 89, 0, - 0, 0, 0, 80, 87, 71, 0, 0, 0, 0, - 0, 0, 0, 0, -98, 0, 0, 0, 68, 69, - 70, 0, 0, 0, 0, 0, 0, 0, 0, 72, - 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, - 73, 74, 0, 75, 0, 0, 0, 76, 0, 77, - 78, 79, 0, 0, 81, 0, 0, 0, 82, 0, - 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 84, 13, 16, 0, 85, 0, 86, 0, - 88, 0, 89, 0, 0, 0, 0, 80, 87, 71, - 0, 0, 0, 0, 0, 0, 0, 0, 68, 69, - 70, 0, 0, 0, 0, 0, 0, 0, 0, 72, - 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, - 73, 74, 0, 75, 0, 0, 0, 76, 0, 77, - 78, 79, 0, 0, 81, 0, 0, 0, 82, 0, - 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 84, 13, 16, 0, 85, 0, 86, 0, - 88, 303, 89, 0, 0, 0, 0, 80, 87, 71, - 0, 0, 0, 0, 0, 0, 0, 0, 496, 0, - 0, 68, 69, 70, 0, 0, 0, 0, 0, 0, - 0, 0, 72, 0, 0, 0, 0, 0, 0, 12, - 0, 0, 0, 73, 74, 0, 75, 0, 0, 0, - 76, 0, 77, 78, 79, 0, 0, 81, 0, 0, - 0, 82, 0, 83, 0, 0, 497, 0, 0, 0, - 0, 0, 0, 0, 0, 84, 13, 16, 0, 85, - 0, 86, 0, 88, 0, 89, 0, 0, 0, 0, - 80, 87, 71, 0, 0, 0, 0, 0, 0, 0, - 0, 504, 0, 0, 68, 69, 70, 0, 0, 0, - 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, - 0, 0, 12, 0, 0, 0, 73, 74, 0, 75, - 0, 0, 0, 76, 0, 77, 78, 79, 0, 0, - 81, 0, 0, 0, 82, 0, 83, 0, 0, 505, - 0, 0, 0, 0, 0, 0, 0, 0, 84, 13, - 16, 0, 85, 0, 86, 0, 88, 0, 89, 0, - 0, 0, 0, 80, 87, 71, 0, 0, 0, 0, - 0, 0, 0, 0, 496, 0, 0, 68, 69, 70, - 0, 0, 0, 0, 0, 0, 0, 0, 72, 0, - 0, 0, 0, 0, 0, 12, 0, 0, 0, 73, - 74, 0, 75, 0, 0, 0, 76, 0, 77, 78, - 79, 0, 0, 81, 0, 0, 0, 82, 0, 83, - 0, 0, 502, 0, 0, 0, 0, 0, 0, 0, - 0, 84, 13, 16, 0, 85, 0, 86, 0, 88, - 0, 89, 0, 0, 0, 0, 80, 87, 71, 0, - 0, 0, 0, 0, 0, 0, 0, 504, 0, 0, - 68, 69, 70, 0, 0, 0, 0, 0, 0, 0, - 0, 72, 0, 0, 0, 0, 0, 0, 12, 0, - 0, 0, 73, 74, 0, 75, 0, 0, 0, 76, - 0, 77, 78, 79, 0, 0, 81, 0, 0, 0, - 82, 0, 83, 0, 0, 507, 0, 0, 0, 0, - 0, 0, 0, 0, 84, 13, 16, 0, 85, 0, - 86, 0, 88, 0, 89, 0, 0, 0, 0, 80, - 87, 71, 0, 0, 0, 0, 0, 0, 0, 0, - 496, 0, 0, 68, 69, 70, 0, 0, 0, 0, - 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, - 0, 12, 0, 0, 0, 73, 74, 0, 75, 0, - 0, 0, 76, 0, 77, 78, 79, 0, 0, 81, - 0, 0, 0, 82, 0, 83, 0, 0, 497, 0, - 0, 15, 0, 0, 0, 0, 0, 84, 13, 16, - 0, 85, 0, 86, 0, 88, 0, 89, 0, 0, - 0, 0, 80, 87, 71, 0, 0, 14, 0, 0, - 0, 0, 0, 68, 69, 70, 0, 0, 0, 0, - 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, - 0, 12, 251, 0, 0, 535, 536, 0, 75, 0, - 0, 0, 76, 0, 77, 78, 79, 0, 0, 81, - 0, 0, 0, 82, 0, 83, 0, 0, 0, 0, - 0, 0, 0, 255, 0, 0, 0, 84, 13, 16, - 0, 85, 0, 86, 0, 88, 0, 89, 0, 0, - 0, 0, 80, 87, 71, 0, 246, 0, 537, 0, - 0, 0, 0, 142, 143, 144, 0, 0, 146, 148, - 149, 0, 0, 150, 0, 151, 0, 0, 0, 153, - 154, 155, 0, 0, 0, 0, 0, 0, 12, 156, - 157, 158, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 159, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 162, 0, - 0, 0, 0, 0, 0, 13, 16, 163, 164, 165, - 0, 167, 168, 169, 170, 171, 172, 0, 0, 160, - 166, 152, 145, 147, 161, 0, 0, 0, 0, 0, - 142, 143, 144, 0, 0, 146, 148, 149, 0, 0, - 150, 0, 151, 0, 0, 0, 153, 154, 155, 0, - 0, 0, 0, 0, 0, 425, 156, 157, 158, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 159, - 0, 0, 0, 426, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 162, 0, 0, 0, 0, - 0, 430, 427, 429, 163, 164, 165, 0, 167, 168, - 169, 170, 171, 172, 0, 0, 160, 166, 152, 145, - 147, 161, 0, 0, 0, 0, 0, 142, 143, 144, - 0, 0, 146, 148, 149, 0, 0, 150, 0, 151, - 0, 0, 0, 153, 154, 155, 0, 0, 0, 0, - 0, 0, 425, 156, 157, 158, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 159, 0, 0, 0, - 426, 0, 0, 0, 0, 0, 0, 0, 428, 0, - 0, 0, 162, 0, 0, 0, 0, 0, 430, 427, - 429, 163, 164, 165, 0, 167, 168, 169, 170, 171, - 172, 0, 0, 160, 166, 152, 145, 147, 161, 0, - 0, 0, 0, 0, 244, 0, 0, 0, 0, 245, - 0, 68, 69, 70, 247, 0, 0, 0, 0, 0, - 0, 248, 72, 0, 0, 0, 0, 0, 0, 250, - 251, 0, 0, 252, 74, 0, 75, 0, 0, 0, - 76, 0, 77, 78, 79, 0, 0, 81, 0, 0, - 0, 82, 0, 83, 0, 0, 0, 0, 0, 254, - 0, 255, 0, 0, 0, 84, 253, 256, 257, 85, - 258, 86, 259, 88, 31, 89, 260, 261, 0, 0, - 80, 87, 71, 25, 246, 0, 0, 0, 0, 0, - 0, 244, 0, 0, 0, 0, 245, 0, 68, 69, - 70, 247, 0, 0, 0, 0, 0, 0, 248, 249, - 0, 0, 0, 0, 0, 0, 250, 251, 0, 0, - 252, 74, 0, 75, 0, 0, 0, 76, 0, 77, - 78, 79, 0, 0, 81, 0, 0, 0, 82, 0, - 83, 0, 0, 0, 0, 0, 254, 0, 255, 0, - 0, 0, 84, 253, 256, 257, 85, 258, 86, 259, - 88, 31, 89, 260, 261, 0, 0, 80, 87, 71, - 25, 246, 0, 0, 0, 0, 0, 0, 541, 143, - 144, 0, 0, 543, 148, 545, 69, 70, 546, 0, - 151, 0, 0, 0, 153, 548, 549, 0, 0, 0, - 0, 0, 0, 550, 551, 157, 158, 252, 74, 0, - 75, 0, 0, 0, 76, 0, 77, 552, 79, 0, - 0, 554, 0, 0, 0, 82, 0, 83, 0, 0, - 0, 0, 0, 556, 0, 255, 0, 0, 0, 558, - 555, 557, 559, 560, 561, 86, 563, 564, 565, 566, - 567, 568, 0, 0, 553, 562, 547, 542, 544, 161, - 0, 0, 0, 0, 0, 393, 143, 144, 0, 0, - 395, 148, 397, 69, 70, 398, 0, 151, 0, 0, - 0, 153, 400, 401, 0, 0, 0, 0, 0, 0, - 402, 403, 157, 158, 252, 74, 0, 75, 0, 0, - 0, 76, 0, 77, 404, 79, 0, 0, 406, 0, - 0, 0, 82, 0, 83, 0, -244, 0, 0, 0, - 408, 0, 255, 0, 0, 0, 410, 407, 409, 411, - 412, 413, 86, 415, 416, 417, 418, 419, 420, 0, - 0, 405, 414, 399, 394, 396, 161, 0, 0, 0, - 0, 0, + 0, 0, 0, 0, 0, 123, 0, 0, 0, 0, + 0, 0, 43, 44, 124, 125, 126, 0, 128, 129, + 130, 131, 132, 133, 0, 0, 121, 127, 113, 106, + 108, 122, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 103, 104, 105, 0, 0, 107, 109, 110, 0, + 0, 111, 0, 112, 0, 0, 0, 114, 115, 116, + 0, 0, 0, 0, 0, 0, 387, 117, 118, 119, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 120, 0, 0, 0, 388, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 123, 0, 0, 0, + 0, 0, 392, 389, 391, 124, 125, 126, 0, 128, + 129, 130, 131, 132, 133, 0, 0, 121, 127, 113, + 106, 108, 122, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 103, 104, 105, 0, 0, 107, 109, 110, + 0, 0, 111, 0, 112, 0, 0, 0, 114, 115, + 116, 0, 0, 0, 0, 0, 0, 387, 117, 118, + 119, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 120, 0, 0, 0, 388, 0, 0, 0, 0, + 0, 0, 0, 390, 0, 0, 0, 123, 0, 0, + 0, 0, 0, 392, 389, 391, 124, 125, 126, 0, + 128, 129, 130, 131, 132, 133, 0, 0, 121, 127, + 113, 106, 108, 122, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 203, 0, 0, 0, 0, 205, 0, + 26, 27, 28, 207, 0, 0, 0, 0, 0, 0, + 208, 30, 0, 0, 0, 0, 0, 0, 210, 211, + 0, 0, 212, 33, 0, 34, 0, 0, 0, 35, + 0, 36, 37, 38, 0, 0, 40, 0, 0, 0, + 41, 0, 42, 0, 0, 0, 0, 0, 214, 0, + 215, 0, 0, 0, 45, 213, 216, 217, 46, 218, + 47, 219, 49, 220, 50, 221, 222, 0, 0, 39, + 48, 29, 204, 206, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 203, 0, 0, 0, 0, 205, + 0, 26, 27, 28, 207, 0, 0, 0, 0, 0, + 0, 208, 209, 0, 0, 0, 0, 0, 0, 210, + 211, 0, 0, 212, 33, 0, 34, 0, 0, 0, + 35, 0, 36, 37, 38, 0, 0, 40, 0, 0, + 0, 41, 0, 42, 0, 0, 0, 0, 0, 214, + 0, 215, 0, 0, 0, 45, 213, 216, 217, 46, + 218, 47, 219, 49, 220, 50, 221, 222, 0, 0, + 39, 48, 29, 204, 206, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 585, 104, 105, 0, 0, + 587, 109, 589, 27, 28, 590, 0, 112, 0, 0, + 0, 114, 592, 593, 0, 0, 0, 0, 0, 0, + 594, 595, 118, 119, 212, 33, 0, 34, 0, 0, + 0, 35, 0, 36, 596, 38, 0, 0, 598, 0, + 0, 0, 41, 0, 42, 0, 0, 0, 0, 0, + 600, 0, 215, 0, 0, 0, 602, 599, 601, 603, + 604, 605, 47, 607, 608, 609, 610, 611, 612, 0, + 0, 597, 606, 591, 586, 588, 122, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 355, 104, 105, 0, + 0, 357, 109, 359, 27, 28, 360, 0, 112, 0, + 0, 0, 114, 362, 363, 0, 0, 0, 0, 0, + 0, 364, 365, 118, 119, 212, 33, 0, 34, 0, + 0, 0, 35, 0, 36, 366, 38, 0, 0, 368, + 0, 0, 0, 41, 0, 42, 0, -262, 0, 0, + 0, 370, 0, 215, 0, 0, 0, 372, 369, 371, + 373, 374, 375, 47, 377, 378, 379, 380, 381, 382, + 0, 0, 367, 376, 361, 356, 358, 122, 0, 0, + 0, 0, 0, 0, 0, 0, 0, - 334, 477, 282, 482, 270, 503, 467, 464, 275, 42, - 577, 55, 506, 479, 481, 217, 516, 522, 185, 23, - 468, 217, 540, 583, 10, 486, 488, 492, 490, 493, - 508, 270, 434, 385, 422, 383, 381, 366, 379, 368, - 270, 275, 468, 275, 334, 173, 282, 217, 242, 223, - 179, 468, 176, 334, 285, 371, 221, 343, 181, 341, - 211, 282, 465, 198, 352, 204, 457, 339, 370, 449, - 447, 206, 432, 442, 424, 334, 0, 93, 179, 501, - 0, 577, 318, 500, 213, 221, 93, 0, 471, 93, - 93, 93, 130, 483, 316, 317, 93, 461, 93, 93, - 215, 319, 93, 93, 320, 514, 93, 93, 129, 17, - 93, 0, 110, 94, 93, 93, 484, 102, 93, 242, - 93, 103, 101, 203, 337, 93, 11, 484, 93, 93, - 93, 513, 483, 93, 574, 515, 298, 93, 587, 334, - 0, 302, 200, 93, 93, 105, 334, 352, 125, 126, - 93, 11, 215, 269, 93, 93, 373, 510, 93, 124, - 512, 93, 436, 511, 179, 437, 93, 0, 242, 93, - 439, 127, 93, 123, 0, 436, 0, 128, 437, 93, - 93, 483, 215, 93, 93, 139, 436, 122, 335, 437, - 93, 93, 334, 141, 121, 362, 133, 376, 93, 93, - 100, 135, 93, 0, 117, 330, 361, 330, 131, 330, - 302, 93, 302, 93, 302, 330, 302, 0, 302, 0, - 302, 0, 0, 93, 327, 93, 345, 329, 302, 332, - 302, 351, 310, 0, 0, 0, 0, 349, 93, 0, - 348, 364, 93, 302, 93, 321, 484, 302, 93, 322, - 0, 93, 93, 302, 330, 323, 302, 302, 139, 302, - 35, 305, 0, 0, 325, 527, 141, 210, 35, 0, - 24, 37, 11, 0, 0, 0, 358, 0, 24, 37, - 11, 532, 529, 531, 533, 530, 534, 0, 0, 0, + 165, 543, 163, 430, 409, 512, 303, 301, 386, 394, + 504, 411, 557, 455, 305, 515, 519, 430, 404, 551, + 569, 144, 176, 296, 13, 489, 314, 384, 182, 244, + 201, 180, 296, 433, 567, 237, 481, 247, 439, 232, + 170, 566, 341, 244, 176, 430, 345, 564, 343, 429, + 433, 584, 333, 423, 328, 176, 330, 296, 332, 237, + 441, 347, 426, 396, 466, 454, 232, 443, 452, 237, + 244, 461, 548, 232, 450, 419, 444, 134, 427, 522, + 479, 476, 54, 0, 0, 433, 84, 0, 142, 100, + 496, 0, 618, 201, 496, 137, 523, 496, 500, 157, + 201, 0, 0, 140, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 398, 102, 54, 399, 0, 54, + 82, 54, 54, 83, 174, 54, 282, 174, 140, 54, + 54, 445, 54, 54, 401, 86, 140, 87, 314, 54, + 54, 66, 172, 54, 281, 89, 180, 54, 54, 446, + 260, 54, 54, 280, 174, 264, 296, 159, 54, 54, + 54, 96, 445, 85, 279, 54, 54, 54, 446, 54, + 278, 54, 88, 54, 448, 71, 474, 90, 54, 91, + 473, 64, 54, 54, 446, 488, 54, 398, 445, 296, + 399, 54, 296, 455, 231, 54, 338, 63, 54, 54, + 62, 61, 54, 54, 54, 55, 484, 162, 54, 92, + 485, 54, 54, 398, 323, 100, 399, 78, 0, 613, + 297, 615, 54, 94, 483, 54, 54, 487, 486, 0, + 292, 54, 0, 292, 335, 264, 264, 0, 264, 0, + 54, 102, 169, 466, 287, 264, 292, 0, 0, 267, + 0, 264, 313, 324, 54, 311, 326, 292, 54, 264, + 54, 285, 264, 264, 0, 264, 54, 465, 294, 289, + 0, 264, 0, 54, 0, 307, 296, 54, 264, 291, + 272, 292, 264, 310, 283, 54, 264, 496, 537, 0, + 264, 571, 284, 576, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 320, 528, 538, 0, 0, 573, 575, + 577, 574, 578, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 299, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 571, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 569, 0, 0, 0, 0, 0, - 493, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 496, 537, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 528, 538, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0}; + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0}; const int QmlJSGrammar::action_check [] = { - 60, 8, 36, 36, 33, 33, 7, 60, 7, 36, - 29, 33, 7, 7, 7, 36, 7, 55, 7, 78, - 1, 78, 48, 1, 36, 33, 36, 36, 60, 5, - 55, 61, 2, 33, 8, 55, 60, 16, 7, 7, - 7, 5, 48, 60, 7, 2, 60, 20, 7, 5, - 48, 17, 55, 2, 31, 7, 61, 8, 33, 7, - 7, 7, 7, 60, 36, 36, 7, 0, 8, 7, - 7, 36, 7, 88, 36, 29, 36, 1, 60, 65, - 33, 17, 78, 1, 7, 7, 36, 7, 7, 33, - 33, 76, 8, 2, 55, 78, 88, 36, 8, 29, - 8, 8, 36, 61, 36, 36, 48, 36, 8, 8, - 8, 66, 40, 8, 40, 8, -1, 7, 8, 8, - -1, -1, -1, 51, 15, 51, 8, 40, 40, 50, - 6, 8, 10, 54, 61, 62, 61, 62, 51, 51, - 42, 8, 33, 8, 20, 7, 61, 62, 8, 29, - 60, 53, 60, 60, 29, 61, 62, 56, 56, 29, - 60, 56, 50, 56, 61, 62, 54, 61, 62, 61, - 62, 60, 8, 29, 61, 62, 7, 55, 7, 61, - 61, 62, 8, 60, 29, -1, 15, 15, 15, 12, - 29, 66, 67, 60, 74, 60, 66, 67, 15, 29, - 8, 61, 62, -1, 33, 85, 34, 34, 36, 36, - 66, 67, 8, 29, -1, -1, -1, 34, -1, 36, - 29, 66, 67, 29, -1, 61, 62, 66, 67, 7, - 61, 62, 29, -1, 57, 61, 62, 29, -1, 25, - 63, 27, 12, 25, 74, 27, 25, 12, 27, -1, - 66, 67, 38, 61, 62, 85, 38, 66, 67, 38, - 66, 67, 29, 18, 19, 61, 62, 29, -1, 66, - 67, 29, -1, -1, 66, 67, 8, -1, 36, 18, - 19, 29, -1, 61, 62, -1, -1, 57, 36, -1, - 45, 46, 57, 63, 18, 19, 18, 19, 63, 66, - 67, 33, 23, 24, 66, 67, 45, 46, 66, 67, - 29, 32, 29, 25, 35, 27, 37, -1, 66, 67, - 29, 45, 46, 45, 46, 29, 38, 23, 24, 61, - 62, -1, 29, -1, -1, -1, 32, -1, -1, 35, - -1, 37, 61, 62, 61, 62, -1, 66, 67, 66, - 67, 29, 61, 62, -1, 59, -1, 66, 67, 23, - 24, -1, 66, 67, 61, 62, 23, 24, 32, 66, - 67, 35, -1, 37, -1, 32, 29, -1, 35, 29, - 37, 85, -1, 61, 62, 23, 24, -1, 66, 67, - -1, -1, -1, 31, 32, 23, 24, 35, -1, 37, - -1, -1, -1, 31, 32, -1, 59, 35, -1, 37, - -1, 61, 62, 66, 67, -1, 66, 67, 10, 23, - 24, -1, -1, -1, -1, -1, -1, 31, 32, -1, - 22, 35, 85, 37, -1, 23, 24, 29, -1, 10, - -1, 23, 24, 31, 32, -1, -1, 35, -1, 37, - 32, 22, -1, 35, -1, 37, -1, -1, 29, -1, - -1, -1, -1, 55, -1, -1, -1, 59, -1, -1, - -1, -1, -1, -1, 66, 67, -1, -1, -1, -1, - -1, -1, 74, -1, 55, -1, -1, -1, 59, -1, - -1, 83, -1, 85, -1, 66, 67, 3, -1, -1, - -1, -1, -1, 74, -1, -1, -1, 13, -1, 23, - 24, 17, 83, -1, 85, -1, -1, 31, 32, -1, - 26, 35, 28, 37, -1, 31, -1, -1, -1, -1, - -1, -1, -1, 39, -1, 41, 42, -1, -1, 12, - 13, -1, -1, 49, -1, -1, 52, 53, -1, 22, - -1, -1, 58, -1, -1, -1, 29, -1, 64, -1, - 33, 34, -1, 36, -1, -1, -1, -1, -1, -1, - 43, -1, -1, 79, 47, -1, -1, 3, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 13, -1, -1, - -1, 17, 65, 66, 67, -1, 69, -1, -1, -1, - 26, -1, 28, -1, -1, -1, -1, 80, 81, 82, - -1, -1, -1, 39, -1, 41, 42, -1, -1, -1, - -1, -1, -1, 49, -1, -1, 52, 53, -1, -1, - -1, -1, 58, -1, -1, -1, -1, -1, 64, -1, + 7, 36, 36, 7, 55, 7, 33, 7, 36, 7, + 55, 8, 36, 7, 36, 16, 36, 7, 60, 7, + 33, 7, 33, 55, 36, 7, 36, 60, 7, 20, + 55, 5, 7, 5, 29, 8, 29, 36, 7, 17, + 36, 33, 29, 60, 33, 60, 7, 5, 7, 88, + 7, 36, 36, 33, 7, 7, 33, 66, 7, 7, + 36, 1, 8, 2, 78, 36, 7, 1, 36, 7, + 78, 8, 2, 78, 1, 8, 36, 60, 33, 8, + 61, 7, 48, 7, 48, 88, 48, 31, 7, 36, + 33, 61, 17, 60, 36, 60, 2, 60, 8, 55, + 36, 36, 2, 1, 36, 8, 60, 8, 7, 8, + -1, 8, 8, 8, 8, 6, 61, 48, 8, 8, + 40, 8, 10, 8, 40, 8, 76, 78, 50, 20, + 8, 51, 54, 61, 62, 51, 15, -1, 61, 62, + 61, 62, 50, 61, 62, 8, 54, 61, 62, 61, + 62, 7, 61, 62, 33, 29, 29, 60, 12, 60, + 56, 56, 29, 60, 40, 7, 60, 55, 61, 62, + 60, 56, 61, 60, 40, 51, 0, 60, 42, 61, + 62, 25, 60, 27, 29, 51, 61, 62, 8, 53, + 61, 62, 29, 56, 38, 12, 8, 29, 8, 29, + 74, 74, 25, 57, 27, 61, 62, 74, -1, 63, + 29, 85, 85, 8, -1, 38, -1, -1, 85, 61, + 62, 66, 67, 29, -1, 61, 62, 29, -1, 66, + 67, 29, 12, -1, 66, 67, 29, -1, 29, -1, + 57, 61, 62, 25, 74, 27, 63, 66, 67, 61, + 62, 61, 62, 89, 29, 85, 38, 25, 29, 27, + 66, 67, 61, 62, 66, 67, 61, 62, 66, 67, + 38, 7, 29, 66, 67, 66, 67, 57, 29, 15, + 25, 15, 27, 63, 15, 25, 25, 27, 27, 8, + 89, 66, 67, 38, -1, 66, 67, 33, 38, 38, + 34, 29, 36, 34, 25, 36, 27, 29, -1, 66, + 67, 25, 25, 27, 27, 66, 67, 38, 25, 25, + 27, 27, 18, 19, 38, 38, 90, 91, 92, 29, + -1, 38, 38, 25, 29, 27, -1, 8, 66, 67, + -1, -1, 61, 62, 66, 67, 38, 29, -1, 45, + 46, -1, -1, -1, 36, 18, 19, 29, -1, 15, + 18, 19, 33, 29, 36, -1, 66, 67, -1, -1, + -1, 66, 67, -1, 15, -1, -1, -1, 34, -1, + 36, -1, 45, 46, 66, 67, -1, 45, 46, -1, + 61, 62, -1, 59, 66, 67, 23, 24, -1, -1, + 66, 67, 23, 24, 29, 32, 47, -1, 35, -1, + 37, 32, -1, 29, 35, -1, 37, 23, 24, 85, + 61, 62, -1, -1, 29, -1, 32, 29, -1, 35, + -1, 37, -1, -1, -1, -1, 61, 62, 29, 18, + 19, 66, 67, 23, 24, 61, 62, -1, 89, -1, + 66, 67, 32, 29, 59, 35, 29, 37, -1, 61, + 62, 66, 67, -1, 66, 67, 45, 46, -1, -1, + 61, 62, -1, -1, -1, 66, 67, -1, -1, -1, + 85, -1, -1, -1, -1, 61, 62, 10, 61, 62, + 66, 67, -1, 66, 67, 23, 24, 29, -1, 22, + -1, 10, -1, 31, 32, -1, 29, 35, -1, 37, + 23, 24, -1, 22, -1, -1, 23, 24, 31, 32, + 29, -1, 35, -1, 37, 32, -1, 59, 35, -1, + 37, 3, 55, 65, 66, 67, 59, -1, -1, -1, + -1, 13, -1, 66, 67, 17, 55, -1, -1, -1, + 59, 74, -1, 85, 26, -1, 28, 66, 67, -1, + 83, -1, 85, -1, -1, 74, -1, 39, -1, 41, + 42, -1, -1, -1, 83, -1, 85, 49, -1, -1, + 52, 53, -1, -1, -1, 3, 58, -1, 23, 24, + -1, -1, 64, -1, -1, 13, 31, 32, -1, 17, + 35, -1, 37, -1, -1, -1, -1, 79, 26, -1, + 28, -1, -1, 31, -1, -1, -1, -1, -1, -1, + -1, 39, -1, 41, 42, -1, -1, -1, -1, -1, + -1, 49, -1, -1, 52, 53, -1, -1, -1, -1, + 58, -1, -1, -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 79, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 12, 13, -1, -1, -1, - -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, - -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, - -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, - 47, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, - 67, -1, 69, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 80, 81, 82, -1, -1, -1, -1, - -1, -1, -1, -1, 11, 12, 13, -1, -1, -1, + 3, 79, -1, -1, -1, -1, -1, -1, -1, -1, + 13, -1, -1, -1, 17, -1, -1, -1, -1, -1, + -1, -1, -1, 26, -1, 28, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 39, -1, 41, 42, + -1, 11, 12, 13, -1, -1, 49, -1, -1, 52, + 53, -1, 22, -1, -1, 58, -1, -1, -1, 29, + -1, 64, -1, 33, 34, -1, 36, -1, -1, -1, + 40, -1, 42, 43, 44, -1, 79, 47, -1, -1, + -1, 51, -1, 53, -1, -1, -1, -1, -1, -1, + -1, -1, 12, 13, -1, 65, 66, 67, -1, 69, + -1, 71, 22, 73, -1, 75, -1, -1, -1, 29, + 80, 81, 82, 33, 34, -1, 36, -1, -1, -1, + -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 65, 66, 67, -1, 69, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 80, 81, 82, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 11, 12, 13, -1, -1, + -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, + -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, + 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, + -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, + 66, 67, -1, 69, -1, 71, -1, 73, -1, 75, + -1, -1, -1, -1, 80, 81, 82, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, + -1, -1, -1, 11, 12, 13, -1, -1, -1, -1, + -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, + -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, + -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, + -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, + -1, 69, -1, 71, -1, 73, -1, 75, -1, -1, + -1, -1, 80, 81, 82, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 11, 12, 13, + -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, + -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, + 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, + 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 65, 66, 67, -1, 69, -1, 71, -1, 73, + 74, 75, -1, -1, -1, -1, 80, 81, 82, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 8, -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, - 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, + 47, -1, -1, -1, 51, -1, 53, -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, -1, 69, -1, 71, -1, 73, -1, 75, -1, -1, -1, -1, 80, 81, 82, -1, -1, -1, -1, - -1, -1, -1, -1, 7, -1, -1, -1, 11, 12, - 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, - -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, - 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, - 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, - 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 65, 66, 67, -1, 69, -1, 71, -1, - 73, -1, 75, -1, -1, -1, -1, 80, 81, 82, - -1, -1, -1, -1, -1, -1, -1, -1, 11, 12, - 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, - -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, - 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, - 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, - 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 65, 66, 67, -1, 69, -1, 71, -1, - 73, 74, 75, -1, -1, -1, -1, 80, 81, 82, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, @@ -681,73 +738,77 @@ const int QmlJSGrammar::action_check [] = { -1, -1, -1, -1, -1, 65, 66, 67, -1, 69, -1, 71, -1, 73, -1, 75, -1, -1, -1, -1, 80, 81, 82, -1, -1, -1, -1, -1, -1, -1, - -1, 8, -1, -1, 11, 12, 13, -1, -1, -1, - -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, - -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, - -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, - 47, -1, -1, -1, 51, -1, 53, -1, -1, 56, - -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, - 67, -1, 69, -1, 71, -1, 73, -1, 75, -1, - -1, -1, -1, 80, 81, 82, -1, -1, -1, -1, - -1, -1, -1, -1, 8, -1, -1, 11, 12, 13, - -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, - -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, - 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, - 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, - -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, - -1, 65, 66, 67, -1, 69, -1, 71, -1, 73, - -1, 75, -1, -1, -1, -1, 80, 81, 82, -1, - -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, - 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, - -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, - -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, - -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, - 51, -1, 53, -1, -1, 56, -1, -1, -1, -1, - -1, -1, -1, -1, 65, 66, 67, -1, 69, -1, - 71, -1, 73, -1, 75, -1, -1, -1, -1, 80, - 81, 82, -1, -1, -1, -1, -1, -1, -1, -1, - 8, -1, -1, 11, 12, 13, -1, -1, -1, -1, - -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, - -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, - -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, - -1, -1, -1, 51, -1, 53, -1, -1, 56, -1, - -1, 59, -1, -1, -1, -1, -1, 65, 66, 67, - -1, 69, -1, 71, -1, 73, -1, 75, -1, -1, - -1, -1, 80, 81, 82, -1, -1, 85, -1, -1, - -1, -1, -1, 11, 12, 13, -1, -1, -1, -1, - -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, - -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, - -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, - -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, - -1, -1, -1, 61, -1, -1, -1, 65, 66, 67, - -1, 69, -1, 71, -1, 73, -1, 75, -1, -1, - -1, -1, 80, 81, 82, -1, 84, -1, 86, -1, - -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, - 11, -1, -1, 14, -1, 16, -1, -1, -1, 20, - 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, - 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 43, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, - -1, -1, -1, -1, -1, 66, 67, 68, 69, 70, - -1, 72, 73, 74, 75, 76, 77, -1, -1, 80, - 81, 82, 83, 84, 85, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 8, -1, -1, 11, 12, + 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, + -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, + 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, + 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, + 53, -1, -1, 56, -1, -1, -1, -1, -1, -1, + -1, -1, 65, 66, 67, -1, 69, -1, 71, -1, + 73, -1, 75, -1, -1, -1, -1, 80, 81, 82, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 8, -1, -1, 11, 12, 13, -1, -1, + -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, + -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, + 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, + -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, + 56, -1, -1, -1, -1, -1, -1, -1, -1, 65, + 66, 67, -1, 69, -1, 71, -1, 73, -1, 75, + -1, -1, -1, -1, 80, 81, 82, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, + 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, + 22, -1, -1, -1, -1, -1, -1, 29, 30, -1, + -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, + 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, + -1, 53, -1, -1, -1, -1, -1, -1, -1, 61, + -1, -1, -1, 65, 66, 67, -1, 69, -1, 71, + -1, 73, -1, 75, -1, -1, -1, -1, 80, 81, + 82, -1, 84, -1, 86, -1, -1, -1, -1, -1, + -1, -1, -1, 8, -1, -1, 11, 12, 13, -1, + -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, + -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, + -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, + -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, + -1, 56, -1, -1, 59, -1, -1, -1, -1, -1, + 65, 66, 67, -1, 69, -1, 71, -1, 73, -1, + 75, -1, -1, -1, -1, 80, 81, 82, -1, -1, + 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, 31, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, - -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, - -1, 65, 66, 67, 68, 69, 70, -1, 72, 73, + -1, -1, 66, 67, 68, 69, 70, -1, 72, 73, 74, 75, 76, 77, -1, -1, 80, 81, 82, 83, - 84, 85, -1, -1, -1, -1, -1, 4, 5, 6, - -1, -1, 9, 10, 11, -1, -1, 14, -1, 16, - -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, - -1, -1, 29, 30, 31, 32, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, - 47, -1, -1, -1, -1, -1, -1, -1, 55, -1, - -1, -1, 59, -1, -1, -1, -1, -1, 65, 66, - 67, 68, 69, 70, -1, 72, 73, 74, 75, 76, - 77, -1, -1, 80, 81, 82, 83, 84, 85, -1, + 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 4, 5, 6, -1, -1, 9, 10, 11, -1, + -1, 14, -1, 16, -1, -1, -1, 20, 21, 22, + -1, -1, -1, -1, -1, -1, 29, 30, 31, 32, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 43, -1, -1, -1, 47, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 59, -1, -1, -1, + -1, -1, 65, 66, 67, 68, 69, 70, -1, 72, + 73, 74, 75, 76, 77, -1, -1, 80, 81, 82, + 83, 84, 85, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, + -1, -1, 14, -1, 16, -1, -1, -1, 20, 21, + 22, -1, -1, -1, -1, -1, -1, 29, 30, 31, + 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 43, -1, -1, -1, 47, -1, -1, -1, -1, + -1, -1, -1, 55, -1, -1, -1, 59, -1, -1, + -1, -1, -1, 65, 66, 67, 68, 69, 70, -1, + 72, 73, 74, 75, 76, 77, -1, -1, 80, 81, + 82, 83, 84, 85, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 4, -1, -1, -1, -1, 9, -1, + 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, + 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, + -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, + -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, + 51, -1, 53, -1, -1, -1, -1, -1, 59, -1, + 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, -1, -1, 80, + 81, 82, 83, 84, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, 9, -1, 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, 21, 22, -1, -1, -1, -1, -1, -1, 29, @@ -757,73 +818,72 @@ const int QmlJSGrammar::action_check [] = { -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, -1, 80, 81, 82, 83, 84, -1, -1, -1, -1, -1, - -1, 4, -1, -1, -1, -1, 9, -1, 11, 12, - 13, 14, -1, -1, -1, -1, -1, -1, 21, 22, - -1, -1, -1, -1, -1, -1, 29, 30, -1, -1, - 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, - 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, - 53, -1, -1, -1, -1, -1, 59, -1, 61, -1, - -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, -1, -1, 80, 81, 82, - 83, 84, -1, -1, -1, -1, -1, -1, 4, 5, - 6, -1, -1, 9, 10, 11, 12, 13, 14, -1, - 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, - -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, - 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, - -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, - -1, -1, -1, 59, -1, 61, -1, -1, -1, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, -1, -1, 80, 81, 82, 83, 84, 85, -1, -1, -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, 12, 13, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, - -1, -1, 51, -1, 53, -1, 55, -1, -1, -1, + -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, 59, -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, -1, -1, 80, 81, 82, 83, 84, 85, -1, -1, -1, - -1, -1, + -1, -1, -1, -1, -1, -1, 4, 5, 6, -1, + -1, 9, 10, 11, 12, 13, 14, -1, 16, -1, + -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, + -1, 29, 30, 31, 32, 33, 34, -1, 36, -1, + -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, + -1, -1, -1, 51, -1, 53, -1, 55, -1, -1, + -1, 59, -1, 61, -1, -1, -1, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + -1, -1, 80, 81, 82, 83, 84, 85, -1, -1, + -1, -1, -1, -1, -1, -1, -1, - 14, 93, 66, 15, 23, 29, 76, 76, 23, 20, - 23, 14, 29, 23, 15, 23, 23, 14, 62, 23, - 14, 23, 10, 29, 5, 14, 66, 66, 14, 29, - 14, 23, 66, 66, 29, 66, 14, 66, 66, 14, - 23, 23, 14, 23, 14, 14, 66, 23, 66, 23, - 29, 14, 29, 14, 14, 23, 23, 66, 29, 14, - 14, 66, 14, 29, 23, 29, 91, 66, 66, 14, - 66, 29, 29, 66, 30, 14, -1, 39, 29, 25, - -1, 23, 44, 29, 35, 23, 39, -1, 15, 39, - 39, 39, 45, 41, 44, 44, 39, 88, 39, 39, - 41, 44, 39, 39, 44, 41, 39, 39, 45, 6, - 39, -1, 45, 42, 39, 39, 41, 41, 39, 66, - 39, 42, 41, 55, 63, 39, 23, 41, 39, 39, - 39, 41, 41, 39, 6, 41, 39, 39, 80, 14, - -1, 44, 53, 39, 39, 47, 14, 23, 44, 44, - 39, 23, 41, 100, 39, 39, 94, 41, 39, 44, - 41, 39, 33, 41, 29, 36, 39, -1, 66, 39, - 35, 44, 39, 43, -1, 33, -1, 44, 36, 39, - 39, 41, 41, 39, 39, 23, 33, 43, 63, 36, - 39, 39, 14, 31, 43, 63, 51, 95, 39, 39, - 41, 49, 39, -1, 44, 39, 82, 39, 45, 39, - 44, 39, 44, 39, 44, 39, 44, -1, 44, -1, - 44, -1, -1, 39, 50, 39, 54, 61, 44, 61, - 44, 61, 46, -1, -1, -1, -1, 61, 39, -1, - 56, 63, 39, 44, 39, 46, 41, 44, 39, 46, - -1, 39, 39, 44, 39, 46, 44, 44, 23, 44, - 11, 48, -1, -1, 52, 8, 31, 32, 11, -1, - 21, 22, 23, -1, -1, -1, 61, -1, 21, 22, - 23, 14, 15, 16, 17, 18, 19, -1, -1, -1, + 33, 23, 33, 3, 2, 9, 3, 2, 34, 33, + 9, 3, 3, 9, 2, 9, 9, 3, 2, 9, + 9, 66, 9, 3, 3, 2, 9, 33, 9, 2, + 2, 9, 3, 18, 9, 9, 3, 3, 96, 9, + 3, 23, 2, 2, 9, 3, 2, 23, 3, 79, + 18, 15, 9, 91, 2, 9, 3, 3, 2, 9, + 9, 2, 79, 2, 33, 2, 9, 18, 3, 9, + 2, 33, 3, 9, 2, 94, 18, 3, 3, 8, + 33, 33, 43, -1, -1, 18, 47, -1, 33, 9, + 9, -1, 11, 2, 9, 33, 11, 9, 10, 33, + 2, -1, -1, 33, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 37, 35, 43, 40, -1, 43, + 47, 43, 43, 47, 45, 43, 48, 45, 33, 43, + 43, 45, 43, 43, 39, 48, 33, 48, 9, 43, + 43, 51, 39, 43, 48, 48, 9, 43, 43, 45, + 43, 43, 43, 48, 45, 48, 3, 57, 43, 43, + 43, 53, 45, 48, 48, 43, 43, 43, 45, 43, + 48, 43, 48, 43, 3, 49, 29, 49, 43, 49, + 33, 46, 43, 43, 45, 45, 43, 37, 45, 3, + 40, 43, 3, 9, 103, 43, 98, 45, 43, 43, + 45, 45, 43, 43, 43, 46, 45, 59, 43, 49, + 45, 43, 43, 37, 85, 9, 40, 48, -1, 9, + 67, 11, 43, 55, 45, 43, 43, 45, 45, -1, + 43, 43, -1, 43, 97, 48, 48, -1, 48, -1, + 43, 35, 36, 33, 56, 48, 43, -1, -1, 52, + -1, 48, 65, 67, 43, 65, 67, 43, 43, 48, + 43, 50, 48, 48, -1, 48, 43, 83, 65, 54, + -1, 48, -1, 43, -1, 58, 3, 43, 48, 65, + 50, 43, 48, 60, 50, 43, 48, 9, 10, -1, + 48, 13, 50, 3, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 65, 26, 27, -1, -1, 18, 19, + 20, 21, 22, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 67, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 6, -1, -1, + -1, -1, -1, -1, -1, 26, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 23, -1, -1, -1, -1, -1, - 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1}; + -1, -1, -1, -1}; diff --git a/src/plugins/duieditor/parser/qmljsgrammar_p.h b/src/plugins/duieditor/parser/qmljsgrammar_p.h index ff948613d1..da42f8c412 100644 --- a/src/plugins/duieditor/parser/qmljsgrammar_p.h +++ b/src/plugins/duieditor/parser/qmljsgrammar_p.h @@ -2,7 +2,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the QtCore module of the Qt Toolkit. ** @@ -35,7 +35,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -59,11 +59,12 @@ class QmlJSGrammar public: enum { EOF_SYMBOL = 0, - REDUCE_HERE = 90, - SHIFT_THERE = 89, + REDUCE_HERE = 94, + SHIFT_THERE = 93, T_AND = 1, T_AND_AND = 2, T_AND_EQ = 3, + T_AS = 89, T_AUTOMATIC_SEMICOLON = 62, T_BREAK = 4, T_CASE = 5, @@ -84,6 +85,9 @@ public: T_EQ_EQ = 18, T_EQ_EQ_EQ = 19, T_FALSE = 82, + T_FEED_JS_EXPRESSION = 92, + T_FEED_JS_STATEMENT = 91, + T_FEED_UI_PROGRAM = 90, T_FINALLY = 20, T_FOR = 21, T_FUNCTION = 22, @@ -150,15 +154,15 @@ public: T_XOR = 78, T_XOR_EQ = 79, - ACCEPT_STATE = 588, - RULE_COUNT = 323, - STATE_COUNT = 589, - TERMINAL_COUNT = 91, - NON_TERMINAL_COUNT = 102, + ACCEPT_STATE = 621, + RULE_COUNT = 341, + STATE_COUNT = 622, + TERMINAL_COUNT = 95, + NON_TERMINAL_COUNT = 105, - GOTO_INDEX_OFFSET = 589, - GOTO_INFO_OFFSET = 2092, - GOTO_CHECK_OFFSET = 2092 + GOTO_INDEX_OFFSET = 622, + GOTO_INFO_OFFSET = 2247, + GOTO_CHECK_OFFSET = 2247 }; static const char *const spell []; diff --git a/src/plugins/duieditor/parser/qmljslexer.cpp b/src/plugins/duieditor/parser/qmljslexer.cpp index c5e4dbc655..a22169dda0 100644 --- a/src/plugins/duieditor/parser/qmljslexer.cpp +++ b/src/plugins/duieditor/parser/qmljslexer.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -159,6 +159,8 @@ int Lexer::findReservedWord(const QChar *c, int size) const return QmlJSGrammar::T_IF; else if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('n')) return QmlJSGrammar::T_IN; + else if (c[0] == QLatin1Char('a') && c[1] == QLatin1Char('s')) + return QmlJSGrammar::T_AS; } break; case 3: { diff --git a/src/plugins/duieditor/parser/qmljslexer_p.h b/src/plugins/duieditor/parser/qmljslexer_p.h index e46aec3a65..e1ff23e053 100644 --- a/src/plugins/duieditor/parser/qmljslexer_p.h +++ b/src/plugins/duieditor/parser/qmljslexer_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/duieditor/parser/qmljsmemorypool_p.h b/src/plugins/duieditor/parser/qmljsmemorypool_p.h index fc35b5a8b3..6bd21f8b4f 100644 --- a/src/plugins/duieditor/parser/qmljsmemorypool_p.h +++ b/src/plugins/duieditor/parser/qmljsmemorypool_p.h @@ -1,9 +1,9 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/duieditor/parser/qmljsnodepool_p.h b/src/plugins/duieditor/parser/qmljsnodepool_p.h index 7cb62bae65..e2f0a3c1ea 100644 --- a/src/plugins/duieditor/parser/qmljsnodepool_p.h +++ b/src/plugins/duieditor/parser/qmljsnodepool_p.h @@ -1,9 +1,9 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/duieditor/parser/qmljsparser.cpp b/src/plugins/duieditor/parser/qmljsparser.cpp index 91bf7831e3..08a424eaad 100644 --- a/src/plugins/duieditor/parser/qmljsparser.cpp +++ b/src/plugins/duieditor/parser/qmljsparser.cpp @@ -3,7 +3,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -36,7 +36,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -143,14 +143,16 @@ AST::UiQualifiedId *Parser::reparseAsQualifiedId(AST::ExpressionNode *expr) return 0; } -bool Parser::parse() +bool Parser::parse(int startToken) { Lexer *lexer = driver->lexer(); bool hadErrors = false; int yytoken = -1; int action = 0; - first_token = last_token = 0; + token_buffer[0].token = startToken; + first_token = &token_buffer[0]; + last_token = &token_buffer[1]; tos = -1; program = 0; @@ -194,25 +196,39 @@ bool Parser::parse() switch (r) { case 0: { - program = makeAstNode<AST::UiProgram> (driver->nodePool(), sym(1).UiImportList, - sym(2).UiObjectMemberList->finish()); - sym(1).UiProgram = program; + sym(1).Node = sym(2).Node; + program = sym(1).Node; +} break; + +case 1: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; } break; case 2: { - sym(1).Node = sym(1).UiImportList->finish(); + sym(1).Node = sym(2).Node; + program = sym(1).Node; } break; case 3: { + sym(1).UiProgram = makeAstNode<AST::UiProgram> (driver->nodePool(), sym(1).UiImportList, + sym(2).UiObjectMemberList->finish()); +} break; + +case 5: { + sym(1).Node = sym(1).UiImportList->finish(); +} break; + +case 6: { sym(1).Node = makeAstNode<AST::UiImportList> (driver->nodePool(), sym(1).UiImport); } break; -case 4: { +case 7: { sym(1).Node = makeAstNode<AST::UiImportList> (driver->nodePool(), sym(1).UiImportList, sym(2).UiImport); } break; -case 6: { +case 9: { AST::UiImport *node = makeAstNode<AST::UiImport>(driver->nodePool(), sym(2).sval); node->importToken = loc(1); node->fileNameToken = loc(2); @@ -220,56 +236,107 @@ case 6: { sym(1).Node = node; } break; -case 7: { +case 11: { + AST::UiImport *node = makeAstNode<AST::UiImport>(driver->nodePool(), sym(2).sval); + node->importId = sym(4).sval; + node->importToken = loc(1); + node->fileNameToken = loc(2); + node->asToken = loc(3); + node->importIdToken = loc(4); + node->semicolonToken = loc(5); + sym(1).Node = node; +} break; + +case 13: { + AST::UiImport *node = makeAstNode<AST::UiImport>(driver->nodePool(), sym(2).UiQualifiedId->finish()); + node->importToken = loc(1); + node->fileNameToken = loc(2); + node->semicolonToken = loc(3); + sym(1).Node = node; +} break; + +case 15: { + AST::UiImport *node = makeAstNode<AST::UiImport>(driver->nodePool(), sym(2).UiQualifiedId->finish()); + node->importToken = loc(1); + node->fileNameToken = loc(2); + node->versionToken = loc(3); + node->semicolonToken = loc(4); + sym(1).Node = node; +} break; + +case 17: { + AST::UiImport *node = makeAstNode<AST::UiImport>(driver->nodePool(), sym(2).UiQualifiedId->finish()); + node->importId = sym(5).sval; + node->importToken = loc(1); + node->fileNameToken = loc(2); + node->versionToken = loc(3); + node->asToken = loc(4); + node->importIdToken = loc(5); + node->semicolonToken = loc(6); + sym(1).Node = node; +} break; + +case 19: { + AST::UiImport *node = makeAstNode<AST::UiImport>(driver->nodePool(), sym(2).UiQualifiedId->finish()); + node->importId = sym(4).sval; + node->importToken = loc(1); + node->fileNameToken = loc(2); + node->asToken = loc(3); + node->importIdToken = loc(4); + node->semicolonToken = loc(5); + sym(1).Node = node; +} break; + +case 20: { sym(1).Node = 0; } break; -case 8: { +case 21: { sym(1).Node = makeAstNode<AST::UiObjectMemberList> (driver->nodePool(), sym(1).UiObjectMember); } break; -case 9: { +case 22: { sym(1).Node = makeAstNode<AST::UiObjectMemberList> (driver->nodePool(), sym(1).UiObjectMember); } break; -case 10: { +case 23: { AST::UiObjectMemberList *node = makeAstNode<AST:: UiObjectMemberList> (driver->nodePool(), sym(1).UiObjectMemberList, sym(2).UiObjectMember); sym(1).Node = node; } break; -case 11: { +case 24: { sym(1).Node = makeAstNode<AST::UiArrayMemberList> (driver->nodePool(), sym(1).UiObjectMember); } break; -case 12: { +case 25: { AST::UiArrayMemberList *node = makeAstNode<AST::UiArrayMemberList> (driver->nodePool(), sym(1).UiArrayMemberList, sym(3).UiObjectMember); node->commaToken = loc(2); sym(1).Node = node; } break; -case 13: { +case 26: { AST::UiObjectInitializer *node = makeAstNode<AST::UiObjectInitializer> (driver->nodePool(), (AST::UiObjectMemberList*)0); node->lbraceToken = loc(1); node->rbraceToken = loc(2); sym(1).Node = node; } break; -case 14: { +case 27: { AST::UiObjectInitializer *node = makeAstNode<AST::UiObjectInitializer> (driver->nodePool(), sym(2).UiObjectMemberList->finish()); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 15: { +case 28: { AST::UiObjectDefinition *node = makeAstNode<AST::UiObjectDefinition> (driver->nodePool(), sym(1).UiQualifiedId->finish(), sym(2).UiObjectInitializer); sym(1).Node = node; } break; -case 17: { +case 30: { AST::UiArrayBinding *node = makeAstNode<AST::UiArrayBinding> (driver->nodePool(), sym(1).UiQualifiedId->finish(), sym(4).UiArrayMemberList->finish()); node->colonToken = loc(2); @@ -278,19 +345,19 @@ case 17: { sym(1).Node = node; } break; -case 18: { +case 31: { AST::StringLiteral *node = makeAstNode<AST::StringLiteral> (driver->nodePool(), sym(1).sval); node->literalToken = loc(1); sym(1).Node = node; } break; -case 20: { +case 33: { AST::ExpressionStatement *node = makeAstNode<AST::ExpressionStatement> (driver->nodePool(), sym(1).Expression); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 21: { +case 34: { if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(3).Expression)) { AST::UiObjectBinding *node = makeAstNode<AST::UiObjectBinding> (driver->nodePool(), sym(1).UiQualifiedId->finish(), qualifiedId, sym(4).UiObjectInitializer); @@ -305,7 +372,7 @@ case 21: { return false; // ### recover } } break; -case 22:case 23:case 24:case 25:case 26:case 27: +case 35:case 36:case 37:case 38:case 39:case 40: { AST::UiScriptBinding *node = makeAstNode<AST::UiScriptBinding> (driver->nodePool(), sym(1).UiQualifiedId->finish(), sym(3).Statement); @@ -313,23 +380,54 @@ case 22:case 23:case 24:case 25:case 26:case 27: sym(1).Node = node; } break; -case 28: +case 41: -case 29: { +case 42: { sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount()); break; } -case 31: { +case 44: { + sym(1).Node = 0; +} break; + +case 45: { + sym(1).Node = sym(1).UiParameterList->finish (); +} break; + +case 46: { + AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), sym(1).sval, sym(2).sval); + node->identifierToken = loc(2); + sym(1).Node = node; +} break; + +case 47: { + AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), sym(1).UiParameterList, sym(3).sval, sym(4).sval); + node->commaToken = loc(2); + node->identifierToken = loc(4); + sym(1).Node = node; +} break; + +case 48: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), (NameId *)0, sym(2).sval); node->type = AST::UiPublicMember::Signal; node->propertyToken = loc(1); node->typeToken = loc(2); node->identifierToken = loc(3); + node->parameters = sym(4).UiParameterList; sym(1).Node = node; } break; -case 33: { +case 49: { + AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), (NameId *)0, sym(2).sval); + node->type = AST::UiPublicMember::Signal; + node->propertyToken = loc(1); + node->typeToken = loc(2); + node->identifierToken = loc(3); + sym(1).Node = node; +} break; + +case 51: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval); node->propertyToken = loc(1); node->typeToken = loc(2); @@ -338,7 +436,7 @@ case 33: { sym(1).Node = node; } break; -case 35: { +case 53: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval); node->isDefaultMember = true; node->defaultToken = loc(1); @@ -349,7 +447,7 @@ case 35: { sym(1).Node = node; } break; -case 37: { +case 55: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval, sym(5).Expression); node->propertyToken = loc(1); @@ -360,7 +458,7 @@ case 37: { sym(1).Node = node; } break; -case 39: { +case 57: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval, sym(6).Expression); node->isDefaultMember = true; @@ -373,76 +471,76 @@ case 39: { sym(1).Node = node; } break; -case 40: { +case 58: { sym(1).Node = makeAstNode<AST::UiSourceElement>(driver->nodePool(), sym(1).Node); } break; -case 41: { +case 59: { sym(1).Node = makeAstNode<AST::UiSourceElement>(driver->nodePool(), sym(1).Node); } break; -case 42: -case 43: +case 60: +case 61: { AST::UiQualifiedId *node = makeAstNode<AST::UiQualifiedId> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount())); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 45: { +case 63: { QString s = QLatin1String(QmlJSGrammar::spell[T_PROPERTY]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } -case 46: { +case 64: { QString s = QLatin1String(QmlJSGrammar::spell[T_SIGNAL]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } -case 47: { +case 65: { AST::ThisExpression *node = makeAstNode<AST::ThisExpression> (driver->nodePool()); node->thisToken = loc(1); sym(1).Node = node; } break; -case 48: { +case 66: { AST::IdentifierExpression *node = makeAstNode<AST::IdentifierExpression> (driver->nodePool(), sym(1).sval); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 49: { +case 67: { AST::NullExpression *node = makeAstNode<AST::NullExpression> (driver->nodePool()); node->nullToken = loc(1); sym(1).Node = node; } break; -case 50: { +case 68: { AST::TrueLiteral *node = makeAstNode<AST::TrueLiteral> (driver->nodePool()); node->trueToken = loc(1); sym(1).Node = node; } break; -case 51: { +case 69: { AST::FalseLiteral *node = makeAstNode<AST::FalseLiteral> (driver->nodePool()); node->falseToken = loc(1); sym(1).Node = node; } break; -case 52: { +case 70: { AST::NumericLiteral *node = makeAstNode<AST::NumericLiteral> (driver->nodePool(), sym(1).dval, lexer->flags); node->literalToken = loc(1); sym(1).Node = node; } break; -case 53: { +case 71: { AST::StringLiteral *node = makeAstNode<AST::StringLiteral> (driver->nodePool(), sym(1).sval); node->literalToken = loc(1); sym(1).Node = node; } break; -case 54: { +case 72: { bool rx = lexer->scanRegExp(Lexer::NoPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); @@ -453,7 +551,7 @@ case 54: { sym(1).Node = node; } break; -case 55: { +case 73: { bool rx = lexer->scanRegExp(Lexer::EqualPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); @@ -464,28 +562,28 @@ case 55: { sym(1).Node = node; } break; -case 56: { +case 74: { AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), (AST::Elision *) 0); node->lbracketToken = loc(1); node->rbracketToken = loc(2); sym(1).Node = node; } break; -case 57: { +case 75: { AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).Elision->finish()); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; -case 58: { +case 76: { AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish ()); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; -case 59: { +case 77: { AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish (), (AST::Elision *) 0); node->lbracketToken = loc(1); @@ -494,7 +592,7 @@ case 59: { sym(1).Node = node; } break; -case 60: { +case 78: { AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish (), sym(4).Elision->finish()); node->lbracketToken = loc(1); @@ -503,7 +601,7 @@ case 60: { sym(1).Node = node; } break; -case 61: { +case 79: { AST::ObjectLiteral *node = 0; if (sym(2).Node) node = makeAstNode<AST::ObjectLiteral> (driver->nodePool(), @@ -515,7 +613,7 @@ case 61: { sym(1).Node = node; } break; -case 62: { +case 80: { AST::ObjectLiteral *node = makeAstNode<AST::ObjectLiteral> (driver->nodePool(), sym(2).PropertyNameAndValueList->finish ()); node->lbraceToken = loc(1); @@ -523,67 +621,67 @@ case 62: { sym(1).Node = node; } break; -case 63: { +case 81: { AST::NestedExpression *node = makeAstNode<AST::NestedExpression>(driver->nodePool(), sym(2).Expression); node->lparenToken = loc(1); node->rparenToken = loc(3); sym(1).Node = node; } break; -case 64: { +case 82: { AST::UiQualifiedId *node = makeAstNode<AST::UiQualifiedId> (driver->nodePool(), sym(1).sval); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 65: { +case 83: { AST::UiQualifiedId *node = makeAstNode<AST::UiQualifiedId> (driver->nodePool(), sym(1).UiQualifiedId, sym(3).sval); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 66: { +case 84: { sym(1).Node = makeAstNode<AST::ElementList> (driver->nodePool(), (AST::Elision *) 0, sym(1).Expression); } break; -case 67: { +case 85: { sym(1).Node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).Elision->finish(), sym(2).Expression); } break; -case 68: { +case 86: { AST::ElementList *node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).ElementList, (AST::Elision *) 0, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 69: { +case 87: { AST::ElementList *node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).ElementList, sym(3).Elision->finish(), sym(4).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 70: { +case 88: { AST::Elision *node = makeAstNode<AST::Elision> (driver->nodePool()); node->commaToken = loc(1); sym(1).Node = node; } break; -case 71: { +case 89: { AST::Elision *node = makeAstNode<AST::Elision> (driver->nodePool(), sym(1).Elision); node->commaToken = loc(2); sym(1).Node = node; } break; -case 72: { +case 90: { AST::PropertyNameAndValueList *node = makeAstNode<AST::PropertyNameAndValueList> (driver->nodePool(), sym(1).PropertyName, sym(3).Expression); node->colonToken = loc(2); sym(1).Node = node; } break; -case 73: { +case 91: { AST::PropertyNameAndValueList *node = makeAstNode<AST::PropertyNameAndValueList> (driver->nodePool(), sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression); node->commaToken = loc(2); @@ -591,116 +689,116 @@ case 73: { sym(1).Node = node; } break; -case 74: { +case 92: { AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 75: -case 76: { +case 93: +case 94: { AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount())); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 77: { +case 95: { AST::StringLiteralPropertyName *node = makeAstNode<AST::StringLiteralPropertyName> (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 78: { +case 96: { AST::NumericLiteralPropertyName *node = makeAstNode<AST::NumericLiteralPropertyName> (driver->nodePool(), sym(1).dval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 79: { +case 97: { AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 80: +case 98: -case 81: +case 99: -case 82: +case 100: -case 83: +case 101: -case 84: +case 102: -case 85: +case 103: -case 86: +case 104: -case 87: +case 105: -case 88: +case 106: -case 89: +case 107: -case 90: +case 108: -case 91: +case 109: -case 92: +case 110: -case 93: +case 111: -case 94: +case 112: -case 95: +case 113: -case 96: +case 114: -case 97: +case 115: -case 98: +case 116: -case 99: +case 117: -case 100: +case 118: -case 101: +case 119: -case 102: +case 120: -case 103: +case 121: -case 104: +case 122: -case 105: +case 123: -case 106: +case 124: -case 107: +case 125: -case 108: +case 126: -case 109: +case 127: -case 110: +case 128: { sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount()); } break; -case 115: { +case 133: { AST::ArrayMemberExpression *node = makeAstNode<AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; -case 116: { +case 134: { AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 117: { +case 135: { AST::NewMemberExpression *node = makeAstNode<AST::NewMemberExpression> (driver->nodePool(), sym(2).Expression, sym(4).ArgumentList); node->newToken = loc(1); node->lparenToken = loc(3); @@ -708,384 +806,384 @@ case 117: { sym(1).Node = node; } break; -case 119: { +case 137: { AST::NewExpression *node = makeAstNode<AST::NewExpression> (driver->nodePool(), sym(2).Expression); node->newToken = loc(1); sym(1).Node = node; } break; -case 120: { +case 138: { AST::CallExpression *node = makeAstNode<AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; -case 121: { +case 139: { AST::CallExpression *node = makeAstNode<AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; -case 122: { +case 140: { AST::ArrayMemberExpression *node = makeAstNode<AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; -case 123: { +case 141: { AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 124: { +case 142: { sym(1).Node = 0; } break; -case 125: { +case 143: { sym(1).Node = sym(1).ArgumentList->finish(); } break; -case 126: { +case 144: { sym(1).Node = makeAstNode<AST::ArgumentList> (driver->nodePool(), sym(1).Expression); } break; -case 127: { +case 145: { AST::ArgumentList *node = makeAstNode<AST::ArgumentList> (driver->nodePool(), sym(1).ArgumentList, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 131: { +case 149: { AST::PostIncrementExpression *node = makeAstNode<AST::PostIncrementExpression> (driver->nodePool(), sym(1).Expression); node->incrementToken = loc(2); sym(1).Node = node; } break; -case 132: { +case 150: { AST::PostDecrementExpression *node = makeAstNode<AST::PostDecrementExpression> (driver->nodePool(), sym(1).Expression); node->decrementToken = loc(2); sym(1).Node = node; } break; -case 134: { +case 152: { AST::DeleteExpression *node = makeAstNode<AST::DeleteExpression> (driver->nodePool(), sym(2).Expression); node->deleteToken = loc(1); sym(1).Node = node; } break; -case 135: { +case 153: { AST::VoidExpression *node = makeAstNode<AST::VoidExpression> (driver->nodePool(), sym(2).Expression); node->voidToken = loc(1); sym(1).Node = node; } break; -case 136: { +case 154: { AST::TypeOfExpression *node = makeAstNode<AST::TypeOfExpression> (driver->nodePool(), sym(2).Expression); node->typeofToken = loc(1); sym(1).Node = node; } break; -case 137: { +case 155: { AST::PreIncrementExpression *node = makeAstNode<AST::PreIncrementExpression> (driver->nodePool(), sym(2).Expression); node->incrementToken = loc(1); sym(1).Node = node; } break; -case 138: { +case 156: { AST::PreDecrementExpression *node = makeAstNode<AST::PreDecrementExpression> (driver->nodePool(), sym(2).Expression); node->decrementToken = loc(1); sym(1).Node = node; } break; -case 139: { +case 157: { AST::UnaryPlusExpression *node = makeAstNode<AST::UnaryPlusExpression> (driver->nodePool(), sym(2).Expression); node->plusToken = loc(1); sym(1).Node = node; } break; -case 140: { +case 158: { AST::UnaryMinusExpression *node = makeAstNode<AST::UnaryMinusExpression> (driver->nodePool(), sym(2).Expression); node->minusToken = loc(1); sym(1).Node = node; } break; -case 141: { +case 159: { AST::TildeExpression *node = makeAstNode<AST::TildeExpression> (driver->nodePool(), sym(2).Expression); node->tildeToken = loc(1); sym(1).Node = node; } break; -case 142: { +case 160: { AST::NotExpression *node = makeAstNode<AST::NotExpression> (driver->nodePool(), sym(2).Expression); node->notToken = loc(1); sym(1).Node = node; } break; -case 144: { +case 162: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Mul, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 145: { +case 163: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Div, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 146: { +case 164: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Mod, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 148: { +case 166: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Add, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 149: { +case 167: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Sub, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 151: { +case 169: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::LShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 152: { +case 170: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::RShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 153: { +case 171: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::URShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 155: { +case 173: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 156: { +case 174: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 157: { +case 175: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 158: { +case 176: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 159: { +case 177: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 160: { +case 178: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::In, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 162: { +case 180: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 163: { +case 181: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 164: { +case 182: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 165: { +case 183: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 166: { +case 184: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 168: { +case 186: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 169: { +case 187: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 170: { +case 188: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 171: { +case 189: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 173: { +case 191: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 174: { +case 192: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 175: { +case 193: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 176: { +case 194: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 178: { +case 196: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitAnd, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 180: { +case 198: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitAnd, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 182: { +case 200: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitXor, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 184: { +case 202: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitXor, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 186: { +case 204: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitOr, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 188: { +case 206: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::BitOr, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 190: { +case 208: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::And, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 192: { +case 210: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::And, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 194: { +case 212: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Or, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 196: { +case 214: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Or, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 198: { +case 216: { AST::ConditionalExpression *node = makeAstNode<AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); @@ -1093,7 +1191,7 @@ case 198: { sym(1).Node = node; } break; -case 200: { +case 218: { AST::ConditionalExpression *node = makeAstNode<AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); @@ -1101,112 +1199,112 @@ case 200: { sym(1).Node = node; } break; -case 202: { +case 220: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 204: { +case 222: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 205: { +case 223: { sym(1).ival = QSOperator::Assign; } break; -case 206: { +case 224: { sym(1).ival = QSOperator::InplaceMul; } break; -case 207: { +case 225: { sym(1).ival = QSOperator::InplaceDiv; } break; -case 208: { +case 226: { sym(1).ival = QSOperator::InplaceMod; } break; -case 209: { +case 227: { sym(1).ival = QSOperator::InplaceAdd; } break; -case 210: { +case 228: { sym(1).ival = QSOperator::InplaceSub; } break; -case 211: { +case 229: { sym(1).ival = QSOperator::InplaceLeftShift; } break; -case 212: { +case 230: { sym(1).ival = QSOperator::InplaceRightShift; } break; -case 213: { +case 231: { sym(1).ival = QSOperator::InplaceURightShift; } break; -case 214: { +case 232: { sym(1).ival = QSOperator::InplaceAnd; } break; -case 215: { +case 233: { sym(1).ival = QSOperator::InplaceXor; } break; -case 216: { +case 234: { sym(1).ival = QSOperator::InplaceOr; } break; -case 218: { +case 236: { AST::Expression *node = makeAstNode<AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 219: { +case 237: { sym(1).Node = 0; } break; -case 222: { +case 240: { AST::Expression *node = makeAstNode<AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 223: { +case 241: { sym(1).Node = 0; } break; -case 240: { +case 258: { AST::Block *node = makeAstNode<AST::Block> (driver->nodePool(), sym(2).StatementList); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 241: { +case 259: { sym(1).Node = makeAstNode<AST::StatementList> (driver->nodePool(), sym(1).Statement); } break; -case 242: { +case 260: { sym(1).Node = makeAstNode<AST::StatementList> (driver->nodePool(), sym(1).StatementList, sym(2).Statement); } break; -case 243: { +case 261: { sym(1).Node = 0; } break; -case 244: { +case 262: { sym(1).Node = sym(1).StatementList->finish (); } break; -case 246: { +case 264: { AST::VariableStatement *node = makeAstNode<AST::VariableStatement> (driver->nodePool(), sym(2).VariableDeclarationList->finish (/*readOnly=*/sym(1).ival == T_CONST)); node->declarationKindToken = loc(1); @@ -1214,76 +1312,76 @@ case 246: { sym(1).Node = node; } break; -case 247: { +case 265: { sym(1).ival = T_CONST; } break; -case 248: { +case 266: { sym(1).ival = T_VAR; } break; -case 249: { +case 267: { sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration); } break; -case 250: { +case 268: { AST::VariableDeclarationList *node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); node->commaToken = loc(2); sym(1).Node = node; } break; -case 251: { +case 269: { sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration); } break; -case 252: { +case 270: { sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); } break; -case 253: { +case 271: { AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 254: { +case 272: { AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 255: { +case 273: { // ### TODO: AST for initializer sym(1) = sym(2); } break; -case 256: { +case 274: { sym(1).Node = 0; } break; -case 258: { +case 276: { // ### TODO: AST for initializer sym(1) = sym(2); } break; -case 259: { +case 277: { sym(1).Node = 0; } break; -case 261: { +case 279: { AST::EmptyStatement *node = makeAstNode<AST::EmptyStatement> (driver->nodePool()); node->semicolonToken = loc(1); sym(1).Node = node; } break; -case 263: { +case 281: { AST::ExpressionStatement *node = makeAstNode<AST::ExpressionStatement> (driver->nodePool(), sym(1).Expression); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 264: { +case 282: { AST::IfStatement *node = makeAstNode<AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement, sym(7).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); @@ -1292,7 +1390,7 @@ case 264: { sym(1).Node = node; } break; -case 265: { +case 283: { AST::IfStatement *node = makeAstNode<AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); @@ -1300,7 +1398,7 @@ case 265: { sym(1).Node = node; } break; -case 267: { +case 285: { AST::DoWhileStatement *node = makeAstNode<AST::DoWhileStatement> (driver->nodePool(), sym(2).Statement, sym(5).Expression); node->doToken = loc(1); node->whileToken = loc(3); @@ -1310,7 +1408,7 @@ case 267: { sym(1).Node = node; } break; -case 268: { +case 286: { AST::WhileStatement *node = makeAstNode<AST::WhileStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->whileToken = loc(1); node->lparenToken = loc(2); @@ -1318,7 +1416,7 @@ case 268: { sym(1).Node = node; } break; -case 269: { +case 287: { AST::ForStatement *node = makeAstNode<AST::ForStatement> (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Expression, sym(9).Statement); node->forToken = loc(1); @@ -1329,7 +1427,7 @@ case 269: { sym(1).Node = node; } break; -case 270: { +case 288: { AST::LocalForStatement *node = makeAstNode<AST::LocalForStatement> (driver->nodePool(), sym(4).VariableDeclarationList->finish (/*readOnly=*/false), sym(6).Expression, sym(8).Expression, sym(10).Statement); @@ -1342,7 +1440,7 @@ case 270: { sym(1).Node = node; } break; -case 271: { +case 289: { AST:: ForEachStatement *node = makeAstNode<AST::ForEachStatement> (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Statement); node->forToken = loc(1); @@ -1352,7 +1450,7 @@ case 271: { sym(1).Node = node; } break; -case 272: { +case 290: { AST::LocalForEachStatement *node = makeAstNode<AST::LocalForEachStatement> (driver->nodePool(), sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement); node->forToken = loc(1); @@ -1363,14 +1461,14 @@ case 272: { sym(1).Node = node; } break; -case 274: { +case 292: { AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool()); node->continueToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 276: { +case 294: { AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool(), sym(2).sval); node->continueToken = loc(1); node->identifierToken = loc(2); @@ -1378,14 +1476,14 @@ case 276: { sym(1).Node = node; } break; -case 278: { +case 296: { AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool()); node->breakToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 280: { +case 298: { AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool(), sym(2).sval); node->breakToken = loc(1); node->identifierToken = loc(2); @@ -1393,14 +1491,14 @@ case 280: { sym(1).Node = node; } break; -case 282: { +case 300: { AST::ReturnStatement *node = makeAstNode<AST::ReturnStatement> (driver->nodePool(), sym(2).Expression); node->returnToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; -case 283: { +case 301: { AST::WithStatement *node = makeAstNode<AST::WithStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->withToken = loc(1); node->lparenToken = loc(2); @@ -1408,7 +1506,7 @@ case 283: { sym(1).Node = node; } break; -case 284: { +case 302: { AST::SwitchStatement *node = makeAstNode<AST::SwitchStatement> (driver->nodePool(), sym(3).Expression, sym(5).CaseBlock); node->switchToken = loc(1); node->lparenToken = loc(2); @@ -1416,90 +1514,90 @@ case 284: { sym(1).Node = node; } break; -case 285: { +case 303: { AST::CaseBlock *node = makeAstNode<AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 286: { +case 304: { AST::CaseBlock *node = makeAstNode<AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(5); sym(1).Node = node; } break; -case 287: { +case 305: { sym(1).Node = makeAstNode<AST::CaseClauses> (driver->nodePool(), sym(1).CaseClause); } break; -case 288: { +case 306: { sym(1).Node = makeAstNode<AST::CaseClauses> (driver->nodePool(), sym(1).CaseClauses, sym(2).CaseClause); } break; -case 289: { +case 307: { sym(1).Node = 0; } break; -case 290: { +case 308: { sym(1).Node = sym(1).CaseClauses->finish (); } break; -case 291: { +case 309: { AST::CaseClause *node = makeAstNode<AST::CaseClause> (driver->nodePool(), sym(2).Expression, sym(4).StatementList); node->caseToken = loc(1); node->colonToken = loc(3); sym(1).Node = node; } break; -case 292: { +case 310: { AST::DefaultClause *node = makeAstNode<AST::DefaultClause> (driver->nodePool(), sym(3).StatementList); node->defaultToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 293: -case 294: { +case 311: +case 312: { AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()), sym(3).Statement); node->identifierToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 295: { +case 313: { AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), sym(1).sval, sym(3).Statement); node->identifierToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 297: { +case 315: { AST::ThrowStatement *node = makeAstNode<AST::ThrowStatement> (driver->nodePool(), sym(2).Expression); node->throwToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; -case 298: { +case 316: { AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch); node->tryToken = loc(1); sym(1).Node = node; } break; -case 299: { +case 317: { AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; -case 300: { +case 318: { AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch, sym(4).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; -case 301: { +case 319: { AST::Catch *node = makeAstNode<AST::Catch> (driver->nodePool(), sym(3).sval, sym(5).Block); node->catchToken = loc(1); node->lparenToken = loc(2); @@ -1508,20 +1606,20 @@ case 301: { sym(1).Node = node; } break; -case 302: { +case 320: { AST::Finally *node = makeAstNode<AST::Finally> (driver->nodePool(), sym(2).Block); node->finallyToken = loc(1); sym(1).Node = node; } break; -case 304: { +case 322: { AST::DebuggerStatement *node = makeAstNode<AST::DebuggerStatement> (driver->nodePool()); node->debuggerToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 305: { +case 323: { AST::FunctionDeclaration *node = makeAstNode<AST::FunctionDeclaration> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); node->identifierToken = loc(2); @@ -1532,7 +1630,7 @@ case 305: { sym(1).Node = node; } break; -case 306: { +case 324: { AST::FunctionExpression *node = makeAstNode<AST::FunctionExpression> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); if (sym(2).sval) @@ -1544,56 +1642,56 @@ case 306: { sym(1).Node = node; } break; -case 307: { +case 325: { AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).sval); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 308: { +case 326: { AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).FormalParameterList, sym(3).sval); node->commaToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 309: { +case 327: { sym(1).Node = 0; } break; -case 310: { +case 328: { sym(1).Node = sym(1).FormalParameterList->finish (); } break; -case 311: { +case 329: { sym(1).Node = 0; } break; -case 313: { +case 331: { sym(1).Node = makeAstNode<AST::FunctionBody> (driver->nodePool(), sym(1).SourceElements->finish ()); } break; -case 314: { +case 332: { sym(1).Node = makeAstNode<AST::SourceElements> (driver->nodePool(), sym(1).SourceElement); } break; -case 315: { +case 333: { sym(1).Node = makeAstNode<AST::SourceElements> (driver->nodePool(), sym(1).SourceElements, sym(2).SourceElement); } break; -case 316: { +case 334: { sym(1).Node = makeAstNode<AST::StatementSourceElement> (driver->nodePool(), sym(1).Statement); } break; -case 317: { +case 335: { sym(1).Node = makeAstNode<AST::FunctionSourceElement> (driver->nodePool(), sym(1).FunctionDeclaration); } break; -case 318: { +case 336: { sym(1).sval = 0; } break; -case 320: { +case 338: { sym(1).Node = 0; } break; @@ -1687,7 +1785,8 @@ case 320: { } for (int tk = 1; tk < TERMINAL_COUNT; ++tk) { - if (tk == T_AUTOMATIC_SEMICOLON) + if (tk == T_AUTOMATIC_SEMICOLON || tk == T_FEED_UI_PROGRAM || + tk == T_FEED_JS_STATEMENT || tk == T_FEED_JS_EXPRESSION) continue; int a = t_action(errorState, tk); diff --git a/src/plugins/duieditor/parser/qmljsparser_p.h b/src/plugins/duieditor/parser/qmljsparser_p.h index 35c0cd9e4e..9273039952 100644 --- a/src/plugins/duieditor/parser/qmljsparser_p.h +++ b/src/plugins/duieditor/parser/qmljsparser_p.h @@ -3,7 +3,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the QtScript module of the Qt Toolkit. ** @@ -36,7 +36,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -109,6 +109,7 @@ public: AST::UiProgram *UiProgram; AST::UiImportList *UiImportList; AST::UiImport *UiImport; + AST::UiParameterList *UiParameterList; AST::UiPublicMember *UiPublicMember; AST::UiObjectDefinition *UiObjectDefinition; AST::UiObjectInitializer *UiObjectInitializer; @@ -125,10 +126,29 @@ public: Parser(Engine *engine); ~Parser(); - bool parse(); + // parse a UI program + bool parse() { return parse(T_FEED_UI_PROGRAM); } + bool parseStatement() { return parse(T_FEED_JS_STATEMENT); } + bool parseExpression() { return parse(T_FEED_JS_EXPRESSION); } - AST::UiProgram *ast() - { return program; } + AST::UiProgram *ast() const + { return AST::cast<AST::UiProgram *>(program); } + + AST::Statement *statement() const + { + if (! program) + return 0; + + return program->statementCast(); + } + + AST::ExpressionNode *expression() const + { + if (! program) + return 0; + + return program->expressionCast(); + } QList<DiagnosticMessage> diagnosticMessages() const { return diagnostic_messages; } @@ -153,6 +173,8 @@ public: { return diagnosticMessage().loc.startColumn; } protected: + bool parse(int startToken); + void reallocateStack(); inline Value &sym(int index) @@ -171,7 +193,7 @@ protected: int *state_stack; AST::SourceLocation *location_stack; - AST::UiProgram *program; + AST::Node *program; // error recovery enum { TOKEN_BUFFER_SIZE = 3 }; @@ -197,9 +219,9 @@ protected: -#define J_SCRIPT_REGEXPLITERAL_RULE1 54 +#define J_SCRIPT_REGEXPLITERAL_RULE1 72 -#define J_SCRIPT_REGEXPLITERAL_RULE2 55 +#define J_SCRIPT_REGEXPLITERAL_RULE2 73 QT_END_NAMESPACE diff --git a/src/plugins/duieditor/parser/qmljsprettypretty.cpp b/src/plugins/duieditor/parser/qmljsprettypretty.cpp index 3a89206ffa..b6733e556f 100644 --- a/src/plugins/duieditor/parser/qmljsprettypretty.cpp +++ b/src/plugins/duieditor/parser/qmljsprettypretty.cpp @@ -1,9 +1,9 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -170,14 +170,14 @@ void PrettyPretty::accept(AST::Node *node) bool PrettyPretty::visit(AST::ThisExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); out << "this"; return true; } void PrettyPretty::endVisit(AST::ThisExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::IdentifierExpression *node) @@ -188,43 +188,43 @@ bool PrettyPretty::visit(AST::IdentifierExpression *node) void PrettyPretty::endVisit(AST::IdentifierExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::NullExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); out << "null"; return false; } void PrettyPretty::endVisit(AST::NullExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::TrueLiteral *node) { - Q_UNUSED(node) + Q_UNUSED(node); out << "true"; return false; } void PrettyPretty::endVisit(AST::TrueLiteral *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::FalseLiteral *node) { - Q_UNUSED(node) + Q_UNUSED(node); out << "false"; return false; } void PrettyPretty::endVisit(AST::FalseLiteral *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::StringLiteral *node) @@ -237,7 +237,7 @@ bool PrettyPretty::visit(AST::StringLiteral *node) void PrettyPretty::endVisit(AST::StringLiteral *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::NumericLiteral *node) @@ -248,7 +248,7 @@ bool PrettyPretty::visit(AST::NumericLiteral *node) void PrettyPretty::endVisit(AST::NumericLiteral *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::RegExpLiteral *node) @@ -262,7 +262,7 @@ bool PrettyPretty::visit(AST::RegExpLiteral *node) void PrettyPretty::endVisit(AST::RegExpLiteral *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::ArrayLiteral *node) @@ -276,7 +276,7 @@ bool PrettyPretty::visit(AST::ArrayLiteral *node) void PrettyPretty::endVisit(AST::ArrayLiteral *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::ObjectLiteral *node) @@ -300,7 +300,7 @@ bool PrettyPretty::visit(AST::ObjectLiteral *node) void PrettyPretty::endVisit(AST::ObjectLiteral *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::ElementList *node) @@ -317,7 +317,7 @@ bool PrettyPretty::visit(AST::ElementList *node) void PrettyPretty::endVisit(AST::ElementList *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::Elision *node) @@ -330,7 +330,7 @@ bool PrettyPretty::visit(AST::Elision *node) void PrettyPretty::endVisit(AST::Elision *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::PropertyNameAndValueList *node) @@ -343,7 +343,7 @@ bool PrettyPretty::visit(AST::PropertyNameAndValueList *node) void PrettyPretty::endVisit(AST::PropertyNameAndValueList *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::IdentifierPropertyName *node) @@ -354,7 +354,7 @@ bool PrettyPretty::visit(AST::IdentifierPropertyName *node) void PrettyPretty::endVisit(AST::IdentifierPropertyName *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::StringLiteralPropertyName *node) @@ -367,7 +367,7 @@ bool PrettyPretty::visit(AST::StringLiteralPropertyName *node) void PrettyPretty::endVisit(AST::StringLiteralPropertyName *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::NumericLiteralPropertyName *node) @@ -378,7 +378,7 @@ bool PrettyPretty::visit(AST::NumericLiteralPropertyName *node) void PrettyPretty::endVisit(AST::NumericLiteralPropertyName *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::ArrayMemberExpression *node) @@ -392,7 +392,7 @@ bool PrettyPretty::visit(AST::ArrayMemberExpression *node) void PrettyPretty::endVisit(AST::ArrayMemberExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::FieldMemberExpression *node) @@ -404,7 +404,7 @@ bool PrettyPretty::visit(AST::FieldMemberExpression *node) void PrettyPretty::endVisit(AST::FieldMemberExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::NewMemberExpression *node) @@ -419,19 +419,19 @@ bool PrettyPretty::visit(AST::NewMemberExpression *node) void PrettyPretty::endVisit(AST::NewMemberExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::NewExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); out << "new "; return true; } void PrettyPretty::endVisit(AST::NewExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::CallExpression *node) @@ -445,7 +445,7 @@ bool PrettyPretty::visit(AST::CallExpression *node) void PrettyPretty::endVisit(AST::CallExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::ArgumentList *node) @@ -460,91 +460,91 @@ bool PrettyPretty::visit(AST::ArgumentList *node) void PrettyPretty::endVisit(AST::ArgumentList *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::PostIncrementExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); return true; } void PrettyPretty::endVisit(AST::PostIncrementExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); out << "++"; } bool PrettyPretty::visit(AST::PostDecrementExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); return true; } void PrettyPretty::endVisit(AST::PostDecrementExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); out << "--"; } bool PrettyPretty::visit(AST::DeleteExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); out << "delete "; return true; } void PrettyPretty::endVisit(AST::DeleteExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::VoidExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); out << "void "; return true; } void PrettyPretty::endVisit(AST::VoidExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::TypeOfExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); out << "typeof "; return true; } void PrettyPretty::endVisit(AST::TypeOfExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::PreIncrementExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); out << "++"; return true; } void PrettyPretty::endVisit(AST::PreIncrementExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::PreDecrementExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); out << "--"; return true; } void PrettyPretty::endVisit(AST::PreDecrementExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::UnaryPlusExpression *node) @@ -561,7 +561,7 @@ bool PrettyPretty::visit(AST::UnaryPlusExpression *node) void PrettyPretty::endVisit(AST::UnaryPlusExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::UnaryMinusExpression *node) @@ -578,7 +578,7 @@ bool PrettyPretty::visit(AST::UnaryMinusExpression *node) void PrettyPretty::endVisit(AST::UnaryMinusExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::TildeExpression *node) @@ -595,7 +595,7 @@ bool PrettyPretty::visit(AST::TildeExpression *node) void PrettyPretty::endVisit(AST::TildeExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::NotExpression *node) @@ -612,7 +612,7 @@ bool PrettyPretty::visit(AST::NotExpression *node) void PrettyPretty::endVisit(AST::NotExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::BinaryExpression *node) @@ -712,7 +712,7 @@ bool PrettyPretty::visit(AST::BinaryExpression *node) void PrettyPretty::endVisit(AST::BinaryExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::ConditionalExpression *node) @@ -727,7 +727,7 @@ bool PrettyPretty::visit(AST::ConditionalExpression *node) void PrettyPretty::endVisit(AST::ConditionalExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::Expression *node) @@ -740,18 +740,18 @@ bool PrettyPretty::visit(AST::Expression *node) void PrettyPretty::endVisit(AST::Expression *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::Block *node) { - Q_UNUSED(node) + Q_UNUSED(node); return true; } void PrettyPretty::endVisit(AST::Block *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::StatementList *node) @@ -766,7 +766,7 @@ bool PrettyPretty::visit(AST::StatementList *node) void PrettyPretty::endVisit(AST::StatementList *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::VariableDeclarationList *node) @@ -785,19 +785,19 @@ bool PrettyPretty::visit(AST::VariableDeclarationList *node) void PrettyPretty::endVisit(AST::VariableDeclarationList *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::VariableStatement *node) { out << "var "; - Q_UNUSED(node) + Q_UNUSED(node); return true; } void PrettyPretty::endVisit(AST::VariableStatement *node) { - Q_UNUSED(node) + Q_UNUSED(node); out << ";"; } @@ -813,19 +813,19 @@ bool PrettyPretty::visit(AST::VariableDeclaration *node) void PrettyPretty::endVisit(AST::VariableDeclaration *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::EmptyStatement *node) { - Q_UNUSED(node) + Q_UNUSED(node); out << ";"; return true; } void PrettyPretty::endVisit(AST::EmptyStatement *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::ExpressionStatement *node) @@ -837,7 +837,7 @@ bool PrettyPretty::visit(AST::ExpressionStatement *node) void PrettyPretty::endVisit(AST::ExpressionStatement *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::IfStatement *node) @@ -855,7 +855,7 @@ bool PrettyPretty::visit(AST::IfStatement *node) void PrettyPretty::endVisit(AST::IfStatement *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::DoWhileStatement *node) @@ -870,7 +870,7 @@ bool PrettyPretty::visit(AST::DoWhileStatement *node) void PrettyPretty::endVisit(AST::DoWhileStatement *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::WhileStatement *node) @@ -884,7 +884,7 @@ bool PrettyPretty::visit(AST::WhileStatement *node) void PrettyPretty::endVisit(AST::WhileStatement *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::ForStatement *node) @@ -902,7 +902,7 @@ bool PrettyPretty::visit(AST::ForStatement *node) void PrettyPretty::endVisit(AST::ForStatement *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::LocalForStatement *node) @@ -920,7 +920,7 @@ bool PrettyPretty::visit(AST::LocalForStatement *node) void PrettyPretty::endVisit(AST::LocalForStatement *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::ForEachStatement *node) @@ -936,7 +936,7 @@ bool PrettyPretty::visit(AST::ForEachStatement *node) void PrettyPretty::endVisit(AST::ForEachStatement *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::LocalForEachStatement *node) @@ -952,7 +952,7 @@ bool PrettyPretty::visit(AST::LocalForEachStatement *node) void PrettyPretty::endVisit(AST::LocalForEachStatement *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::ContinueStatement *node) @@ -967,7 +967,7 @@ bool PrettyPretty::visit(AST::ContinueStatement *node) void PrettyPretty::endVisit(AST::ContinueStatement *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::BreakStatement *node) @@ -982,7 +982,7 @@ bool PrettyPretty::visit(AST::BreakStatement *node) void PrettyPretty::endVisit(AST::BreakStatement *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::ReturnStatement *node) @@ -998,7 +998,7 @@ bool PrettyPretty::visit(AST::ReturnStatement *node) void PrettyPretty::endVisit(AST::ReturnStatement *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::WithStatement *node) @@ -1012,7 +1012,7 @@ bool PrettyPretty::visit(AST::WithStatement *node) void PrettyPretty::endVisit(AST::WithStatement *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::SwitchStatement *node) @@ -1026,7 +1026,7 @@ bool PrettyPretty::visit(AST::SwitchStatement *node) void PrettyPretty::endVisit(AST::SwitchStatement *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::CaseBlock *node) @@ -1045,7 +1045,7 @@ bool PrettyPretty::visit(AST::CaseBlock *node) void PrettyPretty::endVisit(AST::CaseBlock *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::CaseClauses *node) @@ -1060,7 +1060,7 @@ bool PrettyPretty::visit(AST::CaseClauses *node) void PrettyPretty::endVisit(AST::CaseClauses *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::CaseClause *node) @@ -1077,12 +1077,12 @@ bool PrettyPretty::visit(AST::CaseClause *node) void PrettyPretty::endVisit(AST::CaseClause *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::DefaultClause *node) { - Q_UNUSED(node) + Q_UNUSED(node); out << "default:"; newlineAndIndent(); return true; @@ -1090,7 +1090,7 @@ bool PrettyPretty::visit(AST::DefaultClause *node) void PrettyPretty::endVisit(AST::DefaultClause *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::LabelledStatement *node) @@ -1101,12 +1101,12 @@ bool PrettyPretty::visit(AST::LabelledStatement *node) void PrettyPretty::endVisit(AST::LabelledStatement *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::ThrowStatement *node) { - Q_UNUSED(node) + Q_UNUSED(node); out << "throw "; accept(node->expression); out << ";"; @@ -1115,7 +1115,7 @@ bool PrettyPretty::visit(AST::ThrowStatement *node) void PrettyPretty::endVisit(AST::ThrowStatement *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::TryStatement *node) @@ -1135,30 +1135,30 @@ bool PrettyPretty::visit(AST::TryStatement *node) void PrettyPretty::endVisit(AST::TryStatement *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::Catch *node) { - Q_UNUSED(node) + Q_UNUSED(node); return true; } void PrettyPretty::endVisit(AST::Catch *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::Finally *node) { - Q_UNUSED(node) + Q_UNUSED(node); out << "finally "; return true; } void PrettyPretty::endVisit(AST::Finally *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::FunctionDeclaration *node) @@ -1197,7 +1197,7 @@ bool PrettyPretty::visit(AST::FunctionDeclaration *node) void PrettyPretty::endVisit(AST::FunctionDeclaration *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::FunctionExpression *node) @@ -1236,45 +1236,45 @@ bool PrettyPretty::visit(AST::FunctionExpression *node) void PrettyPretty::endVisit(AST::FunctionExpression *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::FormalParameterList *node) { - Q_UNUSED(node) + Q_UNUSED(node); return true; } void PrettyPretty::endVisit(AST::FormalParameterList *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::FunctionBody *node) { - Q_UNUSED(node) + Q_UNUSED(node); return true; } void PrettyPretty::endVisit(AST::FunctionBody *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::Program *node) { - Q_UNUSED(node) + Q_UNUSED(node); return true; } void PrettyPretty::endVisit(AST::Program *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::SourceElements *node) { - Q_UNUSED(node) + Q_UNUSED(node); accept(node->element); for (node = node->next; node != 0; node = node->next) { newlineAndIndent(); @@ -1285,47 +1285,47 @@ bool PrettyPretty::visit(AST::SourceElements *node) void PrettyPretty::endVisit(AST::SourceElements *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::FunctionSourceElement *node) { - Q_UNUSED(node) + Q_UNUSED(node); return true; } void PrettyPretty::endVisit(AST::FunctionSourceElement *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::StatementSourceElement *node) { - Q_UNUSED(node) + Q_UNUSED(node); return true; } void PrettyPretty::endVisit(AST::StatementSourceElement *node) { - Q_UNUSED(node) + Q_UNUSED(node); } bool PrettyPretty::visit(AST::DebuggerStatement *node) { - Q_UNUSED(node) + Q_UNUSED(node); out << "debugger"; return true; } void PrettyPretty::endVisit(AST::DebuggerStatement *node) { - Q_UNUSED(node) + Q_UNUSED(node); out << ";"; } bool PrettyPretty::preVisit(AST::Node *node) { - Q_UNUSED(node) + Q_UNUSED(node); return true; } diff --git a/src/plugins/duieditor/parser/qmljsprettypretty_p.h b/src/plugins/duieditor/parser/qmljsprettypretty_p.h index e0fe1f8491..3227e7d4e0 100644 --- a/src/plugins/duieditor/parser/qmljsprettypretty_p.h +++ b/src/plugins/duieditor/parser/qmljsprettypretty_p.h @@ -1,9 +1,9 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: Qt Software Information (qt-info@nokia.com) ** -** This file is part of the QtScript module of the Qt Toolkit. +** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://www.qtsoftware.com/contact. +** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/plugins/find/basetextfind.cpp b/src/plugins/find/basetextfind.cpp index da3c1de3d9..d4c245ad3f 100644 --- a/src/plugins/find/basetextfind.cpp +++ b/src/plugins/find/basetextfind.cpp @@ -216,7 +216,8 @@ int BaseTextFind::replaceAll(const QString &before, const QString &after, regexp.setPatternSyntax(usesRegExp ? QRegExp::RegExp : QRegExp::FixedString); regexp.setCaseSensitivity((findFlags & IFindSupport::FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive); QTextCursor found = document()->find(regexp, editCursor, IFindSupport::textDocumentFlagsForFindFlags(findFlags)); - while (!found.isNull() && inScope(found.selectionStart(), found.selectionEnd())) { + while (!found.isNull() && found.selectionStart() < found.selectionEnd() + && inScope(found.selectionStart(), found.selectionEnd())) { ++count; editCursor.setPosition(found.selectionStart()); editCursor.setPosition(found.selectionEnd(), QTextCursor::KeepAnchor); diff --git a/src/plugins/find/find_dependencies.pri b/src/plugins/find/find_dependencies.pri index a64caedc10..7f369f6326 100644 --- a/src/plugins/find/find_dependencies.pri +++ b/src/plugins/find/find_dependencies.pri @@ -1 +1,2 @@ include(../../plugins/coreplugin/coreplugin.pri) +include(../../libs/utils/utils.pri) diff --git a/src/plugins/find/findtoolbar.cpp b/src/plugins/find/findtoolbar.cpp index 8b7a4bb6af..4e19745403 100644 --- a/src/plugins/find/findtoolbar.cpp +++ b/src/plugins/find/findtoolbar.cpp @@ -34,12 +34,11 @@ #include <coreplugin/coreconstants.h> #include <coreplugin/findplaceholder.h> #include <coreplugin/icore.h> -#include <coreplugin/stylehelper.h> #include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actioncontainer.h> #include <coreplugin/actionmanager/command.h> - #include <extensionsystem/pluginmanager.h> +#include <utils/stylehelper.h> #include <QtCore/QDebug> #include <QtCore/QSettings> @@ -49,9 +48,10 @@ #include <QtGui/QKeyEvent> #include <QtGui/QLineEdit> #include <QtGui/QMenu> -#include <QtGui/QPainter> #include <QtGui/QPushButton> #include <QtGui/QToolButton> +#include <QtGui/QPainter> +#include <QtGui/QPixmapCache> Q_DECLARE_METATYPE(QStringList) Q_DECLARE_METATYPE(Find::IFindFilter*) @@ -68,14 +68,12 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen m_findNextAction(0), m_findPreviousAction(0), m_replaceNextAction(0), - m_widget(new QWidget), m_casesensitiveIcon(":/find/images/casesensitively.png"), m_regexpIcon(":/find/images/regexp.png"), m_wholewordsIcon(":/find/images/wholewords.png") { //setup ui - m_ui.setupUi(m_widget); - addWidget(m_widget); + m_ui.setupUi(this); setFocusProxy(m_ui.findEdit); setProperty("topBorder", true); m_ui.findEdit->setAttribute(Qt::WA_MacShowFocusRect, false); @@ -83,14 +81,9 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen connect(m_ui.findEdit, SIGNAL(editingFinished()), this, SLOT(invokeResetIncrementalSearch())); - QWidget *spacerItem = new QWidget; - spacerItem->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); - addWidget(spacerItem); - QToolButton *close = new QToolButton; - close->setProperty("type", QLatin1String("dockbutton")); - close->setIcon(QIcon(":/core/images/closebutton.png")); - connect(close, SIGNAL(clicked()), this, SLOT(hideAndResetFocus())); - addWidget(close); + m_ui.close->setProperty("type", QLatin1String("dockbutton")); + m_ui.close->setIcon(QIcon(":/core/images/closebutton.png")); + connect(m_ui.close, SIGNAL(clicked()), this, SLOT(hideAndResetFocus())); m_ui.findPreviousButton->setProperty("type", QLatin1String("dockbutton")); m_ui.findNextButton->setProperty("type", QLatin1String("dockbutton")); @@ -110,7 +103,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen m_ui.findEdit->installEventFilter(this); m_ui.replaceEdit->installEventFilter(this); - m_widget->installEventFilter(this); + this->installEventFilter(this); connect(m_ui.findEdit, SIGNAL(textChanged(const QString&)), this, SLOT(invokeFindIncremental())); connect(m_ui.findEdit, SIGNAL(returnPressed()), this, SLOT(invokeFindEnter())); @@ -251,7 +244,7 @@ bool FindToolBar::eventFilter(QObject *obj, QEvent *event) return true; } } - } else if (obj == m_widget && event->type() == QEvent::ShortcutOverride) { + } else if (obj == this && event->type() == QEvent::ShortcutOverride) { QKeyEvent *ke = static_cast<QKeyEvent *>(event); if (ke->key() == Qt::Key_Escape && !ke->modifiers() && !m_findCompleter->popup()->isVisible() @@ -268,13 +261,13 @@ bool FindToolBar::eventFilter(QObject *obj, QEvent *event) event->accept(); return true; } - } else if (obj == m_widget && event->type() == QEvent::Hide) { + } else if (obj == this && event->type() == QEvent::Hide) { invokeClearResults(); if (m_currentDocumentFind->isEnabled()) { m_currentDocumentFind->clearFindScope(); } } - return QToolBar::eventFilter(obj, event); + return Core::Utils::StyledBar::eventFilter(obj, event); } void FindToolBar::updateActions() @@ -284,9 +277,11 @@ void FindToolBar::updateActions() m_findInDocumentAction->setEnabled(enabled); m_findNextAction->setEnabled(enabled); m_findPreviousAction->setEnabled(enabled); + m_replaceNextAction->setEnabled(replaceEnabled); m_replacePreviousAction->setEnabled(replaceEnabled); m_replaceAllAction->setEnabled(replaceEnabled); + m_caseSensitiveAction->setEnabled(enabled); m_wholeWordAction->setEnabled(enabled); m_regularExpressionAction->setEnabled(enabled); @@ -295,8 +290,16 @@ void FindToolBar::updateActions() bool replaceFocus = m_ui.replaceEdit->hasFocus(); m_ui.findEdit->setEnabled(enabled); m_ui.findLabel->setEnabled(enabled); + m_ui.replaceEdit->setEnabled(replaceEnabled); m_ui.replaceLabel->setEnabled(replaceEnabled); + m_ui.replaceEdit->setVisible(replaceEnabled); + m_ui.replaceLabel->setVisible(replaceEnabled); + m_ui.replacePreviousButton->setVisible(replaceEnabled); + m_ui.replaceNextButton->setVisible(replaceEnabled); + m_ui.replaceAllButton->setVisible(replaceEnabled); + layout()->invalidate(); + if (!replaceEnabled && enabled && replaceFocus) m_ui.findEdit->setFocus(); updateIcons(); @@ -540,7 +543,7 @@ bool FindToolBar::focusNextPrevChild(bool next) else if (!next && m_ui.findEdit->hasFocus()) m_ui.replaceAllButton->setFocus(Qt::TabFocusReason); else - return QToolBar::focusNextPrevChild(next); + return Core::Utils::StyledBar::focusNextPrevChild(next); return true; } diff --git a/src/plugins/find/findtoolbar.h b/src/plugins/find/findtoolbar.h index 4b85c1a9e8..f1cab5e314 100644 --- a/src/plugins/find/findtoolbar.h +++ b/src/plugins/find/findtoolbar.h @@ -34,6 +34,8 @@ #include "ifindfilter.h" #include "currentdocumentfind.h" +#include <utils/styledbar.h> + #include <QtGui/QStringListModel> #include <QtGui/QWidget> #include <QtGui/QToolBar> @@ -44,7 +46,7 @@ namespace Internal { class FindPlugin; -class FindToolBar : public QToolBar +class FindToolBar : public Core::Utils::StyledBar { Q_OBJECT @@ -113,7 +115,6 @@ private: QAction *m_caseSensitiveAction; QAction *m_wholeWordAction; QAction *m_regularExpressionAction; - QWidget *m_widget; IFindSupport::FindFlags m_findFlags; QPixmap m_casesensitiveIcon; diff --git a/src/plugins/find/findwidget.ui b/src/plugins/find/findwidget.ui index b11792768d..8fb5973c13 100644 --- a/src/plugins/find/findwidget.ui +++ b/src/plugins/find/findwidget.ui @@ -6,58 +6,48 @@ <rect> <x>0</x> <y>0</y> - <width>600</width> - <height>71</height> + <width>603</width> + <height>90</height> </rect> </property> <property name="windowTitle"> <string>Find</string> </property> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <property name="spacing"> - <number>15</number> - </property> + <layout class="QGridLayout" name="gridLayout"> <property name="leftMargin"> <number>5</number> </property> <property name="topMargin"> - <number>1</number> + <number>2</number> </property> <property name="rightMargin"> - <number>5</number> + <number>0</number> </property> <property name="bottomMargin"> <number>1</number> </property> - <item> + <property name="horizontalSpacing"> + <number>5</number> + </property> + <property name="verticalSpacing"> + <number>0</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="findLabel"> + <property name="text"> + <string>Find:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="Core::Utils::FancyLineEdit" name="findEdit"/> + </item> + <item row="0" column="2"> <layout class="QHBoxLayout" name="horizontalLayout_2"> <property name="spacing"> - <number>2</number> + <number>3</number> </property> <item> - <widget class="QLabel" name="findLabel"> - <property name="text"> - <string>Find:</string> - </property> - </widget> - </item> - <item> - <widget class="Core::Utils::FancyLineEdit" name="findEdit"> - <property name="minimumSize"> - <size> - <width>160</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>160</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - <item> <widget class="QToolButton" name="findPreviousButton"> <property name="focusPolicy"> <enum>Qt::NoFocus</enum> @@ -80,36 +70,43 @@ </property> </widget> </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="spacing"> - <number>2</number> - </property> <item> - <widget class="QLabel" name="replaceLabel"> - <property name="text"> - <string>Replace with:</string> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="replaceEdit"> - <property name="minimumSize"> + <property name="sizeHint" stdset="0"> <size> - <width>150</width> - <height>0</height> + <width>40</width> + <height>20</height> </size> </property> - <property name="maximumSize"> - <size> - <width>150</width> - <height>16777215</height> - </size> + </spacer> + </item> + <item> + <widget class="QToolButton" name="close"> + <property name="text"> + <string>...</string> </property> </widget> </item> + </layout> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="replaceLabel"> + <property name="text"> + <string>Replace with:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="replaceEdit"/> + </item> + <item row="1" column="2"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>3</number> + </property> <item> <widget class="QToolButton" name="replacePreviousButton"> <property name="focusPolicy"> @@ -146,6 +143,19 @@ </property> </widget> </item> + <item> + <spacer name="replaceSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>0</height> + </size> + </property> + </spacer> + </item> </layout> </item> </layout> @@ -157,6 +167,12 @@ <header location="global">utils/fancylineedit.h</header> </customwidget> </customwidgets> + <tabstops> + <tabstop>findEdit</tabstop> + <tabstop>replaceEdit</tabstop> + <tabstop>close</tabstop> + <tabstop>replaceAllButton</tabstop> + </tabstops> <resources/> <connections/> </ui> diff --git a/src/plugins/find/searchresulttreemodel.cpp b/src/plugins/find/searchresulttreemodel.cpp index a53b8fe595..ddb934c1a1 100644 --- a/src/plugins/find/searchresulttreemodel.cpp +++ b/src/plugins/find/searchresulttreemodel.cpp @@ -33,6 +33,7 @@ #include <QtGui/QFont> #include <QtGui/QColor> +#include <QtCore/QDir> using namespace Find::Internal; @@ -187,7 +188,7 @@ QVariant SearchResultTreeModel::data(const SearchResultFile *file, int role) con result = QColor(qRgb(245, 245, 245)); break; case Qt::DisplayRole: - result = QString(file->fileName() + result = QString(QDir::toNativeSeparators(file->fileName()) + " (" + QString::number(file->childrenCount()) + ")"); break; case ItemDataRoles::FileNameRole: diff --git a/src/plugins/find/searchresultwindow.cpp b/src/plugins/find/searchresultwindow.cpp index d4ae8d926d..7b160a3679 100644 --- a/src/plugins/find/searchresultwindow.cpp +++ b/src/plugins/find/searchresultwindow.cpp @@ -153,6 +153,7 @@ void SearchResultWindow::handleJumpToSearchResult(int index, const QString &file ResultWindowItem *SearchResultWindow::addResult(const QString &fileName, int lineNumber, const QString &rowText, int searchTermStart, int searchTermLength) { + qDebug()<<"###"<<fileName; m_widget->setCurrentWidget(m_searchResultTreeView); int index = m_items.size(); ResultWindowItem *item = new ResultWindowItem; diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 74841b74b1..0486522fd1 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -493,7 +493,7 @@ GitCommand *GitClient::createCommand(const QString &workingDirectory, } } else { QTC_ASSERT(editor, /**/); - connect(command, SIGNAL(outputData(QByteArray)), editor, SLOT(setPlainTextData(QByteArray))); + connect(command, SIGNAL(outputData(QByteArray)), editor, SLOT(setPlainTextDataFiltered(QByteArray))); } if (outputWindow) diff --git a/src/plugins/git/giteditor.cpp b/src/plugins/git/giteditor.cpp index bb3c412993..62fa5688c6 100644 --- a/src/plugins/git/giteditor.cpp +++ b/src/plugins/git/giteditor.cpp @@ -33,6 +33,7 @@ #include "gitclient.h" #include "gitconstants.h" #include "gitplugin.h" +#include <QtCore/QTextCodec> #include <coreplugin/editormanager/editormanager.h> #include <utils/qtcassert.h> @@ -141,5 +142,47 @@ QString GitEditor::fileNameFromDiffSpecification(const QTextBlock &inBlock) cons return QString(); } +/* Remove the date specification from annotation, which is tabular: +\code +8ca887aa (author YYYY-MM-DD HH:MM:SS <offset> <line>)<content> +\endcode */ + +static void removeAnnotationDate(QString *s) +{ + if (s->isEmpty()) + return; + // Get position of date (including blank) and the ')' + const QRegExp isoDatePattern(QLatin1String(" \\d{4}-\\d{2}-\\d{2}")); + Q_ASSERT(isoDatePattern.isValid()); + const int datePos = s->indexOf(isoDatePattern); + const int parenPos = datePos == -1 ? -1 : s->indexOf(QLatin1Char(')')); + if (parenPos == -1) + return; + // In all lines, remove the bit from datePos .. parenPos; + const int dateLength = parenPos - datePos; + const QChar newLine = QLatin1Char('\n'); + for (int pos = 0; pos < s->size(); ) { + if (pos + parenPos >s->size()) // Should not happen + break; + s->remove(pos + datePos, dateLength); + const int nextLinePos = s->indexOf(newLine, pos + datePos); + pos = nextLinePos == -1 ? s->size() : nextLinePos + 1; + } +} + +void GitEditor::setPlainTextDataFiltered(const QByteArray &a) +{ + // If desired, filter out the date from annotation + const bool omitAnnotationDate = contentType() == VCSBase::AnnotateOutput + && GitPlugin::instance()->settings().omitAnnotationDate; + if (omitAnnotationDate) { + QString text = codec()->toUnicode(a); + removeAnnotationDate(&text); + setPlainText(text); + } else { + setPlainTextData(a); + } +} + } // namespace Internal } // namespace Git diff --git a/src/plugins/git/giteditor.h b/src/plugins/git/giteditor.h index f87c1ccd48..88e349dd20 100644 --- a/src/plugins/git/giteditor.h +++ b/src/plugins/git/giteditor.h @@ -47,6 +47,9 @@ public: explicit GitEditor(const VCSBase::VCSBaseEditorParameters *type, QWidget *parent); +public slots: + void setPlainTextDataFiltered(const QByteArray &a); + private: virtual QSet<QString> annotationChanges() const; virtual QString changeUnderCursor(const QTextCursor &) const; diff --git a/src/plugins/git/gitsettings.cpp b/src/plugins/git/gitsettings.cpp index f35bf5b7d3..2cda583418 100644 --- a/src/plugins/git/gitsettings.cpp +++ b/src/plugins/git/gitsettings.cpp @@ -42,6 +42,7 @@ static const char *pathKeyC = "Path"; static const char *logCountKeyC = "LogCount"; static const char *timeoutKeyC = "TimeOut"; static const char *promptToSubmitKeyC = "PromptForSubmit"; +static const char *omitAnnotationDateKeyC = "OmitAnnotationDate"; enum { defaultLogCount = 10 , defaultTimeOut = 30}; @@ -52,7 +53,8 @@ GitSettings::GitSettings() : adoptPath(false), logCount(defaultLogCount), timeout(defaultTimeOut), - promptToSubmit(true) + promptToSubmit(true), + omitAnnotationDate(false) { } @@ -64,6 +66,7 @@ void GitSettings::fromSettings(QSettings *settings) logCount = settings->value(QLatin1String(logCountKeyC), defaultLogCount).toInt(); timeout = settings->value(QLatin1String(timeoutKeyC), defaultTimeOut).toInt(); promptToSubmit = settings->value(QLatin1String(promptToSubmitKeyC), true).toBool(); + omitAnnotationDate = settings->value(QLatin1String(omitAnnotationDateKeyC), false).toBool(); settings->endGroup(); } @@ -75,13 +78,15 @@ void GitSettings::toSettings(QSettings *settings) const settings->setValue(QLatin1String(logCountKeyC), logCount); settings->setValue(QLatin1String(timeoutKeyC), timeout); settings->setValue(QLatin1String(promptToSubmitKeyC), promptToSubmit); + settings->setValue(QLatin1String(omitAnnotationDateKeyC), omitAnnotationDate); settings->endGroup(); } bool GitSettings::equals(const GitSettings &s) const { return adoptPath == s.adoptPath && path == s.path && logCount == s.logCount - && timeout == s.timeout && promptToSubmit == s.promptToSubmit; + && timeout == s.timeout && promptToSubmit == s.promptToSubmit + && omitAnnotationDate == s.omitAnnotationDate; } QString GitSettings::gitBinaryPath(bool *ok, QString *errorMessage) const diff --git a/src/plugins/git/gitsettings.h b/src/plugins/git/gitsettings.h index 666e1483e3..f65a4906b1 100644 --- a/src/plugins/git/gitsettings.h +++ b/src/plugins/git/gitsettings.h @@ -56,6 +56,7 @@ struct GitSettings int logCount; int timeout; bool promptToSubmit; + bool omitAnnotationDate; }; inline bool operator==(const GitSettings &p1, const GitSettings &p2) diff --git a/src/plugins/git/settingspage.cpp b/src/plugins/git/settingspage.cpp index 2167bafa7f..9a55e7330c 100644 --- a/src/plugins/git/settingspage.cpp +++ b/src/plugins/git/settingspage.cpp @@ -54,7 +54,8 @@ GitSettings SettingsPageWidget::settings() const rc.adoptPath = m_ui.environmentGroupBox->isChecked() && !rc.path.isEmpty(); rc.logCount = m_ui.logCountSpinBox->value(); rc.timeout = m_ui.timeoutSpinBox->value(); - rc.promptToSubmit = m_ui.promptToSubmitCheckBox->isChecked(); + rc.promptToSubmit = m_ui.promptToSubmitCheckBox->isChecked(); + rc.omitAnnotationDate = m_ui.omitAnnotationDataCheckBox->isChecked(); return rc; } @@ -65,6 +66,7 @@ void SettingsPageWidget::setSettings(const GitSettings &s) m_ui.logCountSpinBox->setValue(s.logCount); m_ui.timeoutSpinBox->setValue(s.timeout); m_ui.promptToSubmitCheckBox->setChecked(s.promptToSubmit); + m_ui.omitAnnotationDataCheckBox->setChecked(s.omitAnnotationDate); } void SettingsPageWidget::setSystemPath() diff --git a/src/plugins/git/settingspage.ui b/src/plugins/git/settingspage.ui index 13884c70d1..b5fdc24a58 100644 --- a/src/plugins/git/settingspage.ui +++ b/src/plugins/git/settingspage.ui @@ -111,6 +111,13 @@ </property> </widget> </item> + <item row="3" column="0" colspan="2"> + <widget class="QCheckBox" name="omitAnnotationDataCheckBox"> + <property name="text"> + <string>Omit date from annotation output</string> + </property> + </widget> + </item> </layout> </item> <item> diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index f50e27c328..4ee1549085 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -14,6 +14,7 @@ SUBDIRS = plugin_coreplugin \ plugin_perforce \ plugin_subversion \ plugin_git \ + plugin_cvs \ plugin_cpptools \ plugin_qt4projectmanager \ # plugin_snippets \ # buggy and annoying @@ -73,6 +74,12 @@ plugin_git.depends = plugin_vcsbase plugin_git.depends += plugin_projectexplorer plugin_git.depends += plugin_coreplugin +plugin_cvs.subdir = cvs +plugin_cvs.depends = plugin_texteditor +plugin_cvs.depends = plugin_vcsbase +plugin_cvs.depends += plugin_projectexplorer +plugin_cvs.depends += plugin_coreplugin + plugin_subversion.subdir = subversion plugin_subversion.depends = plugin_vcsbase plugin_subversion.depends += plugin_projectexplorer diff --git a/src/plugins/projectexplorer/applicationrunconfiguration.h b/src/plugins/projectexplorer/applicationrunconfiguration.h index 6d347c0ab6..0f4315844c 100644 --- a/src/plugins/projectexplorer/applicationrunconfiguration.h +++ b/src/plugins/projectexplorer/applicationrunconfiguration.h @@ -57,6 +57,7 @@ public: virtual QStringList commandLineArguments() const = 0; virtual Environment environment() const = 0; virtual QString dumperLibrary() const = 0; + virtual QStringList dumperLibraryLocations() const = 0; virtual ProjectExplorer::ToolChain::ToolChainType toolChainType() const = 0; virtual void save(PersistentSettingsWriter &writer) const; diff --git a/src/plugins/projectexplorer/buildprogress.cpp b/src/plugins/projectexplorer/buildprogress.cpp index a91c4afff6..582419431b 100644 --- a/src/plugins/projectexplorer/buildprogress.cpp +++ b/src/plugins/projectexplorer/buildprogress.cpp @@ -29,7 +29,7 @@ #include "buildprogress.h" -#include <coreplugin/stylehelper.h> +#include <utils/stylehelper.h> #include <QtGui/QVBoxLayout> #include <QtGui/QHBoxLayout> diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp index 97de117817..ad516a218a 100644 --- a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp +++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp @@ -459,6 +459,12 @@ QString CustomExecutableRunConfiguration::dumperLibrary() const return ProjectExplorer::DebuggingHelperLibrary::debuggingHelperLibrary(qmakePath); } +QStringList CustomExecutableRunConfiguration::dumperLibraryLocations() const +{ + QString qmakePath = ProjectExplorer::DebuggingHelperLibrary::findSystemQt(environment()); + return ProjectExplorer::DebuggingHelperLibrary::debuggingHelperLibraryLocations(qmakePath); +} + ProjectExplorer::ToolChain::ToolChainType CustomExecutableRunConfiguration::toolChainType() const { return ProjectExplorer::ToolChain::UNKNOWN; diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.h b/src/plugins/projectexplorer/customexecutablerunconfiguration.h index 894116fc08..81db5a1fa7 100644 --- a/src/plugins/projectexplorer/customexecutablerunconfiguration.h +++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.h @@ -89,6 +89,7 @@ public: virtual QWidget *configurationWidget(); virtual QString dumperLibrary() const; + virtual QStringList dumperLibraryLocations() const; virtual ProjectExplorer::ToolChain::ToolChainType toolChainType() const; diff --git a/src/plugins/projectexplorer/debugginghelper.cpp b/src/plugins/projectexplorer/debugginghelper.cpp index fbbab7f5f3..8af5ba3045 100644 --- a/src/plugins/projectexplorer/debugginghelper.cpp +++ b/src/plugins/projectexplorer/debugginghelper.cpp @@ -66,11 +66,16 @@ QStringList DebuggingHelperLibrary::debuggingHelperLibraryDirectories(const QStr QStringList directories; directories << (qtInstallData + "/qtc-debugging-helper/") - << (QApplication::applicationDirPath() + "/../qtc-debugging-helper/" + QString::number(hash)) + "/" + << QDir::cleanPath((QApplication::applicationDirPath() + "/../qtc-debugging-helper/" + QString::number(hash))) + "/" << (QDesktopServices::storageLocation(QDesktopServices::DataLocation) + "/qtc-debugging-helper/" + QString::number(hash)) + "/"; return directories; } +QStringList DebuggingHelperLibrary::debuggingHelperLibraryLocations(const QString &qmakePath) +{ + return debuggingHelperLibraryLocations(qtInstallDataDir(qmakePath), qtDir(qmakePath)); +} + QString DebuggingHelperLibrary::debuggingHelperLibrary(const QString &qmakePath) { return debuggingHelperLibrary(qtInstallDataDir(qmakePath), qtDir(qmakePath)); @@ -94,6 +99,22 @@ QString DebuggingHelperLibrary::qtDir(const QString &qmakePath) // Debugging Helper Library +QStringList DebuggingHelperLibrary::debuggingHelperLibraryLocations(const QString &qtInstallData, const QString &qtpath) +{ + QStringList result; + foreach(const QString &directory, debuggingHelperLibraryDirectories(qtInstallData, qtpath)) { +#if defined(Q_OS_WIN) + QFileInfo fi(directory + "debug/gdbmacros.dll"); +#elif defined(Q_OS_MAC) + QFileInfo fi(directory + "libgdbmacros.dylib"); +#else // generic UNIX + QFileInfo fi(directory + "libgdbmacros.so"); +#endif + result << fi.filePath(); + } + return result; +} + QString DebuggingHelperLibrary::debuggingHelperLibrary(const QString &qtInstallData, const QString &qtpath) { foreach(const QString &directory, debuggingHelperLibraryDirectories(qtInstallData, qtpath)) { diff --git a/src/plugins/projectexplorer/debugginghelper.h b/src/plugins/projectexplorer/debugginghelper.h index 3717e32b85..a98ab2a616 100644 --- a/src/plugins/projectexplorer/debugginghelper.h +++ b/src/plugins/projectexplorer/debugginghelper.h @@ -49,11 +49,18 @@ public: static QString qtVersionForQMake(const QString &qmakePath); static bool hasDebuggingHelperLibrary(const QString &qmakePath); + static QString debuggingHelperLibrary(const QString &qmakePath); - static QString buildDebuggingHelperLibrary(const QString &qmakePath, const QString &make, const Environment &env); static QString debuggingHelperLibrary(const QString &qtInstallData, const QString &qtpath); - static QString copyDebuggingHelperLibrary(const QString &qtInstallData, const QString &qtdir); + + static QString buildDebuggingHelperLibrary(const QString &qmakePath, const QString &make, const Environment &env); static QString buildDebuggingHelperLibrary(const QString &directory, const QString &makeCommand, const QString &qmakeCommand, const QString &mkspec, const Environment &env); + + static QStringList debuggingHelperLibraryLocations(const QString &qmakePath); + static QStringList debuggingHelperLibraryLocations(const QString &qtInstallData, const QString &qtpath); + + static QString copyDebuggingHelperLibrary(const QString &qtInstallData, const QString &qtdir); + private: static QStringList debuggingHelperLibraryDirectories(const QString &qtInstallData, const QString &qtpath); static QString qtInstallDataDir(const QString &qmakePath); diff --git a/src/plugins/projectexplorer/projectexplorer.pri b/src/plugins/projectexplorer/projectexplorer.pri index 45d1e96374..fa0891a5fa 100644 --- a/src/plugins/projectexplorer/projectexplorer.pri +++ b/src/plugins/projectexplorer/projectexplorer.pri @@ -1,3 +1,2 @@ include(projectexplorer_dependencies.pri) - LIBS *= -l$$qtLibraryTarget(ProjectExplorer) diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp index 0c9670ca6b..b9a7d2e5d2 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.cpp +++ b/src/plugins/qmlprojectmanager/qmlproject.cpp @@ -381,6 +381,11 @@ QString QmlRunConfiguration::dumperLibrary() const return QString(); } +QStringList QmlRunConfiguration::dumperLibraryLocations() const +{ + return QStringList(); +} + QWidget *QmlRunConfiguration::configurationWidget() { QWidget *config = new QWidget; diff --git a/src/plugins/qmlprojectmanager/qmlproject.h b/src/plugins/qmlprojectmanager/qmlproject.h index b540f85c0f..662abdeb88 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.h +++ b/src/plugins/qmlprojectmanager/qmlproject.h @@ -150,6 +150,7 @@ public: virtual QStringList commandLineArguments() const; virtual ProjectExplorer::Environment environment() const; virtual QString dumperLibrary() const; + virtual QStringList dumperLibraryLocations() const; virtual QWidget *configurationWidget(); ProjectExplorer::ToolChain::ToolChainType toolChainType() const { return ProjectExplorer::ToolChain::OTHER; } diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp index 8d07707e7f..953f90a9ab 100644 --- a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp @@ -637,6 +637,13 @@ QString Qt4RunConfiguration::dumperLibrary() const return version->debuggingHelperLibrary(); } +QStringList Qt4RunConfiguration::dumperLibraryLocations() const +{ + Qt4Project *pro = qobject_cast<Qt4Project *>(project()); + QtVersion *version = pro->qtVersion(pro->activeBuildConfiguration()); + return version->debuggingHelperLibraryLocations();; +} + void Qt4RunConfiguration::setBaseEnvironmentBase(BaseEnvironmentBase env) { if (m_baseEnvironmentBase == env) diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.h b/src/plugins/qt4projectmanager/qt4runconfiguration.h index db7b015d42..e2fb384511 100644 --- a/src/plugins/qt4projectmanager/qt4runconfiguration.h +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.h @@ -74,6 +74,7 @@ public: virtual QStringList commandLineArguments() const; virtual ProjectExplorer::Environment environment() const; virtual QString dumperLibrary() const; + virtual QStringList dumperLibraryLocations() const; virtual ProjectExplorer::ToolChain::ToolChainType toolChainType() const; bool isUsingDyldImageSuffix() const; diff --git a/src/plugins/qt4projectmanager/qtversionmanager.cpp b/src/plugins/qt4projectmanager/qtversionmanager.cpp index 6e49ff08dd..0005049ad4 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.cpp +++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp @@ -1102,6 +1102,14 @@ QString QtVersion::debuggingHelperLibrary() const return DebuggingHelperLibrary::debuggingHelperLibrary(qtInstallData, path()); } +QStringList QtVersion::debuggingHelperLibraryLocations() const +{ + QString qtInstallData = versionInfo().value("QT_INSTALL_DATA"); + if (qtInstallData.isEmpty()) + qtInstallData = path(); + return DebuggingHelperLibrary::debuggingHelperLibraryLocations(qtInstallData, path()); +} + bool QtVersion::hasDocumentation() const { updateVersionInfo(); diff --git a/src/plugins/qt4projectmanager/qtversionmanager.h b/src/plugins/qt4projectmanager/qtversionmanager.h index 6debdcc9d2..f76dd602ea 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.h +++ b/src/plugins/qt4projectmanager/qtversionmanager.h @@ -96,6 +96,7 @@ public: bool hasDebuggingHelper() const; QString debuggingHelperLibrary() const; + QStringList debuggingHelperLibraryLocations() const; // Builds a debugging library // returns the output of the commands diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index dad3c37bab..21c3e5b9a3 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -754,7 +754,7 @@ void SubversionPlugin::updateProject() QStringList args(QLatin1String("update")); args.push_back(QLatin1String(nonInteractiveOptionC)); args.append(topLevels); - runSvn(args, subversionLongTimeOut, false); + runSvn(args, subversionLongTimeOut, true); } void SubversionPlugin::annotateCurrentFile() diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp index f94f6b789c..c43918dfd0 100644 --- a/src/plugins/texteditor/basefilefind.cpp +++ b/src/plugins/texteditor/basefilefind.cpp @@ -30,12 +30,12 @@ #include "basefilefind.h" #include <coreplugin/icore.h> -#include <coreplugin/stylehelper.h> #include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/editormanager/editormanager.h> #include <find/textfindconstants.h> #include <texteditor/itexteditor.h> #include <texteditor/basetexteditor.h> +#include <utils/stylehelper.h> #include <QtCore/QDebug> #include <QtCore/QDirIterator> diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 4fcd94e2af..414e5c7bb2 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -39,14 +39,14 @@ #include "codecselector.h" #ifndef TEXTEDITOR_STANDALONE +#include <aggregation/aggregate.h> #include <coreplugin/coreconstants.h> #include <coreplugin/editormanager/editormanager.h> #include <coreplugin/manhattanstyle.h> -#include <coreplugin/stylehelper.h> #include <extensionsystem/pluginmanager.h> #include <find/basetextfind.h> +#include <utils/stylehelper.h> -#include <aggregation/aggregate.h> #endif #include <utils/linecolumnlabel.h> #include <utils/qtcassert.h> @@ -1245,7 +1245,7 @@ bool BaseTextEditor::isParenthesesMatchingEnabled() const void BaseTextEditor::setHighlightCurrentLine(bool b) { d->m_highlightCurrentLine = b; - slotCursorPositionChanged(); + updateCurrentLineHighlight(); } bool BaseTextEditor::highlightCurrentLine() const @@ -2582,6 +2582,22 @@ void BaseTextEditor::saveCurrentCursorPositionForNavigation() d->m_tempNavigationState = saveState(); } +void BaseTextEditor::updateCurrentLineHighlight() +{ + QList<QTextEdit::ExtraSelection> extraSelections; + + if (d->m_highlightCurrentLine) { + QTextEdit::ExtraSelection sel; + sel.format.setBackground(d->m_currentLineFormat.background()); + sel.format.setProperty(QTextFormat::FullWidthSelection, true); + sel.cursor = textCursor(); + sel.cursor.clearSelection(); + extraSelections.append(sel); + } + + setExtraSelections(CurrentLineSelection, extraSelections); +} + void BaseTextEditor::slotCursorPositionChanged() { if (!d->m_contentsChanged && d->m_lastCursorChangeWasInteresting) { @@ -2602,18 +2618,7 @@ void BaseTextEditor::slotCursorPositionChanged() } } - QList<QTextEdit::ExtraSelection> extraSelections; - - if (d->m_highlightCurrentLine) { - QTextEdit::ExtraSelection sel; - sel.format.setBackground(d->m_currentLineFormat.background()); - sel.format.setProperty(QTextFormat::FullWidthSelection, true); - sel.cursor = textCursor(); - sel.cursor.clearSelection(); - extraSelections.append(sel); - } - - setExtraSelections(CurrentLineSelection, extraSelections); + updateCurrentLineHighlight(); if (d->m_displaySettings.m_highlightBlocks) { QTextCursor cursor = textCursor(); @@ -3898,7 +3903,8 @@ void BaseTextEditor::setFontSettings(const TextEditor::FontSettings &fs) d->m_matchFormat.setForeground(parenthesesFormat.foreground()); d->m_rangeFormat.setBackground(parenthesesFormat.background()); - slotUpdateExtraAreaWidth(); + slotUpdateExtraAreaWidth(); // Adjust to new font width + updateCurrentLineHighlight(); // Make sure it takes the new color } void BaseTextEditor::setTabSettings(const TabSettings &ts) diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h index 9dd9240579..5bcf962ed9 100644 --- a/src/plugins/texteditor/basetexteditor.h +++ b/src/plugins/texteditor/basetexteditor.h @@ -526,6 +526,7 @@ private: void moveLineUpDown(bool up); void copyLineUpDown(bool up); void saveCurrentCursorPositionForNavigation(); + void updateCurrentLineHighlight(); void drawFoldingMarker(QPainter *painter, const QPalette &pal, const QRect &rect, diff --git a/src/plugins/texteditor/colorscheme.cpp b/src/plugins/texteditor/colorscheme.cpp index 6aa4116cf6..e937d15f05 100644 --- a/src/plugins/texteditor/colorscheme.cpp +++ b/src/plugins/texteditor/colorscheme.cpp @@ -151,8 +151,7 @@ bool ColorScheme::save(const QString &fileName) const Format &format = i.next().value(); w.writeStartElement(QLatin1String("style")); w.writeAttribute(QLatin1String("name"), i.key()); - if (format.foreground().isValid() && - (i.key() == QLatin1String(Constants::C_TEXT) || format.foreground() != textFormat.foreground())) + if (format.foreground().isValid()) w.writeAttribute(QLatin1String("foreground"), format.foreground().name().toLower()); if (format.background().isValid()) w.writeAttribute(QLatin1String("background"), format.background().name().toLower()); diff --git a/src/plugins/texteditor/fontsettings.cpp b/src/plugins/texteditor/fontsettings.cpp index 39121e545e..5ad025d815 100644 --- a/src/plugins/texteditor/fontsettings.cpp +++ b/src/plugins/texteditor/fontsettings.cpp @@ -77,7 +77,6 @@ void FontSettings::clear() } void FontSettings::toSettings(const QString &category, - const FormatDescriptions &descriptions, QSettings *s) const { s->beginGroup(category); @@ -111,8 +110,30 @@ bool FontSettings::fromSettings(const QString &category, m_family = s->value(group + QLatin1String(fontFamilyKey), defaultFixedFontFamily()).toString(); m_fontSize = s->value(group + QLatin1String(fontSizeKey), m_fontSize).toInt(); m_antialias = s->value(group + QLatin1String(antialiasKey), DEFAULT_ANTIALIAS).toBool(); - loadColorScheme(s->value(group + QLatin1String(schemeFileNameKey), defaultSchemeFileName()).toString(), - descriptions); + + if (s->contains(group + QLatin1String(schemeFileNameKey))) { + // Load the selected color scheme + loadColorScheme(s->value(group + QLatin1String(schemeFileNameKey), defaultSchemeFileName()).toString(), + descriptions); + } else { + // Load color scheme from ini file + foreach (const FormatDescription &desc, descriptions) { + const QString name = desc.name(); + const QString fmt = s->value(group + name, QString()).toString(); + Format format; + if (fmt.isEmpty()) { + format.setForeground(desc.foreground()); + format.setBackground(desc.background()); + format.setBold(desc.format().bold()); + format.setItalic(desc.format().italic()); + } else { + format.fromString(fmt); + } + m_scheme.setFormatFor(name, format); + } + + m_scheme.setName(QObject::tr("Customized")); + } return true; } @@ -256,10 +277,18 @@ bool FontSettings::loadColorScheme(const QString &fileName, return loaded; } +bool FontSettings::saveColorScheme(const QString &fileName) +{ + const bool saved = m_scheme.save(fileName); + if (saved) + m_schemeFileName = fileName; + return saved; +} + /** * Returns the currently active color scheme. */ -ColorScheme FontSettings::colorScheme() const +const ColorScheme &FontSettings::colorScheme() const { return m_scheme; } diff --git a/src/plugins/texteditor/fontsettings.h b/src/plugins/texteditor/fontsettings.h index 0fa93bbe7b..9e55aed5b0 100644 --- a/src/plugins/texteditor/fontsettings.h +++ b/src/plugins/texteditor/fontsettings.h @@ -62,7 +62,6 @@ public: inline bool isEmpty() const { return m_scheme.isEmpty(); } void toSettings(const QString &category, - const FormatDescriptions &descriptions, QSettings *s) const; bool fromSettings(const QString &category, @@ -86,8 +85,9 @@ public: QString colorSchemeFileName() const; void setColorSchemeFileName(const QString &fileName); bool loadColorScheme(const QString &fileName, const FormatDescriptions &descriptions); + bool saveColorScheme(const QString &fileName); - ColorScheme colorScheme() const; + const ColorScheme &colorScheme() const; void setColorScheme(const ColorScheme &scheme); bool equals(const FontSettings &f) const; diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp index 18c4e723e5..6698230b87 100644 --- a/src/plugins/texteditor/fontsettingspage.cpp +++ b/src/plugins/texteditor/fontsettingspage.cpp @@ -90,6 +90,35 @@ Q_DECLARE_METATYPE(TextEditor::Internal::ColorSchemeEntry) using namespace TextEditor; using namespace TextEditor::Internal; +static QString customStylesPath() +{ + QString path = QFileInfo(Core::ICore::instance()->settings()->fileName()).path(); + path.append(QLatin1String("/qtcreator/styles/")); + return path; +} + +static QString createColorSchemeFileName(const QString &pattern) +{ + const QString stylesPath = customStylesPath(); + QString baseFileName = stylesPath; + baseFileName += pattern; + + // Find an available file name + int i = 1; + QString fileName; + do { + fileName = baseFileName.arg((i == 1) ? QString() : QString::number(i)); + ++i; + } while (QFile::exists(fileName)); + + // Create the base directory when it doesn't exist + if (!QFile::exists(stylesPath) && !QDir().mkpath(stylesPath)) { + qWarning() << "Failed to create color scheme directory:" << stylesPath; + return QString(); + } + + return fileName; +} // ------- FontSettingsPagePrivate FontSettingsPagePrivate::FontSettingsPagePrivate(const TextEditor::FormatDescriptions &fd, @@ -103,22 +132,37 @@ FontSettingsPagePrivate::FontSettingsPagePrivate(const TextEditor::FormatDescrip m_descriptions(fd) { bool settingsFound = false; - if (const QSettings *settings = Core::ICore::instance()->settings()) + QSettings *settings = Core::ICore::instance()->settings(); + if (settings) settingsFound = m_value.fromSettings(m_settingsGroup, m_descriptions, settings); + if (!settingsFound) { // Apply defaults foreach (const FormatDescription &f, m_descriptions) { const QString name = f.name(); - m_lastValue.formatFor(name).setForeground(f.foreground()); - m_lastValue.formatFor(name).setBackground(f.background()); - m_lastValue.formatFor(name).setBold(f.format().bold()); - m_lastValue.formatFor(name).setItalic(f.format().italic()); - m_value.formatFor(name).setForeground(f.foreground()); m_value.formatFor(name).setBackground(f.background()); m_value.formatFor(name).setBold(f.format().bold()); m_value.formatFor(name).setItalic(f.format().italic()); } + } else if (m_value.colorSchemeFileName().isEmpty()) { + // No color scheme was loaded, but one might be imported from the ini file + ColorScheme defaultScheme; + foreach (const FormatDescription &f, m_descriptions) { + const QString name = f.name(); + defaultScheme.formatFor(name).setForeground(f.foreground()); + defaultScheme.formatFor(name).setBackground(f.background()); + defaultScheme.formatFor(name).setBold(f.format().bold()); + defaultScheme.formatFor(name).setItalic(f.format().italic()); + } + if (m_value.colorScheme() != defaultScheme) { + // Save it as a color scheme file + QString schemeFileName = createColorSchemeFileName(QLatin1String("customized%1.xml")); + if (!schemeFileName.isEmpty()) { + if (m_value.saveColorScheme(schemeFileName) && settings) + m_value.toSettings(m_category, settings); + } + } } m_lastValue = m_value; @@ -312,31 +356,18 @@ void FontSettingsPage::cloneColorScheme() if (!d_ptr->m_value.loadColorScheme(entry.fileName, d_ptr->m_descriptions)) return; - QString baseDir = customStylesPath(); - QString baseFileName = baseDir; - baseFileName.append(QFileInfo(entry.fileName).completeBaseName()); + QString baseFileName = QFileInfo(entry.fileName).completeBaseName(); + baseFileName += QLatin1String("_copy%1.xml"); + QString fileName = createColorSchemeFileName(baseFileName); - // Find an available file name - int i = 1; - QString fileName; - do { - fileName = baseFileName; - fileName.append(QString("_copy%1.xml").arg((i == 1) ? QString() : QString::number(i))); - ++i; - } while (QFile::exists(fileName)); + if (!fileName.isEmpty()) { + ColorScheme scheme = d_ptr->m_value.colorScheme(); + scheme.setName(tr("%1 (copy)").arg(scheme.name())); + scheme.save(fileName); + d_ptr->m_value.setColorSchemeFileName(fileName); - // Create the base directory when it doesn't exist - if (!QFile::exists(baseDir) && !QDir().mkpath(baseDir)) { - qWarning() << "Failed to create color scheme directory:" << baseDir; - return; + refreshColorSchemeList(); } - - ColorScheme scheme = d_ptr->m_value.colorScheme(); - scheme.setName(tr("%1 (copy)").arg(scheme.name())); - scheme.save(fileName); - d_ptr->m_value.setColorSchemeFileName(fileName); - - refreshColorSchemeList(); } void FontSettingsPage::deleteColorScheme() @@ -436,13 +467,6 @@ void FontSettingsPage::refreshColorSchemeList() d_ptr->ui.schemeListWidget->setCurrentIndex(s); } -QString FontSettingsPage::customStylesPath() -{ - QString path = QFileInfo(Core::ICore::instance()->settings()->fileName()).path(); - path.append(QLatin1String("/qtcreator/styles/")); - return path; -} - void FontSettingsPage::delayedChange() { emit changed(d_ptr->m_value); @@ -471,7 +495,7 @@ void FontSettingsPage::saveSettings() if (d_ptr->m_value != d_ptr->m_lastValue) { d_ptr->m_lastValue = d_ptr->m_value; if (QSettings *settings = Core::ICore::instance()->settings()) - d_ptr->m_value.toSettings(d_ptr->m_settingsGroup, d_ptr->m_descriptions, settings); + d_ptr->m_value.toSettings(d_ptr->m_settingsGroup, settings); QTimer::singleShot(0, this, SLOT(delayedChange())); } diff --git a/src/plugins/texteditor/fontsettingspage.h b/src/plugins/texteditor/fontsettingspage.h index a57761d299..af009d75d4 100644 --- a/src/plugins/texteditor/fontsettingspage.h +++ b/src/plugins/texteditor/fontsettingspage.h @@ -119,7 +119,6 @@ private slots: private: void addColorSchemeEntry(const QString &fileName, bool readOnly); void refreshColorSchemeList(); - static QString customStylesPath(); Internal::FontSettingsPagePrivate *d_ptr; }; diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp index 86ea887bc9..5948825eda 100644 --- a/src/plugins/texteditor/texteditorplugin.cpp +++ b/src/plugins/texteditor/texteditorplugin.cpp @@ -131,7 +131,7 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe #endif connect(completionShortcut, SIGNAL(activated()), this, SLOT(invokeCompletion())); - // Add shortcut for invoking automatic completion + // Add shortcut for invoking quick fix options QShortcut *quickFixShortcut = new QShortcut(core->mainWindow()); quickFixShortcut->setWhatsThis(tr("Triggers a quick fix in this scope")); // Make sure the shortcut still works when the quick fix widget is active diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp index 4f309d914c..46734d78e4 100644 --- a/src/shared/proparser/profileevaluator.cpp +++ b/src/shared/proparser/profileevaluator.cpp @@ -140,7 +140,7 @@ public: ProBlock *currentBlock(); void updateItem(); bool parseLine(const QString &line); - void insertVariable(const QString &line, int *i); + void insertVariable(const ushort **pCur, const ushort *end); void insertOperator(const char op); void insertComment(const QString &comment); void enterScope(bool multiLine); @@ -153,11 +153,14 @@ public: ProItem *m_commentItem; QString m_proitem; QString m_pendingComment; + ushort *m_proitemPtr; bool m_syntaxError; bool m_contNextLine; bool m_inQuote; int m_parens; + enum StrState { NotStarted, Started, PutSpace }; + /////////////// Evaluating pro file contents // implementation of AbstractProItemVisitor @@ -304,32 +307,36 @@ bool ProFileEvaluator::Private::read(ProFile *pro, QTextStream *ts) return true; } -bool ProFileEvaluator::Private::parseLine(const QString &line0) +bool ProFileEvaluator::Private::parseLine(const QString &line) { if (m_blockstack.isEmpty()) return false; + const ushort *cur = (const ushort *)line.unicode(), + *end = cur + line.length(); int parens = m_parens; bool inQuote = m_inQuote; bool escaped = false; - QString line = line0.simplified(); - for (int i = 0; !m_syntaxError && i < line.length(); ++i) { - ushort c = line.at(i).unicode(); + m_proitem.reserve(line.length()); + m_proitemPtr = (ushort *)m_proitem.unicode(); + nextItem: + ushort *ptr = m_proitemPtr; + StrState sts = NotStarted; + while (cur < end) { + ushort c = *cur++; if (c == '#') { // Yep - no escaping possible - insertComment(line.mid(i + 1)); - escaped = m_contNextLine; - break; + m_proitemPtr = ptr; + insertComment(line.right(end - cur).simplified()); + goto done; } if (!escaped) { if (c == '\\') { escaped = true; - m_proitem += c; - continue; + goto putch; } else if (c == '"') { inQuote = !inQuote; - m_proitem += c; - continue; + goto putch; } } else { escaped = false; @@ -341,52 +348,70 @@ bool ProFileEvaluator::Private::parseLine(const QString &line0) --parens; } else if (!parens) { if (m_block && (m_block->blockKind() & ProBlock::VariableKind)) { - if (c == ' ') + if (c == ' ' || c == '\t') { + m_proitemPtr = ptr; updateItem(); - else - m_proitem += c; - continue; - } - if (c == ':') { - enterScope(false); - continue; - } - if (c == '{') { - enterScope(true); - continue; - } - if (c == '}') { - leaveScope(); - continue; - } - if (c == '=') { - insertVariable(line, &i); - continue; - } - if (c == '|' || c == '!') { - insertOperator(c); - continue; + goto nextItem; + } + } else { + if (c == ':') { + m_proitemPtr = ptr; + enterScope(false); + goto nextItem; + } + if (c == '{') { + m_proitemPtr = ptr; + enterScope(true); + goto nextItem; + } + if (c == '}') { + m_proitemPtr = ptr; + leaveScope(); + if (m_syntaxError) + goto done1; + goto nextItem; + } + if (c == '=') { + m_proitemPtr = ptr; + insertVariable(&cur, end); + goto nextItem; + } + if (c == '|' || c == '!') { + m_proitemPtr = ptr; + insertOperator(c); + goto nextItem; + } } } } - m_proitem += c; + if (c == ' ' || c == '\t') { + if (sts == Started) + sts = PutSpace; + } else { + putch: + if (sts == PutSpace) + *ptr++ = ' '; + *ptr++ = c; + sts = Started; + } } + m_proitemPtr = ptr; + done1: + m_contNextLine = escaped; + done: m_inQuote = inQuote; m_parens = parens; - m_contNextLine = escaped; + if (m_syntaxError) + return false; if (escaped) { - m_proitem.chop(1); + --m_proitemPtr; updateItem(); - return true; } else { - if (!m_syntaxError) { - updateItem(); - finalizeBlock(); - return true; - } - return false; + updateItem(); + finalizeBlock(); } + return true; } void ProFileEvaluator::Private::finalizeBlock() @@ -401,37 +426,44 @@ void ProFileEvaluator::Private::finalizeBlock() } } -void ProFileEvaluator::Private::insertVariable(const QString &line, int *i) +void ProFileEvaluator::Private::insertVariable(const ushort **pCur, const ushort *end) { ProVariable::VariableOperator opkind; + ushort *uc = (ushort *)m_proitem.unicode(); + ushort *ptr = m_proitemPtr; - if (m_proitem.isEmpty()) // Line starting with '=', like a conflict marker + if (ptr == uc) // Line starting with '=', like a conflict marker return; - switch (m_proitem.at(m_proitem.length() - 1).unicode()) { + switch (*(ptr - 1)) { case '+': - m_proitem.chop(1); + --ptr; opkind = ProVariable::AddOperator; break; case '-': - m_proitem.chop(1); + --ptr; opkind = ProVariable::RemoveOperator; break; case '*': - m_proitem.chop(1); + --ptr; opkind = ProVariable::UniqueAddOperator; break; case '~': - m_proitem.chop(1); + --ptr; opkind = ProVariable::ReplaceOperator; break; default: opkind = ProVariable::SetOperator; } + while (ptr != uc && *(ptr - 1) == ' ') + --ptr; + m_proitem.resize(ptr - uc); + QString proVar = m_proitem; + proVar.detach(); + ProBlock *block = m_blockstack.top(); - m_proitem = m_proitem.trimmed(); - ProVariable *variable = new ProVariable(m_proitem, block); + ProVariable *variable = new ProVariable(proVar, block); variable->setLineNumber(m_lineNo); variable->setVariableOperator(opkind); block->appendItem(variable); @@ -443,26 +475,31 @@ void ProFileEvaluator::Private::insertVariable(const QString &line, int *i) } m_commentItem = variable; - m_proitem.clear(); - if (opkind == ProVariable::ReplaceOperator) { // skip util end of line or comment - while (1) { - ++(*i); - - // end of line? - if (*i >= line.count()) + StrState sts = NotStarted; + ptr = uc; + const ushort *cur = *pCur; + while (cur < end) { + ushort c = *cur; + if (c == '#') // comment? break; + ++cur; - // comment? - if (line.at(*i).unicode() == '#') { - --(*i); - break; + if (c == ' ' || c == '\t') { + if (sts == Started) + sts = PutSpace; + } else { + if (sts == PutSpace) + *ptr++ = ' '; + *ptr++ = c; + sts = Started; } - - m_proitem += line.at(*i); } - m_proitem = m_proitem.trimmed(); + *pCur = cur; + m_proitemPtr = ptr; + } else { + m_proitemPtr = uc; } } @@ -563,22 +600,27 @@ ProBlock *ProFileEvaluator::Private::currentBlock() void ProFileEvaluator::Private::updateItem() { - m_proitem = m_proitem.trimmed(); - if (m_proitem.isEmpty()) + ushort *uc = (ushort *)m_proitem.unicode(); + ushort *ptr = m_proitemPtr; + + if (ptr == uc) return; + m_proitem.resize(ptr - uc); + m_proitemPtr = uc; + QString proItem = m_proitem; + proItem.detach(); + ProBlock *block = currentBlock(); if (block->blockKind() & ProBlock::VariableKind) { - m_commentItem = new ProValue(m_proitem, static_cast<ProVariable*>(block)); - } else if (m_proitem.endsWith(QLatin1Char(')'))) { - m_commentItem = new ProFunction(m_proitem); + m_commentItem = new ProValue(proItem, static_cast<ProVariable*>(block)); + } else if (proItem.endsWith(QLatin1Char(')'))) { + m_commentItem = new ProFunction(proItem); } else { - m_commentItem = new ProCondition(m_proitem); + m_commentItem = new ProCondition(proItem); } m_commentItem->setLineNumber(m_lineNo); block->appendItem(m_commentItem); - - m_proitem.clear(); } |