Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

This commit is contained in:
Erik Verbruggen
2009-07-16 09:43:30 +02:00
120 changed files with 6139 additions and 1597 deletions

View File

@@ -3480,7 +3480,7 @@ void *qDumpObjectData440(
"\"").put(((QT_VERSION >> 8) & 255)).put("\"," "\"").put(((QT_VERSION >> 8) & 255)).put("\","
"\"").put(((QT_VERSION) & 255)).put("\"]"); "\"").put(((QT_VERSION) & 255)).put("\"]");
d.put(",namespace=\""NS"\","); d.put(",namespace=\""NS"\",");
d.put(",dumperversion=\"1.3\","); d.put("dumperversion=\"1.3\",");
// Dump out size information // Dump out size information
d.put("sizes={"); d.put("sizes={");
d.put("int=\"").put(sizeof(int)).put("\",") d.put("int=\"").put(sizeof(int)).put("\",")

View File

@@ -8,7 +8,7 @@
<key>CFBundleTypeRole</key> <key>CFBundleTypeRole</key>
<string>Editor</string> <string>Editor</string>
<key>CFBundleTypeIconFile</key> <key>CFBundleTypeIconFile</key>
<string>qtcreator.icns</string> <string>profile.icns</string>
<key>CFBundleTypeExtensions</key> <key>CFBundleTypeExtensions</key>
<array> <array>
<string>pro</string> <string>pro</string>
@@ -21,6 +21,8 @@
<dict> <dict>
<key>CFBundleTypeRole</key> <key>CFBundleTypeRole</key>
<string>Editor</string> <string>Editor</string>
<key>CFBundleTypeIconFile</key>
<string>profile.icns</string>
<key>CFBundleTypeExtensions</key> <key>CFBundleTypeExtensions</key>
<array> <array>
<string>pri</string> <string>pri</string>
@@ -47,7 +49,7 @@
<string>Editor</string> <string>Editor</string>
<key>CFBundleTypeExtensions</key> <key>CFBundleTypeExtensions</key>
<array> <array>
<string>pri</string> <string>ui</string>
</array> </array>
<key>CFBundleTypeName</key> <key>CFBundleTypeName</key>
<string>Qt UI File</string> <string>Qt UI File</string>

View File

@@ -20,6 +20,9 @@ win32 {
ICON = qtcreator.icns ICON = qtcreator.icns
QMAKE_INFO_PLIST = Info.plist QMAKE_INFO_PLIST = Info.plist
FILETYPES.files = profile.icns prifile.icns
FILETYPES.path = Contents/Resources
QMAKE_BUNDLE_DATA += FILETYPES
} else { } else {
LIBS *= -lExtensionSystem -lAggregation LIBS *= -lExtensionSystem -lAggregation

BIN
src/app/prifile.icns Normal file

Binary file not shown.

BIN
src/app/profile.icns Normal file

Binary file not shown.

View File

@@ -31,7 +31,6 @@
#include <cctype> #include <cctype>
#include <QtCore/QFile> #include <QtCore/QFile>
#include <QtCore/QDir>
#include <QtCore/QFutureInterface> #include <QtCore/QFutureInterface>
#include <QtCore/QtConcurrentRun> #include <QtCore/QtConcurrentRun>
#include <QtCore/QRegExp> #include <QtCore/QRegExp>
@@ -158,7 +157,7 @@ void runFileSearch(QFutureInterface<FileSearchResult> &future,
int n = 0; int n = 0;
while (startOfLastLine[i] != '\n' && startOfLastLine[i] != '\r' && i < textLength && n++ < 256) while (startOfLastLine[i] != '\n' && startOfLastLine[i] != '\r' && i < textLength && n++ < 256)
res.append(startOfLastLine[i++]); res.append(startOfLastLine[i++]);
future.reportResult(FileSearchResult(QDir::toNativeSeparators(s), lineNr, QString(res), future.reportResult(FileSearchResult(s, lineNr, QString(res),
regionPtr - startOfLastLine, sa.length())); regionPtr - startOfLastLine, sa.length()));
++numMatches; ++numMatches;
} }
@@ -204,7 +203,7 @@ void runFileSearchRegExp(QFutureInterface<FileSearchResult> &future,
line = stream.readLine(); line = stream.readLine();
int pos = 0; int pos = 0;
while ((pos = expression.indexIn(line, pos)) != -1) { 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()));
pos += expression.matchedLength(); pos += expression.matchedLength();
} }

View File

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

View File

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

View File

