This commit is contained in:
Luis Ángel San Martín
2016-01-13 19:31:57 +01:00
44 changed files with 928 additions and 333 deletions

View File

@ -4,7 +4,6 @@
#include <QCoreApplication>
#include <QFileInfo>
#include <QMessageBox>
#include <QList>
#include "yacreader_global.h"

View File

@ -1,5 +1,5 @@
#include "check_new_version.h"
#include <QMessageBox>
#include <QUrl>
#include <QtGlobal>
#include <QStringList>

View File

@ -4,7 +4,6 @@
#include "http_worker.h"
#include "yacreader_global.h"
#include <QWidget>
#include <QByteArray>
#include <QThread>

View File

@ -6,7 +6,7 @@
#include <algorithm>
#include <QDir>
#include <QFileInfoList>
#include <QApplication>
#include <QCoreApplication>
#include "bookmarks.h" //TODO desacoplar la dependencia con bookmarks
#include "qnaturalsorting.h"
@ -320,7 +320,7 @@ bool FileComic::load(const QString & path, const ComicDB & comic)
else
{
//QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path);
moveToThread(QApplication::instance()->thread());
moveToThread(QCoreApplication::instance()->thread());
emit errorOpening();
return false;
}
@ -487,14 +487,14 @@ void FileComic::process()
CompressedArchive archive(_path);
if(!archive.toolsLoaded())
{
moveToThread(QApplication::instance()->thread());
moveToThread(QCoreApplication::instance()->thread());
emit errorOpening(tr("7z not found"));
return;
}
if(!archive.isValid())
{
moveToThread(QApplication::instance()->thread());
moveToThread(QCoreApplication::instance()->thread());
emit errorOpening(tr("Format not supported"));
return;
}
@ -506,7 +506,7 @@ void FileComic::process()
if(_fileNames.size()==0)
{
//QMessageBox::critical(NULL,tr("File error"),tr("File not found or not images in file"));
moveToThread(QApplication::instance()->thread());
moveToThread(QCoreApplication::instance()->thread());
emit errorOpening();
return;
}
@ -552,7 +552,7 @@ void FileComic::process()
emit imageLoaded(sortedIndex);
emit imageLoaded(sortedIndex,_pages[sortedIndex]);
}*/
moveToThread(QApplication::instance()->thread());
moveToThread(QCoreApplication::instance()->thread());
emit imagesLoaded();
}
@ -612,7 +612,7 @@ void FolderComic::process()
{
//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"));
moveToThread(QApplication::instance()->thread());
moveToThread(QCoreApplication::instance()->thread());
emit errorOpening();
}
else
@ -646,7 +646,7 @@ void FolderComic::process()
count++;
}
}
moveToThread(QApplication::instance()->thread());
moveToThread(QCoreApplication::instance()->thread());
emit imagesLoaded();
}
@ -689,7 +689,7 @@ bool PDFComic::load(const QString & path, int atPage)
}
else
{
moveToThread(QApplication::instance()->thread());
moveToThread(QCoreApplication::instance()->thread());
emit errorOpening();
return false;
}
@ -712,7 +712,7 @@ bool PDFComic::load(const QString & path, const ComicDB & comic)
else
{
//QMessageBox::critical(NULL,tr("Not found"),tr("Comic not found")+" : " + path);
moveToThread(QApplication::instance()->thread());
moveToThread(QCoreApplication::instance()->thread());
emit errorOpening();
return false;
}
@ -736,13 +736,13 @@ void PDFComic::process()
{
//delete pdfComic;
//pdfComic = 0;
moveToThread(QApplication::instance()->thread());
moveToThread(QCoreApplication::instance()->thread());
emit errorOpening();
return;
}
if (pdfComic->isLocked())
{
moveToThread(QApplication::instance()->thread());
moveToThread(QCoreApplication::instance()->thread());
emit errorOpening();
return;
}
@ -778,7 +778,7 @@ void PDFComic::process()
renderPage(i);
delete pdfComic;
moveToThread(QApplication::instance()->thread());
moveToThread(QCoreApplication::instance()->thread());
emit imagesLoaded();
}

View File

@ -1,5 +1,5 @@
#include "http_worker.h"
#include <QMessageBox>
#include <QUrl>
#include <QtGlobal>
#include <QStringList>

View File

@ -1,7 +1,6 @@
#ifndef __HTTP_WORKER_H
#define __HTTP_WORKER_H
#include <QWidget>
#include <QByteArray>
#include <QThread>
#include <QUrl>

View File

@ -28,7 +28,7 @@
#define PICTUREFLOW_H
#include <qwidget.h>
#include "yacreader_global.h" //FlowType
#include "yacreader_global_gui.h" //FlowType
class PictureFlowPrivate;

View File

@ -1,5 +1,5 @@
#include "yacreader_global.h"
#include <QAction>
using namespace YACReader;
@ -13,22 +13,6 @@ QString YACReader::getSettingsPath()
}
void YACReader::addSperator(QWidget *w)
{
QAction * separator = new QAction(w);
separator->setSeparator(true);
w->addAction(separator);
}
QAction * YACReader::createSeparator()
{
QAction * a = new QAction(0);
a->setSeparator(true);
return a;
}
QString YACReader::colorToName(LabelColors colors)
{
switch(colors){
@ -59,31 +43,6 @@ QString YACReader::colorToName(LabelColors colors)
}
}
QIcon YACReader::noHighlightedIcon(const QString &path)
{
QPixmap p(path);
QIcon icon;//(path);
icon.addFile(path,p.size(),QIcon::Normal);
icon.addFile(path,p.size(),QIcon::Selected);
return icon;
}
void YACReader::colorize(QImage &img, QColor &col)
{
QRgb *data = (QRgb *)img.bits();
QRgb *end = data + img.width()*img.height();
int rcol = col.red(), gcol = col.green(), bcol = col.blue();
while(data != end) {
*data = qRgba(rcol,gcol,bcol,qAlpha(*data));
++data;
}
}
QString YACReader::labelColorToRGBString(LabelColors color)
{
switch (color) {
@ -129,13 +88,3 @@ QString YACReader::labelColorToRGBString(LabelColors color)
}
}
QList<qulonglong> YACReader::mimeDataToComicsIds(const QMimeData *data)
{
QList<qulonglong> comicIds;
QByteArray rawData = data->data(YACReader::YACReaderLibrarComiscSelectionMimeDataFormat);
QDataStream in(&rawData,QIODevice::ReadOnly);
in >> comicIds; //deserialize the list of indentifiers
return comicIds;
}

View File

@ -7,66 +7,8 @@
#include <QDesktopServices>
#endif
#include <QWidget>
#include <QMimeData>
#define VERSION "8.0.0"
//old fitmode defines
/*
#define ADJUST_TO_FULL_SIZE "ADJUST_TO_FULL_SIZE"
#define FIT "FIT"
#define FIT_TO_WIDTH_RATIO "FIT_TO_WIDTH_RATIO"
*/
#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 FITMODE "FITMODE"
#define FLOW_TYPE "FLOW_TYPE"
#define FULLSCREEN "FULLSCREEN"
#define Y_WINDOW_POS "POS"
#define Y_WINDOW_SIZE "SIZE"
#define MAXIMIZED "MAXIMIZED"
#define DOUBLE_PAGE "DOUBLE_PAGE"
#define DOUBLE_MANGA_PAGE "DOUBLE_MANGA_PAGE"
#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 COMICS_VIEW_STATUS "COMICS_VIEW_STATUS"
#define COMICS_VIEW_FLOW_SPLITTER_STATUS "COMICS_VIEW_FLOW_SPLITTER_STATUS"
#define SIDEBAR_SPLITTER_STATUS "SIDEBAR_SPLITTER_STATUS"
#define COMICS_GRID_COVER_SIZES "COMICS_GRID_COVER_SIZES"
#define USE_BACKGROUND_IMAGE_IN_GRID_VIEW "USE_BACKGROUND_IMAGE_IN_GRID_VIEW"
#define OPACITY_BACKGROUND_IMAGE_IN_GRID_VIEW "OPACITY_BACKGROUND_IMAGE_IN_GRID_VIEW"
#define BLUR_RADIUS_BACKGROUND_IMAGE_IN_GRID_VIEW "BLUR_RADIUS_BACKGROUND_IMAGE_IN_GRID_VIEW"
@ -79,24 +21,9 @@
#define LIBRARIES "LIBRARIES"
#define COMIC_VINE_API_KEY "COMIC_VINE_API_KEY"
namespace YACReader
{
static const QString YACReaderLibrarComiscSelectionMimeDataFormat = "application/yacreaderlibrary-comics-ids";
static const QString YACReaderLibrarSubReadingListMimeDataFormat = "application/yacreaderlibrary-sublist-rows";
enum FlowType
{
CoverFlowLike=0,
Strip,
StripOverlapped,
Modern,
Roulette,
Custom
};
enum YACReaderIPCMessages
{
RequestComicInfo = 0,
@ -115,12 +42,6 @@ static const QString YACReaderLibrarSubReadingListMimeDataFormat = "application/
SevenZNotFound = 700
};
enum ComicsViewStatus
{
Flow,
Grid
};
enum SearchModifiers{
NoModifiers = 0,
OnlyRead,
@ -143,22 +64,10 @@ static const QString YACReaderLibrarSubReadingListMimeDataFormat = "application/
YDark
};
enum FitMode{
ToWidth=0x01,
ToHeight=0x02,
FullRes=0x03,
FullPage=0x04//,
//Text=0x05
};
QString getSettingsPath();
void addSperator(QWidget * w);
QAction * createSeparator();
QString colorToName(LabelColors colors);
QIcon noHighlightedIcon(const QString & path);
void colorize(QImage &img, QColor &col);
QString labelColorToRGBString(LabelColors color);
QList<qulonglong> mimeDataToComicsIds(const QMimeData * data);
}
#endif

