mirror of
https://github.com/YACReader/yacreader
synced 2025-07-19 05:24:57 -04:00
A?adido el uso 7z.dll en lugar de 7z.exe en el visor
This commit is contained in:
147
common/check_new_version.cpp
Normal file
147
common/check_new_version.cpp
Normal file
@ -0,0 +1,147 @@
|
||||
#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()
|
||||
:QThread()
|
||||
{
|
||||
http = new QHttp(this);
|
||||
|
||||
connect(http, SIGNAL(requestFinished(int, bool)),
|
||||
this, SLOT(httpRequestFinished(int, bool)));
|
||||
|
||||
connect(http, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)),
|
||||
this, SLOT(readResponseHeader(const QHttpResponseHeader &)));
|
||||
|
||||
connect(http, SIGNAL(readyRead(const QHttpResponseHeader &)),
|
||||
this, SLOT(read(const QHttpResponseHeader &)));
|
||||
}
|
||||
|
||||
void HttpVersionChecker::get()
|
||||
{
|
||||
this->start();
|
||||
|
||||
}
|
||||
|
||||
void HttpVersionChecker::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(
|
||||
QUrl("https://bitbucket.org/luisangelsm/yacreader/wiki/Home")));
|
||||
|
||||
tT.start(5000); // 5s timeout
|
||||
q.exec();
|
||||
|
||||
if(tT.isActive()){
|
||||
// download complete
|
||||
checkNewVersion(reply->readAll());
|
||||
tT.stop();
|
||||
} else {
|
||||
// timeout
|
||||
}
|
||||
|
||||
/*QUrl url("http://code.google.com/p/yacreader/downloads/list");
|
||||
QHttp::ConnectionMode mode = QHttp::ConnectionModeHttp;
|
||||
http->setHost(url.host(), mode, url.port() == -1 ? 0 : url.port());
|
||||
QByteArray path = QUrl::toPercentEncoding(url.path(), "!$&'()*+,;=:@/");
|
||||
if (path.isEmpty())
|
||||
path = "/";
|
||||
httpGetId = http->get(path, 0);
|
||||
exec();*/
|
||||
}
|
||||
void HttpVersionChecker::readResponseHeader(const QHttpResponseHeader &responseHeader)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void HttpVersionChecker::read(const QHttpResponseHeader &){
|
||||
content.append(http->readAll());
|
||||
}
|
||||
|
||||
void HttpVersionChecker::httpRequestFinished(int requestId, bool error)
|
||||
{
|
||||
#ifdef QT_DEBUG
|
||||
QString response("YACReader-5.0.0 win32.exe");
|
||||
#else
|
||||
QString response(content);
|
||||
#endif
|
||||
checkNewVersion(response);
|
||||
exit();
|
||||
}
|
||||
|
||||
//TODO escribir prueba unitaria
|
||||
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;
|
||||
}
|
||||
}
|
33
common/check_new_version.h
Normal file
33
common/check_new_version.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef __CHECKUPDATE_H
|
||||
#define __CHECKUPDATE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QHttp>
|
||||
#include <QHttpResponseHeader>
|
||||
#include <QByteArray>
|
||||
#include <QThread>
|
||||
#include "yacreader_global.h"
|
||||
|
||||
class HttpVersionChecker : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HttpVersionChecker();
|
||||
bool thereIsNewVersion();
|
||||
public slots:
|
||||
void httpRequestFinished(int requestId, bool error);
|
||||
void readResponseHeader(const QHttpResponseHeader &);
|
||||
void read(const QHttpResponseHeader &);
|
||||
void get();
|
||||
private:
|
||||
void run();
|
||||
QHttp *http;
|
||||
int httpGetId;
|
||||
QByteArray content;
|
||||
bool found;
|
||||
bool checkNewVersion(QString sourceContent);
|
||||
signals:
|
||||
void newVersionDetected();
|
||||
};
|
||||
|
||||
#endif
|
408
common/comic_db.cpp
Normal file
408
common/comic_db.cpp
Normal file
@ -0,0 +1,408 @@
|
||||
#include "comic_db.h"
|
||||
|
||||
#include <QVariant>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//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));
|
||||
|
||||
//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;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
//COMIC_INFO-------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
ComicInfo::ComicInfo()
|
||||
:existOnDb(false),
|
||||
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;
|
||||
|
||||
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(value != NULL)
|
||||
field = new QString(*value);
|
||||
}
|
||||
|
||||
void ComicInfo::copyField(int * & field, int * value)
|
||||
{
|
||||
if(value != NULL)
|
||||
field = new int(*value);
|
||||
}
|
||||
|
||||
void ComicInfo::copyField(bool * & field, bool * value)
|
||||
{
|
||||
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;
|
||||
}
|
121
common/comic_db.h
Normal file
121
common/comic_db.h
Normal file
@ -0,0 +1,121 @@
|
||||
#ifndef __COMICDB_H
|
||||
#define __COMICDB_H
|
||||
|
||||
#include "library_item.h"
|
||||
#include <QList>
|
||||
#include <QPixmap>
|
||||
#include <QImage>
|
||||
|
||||
class ComicInfo
|
||||
{
|
||||
public:
|
||||
ComicInfo();
|
||||
ComicInfo(const ComicInfo & comicInfo);
|
||||
~ComicInfo();
|
||||
|
||||
ComicInfo & operator=(const ComicInfo & comicInfo);
|
||||
|
||||
qulonglong id;
|
||||
bool read;
|
||||
bool edited;
|
||||
QString hash;
|
||||
bool existOnDb;
|
||||
|
||||
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);
|
||||
|
||||
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;};
|
||||
|
||||
QString toTXT();
|
||||
|
||||
ComicInfo info;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
311
common/comic_flow_widget.cpp
Normal file
311
common/comic_flow_widget.cpp
Normal file
@ -0,0 +1,311 @@
|
||||
#include "comic_flow_widget.h"
|
||||
|
||||
ComicFlowWidget::ComicFlowWidget(QWidget * parent)
|
||||
:QWidget(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ComicFlowWidgetSW::ComicFlowWidgetSW(QWidget * parent)
|
||||
:ComicFlowWidget(parent)
|
||||
{
|
||||
flow = new ComicFlow(parent);
|
||||
|
||||
connect(flow,SIGNAL(centerIndexChanged(int)),this,SIGNAL(centerIndexChanged(int)));
|
||||
connect(flow,SIGNAL(selected(unsigned int)),this,SIGNAL(selected(unsigned int)));
|
||||
|
||||
QVBoxLayout * l = new QVBoxLayout;
|
||||
l->addWidget(flow);
|
||||
setLayout(l);
|
||||
|
||||
//TODO eleminar "padding"
|
||||
QPalette Pal(palette());
|
||||
// set black background
|
||||
Pal.setColor(QPalette::Background, Qt::black);
|
||||
setAutoFillBackground(true);
|
||||
setPalette(Pal);
|
||||
}
|
||||
|
||||
QSize ComicFlowWidgetSW::minimumSizeHint() const
|
||||
{
|
||||
return flow->minimumSizeHint();
|
||||
}
|
||||
QSize ComicFlowWidgetSW::sizeHint() const
|
||||
{
|
||||
return flow->sizeHint();
|
||||
}
|
||||
|
||||
void ComicFlowWidgetSW::setShowMarks(bool value)
|
||||
{
|
||||
flow->setShowMarks(value);
|
||||
}
|
||||
void ComicFlowWidgetSW::setMarks(QVector<bool> marks)
|
||||
{
|
||||
flow->setMarks(marks);
|
||||
}
|
||||
void ComicFlowWidgetSW::setMarkImage(QImage & image)
|
||||
{
|
||||
flow->setMarkImage(image);
|
||||
}
|
||||
void ComicFlowWidgetSW::markSlide(int index)
|
||||
{
|
||||
flow->markSlide(index);
|
||||
}
|
||||
void ComicFlowWidgetSW::unmarkSlide(int index)
|
||||
{
|
||||
flow->unmarkSlide(index);
|
||||
}
|
||||
void ComicFlowWidgetSW::setSlideSize(QSize size)
|
||||
{
|
||||
flow->setSlideSize(size);
|
||||
}
|
||||
void ComicFlowWidgetSW::clear()
|
||||
{
|
||||
flow->clear();
|
||||
}
|
||||
void ComicFlowWidgetSW::setImagePaths(QStringList paths)
|
||||
{
|
||||
flow->setImagePaths(paths);
|
||||
}
|
||||
void ComicFlowWidgetSW::setCenterIndex(int index)
|
||||
{
|
||||
flow->setCenterIndex(index);
|
||||
}
|
||||
void ComicFlowWidgetSW::showSlide(int index)
|
||||
{
|
||||
flow->showSlide(index);
|
||||
}
|
||||
int ComicFlowWidgetSW::centerIndex()
|
||||
{
|
||||
return flow->centerIndex();
|
||||
}
|
||||
void ComicFlowWidgetSW::updateMarks()
|
||||
{
|
||||
flow->updateMarks();
|
||||
}
|
||||
void ComicFlowWidgetSW::setFlowType(PictureFlow::FlowType flowType)
|
||||
{
|
||||
flow->setFlowType(flowType);
|
||||
}
|
||||
void ComicFlowWidgetSW::render()
|
||||
{
|
||||
flow->render();
|
||||
}
|
||||
void ComicFlowWidgetSW::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
flow->keyPressEvent(event);
|
||||
}
|
||||
void ComicFlowWidgetSW::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
flow->paintEvent(event);
|
||||
}
|
||||
void ComicFlowWidgetSW::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
flow->mousePressEvent(event);
|
||||
}
|
||||
void ComicFlowWidgetSW::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
flow->resizeEvent(event);
|
||||
}
|
||||
void ComicFlowWidgetSW::mouseDoubleClickEvent(QMouseEvent* event)
|
||||
{
|
||||
flow->mouseDoubleClickEvent(event);
|
||||
}
|
||||
void ComicFlowWidgetSW::updateConfig(QSettings * settings)
|
||||
{
|
||||
//flow->setFlowType(flowType);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
///OpenGL ComicFlow
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ComicFlowWidgetGL::ComicFlowWidgetGL(QWidget * parent)
|
||||
:ComicFlowWidget(parent)
|
||||
{
|
||||
flow = new YACReaderComicFlowGL(parent);
|
||||
|
||||
connect(flow,SIGNAL(centerIndexChanged(int)),this,SIGNAL(centerIndexChanged(int)));
|
||||
connect(flow,SIGNAL(selected(unsigned int)),this,SIGNAL(selected(unsigned int)));
|
||||
|
||||
QVBoxLayout * l = new QVBoxLayout;
|
||||
l->addWidget(flow);
|
||||
l->setContentsMargins(0,0,0,0);
|
||||
setLayout(l);
|
||||
|
||||
//TODO eleminar "padding"
|
||||
QPalette Pal(palette());
|
||||
// set black background
|
||||
Pal.setColor(QPalette::Background, Qt::black);
|
||||
setAutoFillBackground(true);
|
||||
setPalette(Pal);
|
||||
}
|
||||
|
||||
QSize ComicFlowWidgetGL::minimumSizeHint() const
|
||||
{
|
||||
return flow->minimumSizeHint();
|
||||
}
|
||||
QSize ComicFlowWidgetGL::sizeHint() const
|
||||
{
|
||||
return flow->sizeHint();
|
||||
}
|
||||
|
||||
void ComicFlowWidgetGL::setShowMarks(bool value)
|
||||
{
|
||||
flow->setShowMarks(value);
|
||||
}
|
||||
void ComicFlowWidgetGL::setMarks(QVector<bool> marks)
|
||||
{
|
||||
flow->setMarks(marks);
|
||||
}
|
||||
void ComicFlowWidgetGL::setMarkImage(QImage & image)
|
||||
{
|
||||
flow->setMarkImage(image);
|
||||
}
|
||||
void ComicFlowWidgetGL::markSlide(int index)
|
||||
{
|
||||
flow->markSlide(index);
|
||||
}
|
||||
void ComicFlowWidgetGL::unmarkSlide(int index)
|
||||
{
|
||||
flow->unmarkSlide(index);
|
||||
}
|
||||
void ComicFlowWidgetGL::setSlideSize(QSize size)
|
||||
{
|
||||
flow->setSlideSize(size);
|
||||
}
|
||||
void ComicFlowWidgetGL::clear()
|
||||
{
|
||||
flow->clear();
|
||||
}
|
||||
void ComicFlowWidgetGL::setImagePaths(QStringList paths)
|
||||
{
|
||||
flow->setImagePaths(paths);
|
||||
}
|
||||
void ComicFlowWidgetGL::setCenterIndex(int index)
|
||||
{
|
||||
flow->setCenterIndex(index);
|
||||
}
|
||||
void ComicFlowWidgetGL::showSlide(int index)
|
||||
{
|
||||
flow->showSlide(index);
|
||||
}
|
||||
int ComicFlowWidgetGL::centerIndex()
|
||||
{
|
||||
return flow->centerIndex();
|
||||
}
|
||||
void ComicFlowWidgetGL::updateMarks()
|
||||
{
|
||||
flow->updateMarks();
|
||||
}
|
||||
void ComicFlowWidgetGL::setFlowType(PictureFlow::FlowType flowType)
|
||||
{
|
||||
if(flowType == PictureFlow::CoverFlowLike)
|
||||
flow->setPreset(presetYACReaderFlowClassicConfig);
|
||||
else if(flowType == PictureFlow::Strip)
|
||||
flow->setPreset(presetYACReaderFlowStripeConfig);
|
||||
else if(flowType == PictureFlow::StripOverlapped)
|
||||
flow->setPreset(presetYACReaderFlowOverlappedStripeConfig);
|
||||
else
|
||||
flow->setPreset(defaultYACReaderFlowConfig);
|
||||
}
|
||||
void ComicFlowWidgetGL::render()
|
||||
{
|
||||
flow->render();
|
||||
}
|
||||
void ComicFlowWidgetGL::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
flow->keyPressEvent(event);
|
||||
}
|
||||
void ComicFlowWidgetGL::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
//flow->paintEvent(event);
|
||||
}
|
||||
void ComicFlowWidgetGL::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
flow->mousePressEvent(event);
|
||||
}
|
||||
void ComicFlowWidgetGL::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
flow->resizeGL(event->size().width(),event->size().height());
|
||||
}
|
||||
void ComicFlowWidgetGL::mouseDoubleClickEvent(QMouseEvent* event)
|
||||
{
|
||||
flow->mouseDoubleClickEvent(event);
|
||||
}
|
||||
|
||||
void ComicFlowWidgetGL::updateConfig(QSettings * settings)
|
||||
{
|
||||
Performance performance = medium;
|
||||
|
||||
switch (settings->value("performance").toInt())
|
||||
{
|
||||
case 0:
|
||||
performance = low;
|
||||
break;
|
||||
case 1:
|
||||
performance = medium;
|
||||
break;
|
||||
case 2:
|
||||
performance = high;
|
||||
break;
|
||||
case 3:
|
||||
performance = ultraHigh;
|
||||
break;
|
||||
}
|
||||
|
||||
flow->setPerformance(performance);
|
||||
|
||||
switch (settings->value("flowType").toInt())
|
||||
{
|
||||
case 0:
|
||||
flow->setPreset(presetYACReaderFlowClassicConfig);
|
||||
return;
|
||||
case 1:
|
||||
flow->setPreset(presetYACReaderFlowStripeConfig);
|
||||
return;
|
||||
case 2:
|
||||
flow->setPreset(presetYACReaderFlowOverlappedStripeConfig);
|
||||
return;
|
||||
case 3:
|
||||
flow->setPreset(defaultYACReaderFlowConfig);
|
||||
return;
|
||||
case 4:
|
||||
flow->setPreset(pressetYACReaderFlowDownConfig);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//custom config
|
||||
|
||||
flow->setCF_RX(settings->value("xRotation").toInt());
|
||||
flow->setCF_Y(settings->value("yPosition").toInt());
|
||||
flow->setX_Distance(settings->value("coverDistance").toInt());
|
||||
flow->setCenter_Distance(settings->value("centralDistance").toInt());
|
||||
flow->setCF_Z(settings->value("zoomLevel").toInt());
|
||||
flow->setY_Distance(settings->value("yCoverOffset").toInt());
|
||||
flow->setZ_Distance(settings->value("zCoverOffset").toInt());
|
||||
flow->setRotation(settings->value("coverRotation").toInt());
|
||||
flow->setFadeOutDist(settings->value("fadeOutDist").toInt());
|
||||
flow->setLightStrenght(settings->value("lightStrength").toInt());
|
||||
flow->setMaxAngle(settings->value("maxAngle").toInt());
|
||||
|
||||
/* flow->setVisibility(settings->value("visibilityDistance").toInt());
|
||||
flow->setLightStrenght(settings->value("lightStrength").toInt())*/;
|
||||
|
||||
}
|
||||
|
||||
//void ComicFlowWidgetGL::setCF_RX(int value){ flow->setCF_RX(value);}
|
||||
//void ComicFlowWidgetGL::setCF_RY(int value){ flow->setCF_RY(value);}
|
||||
//void ComicFlowWidgetGL::setCF_RZ(int value){ flow->setCF_RZ(value);}
|
||||
//void ComicFlowWidgetGL::setZoom(int zoom){ flow->setZoom(zoom);}
|
||||
//void ComicFlowWidgetGL::setRotation(int angle){ flow->setRotation(angle);}
|
||||
//void ComicFlowWidgetGL::setX_Distance(int distance){ flow->setX_Distance(distance);}
|
||||
//void ComicFlowWidgetGL::setCenter_Distance(int distance){ flow->setCenter_Distance(distance);}
|
||||
//void ComicFlowWidgetGL::setZ_Distance(int distance){ flow->setZ_Distance(distance);}
|
||||
//void ComicFlowWidgetGL::setCF_Y(int value){ flow->setCF_Y(value);}
|
||||
//void ComicFlowWidgetGL::setY_Distance(int value){ flow->setY_Distance(value);}
|
||||
//void ComicFlowWidgetGL::setPreset(const Preset & p){ flow->setPreset(p);}
|
119
common/comic_flow_widget.h
Normal file
119
common/comic_flow_widget.h
Normal file
@ -0,0 +1,119 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "pictureflow.h"
|
||||
#include "comic_flow.h"
|
||||
#include "yacreader_flow_gl.h"
|
||||
|
||||
class ComicFlowWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ComicFlowWidget(QWidget * paret = 0);
|
||||
|
||||
public slots:
|
||||
virtual void setShowMarks(bool value) = 0;
|
||||
virtual void setMarks(QVector<bool> marks) = 0;
|
||||
virtual void setMarkImage(QImage & image) = 0;
|
||||
virtual void markSlide(int index) = 0;
|
||||
virtual void unmarkSlide(int index) = 0;
|
||||
virtual void setSlideSize(QSize size) = 0;
|
||||
virtual void clear() = 0;
|
||||
virtual void setImagePaths(QStringList paths) = 0;
|
||||
virtual void setCenterIndex(int index) = 0;
|
||||
virtual void showSlide(int index) = 0;
|
||||
virtual int centerIndex() = 0;
|
||||
virtual void updateMarks() = 0;
|
||||
virtual void setFlowType(PictureFlow::FlowType flowType) = 0;
|
||||
virtual void render() = 0;
|
||||
virtual void updateConfig(QSettings * settings) = 0;
|
||||
signals:
|
||||
void centerIndexChanged(int);
|
||||
void selected(unsigned int);
|
||||
};
|
||||
|
||||
|
||||
class ComicFlowWidgetSW : public ComicFlowWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
ComicFlow * flow;
|
||||
public:
|
||||
ComicFlowWidgetSW(QWidget * parent = 0);
|
||||
|
||||
void setShowMarks(bool value);
|
||||
void setMarks(QVector<bool> marks);
|
||||
void setMarkImage(QImage & image);
|
||||
void markSlide(int index);
|
||||
void unmarkSlide(int index);
|
||||
void setSlideSize(QSize size);
|
||||
void clear();
|
||||
void setImagePaths(QStringList paths);
|
||||
void setCenterIndex(int index);
|
||||
void showSlide(int index);
|
||||
int centerIndex();
|
||||
void updateMarks();
|
||||
void setFlowType(PictureFlow::FlowType flowType);
|
||||
void render();
|
||||
void updateConfig(QSettings * settings);
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
void resizeEvent(QResizeEvent* event);
|
||||
void mouseDoubleClickEvent(QMouseEvent* event);
|
||||
QSize minimumSizeHint() const;
|
||||
QSize sizeHint() const;
|
||||
};
|
||||
|
||||
class ComicFlowWidgetGL : public ComicFlowWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
YACReaderComicFlowGL * flow;
|
||||
public:
|
||||
ComicFlowWidgetGL(QWidget * parent = 0);
|
||||
|
||||
void setShowMarks(bool value);
|
||||
void setMarks(QVector<bool> marks);
|
||||
void setMarkImage(QImage & image);
|
||||
void markSlide(int index);
|
||||
void unmarkSlide(int index);
|
||||
void setSlideSize(QSize size);
|
||||
void clear();
|
||||
void setImagePaths(QStringList paths);
|
||||
void setCenterIndex(int index);
|
||||
void showSlide(int index);
|
||||
int centerIndex();
|
||||
void updateMarks();
|
||||
void setFlowType(PictureFlow::FlowType flowType);
|
||||
void render();
|
||||
void updateConfig(QSettings * settings);
|
||||
//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 setY_Distance(int value);
|
||||
// void setPreset(const Preset & p);
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
void resizeEvent(QResizeEvent* event);
|
||||
void mouseDoubleClickEvent(QMouseEvent* event);
|
||||
QSize minimumSizeHint() const;
|
||||
QSize sizeHint() const;
|
||||
};
|
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
|
||||
|
||||
|
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
|
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
|
1383
common/pictureflow.cpp
Normal file
1383
common/pictureflow.cpp
Normal file
File diff suppressed because it is too large
Load Diff
226
common/pictureflow.h
Normal file
226
common/pictureflow.h
Normal file
@ -0,0 +1,226 @@
|
||||
/*
|
||||
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;
|
||||
|
||||
/*!
|
||||
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);
|
||||
|
||||
void updateMarks();
|
||||
|
||||
void unmarkSlide(int index);
|
||||
|
||||
void setMarks(const QVector<bool> & marks);
|
||||
|
||||
void setShowMarks(bool enable);
|
||||
|
||||
QVector<bool> 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;
|
||||
QVector<bool> marks;
|
||||
int framesSkip;
|
||||
};
|
||||
|
||||
#endif // PICTUREFLOW_H
|
||||
|
257
common/qnaturalsorting.cpp
Normal file
257
common/qnaturalsorting.cpp
Normal file
@ -0,0 +1,257 @@
|
||||
/* 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());
|
||||
}
|
13
common/qnaturalsorting.h
Normal file
13
common/qnaturalsorting.h
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
#ifndef __QNATURALSORTING_H
|
||||
#define __QNATURALSORTING_H
|
||||
|
||||
#include <QString>
|
||||
#include <QFileInfo>
|
||||
|
||||
bool naturalSortLessThanCS( const QString &left, const QString &right );
|
||||
bool naturalSortLessThanCI( const QString &left, const QString &right );
|
||||
bool naturalSortLessThanCIFileInfo(const QFileInfo & left,const QFileInfo & right);
|
||||
|
||||
#endif
|
1441
common/yacreader_flow_gl.cpp
Normal file
1441
common/yacreader_flow_gl.cpp
Normal file
File diff suppressed because it is too large
Load Diff
390
common/yacreader_flow_gl.h
Normal file
390
common/yacreader_flow_gl.h
Normal file
@ -0,0 +1,390 @@
|
||||
//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;
|
||||
void initializeGL();
|
||||
void paintGL();
|
||||
void timerEvent(QTimerEvent *);
|
||||
|
||||
//number of Covers
|
||||
int numObjects;
|
||||
int lazyPopulateObjects;
|
||||
bool showMarks;
|
||||
QVector<bool> loaded;
|
||||
QVector<bool> 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);
|
||||
~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
|
||||
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<bool> marks);
|
||||
void setMarkImage(QImage & image);
|
||||
void markSlide(int index);
|
||||
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();
|
||||
friend class ImageLoaderGL;
|
||||
private:
|
||||
ImageLoaderGL * worker;
|
||||
|
||||
};
|
||||
|
||||
class YACReaderPageFlowGL : public YACReaderFlowGL
|
||||
{
|
||||
public:
|
||||
YACReaderPageFlowGL(QWidget *parent = 0,struct Preset p = defaultYACReaderFlowConfig);
|
||||
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; };
|
||||
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
|
65
common/yacreader_global.h
Normal file
65
common/yacreader_global.h
Normal file
@ -0,0 +1,65 @@
|
||||
#ifndef __YACREADER_GLOBAL_H
|
||||
#define __YACREADER_GLOBAL_H
|
||||
|
||||
#define VERSION "6.5.3"
|
||||
|
||||
#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 YACREADERLIBRARY_GUID "ea343ff3-2005-4865-b212-7fa7c43999b8"
|
||||
|
||||
|
||||
enum FlowType
|
||||
{
|
||||
CoverFlowLike=0,
|
||||
Strip,
|
||||
StripOverlapped,
|
||||
Modern,
|
||||
Roulette,
|
||||
Custom
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user