Compare commits
1 Commits
work/redst
...
work/tobia
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc890b6799 |
@@ -66,6 +66,8 @@ if (QT_KNOWN_POLICY_QTP0004)
|
||||
qt_policy(SET QTP0004 NEW)
|
||||
endif ()
|
||||
|
||||
find_package(sentry REQUIRED)
|
||||
|
||||
find_package(KF6 ${KF_MIN_VERSION} COMPONENTS Kirigami I18n Notifications Config CoreAddons Sonnet ItemModels IconThemes ColorScheme)
|
||||
set_package_properties(KF6 PROPERTIES
|
||||
TYPE REQUIRED
|
||||
|
||||
@@ -198,6 +198,8 @@ add_library(neochat STATIC
|
||||
models/pinnedmessagemodel.h
|
||||
models/commonroomsmodel.cpp
|
||||
models/commonroomsmodel.h
|
||||
sentryintegration.cpp
|
||||
sentryintegration.h
|
||||
)
|
||||
|
||||
set_source_files_properties(qml/OsmLocationPlugin.qml PROPERTIES
|
||||
@@ -298,6 +300,7 @@ ecm_add_qml_module(neochat URI org.kde.neochat GENERATE_PLUGIN_SOURCE
|
||||
qml/HoverLinkIndicator.qml
|
||||
qml/AvatarNotification.qml
|
||||
qml/ReasonDialog.qml
|
||||
qml/SendLogsDialog.qml
|
||||
DEPENDENCIES
|
||||
QtCore
|
||||
QtQuick
|
||||
@@ -430,6 +433,7 @@ target_link_libraries(neochat PUBLIC
|
||||
cmark::cmark
|
||||
QCoro::Core
|
||||
QCoro::Network
|
||||
sentry::sentry
|
||||
)
|
||||
|
||||
if (TARGET KF6::Crash)
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "controller.h"
|
||||
#include "logger.h"
|
||||
#include "roommanager.h"
|
||||
#include "sentryintegration.h"
|
||||
#include "sharehandler.h"
|
||||
#include "windowcontroller.h"
|
||||
|
||||
@@ -174,6 +175,8 @@ int main(int argc, char *argv[])
|
||||
KCrash::initialize();
|
||||
#endif
|
||||
|
||||
Sentry::instance();
|
||||
|
||||
initLogging();
|
||||
|
||||
Connection::setEncryptionDefault(true);
|
||||
|
||||
@@ -91,12 +91,21 @@ KirigamiComponents.ConvergentContextMenu {
|
||||
enabled: Controller.csSupported
|
||||
}
|
||||
|
||||
QQC2.Action {
|
||||
text: i18nc("@action:inmenu", "Do Sentry Things")
|
||||
onTriggered: root.window.pageStack.pushDialogLayer(Qt.createComponent("org.kde.neochat", "SendLogsDialog"), {}, {
|
||||
title: i18nc("@title:window", "Send Logs")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
QQC2.Action {
|
||||
text: i18n("Logout")
|
||||
icon.name: "im-kick-user"
|
||||
onTriggered: confirmLogoutDialogComponent.createObject(QQC2.ApplicationWindow.window.overlay).open()
|
||||
}
|
||||
|
||||
|
||||
readonly property Component confirmLogoutDialogComponent: ConfirmLogoutDialog {
|
||||
connection: root.connection
|
||||
}
|
||||
|
||||
36
src/qml/SendLogsDialog.qml
Normal file
36
src/qml/SendLogsDialog.qml
Normal file
@@ -0,0 +1,36 @@
|
||||
// SPDX-FileCopyrightText: 2025 Tobias Fella <tobias.fella@kde.org>
|
||||
// SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
import QtQuick.Layouts
|
||||
|
||||
import org.kde.kirigami as Kirigami
|
||||
import org.kde.kirigamiaddons.formcard as FormCard
|
||||
|
||||
import org.kde.neochat
|
||||
|
||||
FormCard.FormCardPage {
|
||||
id: root
|
||||
|
||||
title: i18nc("@title:dialog", "Upload Logs")
|
||||
|
||||
FormCard.FormTextDelegate {
|
||||
text: i18nc("@info", "Uploading NeoChat's logs can help with finding bugs in the app. After uploading the logs, a token will be shown which identifies the file you have uploaded. Please add this token when creating a bug report for your problem. Uploaded logs are only accessible to KDE developers and will never contain secret data.");
|
||||
textItem.wrapMode: Text.Wrap
|
||||
}
|
||||
|
||||
FormCard.FormTextAreaDelegate {
|
||||
id: description
|
||||
label: i18nc("@label", "Description")
|
||||
placeholderText: i18nc("@info:placeholder", "Things are not working")
|
||||
}
|
||||
|
||||
QQC2.DialogButtonBox {
|
||||
QQC2.Button {
|
||||
text: i18nc("@action:button", "Upload")
|
||||
//TODO icon
|
||||
}
|
||||
standardButtons: QQC2.DialogButtonBox.Cancel
|
||||
}
|
||||
}
|
||||
35
src/sentryintegration.cpp
Normal file
35
src/sentryintegration.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
// SPDX-FileCopyrightText: 2025 Tobias Fella <tobias.fella@kde.org>
|
||||
// SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
|
||||
#include "sentryintegration.h"
|
||||
|
||||
#include <sentry.h>
|
||||
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
|
||||
Sentry &Sentry::instance()
|
||||
{
|
||||
static Sentry _instance;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
Sentry::Sentry()
|
||||
: QObject()
|
||||
{
|
||||
QString dsn = QStringLiteral("https://%1@crash-reports.kde.org/%2").arg("296a68fe1cf24ee79fafad735365d8d6"_L1, "18"_L1);
|
||||
auto options = sentry_options_new();
|
||||
sentry_options_set_dsn(options, dsn.toLatin1().data());
|
||||
sentry_options_set_release(options, "neochat@TESTING");
|
||||
sentry_options_set_debug(options, false);
|
||||
sentry_options_add_attachment(options, "/home/tobias/.local/share/KDE/neochat/neochat.log.0");
|
||||
sentry_init(options);
|
||||
}
|
||||
|
||||
void Sentry::sendLogs()
|
||||
{
|
||||
auto event = sentry_value_new_message_event(SENTRY_LEVEL_INFO, "custom", "It works!");
|
||||
auto uuid = sentry_capture_event(event);
|
||||
auto str = (char *)malloc(37);
|
||||
sentry_uuid_as_string(&uuid, str);
|
||||
qWarning() << "sent logs" << str;
|
||||
}
|
||||
28
src/sentryintegration.h
Normal file
28
src/sentryintegration.h
Normal file
@@ -0,0 +1,28 @@
|
||||
// SPDX-FileCopyrightText: 2025 Tobias Fella <tobias.fella@kde.org>
|
||||
// SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QQmlEngine>
|
||||
#include <qqmlintegration.h>
|
||||
|
||||
class Sentry : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
QML_SINGLETON
|
||||
|
||||
public:
|
||||
static Sentry &instance();
|
||||
static Sentry *create(QQmlEngine *engine, QJSEngine *)
|
||||
{
|
||||
engine->setObjectOwnership(&instance(), QQmlEngine::CppOwnership);
|
||||
return &instance();
|
||||
}
|
||||
|
||||
Q_INVOKABLE void sendLogs();
|
||||
|
||||
private:
|
||||
Sentry();
|
||||
};
|
||||
Reference in New Issue
Block a user