View File

@ -0,0 +1,51 @@
#include "yacreader_global_gui.h"
#include <QtCore>
#include <QAction>
using namespace YACReader;
void YACReader::addSperator(QWidget *w)
{
QAction * separator = new QAction(w);
separator->setSeparator(true);
w->addAction(separator);
}
QAction * YACReader::createSeparator()
{
QAction * a = new QAction(0);
a->setSeparator(true);
return a;
}
QIcon YACReader::noHighlightedIcon(const QString &path)
{
QPixmap p(path);
QIcon icon;//(path);
icon.addFile(path,p.size(),QIcon::Normal);
icon.addFile(path,p.size(),QIcon::Selected);
return icon;
}
void YACReader::colorize(QImage &img, QColor &col)
{
QRgb *data = (QRgb *)img.bits();
QRgb *end = data + img.width()*img.height();
int rcol = col.red(), gcol = col.green(), bcol = col.blue();
while(data != end) {
*data = qRgba(rcol,gcol,bcol,qAlpha(*data));
++data;
}
}
QList<qulonglong> YACReader::mimeDataToComicsIds(const QMimeData *data)
{
QList<qulonglong> comicIds;
QByteArray rawData = data->data(YACReader::YACReaderLibrarComiscSelectionMimeDataFormat);
QDataStream in(&rawData,QIODevice::ReadOnly);
in >> comicIds; //deserialize the list of indentifiers
return comicIds;
}

View File

@ -0,0 +1,98 @@
#ifndef __YACREADER_GLOBAL_GUI_H
#define __YACREADER_GLOBAL_GUI_H
#include "yacreader_global.h"
#include <QWidget>
#include <QMimeData>
#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 FITMODE "FITMODE"
#define FLOW_TYPE "FLOW_TYPE"
#define FULLSCREEN "FULLSCREEN"
#define Y_WINDOW_POS "POS"
#define Y_WINDOW_SIZE "SIZE"
#define MAXIMIZED "MAXIMIZED"
#define DOUBLE_PAGE "DOUBLE_PAGE"
#define DOUBLE_MANGA_PAGE "DOUBLE_MANGA_PAGE"
#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 COMICS_VIEW_STATUS "COMICS_VIEW_STATUS"
#define COMICS_VIEW_FLOW_SPLITTER_STATUS "COMICS_VIEW_FLOW_SPLITTER_STATUS"
#define SIDEBAR_SPLITTER_STATUS "SIDEBAR_SPLITTER_STATUS"
#define COMICS_GRID_COVER_SIZES "COMICS_GRID_COVER_SIZES"
#define COMIC_VINE_API_KEY "COMIC_VINE_API_KEY"
namespace YACReader
{
static const QString YACReaderLibrarComiscSelectionMimeDataFormat = "application/yacreaderlibrary-comics-ids";
static const QString YACReaderLibrarSubReadingListMimeDataFormat = "application/yacreaderlibrary-sublist-rows";
enum FlowType
{
CoverFlowLike=0,
Strip,
StripOverlapped,
Modern,
Roulette,
Custom
};
enum ComicsViewStatus
{
Flow,
Grid
};
enum FitMode{
ToWidth=0x01,
ToHeight=0x02,
FullRes=0x03,
FullPage=0x04//,
//Text=0x05
};
void addSperator(QWidget * w);
QAction * createSeparator();
QIcon noHighlightedIcon(const QString & path);
void colorize(QImage &img, QColor &col);
QList<qulonglong> mimeDataToComicsIds(const QMimeData * data);
}
#endif