mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-27 16:17:21 -08:00
Quiesce QIODevice warnings
This commit is contained in:
parent
4c5fd69f57
commit
9154d6a0bd
2 changed files with 75 additions and 46 deletions
120
functions.h
120
functions.h
|
@ -110,46 +110,61 @@ namespace {
|
||||||
int defaultPdfPageHeight;
|
int defaultPdfPageHeight;
|
||||||
bool checked_box = false;
|
bool checked_box = false;
|
||||||
bool checkconfig(QString file) {
|
bool checkconfig(QString file) {
|
||||||
QFile config(file);
|
if(QFile::exists(file)) {
|
||||||
config.open(QIODevice::ReadOnly);
|
QFile config(file);
|
||||||
QTextStream in (&config);
|
config.open(QIODevice::ReadOnly);
|
||||||
const QString content = in.readAll();
|
QTextStream in (&config);
|
||||||
std::string contentstr = content.toStdString();
|
const QString content = in.readAll();
|
||||||
if(contentstr.find("true") != std::string::npos) {
|
std::string contentstr = content.toStdString();
|
||||||
return true;
|
if(contentstr.find("true") != std::string::npos) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
config.close();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
config.close();
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
bool checkconfig_rw(QString file) {
|
bool checkconfig_rw(QString file) {
|
||||||
QFile config(file);
|
if(QFile::exists(file)) {
|
||||||
config.open(QIODevice::ReadWrite);
|
QFile config(file);
|
||||||
QTextStream in (&config);
|
config.open(QIODevice::ReadWrite);
|
||||||
const QString content = in.readAll();
|
QTextStream in (&config);
|
||||||
std::string contentstr = content.toStdString();
|
const QString content = in.readAll();
|
||||||
if(contentstr.find("true") != std::string::npos) {
|
std::string contentstr = content.toStdString();
|
||||||
return true;
|
if(contentstr.find("true") != std::string::npos) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
config.close();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
config.close();
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
void setDefaultWorkDir() {
|
void setDefaultWorkDir() {
|
||||||
QDir::setCurrent("/mnt/onboard/.adds/inkbox");
|
QDir::setCurrent("/mnt/onboard/.adds/inkbox");
|
||||||
}
|
}
|
||||||
int brightness_checkconfig(QString file) {
|
int brightness_checkconfig(QString file) {
|
||||||
QFile config(file);
|
if(QFile::exists(file)) {
|
||||||
config.open(QIODevice::ReadWrite);
|
QFile config(file);
|
||||||
QTextStream in (&config);
|
config.open(QIODevice::ReadWrite);
|
||||||
const QString content = in.readAll();
|
QTextStream in (&config);
|
||||||
int content_int = content.toInt();
|
const QString content = in.readAll();
|
||||||
return content_int;
|
int content_int = content.toInt();
|
||||||
config.close();
|
return content_int;
|
||||||
|
config.close();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
void set_brightness(int value) {
|
void set_brightness(int value) {
|
||||||
|
@ -167,12 +182,17 @@ namespace {
|
||||||
ioctl(light, 241, value);
|
ioctl(light, 241, value);
|
||||||
}
|
}
|
||||||
int int_checkconfig(QString file) {
|
int int_checkconfig(QString file) {
|
||||||
QFile int_config(file);
|
if(QFile::exists(file)) {
|
||||||
int_config.open(QIODevice::ReadOnly);
|
QFile int_config(file);
|
||||||
QString valuestr = int_config.readAll();
|
int_config.open(QIODevice::ReadOnly);
|
||||||
int value = valuestr.toInt();
|
QString valuestr = int_config.readAll();
|
||||||
int_config.close();
|
int value = valuestr.toInt();
|
||||||
return value;
|
int_config.close();
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int display_quote() {
|
int display_quote() {
|
||||||
|
@ -197,20 +217,30 @@ namespace {
|
||||||
fhandler.close();
|
fhandler.close();
|
||||||
}
|
}
|
||||||
void string_checkconfig(QString file) {
|
void string_checkconfig(QString file) {
|
||||||
checkconfig_str_val = "";
|
if(QFile::exists(file)) {
|
||||||
QFile config(file);
|
checkconfig_str_val = "";
|
||||||
config.open(QIODevice::ReadWrite);
|
QFile config(file);
|
||||||
QTextStream in (&config);
|
config.open(QIODevice::ReadWrite);
|
||||||
checkconfig_str_val = in.readAll();
|
QTextStream in (&config);
|
||||||
config.close();
|
checkconfig_str_val = in.readAll();
|
||||||
|
config.close();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
checkconfig_str_val = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void string_checkconfig_ro(QString file) {
|
void string_checkconfig_ro(QString file) {
|
||||||
checkconfig_str_val = "";
|
if(QFile::exists(file)) {
|
||||||
QFile config(file);
|
checkconfig_str_val = "";
|
||||||
config.open(QIODevice::ReadOnly);
|
QFile config(file);
|
||||||
QTextStream in (&config);
|
config.open(QIODevice::ReadOnly);
|
||||||
checkconfig_str_val = in.readAll();
|
QTextStream in (&config);
|
||||||
config.close();
|
checkconfig_str_val = in.readAll();
|
||||||
|
config.close();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
checkconfig_str_val = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void brightness_writeconfig(int value) {
|
void brightness_writeconfig(int value) {
|
||||||
std::ofstream fhandler;
|
std::ofstream fhandler;
|
||||||
|
@ -257,10 +287,10 @@ namespace {
|
||||||
batt_level_file.close();
|
batt_level_file.close();
|
||||||
}
|
}
|
||||||
void writeconfig(std::string file, std::string config) {
|
void writeconfig(std::string file, std::string config) {
|
||||||
std::ofstream fhandler;
|
std::ofstream fhandler;
|
||||||
fhandler.open(file);
|
fhandler.open(file);
|
||||||
fhandler << config << std::boolalpha << checked_box << std::endl;
|
fhandler << config << std::boolalpha << checked_box << std::endl;
|
||||||
fhandler.close();
|
fhandler.close();
|
||||||
}
|
}
|
||||||
bool checkconfig_match(QString file, std::string pattern) {
|
bool checkconfig_match(QString file, std::string pattern) {
|
||||||
QFile config(file);
|
QFile config(file);
|
||||||
|
|
|
@ -21,7 +21,6 @@ toast::toast(QWidget *parent) :
|
||||||
ui->messageLabel->setText(global::toast::message);
|
ui->messageLabel->setText(global::toast::message);
|
||||||
this->adjustSize();
|
this->adjustSize();
|
||||||
centerToast();
|
centerToast();
|
||||||
qDebug() << global::toast::delay;
|
|
||||||
if(global::toast::indefiniteToast == false) {
|
if(global::toast::indefiniteToast == false) {
|
||||||
if(global::toast::delay == 0) {
|
if(global::toast::delay == 0) {
|
||||||
global::toast::delay = 5000;
|
global::toast::delay = 5000;
|
||||||
|
|
Loading…
Reference in a new issue