OSDN Git Service

Merge remote branch 'origin/2.1'
authordt <qtc-committer@nokia.com>
Wed, 10 Nov 2010 16:00:07 +0000 (17:00 +0100)
committerdt <qtc-committer@nokia.com>
Wed, 10 Nov 2010 16:02:40 +0000 (17:02 +0100)
Conflicts:
share/qtcreator/static.pro
src/plugins/cppeditor/cppeditor.cpp
src/plugins/qmljseditor/qmljseditor.cpp
src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp
src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.cpp
src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.ui
src/plugins/qt4projectmanager/qtoutputformatter.cpp
src/plugins/texteditor/generichighlighter/highlightersettings.cpp

18 files changed:
1  2 
share/qtcreator/qml/qmlobserver/main.cpp
share/qtcreator/static.pro
src/plugins/cppeditor/cppeditor.cpp
src/plugins/glsleditor/glsleditor.cpp
src/plugins/qmljseditor/qmljseditor.cpp
src/plugins/qmljsinspector/qmljsinspector.cpp
src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp
src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.cpp
src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.ui
src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.cpp
src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp
src/plugins/qt4projectmanager/qtoutputformatter.cpp
src/plugins/qt4projectmanager/qtoutputformatter.h
src/plugins/texteditor/basetexteditor.cpp
src/plugins/texteditor/basetexteditor.h
src/plugins/texteditor/generichighlighter/highlightersettings.cpp
src/plugins/texteditor/plaintexteditor.cpp
src/plugins/welcome/communitywelcomepagewidget.cpp

@@@ -35,7 -35,9 +35,8 @@@ DATA_DIRS = 
      qmldesigner \
      qmlicons \
      qml \
-     qml-type-descriptions
+     qml-type-descriptions \
 -    qmljsdebugger \
