diff --git a/CHANGELOG.md b/CHANGELOG.md index e3a496af..11a0ddc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ Version counting is based on semantic versioning (Major.Feature.Patch) ## WIP +### YACReaderLibrary +* Ensure that comic info exports use .ydb as file suffix + +### YACReader +* Show error when opening bad open recent entries +* GoTo page: Fix segfault when entering page numbers greater than comic's page count + (toolbar and page flow) +* Initialize GotoFlow on current page, not cover +* Quick navigation mode: Fix page index error when using both mouse and keyboard for navigation +* Remove obsolete double page mode debug messages + ## 9.8.2 ### YACReaderLibrary * Fix opening comics from the continue reading banner. diff --git a/YACReader/goto_dialog.cpp b/YACReader/goto_dialog.cpp index 93e21ee5..749dd17a 100644 --- a/YACReader/goto_dialog.cpp +++ b/YACReader/goto_dialog.cpp @@ -60,12 +60,10 @@ void GoToDialog::setupUI() void GoToDialog::goTo() { unsigned int page = pageNumber->text().toInt(); - pageNumber->clear(); - - if (page >= 1) + if (page >= 1 && page <= v->top()) { emit(goToPage(page - 1)); - - close(); + close(); + } } void GoToDialog::setNumPages(unsigned int numPages) diff --git a/YACReader/goto_flow_toolbar.cpp b/YACReader/goto_flow_toolbar.cpp index 0d13f773..b8db9a5e 100644 --- a/YACReader/goto_flow_toolbar.cpp +++ b/YACReader/goto_flow_toolbar.cpp @@ -32,7 +32,8 @@ GoToFlowToolBar::GoToFlowToolBar(QWidget *parent) " border-radius: 1px;" "}"); - connect(slider, &QSlider::valueChanged, this, [this](int v) { emit(setCenter(v)); }); + connect(slider, &QSlider::valueChanged, this, [&](int v) { emit(setCenter(v)); }); + connect(slider, &QSlider::valueChanged, this, [=](int v) { emit(setPage(v)); }); pageHint = new QLabel("" + tr("Page : ") + "", this); v = new QIntValidator(this); @@ -109,8 +110,10 @@ void GoToFlowToolBar::setTop(int numPages) void GoToFlowToolBar::goTo() { - if (edit->text().toInt() != 0) - emit(goToPage(edit->text().toInt() - 1)); + unsigned int page = edit->text().toInt(); + if (page >= 1 && page <= v->top()) { + emit(goTo(page - 1)); + } } void GoToFlowToolBar::centerSlide() diff --git a/YACReader/goto_flow_widget.cpp b/YACReader/goto_flow_widget.cpp index 9b96efe6..b3178948 100644 --- a/YACReader/goto_flow_widget.cpp +++ b/YACReader/goto_flow_widget.cpp @@ -11,7 +11,7 @@ GoToFlowWidget::GoToFlowWidget(QWidget *parent) : QWidget(parent) { - mainLayout = new QVBoxLayout; + mainLayout = new QVBoxLayout(this); mainLayout->setMargin(0); mainLayout->setSpacing(0); @@ -22,11 +22,7 @@ GoToFlowWidget::GoToFlowWidget(QWidget *parent) //toolBar->installEventFilter(this); } -GoToFlowWidget::~GoToFlowWidget() -{ - delete toolBar; - delete mainLayout; -} +GoToFlowWidget::~GoToFlowWidget() { } void GoToFlowWidget::setPageNumber(int page) { diff --git a/YACReader/main.cpp b/YACReader/main.cpp index 228d1628..7a76640b 100644 --- a/YACReader/main.cpp +++ b/YACReader/main.cpp @@ -89,6 +89,13 @@ int main(int argc, char *argv[]) { qInstallMessageHandler(messageHandler); + static const char ENV_VAR_QT_DEVICE_PIXEL_RATIO[] = "QT_DEVICE_PIXEL_RATIO"; + if (!qEnvironmentVariableIsSet(ENV_VAR_QT_DEVICE_PIXEL_RATIO) && !qEnvironmentVariableIsSet("QT_AUTO_SCREEN_SCALE_FACTOR") && !qEnvironmentVariableIsSet("QT_SCALE_FACTOR") && !qEnvironmentVariableIsSet("QT_SCREEN_SCALE_FACTORS")) { + QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + } + + QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); + #if defined(_MSC_VER) && defined(_DEBUG) _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif @@ -105,7 +112,7 @@ int main(int argc, char *argv[]) app.setApplicationName("YACReader"); app.setOrganizationName("YACReader"); - app.setAttribute(Qt::AA_UseHighDpiPixmaps); + if (QIcon::hasThemeIcon("YACReader")) { app.setWindowIcon(QIcon::fromTheme("YACReader")); } diff --git a/YACReader/main_window_viewer.cpp b/YACReader/main_window_viewer.cpp index 85a98e87..f07f5e69 100644 --- a/YACReader/main_window_viewer.cpp +++ b/YACReader/main_window_viewer.cpp @@ -810,6 +810,9 @@ void MainWindowViewer::openComicFromRecentAction(QAction *action) } else if (info1.isDir()) { openFolderFromPath(action->data().toString()); } + } else { + viewer->resetContent(); + viewer->showMessageErrorOpening(); } } diff --git a/YACReader/render.cpp b/YACReader/render.cpp index e7e7caaa..a63054d9 100644 --- a/YACReader/render.cpp +++ b/YACReader/render.cpp @@ -587,9 +587,6 @@ bool Render::nextPageIsDoublePage() bool Render::previousPageIsDoublePage() { - qWarning("Previous page is doublepage!"); - qWarning("%d", currentIndex); - qWarning("%d", currentPageBufferedIndex); if (currentIndex == 2 && Configuration::getConfiguration().getSettings()->value(COVER_IS_SP, true).toBool()) { return false; } diff --git a/YACReader/viewer.cpp b/YACReader/viewer.cpp index c26544ec..a349818a 100644 --- a/YACReader/viewer.cpp +++ b/YACReader/viewer.cpp @@ -844,9 +844,9 @@ void Viewer::animateShowGoToFlow() showGoToFlowAnimation->setStartValue(QPoint((width() - goToFlow->width()) / 2, height() - 10)); showGoToFlowAnimation->setEndValue(QPoint((width() - goToFlow->width()) / 2, height() - goToFlow->height())); showGoToFlowAnimation->start(); - goToFlow->centerSlide(render->getIndex()); - goToFlow->setPageNumber(render->getIndex()); goToFlow->show(); + goToFlow->setPageNumber(render->getIndex()); + goToFlow->centerSlide(render->getIndex()); goToFlow->setFocus(Qt::OtherFocusReason); } } diff --git a/YACReaderLibrary/export_comics_info_dialog.cpp b/YACReaderLibrary/export_comics_info_dialog.cpp index 3535c08b..77fc476b 100644 --- a/YACReaderLibrary/export_comics_info_dialog.cpp +++ b/YACReaderLibrary/export_comics_info_dialog.cpp @@ -65,7 +65,7 @@ void ExportComicsInfoDialog::findPath() { QString s = QFileDialog::getSaveFileName(this, tr("Destination database name"), ".", "*.ydb"); if (!s.isEmpty()) { - path->setText(s); + path->setText(s.endsWith(".ydb") ? s : s + ".ydb"); accept->setEnabled(true); } } diff --git a/YACReaderLibrary/main.cpp b/YACReaderLibrary/main.cpp index 1c11315b..29fcc229 100644 --- a/YACReaderLibrary/main.cpp +++ b/YACReaderLibrary/main.cpp @@ -119,6 +119,14 @@ void messageHandler(QtMsgType type, const QMessageLogContext &context, const QSt int main(int argc, char **argv) { qInstallMessageHandler(messageHandler); + + static const char ENV_VAR_QT_DEVICE_PIXEL_RATIO[] = "QT_DEVICE_PIXEL_RATIO"; + if (!qEnvironmentVariableIsSet(ENV_VAR_QT_DEVICE_PIXEL_RATIO) && !qEnvironmentVariableIsSet("QT_AUTO_SCREEN_SCALE_FACTOR") && !qEnvironmentVariableIsSet("QT_SCALE_FACTOR") && !qEnvironmentVariableIsSet("QT_SCREEN_SCALE_FACTORS")) { + QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + } + + QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); + QApplication app(argc, argv); #ifdef FORCE_ANGLE @@ -128,7 +136,6 @@ int main(int argc, char **argv) app.setApplicationName("YACReaderLibrary"); app.setOrganizationName("YACReader"); app.setApplicationVersion(VERSION); - app.setAttribute(Qt::AA_UseHighDpiPixmaps); // Set window icon according to Freedesktop icon specification // This is mostly relevant for Linux and other Unix systems