mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 23:57:22 -08: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 = "";
|
global::library::bookTitle = "";
|
||||||
}
|
}
|
||||||
else {
|
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
|
// Centering dialog
|
||||||
|
|
1
eink.qrc
1
eink.qrc
|
@ -70,5 +70,6 @@
|
||||||
<file>resources/alert-triangle.png</file>
|
<file>resources/alert-triangle.png</file>
|
||||||
<file>resources/online-library.png</file>
|
<file>resources/online-library.png</file>
|
||||||
<file>resources/online-library-inverted.png</file>
|
<file>resources/online-library-inverted.png</file>
|
||||||
|
<file>resources/cover_unavailable.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -367,6 +367,7 @@ void generalDialog::on_okBtn_clicked()
|
||||||
connect(searchResultsWidgetWindow, SIGNAL(destroyed(QObject*)), SLOT(restartSearchDialog()));
|
connect(searchResultsWidgetWindow, SIGNAL(destroyed(QObject*)), SLOT(restartSearchDialog()));
|
||||||
searchResultsWidgetWindow->setListViewContents(searchResults);
|
searchResultsWidgetWindow->setListViewContents(searchResults);
|
||||||
ui->mainStackedWidget->insertWidget(1, searchResultsWidgetWindow);
|
ui->mainStackedWidget->insertWidget(1, searchResultsWidgetWindow);
|
||||||
|
QFile::remove("/inkbox/gutenberg-search/search_done");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -374,9 +375,9 @@ void generalDialog::on_okBtn_clicked()
|
||||||
emit showToast("No results found");
|
emit showToast("No results found");
|
||||||
keyboardWidget->clearLineEdit();
|
keyboardWidget->clearLineEdit();
|
||||||
global::keyboard::keyboardText = "";
|
global::keyboard::keyboardText = "";
|
||||||
|
QFile::remove("/inkbox/gutenberg-search/search_done");
|
||||||
break;
|
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
|
// Get currently selected row number
|
||||||
int selectedRow = ui->listView->currentIndex().row();
|
int selectedRow = ui->listView->currentIndex().row();
|
||||||
// So that row 0 becomes row 1
|
// 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;
|
unsigned long bookId = bookIdQstr.toULong();
|
||||||
global::keyboard::keyboardDialog = false;
|
global::library::bookId = bookId;
|
||||||
|
|
||||||
|
index = ui->listView->currentIndex();
|
||||||
|
itemText = index.data(Qt::DisplayRole).toString();
|
||||||
|
global::library::bookTitle = itemText;
|
||||||
|
|
||||||
bookInfoDialog * bookInfoDialogWindow = new bookInfoDialog();
|
bookInfoDialog * bookInfoDialogWindow = new bookInfoDialog();
|
||||||
bookInfoDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
bookInfoDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
bookInfoDialogWindow->show();
|
bookInfoDialogWindow->show();
|
||||||
|
|
||||||
|
global::keyboard::searchDialog = false;
|
||||||
|
global::keyboard::keyboardDialog = false;
|
||||||
|
searchResultsWidget::close();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
index = ui->listView->currentIndex();
|
index = ui->listView->currentIndex();
|
||||||
|
|
Loading…
Reference in a new issue