+     generic-highlighter
  
  !isEmpty(copydata) {
  
@@@ -415,9 -410,6 +415,9 @@@ CPPEditor::CPPEditor(QWidget *parent
      setParenthesesMatchingEnabled(true);
      setMarksVisible(true);
      setCodeFoldingSupported(true);
-     setCodeFoldingVisible(true);
 +    setIndenter(new CppQtStyleIndenter);
 +    setAutoCompleter(new CppAutoCompleter);
++
      baseTextDocument()->setSyntaxHighlighter(new CppHighlighter);
  
      m_modelManager = CppTools::CppModelManagerInterface::instance();
index 8e58371,0000000..5903def
mode 100644,000000..100644
--- /dev/null
@@@ -1,244 -1,0 +1,243 @@@
-     setCodeFoldingVisible(true);
 +/**************************************************************************
 +**
 +** This file is part of Qt Creator
 +**
 +** Copyright (c) 2010 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://qt.nokia.com/contact.
 +**
 +**************************************************************************/
 +
 +#include "glsleditor.h"
 +#include "glsleditoreditable.h"
 +#include "glsleditorconstants.h"
 +#include "glsleditorplugin.h"
 +#include "glslhighlighter.h"
 +
 +#include <coreplugin/actionmanager/actionmanager.h>
 +#include <coreplugin/actionmanager/actioncontainer.h>
 +#include <coreplugin/uniqueidmanager.h>
 +#include <coreplugin/actionmanager/command.h>
 +#include <coreplugin/editormanager/editormanager.h>
 +#include <coreplugin/icore.h>
 +#include <coreplugin/mimedatabase.h>
 +#include <extensionsystem/pluginmanager.h>
 +#include <texteditor/basetextdocument.h>
 +#include <texteditor/fontsettings.h>
 +#include <texteditor/tabsettings.h>
 +#include <texteditor/texteditorconstants.h>
 +#include <texteditor/texteditorsettings.h>
 +#include <texteditor/syntaxhighlighter.h>
 +#include <texteditor/refactoroverlay.h>
 +#include <texteditor/tooltip/tooltip.h>
 +#include <qmldesigner/qmldesignerconstants.h>
 +#include <utils/changeset.h>
 +#include <utils/uncommentselection.h>
 +
 +#include <QtCore/QFileInfo>
 +#include <QtCore/QSignalMapper>
 +#include <QtCore/QTimer>
 +
 +#include <QtGui/QMenu>
 +#include <QtGui/QComboBox>
 +#include <QtGui/QHeaderView>
 +#include <QtGui/QInputDialog>
 +#include <QtGui/QMainWindow>
 +#include <QtGui/QToolBar>
 +#include <QtGui/QTreeView>
 +
 +using namespace GLSL;
 +using namespace GLSLEditor;
 +using namespace GLSLEditor::Internal;
 +
 +enum {
 +    UPDATE_DOCUMENT_DEFAULT_INTERVAL = 150
 +};
 +
 +GLSLTextEditor::GLSLTextEditor(QWidget *parent) :
 +    TextEditor::BaseTextEditor(parent),
 +    m_outlineCombo(0)
 +{
 +    setParenthesesMatchingEnabled(true);
 +    setMarksVisible(true);
 +    setCodeFoldingSupported(true);
 +    //setIndenter(new Indenter);
 +
 +    m_updateDocumentTimer = new QTimer(this);
 +    m_updateDocumentTimer->setInterval(UPDATE_DOCUMENT_DEFAULT_INTERVAL);
 +    m_updateDocumentTimer->setSingleShot(true);
 +    connect(m_updateDocumentTimer, SIGNAL(timeout()), this, SLOT(updateDocumentNow()));
 +
 +    connect(this, SIGNAL(textChanged()), this, SLOT(updateDocument()));
 +
 +    baseTextDocument()->setSyntaxHighlighter(new Highlighter(document()));
 +
 +//    if (m_modelManager) {
 +//        m_semanticHighlighter->setModelManager(m_modelManager);
 +//        connect(m_modelManager, SIGNAL(documentUpdated(GLSL::Document::Ptr)),
 +//                this, SLOT(onDocumentUpdated(GLSL::Document::Ptr)));
 +//        connect(m_modelManager, SIGNAL(libraryInfoUpdated(QString,GLSL::LibraryInfo)),
 +//                this, SLOT(forceSemanticRehighlight()));
 +//        connect(this->document(), SIGNAL(modificationChanged(bool)), this, SLOT(modificationChanged(bool)));
 +//    }
 +}
 +
 +GLSLTextEditor::~GLSLTextEditor()
 +{
 +}
 +
 +int GLSLTextEditor::editorRevision() const
 +{
 +    //return document()->revision();
 +    return 0;
 +}
 +
 +bool GLSLTextEditor::isOutdated() const
 +{
 +//    if (m_semanticInfo.revision() != editorRevision())
 +//        return true;
 +
 +    return false;
 +}
 +
 +Core::IEditor *GLSLEditorEditable::duplicate(QWidget *parent)
 +{
 +    GLSLTextEditor *newEditor = new GLSLTextEditor(parent);
 +    newEditor->duplicateFrom(editor());
 +    GLSLEditorPlugin::instance()->initializeEditor(newEditor);
 +    return newEditor->editableInterface();
 +}
 +
 +QString GLSLEditorEditable::id() const
 +{
 +    return QLatin1String(GLSLEditor::Constants::C_GLSLEDITOR_ID);
 +}
 +
 +bool GLSLEditorEditable::open(const QString &fileName)
 +{
 +    bool b = TextEditor::BaseTextEditorEditable::open(fileName);
 +    editor()->setMimeType(Core::ICore::instance()->mimeDatabase()->findByFile(QFileInfo(fileName)).type());
 +    return b;
 +}
 +
 +Core::Context GLSLEditorEditable::context() const
 +{
 +    return m_context;
 +}
 +
 +void GLSLTextEditor::setFontSettings(const TextEditor::FontSettings &fs)
 +{
 +    TextEditor::BaseTextEditor::setFontSettings(fs);
 +    Highlighter *highlighter = qobject_cast<Highlighter*>(baseTextDocument()->syntaxHighlighter());
 +    if (!highlighter)
 +        return;
 +
 +    /*
 +        NumberFormat,
 +        StringFormat,
 +        TypeFormat,
 +        KeywordFormat,
 +        LabelFormat,
 +        CommentFormat,
 +        VisualWhitespace,
 +     */
 +    static QVector<QString> categories;
 +    if (categories.isEmpty()) {
 +        categories << QLatin1String(TextEditor::Constants::C_NUMBER)
 +                   << QLatin1String(TextEditor::Constants::C_STRING)
 +                   << QLatin1String(TextEditor::Constants::C_TYPE)
 +                   << QLatin1String(TextEditor::Constants::C_KEYWORD)
 +                   << QLatin1String(TextEditor::Constants::C_FIELD)
 +                   << QLatin1String(TextEditor::Constants::C_COMMENT)
 +                   << QLatin1String(TextEditor::Constants::C_VISUAL_WHITESPACE);
 +    }
 +
 +    highlighter->setFormats(fs.toTextCharFormats(categories));
 +    highlighter->rehighlight();
 +}
 +
 +QString GLSLTextEditor::wordUnderCursor() const
 +{
 +    QTextCursor tc = textCursor();
 +    const QChar ch = characterAt(tc.position() - 1);
 +    // make sure that we're not at the start of the next word.
 +    if (ch.isLetterOrNumber() || ch == QLatin1Char('_'))
 +        tc.movePosition(QTextCursor::Left);
 +    tc.movePosition(QTextCursor::StartOfWord);
 +    tc.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
 +    const QString word = tc.selectedText();
 +    return word;
 +}
 +
 +TextEditor::BaseTextEditorEditable *GLSLTextEditor::createEditableInterface()
 +{
 +    GLSLEditorEditable *editable = new GLSLEditorEditable(this);
 +    createToolBar(editable);
 +    return editable;
 +}
 +
 +void GLSLTextEditor::createToolBar(GLSLEditorEditable *editable)
 +{
 +    m_outlineCombo = new QComboBox;
 +    m_outlineCombo->setMinimumContentsLength(22);
 +#ifdef __GNUC__
 +#warning set up the outline model
 +#endif
 +    // m_outlineCombo->setModel(m_outlineModel);
 +
 +    QTreeView *treeView = new QTreeView;
 +    treeView->header()->hide();
 +    treeView->setItemsExpandable(false);
 +    treeView->setRootIsDecorated(false);
 +    m_outlineCombo->setView(treeView);
 +    treeView->expandAll();
 +
 +    //m_outlineCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
 +
 +    // Make the combo box prefer to expand
 +    QSizePolicy policy = m_outlineCombo->sizePolicy();
 +    policy.setHorizontalPolicy(QSizePolicy::Expanding);
 +    m_outlineCombo->setSizePolicy(policy);
 +
 +    QToolBar *toolBar = static_cast<QToolBar*>(editable->toolBar());
 +
 +    QList<QAction*> actions = toolBar->actions();
 +    toolBar->insertWidget(actions.first(), m_outlineCombo);
 +}
 +
 +bool GLSLTextEditor::event(QEvent *e)
 +{
 +    return BaseTextEditor::event(e);
 +}
 +
 +void GLSLTextEditor::unCommentSelection()
 +{
 +    Utils::unCommentSelection(this);
 +}
 +
 +void GLSLTextEditor::updateDocument()
 +{
 +}
 +
 +void GLSLTextEditor::updateDocumentNow()
 +{
 +}
@@@ -613,9 -689,6 +613,8 @@@ QmlJSTextEditor::QmlJSTextEditor(QWidge
      setParenthesesMatchingEnabled(true);
      setMarksVisible(true);
      setCodeFoldingSupported(true);
-     setCodeFoldingVisible(true);
 +    setIndenter(new Indenter);
 +    setAutoCompleter(new AutoCompleter);
  
      m_updateDocumentTimer = new QTimer(this);
      m_updateDocumentTimer->setInterval(UPDATE_DOCUMENT_DEFAULT_INTERVAL);
@@@ -22,9 -20,8 +22,8 @@@ MaemoDeployStepWidget::MaemoDeployStepW
      m_step(step)
  {
      ui->setupUi(this);
-     ui->tableView->setTextElideMode(Qt::ElideMiddle);
 -    ui->modelComboBox->setModel(m_step->deployables());
 -    connect(m_step->deployables(), SIGNAL(modelAboutToBeReset()),
 +    ui->modelComboBox->setModel(m_step->deployables().data());
 +    connect(m_step->deployables().data(), SIGNAL(modelAboutToBeReset()),
          SLOT(handleModelListToBeReset()));
  
      // Queued connection because of race condition with combo box's reaction
      </layout>
     </item>
     <item>
 -    <widget class="QTableView" name="tableView">
 -     <property name="minimumSize">
 -      <size>
 -       <width>0</width>
 -       <height>150</height>
 -      </size>
 -     </property>
 -     <property name="textElideMode">
 -      <enum>Qt::ElideMiddle</enum>
 -     </property>
 -     <property name="horizontalScrollMode">
 -      <enum>QAbstractItemView::ScrollPerPixel</enum>
 -     </property>
 -     <property name="showGrid">
 -      <bool>false</bool>
 -     </property>
 -     <property name="wordWrap">
 -      <bool>false</bool>
 -     </property>
 -     <attribute name="horizontalHeaderDefaultSectionSize">
 -      <number>400</number>
 -     </attribute>
 -     <attribute name="horizontalHeaderHighlightSections">
 -      <bool>false</bool>
 -     </attribute>
 -     <attribute name="horizontalHeaderMinimumSectionSize">
 -      <number>100</number>
 -     </attribute>
 -     <attribute name="horizontalHeaderStretchLastSection">
 -      <bool>true</bool>
 -     </attribute>
 -     <attribute name="verticalHeaderVisible">
 -      <bool>false</bool>
 -     </attribute>
 -    </widget>
 +    <layout class="QHBoxLayout" name="horizontalLayout_4">
 +     <item>
 +      <widget class="QTableView" name="tableView">
++       <property name="minimumSize">
++        <size>
++         <width>0</width>
++         <height>150</height>
++        </size>
++       </property>
++       <property name="textElideMode">
++        <enum>Qt::ElideMiddle</enum>
++       </property>
++       <property name="horizontalScrollMode">
++        <enum>QAbstractItemView::ScrollPerPixel</enum>
++       </property>
 +       <property name="showGrid">
 +        <bool>false</bool>
 +       </property>
 +       <property name="wordWrap">
 +        <bool>false</bool>
 +       </property>
 +       <attribute name="horizontalHeaderDefaultSectionSize">
 +        <number>400</number>
 +       </attribute>
++       <attribute name="horizontalHeaderHighlightSections">
++        <bool>false</bool>
++       </attribute>
 +       <attribute name="horizontalHeaderMinimumSectionSize">
 +        <number>100</number>
 +       </attribute>
 +       <attribute name="horizontalHeaderStretchLastSection">
 +        <bool>true</bool>
 +       </attribute>
 +       <attribute name="verticalHeaderVisible">
 +        <bool>false</bool>
 +       </attribute>
 +      </widget>
 +     </item>
 +     <item>
 +      <layout class="QVBoxLayout" name="verticalLayout">
 +       <item>
 +        <widget class="QPushButton" name="addDesktopFileButton">
 +         <property name="text">
 +          <string>Add Desktop File</string>
 +         </property>
 +        </widget>
 +       </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>
 +    </layout>
     </item>
    </layout>
   </widget>
@@@ -447,10 -430,35 +435,23 @@@ void MaemoRemoteMounter::handleUtfsServ
      setState(Inactive);
  }
  
 -void MaemoRemoteMounter::assertState(State expectedState, const char *func)
 -{
 -    assertState(QList<State>() << expectedState, func);
 -}
 -
 -void MaemoRemoteMounter::assertState(const QList<State> &expectedStates,
 -    const char *func)
 -{
 -    QTC_ASSERT(expectedStates.contains(m_state),
 -        qDebug("Unexpected state %d at %s.", m_state, func))
 -}
 -
  void MaemoRemoteMounter::setState(State newState)
  {
-     if (newState == Inactive)
+     if (newState == Inactive) {
          m_utfsServerTimer->stop();
+         if (m_utfsClientUploader) {
+             disconnect(m_utfsClientUploader.data(), 0, this, 0);
+             m_utfsClientUploader->closeChannel();
+         }
+         if (m_mountProcess) {
+             disconnect(m_mountProcess.data(), 0, this, 0);
+             m_mountProcess->closeChannel();
+         }
+         if (m_unmountProcess) {
+             disconnect(m_unmountProcess.data(), 0, this, 0);
+             m_unmountProcess->closeChannel();
+         }
+     }
      m_state = newState;
  }
  
@@@ -179,25 -218,13 +222,26 @@@ QString QtOutputFormatter::pathInSource
  void QtOutputFormatter::handleLink(const QString &href)
  {
      if (!href.isEmpty()) {
 -        const QRegExp qmlErrorLink(QLatin1String("^(file:///.+):(\\d+):(\\d+)"));
 +        const QRegExp qmlLineColumnLink(QLatin1String("^(file:///.+)" // file url
 +                                                 ":(\\d+)"            // line
 +                                                 ":(\\d+)$"));        // column
  
 -        if (qmlErrorLink.indexIn(href) != -1) {
 -            const QString fileName = QUrl(qmlErrorLink.cap(1)).toLocalFile();
 -            const int line = qmlErrorLink.cap(2).toInt();
 -            const int column = qmlErrorLink.cap(3).toInt();
 +        if (qmlLineColumnLink.indexIn(href) != -1) {
 +            const QString fileName = QUrl(qmlLineColumnLink.cap(1)).toLocalFile();
 +            const int line = qmlLineColumnLink.cap(2).toInt();
 +            const int column = qmlLineColumnLink.cap(3).toInt();
-             TextEditor::BaseTextEditor::openEditorAt(fileName, line, column - 1);
+             TextEditor::BaseTextEditor::openEditorAt(pathInSourceDirectory(fileName), line, column - 1);
++
 +            return;
 +        }
 +
 +        const QRegExp qmlLineLink(QLatin1String("^(file:///.+)" // file url
 +                                                 ":(\\d+)$"));  // line
 +
 +        if (qmlLineLink.indexIn(href) != -1) {
 +            const QString fileName = QUrl(qmlLineLink.cap(1)).toLocalFile();
 +            const int line = qmlLineLink.cap(2).toInt();
-             TextEditor::BaseTextEditor::openEditorAt(fileName, line);
++            TextEditor::BaseTextEditor::openEditorAt(pathInSourceDirectory(fileName), line);
              return;
          }
  
  namespace TextEditor {
  namespace Internal {
  
- QString findDefinitionsLocation()
+ QString findFallbackDefinitionsLocation()
  {
 -#ifdef Q_OS_UNIX
+     QDir dir;
+     dir.setNameFilters(QStringList(QLatin1String("*.xml")));
 +#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
      static const QLatin1String kateSyntax[] = {
          QLatin1String("/share/apps/katepart/syntax"),
          QLatin1String("/share/kde4/apps/katepart/syntax")