mirror of
https://github.com/YACReader/yacreader
synced 2025-07-21 22:44:56 -04:00
fixed compilation in MacOSX
This commit is contained in:
174
common/bookmarks.cpp
Normal file
174
common/bookmarks.cpp
Normal file
@ -0,0 +1,174 @@
|
||||
#include "bookmarks.h"
|
||||
#include <QFile>
|
||||
#include <QDataStream>
|
||||
#include <QCoreApplication>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QList>
|
||||
|
||||
#include "yacreader_global.h"
|
||||
|
||||
Bookmarks::Bookmarks()
|
||||
:lastPageIndex(0)
|
||||
{
|
||||
list.load();
|
||||
}
|
||||
void Bookmarks::setLastPage(int index,const QImage & page)
|
||||
{
|
||||
lastPageIndex = index;
|
||||
lastPage = page;
|
||||
}
|
||||
void Bookmarks::setBookmark(int index,const QImage & page)
|
||||
{
|
||||
if(!bookmarks.contains(index))
|
||||
{
|
||||
bookmarks.insert(index,page);
|
||||
latestBookmarks.push_front(index);
|
||||
if(latestBookmarks.count()>3)
|
||||
{
|
||||
bookmarks.remove(latestBookmarks.back());
|
||||
latestBookmarks.pop_back();
|
||||
}
|
||||
}
|
||||
else //udate de pixmap;
|
||||
{
|
||||
bookmarks[index]=page;
|
||||
}
|
||||
}
|
||||
|
||||
void Bookmarks::removeBookmark(int index)
|
||||
{
|
||||
bookmarks.remove(index);
|
||||
}
|
||||
|
||||
QList<int> Bookmarks::getBookmarkPages() const
|
||||
{
|
||||
return bookmarks.keys();
|
||||
}
|
||||
|
||||
QImage Bookmarks::getBookmarkPixmap(int page) const
|
||||
{
|
||||
return bookmarks.value(page);
|
||||
}
|
||||
|
||||
QImage Bookmarks::getLastPagePixmap() const
|
||||
{
|
||||
return lastPage;
|
||||
}
|
||||
|
||||
int Bookmarks::getLastPage() const
|
||||
{
|
||||
return lastPageIndex;
|
||||
}
|
||||
|
||||
|
||||
bool Bookmarks::isBookmark(int page)
|
||||
{
|
||||
return bookmarks.contains(page);
|
||||
}
|
||||
|
||||
bool Bookmarks::imageLoaded(int page)
|
||||
{
|
||||
return !bookmarks.value(page).isNull();
|
||||
}
|
||||
|
||||
void Bookmarks::newComic(const QString & path)
|
||||
{
|
||||
QFileInfo f(path);
|
||||
QString comicID = f.fileName().toLower()+QString::number(f.size());
|
||||
clear();
|
||||
BookmarksList::Bookmark b = list.get(comicID);
|
||||
comicPath=comicID;
|
||||
lastPageIndex = b.lastPage;
|
||||
latestBookmarks = b.bookmarks;
|
||||
for(int i=0;i<latestBookmarks.count();i++)
|
||||
bookmarks.insert(latestBookmarks.at(i),QImage());
|
||||
added = b.added;
|
||||
}
|
||||
|
||||
void Bookmarks::clear()
|
||||
{
|
||||
bookmarks.clear();
|
||||
latestBookmarks.clear();
|
||||
lastPageIndex=0;
|
||||
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;
|
||||
b.lastPage = lastPageIndex;
|
||||
b.bookmarks = getBookmarkPages();
|
||||
|
||||
BookmarksList::Bookmark previousBookmarks;
|
||||
bool updated = ((previousBookmarks.lastPage != b.lastPage) || (previousBookmarks.bookmarks != b.bookmarks));
|
||||
|
||||
if(b.added.isNull() || updated)
|
||||
b.added = QDateTime::currentDateTime();
|
||||
list.add(comicPath,b);
|
||||
list.save();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void BookmarksList::load()
|
||||
{
|
||||
QFile f(YACReader::getSettingsPath()+"/bookmarks.yacr");
|
||||
if(f.open(QIODevice::ReadOnly))
|
||||
{
|
||||
QDataStream dataS(&f);
|
||||
dataS >> list;
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
|
||||
void BookmarksList::save()
|
||||
{
|
||||
QFile f(YACReader::getSettingsPath()+"/bookmarks.yacr");
|
||||
f.open(QIODevice::WriteOnly);
|
||||
QDataStream dataS(&f);
|
||||
if(list.count()>numMaxBookmarks)
|
||||
deleteOldest(list.count()-numMaxBookmarks);
|
||||
dataS << list;
|
||||
f.close();
|
||||
}
|
||||
|
||||
|
||||
void BookmarksList::deleteOldest(int num)
|
||||
{
|
||||
Q_UNUSED(num)
|
||||
QString comic;
|
||||
QDateTime date(QDate(10000,1,1));//TODO MAX_DATE??
|
||||
for(QMap<QString,Bookmark>::const_iterator itr=list.begin();itr!=list.end();itr++)
|
||||
{
|
||||
if(itr->added<date)
|
||||
{
|
||||
comic=itr.key();
|
||||
date = itr->added;
|
||||
}
|
||||
}
|
||||
list.remove(comic);
|
||||
}
|
||||
|
||||
void BookmarksList::add(const QString & comicID, const Bookmark & b)
|
||||
{
|
||||
list.insert(comicID,b);
|
||||
}
|
||||
|
||||
BookmarksList::Bookmark BookmarksList::get(const QString & comicID)
|
||||
{
|
||||
//if(list.contains(comicID)
|
||||
return list.value(comicID);
|
||||
}
|
80
common/bookmarks.h
Normal file
80
common/bookmarks.h
Normal file
@ -0,0 +1,80 @@
|
||||
#ifndef BOOKMARKS_H
|
||||
#define BOOKMARKS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QMap>
|
||||
#include <QImage>
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
#include <QDateTime>
|
||||
class BookmarksList
|
||||
{
|
||||
public:
|
||||
struct Bookmark {
|
||||
int lastPage;
|
||||
QList<int> bookmarks;
|
||||
QDateTime added;
|
||||
Bookmark():lastPage(0){};
|
||||
friend QDataStream & operator<< ( QDataStream & out, const Bookmark & bm )
|
||||
{
|
||||
out << bm.lastPage;
|
||||
out << bm.bookmarks;
|
||||
out << bm.added;
|
||||
return out;
|
||||
}
|
||||
friend QDataStream & operator>> ( QDataStream & in, Bookmark & bm )
|
||||
{
|
||||
in >> bm.lastPage;
|
||||
in >> bm.bookmarks;
|
||||
in >> bm.added;
|
||||
return in;
|
||||
}
|
||||
|
||||
};
|
||||
BookmarksList():numMaxBookmarks(400){}
|
||||
void load();
|
||||
void save();
|
||||
void add(const QString & comicID, const Bookmark & b);
|
||||
Bookmark get(const QString & comicID);
|
||||
protected:
|
||||
QMap<QString,Bookmark> list;
|
||||
void deleteOldest(int num);
|
||||
private:
|
||||
int numMaxBookmarks;
|
||||
|
||||
};
|
||||
|
||||
class Bookmarks : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
QString comicPath;
|
||||
//bookmarks setted by the user
|
||||
QMap<int,QImage> bookmarks;
|
||||
QList<int> latestBookmarks;
|
||||
//last page readed
|
||||
int lastPageIndex;
|
||||
QImage lastPage;
|
||||
BookmarksList list;
|
||||
QDateTime added;
|
||||
|
||||
public:
|
||||
Bookmarks();
|
||||
void setLastPage(int index,const QImage & page);
|
||||
void setBookmark(int index,const QImage & page);
|
||||
void removeBookmark(int index);
|
||||
QList<int> getBookmarkPages() const;
|
||||
QImage getBookmarkPixmap(int page) const;
|
||||
QImage getLastPagePixmap() const;
|
||||
int getLastPage() const;
|
||||
bool isBookmark(int page);
|
||||
bool imageLoaded(int page);
|
||||
void newComic(const QString & path);
|
||||
void clear();
|
||||
void save();
|
||||
bool load(const QList<int> & bookmarkIndexes, int lastPage);
|
||||
|
||||
};
|
||||
|
||||
#endif // BOOKMARKS_H
|
84
common/check_new_version.cpp
Normal file
84
common/check_new_version.cpp
Normal file
@ -0,0 +1,84 @@
|
||||
#include "check_new_version.h"
|
||||
#include <QMessageBox>
|
||||
#include <QUrl>
|
||||
#include <QtGlobal>
|
||||
#include <QStringList>
|
||||
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QEventLoop>
|
||||
#include <QTimer>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
|
||||
#define PREVIOUS_VERSION "6.0.0"
|
||||
|
||||
HttpVersionChecker::HttpVersionChecker()
|
||||
:HttpWorker("https://bitbucket.org/luisangelsm/yacreader/wiki/Home")
|
||||
{
|
||||
connect(this,SIGNAL(dataReady(const QByteArray &)),this,SLOT(checkNewVersion(const QByteArray &)));
|
||||
}
|
||||
|
||||
void HttpVersionChecker::checkNewVersion(const QByteArray & data)
|
||||
{
|
||||
checkNewVersion(QString(data));
|
||||
}
|
||||
|
||||
bool HttpVersionChecker::checkNewVersion(QString sourceContent)
|
||||
{
|
||||
#ifdef Q_OS_WIN32
|
||||
QRegExp rx(".*YACReader\\-([0-9]+).([0-9]+).([0-9]+)\\.?([0-9]+)?.{0,5}win32.*");
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
QRegExp rx(".*YACReader\\-([0-9]+).([0-9]+).([0-9]+)\\.?([0-9]+)?.{0,5}X11.*");
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
QRegExp rx(".*YACReader\\-([0-9]+).([0-9]+).([0-9]+)\\.?([0-9]+)?.{0,5}Mac.*");
|
||||
#endif
|
||||
|
||||
int index = 0;
|
||||
bool newVersion = false;
|
||||
bool sameVersion = true;
|
||||
//bool currentVersionIsNewer = false;
|
||||
#ifdef QT_DEBUG
|
||||
QString version(PREVIOUS_VERSION);
|
||||
#else
|
||||
QString version(VERSION);
|
||||
#endif
|
||||
QStringList sl = version.split(".");
|
||||
if((index = rx.indexIn(sourceContent))!=-1)
|
||||
{
|
||||
int length = qMin(sl.size(),(rx.cap(4)!="")?4:3);
|
||||
for(int i=0;i<length;i++)
|
||||
{
|
||||
if(rx.cap(i+1).toInt()<sl.at(i).toInt())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(rx.cap(i+1).toInt()>sl.at(i).toInt()){
|
||||
newVersion=true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
sameVersion = sameVersion && rx.cap(i+1).toInt()==sl.at(i).toInt();
|
||||
}
|
||||
if(!newVersion && sameVersion)
|
||||
{
|
||||
if((sl.size()==3)&&(rx.cap(4)!=""))
|
||||
newVersion = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(newVersion == true)
|
||||
{
|
||||
emit newVersionDetected();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
27
common/check_new_version.h
Normal file
27
common/check_new_version.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef __CHECKUPDATE_H
|
||||
#define __CHECKUPDATE_H
|
||||
|
||||
#include "http_worker.h"
|
||||
#include "yacreader_global.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QByteArray>
|
||||
#include <QThread>
|
||||
|
||||
class HttpVersionChecker : public HttpWorker
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HttpVersionChecker();
|
||||
public slots:
|
||||
|
||||
private:
|
||||
bool found;
|
||||
private slots:
|
||||
bool checkNewVersion(QString sourceContent);
|
||||
void checkNewVersion(const QByteArray & data);
|
||||
signals:
|
||||
void newVersionDetected();
|
||||
};
|
||||
|
||||
#endif
|
712
common/comic.cpp
Normal file
712
common/comic.cpp
Normal file
@ -0,0 +1,712 @@
|
||||
#include "comic.h"
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QRegExp>
|
||||
#include <QString>
|
||||
#include <algorithm>
|
||||
#include <QDir>
|
||||
#include <QFileInfoList>
|
||||
#include <QApplication>
|
||||
|
||||
#include "bookmarks.h" //TODO desacoplar la dependencia con bookmarks
|
||||
#include "qnaturalsorting.h"
|
||||
#include "compressed_archive.h"
|
||||
#include "comic_db.h"
|
||||
|
||||
QStringList Comic::extensions = QStringList() << "*.jpg" << "*.jpeg" << "*.png" << "*.gif" << "*.tiff" << "*.tif" << "*.bmp";
|
||||
QStringList Comic::literalExtensions = QStringList() << ".jpg" << ".jpeg" << ".png" << ".gif" << ".tiff" << ".tif" << ".bmp";
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
Comic::Comic()
|
||||
:_pages(),_index(0),_path(),_loaded(false),bm(new Bookmarks()),_loadedPages(),_isPDF(false)
|
||||
{
|
||||
setup();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
Comic::Comic(const QString & pathFile, int atPage )
|
||||
:_pages(),_index(0),_path(pathFile),_loaded(false),bm(new Bookmarks()),_loadedPages(),_isPDF(false),_firstPage(atPage)
|
||||
{
|
||||
setup();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
Comic::~Comic()
|
||||
{
|
||||
delete bm;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::setup()
|
||||
{
|
||||
connect(this,SIGNAL(pageChanged(int)),this,SLOT(checkIsBookmark(int)));
|
||||
connect(this,SIGNAL(imageLoaded(int)),this,SLOT(updateBookmarkImage(int)));
|
||||
connect(this,SIGNAL(imageLoaded(int)),this,SLOT(setPageLoaded(int)));
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
int Comic::nextPage()
|
||||
{
|
||||
if(_index<_pages.size()-1)
|
||||
{
|
||||
_index++;
|
||||
|
||||
emit pageChanged(_index);
|
||||
}
|
||||
else
|
||||
emit isLast();
|
||||
return _index;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int Comic::previousPage()
|
||||
{
|
||||
if(_index>0)
|
||||
{
|
||||
_index--;
|
||||
|
||||
emit pageChanged(_index);
|
||||
}
|
||||
else
|
||||
emit isCover();
|
||||
|
||||
return _index;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::setIndex(unsigned int index)
|
||||
{
|
||||
int previousIndex = _index;
|
||||
if(static_cast<int>(index)<_pages.size()-1)
|
||||
_index = index;
|
||||
else
|
||||
_index = _pages.size()-1;
|
||||
|
||||
if(previousIndex != _index)
|
||||
emit pageChanged(_index);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
/*QPixmap * Comic::currentPage()
|
||||
{
|
||||
QPixmap * p = new QPixmap();
|
||||
p->loadFromData(_pages[_index]);
|
||||
return p;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
QPixmap * Comic::operator[](unsigned int index)
|
||||
{
|
||||
QPixmap * p = new QPixmap();
|
||||
p->loadFromData(_pages[index]);
|
||||
return p;
|
||||
}*/
|
||||
bool Comic::load(const QString & path, const ComicDB & comic)
|
||||
{
|
||||
Q_UNUSED(path);
|
||||
Q_UNUSED(comic);
|
||||
return false;
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
bool Comic::loaded()
|
||||
{
|
||||
return _loaded;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::loadFinished()
|
||||
{
|
||||
emit imagesLoaded();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::setBookmark()
|
||||
{
|
||||
QImage p;
|
||||
p.loadFromData(_pages[_index]);
|
||||
bm->setBookmark(_index,p);
|
||||
//emit bookmarksLoaded(*bm);
|
||||
emit bookmarksUpdated();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::removeBookmark()
|
||||
{
|
||||
bm->removeBookmark(_index);
|
||||
//emit bookmarksLoaded(*bm);
|
||||
emit bookmarksUpdated();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::saveBookmarks()
|
||||
{
|
||||
QImage p;
|
||||
p.loadFromData(_pages[_index]);
|
||||
bm->setLastPage(_index,p);
|
||||
bm->save();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::checkIsBookmark(int index)
|
||||
{
|
||||
emit isBookmark(bm->isBookmark(index));
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::updateBookmarkImage(int index)
|
||||
{
|
||||
if(bm->isBookmark(index))
|
||||
{
|
||||
QImage p;
|
||||
p.loadFromData(_pages[index]);
|
||||
bm->setBookmark(index,p);
|
||||
emit bookmarksUpdated();
|
||||
//emit bookmarksLoaded(*bm);
|
||||
|
||||
}
|
||||
if(bm->getLastPage() == index)
|
||||
{
|
||||
QImage p;
|
||||
p.loadFromData(_pages[index]);
|
||||
bm->setLastPage(index,p);
|
||||
emit bookmarksUpdated();
|
||||
//emit bookmarksLoaded(*bm);
|
||||
}
|
||||
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Comic::setPageLoaded(int page)
|
||||
{
|
||||
_loadedPages[page] = true;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
QByteArray Comic::getRawPage(int page)
|
||||
{
|
||||
if(page < 0 || page >= _pages.size())
|
||||
return QByteArray();
|
||||
return _pages[page];
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
bool Comic::pageIsLoaded(int page)
|
||||
{
|
||||
if(page < 0 || page >= _pages.size())
|
||||
return false;
|
||||
return _loadedPages[page];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
FileComic::FileComic()
|
||||
:Comic()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
FileComic::FileComic(const QString & path, int atPage )
|
||||
:Comic(path,atPage)
|
||||
{
|
||||
load(path,atPage);
|
||||
}
|
||||
|
||||
FileComic::~FileComic()
|
||||
{
|
||||
_pages.clear();
|
||||
_loadedPages.clear();
|
||||
_fileNames.clear();
|
||||
_newOrder.clear();
|
||||
_order.clear();
|
||||
}
|
||||
|
||||
bool FileComic::load(const QString & path, int atPage)
|
||||
{
|
||||
QFileInfo fi(path);
|
||||
|
||||
if(fi.exists())
|
||||
{
|
||||
if(atPage == -1)
|
||||
{
|
||||
bm->newComic(path);
|
||||
emit bookmarksUpdated();
|
||||
}
|
||||
_firstPage = atPage;
|
||||
//emit bookmarksLoaded(*bm);
|
||||
|
||||
_path = QDir::cleanPath(path);
|
||||
//load files size
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//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;
|
||||
}
|
||||
}
|
||||
|
||||
QList<QString> FileComic::filter(const QList<QString> & src)
|
||||
{
|
||||
QList<QString> extensions = getSupportedImageLiteralFormats();
|
||||
QList<QString> filtered;
|
||||
bool fileAccepted = false;
|
||||
|
||||
foreach(QString fileName,src)
|
||||
{
|
||||
fileAccepted = false;
|
||||
if(!fileName.contains("__MACOSX"))
|
||||
{
|
||||
foreach(QString extension,extensions)
|
||||
{
|
||||
if(fileName.endsWith(extension,Qt::CaseInsensitive))
|
||||
{
|
||||
fileAccepted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(fileAccepted)
|
||||
filtered.append(fileName);
|
||||
}
|
||||
|
||||
return filtered;
|
||||
}
|
||||
|
||||
//DELEGATE methods
|
||||
void FileComic::fileExtracted(int index, const QByteArray & rawData)
|
||||
{
|
||||
/*QFile f("c:/temp/out2.txt");
|
||||
f.open(QIODevice::Append);
|
||||
QTextStream out(&f);*/
|
||||
int sortedIndex = _fileNames.indexOf(_order.at(index));
|
||||
//out << sortedIndex << " , ";
|
||||
//f.close();
|
||||
if(sortedIndex == -1)
|
||||
return;
|
||||
_pages[sortedIndex] = rawData;
|
||||
emit imageLoaded(sortedIndex);
|
||||
emit imageLoaded(sortedIndex,_pages[sortedIndex]);
|
||||
}
|
||||
|
||||
void FileComic::crcError(int index)
|
||||
{
|
||||
emit crcErrorFound(tr("CRC error on page (%1): some of the pages will not be displayed correctly").arg(index+1));
|
||||
}
|
||||
|
||||
//TODO: comprobar que si se produce uno de estos errores, la carga del c<>mic es irrecuperable
|
||||
void FileComic::unknownError(int index)
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
emit errorOpening(tr("Unknown error opening the file"));
|
||||
//emit errorOpening();
|
||||
}
|
||||
|
||||
//--------------------------------------
|
||||
|
||||
QList<QVector<quint32> > FileComic::getSections(int & sectionIndex)
|
||||
{
|
||||
QVector<quint32> sortedIndexes;
|
||||
foreach(QString name, _fileNames)
|
||||
{
|
||||
sortedIndexes.append(_order.indexOf(name));
|
||||
}
|
||||
QList<QVector <quint32> > sections;
|
||||
quint32 previous = 0;
|
||||
sectionIndex = -1;
|
||||
int sectionCount = 0;
|
||||
QVector <quint32> section;
|
||||
int idx = 0;
|
||||
unsigned int realIdx;
|
||||
foreach(quint32 i, sortedIndexes)
|
||||
{
|
||||
|
||||
if(_firstPage == idx)
|
||||
{
|
||||
sectionIndex = sectionCount;
|
||||
realIdx = i;
|
||||
}
|
||||
if(previous <= i)
|
||||
{
|
||||
//out << "idx : " << i << endl;
|
||||
section.append(i);
|
||||
previous = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(sectionIndex == sectionCount) //found
|
||||
{
|
||||
if(section.indexOf(realIdx)!=0)
|
||||
{
|
||||
QVector <quint32> section1;
|
||||
QVector <quint32> section2;
|
||||
foreach(quint32 si,section)
|
||||
{
|
||||
if(si<realIdx)
|
||||
section1.append(si);
|
||||
else
|
||||
section2.append(si);
|
||||
}
|
||||
sectionIndex++;
|
||||
sections.append(section1);
|
||||
sections.append(section2);
|
||||
//out << "SPLIT" << endl;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
sections.append(section);
|
||||
}
|
||||
}
|
||||
else
|
||||
sections.append(section);
|
||||
|
||||
section = QVector <quint32> ();
|
||||
//out << "---------------" << endl;
|
||||
section.append(i);
|
||||
//out << "idx : " << i << endl;
|
||||
previous = i;
|
||||
sectionCount++;
|
||||
}
|
||||
|
||||
idx++;
|
||||
}
|
||||
if(sectionIndex == sectionCount) //found
|
||||
{
|
||||
if(section.indexOf(realIdx)!=0)
|
||||
{
|
||||
QVector <quint32> section1;
|
||||
QVector <quint32> section2;
|
||||
foreach(quint32 si,section)
|
||||
{
|
||||
if(si<realIdx)
|
||||
section1.append(si);
|
||||
else
|
||||
section2.append(si);
|
||||
}
|
||||
sectionIndex++;
|
||||
sections.append(section1);
|
||||
sections.append(section2);
|
||||
//out << "SPLIT" << endl;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
sections.append(section);
|
||||
}
|
||||
}
|
||||
else
|
||||
sections.append(section);
|
||||
|
||||
//out << "se han encontrado : " << sections.count() << " sectionIndex : " << sectionIndex << endl;
|
||||
return sections;
|
||||
}
|
||||
|
||||
void FileComic::process()
|
||||
{
|
||||
CompressedArchive archive(_path);
|
||||
if(!archive.toolsLoaded())
|
||||
{
|
||||
emit errorOpening(tr("7z not found"));
|
||||
return;
|
||||
}
|
||||
|
||||
if(!archive.isValid())
|
||||
{
|
||||
emit errorOpening(tr("Format not supported"));
|
||||
return;
|
||||
}
|
||||
//se filtran para obtener s<>lo los formatos soportados
|
||||
_order = archive.getFileNames();
|
||||
_fileNames = filter(_order);
|
||||
|
||||
if(_fileNames.size()==0)
|
||||
{
|
||||
//QMessageBox::critical(NULL,tr("File error"),tr("File not found or not images in file"));
|
||||
emit errorOpening();
|
||||
return;
|
||||
}
|
||||
|
||||
//TODO, cambiar por listas
|
||||
//_order = _fileNames;
|
||||
|
||||
_pages.resize(_fileNames.size());
|
||||
_loadedPages = QVector<bool>(_fileNames.size(),false);
|
||||
|
||||
emit pageChanged(0); // this indicates new comic, index=0
|
||||
emit numPages(_pages.size());
|
||||
_loaded = true;
|
||||
|
||||
_cfi=0;
|
||||
qSort(_fileNames.begin(),_fileNames.end(), naturalSortLessThanCI);
|
||||
|
||||
if(_firstPage == -1)
|
||||
_firstPage = bm->getLastPage();
|
||||
_index = _firstPage;
|
||||
emit(openAt(_index));
|
||||
|
||||
int sectionIndex;
|
||||
QList<QVector <quint32> > sections = getSections(sectionIndex);
|
||||
|
||||
for(int i = sectionIndex; i<sections.count() ; i++)
|
||||
archive.getAllData(sections.at(i),this);
|
||||
for(int i = 0; i<sectionIndex; i++)
|
||||
archive.getAllData(sections.at(i),this);
|
||||
//archive.getAllData(QVector<quint32>(),this);
|
||||
/*
|
||||
foreach(QString name,_fileNames)
|
||||
{
|
||||
index = _order.indexOf(name);
|
||||
sortedIndex = _fileNames.indexOf(name);
|
||||
_pages[sortedIndex] = allData.at(index);
|
||||
emit imageLoaded(sortedIndex);
|
||||
emit imageLoaded(sortedIndex,_pages[sortedIndex]);
|
||||
}*/
|
||||
|
||||
emit imagesLoaded();
|
||||
//moveToThread(QApplication::instance()->thread());
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
FolderComic::FolderComic()
|
||||
:Comic()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
FolderComic::FolderComic(const QString & path, int atPage )
|
||||
:Comic(path, atPage )
|
||||
{
|
||||
load(path, atPage );
|
||||
}
|
||||
|
||||
FolderComic::~FolderComic()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool FolderComic::load(const QString & path, int atPage )
|
||||
{
|
||||
_path = path;
|
||||
if(atPage == -1)
|
||||
{
|
||||
bm->newComic(_path);
|
||||
emit bookmarksUpdated();
|
||||
}
|
||||
_firstPage = atPage;
|
||||
//emit bookmarksLoaded(*bm);
|
||||
return true;
|
||||
}
|
||||
|
||||
void FolderComic::process()
|
||||
{
|
||||
QDir d(_path);
|
||||
|
||||
d.setNameFilters(getSupportedImageFormats());
|
||||
d.setFilter(QDir::Files|QDir::NoDotAndDotDot);
|
||||
//d.setSorting(QDir::Name|QDir::IgnoreCase|QDir::LocaleAware);
|
||||
QFileInfoList list = d.entryInfoList();
|
||||
|
||||
qSort(list.begin(),list.end(),naturalSortLessThanCIFileInfo);
|
||||
|
||||
int nPages = list.size();
|
||||
_pages.clear();
|
||||
_pages.resize(nPages);
|
||||
_loadedPages = QVector<bool>(nPages,false);
|
||||
|
||||
if(nPages==0)
|
||||
{
|
||||
//TODO emitir este mensaje en otro sitio
|
||||
//QMessageBox::critical(NULL,QObject::tr("No images found"),QObject::tr("There are not images on the selected folder"));
|
||||
emit errorOpening();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_firstPage == -1)
|
||||
_firstPage = bm->getLastPage();
|
||||
|
||||
_index = _firstPage;
|
||||
|
||||
emit(openAt(_index));
|
||||
|
||||
emit pageChanged(0); // this indicates new comic, index=0
|
||||
emit numPages(_pages.size());
|
||||
_loaded = true;
|
||||
|
||||
int count=0;
|
||||
int i=_firstPage;
|
||||
while(count<nPages)
|
||||
{
|
||||
QFile f(list.at(i).absoluteFilePath());
|
||||
f.open(QIODevice::ReadOnly);
|
||||
_pages[i]=f.readAll();
|
||||
emit imageLoaded(i);
|
||||
emit imageLoaded(i,_pages[i]);
|
||||
i++;
|
||||
if(i==nPages)
|
||||
i=0;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
emit imagesLoaded();
|
||||
moveToThread(QApplication::instance()->thread());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PDFComic::PDFComic()
|
||||
:Comic()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
PDFComic::PDFComic(const QString & path, int atPage)
|
||||
:Comic(path,atPage)
|
||||
{
|
||||
load(path,atPage);
|
||||
}
|
||||
|
||||
PDFComic::~PDFComic()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool PDFComic::load(const QString & path, int atPage)
|
||||
{
|
||||
QFileInfo fi(path);
|
||||
|
||||
if(fi.exists())
|
||||
{
|
||||
_path = path;
|
||||
if(atPage == -1)
|
||||
{
|
||||
bm->newComic(_path);
|
||||
emit bookmarksUpdated();
|
||||
}
|
||||
_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()
|
||||
{
|
||||
pdfComic = Poppler::Document::load(_path);
|
||||
if (!pdfComic)
|
||||
{
|
||||
delete pdfComic;
|
||||
pdfComic = 0;
|
||||
emit errorOpening();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//pdfComic->setRenderHint(Poppler::Document::Antialiasing, true);
|
||||
pdfComic->setRenderHint(Poppler::Document::TextAntialiasing, true);
|
||||
int nPages = pdfComic->numPages();
|
||||
emit pageChanged(0); // this indicates new comic, index=0
|
||||
emit numPages(nPages);
|
||||
_loaded = true;
|
||||
//QMessageBox::critical(NULL,QString("%1").arg(nPages),tr("Invalid PDF file"));
|
||||
|
||||
_pages.clear();
|
||||
_pages.resize(nPages);
|
||||
_loadedPages = QVector<bool>(nPages,false);
|
||||
|
||||
if(_firstPage == -1)
|
||||
_firstPage = bm->getLastPage();
|
||||
_index = _firstPage;
|
||||
emit(openAt(_index));
|
||||
|
||||
for(int i=_index;i<nPages;i++)
|
||||
renderPage(i);
|
||||
for(int i=0;i<_index;i++)
|
||||
renderPage(i);
|
||||
|
||||
delete pdfComic;
|
||||
emit imagesLoaded();
|
||||
moveToThread(QApplication::instance()->thread());
|
||||
}
|
||||
|
||||
void PDFComic::renderPage(int page)
|
||||
{
|
||||
Poppler::Page* pdfpage = pdfComic->page(page);
|
||||
if (pdfpage)
|
||||
{
|
||||
QImage img = pdfpage->renderToImage(150,150);
|
||||
delete pdfpage;
|
||||
QByteArray ba;
|
||||
QBuffer buf(&ba);
|
||||
img.save(&buf, "jpg");
|
||||
_pages[page] = ba;
|
||||
emit imageLoaded(page);
|
||||
emit imageLoaded(page,_pages[page]);
|
||||
}
|
||||
}
|
||||
|
||||
Comic * FactoryComic::newComic(const QString & path)
|
||||
{
|
||||
|
||||
QFileInfo fi(path);
|
||||
if(fi.exists())
|
||||
{
|
||||
if(fi.isFile())
|
||||
{
|
||||
if(fi.suffix().compare("pdf",Qt::CaseInsensitive) == 0)
|
||||
return new PDFComic();
|
||||
else
|
||||
return new FileComic();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(fi.isDir())
|
||||
return new FolderComic();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
}
|
163
common/comic.h
Normal file
163
common/comic.h
Normal file
@ -0,0 +1,163 @@
|
||||
#ifndef __COMIC_H
|
||||
#define __COMIC_H
|
||||
#include <QtCore>
|
||||
#include <QImage>
|
||||
#include <QtGui>
|
||||
#include <QByteArray>
|
||||
#include <QMap>
|
||||
|
||||
#include "extract_delegate.h"
|
||||
|
||||
#include "bookmarks.h"
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include "poppler-qt5.h"
|
||||
#else
|
||||
#include "poppler-qt4.h"
|
||||
#endif
|
||||
|
||||
class ComicDB;
|
||||
//#define EXTENSIONS << "*.jpg" << "*.jpeg" << "*.png" << "*.gif" << "*.tiff" << "*.tif" << "*.bmp" Comic::getSupportedImageFormats()
|
||||
//#define EXTENSIONS_LITERAL << ".jpg" << ".jpeg" << ".png" << ".gif" << ".tiff" << ".tif" << ".bmp" //Comic::getSupportedImageLiteralFormats()
|
||||
class Comic : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
//Comic pages, one QPixmap for each file.
|
||||
QVector<QByteArray> _pages;
|
||||
QVector<bool> _loadedPages;
|
||||
//QVector<uint> _sizes;
|
||||
QStringList _fileNames;
|
||||
QMap<QString,int> _newOrder;
|
||||
QList<QString> _order;
|
||||
int _index;
|
||||
QString _path;
|
||||
bool _loaded;
|
||||
|
||||
int _cfi;
|
||||
|
||||
//open the comic at this point
|
||||
int _firstPage;
|
||||
|
||||
bool _isPDF;
|
||||
|
||||
static QStringList extensions;
|
||||
static QStringList literalExtensions;
|
||||
public:
|
||||
Bookmarks * bm;
|
||||
|
||||
//Constructors
|
||||
Comic();
|
||||
Comic(const QString & pathFile, int atPage = -1);
|
||||
~Comic();
|
||||
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);
|
||||
|
||||
/*void loadFromFile(const QString & pathFile);
|
||||
void loadFromDir(const QString & pathDir);
|
||||
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();}
|
||||
//QPixmap * currentPage();
|
||||
bool loaded();
|
||||
//QPixmap * operator[](unsigned int index);
|
||||
QVector<QByteArray> * getRawData(){return &_pages;};
|
||||
QByteArray getRawPage(int page);
|
||||
bool pageIsLoaded(int page);
|
||||
|
||||
inline static QStringList getSupportedImageFormats() { return extensions;};
|
||||
inline static QStringList getSupportedImageLiteralFormats() { return literalExtensions;};
|
||||
|
||||
public slots:
|
||||
void loadFinished();
|
||||
void setBookmark();
|
||||
void removeBookmark();
|
||||
void saveBookmarks();
|
||||
void checkIsBookmark(int index);
|
||||
void updateBookmarkImage(int);
|
||||
void setPageLoaded(int page);
|
||||
signals:
|
||||
void imagesLoaded();
|
||||
void imageLoaded(int index);
|
||||
void imageLoaded(int index,const QByteArray & image);
|
||||
void pageChanged(int index);
|
||||
void openAt(int index);
|
||||
void numPages(unsigned int numPages);
|
||||
void errorOpening();
|
||||
void errorOpening(QString);
|
||||
void crcErrorFound(QString);
|
||||
void isBookmark(bool);
|
||||
void bookmarksUpdated();
|
||||
void isCover();
|
||||
void isLast();
|
||||
|
||||
};
|
||||
|
||||
class FileComic : public Comic, public ExtractDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QList<QVector<quint32> > getSections(int & sectionIndex);
|
||||
public:
|
||||
FileComic();
|
||||
FileComic(const QString & path, int atPage = -1);
|
||||
~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);
|
||||
static QList<QString> filter(const QList<QString> & src);
|
||||
public slots:
|
||||
void process();
|
||||
};
|
||||
|
||||
class FolderComic : public Comic
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
//void run();
|
||||
public:
|
||||
FolderComic();
|
||||
FolderComic(const QString & path, int atPage = -1);
|
||||
~FolderComic();
|
||||
|
||||
virtual bool load(const QString & path, int atPage = -1);
|
||||
public slots:
|
||||
void process();
|
||||
|
||||
};
|
||||
|
||||
class PDFComic : public Comic
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
//pdf
|
||||
Poppler::Document * pdfComic;
|
||||
void renderPage(int page);
|
||||
|
||||
//void run();
|
||||
public:
|
||||
PDFComic();
|
||||
PDFComic(const QString & path, int atPage = -1);
|
||||
~PDFComic();
|
||||
|
||||
virtual bool load(const QString & path, int atPage = -1);
|
||||
virtual bool load(const QString & path, const ComicDB & comic);
|
||||
public slots:
|
||||
void process();
|
||||
};
|
||||
|
||||
class FactoryComic
|
||||
{
|
||||
public:
|
||||
static Comic * newComic(const QString & path);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
645
common/comic_db.cpp
Normal file
645
common/comic_db.cpp
Normal file
@ -0,0 +1,645 @@
|
||||
#include "comic_db.h"
|
||||
|
||||
#include <QVariant>
|
||||
#include <QFileInfo>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//COMIC------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
ComicDB::ComicDB()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool ComicDB::isDir()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QString ComicDB::toTXT()
|
||||
{
|
||||
QString txt;
|
||||
|
||||
//Legacy info
|
||||
txt.append(QString("comicid:%1\r\n").arg(id));
|
||||
txt.append(QString("hash:%1\r\n").arg(info.hash));
|
||||
txt.append(QString("path:%1\r\n").arg(path));
|
||||
txt.append(QString("numpages:%1\r\n").arg(*info.numPages));
|
||||
|
||||
//new 7.0
|
||||
txt.append(QString("rating:%1\r\n").arg(info.rating));
|
||||
txt.append(QString("currentPage:%1\r\n").arg(info.currentPage));
|
||||
txt.append(QString("contrast:%1\r\n").arg(info.contrast));
|
||||
|
||||
//Informaci<63>n general
|
||||
if(info.coverPage != NULL)
|
||||
txt.append(QString("coverPage:%1\r\n").arg(*info.coverPage));
|
||||
|
||||
if(info.title != NULL)
|
||||
txt.append(QString("title:%1\r\n").arg(*info.title));
|
||||
|
||||
if(info.number != NULL)
|
||||
txt.append(QString("number:%1\r\n").arg(*info.number));
|
||||
|
||||
if(info.isBis != NULL)
|
||||
txt.append(QString("isBis:%1\r\n").arg(*info.isBis));
|
||||
|
||||
if(info.count != NULL)
|
||||
txt.append(QString("count:%1\r\n").arg(*info.count));
|
||||
|
||||
if(info.volume != NULL)
|
||||
txt.append(QString("volume:%1\r\n").arg(*info.volume));
|
||||
|
||||
if(info.storyArc != NULL)
|
||||
txt.append(QString("storyArc:%1\r\n").arg(*info.storyArc));
|
||||
|
||||
if(info.arcNumber != NULL)
|
||||
txt.append(QString("arcNumber:%1\r\n").arg(*info.arcNumber));
|
||||
|
||||
if(info.arcCount != NULL)
|
||||
txt.append(QString("arcCount:%1\r\n").arg(*info.arcCount));
|
||||
|
||||
if(info.genere != NULL)
|
||||
txt.append(QString("genere:%1\r\n").arg(*info.genere));
|
||||
|
||||
//Autores
|
||||
if(info.writer != NULL)
|
||||
txt.append(QString("writer:%1\r\n").arg(*info.writer));
|
||||
|
||||
if(info.penciller != NULL)
|
||||
txt.append(QString("penciller:%1\r\n").arg(*info.penciller));
|
||||
|
||||
if(info.inker != NULL)
|
||||
txt.append(QString("inker:%1\r\n").arg(*info.inker));
|
||||
|
||||
if(info.colorist != NULL)
|
||||
txt.append(QString("colorist:%1\r\n").arg(*info.colorist));
|
||||
|
||||
if(info.letterer != NULL)
|
||||
txt.append(QString("letterer:%1\r\n").arg(*info.letterer));
|
||||
|
||||
if(info.coverArtist != NULL)
|
||||
txt.append(QString("coverArtist:%1\r\n").arg(*info.coverArtist));
|
||||
//Publicaci<63>n
|
||||
if(info.date != NULL)
|
||||
txt.append(QString("date:%1\r\n").arg(*info.date));
|
||||
|
||||
if(info.publisher != NULL)
|
||||
txt.append(QString("publisher:%1\r\n").arg(*info.publisher));
|
||||
|
||||
if(info.format != NULL)
|
||||
txt.append(QString("format:%1\r\n").arg(*info.format));
|
||||
|
||||
if(info.color != NULL)
|
||||
txt.append(QString("color:%1\r\n").arg(*info.color));
|
||||
|
||||
if(info.ageRating != NULL)
|
||||
txt.append(QString("ageRating:%1\r\n").arg(*info.ageRating));
|
||||
//Argumento
|
||||
if(info.synopsis != NULL)
|
||||
txt.append(QString("synopsis:%1\r\n").arg(*info.synopsis));
|
||||
|
||||
if(info.characters != NULL)
|
||||
txt.append(QString("characters:%1\r\n").arg(*info.characters));
|
||||
|
||||
if(info.notes != NULL)
|
||||
txt.append(QString("notes:%1\r\n").arg(*info.notes));
|
||||
|
||||
return txt;
|
||||
}
|
||||
|
||||
QString ComicDB::getFileName() const
|
||||
{
|
||||
return QFileInfo(path).fileName();
|
||||
}
|
||||
|
||||
QString ComicDB::getTitleOrFileName() const
|
||||
{
|
||||
if(info.title && info.title->isEmpty())
|
||||
return *(info.title);
|
||||
else
|
||||
return QFileInfo(path).fileName();
|
||||
}
|
||||
|
||||
QString ComicDB::getParentFolderName() const
|
||||
{
|
||||
QStringList paths = path.split('/');
|
||||
if(paths.length()<2)
|
||||
return "";
|
||||
else
|
||||
return paths[paths.length()-2];
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//COMIC_INFO-------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
ComicInfo::ComicInfo()
|
||||
:existOnDb(false),
|
||||
rating(0),
|
||||
hasBeenOpened(false),
|
||||
currentPage(1),
|
||||
bookmark1(-1),
|
||||
bookmark2(-1),
|
||||
bookmark3(-1),
|
||||
brightness(-1),
|
||||
contrast(-1),
|
||||
gamma(-1),
|
||||
title(NULL),
|
||||
coverPage(NULL),
|
||||
numPages(NULL),
|
||||
number(NULL),
|
||||
isBis(NULL),
|
||||
count(NULL),
|
||||
volume(NULL),
|
||||
storyArc(NULL),
|
||||
arcNumber(NULL),
|
||||
arcCount(NULL),
|
||||
genere(NULL),
|
||||
writer(NULL),
|
||||
penciller(NULL),
|
||||
inker(NULL),
|
||||
colorist(NULL),
|
||||
letterer(NULL),
|
||||
coverArtist(NULL),
|
||||
date(NULL),
|
||||
publisher(NULL),
|
||||
format(NULL),
|
||||
color(NULL),
|
||||
ageRating(NULL),
|
||||
synopsis(NULL),
|
||||
characters(NULL),
|
||||
notes(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ComicInfo::ComicInfo(const ComicInfo & comicInfo)
|
||||
: title(NULL),
|
||||
coverPage(NULL),
|
||||
numPages(NULL),
|
||||
number(NULL),
|
||||
isBis(NULL),
|
||||
count(NULL),
|
||||
volume(NULL),
|
||||
storyArc(NULL),
|
||||
arcNumber(NULL),
|
||||
arcCount(NULL),
|
||||
genere(NULL),
|
||||
writer(NULL),
|
||||
penciller(NULL),
|
||||
inker(NULL),
|
||||
colorist(NULL),
|
||||
letterer(NULL),
|
||||
coverArtist(NULL),
|
||||
date(NULL),
|
||||
publisher(NULL),
|
||||
format(NULL),
|
||||
color(NULL),
|
||||
ageRating(NULL),
|
||||
synopsis(NULL),
|
||||
characters(NULL),
|
||||
notes(NULL)
|
||||
{
|
||||
operator=(comicInfo);
|
||||
}
|
||||
|
||||
ComicInfo::~ComicInfo()
|
||||
{
|
||||
delete title;
|
||||
delete coverPage;
|
||||
delete numPages;
|
||||
delete number;
|
||||
delete isBis;
|
||||
delete count;
|
||||
delete volume;
|
||||
delete storyArc;
|
||||
delete arcNumber;
|
||||
delete arcCount;
|
||||
delete genere;
|
||||
delete writer;
|
||||
delete penciller;
|
||||
delete inker;
|
||||
delete colorist;
|
||||
delete letterer;
|
||||
delete coverArtist;
|
||||
delete date;
|
||||
delete publisher;
|
||||
delete format;
|
||||
delete color;
|
||||
delete ageRating;
|
||||
delete synopsis;
|
||||
delete characters;
|
||||
delete notes;
|
||||
}
|
||||
ComicInfo & ComicInfo::operator=(const ComicInfo & comicInfo)
|
||||
{
|
||||
copyField(title,comicInfo.title);
|
||||
copyField(coverPage,comicInfo.coverPage);
|
||||
copyField(numPages,comicInfo.numPages);
|
||||
copyField(number,comicInfo.number);
|
||||
copyField(isBis,comicInfo.isBis);
|
||||
copyField(count,comicInfo.count);
|
||||
copyField(volume,comicInfo.volume);
|
||||
copyField(storyArc,comicInfo.storyArc);
|
||||
copyField(arcNumber,comicInfo.arcNumber);
|
||||
copyField(arcCount,comicInfo.arcCount);
|
||||
copyField(genere,comicInfo.genere);
|
||||
copyField(writer,comicInfo.writer);
|
||||
copyField(penciller,comicInfo.penciller);
|
||||
copyField(inker,comicInfo.inker);
|
||||
copyField(colorist,comicInfo.colorist);
|
||||
copyField(letterer,comicInfo.letterer);
|
||||
copyField(coverArtist,comicInfo.coverArtist);
|
||||
copyField(date,comicInfo.date);
|
||||
copyField(publisher,comicInfo.publisher);
|
||||
copyField(format,comicInfo.format);
|
||||
copyField(color,comicInfo.color);
|
||||
copyField(ageRating,comicInfo.ageRating);
|
||||
copyField(synopsis,comicInfo.synopsis);
|
||||
copyField(characters,comicInfo.characters);
|
||||
copyField(notes,comicInfo.notes);
|
||||
|
||||
hash = comicInfo.hash;
|
||||
id = comicInfo.id;
|
||||
existOnDb = comicInfo.existOnDb;
|
||||
read = comicInfo.read;
|
||||
edited = comicInfo.edited;
|
||||
|
||||
hasBeenOpened = comicInfo.hasBeenOpened;
|
||||
rating = comicInfo.rating;
|
||||
currentPage = comicInfo.currentPage;
|
||||
bookmark1 = comicInfo.bookmark1;
|
||||
bookmark2 = comicInfo.bookmark2;
|
||||
bookmark3 = comicInfo.bookmark3;
|
||||
brightness = comicInfo.brightness;
|
||||
contrast = comicInfo.contrast;
|
||||
gamma = comicInfo.gamma;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void ComicInfo::setValue(QString * & field, const QString & value)
|
||||
{
|
||||
if(field == NULL)
|
||||
field = new QString;
|
||||
*field = value;
|
||||
}
|
||||
|
||||
void ComicInfo::setValue(int * & field, int value)
|
||||
{
|
||||
if(field == NULL)
|
||||
field = new int;
|
||||
*field = value;
|
||||
}
|
||||
|
||||
void ComicInfo::setValue(bool * & field, bool value)
|
||||
{
|
||||
if(field == NULL)
|
||||
field = new bool;
|
||||
*field = value;
|
||||
}
|
||||
|
||||
void ComicInfo::copyField(QString * & field, const QString * value)
|
||||
{
|
||||
if(field != 0)
|
||||
delete field;
|
||||
field = 0;
|
||||
if(value != NULL)
|
||||
field = new QString(*value);
|
||||
|
||||
}
|
||||
|
||||
void ComicInfo::copyField(int * & field, int * value)
|
||||
{
|
||||
if(field != NULL)
|
||||
delete field;
|
||||
field = 0;
|
||||
if(value != NULL)
|
||||
field = new int(*value);
|
||||
}
|
||||
|
||||
void ComicInfo::copyField(bool * & field, bool * value)
|
||||
{
|
||||
if(field != NULL)
|
||||
delete field;
|
||||
field = 0;
|
||||
if(value != NULL)
|
||||
field = new bool(*value);
|
||||
}
|
||||
|
||||
|
||||
//set fields
|
||||
void ComicInfo::setTitle(QString value)
|
||||
{
|
||||
setValue(title,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setCoverPage(int value)
|
||||
{
|
||||
setValue(coverPage,value);
|
||||
}
|
||||
void ComicInfo::setNumPages(int value)
|
||||
{
|
||||
setValue(numPages,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setNumber(int value)
|
||||
{
|
||||
setValue(number,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setIsBis(bool value)
|
||||
{
|
||||
setValue(isBis,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setCount(int value)
|
||||
{
|
||||
setValue(count,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setVolume(QString value)
|
||||
{
|
||||
setValue(volume,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setStoryArc(QString value)
|
||||
{
|
||||
setValue(storyArc,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setArcNumber(int value)
|
||||
{
|
||||
setValue(arcNumber,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setArcCount(int value)
|
||||
{
|
||||
setValue(arcCount,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setGenere(QString value)
|
||||
{
|
||||
setValue(genere,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setWriter(QString value)
|
||||
{
|
||||
setValue(writer,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setPenciller(QString value)
|
||||
{
|
||||
setValue(penciller,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setInker(QString value)
|
||||
{
|
||||
setValue(inker,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setColorist(QString value)
|
||||
{
|
||||
setValue(colorist,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setLetterer(QString value)
|
||||
{
|
||||
setValue(letterer,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setCoverArtist(QString value)
|
||||
{
|
||||
setValue(coverArtist,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setDate(QString value)
|
||||
{
|
||||
setValue(date,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setPublisher(QString value)
|
||||
{
|
||||
setValue(publisher,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setFormat(QString value)
|
||||
{
|
||||
setValue(format,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setColor(bool value)
|
||||
{
|
||||
setValue(color,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setAgeRating(QString value)
|
||||
{
|
||||
setValue(ageRating,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setSynopsis(QString value)
|
||||
{
|
||||
setValue(synopsis,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setCharacters(QString value)
|
||||
{
|
||||
setValue(characters,value);
|
||||
}
|
||||
|
||||
void ComicInfo::setNotes(QString value)
|
||||
{
|
||||
setValue(notes,value);
|
||||
}
|
||||
|
||||
QPixmap ComicInfo::getCover(const QString & basePath)
|
||||
{
|
||||
if(cover.isNull())
|
||||
{
|
||||
cover.load(basePath + "/.yacreaderlibrary/covers/" + hash + ".jpg");
|
||||
}
|
||||
QPixmap c;
|
||||
c.convertFromImage(cover);
|
||||
return c;
|
||||
}
|
||||
QDataStream &operator<<(QDataStream & stream, const ComicDB & comic)
|
||||
{
|
||||
stream << comic.id;
|
||||
stream << comic.name;
|
||||
stream << comic.parentId;
|
||||
stream << comic.path;
|
||||
stream << comic._hasCover;
|
||||
stream << comic.info;
|
||||
return stream;
|
||||
}
|
||||
|
||||
QDataStream &operator>>(QDataStream & stream, ComicDB & comic)
|
||||
{
|
||||
stream >> comic.id;
|
||||
stream >> comic.name;
|
||||
stream >> comic.parentId;
|
||||
stream >> comic.path;
|
||||
stream >> comic._hasCover;
|
||||
stream >> comic.info;
|
||||
return stream;
|
||||
}
|
||||
|
||||
void serializeField(QDataStream & stream, QString * field)
|
||||
{
|
||||
stream << (field!=0);
|
||||
if (field!=0) stream << *field;
|
||||
}
|
||||
|
||||
void serializeField(QDataStream & stream, int * field)
|
||||
{
|
||||
stream << (field!=0);
|
||||
if (field!=0) stream << *field;
|
||||
}
|
||||
|
||||
void serializeField(QDataStream & stream, bool * field)
|
||||
{
|
||||
stream << (field!=0);
|
||||
if (field!=0) stream << *field;
|
||||
}
|
||||
|
||||
void deserializeField(QDataStream & stream, QString * & field)
|
||||
{
|
||||
bool isData;
|
||||
stream >> isData;
|
||||
if(isData)
|
||||
{
|
||||
field = new QString();
|
||||
stream >> *field;
|
||||
}
|
||||
}
|
||||
|
||||
void deserializeField(QDataStream & stream, int * & field)
|
||||
{
|
||||
bool isData;
|
||||
stream >> isData;
|
||||
if(isData)
|
||||
{
|
||||
field = new int;
|
||||
stream >> *field;
|
||||
}
|
||||
}
|
||||
|
||||
void deserializeField(QDataStream & stream, bool * & field)
|
||||
{
|
||||
bool isData;
|
||||
stream >> isData;
|
||||
if(isData)
|
||||
{
|
||||
field = new bool;
|
||||
stream >> *field;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QDataStream &operator<<(QDataStream & stream, const ComicInfo & comicInfo)
|
||||
{
|
||||
stream << comicInfo.id;
|
||||
stream << comicInfo.read;
|
||||
stream << comicInfo.edited;
|
||||
stream << comicInfo.hash;
|
||||
stream << comicInfo.existOnDb;
|
||||
|
||||
stream << comicInfo.hasBeenOpened;
|
||||
stream << comicInfo.rating;
|
||||
stream << comicInfo.currentPage;
|
||||
stream << comicInfo.bookmark1;
|
||||
stream << comicInfo.bookmark2;
|
||||
stream << comicInfo.bookmark3;
|
||||
stream << comicInfo.brightness;
|
||||
stream << comicInfo.contrast;
|
||||
stream << comicInfo.gamma;
|
||||
|
||||
serializeField(stream,comicInfo.title);
|
||||
|
||||
serializeField(stream,comicInfo.coverPage);
|
||||
serializeField(stream,comicInfo.numPages);
|
||||
|
||||
serializeField(stream,comicInfo.number);
|
||||
serializeField(stream,comicInfo.isBis);
|
||||
serializeField(stream,comicInfo.count);
|
||||
|
||||
serializeField(stream,comicInfo.volume);
|
||||
serializeField(stream,comicInfo.storyArc);
|
||||
serializeField(stream,comicInfo.arcNumber);
|
||||
serializeField(stream,comicInfo.arcCount);
|
||||
|
||||
serializeField(stream,comicInfo.genere);
|
||||
|
||||
serializeField(stream,comicInfo.writer);
|
||||
serializeField(stream,comicInfo.penciller);
|
||||
serializeField(stream,comicInfo.inker);
|
||||
serializeField(stream,comicInfo.colorist);
|
||||
serializeField(stream,comicInfo.letterer);
|
||||
serializeField(stream,comicInfo.coverArtist);
|
||||
|
||||
serializeField(stream,comicInfo.date);
|
||||
serializeField(stream,comicInfo.publisher);
|
||||
serializeField(stream,comicInfo.format);
|
||||
serializeField(stream,comicInfo.color);
|
||||
serializeField(stream,comicInfo.ageRating);
|
||||
|
||||
serializeField(stream,comicInfo.synopsis);
|
||||
serializeField(stream,comicInfo.characters);
|
||||
serializeField(stream,comicInfo.notes);
|
||||
return stream;
|
||||
}
|
||||
|
||||
QDataStream &operator>>(QDataStream & stream, ComicInfo & comicInfo)
|
||||
{
|
||||
stream >> comicInfo.id;
|
||||
stream >> comicInfo.read;
|
||||
stream >> comicInfo.edited;
|
||||
stream >> comicInfo.hash;
|
||||
stream >> comicInfo.existOnDb;
|
||||
|
||||
stream >> comicInfo.hasBeenOpened;
|
||||
stream >> comicInfo.rating;
|
||||
stream >> comicInfo.currentPage;
|
||||
stream >> comicInfo.bookmark1;
|
||||
stream >> comicInfo.bookmark2;
|
||||
stream >> comicInfo.bookmark3;
|
||||
stream >> comicInfo.brightness;
|
||||
stream >> comicInfo.contrast;
|
||||
stream >> comicInfo.gamma;
|
||||
|
||||
deserializeField(stream,comicInfo.title);
|
||||
|
||||
deserializeField(stream,comicInfo.coverPage);
|
||||
deserializeField(stream,comicInfo.numPages);
|
||||
|
||||
deserializeField(stream,comicInfo.number);
|
||||
deserializeField(stream,comicInfo.isBis);
|
||||
deserializeField(stream,comicInfo.count);
|
||||
|
||||
deserializeField(stream,comicInfo.volume);
|
||||
deserializeField(stream,comicInfo.storyArc);
|
||||
deserializeField(stream,comicInfo.arcNumber);
|
||||
deserializeField(stream,comicInfo.arcCount);
|
||||
|
||||
deserializeField(stream,comicInfo.genere);
|
||||
|
||||
deserializeField(stream,comicInfo.writer);
|
||||
deserializeField(stream,comicInfo.penciller);
|
||||
deserializeField(stream,comicInfo.inker);
|
||||
deserializeField(stream,comicInfo.colorist);
|
||||
deserializeField(stream,comicInfo.letterer);
|
||||
deserializeField(stream,comicInfo.coverArtist);
|
||||
|
||||
deserializeField(stream,comicInfo.date);
|
||||
deserializeField(stream,comicInfo.publisher);
|
||||
deserializeField(stream,comicInfo.format);
|
||||
deserializeField(stream,comicInfo.color);
|
||||
deserializeField(stream,comicInfo.ageRating);
|
||||
|
||||
deserializeField(stream,comicInfo.synopsis);
|
||||
deserializeField(stream,comicInfo.characters);
|
||||
deserializeField(stream,comicInfo.notes);
|
||||
return stream;
|
||||
}
|
156
common/comic_db.h
Normal file
156
common/comic_db.h
Normal file
@ -0,0 +1,156 @@
|
||||
#ifndef __COMICDB_H
|
||||
#define __COMICDB_H
|
||||
|
||||
#include "library_item.h"
|
||||
#include <QList>
|
||||
#include <QPixmap>
|
||||
#include <QImage>
|
||||
#include <QMetaType>
|
||||
|
||||
class ComicInfo
|
||||
{
|
||||
public:
|
||||
ComicInfo();
|
||||
ComicInfo(const ComicInfo & comicInfo);
|
||||
~ComicInfo();
|
||||
|
||||
ComicInfo & operator=(const ComicInfo & comicInfo);
|
||||
|
||||
qulonglong id;
|
||||
bool read;
|
||||
bool edited;
|
||||
QString hash;
|
||||
bool existOnDb;
|
||||
|
||||
int rating;
|
||||
|
||||
bool hasBeenOpened;
|
||||
|
||||
//viewer
|
||||
int currentPage;
|
||||
int bookmark1;
|
||||
int bookmark2;
|
||||
int bookmark3;
|
||||
int brightness;
|
||||
int contrast;
|
||||
int gamma;
|
||||
|
||||
|
||||
|
||||
QString * title;
|
||||
|
||||
int * coverPage;
|
||||
int * numPages;
|
||||
|
||||
int * number;
|
||||
bool * isBis;
|
||||
int * count;
|
||||
|
||||
QString * volume;
|
||||
QString * storyArc;
|
||||
int * arcNumber;
|
||||
int * arcCount;
|
||||
|
||||
QString * genere;
|
||||
|
||||
QString * writer;
|
||||
QString * penciller;
|
||||
QString * inker;
|
||||
QString * colorist;
|
||||
QString * letterer;
|
||||
QString * coverArtist;
|
||||
|
||||
QString * date;
|
||||
QString * publisher;
|
||||
QString * format;
|
||||
bool * color;
|
||||
QString * ageRating;
|
||||
|
||||
QString * synopsis;
|
||||
QString * characters;
|
||||
QString * notes;
|
||||
|
||||
QImage cover;
|
||||
|
||||
void setTitle(QString value);
|
||||
|
||||
void setCoverPage(int value);
|
||||
void setNumPages(int value);
|
||||
|
||||
void setNumber(int value);
|
||||
void setIsBis(bool value);
|
||||
void setCount(int value);
|
||||
|
||||
void setVolume(QString value);
|
||||
void setStoryArc(QString value);
|
||||
void setArcNumber(int value);
|
||||
void setArcCount(int value);
|
||||
|
||||
void setGenere(QString value);
|
||||
|
||||
void setWriter(QString value);
|
||||
void setPenciller(QString value);
|
||||
void setInker(QString value);
|
||||
void setColorist(QString value);
|
||||
void setLetterer(QString value);
|
||||
void setCoverArtist(QString value);
|
||||
|
||||
void setDate(QString value);
|
||||
void setPublisher(QString value);
|
||||
void setFormat(QString value);
|
||||
void setColor(bool value);
|
||||
void setAgeRating(QString value);
|
||||
|
||||
void setSynopsis(QString value);
|
||||
void setCharacters(QString value);
|
||||
void setNotes(QString value);
|
||||
|
||||
QPixmap getCover(const QString & basePath);
|
||||
|
||||
friend QDataStream &operator<<(QDataStream & stream, const ComicInfo & comicInfo);
|
||||
|
||||
friend QDataStream &operator>>(QDataStream & stream, ComicInfo & comicInfo);
|
||||
|
||||
private:
|
||||
void setValue(QString * & field, const QString & value);
|
||||
void setValue(int * & field, int value);
|
||||
void setValue(bool * & field, bool value);
|
||||
|
||||
void copyField(QString * & field, const QString * value);
|
||||
void copyField(int * & field, int * value);
|
||||
void copyField(bool * & field, bool * value);
|
||||
};
|
||||
|
||||
class ComicDB : public LibraryItem
|
||||
{
|
||||
public:
|
||||
ComicDB();
|
||||
|
||||
bool isDir();
|
||||
|
||||
bool _hasCover;
|
||||
|
||||
bool hasCover() {return _hasCover;};
|
||||
|
||||
//return comic file name
|
||||
QString getFileName() const;
|
||||
|
||||
//returns comic title if it isn't null or empty, in other case returns fileName
|
||||
QString getTitleOrFileName() const;
|
||||
|
||||
//returns parent folder name
|
||||
QString getParentFolderName() const;
|
||||
|
||||
QString toTXT();
|
||||
|
||||
ComicInfo info;
|
||||
|
||||
bool operator==(const ComicDB & other){return id == other.id;};
|
||||
|
||||
friend QDataStream &operator<<(QDataStream &, const ComicDB &);
|
||||
friend QDataStream &operator>>(QDataStream &, ComicDB &);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(ComicDB);
|
||||
|
||||
#endif
|
24
common/custom_widgets.cpp
Normal file
24
common/custom_widgets.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include "custom_widgets.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
|
||||
void delTree(QDir dir)
|
||||
{
|
||||
dir.setFilter(QDir::AllDirs|QDir::Files|QDir::Hidden|QDir::NoDotAndDotDot);
|
||||
QFileInfoList list = dir.entryInfoList();
|
||||
for (int i = 0; i < list.size(); ++i)
|
||||
{
|
||||
QFileInfo fileInfo = list.at(i);
|
||||
QString path = fileInfo.filePath();
|
||||
if(fileInfo.isDir())
|
||||
{
|
||||
delTree(QDir(fileInfo.absoluteFilePath()));
|
||||
dir.rmdir(fileInfo.absoluteFilePath());
|
||||
}
|
||||
else
|
||||
{
|
||||
dir.remove(fileInfo.absoluteFilePath());
|
||||
}
|
||||
}
|
||||
}
|
12
common/custom_widgets.h
Normal file
12
common/custom_widgets.h
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef __CUSTOM_WIDGETS_H
|
||||
#define __CUSTOM_WIDGETS_H
|
||||
|
||||
class QDir;
|
||||
|
||||
void delTree(QDir dir);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
21
common/exit_check.cpp
Normal file
21
common/exit_check.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include "exit_check.h"
|
||||
|
||||
#include "yacreader_global.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
using namespace YACReader;
|
||||
|
||||
void YACReader::exitCheck(int ret)
|
||||
{
|
||||
switch(ret)
|
||||
{
|
||||
case YACReader::SevenZNotFound:
|
||||
QMessageBox::critical(0,QObject::tr("7z lib not found"),QObject::tr("unable to load 7z lib from ./utils"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
9
common/exit_check.h
Normal file
9
common/exit_check.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef EXIT_CHECK_H
|
||||
#define EXIT_CHECK_H
|
||||
|
||||
namespace YACReader
|
||||
{
|
||||
void exitCheck(int ret);
|
||||
}
|
||||
|
||||
#endif
|
0
common/folder.cpp
Normal file
0
common/folder.cpp
Normal file
22
common/folder.h
Normal file
22
common/folder.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef __FOLDER_H
|
||||
#define __FOLDER_H
|
||||
|
||||
#include "library_item.h"
|
||||
|
||||
#include <QList>
|
||||
|
||||
class Folder : public LibraryItem
|
||||
{
|
||||
public:
|
||||
bool knownParent;
|
||||
bool knownId;
|
||||
|
||||
Folder():knownParent(false), knownId(false){};
|
||||
Folder(qulonglong sid, qulonglong pid,QString fn, QString fp):knownParent(true), knownId(true){id = sid; parentId = pid;name = fn; path = fp;};
|
||||
Folder(QString fn, QString fp):knownParent(false), knownId(false){name = fn; path = fp;};
|
||||
void setId(qulonglong sid){id = sid;knownId = true;};
|
||||
void setFather(qulonglong pid){parentId = pid;knownParent = true;};
|
||||
bool isDir(){return true;};
|
||||
};
|
||||
|
||||
#endif
|
65
common/http_worker.cpp
Normal file
65
common/http_worker.cpp
Normal file
@ -0,0 +1,65 @@
|
||||
#include "http_worker.h"
|
||||
#include <QMessageBox>
|
||||
#include <QUrl>
|
||||
#include <QtGlobal>
|
||||
#include <QStringList>
|
||||
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QEventLoop>
|
||||
#include <QTimer>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
|
||||
#define PREVIOUS_VERSION "6.0.0"
|
||||
|
||||
HttpWorker::HttpWorker(const QString & urlString)
|
||||
:QThread(),url(urlString),_error(false),_timeout(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void HttpWorker::get()
|
||||
{
|
||||
this->start();
|
||||
}
|
||||
|
||||
QByteArray HttpWorker::getResult()
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
bool HttpWorker::wasValid()
|
||||
{
|
||||
return !_error;
|
||||
}
|
||||
|
||||
bool HttpWorker::wasTimeout()
|
||||
{
|
||||
return _timeout;
|
||||
}
|
||||
|
||||
void HttpWorker::run()
|
||||
{
|
||||
QNetworkAccessManager manager;
|
||||
QEventLoop q;
|
||||
QTimer tT;
|
||||
|
||||
tT.setSingleShot(true);
|
||||
connect(&tT, SIGNAL(timeout()), &q, SLOT(quit()));
|
||||
connect(&manager, SIGNAL(finished(QNetworkReply*)),&q, SLOT(quit()));
|
||||
QNetworkReply *reply = manager.get(QNetworkRequest(url));
|
||||
|
||||
tT.start(5000); // 5s timeout
|
||||
q.exec();
|
||||
|
||||
if(tT.isActive()){
|
||||
// download complete
|
||||
_error = !(reply->error() == QNetworkReply::NoError);
|
||||
result = reply->readAll();
|
||||
emit dataReady(result);
|
||||
tT.stop();
|
||||
} else {
|
||||
_timeout = true;
|
||||
emit timeout();
|
||||
}
|
||||
}
|
32
common/http_worker.h
Normal file
32
common/http_worker.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef __HTTP_WORKER_H
|
||||
#define __HTTP_WORKER_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QByteArray>
|
||||
#include <QThread>
|
||||
#include <QUrl>
|
||||
#include "yacreader_global.h"
|
||||
|
||||
class HttpWorker : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HttpWorker(const QString & urlString);
|
||||
public slots:
|
||||
void get();
|
||||
QByteArray getResult();
|
||||
bool wasValid();
|
||||
bool wasTimeout();
|
||||
private:
|
||||
void run();
|
||||
QUrl url;
|
||||
int httpGetId;
|
||||
QByteArray result;
|
||||
bool _error;
|
||||
bool _timeout;
|
||||
signals:
|
||||
void dataReady(const QByteArray &);
|
||||
void timeout();
|
||||
};
|
||||
|
||||
#endif
|
0
common/library_item.cpp
Normal file
0
common/library_item.cpp
Normal file
16
common/library_item.h
Normal file
16
common/library_item.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef __LIBRARY_ITEM_H
|
||||
#define __LIBRARY_ITEM_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class LibraryItem
|
||||
{
|
||||
public:
|
||||
virtual bool isDir() = 0;
|
||||
QString name;
|
||||
QString path;
|
||||
qulonglong parentId;
|
||||
qulonglong id;
|
||||
};
|
||||
|
||||
#endif
|
54
common/onstart_flow_selection_dialog.cpp
Normal file
54
common/onstart_flow_selection_dialog.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
#include "onstart_flow_selection_dialog.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QHBoxLayout>
|
||||
#include <qlocale.h>
|
||||
|
||||
OnStartFlowSelectionDialog::OnStartFlowSelectionDialog(QWidget * parent)
|
||||
:QDialog(parent)
|
||||
{
|
||||
setModal(true);
|
||||
QPushButton * acceptHW = new QPushButton(this);
|
||||
connect(acceptHW,SIGNAL(clicked()),this,SLOT(accept()));
|
||||
QPushButton * rejectHW = new QPushButton(this); //and use SW flow
|
||||
connect(rejectHW,SIGNAL(clicked()),this,SLOT(reject()));
|
||||
|
||||
acceptHW->setGeometry(90,165,110,118);
|
||||
acceptHW->setFlat(true);
|
||||
acceptHW->setAutoFillBackground(true);
|
||||
rejectHW->setGeometry(464,165,110,118);
|
||||
rejectHW->setFlat(true);
|
||||
rejectHW->setAutoFillBackground(true);
|
||||
|
||||
QPalette paletteHW;
|
||||
QLocale locale = this->locale();
|
||||
QLocale::Language language = locale.language();
|
||||
|
||||
/*if(language == QLocale::Spanish)
|
||||
paletteHW.setBrush(acceptHW->backgroundRole(), QBrush(QImage(":/images/useNewFlowButton_es.png")));
|
||||
else
|
||||
paletteHW.setBrush(acceptHW->backgroundRole(), QBrush(QImage(":/images/useNewFlowButton.png")));*/
|
||||
|
||||
|
||||
paletteHW.setBrush(acceptHW->backgroundRole(), QBrush(QImage(":/images/nonexxx.png")));
|
||||
acceptHW->setPalette(paletteHW);
|
||||
QPalette paletteSW;
|
||||
paletteSW.setBrush(rejectHW->backgroundRole(), QBrush(QImage(":/images/nonexxx.png")));
|
||||
rejectHW->setPalette(paletteSW);
|
||||
//QHBoxLayout * layout = new QHBoxLayout;
|
||||
//layout->addWidget(acceptHW);
|
||||
//layout->addWidget(rejectHW);
|
||||
|
||||
QPalette palette;
|
||||
if(language == QLocale::Spanish)
|
||||
palette.setBrush(this->backgroundRole(), QBrush(QImage(":/images/onStartFlowSelection_es.png")));
|
||||
else
|
||||
palette.setBrush(this->backgroundRole(), QBrush(QImage(":/images/onStartFlowSelection.png")));
|
||||
|
||||
setPalette(palette);
|
||||
|
||||
|
||||
//setLayout(layout);
|
||||
|
||||
resize(664,371);
|
||||
}
|
13
common/onstart_flow_selection_dialog.h
Normal file
13
common/onstart_flow_selection_dialog.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef ONSTART_FLOW_SELECTION_DIALOG_H
|
||||
#define ONSTART_FLOW_SELECTION_DIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class OnStartFlowSelectionDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
OnStartFlowSelectionDialog(QWidget * parent = 0);
|
||||
};
|
||||
|
||||
#endif
|
1380
common/pictureflow.cpp
Normal file
1380
common/pictureflow.cpp
Normal file
File diff suppressed because it is too large
Load Diff
227
common/pictureflow.h
Normal file
227
common/pictureflow.h
Normal file
@ -0,0 +1,227 @@
|
||||
/*
|
||||
PictureFlow - animated image show widget
|
||||
http://pictureflow.googlecode.com
|
||||
|
||||
Copyright (C) 2008 Ariya Hidayat (ariya@kde.org)
|
||||
Copyright (C) 2007 Ariya Hidayat (ariya@kde.org)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef PICTUREFLOW_H
|
||||
#define PICTUREFLOW_H
|
||||
|
||||
#include <qwidget.h>
|
||||
#include "yacreader_global.h" //FlowType
|
||||
|
||||
class PictureFlowPrivate;
|
||||
|
||||
using namespace YACReader;
|
||||
|
||||
/*!
|
||||
Class PictureFlow implements an image show widget with animation effect
|
||||
like Apple's CoverFlow (in iTunes and iPod). Images are arranged in form
|
||||
of slides, one main slide is shown at the center with few slides on
|
||||
the left and right sides of the center slide. When the next or previous
|
||||
slide is brought to the front, the whole slides flow to the right or
|
||||
the right with smooth animation effect; until the new slide is finally
|
||||
placed at the center.
|
||||
|
||||
*/
|
||||
class PictureFlow : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
|
||||
Q_PROPERTY(QSize slideSize READ slideSize WRITE setSlideSize)
|
||||
Q_PROPERTY(int slideCount READ slideCount)
|
||||
Q_PROPERTY(int centerIndex READ centerIndex WRITE setCenterIndex)
|
||||
|
||||
public:
|
||||
|
||||
enum ReflectionEffect
|
||||
{
|
||||
NoReflection,
|
||||
PlainReflection,
|
||||
BlurredReflection
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
Creates a new PictureFlow widget.
|
||||
*/
|
||||
PictureFlow(QWidget* parent = 0, FlowType flowType = CoverFlowLike);
|
||||
|
||||
/*!
|
||||
Destroys the widget.
|
||||
*/
|
||||
~PictureFlow();
|
||||
|
||||
/*!
|
||||
Returns the background color.
|
||||
*/
|
||||
QColor backgroundColor() const;
|
||||
|
||||
/*!
|
||||
Sets the background color. By default it is black.
|
||||
*/
|
||||
void setBackgroundColor(const QColor& c);
|
||||
|
||||
/*!
|
||||
Returns the dimension of each slide (in pixels).
|
||||
*/
|
||||
QSize slideSize() const;
|
||||
|
||||
/*!
|
||||
Sets the dimension of each slide (in pixels).
|
||||
*/
|
||||
void setSlideSize(QSize size);
|
||||
|
||||
/*!
|
||||
Returns the total number of slides.
|
||||
*/
|
||||
int slideCount() const;
|
||||
|
||||
/*!
|
||||
Returns QImage of specified slide.
|
||||
*/
|
||||
QImage slide(int index) const;
|
||||
|
||||
/*!
|
||||
Returns the index of slide currently shown in the middle of the viewport.
|
||||
*/
|
||||
int centerIndex() const;
|
||||
|
||||
/*!
|
||||
Returns the effect applied to the reflection.
|
||||
*/
|
||||
ReflectionEffect reflectionEffect() const;
|
||||
|
||||
/*!
|
||||
Sets the effect applied to the reflection. The default is PlainReflection.
|
||||
*/
|
||||
void setReflectionEffect(ReflectionEffect effect);
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
/*!
|
||||
Adds a new slide.
|
||||
*/
|
||||
void addSlide(const QImage& image);
|
||||
|
||||
/*!
|
||||
Adds a new slide.
|
||||
*/
|
||||
void addSlide(const QPixmap& pixmap);
|
||||
|
||||
/*!
|
||||
Removes an existing slide.
|
||||
*/
|
||||
void removeSlide(int index);
|
||||
|
||||
/*!
|
||||
Sets an image for specified slide. If the slide already exists,
|
||||
it will be replaced.
|
||||
*/
|
||||
void setSlide(int index, const QImage& image);
|
||||
|
||||
/*!
|
||||
Sets a pixmap for specified slide. If the slide already exists,
|
||||
it will be replaced.
|
||||
*/
|
||||
void setSlide(int index, const QPixmap& pixmap);
|
||||
|
||||
/*!
|
||||
Sets slide to be shown in the middle of the viewport. No animation
|
||||
effect will be produced, unlike using showSlide.
|
||||
*/
|
||||
void setCenterIndex(int index);
|
||||
|
||||
/*!
|
||||
Clears all slides.
|
||||
*/
|
||||
void clear();
|
||||
|
||||
/*!
|
||||
Shows previous slide using animation effect.
|
||||
*/
|
||||
void showPrevious();
|
||||
|
||||
/*!
|
||||
Shows next slide using animation effect.
|
||||
*/
|
||||
void showNext();
|
||||
|
||||
/*!
|
||||
Go to specified slide using animation effect.
|
||||
*/
|
||||
void showSlide(unsigned int index);
|
||||
|
||||
/*!
|
||||
Rerender the widget. Normally this function will be automatically invoked
|
||||
whenever necessary, e.g. during the transition animation.
|
||||
*/
|
||||
void render();
|
||||
|
||||
/*!
|
||||
Schedules a rendering update. Unlike render(), this function does not cause
|
||||
immediate rendering.
|
||||
*/
|
||||
void triggerRender();
|
||||
|
||||
void setFlowType(FlowType flowType);
|
||||
|
||||
void setMarkImage(const QImage & mark);
|
||||
|
||||
void markSlide(int index, YACReaderComicReadStatus readStatus = Read);
|
||||
|
||||
void updateMarks();
|
||||
|
||||
void unmarkSlide(int index);
|
||||
|
||||
void setMarks(const QVector<YACReaderComicReadStatus> & marks);
|
||||
|
||||
void setShowMarks(bool enable);
|
||||
|
||||
QVector<YACReaderComicReadStatus> getMarks();
|
||||
|
||||
|
||||
signals:
|
||||
void centerIndexChanged(int index);
|
||||
void centerIndexChangedSilent(int index);
|
||||
|
||||
public:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
void resizeEvent(QResizeEvent* event);
|
||||
|
||||
private slots:
|
||||
void updateAnimation();
|
||||
|
||||
private:
|
||||
PictureFlowPrivate* d;
|
||||
QImage mark;
|
||||
int framesSkip;
|
||||
};
|
||||
|
||||
#endif // PICTUREFLOW_H
|
||||
|
262
common/qnaturalsorting.cpp
Normal file
262
common/qnaturalsorting.cpp
Normal file
@ -0,0 +1,262 @@
|
||||
/* This file contains parts of the KDE libraries
|
||||
Copyright (C) 1999 Ian Zepp (icszepp@islc.net)
|
||||
Copyright (C) 2006 by Dominic Battre <dominic@battre.de>
|
||||
Copyright (C) 2006 by Martin Pool <mbp@canonical.com>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "qnaturalsorting.h"
|
||||
|
||||
//from KDE
|
||||
/*
|
||||
int naturalCompare(const QString &_a, const QString &_b, Qt::CaseSensitivity caseSensitivity)
|
||||
{
|
||||
// This method chops the input a and b into pieces of
|
||||
// digits and non-digits (a1.05 becomes a | 1 | . | 05)
|
||||
// and compares these pieces of a and b to each other
|
||||
// (first with first, second with second, ...).
|
||||
//
|
||||
// This is based on the natural sort order code code by Martin Pool
|
||||
// http://sourcefrog.net/projects/natsort/
|
||||
// Martin Pool agreed to license this under LGPL or GPL.
|
||||
|
||||
// FIXME: Using toLower() to implement case insensitive comparison is
|
||||
// sub-optimal, but is needed because we compare strings with
|
||||
// localeAwareCompare(), which does not know about case sensitivity.
|
||||
// A task has been filled for this in Qt Task Tracker with ID 205990.
|
||||
// http://trolltech.com/developer/task-tracker/index_html?method=entry&id=205990
|
||||
QString a;
|
||||
QString b;
|
||||
if (caseSensitivity == Qt::CaseSensitive) {
|
||||
a = _a;
|
||||
b = _b;
|
||||
} else {
|
||||
a = _a.toLower();
|
||||
b = _b.toLower();
|
||||
}
|
||||
|
||||
const QChar* currA = a.unicode(); // iterator over a
|
||||
const QChar* currB = b.unicode(); // iterator over b
|
||||
|
||||
if (currA == currB) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const QChar* begSeqA = currA; // beginning of a new character sequence of a
|
||||
const QChar* begSeqB = currB;
|
||||
|
||||
while (!currA->isNull() && !currB->isNull()) {
|
||||
if (currA->unicode() == QChar::ObjectReplacementCharacter) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (currB->unicode() == QChar::ObjectReplacementCharacter) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (currA->unicode() == QChar::ReplacementCharacter) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (currB->unicode() == QChar::ReplacementCharacter) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// find sequence of characters ending at the first non-character
|
||||
while (!currA->isNull() && !currA->isDigit() && !currA->isPunct() && !currA->isSpace()) {
|
||||
++currA;
|
||||
}
|
||||
|
||||
while (!currB->isNull() && !currB->isDigit() && !currB->isPunct() && !currB->isSpace()) {
|
||||
++currB;
|
||||
}
|
||||
|
||||
// compare these sequences
|
||||
const QStringRef& subA(a.midRef(begSeqA - a.unicode(), currA - begSeqA));
|
||||
const QStringRef& subB(b.midRef(begSeqB - b.unicode(), currB - begSeqB));
|
||||
const int cmp = QStringRef::localeAwareCompare(subA, subB);
|
||||
if (cmp != 0) {
|
||||
return cmp < 0 ? -1 : +1;
|
||||
}
|
||||
|
||||
if (currA->isNull() || currB->isNull()) {
|
||||
break;
|
||||
}
|
||||
|
||||
// find sequence of characters ending at the first non-character
|
||||
while (currA->isPunct() || currA->isSpace() || currB->isPunct() || currB->isSpace()) {
|
||||
if (*currA != *currB) {
|
||||
return (*currA < *currB) ? -1 : +1;
|
||||
}
|
||||
++currA;
|
||||
++currB;
|
||||
}
|
||||
|
||||
// now some digits follow...
|
||||
if ((*currA == '0') || (*currB == '0')) {
|
||||
// one digit-sequence starts with 0 -> assume we are in a fraction part
|
||||
// do left aligned comparison (numbers are considered left aligned)
|
||||
while (1) {
|
||||
if (!currA->isDigit() && !currB->isDigit()) {
|
||||
break;
|
||||
} else if (!currA->isDigit()) {
|
||||
return +1;
|
||||
} else if (!currB->isDigit()) {
|
||||
return -1;
|
||||
} else if (*currA < *currB) {
|
||||
return -1;
|
||||
} else if (*currA > *currB) {
|
||||
return + 1;
|
||||
}
|
||||
++currA;
|
||||
++currB;
|
||||
}
|
||||
} else {
|
||||
// No digit-sequence starts with 0 -> assume we are looking at some integer
|
||||
// do right aligned comparison.
|
||||
//
|
||||
// The longest run of digits wins. That aside, the greatest
|
||||
// value wins, but we can't know that it will until we've scanned
|
||||
// both numbers to know that they have the same magnitude.
|
||||
|
||||
bool isFirstRun = true;
|
||||
int weight = 0;
|
||||
while (1) {
|
||||
if (!currA->isDigit() && !currB->isDigit()) {
|
||||
if (weight != 0) {
|
||||
return weight;
|
||||
}
|
||||
break;
|
||||
} else if (!currA->isDigit()) {
|
||||
if (isFirstRun) {
|
||||
return *currA < *currB ? -1 : +1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else if (!currB->isDigit()) {
|
||||
if (isFirstRun) {
|
||||
return *currA < *currB ? -1 : +1;
|
||||
} else {
|
||||
return +1;
|
||||
}
|
||||
} else if ((*currA < *currB) && (weight == 0)) {
|
||||
weight = -1;
|
||||
} else if ((*currA > *currB) && (weight == 0)) {
|
||||
weight = + 1;
|
||||
}
|
||||
++currA;
|
||||
++currB;
|
||||
isFirstRun = false;
|
||||
}
|
||||
}
|
||||
|
||||
begSeqA = currA;
|
||||
begSeqB = currB;
|
||||
}
|
||||
|
||||
if (currA->isNull() && currB->isNull()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return currA->isNull() ? -1 : + 1;
|
||||
}
|
||||
|
||||
*/
|
||||
static inline QChar getNextChar(const QString &s, int location)
|
||||
{
|
||||
return (location < s.length()) ? s.at(location) : QChar();
|
||||
}
|
||||
|
||||
int naturalCompare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs)
|
||||
{
|
||||
for (int l1 = 0, l2 = 0; l1 <= s1.count() && l2 <= s2.count(); ++l1, ++l2) {
|
||||
// skip spaces, tabs and 0's
|
||||
QChar c1 = getNextChar(s1, l1);
|
||||
while (c1.isSpace())
|
||||
c1 = getNextChar(s1, ++l1);
|
||||
QChar c2 = getNextChar(s2, l2);
|
||||
while (c2.isSpace())
|
||||
c2 = getNextChar(s2, ++l2);
|
||||
|
||||
if (c1.isDigit() && c2.isDigit()) {
|
||||
while (c1.digitValue() == 0)
|
||||
c1 = getNextChar(s1, ++l1);
|
||||
while (c2.digitValue() == 0)
|
||||
c2 = getNextChar(s2, ++l2);
|
||||
|
||||
int lookAheadLocation1 = l1;
|
||||
int lookAheadLocation2 = l2;
|
||||
int currentReturnValue = 0;
|
||||
// find the last digit, setting currentReturnValue as we go if it isn't equal
|
||||
for (
|
||||
QChar lookAhead1 = c1, lookAhead2 = c2;
|
||||
(lookAheadLocation1 <= s1.length() && lookAheadLocation2 <= s2.length());
|
||||
lookAhead1 = getNextChar(s1, ++lookAheadLocation1),
|
||||
lookAhead2 = getNextChar(s2, ++lookAheadLocation2)
|
||||
) {
|
||||
bool is1ADigit = !lookAhead1.isNull() && lookAhead1.isDigit();
|
||||
bool is2ADigit = !lookAhead2.isNull() && lookAhead2.isDigit();
|
||||
if (!is1ADigit && !is2ADigit)
|
||||
break;
|
||||
if (!is1ADigit)
|
||||
return -1;
|
||||
if (!is2ADigit)
|
||||
return 1;
|
||||
if (currentReturnValue == 0) {
|
||||
if (lookAhead1 < lookAhead2) {
|
||||
currentReturnValue = -1;
|
||||
} else if (lookAhead1 > lookAhead2) {
|
||||
currentReturnValue = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (currentReturnValue != 0)
|
||||
return currentReturnValue;
|
||||
}
|
||||
|
||||
if (cs == Qt::CaseInsensitive) {
|
||||
if (!c1.isLower()) c1 = c1.toLower();
|
||||
if (!c2.isLower()) c2 = c2.toLower();
|
||||
}
|
||||
int r = QString::localeAwareCompare(c1, c2);
|
||||
if (r < 0)
|
||||
return -1;
|
||||
if (r > 0)
|
||||
return 1;
|
||||
}
|
||||
// The two strings are the same (02 == 2) so fall back to the normal sort
|
||||
return QString::compare(s1, s2, cs);
|
||||
}
|
||||
bool naturalSortLessThanCS( const QString &left, const QString &right )
|
||||
{
|
||||
return (naturalCompare( left, right, Qt::CaseSensitive ) < 0);
|
||||
}
|
||||
|
||||
bool naturalSortLessThanCI( const QString &left, const QString &right )
|
||||
{
|
||||
return (naturalCompare( left, right, Qt::CaseInsensitive ) < 0);
|
||||
}
|
||||
|
||||
bool naturalSortLessThanCIFileInfo(const QFileInfo & left,const QFileInfo & right)
|
||||
{
|
||||
return naturalSortLessThanCI(left.fileName(),right.fileName());
|
||||
}
|
||||
|
||||
bool naturalSortLessThanCILibraryItem(LibraryItem * left, LibraryItem * right)
|
||||
{
|
||||
return naturalSortLessThanCI(left->name,right->name);
|
||||
}
|
15
common/qnaturalsorting.h
Normal file
15
common/qnaturalsorting.h
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
#ifndef __QNATURALSORTING_H
|
||||
#define __QNATURALSORTING_H
|
||||
|
||||
#include <QString>
|
||||
#include <QFileInfo>
|
||||
#include "library_item.h"
|
||||
|
||||
bool naturalSortLessThanCS( const QString &left, const QString &right );
|
||||
bool naturalSortLessThanCI( const QString &left, const QString &right );
|
||||
bool naturalSortLessThanCIFileInfo(const QFileInfo & left,const QFileInfo & right);
|
||||
bool naturalSortLessThanCILibraryItem(LibraryItem * left, LibraryItem * right);
|
||||
|
||||
#endif
|
1482
common/yacreader_flow_gl.cpp
Normal file
1482
common/yacreader_flow_gl.cpp
Normal file
File diff suppressed because it is too large
Load Diff
395
common/yacreader_flow_gl.h
Normal file
395
common/yacreader_flow_gl.h
Normal file
@ -0,0 +1,395 @@
|
||||
//OpenGL Coverflow API by J.Roth
|
||||
#ifndef __YACREADER_FLOW_GL_H
|
||||
#define __YACREADER_FLOW_GL_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <QtOpenGL>
|
||||
#include <QGLWidget>
|
||||
#include <QMutex>
|
||||
|
||||
#include "pictureflow.h" //TODO mover los tipos de flow de sitio
|
||||
|
||||
class ImageLoaderGL;
|
||||
class QGLContext;
|
||||
class WidgetLoader;
|
||||
class ImageLoaderByteArrayGL;
|
||||
|
||||
enum Performance
|
||||
{
|
||||
low=0,
|
||||
medium,
|
||||
high,
|
||||
ultraHigh
|
||||
};
|
||||
|
||||
//Cover Vector
|
||||
struct RVect{
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float rot;
|
||||
};
|
||||
|
||||
//the cover info struct
|
||||
struct CFImage{
|
||||
GLuint img;
|
||||
//char name[256];
|
||||
|
||||
float width;
|
||||
float height;
|
||||
|
||||
int index;
|
||||
|
||||
RVect current;
|
||||
RVect animEnd;
|
||||
};
|
||||
|
||||
struct Preset{
|
||||
/*** Animation Settings ***/
|
||||
//sets the speed of the animation
|
||||
float animationStep;
|
||||
//sets the acceleration of the animation
|
||||
float animationSpeedUp;
|
||||
//sets the maximum speed of the animation
|
||||
float animationStepMax;
|
||||
//sets the distance of view
|
||||
float animationFadeOutDist;
|
||||
//sets the rotation increasion
|
||||
float preRotation;
|
||||
//sets the light strenght on rotation
|
||||
float viewRotateLightStrenght;
|
||||
//sets the speed of the rotation
|
||||
float viewRotateAdd;
|
||||
//sets the speed of reversing the rotation
|
||||
float viewRotateSub;
|
||||
//sets the maximum view angle
|
||||
float viewAngle;
|
||||
|
||||
/*** Position Configuration ***/
|
||||
//the X Position of the Coverflow
|
||||
float cfX;
|
||||
//the Y Position of the Coverflow
|
||||
float cfY;
|
||||
//the Z Position of the Coverflow
|
||||
float cfZ;
|
||||
//the X Rotation of the Coverflow
|
||||
float cfRX;
|
||||
//the Y Rotation of the Coverflow
|
||||
float cfRY;
|
||||
//the Z Rotation of the Coverflow
|
||||
float cfRZ;
|
||||
//sets the rotation of each cover
|
||||
float rotation;
|
||||
//sets the distance between the covers
|
||||
float xDistance;
|
||||
//sets the distance between the centered and the non centered covers
|
||||
float centerDistance;
|
||||
//sets the pushback amount
|
||||
float zDistance;
|
||||
//sets the elevation amount
|
||||
float yDistance;
|
||||
|
||||
float zoom;
|
||||
};
|
||||
|
||||
extern struct Preset defaultYACReaderFlowConfig;
|
||||
extern struct Preset presetYACReaderFlowClassicConfig;
|
||||
extern struct Preset presetYACReaderFlowStripeConfig;
|
||||
extern struct Preset presetYACReaderFlowOverlappedStripeConfig;
|
||||
extern struct Preset pressetYACReaderFlowUpConfig;
|
||||
extern struct Preset pressetYACReaderFlowDownConfig;
|
||||
|
||||
class YACReaderFlowGL : public QGLWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
int timerId;
|
||||
/*** System variables ***/
|
||||
CFImage dummy;
|
||||
int viewRotateActive;
|
||||
float stepBackup;
|
||||
|
||||
/*functions*/
|
||||
void calcPos(CFImage *CF,int pos);
|
||||
void calcRV(RVect *RV,int pos);
|
||||
void animate(RVect *Current,RVect to);
|
||||
void drawCover(CFImage *CF);
|
||||
|
||||
void udpatePerspective(int width, int height);
|
||||
|
||||
int updateCount;
|
||||
WidgetLoader * loader;
|
||||
int fontSize;
|
||||
|
||||
GLuint defaultTexture;
|
||||
GLuint markTexture;
|
||||
GLuint readingTexture;
|
||||
void initializeGL();
|
||||
void paintGL();
|
||||
void timerEvent(QTimerEvent *);
|
||||
|
||||
//number of Covers
|
||||
int numObjects;
|
||||
int lazyPopulateObjects;
|
||||
bool showMarks;
|
||||
QVector<bool> loaded;
|
||||
QVector<YACReaderComicReadStatus> marks;
|
||||
QList<QString> paths;
|
||||
CFImage * cfImages;
|
||||
bool hasBeenInitialized;
|
||||
|
||||
Performance performance;
|
||||
bool bUseVSync;
|
||||
|
||||
/*** Animation Settings ***/
|
||||
Preset config;
|
||||
|
||||
//sets/returns the curent selected cover
|
||||
int currentSelected;
|
||||
|
||||
//defines the position of the centered cover
|
||||
RVect centerPos;
|
||||
|
||||
/*** Style ***/
|
||||
//sets the amount of shading of the covers in the back (0-1)
|
||||
float shadingTop;
|
||||
float shadingBottom;
|
||||
|
||||
//sets the reflection strenght (0-1)
|
||||
float reflectionUp;
|
||||
float reflectionBottom;
|
||||
|
||||
/*** System info ***/
|
||||
float viewRotate;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
/*Constructor*/
|
||||
YACReaderFlowGL(QWidget *parent = 0,struct Preset p = pressetYACReaderFlowDownConfig);
|
||||
virtual ~YACReaderFlowGL();
|
||||
|
||||
//size;
|
||||
QSize minimumSizeHint() const;
|
||||
//QSize sizeHint() const;
|
||||
|
||||
/*functions*/
|
||||
|
||||
//if called it moves the coverflow to the left
|
||||
void showPrevious();
|
||||
//if called it moves the coverflow to the right
|
||||
void showNext();
|
||||
//go to
|
||||
void setCurrentIndex(int pos);
|
||||
//must be called whenever the coverflow animation is stopped
|
||||
void cleanupAnimation();
|
||||
//Draws the coverflow
|
||||
void draw();
|
||||
//updates the coverflow
|
||||
void updatePositions();
|
||||
//inserts a new item to the coverflow
|
||||
//if item is set to a value > -1 it updates a already set value
|
||||
//otherwise a new entry is set
|
||||
void insert(char *name, GLuint Tex, float x, float y,int item = -1);
|
||||
//removes a item
|
||||
virtual void remove(int item);
|
||||
//replaces the texture of the item 'item' with Tex
|
||||
void replace(char *name, GLuint Tex, float x, float y,int item);
|
||||
//create n covers with the default nu
|
||||
void populate(int n);
|
||||
/*Info*/
|
||||
//retuns the CFImage Struct of the current selected item
|
||||
//to read title or textures
|
||||
CFImage getCurrentSelected();
|
||||
|
||||
public slots:
|
||||
void setCF_RX(int value);
|
||||
//the Y Rotation of the Coverflow
|
||||
void setCF_RY(int value);
|
||||
//the Z Rotation of the Coverflow
|
||||
void setCF_RZ(int value);
|
||||
|
||||
//perspective
|
||||
void setZoom(int zoom);
|
||||
|
||||
void setRotation(int angle);
|
||||
//sets the distance between the covers
|
||||
void setX_Distance(int distance);
|
||||
//sets the distance between the centered and the non centered covers
|
||||
void setCenter_Distance(int distance);
|
||||
//sets the pushback amount
|
||||
void setZ_Distance(int distance);
|
||||
|
||||
void setCF_Y(int value);
|
||||
void setCF_Z(int value);
|
||||
|
||||
void setY_Distance(int value);
|
||||
|
||||
void setFadeOutDist(int value);
|
||||
|
||||
void setLightStrenght(int value);
|
||||
|
||||
void setMaxAngle(int value);
|
||||
|
||||
void setPreset(const Preset & p);
|
||||
|
||||
void setPerformance(Performance performance);
|
||||
|
||||
void useVSync(bool b);
|
||||
|
||||
virtual void updateImageData() = 0;
|
||||
|
||||
void reset();
|
||||
void reload();
|
||||
|
||||
//interface with yacreaderlibrary, compatibility
|
||||
void setShowMarks(bool value);
|
||||
void setMarks(QVector<YACReaderComicReadStatus> marks);
|
||||
void setMarkImage(QImage & image);
|
||||
void markSlide(int index, YACReaderComicReadStatus status);
|
||||
void unmarkSlide(int index);
|
||||
void setSlideSize(QSize size);
|
||||
void clear();
|
||||
void setCenterIndex(unsigned int index);
|
||||
void showSlide(int index);
|
||||
int centerIndex();
|
||||
void updateMarks();
|
||||
//void setFlowType(PictureFlow::FlowType flowType);
|
||||
void render();
|
||||
|
||||
//void paintEvent(QPaintEvent *event);
|
||||
void mouseDoubleClickEvent(QMouseEvent* event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void wheelEvent(QWheelEvent * event);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void resizeGL(int width, int height);
|
||||
friend class ImageLoaderGL;
|
||||
friend class ImageLoaderByteArrayGL;
|
||||
|
||||
signals:
|
||||
void centerIndexChanged(int);
|
||||
void selected(unsigned int);
|
||||
};
|
||||
|
||||
//class WidgetLoader : public QGLWidget
|
||||
//{
|
||||
// Q_OBJECT
|
||||
//public:
|
||||
// WidgetLoader(QWidget *parent, QGLWidget * shared);
|
||||
// YACReaderFlowGL * flow;
|
||||
//public slots:
|
||||
// void loadTexture(int index);
|
||||
//
|
||||
//};
|
||||
|
||||
class YACReaderComicFlowGL : public YACReaderFlowGL
|
||||
{
|
||||
public:
|
||||
YACReaderComicFlowGL(QWidget *parent = 0,struct Preset p = defaultYACReaderFlowConfig);
|
||||
void setImagePaths(QStringList paths);
|
||||
void updateImageData();
|
||||
void remove(int item);
|
||||
friend class ImageLoaderGL;
|
||||
private:
|
||||
ImageLoaderGL * worker;
|
||||
|
||||
};
|
||||
|
||||
class YACReaderPageFlowGL : public YACReaderFlowGL
|
||||
{
|
||||
public:
|
||||
YACReaderPageFlowGL(QWidget *parent = 0,struct Preset p = defaultYACReaderFlowConfig);
|
||||
~YACReaderPageFlowGL();
|
||||
void updateImageData();
|
||||
void populate(int n);
|
||||
QVector<bool> imagesReady;
|
||||
QVector<QByteArray> rawImages;
|
||||
QVector<bool> imagesSetted;
|
||||
friend class ImageLoaderByteArrayGL;
|
||||
private:
|
||||
ImageLoaderByteArrayGL * worker;
|
||||
};
|
||||
|
||||
class ImageLoaderGL : public QThread
|
||||
{
|
||||
public:
|
||||
ImageLoaderGL(YACReaderFlowGL * flow);
|
||||
~ImageLoaderGL();
|
||||
// returns FALSE if worker is still busy and can't take the task
|
||||
bool busy() const;
|
||||
void generate(int index, const QString& fileName);
|
||||
void reset(){idx = -1;fileName="";};
|
||||
int index() const { return idx; };
|
||||
void lock();
|
||||
void unlock();
|
||||
QImage result();
|
||||
YACReaderFlowGL * flow;
|
||||
GLuint resultTexture;
|
||||
QImage loadImage(const QString& fileName);
|
||||
|
||||
protected:
|
||||
void run();
|
||||
|
||||
private:
|
||||
QMutex mutex;
|
||||
QWaitCondition condition;
|
||||
|
||||
|
||||
bool restart;
|
||||
bool working;
|
||||
int idx;
|
||||
QString fileName;
|
||||
QSize size;
|
||||
QImage img;
|
||||
};
|
||||
|
||||
class ImageLoaderByteArrayGL : public QThread
|
||||
{
|
||||
public:
|
||||
ImageLoaderByteArrayGL(YACReaderFlowGL * flow);
|
||||
~ImageLoaderByteArrayGL();
|
||||
// returns FALSE if worker is still busy and can't take the task
|
||||
bool busy() const;
|
||||
void generate(int index, const QByteArray& raw);
|
||||
void reset(){idx = -1; rawData.clear();};
|
||||
int index() const { return idx; };
|
||||
QImage result();
|
||||
YACReaderFlowGL * flow;
|
||||
GLuint resultTexture;
|
||||
QImage loadImage(const QByteArray& rawData);
|
||||
|
||||
protected:
|
||||
void run();
|
||||
|
||||
private:
|
||||
QMutex mutex;
|
||||
QWaitCondition condition;
|
||||
|
||||
|
||||
bool restart;
|
||||
bool working;
|
||||
int idx;
|
||||
QByteArray rawData;
|
||||
QSize size;
|
||||
QImage img;
|
||||
};
|
||||
|
||||
//class TextureLoader : public QThread
|
||||
//{
|
||||
//public:
|
||||
// TextureLoader();
|
||||
// ~TextureLoader();
|
||||
// // returns FALSE if worker is still busy and can't take the task
|
||||
//
|
||||
// YACReaderFlow * flow;
|
||||
// ImageLoader * worker;
|
||||
//protected:
|
||||
// void run();
|
||||
//
|
||||
//};
|
||||
|
||||
#endif
|
13
common/yacreader_global.cpp
Normal file
13
common/yacreader_global.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include "yacreader_global.h"
|
||||
|
||||
using namespace YACReader;
|
||||
|
||||
QString YACReader::getSettingsPath()
|
||||
{
|
||||
#if QT_VERSION >= 0x050000
|
||||
return QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
||||
#else
|
||||
return QDesktopServices::storageLocation(QDesktopServices::DataLocation);
|
||||
#endif
|
||||
|
||||
}
|
101
common/yacreader_global.h
Normal file
101
common/yacreader_global.h
Normal file
@ -0,0 +1,101 @@
|
||||
#ifndef __YACREADER_GLOBAL_H
|
||||
#define __YACREADER_GLOBAL_H
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QStandardPaths>
|
||||
#else
|
||||
#include <QDesktopServices>
|
||||
#endif
|
||||
|
||||
|
||||
#define VERSION "7.0.0"
|
||||
|
||||
#define PATH "PATH"
|
||||
#define MAG_GLASS_SIZE "MAG_GLASS_SIZE"
|
||||
#define ZOOM_LEVEL "ZOOM_LEVEL"
|
||||
#define SLIDE_SIZE "SLIDE_SIZE"
|
||||
#define GO_TO_FLOW_SIZE "GO_TO_FLOW_SIZE"
|
||||
#define FLOW_TYPE_SW "FLOW_TYPE_SW"
|
||||
#define FIT "FIT"
|
||||
#define FLOW_TYPE "FLOW_TYPE"
|
||||
#define FULLSCREEN "FULLSCREEN"
|
||||
#define FIT_TO_WIDTH_RATIO "FIT_TO_WIDTH_RATIO"
|
||||
#define Y_WINDOW_POS "POS"
|
||||
#define Y_WINDOW_SIZE "SIZE"
|
||||
#define MAXIMIZED "MAXIMIZED"
|
||||
#define DOUBLE_PAGE "DOUBLE_PAGE"
|
||||
#define ADJUST_TO_FULL_SIZE "ADJUST_TO_FULL_SIZE"
|
||||
#define BACKGROUND_COLOR "BACKGROUND_COLOR"
|
||||
#define ALWAYS_ON_TOP "ALWAYS_ON_TOP"
|
||||
#define SHOW_TOOLBARS "SHOW_TOOLBARS"
|
||||
#define BRIGHTNESS "BRIGHTNESS"
|
||||
#define CONTRAST "CONTRAST"
|
||||
#define GAMMA "GAMMA"
|
||||
#define SHOW_INFO "SHOW_INFO"
|
||||
|
||||
#define FLOW_TYPE_GL "FLOW_TYPE_GL"
|
||||
#define Y_POSITION "Y_POSITION"
|
||||
#define COVER_DISTANCE "COVER_DISTANCE"
|
||||
#define CENTRAL_DISTANCE "CENTRAL_DISTANCE"
|
||||
#define ZOOM_LEVEL "ZOOM_LEVEL"
|
||||
#define Z_COVER_OFFSET "Z_COVER_OFFSET"
|
||||
#define COVER_ROTATION "COVER_ROTATION"
|
||||
#define FADE_OUT_DIST "FADE_OUT_DIST"
|
||||
#define LIGHT_STRENGTH "LIGHT_STRENGTH"
|
||||
#define MAX_ANGLE "MAX_ANGLE"
|
||||
#define PERFORMANCE "PERFORMANCE"
|
||||
#define USE_OPEN_GL "USE_OPEN_GL"
|
||||
#define X_ROTATION "X_ROTATION"
|
||||
#define Y_COVER_OFFSET "Y_COVER_OFFSET"
|
||||
#define V_SYNC "V_SYNC"
|
||||
#define SERVER_ON "SERVER_ON"
|
||||
|
||||
#define MAIN_WINDOW_GEOMETRY "MAIN_WINDOW_GEOMETRY"
|
||||
#define MAIN_WINDOW_STATE "MAIN_WINDOW_STATE"
|
||||
#define COMICS_VIEW_HEADERS "COMICS_VIEW_HEADERS"
|
||||
#define COMICS_VIEW_HEADERS_GEOMETRY "COMICS_VIEW_HEADERS_GEOMETRY"
|
||||
|
||||
#define NUM_DAYS_BETWEEN_VERSION_CHECKS "NUM_DAYS_BETWEEN_VERSION_CHECKS"
|
||||
#define LAST_VERSION_CHECK "LAST_VERSION_CHECK"
|
||||
|
||||
#define YACREADERLIBRARY_GUID "ea343ff3-2005-4865-b212-7fa7c43999b8"
|
||||
|
||||
#define LIBRARIES "LIBRARIES"
|
||||
|
||||
namespace YACReader
|
||||
{
|
||||
|
||||
enum FlowType
|
||||
{
|
||||
CoverFlowLike=0,
|
||||
Strip,
|
||||
StripOverlapped,
|
||||
Modern,
|
||||
Roulette,
|
||||
Custom
|
||||
};
|
||||
|
||||
enum YACReaderIPCMessages
|
||||
{
|
||||
RequestComicInfo = 0,
|
||||
SendComicInfo,
|
||||
};
|
||||
|
||||
enum YACReaderComicReadStatus
|
||||
{
|
||||
Unread = 0,
|
||||
Read = 1,
|
||||
Opened = 2
|
||||
};
|
||||
|
||||
enum YACReaderErrors
|
||||
{
|
||||
SevenZNotFound = 700
|
||||
};
|
||||
|
||||
QString getSettingsPath();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user