bookmarks and image optiones are now stored in the library for each comic

This commit is contained in:
Luis Ángel San Martín
2013-08-18 22:06:59 +02:00
parent 2dd51a0df7
commit db9aad8521
18 changed files with 599 additions and 353 deletions

View File

@ -1,8 +1,13 @@
6.8 (No p<>blica)
Corregido bug que causaba un cierre inesperado despu<70>s de cambiar el modo de sincronizaci<63>n vertical (flow)
Corregido bug que causaba que la toolbar en el visor no se pudiese ocultar/mostrar sin un c<>mic abierto
Mejorada la gesti<74>n de errores al abrir c<>mics
Corregidos algunos bugs relacionados con la apertura de c<>mics
6.7 (No p<>blica)
A<EFBFBD>adidos nuevos campos en la base de datos para almacenar informaci<63>n adicional sobre c<>mics: rating, p<>gina actual, bookmarks y configuraci<63>n de imagen
A<EFBFBD>adida comunicaci<63>n entre YACReaderLibrary y YACReader para poder almacenar el progreso de los c<>mics e informaci<63>n adicional
6.6 (No p<>blica)
Modificado YACReader para que abra los archivos comprimidos usando 7z.dll (.so, .dylib)
YACReader abre ahora los c<>mics por la <20>ltima p<>gina le<6C>da.

View File

@ -5,7 +5,7 @@
#include <QFileInfo>
#include <QMessageBox>
#include <QList>
#define NUM_BOOKMARKS 250
Bookmarks::Bookmarks()
@ -84,8 +84,8 @@ void Bookmarks::newComic(const QString & path)
for(int i=0;i<latestBookmarks.count();i++)
bookmarks.insert(latestBookmarks.at(i),QImage());
added = b.added;
}
void Bookmarks::clear()
{
bookmarks.clear();
@ -94,6 +94,19 @@ void Bookmarks::clear()
lastPage = QImage();
}
bool Bookmarks::load(const QList<int> & bookmarkIndexes, int lastPage)
{
lastPageIndex = lastPage;
foreach(int b, bookmarkIndexes)
if(b != -1)
{
latestBookmarks.push_back(b);
bookmarks.insert(b,QImage());
}
return true;
}
void Bookmarks::save()
{
BookmarksList::Bookmark b;

View File

@ -71,6 +71,7 @@ class Bookmarks : public QObject
void newComic(const QString & path);
void clear();
void save();
bool load(const QList<int> & bookmarkIndexes, int lastPage);
};

View File

