mirror of
https://github.com/Quill-OS/quill.git
synced 2024-10-31 21:33:22 -07:00
bookInfoDialog half-implemented
This commit is contained in:
parent
5cf39fb0ad
commit
7df1a38240
11 changed files with 302 additions and 10 deletions
61
bookinfodialog.cpp
Normal file
61
bookinfodialog.cpp
Normal file
|
@ -0,0 +1,61 @@
|
|||
#include "bookinfodialog.h"
|
||||
#include "ui_bookinfodialog.h"
|
||||
#include "functions.h"
|
||||
|
||||
#include <QScreen>
|
||||
|
||||
bookInfoDialog::bookInfoDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::bookInfoDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->closeBtn->setProperty("type", "borderless");
|
||||
ui->closeBtn->setText("");
|
||||
ui->closeBtn->setIcon(QIcon(":/resources/close.png"));
|
||||
ui->bookCoverLabel->setText("");
|
||||
ui->getBtn->setStyleSheet("background: lightGrey; font-size: 9pt; padding: 8px");
|
||||
|
||||
// Getting the screen's size
|
||||
sW = QGuiApplication::screens()[0]->size().width();
|
||||
sH = QGuiApplication::screens()[0]->size().height();
|
||||
|
||||
// Setting icons up
|
||||
stdIconWidth = sW / 4;
|
||||
stdIconHeight = sH / 4;
|
||||
|
||||
if(global::library::isLatestBook == true) {
|
||||
QString bookNumberQstr = QString::number(global::library::latestBookNumber);
|
||||
QString coverPath = "/mnt/onboard/onboard/.inkbox/gutenberg-data/latest-books/";
|
||||
coverPath = coverPath.append(bookNumberQstr);
|
||||
coverPath = coverPath.append("/cover.jpg");
|
||||
|
||||
QPixmap coverPixmap(coverPath);
|
||||
QPixmap scaledCoverPixmap = coverPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
|
||||
ui->bookCoverLabel->setPixmap(scaledCoverPixmap);
|
||||
global::library::isLatestBook = false;
|
||||
|
||||
ui->bookTitleLabel->setText(global::library::bookTitle);
|
||||
global::library::bookTitle = "";
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
// Centering dialog
|
||||
this->adjustSize();
|
||||
QRect screenGeometry = QGuiApplication::screens()[0]->geometry();
|
||||
int x = (screenGeometry.width() - this->width()) / 2;
|
||||
int y = (screenGeometry.height() - this->height()) / 2;
|
||||
this->move(x, y);
|
||||
}
|
||||
|
||||
bookInfoDialog::~bookInfoDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void bookInfoDialog::on_closeBtn_clicked()
|
||||
{
|
||||
bookInfoDialog::close();
|
||||
}
|
||||
|
29
bookinfodialog.h
Normal file
29
bookinfodialog.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
#ifndef BOOKINFODIALOG_H
|
||||
#define BOOKINFODIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class bookInfoDialog;
|
||||
}
|
||||
|
||||
class bookInfoDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit bookInfoDialog(QWidget *parent = nullptr);
|
||||
~bookInfoDialog();
|
||||
float sH;
|
||||
float sW;
|
||||
float stdIconHeight;
|
||||
float stdIconWidth;
|
||||
|
||||
private slots:
|
||||
void on_closeBtn_clicked();
|
||||
|
||||
private:
|
||||
Ui::bookInfoDialog *ui;
|
||||
};
|
||||
|
||||
#endif // BOOKINFODIALOG_H
|
163
bookinfodialog.ui
Normal file
163
bookinfodialog.ui
Normal file
|
@ -0,0 +1,163 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>bookInfoDialog</class>
|
||||
<widget class="QDialog" name="bookInfoDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>377</width>
|
||||
<height>209</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="closeBtn">
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="bookCoverLabel">
|
||||
<property name="text">
|
||||
<string>Cover</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="bookTitleLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Book title</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="getBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>GET</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -102,6 +102,13 @@ namespace global {
|
|||
inline bool disableStorageEncryptionDialog;
|
||||
inline bool errorNoBooksInDropboxDialog;
|
||||
}
|
||||
namespace library {
|
||||
inline unsigned long bookId;
|
||||
inline bool isLatestBook;
|
||||
inline int latestBookNumber;
|
||||
inline QString bookTitle;
|
||||
inline bool librarySearchDialog;
|
||||
}
|
||||
inline QString systemInfoText;
|
||||
inline bool forbidOpenSearchDialog;
|
||||
inline bool isN705;
|
||||
|
|
|
@ -47,6 +47,9 @@ generalDialog::generalDialog(QWidget *parent) :
|
|||
else if(checkconfig_str_val == "Local storage") {
|
||||
ui->searchComboBox->setCurrentIndex(1);
|
||||
}
|
||||
else if(checkconfig_str_val == "Online library") {
|
||||
ui->searchComboBox->setCurrentIndex(2);
|
||||
}
|
||||
else {
|
||||
ui->searchComboBox->setCurrentIndex(0);
|
||||
}
|
||||
|
@ -198,6 +201,7 @@ void generalDialog::on_cancelBtn_clicked()
|
|||
global::forbidOpenSearchDialog = true;
|
||||
global::keyboard::keyboardDialog = false;
|
||||
global::keyboard::keyboardText = "";
|
||||
global::library::librarySearchDialog = false;
|
||||
}
|
||||
else if(global::keyboard::vncDialog == true) {
|
||||
global::keyboard::vncDialog = false;
|
||||
|
@ -339,6 +343,9 @@ void generalDialog::on_okBtn_clicked()
|
|||
keyboardWidget->clearLineEdit();
|
||||
global::keyboard::keyboardText = "";
|
||||
}
|
||||
}
|
||||
else if(ui->searchComboBox->currentText() == "Online library") {
|
||||
|
||||
}
|
||||
else {
|
||||
;
|
||||
|
|
|
@ -223,6 +223,11 @@
|
|||
<string>Local storage</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Online library</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -13,6 +13,7 @@ QMAKE_CXXFLAGS += -Wno-unused-function -Wno-unused-parameter
|
|||
SOURCES += \
|
||||
alert.cpp \
|
||||
apps.cpp \
|
||||
bookinfodialog.cpp \
|
||||
brightnessdialog.cpp \
|
||||
calendarapp.cpp \
|
||||
dictionarywidget.cpp \
|
||||
|
@ -41,6 +42,7 @@ SOURCES += \
|
|||
HEADERS += \
|
||||
alert.h \
|
||||
apps.h \
|
||||
bookinfodialog.h \
|
||||
brightnessdialog.h \
|
||||
calendarapp.h \
|
||||
dictionarywidget.h \
|
||||
|
@ -69,6 +71,7 @@ HEADERS += \
|
|||
FORMS += \
|
||||
alert.ui \
|
||||
apps.ui \
|
||||
bookinfodialog.ui \
|
||||
brightnessdialog.ui \
|
||||
calendarapp.ui \
|
||||
dictionarywidget.ui \
|
||||
|
|
|
@ -228,13 +228,23 @@ QString libraryWidget::getTitle(int bookNumber) {
|
|||
QString fullTitlePath = "/mnt/onboard/onboard/.inkbox/gutenberg-data/latest-books/";
|
||||
fullTitlePath = fullTitlePath.append(bookNumberQstr);
|
||||
fullTitlePath = fullTitlePath.append("/title_full");
|
||||
qDebug() << fullTitlePath;
|
||||
|
||||
return readFile(fullTitlePath);
|
||||
}
|
||||
|
||||
void libraryWidget::openLatestBookInfoDialog(int bookNumber, QString title) {
|
||||
QString idPath = "/mnt/onboard/onboard/.inkbox/gutenberg-data/latest-books/";
|
||||
idPath = idPath.append(bookNumber);
|
||||
idPath = idPath.append("/id");
|
||||
global::library::isLatestBook = true;
|
||||
global::library::bookId = readFile(idPath).toULong();
|
||||
global::library::latestBookNumber = bookNumber;
|
||||
global::library::bookTitle = title;
|
||||
|
||||
bookInfoDialogWindow = new bookInfoDialog(this);
|
||||
bookInfoDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||
bookInfoDialogWindow->setModal(true);
|
||||
bookInfoDialogWindow->show();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <QWidget>
|
||||
#include <toast.h>
|
||||
#include <bookinfodialog.h>
|
||||
|
||||
namespace Ui {
|
||||
class libraryWidget;
|
||||
|
@ -23,6 +24,7 @@ public:
|
|||
private:
|
||||
Ui::libraryWidget * ui;
|
||||
toast * toastWindow;
|
||||
bookInfoDialog * bookInfoDialogWindow;
|
||||
|
||||
private slots:
|
||||
void syncCatalog();
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
<item row="4" column="0">
|
||||
<widget class="QStackedWidget" name="booksStackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
|
|
|
@ -29,6 +29,10 @@ void searchResultsWidget::setListViewContents(QStringList searchResults) {
|
|||
|
||||
void searchResultsWidget::on_openBtn_clicked()
|
||||
{
|
||||
if(global::library::librarySearchDialog == true) {
|
||||
|
||||
}
|
||||
else {
|
||||
index = ui->listView->currentIndex();
|
||||
itemText = index.data(Qt::DisplayRole).toString();
|
||||
if(!itemText.isEmpty()) {
|
||||
|
@ -40,6 +44,7 @@ void searchResultsWidget::on_openBtn_clicked()
|
|||
else {
|
||||
QMessageBox::critical(this, tr("Invalid argument"), tr("Please select a search result."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue