mirror of
https://github.com/YACReader/yacreader
synced 2025-07-21 06:24:39 -04:00
Fix indent (tag/space mix)
This commit is contained in:
@ -58,11 +58,11 @@ using namespace YACReader;
|
||||
void setMagnifyingGlassSize(const QSize & mgs) { settings->setValue(MAG_GLASS_SIZE,mgs);}
|
||||
QSize getGotoSlideSize() { return settings->value(GO_TO_FLOW_SIZE).toSize();}
|
||||
void setGotoSlideSize(const QSize & gss) { settings->setValue(GO_TO_FLOW_SIZE,gss);}
|
||||
float getZoomLevel() { return settings->value(ZOOM_LEVEL).toFloat();}
|
||||
void setZoomLevel(float zl) { settings->setValue(ZOOM_LEVEL,zl);}
|
||||
float getZoomLevel() { return settings->value(ZOOM_LEVEL).toFloat();}
|
||||
void setZoomLevel(float zl) { settings->setValue(ZOOM_LEVEL,zl);}
|
||||
|
||||
//Unified enum based fitmode
|
||||
YACReader::FitMode getFitMode() { return static_cast<YACReader::FitMode>(settings->value(FITMODE, YACReader::FitMode::FullPage).toInt()); }
|
||||
YACReader::FitMode getFitMode() { return static_cast<YACReader::FitMode>(settings->value(FITMODE, YACReader::FitMode::FullPage).toInt()); }
|
||||
void setFitMode ( YACReader::FitMode fitMode ){ settings->setValue(FITMODE, static_cast<int>(fitMode)); }
|
||||
|
||||
//openRecent
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
|
||||
GoToFlow::GoToFlow(QWidget *parent,FlowType flowType)
|
||||
:GoToFlowWidget(parent),ready(false)
|
||||
:GoToFlowWidget(parent),ready(false)
|
||||
{
|
||||
updateTimer = new QTimer;
|
||||
connect(updateTimer, SIGNAL(timeout()), this, SLOT(updateImageData()));
|
||||
@ -45,10 +45,10 @@ GoToFlow::GoToFlow(QWidget *parent,FlowType flowType)
|
||||
connect(toolBar,SIGNAL(goTo(unsigned int)),this,SIGNAL(goToPage(unsigned int)));
|
||||
connect(toolBar,SIGNAL(setCenter(unsigned int)),flow,SLOT(showSlide(unsigned int)));
|
||||
|
||||
mainLayout->addWidget(flow);
|
||||
toolBar->raise();
|
||||
mainLayout->addWidget(flow);
|
||||
toolBar->raise();
|
||||
|
||||
resize(static_cast<int>(5*imageSize.width()),toolBar->height() + static_cast<int>(imageSize.height()*1.7));
|
||||
resize(static_cast<int>(5*imageSize.width()),toolBar->height() + static_cast<int>(imageSize.height()*1.7));
|
||||
|
||||
this->setCursor(QCursor(Qt::ArrowCursor));
|
||||
}
|
||||
@ -64,11 +64,11 @@ void GoToFlow::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_Left: case Qt::Key_Right: case Qt::Key_Up:
|
||||
QApplication::sendEvent(flow,event);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
case Qt::Key_Left: case Qt::Key_Right: case Qt::Key_Up:
|
||||
QApplication::sendEvent(flow,event);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
GoToFlowWidget::keyPressEvent(event);
|
||||
@ -76,10 +76,10 @@ void GoToFlow::keyPressEvent(QKeyEvent *event)
|
||||
|
||||
void GoToFlow::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QWidget::resizeEvent(event);
|
||||
QWidget::resizeEvent(event);
|
||||
|
||||
toolBar->move(0, event->size().height() - toolBar->height());
|
||||
toolBar->setFixedWidth(width());
|
||||
toolBar->move(0, event->size().height() - toolBar->height());
|
||||
toolBar->setFixedWidth(width());
|
||||
}
|
||||
|
||||
|
||||
@ -229,7 +229,7 @@ void GoToFlow::updateConfig(QSettings * settings)
|
||||
//SlideInitializer
|
||||
//-----------------------------------------------------------------------------
|
||||
SlideInitializer::SlideInitializer(QMutex * m,PictureFlow * flow,int slides)
|
||||
:QThread(),mutex(m),_flow(flow),_slides(slides)
|
||||
:QThread(),mutex(m),_flow(flow),_slides(slides)
|
||||
{
|
||||
|
||||
}
|
||||
@ -250,7 +250,7 @@ void SlideInitializer::run()
|
||||
|
||||
|
||||
PageLoader::PageLoader(QMutex * m):
|
||||
QThread(),mutex(m), restart(false), working(false), idx(-1)
|
||||
QThread(),mutex(m), restart(false), working(false), idx(-1)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -28,10 +28,10 @@ GoToFlowGL::GoToFlowGL(QWidget* parent, FlowType flowType)
|
||||
connect(toolBar,SIGNAL(goTo(unsigned int)),this,SIGNAL(goToPage(unsigned int)));
|
||||
connect(toolBar,SIGNAL(setCenter(unsigned int)),flow,SLOT(setCenterIndex(unsigned int)));
|
||||
|
||||
mainLayout->addWidget(flow);
|
||||
toolBar->raise();
|
||||
mainLayout->addWidget(flow);
|
||||
toolBar->raise();
|
||||
|
||||
resize(static_cast<int>(5*imageSize.width()),toolBar->height() + static_cast<int>(imageSize.height()*1.7));
|
||||
resize(static_cast<int>(5*imageSize.width()),toolBar->height() + static_cast<int>(imageSize.height()*1.7));
|
||||
|
||||
this->setCursor(QCursor(Qt::ArrowCursor));
|
||||
}
|
||||
@ -138,7 +138,7 @@ void GoToFlowGL::updateConfig(QSettings * settings)
|
||||
flow->setLightStrenght(settings->value(LIGHT_STRENGTH).toInt());
|
||||
flow->setMaxAngle(settings->value(MAX_ANGLE).toInt());
|
||||
|
||||
/* flow->setVisibility(settings->value("visibilityDistance").toInt());
|
||||
/* flow->setVisibility(settings->value("visibilityDistance").toInt());
|
||||
flow->setLightStrenght(settings->value("lightStrength").toInt())*/;
|
||||
|
||||
}
|
||||
@ -147,11 +147,11 @@ void GoToFlowGL::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_Left: case Qt::Key_Right: case Qt::Key_Up:
|
||||
QApplication::sendEvent(flow,event);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
case Qt::Key_Left: case Qt::Key_Right: case Qt::Key_Up:
|
||||
QApplication::sendEvent(flow,event);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
GoToFlowWidget::keyPressEvent(event);
|
||||
@ -159,8 +159,8 @@ void GoToFlowGL::keyPressEvent(QKeyEvent* event)
|
||||
|
||||
void GoToFlowGL::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QWidget::resizeEvent(event);
|
||||
QWidget::resizeEvent(event);
|
||||
|
||||
toolBar->move(0, event->size().height() - toolBar->height());
|
||||
toolBar->setFixedWidth(width());
|
||||
toolBar->move(0, event->size().height() - toolBar->height());
|
||||
toolBar->setFixedWidth(width());
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
#endif
|
||||
|
||||
OptionsDialog::OptionsDialog(QWidget * parent)
|
||||
:YACReaderOptionsDialog(parent)
|
||||
:YACReaderOptionsDialog(parent)
|
||||
{
|
||||
|
||||
QTabWidget * tabWidget = new QTabWidget();
|
||||
@ -49,7 +49,7 @@ OptionsDialog::OptionsDialog(QWidget * parent)
|
||||
|
||||
QHBoxLayout * path = new QHBoxLayout();
|
||||
path->addWidget(pathEdit = new QLineEdit());
|
||||
path->addWidget(pathFindButton = new QPushButton(QIcon(":/images/find_folder.png"),""));
|
||||
path->addWidget(pathFindButton = new QPushButton(QIcon(":/images/find_folder.png"),""));
|
||||
pathBox->setLayout(path);
|
||||
|
||||
connect(pathFindButton,SIGNAL(clicked()),this,SLOT(findFolder()));
|
||||
@ -115,7 +115,7 @@ OptionsDialog::OptionsDialog(QWidget * parent)
|
||||
layoutGeneral->addWidget(slideSizeBox);
|
||||
//layoutGeneral->addWidget(fitBox);
|
||||
layoutGeneral->addWidget(colorBox);
|
||||
layoutGeneral->addWidget(shortcutsBox);
|
||||
layoutGeneral->addWidget(shortcutsBox);
|
||||
layoutGeneral->addStretch();
|
||||
layoutFlow->addWidget(sw);
|
||||
#ifndef NO_OPENGL
|
||||
@ -202,18 +202,18 @@ void OptionsDialog::restoreOptions(QSettings * settings)
|
||||
slideSize->setSliderPosition(settings->value(GO_TO_FLOW_SIZE).toSize().height());
|
||||
switch(settings->value(FLOW_TYPE_SW).toInt())
|
||||
{
|
||||
case 0:
|
||||
sw->radio1->setChecked(true);
|
||||
break;
|
||||
case 1:
|
||||
sw->radio2->setChecked(true);
|
||||
break;
|
||||
case 2:
|
||||
sw->radio3->setChecked(true);
|
||||
break;
|
||||
default:
|
||||
sw->radio1->setChecked(true);
|
||||
break;
|
||||
case 0:
|
||||
sw->radio1->setChecked(true);
|
||||
break;
|
||||
case 1:
|
||||
sw->radio2->setChecked(true);
|
||||
break;
|
||||
case 2:
|
||||
sw->radio3->setChecked(true);
|
||||
break;
|
||||
default:
|
||||
sw->radio1->setChecked(true);
|
||||
break;
|
||||
}
|
||||
|
||||
pathEdit->setText(settings->value(PATH).toString());
|
||||
|
@ -23,21 +23,21 @@
|
||||
#include <QFile>
|
||||
|
||||
Viewer::Viewer(QWidget * parent)
|
||||
:QScrollArea(parent),
|
||||
currentPage(0),
|
||||
magnifyingGlassShowed(false),
|
||||
fullscreen(false),
|
||||
information(false),
|
||||
doublePage(false),
|
||||
doubleMangaPage(false),
|
||||
wheelStop(false),
|
||||
direction(1),
|
||||
restoreMagnifyingGlass(false),
|
||||
drag(false),
|
||||
numScrollSteps(22),
|
||||
shouldOpenNext(false),
|
||||
shouldOpenPrevious(false),
|
||||
zoom(100)
|
||||
:QScrollArea(parent),
|
||||
currentPage(0),
|
||||
magnifyingGlassShowed(false),
|
||||
fullscreen(false),
|
||||
information(false),
|
||||
doublePage(false),
|
||||
doubleMangaPage(false),
|
||||
wheelStop(false),
|
||||
direction(1),
|
||||
restoreMagnifyingGlass(false),
|
||||
drag(false),
|
||||
numScrollSteps(22),
|
||||
shouldOpenNext(false),
|
||||
shouldOpenPrevious(false),
|
||||
zoom(100)
|
||||
{
|
||||
translator = new YACReaderTranslator(this);
|
||||
translator->hide();
|
||||
@ -71,22 +71,22 @@ zoom(100)
|
||||
|
||||
QSettings * settings = new QSettings(YACReader::getSettingsPath()+"/YACReader.ini",QSettings::IniFormat);
|
||||
|
||||
//CONFIG GOTO_FLOW--------------------------------------------------------
|
||||
//CONFIG GOTO_FLOW--------------------------------------------------------
|
||||
#ifndef NO_OPENGL
|
||||
|
||||
OpenGLChecker openGLChecker;
|
||||
bool openGLAvailable = openGLChecker.hasCompatibleOpenGLVersion();
|
||||
OpenGLChecker openGLChecker;
|
||||
bool openGLAvailable = openGLChecker.hasCompatibleOpenGLVersion();
|
||||
|
||||
if(openGLAvailable && !settings->contains(USE_OPEN_GL))
|
||||
settings->setValue(USE_OPEN_GL,2);
|
||||
else
|
||||
if(!openGLAvailable)
|
||||
settings->setValue(USE_OPEN_GL,0);
|
||||
if(openGLAvailable && !settings->contains(USE_OPEN_GL))
|
||||
settings->setValue(USE_OPEN_GL,2);
|
||||
else
|
||||
if(!openGLAvailable)
|
||||
settings->setValue(USE_OPEN_GL,0);
|
||||
|
||||
if((settings->value(USE_OPEN_GL).toBool() == true))
|
||||
goToFlow = new GoToFlowGL(this,Configuration::getConfiguration().getFlowType());
|
||||
else
|
||||
goToFlow = new GoToFlow(this,Configuration::getConfiguration().getFlowType());
|
||||
if((settings->value(USE_OPEN_GL).toBool() == true))
|
||||
goToFlow = new GoToFlowGL(this,Configuration::getConfiguration().getFlowType());
|
||||
else
|
||||
goToFlow = new GoToFlow(this,Configuration::getConfiguration().getFlowType());
|
||||
#else
|
||||
goToFlow = new GoToFlow(this,Configuration::getConfiguration().getFlowType());
|
||||
#endif
|
||||
@ -224,13 +224,13 @@ void Viewer::open(QString pathFile, const ComicDB & comic)
|
||||
|
||||
void Viewer::showMessageErrorOpening()
|
||||
{
|
||||
QMessageBox::critical(this,tr("Not found"),tr("Comic not found"));
|
||||
QMessageBox::critical(this,tr("Not found"),tr("Comic not found"));
|
||||
//resetContent(); --> not needed
|
||||
}
|
||||
|
||||
void Viewer::showMessageErrorOpening(QString message)
|
||||
{
|
||||
QMessageBox::critical(this,tr("Error opening comic"),message);
|
||||
QMessageBox::critical(this,tr("Error opening comic"),message);
|
||||
resetContent();
|
||||
}
|
||||
|
||||
@ -263,7 +263,7 @@ void Viewer::prev()
|
||||
}
|
||||
else
|
||||
{
|
||||
render->previousPage();
|
||||
render->previousPage();
|
||||
}
|
||||
updateInformation();
|
||||
shouldOpenNext = false;
|
||||
@ -330,28 +330,28 @@ void Viewer::updateContentSize()
|
||||
YACReader::FitMode fitmode = Configuration::getConfiguration().getFitMode();
|
||||
switch (fitmode)
|
||||
{
|
||||
case YACReader::FitMode::FullRes:
|
||||
pagefit=currentPage->size();
|
||||
break;
|
||||
case YACReader::FitMode::ToWidth:
|
||||
pagefit=currentPage->size();
|
||||
pagefit.scale(width(), 0, Qt::KeepAspectRatioByExpanding);
|
||||
break;
|
||||
case YACReader::FitMode::ToHeight:
|
||||
pagefit=currentPage->size();
|
||||
pagefit.scale(0, height(), Qt::KeepAspectRatioByExpanding);
|
||||
break;
|
||||
case YACReader::FitMode::FullRes:
|
||||
pagefit=currentPage->size();
|
||||
break;
|
||||
case YACReader::FitMode::ToWidth:
|
||||
pagefit=currentPage->size();
|
||||
pagefit.scale(width(), 0, Qt::KeepAspectRatioByExpanding);
|
||||
break;
|
||||
case YACReader::FitMode::ToHeight:
|
||||
pagefit=currentPage->size();
|
||||
pagefit.scale(0, height(), Qt::KeepAspectRatioByExpanding);
|
||||
break;
|
||||
//if everything fails showing the full page is a good idea
|
||||
case YACReader::FitMode::FullPage:
|
||||
default:
|
||||
pagefit=currentPage->size();
|
||||
pagefit.scale(size(), Qt::KeepAspectRatio);
|
||||
break;
|
||||
case YACReader::FitMode::FullPage:
|
||||
default:
|
||||
pagefit=currentPage->size();
|
||||
pagefit.scale(size(), Qt::KeepAspectRatio);
|
||||
break;
|
||||
}
|
||||
|
||||
if(zoom != 100)
|
||||
if(zoom != 100)
|
||||
{
|
||||
pagefit.scale(floor(pagefit.width()*zoom/100.0f), 0, Qt::KeepAspectRatioByExpanding);
|
||||
pagefit.scale(floor(pagefit.width()*zoom/100.0f), 0, Qt::KeepAspectRatioByExpanding);
|
||||
}
|
||||
//apply scaling
|
||||
content->resize(pagefit);
|
||||
@ -371,23 +371,23 @@ void Viewer::updateContentSize()
|
||||
|
||||
void Viewer::increaseZoomFactor()
|
||||
{
|
||||
zoom = std::min(zoom + 10, 500);
|
||||
zoom = std::min(zoom + 10, 500);
|
||||
|
||||
updateContentSize();
|
||||
notificationsLabel->setText(QString::number(getZoomFactor())+"%");
|
||||
notificationsLabel->setText(QString::number(getZoomFactor())+"%");
|
||||
notificationsLabel->flash();
|
||||
|
||||
emit zoomUpdated(zoom);
|
||||
emit zoomUpdated(zoom);
|
||||
}
|
||||
void Viewer::decreaseZoomFactor()
|
||||
{
|
||||
zoom = std::max(zoom - 10, 30);
|
||||
zoom = std::max(zoom - 10, 30);
|
||||
|
||||
updateContentSize();
|
||||
notificationsLabel->setText(QString::number(getZoomFactor())+"%");
|
||||
notificationsLabel->setText(QString::number(getZoomFactor())+"%");
|
||||
notificationsLabel->flash();
|
||||
|
||||
emit zoomUpdated(zoom);
|
||||
emit zoomUpdated(zoom);
|
||||
}
|
||||
|
||||
int Viewer::getZoomFactor()
|
||||
@ -399,14 +399,14 @@ int Viewer::getZoomFactor()
|
||||
void Viewer::setZoomFactor(int z)
|
||||
{
|
||||
//this function is mostly used to reset the zoom after a fitmode switch
|
||||
if (z > 500)
|
||||
zoom = 500;
|
||||
else if (z < 30)
|
||||
zoom = 30;
|
||||
if (z > 500)
|
||||
zoom = 500;
|
||||
else if (z < 30)
|
||||
zoom = 30;
|
||||
else
|
||||
zoom = z;
|
||||
|
||||
emit zoomUpdated(zoom);
|
||||
emit zoomUpdated(zoom);
|
||||
}
|
||||
|
||||
void Viewer::updateVerticalScrollBar()
|
||||
@ -457,108 +457,108 @@ void Viewer::scrollUp()
|
||||
|
||||
void Viewer::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if(render->hasLoadedComic())
|
||||
{
|
||||
int _key = event->key();
|
||||
Qt::KeyboardModifiers modifiers = event->modifiers();
|
||||
if(render->hasLoadedComic())
|
||||
{
|
||||
int _key = event->key();
|
||||
Qt::KeyboardModifiers modifiers = event->modifiers();
|
||||
|
||||
if(modifiers & Qt::ShiftModifier)
|
||||
_key |= Qt::SHIFT;
|
||||
if (modifiers & Qt::ControlModifier)
|
||||
_key |= Qt::CTRL;
|
||||
if (modifiers & Qt::MetaModifier)
|
||||
_key |= Qt::META;
|
||||
if (modifiers & Qt::AltModifier)
|
||||
_key |= Qt::ALT;
|
||||
if(modifiers & Qt::ShiftModifier)
|
||||
_key |= Qt::SHIFT;
|
||||
if (modifiers & Qt::ControlModifier)
|
||||
_key |= Qt::CTRL;
|
||||
if (modifiers & Qt::MetaModifier)
|
||||
_key |= Qt::META;
|
||||
if (modifiers & Qt::AltModifier)
|
||||
_key |= Qt::ALT;
|
||||
|
||||
QKeySequence key(_key);
|
||||
/*if(goToFlow->isVisible() && event->key()!=Qt::Key_S)
|
||||
QCoreApplication::sendEvent(goToFlow,event);
|
||||
else*/
|
||||
QKeySequence key(_key);
|
||||
/*if(goToFlow->isVisible() && event->key()!=Qt::Key_S)
|
||||
QCoreApplication::sendEvent(goToFlow,event);
|
||||
else*/
|
||||
|
||||
if (key == ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_FORWARD_ACTION_Y))
|
||||
{
|
||||
posByStep = height()/numScrollSteps;
|
||||
nextPos=verticalScrollBar()->sliderPosition()+static_cast<int>((height()*0.80));
|
||||
scrollDown();
|
||||
}
|
||||
if (key == ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_FORWARD_ACTION_Y))
|
||||
{
|
||||
posByStep = height()/numScrollSteps;
|
||||
nextPos=verticalScrollBar()->sliderPosition()+static_cast<int>((height()*0.80));
|
||||
scrollDown();
|
||||
}
|
||||
|
||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_BACKWARD_ACTION_Y))
|
||||
{
|
||||
posByStep = height()/numScrollSteps;
|
||||
nextPos=verticalScrollBar()->sliderPosition()-static_cast<int>((height()*0.80));
|
||||
scrollUp();
|
||||
}
|
||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_BACKWARD_ACTION_Y))
|
||||
{
|
||||
posByStep = height()/numScrollSteps;
|
||||
nextPos=verticalScrollBar()->sliderPosition()-static_cast<int>((height()*0.80));
|
||||
scrollUp();
|
||||
}
|
||||
|
||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_DOWN_ACTION_Y) ||
|
||||
key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_UP_ACTION_Y) ||
|
||||
key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_LEFT_ACTION_Y) ||
|
||||
key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_RIGHT_ACTION_Y))
|
||||
{
|
||||
QAbstractScrollArea::keyPressEvent(event);
|
||||
emit backgroundChanges();
|
||||
}
|
||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_DOWN_ACTION_Y) ||
|
||||
key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_UP_ACTION_Y) ||
|
||||
key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_LEFT_ACTION_Y) ||
|
||||
key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_RIGHT_ACTION_Y))
|
||||
{
|
||||
QAbstractScrollArea::keyPressEvent(event);
|
||||
emit backgroundChanges();
|
||||
}
|
||||
|
||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(GO_TO_FIRST_PAGE_ACTION_Y))
|
||||
{
|
||||
goTo(0);
|
||||
}
|
||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(GO_TO_FIRST_PAGE_ACTION_Y))
|
||||
{
|
||||
goTo(0);
|
||||
}
|
||||
|
||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(GO_TO_LAST_PAGE_ACTION_Y))
|
||||
{
|
||||
goTo(this->render->numPages()-1);
|
||||
}
|
||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(GO_TO_LAST_PAGE_ACTION_Y))
|
||||
{
|
||||
goTo(this->render->numPages()-1);
|
||||
}
|
||||
|
||||
else
|
||||
QAbstractScrollArea::keyPressEvent(event);
|
||||
else
|
||||
QAbstractScrollArea::keyPressEvent(event);
|
||||
|
||||
if(mglass->isVisible() && (key == ShortcutsManager::getShortcutsManager().getShortcut(SIZE_UP_MGLASS_ACTION_Y) ||
|
||||
key == ShortcutsManager::getShortcutsManager().getShortcut(SIZE_DOWN_MGLASS_ACTION_Y) ||
|
||||
key == ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_IN_MGLASS_ACTION_Y) ||
|
||||
key == ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_OUT_MGLASS_ACTION_Y)))
|
||||
{
|
||||
QCoreApplication::sendEvent(mglass,event);
|
||||
}
|
||||
if(mglass->isVisible() && (key == ShortcutsManager::getShortcutsManager().getShortcut(SIZE_UP_MGLASS_ACTION_Y) ||
|
||||
key == ShortcutsManager::getShortcutsManager().getShortcut(SIZE_DOWN_MGLASS_ACTION_Y) ||
|
||||
key == ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_IN_MGLASS_ACTION_Y) ||
|
||||
key == ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_OUT_MGLASS_ACTION_Y)))
|
||||
{
|
||||
QCoreApplication::sendEvent(mglass,event);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
QAbstractScrollArea::keyPressEvent(event);
|
||||
}
|
||||
else
|
||||
QAbstractScrollArea::keyPressEvent(event);
|
||||
}
|
||||
|
||||
void Viewer::wheelEvent(QWheelEvent * event)
|
||||
{
|
||||
if(render->hasLoadedComic())
|
||||
{
|
||||
if((event->delta()<0)&&(verticalScrollBar()->sliderPosition()==verticalScrollBar()->maximum()))
|
||||
{
|
||||
if(wheelStop)
|
||||
{
|
||||
if(getMovement(event) == Forward)
|
||||
{
|
||||
next();
|
||||
verticalScroller->stop();
|
||||
event->accept();
|
||||
wheelStop = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
wheelStop = true;
|
||||
}
|
||||
else
|
||||
if((event->delta()<0)&&(verticalScrollBar()->sliderPosition()==verticalScrollBar()->maximum()))
|
||||
{
|
||||
if(wheelStop)
|
||||
{
|
||||
if(getMovement(event) == Forward)
|
||||
{
|
||||
next();
|
||||
verticalScroller->stop();
|
||||
event->accept();
|
||||
wheelStop = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
wheelStop = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if((event->delta()>0)&&(verticalScrollBar()->sliderPosition()==verticalScrollBar()->minimum()))
|
||||
{
|
||||
if(wheelStop)
|
||||
{
|
||||
if(getMovement(event) == Backward)
|
||||
{
|
||||
prev();
|
||||
verticalScroller->stop();
|
||||
event->accept();
|
||||
wheelStop = false;
|
||||
}
|
||||
return;
|
||||
{
|
||||
if(getMovement(event) == Backward)
|
||||
{
|
||||
prev();
|
||||
verticalScroller->stop();
|
||||
event->accept();
|
||||
wheelStop = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
wheelStop = true;
|
||||
@ -604,23 +604,23 @@ void Viewer::mouseMoveEvent(QMouseEvent * event)
|
||||
{
|
||||
if(showGoToFlowAnimation->state()!=QPropertyAnimation::Running)
|
||||
{
|
||||
if(goToFlow->isVisible())
|
||||
{
|
||||
QPoint gtfPos = goToFlow->mapFrom(this,event->pos());
|
||||
if(gtfPos.y() < 0 || gtfPos.x()<0 || gtfPos.x()>goToFlow->width())//TODO this extra check is for Mavericks (mouseMove over goToFlowGL seems to be broken)
|
||||
animateHideGoToFlow();
|
||||
//goToFlow->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
int umbral = (width()-goToFlow->width())/2;
|
||||
if((event->y()>height()-15)&&(event->x()>umbral)&&(event->x()<width()-umbral))
|
||||
if(goToFlow->isVisible())
|
||||
{
|
||||
|
||||
animateShowGoToFlow();
|
||||
hideCursorTimer->stop();
|
||||
QPoint gtfPos = goToFlow->mapFrom(this,event->pos());
|
||||
if(gtfPos.y() < 0 || gtfPos.x()<0 || gtfPos.x()>goToFlow->width())//TODO this extra check is for Mavericks (mouseMove over goToFlowGL seems to be broken)
|
||||
animateHideGoToFlow();
|
||||
//goToFlow->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
int umbral = (width()-goToFlow->width())/2;
|
||||
if((event->y()>height()-15)&&(event->x()>umbral)&&(event->x()<width()-umbral))
|
||||
{
|
||||
|
||||
animateShowGoToFlow();
|
||||
hideCursorTimer->stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(drag)
|
||||
@ -654,7 +654,7 @@ void Viewer::showMagnifyingGlass()
|
||||
QPoint p = QPoint(cursor().pos().x(),cursor().pos().y());
|
||||
p = this->parentWidget()->mapFromGlobal(p);
|
||||
mglass->move(static_cast<int>(p.x()-float(mglass->width())/2)
|
||||
,static_cast<int>(p.y()-float(mglass->height())/2));
|
||||
,static_cast<int>(p.y()-float(mglass->height())/2));
|
||||
mglass->show();
|
||||
mglass->updateImage(mglass->x()+mglass->width()/2,mglass->y()+mglass->height()/2);
|
||||
magnifyingGlassShowed = true;
|
||||
@ -718,7 +718,7 @@ void Viewer::animateShowGoToFlow()
|
||||
goToFlow->centerSlide(render->getIndex());
|
||||
goToFlow->setPageNumber(render->getIndex());
|
||||
goToFlow->show();
|
||||
goToFlow->setFocus(Qt::OtherFocusReason);
|
||||
goToFlow->setFocus(Qt::OtherFocusReason);
|
||||
}
|
||||
}
|
||||
|
||||
@ -732,30 +732,30 @@ void Viewer::animateHideGoToFlow()
|
||||
showGoToFlowAnimation->setEndValue(QPoint((width()-goToFlow->width())/2,height()));
|
||||
showGoToFlowAnimation->start();
|
||||
goToFlow->centerSlide(render->getIndex());
|
||||
goToFlow->setPageNumber(render->getIndex());
|
||||
this->setFocus(Qt::OtherFocusReason);
|
||||
goToFlow->setPageNumber(render->getIndex());
|
||||
this->setFocus(Qt::OtherFocusReason);
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::moveCursoToGoToFlow()
|
||||
{
|
||||
//Move cursor to goToFlow widget on show (this avoid hide when mouse is moved)
|
||||
int y = goToFlow->pos().y();
|
||||
int x1 = goToFlow->pos().x();
|
||||
int x2 = x1 + goToFlow->width();
|
||||
QPoint cursorPos = mapFromGlobal(cursor().pos());
|
||||
int cursorX = cursorPos.x();
|
||||
int cursorY = cursorPos.y();
|
||||
//Move cursor to goToFlow widget on show (this avoid hide when mouse is moved)
|
||||
int y = goToFlow->pos().y();
|
||||
int x1 = goToFlow->pos().x();
|
||||
int x2 = x1 + goToFlow->width();
|
||||
QPoint cursorPos = mapFromGlobal(cursor().pos());
|
||||
int cursorX = cursorPos.x();
|
||||
int cursorY = cursorPos.y();
|
||||
|
||||
if(cursorY <= y)
|
||||
cursorY = y + 10;
|
||||
if(cursorX <= x1)
|
||||
cursorX = x1 + 10;
|
||||
if(cursorX >= x2)
|
||||
cursorX = x2 - 10;
|
||||
cursor().setPos(mapToGlobal(QPoint(cursorX,cursorY)));
|
||||
hideCursorTimer->stop();
|
||||
showCursor();
|
||||
if(cursorY <= y)
|
||||
cursorY = y + 10;
|
||||
if(cursorX <= x1)
|
||||
cursorX = x1 + 10;
|
||||
if(cursorX >= x2)
|
||||
cursorX = x2 - 10;
|
||||
cursor().setPos(mapToGlobal(QPoint(cursorX,cursorY)));
|
||||
hideCursorTimer->stop();
|
||||
showCursor();
|
||||
}
|
||||
|
||||
void Viewer::rotateLeft()
|
||||
@ -773,18 +773,18 @@ void Viewer::setBookmark(bool set)
|
||||
render->setBookmark();
|
||||
if(set) //add bookmark
|
||||
{
|
||||
render->setBookmark();
|
||||
render->setBookmark();
|
||||
}
|
||||
else //remove bookmark
|
||||
{
|
||||
render->removeBookmark();
|
||||
render->removeBookmark();
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::save ()
|
||||
{
|
||||
if(render->hasLoadedComic())
|
||||
render->save();
|
||||
render->save();
|
||||
}
|
||||
|
||||
void Viewer::doublePageSwitch()
|
||||
@ -833,8 +833,8 @@ void Viewer::setPageUnavailableMessage()
|
||||
void Viewer::configureContent(QString msg)
|
||||
{
|
||||
content->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
|
||||
if(!(devicePixelRatio()>1))
|
||||
content->setScaledContents(true);
|
||||
if(!(devicePixelRatio()>1))
|
||||
content->setScaledContents(true);
|
||||
content->setAlignment(Qt::AlignTop|Qt::AlignHCenter);
|
||||
content->setText(msg);
|
||||
content->setFont(QFont("courier new", 12));
|
||||
@ -914,27 +914,27 @@ void Viewer::animateHideTranslator()
|
||||
|
||||
void Viewer::mousePressEvent ( QMouseEvent * event )
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
drag = true;
|
||||
yDragOrigin = event->y();
|
||||
xDragOrigin = event->x();
|
||||
setCursor(Qt::ClosedHandCursor);
|
||||
event->accept();
|
||||
}
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
drag = true;
|
||||
yDragOrigin = event->y();
|
||||
xDragOrigin = event->x();
|
||||
setCursor(Qt::ClosedHandCursor);
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::mouseReleaseEvent ( QMouseEvent * event )
|
||||
{
|
||||
drag = false;
|
||||
setCursor(Qt::OpenHandCursor);
|
||||
event->accept();
|
||||
drag = false;
|
||||
setCursor(Qt::OpenHandCursor);
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void Viewer::updateZoomRatio(int ratio)
|
||||
{
|
||||
zoom = ratio;
|
||||
updateContentSize();
|
||||
zoom = ratio;
|
||||
updateContentSize();
|
||||
}
|
||||
|
||||
void Viewer::updateConfig(QSettings * settings)
|
||||
@ -1010,31 +1010,31 @@ void Viewer::updateComic(ComicDB & comic)
|
||||
{
|
||||
if(render->hasLoadedComic())
|
||||
{
|
||||
//set currentPage
|
||||
comic.info.currentPage = render->getIndex()+1;
|
||||
//set bookmarks
|
||||
Bookmarks * boomarks = render->getBookmarks();
|
||||
QList<int> boomarksList = boomarks->getBookmarkPages();
|
||||
int numBookmarks = boomarksList.size();
|
||||
if(numBookmarks > 0)
|
||||
comic.info.bookmark1 = boomarksList[0];
|
||||
if(numBookmarks > 1)
|
||||
comic.info.bookmark2 = boomarksList[1];
|
||||
if(numBookmarks > 2)
|
||||
comic.info.bookmark3 = boomarksList[2];
|
||||
//set filters
|
||||
//TODO: avoid use settings for this...
|
||||
QSettings settings(YACReader::getSettingsPath()+"/YACReader.ini",QSettings::IniFormat);
|
||||
int brightness = settings.value(BRIGHTNESS,0).toInt();
|
||||
int contrast = settings.value(CONTRAST,100).toInt();
|
||||
int gamma = settings.value(GAMMA,100).toInt();
|
||||
//set currentPage
|
||||
comic.info.currentPage = render->getIndex()+1;
|
||||
//set bookmarks
|
||||
Bookmarks * boomarks = render->getBookmarks();
|
||||
QList<int> boomarksList = boomarks->getBookmarkPages();
|
||||
int numBookmarks = boomarksList.size();
|
||||
if(numBookmarks > 0)
|
||||
comic.info.bookmark1 = boomarksList[0];
|
||||
if(numBookmarks > 1)
|
||||
comic.info.bookmark2 = boomarksList[1];
|
||||
if(numBookmarks > 2)
|
||||
comic.info.bookmark3 = boomarksList[2];
|
||||
//set filters
|
||||
//TODO: avoid use settings for this...
|
||||
QSettings settings(YACReader::getSettingsPath()+"/YACReader.ini",QSettings::IniFormat);
|
||||
int brightness = settings.value(BRIGHTNESS,0).toInt();
|
||||
int contrast = settings.value(CONTRAST,100).toInt();
|
||||
int gamma = settings.value(GAMMA,100).toInt();
|
||||
|
||||
if(brightness != 0 || comic.info.brightness!=-1)
|
||||
comic.info.brightness = brightness;
|
||||
if(contrast != 100 || comic.info.contrast!=-1)
|
||||
comic.info.contrast = contrast;
|
||||
if(gamma != 100 || comic.info.gamma!=-1)
|
||||
comic.info.gamma = gamma;
|
||||
if(brightness != 0 || comic.info.brightness!=-1)
|
||||
comic.info.brightness = brightness;
|
||||
if(contrast != 100 || comic.info.contrast!=-1)
|
||||
comic.info.contrast = contrast;
|
||||
if(gamma != 100 || comic.info.gamma!=-1)
|
||||
comic.info.gamma = gamma;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user