@ -9,6 +9,7 @@
#include "bookmarks.h" //TODO desacoplar la dependencia con bookmarks
#include "qnaturalsorting.h"
#include "compressed_archive.h"
#include "comic_db.h"
#define EXTENSIONS << "*.jpg" << "*.jpeg" << "*.png" << "*.gif" << "*.tiff" << "*.tif" << "*.bmp"
#define EXTENSIONS_LITERAL << ".jpg" << ".jpeg" << ".png" << ".gif" << ".tiff" << ".tif" << ".bmp"
@ -212,7 +213,29 @@ bool FileComic::load(const QString & path, int atPage)
}
else
{
QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path);
//QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path);
emit errorOpening();
return false;
}
}
bool FileComic::load(const QString & path, const ComicDB & comic)
{
QFileInfo fi(path);
if(fi.exists())
{
QList<int> bookmarkIndexes;
bookmarkIndexes << comic.info.bookmark1 << comic.info.bookmark2 << comic.info.bookmark3;
if(bm->load(bookmarkIndexes,comic.info.currentPage-1))
emit bookmarksUpdated();
_firstPage = comic.info.currentPage-1;
_path = QDir::cleanPath(path);
return true;
}
else
{
//QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path);
emit errorOpening();
return false;
}
@ -547,6 +570,10 @@ PDFComic::~PDFComic()
bool PDFComic::load(const QString & path, int atPage)
{
QFileInfo fi(path);
if(fi.exists())
{
_path = path;
if(atPage == -1)
{
@ -556,6 +583,34 @@ bool PDFComic::load(const QString & path, int atPage)
_firstPage = atPage;
//emit bookmarksLoaded(*bm);
return true;
}
else
{
emit errorOpening();
return false;
}
}
bool PDFComic::load(const QString & path, const ComicDB & comic)
{
QFileInfo fi(path);
if(fi.exists())
{
QList<int> bookmarkIndexes;
bookmarkIndexes << comic.info.bookmark1 << comic.info.bookmark2 << comic.info.bookmark3;
if(bm->load(bookmarkIndexes,comic.info.currentPage-1))
emit bookmarksUpdated();
_firstPage = comic.info.currentPage-1;
_path = QDir::cleanPath(path);
return true;
}
else
{
//QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path);
emit errorOpening();
return false;
}
}
void PDFComic::process()

View File

@ -12,6 +12,8 @@
#include "poppler-qt4.h"
class ComicDB;
class Comic : public QObject
{
Q_OBJECT
@ -43,6 +45,7 @@
void setup();
//Load pages from file
virtual bool load(const QString & path, int atPage = -1) = 0;
virtual bool load(const QString & path, const ComicDB & comic){return false;};
/*void loadFromFile(const QString & pathFile);
void loadFromDir(const QString & pathDir);
@ -95,6 +98,7 @@
~FileComic();
void fileExtracted(int index, const QByteArray & rawData);
virtual bool load(const QString & path, int atPage = -1);
virtual bool load(const QString & path, const ComicDB & comic);
void crcError(int index);
void unknownError(int index);
public slots:
@ -132,6 +136,7 @@
~PDFComic();
virtual bool load(const QString & path, int atPage = -1);
virtual bool load(const QString & path, const ComicDB & comic);
public slots:
void process();
};

View File

@ -142,7 +142,7 @@ void MainWindowViewer::setupUI()
connect(optionsDialog,SIGNAL(accepted()),viewer,SLOT(updateOptions()));
connect(optionsDialog,SIGNAL(fitToWidthRatioChanged(float)),viewer,SLOT(updateFitToWidthRatio(float)));
connect(optionsDialog, SIGNAL(optionsChanged()),this,SLOT(reloadOptions()));
connect(optionsDialog,SIGNAL(changedImageOptions()),viewer,SLOT(updateImageOptions()));
connect(optionsDialog,SIGNAL(changedFilters(int,int,int)),viewer,SLOT(updateFilters(int,int,int)));
optionsDialog->restoreOptions(settings);
shortcutsDialog = new ShortcutsDialog(this);
@ -152,40 +152,7 @@ void MainWindowViewer::setupUI()
setWindowTitle("YACReader");
if(QCoreApplication::argc() == 2) //only path...
{
isClient = false;
//TODO: new method open(QString)
QString pathFile = QCoreApplication::arguments().at(1);
QFileInfo fi(pathFile);
currentDirectory = fi.absoluteDir().path();
getSiblingComics(fi.absolutePath(),fi.fileName());
setWindowTitle("YACReader - " + fi.fileName());
enableActions();
viewer->open(pathFile);
}
else if(QCoreApplication::argc() == 5)
{
isClient = true;
QString pathFile = QCoreApplication::arguments().at(1);
currentDirectory = pathFile;
quint64 comicId = QCoreApplication::arguments().at(2).toULongLong();
libraryId = QCoreApplication::arguments().at(3).toULongLong();
int page = QCoreApplication::arguments().at(4).toULongLong();
enableActions();
//TODO request data to the server
currentComicDB.id = comicId;
YACReaderLocalClient client;
if(client.requestComicInfo(libraryId,currentComicDB,siblingComics))
open(pathFile+currentComicDB.path,currentComicDB,siblingComics);
else
{/*error*/}
}
openFromArgv();
versionChecker = new HttpVersionChecker();
@ -220,6 +187,43 @@ void MainWindowViewer::setupUI()
hideToolBars();
}
void MainWindowViewer::openFromArgv()
{
if(QCoreApplication::argc() == 2) //only path...
{
isClient = false;
//TODO: new method open(QString)
QString pathFile = QCoreApplication::arguments().at(1);
QFileInfo fi(pathFile);
currentDirectory = fi.absoluteDir().path();
getSiblingComics(fi.absolutePath(),fi.fileName());
setWindowTitle("YACReader - " + fi.fileName());
enableActions();
viewer->open(pathFile);
}
else if(QCoreApplication::argc() == 4)
{
isClient = true;
QString pathFile = QCoreApplication::arguments().at(1);
currentDirectory = pathFile;
quint64 comicId = QCoreApplication::arguments().at(2).toULongLong();
libraryId = QCoreApplication::arguments().at(3).toULongLong();
enableActions();
currentComicDB.id = comicId;
YACReaderLocalClient client;
if(client.requestComicInfo(libraryId,currentComicDB,siblingComics))
open(pathFile+currentComicDB.path,currentComicDB,siblingComics);
else
{/*error*/}
optionsDialog->setFilters(currentComicDB.info.brightness, currentComicDB.info.contrast, currentComicDB.info.gamma);
}
}
void MainWindowViewer::createActions()
{
openAction = new QAction(tr("&Open"),this);
@ -598,10 +602,12 @@ void MainWindowViewer::open(QString path, ComicDB & comic, QList<ComicDB> & sibl
else
setWindowTitle("YACReader - " + fi.fileName());
viewer->open(path,comic.info.currentPage-1);
viewer->open(path,comic);
enableActions();
int index = siblings.indexOf(comic);
optionsDialog->setFilters(currentComicDB.info.brightness, currentComicDB.info.contrast, currentComicDB.info.gamma);
if(index>0)
openPreviousComicAction->setDisabled(false);
else
@ -840,20 +846,10 @@ void MainWindowViewer::newVersion()
}
}
void MainWindowViewer::closeEvent ( QCloseEvent * event )
{
YACReaderLocalClient client;
if(isClient)
{
currentComicDB.info.currentPage = viewer->getCurrentPageNumber()+1;
currentComicDB.info.hasBeenOpened = true;
//viewer->getBookmarks();
client.sendComicInfo(libraryId,currentComicDB);
}
sendComic();
viewer->save();
Configuration & conf = Configuration::getConfiguration();
@ -869,20 +865,16 @@ void MainWindowViewer::closeEvent ( QCloseEvent * event )
void MainWindowViewer::openPreviousComic()
{
YACReaderLocalClient client;
if(!siblingComics.isEmpty() && isClient)
{
currentComicDB.info.currentPage = viewer->getCurrentPageNumber()+1;
currentComicDB.info.hasBeenOpened = true;
//viewer->getBookmarks();
client.sendComicInfo(libraryId,currentComicDB);
sendComic();
int currentIndex = siblingComics.indexOf(currentComicDB);
if (currentIndex == -1)
return;
if(currentIndex-1 >= 0 && currentIndex-1 < siblingComics.count())
{
siblingComics[currentIndex] = currentComicDB; //updated
currentComicDB = siblingComics.at(currentIndex-1);
open(currentDirectory+currentComicDB.path,currentComicDB,siblingComics);
}
@ -900,19 +892,16 @@ void MainWindowViewer::openPreviousComic()
void MainWindowViewer::openNextComic()
{
YACReaderLocalClient client;
if(!siblingComics.isEmpty() && isClient)
{
currentComicDB.info.currentPage = viewer->getCurrentPageNumber()+1;
currentComicDB.info.hasBeenOpened = true;
//viewer->getBookmarks();
client.sendComicInfo(libraryId,currentComicDB);
sendComic();
int currentIndex = siblingComics.indexOf(currentComicDB);
if (currentIndex == -1)
return;
if(currentIndex+1 > 0 && currentIndex+1 < siblingComics.count())
{
siblingComics[currentIndex] = currentComicDB; //updated
currentComicDB = siblingComics.at(currentIndex+1);
open(currentDirectory+currentComicDB.path,currentComicDB,siblingComics);
}
@ -1034,3 +1023,13 @@ void MainWindowViewer::adjustToFullSizeSwitch()
Configuration::getConfiguration().setAdjustToFullSize(!Configuration::getConfiguration().getAdjustToFullSize());
viewer->updatePage();
}
void MainWindowViewer::sendComic()
{
YACReaderLocalClient * client = new YACReaderLocalClient;
currentComicDB.info.hasBeenOpened = true;
viewer->updateComic(currentComicDB);
client->sendComicInfo(libraryId,currentComicDB);
connect(client,SIGNAL(finished()),client,SLOT(deleteLater()));
//delete client;
}

View File

@ -106,6 +106,7 @@ class YACReaderSliderAction;
QString nextComicPath;
//! M<>todo que inicializa el interfaz.
void setupUI();
void openFromArgv();
void createActions();
void createToolBars();
void getSiblingComics(QString path,QString currentComic);
@ -127,9 +128,10 @@ signals:
void closed();
protected:
virtual void closeEvent ( QCloseEvent * event );
void sendComic();
public:
MainWindowViewer();
~MainWindowViewer();
};
};
#endif

View File

@ -244,21 +244,24 @@ void OptionsDialog::brightnessChanged(int value)
{
QSettings settings(QCoreApplication::applicationDirPath()+"/YACReader.ini",QSettings::IniFormat);
settings.setValue(BRIGHTNESS,value);
emit(changedImageOptions());
emit changedFilters(brightnessS->getValue(), contrastS->getValue(), gammaS->getValue());
//emit(changedImageOptions());
}
void OptionsDialog::contrastChanged(int value)
{
QSettings settings(QCoreApplication::applicationDirPath()+"/YACReader.ini",QSettings::IniFormat);
settings.setValue(CONTRAST,value);
emit(changedImageOptions());
emit changedFilters(brightnessS->getValue(), contrastS->getValue(), gammaS->getValue());
///emit(changedImageOptions());
}
void OptionsDialog::gammaChanged(int value)
{
QSettings settings(QCoreApplication::applicationDirPath()+"/YACReader.ini",QSettings::IniFormat);
settings.setValue(GAMMA,value);
emit(changedImageOptions());
emit changedFilters(brightnessS->getValue(), contrastS->getValue(), gammaS->getValue());
//emit(changedImageOptions());
}
void OptionsDialog::resetImageConfig()
@ -270,7 +273,8 @@ void OptionsDialog::resetImageConfig()
settings.setValue(BRIGHTNESS,0);
settings.setValue(CONTRAST,100);
settings.setValue(GAMMA,100);
emit(changedImageOptions());
emit changedFilters(brightnessS->getValue(), contrastS->getValue(), gammaS->getValue());
//emit(changedImageOptions());
}
void OptionsDialog::show()
@ -281,3 +285,20 @@ void OptionsDialog::show()
QDialog::show();
delete s;
}
void OptionsDialog::setFilters(int brightness, int contrast, int gamma)
{
if(brightness != -1)
brightnessS->setValue(brightness);
else
brightnessS->setValue(0);
if(contrast != -1)
contrastS->setValue(contrast);
else
contrastS->setValue(100);
if(gamma != -1)
gammaS->setValue(gamma);
else
gammaS->setValue(100);
}

