mirror of
https://github.com/Quill-OS/quill.git
synced 2024-10-31 21:33:22 -07:00
Code that works until the last step, then crashes the binary
This commit is contained in:
parent
f2a8d5ce57
commit
8f1003f6bb
5 changed files with 94 additions and 4 deletions
|
@ -97,6 +97,7 @@ namespace global {
|
|||
inline bool encfsDialog;
|
||||
inline bool vncDialog;
|
||||
inline bool wifiPassphraseDialog;
|
||||
inline bool telemetryMessageDialog;
|
||||
inline QString keyboardText;
|
||||
inline QString keypadText;
|
||||
inline bool embed = true;
|
||||
|
@ -232,6 +233,14 @@ namespace global {
|
|||
namespace telemetry {
|
||||
inline bool enabled = false;
|
||||
inline bool telemetryDialog = false;
|
||||
namespace collectedData {
|
||||
inline QString message;
|
||||
inline QString deviceUID;
|
||||
inline QString systemVersion;
|
||||
inline QString device;
|
||||
inline bool deviceRooted;
|
||||
inline bool developerKeyInstalled;
|
||||
}
|
||||
}
|
||||
inline QString systemInfoText;
|
||||
inline bool forbidOpenSearchDialog;
|
||||
|
@ -582,7 +591,7 @@ namespace {
|
|||
proc->deleteLater();
|
||||
}
|
||||
}
|
||||
void getUID() {
|
||||
QString getUID() {
|
||||
QString prog ("dd");
|
||||
QStringList args;
|
||||
args << "if=/dev/mmcblk0" << "bs=512" << "skip=1" << "count=1" << "status=none";
|
||||
|
@ -594,6 +603,8 @@ namespace {
|
|||
deviceUID = deviceUID.left(256);
|
||||
|
||||
proc->deleteLater();
|
||||
|
||||
return deviceUID;
|
||||
}
|
||||
void getKernelVersion() {
|
||||
QString prog ("uname");
|
||||
|
@ -1221,6 +1232,36 @@ namespace {
|
|||
fhandler << str.toStdString();
|
||||
fhandler.close();
|
||||
}
|
||||
QJsonObject collectDeviceInformation() {
|
||||
global::telemetry::collectedData::deviceUID = getUID();
|
||||
global::telemetry::collectedData::systemVersion = readFile("/opt/version").trimmed();
|
||||
global::telemetry::collectedData::device = global::deviceID.trimmed();
|
||||
if(checkconfig("/external_root/opt/root/rooted")) {
|
||||
global::telemetry::collectedData::deviceRooted = "true";
|
||||
}
|
||||
else {
|
||||
global::telemetry::collectedData::deviceRooted = "false";
|
||||
}
|
||||
if(checkconfig("/external_root/opt/developer/valid-key")) {
|
||||
global::telemetry::collectedData::developerKeyInstalled = "true";
|
||||
}
|
||||
else {
|
||||
global::telemetry::collectedData::developerKeyInstalled = "false";
|
||||
}
|
||||
|
||||
QJsonObject data;
|
||||
data.insert("UID", global::telemetry::collectedData::deviceUID);
|
||||
data.insert("SystemVersion", global::telemetry::collectedData::systemVersion);
|
||||
data.insert("DeviceModel", global::telemetry::collectedData::device);
|
||||
data.insert("DeviceRooted", global::telemetry::collectedData::deviceRooted);
|
||||
data.insert("DeveloperKeyInstalled", global::telemetry::collectedData::developerKeyInstalled);
|
||||
data.insert("Message", global::telemetry::collectedData::message);
|
||||
|
||||
return(data);
|
||||
}
|
||||
bool sendDeviceInformation(QJsonObject data) {
|
||||
qDebug() << data;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // FUNCTIONS_H
|
||||
|
|
|
@ -1099,6 +1099,27 @@ void MainWindow::openTelemetryDialog() {
|
|||
global::telemetry::telemetryDialog = true;
|
||||
|
||||
generalDialogWindow = new generalDialog(this);
|
||||
QObject::connect(generalDialogWindow, &generalDialog::destroyed, this, &MainWindow::openTelemetryMessageDialog);
|
||||
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||
QApplication::processEvents();
|
||||
}
|
||||
|
||||
void MainWindow::openTelemetryMessageDialog() {
|
||||
if(global::keyboard::telemetryMessageDialog == true) {
|
||||
log("Showing telemetry message dialog", className);
|
||||
global::keyboard::keyboardDialog = true;
|
||||
global::keyboard::keyboardText = "";
|
||||
generalDialogWindow = new generalDialog(this);
|
||||
QObject::connect(generalDialogWindow, &generalDialog::destroyed, this, &MainWindow::sendDeviceInformationSlot);
|
||||
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||
QApplication::processEvents();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::sendDeviceInformationSlot() {
|
||||
QJsonObject data = collectDeviceInformation();
|
||||
qDebug() << data;
|
||||
sendDeviceInformation(data);
|
||||
writeFile("/mnt/onboard/.adds/inkbox/.config/24-telemetry/asked", "true");
|
||||
writeFile("/mnt/onboard/.adds/inkbox/.config/24-telemetry/enabled", "true");
|
||||
}
|
||||
|
|
|
@ -104,6 +104,8 @@ private slots:
|
|||
void launchOnlineLibrary();
|
||||
void on_audioBtn_clicked();
|
||||
void openTelemetryDialog();
|
||||
void openTelemetryMessageDialog();
|
||||
void sendDeviceInformationSlot();
|
||||
|
||||
private:
|
||||
Ui::MainWindow * ui;
|
||||
|
|
|
@ -177,10 +177,10 @@ void localLibraryWidget::setupDatabase() {
|
|||
// Determine maximum page number
|
||||
booksNumber = databaseJsonArrayList.size();
|
||||
if(folderFeatureEnabled == false) {
|
||||
pagesNumber = std::ceil((double)booksNumber / buttonsNumber);
|
||||
pagesNumber = std::ceil((double)booksNumber / buttonsNumber);
|
||||
}
|
||||
else {
|
||||
calculateMaximumPagesNumberForFolders();
|
||||
calculateMaximumPagesNumberForFolders();
|
||||
}
|
||||
if(databaseJsonArrayList.isEmpty()) {
|
||||
log("Database is empty", className);
|
||||
|
|
|
@ -309,6 +309,12 @@ void generalDialog::on_cancelBtn_clicked()
|
|||
log("User declined telemetry request", className);
|
||||
writeFile("/mnt/onboard/.adds/inkbox/.config/24-telemetry/asked", "true");
|
||||
}
|
||||
else if(global::keyboard::telemetryMessageDialog == true) {
|
||||
global::keyboard::telemetryMessageDialog = false;
|
||||
global::keyboard::keyboardText = "";
|
||||
global::telemetry::collectedData::message = "";
|
||||
log("No message to be sent along with collected data", className);
|
||||
}
|
||||
generalDialog::close();
|
||||
}
|
||||
}
|
||||
|
@ -550,6 +556,20 @@ void generalDialog::on_okBtn_clicked()
|
|||
showToast("Please type in the required argument");
|
||||
}
|
||||
}
|
||||
else if(global::keyboard::telemetryMessageDialog == true) {
|
||||
if(!global::keyboard::keyboardText.isEmpty()) {
|
||||
global::telemetry::collectedData::message = global::keyboard::keyboardText;
|
||||
global::keyboard::keyboardText = "";
|
||||
global::keyboard::telemetryMessageDialog = false;
|
||||
global::keyboard::keyboardDialog = false;
|
||||
log("Message to be sent along with collected data is: " + global::telemetry::collectedData::message, className);
|
||||
this->close();
|
||||
}
|
||||
else {
|
||||
global::toast::delay = 3000;
|
||||
showToast("Please type in the required argument");
|
||||
}
|
||||
}
|
||||
else {
|
||||
global::keyboard::keyboardDialog = false;
|
||||
generalDialog::close();
|
||||
|
@ -580,7 +600,7 @@ void generalDialog::on_okBtn_clicked()
|
|||
}
|
||||
else if(global::telemetry::telemetryDialog == true) {
|
||||
global::telemetry::telemetryDialog = false;
|
||||
|
||||
global::keyboard::telemetryMessageDialog = true;
|
||||
generalDialog::close();
|
||||
}
|
||||
}
|
||||
|
@ -677,6 +697,12 @@ void generalDialog::setupKeyboardDialog() {
|
|||
ui->okBtn->setText("OK");
|
||||
ui->cancelBtn->setText("Cancel");
|
||||
}
|
||||
else if(global::keyboard::telemetryMessageDialog == true) {
|
||||
ui->headerLabel->setWordWrap(true);
|
||||
ui->headerLabel->setText("If you'd like, feel free to send us a random message along with the collected data");
|
||||
ui->okBtn->setText("Continue");
|
||||
ui->cancelBtn->setText("No, thanks");
|
||||
}
|
||||
else {
|
||||
ui->headerLabel->setText("Enter a string");
|
||||
ui->okBtn->setText("OK");
|
||||
|
|
Loading…
Reference in a new issue