2022-06-23 08:10:38 -07:00
|
|
|
#ifndef LOCALLIBRARYWIDGET_H
|
|
|
|
#define LOCALLIBRARYWIDGET_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
2022-06-23 12:34:40 -07:00
|
|
|
#include <QLabel>
|
2022-06-25 20:22:38 -07:00
|
|
|
#include <QHBoxLayout>
|
2022-06-23 12:34:40 -07:00
|
|
|
|
|
|
|
#include "functions.h"
|
|
|
|
#include "qclickablelabel.h"
|
2022-06-29 08:42:05 -07:00
|
|
|
#include "generaldialog.h"
|
2022-06-30 06:52:48 -07:00
|
|
|
#include "toast.h"
|
2022-07-06 11:24:23 -07:00
|
|
|
#include "bookoptionsdialog.h"
|
2022-07-12 09:34:36 -07:00
|
|
|
#include "bookinfodialog.h"
|
2022-06-23 08:10:38 -07:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class localLibraryWidget;
|
|
|
|
}
|
|
|
|
|
|
|
|
class localLibraryWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2022-06-23 12:34:40 -07:00
|
|
|
QString className = this->metaObject()->className();
|
2022-06-23 08:10:38 -07:00
|
|
|
explicit localLibraryWidget(QWidget *parent = nullptr);
|
|
|
|
~localLibraryWidget();
|
2022-06-23 12:34:40 -07:00
|
|
|
int buttonsNumber;
|
|
|
|
int sW;
|
|
|
|
int sH;
|
2022-06-26 23:40:34 -07:00
|
|
|
float stdIconWidthDivider;
|
|
|
|
float stdIconHeightDivider;
|
2022-06-23 12:34:40 -07:00
|
|
|
int stdIconWidth;
|
|
|
|
int stdIconHeight;
|
2022-06-25 17:12:50 -07:00
|
|
|
QJsonDocument databaseJsonDocument;
|
|
|
|
QJsonObject databaseJsonObject;
|
|
|
|
QJsonArray databaseJsonArrayList;
|
|
|
|
int currentPageNumber = 1;
|
2022-06-25 20:22:38 -07:00
|
|
|
int pagesNumber;
|
2022-06-27 15:14:20 -07:00
|
|
|
int pagesTurned = 0;
|
2022-06-25 20:22:38 -07:00
|
|
|
int booksNumber;
|
2022-06-26 08:51:52 -07:00
|
|
|
int bookTitleTruncateThreshold;
|
|
|
|
QVector<int> idList;
|
2022-06-27 15:14:20 -07:00
|
|
|
bool noBooksInDatabase = true;
|
2022-06-23 12:34:40 -07:00
|
|
|
|
|
|
|
private slots:
|
2022-06-25 17:12:50 -07:00
|
|
|
void setupDatabase();
|
|
|
|
void setupBooksList(int pageNumber);
|
|
|
|
void on_previousPageBtn_clicked();
|
|
|
|
void on_nextPageBtn_clicked();
|
|
|
|
void openBook(int id);
|
|
|
|
void btnOpenBook(int buttonNumber);
|
2022-06-26 10:21:43 -07:00
|
|
|
void refreshScreenNative();
|
2022-06-29 08:42:05 -07:00
|
|
|
void openGoToPageDialog();
|
|
|
|
void goToPage(int page);
|
2022-06-30 06:52:48 -07:00
|
|
|
void setupDisplay();
|
|
|
|
void showToast(QString messageToDisplay);
|
2022-07-15 20:58:05 -07:00
|
|
|
void openBookOptionsDialog(int pseudoBookID);
|
2022-07-06 11:24:23 -07:00
|
|
|
void handlePossibleBookDeletion();
|
2022-07-12 09:34:36 -07:00
|
|
|
void openLocalBookInfoDialog();
|
2022-06-23 08:10:38 -07:00
|
|
|
|
|
|
|
private:
|
2022-06-23 12:34:40 -07:00
|
|
|
Ui::localLibraryWidget * ui;
|
2022-06-29 08:42:05 -07:00
|
|
|
generalDialog * generalDialogWindow;
|
2022-07-06 11:24:23 -07:00
|
|
|
bookOptionsDialog * bookOptionsDialogWindow;
|
2022-06-30 06:52:48 -07:00
|
|
|
toast * toastWindow;
|
2022-07-12 09:34:36 -07:00
|
|
|
bookInfoDialog * bookInfoDialogWindow;
|
2022-06-26 08:51:52 -07:00
|
|
|
QVector<QHBoxLayout*> horizontalLayoutArray;
|
|
|
|
QVector<QLabel*> bookIconArray;
|
|
|
|
QVector<QClickableLabel*> bookBtnArray;
|
|
|
|
QVector<QFrame*> lineArray;
|
2022-06-25 17:12:50 -07:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void openBookSignal(QString bookFile, bool relativePath);
|
2022-06-26 10:21:43 -07:00
|
|
|
void refreshScreen();
|
2022-06-23 08:10:38 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LOCALLIBRARYWIDGET_H
|