@@ -30,7 +30,7 @@
#ifndef STYLEHELPER_H #ifndef STYLEHELPER_H
#define STYLEHELPER_H #define STYLEHELPER_H
#include "core_global.h" #include "utils_global.h"
#include <QtCore/QRect> #include <QtCore/QRect>
#include <QtGui/QPainter> #include <QtGui/QPainter>
@@ -40,7 +40,7 @@
// Helper class holding all custom color values // Helper class holding all custom color values
class CORE_EXPORT StyleHelper class QTCREATOR_UTILS_EXPORT StyleHelper
{ {
public: public:
// Height of the project explorer navigation bar // Height of the project explorer navigation bar

View File

@@ -29,7 +29,10 @@ SOURCES += reloadpromptutils.cpp \
uncommentselection.cpp \ uncommentselection.cpp \
parameteraction.cpp \ parameteraction.cpp \
treewidgetcolumnstretcher.cpp \ treewidgetcolumnstretcher.cpp \
checkablemessagebox.cpp checkablemessagebox.cpp \
styledbar.cpp \
stylehelper.cpp
win32 { win32 {
SOURCES += abstractprocess_win.cpp \ SOURCES += abstractprocess_win.cpp \
consoleprocess_win.cpp \ consoleprocess_win.cpp \
@@ -66,7 +69,10 @@ HEADERS += utils_global.h \
parameteraction.h \ parameteraction.h \
treewidgetcolumnstretcher.h \ treewidgetcolumnstretcher.h \
checkablemessagebox.h \ checkablemessagebox.h \
qtcassert.h qtcassert.h \
styledbar.h \
stylehelper.h
FORMS += filewizardpage.ui \ FORMS += filewizardpage.ui \
projectintropage.ui \ projectintropage.ui \
newclasswidget.ui \ newclasswidget.ui \

View File

@@ -170,6 +170,12 @@ QString CMakeRunConfiguration::dumperLibrary() const
return dhl; return dhl;
} }
QStringList CMakeRunConfiguration::dumperLibraryLocations() const
{
QString qmakePath = ProjectExplorer::DebuggingHelperLibrary::findSystemQt(environment());
return ProjectExplorer::DebuggingHelperLibrary::debuggingHelperLibraryLocations(qmakePath);
}
ProjectExplorer::Environment CMakeRunConfiguration::baseEnvironment() const ProjectExplorer::Environment CMakeRunConfiguration::baseEnvironment() const
{ {
ProjectExplorer::Environment env; ProjectExplorer::Environment env;

View File

@@ -70,6 +70,7 @@ public:
virtual void save(ProjectExplorer::PersistentSettingsWriter &writer) const; virtual void save(ProjectExplorer::PersistentSettingsWriter &writer) const;
virtual void restore(const ProjectExplorer::PersistentSettingsReader &reader); virtual void restore(const ProjectExplorer::PersistentSettingsReader &reader);
virtual QString dumperLibrary() const; virtual QString dumperLibrary() const;
virtual QStringList dumperLibraryLocations() const;
virtual ProjectExplorer::ToolChain::ToolChainType toolChainType() const; virtual ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
signals: signals:

View File

@@ -65,7 +65,6 @@ SOURCES += mainwindow.cpp \
coreimpl.cpp \ coreimpl.cpp \
basefilewizard.cpp \ basefilewizard.cpp \
plugindialog.cpp \ plugindialog.cpp \
stylehelper.cpp \
inavigationwidgetfactory.cpp \ inavigationwidgetfactory.cpp \
navigationwidget.cpp \ navigationwidget.cpp \
manhattanstyle.cpp \ manhattanstyle.cpp \
@@ -150,7 +149,6 @@ HEADERS += mainwindow.h \
coreimpl.h \ coreimpl.h \
basefilewizard.h \ basefilewizard.h \
plugindialog.h \ plugindialog.h \
stylehelper.h \
inavigationwidgetfactory.h \ inavigationwidgetfactory.h \
navigationwidget.h \ navigationwidget.h \
manhattanstyle.h \ manhattanstyle.h \

View File

@@ -28,7 +28,7 @@
**************************************************************************/ **************************************************************************/
#include "fancytabwidget.h" #include "fancytabwidget.h"
#include "stylehelper.h" #include <utils/stylehelper.h>
#include <QDebug> #include <QDebug>

View File

@@ -28,6 +28,8 @@
**************************************************************************/ **************************************************************************/
#include "fileiconprovider.h" #include "fileiconprovider.h"
#include "mimedatabase.h"
#include <QtGui/QApplication> #include <QtGui/QApplication>
#include <QtGui/QStyle> #include <QtGui/QStyle>
#include <QtGui/QPainter> #include <QtGui/QPainter>
@@ -88,7 +90,9 @@ QIcon FileIconProvider::icon(const QFileInfo &fileInfo)
return icon; 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 FileIconProvider::overlayIcon(QStyle::StandardPixmap baseIcon, const QIcon &overlayIcon, const QSize &size) const
{ {
QPixmap iconPixmap = qApp->style()->standardIcon(baseIcon).pixmap(size); 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) void FileIconProvider::registerIconOverlayForSuffix(const QIcon &icon, const QString &suffix)
{ {
@@ -117,13 +121,22 @@ void FileIconProvider::registerIconOverlayForSuffix(const QIcon &icon, const QSt
m_cache.append(newEntry); m_cache.append(newEntry);
} }
/*!
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. Returns an icon for the given suffix, or an empty one if none registered.
*/ */
QIcon FileIconProvider::iconForSuffix(const QString &suffix) const QIcon FileIconProvider::iconForSuffix(const QString &suffix) const
{ {
QIcon icon; 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) Q_UNUSED(suffix)
#else #else
if (suffix.isEmpty()) if (suffix.isEmpty())

View File

@@ -40,13 +40,17 @@
namespace Core { namespace Core {
class CORE_EXPORT FileIconProvider { class MimeType;
class CORE_EXPORT FileIconProvider
{
public: public:
~FileIconProvider(); // used to clear the cache ~FileIconProvider(); // used to clear the cache
QIcon icon(const QFileInfo &fileInfo); QIcon icon(const QFileInfo &fileInfo);
QPixmap overlayIcon(QStyle::StandardPixmap baseIcon, const QIcon &overlayIcon, const QSize &size) const; QPixmap overlayIcon(QStyle::StandardPixmap baseIcon, const QIcon &overlayIcon, const QSize &size) const;
void registerIconOverlayForSuffix(const QIcon &icon, const QString &suffix); void registerIconOverlayForSuffix(const QIcon &icon, const QString &suffix);
void registerIconOverlayForMimeType(const QIcon &icon, const MimeType &mimeType);
static FileIconProvider *instance(); static FileIconProvider *instance();

View File

@@ -29,8 +29,8 @@
#include "generalsettings.h" #include "generalsettings.h"
#include "stylehelper.h" #include <utils/stylehelper.h>
#include "utils/qtcolorbutton.h" #include <utils/qtcolorbutton.h>
#include <utils/consoleprocess.h> #include <utils/consoleprocess.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>

View File

@@ -51,7 +51,6 @@
#include "scriptmanager_p.h" #include "scriptmanager_p.h"
#include "settingsdialog.h" #include "settingsdialog.h"
#include "stylehelper.h"
#include "variablemanager.h" #include "variablemanager.h"
#include "versiondialog.h" #include "versiondialog.h"
#include "viewmanager.h" #include "viewmanager.h"
@@ -68,6 +67,7 @@
#include <coreplugin/findplaceholder.h> #include <coreplugin/findplaceholder.h>
#include <coreplugin/settingsdatabase.h> #include <coreplugin/settingsdatabase.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <utils/stylehelper.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <QtCore/QDebug> #include <QtCore/QDebug>

View File

@@ -29,12 +29,14 @@
#include "manhattanstyle.h" #include "manhattanstyle.h"
#include "stylehelper.h"
#include "styleanimator.h" #include "styleanimator.h"
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/QLibrary> #include <QtCore/QLibrary>
#include <utils/qtcassert.h>
#include <utils/stylehelper.h>
#include <QtGui/QApplication> #include <QtGui/QApplication>
#include <QtGui/QComboBox> #include <QtGui/QComboBox>
#include <QtGui/QDialog> #include <QtGui/QDialog>
@@ -56,8 +58,6 @@
#include <QtGui/QToolBar> #include <QtGui/QToolBar>
#include <QtGui/QToolButton> #include <QtGui/QToolButton>
#include <utils/qtcassert.h>
// We define a currently unused state for indicating animations // We define a currently unused state for indicating animations
#define State_Animating 0x00000040 #define State_Animating 0x00000040
@@ -86,6 +86,8 @@ bool panelWidget(const QWidget *widget)
return true; return true;
else if (qobject_cast<const QMenuBar *>(p) && styleEnabled(p)) else if (qobject_cast<const QMenuBar *>(p) && styleEnabled(p))
return true; return true;
else if (p->property("panelwidget").toBool())
return true;
p = p->parentWidget(); p = p->parentWidget();
} }
return false; return false;

View File

@@ -28,7 +28,8 @@
**************************************************************************/ **************************************************************************/
#include "minisplitter.h" #include "minisplitter.h"
#include "stylehelper.h"
#include <utils/stylehelper.h>
#include <QtGui/QPaintEvent> #include <QtGui/QPaintEvent>
#include <QtGui/QPainter> #include <QtGui/QPainter>

View File

@@ -28,7 +28,8 @@
**************************************************************************/ **************************************************************************/
#include "progresspie.h" #include "progresspie.h"
#include "stylehelper.h"
#include <utils/stylehelper.h>
#include <QtGui/QPainter> #include <QtGui/QPainter>
#include <QtGui/QFont> #include <QtGui/QFont>

View File

@@ -65,29 +65,19 @@ CppEditorFactory::CppEditorFactory(CppPlugin *owner) :
m_owner(owner) m_owner(owner)
{ {
m_mimeTypes << QLatin1String(CppEditor::Constants::C_SOURCE_MIMETYPE) m_mimeTypes << QLatin1String(CppEditor::Constants::C_SOURCE_MIMETYPE)
<< QLatin1String(CppEditor::Constants::C_HEADER_MIMETYPE) << QLatin1String(CppEditor::Constants::C_HEADER_MIMETYPE)
<< QLatin1String(CppEditor::Constants::CPP_SOURCE_MIMETYPE) << QLatin1String(CppEditor::Constants::CPP_SOURCE_MIMETYPE)
<< QLatin1String(CppEditor::Constants::CPP_HEADER_MIMETYPE); << QLatin1String(CppEditor::Constants::CPP_HEADER_MIMETYPE);
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
#ifndef Q_WS_MAC #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. Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
QIcon cppIcon(":/cppeditor/images/qt_cpp.png"); Core::MimeDatabase *mimeDatabase = Core::ICore::instance()->mimeDatabase();
iconProvider->registerIconOverlayForSuffix(cppIcon, QLatin1String("cpp")); iconProvider->registerIconOverlayForMimeType(QIcon(":/cppeditor/images/qt_cpp.png"),
iconProvider->registerIconOverlayForSuffix(cppIcon, QLatin1String("cp")); mimeDatabase->findByType(QLatin1String(CppEditor::Constants::CPP_SOURCE_MIMETYPE)));
iconProvider->registerIconOverlayForSuffix(cppIcon, QLatin1String("cc")); iconProvider->registerIconOverlayForMimeType(QIcon(":/cppeditor/images/qt_c.png"),
iconProvider->registerIconOverlayForSuffix(cppIcon, QLatin1String("cxx")); mimeDatabase->findByType(QLatin1String(CppEditor::Constants::C_SOURCE_MIMETYPE)));
iconProvider->registerIconOverlayForSuffix(cppIcon, QLatin1String("C")); iconProvider->registerIconOverlayForMimeType(QIcon(":/cppeditor/images/qt_h.png"),
iconProvider->registerIconOverlayForSuffix(cppIcon, QLatin1String("c++")); mimeDatabase->findByType(QLatin1String(CppEditor::Constants::CPP_HEADER_MIMETYPE)));
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++"));
#endif #endif
} }
@@ -122,7 +112,6 @@ CppPlugin *CppPlugin::m_instance = 0;
CppPlugin::CppPlugin() : CppPlugin::CppPlugin() :
m_actionHandler(0), m_actionHandler(0),
m_factory(0),
m_sortedMethodOverview(false) m_sortedMethodOverview(false)
{ {
m_instance = this; m_instance = this;
@@ -130,8 +119,6 @@ CppPlugin::CppPlugin() :
CppPlugin::~CppPlugin() CppPlugin::~CppPlugin()
{ {
removeObject(m_factory);
delete m_factory;
delete m_actionHandler; delete m_actionHandler;
m_instance = 0; m_instance = 0;
} }
@@ -174,12 +161,11 @@ bool CppPlugin::sortedMethodOverview() const
bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
{ {
Core::ICore *core = Core::ICore::instance(); Core::ICore *core = Core::ICore::instance();
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/cppeditor/CppEditor.mimetypes.xml"), errorMessage)) if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/cppeditor/CppEditor.mimetypes.xml"), errorMessage))
return false; return false;
m_factory = new CppEditorFactory(this); addAutoReleasedObject(new CppEditorFactory(this));
addObject(m_factory);
addAutoReleasedObject(new CppHoverHandler); addAutoReleasedObject(new CppHoverHandler);
CppFileWizard::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard); CppFileWizard::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);

View File

@@ -44,7 +44,6 @@ namespace CppEditor {
namespace Internal { namespace Internal {
class CPPEditor; class CPPEditor;
class CppEditorFactory;
class CppPlugin : public ExtensionSystem::IPlugin class CppPlugin : public ExtensionSystem::IPlugin
{ {
@@ -76,7 +75,6 @@ private slots:
void jumpToDefinition(); void jumpToDefinition();
private: private:
friend class CppEditorFactory;
Core::IEditor *createEditor(QWidget *parent); Core::IEditor *createEditor(QWidget *parent);
void writeSettings(); void writeSettings();
void readSettings(); void readSettings();
@@ -84,7 +82,6 @@ private:
static CppPlugin *m_instance; static CppPlugin *m_instance;
TextEditor::TextEditorActionHandler *m_actionHandler; TextEditor::TextEditorActionHandler *m_actionHandler;
CppEditorFactory *m_factory;
bool m_sortedMethodOverview; bool m_sortedMethodOverview;
}; };

View File

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

View File

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

View File

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

View File

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

36
src/plugins/cvs/cvs.pro Normal file
View File

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

5
src/plugins/cvs/cvs.qrc Normal file
View File

@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/trolltech.cvs" >
<file>CVS.mimetypes.xml</file>
</qresource>
</RCC>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

208
src/plugins/cvs/cvsplugin.h Normal file
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -539,12 +539,13 @@ bool CdbDebugEngine::startDebugger(const QSharedPointer<DebuggerStartParameters>
const QString dumperLibName = QDir::toNativeSeparators(m_d->m_debuggerManagerAccess->qtDumperLibraryName()); const QString dumperLibName = QDir::toNativeSeparators(m_d->m_debuggerManagerAccess->qtDumperLibraryName());
bool dumperEnabled = mode != AttachCore bool dumperEnabled = mode != AttachCore
&& mode != AttachCrashedExternal && mode != AttachCrashedExternal
&& !dumperLibName.isEmpty()
&& m_d->m_debuggerManagerAccess->qtDumperLibraryEnabled(); && m_d->m_debuggerManagerAccess->qtDumperLibraryEnabled();
if (dumperEnabled) { if (dumperEnabled) {
const QFileInfo fi(dumperLibName); const QFileInfo fi(dumperLibName);
if (!fi.isFile()) { 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); m_d->m_debuggerManagerAccess->showQtDumperLibraryWarning(msg);
dumperEnabled = false; dumperEnabled = false;
} }

View File

@@ -271,6 +271,7 @@ bool isFatalException(LONG code)
case startupCompleteTrap: // Mysterious exception at start of application case startupCompleteTrap: // Mysterious exception at start of application
case rpcServerUnavailableExceptionCode: case rpcServerUnavailableExceptionCode:
case dllNotFoundExceptionCode: case dllNotFoundExceptionCode:
case cppExceptionCode:
return false; return false;
default: default:
break; break;

View File

@@ -1004,6 +1004,11 @@ void DebuggerManager::setQtDumperLibraryName(const QString &dl)
m_dumperLib = dl; m_dumperLib = dl;
} }
void DebuggerManager::setQtDumperLibraryLocations(const QStringList &dl)
{
m_dumperLibLocations = dl;
}
qint64 DebuggerManager::inferiorPid() const qint64 DebuggerManager::inferiorPid() const
{ {
return m_inferiorPid; return m_inferiorPid;
@@ -1236,11 +1241,12 @@ void DebuggerManager::setStatus(int status)
|| status == DebuggerInferiorStopRequested || status == DebuggerInferiorStopRequested
|| status == DebuggerInferiorStopped; || status == DebuggerInferiorStopped;
//const bool starting = status == DebuggerProcessStartingUp;
const bool running = status == DebuggerInferiorRunning; const bool running = status == DebuggerInferiorRunning;
const bool ready = status == DebuggerInferiorStopped const bool ready = status == DebuggerInferiorStopped
&& startMode() != AttachCore; && startMode() != AttachCore;
if (ready)
QApplication::alert(mainWindow(), 3000);
m_watchAction->setEnabled(ready); m_watchAction->setEnabled(ready);
m_breakAction->setEnabled(true); m_breakAction->setEnabled(true);
@@ -1518,6 +1524,15 @@ QString DebuggerManager::qtDumperLibraryName() const
return m_dumperLib; 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) void DebuggerManager::showQtDumperLibraryWarning(const QString &details)
{ {
QMessageBox dialog(mainWindow()); QMessageBox dialog(mainWindow());

View File

@@ -236,6 +236,7 @@ private:
virtual bool qtDumperLibraryEnabled() const = 0; virtual bool qtDumperLibraryEnabled() const = 0;
virtual QString qtDumperLibraryName() const = 0; virtual QString qtDumperLibraryName() const = 0;
virtual QStringList qtDumperLibraryLocations() const = 0;
virtual void showQtDumperLibraryWarning(const QString &details = QString()) = 0; virtual void showQtDumperLibraryWarning(const QString &details = QString()) = 0;
virtual bool isReverseDebugging() const = 0; virtual bool isReverseDebugging() const = 0;
@@ -272,6 +273,7 @@ public slots:
virtual qint64 inferiorPid() const; virtual qint64 inferiorPid() const;
void setQtDumperLibraryName(const QString &dl); // Run Control void setQtDumperLibraryName(const QString &dl); // Run Control
void setQtDumperLibraryLocations(const QStringList &dl);
void setSimpleDockWidgetArrangement(); void setSimpleDockWidgetArrangement();
void setLocked(bool locked); void setLocked(bool locked);
@@ -376,6 +378,7 @@ private:
virtual bool qtDumperLibraryEnabled() const; virtual bool qtDumperLibraryEnabled() const;
virtual QString qtDumperLibraryName() const; virtual QString qtDumperLibraryName() const;
virtual QStringList qtDumperLibraryLocations() const;
virtual void showQtDumperLibraryWarning(const QString &details = QString()); virtual void showQtDumperLibraryWarning(const QString &details = QString());
virtual bool isReverseDebugging() const; virtual bool isReverseDebugging() const;
@@ -434,6 +437,7 @@ private:
QSharedPointer<DebuggerStartParameters> m_startParameters; QSharedPointer<DebuggerStartParameters> m_startParameters;
DebuggerRunControl *m_runControl; DebuggerRunControl *m_runControl;
QString m_dumperLib; QString m_dumperLib;
QStringList m_dumperLibLocations;
qint64 m_inferiorPid; qint64 m_inferiorPid;

View File

@@ -158,6 +158,7 @@ void DebuggerRunControl::start()
break; break;
} }
m_manager->setQtDumperLibraryName(rc->dumperLibrary()); m_manager->setQtDumperLibraryName(rc->dumperLibrary());
m_manager->setQtDumperLibraryLocations(rc->dumperLibraryLocations());
if (const ProjectExplorer::Project *project = rc->project()) { if (const ProjectExplorer::Project *project = rc->project()) {
m_startParameters->buildDir = project->buildDirectory(project->activeBuildConfiguration()); m_startParameters->buildDir = project->buildDirectory(project->activeBuildConfiguration());
} }

View File

@@ -62,7 +62,7 @@
#include <QtCore/QTextStream> #include <QtCore/QTextStream>
#include <QtGui/QAction> #include <QtGui/QAction>
#include <QtGui/QApplication> #include <QtCore/QCoreApplication>
#include <QtGui/QLabel> #include <QtGui/QLabel>
#include <QtGui/QMainWindow> #include <QtGui/QMainWindow>
#include <QtGui/QMessageBox> #include <QtGui/QMessageBox>
@@ -1146,7 +1146,6 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
m_currentFrame = _(frame.findChild("addr").data() + '%' + m_currentFrame = _(frame.findChild("addr").data() + '%' +
frame.findChild("func").data() + '%'); frame.findChild("func").data() + '%');
QApplication::alert(q->mainWindow(), 3000);
if (theDebuggerAction(ListSourceFiles)->value().toBool()) if (theDebuggerAction(ListSourceFiles)->value().toBool())
reloadSourceFiles(); reloadSourceFiles();
postCommand(_("-break-list"), CB(handleBreakList)); postCommand(_("-break-list"), CB(handleBreakList));
@@ -1302,7 +1301,8 @@ void GdbEngine::handleFileExecAndSymbols(const GdbResultRecord &response, const
QMessageBox::critical(q->mainWindow(), tr("Error"), QMessageBox::critical(q->mainWindow(), tr("Error"),
tr("Starting executable failed:\n") + msg); tr("Starting executable failed:\n") + msg);
QTC_ASSERT(q->status() == DebuggerInferiorRunning, /**/); 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"), QMessageBox::critical(q->mainWindow(), tr("Error"),
tr("Starting executable failed:\n") + QString::fromLocal8Bit(msg)); tr("Starting executable failed:\n") + QString::fromLocal8Bit(msg));
QTC_ASSERT(q->status() == DebuggerInferiorRunning, /**/); QTC_ASSERT(q->status() == DebuggerInferiorRunning, /**/);
interruptInferior(); //interruptInferior();
qq->notifyInferiorExited();
} }
} }
} }
@@ -1589,7 +1590,7 @@ bool GdbEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp)
QFileInfo fi2(sp->coreFile); QFileInfo fi2(sp->coreFile);
// quoting core name below fails in gdb 6.8-debian // quoting core name below fails in gdb 6.8-debian
QString coreName = fi2.absoluteFilePath(); QString coreName = fi2.absoluteFilePath();
postCommand(_("-file-exec-and-symbols ") + fileName); postCommand(_("-file-exec-and-symbols ") + fileName, CB(handleFileExecAndSymbols));
postCommand(_("target core ") + coreName, CB(handleTargetCore)); postCommand(_("target core ") + coreName, CB(handleTargetCore));
qq->breakHandler()->removeAllBreakpoints(); qq->breakHandler()->removeAllBreakpoints();
} else if (q->startMode() == StartRemote) { } else if (q->startMode() == StartRemote) {
@@ -1598,7 +1599,7 @@ bool GdbEngine::startDebugger(const QSharedPointer<DebuggerStartParameters> &sp)
//QFileInfo fi(sp->executable); //QFileInfo fi(sp->executable);
//QString fileName = fi.absoluteFileName(); //QString fileName = fi.absoluteFileName();
QString fileName = sp->executable; 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 // works only for > 6.8
postCommand(_("set target-async on"), CB(handleSetTargetAsync)); postCommand(_("set target-async on"), CB(handleSetTargetAsync));
} else if (sp->useTerminal) { } else if (sp->useTerminal) {
@@ -2800,7 +2801,7 @@ void GdbEngine::setToolTipExpression(const QPoint &mousePos,
//: Variable //: Variable
static const QString strNotInScope = 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, static void setWatchDataValue(WatchData &data, const GdbMi &mi,
@@ -3855,11 +3856,13 @@ void GdbEngine::tryLoadDebuggingHelpers()
if (!qq->qtDumperLibraryEnabled()) if (!qq->qtDumperLibraryEnabled())
return; return;
const QString lib = qq->qtDumperLibraryName(); const QString lib = qq->qtDumperLibraryName();
const QStringList &locations = qq->qtDumperLibraryLocations();
//qDebug() << "DUMPERLIB:" << lib; //qDebug() << "DUMPERLIB:" << lib;
// @TODO: same in CDB engine... // @TODO: same in CDB engine...
const QFileInfo fi(lib); const QFileInfo fi(lib);
if (!fi.exists()) { 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); debugMessage(msg);
qq->showQtDumperLibraryWarning(msg); qq->showQtDumperLibraryWarning(msg);
return; return;

View File

@@ -546,18 +546,22 @@ QList<WatchData> QtDumperResult::toWatchData(int source) const
WatchData &wchild = rc.back(); WatchData &wchild = rc.back();
wchild.source = source; wchild.source = source;
wchild.iname = iname; wchild.iname = iname;
wchild.iname += dot; // Name can be empty for array-like things
wchild.iname += dchild.name; const QString iname = dchild.name.isEmpty() ? QString::number(c) : dchild.name;
// Use key entry as name (which is used for map nodes) // Use key entry as name (which is used for map nodes)
if (dchild.key.isEmpty()) { if (dchild.key.isEmpty()) {
wchild.name = dchild.name; wchild.name = iname;
} else { } else {
// Do not use map keys as iname since they might contain quotes.
wchild.name = decodeData(dchild.key, dchild.keyEncoded); wchild.name = decodeData(dchild.key, dchild.keyEncoded);
if (wchild.name.size() > 13) { if (wchild.name.size() > 13) {
wchild.name.truncate(12); wchild.name.truncate(12);
wchild.name += QLatin1String("..."); wchild.name += QLatin1String("...");
} }
} }
// Append iname to total iname.
wchild.iname += dot;
wchild.iname += iname;
wchild.exp = dchild.exp; wchild.exp = dchild.exp;
if (dchild.valueEncountered) { if (dchild.valueEncountered) {
wchild.valuedisabled = dchild.valuedisabled; wchild.valuedisabled = dchild.valuedisabled;
@@ -1349,7 +1353,7 @@ void QtDumperHelper::evaluationParameters(const WatchData &data,
case QAbstractItemType: case QAbstractItemType:
inner = data.addr.mid(1); inner = data.addr.mid(1);
break; break;
case QVectorType: case QVectorType:
if (m_qtVersion >= 0x040600) if (m_qtVersion >= 0x040600)
extraArgs[1] = QString("(char*)&((%1).p->array)-(char*)((%2).p)") extraArgs[1] = QString("(char*)&((%1).p->array)-(char*)((%2).p)")
.arg(data.exp).arg(data.exp); .arg(data.exp).arg(data.exp);

View File

@@ -39,7 +39,7 @@
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/QSharedData> #include <QtCore/QSharedData>
static const char *uiMemberC = "m_ui"; static const char *uiMemberC = "ui";
static const char *uiNamespaceC = "Ui"; static const char *uiNamespaceC = "Ui";
static const char *formClassWizardPageGroupC = "FormClassWizardPage"; static const char *formClassWizardPageGroupC = "FormClassWizardPage";

View File

@@ -617,8 +617,10 @@ void ScriptEditor::indentBlock(QTextDocument *, QTextBlock block, QChar typedCha
{ {
TextEditor::TabSettings ts = tabSettings(); TextEditor::TabSettings ts = tabSettings();
if (typedChar == QLatin1Char('}')) { if (typedChar == QLatin1Char('}')
QTextCursor tc = textCursor(); || ((typedChar == QChar::Null) && block.text().trimmed() == "}")) {
QTextCursor tc(block);
if (TextEditor::TextBlockUserData::findPreviousBlockOpenParenthesis(&tc)) { if (TextEditor::TextBlockUserData::findPreviousBlockOpenParenthesis(&tc)) {
const QString text = tc.block().text(); const QString text = tc.block().text();
int indent = ts.columnAt(text, ts.firstNonSpace(text)); int indent = ts.columnAt(text, ts.firstNonSpace(text));

View File

@@ -1,9 +1,9 @@
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
-- --
-- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -- 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$ -- $QT_BEGIN_LICENSE:LGPL$
-- No Commercial Usage -- No Commercial Usage
@@ -34,7 +34,7 @@
-- met: http://www.gnu.org/copyleft/gpl.html. -- met: http://www.gnu.org/copyleft/gpl.html.
-- --
-- If you are unsure which license is appropriate for your use, please -- 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$ -- $QT_END_LICENSE$
-- --
-- This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -- This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
@@ -84,18 +84,24 @@
--- context keywords. --- context keywords.
%token T_PUBLIC "public" %token T_PUBLIC "public"
%token T_IMPORT "import" %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 SHIFT_THERE
%nonassoc T_IDENTIFIER T_COLON T_SIGNAL T_PROPERTY %nonassoc T_IDENTIFIER T_COLON T_SIGNAL T_PROPERTY
%nonassoc REDUCE_HERE %nonassoc REDUCE_HERE
%start UiProgram %start TopLevel
/. /.
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** 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 QtScript module of the Qt Toolkit.
** **
@@ -128,7 +134,7 @@
** met: http://www.gnu.org/copyleft/gpl.html. ** met: http://www.gnu.org/copyleft/gpl.html.
** **
** If you are unsure which license is appropriate for your use, please ** 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$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/
@@ -148,7 +154,7 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** 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 QtScript module of the Qt Toolkit.
** **
@@ -181,7 +187,7 @@
** met: http://www.gnu.org/copyleft/gpl.html. ** met: http://www.gnu.org/copyleft/gpl.html.
** **
** If you are unsure which license is appropriate for your use, please ** 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$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/
@@ -254,6 +260,7 @@ public:
AST::UiProgram *UiProgram; AST::UiProgram *UiProgram;
AST::UiImportList *UiImportList; AST::UiImportList *UiImportList;
AST::UiImport *UiImport; AST::UiImport *UiImport;
AST::UiParameterList *UiParameterList;
AST::UiPublicMember *UiPublicMember; AST::UiPublicMember *UiPublicMember;
AST::UiObjectDefinition *UiObjectDefinition; AST::UiObjectDefinition *UiObjectDefinition;
AST::UiObjectInitializer *UiObjectInitializer; AST::UiObjectInitializer *UiObjectInitializer;
@@ -270,10 +277,29 @@ public:
Parser(Engine *engine); Parser(Engine *engine);
~Parser(); ~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() AST::UiProgram *ast() const
{ return program; } { 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 QList<DiagnosticMessage> diagnosticMessages() const
{ return diagnostic_messages; } { return diagnostic_messages; }
@@ -298,6 +324,8 @@ public:
{ return diagnosticMessage().loc.startColumn; } { return diagnosticMessage().loc.startColumn; }
protected: protected:
bool parse(int startToken);
void reallocateStack(); void reallocateStack();
inline Value &sym(int index) inline Value &sym(int index)
@@ -316,7 +344,7 @@ protected:
int *state_stack; int *state_stack;
AST::SourceLocation *location_stack; AST::SourceLocation *location_stack;
AST::UiProgram *program; AST::Node *program;
// error recovery // error recovery
enum { TOKEN_BUFFER_SIZE = 3 }; enum { TOKEN_BUFFER_SIZE = 3 };
@@ -437,14 +465,16 @@ AST::UiQualifiedId *Parser::reparseAsQualifiedId(AST::ExpressionNode *expr)
return 0; return 0;
} }
bool Parser::parse() bool Parser::parse(int startToken)
{ {
Lexer *lexer = driver->lexer(); Lexer *lexer = driver->lexer();
bool hadErrors = false; bool hadErrors = false;
int yytoken = -1; int yytoken = -1;
int action = 0; 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; tos = -1;
program = 0; program = 0;
@@ -492,12 +522,35 @@ bool Parser::parse()
-- Declarative UI -- 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 ; UiProgram: UiImportListOpt UiRootMember ;
/. /.
case $rule_number: { 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(2).UiObjectMemberList->finish());
sym(1).UiProgram = program;
} break; } break;
./ ./
@@ -536,6 +589,77 @@ case $rule_number: {
} break; } 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: ; Empty: ;
/. /.
case $rule_number: { case $rule_number: {
@@ -706,6 +830,52 @@ case $rule_number: {
UiPropertyType: T_IDENTIFIER ; 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 ; UiObjectMember: T_SIGNAL T_IDENTIFIER ;
/. /.
case $rule_number: { case $rule_number: {
@@ -2843,7 +3013,8 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
} }
for (int tk = 1; tk < TERMINAL_COUNT; ++tk) { 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; continue;
int a = t_action(errorState, tk); int a = t_action(errorState, tk);

View File

@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** 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 QtScript module of the Qt Toolkit.
** **
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html. ** met: http://www.gnu.org/copyleft/gpl.html.
** **
** If you are unsure which license is appropriate for your use, please ** 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$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/

View File

@@ -1,9 +1,9 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** 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$ ** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage ** No Commercial Usage
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html. ** met: http://www.gnu.org/copyleft/gpl.html.
** **
** If you are unsure which license is appropriate for your use, please ** 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$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/
@@ -209,6 +209,7 @@ public:
Kind_UiObjectMemberList, Kind_UiObjectMemberList,
Kind_UiArrayMemberList, Kind_UiArrayMemberList,
Kind_UiProgram, Kind_UiProgram,
Kind_UiParameterList,
Kind_UiPublicMember, Kind_UiPublicMember,
Kind_UiQualifiedId, Kind_UiQualifiedId,
Kind_UiScriptBinding, Kind_UiScriptBinding,
@@ -2220,15 +2221,24 @@ public:
QMLJS_DECLARE_AST_NODE(UiImport) QMLJS_DECLARE_AST_NODE(UiImport)
UiImport(NameId *fileName) UiImport(NameId *fileName)
: fileName(fileName) : fileName(fileName), importUri(0), importId(0)
{ kind = K; }
UiImport(UiQualifiedId *uri)
: fileName(0), importUri(uri), importId(0)
{ kind = K; } { kind = K; }
virtual void accept0(Visitor *visitor); virtual void accept0(Visitor *visitor);
// attributes // attributes
NameId *fileName; NameId *fileName;
UiQualifiedId *importUri;
NameId *importId;
SourceLocation importToken; SourceLocation importToken;
SourceLocation fileNameToken; SourceLocation fileNameToken;
SourceLocation versionToken;
SourceLocation asToken;
SourceLocation importIdToken;
SourceLocation semicolonToken; SourceLocation semicolonToken;
}; };
@@ -2351,6 +2361,42 @@ public:
SourceLocation rbraceToken; 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 class UiPublicMember: public UiObjectMember
{ {
public: public:
@@ -2358,13 +2404,13 @@ public:
UiPublicMember(NameId *memberType, UiPublicMember(NameId *memberType,
NameId *name) 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; } { kind = K; }
UiPublicMember(NameId *memberType, UiPublicMember(NameId *memberType,
NameId *name, NameId *name,
ExpressionNode *expression) 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; } { kind = K; }
virtual SourceLocation firstSourceLocation() const virtual SourceLocation firstSourceLocation() const
@@ -2388,6 +2434,7 @@ public:
NameId *name; NameId *name;
ExpressionNode *expression; ExpressionNode *expression;
bool isDefaultMember; bool isDefaultMember;
UiParameterList *parameters;
SourceLocation defaultToken; SourceLocation defaultToken;
SourceLocation propertyToken; SourceLocation propertyToken;
SourceLocation typeToken; SourceLocation typeToken;

View File

@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** 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 QtScript module of the Qt Toolkit.
** **
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html. ** met: http://www.gnu.org/copyleft/gpl.html.
** **
** If you are unsure which license is appropriate for your use, please ** 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$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/

View File

@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** 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 QtScript module of the Qt Toolkit.
** **
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html. ** met: http://www.gnu.org/copyleft/gpl.html.
** **
** If you are unsure which license is appropriate for your use, please ** 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$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/

View File

@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** 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 QtScript module of the Qt Toolkit.
** **
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html. ** met: http://www.gnu.org/copyleft/gpl.html.
** **
** If you are unsure which license is appropriate for your use, please ** 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$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/

View File

@@ -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) ** $QT_BEGIN_LICENSE:LGPL$
** ** No Commercial Usage
** 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
** Licensees holding valid Qt Commercial licenses may use this file in ** contained in the either Technology Preview License Agreement or the
** accordance with the Qt Commercial License Agreement provided with the ** Beta Release License Agreement.
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
** **
** GNU Lesser General Public License Usage ** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser ** 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 ** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the ** 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 ** 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. ** 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 ** In addition, as a special exception, Nokia gives you certain
** contact the sales department at http://www.qtsoftware.com/contact. ** 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 qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qmljsengine_p.h" #include "qmljsengine_p.h"
#include "qmljsnodepool_p.h" #include "qmljsnodepool_p.h"

View File

@@ -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) ** $QT_BEGIN_LICENSE:LGPL$
** ** No Commercial Usage
** 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
** Licensees holding valid Qt Commercial licenses may use this file in ** contained in the either Technology Preview License Agreement or the
** accordance with the Qt Commercial License Agreement provided with the ** Beta Release License Agreement.
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
** **
** GNU Lesser General Public License Usage ** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser ** 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 ** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the ** 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 ** 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. ** 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 ** In addition, as a special exception, Nokia gives you certain
** contact the sales department at http://www.qtsoftware.com/contact. ** 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 qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QMLJSENGINE_P_H #ifndef QMLJSENGINE_P_H
#define 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 <QString>
#include <QSet> #include <QSet>

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** 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. ** This file is part of the QtCore module of the Qt Toolkit.
** **
@@ -35,7 +35,7 @@
** met: http://www.gnu.org/copyleft/gpl.html. ** met: http://www.gnu.org/copyleft/gpl.html.
** **
** If you are unsure which license is appropriate for your use, please ** 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$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/
@@ -59,11 +59,12 @@ class QmlJSGrammar
public: public:
enum { enum {
EOF_SYMBOL = 0, EOF_SYMBOL = 0,
REDUCE_HERE = 90, REDUCE_HERE = 94,
SHIFT_THERE = 89, SHIFT_THERE = 93,
T_AND = 1, T_AND = 1,
T_AND_AND = 2, T_AND_AND = 2,
T_AND_EQ = 3, T_AND_EQ = 3,
T_AS = 89,
T_AUTOMATIC_SEMICOLON = 62, T_AUTOMATIC_SEMICOLON = 62,
T_BREAK = 4, T_BREAK = 4,
T_CASE = 5, T_CASE = 5,
@@ -84,6 +85,9 @@ public:
T_EQ_EQ = 18, T_EQ_EQ = 18,
T_EQ_EQ_EQ = 19, T_EQ_EQ_EQ = 19,
T_FALSE = 82, T_FALSE = 82,
T_FEED_JS_EXPRESSION = 92,
T_FEED_JS_STATEMENT = 91,
T_FEED_UI_PROGRAM = 90,
T_FINALLY = 20, T_FINALLY = 20,
T_FOR = 21, T_FOR = 21,
T_FUNCTION = 22, T_FUNCTION = 22,
@@ -150,15 +154,15 @@ public:
T_XOR = 78, T_XOR = 78,
T_XOR_EQ = 79, T_XOR_EQ = 79,
ACCEPT_STATE = 588, ACCEPT_STATE = 621,
RULE_COUNT = 323, RULE_COUNT = 341,
STATE_COUNT = 589, STATE_COUNT = 622,
TERMINAL_COUNT = 91, TERMINAL_COUNT = 95,
NON_TERMINAL_COUNT = 102, NON_TERMINAL_COUNT = 105,
GOTO_INDEX_OFFSET = 589, GOTO_INDEX_OFFSET = 622,
GOTO_INFO_OFFSET = 2092, GOTO_INFO_OFFSET = 2247,
GOTO_CHECK_OFFSET = 2092 GOTO_CHECK_OFFSET = 2247
}; };
static const char *const spell []; static const char *const spell [];

View File

@@ -1,9 +1,9 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** 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$ ** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage ** No Commercial Usage
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html. ** met: http://www.gnu.org/copyleft/gpl.html.
** **
** If you are unsure which license is appropriate for your use, please ** 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$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/
@@ -159,6 +159,8 @@ int Lexer::findReservedWord(const QChar *c, int size) const
return QmlJSGrammar::T_IF; return QmlJSGrammar::T_IF;
else if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('n')) else if (c[0] == QLatin1Char('i') && c[1] == QLatin1Char('n'))
return QmlJSGrammar::T_IN; return QmlJSGrammar::T_IN;
else if (c[0] == QLatin1Char('a') && c[1] == QLatin1Char('s'))
return QmlJSGrammar::T_AS;
} break; } break;
case 3: { case 3: {

View File

@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** 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 QtScript module of the Qt Toolkit.
** **
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html. ** met: http://www.gnu.org/copyleft/gpl.html.
** **
** If you are unsure which license is appropriate for your use, please ** 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$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/

View File

@@ -1,9 +1,9 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** 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$ ** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage ** No Commercial Usage
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html. ** met: http://www.gnu.org/copyleft/gpl.html.
** **
** If you are unsure which license is appropriate for your use, please ** 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$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/

View File

@@ -1,9 +1,9 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** 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$ ** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage ** No Commercial Usage
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html. ** met: http://www.gnu.org/copyleft/gpl.html.
** **
** If you are unsure which license is appropriate for your use, please ** 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$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** 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 QtScript module of the Qt Toolkit.
** **
@@ -36,7 +36,7 @@
** met: http://www.gnu.org/copyleft/gpl.html. ** met: http://www.gnu.org/copyleft/gpl.html.
** **
** If you are unsure which license is appropriate for your use, please ** 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$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/
@@ -109,6 +109,7 @@ public:
AST::UiProgram *UiProgram; AST::UiProgram *UiProgram;
AST::UiImportList *UiImportList; AST::UiImportList *UiImportList;
AST::UiImport *UiImport; AST::UiImport *UiImport;
AST::UiParameterList *UiParameterList;
AST::UiPublicMember *UiPublicMember; AST::UiPublicMember *UiPublicMember;
AST::UiObjectDefinition *UiObjectDefinition; AST::UiObjectDefinition *UiObjectDefinition;
AST::UiObjectInitializer *UiObjectInitializer; AST::UiObjectInitializer *UiObjectInitializer;
@@ -125,10 +126,29 @@ public:
Parser(Engine *engine); Parser(Engine *engine);
~Parser(); ~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() AST::UiProgram *ast() const
{ return program; } { 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 QList<DiagnosticMessage> diagnosticMessages() const
{ return diagnostic_messages; } { return diagnostic_messages; }
@@ -153,6 +173,8 @@ public:
{ return diagnosticMessage().loc.startColumn; } { return diagnosticMessage().loc.startColumn; }
protected: protected:
bool parse(int startToken);
void reallocateStack(); void reallocateStack();
inline Value &sym(int index) inline Value &sym(int index)
@@ -171,7 +193,7 @@ protected:
int *state_stack; int *state_stack;
AST::SourceLocation *location_stack; AST::SourceLocation *location_stack;
AST::UiProgram *program; AST::Node *program;
// error recovery // error recovery
enum { TOKEN_BUFFER_SIZE = 3 }; 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 QT_END_NAMESPACE

View File

@@ -1,9 +1,9 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** 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$ ** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage ** No Commercial Usage
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html. ** met: http://www.gnu.org/copyleft/gpl.html.
** **
** If you are unsure which license is appropriate for your use, please ** 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$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/
@@ -170,14 +170,14 @@ void PrettyPretty::accept(AST::Node *node)
bool PrettyPretty::visit(AST::ThisExpression *node) bool PrettyPretty::visit(AST::ThisExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
out << "this"; out << "this";
return true; return true;
} }
void PrettyPretty::endVisit(AST::ThisExpression *node) void PrettyPretty::endVisit(AST::ThisExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::IdentifierExpression *node) bool PrettyPretty::visit(AST::IdentifierExpression *node)
@@ -188,43 +188,43 @@ bool PrettyPretty::visit(AST::IdentifierExpression *node)
void PrettyPretty::endVisit(AST::IdentifierExpression *node) void PrettyPretty::endVisit(AST::IdentifierExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::NullExpression *node) bool PrettyPretty::visit(AST::NullExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
out << "null"; out << "null";
return false; return false;
} }
void PrettyPretty::endVisit(AST::NullExpression *node) void PrettyPretty::endVisit(AST::NullExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::TrueLiteral *node) bool PrettyPretty::visit(AST::TrueLiteral *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
out << "true"; out << "true";
return false; return false;
} }
void PrettyPretty::endVisit(AST::TrueLiteral *node) void PrettyPretty::endVisit(AST::TrueLiteral *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::FalseLiteral *node) bool PrettyPretty::visit(AST::FalseLiteral *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
out << "false"; out << "false";
return false; return false;
} }
void PrettyPretty::endVisit(AST::FalseLiteral *node) void PrettyPretty::endVisit(AST::FalseLiteral *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::StringLiteral *node) bool PrettyPretty::visit(AST::StringLiteral *node)
@@ -237,7 +237,7 @@ bool PrettyPretty::visit(AST::StringLiteral *node)
void PrettyPretty::endVisit(AST::StringLiteral *node) void PrettyPretty::endVisit(AST::StringLiteral *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::NumericLiteral *node) bool PrettyPretty::visit(AST::NumericLiteral *node)
@@ -248,7 +248,7 @@ bool PrettyPretty::visit(AST::NumericLiteral *node)
void PrettyPretty::endVisit(AST::NumericLiteral *node) void PrettyPretty::endVisit(AST::NumericLiteral *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::RegExpLiteral *node) bool PrettyPretty::visit(AST::RegExpLiteral *node)
@@ -262,7 +262,7 @@ bool PrettyPretty::visit(AST::RegExpLiteral *node)
void PrettyPretty::endVisit(AST::RegExpLiteral *node) void PrettyPretty::endVisit(AST::RegExpLiteral *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::ArrayLiteral *node) bool PrettyPretty::visit(AST::ArrayLiteral *node)
@@ -276,7 +276,7 @@ bool PrettyPretty::visit(AST::ArrayLiteral *node)
void PrettyPretty::endVisit(AST::ArrayLiteral *node) void PrettyPretty::endVisit(AST::ArrayLiteral *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::ObjectLiteral *node) bool PrettyPretty::visit(AST::ObjectLiteral *node)
@@ -300,7 +300,7 @@ bool PrettyPretty::visit(AST::ObjectLiteral *node)
void PrettyPretty::endVisit(AST::ObjectLiteral *node) void PrettyPretty::endVisit(AST::ObjectLiteral *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::ElementList *node) bool PrettyPretty::visit(AST::ElementList *node)
@@ -317,7 +317,7 @@ bool PrettyPretty::visit(AST::ElementList *node)
void PrettyPretty::endVisit(AST::ElementList *node) void PrettyPretty::endVisit(AST::ElementList *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::Elision *node) bool PrettyPretty::visit(AST::Elision *node)
@@ -330,7 +330,7 @@ bool PrettyPretty::visit(AST::Elision *node)
void PrettyPretty::endVisit(AST::Elision *node) void PrettyPretty::endVisit(AST::Elision *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::PropertyNameAndValueList *node) bool PrettyPretty::visit(AST::PropertyNameAndValueList *node)
@@ -343,7 +343,7 @@ bool PrettyPretty::visit(AST::PropertyNameAndValueList *node)
void PrettyPretty::endVisit(AST::PropertyNameAndValueList *node) void PrettyPretty::endVisit(AST::PropertyNameAndValueList *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::IdentifierPropertyName *node) bool PrettyPretty::visit(AST::IdentifierPropertyName *node)
@@ -354,7 +354,7 @@ bool PrettyPretty::visit(AST::IdentifierPropertyName *node)
void PrettyPretty::endVisit(AST::IdentifierPropertyName *node) void PrettyPretty::endVisit(AST::IdentifierPropertyName *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::StringLiteralPropertyName *node) bool PrettyPretty::visit(AST::StringLiteralPropertyName *node)
@@ -367,7 +367,7 @@ bool PrettyPretty::visit(AST::StringLiteralPropertyName *node)
void PrettyPretty::endVisit(AST::StringLiteralPropertyName *node) void PrettyPretty::endVisit(AST::StringLiteralPropertyName *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::NumericLiteralPropertyName *node) bool PrettyPretty::visit(AST::NumericLiteralPropertyName *node)
@@ -378,7 +378,7 @@ bool PrettyPretty::visit(AST::NumericLiteralPropertyName *node)
void PrettyPretty::endVisit(AST::NumericLiteralPropertyName *node) void PrettyPretty::endVisit(AST::NumericLiteralPropertyName *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::ArrayMemberExpression *node) bool PrettyPretty::visit(AST::ArrayMemberExpression *node)
@@ -392,7 +392,7 @@ bool PrettyPretty::visit(AST::ArrayMemberExpression *node)
void PrettyPretty::endVisit(AST::ArrayMemberExpression *node) void PrettyPretty::endVisit(AST::ArrayMemberExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::FieldMemberExpression *node) bool PrettyPretty::visit(AST::FieldMemberExpression *node)
@@ -404,7 +404,7 @@ bool PrettyPretty::visit(AST::FieldMemberExpression *node)
void PrettyPretty::endVisit(AST::FieldMemberExpression *node) void PrettyPretty::endVisit(AST::FieldMemberExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::NewMemberExpression *node) bool PrettyPretty::visit(AST::NewMemberExpression *node)
@@ -419,19 +419,19 @@ bool PrettyPretty::visit(AST::NewMemberExpression *node)
void PrettyPretty::endVisit(AST::NewMemberExpression *node) void PrettyPretty::endVisit(AST::NewMemberExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::NewExpression *node) bool PrettyPretty::visit(AST::NewExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
out << "new "; out << "new ";
return true; return true;
} }
void PrettyPretty::endVisit(AST::NewExpression *node) void PrettyPretty::endVisit(AST::NewExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::CallExpression *node) bool PrettyPretty::visit(AST::CallExpression *node)
@@ -445,7 +445,7 @@ bool PrettyPretty::visit(AST::CallExpression *node)
void PrettyPretty::endVisit(AST::CallExpression *node) void PrettyPretty::endVisit(AST::CallExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::ArgumentList *node) bool PrettyPretty::visit(AST::ArgumentList *node)
@@ -460,91 +460,91 @@ bool PrettyPretty::visit(AST::ArgumentList *node)
void PrettyPretty::endVisit(AST::ArgumentList *node) void PrettyPretty::endVisit(AST::ArgumentList *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::PostIncrementExpression *node) bool PrettyPretty::visit(AST::PostIncrementExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
return true; return true;
} }
void PrettyPretty::endVisit(AST::PostIncrementExpression *node) void PrettyPretty::endVisit(AST::PostIncrementExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
out << "++"; out << "++";
} }
bool PrettyPretty::visit(AST::PostDecrementExpression *node) bool PrettyPretty::visit(AST::PostDecrementExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
return true; return true;
} }
void PrettyPretty::endVisit(AST::PostDecrementExpression *node) void PrettyPretty::endVisit(AST::PostDecrementExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
out << "--"; out << "--";
} }
bool PrettyPretty::visit(AST::DeleteExpression *node) bool PrettyPretty::visit(AST::DeleteExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
out << "delete "; out << "delete ";
return true; return true;
} }
void PrettyPretty::endVisit(AST::DeleteExpression *node) void PrettyPretty::endVisit(AST::DeleteExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::VoidExpression *node) bool PrettyPretty::visit(AST::VoidExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
out << "void "; out << "void ";
return true; return true;
} }
void PrettyPretty::endVisit(AST::VoidExpression *node) void PrettyPretty::endVisit(AST::VoidExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::TypeOfExpression *node) bool PrettyPretty::visit(AST::TypeOfExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
out << "typeof "; out << "typeof ";
return true; return true;
} }
void PrettyPretty::endVisit(AST::TypeOfExpression *node) void PrettyPretty::endVisit(AST::TypeOfExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::PreIncrementExpression *node) bool PrettyPretty::visit(AST::PreIncrementExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
out << "++"; out << "++";
return true; return true;
} }
void PrettyPretty::endVisit(AST::PreIncrementExpression *node) void PrettyPretty::endVisit(AST::PreIncrementExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::PreDecrementExpression *node) bool PrettyPretty::visit(AST::PreDecrementExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
out << "--"; out << "--";
return true; return true;
} }
void PrettyPretty::endVisit(AST::PreDecrementExpression *node) void PrettyPretty::endVisit(AST::PreDecrementExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::UnaryPlusExpression *node) bool PrettyPretty::visit(AST::UnaryPlusExpression *node)
@@ -561,7 +561,7 @@ bool PrettyPretty::visit(AST::UnaryPlusExpression *node)
void PrettyPretty::endVisit(AST::UnaryPlusExpression *node) void PrettyPretty::endVisit(AST::UnaryPlusExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::UnaryMinusExpression *node) bool PrettyPretty::visit(AST::UnaryMinusExpression *node)
@@ -578,7 +578,7 @@ bool PrettyPretty::visit(AST::UnaryMinusExpression *node)
void PrettyPretty::endVisit(AST::UnaryMinusExpression *node) void PrettyPretty::endVisit(AST::UnaryMinusExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::TildeExpression *node) bool PrettyPretty::visit(AST::TildeExpression *node)
@@ -595,7 +595,7 @@ bool PrettyPretty::visit(AST::TildeExpression *node)
void PrettyPretty::endVisit(AST::TildeExpression *node) void PrettyPretty::endVisit(AST::TildeExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::NotExpression *node) bool PrettyPretty::visit(AST::NotExpression *node)
@@ -612,7 +612,7 @@ bool PrettyPretty::visit(AST::NotExpression *node)
void PrettyPretty::endVisit(AST::NotExpression *node) void PrettyPretty::endVisit(AST::NotExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::BinaryExpression *node) bool PrettyPretty::visit(AST::BinaryExpression *node)
@@ -712,7 +712,7 @@ bool PrettyPretty::visit(AST::BinaryExpression *node)
void PrettyPretty::endVisit(AST::BinaryExpression *node) void PrettyPretty::endVisit(AST::BinaryExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::ConditionalExpression *node) bool PrettyPretty::visit(AST::ConditionalExpression *node)
@@ -727,7 +727,7 @@ bool PrettyPretty::visit(AST::ConditionalExpression *node)
void PrettyPretty::endVisit(AST::ConditionalExpression *node) void PrettyPretty::endVisit(AST::ConditionalExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::Expression *node) bool PrettyPretty::visit(AST::Expression *node)
@@ -740,18 +740,18 @@ bool PrettyPretty::visit(AST::Expression *node)
void PrettyPretty::endVisit(AST::Expression *node) void PrettyPretty::endVisit(AST::Expression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::Block *node) bool PrettyPretty::visit(AST::Block *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
return true; return true;
} }
void PrettyPretty::endVisit(AST::Block *node) void PrettyPretty::endVisit(AST::Block *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::StatementList *node) bool PrettyPretty::visit(AST::StatementList *node)
@@ -766,7 +766,7 @@ bool PrettyPretty::visit(AST::StatementList *node)
void PrettyPretty::endVisit(AST::StatementList *node) void PrettyPretty::endVisit(AST::StatementList *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::VariableDeclarationList *node) bool PrettyPretty::visit(AST::VariableDeclarationList *node)
@@ -785,19 +785,19 @@ bool PrettyPretty::visit(AST::VariableDeclarationList *node)
void PrettyPretty::endVisit(AST::VariableDeclarationList *node) void PrettyPretty::endVisit(AST::VariableDeclarationList *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::VariableStatement *node) bool PrettyPretty::visit(AST::VariableStatement *node)
{ {
out << "var "; out << "var ";
Q_UNUSED(node) Q_UNUSED(node);
return true; return true;
} }
void PrettyPretty::endVisit(AST::VariableStatement *node) void PrettyPretty::endVisit(AST::VariableStatement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
out << ";"; out << ";";
} }
@@ -813,19 +813,19 @@ bool PrettyPretty::visit(AST::VariableDeclaration *node)
void PrettyPretty::endVisit(AST::VariableDeclaration *node) void PrettyPretty::endVisit(AST::VariableDeclaration *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::EmptyStatement *node) bool PrettyPretty::visit(AST::EmptyStatement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
out << ";"; out << ";";
return true; return true;
} }
void PrettyPretty::endVisit(AST::EmptyStatement *node) void PrettyPretty::endVisit(AST::EmptyStatement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::ExpressionStatement *node) bool PrettyPretty::visit(AST::ExpressionStatement *node)
@@ -837,7 +837,7 @@ bool PrettyPretty::visit(AST::ExpressionStatement *node)
void PrettyPretty::endVisit(AST::ExpressionStatement *node) void PrettyPretty::endVisit(AST::ExpressionStatement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::IfStatement *node) bool PrettyPretty::visit(AST::IfStatement *node)
@@ -855,7 +855,7 @@ bool PrettyPretty::visit(AST::IfStatement *node)
void PrettyPretty::endVisit(AST::IfStatement *node) void PrettyPretty::endVisit(AST::IfStatement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::DoWhileStatement *node) bool PrettyPretty::visit(AST::DoWhileStatement *node)
@@ -870,7 +870,7 @@ bool PrettyPretty::visit(AST::DoWhileStatement *node)
void PrettyPretty::endVisit(AST::DoWhileStatement *node) void PrettyPretty::endVisit(AST::DoWhileStatement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::WhileStatement *node) bool PrettyPretty::visit(AST::WhileStatement *node)
@@ -884,7 +884,7 @@ bool PrettyPretty::visit(AST::WhileStatement *node)
void PrettyPretty::endVisit(AST::WhileStatement *node) void PrettyPretty::endVisit(AST::WhileStatement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::ForStatement *node) bool PrettyPretty::visit(AST::ForStatement *node)
@@ -902,7 +902,7 @@ bool PrettyPretty::visit(AST::ForStatement *node)
void PrettyPretty::endVisit(AST::ForStatement *node) void PrettyPretty::endVisit(AST::ForStatement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::LocalForStatement *node) bool PrettyPretty::visit(AST::LocalForStatement *node)
@@ -920,7 +920,7 @@ bool PrettyPretty::visit(AST::LocalForStatement *node)
void PrettyPretty::endVisit(AST::LocalForStatement *node) void PrettyPretty::endVisit(AST::LocalForStatement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::ForEachStatement *node) bool PrettyPretty::visit(AST::ForEachStatement *node)
@@ -936,7 +936,7 @@ bool PrettyPretty::visit(AST::ForEachStatement *node)
void PrettyPretty::endVisit(AST::ForEachStatement *node) void PrettyPretty::endVisit(AST::ForEachStatement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::LocalForEachStatement *node) bool PrettyPretty::visit(AST::LocalForEachStatement *node)
@@ -952,7 +952,7 @@ bool PrettyPretty::visit(AST::LocalForEachStatement *node)
void PrettyPretty::endVisit(AST::LocalForEachStatement *node) void PrettyPretty::endVisit(AST::LocalForEachStatement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::ContinueStatement *node) bool PrettyPretty::visit(AST::ContinueStatement *node)
@@ -967,7 +967,7 @@ bool PrettyPretty::visit(AST::ContinueStatement *node)
void PrettyPretty::endVisit(AST::ContinueStatement *node) void PrettyPretty::endVisit(AST::ContinueStatement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::BreakStatement *node) bool PrettyPretty::visit(AST::BreakStatement *node)
@@ -982,7 +982,7 @@ bool PrettyPretty::visit(AST::BreakStatement *node)
void PrettyPretty::endVisit(AST::BreakStatement *node) void PrettyPretty::endVisit(AST::BreakStatement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::ReturnStatement *node) bool PrettyPretty::visit(AST::ReturnStatement *node)
@@ -998,7 +998,7 @@ bool PrettyPretty::visit(AST::ReturnStatement *node)
void PrettyPretty::endVisit(AST::ReturnStatement *node) void PrettyPretty::endVisit(AST::ReturnStatement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::WithStatement *node) bool PrettyPretty::visit(AST::WithStatement *node)
@@ -1012,7 +1012,7 @@ bool PrettyPretty::visit(AST::WithStatement *node)
void PrettyPretty::endVisit(AST::WithStatement *node) void PrettyPretty::endVisit(AST::WithStatement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::SwitchStatement *node) bool PrettyPretty::visit(AST::SwitchStatement *node)
@@ -1026,7 +1026,7 @@ bool PrettyPretty::visit(AST::SwitchStatement *node)
void PrettyPretty::endVisit(AST::SwitchStatement *node) void PrettyPretty::endVisit(AST::SwitchStatement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::CaseBlock *node) bool PrettyPretty::visit(AST::CaseBlock *node)
@@ -1045,7 +1045,7 @@ bool PrettyPretty::visit(AST::CaseBlock *node)
void PrettyPretty::endVisit(AST::CaseBlock *node) void PrettyPretty::endVisit(AST::CaseBlock *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::CaseClauses *node) bool PrettyPretty::visit(AST::CaseClauses *node)
@@ -1060,7 +1060,7 @@ bool PrettyPretty::visit(AST::CaseClauses *node)
void PrettyPretty::endVisit(AST::CaseClauses *node) void PrettyPretty::endVisit(AST::CaseClauses *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::CaseClause *node) bool PrettyPretty::visit(AST::CaseClause *node)
@@ -1077,12 +1077,12 @@ bool PrettyPretty::visit(AST::CaseClause *node)
void PrettyPretty::endVisit(AST::CaseClause *node) void PrettyPretty::endVisit(AST::CaseClause *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::DefaultClause *node) bool PrettyPretty::visit(AST::DefaultClause *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
out << "default:"; out << "default:";
newlineAndIndent(); newlineAndIndent();
return true; return true;
@@ -1090,7 +1090,7 @@ bool PrettyPretty::visit(AST::DefaultClause *node)
void PrettyPretty::endVisit(AST::DefaultClause *node) void PrettyPretty::endVisit(AST::DefaultClause *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::LabelledStatement *node) bool PrettyPretty::visit(AST::LabelledStatement *node)
@@ -1101,12 +1101,12 @@ bool PrettyPretty::visit(AST::LabelledStatement *node)
void PrettyPretty::endVisit(AST::LabelledStatement *node) void PrettyPretty::endVisit(AST::LabelledStatement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::ThrowStatement *node) bool PrettyPretty::visit(AST::ThrowStatement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
out << "throw "; out << "throw ";
accept(node->expression); accept(node->expression);
out << ";"; out << ";";
@@ -1115,7 +1115,7 @@ bool PrettyPretty::visit(AST::ThrowStatement *node)
void PrettyPretty::endVisit(AST::ThrowStatement *node) void PrettyPretty::endVisit(AST::ThrowStatement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::TryStatement *node) bool PrettyPretty::visit(AST::TryStatement *node)
@@ -1135,30 +1135,30 @@ bool PrettyPretty::visit(AST::TryStatement *node)
void PrettyPretty::endVisit(AST::TryStatement *node) void PrettyPretty::endVisit(AST::TryStatement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::Catch *node) bool PrettyPretty::visit(AST::Catch *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
return true; return true;
} }
void PrettyPretty::endVisit(AST::Catch *node) void PrettyPretty::endVisit(AST::Catch *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::Finally *node) bool PrettyPretty::visit(AST::Finally *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
out << "finally "; out << "finally ";
return true; return true;
} }
void PrettyPretty::endVisit(AST::Finally *node) void PrettyPretty::endVisit(AST::Finally *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::FunctionDeclaration *node) bool PrettyPretty::visit(AST::FunctionDeclaration *node)
@@ -1197,7 +1197,7 @@ bool PrettyPretty::visit(AST::FunctionDeclaration *node)
void PrettyPretty::endVisit(AST::FunctionDeclaration *node) void PrettyPretty::endVisit(AST::FunctionDeclaration *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::FunctionExpression *node) bool PrettyPretty::visit(AST::FunctionExpression *node)
@@ -1236,45 +1236,45 @@ bool PrettyPretty::visit(AST::FunctionExpression *node)
void PrettyPretty::endVisit(AST::FunctionExpression *node) void PrettyPretty::endVisit(AST::FunctionExpression *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::FormalParameterList *node) bool PrettyPretty::visit(AST::FormalParameterList *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
return true; return true;
} }
void PrettyPretty::endVisit(AST::FormalParameterList *node) void PrettyPretty::endVisit(AST::FormalParameterList *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::FunctionBody *node) bool PrettyPretty::visit(AST::FunctionBody *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
return true; return true;
} }
void PrettyPretty::endVisit(AST::FunctionBody *node) void PrettyPretty::endVisit(AST::FunctionBody *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::Program *node) bool PrettyPretty::visit(AST::Program *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
return true; return true;
} }
void PrettyPretty::endVisit(AST::Program *node) void PrettyPretty::endVisit(AST::Program *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::SourceElements *node) bool PrettyPretty::visit(AST::SourceElements *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
accept(node->element); accept(node->element);
for (node = node->next; node != 0; node = node->next) { for (node = node->next; node != 0; node = node->next) {
newlineAndIndent(); newlineAndIndent();
@@ -1285,47 +1285,47 @@ bool PrettyPretty::visit(AST::SourceElements *node)
void PrettyPretty::endVisit(AST::SourceElements *node) void PrettyPretty::endVisit(AST::SourceElements *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::FunctionSourceElement *node) bool PrettyPretty::visit(AST::FunctionSourceElement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
return true; return true;
} }
void PrettyPretty::endVisit(AST::FunctionSourceElement *node) void PrettyPretty::endVisit(AST::FunctionSourceElement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::StatementSourceElement *node) bool PrettyPretty::visit(AST::StatementSourceElement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
return true; return true;
} }
void PrettyPretty::endVisit(AST::StatementSourceElement *node) void PrettyPretty::endVisit(AST::StatementSourceElement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
} }
bool PrettyPretty::visit(AST::DebuggerStatement *node) bool PrettyPretty::visit(AST::DebuggerStatement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
out << "debugger"; out << "debugger";
return true; return true;
} }
void PrettyPretty::endVisit(AST::DebuggerStatement *node) void PrettyPretty::endVisit(AST::DebuggerStatement *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
out << ";"; out << ";";
} }
bool PrettyPretty::preVisit(AST::Node *node) bool PrettyPretty::preVisit(AST::Node *node)
{ {
Q_UNUSED(node) Q_UNUSED(node);
return true; return true;
} }

View File

@@ -1,9 +1,9 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** 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$ ** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage ** No Commercial Usage
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html. ** met: http://www.gnu.org/copyleft/gpl.html.
** **
** If you are unsure which license is appropriate for your use, please ** 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$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/

View File

@@ -216,7 +216,8 @@ int BaseTextFind::replaceAll(const QString &before, const QString &after,
regexp.setPatternSyntax(usesRegExp ? QRegExp::RegExp : QRegExp::FixedString); regexp.setPatternSyntax(usesRegExp ? QRegExp::RegExp : QRegExp::FixedString);
regexp.setCaseSensitivity((findFlags & IFindSupport::FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive); regexp.setCaseSensitivity((findFlags & IFindSupport::FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive);
QTextCursor found = document()->find(regexp, editCursor, IFindSupport::textDocumentFlagsForFindFlags(findFlags)); 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; ++count;
editCursor.setPosition(found.selectionStart()); editCursor.setPosition(found.selectionStart());
editCursor.setPosition(found.selectionEnd(), QTextCursor::KeepAnchor); editCursor.setPosition(found.selectionEnd(), QTextCursor::KeepAnchor);

View File

@@ -1 +1,2 @@
include(../../plugins/coreplugin/coreplugin.pri) include(../../plugins/coreplugin/coreplugin.pri)
include(../../libs/utils/utils.pri)

View File

@@ -34,12 +34,11 @@
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/findplaceholder.h> #include <coreplugin/findplaceholder.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/stylehelper.h>
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h> #include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/command.h> #include <coreplugin/actionmanager/command.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <utils/stylehelper.h>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/QSettings> #include <QtCore/QSettings>
@@ -49,9 +48,10 @@
#include <QtGui/QKeyEvent> #include <QtGui/QKeyEvent>
#include <QtGui/QLineEdit> #include <QtGui/QLineEdit>
#include <QtGui/QMenu> #include <QtGui/QMenu>
#include <QtGui/QPainter>
#include <QtGui/QPushButton> #include <QtGui/QPushButton>
#include <QtGui/QToolButton> #include <QtGui/QToolButton>
#include <QtGui/QPainter>
#include <QtGui/QPixmapCache>
Q_DECLARE_METATYPE(QStringList) Q_DECLARE_METATYPE(QStringList)
Q_DECLARE_METATYPE(Find::IFindFilter*) Q_DECLARE_METATYPE(Find::IFindFilter*)
@@ -68,14 +68,12 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
m_findNextAction(0), m_findNextAction(0),
m_findPreviousAction(0), m_findPreviousAction(0),
m_replaceNextAction(0), m_replaceNextAction(0),
m_widget(new QWidget),
m_casesensitiveIcon(":/find/images/casesensitively.png"), m_casesensitiveIcon(":/find/images/casesensitively.png"),
m_regexpIcon(":/find/images/regexp.png"), m_regexpIcon(":/find/images/regexp.png"),
m_wholewordsIcon(":/find/images/wholewords.png") m_wholewordsIcon(":/find/images/wholewords.png")
{ {
//setup ui //setup ui
m_ui.setupUi(m_widget); m_ui.setupUi(this);
addWidget(m_widget);
setFocusProxy(m_ui.findEdit); setFocusProxy(m_ui.findEdit);
setProperty("topBorder", true); setProperty("topBorder", true);
m_ui.findEdit->setAttribute(Qt::WA_MacShowFocusRect, false); 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())); connect(m_ui.findEdit, SIGNAL(editingFinished()), this, SLOT(invokeResetIncrementalSearch()));
QWidget *spacerItem = new QWidget; m_ui.close->setProperty("type", QLatin1String("dockbutton"));
spacerItem->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); m_ui.close->setIcon(QIcon(":/core/images/closebutton.png"));
addWidget(spacerItem); connect(m_ui.close, SIGNAL(clicked()), this, SLOT(hideAndResetFocus()));
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.findPreviousButton->setProperty("type", QLatin1String("dockbutton")); m_ui.findPreviousButton->setProperty("type", QLatin1String("dockbutton"));
m_ui.findNextButton->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.findEdit->installEventFilter(this);
m_ui.replaceEdit->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(textChanged(const QString&)), this, SLOT(invokeFindIncremental()));
connect(m_ui.findEdit, SIGNAL(returnPressed()), this, SLOT(invokeFindEnter())); connect(m_ui.findEdit, SIGNAL(returnPressed()), this, SLOT(invokeFindEnter()));
@@ -251,7 +244,7 @@ bool FindToolBar::eventFilter(QObject *obj, QEvent *event)
return true; 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); QKeyEvent *ke = static_cast<QKeyEvent *>(event);
if (ke->key() == Qt::Key_Escape && !ke->modifiers() if (ke->key() == Qt::Key_Escape && !ke->modifiers()
&& !m_findCompleter->popup()->isVisible() && !m_findCompleter->popup()->isVisible()
@@ -268,13 +261,13 @@ bool FindToolBar::eventFilter(QObject *obj, QEvent *event)
event->accept(); event->accept();
return true; return true;
} }
} else if (obj == m_widget && event->type() == QEvent::Hide) { } else if (obj == this && event->type() == QEvent::Hide) {
invokeClearResults(); invokeClearResults();
if (m_currentDocumentFind->isEnabled()) { if (m_currentDocumentFind->isEnabled()) {
m_currentDocumentFind->clearFindScope(); m_currentDocumentFind->clearFindScope();
} }
} }
return QToolBar::eventFilter(obj, event); return Core::Utils::StyledBar::eventFilter(obj, event);
} }
void FindToolBar::updateActions() void FindToolBar::updateActions()
@@ -284,9 +277,11 @@ void FindToolBar::updateActions()
m_findInDocumentAction->setEnabled(enabled); m_findInDocumentAction->setEnabled(enabled);
m_findNextAction->setEnabled(enabled); m_findNextAction->setEnabled(enabled);
m_findPreviousAction->setEnabled(enabled); m_findPreviousAction->setEnabled(enabled);
m_replaceNextAction->setEnabled(replaceEnabled); m_replaceNextAction->setEnabled(replaceEnabled);
m_replacePreviousAction->setEnabled(replaceEnabled); m_replacePreviousAction->setEnabled(replaceEnabled);
m_replaceAllAction->setEnabled(replaceEnabled); m_replaceAllAction->setEnabled(replaceEnabled);
m_caseSensitiveAction->setEnabled(enabled); m_caseSensitiveAction->setEnabled(enabled);
m_wholeWordAction->setEnabled(enabled); m_wholeWordAction->setEnabled(enabled);
m_regularExpressionAction->setEnabled(enabled); m_regularExpressionAction->setEnabled(enabled);
@@ -295,8 +290,16 @@ void FindToolBar::updateActions()
bool replaceFocus = m_ui.replaceEdit->hasFocus(); bool replaceFocus = m_ui.replaceEdit->hasFocus();
m_ui.findEdit->setEnabled(enabled); m_ui.findEdit->setEnabled(enabled);
m_ui.findLabel->setEnabled(enabled); m_ui.findLabel->setEnabled(enabled);
m_ui.replaceEdit->setEnabled(replaceEnabled); m_ui.replaceEdit->setEnabled(replaceEnabled);
m_ui.replaceLabel->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) if (!replaceEnabled && enabled && replaceFocus)
m_ui.findEdit->setFocus(); m_ui.findEdit->setFocus();
updateIcons(); updateIcons();
@@ -540,7 +543,7 @@ bool FindToolBar::focusNextPrevChild(bool next)
else if (!next && m_ui.findEdit->hasFocus()) else if (!next && m_ui.findEdit->hasFocus())
m_ui.replaceAllButton->setFocus(Qt::TabFocusReason); m_ui.replaceAllButton->setFocus(Qt::TabFocusReason);
else else
return QToolBar::focusNextPrevChild(next); return Core::Utils::StyledBar::focusNextPrevChild(next);
return true; return true;
} }

View File

@@ -34,6 +34,8 @@
#include "ifindfilter.h" #include "ifindfilter.h"
#include "currentdocumentfind.h" #include "currentdocumentfind.h"
#include <utils/styledbar.h>
#include <QtGui/QStringListModel> #include <QtGui/QStringListModel>
#include <QtGui/QWidget> #include <QtGui/QWidget>
#include <QtGui/QToolBar> #include <QtGui/QToolBar>
@@ -44,7 +46,7 @@ namespace Internal {
class FindPlugin; class FindPlugin;
class FindToolBar : public QToolBar class FindToolBar : public Core::Utils::StyledBar
{ {
Q_OBJECT Q_OBJECT
@@ -113,7 +115,6 @@ private:
QAction *m_caseSensitiveAction; QAction *m_caseSensitiveAction;
QAction *m_wholeWordAction; QAction *m_wholeWordAction;
QAction *m_regularExpressionAction; QAction *m_regularExpressionAction;
QWidget *m_widget;
IFindSupport::FindFlags m_findFlags; IFindSupport::FindFlags m_findFlags;
QPixmap m_casesensitiveIcon; QPixmap m_casesensitiveIcon;

View File

@@ -6,57 +6,47 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>600</width> <width>603</width>
<height>71</height> <height>90</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Find</string> <string>Find</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QGridLayout" name="gridLayout">
<property name="spacing">
<number>15</number>
</property>
<property name="leftMargin"> <property name="leftMargin">
<number>5</number> <number>5</number>
</property> </property>
<property name="topMargin"> <property name="topMargin">
<number>1</number> <number>2</number>
</property> </property>
<property name="rightMargin"> <property name="rightMargin">
<number>5</number> <number>0</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>1</number> <number>1</number>
</property> </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"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing"> <property name="spacing">
<number>2</number> <number>3</number>
</property> </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> <item>
<widget class="QToolButton" name="findPreviousButton"> <widget class="QToolButton" name="findPreviousButton">
<property name="focusPolicy"> <property name="focusPolicy">
@@ -80,36 +70,43 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="close">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<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"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing"> <property name="spacing">
<number>2</number> <number>3</number>
</property> </property>
<item>
<widget class="QLabel" name="replaceLabel">
<property name="text">
<string>Replace with:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="replaceEdit">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item> <item>
<widget class="QToolButton" name="replacePreviousButton"> <widget class="QToolButton" name="replacePreviousButton">
<property name="focusPolicy"> <property name="focusPolicy">
@@ -146,6 +143,19 @@
</property> </property>
</widget> </widget>
</item> </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> </layout>
</item> </item>
</layout> </layout>
@@ -157,6 +167,12 @@
<header location="global">utils/fancylineedit.h</header> <header location="global">utils/fancylineedit.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<tabstops>
<tabstop>findEdit</tabstop>
<tabstop>replaceEdit</tabstop>
<tabstop>close</tabstop>
<tabstop>replaceAllButton</tabstop>
</tabstops>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

View File

@@ -33,6 +33,7 @@
#include <QtGui/QFont> #include <QtGui/QFont>
#include <QtGui/QColor> #include <QtGui/QColor>
#include <QtCore/QDir>
using namespace Find::Internal; using namespace Find::Internal;
@@ -187,7 +188,7 @@ QVariant SearchResultTreeModel::data(const SearchResultFile *file, int role) con
result = QColor(qRgb(245, 245, 245)); result = QColor(qRgb(245, 245, 245));
break; break;
case Qt::DisplayRole: case Qt::DisplayRole:
result = QString(file->fileName() result = QString(QDir::toNativeSeparators(file->fileName())
+ " (" + QString::number(file->childrenCount()) + ")"); + " (" + QString::number(file->childrenCount()) + ")");
break; break;
case ItemDataRoles::FileNameRole: case ItemDataRoles::FileNameRole:

View File

@@ -153,6 +153,7 @@ void SearchResultWindow::handleJumpToSearchResult(int index, const QString &file
ResultWindowItem *SearchResultWindow::addResult(const QString &fileName, int lineNumber, const QString &rowText, ResultWindowItem *SearchResultWindow::addResult(const QString &fileName, int lineNumber, const QString &rowText,
int searchTermStart, int searchTermLength) int searchTermStart, int searchTermLength)
{ {
qDebug()<<"###"<<fileName;
m_widget->setCurrentWidget(m_searchResultTreeView); m_widget->setCurrentWidget(m_searchResultTreeView);
int index = m_items.size(); int index = m_items.size();
ResultWindowItem *item = new ResultWindowItem; ResultWindowItem *item = new ResultWindowItem;

View File

@@ -493,7 +493,7 @@ GitCommand *GitClient::createCommand(const QString &workingDirectory,
} }
} else { } else {
QTC_ASSERT(editor, /**/); QTC_ASSERT(editor, /**/);
connect(command, SIGNAL(outputData(QByteArray)), editor, SLOT(setPlainTextData(QByteArray))); connect(command, SIGNAL(outputData(QByteArray)), editor, SLOT(setPlainTextDataFiltered(QByteArray)));
} }
if (outputWindow) if (outputWindow)

View File

@@ -33,6 +33,7 @@
#include "gitclient.h" #include "gitclient.h"
#include "gitconstants.h" #include "gitconstants.h"
#include "gitplugin.h" #include "gitplugin.h"
#include <QtCore/QTextCodec>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -141,5 +142,47 @@ QString GitEditor::fileNameFromDiffSpecification(const QTextBlock &inBlock) cons
return QString(); 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 Internal
} // namespace Git } // namespace Git

View File

@@ -47,6 +47,9 @@ public:
explicit GitEditor(const VCSBase::VCSBaseEditorParameters *type, explicit GitEditor(const VCSBase::VCSBaseEditorParameters *type,
QWidget *parent); QWidget *parent);
public slots:
void setPlainTextDataFiltered(const QByteArray &a);
private: private:
virtual QSet<QString> annotationChanges() const; virtual QSet<QString> annotationChanges() const;
virtual QString changeUnderCursor(const QTextCursor &) const; virtual QString changeUnderCursor(const QTextCursor &) const;

View File

@@ -42,6 +42,7 @@ static const char *pathKeyC = "Path";
static const char *logCountKeyC = "LogCount"; static const char *logCountKeyC = "LogCount";
static const char *timeoutKeyC = "TimeOut"; static const char *timeoutKeyC = "TimeOut";
static const char *promptToSubmitKeyC = "PromptForSubmit"; static const char *promptToSubmitKeyC = "PromptForSubmit";
static const char *omitAnnotationDateKeyC = "OmitAnnotationDate";
enum { defaultLogCount = 10 , defaultTimeOut = 30}; enum { defaultLogCount = 10 , defaultTimeOut = 30};
@@ -52,7 +53,8 @@ GitSettings::GitSettings() :
adoptPath(false), adoptPath(false),
logCount(defaultLogCount), logCount(defaultLogCount),
timeout(defaultTimeOut), timeout(defaultTimeOut),
promptToSubmit(true) promptToSubmit(true),
omitAnnotationDate(false)
{ {
} }
@@ -64,6 +66,7 @@ void GitSettings::fromSettings(QSettings *settings)
logCount = settings->value(QLatin1String(logCountKeyC), defaultLogCount).toInt(); logCount = settings->value(QLatin1String(logCountKeyC), defaultLogCount).toInt();
timeout = settings->value(QLatin1String(timeoutKeyC), defaultTimeOut).toInt(); timeout = settings->value(QLatin1String(timeoutKeyC), defaultTimeOut).toInt();
promptToSubmit = settings->value(QLatin1String(promptToSubmitKeyC), true).toBool(); promptToSubmit = settings->value(QLatin1String(promptToSubmitKeyC), true).toBool();
omitAnnotationDate = settings->value(QLatin1String(omitAnnotationDateKeyC), false).toBool();
settings->endGroup(); settings->endGroup();
} }
@@ -75,13 +78,15 @@ void GitSettings::toSettings(QSettings *settings) const
settings->setValue(QLatin1String(logCountKeyC), logCount); settings->setValue(QLatin1String(logCountKeyC), logCount);
settings->setValue(QLatin1String(timeoutKeyC), timeout); settings->setValue(QLatin1String(timeoutKeyC), timeout);
settings->setValue(QLatin1String(promptToSubmitKeyC), promptToSubmit); settings->setValue(QLatin1String(promptToSubmitKeyC), promptToSubmit);
settings->setValue(QLatin1String(omitAnnotationDateKeyC), omitAnnotationDate);
settings->endGroup(); settings->endGroup();
} }
bool GitSettings::equals(const GitSettings &s) const bool GitSettings::equals(const GitSettings &s) const
{ {
return adoptPath == s.adoptPath && path == s.path && logCount == s.logCount 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 QString GitSettings::gitBinaryPath(bool *ok, QString *errorMessage) const

View File

@@ -56,6 +56,7 @@ struct GitSettings
int logCount; int logCount;
int timeout; int timeout;
bool promptToSubmit; bool promptToSubmit;
bool omitAnnotationDate;
}; };
inline bool operator==(const GitSettings &p1, const GitSettings &p2) inline bool operator==(const GitSettings &p1, const GitSettings &p2)

