mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 23:57:22 -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
|
@ -199,36 +199,40 @@ namespace global {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
namespace audio {
|
namespace audio {
|
||||||
inline bool enabled = false;
|
inline bool enabled = false;
|
||||||
struct musicFile {
|
struct musicFile {
|
||||||
QString path;
|
QString path;
|
||||||
QString name; // Cut path for easier use in names
|
QString name; // Cut path for easier use in names
|
||||||
int lengths; // length Seconds
|
int lengths; // length Seconds
|
||||||
QString length; // In minutes:seconds
|
QString length; // In minutes:seconds
|
||||||
int id;
|
int id;
|
||||||
};
|
};
|
||||||
// 'None' is when 'currentAction' is empty
|
// 'None' is when 'currentAction' is empty
|
||||||
enum class Action { // Function will be called with this enum
|
enum class Action { // Function will be called with this enum
|
||||||
Play,
|
Play,
|
||||||
Next,
|
Next,
|
||||||
Previous,
|
Previous,
|
||||||
Pause,
|
Pause,
|
||||||
Continue,
|
Continue,
|
||||||
Stop, // Sets 'paused' to false, 'isSomethingCurrentlyPlaying' to false, and 'itemCurrentlyPlaying' to -1; also stops playing
|
Stop, // Sets 'paused' to false, 'isSomethingCurrentlyPlaying' to false, and 'itemCurrentlyPlaying' to -1; also stops playing
|
||||||
SetVolume,
|
SetVolume,
|
||||||
};
|
};
|
||||||
inline QVector<Action> currentAction;
|
inline QVector<Action> currentAction;
|
||||||
inline QVector<musicFile> queue;
|
inline QVector<musicFile> queue;
|
||||||
inline QVector<musicFile> fileList;
|
inline QVector<musicFile> fileList;
|
||||||
inline int itemCurrentlyPlaying = -1; // Also indicates in the queue menu which a gray color which is playing
|
inline int itemCurrentlyPlaying = -1; // Also indicates in the queue menu which a gray color which is playing
|
||||||
inline QMutex audioMutex; // These variables will be shared between threads, so here, it's to protect it
|
inline QMutex audioMutex; // These variables will be shared between threads, so here, it's to protect it
|
||||||
inline int progressSeconds = -5; // -5 at default to avoid cutting song too early... yea
|
inline int progressSeconds = -5; // -5 at default to avoid cutting song too early... yea
|
||||||
inline bool paused = false;
|
inline bool paused = false;
|
||||||
inline bool isSomethingCurrentlyPlaying = false; // Pause and continue
|
inline bool isSomethingCurrentlyPlaying = false; // Pause and continue
|
||||||
inline bool firstScan = true;
|
inline bool firstScan = true;
|
||||||
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