Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion YACReader/goto_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void GoToDialog::goTo()
close();
}

void GoToDialog::setNumPages(unsigned int numPages)
void GoToDialog::setNumPages(int numPages)
{
numPagesLabel->setText(tr("Total pages : ") + QString::number(numPages));
v->setTop(numPages);
Expand Down
2 changes: 1 addition & 1 deletion YACReader/goto_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class GoToDialog : public QDialog
void setupUI();
public slots:
void goTo();
void setNumPages(unsigned int numPages);
void setNumPages(int numPages);
void open() override;
signals:
void goToPage(unsigned int page);
Expand Down
4 changes: 2 additions & 2 deletions YACReader/goto_flow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void GoToFlow::centerSlide(int slide)
}
}

void GoToFlow::setNumSlides(unsigned int slides)
void GoToFlow::setNumSlides(int slides)
{
// numPagesLabel->setText(tr("Total pages : ")+QString::number(slides));
// numPagesLabel->adjustSize();
Expand All @@ -120,7 +120,7 @@ void GoToFlow::setNumSlides(unsigned int slides)
worker->reset();

flow->clear();
for (unsigned int i = 0; i < slides; i++)
for (int i = 0; i < slides; ++i)
flow->addSlide(QImage());
flow->setCenterIndex(0);
}
Expand Down
2 changes: 1 addition & 1 deletion YACReader/goto_flow.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private slots:
public slots:
void centerSlide(int slide) override;
void reset() override;
void setNumSlides(unsigned int slides) override;
void setNumSlides(int slides) override;
void setImageReady(int index, const QByteArray &image) override;
void setFlowType(FlowType flowType) override;
void updateConfig(QSettings *settings) override;
Expand Down
2 changes: 1 addition & 1 deletion YACReader/goto_flow_gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void GoToFlowGL::setFlowType(FlowType flowType)
flow->setPreset(defaultYACReaderFlowConfig);
}

void GoToFlowGL::setNumSlides(unsigned int slides)
void GoToFlowGL::setNumSlides(int slides)
{
flow->populate(slides);
toolBar->setTop(slides);
Expand Down
2 changes: 1 addition & 1 deletion YACReader/goto_flow_gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class GoToFlowGL : public GoToFlowWidget
void reset() override;
void centerSlide(int slide) override;
void setFlowType(FlowType flowType) override;
void setNumSlides(unsigned int slides) override;
void setNumSlides(int slides) override;
void setImageReady(int index, const QByteArray &image) override;

void updateConfig(QSettings *settings);
Expand Down
2 changes: 1 addition & 1 deletion YACReader/goto_flow_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public slots:
virtual void centerSlide(int slide) = 0;
virtual void setPageNumber(int page);
virtual void setFlowType(FlowType flowType) = 0;
virtual void setNumSlides(unsigned int slides) = 0;
virtual void setNumSlides(int slides) = 0;
virtual void setImageReady(int index, const QByteArray &image) = 0;
virtual void updateSize();
virtual void updateConfig(QSettings *settings);
Expand Down
22 changes: 11 additions & 11 deletions YACReader/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ void Render::prepareAvailablePage(int page)
}
} else {
//check for last page in double page mode
if ((currentIndex == page) && (currentIndex + 1) >= (int)comic->numPages()) {
if (currentIndex == page && currentIndex + 1 >= comic->numPages()) {
emit currentPageReady();
} else if ((currentIndex == page && !buffer[currentPageBufferedIndex + 1]->isNull()) ||
(currentIndex + 1 == page && !buffer[currentPageBufferedIndex]->isNull())) {
Expand Down Expand Up @@ -718,8 +718,8 @@ void Render::createComic(const QString &path)
connect(comic, SIGNAL(imageLoaded(int)), this, SLOT(pageRawDataReady(int)), Qt::QueuedConnection);
connect(comic, SIGNAL(imageLoaded(int)), this, SIGNAL(imageLoaded(int)), Qt::QueuedConnection);
connect(comic, SIGNAL(openAt(int)), this, SLOT(renderAt(int)), Qt::QueuedConnection);
connect(comic, SIGNAL(numPages(unsigned int)), this, SIGNAL(numPages(unsigned int)), Qt::QueuedConnection);
connect(comic, SIGNAL(numPages(unsigned int)), this, SLOT(setNumPages(unsigned int)), Qt::QueuedConnection);
connect(comic, &Comic::numPagesChanged, this, &Render::numPagesChanged, Qt::QueuedConnection);
connect(comic, &Comic::numPagesChanged, this, &Render::setNumPages, Qt::QueuedConnection);
connect(comic, SIGNAL(imageLoaded(int, QByteArray)), this, SIGNAL(imageLoaded(int, QByteArray)), Qt::QueuedConnection);
connect(comic, SIGNAL(isBookmark(bool)), this, SIGNAL(currentPageIsBookmark(bool)), Qt::QueuedConnection);

Expand Down Expand Up @@ -786,14 +786,14 @@ void Render::nextPage()
currentIndex = nextPage;
update();
emit pageChanged(currentIndex);
} else if (hasLoadedComic() && ((unsigned int)currentIndex == numPages() - 1)) {
} else if (hasLoadedComic() && currentIndex == numPages() - 1) {
emit isLast();
}
}
void Render::nextDoublePage()
{
int nextPage;
if (currentIndex + 2 < (int)comic->numPages()) {
if (currentIndex + 2 < comic->numPages()) {
nextPage = currentIndex + 2;
} else {
nextPage = currentIndex;
Expand All @@ -804,7 +804,7 @@ void Render::nextDoublePage()
currentIndex = nextPage;
update();
emit pageChanged(currentIndex);
} else if (hasLoadedComic() && ((unsigned int)currentIndex >= numPages() - 2)) {
} else if (hasLoadedComic() && currentIndex >= numPages() - 2) {
emit isLast();
}
}
Expand Down Expand Up @@ -840,11 +840,11 @@ void Render::previousDoublePage()
}
}

