summaryrefslogtreecommitdiff
path: root/src/plugins/glsleditor
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2010-12-01 15:44:50 +1000
committerRhys Weatherley <rhys.weatherley@nokia.com>2010-12-01 15:44:50 +1000
commite117f04fabde000f4c0aae7cc1a82c58da1ba4c3 (patch)
tree5f359f97cbb0f98892bc6c3265dda0dcb2cbe5de /src/plugins/glsleditor
parentecf4baec663e5c2368056a6a79efa7078719026c (diff)
downloadqt-creator-e117f04fabde000f4c0aae7cc1a82c58da1ba4c3.tar.gz
Show different icons for GLSL variable categories
Attributes, uniforms, varyings, and constants are shown with a distinguished icon that is different from regular variables.
Diffstat (limited to 'src/plugins/glsleditor')
-rw-r--r--src/plugins/glsleditor/glslcodecompletion.cpp26
-rw-r--r--src/plugins/glsleditor/glslcodecompletion.h4
-rw-r--r--src/plugins/glsleditor/glsleditor.qrc4
-rw-r--r--src/plugins/glsleditor/images/attribute.pngbin0 -> 583 bytes
-rw-r--r--src/plugins/glsleditor/images/const.pngbin0 -> 478 bytes
-rw-r--r--src/plugins/glsleditor/images/uniform.pngbin0 -> 583 bytes
-rw-r--r--src/plugins/glsleditor/images/varying.pngbin0 -> 585 bytes
7 files changed, 30 insertions, 4 deletions
diff --git a/src/plugins/glsleditor/glslcodecompletion.cpp b/src/plugins/glsleditor/glslcodecompletion.cpp
index ff89180275..042f4c8a77 100644
--- a/src/plugins/glsleditor/glslcodecompletion.cpp
+++ b/src/plugins/glsleditor/glslcodecompletion.cpp
@@ -492,6 +492,10 @@ CodeCompletion::CodeCompletion(QObject *parent)
m_varIcon(":/glsleditor/images/var.png"),
m_functionIcon(":/glsleditor/images/func.png"),
m_typeIcon(":/glsleditor/images/type.png"),
+ m_constIcon(":/glsleditor/images/const.png"),
+ m_attributeIcon(":/glsleditor/images/attribute.png"),
+ m_uniformIcon(":/glsleditor/images/uniform.png"),
+ m_varyingIcon(":/glsleditor/images/varying.png"),
m_otherIcon(":/glsleditor/images/other.png")
{
const QIcon keywordIcon(QLatin1String(":/glsleditor/images/keyword.png"));
@@ -678,14 +682,28 @@ int CodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
foreach (GLSL::Symbol *s, members) {
TextEditor::CompletionItem item(this);
- if (s->asVariable() || s->asArgument())
+ GLSL::Variable *var = s->asVariable();
+ if (var) {
+ int storageType = var->qualifiers() & GLSL::QualifiedTypeAST::StorageMask;
+ if (storageType == GLSL::QualifiedTypeAST::Attribute)
+ item.icon = m_attributeIcon;
+ else if (storageType == GLSL::QualifiedTypeAST::Uniform)
+ item.icon = m_uniformIcon;
+ else if (storageType == GLSL::QualifiedTypeAST::Varying)
+ item.icon = m_varyingIcon;
+ else if (storageType == GLSL::QualifiedTypeAST::Const)
+ item.icon = m_constIcon;
+ else
+ item.icon = m_varIcon;
+ } else if (s->asArgument()) {
item.icon = m_varIcon;
- else if (s->asFunction() || s->asOverloadSet())
+ } else if (s->asFunction() || s->asOverloadSet()) {
item.icon = m_functionIcon;
- else if (s->asStruct())
+ } else if (s->asStruct()) {
item.icon = m_typeIcon;
- else
+ } else {
item.icon = m_otherIcon;
+ }
item.text = s->name();
if (specialMembers.contains(item.text))
item.order = SpecialMemberOrder;
diff --git a/src/plugins/glsleditor/glslcodecompletion.h b/src/plugins/glsleditor/glslcodecompletion.h
index f8110bcffc..7eb3796e46 100644
--- a/src/plugins/glsleditor/glslcodecompletion.h
+++ b/src/plugins/glsleditor/glslcodecompletion.h
@@ -110,6 +110,10 @@ private:
QIcon m_varIcon;
QIcon m_functionIcon;
QIcon m_typeIcon;
+ QIcon m_constIcon;
+ QIcon m_attributeIcon;
+ QIcon m_uniformIcon;
+ QIcon m_varyingIcon;
QIcon m_otherIcon;
};
diff --git a/src/plugins/glsleditor/glsleditor.qrc b/src/plugins/glsleditor/glsleditor.qrc
index 4003791125..3455048e00 100644
--- a/src/plugins/glsleditor/glsleditor.qrc
+++ b/src/plugins/glsleditor/glsleditor.qrc
@@ -6,6 +6,10 @@
<file>images/var.png</file>
<file>images/func.png</file>
<file>images/type.png</file>
+ <file>images/const.png</file>
+ <file>images/attribute.png</file>
+ <file>images/uniform.png</file>
+ <file>images/varying.png</file>
<file>images/other.png</file>
</qresource>
</RCC>
diff --git a/src/plugins/glsleditor/images/attribute.png b/src/plugins/glsleditor/images/attribute.png
new file mode 100644
index 0000000000..94f20ac42a
--- /dev/null
+++ b/src/plugins/glsleditor/images/attribute.png
Binary files differ
diff --git a/src/plugins/glsleditor/images/const.png b/src/plugins/glsleditor/images/const.png
new file mode 100644
index 0000000000..25fc49c659
--- /dev/null
+++ b/src/plugins/glsleditor/images/const.png
Binary files differ
diff --git a/src/plugins/glsleditor/images/uniform.png b/src/plugins/glsleditor/images/uniform.png
new file mode 100644
index 0000000000..c6452fc8c6
--- /dev/null
+++ b/src/plugins/glsleditor/images/uniform.png
Binary files differ
diff --git a/src/plugins/glsleditor/images/varying.png b/src/plugins/glsleditor/images/varying.png
new file mode 100644
index 0000000000..c2551c0025
--- /dev/null
+++ b/src/plugins/glsleditor/images/varying.png
Binary files differ