mirror of
https://github.com/YACReader/yacreader
synced 2025-07-21 06:24:39 -04:00
YACReaderLibrary opens now its own viewer windows
This commit is contained in:
@ -5,108 +5,9 @@ TEMPLATE = app
|
||||
TARGET =
|
||||
DEPENDPATH += . \
|
||||
release
|
||||
INCLUDEPATH += .
|
||||
INCLUDEPATH += ../common \
|
||||
../custom_widgets
|
||||
|
||||
win32 {
|
||||
INCLUDEPATH += ../dependencies/poppler/include
|
||||
LIBS += -L../dependencies/poppler/lib -lpoppler-qt4
|
||||
QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL
|
||||
QMAKE_LFLAGS_RELEASE += /LTCG
|
||||
CONFIG -= embed_manifest_exe
|
||||
}
|
||||
|
||||
unix:!macx{
|
||||
INCLUDEPATH += /usr/include/poppler/qt4
|
||||
LIBS += -L/usr/lib -lpoppler-qt4
|
||||
LIBS += -lGLU
|
||||
}
|
||||
|
||||
macx{
|
||||
#INCLUDEPATH += "/Volumes/Mac OS X Lion/usr/X11/include"
|
||||
INCLUDEPATH += /usr/local/include/poppler/qt4
|
||||
LIBS += -L/usr/local/lib -lpoppler-qt4
|
||||
}
|
||||
|
||||
QT += network phonon opengl
|
||||
CONFIG += release
|
||||
CONFIG -= flat
|
||||
|
||||
# Input
|
||||
HEADERS += comic.h \
|
||||
configuration.h \
|
||||
goto_dialog.h \
|
||||
magnifying_glass.h \
|
||||
main_window_viewer.h \
|
||||
viewer.h \
|
||||
goto_flow.h \
|
||||
options_dialog.h \
|
||||
bookmarks.h \
|
||||
bookmarks_dialog.h \
|
||||
render.h \
|
||||
shortcuts_dialog.h \
|
||||
translator.h \
|
||||
goto_flow_gl.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_flow_gl.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
|
||||
|
||||
SOURCES += comic.cpp \
|
||||
configuration.cpp \
|
||||
goto_dialog.cpp \
|
||||
magnifying_glass.cpp \
|
||||
main.cpp \
|
||||
main_window_viewer.cpp \
|
||||
viewer.cpp \
|
||||
goto_flow.cpp \
|
||||
options_dialog.cpp \
|
||||
bookmarks.cpp \
|
||||
bookmarks_dialog.cpp \
|
||||
render.cpp \
|
||||
shortcuts_dialog.cpp \
|
||||
translator.cpp \
|
||||
goto_flow_gl.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/yacreader_flow_gl.cpp \
|
||||
../common/onstart_flow_selection_dialog.cpp \
|
||||
../common/comic_db.cpp \
|
||||
../common/folder.cpp \
|
||||
../common/library_item.cpp \
|
||||
yacreader_local_client.cpp
|
||||
|
||||
include(../custom_widgets/custom_widgets.pri)
|
||||
include(../compressed_archive/wrapper.pri)
|
||||
|
||||
RESOURCES += images.qrc \
|
||||
files.qrc
|
||||
|
||||
win32:RESOURCES += images_win.qrc
|
||||
unix:!macx:RESOURCES += images_win.qrc
|
||||
macx:RESOURCES += images_osx.qrc
|
||||
SOURCES += main.cpp
|
||||
include(YACReader.pri)
|
||||
|
||||
RC_FILE = icon.rc
|
||||
|
||||
|
@ -558,6 +558,34 @@ void MainWindowViewer::open()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindowViewer::open(QString path, ComicDB & comic, QList<ComicDB> & siblings)
|
||||
{
|
||||
currentComicDB = comic;
|
||||
siblingComics = siblings;
|
||||
|
||||
QFileInfo fi(path);
|
||||
currentDirectory = fi.absoluteDir().path();
|
||||
|
||||
if(comic.info.title != 0 && !comic.info.title->isEmpty())
|
||||
setWindowTitle("YACReader - " + *comic.info.title);
|
||||
else
|
||||
setWindowTitle("YACReader - " + fi.fileName());
|
||||
|
||||
viewer->open(path);
|
||||
enableActions();
|
||||
int index = siblings.indexOf(comic);
|
||||
|
||||
if(index>0)
|
||||
openPreviousComicAction->setDisabled(false);
|
||||
else
|
||||
openPreviousComicAction->setDisabled(true);
|
||||
|
||||
if(index+1<siblings.count())
|
||||
openNextComicAction->setDisabled(false);
|
||||
else
|
||||
openNextComicAction->setDisabled(true);
|
||||
}
|
||||
|
||||
void MainWindowViewer::openComicFromPath(QString pathFile)
|
||||
{
|
||||
currentDirectory = pathFile;
|
||||
@ -795,10 +823,19 @@ void MainWindowViewer::closeEvent ( QCloseEvent * event )
|
||||
conf.setSize(size());
|
||||
}
|
||||
conf.setMaximized(isMaximized());
|
||||
|
||||
emit (closed());
|
||||
}
|
||||
|
||||
void MainWindowViewer::openPreviousComic()
|
||||
{
|
||||
if(!siblingComics.isEmpty())
|
||||
{
|
||||
int currentIndex = siblingComics.indexOf(currentComicDB);
|
||||
ComicDB previoiusComic = siblingComics.at(currentIndex-1);
|
||||
open(currentDirectory+previoiusComic.path,previoiusComic,siblingComics);
|
||||
return;
|
||||
}
|
||||
if(!previousComicPath.isEmpty())
|
||||
{
|
||||
viewer->open(previousComicPath);
|
||||
@ -811,6 +848,13 @@ void MainWindowViewer::openPreviousComic()
|
||||
|
||||
void MainWindowViewer::openNextComic()
|
||||
{
|
||||
if(!siblingComics.isEmpty())
|
||||
{
|
||||
int currentIndex = siblingComics.indexOf(currentComicDB);
|
||||
ComicDB nextComic = siblingComics.at(currentIndex+1);
|
||||
open(currentDirectory+nextComic.path,nextComic,siblingComics);
|
||||
return;
|
||||
}
|
||||
if(!nextComicPath.isEmpty())
|
||||
{
|
||||
viewer->open(nextComicPath);
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include <QCloseEvent>
|
||||
#include <QSettings>
|
||||
|
||||
#include "comic_db.h"
|
||||
|
||||
class Comic;
|
||||
class Viewer;
|
||||
class OptionsDialog;
|
||||
@ -23,6 +25,7 @@ class YACReaderSliderAction;
|
||||
|
||||
public slots:
|
||||
void open();
|
||||
void open(QString path, ComicDB & comic, QList<ComicDB> & siblings);
|
||||
void openFolder();
|
||||
void saveImage();
|
||||
void toggleToolBars();
|
||||
@ -115,7 +118,11 @@ class YACReaderSliderAction;
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
|
||||
QSettings * settings;
|
||||
|
||||
|
||||
ComicDB currentComicDB;
|
||||
QList<ComicDB> siblingComics;
|
||||
signals:
|
||||
void closed();
|
||||
protected:
|
||||
virtual void closeEvent ( QCloseEvent * event );
|
||||
public:
|
||||
|
Reference in New Issue
Block a user