View File

@ -56,10 +56,12 @@ Q_OBJECT
void gammaChanged(int value);
void resetImageConfig();
void show();
void setFilters(int brightness, int contrast, int gamma);
signals:
void changedOptions();
void changedImageOptions();
void changedFilters(int brightness, int contrast, int gamma);
void fitToWidthRatioChanged(float ratio);
};

View File

@ -10,6 +10,7 @@
#define NL 2
#define NR 2
#include "comic_db.h"
#include "yacreader_global.h"
template<class T>
@ -223,9 +224,9 @@ QImage MedianNoiseReductionFilter::setFilter(const QImage & image)
// BrightnessFilter
//-----------------------------------------------------------------------------
BrightnessFilter::BrightnessFilter(int l)
:level(l)
:ImageFilter()
{
level = l;
}
QImage BrightnessFilter::setFilter(const QImage & image)
@ -240,17 +241,24 @@ QImage BrightnessFilter::setFilter(const QImage & image)
}
}
return result;*/
if(level ==-1)
{
QSettings settings(QCoreApplication::applicationDirPath()+"/YACReader.ini",QSettings::IniFormat);
return changeBrightness(image,settings.value(BRIGHTNESS,0).toInt());
}
else
{
return changeBrightness(image,level);
}
}
//-----------------------------------------------------------------------------
// ContrastFilter
//-----------------------------------------------------------------------------
ContrastFilter::ContrastFilter(int l)
:level(l)
:ImageFilter()
{
level = l;
}
QImage ContrastFilter::setFilter(const QImage & image)
@ -311,21 +319,36 @@ QImage ContrastFilter::setFilter(const QImage & image)
}
return result;*/
if(level ==-1)
{
QSettings settings(QCoreApplication::applicationDirPath()+"/YACReader.ini",QSettings::IniFormat);
return changeContrast(image,settings.value(CONTRAST,100).toInt());
}
else
{
return changeContrast(image,level);
}
}
//-----------------------------------------------------------------------------
// ContrastFilter
//-----------------------------------------------------------------------------
GammaFilter::GammaFilter(int l)
:level(l)
:ImageFilter()
{
level = l;
}
QImage GammaFilter::setFilter(const QImage & image)
{
if(level ==-1)
{
QSettings settings(QCoreApplication::applicationDirPath()+"/YACReader.ini",QSettings::IniFormat);
return changeGamma(image,settings.value(GAMMA,100).toInt());
}
else
{
return changeGamma(image,level);
}
}
//-----------------------------------------------------------------------------
@ -585,6 +608,40 @@ void Render::update()
// Comic interface
//-----------------------------------------------------------------------------
void Render::load(const QString & path, int atPage)
{
createComic(path);
loadComic(path,atPage);
startLoad();
}
//-----------------------------------------------------------------------------
void Render::load(const QString & path, const ComicDB & comicDB)
{
//TODO prepare filters
for(int i = 0; i < filters.count(); i++)
{
if(typeid(*filters[i]) == typeid(BrightnessFilter))
if(comicDB.info.brightness == -1)
filters[i]->setLevel(0);
else
filters[i]->setLevel(comicDB.info.brightness);
if(typeid(*filters[i]) == typeid(ContrastFilter))
if(comicDB.info.contrast == -1)
filters[i]->setLevel(100);
else
filters[i]->setLevel(comicDB.info.contrast);
if(typeid(*filters[i]) == typeid(GammaFilter))
if(comicDB.info.gamma == -1)
filters[i]->setLevel(100);
else
filters[i]->setLevel(comicDB.info.gamma);
}
createComic(path);
loadComic(path,comicDB);
startLoad();
}
void Render::createComic(const QString & path)
{
if(comic!=0)
{
@ -622,6 +679,22 @@ void Render::load(const QString & path, int atPage)
connect(comic,SIGNAL(isLast()),this,SIGNAL(isLast()));
connect(comic,SIGNAL(isCover()),this,SIGNAL(isCover()));
pagesReady.clear();
}
void Render::loadComic(const QString & path,const ComicDB & comicDB)
{
//if(typeid(*comic) != typeid(FolderComic))
comic->load(path,comicDB);
//else
{/*TODO error*/}
}
void Render::loadComic(const QString & path, int atPage)
{
comic->load(path,atPage);
}
void Render::startLoad()
{
QThread * thread = NULL;
thread = new QThread();
@ -631,18 +704,12 @@ void Render::load(const QString & path, int atPage)
connect(thread, SIGNAL(started()), comic, SLOT(process()));
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
pagesReady.clear();
comic->load(path,atPage); //garantiza que se va a intentar abrir el c<>mic
if(thread != NULL)
thread->start();
invalidate();
loadedComic = true;
update();
}
void Render::renderAt(int page)
@ -1003,3 +1070,18 @@ void Render::reload()
update();
}
}
void Render::updateFilters(int brightness, int contrast, int gamma)
{
for(int i = 0; i < filters.count(); i++)
{
if(typeid(*filters[i]) == typeid(BrightnessFilter))
filters[i]->setLevel(brightness);
if(typeid(*filters[i]) == typeid(ContrastFilter))
filters[i]->setLevel(contrast);
if(typeid(*filters[i]) == typeid(GammaFilter))
filters[i]->setLevel(gamma);
}
reload();
}

