Merged in selmf/yacreader/8.0.0-release-small-bugfixes (pull request #16)

Small bugfixes
This commit is contained in:
Luis Ángel San Martín 2015-02-24 18:56:23 +01:00
commit b776a1d3bd
9 changed files with 2180 additions and 126 deletions

View File

@ -4,6 +4,12 @@ INCLUDEPATH += .
INCLUDEPATH += $$PWD/../common \
$$PWD/../custom_widgets
CONFIG(legacy_gl_widget) {
INCLUDEPATH += ../common/gl_legacy \
} else {
INCLUDEPATH += ../common/gl \
}
win32 {
LIBS += -L$$PWD/../dependencies/poppler/lib -loleaut32 -lole32
@ -94,8 +100,13 @@ HEADERS += $$PWD/../common/comic.h \
$$PWD/../common/scroll_management.h
!CONFIG(no_opengl) {
HEADERS += $$PWD/goto_flow_gl.h \
$$PWD/../common/yacreader_flow_gl.h
CONFIG(legacy_gl_widget) {
message("using legacy YACReaderFlowGL (QGLWidget) header")
HEADERS += ../common/gl_legacy/yacreader_flow_gl.h
} else {
HEADERS += ../common/gl/yacreader_flow_gl.h
}
HEADERS += $$PWD/goto_flow_gl.h
}
SOURCES += $$PWD/../common/comic.cpp \
@ -132,8 +143,13 @@ SOURCES += $$PWD/../common/comic.cpp \
$$PWD/../common/scroll_management.cpp
!CONFIG(no_opengl) {
SOURCES += $$PWD/goto_flow_gl.cpp \
$$PWD/../common/yacreader_flow_gl.cpp
CONFIG(legacy_gl_widget) {
message("using legacy YACReaderFlowGL (QGLWidget) source code")
SOURCES += ../common/gl_legacy/yacreader_flow_gl.cpp
} else {
SOURCES += ../common/gl/yacreader_flow_gl.cpp
}
SOURCES += $$PWD/goto_flow_gl.cpp
}
include($$PWD/../custom_widgets/custom_widgets_yacreader.pri)

View File

@ -1,5 +1,5 @@
# #####################################################################
# Automatically generated by qmake (2.01a) mié 8. oct 20:54:05 2008
# Automatically generated by qmake (2.01a) mié 8. oct 20:54:05 2008
# #####################################################################
TEMPLATE = app
TARGET = YACReader
@ -21,7 +21,170 @@ Release:DESTDIR = ../release
Debug:DESTDIR = ../debug
SOURCES += main.cpp
include(YACReader.pri)
INCLUDEPATH += ../common \
../custom_widgets
CONFIG(legacy_gl_widget) {
INCLUDEPATH += ../common/gl_legacy \
} else {
INCLUDEPATH += ../common/gl \
}
win32 {
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32
LIBS += -lpoppler-qt5
INCLUDEPATH += ../dependencies/poppler/include/qt5
QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT
!CONFIG(no_opengl) {
QMAKE_CXXFLAGS_RELEASE += /GL
}
QMAKE_LFLAGS_RELEASE += /LTCG
CONFIG -= embed_manifest_exe
}
unix:!macx{
INCLUDEPATH += /usr/include/poppler/qt5
LIBS += -L/usr/lib -lpoppler-qt5
!CONFIG(no_opengl) {
LIBS += -lGLU
}
}
macx{
#INCLUDEPATH += "/Volumes/Mac OS X Lion/usr/X11/include"
#isEqual(QT_MAJOR_VERSION, 5) {
#INCLUDEPATH += /usr/local/include/poppler/qt5
#LIBS += -L/usr/local/lib -lpoppler-qt5
#}
#else {
#INCLUDEPATH += /usr/local/include/poppler/qt4
#LIBS += -L/usr/local/lib -lpoppler-qt4
#}
CONFIG += objective_c
QT += macextras gui-private
LIBS += -framework Foundation -framework ApplicationServices -framework AppKit
OBJECTIVE_SOURCES += ../common/pdf_comic.mm
HEADERS += ../common/pdf_comic.h
}
QT += network widgets core
!CONFIG(no_opengl) {
QT += opengl
}
#CONFIG += release
CONFIG -= flat
QT += multimedia
# Input
HEADERS += ../common/comic.h \
configuration.h \
goto_dialog.h \
magnifying_glass.h \
main_window_viewer.h \
viewer.h \
goto_flow.h \
options_dialog.h \
../common/bookmarks.h \
bookmarks_dialog.h \
render.h \
shortcuts_dialog.h \
translator.h \
goto_flow_widget.h \
page_label_widget.h \
goto_flow_toolbar.h \
goto_flow_decorationbar.h \
width_slider.h \
notifications_label_widget.h \
../common/pictureflow.h \
../common/custom_widgets.h \
../common/check_new_version.h \
../common/qnaturalsorting.h \
../common/yacreader_global.h \
../common/onstart_flow_selection_dialog.h \
../common/comic_db.h \
../common/folder.h \
../common/library_item.h \
yacreader_local_client.h \
../common/http_worker.h \
../common/exit_check.h \
../common/scroll_management.h
!CONFIG(no_opengl) {
CONFIG(legacy_gl_widget) {
message("using legacy YACReaderFlowGL (QGLWidget) header")
HEADERS += ../common/gl_legacy/yacreader_flow_gl.h
} else {
HEADERS += ../common/gl/yacreader_flow_gl.h
}
HEADERS += goto_flow_gl.h
}
SOURCES += ../common/comic.cpp \
configuration.cpp \
goto_dialog.cpp \
magnifying_glass.cpp \
main_window_viewer.cpp \
viewer.cpp \
goto_flow.cpp \
options_dialog.cpp \
../common/bookmarks.cpp \
bookmarks_dialog.cpp \
render.cpp \
shortcuts_dialog.cpp \
translator.cpp \
goto_flow_widget.cpp \
page_label_widget.cpp \
goto_flow_toolbar.cpp \
goto_flow_decorationbar.cpp \
width_slider.cpp \
notifications_label_widget.cpp \
../common/pictureflow.cpp \
../common/custom_widgets.cpp \
../common/check_new_version.cpp \
../common/qnaturalsorting.cpp \
../common/onstart_flow_selection_dialog.cpp \
../common/comic_db.cpp \
../common/folder.cpp \
../common/library_item.cpp \
yacreader_local_client.cpp \
../common/http_worker.cpp \
../common/yacreader_global.cpp \
../common/exit_check.cpp \
../common/scroll_management.cpp
!CONFIG(no_opengl) {
CONFIG(legacy_gl_widget) {
message("using legacy YACReaderFlowGL (QGLWidget) source code")
SOURCES += ../common/gl_legacy/yacreader_flow_gl.cpp
} else {
SOURCES += ../common/gl/yacreader_flow_gl.cpp
}
SOURCES += goto_flow_gl.cpp
}
include(../custom_widgets/custom_widgets_yacreader.pri)
include(../compressed_archive/wrapper.pri)
include(../shortcuts_management/shortcuts_management.pri)
RESOURCES += yacreader_images.qrc \
yacreader_files.qrc
win32:RESOURCES += yacreader_images_win.qrc
unix:!macx:RESOURCES += yacreader_images_win.qrc
macx:RESOURCES += yacreader_images_osx.qrc
include(../QsLog/QsLog.pri)
RC_FILE = icon.rc
@ -90,7 +253,7 @@ icon.path = $$DATADIR/yacreader
icon.files = ../images/icon.png
desktop.path = $$DATADIR/applications
desktop.extra = desktop-file-edit --set-icon=$$DATADIR/yacreader/icon.png $$PWD/../YACReader.desktop
desktop.extra = desktop-file-edit --set-icon=$$DATADIR/yacreader/icon.png ../YACReader.desktop
desktop.files = ../YACReader.desktop
#TODO: icons should be located at /usr/share/icons and have the same basename as their application

View File

@ -889,58 +889,6 @@ void MainWindowViewer::toggleFullScreen()
Configuration::getConfiguration().setFullScreen(fullscreen = !fullscreen);
}
//QTBUG-41883
#ifdef Q_OS_WIN
void MainWindowViewer::toFullScreen()
{
_size = size();
_pos = pos();
hide();
fromMaximized = this->isMaximized();
hideToolBars();
viewer->hide();
viewer->fullscreen = true;//TODO, change by the right use of windowState();
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
setWindowState(windowState() | Qt::WindowFullScreen);
resize(windowHandle()->screen()->size()-QSize(0,1));
viewer->show();
if(viewer->magnifyingGlassIsVisible())
viewer->showMagnifyingGlass();
show();
}
//QTBUG-41883
void MainWindowViewer::toNormal()
{
hide();
//show all
viewer->hide();
viewer->fullscreen = false;//TODO, change by the right use of windowState();
//viewer->hideMagnifyingGlass();
setWindowFlags(windowFlags() & ~Qt::WindowStaysOnTopHint);
setWindowState(windowState() & ~Qt::WindowFullScreen);
resize(_size);
move(_pos);
if(fromMaximized)
showMaximized();
else
showNormal();
if(Configuration::getConfiguration().getShowToolbars())
showToolBars();
viewer->show();
if(viewer->magnifyingGlassIsVisible())
viewer->showMagnifyingGlass();
show();
}
#else
void MainWindowViewer::toFullScreen()
{
fromMaximized = this->isMaximized();
@ -972,8 +920,6 @@ void MainWindowViewer::toNormal()
viewer->showMagnifyingGlass();
}
#endif
void MainWindowViewer::toggleToolBars()
{
toolbars?hideToolBars():showToolBars();

View File

@ -19,6 +19,12 @@ CONFIG(no_opengl) {
DEFINES += NO_OPENGL
}
CONFIG(legacy_gl_widget) {
INCLUDEPATH += ../common/gl_legacy \
} else {
INCLUDEPATH += ../common/gl \
}
win32 {
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32
@ -135,7 +141,12 @@ HEADERS += comic_flow.h \
../common/scroll_management.h
!CONFIG(no_opengl) {
HEADERS += ../common/yacreader_flow_gl.h
CONFIG(legacy_gl_widget) {
message("using legacy YACReaderFlowGL (QGLWidget) header")
HEADERS += ../common/gl_legacy/yacreader_flow_gl.h
} else {
HEADERS += ../common/gl/yacreader_flow_gl.h
}
}
SOURCES += comic_flow.cpp \
@ -198,7 +209,12 @@ SOURCES += comic_flow.cpp \
../common/scroll_management.cpp
!CONFIG(no_opengl) {
SOURCES += ../common/yacreader_flow_gl.cpp
CONFIG(legacy_gl_widget) {
message("using legacy YACReaderFlowGL (QGLWidget) source code")
SOURCES += ../common/gl_legacy/yacreader_flow_gl.cpp
} else {
SOURCES += ../common/gl/yacreader_flow_gl.cpp
}
}

View File

@ -2085,64 +2085,6 @@ void LibraryWindow::toggleFullScreen()
fullscreen = !fullscreen;
}
#ifdef Q_OS_WIN
//QTBUG-41883
void LibraryWindow::toFullScreen()
{
_size = size();
_pos = pos();
hide();
fromMaximized = this->isMaximized();
sideBar->hide();
libraryToolBar->hide();
comicsView->toFullScreen();
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
setWindowState(windowState() | Qt::WindowFullScreen);
resize(windowHandle()->screen()->size()-QSize(0,1));
show();
}
//QTBUG-41883
void LibraryWindow::toNormal()
{
hide();
sideBar->show();
comicsView->toNormal();
setWindowFlags(windowFlags() & ~Qt::WindowStaysOnTopHint);
setWindowState(windowState() & ~Qt::WindowFullScreen);
resize(_size);
move(_pos);
if(fromMaximized)
showMaximized();
else
showNormal();
#ifdef Q_OS_MAC
QTimer * timer = new QTimer();
timer->setSingleShot(true);
timer->start();
connect(timer,SIGNAL(timeout()),libraryToolBar,SLOT(show()));
connect(timer,SIGNAL(timeout()),timer,SLOT(deleteLater()));
#else
libraryToolBar->show();
#endif
show();
}
#else
void LibraryWindow::toFullScreen()
{
fromMaximized = this->isMaximized();
@ -2178,8 +2120,6 @@ void LibraryWindow::toNormal()
}
#endif
void LibraryWindow::setSearchFilter(const YACReader::SearchModifiers modifier, QString filter)
{
if(!filter.isEmpty())

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,380 @@
//OpenGL Coverflow API by J.Roth
#ifndef __YACREADER_FLOW_GL_H
#define __YACREADER_FLOW_GL_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <QtOpenGL>
#include <QGLWidget>
#include <QtWidgets>
#include "pictureflow.h" //TODO mover los tipos de flow de sitio
#include "scroll_management.h"
class ImageLoaderGL;
class QGLContext;
class WidgetLoader;
class ImageLoaderByteArrayGL;
enum Performance
{
low=0,
medium,
high,
ultraHigh
};
//Cover Vector
struct YACReader3DVector{
float x;
float y;
float z;
float rot;
};
//the image/texture info struct
struct YACReader3DImage{
GLuint texture;
//char name[256];
float width;
float height;
int index;
YACReader3DVector current;
YACReader3DVector animEnd;
};
struct Preset{
/*** Animation Settings ***/
//sets the speed of the animation
float animationStep;
//sets the acceleration of the animation
float animationSpeedUp;
//sets the maximum speed of the animation
float animationStepMax;
//sets the distance of view
float animationFadeOutDist;
//sets the rotation increasion
float preRotation;
//sets the light strenght on rotation
float viewRotateLightStrenght;
//sets the speed of the rotation
float viewRotateAdd;
//sets the speed of reversing the rotation
float viewRotateSub;
//sets the maximum view angle
float viewAngle;
/*** Position Configuration ***/
//the X Position of the Coverflow
float cfX;
//the Y Position of the Coverflow
float cfY;
//the Z Position of the Coverflow
float cfZ;
//the X Rotation of the Coverflow
float cfRX;
//the Y Rotation of the Coverflow
float cfRY;
//the Z Rotation of the Coverflow
float cfRZ;
//sets the rotation of each cover
float rotation;
//sets the distance between the covers
float xDistance;
//sets the distance between the centered and the non centered covers
float centerDistance;
//sets the pushback amount
float zDistance;
//sets the elevation amount
float yDistance;
float zoom;
};
extern struct Preset defaultYACReaderFlowConfig;
extern struct Preset presetYACReaderFlowClassicConfig;
extern struct Preset presetYACReaderFlowStripeConfig;
extern struct Preset presetYACReaderFlowOverlappedStripeConfig;
extern struct Preset pressetYACReaderFlowUpConfig;
extern struct Preset pressetYACReaderFlowDownConfig;
class YACReaderFlowGL : public QGLWidget, public ScrollManagement
{
Q_OBJECT
protected:
int timerId;
/*** System variables ***/
YACReader3DImage dummy;
int viewRotateActive;
float stepBackup;
/*functions*/
void calcPos(YACReader3DImage & image, int pos);
void calcVector(YACReader3DVector & vector, int pos);
//returns true if the animation is finished for Current
bool animate(YACReader3DVector &currentVector, YACReader3DVector &toVector);
void drawCover(const YACReader3DImage & image);
void udpatePerspective(int width, int height);
int updateCount;
WidgetLoader * loader;
int fontSize;
GLuint defaultTexture;
GLuint markTexture;
GLuint readingTexture;
void initializeGL();
void paintGL();
void timerEvent(QTimerEvent *);
//number of Covers
int numObjects;
int lazyPopulateObjects;
bool showMarks;
QVector<bool> loaded;
QVector<YACReaderComicReadStatus> marks;
QVector<YACReader3DImage> images;
bool hasBeenInitialized;
Performance performance;
bool bUseVSync;
/*** Animation Settings ***/
Preset config;
//sets/returns the curent selected cover
int currentSelected;
//defines the position of the centered cover
YACReader3DVector centerPos;
/*** Style ***/
//sets the amount of shading of the covers in the back (0-1)
float shadingTop;
float shadingBottom;
//sets the reflection strenght (0-1)
float reflectionUp;
float reflectionBottom;
/*** System info ***/
float viewRotate;
//sets the updateInterval in ms
static int updateInterval;
void startAnimationTimer();
void stopAnimationTimer();
public:
/*Constructor*/
YACReaderFlowGL(QWidget *parent = 0,struct Preset p = pressetYACReaderFlowDownConfig);
virtual ~YACReaderFlowGL();
//size;
QSize minimumSizeHint() const;
//QSize sizeHint() const;
/*functions*/
//if called it moves the coverflow to the left
void showPrevious();
//if called it moves the coverflow to the right
void showNext();
//go to
void setCurrentIndex(int pos);
//must be called whenever the coverflow animation is stopped
void cleanupAnimation();
//Draws the coverflow
void draw();
//updates the coverflow
void updatePositions();
//inserts a new item to the coverflow
//if item is set to a value > -1 it updates a already set value
//otherwise a new entry is set
void insert(const char *name, GLuint Tex, float x, float y,int item = -1);
//removes a item
virtual void remove(int item);
//replaces the texture of the item 'item' with Tex
void replace(const char *name, GLuint Tex, float x, float y,int item);
//create n covers with the default nu
void populate(int n);
/*Info*/
//retuns the YACReader3DImage Struct of the current selected item
//to read title or textures
YACReader3DImage getCurrentSelected();
public slots:
void setCF_RX(int value);
//the Y Rotation of the Coverflow
void setCF_RY(int value);
//the Z Rotation of the Coverflow
void setCF_RZ(int value);
//perspective
void setZoom(int zoom);
void setRotation(int angle);
//sets the distance between the covers
void setX_Distance(int distance);
//sets the distance between the centered and the non centered covers
void setCenter_Distance(int distance);
//sets the pushback amount
void setZ_Distance(int distance);
void setCF_Y(int value);
void setCF_Z(int value);
void setY_Distance(int value);
void setFadeOutDist(int value);
void setLightStrenght(int value);
void setMaxAngle(int value);
void setPreset(const Preset & p);
void setPerformance(Performance performance);
void useVSync(bool b);
virtual void updateImageData() = 0;
void reset();
void reload();
//interface with yacreaderlibrary, compatibility
void setShowMarks(bool value);
void setMarks(QVector<YACReaderComicReadStatus> marks);
void setMarkImage(QImage & image);
void markSlide(int index, YACReaderComicReadStatus status);
void unmarkSlide(int index);
void setSlideSize(QSize size);
void clear();
void setCenterIndex(unsigned int index);
void showSlide(int index);
int centerIndex();
void updateMarks();
//void setFlowType(PictureFlow::FlowType flowType);
void render();
//void paintEvent(QPaintEvent *event);
void mouseDoubleClickEvent(QMouseEvent* event);
void mousePressEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent * event);
void keyPressEvent(QKeyEvent *event);
void resizeGL(int width, int height);
friend class ImageLoaderGL;
friend class ImageLoaderByteArrayGL;
signals:
void centerIndexChanged(int);
void selected(unsigned int);
};
class YACReaderComicFlowGL : public YACReaderFlowGL
{
public:
YACReaderComicFlowGL(QWidget *parent = 0,struct Preset p = defaultYACReaderFlowConfig);
void setImagePaths(QStringList paths);
void updateImageData();
void remove(int item);
void resortCovers(QList<int> newOrder);
friend class ImageLoaderGL;
private:
ImageLoaderGL * worker;
protected:
QList<QString> paths;
};
class YACReaderPageFlowGL : public YACReaderFlowGL
{
public:
YACReaderPageFlowGL(QWidget *parent = 0,struct Preset p = defaultYACReaderFlowConfig);
~YACReaderPageFlowGL();
void updateImageData();
void populate(int n);
QVector<bool> imagesReady;
QVector<QByteArray> rawImages;
QVector<bool> imagesSetted;
friend class ImageLoaderByteArrayGL;
private:
ImageLoaderByteArrayGL * worker;
};
class ImageLoaderGL : public QThread
{
public:
ImageLoaderGL(YACReaderFlowGL * flow);
~ImageLoaderGL();
// returns FALSE if worker is still busy and can't take the task
bool busy() const;
void generate(int index, const QString& fileName);
void reset(){idx = -1;fileName="";}
int index() const { return idx; }
void lock();
void unlock();
QImage result();
YACReaderFlowGL * flow;
GLuint resultTexture;
QImage loadImage(const QString& fileName);
protected:
void run();
private:
QMutex mutex;
QWaitCondition condition;
bool restart;
bool working;
int idx;
QString fileName;
QSize size;
QImage img;
};
class ImageLoaderByteArrayGL : public QThread
{
public:
ImageLoaderByteArrayGL(YACReaderFlowGL * flow);
~ImageLoaderByteArrayGL();
// returns FALSE if worker is still busy and can't take the task
bool busy() const;
void generate(int index, const QByteArray& raw);
void reset(){idx = -1; rawData.clear();}
int index() const { return idx; }
QImage result();
YACReaderFlowGL * flow;
GLuint resultTexture;
QImage loadImage(const QByteArray& rawData);
protected:
void run();
private:
QMutex mutex;
QWaitCondition condition;
bool restart;
bool working;
int idx;
QByteArray rawData;
QSize size;
QImage img;
};
#endif