mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Add a manga reading mode which displays image in reverse order in double page mode.
The mode is triggered by selecting the "21" double page icon next to the double page icon.
This commit is contained in:
parent
09a5eed591
commit
599f7ffcf3
@ -74,6 +74,7 @@ void Configuration::load(const QString & path)
|
||||
windowSize = QSize(0,0);
|
||||
maximized = false;
|
||||
doublePage = false;
|
||||
doubleMangaPage = false;
|
||||
adjustToFullSize = false;
|
||||
backgroundColor = QColor(40,40,40);
|
||||
alwaysOnTop = false;
|
||||
@ -95,65 +96,74 @@ void Configuration::load(const QString & path)
|
||||
else
|
||||
{
|
||||
if(name==PATH)
|
||||
{
|
||||
defaultPath = line.trimmed();
|
||||
else
|
||||
if(name==MAG_GLASS_SIZE)
|
||||
{
|
||||
QStringList values = line.split(',');
|
||||
magnifyingGlassSize = QSize(values[0].toInt(),values[1].toInt());
|
||||
}
|
||||
else
|
||||
if(name==ZOOM_LEVEL)
|
||||
zoomLevel = line.toFloat();
|
||||
else
|
||||
if(name==SLIDE_SIZE)
|
||||
{
|
||||
int height = line.toInt();
|
||||
gotoSlideSize = QSize(static_cast<int>(height/SLIDE_ASPECT_RATIO),height);
|
||||
}
|
||||
else
|
||||
if(name==FIT)
|
||||
adjustToWidth = line.toInt();
|
||||
else
|
||||
if(name==FLOW_TYPE)
|
||||
flowType = (FlowType)line.toInt();
|
||||
else
|
||||
if(name==FULLSCREEN)
|
||||
fullScreen = line.toInt();
|
||||
else
|
||||
if(name==FIT_TO_WIDTH_RATIO)
|
||||
fitToWidthRatio = line.toFloat();
|
||||
else
|
||||
if(name==Y_WINDOW_POS)
|
||||
{
|
||||
QStringList l = line.split(',');
|
||||
windowPos = QPoint(l[0].toInt(),l[1].toInt());
|
||||
}
|
||||
else
|
||||
if(name==Y_WINDOW_SIZE)
|
||||
{
|
||||
QStringList l = line.split(',');
|
||||
windowSize = QSize(l[0].toInt(),l[1].toInt());
|
||||
}
|
||||
else
|
||||
if(name==MAXIMIZED)
|
||||
maximized = line.toInt();
|
||||
else
|
||||
if(name==DOUBLE_PAGE)
|
||||
doublePage = line.toInt();
|
||||
else
|
||||
if(name==ADJUST_TO_FULL_SIZE)
|
||||
adjustToFullSize = line.toInt();
|
||||
else
|
||||
if(name==BACKGROUND_COLOR)
|
||||
{
|
||||
QStringList l = line.split(',');
|
||||
backgroundColor = QColor(l[0].toInt(),l[1].toInt(),l[2].toInt());
|
||||
}
|
||||
else
|
||||
if(name==ALWAYS_ON_TOP)
|
||||
alwaysOnTop = line.toInt();
|
||||
|
||||
}
|
||||
if(name==MAG_GLASS_SIZE)
|
||||
{
|
||||
QStringList values = line.split(',');
|
||||
magnifyingGlassSize = QSize(values[0].toInt(),values[1].toInt());
|
||||
}
|
||||
if(name==ZOOM_LEVEL)
|
||||
{
|
||||
zoomLevel = line.toFloat();
|
||||
}
|
||||
if(name==SLIDE_SIZE)
|
||||
{
|
||||
int height = line.toInt();
|
||||
gotoSlideSize = QSize(static_cast<int>(height/SLIDE_ASPECT_RATIO),height);
|
||||
}
|
||||
if(name==FIT)
|
||||
{
|
||||
adjustToWidth = line.toInt();
|
||||
}
|
||||
if(name==FLOW_TYPE)
|
||||
{
|
||||
flowType = (FlowType)line.toInt();
|
||||
}
|
||||
if(name==FULLSCREEN)
|
||||
{
|
||||
fullScreen = line.toInt();
|
||||
}
|
||||
if(name==FIT_TO_WIDTH_RATIO)
|
||||
{
|
||||
fitToWidthRatio = line.toFloat();
|
||||
}
|
||||
if(name==Y_WINDOW_POS)
|
||||
{
|
||||
QStringList l = line.split(',');
|
||||
windowPos = QPoint(l[0].toInt(),l[1].toInt());
|
||||
}
|
||||
if(name==Y_WINDOW_SIZE)
|
||||
{
|
||||
QStringList l = line.split(',');
|
||||
windowSize = QSize(l[0].toInt(),l[1].toInt());
|
||||
}
|
||||
if(name==MAXIMIZED)
|
||||
{
|
||||
maximized = line.toInt();
|
||||
}
|
||||
if(name==DOUBLE_PAGE)
|
||||
{
|
||||
doublePage = line.toInt();
|
||||
}
|
||||
if(name==DOUBLE_MANGA_PAGE)
|
||||
{
|
||||
doubleMangaPage = line.toInt();
|
||||
}
|
||||
if(name==ADJUST_TO_FULL_SIZE)
|
||||
{
|
||||
adjustToFullSize = line.toInt();
|
||||
}
|
||||
if(name==BACKGROUND_COLOR)
|
||||
{
|
||||
QStringList l = line.split(',');
|
||||
backgroundColor = QColor(l[0].toInt(),l[1].toInt(),l[2].toInt());
|
||||
}
|
||||
if(name==ALWAYS_ON_TOP)
|
||||
{
|
||||
alwaysOnTop = line.toInt();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ using namespace YACReader;
|
||||
QSize windowSize;
|
||||
bool maximized;
|
||||
bool doublePage;
|
||||
bool doubleMangaPage;
|
||||
bool alwaysOnTop;
|
||||
bool adjustToFullSize;
|
||||
QColor backgroundColor;
|
||||
@ -75,6 +76,8 @@ using namespace YACReader;
|
||||
void setMaximized(bool b){settings->setValue(MAXIMIZED,b);}
|
||||
bool getDoublePage(){return settings->value(DOUBLE_PAGE).toBool();}
|
||||
void setDoublePage(bool b){settings->setValue(DOUBLE_PAGE,b);}
|
||||
bool getDoubleMangaPage(){return settings->value(DOUBLE_MANGA_PAGE).toBool();}
|
||||
void setDoubleMangaPage(bool b){settings->setValue(DOUBLE_MANGA_PAGE,b);}
|
||||
bool getAdjustToFullSize(){return settings->value(ADJUST_TO_FULL_SIZE).toBool();}
|
||||
void setAdjustToFullSize(bool b){settings->setValue(ADJUST_TO_FULL_SIZE,b);}
|
||||
QColor getBackgroundColor(){return settings->value(BACKGROUND_COLOR).value<QColor>();}
|
||||
|
@ -92,6 +92,7 @@ MainWindowViewer::~MainWindowViewer()
|
||||
delete leftRotationAction;
|
||||
delete rightRotationAction;
|
||||
delete doublePageAction;
|
||||
delete doubleMangaPageAction;
|
||||
delete goToPage;
|
||||
delete optionsAction;
|
||||
delete helpAboutAction;
|
||||
@ -326,7 +327,20 @@ void MainWindowViewer::createActions()
|
||||
doublePageAction->setCheckable(true);
|
||||
doublePageAction->setChecked(Configuration::getConfiguration().getDoublePage());
|
||||
connect(doublePageAction, SIGNAL(triggered()),viewer,SLOT(doublePageSwitch()));
|
||||
|
||||
|
||||
//tests for inversed mode!
|
||||
doubleMangaPageAction = new QAction(tr("Double page manga mode"),this);
|
||||
doubleMangaPageAction->setToolTip(tr("Reverse reading order in double page mode"));
|
||||
//TODO: Find a good shortcut for this
|
||||
//doubleMangaPageAction->setShortcut(tr("M"));
|
||||
doubleMangaPageAction->setIcon(QIcon(":/images/viewer_toolbar/doubleMangaPage.png"));
|
||||
doubleMangaPageAction->setDisabled(true);
|
||||
doubleMangaPageAction->setCheckable(true);
|
||||
//TODO: Configuration?
|
||||
doubleMangaPageAction->setChecked(Configuration::getConfiguration().getDoubleMangaPage());
|
||||
connect(doubleMangaPageAction, SIGNAL(triggered()),viewer,SLOT(doubleMangaPageSwitch()));
|
||||
//
|
||||
|
||||
goToPage = new QAction(tr("Go To"),this);
|
||||
goToPage->setShortcut(tr("G"));
|
||||
goToPage->setIcon(QIcon(":/images/viewer_toolbar/goto.png"));
|
||||
@ -502,6 +516,7 @@ void MainWindowViewer::createToolBars()
|
||||
comicToolBar->addAction(leftRotationAction);
|
||||
comicToolBar->addAction(rightRotationAction);
|
||||
comicToolBar->addAction(doublePageAction);
|
||||
comicToolBar->addAction(doubleMangaPageAction);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
comicToolBar->addWidget(new MacToolBarSeparator);
|
||||
@ -748,6 +763,7 @@ void MainWindowViewer::enableActions()
|
||||
rightRotationAction->setDisabled(false);
|
||||
showMagnifyingGlass->setDisabled(false);
|
||||
doublePageAction->setDisabled(false);
|
||||
doubleMangaPageAction->setDisabled(false);
|
||||
adjustToFullSizeAction->setDisabled(false);
|
||||
//setBookmark->setDisabled(false);
|
||||
showBookmarks->setDisabled(false);
|
||||
@ -768,6 +784,7 @@ void MainWindowViewer::disableActions()
|
||||
rightRotationAction->setDisabled(true);
|
||||
showMagnifyingGlass->setDisabled(true);
|
||||
doublePageAction->setDisabled(true);
|
||||
doubleMangaPageAction->setDisabled(false);
|
||||
adjustToFullSizeAction->setDisabled(true);
|
||||
setBookmark->setDisabled(true);
|
||||
showBookmarks->setDisabled(true);
|
||||
|
@ -96,6 +96,7 @@ class YACReaderSliderAction;
|
||||
QAction *showInfo;
|
||||
QAction *closeAction;
|
||||
QAction *doublePageAction;
|
||||
QAction *doubleMangaPageAction;
|
||||
QAction *showShorcutsAction;
|
||||
QAction *showDictionaryAction;
|
||||
QAction *alwaysOnTopAction;
|
||||
|
@ -453,11 +453,20 @@ void DoublePageRender::run()
|
||||
|
||||
QImage auxImg(totalWidth,totalHeight,QImage::Format_RGB32);
|
||||
QPainter painter(&auxImg);
|
||||
painter.drawImage(QRect(0,0,width1,totalHeight),img);
|
||||
if(!img2.isNull())
|
||||
painter.drawImage(QRect(width1,0,width2,totalHeight),img2);
|
||||
painter.end();
|
||||
|
||||
if (render->doubleMangaPage) {
|
||||
qDebug() << "we are in the double Manga Page tree" << render->doubleMangaPage;
|
||||
painter.drawImage(QRect(width2,0,width1,totalHeight),img);
|
||||
if(!img2.isNull())
|
||||
painter.drawImage(QRect(0,0,width2,totalHeight),img2);
|
||||
painter.end();
|
||||
}
|
||||
else {
|
||||
qDebug() << "no double Manga Page" << render->doubleMangaPage;
|
||||
painter.drawImage(QRect(0,0,width1,totalHeight),img);
|
||||
if(!img2.isNull())
|
||||
painter.drawImage(QRect(width1,0,width2,totalHeight),img2);
|
||||
painter.end();
|
||||
}
|
||||
if(degrees > 0)
|
||||
{
|
||||
QMatrix m;
|
||||
@ -479,7 +488,7 @@ void DoublePageRender::run()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Render::Render()
|
||||
:currentIndex(0),doublePage(false),comic(0),loadedComic(false),imageRotation(0),numLeftPages(2),numRightPages(2)
|
||||
:currentIndex(0),doublePage(false),doubleMangaPage(false),comic(0),loadedComic(false),imageRotation(0),numLeftPages(2),numRightPages(2)
|
||||
{
|
||||
int size = numLeftPages+numRightPages+1;
|
||||
currentPageBufferedIndex = numLeftPages;
|
||||
@ -1030,6 +1039,16 @@ void Render::doublePageSwitch()
|
||||
}
|
||||
}
|
||||
|
||||
void Render::doubleMangaPageSwitch()
|
||||
{
|
||||
doubleMangaPage = !doubleMangaPage;
|
||||
if(comic&&doublePage)
|
||||
{
|
||||
invalidate();
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
QString Render::getCurrentPagesInformation()
|
||||
{
|
||||
QString s = QString::number(currentIndex+1);
|
||||
|
@ -126,6 +126,7 @@ public slots:
|
||||
QPixmap * getCurrentPage();
|
||||
void goTo(int index);
|
||||
void doublePageSwitch();
|
||||
void doubleMangaPageSwitch();
|
||||
void setRotation(int degrees);
|
||||
void setComic(Comic * c);
|
||||
void prepareAvailablePage(int page);
|
||||
@ -182,6 +183,7 @@ signals:
|
||||
private:
|
||||
Comic * comic;
|
||||
bool doublePage;
|
||||
bool doubleMangaPage;
|
||||
int previousIndex;
|
||||
int currentIndex;
|
||||
//QPixmap * currentPage;
|
||||
|
@ -23,6 +23,7 @@ fullscreen(false),
|
||||
information(false),
|
||||
adjustToWidthRatio(1),
|
||||
doublePage(false),
|
||||
doubleMangaPage(false),
|
||||
wheelStop(false),
|
||||
direction(1),
|
||||
restoreMagnifyingGlass(false),
|
||||
@ -688,6 +689,13 @@ void Viewer::doublePageSwitch()
|
||||
Configuration::getConfiguration().setDoublePage(doublePage);
|
||||
}
|
||||
|
||||
void Viewer::doubleMangaPageSwitch()
|
||||
{
|
||||
doubleMangaPage = !doubleMangaPage;
|
||||
render->doubleMangaPageSwitch();
|
||||
Configuration::getConfiguration().setDoubleMangaPage(doubleMangaPage);
|
||||
}
|
||||
|
||||
void Viewer::resetContent()
|
||||
{
|
||||
configureContent(tr("Press 'O' to open comic."));
|
||||
|
@ -64,6 +64,7 @@ class NotificationsLabelWidget;
|
||||
void setBookmark(bool);
|
||||
void save();
|
||||
void doublePageSwitch();
|
||||
void doubleMangaPageSwitch();
|
||||
void resetContent();
|
||||
void setLoadingMessage();
|
||||
void setPageUnavailableMessage();
|
||||
@ -93,6 +94,7 @@ virtual void mouseReleaseEvent ( QMouseEvent * event );
|
||||
private:
|
||||
bool information;
|
||||
bool doublePage;
|
||||
bool doubleMangaPage;
|
||||
PageLabelWidget * informationLabel;
|
||||
//QTimer * scroller;
|
||||
QPropertyAnimation * verticalScroller;
|
||||
|
@ -3,6 +3,7 @@
|
||||
<file>../images/viewer_toolbar/bookmark.png</file>
|
||||
<file>../images/viewer_toolbar/close.png</file>
|
||||
<file>../images/viewer_toolbar/doublePage.png</file>
|
||||
<file>../images/viewer_toolbar/doubleMangaPage.png</file>
|
||||
<file>../images/viewer_toolbar/flow.png</file>
|
||||
<file>../images/viewer_toolbar/full.png</file>
|
||||
<file>../images/viewer_toolbar/goto.png</file>
|
||||
|
@ -25,6 +25,7 @@
|
||||
#define Y_WINDOW_SIZE "SIZE"
|
||||
#define MAXIMIZED "MAXIMIZED"
|
||||
#define DOUBLE_PAGE "DOUBLE_PAGE"
|
||||
#define DOUBLE_MANGA_PAGE "DOUBLE_MANGA_PAGE"
|
||||
#define ADJUST_TO_FULL_SIZE "ADJUST_TO_FULL_SIZE"
|
||||
#define BACKGROUND_COLOR "BACKGROUND_COLOR"
|
||||
#define ALWAYS_ON_TOP "ALWAYS_ON_TOP"
|
||||
|
BIN
images/viewer_toolbar/doubleMangaPage.png
Normal file
BIN
images/viewer_toolbar/doubleMangaPage.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 514 B |
Loading…
x
Reference in New Issue
Block a user