aboutsummaryrefslogtreecommitdiffstats
path: root/Plugins/SqlEnterpriseFormatter
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2015-11-25 16:48:41 -0500
committerLibravatarUnit 193 <unit193@ubuntu.com>2015-11-25 16:48:41 -0500
commit8e640722c62692818ab840d50b3758f89a41a54e (patch)
tree38197eb1688a5afc338081ea17e15f938976e422 /Plugins/SqlEnterpriseFormatter
parent9618f0ebbf4b88045247c01ce8c8f58203508ebf (diff)
Imported Upstream version 3.0.7upstream/3.0.7
Diffstat (limited to 'Plugins/SqlEnterpriseFormatter')
-rw-r--r--Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter.pro4
-rw-r--r--Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_de.ts31
-rw-r--r--Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_es.ts31
-rw-r--r--Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_fr.ts31
-rw-r--r--Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_it.ts233
-rw-r--r--Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_pl.ts31
-rw-r--r--Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_pt_BR.ts31
-rw-r--r--Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_ru.ts33
-rw-r--r--Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_sk.ts31
-rw-r--r--Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_zh_CN.ts31
-rw-r--r--Plugins/SqlEnterpriseFormatter/formatempty.cpp5
-rw-r--r--Plugins/SqlEnterpriseFormatter/formatempty.h3
-rw-r--r--Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.cpp206
-rw-r--r--Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.h23
-rw-r--r--Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.ui69
15 files changed, 754 insertions, 39 deletions
diff --git a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter.pro b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter.pro
index 965767b..5af5bfa 100644
--- a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter.pro
+++ b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter.pro
@@ -100,7 +100,8 @@ RESOURCES += \
sqlenterpriseformatter.qrc
-TRANSLATIONS += SqlEnterpriseFormatter_zh_CN.ts \
+TRANSLATIONS += SqlEnterpriseFormatter_it.ts \
+ SqlEnterpriseFormatter_zh_CN.ts \
SqlEnterpriseFormatter_sk.ts \
SqlEnterpriseFormatter_de.ts \
SqlEnterpriseFormatter_ru.ts \
@@ -120,3 +121,4 @@ TRANSLATIONS += SqlEnterpriseFormatter_zh_CN.ts \
+
diff --git a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_de.ts b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_de.ts
index a83f5df..37751d0 100644
--- a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_de.ts
+++ b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_de.ts
@@ -4,8 +4,8 @@
<context>
<name>QObject</name>
<message>
- <location filename="sqlenterpriseformatter.cpp" line="82"/>
- <location filename="sqlenterpriseformatter.cpp" line="89"/>
+ <location filename="sqlenterpriseformatter.cpp" line="91"/>
+ <location filename="sqlenterpriseformatter.cpp" line="98"/>
<source>name</source>
<comment>example name wrapper</comment>
<translation type="unfinished"></translation>
@@ -200,7 +200,32 @@
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="sqlenterpriseformatter.ui" line="638"/>
+ <location filename="sqlenterpriseformatter.ui" line="631"/>
+ <source>Comments</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="637"/>
+ <source>Preferred comment marker (where possible):</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="647"/>
+ <source>SqlEnterpriseFormatter.CommentMarkers</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="654"/>
+ <source>Move all comments to the line end</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="664"/>
+ <source>Line up comments at the line end</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="695"/>
<source>Preview</source>
<translation type="unfinished"></translation>
</message>
diff --git a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_es.ts b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_es.ts
index 4d873e5..b0b5eed 100644
--- a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_es.ts
+++ b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_es.ts
@@ -4,8 +4,8 @@
<context>
<name>QObject</name>
<message>
- <location filename="sqlenterpriseformatter.cpp" line="82"/>
- <location filename="sqlenterpriseformatter.cpp" line="89"/>
+ <location filename="sqlenterpriseformatter.cpp" line="91"/>
+ <location filename="sqlenterpriseformatter.cpp" line="98"/>
<source>name</source>
<comment>example name wrapper</comment>
<translation type="unfinished"></translation>
@@ -200,7 +200,32 @@
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="sqlenterpriseformatter.ui" line="638"/>
+ <location filename="sqlenterpriseformatter.ui" line="631"/>
+ <source>Comments</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="637"/>
+ <source>Preferred comment marker (where possible):</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="647"/>
+ <source>SqlEnterpriseFormatter.CommentMarkers</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="654"/>
+ <source>Move all comments to the line end</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="664"/>
+ <source>Line up comments at the line end</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="695"/>
<source>Preview</source>
<translation type="unfinished"></translation>
</message>
diff --git a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_fr.ts b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_fr.ts
index 8a9178b..d0e62f7 100644
--- a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_fr.ts
+++ b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_fr.ts
@@ -4,8 +4,8 @@
<context>
<name>QObject</name>
<message>
- <location filename="sqlenterpriseformatter.cpp" line="82"/>
- <location filename="sqlenterpriseformatter.cpp" line="89"/>
+ <location filename="sqlenterpriseformatter.cpp" line="91"/>
+ <location filename="sqlenterpriseformatter.cpp" line="98"/>
<source>name</source>
<comment>example name wrapper</comment>
<translation>Nom</translation>
@@ -200,7 +200,32 @@
<translation>Mots clé en majuscule</translation>
</message>
<message>
- <location filename="sqlenterpriseformatter.ui" line="638"/>
+ <location filename="sqlenterpriseformatter.ui" line="631"/>
+ <source>Comments</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="637"/>
+ <source>Preferred comment marker (where possible):</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="647"/>
+ <source>SqlEnterpriseFormatter.CommentMarkers</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="654"/>
+ <source>Move all comments to the line end</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="664"/>
+ <source>Line up comments at the line end</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="695"/>
<source>Preview</source>
<translation>Aperçu</translation>
</message>
diff --git a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_it.ts b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_it.ts
new file mode 100644
index 0000000..9e721a4
--- /dev/null
+++ b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_it.ts
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="it_IT">
+<context>
+ <name>QObject</name>
+ <message>
+ <location filename="sqlenterpriseformatter.cpp" line="91"/>
+ <location filename="sqlenterpriseformatter.cpp" line="98"/>
+ <source>name</source>
+ <comment>example name wrapper</comment>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>SqlEnterpriseFormatter</name>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="46"/>
+ <source>Indentation</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="58"/>
+ <source>Line up keywords in multi-line queries</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="68"/>
+ <source>Indent contents of parenthesis block</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="91"/>
+ <source>Tab size:</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="106"/>
+ <source>New lines</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="160"/>
+ <source>Before opening parenthesis in column definitions</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="170"/>
+ <source>After opening parenthesis in column definitions</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="180"/>
+ <source>Before closing parenthesis in column definitions</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="190"/>
+ <source>After closing parenthesis in column definitions</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="200"/>
+ <source>Before opening parenthesis in expressions</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="210"/>
+ <source>After opening parenthesis in expressions</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="220"/>
+ <source>Before closing parenthesis in expressions</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="230"/>
+ <source>After closing parenthesis in expressions</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="240"/>
+ <source>After JOIN keywords in FROM clause</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="250"/>
+ <source>Put each column constraint in CREATE TABLE into new line</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="260"/>
+ <source>After comma</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="270"/>
+ <source>After comma in expressions</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="280"/>
+ <source>After semicolon</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="290"/>
+ <location filename="sqlenterpriseformatter.ui" line="512"/>
+ <source>Never before semicolon</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="338"/>
+ <source>White spaces</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="392"/>
+ <source>Before comma in lists</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="402"/>
+ <source>After comma in lists</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="412"/>
+ <source>Before opening parenthesis</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="422"/>
+ <source>After opening parenthesis</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="432"/>
+ <source>Before closing parenthesis</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="442"/>
+ <source>After closing parenthesis</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="452"/>
+ <source>No space between SQL function name and opening parenthesis</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="462"/>
+ <source>Before dot operator (in path to database object)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="472"/>
+ <source>After dot operator (in path to database object)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="482"/>
+ <source>Before mathematical operator</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="492"/>
+ <source>After mathematical operator</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="502"/>
+ <source>Never before comma</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="558"/>
+ <source>Names</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="583"/>
+ <source>Preferred name wrapper</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="600"/>
+ <source>Always use name wrapping</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="610"/>
+ <source>Uppercase data type names</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="620"/>
+ <source>Uppercase keywords</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="631"/>
+ <source>Comments</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="637"/>
+ <source>Preferred comment marker (where possible):</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="647"/>
+ <source>SqlEnterpriseFormatter.CommentMarkers</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="654"/>
+ <source>Move all comments to the line end</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="664"/>
+ <source>Line up comments at the line end</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="695"/>
+ <source>Preview</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_pl.ts b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_pl.ts
index 5cfbf32..2c03a46 100644
--- a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_pl.ts
+++ b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_pl.ts
@@ -4,8 +4,8 @@
<context>
<name>QObject</name>
<message>
- <location filename="sqlenterpriseformatter.cpp" line="82"/>
- <location filename="sqlenterpriseformatter.cpp" line="89"/>
+ <location filename="sqlenterpriseformatter.cpp" line="91"/>
+ <location filename="sqlenterpriseformatter.cpp" line="98"/>
<source>name</source>
<comment>example name wrapper</comment>
<translation>nazwa</translation>
@@ -201,7 +201,32 @@
<translation>Zmieniaj litery słów kluczowych na duże</translation>
</message>
<message>
- <location filename="sqlenterpriseformatter.ui" line="638"/>
+ <location filename="sqlenterpriseformatter.ui" line="631"/>
+ <source>Comments</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="637"/>
+ <source>Preferred comment marker (where possible):</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="647"/>
+ <source>SqlEnterpriseFormatter.CommentMarkers</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="654"/>
+ <source>Move all comments to the line end</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="664"/>
+ <source>Line up comments at the line end</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="695"/>
<source>Preview</source>
<translation>Podgląd</translation>
</message>
diff --git a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_pt_BR.ts b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_pt_BR.ts
index b89804a..a408ffc 100644
--- a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_pt_BR.ts
+++ b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_pt_BR.ts
@@ -4,8 +4,8 @@
<context>
<name>QObject</name>
<message>
- <location filename="sqlenterpriseformatter.cpp" line="82"/>
- <location filename="sqlenterpriseformatter.cpp" line="89"/>
+ <location filename="sqlenterpriseformatter.cpp" line="91"/>
+ <location filename="sqlenterpriseformatter.cpp" line="98"/>
<source>name</source>
<comment>example name wrapper</comment>
<translation type="unfinished"></translation>
@@ -200,7 +200,32 @@
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="sqlenterpriseformatter.ui" line="638"/>
+ <location filename="sqlenterpriseformatter.ui" line="631"/>
+ <source>Comments</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="637"/>
+ <source>Preferred comment marker (where possible):</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="647"/>
+ <source>SqlEnterpriseFormatter.CommentMarkers</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="654"/>
+ <source>Move all comments to the line end</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="664"/>
+ <source>Line up comments at the line end</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="695"/>
<source>Preview</source>
<translation type="unfinished"></translation>
</message>
diff --git a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_ru.ts b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_ru.ts
index a5656d8..4e5e98d 100644
--- a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_ru.ts
+++ b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_ru.ts
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
-<TS version="2.1" language="ru_RU">
+<TS version="2.0" language="ru_RU">
<context>
<name>QObject</name>
<message>
- <location filename="sqlenterpriseformatter.cpp" line="82"/>
- <location filename="sqlenterpriseformatter.cpp" line="89"/>
+ <location filename="sqlenterpriseformatter.cpp" line="91"/>
+ <location filename="sqlenterpriseformatter.cpp" line="98"/>
<source>name</source>
<comment>example name wrapper</comment>
<translation>имя</translation>
@@ -200,7 +200,32 @@
<translation>Приводить ключевые слова к верхнему регистру</translation>
</message>
<message>
- <location filename="sqlenterpriseformatter.ui" line="638"/>
+ <location filename="sqlenterpriseformatter.ui" line="631"/>
+ <source>Comments</source>
+ <translation>Комментарии</translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="637"/>
+ <source>Preferred comment marker (where possible):</source>
+ <translation>Предпочитаемый символ комментирования (где применимо):</translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="647"/>
+ <source>SqlEnterpriseFormatter.CommentMarkers</source>
+ <translation>SqlEnterpriseFormatter.CommentMarkers</translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="654"/>
+ <source>Move all comments to the line end</source>
+ <translation>Перемещать все комментарии в конец строки</translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="664"/>
+ <source>Line up comments at the line end</source>
+ <translation>Выравнивать комментарии в конце строки</translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="695"/>
<source>Preview</source>
<translation>Предпросмотр</translation>
</message>
diff --git a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_sk.ts b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_sk.ts
index 407cc6e..37a42a4 100644
--- a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_sk.ts
+++ b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_sk.ts
@@ -4,8 +4,8 @@
<context>
<name>QObject</name>
<message>
- <location filename="sqlenterpriseformatter.cpp" line="82"/>
- <location filename="sqlenterpriseformatter.cpp" line="89"/>
+ <location filename="sqlenterpriseformatter.cpp" line="91"/>
+ <location filename="sqlenterpriseformatter.cpp" line="98"/>
<source>name</source>
<comment>example name wrapper</comment>
<translation type="unfinished"></translation>
@@ -200,7 +200,32 @@
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="sqlenterpriseformatter.ui" line="638"/>
+ <location filename="sqlenterpriseformatter.ui" line="631"/>
+ <source>Comments</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="637"/>
+ <source>Preferred comment marker (where possible):</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="647"/>
+ <source>SqlEnterpriseFormatter.CommentMarkers</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="654"/>
+ <source>Move all comments to the line end</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="664"/>
+ <source>Line up comments at the line end</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="695"/>
<source>Preview</source>
<translation type="unfinished"></translation>
</message>
diff --git a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_zh_CN.ts b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_zh_CN.ts
index 3c80603..d1a361b 100644
--- a/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_zh_CN.ts
+++ b/Plugins/SqlEnterpriseFormatter/SqlEnterpriseFormatter_zh_CN.ts
@@ -4,8 +4,8 @@
<context>
<name>QObject</name>
<message>
- <location filename="sqlenterpriseformatter.cpp" line="82"/>
- <location filename="sqlenterpriseformatter.cpp" line="89"/>
+ <location filename="sqlenterpriseformatter.cpp" line="91"/>
+ <location filename="sqlenterpriseformatter.cpp" line="98"/>
<source>name</source>
<comment>example name wrapper</comment>
<translation type="unfinished"></translation>
@@ -200,7 +200,32 @@
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="sqlenterpriseformatter.ui" line="638"/>
+ <location filename="sqlenterpriseformatter.ui" line="631"/>
+ <source>Comments</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="637"/>
+ <source>Preferred comment marker (where possible):</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="647"/>
+ <source>SqlEnterpriseFormatter.CommentMarkers</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="654"/>
+ <source>Move all comments to the line end</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="664"/>
+ <source>Line up comments at the line end</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="sqlenterpriseformatter.ui" line="695"/>
<source>Preview</source>
<translation type="unfinished"></translation>
</message>
diff --git a/Plugins/SqlEnterpriseFormatter/formatempty.cpp b/Plugins/SqlEnterpriseFormatter/formatempty.cpp
index 976694e..d0696e0 100644
--- a/Plugins/SqlEnterpriseFormatter/formatempty.cpp
+++ b/Plugins/SqlEnterpriseFormatter/formatempty.cpp
@@ -1,8 +1,9 @@
#include "formatempty.h"
+#include "common/unused.h"
-FormatEmpty::FormatEmpty(SqliteEmptyQuery* eq) :
- eq(eq)
+FormatEmpty::FormatEmpty(SqliteEmptyQuery* eq)
{
+ UNUSED(eq);
}
void FormatEmpty::formatInternal()
diff --git a/Plugins/SqlEnterpriseFormatter/formatempty.h b/Plugins/SqlEnterpriseFormatter/formatempty.h
index 3279925..2fa3d01 100644
--- a/Plugins/SqlEnterpriseFormatter/formatempty.h
+++ b/Plugins/SqlEnterpriseFormatter/formatempty.h
@@ -12,9 +12,6 @@ class FormatEmpty : public FormatStatement
protected:
void formatInternal();
-
- private:
- SqliteEmptyQuery* eq = nullptr;
};
#endif // FORMATEMPTY_H
diff --git a/Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.cpp b/Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.cpp
index 8f75960..a08f95c 100644
--- a/Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.cpp
+++ b/Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.cpp
@@ -3,6 +3,7 @@
#include "common/unused.h"
#include "common/global.h"
#include <QDebug>
+#include <parser/lexer.h>
#include <parser/parser.h>
SqlEnterpriseFormatter::SqlEnterpriseFormatter()
@@ -11,6 +12,8 @@ SqlEnterpriseFormatter::SqlEnterpriseFormatter()
QString SqlEnterpriseFormatter::format(SqliteQueryPtr query)
{
+ QList<Comment*> comments = collectComments(query->tokens);
+
int wrapperIdx = cfg.SqlEnterpriseFormatter.Wrappers.get().indexOf(cfg.SqlEnterpriseFormatter.PrefferedWrapper.get());
NameWrapper wrapper = getAllNameWrappers()[wrapperIdx];
@@ -24,7 +27,11 @@ QString SqlEnterpriseFormatter::format(SqliteQueryPtr query)
QString formatted = formatStmt->format();
delete formatStmt;
- return formatted;
+ QString formattedWithComments = applyComments(formatted, comments, query->dialect);
+ for (Comment* c : comments)
+ delete c;
+
+ return formattedWithComments;
}
bool SqlEnterpriseFormatter::init()
@@ -34,7 +41,9 @@ bool SqlEnterpriseFormatter::init()
static_qstring(query1, "SELECT (2 + 4) AND (3 + 5), 4 NOT IN (SELECT t1.'some[_]name' + t2.[some'name2] FROM xyz t1 JOIN zxc t2 ON (t1.aaa = t2.aaa)) "
"FROM a, (SELECT id FROM table2);");
static_qstring(query2, "INSERT INTO table1 (id, value1, value2) VALUES (1, (2 + 5), (SELECT id FROM table2));");
- static_qstring(query3, "CREATE TABLE tab (id INTEGER PRIMARY KEY, value1 VARCHAR(6), value2 NUMBER(8,2) NOT NULL DEFAULT 1.0);");
+ static_qstring(query3, "CREATE TABLE tab (id INTEGER PRIMARY KEY, /*a primary key column*/ value1 VARCHAR(6), "
+ "value2 /*column with constraints*/ NUMBER(8,2) NOT NULL DEFAULT 1.0"
+ ");");
static_qstring(query4, "CREATE UNIQUE INDEX IF NOT EXISTS dbName.idx1 ON [messages column] (id COLLATE x ASC, lang DESC, description);");
Parser parser(Dialect::Sqlite3);
@@ -110,3 +119,196 @@ void SqlEnterpriseFormatter::configDialogClosed()
{
disconnect(&cfg.SqlEnterpriseFormatter, SIGNAL(changed(CfgEntry*)), this, SLOT(configModified(CfgEntry*)));
}
+
+QList<SqlEnterpriseFormatter::Comment *> SqlEnterpriseFormatter::collectComments(const TokenList &tokens)
+{
+ QList<Comment*> results;
+
+ QList<TokenList> tokensInLines = tokensByLines(tokens);
+ Comment* prevCommentInThisLine = nullptr;
+ Comment* cmt = nullptr;
+ bool tokensBefore = false;
+ int pos = 0;
+ int line = 0;
+ for (const TokenList& tokensInLine : tokensInLines)
+ {
+ tokensBefore = true;
+ prevCommentInThisLine = nullptr;
+ for (const TokenPtr& token : tokensInLine)
+ {
+ if (token->type == Token::Type::SPACE)
+ continue;
+
+ if (prevCommentInThisLine)
+ prevCommentInThisLine->tokensAfter = true;
+
+ if (token->type == Token::Type::COMMENT)
+ {
+ cmt = new Comment;
+ cmt->tokensBefore = tokensBefore;
+ cmt->position = pos;
+ cmt->multiline = token->value.startsWith("/*");
+ if (cmt->multiline)
+ cmt->contents = token->value.mid(2, token->value.length() - 4).trimmed();
+ else
+ cmt->contents = token->value.mid(2).trimmed();
+
+ results << cmt;
+ prevCommentInThisLine = cmt;
+ continue;
+ }
+
+ tokensBefore = true;
+ pos++;
+ }
+ line++;
+ }
+
+ return results;
+}
+
+QList<TokenList> SqlEnterpriseFormatter::tokensByLines(const TokenList &tokens, bool includeSpaces)
+{
+ QList<TokenList> tokensInLines;
+ TokenList tokensInLine;
+ for (const TokenPtr& token : tokens)
+ {
+ if (includeSpaces || token->type != Token::Type::SPACE)
+ tokensInLine << token;
+
+ if (token->type == Token::Type::SPACE && token->value.contains('\n'))
+ {
+ tokensInLines << tokensInLine;
+ tokensInLine.clear();
+ }
+ }
+ if (tokensInLine.size() > 0)
+ tokensInLines << tokensInLine;
+
+ return tokensInLines;
+}
+
+TokenList SqlEnterpriseFormatter::adjustCommentsToEnd(const TokenList &inputTokens)
+{
+ QList<TokenList> tokensInLines = tokensByLines(inputTokens, true);
+ TokenList newTokens;
+ TokenList commentTokensForLine;
+ TokenPtr newLineToken;
+ for (const TokenList& tokensInLine : tokensInLines)
+ {
+ commentTokensForLine.clear();
+ newLineToken.clear();
+ for (const TokenPtr& token : tokensInLine)
+ {
+ if (token->type == Token::Type::COMMENT)
+ {
+ wrapComment(token, true);
+ //token->value = " " + endLineCommentTpl.arg(token->value);
+ commentTokensForLine << token;
+ }
+ else if (token->type == Token::Type::SPACE && token->value.contains("\n"))
+ newLineToken = token;
+ else
+ newTokens << token;
+ }
+
+ newTokens += commentTokensForLine;
+ if (newLineToken)
+ newTokens << newLineToken;
+ }
+ return newTokens;
+}
+
+TokenList SqlEnterpriseFormatter::wrapOnlyComments(const TokenList &inputTokens)
+{
+ QList<TokenList> tokensInLines = tokensByLines(inputTokens, true);
+ TokenList newTokens;
+ bool lineEnd = true;
+ for (const TokenList& tokensInLine : reverse(tokensInLines))
+ {
+ lineEnd = true;
+ for (const TokenPtr& token : reverse(tokensInLine))
+ {
+ if (!token->isWhitespace())
+ lineEnd = false;
+
+ if (token->type == Token::Type::COMMENT)
+ wrapComment(token, lineEnd);
+
+ newTokens << token;
+ }
+ }
+ return reverse(newTokens);
+}
+
+TokenList SqlEnterpriseFormatter::optimizeInnerComments(const TokenList &inputTokens)
+{
+ // TODO
+ return inputTokens;
+}
+
+TokenList SqlEnterpriseFormatter::optimizeEndLineComments(const TokenList &inputTokens)
+{
+ // TODO
+ return inputTokens;
+}
+
+void SqlEnterpriseFormatter::indentMultiLineComments(const TokenList &inputTokens)
+{
+ // TODO
+}
+
+void SqlEnterpriseFormatter::wrapComment(const TokenPtr &token, bool isAtLineEnd)
+{
+ static_qstring(multiCommentTpl, "/* %1 */");
+ static_qstring(endLineCommentTpl, "-- %1");
+
+ bool isMultiLine = token->value.contains("\n");
+ if (isAtLineEnd && !isMultiLine && cfg.SqlEnterpriseFormatter.PreferredCommentMarker.get() == "--")
+ token->value = endLineCommentTpl.arg(token->value);
+ else
+ token->value = multiCommentTpl.arg(token->value);
+}
+
+QString SqlEnterpriseFormatter::applyComments(const QString& formatted, QList<SqlEnterpriseFormatter::Comment*> comments, Dialect dialect)
+{
+ if (comments.size() == 0)
+ return formatted;
+
+ int currentCommentPosition = comments.first()->position;
+
+ TokenList allTokens = Lexer::tokenize(formatted, dialect);
+ TokenList newTokens;
+ int currentTokenPosition = 0;
+ for (const TokenPtr& token : allTokens)
+ {
+ if (currentTokenPosition == currentCommentPosition)
+ {
+ newTokens << TokenPtr::create(Token::Type::COMMENT, comments.first()->contents);
+ comments.removeFirst();
+ if (comments.size() > 0)
+ currentCommentPosition = comments.first()->position;
+ else
+ currentCommentPosition = -1;
+ }
+
+ newTokens << token;
+ if (token->type != Token::Type::SPACE)
+ currentTokenPosition++;
+ }
+
+ // Any remaining comments
+ for (Comment* cmt : comments)
+ newTokens << TokenPtr::create(Token::Type::COMMENT, cmt->contents);
+
+ if (cfg.SqlEnterpriseFormatter.MoveAllCommentsToLineEnd.get())
+ newTokens = adjustCommentsToEnd(newTokens);
+ else
+ newTokens = wrapOnlyComments(newTokens);
+
+ newTokens = optimizeInnerComments(newTokens);
+ newTokens = optimizeEndLineComments(newTokens);
+ indentMultiLineComments(newTokens);
+
+ return newTokens.detokenize();
+}
diff --git a/Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.h b/Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.h
index 2701745..1f9b6d8 100644
--- a/Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.h
+++ b/Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.h
@@ -53,6 +53,10 @@ CFG_CATEGORIES(SqlEnterpriseFormatterConfig,
CFG_ENTRY(QString, PrefferedWrapper, getNameWrapperStr(NameWrapper::BRACKET))
CFG_ENTRY(QStringList, Wrappers, getNameWrapperStrings(), false)
CFG_ENTRY(QString, PreviewCode, QString(), false)
+ CFG_ENTRY(bool, MoveAllCommentsToLineEnd, false)
+ CFG_ENTRY(bool, LineUpCommentsAtLineEnd, true)
+ CFG_ENTRY(QString, PreferredCommentMarker, "--")
+ CFG_ENTRY(QStringList, CommentMarkers, QStringList({"--", "/* */"}))
)
)
@@ -73,6 +77,25 @@ class SQLENTERPRISEFORMATTERSHARED_EXPORT SqlEnterpriseFormatter : public Generi
void configDialogClosed();
private:
+ struct Comment
+ {
+ int position = 0;
+ QString contents;
+ bool tokensBefore = false;
+ bool tokensAfter = false;
+ bool multiline = false;
+ };
+
+ QList<Comment*> collectComments(const TokenList& tokens);
+ QString applyComments(const QString& formatted, QList<Comment *> comments, Dialect dialect);
+ QList<TokenList> tokensByLines(const TokenList& tokens, bool includeSpaces = false);
+ TokenList adjustCommentsToEnd(const TokenList& inputTokens);
+ TokenList wrapOnlyComments(const TokenList& inputTokens);
+ TokenList optimizeInnerComments(const TokenList& inputTokens);
+ TokenList optimizeEndLineComments(const TokenList& inputTokens);
+ void indentMultiLineComments(const TokenList& inputTokens);
+ void wrapComment(const TokenPtr& token, bool isAtLineEnd);
+
QList<SqliteQueryPtr> previewQueries;
CFG_LOCAL_PERSISTABLE(SqlEnterpriseFormatterConfig, cfg)
diff --git a/Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.ui b/Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.ui
index 2ebfbdf..b21de64 100644
--- a/Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.ui
+++ b/Plugins/SqlEnterpriseFormatter/sqlenterpriseformatter.ui
@@ -39,7 +39,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
- <number>1</number>
+ <number>0</number>
</property>
<widget class="QWidget" name="indentTab">
<attribute name="title">
@@ -133,9 +133,9 @@
<property name="geometry">
<rect>
<x>0</x>
- <y>-166</y>
- <width>578</width>
- <height>350</height>
+ <y>0</y>
+ <width>390</width>
+ <height>299</height>
</rect>
</property>
<property name="styleSheet">
@@ -366,8 +366,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>424</width>
- <height>325</height>
+ <width>418</width>
+ <height>278</height>
</rect>
</property>
<property name="styleSheet">
@@ -626,6 +626,63 @@
</item>
</layout>
</widget>
+ <widget class="QWidget" name="commentsTab">
+ <attribute name="title">
+ <string>Comments</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Preferred comment marker (where possible):</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="ConfigComboBox" name="comboBox_2">
+ <property name="cfg" stdset="0">
+ <string notr="true">SqlEnterpriseFormatter.PreferredCommentMarker</string>
+ </property>
+ <property name="modelName" stdset="0">
+ <string>SqlEnterpriseFormatter.CommentMarkers</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0" colspan="2">
+ <widget class="QCheckBox" name="checkBox_33">
+ <property name="text">
+ <string>Move all comments to the line end</string>
+ </property>
+ <property name="cfg" stdset="0">
+ <string notr="true">SqlEnterpriseFormatter.MoveAllCommentsToLineEnd</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2">
+ <widget class="QCheckBox" name="checkBox_34">
+ <property name="text">
+ <string>Line up comments at the line end</string>
+ </property>
+ <property name="cfg" stdset="0">
+ <string notr="true">SqlEnterpriseFormatter.LineUpCommentsAtLineEnd</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="2">
+ <spacer name="verticalSpacer_5">
+ <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>
+ </widget>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">