mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Add settings to the options dialog to control the mouse behavior
This commit is contained in:
parent
25a569cfa6
commit
a51252ca0d
@ -625,7 +625,7 @@ void MainWindowViewer::createToolBars()
|
|||||||
|
|
||||||
viewer->addAction(closeAction);
|
viewer->addAction(closeAction);
|
||||||
|
|
||||||
viewer->setContextMenuPolicy(Qt::ActionsContextMenu);
|
updateContextMenuPolicy();
|
||||||
|
|
||||||
// MacOSX app menus
|
// MacOSX app menus
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
@ -777,9 +777,25 @@ void MainWindowViewer::openComicFromRecentAction(QAction *action)
|
|||||||
|
|
||||||
void MainWindowViewer::reloadOptions()
|
void MainWindowViewer::reloadOptions()
|
||||||
{
|
{
|
||||||
|
updateContextMenuPolicy();
|
||||||
viewer->updateConfig(settings);
|
viewer->updateConfig(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindowViewer::updateContextMenuPolicy()
|
||||||
|
{
|
||||||
|
auto mouseMode = Configuration::getConfiguration().getMouseMode();
|
||||||
|
switch (mouseMode) {
|
||||||
|
|
||||||
|
case Normal:
|
||||||
|
case HotAreas:
|
||||||
|
viewer->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||||
|
break;
|
||||||
|
case LeftRightNavigation:
|
||||||
|
viewer->setContextMenuPolicy(Qt::NoContextMenu);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindowViewer::open()
|
void MainWindowViewer::open()
|
||||||
{
|
{
|
||||||
QFileDialog openDialog;
|
QFileDialog openDialog;
|
||||||
@ -970,11 +986,13 @@ void MainWindowViewer::disablePreviousNextComicActions()
|
|||||||
|
|
||||||
void MainWindowViewer::mouseDoubleClickEvent(QMouseEvent *event)
|
void MainWindowViewer::mouseDoubleClickEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
|
if (Configuration::getConfiguration().getMouseMode() == MouseMode::Normal) {
|
||||||
if (event->button() == Qt::LeftButton) {
|
if (event->button() == Qt::LeftButton) {
|
||||||
toggleFullScreen();
|
toggleFullScreen();
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindowViewer::toggleFullScreen()
|
void MainWindowViewer::toggleFullScreen()
|
||||||
{
|
{
|
||||||
|
@ -67,6 +67,7 @@ public slots:
|
|||||||
void increasePageZoomLevel();
|
void increasePageZoomLevel();
|
||||||
void decreasePageZoomLevel();
|
void decreasePageZoomLevel();
|
||||||
void reloadOptions();
|
void reloadOptions();
|
||||||
|
void updateContextMenuPolicy();
|
||||||
void fitToWidth();
|
void fitToWidth();
|
||||||
void fitToHeight();
|
void fitToHeight();
|
||||||
void toggleWidthHeight();
|
void toggleWidthHeight();
|
||||||
|
@ -81,11 +81,25 @@ OptionsDialog::OptionsDialog(QWidget *parent)
|
|||||||
|
|
||||||
scrollBox->setLayout(scrollLayout);
|
scrollBox->setLayout(scrollLayout);
|
||||||
|
|
||||||
|
auto mouseModeBox = new QGroupBox(tr("Mouse mode"));
|
||||||
|
auto mouseModeLayout = new QVBoxLayout();
|
||||||
|
|
||||||
|
normalMouseModeRadioButton = new QRadioButton(tr("Only Back/Forward buttons can turn pages"));
|
||||||
|
leftRightNavigationMouseModeRadioButton = new QRadioButton(tr("Use the Left/Right buttons to turn pages."));
|
||||||
|
hotAreasMouseModeRadioButton = new QRadioButton(tr("Click left or right half of the screen to turn pages."));
|
||||||
|
|
||||||
|
mouseModeLayout->addWidget(normalMouseModeRadioButton);
|
||||||
|
mouseModeLayout->addWidget(leftRightNavigationMouseModeRadioButton);
|
||||||
|
mouseModeLayout->addWidget(hotAreasMouseModeRadioButton);
|
||||||
|
|
||||||
|
mouseModeBox->setLayout(mouseModeLayout);
|
||||||
|
|
||||||
layoutGeneral->addWidget(pathBox);
|
layoutGeneral->addWidget(pathBox);
|
||||||
layoutGeneral->addWidget(slideSizeBox);
|
layoutGeneral->addWidget(slideSizeBox);
|
||||||
// layoutGeneral->addWidget(fitBox);
|
// layoutGeneral->addWidget(fitBox);
|
||||||
layoutGeneral->addWidget(colorBox);
|
layoutGeneral->addWidget(colorBox);
|
||||||
layoutGeneral->addWidget(scrollBox);
|
layoutGeneral->addWidget(scrollBox);
|
||||||
|
layoutGeneral->addWidget(mouseModeBox);
|
||||||
layoutGeneral->addWidget(shortcutsBox);
|
layoutGeneral->addWidget(shortcutsBox);
|
||||||
layoutGeneral->addStretch();
|
layoutGeneral->addStretch();
|
||||||
|
|
||||||
@ -246,6 +260,18 @@ void OptionsDialog::saveOptions()
|
|||||||
settings->setValue(USE_SINGLE_SCROLL_STEP_TO_TURN_PAGE, useSingleScrollStepToTurnPage->isChecked());
|
settings->setValue(USE_SINGLE_SCROLL_STEP_TO_TURN_PAGE, useSingleScrollStepToTurnPage->isChecked());
|
||||||
settings->setValue(DISABLE_SCROLL_ANIMATION, disableScrollAnimations->isChecked());
|
settings->setValue(DISABLE_SCROLL_ANIMATION, disableScrollAnimations->isChecked());
|
||||||
|
|
||||||
|
// get checked radio button to get the mouse mode
|
||||||
|
YACReader::MouseMode mouseMode = Normal;
|
||||||
|
if (normalMouseModeRadioButton->isChecked()) {
|
||||||
|
mouseMode = Normal;
|
||||||
|
;
|
||||||
|
} else if (leftRightNavigationMouseModeRadioButton->isChecked()) {
|
||||||
|
mouseMode = LeftRightNavigation;
|
||||||
|
} else if (hotAreasMouseModeRadioButton->isChecked()) {
|
||||||
|
mouseMode = HotAreas;
|
||||||
|
}
|
||||||
|
Configuration::getConfiguration().setMouseMode(mouseMode);
|
||||||
|
|
||||||
YACReaderOptionsDialog::saveOptions();
|
YACReaderOptionsDialog::saveOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,6 +319,20 @@ void OptionsDialog::restoreOptions(QSettings *settings)
|
|||||||
auto defaultDisableScrollAnimationsValue = false;
|
auto defaultDisableScrollAnimationsValue = false;
|
||||||
#endif
|
#endif
|
||||||
disableScrollAnimations->setChecked(settings->value(DISABLE_SCROLL_ANIMATION, defaultDisableScrollAnimationsValue).toBool());
|
disableScrollAnimations->setChecked(settings->value(DISABLE_SCROLL_ANIMATION, defaultDisableScrollAnimationsValue).toBool());
|
||||||
|
|
||||||
|
auto mouseMode = Configuration::getConfiguration().getMouseMode();
|
||||||
|
|
||||||
|
switch (mouseMode) {
|
||||||
|
case Normal:
|
||||||
|
normalMouseModeRadioButton->setChecked(true);
|
||||||
|
break;
|
||||||
|
case LeftRightNavigation:
|
||||||
|
leftRightNavigationMouseModeRadioButton->setChecked(true);
|
||||||
|
break;
|
||||||
|
case HotAreas:
|
||||||
|
hotAreasMouseModeRadioButton->setChecked(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsDialog::updateColor(const QColor &color)
|
void OptionsDialog::updateColor(const QColor &color)
|
||||||
|
@ -51,6 +51,11 @@ private:
|
|||||||
YACReaderSpinSliderWidget *gammaS;
|
YACReaderSpinSliderWidget *gammaS;
|
||||||
|
|
||||||
QColor currentColor;
|
QColor currentColor;
|
||||||
|
|
||||||
|
QRadioButton *normalMouseModeRadioButton;
|
||||||
|
QRadioButton *leftRightNavigationMouseModeRadioButton;
|
||||||
|
QRadioButton *hotAreasMouseModeRadioButton;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void saveOptions() override;
|
void saveOptions() override;
|
||||||
void restoreOptions(QSettings *settings) override;
|
void restoreOptions(QSettings *settings) override;
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#define DO_NOT_TURN_PAGE_ON_SCROLL "DO_NOT_TURN_PAGE_ON_SCROLL"
|
#define DO_NOT_TURN_PAGE_ON_SCROLL "DO_NOT_TURN_PAGE_ON_SCROLL"
|
||||||
#define USE_SINGLE_SCROLL_STEP_TO_TURN_PAGE "USE_SINGLE_SCROLL_STEP_TO_TURN_PAGE"
|
#define USE_SINGLE_SCROLL_STEP_TO_TURN_PAGE "USE_SINGLE_SCROLL_STEP_TO_TURN_PAGE"
|
||||||
#define DISABLE_SCROLL_ANIMATION "DISABLE_SCROLL_ANIMATION"
|
#define DISABLE_SCROLL_ANIMATION "DISABLE_SCROLL_ANIMATION"
|
||||||
|
#define MOUSE_MODE "MOUSE_MODE"
|
||||||
|
|
||||||
#define FLOW_TYPE_GL "FLOW_TYPE_GL"
|
#define FLOW_TYPE_GL "FLOW_TYPE_GL"
|
||||||
#define Y_POSITION "Y_POSITION"
|
#define Y_POSITION "Y_POSITION"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user