mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Merged luisangelsm/yacreader into default
This commit is contained in:
commit
b564e4347b
@ -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>();}
|
||||
|
@ -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;
|
||||
|
@ -100,6 +100,7 @@ class EditShortcutsDialog;
|
||||
QAction *showInfoAction;
|
||||
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;
|
||||
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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."));
|
||||
|
@ -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 |
@ -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);
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user