mirror of
https://github.com/Quill-OS/quill.git
synced 2024-10-31 21:33:22 -07:00
bookInfoDialog successfully bridged with search dialog
This commit is contained in:
parent
4b30573899
commit
3ebdce1f07
5 changed files with 47 additions and 5 deletions
|
@ -45,7 +45,31 @@ bookInfoDialog::bookInfoDialog(QWidget *parent) :
|
|||
global::library::bookTitle = "";
|
||||
}
|
||||
else {
|
||||
ui->bookTitleLabel->setText(global::library::bookTitle);
|
||||
global::library::bookTitle = "";
|
||||
|
||||
QDir dictdir;
|
||||
dictdir.mkpath("/inkbox/gutenberg");
|
||||
string_writeconfig("/inkbox/gutenberg/bookid", QString::number(global::library::bookId).toStdString());
|
||||
string_writeconfig("/opt/ibxd", "gutenberg_get_cover\n");
|
||||
while(true) {
|
||||
if(QFile::exists("/inkbox/gutenberg/getCoverDone")) {
|
||||
if(checkconfig("/inkbox/gutenberg/getCoverDone") == true) {
|
||||
QPixmap coverPixmap("/inkbox/gutenberg/book_cover.jpg");
|
||||
QPixmap scaledCoverPixmap = coverPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
|
||||
ui->bookCoverLabel->setPixmap(scaledCoverPixmap);
|
||||
QFile::remove("/inkbox/gutenberg/getCoverDone");
|
||||
break;
|
||||
}
|
||||
else {
|
||||
QPixmap coverPixmap(":/resources/cover_unavailable.png");
|
||||
QPixmap scaledCoverPixmap = coverPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
|
||||
ui->bookCoverLabel->setPixmap(scaledCoverPixmap);
|
||||
QFile::remove("/inkbox/gutenberg/getCoverDone");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Centering dialog
|
||||
|
|
1
eink.qrc
1
eink.qrc
|
@ -70,5 +70,6 @@
|
|||
<file>resources/alert-triangle.png</file>
|
||||
<file>resources/online-library.png</file>
|
||||
<file>resources/online-library-inverted.png</file>
|
||||
<file>resources/cover_unavailable.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -367,6 +367,7 @@ void generalDialog::on_okBtn_clicked()
|
|||
connect(searchResultsWidgetWindow, SIGNAL(destroyed(QObject*)), SLOT(restartSearchDialog()));
|
||||
searchResultsWidgetWindow->setListViewContents(searchResults);
|
||||
ui->mainStackedWidget->insertWidget(1, searchResultsWidgetWindow);
|
||||
QFile::remove("/inkbox/gutenberg-search/search_done");
|
||||
break;
|
||||
}
|
||||
else {
|
||||
|
@ -374,9 +375,9 @@ void generalDialog::on_okBtn_clicked()
|
|||
emit showToast("No results found");
|
||||
keyboardWidget->clearLineEdit();
|
||||
global::keyboard::keyboardText = "";
|
||||
QFile::remove("/inkbox/gutenberg-search/search_done");
|
||||
break;
|
||||
}
|
||||
QFile::remove("/inkbox/gutenberg-search/search_done");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
BIN
resources/cover_unavailable.png
Normal file
BIN
resources/cover_unavailable.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
|
@ -39,16 +39,32 @@ void searchResultsWidget::on_openBtn_clicked()
|
|||
// Get currently selected row number
|
||||
int selectedRow = ui->listView->currentIndex().row();
|
||||
// So that row 0 becomes row 1
|
||||
selectedRow = selectedRow++;
|
||||
selectedRow = selectedRow + 1;
|
||||
QString selectedRowQstr = QString::number(selectedRow);
|
||||
|
||||
// TODO: Find book ID and pass it on to bookInfoDialog, then retrieve cover.jpg for display
|
||||
QString prog ("sed");
|
||||
QStringList args;
|
||||
args << "-n" << selectedRowQstr + "p" << "/inkbox/gutenberg-search/search_results_ids";
|
||||
QProcess *proc = new QProcess();
|
||||
proc->start(prog, args);
|
||||
proc->waitForFinished();
|
||||
QString bookIdQstr = proc->readAllStandardOutput();
|
||||
proc->deleteLater();
|
||||
|
||||
global::keyboard::searchDialog = false;
|
||||
global::keyboard::keyboardDialog = false;
|
||||
unsigned long bookId = bookIdQstr.toULong();
|
||||
global::library::bookId = bookId;
|
||||
|
||||
index = ui->listView->currentIndex();
|
||||
itemText = index.data(Qt::DisplayRole).toString();
|
||||
global::library::bookTitle = itemText;
|
||||
|
||||
bookInfoDialog * bookInfoDialogWindow = new bookInfoDialog();
|
||||
bookInfoDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||
bookInfoDialogWindow->show();
|
||||
|
||||
global::keyboard::searchDialog = false;
|
||||
global::keyboard::keyboardDialog = false;
|
||||
searchResultsWidget::close();
|
||||
}
|
||||
else {
|
||||
index = ui->listView->currentIndex();
|
||||
|
|
Loading…
Reference in a new issue