2021-03-25 05:00:19 -07:00
|
|
|
#ifndef READER_H
|
|
|
|
#define READER_H
|
|
|
|
|
2021-04-05 06:50:58 -07:00
|
|
|
#include "functions.h"
|
2021-04-22 04:38:54 -07:00
|
|
|
#include "alert.h"
|
|
|
|
#include "generaldialog.h"
|
2021-07-13 22:24:30 -07:00
|
|
|
#include "toast.h"
|
2021-12-31 13:54:53 -08:00
|
|
|
#include "quit.h"
|
2021-04-05 06:50:58 -07:00
|
|
|
|
2021-03-25 05:00:19 -07:00
|
|
|
#include <QWidget>
|
2021-08-29 12:05:07 -07:00
|
|
|
#include <QGraphicsScene>
|
2021-03-25 05:00:19 -07:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
2022-01-09 08:06:22 -08:00
|
|
|
// ePUB & PDF scaling
|
2021-06-17 05:34:00 -07:00
|
|
|
namespace mupdf {
|
2021-09-01 19:07:30 -07:00
|
|
|
inline bool convertRelativeValues;
|
2021-08-29 12:05:07 -07:00
|
|
|
namespace epub {
|
|
|
|
inline int fontSize;
|
|
|
|
inline int width;
|
|
|
|
inline int height;
|
|
|
|
inline int epubPageNumber;
|
|
|
|
inline QString fontSize_qstr;
|
|
|
|
inline QString width_qstr;
|
|
|
|
inline QString height_qstr;
|
|
|
|
inline QString epubPageNumber_qstr;
|
|
|
|
}
|
|
|
|
namespace pdf {
|
|
|
|
inline int width;
|
|
|
|
inline int height;
|
2021-09-01 19:07:30 -07:00
|
|
|
inline int relativeWidth;
|
|
|
|
inline int relativeHeight;
|
2021-08-29 12:05:07 -07:00
|
|
|
inline int pdfPageNumber;
|
|
|
|
inline QString width_qstr;
|
|
|
|
inline QString height_qstr;
|
|
|
|
inline QString pdfPageNumber_qstr;
|
|
|
|
}
|
2021-06-17 05:34:00 -07:00
|
|
|
}
|
|
|
|
|
2021-03-25 05:00:19 -07:00
|
|
|
namespace Ui {
|
|
|
|
class reader;
|
|
|
|
}
|
|
|
|
|
|
|
|
class reader : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2022-04-04 21:47:15 -07:00
|
|
|
QString className = this->metaObject()->className();
|
2021-04-22 10:56:29 -07:00
|
|
|
explicit reader(QWidget *parent = nullptr);
|
|
|
|
~reader();
|
|
|
|
|
2021-03-25 05:00:19 -07:00
|
|
|
int split_total;
|
|
|
|
int split_files_number;
|
|
|
|
int page_number;
|
|
|
|
int dictionary_position = 1;
|
2021-03-30 05:24:13 -07:00
|
|
|
int pagesTurned = 0;
|
2021-06-20 14:00:42 -07:00
|
|
|
int textAlignment;
|
2021-03-30 05:24:13 -07:00
|
|
|
|
|
|
|
// -1 : Never refresh | 0 : Refresh every page | 1 : Refresh every 1 page. And so on...
|
|
|
|
// Refresh every 3 pages is the default
|
|
|
|
int pageRefreshSetting = 3;
|
|
|
|
|
2021-03-25 05:00:19 -07:00
|
|
|
bool menubar_shown = false;
|
|
|
|
bool nextdefinition_lock = false;
|
2021-03-27 16:08:05 -07:00
|
|
|
bool is_epub = false;
|
2021-08-29 12:05:07 -07:00
|
|
|
bool is_pdf = false;
|
2022-01-09 08:06:22 -08:00
|
|
|
bool is_image = false;
|
2021-03-27 16:08:05 -07:00
|
|
|
bool parser_ran = false;
|
2021-06-17 05:34:00 -07:00
|
|
|
bool filematch_ran = false;
|
2021-03-30 05:24:13 -07:00
|
|
|
bool neverRefresh = false;
|
2021-04-06 09:01:04 -07:00
|
|
|
bool wakeFromSleep = false;
|
|
|
|
bool remount = true;
|
2021-06-20 10:31:24 -07:00
|
|
|
bool showTopbarWidget;
|
2021-06-20 14:00:42 -07:00
|
|
|
bool wordwidgetLock;
|
2021-06-22 19:51:28 -07:00
|
|
|
bool isNightModeActive;
|
2021-08-19 16:03:52 -07:00
|
|
|
bool goToSavedPageDone;
|
2021-03-25 05:00:19 -07:00
|
|
|
QString ittext;
|
|
|
|
QString book_file;
|
|
|
|
bool batt_status;
|
|
|
|
QString selected_text;
|
|
|
|
QString word;
|
|
|
|
QString words; // Saved words
|
|
|
|
QString letter;
|
|
|
|
string selected_text_str;
|
|
|
|
QString definition;
|
|
|
|
QPixmap scaledChargingPixmap;
|
|
|
|
QPixmap scaledHalfPixmap;
|
|
|
|
QPixmap scaledFullPixmap;
|
|
|
|
QPixmap scaledEmptyPixmap;
|
|
|
|
QList<QString> content;
|
2021-06-17 05:34:00 -07:00
|
|
|
QString epubPageContent;
|
2021-06-29 09:26:30 -07:00
|
|
|
QString usbmsStatus;
|
2021-07-04 19:35:06 -07:00
|
|
|
int pageNumberInt;
|
|
|
|
int totalPagesInt;
|
2022-04-16 16:40:30 -07:00
|
|
|
int pdfOrientation;
|
|
|
|
bool initialPdfRotationDone;
|
2021-06-20 10:31:24 -07:00
|
|
|
|
2021-04-22 07:10:47 -07:00
|
|
|
int setup_book(QString book, int i, bool run_parser);
|
2021-04-22 10:56:29 -07:00
|
|
|
void checkwords();
|
|
|
|
bool epub_file_match(QString file);
|
|
|
|
void dictionary_lookup(string word, QString first_letter, int position);
|
|
|
|
void save_word(string word, bool remove);
|
2021-03-25 05:00:19 -07:00
|
|
|
void menubar_show();
|
|
|
|
void menubar_hide();
|
|
|
|
void wordwidget_show();
|
|
|
|
void wordwidget_hide();
|
2021-04-22 04:38:54 -07:00
|
|
|
void openLowBatteryDialog();
|
2021-04-23 16:22:53 -07:00
|
|
|
void openCriticalBatteryAlertWindow();
|
2022-03-11 09:38:35 -08:00
|
|
|
void convertMuPdfVars(int fileType, bool convertAll);
|
2021-06-17 05:34:00 -07:00
|
|
|
void refreshScreen();
|
2021-08-29 12:05:07 -07:00
|
|
|
void setPageStyle(int fileType);
|
2021-06-20 14:00:42 -07:00
|
|
|
void alignText(int alignment);
|
|
|
|
void delay(int seconds);
|
2021-06-29 09:26:30 -07:00
|
|
|
void openUsbmsDialog();
|
2021-07-04 19:35:06 -07:00
|
|
|
QString setPageNumberLabelContent();
|
|
|
|
void setupPageWidget();
|
|
|
|
void getTotalEpubPagesNumber();
|
2021-08-29 12:05:07 -07:00
|
|
|
void getTotalPdfPagesNumber();
|
2021-07-11 19:11:13 -07:00
|
|
|
void setBitterFont();
|
|
|
|
void setCrimsonProFont();
|
|
|
|
void setIbarraFont();
|
2021-08-29 12:05:07 -07:00
|
|
|
bool pdf_file_match(QString file);
|
2022-01-09 08:06:22 -08:00
|
|
|
bool image_file_match(QString file);
|
2021-03-25 05:00:19 -07:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void on_nextBtn_clicked();
|
|
|
|
void on_previousBtn_clicked();
|
|
|
|
void on_optionsBtn_clicked();
|
|
|
|
void on_brightnessDecBtn_clicked();
|
|
|
|
void on_brightnessIncBtn_clicked();
|
|
|
|
void on_aboutBtn_clicked();
|
|
|
|
void on_homeBtn_clicked();
|
|
|
|
void on_fontChooser_currentIndexChanged(const QString &arg1);
|
|
|
|
void on_alignLeftBtn_clicked();
|
|
|
|
void on_alignCenterBtn_clicked();
|
|
|
|
void on_alignRightBtn_clicked();
|
|
|
|
void on_alignJustifyBtn_clicked();
|
|
|
|
void on_infoCloseBtn_clicked();
|
|
|
|
void on_previousDefinitionBtn_clicked();
|
|
|
|
void on_nextDefinitionBtn_clicked();
|
|
|
|
void on_saveWordBtn_clicked();
|
|
|
|
void on_sizeSlider_valueChanged(int value);
|
2021-08-19 09:55:12 -07:00
|
|
|
void writeconfig_pagenumber(bool persistent);
|
2021-04-08 04:47:27 -07:00
|
|
|
void quit_restart();
|
2021-06-20 14:00:42 -07:00
|
|
|
void on_text_selectionChanged();
|
2021-06-22 19:51:28 -07:00
|
|
|
void on_nightModeBtn_clicked();
|
2021-07-05 10:45:35 -07:00
|
|
|
void on_gotoBtn_clicked();
|
|
|
|
void gotoPage(int pageNumber);
|
2021-07-06 17:06:40 -07:00
|
|
|
void on_searchBtn_clicked();
|
|
|
|
void searchRefreshScreen();
|
|
|
|
void setupSearchDialog();
|
2021-08-19 09:55:12 -07:00
|
|
|
void saveReadingSettings();
|
|
|
|
void setupLocalSettingsEnvironment();
|
2021-08-29 12:05:07 -07:00
|
|
|
void setupPng();
|
2021-09-01 19:07:30 -07:00
|
|
|
void on_pdfScaleSlider_valueChanged(int value);
|
|
|
|
void on_decreaseScaleBtn_clicked();
|
|
|
|
void on_increaseScaleBtn_clicked();
|
2021-09-05 08:47:09 -07:00
|
|
|
void openBookFileNative(QString book, bool relativePath);
|
|
|
|
void showToast(QString messageToDisplay);
|
2021-12-31 13:54:53 -08:00
|
|
|
void on_quitBtn_clicked();
|
2022-04-06 20:24:16 -07:00
|
|
|
void closeIndefiniteToast();
|
2022-04-16 16:40:30 -07:00
|
|
|
void getPdfOrientation(QString file);
|
2021-09-05 08:47:09 -07:00
|
|
|
|
|
|
|
signals:
|
2021-09-05 07:29:52 -07:00
|
|
|
void openBookFile(QString book, bool relativePath);
|
2021-03-25 05:00:19 -07:00
|
|
|
|
|
|
|
private:
|
2021-08-29 12:05:07 -07:00
|
|
|
Ui::reader * ui;
|
|
|
|
alert * alertWindow;
|
|
|
|
generalDialog * generalDialogWindow;
|
|
|
|
toast * toastWindow;
|
2021-12-31 13:54:53 -08:00
|
|
|
quit * quitWindow;
|
2021-08-29 12:05:07 -07:00
|
|
|
QGraphicsScene * graphicsScene;
|
2021-03-25 05:00:19 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // READER_H
|