mirror of
https://github.com/YACReader/yacreader
synced 2026-04-12 15:49:53 -04:00
merge current develop branch
This commit is contained in:
39
YACReader/Info.plist.mac
Normal file
39
YACReader/Info.plist.mac
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>NSPrincipalClass</key>
|
||||||
|
<string>NSApplication</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>@ICON@</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleGetInfoString</key>
|
||||||
|
<string>Created by Qt/QMake</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>@TYPEINFO@</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>@EXECUTABLE@</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>@BUNDLEIDENTIFIER@</string>
|
||||||
|
<key>NOTE</key>
|
||||||
|
<string>This file was generated by Qt/QMake.</string>
|
||||||
|
|
||||||
|
<key>CFBundleDocumentTypes</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string></string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
<key>LSHandlerRank</key>
|
||||||
|
<string>Alternate</string>
|
||||||
|
<key>LSItemContentTypes</key>
|
||||||
|
<array>
|
||||||
|
<string>public.item</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@ -231,6 +231,7 @@ RC_FILE = icon.rc
|
|||||||
|
|
||||||
macx {
|
macx {
|
||||||
ICON = YACReader.icns
|
ICON = YACReader.icns
|
||||||
|
QMAKE_INFO_PLIST = Info.plist.mac
|
||||||
}
|
}
|
||||||
|
|
||||||
TRANSLATIONS = yacreader_es.ts \
|
TRANSLATIONS = yacreader_es.ts \
|
||||||
|
|||||||
@ -12,7 +12,12 @@
|
|||||||
Configuration::Configuration()
|
Configuration::Configuration()
|
||||||
{
|
{
|
||||||
//read configuration
|
//read configuration
|
||||||
//load("/YACReader.conf");
|
//load("/YACReader.conf");
|
||||||
|
}
|
||||||
|
|
||||||
|
QSettings *Configuration::getSettings()
|
||||||
|
{
|
||||||
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Configuration::Configuration(const Configuration & conf)
|
/*Configuration::Configuration(const Configuration & conf)
|
||||||
@ -49,6 +54,8 @@ void Configuration::load(QSettings * settings)
|
|||||||
settings->setValue(ALWAYS_ON_TOP,false);
|
settings->setValue(ALWAYS_ON_TOP,false);
|
||||||
if(!settings->contains(SHOW_TOOLBARS))
|
if(!settings->contains(SHOW_TOOLBARS))
|
||||||
settings->setValue(SHOW_TOOLBARS, true);
|
settings->setValue(SHOW_TOOLBARS, true);
|
||||||
|
if(!settings->contains(QUICK_NAVI_MODE))
|
||||||
|
settings->setValue(QUICK_NAVI_MODE, false);
|
||||||
//old fit stuff
|
//old fit stuff
|
||||||
/*if(!settings->contains(FIT))
|
/*if(!settings->contains(FIT))
|
||||||
settings->setValue(FIT,false);
|
settings->setValue(FIT,false);
|
||||||
@ -69,4 +76,4 @@ void Configuration::updateOpenRecentList (QString path)
|
|||||||
list.removeLast();
|
list.removeLast();
|
||||||
}
|
}
|
||||||
settings->setValue("recentFiles", list);
|
settings->setValue("recentFiles", list);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,7 @@ using namespace YACReader;
|
|||||||
class Configuration : public QObject
|
class Configuration : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSettings * settings;
|
QSettings * settings;
|
||||||
|
|
||||||
@ -43,14 +43,15 @@ using namespace YACReader;
|
|||||||
Configuration();
|
Configuration();
|
||||||
//Configuration(const Configuration & conf);
|
//Configuration(const Configuration & conf);
|
||||||
void load(const QString & path = CONF_FILE_PATH);
|
void load(const QString & path = CONF_FILE_PATH);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static Configuration & getConfiguration()
|
static Configuration & getConfiguration()
|
||||||
{
|
{
|
||||||
static Configuration configuration;
|
static Configuration configuration;
|
||||||
return configuration;
|
return configuration;
|
||||||
};
|
};
|
||||||
|
QSettings *getSettings();
|
||||||
void load(QSettings * settings);
|
void load(QSettings * settings);
|
||||||
QString getDefaultPath() { return settings->value(PATH).toString(); }
|
QString getDefaultPath() { return settings->value(PATH).toString(); }
|
||||||
void setDefaultPath(QString defaultPath){settings->setValue(PATH,defaultPath);}
|
void setDefaultPath(QString defaultPath){settings->setValue(PATH,defaultPath);}
|
||||||
@ -58,18 +59,18 @@ using namespace YACReader;
|
|||||||
void setMagnifyingGlassSize(const QSize & mgs) { settings->setValue(MAG_GLASS_SIZE,mgs);}
|
void setMagnifyingGlassSize(const QSize & mgs) { settings->setValue(MAG_GLASS_SIZE,mgs);}
|
||||||
QSize getGotoSlideSize() { return settings->value(GO_TO_FLOW_SIZE).toSize();}
|
QSize getGotoSlideSize() { return settings->value(GO_TO_FLOW_SIZE).toSize();}
|
||||||
void setGotoSlideSize(const QSize & gss) { settings->setValue(GO_TO_FLOW_SIZE,gss);}
|
void setGotoSlideSize(const QSize & gss) { settings->setValue(GO_TO_FLOW_SIZE,gss);}
|
||||||
float getZoomLevel() { return settings->value(ZOOM_LEVEL).toFloat();}
|
float getZoomLevel() { return settings->value(ZOOM_LEVEL).toFloat();}
|
||||||
void setZoomLevel(float zl) { settings->setValue(ZOOM_LEVEL,zl);}
|
void setZoomLevel(float zl) { settings->setValue(ZOOM_LEVEL,zl);}
|
||||||
|
|
||||||
//Unified enum based fitmode
|
//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)); }
|
void setFitMode ( YACReader::FitMode fitMode ){ settings->setValue(FITMODE, static_cast<int>(fitMode)); }
|
||||||
|
|
||||||
//openRecent
|
//openRecent
|
||||||
QStringList openRecentList() { return settings->value("recentFiles").toStringList(); }
|
QStringList openRecentList() { return settings->value("recentFiles").toStringList(); }
|
||||||
void updateOpenRecentList (QString path);
|
void updateOpenRecentList (QString path);
|
||||||
void clearOpenRecentList() { settings->remove("recentFiles"); }
|
void clearOpenRecentList() { settings->remove("recentFiles"); }
|
||||||
|
|
||||||
//Old fitmodes
|
//Old fitmodes
|
||||||
/*
|
/*
|
||||||
bool getAdjustToWidth() {return settings->value(FIT).toBool();}
|
bool getAdjustToWidth() {return settings->value(FIT).toBool();}
|
||||||
@ -79,12 +80,12 @@ using namespace YACReader;
|
|||||||
bool getAdjustToFullSize(){return settings->value(ADJUST_TO_FULL_SIZE).toBool();}
|
bool getAdjustToFullSize(){return settings->value(ADJUST_TO_FULL_SIZE).toBool();}
|
||||||
void setAdjustToFullSize(bool b){settings->setValue(ADJUST_TO_FULL_SIZE,b);}
|
void setAdjustToFullSize(bool b){settings->setValue(ADJUST_TO_FULL_SIZE,b);}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
FlowType getFlowType(){return (FlowType)settings->value(FLOW_TYPE_SW).toInt();}
|
FlowType getFlowType(){return (FlowType)settings->value(FLOW_TYPE_SW).toInt();}
|
||||||
void setFlowType(FlowType type){settings->setValue(FLOW_TYPE_SW,type);}
|
void setFlowType(FlowType type){settings->setValue(FLOW_TYPE_SW,type);}
|
||||||
bool getFullScreen(){return settings->value(FULLSCREEN).toBool();}
|
bool getFullScreen(){return settings->value(FULLSCREEN).toBool();}
|
||||||
void setFullScreen(bool f){settings->setValue(FULLSCREEN,f);}
|
void setFullScreen(bool f){settings->setValue(FULLSCREEN,f);}
|
||||||
|
|
||||||
QPoint getPos(){return settings->value(Y_WINDOW_POS).toPoint();}
|
QPoint getPos(){return settings->value(Y_WINDOW_POS).toPoint();}
|
||||||
void setPos(QPoint p){settings->setValue(Y_WINDOW_POS,p);}
|
void setPos(QPoint p){settings->setValue(Y_WINDOW_POS,p);}
|
||||||
QSize getSize(){return settings->value(Y_WINDOW_SIZE).toSize();}
|
QSize getSize(){return settings->value(Y_WINDOW_SIZE).toSize();}
|
||||||
@ -95,7 +96,7 @@ using namespace YACReader;
|
|||||||
void setDoublePage(bool b){settings->setValue(DOUBLE_PAGE,b);}
|
void setDoublePage(bool b){settings->setValue(DOUBLE_PAGE,b);}
|
||||||
bool getDoubleMangaPage(){return settings->value(DOUBLE_MANGA_PAGE).toBool();}
|
bool getDoubleMangaPage(){return settings->value(DOUBLE_MANGA_PAGE).toBool();}
|
||||||
void setDoubleMangaPage(bool b){settings->setValue(DOUBLE_MANGA_PAGE,b);}
|
void setDoubleMangaPage(bool b){settings->setValue(DOUBLE_MANGA_PAGE,b);}
|
||||||
|
|
||||||
QColor getBackgroundColor(){return settings->value(BACKGROUND_COLOR).value<QColor>();}
|
QColor getBackgroundColor(){return settings->value(BACKGROUND_COLOR).value<QColor>();}
|
||||||
void setBackgroundColor(const QColor& color){settings->value(BACKGROUND_COLOR,color);}
|
void setBackgroundColor(const QColor& color){settings->value(BACKGROUND_COLOR,color);}
|
||||||
bool getAlwaysOnTop(){return settings->value(ALWAYS_ON_TOP).toBool();}
|
bool getAlwaysOnTop(){return settings->value(ALWAYS_ON_TOP).toBool();}
|
||||||
@ -108,6 +109,7 @@ using namespace YACReader;
|
|||||||
void setLastVersionCheck(const QDate & date){ settings->setValue(LAST_VERSION_CHECK,date);}
|
void setLastVersionCheck(const QDate & date){ settings->setValue(LAST_VERSION_CHECK,date);}
|
||||||
int getNumDaysBetweenVersionChecks() {return settings->value(NUM_DAYS_BETWEEN_VERSION_CHECKS,1).toInt();}
|
int getNumDaysBetweenVersionChecks() {return settings->value(NUM_DAYS_BETWEEN_VERSION_CHECKS,1).toInt();}
|
||||||
void setNumDaysBetweenVersionChecks(int days) {return settings->setValue(NUM_DAYS_BETWEEN_VERSION_CHECKS,days);}
|
void setNumDaysBetweenVersionChecks(int days) {return settings->setValue(NUM_DAYS_BETWEEN_VERSION_CHECKS,days);}
|
||||||
|
bool getQuickNaviMode(){return settings->value(QUICK_NAVI_MODE).toBool();}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
|
|
||||||
GoToFlow::GoToFlow(QWidget *parent,FlowType flowType)
|
GoToFlow::GoToFlow(QWidget *parent,FlowType flowType)
|
||||||
:GoToFlowWidget(parent),ready(false)
|
:GoToFlowWidget(parent),ready(false)
|
||||||
{
|
{
|
||||||
updateTimer = new QTimer;
|
updateTimer = new QTimer;
|
||||||
connect(updateTimer, SIGNAL(timeout()), this, SLOT(updateImageData()));
|
connect(updateTimer, SIGNAL(timeout()), this, SLOT(updateImageData()));
|
||||||
@ -43,12 +43,12 @@ GoToFlow::GoToFlow(QWidget *parent,FlowType flowType)
|
|||||||
connect(flow,SIGNAL(selected(unsigned int)),this,SIGNAL(goToPage(unsigned int)));
|
connect(flow,SIGNAL(selected(unsigned int)),this,SIGNAL(goToPage(unsigned int)));
|
||||||
|
|
||||||
connect(toolBar,SIGNAL(goTo(unsigned int)),this,SIGNAL(goToPage(unsigned int)));
|
connect(toolBar,SIGNAL(goTo(unsigned int)),this,SIGNAL(goToPage(unsigned int)));
|
||||||
connect(toolBar,SIGNAL(setCenter(unsigned int)),flow,SLOT(showSlide(unsigned int)));
|
connect(toolBar,SIGNAL(setCenter(unsigned int)),flow,SLOT(showSlide(unsigned int)));
|
||||||
|
|
||||||
mainLayout->addWidget(flow);
|
mainLayout->addWidget(flow);
|
||||||
toolBar->raise();
|
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));
|
this->setCursor(QCursor(Qt::ArrowCursor));
|
||||||
}
|
}
|
||||||
@ -64,11 +64,11 @@ void GoToFlow::keyPressEvent(QKeyEvent *event)
|
|||||||
{
|
{
|
||||||
switch (event->key())
|
switch (event->key())
|
||||||
{
|
{
|
||||||
case Qt::Key_Left: case Qt::Key_Right: case Qt::Key_Up:
|
case Qt::Key_Left: case Qt::Key_Right: case Qt::Key_Up:
|
||||||
QApplication::sendEvent(flow,event);
|
QApplication::sendEvent(flow,event);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GoToFlowWidget::keyPressEvent(event);
|
GoToFlowWidget::keyPressEvent(event);
|
||||||
@ -76,10 +76,10 @@ void GoToFlow::keyPressEvent(QKeyEvent *event)
|
|||||||
|
|
||||||
void GoToFlow::resizeEvent(QResizeEvent *event)
|
void GoToFlow::resizeEvent(QResizeEvent *event)
|
||||||
{
|
{
|
||||||
QWidget::resizeEvent(event);
|
QWidget::resizeEvent(event);
|
||||||
|
|
||||||
toolBar->move(0, event->size().height() - toolBar->height());
|
toolBar->move(0, event->size().height() - toolBar->height());
|
||||||
toolBar->setFixedWidth(width());
|
toolBar->setFixedWidth(width());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -169,11 +169,11 @@ void GoToFlow::updateImageData()
|
|||||||
imagesLoaded[idx]=true;
|
imagesLoaded[idx]=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to load only few images on the left and right side
|
// try to load only few images on the left and right side
|
||||||
// i.e. all visible ones plus some extra
|
// i.e. all visible ones plus some extra
|
||||||
#define COUNT 8
|
#define COUNT 8
|
||||||
int indexes[2*COUNT+1];
|
int indexes[2*COUNT+1];
|
||||||
int center = flow->centerIndex();
|
int center = flow->centerIndex();
|
||||||
indexes[0] = center;
|
indexes[0] = center;
|
||||||
@ -181,7 +181,7 @@ void GoToFlow::updateImageData()
|
|||||||
{
|
{
|
||||||
indexes[j*2+1] = center+j+1;
|
indexes[j*2+1] = center+j+1;
|
||||||
indexes[j*2+2] = center-j-1;
|
indexes[j*2+2] = center-j-1;
|
||||||
}
|
}
|
||||||
for(int c = 0; c < 2*COUNT+1; c++)
|
for(int c = 0; c < 2*COUNT+1; c++)
|
||||||
{
|
{
|
||||||
int i = indexes[c];
|
int i = indexes[c];
|
||||||
@ -189,7 +189,7 @@ void GoToFlow::updateImageData()
|
|||||||
if(!imagesLoaded[i]&&imagesReady[i])//slide(i).isNull())
|
if(!imagesLoaded[i]&&imagesReady[i])//slide(i).isNull())
|
||||||
{
|
{
|
||||||
// schedule thumbnail generation
|
// schedule thumbnail generation
|
||||||
|
|
||||||
worker->generate(i, flow->slideSize(),rawImages[i]);
|
worker->generate(i, flow->slideSize(),rawImages[i]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -214,22 +214,26 @@ void GoToFlow::setFlowType(FlowType flowType)
|
|||||||
flow->setFlowType(flowType);
|
flow->setFlowType(flowType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GoToFlow::updateSize() //TODO : fix. it doesn't work.
|
|
||||||
{
|
|
||||||
imageSize = Configuration::getConfiguration().getGotoSlideSize();
|
|
||||||
flow->setSlideSize(imageSize);
|
|
||||||
resize(static_cast<int>(5*imageSize.width()),static_cast<int>(imageSize.height()*1.7));
|
|
||||||
}
|
|
||||||
|
|
||||||
void GoToFlow::updateConfig(QSettings * settings)
|
void GoToFlow::updateConfig(QSettings * settings)
|
||||||
{
|
{
|
||||||
Q_UNUSED(settings)
|
GoToFlowWidget::updateConfig(settings);
|
||||||
|
|
||||||
|
imageSize = Configuration::getConfiguration().getGotoSlideSize();
|
||||||
|
flow->setFlowType(Configuration::getConfiguration().getFlowType());
|
||||||
|
resize(5*imageSize.width(), toolBar->height() + imageSize.height()*1.7);
|
||||||
|
updateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GoToFlow::setFlowRightToLeft(bool b)
|
||||||
|
{
|
||||||
|
flow->setFlowRightToLeft(b);
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//SlideInitializer
|
//SlideInitializer
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
SlideInitializer::SlideInitializer(QMutex * m,PictureFlow * flow,int slides)
|
SlideInitializer::SlideInitializer(QMutex * m,PictureFlow * flow,int slides)
|
||||||
:QThread(),mutex(m),_flow(flow),_slides(slides)
|
:QThread(),mutex(m),_flow(flow),_slides(slides)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -249,8 +253,8 @@ void SlideInitializer::run()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
PageLoader::PageLoader(QMutex * m):
|
PageLoader::PageLoader(QMutex * m):
|
||||||
QThread(),mutex(m), restart(false), working(false), idx(-1)
|
QThread(),mutex(m), restart(false), working(false), idx(-1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +269,7 @@ PageLoader::~PageLoader()
|
|||||||
bool PageLoader::busy() const
|
bool PageLoader::busy() const
|
||||||
{
|
{
|
||||||
return isRunning() ? working : false;
|
return isRunning() ? working : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PageLoader::generate(int index, QSize size,const QByteArray & rImage)
|
void PageLoader::generate(int index, QSize size,const QByteArray & rImage)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -61,8 +61,9 @@ private slots:
|
|||||||
void setNumSlides(unsigned int slides);
|
void setNumSlides(unsigned int slides);
|
||||||
void setImageReady(int index,const QByteArray & image);
|
void setImageReady(int index,const QByteArray & image);
|
||||||
void setFlowType(FlowType flowType);
|
void setFlowType(FlowType flowType);
|
||||||
void updateSize();
|
|
||||||
void updateConfig(QSettings * settings);
|
void updateConfig(QSettings * settings);
|
||||||
|
void setFlowRightToLeft(bool b);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void goToPage(unsigned int page);
|
void goToPage(unsigned int page);
|
||||||
|
|
||||||
|
|||||||
@ -26,12 +26,12 @@ GoToFlowGL::GoToFlowGL(QWidget* parent, FlowType flowType)
|
|||||||
connect(flow,SIGNAL(selected(unsigned int)),this,SIGNAL(goToPage(unsigned int)));
|
connect(flow,SIGNAL(selected(unsigned int)),this,SIGNAL(goToPage(unsigned int)));
|
||||||
|
|
||||||
connect(toolBar,SIGNAL(goTo(unsigned int)),this,SIGNAL(goToPage(unsigned int)));
|
connect(toolBar,SIGNAL(goTo(unsigned int)),this,SIGNAL(goToPage(unsigned int)));
|
||||||
connect(toolBar,SIGNAL(setCenter(unsigned int)),flow,SLOT(setCenterIndex(unsigned int)));
|
connect(toolBar,SIGNAL(setCenter(unsigned int)),flow,SLOT(setCenterIndex(unsigned int)));
|
||||||
|
|
||||||
mainLayout->addWidget(flow);
|
mainLayout->addWidget(flow);
|
||||||
toolBar->raise();
|
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));
|
this->setCursor(QCursor(Qt::ArrowCursor));
|
||||||
}
|
}
|
||||||
@ -77,15 +77,11 @@ void GoToFlowGL::setImageReady(int index,const QByteArray & imageData)
|
|||||||
flow->imagesReady[index] = true;
|
flow->imagesReady[index] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GoToFlowGL::updateSize()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void GoToFlowGL::updateConfig(QSettings * settings)
|
void GoToFlowGL::updateConfig(QSettings * settings)
|
||||||
{
|
{
|
||||||
Performance performance = medium;
|
GoToFlowWidget::updateConfig(settings);
|
||||||
|
|
||||||
|
Performance performance = medium;
|
||||||
switch (settings->value(PERFORMANCE).toInt())
|
switch (settings->value(PERFORMANCE).toInt())
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@ -102,56 +98,56 @@ void GoToFlowGL::updateConfig(QSettings * settings)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
imageSize = Configuration::getConfiguration().getGotoSlideSize();
|
||||||
|
resize(5*imageSize.width(), toolBar->height() + imageSize.height()*1.7);
|
||||||
|
updateSize();
|
||||||
|
|
||||||
flow->setPerformance(performance);
|
flow->setPerformance(performance);
|
||||||
|
|
||||||
switch (settings->value(FLOW_TYPE_GL).toInt())
|
switch (settings->value(FLOW_TYPE_GL).toInt())
|
||||||
{
|
{
|
||||||
case 0:
|
case FlowType::CoverFlowLike:
|
||||||
flow->setPreset(presetYACReaderFlowClassicConfig);
|
flow->setPreset(presetYACReaderFlowClassicConfig);
|
||||||
return;
|
break;
|
||||||
case 1:
|
case FlowType::Strip:
|
||||||
flow->setPreset(presetYACReaderFlowStripeConfig);
|
flow->setPreset(presetYACReaderFlowStripeConfig);
|
||||||
return;
|
break;
|
||||||
case 2:
|
case FlowType::StripOverlapped:
|
||||||
flow->setPreset(presetYACReaderFlowOverlappedStripeConfig);
|
flow->setPreset(presetYACReaderFlowOverlappedStripeConfig);
|
||||||
return;
|
break;
|
||||||
case 3:
|
case FlowType::Modern:
|
||||||
flow->setPreset(defaultYACReaderFlowConfig);
|
flow->setPreset(defaultYACReaderFlowConfig);
|
||||||
return;
|
break;
|
||||||
case 4:
|
case FlowType::Roulette:
|
||||||
flow->setPreset(pressetYACReaderFlowDownConfig);
|
flow->setPreset(pressetYACReaderFlowDownConfig);
|
||||||
return;
|
break;
|
||||||
|
case FlowType::Custom:
|
||||||
|
flow->setCF_RX(settings->value(X_ROTATION).toInt());
|
||||||
|
flow->setCF_Y(settings->value(Y_POSITION).toInt());
|
||||||
|
flow->setX_Distance(settings->value(COVER_DISTANCE).toInt());
|
||||||
|
flow->setCenter_Distance(settings->value(CENTRAL_DISTANCE).toInt());
|
||||||
|
flow->setCF_Z(settings->value(ZOOM_LEVEL).toInt());
|
||||||
|
flow->setY_Distance(settings->value(Y_COVER_OFFSET).toInt());
|
||||||
|
flow->setZ_Distance(settings->value(Z_COVER_OFFSET).toInt());
|
||||||
|
flow->setRotation(settings->value(COVER_ROTATION).toInt());
|
||||||
|
flow->setFadeOutDist(settings->value(FADE_OUT_DIST).toInt());
|
||||||
|
flow->setLightStrenght(settings->value(LIGHT_STRENGTH).toInt());
|
||||||
|
flow->setMaxAngle(settings->value(MAX_ANGLE).toInt());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
if (Configuration::getConfiguration().getQuickNaviMode())
|
||||||
|
flow->setFadeOutDist(20);
|
||||||
//custom config
|
|
||||||
|
|
||||||
flow->setCF_RX(settings->value(X_ROTATION).toInt());
|
|
||||||
flow->setCF_Y(settings->value(Y_POSITION).toInt());
|
|
||||||
flow->setX_Distance(settings->value(COVER_DISTANCE).toInt());
|
|
||||||
flow->setCenter_Distance(settings->value(CENTRAL_DISTANCE).toInt());
|
|
||||||
flow->setCF_Z(settings->value(ZOOM_LEVEL).toInt());
|
|
||||||
flow->setY_Distance(settings->value(Y_COVER_OFFSET).toInt());
|
|
||||||
flow->setZ_Distance(settings->value(Z_COVER_OFFSET).toInt());
|
|
||||||
flow->setRotation(settings->value(COVER_ROTATION).toInt());
|
|
||||||
flow->setFadeOutDist(settings->value(FADE_OUT_DIST).toInt());
|
|
||||||
flow->setLightStrenght(settings->value(LIGHT_STRENGTH).toInt());
|
|
||||||
flow->setMaxAngle(settings->value(MAX_ANGLE).toInt());
|
|
||||||
|
|
||||||
/* flow->setVisibility(settings->value("visibilityDistance").toInt());
|
|
||||||
flow->setLightStrenght(settings->value("lightStrength").toInt())*/;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GoToFlowGL::keyPressEvent(QKeyEvent* event)
|
void GoToFlowGL::keyPressEvent(QKeyEvent* event)
|
||||||
{
|
{
|
||||||
switch (event->key())
|
switch (event->key())
|
||||||
{
|
{
|
||||||
case Qt::Key_Left: case Qt::Key_Right: case Qt::Key_Up:
|
case Qt::Key_Left: case Qt::Key_Right: case Qt::Key_Up:
|
||||||
QApplication::sendEvent(flow,event);
|
QApplication::sendEvent(flow,event);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GoToFlowWidget::keyPressEvent(event);
|
GoToFlowWidget::keyPressEvent(event);
|
||||||
@ -159,8 +155,13 @@ void GoToFlowGL::keyPressEvent(QKeyEvent* event)
|
|||||||
|
|
||||||
void GoToFlowGL::resizeEvent(QResizeEvent *event)
|
void GoToFlowGL::resizeEvent(QResizeEvent *event)
|
||||||
{
|
{
|
||||||
QWidget::resizeEvent(event);
|
QWidget::resizeEvent(event);
|
||||||
|
|
||||||
toolBar->move(0, event->size().height() - toolBar->height());
|
toolBar->move(0, event->size().height() - toolBar->height());
|
||||||
toolBar->setFixedWidth(width());
|
toolBar->setFixedWidth(width());
|
||||||
|
}
|
||||||
|
|
||||||
|
void GoToFlowGL::setFlowRightToLeft(bool b)
|
||||||
|
{
|
||||||
|
flow->setFlowRightToLeft(b);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,9 +23,9 @@ public:
|
|||||||
void setFlowType(FlowType flowType);
|
void setFlowType(FlowType flowType);
|
||||||
void setNumSlides(unsigned int slides);
|
void setNumSlides(unsigned int slides);
|
||||||
void setImageReady(int index,const QByteArray & image);
|
void setImageReady(int index,const QByteArray & image);
|
||||||
void updateSize();
|
|
||||||
|
|
||||||
void updateConfig(QSettings * settings);
|
void updateConfig(QSettings * settings);
|
||||||
|
void setFlowRightToLeft(bool b);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void goToPage(unsigned int page);
|
void goToPage(unsigned int page);
|
||||||
|
|||||||
@ -2,18 +2,43 @@
|
|||||||
|
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
|
|
||||||
|
#include "configuration.h"
|
||||||
|
|
||||||
GoToFlowToolBar::GoToFlowToolBar(QWidget * parent)
|
GoToFlowToolBar::GoToFlowToolBar(QWidget * parent)
|
||||||
:QWidget(parent)
|
:QStackedWidget(parent)
|
||||||
{
|
{
|
||||||
//elementos interactivos
|
//elementos interactivos
|
||||||
QVBoxLayout * mainLayout = new QVBoxLayout;
|
QWidget * normal = new QWidget(this); // container widget
|
||||||
bar = new QWidget(this);
|
QWidget * quickNavi = new QWidget(this); // container widget
|
||||||
QHBoxLayout * bottom = new QHBoxLayout(bar);
|
addWidget(normal);
|
||||||
bottom->addStretch();
|
addWidget(quickNavi);
|
||||||
bottom->addWidget(new QLabel("<b>" + tr("Page : ") + "</b>",bar));
|
QHBoxLayout * normalLayout = new QHBoxLayout(normal);
|
||||||
bottom->addWidget(edit = new QLineEdit(bar));
|
QHBoxLayout * naviLayout = new QHBoxLayout(quickNavi);
|
||||||
v = new QIntValidator(bar);
|
normal->setLayout(normalLayout);
|
||||||
|
quickNavi->setLayout(naviLayout);
|
||||||
|
|
||||||
|
slider = new QSlider(Qt::Horizontal,this);
|
||||||
|
slider->setStyleSheet(
|
||||||
|
"QSlider::groove:horizontal {"
|
||||||
|
" border: 1px solid #22FFFFFF;"
|
||||||
|
" border-radius: 1px;"
|
||||||
|
" background: #77000000;"
|
||||||
|
" margin: 2px 0;"
|
||||||
|
" padding: 1px;"
|
||||||
|
"}"
|
||||||
|
"QSlider::handle:horizontal {"
|
||||||
|
" background: #55FFFFFF;"
|
||||||
|
" width: 48px;"
|
||||||
|
" border-radius: 1px;"
|
||||||
|
"}"
|
||||||
|
);
|
||||||
|
|
||||||
|
connect(slider, &QSlider::valueChanged, this, [&](int v) { emit(setCenter(v)); });
|
||||||
|
|
||||||
|
pageHint = new QLabel("<b>" + tr("Page : ") + "</b>",this);
|
||||||
|
v = new QIntValidator(this);
|
||||||
v->setBottom(1);
|
v->setBottom(1);
|
||||||
|
edit = new QLineEdit(this);
|
||||||
edit->setValidator(v);
|
edit->setValidator(v);
|
||||||
edit->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
edit->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||||
edit->setStyleSheet("QLineEdit {border: 1px solid #77000000; background: #55000000; color: white; padding: 3px 5px 5px 5px; margin: 13px 5px 12px 5px; font-weight:bold}");
|
edit->setStyleSheet("QLineEdit {border: 1px solid #77000000; background: #55000000; color: white; padding: 3px 5px 5px 5px; margin: 13px 5px 12px 5px; font-weight:bold}");
|
||||||
@ -29,37 +54,39 @@ GoToFlowToolBar::GoToFlowToolBar(QWidget * parent)
|
|||||||
QString centerButtonCSS = "QPushButton {background-image: url(:/images/imgCenterSlide.png); width: 100%; height:100%; background-repeat: none; border: none;} "
|
QString centerButtonCSS = "QPushButton {background-image: url(:/images/imgCenterSlide.png); width: 100%; height:100%; background-repeat: none; border: none;} "
|
||||||
"QPushButton:focus { border: none; outline: none;}"
|
"QPushButton:focus { border: none; outline: none;}"
|
||||||
"QPushButton:pressed {background-image: url(:/images/imgCenterSlidePressed.png); width: 100%; height:100%; background-repeat: none; border: none;} ";
|
"QPushButton:pressed {background-image: url(:/images/imgCenterSlidePressed.png); width: 100%; height:100%; background-repeat: none; border: none;} ";
|
||||||
centerButton = new QPushButton(bar);
|
centerButton = new QPushButton(this);
|
||||||
//centerButton->setIcon(QIcon(":/images/center.png"));
|
//centerButton->setIcon(QIcon(":/images/center.png"));
|
||||||
centerButton->setStyleSheet(centerButtonCSS);
|
centerButton->setStyleSheet(centerButtonCSS);
|
||||||
centerButton->setFixedSize(26,50);
|
centerButton->setFixedSize(26,50);
|
||||||
centerButton->setAttribute(Qt::WA_LayoutUsesWidgetRect,true);
|
centerButton->setAttribute(Qt::WA_LayoutUsesWidgetRect,true);
|
||||||
connect(centerButton,SIGNAL(clicked()),this,SLOT(centerSlide()));
|
connect(centerButton,SIGNAL(clicked()),this,SLOT(centerSlide()));
|
||||||
bottom->addWidget(centerButton);
|
|
||||||
|
|
||||||
QString goToButtonCSS = "QPushButton {background-image: url(:/images/imgGoToSlide.png); width: 100%; height:100%; background-repeat: none; border: none;} "
|
QString goToButtonCSS = "QPushButton {background-image: url(:/images/imgGoToSlide.png); width: 100%; height:100%; background-repeat: none; border: none;} "
|
||||||
"QPushButton:focus { border: none; outline: none;}"
|
"QPushButton:focus { border: none; outline: none;}"
|
||||||
"QPushButton:pressed {background-image: url(:/images/imgGoToSlidePressed.png); width: 100%; height:100%; background-repeat: none; border: none;} ";
|
"QPushButton:pressed {background-image: url(:/images/imgGoToSlidePressed.png); width: 100%; height:100%; background-repeat: none; border: none;} ";
|
||||||
goToButton = new QPushButton(bar);
|
goToButton = new QPushButton(this);
|
||||||
//goToButton->setIcon(QIcon(":/images/goto.png"));
|
//goToButton->setIcon(QIcon(":/images/goto.png"));
|
||||||
goToButton->setStyleSheet(goToButtonCSS);
|
goToButton->setStyleSheet(goToButtonCSS);
|
||||||
goToButton->setFixedSize(32,50);
|
goToButton->setFixedSize(32,50);
|
||||||
goToButton->setAttribute(Qt::WA_LayoutUsesWidgetRect,true);
|
goToButton->setAttribute(Qt::WA_LayoutUsesWidgetRect,true);
|
||||||
|
|
||||||
connect(goToButton,SIGNAL(clicked()),this,SLOT(goTo()));
|
connect(goToButton,SIGNAL(clicked()),this,SLOT(goTo()));
|
||||||
bottom->addWidget(goToButton);
|
|
||||||
|
|
||||||
bottom->addStretch();
|
normalLayout->setMargin(0);
|
||||||
bottom->setMargin(0);
|
normalLayout->setSpacing(0);
|
||||||
bottom->setSpacing(0);
|
normalLayout->addStretch();
|
||||||
|
normalLayout->addWidget(pageHint);
|
||||||
bar->setLayout(bottom);
|
normalLayout->addWidget(edit);
|
||||||
|
normalLayout->addWidget(centerButton);
|
||||||
|
normalLayout->addWidget(goToButton);
|
||||||
|
normalLayout->addStretch();
|
||||||
|
|
||||||
mainLayout->setMargin(0);
|
naviLayout->setContentsMargins(5, 0, 0, 0);
|
||||||
mainLayout->setSpacing(0);
|
naviLayout->setSpacing(2);
|
||||||
mainLayout->addWidget(bar);
|
naviLayout->addWidget(slider);
|
||||||
|
naviLayout->addWidget(goToButton);
|
||||||
|
|
||||||
setLayout(mainLayout);
|
updateOptions();
|
||||||
|
|
||||||
setFixedHeight(50);
|
setFixedHeight(50);
|
||||||
}
|
}
|
||||||
@ -78,11 +105,13 @@ void GoToFlowToolBar::paintEvent(QPaintEvent *)
|
|||||||
void GoToFlowToolBar::setPage(int pageNumber)
|
void GoToFlowToolBar::setPage(int pageNumber)
|
||||||
{
|
{
|
||||||
edit->setText(QString::number(pageNumber+1));
|
edit->setText(QString::number(pageNumber+1));
|
||||||
|
slider->setValue(pageNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GoToFlowToolBar::setTop(int numPages)
|
void GoToFlowToolBar::setTop(int numPages)
|
||||||
{
|
{
|
||||||
v->setTop(numPages);
|
v->setTop(numPages);
|
||||||
|
slider->setMaximum(numPages-1); // min is 0
|
||||||
}
|
}
|
||||||
|
|
||||||
void GoToFlowToolBar::goTo()
|
void GoToFlowToolBar::goTo()
|
||||||
@ -94,5 +123,15 @@ void GoToFlowToolBar::goTo()
|
|||||||
void GoToFlowToolBar::centerSlide()
|
void GoToFlowToolBar::centerSlide()
|
||||||
{
|
{
|
||||||
if(edit->text().toInt()!=0)
|
if(edit->text().toInt()!=0)
|
||||||
emit(setCenter(edit->text().toInt()-1));
|
emit(setCenter(edit->text().toInt()-1));
|
||||||
|
}
|
||||||
|
|
||||||
|
void GoToFlowToolBar::updateOptions()
|
||||||
|
{
|
||||||
|
if (Configuration::getConfiguration().getQuickNaviMode())
|
||||||
|
setCurrentIndex(1);
|
||||||
|
else
|
||||||
|
setCurrentIndex(0);
|
||||||
|
|
||||||
|
slider->setInvertedAppearance(Configuration::getConfiguration().getDoubleMangaPage());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,29 +2,36 @@
|
|||||||
#define GOTO_FLOW_TOOLBAR_H
|
#define GOTO_FLOW_TOOLBAR_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QStackedWidget.h>
|
||||||
|
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QIntValidator;
|
class QIntValidator;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
|
class QSlider;
|
||||||
|
class QLabel;
|
||||||
|
|
||||||
class GoToFlowToolBar : public QWidget
|
class GoToFlowToolBar : public QStackedWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
QLineEdit * edit;
|
QLineEdit * edit;
|
||||||
|
QSlider * slider;
|
||||||
QIntValidator * v;
|
QIntValidator * v;
|
||||||
QPushButton * centerButton;
|
QPushButton * centerButton;
|
||||||
QPushButton * goToButton;
|
QPushButton * goToButton;
|
||||||
|
QLabel * pageHint;
|
||||||
QWidget * bar;
|
QWidget * bar;
|
||||||
void paintEvent(QPaintEvent *);
|
void paintEvent(QPaintEvent *);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GoToFlowToolBar(QWidget * parent = 0);
|
GoToFlowToolBar(QWidget * parent = 0);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setPage(int pageNumber);
|
void setPage(int pageNumber);
|
||||||
void setTop(int numPages);
|
void setTop(int numPages);
|
||||||
void goTo();
|
void goTo();
|
||||||
void centerSlide();
|
void centerSlide();
|
||||||
|
void updateOptions();
|
||||||
signals:
|
signals:
|
||||||
void setCenter(unsigned int);
|
void setCenter(unsigned int);
|
||||||
void goTo(unsigned int);
|
void goTo(unsigned int);
|
||||||
|
|||||||
@ -6,20 +6,17 @@
|
|||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
||||||
#include "goto_flow_toolbar.h"
|
#include "goto_flow_toolbar.h"
|
||||||
|
#include "configuration.h"
|
||||||
|
|
||||||
GoToFlowWidget::GoToFlowWidget(QWidget * parent)
|
GoToFlowWidget::GoToFlowWidget(QWidget * parent)
|
||||||
:QWidget(parent)
|
:QWidget(parent)
|
||||||
{
|
{
|
||||||
mainLayout = new QVBoxLayout;
|
mainLayout = new QVBoxLayout;
|
||||||
|
|
||||||
mainLayout->setMargin(0);
|
mainLayout->setMargin(0);
|
||||||
mainLayout->setSpacing(0);
|
mainLayout->setSpacing(0);
|
||||||
|
|
||||||
toolBar = new GoToFlowToolBar(this);
|
toolBar = new GoToFlowToolBar(this);
|
||||||
|
|
||||||
mainLayout->setMargin(0);
|
|
||||||
mainLayout->setSpacing(0);
|
|
||||||
|
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
//toolBar->installEventFilter(this);
|
//toolBar->installEventFilter(this);
|
||||||
@ -54,6 +51,21 @@ void GoToFlowWidget::keyPressEvent(QKeyEvent* event)
|
|||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GoToFlowWidget::updateConfig(QSettings * settings)
|
||||||
|
{
|
||||||
|
Q_UNUSED(settings)
|
||||||
|
toolBar->updateOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GoToFlowWidget::updateSize()
|
||||||
|
{
|
||||||
|
// called by parent in resizeEvent
|
||||||
|
// no need to update width when QuickNaviMode disabled
|
||||||
|
// height is set in updateConfig
|
||||||
|
if (Configuration::getConfiguration().getQuickNaviMode() && parentWidget() != nullptr)
|
||||||
|
resize(parentWidget()->width(),height());
|
||||||
|
}
|
||||||
|
|
||||||
/*bool GoToFlowWidget::eventFilter(QObject * target, QEvent * event)
|
/*bool GoToFlowWidget::eventFilter(QObject * target, QEvent * event)
|
||||||
{
|
{
|
||||||
if(event->type() == QEvent::KeyPress)
|
if(event->type() == QEvent::KeyPress)
|
||||||
|
|||||||
@ -27,8 +27,9 @@ public slots:
|
|||||||
virtual void setFlowType(FlowType flowType) = 0;
|
virtual void setFlowType(FlowType flowType) = 0;
|
||||||
virtual void setNumSlides(unsigned int slides) = 0;
|
virtual void setNumSlides(unsigned int slides) = 0;
|
||||||
virtual void setImageReady(int index,const QByteArray & image) = 0;
|
virtual void setImageReady(int index,const QByteArray & image) = 0;
|
||||||
virtual void updateSize() = 0;
|
virtual void updateSize();
|
||||||
virtual void updateConfig(QSettings * settings) = 0;
|
virtual void updateConfig(QSettings * settings);
|
||||||
|
virtual void setFlowRightToLeft(bool b) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void keyPressEvent(QKeyEvent* event);
|
void keyPressEvent(QKeyEvent* event);
|
||||||
|
|||||||
@ -169,5 +169,13 @@ int main(int argc, char * argv[])
|
|||||||
|
|
||||||
YACReader::exitCheck(ret);
|
YACReader::exitCheck(ret);
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
// ugly workaround to avoid crash when app exit on MacOS Sierra due to Qt's QColorDialog bug.
|
||||||
|
// cf. https://bugreports.qt.io/browse/QTBUG-56448
|
||||||
|
QColorDialog colorDlg(0);
|
||||||
|
colorDlg.setOption(QColorDialog::NoButtons);
|
||||||
|
colorDlg.setCurrentColor(Qt::white);
|
||||||
|
#endif
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -189,6 +189,10 @@ void MainWindowViewer::setupUI()
|
|||||||
// setWindowFlags(this->windowFlags() | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint);
|
// setWindowFlags(this->windowFlags() | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
previousWindowFlags = windowFlags();
|
||||||
|
previousPos = pos();
|
||||||
|
previousSize = size();
|
||||||
|
|
||||||
if(fullscreen)
|
if(fullscreen)
|
||||||
toFullScreen();
|
toFullScreen();
|
||||||
if(conf.getMaximized())
|
if(conf.getMaximized())
|
||||||
@ -651,13 +655,68 @@ void MainWindowViewer::createToolBars()
|
|||||||
fileMenu->addAction(openFolderAction);
|
fileMenu->addAction(openFolderAction);
|
||||||
fileMenu->addSeparator();
|
fileMenu->addSeparator();
|
||||||
fileMenu->addAction(saveImageAction);
|
fileMenu->addAction(saveImageAction);
|
||||||
|
fileMenu->addSeparator();
|
||||||
|
|
||||||
|
QMenu * recentmenu = new QMenu(tr("Open recent"));
|
||||||
|
recentmenu->addActions(recentFilesActionList);
|
||||||
|
recentmenu->addSeparator();
|
||||||
|
recentmenu->addAction(clearRecentFilesAction);
|
||||||
|
refreshRecentFilesActionList();
|
||||||
|
fileMenu->addMenu(recentmenu);
|
||||||
|
|
||||||
|
fileMenu->addSeparator();
|
||||||
|
fileMenu->addAction(closeAction);
|
||||||
|
|
||||||
|
QMenu * editMenu = new QMenu(tr("Edit"));
|
||||||
|
editMenu->addAction(leftRotationAction);
|
||||||
|
editMenu->addAction(rightRotationAction);
|
||||||
|
|
||||||
|
QMenu * viewMenu = new QMenu(tr("View"));
|
||||||
|
viewMenu->addAction(adjustHeightAction);
|
||||||
|
viewMenu->addAction(adjustWidthAction);
|
||||||
|
viewMenu->addAction(fitToPageAction);
|
||||||
|
viewMenu->addAction(adjustToFullSizeAction);
|
||||||
|
viewMenu->addSeparator();
|
||||||
|
viewMenu->addAction(increasePageZoomAction);
|
||||||
|
viewMenu->addAction(decreasePageZoomAction);
|
||||||
|
viewMenu->addAction(resetZoomAction);
|
||||||
|
viewMenu->addAction(showZoomSliderlAction);
|
||||||
|
viewMenu->addSeparator();
|
||||||
|
viewMenu->addAction(doublePageAction);
|
||||||
|
viewMenu->addAction(doubleMangaPageAction);
|
||||||
|
viewMenu->addSeparator();
|
||||||
|
viewMenu->addAction(showMagnifyingGlassAction);
|
||||||
|
|
||||||
|
QMenu * goMenu = new QMenu(tr("Go"));
|
||||||
|
goMenu->addAction(prevAction);
|
||||||
|
goMenu->addAction(nextAction);
|
||||||
|
goMenu->addAction(goToPageAction);
|
||||||
|
goMenu->addSeparator();
|
||||||
|
goMenu->addAction(setBookmarkAction);
|
||||||
|
goMenu->addAction(showBookmarksAction);
|
||||||
|
|
||||||
|
QMenu * windowMenu = new QMenu(tr("Window"));
|
||||||
|
windowMenu->addAction(optionsAction); // this action goes to MacOS's Preference menu by Qt
|
||||||
|
windowMenu->addAction(showShorcutsAction);
|
||||||
|
windowMenu->addAction(showFlowAction);
|
||||||
|
windowMenu->addAction(showInfoAction);
|
||||||
|
windowMenu->addAction(showDictionaryAction);
|
||||||
|
|
||||||
|
QMenu * helpMenu = new QMenu(tr("Help"));
|
||||||
|
helpMenu->addAction(helpAboutAction);
|
||||||
|
|
||||||
|
menuBar->addMenu(fileMenu);
|
||||||
|
menuBar->addMenu(editMenu);
|
||||||
|
menuBar->addMenu(viewMenu);
|
||||||
|
menuBar->addMenu(goMenu);
|
||||||
|
menuBar->addMenu(windowMenu);
|
||||||
|
menuBar->addMenu(helpMenu);
|
||||||
|
|
||||||
//tool bar
|
//tool bar
|
||||||
//QMenu * toolbarMenu = new QMenu(tr("Toolbar"));
|
//QMenu * toolbarMenu = new QMenu(tr("Toolbar"));
|
||||||
//toolbarMenu->addAction();
|
//toolbarMenu->addAction();
|
||||||
//TODO
|
//TODO
|
||||||
|
|
||||||
menuBar->addMenu(fileMenu);
|
|
||||||
//menu->addMenu(toolbarMenu);
|
//menu->addMenu(toolbarMenu);
|
||||||
|
|
||||||
//attach toolbar
|
//attach toolbar
|
||||||
@ -922,6 +981,11 @@ void MainWindowViewer::enableActions()
|
|||||||
showInfoAction->setDisabled(false); //TODO enable goTo and showInfo (or update) when numPages emited
|
showInfoAction->setDisabled(false); //TODO enable goTo and showInfo (or update) when numPages emited
|
||||||
showDictionaryAction->setDisabled(false);
|
showDictionaryAction->setDisabled(false);
|
||||||
showFlowAction->setDisabled(false);
|
showFlowAction->setDisabled(false);
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
activateWindow();
|
||||||
|
raise();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void MainWindowViewer::disableActions()
|
void MainWindowViewer::disableActions()
|
||||||
{
|
{
|
||||||
@ -1000,6 +1064,57 @@ void MainWindowViewer::toggleFullScreen()
|
|||||||
Configuration::getConfiguration().setFullScreen(fullscreen = !fullscreen);
|
Configuration::getConfiguration().setFullScreen(fullscreen = !fullscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN //fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309
|
||||||
|
|
||||||
|
void MainWindowViewer::toFullScreen()
|
||||||
|
{
|
||||||
|
fromMaximized = this->isMaximized();
|
||||||
|
|
||||||
|
hideToolBars();
|
||||||
|
viewer->hide();
|
||||||
|
viewer->fullscreen = true;//TODO, change by the right use of windowState();
|
||||||
|
|
||||||
|
previousWindowFlags = windowFlags();
|
||||||
|
previousPos = pos();
|
||||||
|
previousSize = size();
|
||||||
|
|
||||||
|
showNormal();
|
||||||
|
setWindowFlags(previousWindowFlags | Qt::FramelessWindowHint);
|
||||||
|
|
||||||
|
const QRect r = windowHandle()->screen()->geometry();
|
||||||
|
|
||||||
|
move(r.x(), r.y());
|
||||||
|
resize(r.width(),r.height()+1);
|
||||||
|
show();
|
||||||
|
|
||||||
|
viewer->show();
|
||||||
|
if(viewer->magnifyingGlassIsVisible())
|
||||||
|
viewer->showMagnifyingGlass();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindowViewer::toNormal()
|
||||||
|
{
|
||||||
|
//show all
|
||||||
|
viewer->hide();
|
||||||
|
viewer->fullscreen = false;//TODO, change by the right use of windowState();
|
||||||
|
//viewer->hideMagnifyingGlass();
|
||||||
|
|
||||||
|
setWindowFlags(previousWindowFlags);
|
||||||
|
move(previousPos);
|
||||||
|
resize(previousSize);
|
||||||
|
show();
|
||||||
|
|
||||||
|
if(fromMaximized)
|
||||||
|
showMaximized();
|
||||||
|
|
||||||
|
if(Configuration::getConfiguration().getShowToolbars())
|
||||||
|
showToolBars();
|
||||||
|
viewer->show();
|
||||||
|
if(viewer->magnifyingGlassIsVisible())
|
||||||
|
viewer->showMagnifyingGlass();
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
void MainWindowViewer::toFullScreen()
|
void MainWindowViewer::toFullScreen()
|
||||||
{
|
{
|
||||||
fromMaximized = this->isMaximized();
|
fromMaximized = this->isMaximized();
|
||||||
@ -1030,6 +1145,7 @@ void MainWindowViewer::toNormal()
|
|||||||
if(viewer->magnifyingGlassIsVisible())
|
if(viewer->magnifyingGlassIsVisible())
|
||||||
viewer->showMagnifyingGlass();
|
viewer->showMagnifyingGlass();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void MainWindowViewer::toggleToolBars()
|
void MainWindowViewer::toggleToolBars()
|
||||||
{
|
{
|
||||||
@ -1218,6 +1334,22 @@ void MainWindowViewer::setUpShortcutsManagement()
|
|||||||
autoScrollBackwardAction->setData(AUTO_SCROLL_BACKWARD_ACTION_Y);
|
autoScrollBackwardAction->setData(AUTO_SCROLL_BACKWARD_ACTION_Y);
|
||||||
autoScrollBackwardAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_BACKWARD_ACTION_Y));
|
autoScrollBackwardAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_BACKWARD_ACTION_Y));
|
||||||
|
|
||||||
|
QAction * autoScrollForwardHorizontalFirstAction = new QAction(tr("Autoscroll forward, horizontal first"),orphanActions);
|
||||||
|
autoScrollForwardHorizontalFirstAction->setData(AUTO_SCROLL_FORWARD_HORIZONTAL_FIRST_ACTION_Y);
|
||||||
|
autoScrollForwardHorizontalFirstAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_FORWARD_HORIZONTAL_FIRST_ACTION_Y));
|
||||||
|
|
||||||
|
QAction * autoScrollBackwardHorizontalFirstAction = new QAction(tr("Autoscroll backward, horizontal first"),orphanActions);
|
||||||
|
autoScrollBackwardHorizontalFirstAction->setData(AUTO_SCROLL_BACKWARD_HORIZONTAL_FIRST_ACTION_Y);
|
||||||
|
autoScrollBackwardHorizontalFirstAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_BACKWARD_HORIZONTAL_FIRST_ACTION_Y));
|
||||||
|
|
||||||
|
QAction * autoScrollForwardVerticalFirstAction = new QAction(tr("Autoscroll forward, vertical first"),orphanActions);
|
||||||
|
autoScrollForwardVerticalFirstAction->setData(AUTO_SCROLL_FORWARD_VERTICAL_FIRST_ACTION_Y);
|
||||||
|
autoScrollForwardVerticalFirstAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_FORWARD_VERTICAL_FIRST_ACTION_Y));
|
||||||
|
|
||||||
|
QAction * autoScrollBackwardVerticalFirstAction = new QAction(tr("Autoscroll backward, vertical first"),orphanActions);
|
||||||
|
autoScrollBackwardVerticalFirstAction->setData(AUTO_SCROLL_BACKWARD_VERTICAL_FIRST_ACTION_Y);
|
||||||
|
autoScrollBackwardVerticalFirstAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_BACKWARD_VERTICAL_FIRST_ACTION_Y));
|
||||||
|
|
||||||
QAction * moveDownAction = new QAction(tr("Move down"),orphanActions);
|
QAction * moveDownAction = new QAction(tr("Move down"),orphanActions);
|
||||||
moveDownAction->setData(MOVE_DOWN_ACTION_Y);
|
moveDownAction->setData(MOVE_DOWN_ACTION_Y);
|
||||||
moveDownAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(MOVE_DOWN_ACTION_Y));
|
moveDownAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(MOVE_DOWN_ACTION_Y));
|
||||||
@ -1250,6 +1382,10 @@ void MainWindowViewer::setUpShortcutsManagement()
|
|||||||
<< showBookmarksAction
|
<< showBookmarksAction
|
||||||
<< autoScrollForwardAction
|
<< autoScrollForwardAction
|
||||||
<< autoScrollBackwardAction
|
<< autoScrollBackwardAction
|
||||||
|
<< autoScrollForwardHorizontalFirstAction
|
||||||
|
<< autoScrollBackwardHorizontalFirstAction
|
||||||
|
<< autoScrollForwardVerticalFirstAction
|
||||||
|
<< autoScrollBackwardVerticalFirstAction
|
||||||
<< moveDownAction
|
<< moveDownAction
|
||||||
<< moveUpAction
|
<< moveUpAction
|
||||||
<< moveLeftAction
|
<< moveLeftAction
|
||||||
|
|||||||
@ -167,6 +167,11 @@ class EditShortcutsDialog;
|
|||||||
bool isClient;
|
bool isClient;
|
||||||
QString startComicPath;
|
QString startComicPath;
|
||||||
quint64 libraryId;
|
quint64 libraryId;
|
||||||
|
|
||||||
|
//fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309
|
||||||
|
Qt::WindowFlags previousWindowFlags;
|
||||||
|
QPoint previousPos;
|
||||||
|
QSize previousSize;
|
||||||
signals:
|
signals:
|
||||||
void closed();
|
void closed();
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
OptionsDialog::OptionsDialog(QWidget * parent)
|
OptionsDialog::OptionsDialog(QWidget * parent)
|
||||||
:YACReaderOptionsDialog(parent)
|
:YACReaderOptionsDialog(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
QTabWidget * tabWidget = new QTabWidget();
|
QTabWidget * tabWidget = new QTabWidget();
|
||||||
@ -49,7 +49,7 @@ OptionsDialog::OptionsDialog(QWidget * parent)
|
|||||||
|
|
||||||
QHBoxLayout * path = new QHBoxLayout();
|
QHBoxLayout * path = new QHBoxLayout();
|
||||||
path->addWidget(pathEdit = new QLineEdit());
|
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);
|
pathBox->setLayout(path);
|
||||||
|
|
||||||
connect(pathFindButton,SIGNAL(clicked()),this,SLOT(findFolder()));
|
connect(pathFindButton,SIGNAL(clicked()),this,SLOT(findFolder()));
|
||||||
@ -91,7 +91,7 @@ OptionsDialog::OptionsDialog(QWidget * parent)
|
|||||||
//brightnessS->setText(tr("Brightness"));
|
//brightnessS->setText(tr("Brightness"));
|
||||||
brightnessS->setTracking(false);
|
brightnessS->setTracking(false);
|
||||||
connect(brightnessS,SIGNAL(valueChanged(int)),this,SLOT(brightnessChanged(int)));
|
connect(brightnessS,SIGNAL(valueChanged(int)),this,SLOT(brightnessChanged(int)));
|
||||||
|
|
||||||
contrastS = new YACReaderSpinSliderWidget(this,true);
|
contrastS = new YACReaderSpinSliderWidget(this,true);
|
||||||
contrastS->setRange(0,250);
|
contrastS->setRange(0,250);
|
||||||
//contrastS->setText(tr("Contrast"));
|
//contrastS->setText(tr("Contrast"));
|
||||||
@ -104,6 +104,8 @@ OptionsDialog::OptionsDialog(QWidget * parent)
|
|||||||
gammaS->setTracking(false);
|
gammaS->setTracking(false);
|
||||||
connect(gammaS,SIGNAL(valueChanged(int)),this,SLOT(gammaChanged(int)));
|
connect(gammaS,SIGNAL(valueChanged(int)),this,SLOT(gammaChanged(int)));
|
||||||
//connect(brightnessS,SIGNAL(valueChanged(int)),this,SIGNAL(changedOptions()));
|
//connect(brightnessS,SIGNAL(valueChanged(int)),this,SIGNAL(changedOptions()));
|
||||||
|
|
||||||
|
quickNavi = new QCheckBox(tr("Quick Navigation Mode"));
|
||||||
|
|
||||||
QHBoxLayout * buttons = new QHBoxLayout();
|
QHBoxLayout * buttons = new QHBoxLayout();
|
||||||
buttons->addStretch();
|
buttons->addStretch();
|
||||||
@ -115,13 +117,14 @@ OptionsDialog::OptionsDialog(QWidget * parent)
|
|||||||
layoutGeneral->addWidget(slideSizeBox);
|
layoutGeneral->addWidget(slideSizeBox);
|
||||||
//layoutGeneral->addWidget(fitBox);
|
//layoutGeneral->addWidget(fitBox);
|
||||||
layoutGeneral->addWidget(colorBox);
|
layoutGeneral->addWidget(colorBox);
|
||||||
layoutGeneral->addWidget(shortcutsBox);
|
layoutGeneral->addWidget(shortcutsBox);
|
||||||
layoutGeneral->addStretch();
|
layoutGeneral->addStretch();
|
||||||
layoutFlow->addWidget(sw);
|
layoutFlow->addWidget(sw);
|
||||||
#ifndef NO_OPENGL
|
#ifndef NO_OPENGL
|
||||||
layoutFlow->addWidget(gl);
|
layoutFlow->addWidget(gl);
|
||||||
layoutFlow->addWidget(useGL);
|
layoutFlow->addWidget(useGL);
|
||||||
#endif
|
#endif
|
||||||
|
layoutFlow->addWidget(quickNavi);
|
||||||
layoutFlow->addStretch();
|
layoutFlow->addStretch();
|
||||||
layoutImage->addWidget(new QLabel(tr("Brightness")),0,0);
|
layoutImage->addWidget(new QLabel(tr("Brightness")),0,0);
|
||||||
layoutImage->addWidget(new QLabel(tr("Contrast")),1,0);
|
layoutImage->addWidget(new QLabel(tr("Contrast")),1,0);
|
||||||
@ -177,7 +180,7 @@ void OptionsDialog::findFolder()
|
|||||||
|
|
||||||
void OptionsDialog::saveOptions()
|
void OptionsDialog::saveOptions()
|
||||||
{
|
{
|
||||||
|
|
||||||
settings->setValue(GO_TO_FLOW_SIZE,QSize(static_cast<int>(slideSize->sliderPosition()/SLIDE_ASPECT_RATIO),slideSize->sliderPosition()));
|
settings->setValue(GO_TO_FLOW_SIZE,QSize(static_cast<int>(slideSize->sliderPosition()/SLIDE_ASPECT_RATIO),slideSize->sliderPosition()));
|
||||||
|
|
||||||
if(sw->radio1->isChecked())
|
if(sw->radio1->isChecked())
|
||||||
@ -191,6 +194,7 @@ void OptionsDialog::saveOptions()
|
|||||||
|
|
||||||
settings->setValue(BACKGROUND_COLOR,colorDialog->currentColor());
|
settings->setValue(BACKGROUND_COLOR,colorDialog->currentColor());
|
||||||
//settings->setValue(FIT_TO_WIDTH_RATIO,fitToWidthRatioS->sliderPosition()/100.0);
|
//settings->setValue(FIT_TO_WIDTH_RATIO,fitToWidthRatioS->sliderPosition()/100.0);
|
||||||
|
settings->setValue(QUICK_NAVI_MODE,quickNavi->isChecked());
|
||||||
|
|
||||||
YACReaderOptionsDialog::saveOptions();
|
YACReaderOptionsDialog::saveOptions();
|
||||||
}
|
}
|
||||||
@ -198,22 +202,22 @@ void OptionsDialog::saveOptions()
|
|||||||
void OptionsDialog::restoreOptions(QSettings * settings)
|
void OptionsDialog::restoreOptions(QSettings * settings)
|
||||||
{
|
{
|
||||||
YACReaderOptionsDialog::restoreOptions(settings);
|
YACReaderOptionsDialog::restoreOptions(settings);
|
||||||
|
|
||||||
slideSize->setSliderPosition(settings->value(GO_TO_FLOW_SIZE).toSize().height());
|
slideSize->setSliderPosition(settings->value(GO_TO_FLOW_SIZE).toSize().height());
|
||||||
switch(settings->value(FLOW_TYPE_SW).toInt())
|
switch(settings->value(FLOW_TYPE_SW).toInt())
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
sw->radio1->setChecked(true);
|
sw->radio1->setChecked(true);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
sw->radio2->setChecked(true);
|
sw->radio2->setChecked(true);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
sw->radio3->setChecked(true);
|
sw->radio3->setChecked(true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sw->radio1->setChecked(true);
|
sw->radio1->setChecked(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pathEdit->setText(settings->value(PATH).toString());
|
pathEdit->setText(settings->value(PATH).toString());
|
||||||
@ -221,6 +225,8 @@ void OptionsDialog::restoreOptions(QSettings * settings)
|
|||||||
updateColor(settings->value(BACKGROUND_COLOR).value<QColor>());
|
updateColor(settings->value(BACKGROUND_COLOR).value<QColor>());
|
||||||
//fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100);
|
//fitToWidthRatioS->setSliderPosition(settings->value(FIT_TO_WIDTH_RATIO).toFloat()*100);
|
||||||
|
|
||||||
|
quickNavi->setChecked(settings->value(QUICK_NAVI_MODE).toBool());
|
||||||
|
|
||||||
brightnessS->setValue(settings->value(BRIGHTNESS,0).toInt());
|
brightnessS->setValue(settings->value(BRIGHTNESS,0).toInt());
|
||||||
contrastS->setValue(settings->value(CONTRAST,100).toInt());
|
contrastS->setValue(settings->value(CONTRAST,100).toInt());
|
||||||
gammaS->setValue(settings->value(GAMMA,100).toInt());
|
gammaS->setValue(settings->value(GAMMA,100).toInt());
|
||||||
@ -234,7 +240,7 @@ void OptionsDialog::updateColor(const QColor & color)
|
|||||||
backgroundColor->setPalette(pal);
|
backgroundColor->setPalette(pal);
|
||||||
backgroundColor->setAutoFillBackground(true);
|
backgroundColor->setAutoFillBackground(true);
|
||||||
colorDialog->setCurrentColor(color);
|
colorDialog->setCurrentColor(color);
|
||||||
|
|
||||||
settings->setValue(BACKGROUND_COLOR,color);
|
settings->setValue(BACKGROUND_COLOR,color);
|
||||||
|
|
||||||
emit(changedOptions());
|
emit(changedOptions());
|
||||||
|
|||||||
@ -23,6 +23,7 @@ Q_OBJECT
|
|||||||
//QLabel * pathLabel;
|
//QLabel * pathLabel;
|
||||||
QLineEdit * pathEdit;
|
QLineEdit * pathEdit;
|
||||||
QPushButton * pathFindButton;
|
QPushButton * pathFindButton;
|
||||||
|
QCheckBox * quickNavi;
|
||||||
|
|
||||||
QLabel * magGlassSizeLabel;
|
QLabel * magGlassSizeLabel;
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
#include "goto_flow_gl.h"
|
#include "goto_flow_gl.h"
|
||||||
#else
|
#else
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
#include "bookmarks_dialog.h"
|
#include "bookmarks_dialog.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
#include "goto_dialog.h"
|
#include "goto_dialog.h"
|
||||||
@ -23,21 +23,21 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
Viewer::Viewer(QWidget * parent)
|
Viewer::Viewer(QWidget * parent)
|
||||||
:QScrollArea(parent),
|
:QScrollArea(parent),
|
||||||
currentPage(0),
|
currentPage(0),
|
||||||
magnifyingGlassShowed(false),
|
magnifyingGlassShowed(false),
|
||||||
fullscreen(false),
|
fullscreen(false),
|
||||||
information(false),
|
information(false),
|
||||||
doublePage(false),
|
doublePage(false),
|
||||||
doubleMangaPage(false),
|
doubleMangaPage(false),
|
||||||
wheelStop(false),
|
wheelStop(false),
|
||||||
direction(1),
|
direction(1),
|
||||||
restoreMagnifyingGlass(false),
|
restoreMagnifyingGlass(false),
|
||||||
drag(false),
|
drag(false),
|
||||||
numScrollSteps(22),
|
numScrollSteps(22),
|
||||||
shouldOpenNext(false),
|
shouldOpenNext(false),
|
||||||
shouldOpenPrevious(false),
|
shouldOpenPrevious(false),
|
||||||
zoom(100)
|
zoom(100)
|
||||||
{
|
{
|
||||||
translator = new YACReaderTranslator(this);
|
translator = new YACReaderTranslator(this);
|
||||||
translator->hide();
|
translator->hide();
|
||||||
@ -68,25 +68,25 @@ zoom(100)
|
|||||||
showCursor();
|
showCursor();
|
||||||
|
|
||||||
goToDialog = new GoToDialog(this);
|
goToDialog = new GoToDialog(this);
|
||||||
|
|
||||||
QSettings * settings = new QSettings(YACReader::getSettingsPath()+"/YACReader.ini",QSettings::IniFormat);
|
QSettings * settings = new QSettings(YACReader::getSettingsPath()+"/YACReader.ini",QSettings::IniFormat);
|
||||||
|
|
||||||
//CONFIG GOTO_FLOW--------------------------------------------------------
|
//CONFIG GOTO_FLOW--------------------------------------------------------
|
||||||
#ifndef NO_OPENGL
|
#ifndef NO_OPENGL
|
||||||
|
|
||||||
OpenGLChecker openGLChecker;
|
OpenGLChecker openGLChecker;
|
||||||
bool openGLAvailable = openGLChecker.hasCompatibleOpenGLVersion();
|
bool openGLAvailable = openGLChecker.hasCompatibleOpenGLVersion();
|
||||||
|
|
||||||
if(openGLAvailable && !settings->contains(USE_OPEN_GL))
|
if(openGLAvailable && !settings->contains(USE_OPEN_GL))
|
||||||
settings->setValue(USE_OPEN_GL,2);
|
settings->setValue(USE_OPEN_GL,2);
|
||||||
else
|
else
|
||||||
if(!openGLAvailable)
|
if(!openGLAvailable)
|
||||||
settings->setValue(USE_OPEN_GL,0);
|
settings->setValue(USE_OPEN_GL,0);
|
||||||
|
|
||||||
if((settings->value(USE_OPEN_GL).toBool() == true))
|
if((settings->value(USE_OPEN_GL).toBool() == true))
|
||||||
goToFlow = new GoToFlowGL(this,Configuration::getConfiguration().getFlowType());
|
goToFlow = new GoToFlowGL(this,Configuration::getConfiguration().getFlowType());
|
||||||
else
|
else
|
||||||
goToFlow = new GoToFlow(this,Configuration::getConfiguration().getFlowType());
|
goToFlow = new GoToFlow(this,Configuration::getConfiguration().getFlowType());
|
||||||
#else
|
#else
|
||||||
goToFlow = new GoToFlow(this,Configuration::getConfiguration().getFlowType());
|
goToFlow = new GoToFlow(this,Configuration::getConfiguration().getFlowType());
|
||||||
#endif
|
#endif
|
||||||
@ -94,17 +94,17 @@ zoom(100)
|
|||||||
goToFlow->hide();
|
goToFlow->hide();
|
||||||
showGoToFlowAnimation = new QPropertyAnimation(goToFlow,"pos");
|
showGoToFlowAnimation = new QPropertyAnimation(goToFlow,"pos");
|
||||||
showGoToFlowAnimation->setDuration(150);
|
showGoToFlowAnimation->setDuration(150);
|
||||||
|
|
||||||
bd = new BookmarksDialog(this->parentWidget());
|
bd = new BookmarksDialog(this->parentWidget());
|
||||||
|
|
||||||
render = new Render();
|
render = new Render();
|
||||||
|
|
||||||
hideCursorTimer = new QTimer();
|
hideCursorTimer = new QTimer();
|
||||||
hideCursorTimer->setSingleShot(true);
|
hideCursorTimer->setSingleShot(true);
|
||||||
|
|
||||||
if(Configuration::getConfiguration().getDoublePage())
|
if(Configuration::getConfiguration().getDoublePage())
|
||||||
doublePageSwitch();
|
doublePageSwitch();
|
||||||
|
|
||||||
if(Configuration::getConfiguration().getDoubleMangaPage())
|
if(Configuration::getConfiguration().getDoubleMangaPage())
|
||||||
doubleMangaPageSwitch();
|
doubleMangaPageSwitch();
|
||||||
|
|
||||||
@ -117,6 +117,11 @@ zoom(100)
|
|||||||
//animations
|
//animations
|
||||||
verticalScroller = new QPropertyAnimation(verticalScrollBar(), "sliderPosition");
|
verticalScroller = new QPropertyAnimation(verticalScrollBar(), "sliderPosition");
|
||||||
connect(verticalScroller,SIGNAL(valueChanged (const QVariant &)),this,SIGNAL(backgroundChanges()));
|
connect(verticalScroller,SIGNAL(valueChanged (const QVariant &)),this,SIGNAL(backgroundChanges()));
|
||||||
|
horizontalScroller = new QPropertyAnimation(horizontalScrollBar(), "sliderPosition");
|
||||||
|
connect(horizontalScroller,SIGNAL(valueChanged (const QVariant &)),this,SIGNAL(backgroundChanges()));
|
||||||
|
groupScroller = new QParallelAnimationGroup();
|
||||||
|
groupScroller->addAnimation(verticalScroller);
|
||||||
|
groupScroller->addAnimation(horizontalScroller);
|
||||||
|
|
||||||
notificationsLabel = new NotificationsLabelWidget(this);
|
notificationsLabel = new NotificationsLabelWidget(this);
|
||||||
notificationsLabel->hide();
|
notificationsLabel->hide();
|
||||||
@ -136,6 +141,8 @@ Viewer::~Viewer()
|
|||||||
delete hideCursorTimer;
|
delete hideCursorTimer;
|
||||||
delete informationLabel;
|
delete informationLabel;
|
||||||
delete verticalScroller;
|
delete verticalScroller;
|
||||||
|
delete horizontalScroller;
|
||||||
|
delete groupScroller;
|
||||||
delete bd;
|
delete bd;
|
||||||
delete notificationsLabel;
|
delete notificationsLabel;
|
||||||
delete mglass;
|
delete mglass;
|
||||||
@ -224,13 +231,13 @@ void Viewer::open(QString pathFile, const ComicDB & comic)
|
|||||||
|
|
||||||
void Viewer::showMessageErrorOpening()
|
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
|
//resetContent(); --> not needed
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::showMessageErrorOpening(QString message)
|
void Viewer::showMessageErrorOpening(QString message)
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this,tr("Error opening comic"),message);
|
QMessageBox::critical(this,tr("Error opening comic"),message);
|
||||||
resetContent();
|
resetContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,7 +270,7 @@ void Viewer::prev()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
render->previousPage();
|
render->previousPage();
|
||||||
}
|
}
|
||||||
updateInformation();
|
updateInformation();
|
||||||
shouldOpenNext = false;
|
shouldOpenNext = false;
|
||||||
@ -330,32 +337,32 @@ void Viewer::updateContentSize()
|
|||||||
YACReader::FitMode fitmode = Configuration::getConfiguration().getFitMode();
|
YACReader::FitMode fitmode = Configuration::getConfiguration().getFitMode();
|
||||||
switch (fitmode)
|
switch (fitmode)
|
||||||
{
|
{
|
||||||
case YACReader::FitMode::FullRes:
|
case YACReader::FitMode::FullRes:
|
||||||
pagefit=currentPage->size();
|
pagefit=currentPage->size();
|
||||||
break;
|
break;
|
||||||
case YACReader::FitMode::ToWidth:
|
case YACReader::FitMode::ToWidth:
|
||||||
pagefit=currentPage->size();
|
pagefit=currentPage->size();
|
||||||
pagefit.scale(width(), 0, Qt::KeepAspectRatioByExpanding);
|
pagefit.scale(width(), 0, Qt::KeepAspectRatioByExpanding);
|
||||||
break;
|
break;
|
||||||
case YACReader::FitMode::ToHeight:
|
case YACReader::FitMode::ToHeight:
|
||||||
pagefit=currentPage->size();
|
pagefit=currentPage->size();
|
||||||
pagefit.scale(0, height(), Qt::KeepAspectRatioByExpanding);
|
pagefit.scale(0, height(), Qt::KeepAspectRatioByExpanding);
|
||||||
break;
|
break;
|
||||||
//if everything fails showing the full page is a good idea
|
//if everything fails showing the full page is a good idea
|
||||||
case YACReader::FitMode::FullPage:
|
case YACReader::FitMode::FullPage:
|
||||||
default:
|
default:
|
||||||
pagefit=currentPage->size();
|
pagefit=currentPage->size();
|
||||||
pagefit.scale(size(), Qt::KeepAspectRatio);
|
pagefit.scale(size(), Qt::KeepAspectRatio);
|
||||||
break;
|
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
|
//apply scaling
|
||||||
content->resize(pagefit);
|
content->resize(pagefit);
|
||||||
|
|
||||||
//TODO: updtateContentSize should only scale the pixmap once
|
//TODO: updtateContentSize should only scale the pixmap once
|
||||||
if(devicePixelRatio()>1)//only in retina display
|
if(devicePixelRatio()>1)//only in retina display
|
||||||
{
|
{
|
||||||
@ -371,23 +378,23 @@ void Viewer::updateContentSize()
|
|||||||
|
|
||||||
void Viewer::increaseZoomFactor()
|
void Viewer::increaseZoomFactor()
|
||||||
{
|
{
|
||||||
zoom = std::min(zoom + 10, 500);
|
zoom = std::min(zoom + 10, 500);
|
||||||
|
|
||||||
updateContentSize();
|
updateContentSize();
|
||||||
notificationsLabel->setText(QString::number(getZoomFactor())+"%");
|
notificationsLabel->setText(QString::number(getZoomFactor())+"%");
|
||||||
notificationsLabel->flash();
|
notificationsLabel->flash();
|
||||||
|
|
||||||
emit zoomUpdated(zoom);
|
emit zoomUpdated(zoom);
|
||||||
}
|
}
|
||||||
void Viewer::decreaseZoomFactor()
|
void Viewer::decreaseZoomFactor()
|
||||||
{
|
{
|
||||||
zoom = std::max(zoom - 10, 30);
|
zoom = std::max(zoom - 10, 30);
|
||||||
|
|
||||||
updateContentSize();
|
updateContentSize();
|
||||||
notificationsLabel->setText(QString::number(getZoomFactor())+"%");
|
notificationsLabel->setText(QString::number(getZoomFactor())+"%");
|
||||||
notificationsLabel->flash();
|
notificationsLabel->flash();
|
||||||
|
|
||||||
emit zoomUpdated(zoom);
|
emit zoomUpdated(zoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Viewer::getZoomFactor()
|
int Viewer::getZoomFactor()
|
||||||
@ -399,14 +406,14 @@ int Viewer::getZoomFactor()
|
|||||||
void Viewer::setZoomFactor(int z)
|
void Viewer::setZoomFactor(int z)
|
||||||
{
|
{
|
||||||
//this function is mostly used to reset the zoom after a fitmode switch
|
//this function is mostly used to reset the zoom after a fitmode switch
|
||||||
if (z > 500)
|
if (z > 500)
|
||||||
zoom = 500;
|
zoom = 500;
|
||||||
else if (z < 30)
|
else if (z < 30)
|
||||||
zoom = 30;
|
zoom = 30;
|
||||||
else
|
else
|
||||||
zoom = z;
|
zoom = z;
|
||||||
|
|
||||||
emit zoomUpdated(zoom);
|
emit zoomUpdated(zoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::updateVerticalScrollBar()
|
void Viewer::updateVerticalScrollBar()
|
||||||
@ -455,110 +462,266 @@ void Viewer::scrollUp()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Viewer::scrollForwardHorizontalFirst()
|
||||||
|
{
|
||||||
|
if (!doubleMangaPage)
|
||||||
|
{
|
||||||
|
scrollZigzag(RIGHT, DOWN, true); // right->right->lower left->right->...->next page
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scrollZigzag(LEFT, DOWN, true); // left->left->lower right->left->...->next page
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Viewer::scrollBackwardHorizontalFirst()
|
||||||
|
{
|
||||||
|
if (!doubleMangaPage)
|
||||||
|
{
|
||||||
|
scrollZigzag(LEFT, UP, false); // left->left->upper right->left->...->prev page
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scrollZigzag(RIGHT, UP, false); // right->right->upper left->right->...->prev page
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Viewer::scrollForwardVerticalFirst()
|
||||||
|
{
|
||||||
|
if (!doubleMangaPage)
|
||||||
|
{
|
||||||
|
scrollZigzag(DOWN, RIGHT, true); // down->down->upper right->down->...->next page
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scrollZigzag(DOWN, LEFT, true); // down->down->upper left->down->...->next page
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Viewer::scrollBackwardVerticalFirst()
|
||||||
|
{
|
||||||
|
if (!doubleMangaPage)
|
||||||
|
{
|
||||||
|
scrollZigzag(UP, LEFT, false); // up->up->lower left->up->...->prev page
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scrollZigzag(UP, RIGHT, false); // up->up->lower right->up->...->prev page
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Viewer::isEdge(scrollDirection d)
|
||||||
|
{
|
||||||
|
if(d == UP)
|
||||||
|
return verticalScrollBar()->sliderPosition() == verticalScrollBar()->minimum();
|
||||||
|
else if(d == DOWN)
|
||||||
|
return verticalScrollBar()->sliderPosition() == verticalScrollBar()->maximum();
|
||||||
|
else if(d == LEFT)
|
||||||
|
return horizontalScrollBar()->sliderPosition() == horizontalScrollBar()->minimum();
|
||||||
|
else // d == RIGHT
|
||||||
|
return horizontalScrollBar()->sliderPosition() == horizontalScrollBar()->maximum();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Viewer::scrollZigzag(scrollDirection d1, scrollDirection d2, bool forward)
|
||||||
|
{
|
||||||
|
if(!isEdge(d1))
|
||||||
|
{
|
||||||
|
if(d1 == UP)
|
||||||
|
scrollTo(horizontalScrollBar()->sliderPosition(),
|
||||||
|
verticalScrollBar()->sliderPosition()-static_cast<int>((height()*0.80)));
|
||||||
|
else if(d1 == DOWN)
|
||||||
|
scrollTo(horizontalScrollBar()->sliderPosition(),
|
||||||
|
verticalScrollBar()->sliderPosition()+static_cast<int>((height()*0.80)));
|
||||||
|
else if(d1 == LEFT)
|
||||||
|
scrollTo(horizontalScrollBar()->sliderPosition()-static_cast<int>((width()*0.80)),
|
||||||
|
verticalScrollBar()->sliderPosition());
|
||||||
|
else // d1 == RIGHT
|
||||||
|
scrollTo(horizontalScrollBar()->sliderPosition()+static_cast<int>((width()*0.80)),
|
||||||
|
verticalScrollBar()->sliderPosition());
|
||||||
|
}
|
||||||
|
else if(!isEdge(d2))
|
||||||
|
{
|
||||||
|
int x = 0;
|
||||||
|
int y = 0;
|
||||||
|
|
||||||
|
if(d1 == UP)
|
||||||
|
y = verticalScrollBar()->maximum();
|
||||||
|
else if(d1 == DOWN)
|
||||||
|
y = verticalScrollBar()->minimum();
|
||||||
|
else if(d1 == LEFT)
|
||||||
|
x = horizontalScrollBar()->maximum();
|
||||||
|
else // d1 == RIGHT
|
||||||
|
x = horizontalScrollBar()->minimum();
|
||||||
|
|
||||||
|
if(d2 == UP)
|
||||||
|
y = std::max(verticalScrollBar()->sliderPosition()-static_cast<int>((height()*0.80)), verticalScrollBar()->minimum());
|
||||||
|
else if(d2 == DOWN)
|
||||||
|
y = std::min(verticalScrollBar()->sliderPosition()+static_cast<int>((height()*0.80)), verticalScrollBar()->maximum());
|
||||||
|
else if(d2 == LEFT)
|
||||||
|
x = std::max(horizontalScrollBar()->sliderPosition()-static_cast<int>((width()*0.80)), horizontalScrollBar()->minimum());
|
||||||
|
else // d2 == RIGHT
|
||||||
|
x = std::min(horizontalScrollBar()->sliderPosition()+static_cast<int>((width()*0.80)), horizontalScrollBar()->maximum());
|
||||||
|
|
||||||
|
scrollTo(x, y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// next or prev page's corner
|
||||||
|
int savedPageNumber = getCurrentPageNumber();
|
||||||
|
|
||||||
|
if(forward)
|
||||||
|
next();
|
||||||
|
else
|
||||||
|
prev();
|
||||||
|
|
||||||
|
if(savedPageNumber != getCurrentPageNumber()){
|
||||||
|
if(d1 == LEFT || d2 == LEFT)
|
||||||
|
horizontalScrollBar()->setSliderPosition(horizontalScrollBar()->maximum());
|
||||||
|
else
|
||||||
|
horizontalScrollBar()->setSliderPosition(horizontalScrollBar()->minimum());
|
||||||
|
emit backgroundChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Viewer::scrollTo(int x, int y)
|
||||||
|
{
|
||||||
|
if(groupScroller->state() == QAbstractAnimation::Running)
|
||||||
|
return;
|
||||||
|
horizontalScroller->setDuration(250);
|
||||||
|
horizontalScroller->setStartValue(horizontalScrollBar()->sliderPosition());
|
||||||
|
horizontalScroller->setEndValue(x);
|
||||||
|
verticalScroller->setDuration(250);
|
||||||
|
verticalScroller->setStartValue(verticalScrollBar()->sliderPosition());
|
||||||
|
verticalScroller->setEndValue(y);
|
||||||
|
groupScroller->start();
|
||||||
|
emit backgroundChanges();
|
||||||
|
}
|
||||||
|
|
||||||
void Viewer::keyPressEvent(QKeyEvent *event)
|
void Viewer::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
if(render->hasLoadedComic())
|
if(render->hasLoadedComic())
|
||||||
{
|
{
|
||||||
int _key = event->key();
|
int _key = event->key();
|
||||||
Qt::KeyboardModifiers modifiers = event->modifiers();
|
Qt::KeyboardModifiers modifiers = event->modifiers();
|
||||||
|
|
||||||
if(modifiers & Qt::ShiftModifier)
|
if(modifiers & Qt::ShiftModifier)
|
||||||
_key |= Qt::SHIFT;
|
_key |= Qt::SHIFT;
|
||||||
if (modifiers & Qt::ControlModifier)
|
if (modifiers & Qt::ControlModifier)
|
||||||
_key |= Qt::CTRL;
|
_key |= Qt::CTRL;
|
||||||
if (modifiers & Qt::MetaModifier)
|
if (modifiers & Qt::MetaModifier)
|
||||||
_key |= Qt::META;
|
_key |= Qt::META;
|
||||||
if (modifiers & Qt::AltModifier)
|
if (modifiers & Qt::AltModifier)
|
||||||
_key |= Qt::ALT;
|
_key |= Qt::ALT;
|
||||||
|
|
||||||
QKeySequence key(_key);
|
QKeySequence key(_key);
|
||||||
/*if(goToFlow->isVisible() && event->key()!=Qt::Key_S)
|
/*if(goToFlow->isVisible() && event->key()!=Qt::Key_S)
|
||||||
QCoreApplication::sendEvent(goToFlow,event);
|
QCoreApplication::sendEvent(goToFlow,event);
|
||||||
else*/
|
else*/
|
||||||
|
|
||||||
if (key == ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_FORWARD_ACTION_Y))
|
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_FORWARD_HORIZONTAL_FIRST_ACTION_Y))
|
||||||
{
|
{
|
||||||
posByStep = height()/numScrollSteps;
|
scrollForwardHorizontalFirst();
|
||||||
nextPos=verticalScrollBar()->sliderPosition()+static_cast<int>((height()*0.80));
|
|
||||||
scrollDown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_BACKWARD_ACTION_Y))
|
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_BACKWARD_HORIZONTAL_FIRST_ACTION_Y))
|
||||||
{
|
{
|
||||||
posByStep = height()/numScrollSteps;
|
scrollBackwardHorizontalFirst();
|
||||||
nextPos=verticalScrollBar()->sliderPosition()-static_cast<int>((height()*0.80));
|
|
||||||
scrollUp();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_DOWN_ACTION_Y) ||
|
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_FORWARD_VERTICAL_FIRST_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);
|
scrollForwardVerticalFirst();
|
||||||
emit backgroundChanges();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(GO_TO_FIRST_PAGE_ACTION_Y))
|
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(AUTO_SCROLL_BACKWARD_VERTICAL_FIRST_ACTION_Y))
|
||||||
{
|
{
|
||||||
goTo(0);
|
scrollBackwardVerticalFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(GO_TO_LAST_PAGE_ACTION_Y))
|
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_DOWN_ACTION_Y) ||
|
||||||
{
|
key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_UP_ACTION_Y) ||
|
||||||
goTo(this->render->numPages()-1);
|
key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_LEFT_ACTION_Y) ||
|
||||||
}
|
key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_RIGHT_ACTION_Y))
|
||||||
|
{
|
||||||
|
QAbstractScrollArea::keyPressEvent(event);
|
||||||
|
emit backgroundChanges();
|
||||||
|
}
|
||||||
|
|
||||||
else
|
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(GO_TO_FIRST_PAGE_ACTION_Y))
|
||||||
QAbstractScrollArea::keyPressEvent(event);
|
{
|
||||||
|
goTo(0);
|
||||||
|
}
|
||||||
|
|
||||||
if(mglass->isVisible() && (key == ShortcutsManager::getShortcutsManager().getShortcut(SIZE_UP_MGLASS_ACTION_Y) ||
|
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(GO_TO_LAST_PAGE_ACTION_Y))
|
||||||
key == ShortcutsManager::getShortcutsManager().getShortcut(SIZE_DOWN_MGLASS_ACTION_Y) ||
|
{
|
||||||
key == ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_IN_MGLASS_ACTION_Y) ||
|
goTo(this->render->numPages()-1);
|
||||||
key == ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_OUT_MGLASS_ACTION_Y)))
|
}
|
||||||
{
|
|
||||||
QCoreApplication::sendEvent(mglass,event);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
else
|
||||||
else
|
QAbstractScrollArea::keyPressEvent(event);
|
||||||
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
QAbstractScrollArea::keyPressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::wheelEvent(QWheelEvent * event)
|
void Viewer::wheelEvent(QWheelEvent * event)
|
||||||
{
|
{
|
||||||
if(render->hasLoadedComic())
|
if(render->hasLoadedComic())
|
||||||
{
|
{
|
||||||
if((event->delta()<0)&&(verticalScrollBar()->sliderPosition()==verticalScrollBar()->maximum()))
|
if((event->delta()<0)&&(verticalScrollBar()->sliderPosition()==verticalScrollBar()->maximum()))
|
||||||
{
|
{
|
||||||
if(wheelStop)
|
if(wheelStop)
|
||||||
{
|
{
|
||||||
if(getMovement(event) == Forward)
|
if(getMovement(event) == Forward)
|
||||||
{
|
{
|
||||||
next();
|
next();
|
||||||
verticalScroller->stop();
|
verticalScroller->stop();
|
||||||
event->accept();
|
event->accept();
|
||||||
wheelStop = false;
|
wheelStop = false;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
wheelStop = true;
|
wheelStop = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if((event->delta()>0)&&(verticalScrollBar()->sliderPosition()==verticalScrollBar()->minimum()))
|
if((event->delta()>0)&&(verticalScrollBar()->sliderPosition()==verticalScrollBar()->minimum()))
|
||||||
{
|
{
|
||||||
if(wheelStop)
|
if(wheelStop)
|
||||||
{
|
{
|
||||||
if(getMovement(event) == Backward)
|
if(getMovement(event) == Backward)
|
||||||
{
|
{
|
||||||
prev();
|
prev();
|
||||||
verticalScroller->stop();
|
verticalScroller->stop();
|
||||||
event->accept();
|
event->accept();
|
||||||
wheelStop = false;
|
wheelStop = false;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
wheelStop = true;
|
wheelStop = true;
|
||||||
@ -587,7 +750,8 @@ void Viewer::wheelEvent(QWheelEvent * event)
|
|||||||
void Viewer::resizeEvent(QResizeEvent * event)
|
void Viewer::resizeEvent(QResizeEvent * event)
|
||||||
{
|
{
|
||||||
updateContentSize();
|
updateContentSize();
|
||||||
goToFlow->move(QPoint((width()-goToFlow->width())/2,height()-goToFlow->height()));
|
goToFlow->updateSize();
|
||||||
|
goToFlow->move((width()-goToFlow->width())/2,height()-goToFlow->height());
|
||||||
informationLabel->updatePosition();
|
informationLabel->updatePosition();
|
||||||
QScrollArea::resizeEvent(event);
|
QScrollArea::resizeEvent(event);
|
||||||
}
|
}
|
||||||
@ -604,23 +768,23 @@ void Viewer::mouseMoveEvent(QMouseEvent * event)
|
|||||||
{
|
{
|
||||||
if(showGoToFlowAnimation->state()!=QPropertyAnimation::Running)
|
if(showGoToFlowAnimation->state()!=QPropertyAnimation::Running)
|
||||||
{
|
{
|
||||||
if(goToFlow->isVisible())
|
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))
|
|
||||||
{
|
{
|
||||||
|
QPoint gtfPos = goToFlow->mapFrom(this,event->pos());
|
||||||
animateShowGoToFlow();
|
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)
|
||||||
hideCursorTimer->stop();
|
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)
|
if(drag)
|
||||||
@ -654,7 +818,7 @@ void Viewer::showMagnifyingGlass()
|
|||||||
QPoint p = QPoint(cursor().pos().x(),cursor().pos().y());
|
QPoint p = QPoint(cursor().pos().x(),cursor().pos().y());
|
||||||
p = this->parentWidget()->mapFromGlobal(p);
|
p = this->parentWidget()->mapFromGlobal(p);
|
||||||
mglass->move(static_cast<int>(p.x()-float(mglass->width())/2)
|
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->show();
|
||||||
mglass->updateImage(mglass->x()+mglass->width()/2,mglass->y()+mglass->height()/2);
|
mglass->updateImage(mglass->x()+mglass->width()/2,mglass->y()+mglass->height()/2);
|
||||||
magnifyingGlassShowed = true;
|
magnifyingGlassShowed = true;
|
||||||
@ -718,7 +882,7 @@ void Viewer::animateShowGoToFlow()
|
|||||||
goToFlow->centerSlide(render->getIndex());
|
goToFlow->centerSlide(render->getIndex());
|
||||||
goToFlow->setPageNumber(render->getIndex());
|
goToFlow->setPageNumber(render->getIndex());
|
||||||
goToFlow->show();
|
goToFlow->show();
|
||||||
goToFlow->setFocus(Qt::OtherFocusReason);
|
goToFlow->setFocus(Qt::OtherFocusReason);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -732,30 +896,30 @@ void Viewer::animateHideGoToFlow()
|
|||||||
showGoToFlowAnimation->setEndValue(QPoint((width()-goToFlow->width())/2,height()));
|
showGoToFlowAnimation->setEndValue(QPoint((width()-goToFlow->width())/2,height()));
|
||||||
showGoToFlowAnimation->start();
|
showGoToFlowAnimation->start();
|
||||||
goToFlow->centerSlide(render->getIndex());
|
goToFlow->centerSlide(render->getIndex());
|
||||||
goToFlow->setPageNumber(render->getIndex());
|
goToFlow->setPageNumber(render->getIndex());
|
||||||
this->setFocus(Qt::OtherFocusReason);
|
this->setFocus(Qt::OtherFocusReason);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::moveCursoToGoToFlow()
|
void Viewer::moveCursoToGoToFlow()
|
||||||
{
|
{
|
||||||
//Move cursor to goToFlow widget on show (this avoid hide when mouse is moved)
|
//Move cursor to goToFlow widget on show (this avoid hide when mouse is moved)
|
||||||
int y = goToFlow->pos().y();
|
int y = goToFlow->pos().y();
|
||||||
int x1 = goToFlow->pos().x();
|
int x1 = goToFlow->pos().x();
|
||||||
int x2 = x1 + goToFlow->width();
|
int x2 = x1 + goToFlow->width();
|
||||||
QPoint cursorPos = mapFromGlobal(cursor().pos());
|
QPoint cursorPos = mapFromGlobal(cursor().pos());
|
||||||
int cursorX = cursorPos.x();
|
int cursorX = cursorPos.x();
|
||||||
int cursorY = cursorPos.y();
|
int cursorY = cursorPos.y();
|
||||||
|
|
||||||
if(cursorY <= y)
|
if(cursorY <= y)
|
||||||
cursorY = y + 10;
|
cursorY = y + 10;
|
||||||
if(cursorX <= x1)
|
if(cursorX <= x1)
|
||||||
cursorX = x1 + 10;
|
cursorX = x1 + 10;
|
||||||
if(cursorX >= x2)
|
if(cursorX >= x2)
|
||||||
cursorX = x2 - 10;
|
cursorX = x2 - 10;
|
||||||
cursor().setPos(mapToGlobal(QPoint(cursorX,cursorY)));
|
cursor().setPos(mapToGlobal(QPoint(cursorX,cursorY)));
|
||||||
hideCursorTimer->stop();
|
hideCursorTimer->stop();
|
||||||
showCursor();
|
showCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::rotateLeft()
|
void Viewer::rotateLeft()
|
||||||
@ -773,18 +937,18 @@ void Viewer::setBookmark(bool set)
|
|||||||
render->setBookmark();
|
render->setBookmark();
|
||||||
if(set) //add bookmark
|
if(set) //add bookmark
|
||||||
{
|
{
|
||||||
render->setBookmark();
|
render->setBookmark();
|
||||||
}
|
}
|
||||||
else //remove bookmark
|
else //remove bookmark
|
||||||
{
|
{
|
||||||
render->removeBookmark();
|
render->removeBookmark();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::save ()
|
void Viewer::save ()
|
||||||
{
|
{
|
||||||
if(render->hasLoadedComic())
|
if(render->hasLoadedComic())
|
||||||
render->save();
|
render->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::doublePageSwitch()
|
void Viewer::doublePageSwitch()
|
||||||
@ -798,7 +962,10 @@ void Viewer::doubleMangaPageSwitch()
|
|||||||
{
|
{
|
||||||
doubleMangaPage = !doubleMangaPage;
|
doubleMangaPage = !doubleMangaPage;
|
||||||
render->doubleMangaPageSwitch();
|
render->doubleMangaPageSwitch();
|
||||||
Configuration::getConfiguration().setDoubleMangaPage(doubleMangaPage);
|
Configuration &config = Configuration::getConfiguration();
|
||||||
|
config.setDoubleMangaPage(doubleMangaPage);
|
||||||
|
goToFlow->setFlowRightToLeft(doubleMangaPage);
|
||||||
|
goToFlow->updateConfig(config.getSettings());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::resetContent()
|
void Viewer::resetContent()
|
||||||
@ -833,8 +1000,8 @@ void Viewer::setPageUnavailableMessage()
|
|||||||
void Viewer::configureContent(QString msg)
|
void Viewer::configureContent(QString msg)
|
||||||
{
|
{
|
||||||
content->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
|
content->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
|
||||||
if(!(devicePixelRatio()>1))
|
if(!(devicePixelRatio()>1))
|
||||||
content->setScaledContents(true);
|
content->setScaledContents(true);
|
||||||
content->setAlignment(Qt::AlignTop|Qt::AlignHCenter);
|
content->setAlignment(Qt::AlignTop|Qt::AlignHCenter);
|
||||||
content->setText(msg);
|
content->setText(msg);
|
||||||
content->setFont(QFont("courier new", 12));
|
content->setFont(QFont("courier new", 12));
|
||||||
@ -861,11 +1028,10 @@ void Viewer::showCursor()
|
|||||||
|
|
||||||
void Viewer::updateOptions()
|
void Viewer::updateOptions()
|
||||||
{
|
{
|
||||||
|
|
||||||
goToFlow->setFlowType(Configuration::getConfiguration().getFlowType());
|
goToFlow->setFlowType(Configuration::getConfiguration().getFlowType());
|
||||||
updateBackgroundColor(Configuration::getConfiguration().getBackgroundColor());
|
updateBackgroundColor(Configuration::getConfiguration().getBackgroundColor());
|
||||||
updateContentSize();
|
updateContentSize();
|
||||||
//goToFlow->updateSize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::updateBackgroundColor(const QColor & color)
|
void Viewer::updateBackgroundColor(const QColor & color)
|
||||||
@ -914,27 +1080,27 @@ void Viewer::animateHideTranslator()
|
|||||||
|
|
||||||
void Viewer::mousePressEvent ( QMouseEvent * event )
|
void Viewer::mousePressEvent ( QMouseEvent * event )
|
||||||
{
|
{
|
||||||
if (event->button() == Qt::LeftButton)
|
if (event->button() == Qt::LeftButton)
|
||||||
{
|
{
|
||||||
drag = true;
|
drag = true;
|
||||||
yDragOrigin = event->y();
|
yDragOrigin = event->y();
|
||||||
xDragOrigin = event->x();
|
xDragOrigin = event->x();
|
||||||
setCursor(Qt::ClosedHandCursor);
|
setCursor(Qt::ClosedHandCursor);
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::mouseReleaseEvent ( QMouseEvent * event )
|
void Viewer::mouseReleaseEvent ( QMouseEvent * event )
|
||||||
{
|
{
|
||||||
drag = false;
|
drag = false;
|
||||||
setCursor(Qt::OpenHandCursor);
|
setCursor(Qt::OpenHandCursor);
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::updateZoomRatio(int ratio)
|
void Viewer::updateZoomRatio(int ratio)
|
||||||
{
|
{
|
||||||
zoom = ratio;
|
zoom = ratio;
|
||||||
updateContentSize();
|
updateContentSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::updateConfig(QSettings * settings)
|
void Viewer::updateConfig(QSettings * settings)
|
||||||
@ -978,7 +1144,7 @@ void Viewer::showIsCoverMessage()
|
|||||||
|
|
||||||
shouldOpenNext = false; //single page comic
|
shouldOpenNext = false; //single page comic
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::showIsLastMessage()
|
void Viewer::showIsLastMessage()
|
||||||
{
|
{
|
||||||
if(!shouldOpenNext)
|
if(!shouldOpenNext)
|
||||||
@ -1010,31 +1176,31 @@ void Viewer::updateComic(ComicDB & comic)
|
|||||||
{
|
{
|
||||||
if(render->hasLoadedComic())
|
if(render->hasLoadedComic())
|
||||||
{
|
{
|
||||||
//set currentPage
|
//set currentPage
|
||||||
comic.info.currentPage = render->getIndex()+1;
|
comic.info.currentPage = render->getIndex()+1;
|
||||||
//set bookmarks
|
//set bookmarks
|
||||||
Bookmarks * boomarks = render->getBookmarks();
|
Bookmarks * boomarks = render->getBookmarks();
|
||||||
QList<int> boomarksList = boomarks->getBookmarkPages();
|
QList<int> boomarksList = boomarks->getBookmarkPages();
|
||||||
int numBookmarks = boomarksList.size();
|
int numBookmarks = boomarksList.size();
|
||||||
if(numBookmarks > 0)
|
if(numBookmarks > 0)
|
||||||
comic.info.bookmark1 = boomarksList[0];
|
comic.info.bookmark1 = boomarksList[0];
|
||||||
if(numBookmarks > 1)
|
if(numBookmarks > 1)
|
||||||
comic.info.bookmark2 = boomarksList[1];
|
comic.info.bookmark2 = boomarksList[1];
|
||||||
if(numBookmarks > 2)
|
if(numBookmarks > 2)
|
||||||
comic.info.bookmark3 = boomarksList[2];
|
comic.info.bookmark3 = boomarksList[2];
|
||||||
//set filters
|
//set filters
|
||||||
//TODO: avoid use settings for this...
|
//TODO: avoid use settings for this...
|
||||||
QSettings settings(YACReader::getSettingsPath()+"/YACReader.ini",QSettings::IniFormat);
|
QSettings settings(YACReader::getSettingsPath()+"/YACReader.ini",QSettings::IniFormat);
|
||||||
int brightness = settings.value(BRIGHTNESS,0).toInt();
|
int brightness = settings.value(BRIGHTNESS,0).toInt();
|
||||||
int contrast = settings.value(CONTRAST,100).toInt();
|
int contrast = settings.value(CONTRAST,100).toInt();
|
||||||
int gamma = settings.value(GAMMA,100).toInt();
|
int gamma = settings.value(GAMMA,100).toInt();
|
||||||
|
|
||||||
if(brightness != 0 || comic.info.brightness!=-1)
|
if(brightness != 0 || comic.info.brightness!=-1)
|
||||||
comic.info.brightness = brightness;
|
comic.info.brightness = brightness;
|
||||||
if(contrast != 100 || comic.info.contrast!=-1)
|
if(contrast != 100 || comic.info.contrast!=-1)
|
||||||
comic.info.contrast = contrast;
|
comic.info.contrast = contrast;
|
||||||
if(gamma != 100 || comic.info.gamma!=-1)
|
if(gamma != 100 || comic.info.gamma!=-1)
|
||||||
comic.info.gamma = gamma;
|
comic.info.gamma = gamma;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
|
#include <QParallelAnimationGroup>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
#include "scroll_management.h"
|
#include "scroll_management.h"
|
||||||
@ -55,6 +56,10 @@ class NotificationsLabelWidget;
|
|||||||
void updateOptions();
|
void updateOptions();
|
||||||
void scrollDown();
|
void scrollDown();
|
||||||
void scrollUp();
|
void scrollUp();
|
||||||
|
void scrollForwardHorizontalFirst();
|
||||||
|
void scrollBackwardHorizontalFirst();
|
||||||
|
void scrollForwardVerticalFirst();
|
||||||
|
void scrollBackwardVerticalFirst();
|
||||||
void magnifyingGlassSwitch();
|
void magnifyingGlassSwitch();
|
||||||
void showMagnifyingGlass();
|
void showMagnifyingGlass();
|
||||||
void hideMagnifyingGlass();
|
void hideMagnifyingGlass();
|
||||||
@ -108,6 +113,8 @@ virtual void mouseReleaseEvent ( QMouseEvent * event );
|
|||||||
PageLabelWidget * informationLabel;
|
PageLabelWidget * informationLabel;
|
||||||
//QTimer * scroller;
|
//QTimer * scroller;
|
||||||
QPropertyAnimation * verticalScroller;
|
QPropertyAnimation * verticalScroller;
|
||||||
|
QPropertyAnimation * horizontalScroller;
|
||||||
|
QParallelAnimationGroup * groupScroller;
|
||||||
int posByStep;
|
int posByStep;
|
||||||
int nextPos;
|
int nextPos;
|
||||||
GoToFlowWidget * goToFlow;
|
GoToFlowWidget * goToFlow;
|
||||||
@ -153,6 +160,12 @@ virtual void mouseReleaseEvent ( QMouseEvent * event );
|
|||||||
void wheelEvent(QWheelEvent * event);
|
void wheelEvent(QWheelEvent * event);
|
||||||
void mouseMoveEvent(QMouseEvent * event);
|
void mouseMoveEvent(QMouseEvent * event);
|
||||||
|
|
||||||
|
//!ZigzagScroll
|
||||||
|
enum scrollDirection{ UP, DOWN, LEFT, RIGHT };
|
||||||
|
bool isEdge(scrollDirection d);
|
||||||
|
void scrollZigzag(scrollDirection d1, scrollDirection d2, bool forward);
|
||||||
|
void scrollTo(int x, int y);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Viewer(QWidget * parent = 0);
|
Viewer(QWidget * parent = 0);
|
||||||
~Viewer();
|
~Viewer();
|
||||||
|
|||||||
@ -2022,6 +2022,48 @@ void LibraryWindow::toggleFullScreen()
|
|||||||
fullscreen = !fullscreen;
|
fullscreen = !fullscreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN //fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309
|
||||||
|
void LibraryWindow::toFullScreen()
|
||||||
|
{
|
||||||
|
fromMaximized = this->isMaximized();
|
||||||
|
|
||||||
|
sideBar->hide();
|
||||||
|
libraryToolBar->hide();
|
||||||
|
|
||||||
|
previousWindowFlags = windowFlags();
|
||||||
|
previousPos = pos();
|
||||||
|
previousSize = size();
|
||||||
|
|
||||||
|
showNormal();
|
||||||
|
setWindowFlags(previousWindowFlags | Qt::FramelessWindowHint);
|
||||||
|
|
||||||
|
const QRect r = windowHandle()->screen()->geometry();
|
||||||
|
|
||||||
|
move(r.x(), r.y());
|
||||||
|
resize(r.width(),r.height()+1);
|
||||||
|
show();
|
||||||
|
|
||||||
|
comicsViewsManager->comicsView->toFullScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LibraryWindow::toNormal()
|
||||||
|
{
|
||||||
|
sideBar->show();
|
||||||
|
libraryToolBar->show();
|
||||||
|
|
||||||
|
setWindowFlags(previousWindowFlags);
|
||||||
|
move(previousPos);
|
||||||
|
resize(previousSize);
|
||||||
|
show();
|
||||||
|
|
||||||
|
if(fromMaximized)
|
||||||
|
showMaximized();
|
||||||
|
|
||||||
|
comicsViewsManager->comicsView->toNormal();
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
void LibraryWindow::toFullScreen()
|
void LibraryWindow::toFullScreen()
|
||||||
{
|
{
|
||||||
fromMaximized = this->isMaximized();
|
fromMaximized = this->isMaximized();
|
||||||
@ -2057,6 +2099,8 @@ void LibraryWindow::toNormal()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
void LibraryWindow::setSearchFilter(const YACReader::SearchModifiers modifier, QString filter)
|
void LibraryWindow::setSearchFilter(const YACReader::SearchModifiers modifier, QString filter)
|
||||||
{
|
{
|
||||||
if(!filter.isEmpty())
|
if(!filter.isEmpty())
|
||||||
|
|||||||
@ -375,6 +375,12 @@ public slots:
|
|||||||
void onAddComicsToLabel();
|
void onAddComicsToLabel();
|
||||||
void setToolbarTitle(const QModelIndex & modelIndex);
|
void setToolbarTitle(const QModelIndex & modelIndex);
|
||||||
void saveSelectedCoversTo();
|
void saveSelectedCoversTo();
|
||||||
|
|
||||||
|
private:
|
||||||
|
//fullscreen mode in Windows for preventing this bug: QTBUG-41309 https://bugreports.qt.io/browse/QTBUG-41309
|
||||||
|
Qt::WindowFlags previousWindowFlags;
|
||||||
|
QPoint previousPos;
|
||||||
|
QSize previousSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -12,6 +12,8 @@
|
|||||||
#include "empty_reading_list_widget.h"
|
#include "empty_reading_list_widget.h"
|
||||||
#include "no_search_results_widget.h"
|
#include "no_search_results_widget.h"
|
||||||
|
|
||||||
|
#include "yacreader_sidebar.h"
|
||||||
|
|
||||||
//--
|
//--
|
||||||
#include "yacreader_search_line_edit.h"
|
#include "yacreader_search_line_edit.h"
|
||||||
#include "options_dialog.h"
|
#include "options_dialog.h"
|
||||||
@ -71,6 +73,10 @@ QWidget * YACReaderComicsViewsManager::containerWidget()
|
|||||||
void YACReaderComicsViewsManager::showComicsView()
|
void YACReaderComicsViewsManager::showComicsView()
|
||||||
{
|
{
|
||||||
comicsViewStack->setCurrentWidget(comicsView);
|
comicsViewStack->setCurrentWidget(comicsView);
|
||||||
|
|
||||||
|
//BUG, ugly workaround for glitch when QOpenGLWidget (flow) is used just after any other widget in the views stack
|
||||||
|
//Somehow QOpenGLWidget is messing with the rendering of the side bar (wrong buffer swapping)
|
||||||
|
libraryWindow->sideBar->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void YACReaderComicsViewsManager::showEmptyFolderView()
|
void YACReaderComicsViewsManager::showEmptyFolderView()
|
||||||
|
|||||||
@ -200,7 +200,7 @@ struct Preset pressetYACReaderFlowDownConfig = {
|
|||||||
};
|
};
|
||||||
/*Constructor*/
|
/*Constructor*/
|
||||||
YACReaderFlowGL::YACReaderFlowGL(QWidget *parent,struct Preset p)
|
YACReaderFlowGL::YACReaderFlowGL(QWidget *parent,struct Preset p)
|
||||||
:QOpenGLWidget(/*QOpenGLWidget migration QGLFormat(QGL::SampleBuffers),*/ parent),numObjects(0),lazyPopulateObjects(-1),bUseVSync(false),hasBeenInitialized(false)
|
:QOpenGLWidget(/*QOpenGLWidget migration QGLFormat(QGL::SampleBuffers),*/ parent),numObjects(0),lazyPopulateObjects(-1),bUseVSync(false),hasBeenInitialized(false),flowRightToLeft(false)
|
||||||
{
|
{
|
||||||
updateCount = 0;
|
updateCount = 0;
|
||||||
config = p;
|
config = p;
|
||||||
@ -385,7 +385,11 @@ void YACReaderFlowGL::udpatePerspective(int width, int height)
|
|||||||
/*Private*/
|
/*Private*/
|
||||||
void YACReaderFlowGL::calcPos(YACReader3DImage & image, int pos)
|
void YACReaderFlowGL::calcPos(YACReader3DImage & image, int pos)
|
||||||
{
|
{
|
||||||
if(pos == 0){
|
if(flowRightToLeft){
|
||||||
|
pos = pos * -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pos == 0){
|
||||||
image.current = centerPos;
|
image.current = centerPos;
|
||||||
}else{
|
}else{
|
||||||
if(pos > 0){
|
if(pos > 0){
|
||||||
@ -1052,6 +1056,11 @@ void YACReaderFlowGL::render()
|
|||||||
//do nothing
|
//do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void YACReaderFlowGL::setFlowRightToLeft(bool b)
|
||||||
|
{
|
||||||
|
flowRightToLeft = b;
|
||||||
|
}
|
||||||
|
|
||||||
//EVENTOS
|
//EVENTOS
|
||||||
|
|
||||||
void YACReaderFlowGL::wheelEvent(QWheelEvent * event)
|
void YACReaderFlowGL::wheelEvent(QWheelEvent * event)
|
||||||
@ -1073,7 +1082,7 @@ void YACReaderFlowGL::wheelEvent(QWheelEvent * event)
|
|||||||
|
|
||||||
void YACReaderFlowGL::keyPressEvent(QKeyEvent *event)
|
void YACReaderFlowGL::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
if(event->key() == Qt::Key_Left)
|
if((event->key() == Qt::Key_Left && !flowRightToLeft) || (event->key() == Qt::Key_Right && flowRightToLeft))
|
||||||
{
|
{
|
||||||
if(event->modifiers() == Qt::ControlModifier)
|
if(event->modifiers() == Qt::ControlModifier)
|
||||||
setCurrentIndex((currentSelected-10<0)?0:currentSelected-10);
|
setCurrentIndex((currentSelected-10<0)?0:currentSelected-10);
|
||||||
@ -1083,7 +1092,7 @@ void YACReaderFlowGL::keyPressEvent(QKeyEvent *event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(event->key() == Qt::Key_Right)
|
if((event->key() == Qt::Key_Right && !flowRightToLeft) || (event->key() == Qt::Key_Left && flowRightToLeft))
|
||||||
{
|
{
|
||||||
if(event->modifiers() == Qt::ControlModifier)
|
if(event->modifiers() == Qt::ControlModifier)
|
||||||
setCurrentIndex((currentSelected+10>=numObjects)?numObjects-1:currentSelected+10);
|
setCurrentIndex((currentSelected+10>=numObjects)?numObjects-1:currentSelected+10);
|
||||||
@ -1128,7 +1137,7 @@ void YACReaderFlowGL::mousePressEvent(QMouseEvent *event)
|
|||||||
|
|
||||||
gluUnProject(winX, winY, winZ, modelview, projection, viewport, &posX, &posY, &posZ);
|
gluUnProject(winX, winY, winZ, modelview, projection, viewport, &posX, &posY, &posZ);
|
||||||
|
|
||||||
if(posX >= 0.5)
|
if((posX >= 0.5 && !flowRightToLeft) || (posX <=-0.5 && flowRightToLeft))
|
||||||
{
|
{
|
||||||
//int index = currentSelected+1;
|
//int index = currentSelected+1;
|
||||||
//while((cfImages[index].current.x-cfImages[index].width/(2.0*config.rotation)) < posX)
|
//while((cfImages[index].current.x-cfImages[index].width/(2.0*config.rotation)) < posX)
|
||||||
@ -1136,7 +1145,7 @@ void YACReaderFlowGL::mousePressEvent(QMouseEvent *event)
|
|||||||
//setCurrentIndex(index-1);
|
//setCurrentIndex(index-1);
|
||||||
showNext();
|
showNext();
|
||||||
}
|
}
|
||||||
else if(posX <=-0.5)
|
else if((posX <=-0.5 && !flowRightToLeft) || (posX >= 0.5 && flowRightToLeft) )
|
||||||
showPrevious();
|
showPrevious();
|
||||||
} else
|
} else
|
||||||
QOpenGLWidget::mousePressEvent(event);
|
QOpenGLWidget::mousePressEvent(event);
|
||||||
|
|||||||
@ -173,6 +173,9 @@ protected:
|
|||||||
//sets the updateInterval in ms
|
//sets the updateInterval in ms
|
||||||
static int updateInterval;
|
static int updateInterval;
|
||||||
|
|
||||||
|
// sets flow direction right-to-left (manga mode)
|
||||||
|
bool flowRightToLeft;
|
||||||
|
|
||||||
void startAnimationTimer();
|
void startAnimationTimer();
|
||||||
void stopAnimationTimer();
|
void stopAnimationTimer();
|
||||||
|
|
||||||
@ -251,6 +254,8 @@ public:
|
|||||||
|
|
||||||
void useVSync(bool b);
|
void useVSync(bool b);
|
||||||
|
|
||||||
|
void setFlowRightToLeft(bool b);
|
||||||
|
|
||||||
virtual void updateImageData() = 0;
|
virtual void updateImageData() = 0;
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|||||||
@ -207,6 +207,8 @@ public:
|
|||||||
QVector<SlideInfo> leftSlides;
|
QVector<SlideInfo> leftSlides;
|
||||||
QVector<SlideInfo> rightSlides;
|
QVector<SlideInfo> rightSlides;
|
||||||
int centerIndex;
|
int centerIndex;
|
||||||
|
|
||||||
|
bool flowRightToLeft;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PictureFlowAnimator
|
class PictureFlowAnimator
|
||||||
@ -281,7 +283,7 @@ private:
|
|||||||
|
|
||||||
PictureFlowState::PictureFlowState(int a, float sr):
|
PictureFlowState::PictureFlowState(int a, float sr):
|
||||||
backgroundColor(0), slideWidth(150), slideHeight(200),
|
backgroundColor(0), slideWidth(150), slideHeight(200),
|
||||||
reflectionEffect(PictureFlow::BlurredReflection), centerIndex(0) , rawAngle(a), spacingRatio(sr)
|
reflectionEffect(PictureFlow::BlurredReflection), centerIndex(0) , rawAngle(a), spacingRatio(sr), flowRightToLeft(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,7 +329,10 @@ void PictureFlowState::reset()
|
|||||||
si.angle = angle;
|
si.angle = angle;
|
||||||
si.cx = -(offsetX + spacing*(i)*PFREAL_ONE);
|
si.cx = -(offsetX + spacing*(i)*PFREAL_ONE);
|
||||||
si.cy = offsetY;
|
si.cy = offsetY;
|
||||||
si.slideIndex = centerIndex-1-i;
|
if(!flowRightToLeft)
|
||||||
|
si.slideIndex = centerIndex-1-i;
|
||||||
|
else
|
||||||
|
si.slideIndex = centerIndex+1+i;
|
||||||
si.blend = 200;
|
si.blend = 200;
|
||||||
if(i == (int)leftSlides.count()-2)
|
if(i == (int)leftSlides.count()-2)
|
||||||
si.blend = 128;
|
si.blend = 128;
|
||||||
@ -344,7 +349,10 @@ void PictureFlowState::reset()
|
|||||||
si.angle = -angle;
|
si.angle = -angle;
|
||||||
si.cx = offsetX + spacing*(i)*PFREAL_ONE;
|
si.cx = offsetX + spacing*(i)*PFREAL_ONE;
|
||||||
si.cy = offsetY;
|
si.cy = offsetY;
|
||||||
si.slideIndex = centerIndex+1+i;
|
if(!flowRightToLeft)
|
||||||
|
si.slideIndex = centerIndex+1+i;
|
||||||
|
else
|
||||||
|
si.slideIndex = centerIndex-1-i;
|
||||||
si.blend = 200;
|
si.blend = 200;
|
||||||
if(i == (int)rightSlides.count()-2)
|
if(i == (int)rightSlides.count()-2)
|
||||||
si.blend = 128;
|
si.blend = 128;
|
||||||
@ -423,13 +431,31 @@ void PictureFlowAnimator::update()
|
|||||||
frame = index << 16;
|
frame = index << 16;
|
||||||
state->centerSlide.slideIndex = state->centerIndex;
|
state->centerSlide.slideIndex = state->centerIndex;
|
||||||
for(int i = 0; i < (int)state->leftSlides.count(); i++)
|
for(int i = 0; i < (int)state->leftSlides.count(); i++)
|
||||||
state->leftSlides[i].slideIndex = state->centerIndex-1-i;
|
{
|
||||||
|
if(!state->flowRightToLeft)
|
||||||
|
state->leftSlides[i].slideIndex = state->centerIndex-1-i;
|
||||||
|
else
|
||||||
|
state->leftSlides[i].slideIndex = state->centerIndex+1+i;
|
||||||
|
}
|
||||||
for(int i = 0; i < (int)state->rightSlides.count(); i++)
|
for(int i = 0; i < (int)state->rightSlides.count(); i++)
|
||||||
state->rightSlides[i].slideIndex = state->centerIndex+1+i;
|
{
|
||||||
|
if(!state->flowRightToLeft)
|
||||||
|
state->rightSlides[i].slideIndex = state->centerIndex+1+i;
|
||||||
|
else
|
||||||
|
state->rightSlides[i].slideIndex = state->centerIndex-1-i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
state->centerSlide.angle = (step * tick * state->angle) >> 16;
|
if(!state->flowRightToLeft)
|
||||||
state->centerSlide.cx = -step * fmul(state->offsetX, ftick);
|
{
|
||||||
|
state->centerSlide.angle = (step * tick * state->angle) >> 16;
|
||||||
|
state->centerSlide.cx = -step * fmul(state->offsetX, ftick);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
state->centerSlide.angle = (-step * tick * state->angle) >> 16;
|
||||||
|
state->centerSlide.cx = step * fmul(state->offsetX, ftick);
|
||||||
|
}
|
||||||
state->centerSlide.cy = fmul(state->offsetY, ftick);
|
state->centerSlide.cy = fmul(state->offsetY, ftick);
|
||||||
|
|
||||||
if(state->centerIndex == target)
|
if(state->centerIndex == target)
|
||||||
@ -443,7 +469,10 @@ void PictureFlowAnimator::update()
|
|||||||
{
|
{
|
||||||
SlideInfo& si = state->leftSlides[i];
|
SlideInfo& si = state->leftSlides[i];
|
||||||
si.angle = state->angle;
|
si.angle = state->angle;
|
||||||
si.cx = -(state->offsetX + state->spacing*(i)*PFREAL_ONE + step*state->spacing*ftick);
|
if(!state->flowRightToLeft)
|
||||||
|
si.cx = -(state->offsetX + state->spacing*(i)*PFREAL_ONE + step*state->spacing*ftick);
|
||||||
|
else
|
||||||
|
si.cx = -(state->offsetX + state->spacing*(i)*PFREAL_ONE - step*state->spacing*ftick);
|
||||||
si.cy = state->offsetY;
|
si.cy = state->offsetY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,24 +480,41 @@ void PictureFlowAnimator::update()
|
|||||||
{
|
{
|
||||||
SlideInfo& si = state->rightSlides[i];
|
SlideInfo& si = state->rightSlides[i];
|
||||||
si.angle = -state->angle;
|
si.angle = -state->angle;
|
||||||
si.cx = state->offsetX + state->spacing*(i)*PFREAL_ONE - step*state->spacing*ftick;
|
if(!state->flowRightToLeft)
|
||||||
|
si.cx = state->offsetX + state->spacing*(i)*PFREAL_ONE - step*state->spacing*ftick;
|
||||||
|
else
|
||||||
|
si.cx = state->offsetX + state->spacing*(i)*PFREAL_ONE + step*state->spacing*ftick;
|
||||||
si.cy = state->offsetY;
|
si.cy = state->offsetY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(step > 0)
|
if(step > 0 && !state->flowRightToLeft)
|
||||||
{
|
{
|
||||||
PFreal ftick = (neg * PFREAL_ONE) >> 16;
|
PFreal ftick = (neg * PFREAL_ONE) >> 16;
|
||||||
state->rightSlides[0].angle = -(neg * state->angle) >> 16;
|
state->rightSlides[0].angle = -(neg * state->angle) >> 16;
|
||||||
state->rightSlides[0].cx = fmul(state->offsetX, ftick);
|
state->rightSlides[0].cx = fmul(state->offsetX, ftick);
|
||||||
state->rightSlides[0].cy = fmul(state->offsetY, ftick);
|
state->rightSlides[0].cy = fmul(state->offsetY, ftick);
|
||||||
}
|
}
|
||||||
else
|
else if(!state->flowRightToLeft)
|
||||||
{
|
{
|
||||||
PFreal ftick = (pos * PFREAL_ONE) >> 16;
|
PFreal ftick = (pos * PFREAL_ONE) >> 16;
|
||||||
state->leftSlides[0].angle = (pos * state->angle) >> 16;
|
state->leftSlides[0].angle = (pos * state->angle) >> 16;
|
||||||
state->leftSlides[0].cx = -fmul(state->offsetX, ftick);
|
state->leftSlides[0].cx = -fmul(state->offsetX, ftick);
|
||||||
state->leftSlides[0].cy = fmul(state->offsetY, ftick);
|
state->leftSlides[0].cy = fmul(state->offsetY, ftick);
|
||||||
}
|
}
|
||||||
|
else if(step < 0)
|
||||||
|
{
|
||||||
|
PFreal ftick = (pos * PFREAL_ONE) >> 16;
|
||||||
|
state->rightSlides[0].angle = -(pos * state->angle) >> 16;
|
||||||
|
state->rightSlides[0].cx = fmul(state->offsetX, ftick);
|
||||||
|
state->rightSlides[0].cy = fmul(state->offsetY, ftick);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PFreal ftick = (neg * PFREAL_ONE) >> 16;
|
||||||
|
state->leftSlides[0].angle = (neg * state->angle) >> 16;
|
||||||
|
state->leftSlides[0].cx = -fmul(state->offsetX, ftick);
|
||||||
|
state->leftSlides[0].cy = fmul(state->offsetY, ftick);
|
||||||
|
}
|
||||||
|
|
||||||
// must change direction ?
|
// must change direction ?
|
||||||
if(target < index) if(step > 0)
|
if(target < index) if(step > 0)
|
||||||
@ -1053,6 +1099,13 @@ void PictureFlow::setReflectionEffect(ReflectionEffect effect)
|
|||||||
triggerRender();
|
triggerRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PictureFlow::setFlowRightToLeft(bool b)
|
||||||
|
{
|
||||||
|
d->state->flowRightToLeft = b;
|
||||||
|
d->state->reset();
|
||||||
|
triggerRender();
|
||||||
|
}
|
||||||
|
|
||||||
QImage PictureFlow::slide(int index) const
|
QImage PictureFlow::slide(int index) const
|
||||||
{
|
{
|
||||||
QImage* i = 0;
|
QImage* i = 0;
|
||||||
@ -1225,7 +1278,8 @@ void PictureFlow::showSlide(unsigned int index)
|
|||||||
|
|
||||||
void PictureFlow::keyPressEvent(QKeyEvent* event)
|
void PictureFlow::keyPressEvent(QKeyEvent* event)
|
||||||
{
|
{
|
||||||
if(event->key() == Qt::Key_Left)
|
if((event->key() == Qt::Key_Left && !(d->state->flowRightToLeft))
|
||||||
|
|| (event->key() == Qt::Key_Right && d->state->flowRightToLeft))
|
||||||
{
|
{
|
||||||
/*if(event->modifiers() == Qt::ControlModifier)
|
/*if(event->modifiers() == Qt::ControlModifier)
|
||||||
showSlide(centerIndex()-10);
|
showSlide(centerIndex()-10);
|
||||||
@ -1235,7 +1289,8 @@ void PictureFlow::keyPressEvent(QKeyEvent* event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(event->key() == Qt::Key_Right)
|
if((event->key() == Qt::Key_Right && !(d->state->flowRightToLeft))
|
||||||
|
|| (event->key() == Qt::Key_Left && d->state->flowRightToLeft))
|
||||||
{
|
{
|
||||||
/*if(event->modifiers() == Qt::ControlModifier)
|
/*if(event->modifiers() == Qt::ControlModifier)
|
||||||
showSlide(centerIndex()+10);
|
showSlide(centerIndex()+10);
|
||||||
@ -1256,10 +1311,19 @@ void PictureFlow::keyPressEvent(QKeyEvent* event)
|
|||||||
|
|
||||||
void PictureFlow::mousePressEvent(QMouseEvent* event)
|
void PictureFlow::mousePressEvent(QMouseEvent* event)
|
||||||
{
|
{
|
||||||
if(event->x() > width()/2)
|
mousePressEvent(event, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PictureFlow::mousePressEvent(QMouseEvent* event, int slideWidth)
|
||||||
|
{
|
||||||
|
if((event->x() > (width() + slideWidth)/2 && !(d->state->flowRightToLeft))
|
||||||
|
|| (event->x() < (width() - slideWidth)/2 && d->state->flowRightToLeft))
|
||||||
showNext();
|
showNext();
|
||||||
else
|
else if((event->x() < (width() - slideWidth)/2 && !(d->state->flowRightToLeft))
|
||||||
showPrevious();
|
|| (event->x() > (width() + slideWidth)/2 && d->state->flowRightToLeft))
|
||||||
|
showPrevious();
|
||||||
|
|
||||||
|
//else (centered slide space)
|
||||||
}
|
}
|
||||||
|
|
||||||
void PictureFlow::paintEvent(QPaintEvent* event)
|
void PictureFlow::paintEvent(QPaintEvent* event)
|
||||||
|
|||||||
@ -119,7 +119,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setReflectionEffect(ReflectionEffect effect);
|
void setReflectionEffect(ReflectionEffect effect);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Sets the flow direction right-to-left (manga mode)
|
||||||
|
*/
|
||||||
|
void setFlowRightToLeft(bool b);
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -213,6 +218,7 @@ public:
|
|||||||
void paintEvent(QPaintEvent *event);
|
void paintEvent(QPaintEvent *event);
|
||||||
void keyPressEvent(QKeyEvent* event);
|
void keyPressEvent(QKeyEvent* event);
|
||||||
void mousePressEvent(QMouseEvent* event);
|
void mousePressEvent(QMouseEvent* event);
|
||||||
|
void mousePressEvent(QMouseEvent* event, int slideWidth);
|
||||||
void resizeEvent(QResizeEvent* event);
|
void resizeEvent(QResizeEvent* event);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|||||||
@ -27,6 +27,7 @@
|
|||||||
#define CONTRAST "CONTRAST"
|
#define CONTRAST "CONTRAST"
|
||||||
#define GAMMA "GAMMA"
|
#define GAMMA "GAMMA"
|
||||||
#define SHOW_INFO "SHOW_INFO"
|
#define SHOW_INFO "SHOW_INFO"
|
||||||
|
#define QUICK_NAVI_MODE "QUICK_NAVI_MODE"
|
||||||
|
|
||||||
#define FLOW_TYPE_GL "FLOW_TYPE_GL"
|
#define FLOW_TYPE_GL "FLOW_TYPE_GL"
|
||||||
#define Y_POSITION "Y_POSITION"
|
#define Y_POSITION "Y_POSITION"
|
||||||
|
|||||||
@ -7,12 +7,7 @@ YACReaderFlow::YACReaderFlow(QWidget * parent,FlowType flowType) : PictureFlow(p
|
|||||||
|
|
||||||
void YACReaderFlow::mousePressEvent(QMouseEvent* event)
|
void YACReaderFlow::mousePressEvent(QMouseEvent* event)
|
||||||
{
|
{
|
||||||
if(event->x() > (width()+slideSize().width())/2)
|
PictureFlow::mousePressEvent(event, slideSize().width());
|
||||||
showNext();
|
|
||||||
else
|
|
||||||
if(event->x() < (width()-slideSize().width())/2)
|
|
||||||
showPrevious();
|
|
||||||
//else (centered cover space)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void YACReaderFlow::mouseDoubleClickEvent(QMouseEvent* event)
|
void YACReaderFlow::mouseDoubleClickEvent(QMouseEvent* event)
|
||||||
|
|||||||
@ -356,46 +356,46 @@ void YACReaderOptionsDialog::setOverlappedStripeConfigSW()
|
|||||||
#ifndef NO_OPENGL
|
#ifndef NO_OPENGL
|
||||||
void YACReaderOptionsDialog::setClassicConfig()
|
void YACReaderOptionsDialog::setClassicConfig()
|
||||||
{
|
{
|
||||||
settings->setValue(FLOW_TYPE_GL,CoverFlowLike);
|
|
||||||
|
|
||||||
gl->setValues(presetYACReaderFlowClassicConfig);
|
gl->setValues(presetYACReaderFlowClassicConfig);
|
||||||
|
|
||||||
saveFlowParameters();
|
saveFlowParameters();
|
||||||
|
|
||||||
|
settings->setValue(FLOW_TYPE_GL,CoverFlowLike);
|
||||||
}
|
}
|
||||||
|
|
||||||
void YACReaderOptionsDialog::setStripeConfig()
|
void YACReaderOptionsDialog::setStripeConfig()
|
||||||
{
|
{
|
||||||
settings->setValue(FLOW_TYPE_GL,Strip);
|
|
||||||
|
|
||||||
gl->setValues(presetYACReaderFlowStripeConfig);
|
gl->setValues(presetYACReaderFlowStripeConfig);
|
||||||
|
|
||||||
saveFlowParameters();
|
saveFlowParameters();
|
||||||
|
|
||||||
|
settings->setValue(FLOW_TYPE_GL,Strip);
|
||||||
}
|
}
|
||||||
|
|
||||||
void YACReaderOptionsDialog::setOverlappedStripeConfig()
|
void YACReaderOptionsDialog::setOverlappedStripeConfig()
|
||||||
{
|
{
|
||||||
settings->setValue(FLOW_TYPE_GL,StripOverlapped);
|
|
||||||
|
|
||||||
gl->setValues(presetYACReaderFlowOverlappedStripeConfig);
|
gl->setValues(presetYACReaderFlowOverlappedStripeConfig);
|
||||||
|
|
||||||
saveFlowParameters();
|
saveFlowParameters();
|
||||||
|
|
||||||
|
settings->setValue(FLOW_TYPE_GL,StripOverlapped);
|
||||||
}
|
}
|
||||||
|
|
||||||
void YACReaderOptionsDialog::setModernConfig()
|
void YACReaderOptionsDialog::setModernConfig()
|
||||||
{
|
{
|
||||||
settings->setValue(FLOW_TYPE_GL,Modern);
|
|
||||||
|
|
||||||
gl->setValues(defaultYACReaderFlowConfig);
|
gl->setValues(defaultYACReaderFlowConfig);
|
||||||
|
|
||||||
saveFlowParameters();
|
saveFlowParameters();
|
||||||
|
|
||||||
|
settings->setValue(FLOW_TYPE_GL,Modern);
|
||||||
}
|
}
|
||||||
|
|
||||||
void YACReaderOptionsDialog::setRouletteConfig()
|
void YACReaderOptionsDialog::setRouletteConfig()
|
||||||
{
|
{
|
||||||
settings->setValue(FLOW_TYPE_GL,Roulette);
|
|
||||||
|
|
||||||
gl->setValues(pressetYACReaderFlowDownConfig);
|
gl->setValues(pressetYACReaderFlowDownConfig);
|
||||||
|
|
||||||
saveFlowParameters();
|
saveFlowParameters();
|
||||||
|
|
||||||
|
settings->setValue(FLOW_TYPE_GL,Roulette);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -125,6 +125,10 @@ public:
|
|||||||
//viewer
|
//viewer
|
||||||
#define AUTO_SCROLL_FORWARD_ACTION_Y "AUTO_SCROLL_FORWARD_ACTION_Y"
|
#define AUTO_SCROLL_FORWARD_ACTION_Y "AUTO_SCROLL_FORWARD_ACTION_Y"
|
||||||
#define AUTO_SCROLL_BACKWARD_ACTION_Y "AUTO_SCROLL_BACKWARD_ACTION_Y"
|
#define AUTO_SCROLL_BACKWARD_ACTION_Y "AUTO_SCROLL_BACKWARD_ACTION_Y"
|
||||||
|
#define AUTO_SCROLL_FORWARD_VERTICAL_FIRST_ACTION_Y "AUTO_SCROLL_FORWARD_VERTICAL_FIRST_ACTION_Y"
|
||||||
|
#define AUTO_SCROLL_BACKWARD_VERTICAL_FIRST_ACTION_Y "AUTO_SCROLL_BACKWARD_VERTICAL_FIRST_ACTION_Y"
|
||||||
|
#define AUTO_SCROLL_FORWARD_HORIZONTAL_FIRST_ACTION_Y "AUTO_SCROLL_FORWARD_HORIZONTAL_FIRST_ACTION_Y"
|
||||||
|
#define AUTO_SCROLL_BACKWARD_HORIZONTAL_FIRST_ACTION_Y "AUTO_SCROLL_BACKWARD_HORIZONTAL_FIRST_ACTION_Y"
|
||||||
#define MOVE_DOWN_ACTION_Y "MOVE_DOWN_ACTION_Y"
|
#define MOVE_DOWN_ACTION_Y "MOVE_DOWN_ACTION_Y"
|
||||||
#define MOVE_UP_ACTION_Y "MOVE_UP_ACTION_Y"
|
#define MOVE_UP_ACTION_Y "MOVE_UP_ACTION_Y"
|
||||||
#define MOVE_LEFT_ACTION_Y "MOVE_LEFT_ACTION_Y"
|
#define MOVE_LEFT_ACTION_Y "MOVE_LEFT_ACTION_Y"
|
||||||
|
|||||||
Reference in New Issue
Block a user