Merge branch 'develop' into clazy_autorefactoring

This commit is contained in:
Luis Ángel San Martín 2021-09-26 08:52:23 +02:00 committed by GitHub
commit b8ad2b540b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 44 additions and 22 deletions

View File

@ -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.

View File

@ -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)

View File

@ -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("<b>" + tr("Page : ") + "</b>", 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()

View File

@ -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)
{

View File

@ -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"));
}

View File

@ -810,6 +810,9 @@ void MainWindowViewer::openComicFromRecentAction(QAction *action)
} else if (info1.isDir()) {
openFolderFromPath(action->data().toString());
}
} else {
viewer->resetContent();
viewer->showMessageErrorOpening();
}
}

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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