mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-27 16:17:21 -08:00
Optional telemetry support: First steps
This commit is contained in:
parent
84dcce45bb
commit
7c2c2ed5c9
6 changed files with 87 additions and 38 deletions
|
@ -229,6 +229,10 @@ namespace global {
|
||||||
inline int volumeLevel = 40; // Default save value
|
inline int volumeLevel = 40; // Default save value
|
||||||
inline bool songChanged = false;
|
inline bool songChanged = false;
|
||||||
}
|
}
|
||||||
|
namespace telemetry {
|
||||||
|
inline bool enabled = false;
|
||||||
|
inline bool telemetryDialog = false;
|
||||||
|
}
|
||||||
inline QString systemInfoText;
|
inline QString systemInfoText;
|
||||||
inline bool forbidOpenSearchDialog;
|
inline bool forbidOpenSearchDialog;
|
||||||
inline bool isN705 = false;
|
inline bool isN705 = false;
|
||||||
|
|
|
@ -433,6 +433,13 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
if(checkconfig("/opt/inkbox_genuine") == true) {
|
if(checkconfig("/opt/inkbox_genuine") == true) {
|
||||||
writeFile("/external_root/run/inkbox_gui_git_commit", GIT_COMMIT);
|
writeFile("/external_root/run/inkbox_gui_git_commit", GIT_COMMIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Telemetry
|
||||||
|
if(checkconfig(".config/24-telemetry/enabled") == false && checkconfig(".config/24-telemetry/asked") == false) {
|
||||||
|
if(testPing() == 0) {
|
||||||
|
QTimer::singleShot(1000, this, SLOT(openTelemetryDialog()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
@ -1083,3 +1090,12 @@ void MainWindow::on_audioBtn_clicked()
|
||||||
QDialog* newAudioDialog = new audioDialog(this);
|
QDialog* newAudioDialog = new audioDialog(this);
|
||||||
newAudioDialog->exec();
|
newAudioDialog->exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::openTelemetryDialog() {
|
||||||
|
log("Showing telemetry request dialog", className);
|
||||||
|
global::telemetry::telemetryDialog = true;
|
||||||
|
|
||||||
|
generalDialogWindow = new generalDialog(this);
|
||||||
|
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
QApplication::processEvents();
|
||||||
|
}
|
||||||
|
|
|
@ -103,6 +103,7 @@ private slots:
|
||||||
void setupHomePageWidget();
|
void setupHomePageWidget();
|
||||||
void launchOnlineLibrary();
|
void launchOnlineLibrary();
|
||||||
void on_audioBtn_clicked();
|
void on_audioBtn_clicked();
|
||||||
|
void openTelemetryDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow * ui;
|
Ui::MainWindow * ui;
|
||||||
|
|
|
@ -1117,36 +1117,42 @@ void settings::on_settingsStackedWidget_currentChanged(int arg1)
|
||||||
|
|
||||||
void settings::on_readingSettingsBtn_clicked()
|
void settings::on_readingSettingsBtn_clicked()
|
||||||
{
|
{
|
||||||
|
log("'Reading settings' button clicked", className);
|
||||||
ui->settingsStackedWidget->setCurrentIndex(1);
|
ui->settingsStackedWidget->setCurrentIndex(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void settings::on_homeSettingsBtn_clicked()
|
void settings::on_homeSettingsBtn_clicked()
|
||||||
{
|
{
|
||||||
|
log("'Home settings' button clicked", className);
|
||||||
ui->settingsStackedWidget->setCurrentIndex(2);
|
ui->settingsStackedWidget->setCurrentIndex(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void settings::on_librarySettingsBtn_clicked()
|
void settings::on_librarySettingsBtn_clicked()
|
||||||
{
|
{
|
||||||
|
log("'Library settings' button clicked", className);
|
||||||
ui->settingsStackedWidget->setCurrentIndex(3);
|
ui->settingsStackedWidget->setCurrentIndex(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void settings::on_storageSettingsBtn_clicked()
|
void settings::on_storageSettingsBtn_clicked()
|
||||||
{
|
{
|
||||||
|
log("'Storage settings' button clicked", className);
|
||||||
ui->settingsStackedWidget->setCurrentIndex(4);
|
ui->settingsStackedWidget->setCurrentIndex(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void settings::on_systemSettingsBtn_clicked()
|
void settings::on_systemSettingsBtn_clicked()
|
||||||
{
|
{
|
||||||
|
log("'System settings' button clicked", className);
|
||||||
ui->settingsStackedWidget->setCurrentIndex(5);
|
ui->settingsStackedWidget->setCurrentIndex(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void settings::on_securitySettingsBtn_clicked()
|
void settings::on_securitySettingsBtn_clicked()
|
||||||
{
|
{
|
||||||
|
log("'Security settings' button clicked", className);
|
||||||
ui->settingsStackedWidget->setCurrentIndex(6);
|
ui->settingsStackedWidget->setCurrentIndex(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1154,5 +1160,6 @@ void settings::on_securitySettingsBtn_clicked()
|
||||||
void settings::on_headerBtn_clicked()
|
void settings::on_headerBtn_clicked()
|
||||||
{
|
{
|
||||||
// "Home" button
|
// "Home" button
|
||||||
|
log("'Home' button clicked", className);
|
||||||
ui->settingsStackedWidget->setCurrentIndex(0);
|
ui->settingsStackedWidget->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,16 +226,19 @@ generalDialog::generalDialog(QWidget *parent) :
|
||||||
ui->headerLabel->setText("Sync required");
|
ui->headerLabel->setText("Sync required");
|
||||||
QTimer::singleShot(50, this, SLOT(adjust_size()));
|
QTimer::singleShot(50, this, SLOT(adjust_size()));
|
||||||
}
|
}
|
||||||
|
else if(global::telemetry::telemetryDialog == true) {
|
||||||
|
telemetryDialog = true;
|
||||||
|
ui->stackedWidget->setCurrentIndex(0);
|
||||||
|
ui->okBtn->setText("Send");
|
||||||
|
ui->cancelBtn->setText("Don't send");
|
||||||
|
ui->bodyLabel->setText("<font face='u001'>We, InkBox OS developers, would like to know a bit more about our userbase.<br>We will be extremely grateful if you allow us to collect some information about your device.<br>Would you like to send it to us</font><font face='Inter'>?</font><font face='u001'><br>No personal data will be transmitted.</font>");
|
||||||
|
ui->headerLabel->setText("Telemetry request");
|
||||||
|
QTimer::singleShot(50, this, SLOT(adjust_size()));
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
// We shouldn't be there ;)
|
// We shouldn't be there ;)
|
||||||
log("Launched without settings", className);
|
log("Launched without settings", className);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Centering dialog
|
|
||||||
QRect screenGeometry = QGuiApplication::screens()[0]->geometry();
|
|
||||||
int x = (screenGeometry.width() - this->width()) / 2;
|
|
||||||
int y = (screenGeometry.height() - this->height()) / 2;
|
|
||||||
this->move(x, y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
generalDialog::~generalDialog()
|
generalDialog::~generalDialog()
|
||||||
|
@ -301,6 +304,11 @@ void generalDialog::on_cancelBtn_clicked()
|
||||||
emit noSyncOnlineLibrary();
|
emit noSyncOnlineLibrary();
|
||||||
global::library::librarySyncDialog = false;
|
global::library::librarySyncDialog = false;
|
||||||
}
|
}
|
||||||
|
else if(global::telemetry::telemetryDialog == true) {
|
||||||
|
global::telemetry::telemetryDialog = false;
|
||||||
|
log("User declined telemetry request", className);
|
||||||
|
writeFile("/mnt/onboard/.adds/inkbox/.config/24-telemetry/asked", "true");
|
||||||
|
}
|
||||||
generalDialog::close();
|
generalDialog::close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -570,6 +578,11 @@ void generalDialog::on_okBtn_clicked()
|
||||||
global::library::librarySyncDialog = false;
|
global::library::librarySyncDialog = false;
|
||||||
generalDialog::close();
|
generalDialog::close();
|
||||||
}
|
}
|
||||||
|
else if(global::telemetry::telemetryDialog == true) {
|
||||||
|
global::telemetry::telemetryDialog = false;
|
||||||
|
|
||||||
|
generalDialog::close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void generalDialog::on_acceptBtn_clicked()
|
void generalDialog::on_acceptBtn_clicked()
|
||||||
{
|
{
|
||||||
|
@ -608,10 +621,17 @@ void generalDialog::on_acceptBtn_clicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
void generalDialog::adjust_size() {
|
void generalDialog::adjust_size() {
|
||||||
|
float widthProportion = 2;
|
||||||
|
float heightProportion = 2;
|
||||||
|
if(telemetryDialog) {
|
||||||
|
widthProportion = 2.8;
|
||||||
|
heightProportion = 2.6;
|
||||||
|
}
|
||||||
|
|
||||||
this->adjustSize();
|
this->adjustSize();
|
||||||
QRect screenGeometry = QGuiApplication::screens()[0]->geometry();
|
QRect screenGeometry = QGuiApplication::screens()[0]->geometry();
|
||||||
int x = (screenGeometry.width() - this->width()) / 2;
|
int x = (screenGeometry.width() - this->width()) / widthProportion;
|
||||||
int y = (screenGeometry.height() - this->height()) / 2;
|
int y = (screenGeometry.height() - this->height()) / heightProportion;
|
||||||
this->move(x, y);
|
this->move(x, y);
|
||||||
this->show();
|
this->show();
|
||||||
emit refreshScreen();
|
emit refreshScreen();
|
||||||
|
|
|
@ -38,6 +38,7 @@ public:
|
||||||
bool keyboardDialog = false;
|
bool keyboardDialog = false;
|
||||||
bool keypadDialog = false;
|
bool keypadDialog = false;
|
||||||
bool librarySyncDialog = false;
|
bool librarySyncDialog = false;
|
||||||
|
bool telemetryDialog = false;
|
||||||
bool dictionaryResults = false;
|
bool dictionaryResults = false;
|
||||||
bool vncServerSet = false;
|
bool vncServerSet = false;
|
||||||
bool vncPasswordSet = false;
|
bool vncPasswordSet = false;
|
||||||
|
|
Loading…
Reference in a new issue