Remove Telemetry module; transfer CrashHandler to Diagnostics module

This commit is contained in:
Casper Jeukendrup 2021-12-13 01:48:08 +01:00 committed by Igor Korsukov
parent 27bed32dc6
commit bb201c2301
32 changed files with 266 additions and 609 deletions

View file

@ -51,8 +51,6 @@ option(BUILD_PORTABLEAPPS "Windows build for PortableApps.com" OFF)
option(BUILD_FOR_WINSTORE "Build for the Windows Store." OFF)
option(BUILD_AUTOUPDATE "Build with autoupdate support" OFF)
option(BUILD_TELEMETRY_MODULE "Build with telemetry module" ON)
set(TELEMETRY_TRACK_ID "" CACHE STRING "Telemetry track id")
set(CRASH_REPORT_URL "" CACHE STRING "URL where to send crash reports")
option(LOGGER_DEBUGLEVEL_ENABLED "Enable logging debug level" ON)

View file

@ -41,9 +41,6 @@
#define BUILD_NUMBER "${CMAKE_BUILD_NUMBER}"
#define SPARKLE_APPCAST_URL "${SPARKLE_APPCAST_URL}"
#cmakedefine BUILD_TELEMETRY_MODULE
#define TELEMETRY_TRACK_ID "${TELEMETRY_TRACK_ID}"
#define YOUTUBE_API_KEY "${YOUTUBE_API_KEY}"
#cmakedefine LOGGER_DEBUGLEVEL_ENABLED

View file

@ -12,7 +12,7 @@
<file>qml/HomePage/AddonsContent.qml</file>
<file>qml/DevTools/VST/VSTTests.qml</file>
<file>qml/DevTools/Gallery/GeneralComponentsGallery.qml</file>
<file>qml/DevTools/Telemetry/TelemetryInfo.qml</file>
<file>qml/DevTools/CrashHandler/CrashHandlerDevTools.qml</file>
<file>qml/AboutDialog.qml</file>
<file>qml/AboutMusicXMLDialog.qml</file>
<file>qml/resources/mu_logo.svg</file>
@ -86,7 +86,6 @@
<file>resources/win_opengl_buglist.json</file>
<file>qml/Preferences/internal/BaseSection.qml</file>
<file>qml/Preferences/internal/LanguagesSection.qml</file>
<file>qml/Preferences/internal/TelemetrySection.qml</file>
<file>qml/Preferences/internal/AutoSaveSection.qml</file>
<file>qml/Preferences/internal/RemoteControlSection.qml</file>
<file>qml/Preferences/internal/ProgrammeStartSection.qml</file>

View file

@ -0,0 +1,75 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.15
import MuseScore.Ui 1.0
import MuseScore.UiComponents 1.0
import MuseScore.Diagnostics 1.0
Rectangle {
color: ui.theme.backgroundSecondaryColor
CrashHandlerDevToolsModel {
id: model
}
Column {
anchors.top: parent.top
anchors.left: parent.left
anchors.margins: 12
spacing: 12
Rectangle {
readonly property real padding: 12
width: hintLabel.implicitWidth + 2 * padding
height: hintLabel.implicitHeight + 2 * padding
color: Utils.colorWithAlpha(border.color, 0.25)
border.color: "red"
border.width: 1
radius: 6
Row {
id: hintLabel
anchors.fill: parent
anchors.margins: parent.padding
spacing: 4
StyledIconLabel {
iconCode: IconCode.WARNING
}
StyledTextLabel {
// Just for fun... or when a user accidentally sees this (shouldn't happen)
text: "DANGER! This button does exactly what it says!"
}
}
}
FlatButton {
text: "Crash"
onClicked: model.doCrash()
}
}
}

View file