View File

@@ -54,7 +54,8 @@ GitSettings SettingsPageWidget::settings() const
rc.adoptPath = m_ui.environmentGroupBox->isChecked() && !rc.path.isEmpty(); rc.adoptPath = m_ui.environmentGroupBox->isChecked() && !rc.path.isEmpty();
rc.logCount = m_ui.logCountSpinBox->value(); rc.logCount = m_ui.logCountSpinBox->value();
rc.timeout = m_ui.timeoutSpinBox->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; return rc;
} }
@@ -65,6 +66,7 @@ void SettingsPageWidget::setSettings(const GitSettings &s)
m_ui.logCountSpinBox->setValue(s.logCount); m_ui.logCountSpinBox->setValue(s.logCount);
m_ui.timeoutSpinBox->setValue(s.timeout); m_ui.timeoutSpinBox->setValue(s.timeout);
m_ui.promptToSubmitCheckBox->setChecked(s.promptToSubmit); m_ui.promptToSubmitCheckBox->setChecked(s.promptToSubmit);
m_ui.omitAnnotationDataCheckBox->setChecked(s.omitAnnotationDate);
} }
void SettingsPageWidget::setSystemPath() void SettingsPageWidget::setSystemPath()

View File

@@ -111,6 +111,13 @@
</property> </property>
</widget> </widget>
</item> </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> </layout>
</item> </item>
<item> <item>

