Fixes in homePageWidget; implement 'currentlyRunningUserApplication'

This commit is contained in:
Nicolas Mailloux 2022-07-26 23:09:12 -04:00
parent dfd89c5531
commit 4463ced4c7
5 changed files with 23 additions and 17 deletions

View file

@ -161,7 +161,8 @@ void userapps::on_launchBtn_clicked()
message.append("'"); message.append("'");
log(message, className); log(message, className);
// Tell the OS that we're not running anymore // Tell the OS that we're not running anymore
string_writeconfig("/tmp/inkbox_running", "false"); writeFile("/tmp/inkbox_running", "false");
writeFile("/tmp/currentlyRunningUserApplication", appName);
QProcess process; QProcess process;
QStringList args; QStringList args;

View file

@ -10,21 +10,26 @@ homePageWidget::homePageWidget(QWidget *parent) :
ui(new Ui::homePageWidget) ui(new Ui::homePageWidget)
{ {
ui->setupUi(this); ui->setupUi(this);
// Getting the screen's size
sW = QGuiApplication::screens()[0]->size().width();
sH = QGuiApplication::screens()[0]->size().height();
if(global::deviceID == "n705\n") { if(global::deviceID == "n705\n") {
stdIconWidth = sW / 52; stdIconWidth = sW / 23;
stdIconHeight = sH / 52; stdIconHeight = sH / 23;
} }
else if(global::deviceID == "n905\n" or global::deviceID == "kt\n") { else if(global::deviceID == "n905\n" or global::deviceID == "kt\n") {
stdIconWidth = sW / 54; stdIconWidth = sW / 25;
stdIconHeight = sH / 54; stdIconHeight = sH / 25;
} }
else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n437\n" or global::deviceID == "n306\n" or global::deviceID == "emu\n") { else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n437\n" or global::deviceID == "n306\n" or global::deviceID == "emu\n") {
stdIconWidth = sW / 52.5; stdIconWidth = sW / 23.5;
stdIconHeight = sH / 52.5; stdIconHeight = sH / 23.5;
} }
else { else {
stdIconWidth = sW / 54; stdIconWidth = sW / 25;
stdIconHeight = sH / 54; stdIconHeight = sH / 25;
} }
ui->recentBooksIconLabel->setPixmap(QPixmap(":/resources/file-text.png").scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation)); ui->recentBooksIconLabel->setPixmap(QPixmap(":/resources/file-text.png").scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation));
ui->pinnedBooksIconLabel->setPixmap(QPixmap(":/resources/pin.png").scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation)); ui->pinnedBooksIconLabel->setPixmap(QPixmap(":/resources/pin.png").scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation));
@ -48,10 +53,6 @@ homePageWidget::homePageWidget(QWidget *parent) :
bookTitleTruncateThreshold = 25; bookTitleTruncateThreshold = 25;
} }
// Getting the screen's size
sW = QGuiApplication::screens()[0]->size().width();
sH = QGuiApplication::screens()[0]->size().height();
if(global::deviceID == "n705\n" or global::deviceID == "n905\n" or global::deviceID == "kt\n") { if(global::deviceID == "n705\n" or global::deviceID == "n905\n" or global::deviceID == "kt\n") {
stdIconWidthDivider = 8; stdIconWidthDivider = 8;
stdIconHeightDivider = 8; stdIconHeightDivider = 8;
@ -205,7 +206,7 @@ void homePageWidget::setupDisplay(bool databaseGenerated) {
bookBtnArray[i]->setPixmap(QPixmap(bookIcon).scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio)); bookBtnArray[i]->setPixmap(QPixmap(bookIcon).scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio));
} }
else { else {
bookBtnArray[i]->setPixmap(QPixmap(":/resources/cover_unavailable").scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio)); bookBtnArray[i]->setPixmap(QPixmap(":/resources/cover_unavailable.png").scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation));
} }
verticalLayoutArray[i]->addWidget(bookBtnArray[i]); verticalLayoutArray[i]->addWidget(bookBtnArray[i]);
@ -321,7 +322,7 @@ void homePageWidget::setupDisplay(bool databaseGenerated) {
pinnedBooksBtnArray[i]->setPixmap(QPixmap(bookIcon).scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio)); pinnedBooksBtnArray[i]->setPixmap(QPixmap(bookIcon).scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio));
} }
else { else {
pinnedBooksBtnArray[i]->setPixmap(QPixmap(":/resources/cover_unavailable").scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio)); pinnedBooksBtnArray[i]->setPixmap(QPixmap(":/resources/cover_unavailable.png").scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation));
} }
pinnedBooksVerticalLayoutArray[i]->addWidget(pinnedBooksBtnArray[i]); pinnedBooksVerticalLayoutArray[i]->addWidget(pinnedBooksBtnArray[i]);

View file

@ -220,7 +220,7 @@ void localLibraryWidget::setupBooksList(int pageNumber) {
} }
else { else {
QPixmap pixmap(":/resources/cover_unavailable.png"); QPixmap pixmap(":/resources/cover_unavailable.png");
bookIconArray[in]->setPixmap(pixmap.scaled(stdIconWidth, stdIconHeight)); bookIconArray[in]->setPixmap(pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation));
} }
// Display book title // Display book title

View file

@ -57,6 +57,10 @@ int main(int argc, char *argv[])
global::device::isWifiAble = false; global::device::isWifiAble = false;
} }
if(QFile::exists("/tmp/currentlyRunningUserApplication")) {
QFile::remove("/tmp/currentlyRunningUserApplication");
}
if(QFile::exists("/tmp/rescan_userapps")) { if(QFile::exists("/tmp/rescan_userapps")) {
QFile::remove("/tmp/rescan_userapps"); QFile::remove("/tmp/rescan_userapps");
log("Re-scanning user applications from explicit request", "main"); log("Re-scanning user applications from explicit request", "main");

View file

@ -68,7 +68,7 @@ bookInfoDialog::bookInfoDialog(QWidget *parent) :
} }
else { else {
QPixmap coverPixmap(":/resources/cover_unavailable.png"); QPixmap coverPixmap(":/resources/cover_unavailable.png");
QPixmap scaledCoverPixmap = coverPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio); QPixmap scaledCoverPixmap = coverPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
ui->bookCoverLabel->setPixmap(scaledCoverPixmap); ui->bookCoverLabel->setPixmap(scaledCoverPixmap);
QFile::remove("/inkbox/gutenberg/getCoverDone"); QFile::remove("/inkbox/gutenberg/getCoverDone");
break; break;