@ -32,7 +32,7 @@ import MuseScore.Mpe 1.0
import "./Gallery"
import "./Interactive"
import "./NotationDialogs"
import "./Telemetry"
import "./CrashHandler"
import "./VST"
import "./KeyNav"
import "./Preferences"
@ -51,7 +51,7 @@ DockPage {
case "gallery": root.central = galleryComp; break
case "interactive": root.central = interactiveComp; break
case "mu3dialogs": root.central = notationDialogs; break
case "telemetry": root.central = telemetryComp; break
case "crashhandler": root.central = crashhandlerComp; break
case "audio": root.central = audioComp; break
case "synth": root.central = synthSettingsComp; break
case "midiports": root.central = midiPortsComp; break
@ -87,7 +87,7 @@ DockPage {
{ "name": "gallery", "title": "UI Gallery" },
{ "name": "interactive", "title": "Interactive" },
{ "name": "mu3dialogs", "title": "MU3Dialogs" },
{ "name": "telemetry", "title": "Telemetry" },
{ "name": "crashhandler", "title": "Crash handler" },
{ "name": "audio", "title": "Audio" },
{ "name": "synth", "title": "Synth" },
{ "name": "midiports", "title": "MIDI ports" },
@ -133,11 +133,9 @@ DockPage {
}
Component {
id: telemetryComp
id: crashhandlerComp
Loader {
source: "qrc:/qml/DevTools/Telemetry/TelemetryInfo.qml"
}
CrashHandlerDevTools {}
}
Component {

View file

@ -1,58 +0,0 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.7
import MuseScore.UiComponents 1.0
import MuseScore.Telemetry 1.0
Rectangle {
color: ui.theme.backgroundPrimaryColor
TelemetryDevTools {
id: tmDevTools
}
Column {
anchors.fill: parent
anchors.topMargin: 20
spacing: 20
readonly property int buttonWidth: 200
FlatButton {
text: "Crash"
width: parent.buttonWidth
onClicked: tmDevTools.doCrash()
}
FlatButton {
text: "Open permission dialog"
width: parent.buttonWidth
onClicked: api.launcher.open("musescore://telemetry/permission")
}
}
}

View file

@ -78,25 +78,6 @@ PreferencesPage {
}
}
SeparatorLine {
visible: telemetrySection.visible
}
TelemetrySection {
id: telemetrySection
isTelemetryAllowed: preferencesModel.isTelemetryAllowed
visible: false
navigation.section: root.navigationSection
navigation.order: root.navigationOrderStart + 3
onTelemetryAllowedChanged: function(allowed) {
preferencesModel.isTelemetryAllowed = allowed
}
}
SeparatorLine { }
AutoSaveSection {
@ -104,7 +85,7 @@ PreferencesPage {
autoSaveInterval: preferencesModel.autoSaveInterval
navigation.section: root.navigationSection
navigation.order: root.navigationOrderStart + 4
navigation.order: root.navigationOrderStart + 3
onAutoSaveEnabledChanged: function(enabled) {
preferencesModel.isAutoSaveEnabled = enabled
@ -122,7 +103,7 @@ PreferencesPage {
oscPort: preferencesModel.oscPort
navigation.section: root.navigationSection
navigation.order: root.navigationOrderStart + 5
navigation.order: root.navigationOrderStart + 4
onRemoteControlChanged: function(control) {
preferencesModel.isOSCRemoteControl = control

View file

@ -48,10 +48,6 @@ void GeneralPreferencesModel::load()
projectConfiguration()->autoSaveIntervalChanged().onReceive(this, [this](int minutes) {
emit autoSaveIntervalChanged(minutes);
});
telemetryConfiguration()->isTelemetryAllowed().ch.onReceive(this, [this](bool) {
emit isTelemetryAllowedChanged(isTelemetryAllowed());
});
}
void GeneralPreferencesModel::openUpdateTranslationsPage()
@ -101,11 +97,6 @@ QString GeneralPreferencesModel::currentKeyboardLayout() const
return shortcutsConfiguration()->currentKeyboardLayout();
}
bool GeneralPreferencesModel::isTelemetryAllowed() const
{
return telemetryConfiguration()->isTelemetryAllowed().val;
}
bool GeneralPreferencesModel::isAutoSaveEnabled() const
{
return projectConfiguration()->isAutoSaveEnabled();
@ -146,16 +137,6 @@ void GeneralPreferencesModel::setCurrentKeyboardLayout(const QString& keyboardLa
emit currentKeyboardLayoutChanged();
}
void GeneralPreferencesModel::setIsTelemetryAllowed(bool isTelemetryAllowed)
{
if (isTelemetryAllowed == this->isTelemetryAllowed()) {
return;
}
telemetryConfiguration()->setIsTelemetryAllowed(isTelemetryAllowed);
emit isTelemetryAllowedChanged(isTelemetryAllowed);
}
void GeneralPreferencesModel::setAutoSaveEnabled(bool enabled)
{
if (enabled == isAutoSaveEnabled()) {

View file

@ -32,7 +32,6 @@
#include "languages/ilanguagesservice.h"
#include "shortcuts/ishortcutsconfiguration.h"
#include "project/iprojectconfiguration.h"
#include "telemetry/itelemetryconfiguration.h"
namespace mu::appshell {
class GeneralPreferencesModel : public QObject, public async::Asyncable
@ -44,7 +43,6 @@ class GeneralPreferencesModel : public QObject, public async::Asyncable
INJECT(appshell, languages::ILanguagesService, languagesService)
INJECT(appshell, shortcuts::IShortcutsConfiguration, shortcutsConfiguration)
INJECT(appshell, project::IProjectConfiguration, projectConfiguration)
INJECT(appshell, telemetry::ITelemetryConfiguration, telemetryConfiguration)
Q_PROPERTY(QVariantList languages READ languages NOTIFY languagesChanged)
Q_PROPERTY(QString currentLanguageCode READ currentLanguageCode WRITE setCurrentLanguageCode NOTIFY currentLanguageCodeChanged)
@ -52,7 +50,6 @@ class GeneralPreferencesModel : public QObject, public async::Asyncable
Q_PROPERTY(QStringList keyboardLayouts READ keyboardLayouts CONSTANT)
Q_PROPERTY(QString currentKeyboardLayout READ currentKeyboardLayout WRITE setCurrentKeyboardLayout NOTIFY currentKeyboardLayoutChanged)
Q_PROPERTY(bool isTelemetryAllowed READ isTelemetryAllowed WRITE setIsTelemetryAllowed NOTIFY isTelemetryAllowedChanged)
Q_PROPERTY(bool isAutoSaveEnabled READ isAutoSaveEnabled WRITE setAutoSaveEnabled NOTIFY autoSaveEnabledChanged)
Q_PROPERTY(int autoSaveInterval READ autoSaveInterval WRITE setAutoSaveInterval NOTIFY autoSaveIntervalChanged)
Q_PROPERTY(bool isOSCRemoteControl READ isOSCRemoteControl WRITE setIsOSCRemoteControl NOTIFY isOSCRemoteControlChanged)
@ -70,7 +67,6 @@ public:
QStringList keyboardLayouts() const;
QString currentKeyboardLayout() const;
bool isTelemetryAllowed() const;
bool isAutoSaveEnabled() const;
int autoSaveInterval() const;
bool isOSCRemoteControl() const;
@ -79,7 +75,6 @@ public:
public slots:
void setCurrentLanguageCode(const QString& currentLanguageCode);
void setCurrentKeyboardLayout(const QString& keyboardLayout);
void setIsTelemetryAllowed(bool isTelemetryAllowed);
void setAutoSaveEnabled(bool enabled);
void setAutoSaveInterval(int minutes);
void setIsOSCRemoteControl(bool isOSCRemoteControl);
@ -89,7 +84,6 @@ signals:
void languagesChanged(QVariantList languages);
void currentLanguageCodeChanged(QString currentLanguageCode);
void currentKeyboardLayoutChanged();
void isTelemetryAllowedChanged(bool isTelemetryAllowed);
void autoSaveEnabledChanged(bool enabled);
void autoSaveIntervalChanged(int minutes);
void isOSCRemoteControlChanged(bool isOSCRemoteControl);

View file

@ -31,6 +31,8 @@ set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/idiagnosticspathsregister.h
${CMAKE_CURRENT_LIST_DIR}/iengravingelementsprovider.h
${CMAKE_CURRENT_LIST_DIR}/internal/diagnosticsconfiguration.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/diagnosticsconfiguration.h
${CMAKE_CURRENT_LIST_DIR}/internal/diagnosticsactions.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/diagnosticsactions.h
${CMAKE_CURRENT_LIST_DIR}/internal/diagnosticsactionscontroller.cpp
@ -61,7 +63,51 @@ set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/view/engraving/engravingelementsmodel.cpp
${CMAKE_CURRENT_LIST_DIR}/view/engraving/engravingelementsmodel.h
${CMAKE_CURRENT_LIST_DIR}/devtools/crashhandlerdevtoolsmodel.cpp
${CMAKE_CURRENT_LIST_DIR}/devtools/crashhandlerdevtoolsmodel.h
)
# --- Crashpad ---
# Not building with MinGW, so turned off for MinGW
include(GetCompilerInfo)
set(BUILD_CRASHPAD_CLIENT ON)
if (CC_IS_MINGW)
set(BUILD_CRASHPAD_CLIENT OFF)
endif(CC_IS_MINGW)
if (BUILD_CRASHPAD_CLIENT)
set(MODULE_SRC ${MODULE_SRC}
${CMAKE_CURRENT_LIST_DIR}/internal/crashhandler/crashhandler.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/crashhandler/crashhandler.h
)
set(MODULE_INCLUDE ${MODULE_INCLUDE}
${PROJECT_SOURCE_DIR}/thirdparty/google_crashpad_client
${PROJECT_SOURCE_DIR}/thirdparty/google_crashpad_client/third_party/mini_chromium/mini_chromium
)
set(MODULE_DEF ${MODULE_DEF}
-DBUILD_CRASHPAD_CLIENT
)
add_subdirectory(${PROJECT_SOURCE_DIR}/thirdparty/google_crashpad_client google_crashpad_client)
set(MODULE_LINK ${MODULE_LINK}
gcrashpad
)
endif(BUILD_CRASHPAD_CLIENT)
# ----------------
include(${PROJECT_SOURCE_DIR}/build/module.cmake)
# === Install crashpad handler ===
set(CPAD_ROOT_PATH ${CMAKE_CURRENT_LIST_DIR}/crashpad_handler)
if (OS_IS_LIN)
install(PROGRAMS ${CPAD_ROOT_PATH}/linux/x86-64/crashpad_handler DESTINATION bin)
elseif(OS_IS_WIN)
install(PROGRAMS ${CPAD_ROOT_PATH}/windows/x86-64/crashpad_handler.exe DESTINATION bin)
elseif(OS_IS_MAC)
install(PROGRAMS ${CPAD_ROOT_PATH}/macos/x86-64/crashpad_handler DESTINATION ${Mscore_SHARE_NAME}Contents/MacOS)
endif()

View file

@ -19,18 +19,21 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "crashhandlerdevtoolsmodel.h"
#include "telemetrydevtools.h"
#include "log.h"
using namespace mu::telemetry;
using namespace mu::diagnostics;
TelemetryDevTools::TelemetryDevTools(QObject* parent)
CrashHandlerDevToolsModel::CrashHandlerDevToolsModel(QObject* parent)
: QObject(parent)
{
}
void TelemetryDevTools::doCrash()
void CrashHandlerDevToolsModel::doCrash()
{
LOGW() << "Crashing on demand!";
volatile int* a = (int*)(nullptr);
*a = 1;
}

View file

@ -20,20 +20,21 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_TELEMETRY_TELEMETRYDEVTOOLS_H
#define MU_TELEMETRY_TELEMETRYDEVTOOLS_H
#ifndef MU_DIAGNOSTICS_CRASHHANDLERDEVTOOLSMODEL_H
#define MU_DIAGNOSTICS_CRASHHANDLERDEVTOOLSMODEL_H
#include <QObject>
namespace mu::telemetry {
class TelemetryDevTools : public QObject
namespace mu::diagnostics {
class CrashHandlerDevToolsModel : public QObject
{
Q_OBJECT
public:
explicit TelemetryDevTools(QObject* parent = nullptr);
explicit CrashHandlerDevToolsModel(QObject* parent = nullptr);
Q_INVOKABLE void doCrash();
};
}
#endif // MU_TELEMETRY_TELEMETRYDEVTOOLS_H
#endif // MU_DIAGNOSTICS_CRASHHANDLERDEVTOOLSMODEL_H

View file

@ -24,14 +24,18 @@
#include <QQmlEngine>
#include "modularity/ioc.h"
#include "global/iglobalconfiguration.h"
#include "ui/iinteractiveuriregister.h"
#include "ui/iuiactionsregister.h"
#include "internal/diagnosticsconfiguration.h"
#include "internal/diagnosticsactions.h"
#include "internal/diagnosticsactionscontroller.h"
#include "internal/diagnosticspathsregister.h"
#include "internal/engravingelementsprovider.h"
#include "internal/crashhandler/crashhandler.h"
#include "view/diagnosticspathsmodel.h"
#include "view/system/profilerviewmodel.h"
@ -45,9 +49,15 @@
#include "view/engraving/engravingelementsmodel.h"
#include "devtools/crashhandlerdevtoolsmodel.h"
#include "log.h"
#include "config.h"
using namespace mu::diagnostics;
using namespace mu::modularity;
static std::shared_ptr<DiagnosticsConfiguration> s_configuration = std::make_shared<DiagnosticsConfiguration>();
static std::shared_ptr<DiagnosticsActionsController> s_actionsController = std::make_shared<DiagnosticsActionsController>();
std::string DiagnosticsModule::moduleName() const
@ -92,9 +102,50 @@ void DiagnosticsModule::registerUiTypes()
qmlRegisterType<DiagnosticAccessibleModel>("MuseScore.Diagnostics", 1, 0, "DiagnosticAccessibleModel");
qmlRegisterType<EngravingElementsModel>("MuseScore.Diagnostics", 1, 0, "EngravingElementsModel");
qmlRegisterType<CrashHandlerDevToolsModel>("MuseScore.Diagnostics", 1, 0, "CrashHandlerDevToolsModel");
}
void DiagnosticsModule::onInit(const framework::IApplication::RunMode&)
{
s_configuration->init();
s_actionsController->init();
auto globalConf = modularity::ioc()->resolve<framework::IGlobalConfiguration>(moduleName());
IF_ASSERT_FAILED(globalConf) {
return;
}
#ifdef BUILD_CRASHPAD_CLIENT
static CrashHandler s_crashHandler;
#ifdef _MSC_VER
io::path handlerFile("crashpad_handler.exe");
#else
io::path handlerFile("crashpad_handler");
#endif // _MSC_VER
io::path handlerPath = globalConf->appBinPath() + "/" + handlerFile;
io::path dumpsDir = globalConf->userAppDataPath() + "/logs/dumps";
fileSystem()->makePath(dumpsDir);
std::string serverUrl(CRASH_REPORT_URL);
if (!s_configuration->isDumpUploadAllowed()) {
serverUrl.clear();
LOGD() << "not allowed dump upload";
} else {
LOGD() << "crash server url: " << serverUrl;
}
bool ok = s_crashHandler.start(handlerPath, dumpsDir, serverUrl);
if (!ok) {
LOGE() << "failed start crash handler";
} else {
LOGI() << "success start crash handler";
}
#else
LOGW() << "crash handling disabled";
#endif // BUILD_CRASHPAD_CLIENT
}

View file

@ -24,11 +24,15 @@
#include "modularity/imodulesetup.h"
#include "modularity/ioc.h"
#include "system/ifilesystem.h"
namespace mu::diagnostics {
class DiagnosticsModule : public modularity::IModuleSetup
{
public:
INJECT(diagnostics, system::IFileSystem, fileSystem)
public:
std::string moduleName() const override;
void registerExports() override;
void resolveImports() override;

View file

@ -31,7 +31,7 @@
#include "log.h"
#include "global/version.h"
using namespace mu::telemetry;
using namespace mu::diagnostics;
using namespace crashpad;
CrashHandler::~CrashHandler()

View file

@ -20,8 +20,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_TELEMETRY_CRASHHANDLER_H
#define MU_TELEMETRY_CRASHHANDLER_H
#ifndef MU_DIAGNOSTICS_CRASHHANDLER_H
#define MU_DIAGNOSTICS_CRASHHANDLER_H
#include <string>
@ -33,10 +33,10 @@ namespace crashpad {
class CrashpadClient;
}
namespace mu::telemetry {
namespace mu::diagnostics {
class CrashHandler
{
INJECT(telemetry, system::IFileSystem, fileSystem)
INJECT(diagnostics, system::IFileSystem, fileSystem)
public:
CrashHandler() = default;
@ -51,4 +51,4 @@ private:
};
}
#endif // MU_TELEMETRY_CRASHHANDLER_H
#endif // MU_DIAGNOSTICS_CRASHHANDLER_H

View file

@ -0,0 +1,44 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "diagnosticsconfiguration.h"
#include "global/settings.h"
using namespace mu::diagnostics;
using namespace mu::framework;
static const Settings::Key IS_DUMP_UPLOAD_ALLOWED("diagnostics", "diagnostics/is_dump_upload_allowed");
void DiagnosticsConfiguration::init()
{
settings()->setDefaultValue(IS_DUMP_UPLOAD_ALLOWED, Val(true));
}
bool DiagnosticsConfiguration::isDumpUploadAllowed() const
{
return settings()->value(IS_DUMP_UPLOAD_ALLOWED).toBool();
}
void DiagnosticsConfiguration::setIsDumpUploadAllowed(bool val)
{
settings()->setSharedValue(IS_DUMP_UPLOAD_ALLOWED, Val(val));
}

View file

@ -19,32 +19,20 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.15
#ifndef MU_DIAGNOSTICS_DIAGNOSTICSCONFIGURATION_H
#define MU_DIAGNOSTICS_DIAGNOSTICSCONFIGURATION_H
import MuseScore.UiComponents 1.0
namespace mu::diagnostics {
class DiagnosticsConfiguration
{
public:
DiagnosticsConfiguration() = default;
BaseSection {
id: root
void init();
title: qsTrc("appshell", "Telemetry")
property alias isTelemetryAllowed: sendCheckBox.checked
signal telemetryAllowedChanged(bool allowed)
CheckBox {
id: sendCheckBox
width: root.columnWidth
text: qsTrc("appshell", "Send anonymous telemetry data to MuseScore")
navigation.name: "TelemetryAllowedBox"
navigation.panel: root.navigation
navigation.row: 1
onClicked: {
root.telemetryAllowedChanged(!checked)
}
}
bool isDumpUploadAllowed() const;
void setIsDumpUploadAllowed(bool val);
};
}
#endif // MU_DIAGNOSTICS_DIAGNOSTICSCONFIGURATION_H

View file

@ -44,10 +44,6 @@ endif (BUILD_AUDIO_MODULE)
add_subdirectory(midi)
add_subdirectory(mpe)
if (BUILD_TELEMETRY_MODULE)
add_subdirectory(telemetry)
endif (BUILD_TELEMETRY_MODULE)
if (BUILD_UNIT_TESTS)
add_subdirectory(global/tests)
add_subdirectory(mpe/tests)

View file

@ -1,94 +0,0 @@
# SPDX-License-Identifier: GPL-3.0-only
# MuseScore-CLA-applies
#
# MuseScore
# Music Composition & Notation
#
# Copyright (C) 2021 MuseScore BVBA and others
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
set(MODULE telemetry)
set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/telemetrymodule.cpp
${CMAKE_CURRENT_LIST_DIR}/telemetrymodule.h
${CMAKE_CURRENT_LIST_DIR}/itelemetryconfiguration.h
${CMAKE_CURRENT_LIST_DIR}/internal/telemetryconfiguration.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/telemetryconfiguration.h
${CMAKE_CURRENT_LIST_DIR}/devtools/telemetrydevtools.cpp
${CMAKE_CURRENT_LIST_DIR}/devtools/telemetrydevtools.h
)
#set(MODULE_QRC telemetry.qrc)
set(MODULE_QML_IMPORT ${CMAKE_CURRENT_LIST_DIR}/qml )
set(MODULE_INCLUDE
${PROJECT_SOURCE_DIR}/thirdparty/google_crashpad_client
${PROJECT_SOURCE_DIR}/thirdparty/google_crashpad_client/third_party/mini_chromium/mini_chromium
)
if (NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter")
endif (NOT MSVC)
# --- Crashpad ---
# Not building with MinGW, so turned off for MinGW
include(GetCompilerInfo)
set(BUILD_CRASHPAD_CLIENT ON)
if (CC_IS_MINGW)
set(BUILD_CRASHPAD_CLIENT OFF)
endif(CC_IS_MINGW)
if (BUILD_CRASHPAD_CLIENT)
set(MODULE_SRC ${MODULE_SRC}
${CMAKE_CURRENT_LIST_DIR}/internal/dump/crashhandler.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/dump/crashhandler.h
)
set(MODULE_INCLUDE ${MODULE_INCLUDE}
${PROJECT_SOURCE_DIR}/thirdparty/google_crashpad_client
${PROJECT_SOURCE_DIR}/thirdparty/google_crashpad_client/third_party/mini_chromium/mini_chromium
)
set(MODULE_DEF ${MODULE_DEF}
-DBUILD_CRASHPAD_CLIENT
)
add_subdirectory(${PROJECT_SOURCE_DIR}/thirdparty/google_crashpad_client google_crashpad_client)
set(MODULE_LINK ${MODULE_LINK}
gcrashpad
)
endif(BUILD_CRASHPAD_CLIENT)
# ----------------
include(${PROJECT_SOURCE_DIR}/build/module.cmake)
# === Install crashpad handler ===
set(CPAD_ROOT_PATH ${CMAKE_CURRENT_LIST_DIR}/crashpad_handler)
if (OS_IS_LIN)
install(PROGRAMS ${CPAD_ROOT_PATH}/linux/x86-64/crashpad_handler DESTINATION bin)
elseif(OS_IS_WIN)
install(PROGRAMS ${CPAD_ROOT_PATH}/windows/x86-64/crashpad_handler.exe DESTINATION bin)
elseif(OS_IS_MAC)
install(PROGRAMS ${CPAD_ROOT_PATH}/macos/x86-64/crashpad_handler DESTINATION ${Mscore_SHARE_NAME}Contents/MacOS)
endif()
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4100")
endif (MSVC)

View file

@ -1,73 +0,0 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "telemetryconfiguration.h"
#include "global/settings.h"
#include "config.h"
using namespace mu::telemetry;
using namespace mu::framework;
static const Settings::Key REQUEST_TELEMETRY_PERMISSION("telemetry", "telemetry/telemetry_access_requested");
static const Settings::Key IS_TELEMETRY_ALLOWED("telemetry", "telemetry/allowed");
static const Settings::Key IS_DUMP_UPLOAD_ALLOWED("telemetry", "telemetry/is_dump_upload_allowed");
void TelemetryConfiguration::init()
{
settings()->setDefaultValue(REQUEST_TELEMETRY_PERMISSION, Val(true));
settings()->setDefaultValue(IS_TELEMETRY_ALLOWED, Val(false));
settings()->setDefaultValue(IS_DUMP_UPLOAD_ALLOWED, Val(true));
settings()->valueChanged(IS_TELEMETRY_ALLOWED).onReceive(this, [this](const Val& allowed) {
m_isTelemetryAllowedChannel.send(allowed.toBool());
});
}
bool TelemetryConfiguration::needRequestTelemetryPermission() const
{
return settings()->value(REQUEST_TELEMETRY_PERMISSION).toBool();
}
mu::ValCh<bool> TelemetryConfiguration::isTelemetryAllowed() const
{
mu::ValCh<bool> allowed;
allowed.ch = m_isTelemetryAllowedChannel;
static QString id(TELEMETRY_TRACK_ID);
allowed.val = !id.isEmpty() && settings()->value(IS_TELEMETRY_ALLOWED).toBool();
return allowed;
}
void TelemetryConfiguration::setIsTelemetryAllowed(bool val)
{
return settings()->setSharedValue(IS_TELEMETRY_ALLOWED, Val(val));
}
bool TelemetryConfiguration::isDumpUploadAllowed() const
{
return settings()->value(IS_DUMP_UPLOAD_ALLOWED).toBool();
}
void TelemetryConfiguration::setIsDumpUploadAllowed(bool val)
{
settings()->setSharedValue(IS_DUMP_UPLOAD_ALLOWED, Val(val));
}

View file

@ -1,49 +0,0 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_TELEMETRY_TELEMETRYCONFIGURATION_H
#define MU_TELEMETRY_TELEMETRYCONFIGURATION_H
#include "../itelemetryconfiguration.h"
#include "async/asyncable.h"
namespace mu::telemetry {
class TelemetryConfiguration : public ITelemetryConfiguration, public async::Asyncable
{
public:
TelemetryConfiguration() = default;
void init();
bool needRequestTelemetryPermission() const override;
ValCh<bool> isTelemetryAllowed() const override;
void setIsTelemetryAllowed(bool val) override;
bool isDumpUploadAllowed() const override;
void setIsDumpUploadAllowed(bool val) override;
private:
async::Channel<bool> m_isTelemetryAllowedChannel;
};
}
#endif // MU_TELEMETRY_TELEMETRYCONFIGURATION_H

View file

@ -1,46 +0,0 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_TELEMETRY_ITELEMETRYCONFIGURATION_H
#define MU_TELEMETRY_ITELEMETRYCONFIGURATION_H
#include "modularity/imoduleexport.h"
#include "retval.h"
namespace mu::telemetry {
class ITelemetryConfiguration : MODULE_EXPORT_INTERFACE
{
INTERFACE_ID(ITelemetryConfiguration)
public:
virtual ~ITelemetryConfiguration() = default;
virtual bool needRequestTelemetryPermission() const = 0;
virtual ValCh<bool> isTelemetryAllowed() const = 0;
virtual void setIsTelemetryAllowed(bool val) = 0;
virtual bool isDumpUploadAllowed() const = 0;
virtual void setIsDumpUploadAllowed(bool val) = 0;
};
}
#endif // MU_TELEMETRY_ITELEMETRYCONFIGURATION_H

View file

@ -1 +0,0 @@
module MuseScore.Telemetry

View file

@ -1,3 +0,0 @@
<RCC>
<qresource prefix="/"/>
</RCC>

View file

@ -1,117 +0,0 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "telemetrymodule.h"
#include <QQmlEngine>
#include "modularity/ioc.h"
#include "internal/telemetryconfiguration.h"
#include "global/iglobalconfiguration.h"
#include "internal/dump/crashhandler.h"
#include "devtools/telemetrydevtools.h"
#include "ui/iinteractiveuriregister.h"
#include "log.h"
#include "config.h"
using namespace mu::telemetry;
using namespace mu::modularity;
using namespace mu::ui;
static std::shared_ptr<TelemetryConfiguration> s_configuration = std::make_shared<TelemetryConfiguration>();
static void telemetry_init_qrc()
{
//Q_INIT_RESOURCE(telemetry);
}
std::string TelemetryModule::moduleName() const
{
return "telemetry";
}
void TelemetryModule::registerResources()
{
telemetry_init_qrc();
}
void TelemetryModule::registerExports()
{
ioc()->registerExport<ITelemetryConfiguration>(moduleName(), s_configuration);
}
void TelemetryModule::resolveImports()
{
}
void TelemetryModule::registerUiTypes()
{
qmlRegisterType<TelemetryDevTools>("MuseScore.Telemetry", 1, 0, "TelemetryDevTools");
}
void TelemetryModule::onInit(const framework::IApplication::RunMode&)
{
s_configuration->init();
auto globalConf = modularity::ioc()->resolve<framework::IGlobalConfiguration>(moduleName());
IF_ASSERT_FAILED(globalConf) {
return;
}
#ifdef BUILD_CRASHPAD_CLIENT
static CrashHandler s_crashHandler;
#ifdef _MSC_VER
io::path handlerFile("crashpad_handler.exe");
#else
io::path handlerFile("crashpad_handler");
#endif
io::path handlerPath = globalConf->appBinPath() + "/" + handlerFile;
io::path dumpsDir = globalConf->userAppDataPath() + "/logs/dumps";
fileSystem()->makePath(dumpsDir);
std::string serverUrl(CRASH_REPORT_URL);
if (!s_configuration->isDumpUploadAllowed()) {
serverUrl.clear();
LOGD() << "not allowed dump upload";
} else {
LOGD() << "crash server url: " << serverUrl;
}
bool ok = s_crashHandler.start(handlerPath, dumpsDir, serverUrl);
if (!ok) {
LOGE() << "failed start crash handler";
} else {
LOGI() << "success start crash handler";
}
#else
LOGW() << "crash handling disabled";
#endif
}

View file

@ -1,45 +0,0 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_TELEMETRY_TELEMETRYMODULE_H
#define MU_TELEMETRY_TELEMETRYMODULE_H
#include "framework/global/modularity/imodulesetup.h"
#include "modularity/ioc.h"
#include "system/ifilesystem.h"
namespace mu::telemetry {
class TelemetryModule : public modularity::IModuleSetup
{
INJECT(telemetry, system::IFileSystem, fileSystem)
public:
std::string moduleName() const override;
void registerExports() override;
void resolveImports() override;
void registerResources() override;
void registerUiTypes() override;
void onInit(const framework::IApplication::RunMode& mode) override;
};
}
#endif // MU_TELEMETRY_TELEMETRYMODULE_H

View file

@ -134,13 +134,8 @@ set(LINK_LIB
fonts
system
network
)
if (BUILD_TELEMETRY_MODULE)
set(LINK_LIB ${LINK_LIB} telemetry)
endif(BUILD_TELEMETRY_MODULE)
set(LINK_LIB ${LINK_LIB}
diagnostics
engraving
actions
accessibility
@ -183,8 +178,6 @@ if (NOT CC_IS_EMSCRIPTEN)
list(APPEND LINK_LIB multiinstances)
endif()
list(APPEND LINK_LIB diagnostics)
if (BUILD_AUTOBOT_MODULE)
list(APPEND LINK_LIB autobot)
endif()

View file

@ -105,9 +105,6 @@
#ifdef BUILD_VST
#include "framework/vst/vstmodule.h"
#endif
#ifdef BUILD_TELEMETRY_MODULE
#include "framework/telemetry/telemetrymodule.h"
#endif
#ifndef Q_OS_WASM
#ifdef BUILD_WORKSPACE_MODULE
@ -172,11 +169,9 @@ int main(int argc, char** argv)
mu::appshell::AppShell app;
//! NOTE `telemetry` must be first, because it install crash handler.
//! others modules order not important (must be)
#ifdef BUILD_TELEMETRY_MODULE
app.addModule(new mu::telemetry::TelemetryModule());
#endif
//! NOTE `diagnostics` must be first, because it installs the crash handler.
//! For other modules, the order is (an should be) unimportant.
app.addModule(new mu::diagnostics::DiagnosticsModule());
app.addModule(new mu::fonts::FontsModule());
app.addModule(new mu::ui::UiModule());
app.addModule(new mu::uicomponents::UiComponentsModule());
@ -280,7 +275,6 @@ int main(int argc, char** argv)
#endif
app.addModule(new mu::mi::MultiInstancesModule());
app.addModule(new mu::diagnostics::DiagnosticsModule());
#ifdef BUILD_AUTOBOT_MODULE
app.addModule(new mu::autobot::AutobotModule());