mirror of
https://github.com/YACReader/yacreader
synced 2025-07-18 04:54:29 -04:00
YACReaderLibrary opens now its own viewer windows
This commit is contained in:
@ -5,108 +5,9 @@ TEMPLATE = app
|
|||||||
TARGET =
|
TARGET =
|
||||||
DEPENDPATH += . \
|
DEPENDPATH += . \
|
||||||
release
|
release
|
||||||
INCLUDEPATH += .
|
|
||||||
INCLUDEPATH += ../common \
|
|
||||||
../custom_widgets
|
|
||||||
|
|
||||||
win32 {
|
SOURCES += main.cpp
|
||||||
INCLUDEPATH += ../dependencies/poppler/include
|
include(YACReader.pri)
|
||||||
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
|
|
||||||
|
|
||||||
RC_FILE = icon.rc
|
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)
|
void MainWindowViewer::openComicFromPath(QString pathFile)
|
||||||
{
|
{
|
||||||
currentDirectory = pathFile;
|
currentDirectory = pathFile;
|
||||||
@ -795,10 +823,19 @@ void MainWindowViewer::closeEvent ( QCloseEvent * event )
|
|||||||
conf.setSize(size());
|
conf.setSize(size());
|
||||||
}
|
}
|
||||||
conf.setMaximized(isMaximized());
|
conf.setMaximized(isMaximized());
|
||||||
|
|
||||||
|
emit (closed());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindowViewer::openPreviousComic()
|
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())
|
if(!previousComicPath.isEmpty())
|
||||||
{
|
{
|
||||||
viewer->open(previousComicPath);
|
viewer->open(previousComicPath);
|
||||||
@ -811,6 +848,13 @@ void MainWindowViewer::openPreviousComic()
|
|||||||
|
|
||||||
void MainWindowViewer::openNextComic()
|
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())
|
if(!nextComicPath.isEmpty())
|
||||||
{
|
{
|
||||||
viewer->open(nextComicPath);
|
viewer->open(nextComicPath);
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
|
#include "comic_db.h"
|
||||||
|
|
||||||
class Comic;
|
class Comic;
|
||||||
class Viewer;
|
class Viewer;
|
||||||
class OptionsDialog;
|
class OptionsDialog;
|
||||||
@ -23,6 +25,7 @@ class YACReaderSliderAction;
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void open();
|
void open();
|
||||||
|
void open(QString path, ComicDB & comic, QList<ComicDB> & siblings);
|
||||||
void openFolder();
|
void openFolder();
|
||||||
void saveImage();
|
void saveImage();
|
||||||
void toggleToolBars();
|
void toggleToolBars();
|
||||||
@ -115,7 +118,11 @@ class YACReaderSliderAction;
|
|||||||
void dragEnterEvent(QDragEnterEvent *event);
|
void dragEnterEvent(QDragEnterEvent *event);
|
||||||
|
|
||||||
QSettings * settings;
|
QSettings * settings;
|
||||||
|
|
||||||
|
ComicDB currentComicDB;
|
||||||
|
QList<ComicDB> siblingComics;
|
||||||
|
signals:
|
||||||
|
void closed();
|
||||||
protected:
|
protected:
|
||||||
virtual void closeEvent ( QCloseEvent * event );
|
virtual void closeEvent ( QCloseEvent * event );
|
||||||
public:
|
public:
|
||||||
|
@ -127,6 +127,8 @@ win32:RESOURCES += images_win.qrc
|
|||||||
unix:!macx:RESOURCES += images_win.qrc
|
unix:!macx:RESOURCES += images_win.qrc
|
||||||
macx:RESOURCES += images_osx.qrc
|
macx:RESOURCES += images_osx.qrc
|
||||||
|
|
||||||
|
include(../YACReader/YACReader.pri)
|
||||||
|
|
||||||
RC_FILE = icon.rc
|
RC_FILE = icon.rc
|
||||||
|
|
||||||
macx {
|
macx {
|
||||||
|
@ -394,6 +394,25 @@ QVector<bool> TableModel::setAllComicsRead(bool read)
|
|||||||
return readList;
|
return readList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<ComicDB> TableModel::getAllComics()
|
||||||
|
{
|
||||||
|
QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath);
|
||||||
|
db.transaction();
|
||||||
|
|
||||||
|
QList<ComicDB> comics;
|
||||||
|
int numComics = _data.count();
|
||||||
|
for(int i=0;i<numComics;i++)
|
||||||
|
{
|
||||||
|
comics.append(DBHelper::loadComic(_data.value(i)->data(ID).toULongLong(),db));
|
||||||
|
}
|
||||||
|
|
||||||
|
db.commit();
|
||||||
|
db.close();
|
||||||
|
QSqlDatabase::removeDatabase(_databasePath);
|
||||||
|
|
||||||
|
return comics;
|
||||||
|
}
|
||||||
|
|
||||||
QList<ComicDB> TableModel::getComics(QList<QModelIndex> list)
|
QList<ComicDB> TableModel::getComics(QList<QModelIndex> list)
|
||||||
{
|
{
|
||||||
QList<ComicDB> comics;
|
QList<ComicDB> comics;
|
||||||
|
@ -41,6 +41,7 @@ public:
|
|||||||
QVector<bool> getReadList();
|
QVector<bool> getReadList();
|
||||||
QVector<bool> setAllComicsRead(bool read);
|
QVector<bool> setAllComicsRead(bool read);
|
||||||
QList<ComicDB> getComics(QList<QModelIndex> list); //--> recupera la informaci<63>n com<6F>n a los comics seleccionados
|
QList<ComicDB> getComics(QList<QModelIndex> list); //--> recupera la informaci<63>n com<6F>n a los comics seleccionados
|
||||||
|
QList<ComicDB> getAllComics();
|
||||||
QModelIndex getIndexFromId(quint64 id);
|
QModelIndex getIndexFromId(quint64 id);
|
||||||
//setcomicInfo(QModelIndex & mi); --> inserta en la base datos
|
//setcomicInfo(QModelIndex & mi); --> inserta en la base datos
|
||||||
//setComicInfoForAllComics(); --> inserta la informaci<63>n com<6F>n a todos los c<>mics de una sola vez.
|
//setComicInfoForAllComics(); --> inserta la informaci<63>n com<6F>n a todos los c<>mics de una sola vez.
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
#include "comics_remover.h"
|
#include "comics_remover.h"
|
||||||
#include "yacreader_library_list_widget.h"
|
#include "yacreader_library_list_widget.h"
|
||||||
#include "yacreader_treeview.h"
|
#include "yacreader_treeview.h"
|
||||||
|
#include "main_window_viewer.h"
|
||||||
//#include "yacreader_social_dialog.h"
|
//#include "yacreader_social_dialog.h"
|
||||||
//
|
//
|
||||||
|
|
||||||
@ -1006,19 +1006,25 @@ void LibraryWindow::openComic()
|
|||||||
{
|
{
|
||||||
ComicDB comic = dmCV->getComic(comicView->currentIndex());
|
ComicDB comic = dmCV->getComic(comicView->currentIndex());
|
||||||
QString path = currentPath() + comic.path;
|
QString path = currentPath() + comic.path;
|
||||||
|
MainWindowViewer * viewer = new MainWindowViewer();
|
||||||
|
QList<ComicDB> siblings = dmCV->getAllComics();
|
||||||
|
viewer->open(path,comic,siblings);
|
||||||
|
viewer->show();
|
||||||
|
|
||||||
|
connect(viewer,SIGNAL(closed()),viewer,SLOT(deleteLater()));
|
||||||
/*quint64 comicId = comic.id;
|
/*quint64 comicId = comic.id;
|
||||||
//TODO generate IDS for libraries...
|
//TODO generate IDS for libraries...
|
||||||
quint64 libraryId = selectedLibrary->currentIndex();
|
quint64 libraryId = selectedLibrary->currentIndex();
|
||||||
int page = *(comic.info.numPages) / 2;*/
|
int page = *(comic.info.numPages) / 2;*/
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
//#ifdef Q_OS_MAC
|
||||||
|
//
|
||||||
QProcess::startDetached("open", QStringList() << "-n" << QDir::cleanPath(QCoreApplication::applicationDirPath()+"/../../../YACReader.app") << "--args" << path /*<< comicId << libraryId << page*/);//,QStringList() << path);
|
// QProcess::startDetached("open", QStringList() << "-n" << QDir::cleanPath(QCoreApplication::applicationDirPath()+"/../../../YACReader.app") << "--args" << path /*<< comicId << libraryId << page*/);//,QStringList() << path);
|
||||||
//Comic is readed
|
// //Comic is readed
|
||||||
#else
|
//#else
|
||||||
|
//
|
||||||
QProcess::startDetached(QDir::cleanPath(QCoreApplication::applicationDirPath())+QString("/YACReader \"%1\"").arg(path)/*.arg(comicId).arg(libraryId).arg(page)*/,QStringList());
|
// QProcess::startDetached(QDir::cleanPath(QCoreApplication::applicationDirPath())+QString("/YACReader \"%1\"").arg(path)/*.arg(comicId).arg(libraryId).arg(page)*/,QStringList());
|
||||||
#endif
|
//#endif
|
||||||
//Comic is readed
|
//Comic is readed
|
||||||
setCurrentComicReaded();
|
setCurrentComicReaded();
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "yacreader_global.h"
|
#include "yacreader_global.h"
|
||||||
#include "startup.h"
|
#include "startup.h"
|
||||||
#include "yacreader_local_server.h"
|
#include "yacreader_local_server.h"
|
||||||
|
|
||||||
#define PICTUREFLOW_QT4 1
|
#define PICTUREFLOW_QT4 1
|
||||||
|
|
||||||
//interfaz al servidor
|
//interfaz al servidor
|
||||||
@ -21,6 +22,10 @@ int main( int argc, char ** argv )
|
|||||||
QString sufix = QLocale::system().name();
|
QString sufix = QLocale::system().name();
|
||||||
translator.load(QCoreApplication::applicationDirPath()+"/languages/yacreaderlibrary_"+sufix);
|
translator.load(QCoreApplication::applicationDirPath()+"/languages/yacreaderlibrary_"+sufix);
|
||||||
app.installTranslator(&translator);
|
app.installTranslator(&translator);
|
||||||
|
|
||||||
|
QTranslator viewerTranslator;
|
||||||
|
viewerTranslator.load(QCoreApplication::applicationDirPath()+"/languages/yacreader_"+sufix);
|
||||||
|
app.installTranslator(&viewerTranslator);
|
||||||
app.setApplicationName("YACReaderLibrary");
|
app.setApplicationName("YACReaderLibrary");
|
||||||
|
|
||||||
#ifdef SERVER_RELEASE
|
#ifdef SERVER_RELEASE
|
||||||
|
@ -120,6 +120,8 @@ public:
|
|||||||
|
|
||||||
ComicInfo info;
|
ComicInfo info;
|
||||||
|
|
||||||
|
bool operator==(const ComicDB & other){return id == other.id;};
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &, const ComicDB &);
|
friend QDataStream &operator<<(QDataStream &, const ComicDB &);
|
||||||
friend QDataStream &operator>>(QDataStream &, ComicDB &);
|
friend QDataStream &operator>>(QDataStream &, ComicDB &);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user