View File

@@ -14,6 +14,7 @@ SUBDIRS = plugin_coreplugin \
plugin_perforce \ plugin_perforce \
plugin_subversion \ plugin_subversion \
plugin_git \ plugin_git \
plugin_cvs \
plugin_cpptools \ plugin_cpptools \
plugin_qt4projectmanager \ plugin_qt4projectmanager \
# plugin_snippets \ # buggy and annoying # plugin_snippets \ # buggy and annoying
@@ -73,6 +74,12 @@ plugin_git.depends = plugin_vcsbase
plugin_git.depends += plugin_projectexplorer plugin_git.depends += plugin_projectexplorer
plugin_git.depends += plugin_coreplugin 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.subdir = subversion
plugin_subversion.depends = plugin_vcsbase plugin_subversion.depends = plugin_vcsbase
plugin_subversion.depends += plugin_projectexplorer plugin_subversion.depends += plugin_projectexplorer

View File

@@ -57,6 +57,7 @@ public:
virtual QStringList commandLineArguments() const = 0; virtual QStringList commandLineArguments() const = 0;
virtual Environment environment() const = 0; virtual Environment environment() const = 0;
virtual QString dumperLibrary() const = 0; virtual QString dumperLibrary() const = 0;
virtual QStringList dumperLibraryLocations() const = 0;
virtual ProjectExplorer::ToolChain::ToolChainType toolChainType() const = 0; virtual ProjectExplorer::ToolChain::ToolChainType toolChainType() const = 0;
virtual void save(PersistentSettingsWriter &writer) const; virtual void save(PersistentSettingsWriter &writer) const;

