diff options
| author | 2014-12-06 17:33:25 -0500 | |
|---|---|---|
| committer | 2014-12-06 17:33:25 -0500 | |
| commit | 7167ce41b61d2ba2cdb526777a4233eb84a3b66a (patch) | |
| tree | a35c14143716e1f2c98f808c81f89426045a946f /Plugins/SqlFormatterSimple/sqlformattersimpleplugin.cpp | |
Imported Upstream version 2.99.6upstream/2.99.6
Diffstat (limited to 'Plugins/SqlFormatterSimple/sqlformattersimpleplugin.cpp')
| -rw-r--r-- | Plugins/SqlFormatterSimple/sqlformattersimpleplugin.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/Plugins/SqlFormatterSimple/sqlformattersimpleplugin.cpp b/Plugins/SqlFormatterSimple/sqlformattersimpleplugin.cpp new file mode 100644 index 0000000..0cb60c5 --- /dev/null +++ b/Plugins/SqlFormatterSimple/sqlformattersimpleplugin.cpp @@ -0,0 +1,50 @@ +#include "sqlformattersimpleplugin.h"
+
+SqlFormatterSimplePlugin::SqlFormatterSimplePlugin()
+{
+}
+
+QString SqlFormatterSimplePlugin::format(SqliteQueryPtr query)
+{
+ TokenList tokens = query->tokens;
+ foreach (TokenPtr token, tokens)
+ {
+ if (token->type == Token::KEYWORD && cfg.SqlFormatterSimple.UpperCaseKeywords.get())
+ token->value = token->value.toUpper();
+
+ if (token->type == Token::SPACE && cfg.SqlFormatterSimple.TrimLongSpaces.get() &&
+ token->value.length() > 1)
+ token->value = " ";
+ }
+
+ return tokens.detokenize();
+}
+
+bool SqlFormatterSimplePlugin::init()
+{
+ Q_INIT_RESOURCE(sqlformattersimple);
+ return GenericPlugin::init();
+}
+
+void SqlFormatterSimplePlugin::deinit()
+{
+ Q_CLEANUP_RESOURCE(sqlformattersimple);
+}
+
+QString SqlFormatterSimplePlugin::getConfigUiForm() const
+{
+ return "SqlFormatterSimplePlugin";
+}
+
+CfgMain* SqlFormatterSimplePlugin::getMainUiConfig()
+{
+ return &cfg;
+}
+
+void SqlFormatterSimplePlugin::configDialogOpen()
+{
+}
+
+void SqlFormatterSimplePlugin::configDialogClosed()
+{
+}
|