View File

@ -15,12 +15,17 @@
#include <QThread>
class Comic;
class ComicDB;
class Render;
class ImageFilter {
public:
ImageFilter(){};
virtual QImage setFilter(const QImage & image) = 0;
inline int getLevel() {return level;};
inline void setLevel(int l) {level = l;};
protected:
int level;
};
class MeanNoiseReductionFilter : public ImageFilter {
@ -43,26 +48,20 @@ private:
class BrightnessFilter : public ImageFilter {
public:
BrightnessFilter(int l=150);
BrightnessFilter(int l=-1);
virtual QImage setFilter(const QImage & image);
private:
int level;
};
class ContrastFilter : public ImageFilter {
public:
ContrastFilter(int l=150);
ContrastFilter(int l=-1);
virtual QImage setFilter(const QImage & image);
private:
int level;
};
class GammaFilter : public ImageFilter {
public:
GammaFilter(int l=150);
GammaFilter(int l=-1);
virtual QImage setFilter(const QImage & image);
private:
int level;
};
//-----------------------------------------------------------------------------
@ -136,7 +135,12 @@ public slots:
//--comic interface
void nextPage();
void previousPage();
void load(const QString & path, const ComicDB & comic);
void load(const QString & path, int atPage);
void createComic(const QString & path);
void loadComic(const QString & path,const ComicDB & comic);
void loadComic(const QString & path, int atPage);
void startLoad();
void rotateRight();
void rotateLeft();
unsigned int getIndex();
@ -152,6 +156,7 @@ public slots:
void save();
void reset();
void reload();
void updateFilters(int brightness, int contrast, int gamma);
Bookmarks * getBookmarks();
//sets the firt page to render
void renderAt(int page);

View File

@ -11,7 +11,7 @@
#include "onstart_flow_selection_dialog.h"
#include "page_label_widget.h"
#include "notifications_label_widget.h"
#include "comic_db.h"
#include <QFile>
#define STEPS 22
@ -174,14 +174,15 @@ void Viewer::createConnections()
connect(render,SIGNAL(bookmarksUpdated()),this,SLOT(setBookmarks()));
}
void Viewer::open(QString pathFile, int atPage)
//Deprecated
void Viewer::prepareForOpening()
{
if(render->hasLoadedComic())
save();
//bd->setBookmarks(*bm);
goToFlow->reset();
render->load(pathFile, atPage);
//render->update();
verticalScrollBar()->setSliderPosition(verticalScrollBar()->minimum());
@ -195,8 +196,18 @@ void Viewer::open(QString pathFile, int atPage)
}
informationLabel->setText("...");
}
void Viewer::open(QString pathFile, int atPage)
{
prepareForOpening();
render->load(pathFile, atPage);
}
void Viewer::open(QString pathFile, const ComicDB & comic)
{
prepareForOpening();
render->load(pathFile, comic);
}
void Viewer::showMessageErrorOpening()
@ -802,11 +813,17 @@ void Viewer::updateConfig(QSettings * settings)
}
//deprecated
void Viewer::updateImageOptions()
{
render->reload();
}
void Viewer::updateFilters(int brightness, int contrast,int gamma)
{
render->updateFilters(brightness,contrast,gamma);
}
void Viewer::setBookmarks()
{
bd->setBookmarks(*render->getBookmarks());
@ -834,3 +851,34 @@ int Viewer::getCurrentPageNumber()
{
return render->getIndex();
}
void Viewer::updateComic(ComicDB & comic)
{
//set currentPage
comic.info.currentPage = render->getIndex()+1;
//set bookmarks
Bookmarks * boomarks = render->getBookmarks();
QList<int> boomarksList = boomarks->getBookmarkPages();
int numBookmarks = boomarksList.size();
if(numBookmarks > 0)
comic.info.bookmark1 = boomarksList[0];
if(numBookmarks > 1)
comic.info.bookmark2 = boomarksList[1];
if(numBookmarks > 2)
comic.info.bookmark3 = boomarksList[2];
//set filters
//TODO: avoid use settings for this...
QSettings settings(QCoreApplication::applicationDirPath()+"/YACReader.ini",QSettings::IniFormat);
int brightness = settings.value(BRIGHTNESS,0).toInt();
int contrast = settings.value(CONTRAST,100).toInt();
int gamma = settings.value(GAMMA,100).toInt();
if(brightness != 0 || comic.info.brightness!=-1)
comic.info.brightness = brightness;
if(contrast != 100 || comic.info.contrast!=-1)
comic.info.contrast = contrast;
if(gamma != 100 || comic.info.gamma!=-1)
comic.info.gamma = gamma;
}

View File

@ -16,7 +16,7 @@
#include <QPropertyAnimation>
#include <QSettings>
class ComicDB;
class Comic;
class MagnifyingGlass;
class GoToFlow;
@ -35,7 +35,9 @@ class NotificationsLabelWidget;
public:
bool fullscreen; //TODO, change by the right use of windowState();
public slots:
void prepareForOpening();
void open(QString pathFile, int atPage = -1);
void open(QString pathFile, const ComicDB & comic);
void prev();
void next();
void showGoToDialog();
@ -80,7 +82,9 @@ virtual void mouseReleaseEvent ( QMouseEvent * event );
void showMessageErrorOpening();
void showMessageErrorOpening(QString);
void setBookmarks();
//deprecated
void updateImageOptions();
void updateFilters(int brightness, int contrast,int gamma);
void showIsCoverMessage();
void showIsLastMessage();
int getCurrentPageNumber();
@ -142,6 +146,7 @@ virtual void mouseReleaseEvent ( QMouseEvent * event );
const BookmarksDialog * getBookmarksDialog(){return bd;}
//returns the current index starting in 1 [1,nPages]
unsigned int getIndex();
void updateComic(ComicDB & comic);
signals:
void backgroundChanges();
void pageAvailable(bool);

View File

@ -101,10 +101,15 @@ bool YACReaderLocalClient::sendComicInfo(quint64 libraryId, ComicDB & comic)
tries++;
}
if(tries == 100 && written != block.size())
{
emit finished();
return false;
}
emit finished();
return true;
}
else
emit finished();
return false;
}

