Quiesce QIODevice warnings

This commit is contained in:
Nicolas Mailloux 2021-09-05 09:49:37 -04:00
parent 4c5fd69f57
commit 9154d6a0bd
2 changed files with 75 additions and 46 deletions

View file

@ -110,6 +110,7 @@ namespace {
int defaultPdfPageHeight;
bool checked_box = false;
bool checkconfig(QString file) {
if(QFile::exists(file)) {
QFile config(file);
config.open(QIODevice::ReadOnly);
QTextStream in (&config);
@ -122,9 +123,14 @@ namespace {
return false;
}
config.close();
}
else {
return false;
}
return 0;
};
bool checkconfig_rw(QString file) {
if(QFile::exists(file)) {
QFile config(file);
config.open(QIODevice::ReadWrite);
QTextStream in (&config);
@ -137,12 +143,17 @@ namespace {
return false;
}
config.close();
}
else {
return false;
}
return 0;
};
void setDefaultWorkDir() {
QDir::setCurrent("/mnt/onboard/.adds/inkbox");
}
int brightness_checkconfig(QString file) {
if(QFile::exists(file)) {
QFile config(file);
config.open(QIODevice::ReadWrite);
QTextStream in (&config);
@ -150,6 +161,10 @@ namespace {
int content_int = content.toInt();
return content_int;
config.close();
}
else {
return EXIT_FAILURE;
}
return 0;
}
void set_brightness(int value) {
@ -167,12 +182,17 @@ namespace {
ioctl(light, 241, value);
}
int int_checkconfig(QString file) {
if(QFile::exists(file)) {
QFile int_config(file);
int_config.open(QIODevice::ReadOnly);
QString valuestr = int_config.readAll();
int value = valuestr.toInt();
int_config.close();
return value;
}
else {
return EXIT_FAILURE;
}
return 0;
}
int display_quote() {
@ -197,6 +217,7 @@ namespace {
fhandler.close();
}
void string_checkconfig(QString file) {
if(QFile::exists(file)) {
checkconfig_str_val = "";
QFile config(file);
config.open(QIODevice::ReadWrite);
@ -204,7 +225,12 @@ namespace {
checkconfig_str_val = in.readAll();
config.close();
}
else {
checkconfig_str_val = "";
}
}
void string_checkconfig_ro(QString file) {
if(QFile::exists(file)) {
checkconfig_str_val = "";
QFile config(file);
config.open(QIODevice::ReadOnly);
@ -212,6 +238,10 @@ namespace {
checkconfig_str_val = in.readAll();
config.close();
}
else {
checkconfig_str_val = "";
}
}
void brightness_writeconfig(int value) {
std::ofstream fhandler;
fhandler.open(".config/03-brightness/config");

View file

@ -21,7 +21,6 @@ toast::toast(QWidget *parent) :
ui->messageLabel->setText(global::toast::message);
this->adjustSize();
centerToast();
qDebug() << global::toast::delay;
if(global::toast::indefiniteToast == false) {
if(global::toast::delay == 0) {
global::toast::delay = 5000;