Merge pull request #5553 from vpereverzev/telemetry_dialog_view

Telemetry dialog appearance
This commit is contained in:
anatoly-os 2019-12-26 00:23:08 +02:00 committed by GitHub
commit 188d07992f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 43 additions and 12 deletions

View file

@ -155,7 +155,16 @@ option(BUILD_TELEMETRY_MODULE "Build with telemetry module" ON)
set(TELEMETRY_TRACK_ID "" CACHE STRING "Telemetry track id")
if (MSCORE_UNSTABLE OR TELEMETRY_TRACK_ID STREQUAL "")
add_definitions(-DTELEMETRY_DISABLED)
message("Telemetry feature is disabled")
message("Build is stable = ${MSCORE_UNSTABLE}")
if (TELEMETRY_TRACK_ID STREQUAL "")
message("Telemetry track id is empty")
else(TELEMETRY_TRACK_ID STREQUAL "")
message("Telemetry track id isn't empty")
endif(TELEMETRY_TRACK_ID STREQUAL "")
add_definitions(-DTELEMETRY_DISABLED)
endif(MSCORE_UNSTABLE OR TELEMETRY_TRACK_ID STREQUAL "")
if (BUILD_CRASH_REPORTER)

2
all.h
View file

@ -90,6 +90,7 @@
#include <QAtomicInt>
#include <QErrorMessage>
#include <QEventLoop>
#include <QPainterPath>
#include <QPixmap>
@ -99,6 +100,7 @@
#include <QFontDatabase>
#include <QProcess>
#include <QDesktopServices>
#include <QDesktopWidget>
#include <QTextDocument>
#include <QTextDocumentFragment>
#include <QTextCursor>

View file

@ -7060,8 +7060,16 @@ void tryToRequestTelemetryPermission()
if (accessRequestedAtVersion == VERSION)
return;
TelemetryPermissionDialog *requestDialog = new TelemetryPermissionDialog(mscore->window());
QEventLoop eventLoop;
TelemetryPermissionDialog *requestDialog = new TelemetryPermissionDialog();
QObject::connect(requestDialog, &TelemetryPermissionDialog::closeRequested, [&eventLoop] () {
eventLoop.quit();
});
requestDialog->show();
eventLoop.exec();
requestDialog->deleteLater();
preferences.setPreference(PREF_APP_STARTUP_TELEMETRY_ACCESS_REQUESTED, VERSION);
}
@ -7517,10 +7525,6 @@ int runApplication(int& argc, char** av)
return ok ? EXIT_SUCCESS : EXIT_FAILURE;
}
#ifndef TELEMETRY_DISABLED
tryToRequestTelemetryPermission();
#endif
return qApp->exec();
}
@ -7700,6 +7704,10 @@ void MuseScore::init(QStringList& argv)
gscore->setScoreFont(scoreFont);
gscore->setNoteHeadWidth(scoreFont->width(SymId::noteheadBlack, gscore->spatium()) / SPATIUM20);
#ifndef TELEMETRY_DISABLED
tryToRequestTelemetryPermission();
#endif
//read languages list
mscore->readLanguages(mscoreGlobalShare + "locale/languages.xml");

View file

@ -4388,8 +4388,10 @@ Shortcut* Shortcut::getShortcutByKeySequence(const QKeySequence &keySequence)
continue;
if (action->shortcut() == keySequence)
return shortcut;
for (const QKeySequence& _keySequence : action->shortcuts()) {
if (action->shortcut() == _keySequence)
return shortcut;
}
}
return nullptr;

View file

@ -20,18 +20,24 @@
#include "telemetrypermissiondialog.h"
#include <QQuickItem>
#include <QApplication>
#include <QDesktopWidget>
//---------------------------------------------------------
// TelemetryPermissionDialog
//---------------------------------------------------------
TelemetryPermissionDialog::TelemetryPermissionDialog(QWidget* parentWidget) : QQuickView()
TelemetryPermissionDialog::TelemetryPermissionDialog() : QQuickView()
{
setMinimumWidth(500);
setMinimumHeight(460);
if (parentWidget)
setPosition(parentWidget->pos());
setFlags(Qt::CustomizeWindowHint); ///@note Hidding a native frame with 'X' close button
QRect desktopRect = QApplication::desktop()->availableGeometry();
QPoint center = desktopRect.center();
setPosition(center.x() - minimumWidth() * 0.5, center.y() - minimumHeight() * 0.5);
QUrl url = QUrl(QStringLiteral("qrc:/qml/TelemetryPermissionDialog.qml"));
@ -45,4 +51,5 @@ TelemetryPermissionDialog::TelemetryPermissionDialog(QWidget* parentWidget) : QQ
rootObject()->setWidth(minimumWidth());
connect(rootItem, SIGNAL(closeRequested()), this, SLOT(close()));
connect(rootItem, SIGNAL(closeRequested()), this, SIGNAL(closeRequested()));
}

View file

@ -32,7 +32,10 @@ class TelemetryPermissionDialog : public QQuickView {
Q_OBJECT
public:
explicit TelemetryPermissionDialog(QWidget* parentWidget = nullptr);
explicit TelemetryPermissionDialog();
signals:
void closeRequested();
};
#endif // TELEMETRYPERMISSIONDIALOG_H