Setting to control whether the time is shown in the 'current page/total' label.

Apparently I am going to make millions with this new feature :D
This commit is contained in:
Luis Ángel San Martín
2025-07-18 14:51:33 +02:00
parent 6a4f9730f5
commit 41b7873263
7 changed files with 51 additions and 22 deletions

View File

@ -7,6 +7,7 @@ Version counting is based on semantic versioning (Major.Feature.Patch)
* Don't use scroll animations on macos by default, it where hdpi scroll is most likely to be used.
* New toolbar on macos.
* New mouse modes to turn pages. You can setup the app to use the left/right buttons to turn pages directly or you can click on the left/right part of the screen to turn pages.
* New setting to control whether the time is shown in the 'current page/total' label.
### YACReaderLibrary
* Improve flexibility of the open comic in third party app setting so more complex commands can be used. e.g. `open -a "/Applications/My Reader.app" "{comic_file_path}"`.

View File

@ -91,6 +91,8 @@ public:
void setShowToolbars(bool b) { settings->setValue(SHOW_TOOLBARS, b); }
bool getShowInformation() { return settings->value(SHOW_INFO, false).toBool(); }
void setShowInformation(bool b) { settings->setValue(SHOW_INFO, b); }
bool getShowTimeInInformation() { return settings->value(SHOW_TIME_IN_INFO, true).toBool(); }
void setShowTimeInInformation(bool b) { settings->setValue(SHOW_TIME_IN_INFO, b); }
QDate getLastVersionCheck() { return settings->value(LAST_VERSION_CHECK).toDate(); }
void setLastVersionCheck(const QDate &date) { settings->setValue(LAST_VERSION_CHECK, date); }
int getNumDaysBetweenVersionChecks() { return settings->value(NUM_DAYS_BETWEEN_VERSION_CHECKS, 1).toInt(); }

View File

@ -38,6 +38,12 @@ OptionsDialog::OptionsDialog(QWidget *parent)
path->addWidget(pathFindButton = new QPushButton(QIcon(":/images/find_folder.png"), ""));
pathBox->setLayout(path);
QGroupBox *displayBox = new QGroupBox(tr("Display"));
auto displayLayout = new QHBoxLayout();
showTimeInInformationLabel = new QCheckBox(tr("Show time in current page information label"));
displayLayout->addWidget(showTimeInInformationLabel);
displayBox->setLayout(displayLayout);
connect(pathFindButton, &QAbstractButton::clicked, this, &OptionsDialog::findFolder);
QGroupBox *slideSizeBox = new QGroupBox(tr("\"Go to flow\" size"));
@ -95,6 +101,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
mouseModeBox->setLayout(mouseModeLayout);
layoutGeneral->addWidget(pathBox);
layoutGeneral->addWidget(displayBox);
layoutGeneral->addWidget(slideSizeBox);
// layoutGeneral->addWidget(fitBox);
layoutGeneral->addWidget(colorBox);
@ -251,6 +258,8 @@ void OptionsDialog::saveOptions()
settings->setValue(PATH, pathEdit->text());
Configuration::getConfiguration().setShowTimeInInformation(showTimeInInformationLabel->isChecked());
settings->setValue(BACKGROUND_COLOR, currentColor);
// settings->setValue(FIT_TO_WIDTH_RATIO,fitToWidthRatioS->sliderPosition()/100.0);
settings->setValue(QUICK_NAVI_MODE, quickNavi->isChecked());
@ -297,6 +306,8 @@ void OptionsDialog::restoreOptions(QSettings *settings)
pathEdit->setText(settings->value(PATH).toString());
showTimeInInformationLabel->setChecked(Configuration::getConfiguration().getShowTimeInInformation());
updateColor(settings->value(BACKGROUND_COLOR).value<QColor>());
// fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100);

View File

@ -22,6 +22,9 @@ private:
// QLabel * pathLabel;
QLineEdit *pathEdit;
QPushButton *pathFindButton;
QCheckBox *showTimeInInformationLabel;
QCheckBox *quickNavi;
QCheckBox *disableShowOnMouseOver;
QCheckBox *scaleCheckbox;