unsigned int Render::getIndex()
int Render::getIndex() const
{
return comic->getIndex();
}
unsigned int Render::numPages()
int Render::numPages() const
{
return comic->numPages();
}
Expand All @@ -856,7 +856,7 @@ bool Render::hasLoadedComic()
return false;
}

void Render::setNumPages(unsigned int numPages)
void Render::setNumPages(int numPages)
{
pagesReady.fill(false, numPages);
}
Expand Down Expand Up @@ -977,7 +977,7 @@ void Render::fillBuffer()
}

for (int i = 1; i <= qMax(numLeftPages, numRightPages); i++) {
if ((currentIndex + i < (int)comic->numPages()) &&
if (currentIndex + i < comic->numPages() &&
buffer[currentPageBufferedIndex + i]->isNull() &&
i <= numRightPages &&
pageRenders[currentPageBufferedIndex + i] == 0 &&
Expand Down Expand Up @@ -1049,7 +1049,7 @@ void Render::doubleMangaPageSwitch()
QString Render::getCurrentPagesInformation()
{
QString s = QString::number(currentIndex + 1);
if (doublePage && (currentIndex + 1 < (int)comic->numPages())) {
if (doublePage && currentIndex + 1 < comic->numPages()) {
if (currentPageIsDoublePage()) {
if (doubleMangaPage)
s = QString::number(currentIndex + 2) + "-" + s;
Expand Down
9 changes: 5 additions & 4 deletions YACReader/render.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ class Render : public QObject
Render();
~Render() override;

int getIndex() const;
int numPages() const;

public slots:
void render();
QPixmap *getCurrentPage();
Expand All @@ -150,7 +153,7 @@ public slots:
void setComic(Comic *c);
void prepareAvailablePage(int page);
void update();
void setNumPages(unsigned int numPages);
void setNumPages(int numPages);
void pageRawDataReady(int page);
//--comic interface
void nextPage();
Expand All @@ -165,8 +168,6 @@ public slots:
void startLoad();
void rotateRight();
void rotateLeft();
unsigned int getIndex();
unsigned int numPages();
bool hasLoadedComic();
void updateBuffer();
void fillBuffer();
Expand All @@ -189,7 +190,7 @@ public slots:
void imageLoaded(int index);
void imageLoaded(int index, const QByteArray &image);
void pageChanged(int index);
void numPages(unsigned int numPages);
void numPagesChanged(int numPages);
void errorOpening();
void errorOpening(QString);
void crcError(QString);
Expand Down
9 changes: 4 additions & 5 deletions YACReader/viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,8 @@ void Viewer::createConnections()
connect(render, SIGNAL(errorOpening()), this, SLOT(showMessageErrorOpening()));
connect(render, SIGNAL(errorOpening(QString)), this, SLOT(showMessageErrorOpening(QString)));
connect(render, SIGNAL(crcError(QString)), this, SLOT(processCRCError(QString)));
connect(render, SIGNAL(numPages(unsigned int)), goToFlow, SLOT(setNumSlides(unsigned int)));
connect(render, SIGNAL(numPages(unsigned int)), goToDialog, SLOT(setNumPages(unsigned int)));
//connect(render,SIGNAL(numPages(unsigned int)),this,SLOT(updateInformation()));
connect(render, &Render::numPagesChanged, goToFlow, &GoToFlowWidget::setNumSlides);
connect(render, &Render::numPagesChanged, goToDialog, &GoToDialog::setNumPages);
connect(render, SIGNAL(imageLoaded(int, QByteArray)), goToFlow, SLOT(setImageReady(int, QByteArray)));
connect(render, SIGNAL(currentPageReady()), this, SLOT(updatePage()));
connect(render, SIGNAL(processingPage()), this, SLOT(setLoadingMessage()));
Expand Down Expand Up @@ -1129,12 +1128,12 @@ void Viewer::showIsLastMessage()
shouldOpenPrevious = false; //single page comic
}

unsigned int Viewer::getIndex()
int Viewer::getIndex() const
{
return render->getIndex() + 1;
}

int Viewer::getCurrentPageNumber()
int Viewer::getCurrentPageNumber() const
{
return render->getIndex();
}
Expand Down
4 changes: 2 additions & 2 deletions YACReader/viewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ public slots:
void updateFilters(int brightness, int contrast, int gamma);
void showIsCoverMessage();
void showIsLastMessage();
int getCurrentPageNumber();
void updateZoomRatio(int ratio);
bool getIsMangaMode();

Expand Down Expand Up @@ -182,7 +181,8 @@ public slots:
//Comic * getComic(){return comic;}
const BookmarksDialog *getBookmarksDialog() { return bd; }
//returns the current index starting in 1 [1,nPages]
unsigned int getIndex();
int getIndex() const;
int getCurrentPageNumber() const;
void updateComic(ComicDB &comic);
signals:
void backgroundChanges();
Expand Down
2 changes: 1 addition & 1 deletion YACReaderLibrary/server/controllers/v1/pagecontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void PageController::service(HttpRequest &request, HttpResponse &response)
QStringList pathElements = path.split('/');
QString libraryName = DBHelper::getLibraryName(pathElements.at(2).toInt());
qulonglong comicId = pathElements.at(4).toULongLong();
unsigned int page = pathElements.at(6).toUInt();
const int page = pathElements.at(6).toInt();

//qDebug("lib name : %s",pathElements.at(2).data());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void PageControllerV2::service(HttpRequest &request, HttpResponse &response)
QStringList pathElements = path.split('/');
QString libraryName = DBHelper::getLibraryName(pathElements.at(2).toInt());
qulonglong comicId = pathElements.at(5).toULongLong();
unsigned int page = pathElements.at(7).toUInt();
const int page = pathElements.at(7).toInt();

Comic *comicFile;
qulonglong currentComicId;
Expand Down
10 changes: 5 additions & 5 deletions common/comic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ int Comic::previousPage()
return _index;
}
//-----------------------------------------------------------------------------
void Comic::setIndex(unsigned int index)
void Comic::setIndex(int index)
{
int previousIndex = _index;
if (static_cast<int>(index) < _pages.size() - 1) {
if (index < _pages.size() - 1) {
_index = index;
} else {
_index = _pages.size() - 1;
Expand Down Expand Up @@ -587,7 +587,7 @@ void FileComic::process()
_loadedPages = QVector<bool>(_fileNames.size(), false);

emit pageChanged(0); // this indicates new comic, index=0
emit numPages(_pages.size());
emit numPagesChanged(_pages.size());
_loaded = true;

_cfi = 0;
Expand Down Expand Up @@ -704,7 +704,7 @@ void FolderComic::process()
emit(openAt(_index));

emit pageChanged(0); // this indicates new comic, index=0
emit numPages(_pages.size());
emit numPagesChanged(_pages.size());
_loaded = true;

int count = 0;
Expand Down Expand Up @@ -830,7 +830,7 @@ void PDFComic::process()

int nPages = pdfComic->numPages();
emit pageChanged(0); // this indicates new comic, index=0
emit numPages(nPages);
emit numPagesChanged(nPages);
_loaded = true;
//QMessageBox::critical(NULL,QString("%1").arg(nPages),tr("Invalid PDF file"));

Expand Down
8 changes: 4 additions & 4 deletions common/comic.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ class Comic : public QObject
void loadFromPDF(const QString & pathPDF);*/
int nextPage();
int previousPage();
void setIndex(unsigned int index);
unsigned int getIndex() { return _index; };
unsigned int numPages() { return _pages.size(); }
void setIndex(int index);
int getIndex() const { return _index; }
int numPages() const { return _pages.size(); }
//QPixmap * currentPage();
bool loaded();
//QPixmap * operator[](unsigned int index);
Expand Down Expand Up @@ -101,7 +101,7 @@ public slots:
void imageLoaded(int index, const QByteArray &image);
void pageChanged(int index);
void openAt(int index);
void numPages(unsigned int numPages);
void numPagesChanged(int numPages);
void errorOpening();
void errorOpening(QString);
void crcErrorFound(QString);
Expand Down
2 changes: 1 addition & 1 deletion common/pdf_comic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void PdfiumComic::closeComic()
FPDF_CloseDocument(doc);
}

unsigned int PdfiumComic::numPages()
int PdfiumComic::numPages()
{
if (doc) {
QMutexLocker locker(&pdfmutex);
Expand Down
4 changes: 2 additions & 2 deletions common/pdf_comic.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class MacOSXPDFComic
~MacOSXPDFComic();
bool openComic(const QString &path);
void closeComic();
unsigned int numPages();
int numPages();
QImage getPage(const int page);
//void releaseLastPageData();

Expand All @@ -33,7 +33,7 @@ class PdfiumComic
~PdfiumComic();
bool openComic(const QString &path);
void closeComic();
unsigned int numPages();
int numPages();
QImage getPage(const int page);

private:
Expand Down
2 changes: 1 addition & 1 deletion common/pdf_comic.mm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
//CGPDFDocumentRelease((CGPDFDocumentRef)document);
}

unsigned int MacOSXPDFComic::numPages()
int MacOSXPDFComic::numPages()
{
return (int)CGPDFDocumentGetNumberOfPages((CGPDFDocumentRef)document);
}
Expand Down