mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 23:57:22 -08:00
commit
1527a8e579
1 changed files with 21 additions and 10 deletions
|
@ -132,10 +132,18 @@ void localLibraryWidget::setupDatabase() {
|
|||
QString prog("busybox-initrd");
|
||||
QStringList args;
|
||||
args << "env" << "icon_width_divider=" + QString::number(stdIconWidthDivider - 1.5) << "icon_height_divider=" + QString::number(stdIconHeightDivider - 1.5) << "./explore_local_library.sh" << booksList;
|
||||
|
||||
// Logs / steps needed to debug the database creation
|
||||
//for(int i = 0; i < args.count(); i++) {
|
||||
// log("arg for database: " + args[i], className);
|
||||
//}
|
||||
|
||||
QProcess *proc = new QProcess();
|
||||
proc->start(prog, args);
|
||||
proc->waitForFinished(-1);
|
||||
QJsonDocument jsonDocument = QJsonDocument::fromJson(readFile(global::localLibrary::rawDatabasePath).toUtf8());
|
||||
//log("All output of proc: " + proc->readAllStandardOutput(), className);
|
||||
//log("All err of proc: " + proc->readAllStandardError(), className);
|
||||
QFile::remove(global::localLibrary::rawDatabasePath);
|
||||
proc->deleteLater();
|
||||
|
||||
|
@ -467,10 +475,10 @@ void localLibraryWidget::setupBooksListToggle(int pageNumber) {
|
|||
void localLibraryWidget::setupBooksListFolders(int pageNumber) {
|
||||
log("Showing folders for page: " + QString::number(pageNumber), className);
|
||||
QStringList directoryList = QDir(pathForFolders).entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
|
||||
log("Full directory list is '"+ directoryList.join(", ") + "'", className);
|
||||
log("Full directory list is "+ directoryList.join(", ") + "'", className);
|
||||
|
||||
// Main path is set and its empty
|
||||
if(mainPathIsEmpty == true) {
|
||||
// Main path is set and is empty
|
||||
ui->pageNumberLabel->setText("0 <i>of</i> 0");
|
||||
ui->previousPageBtn->setEnabled(false);
|
||||
ui->nextPageBtn->setEnabled(false);
|
||||
|
@ -489,7 +497,7 @@ void localLibraryWidget::setupBooksListFolders(int pageNumber) {
|
|||
}
|
||||
pageNumberAbove = pageNumberAbove - 1;
|
||||
}
|
||||
log("Front directory list is '" + directoryListFront.join(", ") + "'", className);
|
||||
log("Front directory is '" + directoryListFront.join(", ") + "'", className);
|
||||
|
||||
int aboveRemove = pageNumber * buttonsNumber;
|
||||
if(directoryListBack.count() > aboveRemove) {
|
||||
|
@ -499,7 +507,7 @@ void localLibraryWidget::setupBooksListFolders(int pageNumber) {
|
|||
}
|
||||
}
|
||||
}
|
||||
log("Back directory list is '" + directoryListBack.join(", ") + "'", className);
|
||||
log("Back directory list '" + directoryListBack.join(", ") + "'", className);
|
||||
|
||||
QStringList directoryListPure;
|
||||
for(QString directory: directoryListFront) {
|
||||
|
@ -507,7 +515,7 @@ void localLibraryWidget::setupBooksListFolders(int pageNumber) {
|
|||
directoryListPure.append(directory);
|
||||
}
|
||||
}
|
||||
log("Final directory list is '" + directoryListPure.join(", ") + "'", className);
|
||||
log("Final directory list '" + directoryListPure.join(", ") +"'", className);
|
||||
|
||||
idList.clear();
|
||||
int in = 1;
|
||||
|
@ -555,7 +563,8 @@ void localLibraryWidget::setupBooksListFolders(int pageNumber) {
|
|||
QString coverPath = jsonObject["CoverPath"].toString();
|
||||
QString bookID = jsonObject["BookID"].toString();
|
||||
|
||||
if(!coverPath.isEmpty()) {
|
||||
// To be 100% sure, use QFile
|
||||
if(QFile(coverPath).exists()) {
|
||||
// Display book cover if found
|
||||
QPixmap pixmap(coverPath);
|
||||
bookIconArray[in]->setPixmap(pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio));
|
||||
|
@ -785,10 +794,10 @@ void localLibraryWidget::checkIfMainPathIsEmpty() {
|
|||
if(folderFeatureEnabled == true) {
|
||||
// If the main path is empty, prevent it from freezing and using the CPU at 100% because of a while loop
|
||||
if(pathForFolders == "/mnt/onboard/onboard/") {
|
||||
bool isDirectoryEmpty = QDir(pathForFolders).entryList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot).isEmpty();
|
||||
if(isDirectoryEmpty == true) {
|
||||
bool isDirEmpty = QDir(pathForFolders).entryList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot).isEmpty();
|
||||
log("Main path is empty: " + QVariant(isDirEmpty).toString(), className);
|
||||
if(isDirEmpty == true) {
|
||||
// To clean things out after a deletion
|
||||
log("Main path is empty", className);
|
||||
cleanButtons();
|
||||
booksListForPathIndex.clear();
|
||||
directoryListCount = 0;
|
||||
|
@ -849,11 +858,13 @@ void localLibraryWidget::cleanButtons() {
|
|||
if(bookBtnArray[i]->isHidden() == false) {
|
||||
bookBtnArray[i]->hide();
|
||||
}
|
||||
|
||||
// I like it with those empty lines, like empty book shelves
|
||||
/*
|
||||
if(i < buttonsNumber) {
|
||||
if(lineArray[i]->isHidden() == false) {
|
||||
lineArray[i]->hide();
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue