Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
3a2974b3
Commit
3a2974b3
authored
Oct 01, 2009
by
mae
Browse files
some action cleanup for the qml editor
done with Erik Verbruggen
parent
dc40d764
Changes
15
Hide whitespace changes
Inline
Side-by-side
src/plugins/cppeditor/cppeditor.cpp
View file @
3a2974b3
...
...
@@ -1868,7 +1868,8 @@ void CPPEditor::setFontSettings(const TextEditor::FontSettings &fs)
<<
QLatin1String
(
TextEditor
::
Constants
::
C_LABEL
)
<<
QLatin1String
(
TextEditor
::
Constants
::
C_COMMENT
)
<<
QLatin1String
(
TextEditor
::
Constants
::
C_DOXYGEN_COMMENT
)
<<
QLatin1String
(
TextEditor
::
Constants
::
C_DOXYGEN_TAG
);
<<
QLatin1String
(
TextEditor
::
Constants
::
C_DOXYGEN_TAG
)
<<
QLatin1String
(
TextEditor
::
Constants
::
C_VISUAL_WHITESPACE
);
}
const
QVector
<
QTextCharFormat
>
formats
=
fs
.
toTextCharFormats
(
categories
);
...
...
src/plugins/cppeditor/cppeditorenums.h
View file @
3a2974b3
...
...
@@ -49,6 +49,7 @@ enum CppFormats {
CppCommentFormat
,
CppDoxygenCommentFormat
,
CppDoxygenTagFormat
,
CppVisualWhitespace
,
NumCppFormats
};
...
...
src/plugins/cppeditor/cpphighlighter.cpp
View file @
3a2974b3
...
...
@@ -44,7 +44,6 @@ using namespace CPlusPlus;
CppHighlighter
::
CppHighlighter
(
QTextDocument
*
document
)
:
QSyntaxHighlighter
(
document
)
{
visualSpaceFormat
.
setForeground
(
Qt
::
lightGray
);
}
void
CppHighlighter
::
highlightBlock
(
const
QString
&
text
)
...
...
@@ -75,7 +74,7 @@ void CppHighlighter::highlightBlock(const QString &text)
}
TextEditDocumentLayout
::
clearParentheses
(
currentBlock
());
if
(
text
.
length
())
// the empty line can still contain whitespace
setFormat
(
0
,
text
.
length
(),
visualSpaceFormat
);
setFormat
(
0
,
text
.
length
(),
m_formats
[
CppVisualWhitespace
]
);
return
;
}
...
...
@@ -98,7 +97,7 @@ void CppHighlighter::highlightBlock(const QString &text)
if
(
previousTokenEnd
!=
tk
.
position
())
{
setFormat
(
previousTokenEnd
,
tk
.
position
()
-
previousTokenEnd
,
visualSpaceFormat
);
m_formats
[
CppVisualWhitespace
]
);
}
if
(
tk
.
is
(
T_LPAREN
)
||
tk
.
is
(
T_LBRACE
)
||
tk
.
is
(
T_LBRACKET
))
{
...
...
@@ -176,7 +175,7 @@ void CppHighlighter::highlightBlock(const QString &text)
const
SimpleToken
tk
=
tokens
.
last
();
const
int
lastTokenEnd
=
tk
.
position
()
+
tk
.
length
();
if
(
text
.
length
()
>
lastTokenEnd
)
setFormat
(
lastTokenEnd
,
text
.
length
()
-
lastTokenEnd
,
visualSpaceFormat
);
setFormat
(
lastTokenEnd
,
text
.
length
()
-
lastTokenEnd
,
m_formats
[
CppVisualWhitespace
]
);
}
if
(
TextBlockUserData
*
userData
=
TextEditDocumentLayout
::
testUserData
(
currentBlock
()))
{
...
...
src/plugins/cppeditor/cpphighlighter.h
View file @
3a2974b3
...
...
@@ -65,7 +65,6 @@ private:
bool
isQtKeyword
(
const
QStringRef
&
text
)
const
;
QTextCharFormat
m_formats
[
NumCppFormats
];
QTextCharFormat
visualSpaceFormat
;
};
}
// namespace Internal
...
...
src/plugins/qmleditor/qmleditor.cpp
View file @
3a2974b3
...
...
@@ -46,6 +46,7 @@
#include <coreplugin/icore.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/uniqueidmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <texteditor/basetextdocument.h>
#include <texteditor/fontsettings.h>
...
...
@@ -364,14 +365,17 @@ protected:
#endif
};
ScriptEditorEditable
::
ScriptEditorEditable
(
ScriptEditor
*
editor
,
const
QList
<
int
>
&
context
)
:
BaseTextEditorEditable
(
editor
)
,
m_context
(
context
)
ScriptEditorEditable
::
ScriptEditorEditable
(
ScriptEditor
*
editor
)
:
BaseTextEditorEditable
(
editor
)
{
Core
::
UniqueIDManager
*
uidm
=
Core
::
UniqueIDManager
::
instance
();
m_context
<<
uidm
->
uniqueIdentifier
(
QmlEditor
::
Constants
::
C_QMLEDITOR
);
m_context
<<
uidm
->
uniqueIdentifier
(
TextEditor
::
Constants
::
C_TEXTEDITOR
);
}
ScriptEditor
::
ScriptEditor
(
const
Context
&
context
,
QWidget
*
parent
)
:
ScriptEditor
::
ScriptEditor
(
QWidget
*
parent
)
:
TextEditor
::
BaseTextEditor
(
parent
),
m_context
(
context
),
m_methodCombo
(
0
),
m_modelManager
(
0
)
{
...
...
@@ -411,7 +415,7 @@ QStringList ScriptEditor::words() const
Core
::
IEditor
*
ScriptEditorEditable
::
duplicate
(
QWidget
*
parent
)
{
ScriptEditor
*
newEditor
=
new
ScriptEditor
(
m_context
,
parent
);
ScriptEditor
*
newEditor
=
new
ScriptEditor
(
parent
);
newEditor
->
duplicateFrom
(
editor
());
QmlEditorPlugin
::
instance
()
->
initializeEditor
(
newEditor
);
return
newEditor
->
editableInterface
();
...
...
@@ -605,7 +609,8 @@ void ScriptEditor::setFontSettings(const TextEditor::FontSettings &fs)
<<
QLatin1String
(
TextEditor
::
Constants
::
C_KEYWORD
)
<<
QLatin1String
(
TextEditor
::
Constants
::
C_PREPROCESSOR
)
<<
QLatin1String
(
TextEditor
::
Constants
::
C_LABEL
)
<<
QLatin1String
(
TextEditor
::
Constants
::
C_COMMENT
);
<<
QLatin1String
(
TextEditor
::
Constants
::
C_COMMENT
)
<<
QLatin1String
(
TextEditor
::
Constants
::
C_VISUAL_WHITESPACE
);
}
highlighter
->
setFormats
(
fs
.
toTextCharFormats
(
categories
));
...
...
@@ -674,7 +679,7 @@ void ScriptEditor::indentBlock(QTextDocument *, QTextBlock block, QChar typedCha
TextEditor
::
BaseTextEditorEditable
*
ScriptEditor
::
createEditableInterface
()
{
ScriptEditorEditable
*
editable
=
new
ScriptEditorEditable
(
this
,
m_context
);
ScriptEditorEditable
*
editable
=
new
ScriptEditorEditable
(
this
);
createToolBar
(
editable
);
return
editable
;
}
...
...
src/plugins/qmleditor/qmleditor.h
View file @
3a2974b3
...
...
@@ -59,7 +59,7 @@ class ScriptEditorEditable : public TextEditor::BaseTextEditorEditable
Q_OBJECT
public:
ScriptEditorEditable
(
ScriptEditor
*
,
const
QList
<
int
>
&
);
ScriptEditorEditable
(
ScriptEditor
*
);
QList
<
int
>
context
()
const
;
bool
duplicateSupported
()
const
{
return
true
;
}
...
...
@@ -95,8 +95,7 @@ class ScriptEditor : public TextEditor::BaseTextEditor
public:
typedef
QList
<
int
>
Context
;
ScriptEditor
(
const
Context
&
context
,
QWidget
*
parent
=
0
);
ScriptEditor
(
QWidget
*
parent
=
0
);
~
ScriptEditor
();
QList
<
Declaration
>
declarations
()
const
;
...
...
src/plugins/qmleditor/qmleditorfactory.cpp
View file @
3a2974b3
...
...
@@ -41,18 +41,15 @@
using
namespace
QmlEditor
::
Internal
;
using
namespace
QmlEditor
::
Constants
;
QmlEditorFactory
::
QmlEditorFactory
(
const
Context
&
context
,
QObject
*
parent
)
QmlEditorFactory
::
QmlEditorFactory
(
QObject
*
parent
)
:
Core
::
IEditorFactory
(
parent
),
m_kind
(
QLatin1String
(
C_QMLEDITOR
)),
m_mimeTypes
(
QLatin1String
(
QmlEditor
::
Constants
::
QMLEDITOR_MIMETYPE
)),
m_context
(
context
),
m_actionHandler
(
new
QmlEditorActionHandler
)
m_mimeTypes
(
QLatin1String
(
QmlEditor
::
Constants
::
QMLEDITOR_MIMETYPE
))
{
}
QmlEditorFactory
::~
QmlEditorFactory
()
{
delete
m_actionHandler
;
}
QString
QmlEditorFactory
::
kind
()
const
...
...
@@ -72,7 +69,7 @@ Core::IFile *QmlEditorFactory::open(const QString &fileName)
Core
::
IEditor
*
QmlEditorFactory
::
createEditor
(
QWidget
*
parent
)
{
ScriptEditor
*
rc
=
new
ScriptEditor
(
m_context
,
parent
);
ScriptEditor
*
rc
=
new
ScriptEditor
(
parent
);
QmlEditorPlugin
::
instance
()
->
initializeEditor
(
rc
);
return
rc
->
editableInterface
();
}
...
...
src/plugins/qmleditor/qmleditorfactory.h
View file @
3a2974b3
...
...
@@ -48,9 +48,7 @@ class QmlEditorFactory : public Core::IEditorFactory
Q_OBJECT
public:
typedef
QList
<
int
>
Context
;
QmlEditorFactory
(
const
Context
&
context
,
QObject
*
parent
);
QmlEditorFactory
(
QObject
*
parent
);
~
QmlEditorFactory
();
virtual
QStringList
mimeTypes
()
const
;
...
...
@@ -62,9 +60,6 @@ public:
private:
const
QString
m_kind
;
const
QStringList
m_mimeTypes
;
const
Context
m_context
;
TextEditor
::
TextEditorActionHandler
*
m_actionHandler
;
};
}
// namespace Internal
...
...
src/plugins/qmleditor/qmleditorplugin.cpp
View file @
3a2974b3
...
...
@@ -92,13 +92,10 @@ bool QmlEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
m_modelManager
=
new
QmlModelManager
(
this
);
addAutoReleasedObject
(
m_modelManager
);
m_scriptcontext
<<
core
->
uniqueIDManager
()
->
uniqueIdentifier
(
QmlEditor
::
Constants
::
C_QMLEDITOR
);
m_context
=
m_scriptcontext
;
m_context
<<
core
->
uniqueIDManager
()
->
uniqueIdentifier
(
TextEditor
::
Constants
::
C_TEXTEDITOR
);
QList
<
int
>
context
;
context
<<
core
->
uniqueIDManager
()
->
uniqueIdentifier
(
QmlEditor
::
Constants
::
C_QMLEDITOR
);
registerActions
();
m_editor
=
new
QmlEditorFactory
(
m_context
,
this
);
m_editor
=
new
QmlEditorFactory
(
this
);
addObject
(
m_editor
);
Core
::
BaseFileWizardParameters
wizardParameters
(
Core
::
IWizard
::
FileWizard
);
...
...
@@ -150,8 +147,4 @@ void QmlEditorPlugin::initializeEditor(QmlEditor::Internal::ScriptEditor *editor
TextEditor
::
Internal
::
CompletionSupport
::
instance
(),
SLOT
(
autoComplete
(
ITextEditable
*
,
bool
)));
}
void
QmlEditorPlugin
::
registerActions
()
{
}
Q_EXPORT_PLUGIN
(
QmlEditorPlugin
)
src/plugins/qmleditor/qmleditorplugin.h
View file @
3a2974b3
...
...
@@ -65,14 +65,8 @@ public:
void
initializeEditor
(
ScriptEditor
*
editor
);
private:
void
registerActions
();
static
QmlEditorPlugin
*
m_instance
;
typedef
QList
<
int
>
Context
;
Context
m_context
;
Context
m_scriptcontext
;
QmlModelManagerInterface
*
m_modelManager
;
QmlFileWizard
*
m_wizard
;
QmlEditorFactory
*
m_editor
;
...
...
src/plugins/qtscripteditor/qtscripteditor.cpp
View file @
3a2974b3
...
...
@@ -322,7 +322,8 @@ void ScriptEditor::setFontSettings(const TextEditor::FontSettings &fs)
<<
QLatin1String
(
TextEditor
::
Constants
::
C_KEYWORD
)
<<
QLatin1String
(
TextEditor
::
Constants
::
C_PREPROCESSOR
)
<<
QLatin1String
(
TextEditor
::
Constants
::
C_LABEL
)
<<
QLatin1String
(
TextEditor
::
Constants
::
C_COMMENT
);
<<
QLatin1String
(
TextEditor
::
Constants
::
C_COMMENT
)
<<
QLatin1String
(
TextEditor
::
Constants
::
C_VISUAL_WHITESPACE
);
}
highlighter
->
setFormats
(
fs
.
toTextCharFormats
(
categories
));
...
...
src/plugins/texteditor/texteditorconstants.h
View file @
3a2974b3
...
...
@@ -93,6 +93,7 @@ const char * const C_LABEL = "Label";
const
char
*
const
C_COMMENT
=
"Comment"
;
const
char
*
const
C_DOXYGEN_COMMENT
=
"Doxygen.Comment"
;
const
char
*
const
C_DOXYGEN_TAG
=
"Doxygen.Tag"
;
const
char
*
const
C_VISUAL_WHITESPACE
=
"VisualWhitespace"
;
const
char
*
const
C_DISABLED_CODE
=
"DisabledCode"
;
...
...
@@ -101,6 +102,7 @@ const char * const C_REMOVED_LINE = "RemovedLine";
const
char
*
const
C_DIFF_FILE
=
"DiffFile"
;
const
char
*
const
C_DIFF_LOCATION
=
"DiffLocation"
;
}
// namespace Constants
}
// namespace TextEditor
...
...
src/plugins/texteditor/texteditorsettings.cpp
View file @
3a2974b3
...
...
@@ -92,6 +92,7 @@ TextEditorSettings::TextEditorSettings(QObject *parent)
formatDescriptions
.
append
(
FormatDescription
(
QLatin1String
(
C_COMMENT
),
tr
(
"Comment"
),
Qt
::
darkGreen
));
formatDescriptions
.
append
(
FormatDescription
(
QLatin1String
(
C_DOXYGEN_COMMENT
),
tr
(
"Doxygen Comment"
),
Qt
::
darkBlue
));
formatDescriptions
.
append
(
FormatDescription
(
QLatin1String
(
C_DOXYGEN_TAG
),
tr
(
"Doxygen Tag"
),
Qt
::
blue
));
formatDescriptions
.
append
(
FormatDescription
(
QLatin1String
(
C_VISUAL_WHITESPACE
),
tr
(
"Visual Whitespace"
),
Qt
::
lightGray
));
formatDescriptions
.
append
(
FormatDescription
(
QLatin1String
(
C_DISABLED_CODE
),
tr
(
"Disabled Code"
),
Qt
::
gray
));
// Diff categories
...
...
src/shared/qscripthighlighter/qscripthighlighter.cpp
View file @
3a2974b3
...
...
@@ -203,6 +203,7 @@ const QVector<QTextCharFormat> &QScriptHighlighter::defaultFormats()
rc
[
CommentFormat
].
setForeground
(
Qt
::
red
);
rc
[
CommentFormat
].
setFontItalic
(
true
);
rc
[
PreProcessorFormat
].
setForeground
(
Qt
::
darkBlue
);
rc
[
VisualWhitespace
].
setForeground
(
Qt
::
lightGray
);
}
return
rc
;
}
...
...
src/shared/qscripthighlighter/qscripthighlighter.h
View file @
3a2974b3
...
...
@@ -47,6 +47,7 @@ public:
enum
{
NumberFormat
,
StringFormat
,
TypeFormat
,
KeywordFormat
,
PreProcessorFormat
,
LabelFormat
,
CommentFormat
,
VisualWhitespace
,
NumFormats
};
bool
isDuiEnabled
()
const
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment