diff --git a/YACReader/configuration.cpp b/YACReader/configuration.cpp index a89aab3d..69b3ffe6 100644 --- a/YACReader/configuration.cpp +++ b/YACReader/configuration.cpp @@ -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(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(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(); + } } diff --git a/YACReader/configuration.h b/YACReader/configuration.h index 7ef6b7ff..ba9e1531 100644 --- a/YACReader/configuration.h +++ b/YACReader/configuration.h @@ -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();} diff --git a/YACReader/main_window_viewer.cpp b/YACReader/main_window_viewer.cpp index 67928f87..91c064a0 100644 --- a/YACReader/main_window_viewer.cpp +++ b/YACReader/main_window_viewer.cpp @@ -94,6 +94,7 @@ MainWindowViewer::~MainWindowViewer() delete leftRotationAction; delete rightRotationAction; delete doublePageAction; + delete doubleMangaPageAction; delete goToPageAction; delete optionsAction; delete helpAboutAction; @@ -301,7 +302,18 @@ void MainWindowViewer::createActions() doublePageAction->setData(DOUBLE_PAGE_ACTION_Y); doublePageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(DOUBLE_PAGE_ACTION_Y)); connect(doublePageAction, SIGNAL(triggered()),viewer,SLOT(doublePageSwitch())); - + + //inversed pictures mode + doubleMangaPageAction = new QAction(tr("Double page manga mode"),this); + doubleMangaPageAction->setToolTip(tr("Reverse reading order in double page mode")); + doubleMangaPageAction->setIcon(QIcon(":/images/viewer_toolbar/doubleMangaPage.png")); + doubleMangaPageAction->setDisabled(true); + doubleMangaPageAction->setCheckable(true); + doubleMangaPageAction->setChecked(Configuration::getConfiguration().getDoubleMangaPage()); + doubleMangaPageAction->setData(DOUBLE_MANGA_PAGE_ACTION_Y); + doubleMangaPageAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(DOUBLE_MANGA_PAGE_ACTION_Y)); + connect(doubleMangaPageAction, SIGNAL(triggered()),viewer,SLOT(doubleMangaPageSwitch())); + goToPageAction = new QAction(tr("Go To"),this); goToPageAction->setIcon(QIcon(":/images/viewer_toolbar/goto.png")); goToPageAction->setDisabled(true); @@ -497,6 +509,7 @@ void MainWindowViewer::createToolBars() comicToolBar->addAction(leftRotationAction); comicToolBar->addAction(rightRotationAction); comicToolBar->addAction(doublePageAction); + comicToolBar->addAction(doubleMangaPageAction); #ifdef Q_OS_MAC comicToolBar->addWidget(new MacToolBarSeparator); @@ -777,6 +790,7 @@ void MainWindowViewer::enableActions() rightRotationAction->setDisabled(false); showMagnifyingGlassAction->setDisabled(false); doublePageAction->setDisabled(false); + doubleMangaPageAction->setDisabled(false); adjustToFullSizeAction->setDisabled(false); //setBookmark->setDisabled(false); showBookmarksAction->setDisabled(false); @@ -797,6 +811,7 @@ void MainWindowViewer::disableActions() rightRotationAction->setDisabled(true); showMagnifyingGlassAction->setDisabled(true); doublePageAction->setDisabled(true); + doubleMangaPageAction->setDisabled(true); adjustToFullSizeAction->setDisabled(true); setBookmarkAction->setDisabled(true); showBookmarksAction->setDisabled(true); @@ -1048,6 +1063,7 @@ void MainWindowViewer::setUpShortcutsManagement() << leftRotationAction << rightRotationAction << doublePageAction + << doubleMangaPageAction << adjustToFullSizeAction); allActions << tmpList; diff --git a/YACReader/main_window_viewer.h b/YACReader/main_window_viewer.h index 10ab75ff..26cd4db6 100644 --- a/YACReader/main_window_viewer.h +++ b/YACReader/main_window_viewer.h @@ -100,6 +100,7 @@ class EditShortcutsDialog; QAction *showInfoAction; QAction *closeAction; QAction *doublePageAction; + QAction *doubleMangaPageAction; QAction *showShorcutsAction; QAction *showDictionaryAction; QAction *alwaysOnTopAction; diff --git a/YACReader/render.cpp b/YACReader/render.cpp index ccfebcb7..eaf33bb6 100644 --- a/YACReader/render.cpp +++ b/YACReader/render.cpp @@ -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; @@ -1036,11 +1045,26 @@ void Render::doublePageSwitch() } } +void Render::doubleMangaPageSwitch() +{ + doubleMangaPage = !doubleMangaPage; + if(comic&&doublePage) + { + invalidate(); + update(); + } +} + QString Render::getCurrentPagesInformation() { QString s = QString::number(currentIndex+1); if (doublePage && (currentIndex+1 < (int)comic->numPages())) - s += "-"+QString::number(currentIndex+2); + { + if (doubleMangaPage) + s = QString::number(currentIndex+2) + "-" + s; + else + s += "-"+QString::number(currentIndex+2); + } s += "/"+QString::number(comic->numPages()); return s; } diff --git a/YACReader/render.h b/YACReader/render.h index 423d7955..bb466762 100644 --- a/YACReader/render.h +++ b/YACReader/render.h @@ -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; diff --git a/YACReader/viewer.cpp b/YACReader/viewer.cpp index 10812be8..c69cca49 100644 --- a/YACReader/viewer.cpp +++ b/YACReader/viewer.cpp @@ -25,6 +25,7 @@ fullscreen(false), information(false), adjustToWidthRatio(1), doublePage(false), +doubleMangaPage(false), wheelStop(false), direction(1), restoreMagnifyingGlass(false), @@ -98,6 +99,9 @@ shouldOpenPrevious(false) if(Configuration::getConfiguration().getDoublePage()) doublePageSwitch(); + + if(Configuration::getConfiguration().getDoubleMangaPage()) + doubleMangaPageSwitch(); createConnections(); @@ -700,6 +704,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.")); diff --git a/YACReader/viewer.h b/YACReader/viewer.h index 4abd7ec7..e2ff3291 100644 --- a/YACReader/viewer.h +++ b/YACReader/viewer.h @@ -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; diff --git a/YACReader/yacreader_images_win.qrc b/YACReader/yacreader_images_win.qrc index 3476e623..e7251da4 100644 --- a/YACReader/yacreader_images_win.qrc +++ b/YACReader/yacreader_images_win.qrc @@ -3,6 +3,7 @@ ../images/viewer_toolbar/bookmark.png ../images/viewer_toolbar/close.png ../images/viewer_toolbar/doublePage.png + ../images/viewer_toolbar/doubleMangaPage.png ../images/viewer_toolbar/flow.png ../images/viewer_toolbar/full.png ../images/viewer_toolbar/goto.png diff --git a/common/yacreader_global.h b/common/yacreader_global.h index 09e9d95f..70b5c2ec 100644 --- a/common/yacreader_global.h +++ b/common/yacreader_global.h @@ -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" diff --git a/images/viewer_toolbar/doubleMangaPage.png b/images/viewer_toolbar/doubleMangaPage.png new file mode 100644 index 00000000..99ee1720 Binary files /dev/null and b/images/viewer_toolbar/doubleMangaPage.png differ diff --git a/shortcuts_management/shortcuts_manager.cpp b/shortcuts_management/shortcuts_manager.cpp index df8d253d..50001a62 100644 --- a/shortcuts_management/shortcuts_manager.cpp +++ b/shortcuts_management/shortcuts_manager.cpp @@ -39,6 +39,7 @@ void ShortcutsManager::initDefaultShorcuts() defaultShorcuts.insert(LEFT_ROTATION_ACTION_Y, Qt::Key_L); defaultShorcuts.insert(RIGHT_ROTATION_ACTION_Y, Qt::Key_R); defaultShorcuts.insert(DOUBLE_PAGE_ACTION_Y, Qt::Key_D); + defaultShorcuts.insert(DOUBLE_MANGA_PAGE_ACTION_Y, Qt::Key_J); defaultShorcuts.insert(GO_TO_PAGE_ACTION_Y, Qt::Key_G); defaultShorcuts.insert(OPTIONS_ACTION_Y, Qt::Key_C); defaultShorcuts.insert(HELP_ABOUT_ACTION_Y, Qt::Key_F1); diff --git a/shortcuts_management/shortcuts_manager.h b/shortcuts_management/shortcuts_manager.h index c6e3eae5..701eabb9 100644 --- a/shortcuts_management/shortcuts_manager.h +++ b/shortcuts_management/shortcuts_manager.h @@ -89,6 +89,7 @@ public: #define LEFT_ROTATION_ACTION_Y "LEFT_ROTATION_ACTION_Y" #define RIGHT_ROTATION_ACTION_Y "RIGHT_ROTATION_ACTION_Y" #define DOUBLE_PAGE_ACTION_Y "DOUBLE_PAGE_ACTION_Y" +#define DOUBLE_MANGA_PAGE_ACTION_Y "DOUBLE_MANGA_PAGE_ACTION_Y" #define GO_TO_PAGE_ACTION_Y "GO_TO_PAGE_ACTION_Y" #define OPTIONS_ACTION_Y "OPTIONS_ACTION_Y" #define HELP_ABOUT_ACTION_Y "HELP_ABOUT_ACTION_Y"