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:
@ -127,6 +127,8 @@ win32:RESOURCES += images_win.qrc
|
||||
unix:!macx:RESOURCES += images_win.qrc
|
||||
macx:RESOURCES += images_osx.qrc
|
||||
|
||||
include(../YACReader/YACReader.pri)
|
||||
|
||||
RC_FILE = icon.rc
|
||||
|
||||
macx {
|
||||
|
@ -394,6 +394,25 @@ QVector<bool> TableModel::setAllComicsRead(bool read)
|
||||
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> comics;
|
||||
|
@ -41,6 +41,7 @@ public:
|
||||
QVector<bool> getReadList();
|
||||
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> getAllComics();
|
||||
QModelIndex getIndexFromId(quint64 id);
|
||||
//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.
|
||||
|
@ -55,7 +55,7 @@
|
||||
#include "comics_remover.h"
|
||||
#include "yacreader_library_list_widget.h"
|
||||
#include "yacreader_treeview.h"
|
||||
|
||||
#include "main_window_viewer.h"
|
||||
//#include "yacreader_social_dialog.h"
|
||||
//
|
||||
|
||||
@ -1006,19 +1006,25 @@ void LibraryWindow::openComic()
|
||||
{
|
||||
ComicDB comic = dmCV->getComic(comicView->currentIndex());
|
||||
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;
|
||||
//TODO generate IDS for libraries...
|
||||
quint64 libraryId = selectedLibrary->currentIndex();
|
||||
int page = *(comic.info.numPages) / 2;*/
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
|
||||
QProcess::startDetached("open", QStringList() << "-n" << QDir::cleanPath(QCoreApplication::applicationDirPath()+"/../../../YACReader.app") << "--args" << path /*<< comicId << libraryId << page*/);//,QStringList() << path);
|
||||
//Comic is readed
|
||||
#else
|
||||
|
||||
QProcess::startDetached(QDir::cleanPath(QCoreApplication::applicationDirPath())+QString("/YACReader \"%1\"").arg(path)/*.arg(comicId).arg(libraryId).arg(page)*/,QStringList());
|
||||
#endif
|
||||
//#ifdef Q_OS_MAC
|
||||
//
|
||||
// QProcess::startDetached("open", QStringList() << "-n" << QDir::cleanPath(QCoreApplication::applicationDirPath()+"/../../../YACReader.app") << "--args" << path /*<< comicId << libraryId << page*/);//,QStringList() << path);
|
||||
// //Comic is readed
|
||||
//#else
|
||||
//
|
||||
// QProcess::startDetached(QDir::cleanPath(QCoreApplication::applicationDirPath())+QString("/YACReader \"%1\"").arg(path)/*.arg(comicId).arg(libraryId).arg(page)*/,QStringList());
|
||||
//#endif
|
||||
//Comic is readed
|
||||
setCurrentComicReaded();
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "yacreader_global.h"
|
||||
#include "startup.h"
|
||||
#include "yacreader_local_server.h"
|
||||
|
||||
#define PICTUREFLOW_QT4 1
|
||||
|
||||
//interfaz al servidor
|
||||
@ -21,6 +22,10 @@ int main( int argc, char ** argv )
|
||||
QString sufix = QLocale::system().name();
|
||||
translator.load(QCoreApplication::applicationDirPath()+"/languages/yacreaderlibrary_"+sufix);
|
||||
app.installTranslator(&translator);
|
||||
|
||||
QTranslator viewerTranslator;
|
||||
viewerTranslator.load(QCoreApplication::applicationDirPath()+"/languages/yacreader_"+sufix);
|
||||
app.installTranslator(&viewerTranslator);
|
||||
app.setApplicationName("YACReaderLibrary");
|
||||
|
||||
#ifdef SERVER_RELEASE
|
||||
|
Reference in New Issue
Block a user