mirror of
https://github.com/Quill-OS/quill.git
synced 2024-10-31 21:33:22 -07:00
Local library: Fix folder long names, kobo nia sizes, some aspect ratio repairs
This commit is contained in:
parent
6bc3c41e03
commit
dbb09dcbda
2 changed files with 25 additions and 18 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,3 +6,4 @@ moc_*
|
||||||
qrc_*
|
qrc_*
|
||||||
.qmake.stash
|
.qmake.stash
|
||||||
.vscode
|
.vscode
|
||||||
|
.qtc_clangd
|
||||||
|
|
|
@ -41,6 +41,9 @@ localLibraryWidget::localLibraryWidget(QWidget *parent) :
|
||||||
else if(global::deviceID == "n873\n") {
|
else if(global::deviceID == "n873\n") {
|
||||||
bookTitleTruncateThreshold = 45;
|
bookTitleTruncateThreshold = 45;
|
||||||
}
|
}
|
||||||
|
else if(global::deviceID == "n306\n") {
|
||||||
|
bookTitleTruncateThreshold = 32;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
bookTitleTruncateThreshold = 35;
|
bookTitleTruncateThreshold = 35;
|
||||||
}
|
}
|
||||||
|
@ -57,33 +60,29 @@ localLibraryWidget::localLibraryWidget(QWidget *parent) :
|
||||||
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 = 9.5;
|
stdIconWidthDivider = 9.5;
|
||||||
stdIconHeightDivider = 9.5;
|
stdIconHeightDivider = 9.5;
|
||||||
stdIconWidth = sW / stdIconWidthDivider;
|
|
||||||
stdIconHeight = sH / stdIconHeightDivider;
|
|
||||||
}
|
}
|
||||||
else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n306\n" or global::deviceID == "emu\n") {
|
else if(global::deviceID == "n613\n" or global::deviceID == "emu\n") {
|
||||||
stdIconWidthDivider = 8.5;
|
stdIconWidthDivider = 8.5;
|
||||||
stdIconHeightDivider = 8.5;
|
stdIconHeightDivider = 8.5;
|
||||||
stdIconWidth = sW / stdIconWidthDivider;
|
|
||||||
stdIconHeight = sH / stdIconHeightDivider;
|
|
||||||
}
|
}
|
||||||
else if(global::deviceID == "n437\n") {
|
else if(global::deviceID == "n437\n") {
|
||||||
stdIconWidthDivider = 8;
|
stdIconWidthDivider = 8;
|
||||||
stdIconHeightDivider = 8;
|
stdIconHeightDivider = 8;
|
||||||
stdIconWidth = sW / stdIconWidthDivider;
|
|
||||||
stdIconHeight = sH / stdIconHeightDivider;
|
|
||||||
}
|
}
|
||||||
else if(global::deviceID == "n873\n") {
|
else if(global::deviceID == "n873\n") {
|
||||||
stdIconWidthDivider = 9.7;
|
stdIconWidthDivider = 9.7;
|
||||||
stdIconHeightDivider = 9.7;
|
stdIconHeightDivider = 9.7;
|
||||||
stdIconWidth = sW / stdIconWidthDivider;
|
}
|
||||||
stdIconHeight = sH / stdIconHeightDivider;
|
else if(global::deviceID == "n306\n" || global::deviceID == "n236\n") {
|
||||||
|
stdIconWidthDivider = 9.1;
|
||||||
|
stdIconHeightDivider = 9.1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
stdIconWidthDivider = 9.5;
|
stdIconWidthDivider = 9.5;
|
||||||
stdIconHeightDivider = 9.5;
|
stdIconHeightDivider = 9.5;
|
||||||
|
}
|
||||||
stdIconWidth = sW / stdIconWidthDivider;
|
stdIconWidth = sW / stdIconWidthDivider;
|
||||||
stdIconHeight = sH / stdIconHeightDivider;
|
stdIconHeight = sH / stdIconHeightDivider;
|
||||||
}
|
|
||||||
|
|
||||||
setupButtonsLook();
|
setupButtonsLook();
|
||||||
|
|
||||||
|
@ -216,11 +215,11 @@ void localLibraryWidget::setupBooksList(int pageNumber) {
|
||||||
if(!coverPath.isEmpty()) {
|
if(!coverPath.isEmpty()) {
|
||||||
// Display book cover if found
|
// Display book cover if found
|
||||||
QPixmap pixmap(coverPath);
|
QPixmap pixmap(coverPath);
|
||||||
bookIconArray[in]->setPixmap(pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio));
|
bookIconArray[in]->setPixmap(pixmap.scaled(stdIconWidth, stdIconHeight, Qt::IgnoreAspectRatio));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QPixmap pixmap(":/resources/cover_unavailable.png");
|
QPixmap pixmap(":/resources/cover_unavailable.png");
|
||||||
bookIconArray[in]->setPixmap(pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
bookIconArray[in]->setPixmap(pixmap.scaled(stdIconWidth, stdIconHeight, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display book title
|
// Display book title
|
||||||
|
@ -329,7 +328,7 @@ void localLibraryWidget::btnOpenBook(int buttonNumber) {
|
||||||
if(id == global::localLibrary::folderID) {
|
if(id == global::localLibrary::folderID) {
|
||||||
if(folderFeatureEnabled == true) {
|
if(folderFeatureEnabled == true) {
|
||||||
log("A folder was selected", className);
|
log("A folder was selected", className);
|
||||||
QString directory = purgeHtml(bookBtnArray[buttonNumber]->text());
|
QString directory = bookBtnArray[buttonNumber]->statusTip();
|
||||||
changePathAndRefresh(directory);
|
changePathAndRefresh(directory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -423,7 +422,7 @@ void localLibraryWidget::openBookOptionsDialog(int pseudoBookID) {
|
||||||
if(folderFeatureEnabled == true) {
|
if(folderFeatureEnabled == true) {
|
||||||
bookID = id;
|
bookID = id;
|
||||||
log("Opening options dialog for directory", className);
|
log("Opening options dialog for directory", className);
|
||||||
QString directoryPath = purgeHtml(bookBtnArray[pseudoBookID]->text());
|
QString directoryPath = bookBtnArray[pseudoBookID]->statusTip();
|
||||||
log("Directory path is '" + directoryPath + "'", className);
|
log("Directory path is '" + directoryPath + "'", className);
|
||||||
global::localLibrary::bookOptionsDialog::isFolder = true;
|
global::localLibrary::bookOptionsDialog::isFolder = true;
|
||||||
global::localLibrary::bookOptionsDialog::folderPath = pathForFolders + directoryPath;
|
global::localLibrary::bookOptionsDialog::folderPath = pathForFolders + directoryPath;
|
||||||
|
@ -535,7 +534,14 @@ void localLibraryWidget::setupBooksListFolders(int pageNumber) {
|
||||||
lineArray[in]->show();
|
lineArray[in]->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
bookBtnArray[in]->setText("<font face='Inter'><b>" + directoryListPure.at(directoryCount) + "</b></font>");
|
QString directoryNameFull = directoryListPure.at(directoryCount);
|
||||||
|
bookBtnArray[in]->setStatusTip(directoryNameFull);
|
||||||
|
QString directoryNameNotFull = directoryNameFull;
|
||||||
|
if(directoryNameNotFull.length() > bookTitleTruncateThreshold) {
|
||||||
|
directoryNameNotFull.truncate(bookTitleTruncateThreshold);
|
||||||
|
directoryNameNotFull.append("...");
|
||||||
|
}
|
||||||
|
bookBtnArray[in]->setText("<font face='Inter'><b>" + directoryNameNotFull + "</b></font>");
|
||||||
bookIconArray[in]->setPixmap(pixmapForFolder.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
bookIconArray[in]->setPixmap(pixmapForFolder.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||||
|
|
||||||
// ID for indicating that it's a folder in btnOpenBook
|
// ID for indicating that it's a folder in btnOpenBook
|
||||||
|
@ -568,11 +574,11 @@ void localLibraryWidget::setupBooksListFolders(int pageNumber) {
|
||||||
if(QFile(coverPath).exists()) {
|
if(QFile(coverPath).exists()) {
|
||||||
// Display book cover if found
|
// Display book cover if found
|
||||||
QPixmap pixmap(coverPath);
|
QPixmap pixmap(coverPath);
|
||||||
bookIconArray[in]->setPixmap(pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio));
|
bookIconArray[in]->setPixmap(pixmap.scaled(stdIconWidth, stdIconHeight, Qt::IgnoreAspectRatio));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QPixmap pixmap(":/resources/cover_unavailable.png");
|
QPixmap pixmap(":/resources/cover_unavailable.png");
|
||||||
bookIconArray[in]->setPixmap(pixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
bookIconArray[in]->setPixmap(pixmap.scaled(stdIconWidth, stdIconHeight, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display book title
|
// Display book title
|
||||||
|
|
Loading…
Reference in a new issue