mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
recycled the old fit to witdh slider into a zoom slider
This commit is contained in:
parent
b11a50cf44
commit
bbc2861ee5
@ -114,7 +114,7 @@ HEADERS += ../common/comic.h \
|
|||||||
page_label_widget.h \
|
page_label_widget.h \
|
||||||
goto_flow_toolbar.h \
|
goto_flow_toolbar.h \
|
||||||
goto_flow_decorationbar.h \
|
goto_flow_decorationbar.h \
|
||||||
#width_slider.h \
|
width_slider.h \
|
||||||
notifications_label_widget.h \
|
notifications_label_widget.h \
|
||||||
../common/pictureflow.h \
|
../common/pictureflow.h \
|
||||||
../common/custom_widgets.h \
|
../common/custom_widgets.h \
|
||||||
@ -158,7 +158,7 @@ SOURCES += ../common/comic.cpp \
|
|||||||
page_label_widget.cpp \
|
page_label_widget.cpp \
|
||||||
goto_flow_toolbar.cpp \
|
goto_flow_toolbar.cpp \
|
||||||
goto_flow_decorationbar.cpp \
|
goto_flow_decorationbar.cpp \
|
||||||
#width_slider.cpp \
|
width_slider.cpp \
|
||||||
notifications_label_widget.cpp \
|
notifications_label_widget.cpp \
|
||||||
../common/pictureflow.cpp \
|
../common/pictureflow.cpp \
|
||||||
../common/custom_widgets.cpp \
|
../common/custom_widgets.cpp \
|
||||||
|
@ -418,6 +418,10 @@ void MainWindowViewer::createActions()
|
|||||||
fitToPageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(FIT_TO_PAGE_ACTION_Y));
|
fitToPageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(FIT_TO_PAGE_ACTION_Y));
|
||||||
connect(fitToPageAction,SIGNAL(triggered()),this,SLOT(fitToPageSwitch()));
|
connect(fitToPageAction,SIGNAL(triggered()),this,SLOT(fitToPageSwitch()));
|
||||||
|
|
||||||
|
showZoomSliderlAction = new QAction(tr("Show zoom slider"), this);
|
||||||
|
showZoomSliderlAction->setIcon(QIcon(":/images/viewer_toolbar/zoom.png"));
|
||||||
|
showZoomSliderlAction->setDisabled(true);
|
||||||
|
|
||||||
increasePageZoomAction = new QAction(tr("Zoom+"),this);
|
increasePageZoomAction = new QAction(tr("Zoom+"),this);
|
||||||
increasePageZoomAction->setDisabled(true);
|
increasePageZoomAction->setDisabled(true);
|
||||||
increasePageZoomAction->setData(ZOOM_PLUS_ACTION_Y);
|
increasePageZoomAction->setData(ZOOM_PLUS_ACTION_Y);
|
||||||
@ -509,43 +513,34 @@ void MainWindowViewer::createToolBars()
|
|||||||
|
|
||||||
//comicToolBar->addAction(adjustWidth);
|
//comicToolBar->addAction(adjustWidth);
|
||||||
|
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
|
|
||||||
//sliderAction = new YACReaderSlider(this);
|
|
||||||
//sliderAction->hide();
|
|
||||||
|
|
||||||
comicToolBar->addAction(adjustWidthAction);
|
|
||||||
|
|
||||||
//QAction * action = comicToolBar->addFitToWidthSlider(adjustWidthAction);
|
|
||||||
|
|
||||||
//connect(action,SIGNAL(triggered()),this,SLOT(toggleFitToWidthSlider()));
|
|
||||||
|
|
||||||
#else
|
|
||||||
//QMenu * menu = new QMenu();
|
|
||||||
|
|
||||||
//sliderAction = new YACReaderSliderAction(this);
|
|
||||||
|
|
||||||
//menu->setAutoFillBackground(false);
|
|
||||||
//menu->setStyleSheet(" QMenu {background:transparent; border: 0px;padding: 0px; }"
|
|
||||||
// );
|
|
||||||
//menu->addAction(sliderAction);
|
|
||||||
//QToolButton * tb2 = new QToolButton();
|
|
||||||
//tb2->addAction(adjustWidthAction);
|
|
||||||
//tb2->setMenu(menu);
|
|
||||||
|
|
||||||
//tb2->addAction();
|
|
||||||
//tb2->setPopupMode(QToolButton::MenuButtonPopup);
|
|
||||||
//tb2->setDefaultAction(adjustWidthAction);
|
|
||||||
//comicToolBar->addWidget(tb2);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//connect(sliderAction,SIGNAL(fitToWidthRatioChanged(float)),viewer,SLOT(updateFitToWidthRatio(float)));
|
|
||||||
//connect(optionsDialog,SIGNAL(fitToWidthRatioChanged(float)),sliderAction,SLOT(updateFitToWidthRatio(float)));
|
|
||||||
comicToolBar->addAction(adjustWidthAction);
|
comicToolBar->addAction(adjustWidthAction);
|
||||||
comicToolBar->addAction(adjustHeightAction);
|
comicToolBar->addAction(adjustHeightAction);
|
||||||
comicToolBar->addAction(adjustToFullSizeAction);
|
comicToolBar->addAction(adjustToFullSizeAction);
|
||||||
comicToolBar->addAction(fitToPageAction);
|
comicToolBar->addAction(fitToPageAction);
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
|
||||||
|
zoomSliderAction = new YACReaderSlider(this);
|
||||||
|
zoomSliderAction->hide();
|
||||||
|
|
||||||
|
comicToolBar->addAction(showZoomSliderlAction);
|
||||||
|
|
||||||
|
QAction * action = comicToolBar->addFitToWidthSlider(showZoomSliderlAction);
|
||||||
|
|
||||||
|
connect(action,SIGNAL(triggered()),this,SLOT(toggleFitToWidthSlider()));
|
||||||
|
|
||||||
|
#else
|
||||||
|
zoomSliderAction = new YACReaderSlider(this);
|
||||||
|
zoomSliderAction->hide();
|
||||||
|
|
||||||
|
comicToolBar->addAction(showZoomSliderlAction);
|
||||||
|
|
||||||
|
//QAction * action = comicToolBar->addFitToWidthSlider(showZoomSliderlAction);
|
||||||
|
|
||||||
|
connect(showZoomSliderlAction,SIGNAL(triggered()),this,SLOT(toggleFitToWidthSlider()));
|
||||||
|
connect(zoomSliderAction, SIGNAL(zoomRatioChanged(float)),viewer,SLOT(updateZoomRatio(float)));
|
||||||
|
#endif
|
||||||
|
|
||||||
comicToolBar->addAction(leftRotationAction);
|
comicToolBar->addAction(leftRotationAction);
|
||||||
comicToolBar->addAction(rightRotationAction);
|
comicToolBar->addAction(rightRotationAction);
|
||||||
comicToolBar->addAction(doublePageAction);
|
comicToolBar->addAction(doublePageAction);
|
||||||
@ -555,7 +550,6 @@ void MainWindowViewer::createToolBars()
|
|||||||
|
|
||||||
comicToolBar->addAction(showMagnifyingGlassAction);
|
comicToolBar->addAction(showMagnifyingGlassAction);
|
||||||
|
|
||||||
|
|
||||||
comicToolBar->addSeparator();
|
comicToolBar->addSeparator();
|
||||||
|
|
||||||
comicToolBar->addAction(setBookmarkAction);
|
comicToolBar->addAction(setBookmarkAction);
|
||||||
@ -850,6 +844,7 @@ void MainWindowViewer::enableActions()
|
|||||||
adjustToFullSizeAction->setDisabled(false);
|
adjustToFullSizeAction->setDisabled(false);
|
||||||
adjustToFullSizeAction->setDisabled(false);
|
adjustToFullSizeAction->setDisabled(false);
|
||||||
fitToPageAction->setDisabled(false);
|
fitToPageAction->setDisabled(false);
|
||||||
|
showZoomSliderlAction->setDisabled(false);
|
||||||
increasePageZoomAction->setDisabled(false);
|
increasePageZoomAction->setDisabled(false);
|
||||||
decreasePageZoomAction->setDisabled(false);
|
decreasePageZoomAction->setDisabled(false);
|
||||||
//setBookmark->setDisabled(false);
|
//setBookmark->setDisabled(false);
|
||||||
@ -873,6 +868,8 @@ void MainWindowViewer::disableActions()
|
|||||||
doublePageAction->setDisabled(true);
|
doublePageAction->setDisabled(true);
|
||||||
doubleMangaPageAction->setDisabled(true);
|
doubleMangaPageAction->setDisabled(true);
|
||||||
adjustToFullSizeAction->setDisabled(true);
|
adjustToFullSizeAction->setDisabled(true);
|
||||||
|
fitToPageAction->setDisabled(true);
|
||||||
|
showZoomSliderlAction->setDisabled(true);
|
||||||
setBookmarkAction->setDisabled(true);
|
setBookmarkAction->setDisabled(true);
|
||||||
showBookmarksAction->setDisabled(true);
|
showBookmarksAction->setDisabled(true);
|
||||||
showInfoAction->setDisabled(true); //TODO enable goTo and showInfo (or update) when numPages emited
|
showInfoAction->setDisabled(true); //TODO enable goTo and showInfo (or update) when numPages emited
|
||||||
@ -1175,21 +1172,26 @@ void MainWindowViewer::setUpShortcutsManagement()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
/*
|
|
||||||
void MainWindowViewer::toggleFitToWidthSlider()
|
void MainWindowViewer::toggleFitToWidthSlider()
|
||||||
{
|
{
|
||||||
if(sliderAction->isVisible())
|
int y;
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
y = 0;
|
||||||
|
#else
|
||||||
|
y = this->comicToolBar->frameSize().height();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(zoomSliderAction->isVisible())
|
||||||
{
|
{
|
||||||
sliderAction->hide();
|
zoomSliderAction->hide();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sliderAction->move(250,0);
|
zoomSliderAction->move(250, y);
|
||||||
sliderAction->show();
|
zoomSliderAction->show();
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void MainWindowViewer::newVersion()
|
void MainWindowViewer::newVersion()
|
||||||
{
|
{
|
||||||
|
@ -64,9 +64,8 @@ class EditShortcutsDialog;
|
|||||||
void processReset();
|
void processReset();
|
||||||
void setUpShortcutsManagement();
|
void setUpShortcutsManagement();
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
void toggleFitToWidthSlider();
|
void toggleFitToWidthSlider();
|
||||||
#endif
|
|
||||||
/*void viewComic();
|
/*void viewComic();
|
||||||
void prev();
|
void prev();
|
||||||
void next();
|
void next();
|
||||||
@ -128,16 +127,14 @@ class EditShortcutsDialog;
|
|||||||
QAction *alwaysOnTopAction;
|
QAction *alwaysOnTopAction;
|
||||||
QAction *adjustToFullSizeAction;
|
QAction *adjustToFullSizeAction;
|
||||||
QAction *fitToPageAction;
|
QAction *fitToPageAction;
|
||||||
|
QAction *showZoomSliderlAction;
|
||||||
QAction *increasePageZoomAction;
|
QAction *increasePageZoomAction;
|
||||||
QAction *decreasePageZoomAction;
|
QAction *decreasePageZoomAction;
|
||||||
QAction *showFlowAction;
|
QAction *showFlowAction;
|
||||||
|
|
||||||
QAction *showEditShortcutsAction;
|
QAction *showEditShortcutsAction;
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
YACReaderSlider * sliderAction;
|
YACReaderSlider * zoomSliderAction;
|
||||||
#else
|
|
||||||
YACReaderSliderAction * sliderAction;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
HttpVersionChecker * versionChecker;
|
HttpVersionChecker * versionChecker;
|
||||||
QString previousComicPath;
|
QString previousComicPath;
|
||||||
|
@ -386,8 +386,8 @@ void Viewer::increaseZoomFactor()
|
|||||||
void Viewer::decreaseZoomFactor()
|
void Viewer::decreaseZoomFactor()
|
||||||
{
|
{
|
||||||
zoom -= 0.1;
|
zoom -= 0.1;
|
||||||
if (zoom < 0.1)
|
if (zoom < 0.3)
|
||||||
zoom = 0.1;
|
zoom = 0.3;
|
||||||
updateContentSize();
|
updateContentSize();
|
||||||
notificationsLabel->setText(QString::number(getZoomFactor()*100)+"%");
|
notificationsLabel->setText(QString::number(getZoomFactor()*100)+"%");
|
||||||
notificationsLabel->flash();
|
notificationsLabel->flash();
|
||||||
@ -930,6 +930,12 @@ void Viewer::mouseReleaseEvent ( QMouseEvent * event )
|
|||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Viewer::updateZoomRatio(float ratio)
|
||||||
|
{
|
||||||
|
zoom = ratio;
|
||||||
|
updateContentSize();
|
||||||
|
}
|
||||||
|
|
||||||
void Viewer::updateConfig(QSettings * settings)
|
void Viewer::updateConfig(QSettings * settings)
|
||||||
{
|
{
|
||||||
goToFlow->updateConfig(settings);
|
goToFlow->updateConfig(settings);
|
||||||
|
@ -96,6 +96,7 @@ virtual void mouseReleaseEvent ( QMouseEvent * event );
|
|||||||
void showIsCoverMessage();
|
void showIsCoverMessage();
|
||||||
void showIsLastMessage();
|
void showIsLastMessage();
|
||||||
int getCurrentPageNumber();
|
int getCurrentPageNumber();
|
||||||
|
void updateZoomRatio(float ratio);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool information;
|
bool information;
|
||||||
|
@ -12,9 +12,7 @@ YACReaderSliderAction::YACReaderSliderAction (QWidget * parent)
|
|||||||
widget = new YACReaderSlider();
|
widget = new YACReaderSlider();
|
||||||
setDefaultWidget(widget);
|
setDefaultWidget(widget);
|
||||||
|
|
||||||
connect(widget,SIGNAL(fitToWidthRatioChanged(float)),this,SIGNAL(fitToWidthRatioChanged(float)));
|
connect(widget,SIGNAL(zoomRatioChanged(float)),this,SIGNAL(zoomRatioChanged(float)));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void YACReaderSliderAction::updateText(int value)
|
void YACReaderSliderAction::updateText(int value)
|
||||||
@ -22,9 +20,9 @@ void YACReaderSliderAction::updateText(int value)
|
|||||||
widget->updateText(value);
|
widget->updateText(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void YACReaderSliderAction::updateFitToWidthRatio(float v)
|
void YACReaderSliderAction::updateZoomRatio(float v)
|
||||||
{
|
{
|
||||||
widget->updateFitToWidthRatio(v);
|
widget->updateZoomRatio(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
YACReaderSlider::YACReaderSlider(QWidget *parent)
|
YACReaderSlider::YACReaderSlider(QWidget *parent)
|
||||||
@ -69,11 +67,11 @@ YACReaderSlider::YACReaderSlider(QWidget *parent)
|
|||||||
|
|
||||||
setMinimumSize(276,45);
|
setMinimumSize(276,45);
|
||||||
|
|
||||||
slider->setMinimum(50);
|
slider->setMinimum(30);
|
||||||
slider->setMaximum(100);
|
slider->setMaximum(500);
|
||||||
slider->setPageStep(5);
|
slider->setPageStep(5);
|
||||||
|
|
||||||
int value = Configuration::getConfiguration().getFitToWidthRatio()*100;
|
int value = Configuration::getConfiguration().getZoomLevel()*100;
|
||||||
slider->setValue(value);
|
slider->setValue(value);
|
||||||
percentageLabel->setText(QString("%1 %").arg(value));
|
percentageLabel->setText(QString("%1 %").arg(value));
|
||||||
connect(slider,SIGNAL(valueChanged(int)),this,SLOT(updateText(int)));
|
connect(slider,SIGNAL(valueChanged(int)),this,SLOT(updateText(int)));
|
||||||
@ -82,11 +80,11 @@ YACReaderSlider::YACReaderSlider(QWidget *parent)
|
|||||||
void YACReaderSlider::updateText(int value)
|
void YACReaderSlider::updateText(int value)
|
||||||
{
|
{
|
||||||
percentageLabel->setText(QString("%1 %").arg(value));
|
percentageLabel->setText(QString("%1 %").arg(value));
|
||||||
Configuration::getConfiguration().setFitToWidthRatio(value/100.0);
|
Configuration::getConfiguration().setZoomLevel(value/100.0);
|
||||||
emit(fitToWidthRatioChanged(value / 100.0f));
|
emit(zoomRatioChanged(value / 100.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void YACReaderSlider::updateFitToWidthRatio(float v)
|
void YACReaderSlider::updateZoomRatio(float v)
|
||||||
{
|
{
|
||||||
int value = v*100;
|
int value = v*100;
|
||||||
slider->setValue(value);
|
slider->setValue(value);
|
||||||
|
@ -19,11 +19,11 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateText(int value);
|
void updateText(int value);
|
||||||
void updateFitToWidthRatio(float v);
|
void updateZoomRatio(float v);
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void fitToWidthRatioChanged(float value);
|
void zoomRatioChanged(float value);
|
||||||
};
|
};
|
||||||
|
|
||||||
class YACReaderSliderAction : public QWidgetAction
|
class YACReaderSliderAction : public QWidgetAction
|
||||||
@ -38,11 +38,11 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateText(int value);
|
void updateText(int value);
|
||||||
void updateFitToWidthRatio(float v);
|
void updateZoomRatio(float v);
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void fitToWidthRatioChanged(float value);
|
void zoomRatioChanged(float value);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user