summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Krus <mike.krus@kdab.com>2019-12-12 13:53:57 +0000
committerMike Krus <mike.krus@kdab.com>2019-12-18 15:24:42 +0000
commit390982e5d62b76528ce345dfcac7325abc839935 (patch)
tree26615bb44fb304072bed6adb89c221a9d76befca
parent5aa183f8f50d9422cf6ed255b0a0c932508a7c04 (diff)
Expand System Information
Add methods to: - Reveal folder where trace files are saved in the file browser - Dump the output of commands to the console Change-Id: Iaad76b4db93dbf60df170aa53212a8f4df1b2283 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-rw-r--r--src/core/services/qsysteminformationservice.cpp26
-rw-r--r--src/core/services/qsysteminformationservice_p.h9
2 files changed, 31 insertions, 4 deletions
diff --git a/src/core/services/qsysteminformationservice.cpp b/src/core/services/qsysteminformationservice.cpp
index 564138b23..212038eea 100644
--- a/src/core/services/qsysteminformationservice.cpp
+++ b/src/core/services/qsysteminformationservice.cpp
@@ -48,10 +48,13 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QFile>
#include <QtCore/QDateTime>
-#include <QtCore/QCoreApplication>
+#include <QtCore/QUrl>
+#include <QtCore/QDir>
+#include <QtGui/QDesktopServices>
#include <Qt3DCore/QAspectEngine>
#include <Qt3DCore/QAbstractAspect>
+#include <Qt3DCore/private/qabstractaspect_p.h>
#include <Qt3DCore/private/qaspectengine_p.h>
#include <Qt3DCore/private/aspectcommanddebugger_p.h>
@@ -382,6 +385,11 @@ void QSystemInformationService::writePreviousFrameTraces()
d->writeFrameJobLogStats();
}
+void QSystemInformationService::revealLogFolder()
+{
+ QDesktopServices::openUrl(QUrl::fromLocalFile(QDir::currentPath()));
+}
+
QVariant QSystemInformationService::executeCommand(const QString &command)
{
Q_D(QSystemInformationService);
@@ -409,6 +417,22 @@ QVariant QSystemInformationService::executeCommand(const QString &command)
return d->m_aspectEngine->executeCommand(command);
}
+void QSystemInformationService::dumpCommand(const QString &command)
+{
+ QVariant res = executeCommand(command);
+ QObject *obj = res.value<QObject *>();
+ if (obj) {
+ auto reply = qobject_cast<Qt3DCore::Debug::AsynchronousCommandReply*>(obj);
+ if (reply) {
+ connect(reply, &Debug::AsynchronousCommandReply::finished, this, [reply]() {
+ qWarning() << qPrintable( QLatin1String(reply->data()) );
+ });
+ return;
+ }
+ }
+ qWarning() << res;
+}
+
}
QT_END_NAMESPACE
diff --git a/src/core/services/qsysteminformationservice_p.h b/src/core/services/qsysteminformationservice_p.h
index 8851a0ccc..4e6dc0c00 100644
--- a/src/core/services/qsysteminformationservice_p.h
+++ b/src/core/services/qsysteminformationservice_p.h
@@ -53,6 +53,7 @@
#include <Qt3DCore/qt3dcore_global.h>
#include <QtCore/qstringlist.h>
+#include <QtCore/qvariant.h>
#include <Qt3DCore/private/qservicelocator_p.h>
@@ -76,15 +77,17 @@ public:
bool isGraphicsTraceEnabled() const;
bool isCommandServerEnabled() const;
- void setTraceEnabled(bool traceEnabled);
- void setGraphicsTraceEnabled(bool graphicsTraceEnabled);
-
QStringList aspectNames() const;
int threadPoolThreadCount() const;
void writePreviousFrameTraces();
+ Q_INVOKABLE void revealLogFolder();
+public Q_SLOTS:
+ void setTraceEnabled(bool traceEnabled);
+ void setGraphicsTraceEnabled(bool graphicsTraceEnabled);
QVariant executeCommand(const QString &command);
+ void dumpCommand(const QString &command);
signals:
void traceEnabledChanged(bool traceEnabled);