diff options
Diffstat (limited to 'sinksh')
-rw-r--r-- | sinksh/CMakeLists.txt | 3 | ||||
-rw-r--r-- | sinksh/repl/replStates.cpp | 4 | ||||
-rw-r--r-- | sinksh/sinksh_utils.cpp | 2 | ||||
-rw-r--r-- | sinksh/sinksh_utils.h | 3 | ||||
-rw-r--r-- | sinksh/syntax_modules/core_syntax.cpp | 55 | ||||
-rw-r--r-- | sinksh/syntax_modules/sink_clear.cpp | 2 |
6 files changed, 63 insertions, 6 deletions
diff --git a/sinksh/CMakeLists.txt b/sinksh/CMakeLists.txt index 1489fb3..3149347 100644 --- a/sinksh/CMakeLists.txt +++ b/sinksh/CMakeLists.txt | |||
@@ -2,7 +2,6 @@ project(sinksh) | |||
2 | 2 | ||
3 | find_package(Readline REQUIRED) | 3 | find_package(Readline REQUIRED) |
4 | 4 | ||
5 | |||
6 | set(sink_cli_SRCS | 5 | set(sink_cli_SRCS |
7 | main.cpp | 6 | main.cpp |
8 | syntaxtree.cpp | 7 | syntaxtree.cpp |
@@ -24,6 +23,6 @@ set(sink_cli_SRCS | |||
24 | include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) | 23 | include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) |
25 | 24 | ||
26 | add_executable(${PROJECT_NAME} ${sink_cli_SRCS}) | 25 | add_executable(${PROJECT_NAME} ${sink_cli_SRCS}) |
27 | target_link_libraries(${PROJECT_NAME} Qt5::Core ${Readline_LIBRARY} sinkcommon) | 26 | target_link_libraries(${PROJECT_NAME} Qt5::Core ${Readline_LIBRARY} sink) |
28 | install(TARGETS ${PROJECT_NAME} ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) | 27 | install(TARGETS ${PROJECT_NAME} ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) |
29 | 28 | ||
diff --git a/sinksh/repl/replStates.cpp b/sinksh/repl/replStates.cpp index 43b1353..0cd2620 100644 --- a/sinksh/repl/replStates.cpp +++ b/sinksh/repl/replStates.cpp | |||
@@ -168,4 +168,8 @@ static char *sink_cli_next_tab_complete_match(const char *text, int state) | |||
168 | return rl_filename_completion_function(text, state); | 168 | return rl_filename_completion_function(text, state); |
169 | } | 169 | } |
170 | 170 | ||
171 | //Ignore warning I don't know how to fix in a moc file | ||
172 | #pragma clang diagnostic push | ||
173 | #pragma clang diagnostic ignored "-Wundefined-reinterpret-cast" | ||
171 | #include "moc_replStates.cpp" | 174 | #include "moc_replStates.cpp" |
175 | #pragma clang diagnostic pop | ||
diff --git a/sinksh/sinksh_utils.cpp b/sinksh/sinksh_utils.cpp index fa06b34..d5b1c22 100644 --- a/sinksh/sinksh_utils.cpp +++ b/sinksh/sinksh_utils.cpp | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | #include "sinksh_utils.h" | 21 | #include "sinksh_utils.h" |
22 | 22 | ||
23 | #include "common/clientapi.h" | 23 | #include "common/store.h" |
24 | 24 | ||
25 | #include "utils.h" | 25 | #include "utils.h" |
26 | 26 | ||
diff --git a/sinksh/sinksh_utils.h b/sinksh/sinksh_utils.h index 457f644..bc4f6e5 100644 --- a/sinksh/sinksh_utils.h +++ b/sinksh/sinksh_utils.h | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <QSharedPointer> | 24 | #include <QSharedPointer> |
25 | 25 | ||
26 | #include "common/query.h" | 26 | #include "common/query.h" |
27 | #include "common/clientapi.h" | 27 | #include "common/store.h" |
28 | 28 | ||
29 | #include "state.h" | 29 | #include "state.h" |
30 | 30 | ||
@@ -47,6 +47,7 @@ QMap<QString, QString> keyValueMapFromArgs(const QStringList &args); | |||
47 | */ | 47 | */ |
48 | class StoreBase { | 48 | class StoreBase { |
49 | public: | 49 | public: |
50 | virtual ~StoreBase() {}; | ||
50 | virtual Sink::ApplicationDomain::ApplicationDomainType::Ptr getObject() = 0; | 51 | virtual Sink::ApplicationDomain::ApplicationDomainType::Ptr getObject() = 0; |
51 | virtual Sink::ApplicationDomain::ApplicationDomainType::Ptr getObject(const QByteArray &resourceInstanceIdentifier, const QByteArray &identifier = QByteArray()) = 0; | 52 | virtual Sink::ApplicationDomain::ApplicationDomainType::Ptr getObject(const QByteArray &resourceInstanceIdentifier, const QByteArray &identifier = QByteArray()) = 0; |
52 | virtual KAsync::Job<void> create(const Sink::ApplicationDomain::ApplicationDomainType &type) = 0; | 53 | virtual KAsync::Job<void> create(const Sink::ApplicationDomain::ApplicationDomainType &type) = 0; |
diff --git a/sinksh/syntax_modules/core_syntax.cpp b/sinksh/syntax_modules/core_syntax.cpp index f5b6274..e90d894 100644 --- a/sinksh/syntax_modules/core_syntax.cpp +++ b/sinksh/syntax_modules/core_syntax.cpp | |||
@@ -25,6 +25,7 @@ | |||
25 | #include "state.h" | 25 | #include "state.h" |
26 | #include "syntaxtree.h" | 26 | #include "syntaxtree.h" |
27 | #include "utils.h" | 27 | #include "utils.h" |
28 | #include "common/log.h" | ||
28 | 29 | ||
29 | namespace CoreSyntax | 30 | namespace CoreSyntax |
30 | { | 31 | { |
@@ -32,7 +33,6 @@ namespace CoreSyntax | |||
32 | bool exit(const QStringList &, State &) | 33 | bool exit(const QStringList &, State &) |
33 | { | 34 | { |
34 | ::exit(0); | 35 | ::exit(0); |
35 | return true; | ||
36 | } | 36 | } |
37 | 37 | ||
38 | bool showHelp(const QStringList &commands, State &state) | 38 | bool showHelp(const QStringList &commands, State &state) |
@@ -164,6 +164,49 @@ bool printLoggingLevel(const QStringList &commands, State &state) | |||
164 | return true; | 164 | return true; |
165 | } | 165 | } |
166 | 166 | ||
167 | bool setLoggingAreas(const QStringList &commands, State &state) | ||
168 | { | ||
169 | if (commands.isEmpty()) { | ||
170 | state.printError(QObject::tr("Wrong number of arguments; expected logging areas.")); | ||
171 | return false; | ||
172 | } | ||
173 | |||
174 | QByteArrayList areas; | ||
175 | for (const auto &c : commands) { | ||
176 | areas << c.toLatin1(); | ||
177 | } | ||
178 | |||
179 | Sink::Log::setDebugOutputFilter(Sink::Log::Area, areas); | ||
180 | return true; | ||
181 | } | ||
182 | |||
183 | bool setLoggingFilter(const QStringList &commands, State &state) | ||
184 | { | ||
185 | if (commands.isEmpty()) { | ||
186 | state.printError(QObject::tr("Wrong number of arguments; expected resource identifier or application names.")); | ||
187 | return false; | ||
188 | } | ||
189 | |||
190 | QByteArrayList filter; | ||
191 | for (const auto &c : commands) { | ||
192 | filter << c.toLatin1(); | ||
193 | } | ||
194 | |||
195 | Sink::Log::setDebugOutputFilter(Sink::Log::ApplicationName, filter); | ||
196 | return true; | ||
197 | } | ||
198 | |||
199 | bool setLoggingFields(const QStringList &commands, State &state) | ||
200 | { | ||
201 | QByteArrayList output; | ||
202 | for (const auto &c : commands) { | ||
203 | output << c.toLatin1(); | ||
204 | } | ||
205 | |||
206 | Sink::Log::setDebugOutputFields(output); | ||
207 | return true; | ||
208 | } | ||
209 | |||
167 | Syntax::List syntax() | 210 | Syntax::List syntax() |
168 | { | 211 | { |
169 | Syntax::List syntax; | 212 | Syntax::List syntax; |
@@ -187,6 +230,16 @@ Syntax::List syntax() | |||
187 | logging.completer = [](const QStringList &, const QString &fragment, State &state) -> QStringList { return Utils::filteredCompletions(QStringList() << "trace" << "log" << "warning" << "error", fragment, Qt::CaseInsensitive); }; | 230 | logging.completer = [](const QStringList &, const QString &fragment, State &state) -> QStringList { return Utils::filteredCompletions(QStringList() << "trace" << "log" << "warning" << "error", fragment, Qt::CaseInsensitive); }; |
188 | set.children << logging; | 231 | set.children << logging; |
189 | 232 | ||
233 | Syntax loggingAreas("loggingAreas", QObject::tr("Set logging areas."), &CoreSyntax::setLoggingAreas); | ||
234 | set.children << loggingAreas; | ||
235 | |||
236 | Syntax loggingFilter("loggingFilter", QObject::tr("Set logging filter."), &CoreSyntax::setLoggingFilter); | ||
237 | set.children << loggingFilter; | ||
238 | |||
239 | Syntax loggingFields("loggingFields", QObject::tr("Set logging fields."), &CoreSyntax::setLoggingFields); | ||
240 | loggingFields.completer = [](const QStringList &, const QString &fragment, State &state) -> QStringList { return Utils::filteredCompletions(QStringList() << "name" << "function" << "location" << "", fragment, Qt::CaseInsensitive); }; | ||
241 | set.children << loggingFields; | ||
242 | |||
190 | syntax << set; | 243 | syntax << set; |
191 | 244 | ||
192 | Syntax get("get", QObject::tr("Gets settings for the session")); | 245 | Syntax get("get", QObject::tr("Gets settings for the session")); |
diff --git a/sinksh/syntax_modules/sink_clear.cpp b/sinksh/syntax_modules/sink_clear.cpp index d02c638..72d9a14 100644 --- a/sinksh/syntax_modules/sink_clear.cpp +++ b/sinksh/syntax_modules/sink_clear.cpp | |||
@@ -41,7 +41,7 @@ bool clear(const QStringList &args, State &state) | |||
41 | { | 41 | { |
42 | for (const auto &resource : args) { | 42 | for (const auto &resource : args) { |
43 | state.print(QObject::tr("Removing local cache for '%1' ...").arg(resource)); | 43 | state.print(QObject::tr("Removing local cache for '%1' ...").arg(resource)); |
44 | Sink::Store::removeFromDisk(resource.toLatin1()); | 44 | Sink::Store::removeDataFromDisk(resource.toLatin1()).exec().waitForFinished(); |
45 | state.printLine(QObject::tr("done")); | 45 | state.printLine(QObject::tr("done")); |
46 | } | 46 | } |
47 | 47 | ||