View File

@@ -29,7 +29,7 @@
#include "buildprogress.h" #include "buildprogress.h"
#include <coreplugin/stylehelper.h> #include <utils/stylehelper.h>
#include <QtGui/QVBoxLayout> #include <QtGui/QVBoxLayout>
#include <QtGui/QHBoxLayout> #include <QtGui/QHBoxLayout>

View File

@@ -459,6 +459,12 @@ QString CustomExecutableRunConfiguration::dumperLibrary() const
return ProjectExplorer::DebuggingHelperLibrary::debuggingHelperLibrary(qmakePath); 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 ProjectExplorer::ToolChain::ToolChainType CustomExecutableRunConfiguration::toolChainType() const
{ {
return ProjectExplorer::ToolChain::UNKNOWN; return ProjectExplorer::ToolChain::UNKNOWN;

View File

@@ -89,6 +89,7 @@ public:
virtual QWidget *configurationWidget(); virtual QWidget *configurationWidget();
virtual QString dumperLibrary() const; virtual QString dumperLibrary() const;
virtual QStringList dumperLibraryLocations() const;
virtual ProjectExplorer::ToolChain::ToolChainType toolChainType() const; virtual ProjectExplorer::ToolChain::ToolChainType toolChainType() const;

View File

@@ -66,11 +66,16 @@ QStringList DebuggingHelperLibrary::debuggingHelperLibraryDirectories(const QStr
QStringList directories; QStringList directories;
directories directories
<< (qtInstallData + "/qtc-debugging-helper/") << (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)) + "/"; << (QDesktopServices::storageLocation(QDesktopServices::DataLocation) + "/qtc-debugging-helper/" + QString::number(hash)) + "/";
return directories; return directories;
} }
QStringList DebuggingHelperLibrary::debuggingHelperLibraryLocations(const QString &qmakePath)
{
return debuggingHelperLibraryLocations(qtInstallDataDir(qmakePath), qtDir(qmakePath));
}
QString DebuggingHelperLibrary::debuggingHelperLibrary(const QString &qmakePath) QString DebuggingHelperLibrary::debuggingHelperLibrary(const QString &qmakePath)
{ {
return debuggingHelperLibrary(qtInstallDataDir(qmakePath), qtDir(qmakePath)); return debuggingHelperLibrary(qtInstallDataDir(qmakePath), qtDir(qmakePath));
@@ -94,6 +99,22 @@ QString DebuggingHelperLibrary::qtDir(const QString &qmakePath)
// Debugging Helper Library // 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) QString DebuggingHelperLibrary::debuggingHelperLibrary(const QString &qtInstallData, const QString &qtpath)
{ {
foreach(const QString &directory, debuggingHelperLibraryDirectories(qtInstallData, qtpath)) { foreach(const QString &directory, debuggingHelperLibraryDirectories(qtInstallData, qtpath)) {

View File

@@ -49,11 +49,18 @@ public:
static QString qtVersionForQMake(const QString &qmakePath); static QString qtVersionForQMake(const QString &qmakePath);
static bool hasDebuggingHelperLibrary(const QString &qmakePath); static bool hasDebuggingHelperLibrary(const QString &qmakePath);
static QString debuggingHelperLibrary(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 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 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: private:
static QStringList debuggingHelperLibraryDirectories(const QString &qtInstallData, const QString &qtpath); static QStringList debuggingHelperLibraryDirectories(const QString &qtInstallData, const QString &qtpath);
static QString qtInstallDataDir(const QString &qmakePath); static QString qtInstallDataDir(const QString &qmakePath);

View File

@@ -1,3 +1,2 @@
include(projectexplorer_dependencies.pri) include(projectexplorer_dependencies.pri)
LIBS *= -l$$qtLibraryTarget(ProjectExplorer) LIBS *= -l$$qtLibraryTarget(ProjectExplorer)

View File

@@ -381,6 +381,11 @@ QString QmlRunConfiguration::dumperLibrary() const
return QString(); return QString();
} }
QStringList QmlRunConfiguration::dumperLibraryLocations() const
{
return QStringList();
}
QWidget *QmlRunConfiguration::configurationWidget() QWidget *QmlRunConfiguration::configurationWidget()
{ {
QWidget *config = new QWidget; QWidget *config = new QWidget;

View File

@@ -150,6 +150,7 @@ public:
virtual QStringList commandLineArguments() const; virtual QStringList commandLineArguments() const;
virtual ProjectExplorer::Environment environment() const; virtual ProjectExplorer::Environment environment() const;
virtual QString dumperLibrary() const; virtual QString dumperLibrary() const;
virtual QStringList dumperLibraryLocations() const;
virtual QWidget *configurationWidget(); virtual QWidget *configurationWidget();
ProjectExplorer::ToolChain::ToolChainType toolChainType() const { return ProjectExplorer::ToolChain::OTHER; } ProjectExplorer::ToolChain::ToolChainType toolChainType() const { return ProjectExplorer::ToolChain::OTHER; }

View File

@@ -637,6 +637,13 @@ QString Qt4RunConfiguration::dumperLibrary() const
return version->debuggingHelperLibrary(); 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) void Qt4RunConfiguration::setBaseEnvironmentBase(BaseEnvironmentBase env)
{ {
if (m_baseEnvironmentBase == env) if (m_baseEnvironmentBase == env)

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