aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/sqlitestudiocli/cli.cpp
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2015-11-25 16:48:49 -0500
committerLibravatarUnit 193 <unit193@ubuntu.com>2015-11-25 16:48:49 -0500
commit7412693e086a7eafaa7ea861164caf523943e5fa (patch)
tree0aee322e40572df306b9813546c7a12b3093bcea /SQLiteStudio3/sqlitestudiocli/cli.cpp
parent640196993d31cf5d6fdf36386990ec05f473a048 (diff)
parent8e640722c62692818ab840d50b3758f89a41a54e (diff)
Merge tag 'upstream/3.0.7'
Upstream version 3.0.7 # gpg: Signature made Wed 25 Nov 2015 04:48:48 PM EST using RSA key ID EBE9BD91 # gpg: Good signature from "Unit 193 <unit193@gmail.com>" # gpg: aka "Unit 193 <unit193@ninthfloor.org>" # gpg: aka "Unit 193 <unit193@ubuntu.com>" # gpg: aka "Unit 193 <unit193@ninthfloor.com>"
Diffstat (limited to 'SQLiteStudio3/sqlitestudiocli/cli.cpp')
-rw-r--r--SQLiteStudio3/sqlitestudiocli/cli.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/SQLiteStudio3/sqlitestudiocli/cli.cpp b/SQLiteStudio3/sqlitestudiocli/cli.cpp
index 0f527ac..87c4f93 100644
--- a/SQLiteStudio3/sqlitestudiocli/cli.cpp
+++ b/SQLiteStudio3/sqlitestudiocli/cli.cpp
@@ -9,12 +9,14 @@
#include "common/utils_sql.h"
#include "climsghandler.h"
#include "clicompleter.h"
+#include "services/notifymanager.h"
#include <QCoreApplication>
#include <QThread>
#include <QFile>
#include <QSet>
#include <QStringList>
#include <QLibrary>
+#include <QString>
#if defined(Q_OS_WIN32)
#include "readline.h"
@@ -36,6 +38,9 @@ CLI::CLI(QObject* parent) :
history_base = 0; // for some reason this was set to 1 under Unix, making 1st history entry to be always ommited
#endif
+ connect(NOTIFY_MANAGER, SIGNAL(notifyInfo(QString)), this, SLOT(printInfo(QString)));
+ connect(NOTIFY_MANAGER, SIGNAL(notifyWarning(QString)), this, SLOT(printWarn(QString)));
+ connect(NOTIFY_MANAGER, SIGNAL(notifyError(QString)), this, SLOT(printError(QString)));
loadHistory();
CliCompleter::getInstance()->init(this);
@@ -43,6 +48,7 @@ CLI::CLI(QObject* parent) :
CLI::~CLI()
{
+ safe_delete(thread);
}
CLI* CLI::getInstance()
@@ -53,6 +59,11 @@ CLI* CLI::getInstance()
return instance;
}
+void CLI::dispose()
+{
+ safe_delete(instance);
+}
+
void CLI::start()
{
thread = new QThread(this);
@@ -153,6 +164,24 @@ int CLI::historyLength() const
#endif
}
+void CLI::printWarn(const QString &msg)
+{
+ static_qstring(tpl, "[WARNING] %1");
+ qOut << tpl.arg(msg) << "\n";
+}
+
+void CLI::printError(const QString &msg)
+{
+ static_qstring(tpl, "[ERROR] %1");
+ qOut << tpl.arg(msg) << "\n";
+}
+
+void CLI::printInfo(const QString &msg)
+{
+ static_qstring(tpl, "[INFO] %1");
+ qOut << tpl.arg(msg) << "\n";
+}
+
void CLI::waitForExecution()
{
executionFinished = false;