View File

@ -18,32 +18,35 @@ PageLabelWidget::PageLabelWidget(QWidget *parent)
auto layout = new QHBoxLayout;
layout->setContentsMargins(0, 0, 0, 0);
setContentsMargins(0, 0, 0, 0);
QSize labelSize;
if (verticalRes <= 1024)
labelSize = QSize(135, 30);
else if (verticalRes <= 1200)
labelSize = QSize(170, 35);
else
labelSize = QSize(205, 45);
textLabel = new QLabel(this);
textLabel->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
if (verticalRes <= 1024)
textLabel->setStyleSheet("QLabel { color : white; font-size:12px; padding-left:8px; }");
else if (verticalRes <= 1200)
textLabel->setStyleSheet("QLabel { color : white; font-size:16px; padding-left:8px;}");
else
textLabel->setStyleSheet("QLabel { color : white; font-size:20px; padding-left:8px; }");
textLabel->setWordWrap(true); // Allow wrapping
setFixedSize(labelSize);
int contentMargin = 0;
if (verticalRes <= 1024) {
textLabel->setStyleSheet("QLabel { color : white; font-size:12px; }");
contentMargin = 12;
} else if (verticalRes <= 1200) {
textLabel->setStyleSheet("QLabel { color : white; font-size:16px; }");
contentMargin = 16;
} else {
textLabel->setStyleSheet("QLabel { color : white; font-size:20px; }");
contentMargin = 20;
}
setContentsMargins(contentMargin * 2.3, contentMargin / 2.3, contentMargin * 2.3, contentMargin / 2.3);
// Instead of fixed size, allow dynamic sizing
textLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
layout->addWidget(textLabel, 0, Qt::AlignCenter);
setLayout(layout);
adjustSize(); // Resize to fit content
if (parent != nullptr)
move(QPoint((parent->geometry().size().width() - this->width()), -this->height()));
layout->addWidget(textLabel, 0, Qt::AlignCenter);
setLayout(layout);
}
void PageLabelWidget::show()

View File

@ -825,6 +825,7 @@ void Viewer::setMagnifyingGlassShown(bool shown)
void Viewer::informationSwitch()
{
informationLabel->updatePosition();
information ? informationLabel->hide() : informationLabel->show();
// informationLabel->move(QPoint((width()-informationLabel->width())/2,0));
information = !information;
@ -837,9 +838,16 @@ void Viewer::informationSwitch()
void Viewer::updateInformation()
{
if (render->hasLoadedComic()) {
auto displayTime = Configuration::getConfiguration().getShowTimeInInformation();
if (displayTime) {
informationLabel->setText(render->getCurrentPagesInformation() + " - " + QTime::currentTime().toString("HH:mm"));
} else {
informationLabel->setText(render->getCurrentPagesInformation());
}
informationLabel->adjustSize();
informationLabel->update(); // TODO it shouldn't be neccesary
informationLabel->updatePosition();
}
}
@ -1024,10 +1032,10 @@ void Viewer::showCursor()
void Viewer::updateOptions()
{
goToFlow->setFlowType(Configuration::getConfiguration().getFlowType());
updateBackgroundColor(Configuration::getConfiguration().getBackgroundColor());
updateContentSize();
updateInformation();
}
void Viewer::updateBackgroundColor(const QColor &color)

View File

@ -30,6 +30,7 @@
#define CONTRAST "CONTRAST"
#define GAMMA "GAMMA"
#define SHOW_INFO "SHOW_INFO"
#define SHOW_TIME_IN_INFO "SHOW_TIME_IN_INFO"
#define QUICK_NAVI_MODE "QUICK_NAVI_MODE"
#define DISABLE_MOUSE_OVER_GOTO_FLOW "DISABLE_MOUSE_OVER_GOTO_FLOW"
#define ENLARGE_IMAGES "ENLARGE_IMAGES"