View File

@ -13,7 +13,7 @@ public:
explicit YACReaderLocalClient(QObject *parent = 0);
signals:
void finished();
public slots:
void readMessage();
bool requestComicInfo(quint64 libraryId, ComicDB & comic,QList<ComicDB> & siblings);

View File

@ -1012,17 +1012,15 @@ void LibraryWindow::openComic()
quint64 comicId = comic.id;
//TODO generate IDS for libraries...
quint64 libraryId = selectedLibrary->currentIndex();
int page = *(comic.info.numPages) / 2;
// %1 %2 %3 NO-->%4 %5 %6 %7 %8 %9 %10
//Invoke YACReader comicPath comicId libraryId NO-->currentPage bookmark1 bookmark2 bookmark3 brightness contrast gamma
#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 << bookmark1 << bookmark2 << bookmark3 << brightness << contrast << gamma*/);//,QStringList() << path);
#else
QProcess::startDetached(QDir::cleanPath(QCoreApplication::applicationDirPath())+QString("/YACReader \"%1\" \"%2\" \"%3\" \"%4\"").arg(path).arg(comicId).arg(libraryId).arg(page),QStringList());
/* \"%4\" \"%5\" \"%6\" \"%7\" \"%8\" \"%9\" \"%10\" */
QProcess::startDetached(QDir::cleanPath(QCoreApplication::applicationDirPath())+QString("/YACReader \"%1\" \"%2\" \"%3\"").arg(path).arg(comicId).arg(libraryId)/*.arg(page).arg(bookmark1).arg(bookmark2).arg(bookmark3).arg(brightness).arg(contrast).arg(gamma)*/,QStringList());
#endif
//Comic is readed
//setCurrentComicReaded();
setCurrentComicOpened();
}
}