mirror of
https://github.com/YACReader/yacreader
synced 2025-07-17 20:44:32 -04:00
merged
This commit is contained in:
@ -122,6 +122,7 @@ HEADERS += ../common/comic.h \
|
||||
../common/check_new_version.h \
|
||||
../common/qnaturalsorting.h \
|
||||
../common/yacreader_global.h \
|
||||
../common/yacreader_global_gui.h \
|
||||
../common/onstart_flow_selection_dialog.h \
|
||||
../common/comic_db.h \
|
||||
../common/folder.h \
|
||||
@ -171,6 +172,7 @@ SOURCES += ../common/comic.cpp \
|
||||
yacreader_local_client.cpp \
|
||||
../common/http_worker.cpp \
|
||||
../common/yacreader_global.cpp \
|
||||
../common/yacreader_global_gui.cpp \
|
||||
../common/exit_check.cpp \
|
||||
../common/scroll_management.cpp \
|
||||
../common/opengl_checker.cpp
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <QSettings>
|
||||
#include <QDate>
|
||||
|
||||
#include "yacreader_global.h"
|
||||
#include "yacreader_global_gui.h"
|
||||
|
||||
#define CONF_FILE_PATH "."
|
||||
#define SLIDE_ASPECT_RATIO 1.585
|
||||
|
@ -2,6 +2,8 @@
|
||||
#define __GOTO_FLOW_H
|
||||
|
||||
#include "goto_flow_widget.h"
|
||||
#include "yacreader_global_gui.h"
|
||||
|
||||
#include <QThread>
|
||||
|
||||
#include <QWaitCondition>
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include <QSettings>
|
||||
#include "yacreader_global.h"
|
||||
#include "yacreader_global_gui.h"
|
||||
|
||||
using namespace YACReader;
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <typeinfo>
|
||||
|
||||
#include "comic_db.h"
|
||||
#include "yacreader_global.h"
|
||||
#include "yacreader_global_gui.h"
|
||||
|
||||
template<class T>
|
||||
inline const T& kClamp( const T& x, const T& low, const T& high )
|
||||
|
@ -118,6 +118,7 @@ HEADERS += comic_flow.h \
|
||||
../common/custom_widgets.h \
|
||||
../common/qnaturalsorting.h \
|
||||
../common/yacreader_global.h \
|
||||
../common/yacreader_global_gui.h \
|
||||
../common/onstart_flow_selection_dialog.h \
|
||||
no_libraries_widget.h \
|
||||
import_widget.h \
|
||||
@ -194,6 +195,7 @@ SOURCES += comic_flow.cpp \
|
||||
comics_remover.cpp \
|
||||
../common/http_worker.cpp \
|
||||
../common/yacreader_global.cpp \
|
||||
../common/yacreader_global_gui.cpp \
|
||||
yacreader_libraries.cpp \
|
||||
../common/exit_check.cpp \
|
||||
comics_view.cpp \
|
||||
|
164
YACReaderLibrary/YACReaderLibraryServer.pro
Normal file
164
YACReaderLibrary/YACReaderLibraryServer.pro
Normal file
@ -0,0 +1,164 @@
|
||||
######################################################################
|
||||
# Automatically generated by qmake (2.01a) dom 12. oct 20:47:48 2008
|
||||
######################################################################
|
||||
|
||||
TEMPLATE = app
|
||||
TARGET = YACReaderLibraryServer
|
||||
CONFIG += console
|
||||
DEPENDPATH += .
|
||||
INCLUDEPATH += .
|
||||
INCLUDEPATH += ../common \
|
||||
./server \
|
||||
./db
|
||||
|
||||
DEFINES += SERVER_RELEASE NOMINMAX YACREADER_LIBRARY QT_NO_DEBUG_OUTPUT
|
||||
|
||||
#load default build flags
|
||||
#TODO include (../config.pri)
|
||||
!CONFIG(unarr):!CONFIG(7zip) {
|
||||
unix {
|
||||
!macx {
|
||||
CONFIG+=unarr
|
||||
}
|
||||
else {
|
||||
CONFIG+=7zip
|
||||
}
|
||||
|
||||
}
|
||||
win32 {
|
||||
CONFIG+=7zip
|
||||
}
|
||||
}
|
||||
|
||||
win32 {
|
||||
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -luser32
|
||||
LIBS += -lpoppler-qt5
|
||||
INCLUDEPATH += ../dependencies/poppler/include/qt5
|
||||
|
||||
QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL
|
||||
QMAKE_LFLAGS_RELEASE += /LTCG
|
||||
CONFIG -= embed_manifest_exe
|
||||
}
|
||||
|
||||
unix:!macx{
|
||||
INCLUDEPATH += /usr/include/poppler/qt5
|
||||
LIBS += -L/usr/lib -lpoppler-qt5
|
||||
}
|
||||
|
||||
macx{
|
||||
LIBS += -framework Foundation -framework ApplicationServices -framework AppKit
|
||||
|
||||
OBJECTIVE_SOURCES += $$PWD/../common/pdf_comic.mm
|
||||
HEADERS += $$PWD/../common/pdf_comic.h
|
||||
CONFIG += objective_c
|
||||
}
|
||||
|
||||
unix{
|
||||
CONFIG += c++11
|
||||
}
|
||||
|
||||
#CONFIG += release
|
||||
CONFIG -= flat
|
||||
QT += core sql network script
|
||||
|
||||
# Input
|
||||
HEADERS += library_creator.h \
|
||||
package_manager.h \
|
||||
bundle_creator.h \
|
||||
db_helper.h \
|
||||
./db/data_base_management.h \
|
||||
../common/comic_db.h \
|
||||
../common/folder.h \
|
||||
../common/library_item.h \
|
||||
../common/comic.h \
|
||||
../common/bookmarks.h \
|
||||
../common/qnaturalsorting.h \
|
||||
../common/yacreader_global.h \
|
||||
yacreader_local_server.h \
|
||||
comics_remover.h \
|
||||
../common/http_worker.h \
|
||||
yacreader_libraries.h \
|
||||
comic_files_manager.h \
|
||||
headless/console_ui_library_creator.h
|
||||
|
||||
|
||||
SOURCES += library_creator.cpp \
|
||||
.\headless\main.cpp \
|
||||
package_manager.cpp \
|
||||
bundle_creator.cpp \
|
||||
db_helper.cpp \
|
||||
./db/data_base_management.cpp \
|
||||
../common/comic_db.cpp \
|
||||
../common/folder.cpp \
|
||||
../common/library_item.cpp \
|
||||
../common/comic.cpp \
|
||||
../common/bookmarks.cpp \
|
||||
../common/qnaturalsorting.cpp \
|
||||
yacreader_local_server.cpp \
|
||||
comics_remover.cpp \
|
||||
../common/http_worker.cpp \
|
||||
../common/yacreader_global.cpp \
|
||||
yacreader_libraries.cpp \
|
||||
comic_files_manager.cpp \
|
||||
headless/console_ui_library_creator.cpp
|
||||
|
||||
|
||||
include(./server/server.pri)
|
||||
CONFIG(7zip){
|
||||
include(../compressed_archive/wrapper.pri)
|
||||
} else:CONFIG(unarr) {
|
||||
include(../compressed_archive/unarr/unarr-wrapper.pri)
|
||||
} else {
|
||||
error(No compression backend specified. Did you mess with the build system?)
|
||||
}
|
||||
include(../QsLog/QsLog.pri)
|
||||
|
||||
|
||||
TRANSLATIONS = yacreaderlibraryserver_es.ts \
|
||||
yacreaderlibraryserver_ru.ts \
|
||||
yacreaderlibraryserver_pt.ts \
|
||||
yacreaderlibraryserver_fr.ts \
|
||||
yacreaderlibraryserver_nl.ts \
|
||||
yacreaderlibraryserver_tr.ts \
|
||||
yacreaderlibraryserver_de.ts \
|
||||
yacreaderlibraryserver_source.ts
|
||||
|
||||
|
||||
RESOURCES += headless/images.qrc
|
||||
|
||||
|
||||
Release:DESTDIR = ../release
|
||||
Debug:DESTDIR = ../debug
|
||||
|
||||
|
||||
unix:!macx {
|
||||
#set install prefix if it's empty
|
||||
isEmpty(PREFIX) {
|
||||
PREFIX = /usr
|
||||
}
|
||||
|
||||
BINDIR = $$PREFIX/bin
|
||||
LIBDIR = $$PREFIX/lib
|
||||
DATADIR = $$PREFIX/share
|
||||
|
||||
DEFINES += "LIBDIR=\\\"$$LIBDIR\\\"" "DATADIR=\\\"$$DATADIR\\\"" "BINDIR=\\\"$$BINDIR\\\""
|
||||
|
||||
#MAKE INSTALL
|
||||
INSTALLS += bin icon desktop server translation manpage
|
||||
|
||||
bin.path = $$BINDIR
|
||||
isEmpty(DESTDIR) {
|
||||
bin.files = YACReaderLibrary
|
||||
} else {
|
||||
bin.files = $$DESTDIR/YACReaderLibrary
|
||||
}
|
||||
|
||||
server.path = $$DATADIR/yacreader
|
||||
server.files = ../release/server
|
||||
|
||||
translation.path = $$DATADIR/yacreader/languages
|
||||
translation.files = ../release/languages/yacreaderlibrary_*
|
||||
|
||||
manpage.path = $$DATADIR/man/man1
|
||||
manpage.files = ../YACReaderLibrary.1
|
||||
}
|
@ -7,7 +7,7 @@
|
||||
#include <QPushButton>
|
||||
#include <QSettings>
|
||||
|
||||
#include "yacreader_global.h"
|
||||
#include "yacreader_global_gui.h"
|
||||
|
||||
ApiKeyDialog::ApiKeyDialog(QWidget *parent) :
|
||||
QDialog(parent)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "comic_vine_client.h"
|
||||
#include "yacreader_global_gui.h"
|
||||
|
||||
//this is the API key used by YACReader to access Comic Vine
|
||||
//please, do not use it in your own software, get one for free at Comic Vine
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <QSizePolicy>
|
||||
#include <QPainter>
|
||||
|
||||
#include "yacreader_global.h"
|
||||
#include "yacreader_global_gui.h"
|
||||
|
||||
ComicsViewTransition::ComicsViewTransition(QWidget *parent) :
|
||||
QWidget(parent),movie(0)
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <QSqlQuery>
|
||||
#include <QSqlDatabase>
|
||||
|
||||
#include "yacreader_global.h"
|
||||
#include "yacreader_global_gui.h"
|
||||
|
||||
class ComicDB;
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "library_creator.h"
|
||||
#include "check_new_version.h"
|
||||
|
||||
|
||||
static QString fields = "title ,"
|
||||
|
||||
"coverPage,"
|
||||
@ -311,7 +312,6 @@ bool DataBaseManagement::createV8Tables(QSqlDatabase &database)
|
||||
return success;
|
||||
}
|
||||
|
||||
#include <qmessagebox.h>
|
||||
void DataBaseManagement::exportComicsInfo(QString source, QString dest)
|
||||
{
|
||||
//QSqlDatabase sourceDB = loadDatabase(source);
|
||||
|
@ -54,7 +54,7 @@
|
||||
#include "folder.h"
|
||||
#include "db_helper.h"
|
||||
#include "qnaturalsorting.h"
|
||||
#include "yacreader_global.h"
|
||||
#include "yacreader_global_gui.h"
|
||||
#include "QsLog.h"
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <QIcon>
|
||||
#include <QVariant>
|
||||
|
||||
#include "yacreader_global.h"
|
||||
#include "yacreader_global_gui.h"
|
||||
#include "reading_list_model.h"
|
||||
//TODO add propper constructors, using QList<QVariant> is not safe
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <QtWidgets>
|
||||
#include "empty_container_info.h"
|
||||
#include "yacreader_global.h"
|
||||
#include "yacreader_global_gui.h"
|
||||
|
||||
class EmptyLabelWidget : public EmptyContainerInfo
|
||||
{
|
||||
|
@ -127,7 +127,6 @@ void GridComicsView::createCoverSizeSliderWidget()
|
||||
|
||||
void GridComicsView::setToolBar(QToolBar *toolBar)
|
||||
{
|
||||
QLOG_INFO() << "setToolBar";
|
||||
static_cast<QVBoxLayout *>(this->layout())->insertWidget(1,toolBar);
|
||||
this->toolbar = toolBar;
|
||||
|
||||
@ -137,21 +136,20 @@ void GridComicsView::setToolBar(QToolBar *toolBar)
|
||||
|
||||
void GridComicsView::setModel(ComicModel *model)
|
||||
{
|
||||
QLOG_INFO() << "setModel";
|
||||
if(model == NULL)
|
||||
return;
|
||||
|
||||
ComicsView::setModel(model);
|
||||
|
||||
QQmlContext *ctxt = view->rootContext();
|
||||
|
||||
//there is only one mothel in the system
|
||||
ComicsView::setModel(model);
|
||||
if(this->model != NULL)
|
||||
{
|
||||
QLOG_INFO() << "xxx";
|
||||
|
||||
if(_selectionModel != NULL)
|
||||
delete _selectionModel;
|
||||
_selectionModel = new QItemSelectionModel(this->model);
|
||||
|
||||
ctxt->setContextProperty("comicsList", this->model);
|
||||
_selectionModel = new QItemSelectionModel(model);
|
||||
|
||||
//TODO fix crash in the following line on comics views switch
|
||||
ctxt->setContextProperty("comicsList", model);
|
||||
ctxt->setContextProperty("comicsSelection", _selectionModel);
|
||||
ctxt->setContextProperty("contextMenuHelper",this);
|
||||
ctxt->setContextProperty("comicsSelectionHelper", this);
|
||||
@ -164,7 +162,6 @@ void GridComicsView::setModel(ComicModel *model)
|
||||
|
||||
if(model->rowCount()>0)
|
||||
setCurrentIndex(model->index(0,0));
|
||||
}
|
||||
}
|
||||
|
||||
void GridComicsView::updateBackgroundConfig()
|
||||
@ -208,7 +205,6 @@ void GridComicsView::updateBackgroundConfig()
|
||||
|
||||
void GridComicsView::setCurrentIndex(const QModelIndex &index)
|
||||
{
|
||||
QLOG_INFO() << "setCurrentIndex";
|
||||
_selectionModel->clear();
|
||||
_selectionModel->select(index, QItemSelectionModel::Select | QItemSelectionModel::Rows);
|
||||
view->rootContext()->setContextProperty("dummyValue", true);
|
||||
@ -219,7 +215,6 @@ void GridComicsView::setCurrentIndex(const QModelIndex &index)
|
||||
|
||||
QModelIndex GridComicsView::currentIndex()
|
||||
{
|
||||
QLOG_INFO() << "currentIndex";
|
||||
|
||||
if(!_selectionModel)
|
||||
return QModelIndex();
|
||||
@ -238,7 +233,6 @@ QModelIndex GridComicsView::currentIndex()
|
||||
|
||||
QItemSelectionModel *GridComicsView::selectionModel()
|
||||
{
|
||||
QLOG_INFO() << "selectionModel";
|
||||
QModelIndexList indexes = _selectionModel->selectedRows();
|
||||
if(indexes.length()==0)
|
||||
this->selectIndex(0);
|
||||
@ -248,24 +242,22 @@ QItemSelectionModel *GridComicsView::selectionModel()
|
||||
|
||||
void GridComicsView::scrollTo(const QModelIndex &mi, QAbstractItemView::ScrollHint hint)
|
||||
{
|
||||
QLOG_INFO() << "scrollTo";
|
||||
|
||||
}
|
||||
|
||||
void GridComicsView::toFullScreen()
|
||||
{
|
||||
QLOG_INFO() << "toFullScreen";
|
||||
toolbar->hide();
|
||||
}
|
||||
|
||||
void GridComicsView::toNormal()
|
||||
{
|
||||
QLOG_INFO() << "toNormal";
|
||||
toolbar->show();
|
||||
}
|
||||
|
||||
void GridComicsView::updateConfig(QSettings *settings)
|
||||
{
|
||||
QLOG_INFO() << "updateConfig";
|
||||
|
||||
}
|
||||
|
||||
void GridComicsView::enableFilterMode(bool enabled)
|
||||
@ -275,7 +267,6 @@ void GridComicsView::enableFilterMode(bool enabled)
|
||||
|
||||
void GridComicsView::selectAll()
|
||||
{
|
||||
QLOG_INFO() << "selectAll";
|
||||
QModelIndex top = model->index(0, 0);
|
||||
QModelIndex bottom = model->index(model->rowCount()-1, 0);
|
||||
QItemSelection selection(top, bottom);
|
||||
@ -285,7 +276,6 @@ void GridComicsView::selectAll()
|
||||
|
||||
void GridComicsView::rate(int index, int rating)
|
||||
{
|
||||
QLOG_INFO() << "Comic "<< index << "rated" << rating;
|
||||
model->updateRating(rating,model->index(index,0));
|
||||
}
|
||||
|
||||
@ -302,7 +292,6 @@ void GridComicsView::setCoversSize(int width)
|
||||
|
||||
if(grid != 0)
|
||||
{
|
||||
QLOG_INFO() << "method invoked";
|
||||
QVariant cellCustomWidth = (width * YACREADER_MIN_CELL_CUSTOM_WIDTH) / YACREADER_MIN_GRID_ZOOM_WIDTH;
|
||||
QMetaObject::invokeMethod(grid, "calculateCellWidths",
|
||||
Q_ARG(QVariant, cellCustomWidth));
|
||||
@ -322,7 +311,6 @@ void GridComicsView::setCoversSize(int width)
|
||||
|
||||
QSize GridComicsView::sizeHint()
|
||||
{
|
||||
QLOG_INFO() << "sizeHint";
|
||||
return QSize(1280,768);
|
||||
}
|
||||
|
||||
@ -340,7 +328,6 @@ QByteArray GridComicsView::getMimeDataFromSelection()
|
||||
|
||||
void GridComicsView::startDrag()
|
||||
{
|
||||
QLOG_DEBUG() << "performDrag";
|
||||
QDrag *drag = new QDrag(this);
|
||||
drag->setMimeData(model->mimeData(_selectionModel->selectedRows()));
|
||||
drag->setPixmap(QPixmap(":/images/comics_view_toolbar/openInYACReader.png")); //TODO add better image
|
||||
@ -388,7 +375,6 @@ void GridComicsView::droppedComicsForResortingAt(const QString &data, int index)
|
||||
//helper
|
||||
void GridComicsView::selectIndex(int index)
|
||||
{
|
||||
QLOG_INFO() << "selectIndex" << index;
|
||||
if(_selectionModel != NULL && model!=NULL)
|
||||
{
|
||||
_selectionModel->select(model->index(index,0),QItemSelectionModel::Select | QItemSelectionModel::Rows);
|
||||
@ -422,7 +408,6 @@ bool GridComicsView::isSelectedIndex(int index)
|
||||
|
||||
void GridComicsView::clear()
|
||||
{
|
||||
QLOG_INFO() << "clear";
|
||||
if(_selectionModel != NULL)
|
||||
{
|
||||
_selectionModel->clear();
|
||||
@ -452,7 +437,6 @@ int GridComicsView::lastSelectedIndex()
|
||||
{
|
||||
if(_selectionModel != NULL)
|
||||
{
|
||||
QLOG_INFO() << "last selected index " << _selectionModel->selectedRows().last().row();
|
||||
return _selectionModel->selectedRows().last().row();
|
||||
}
|
||||
|
||||
@ -461,7 +445,6 @@ int GridComicsView::lastSelectedIndex()
|
||||
|
||||
void GridComicsView::setShowMarks(bool show)
|
||||
{
|
||||
QLOG_INFO() << "setShowMarks";
|
||||
QQmlContext *ctxt = view->rootContext();
|
||||
ctxt->setContextProperty("show_marks", show);
|
||||
}
|
||||
@ -471,7 +454,6 @@ void GridComicsView::closeEvent(QCloseEvent *event)
|
||||
toolbar->removeAction(toolBarStretchAction);
|
||||
toolbar->removeAction(coverSizeSliderAction);
|
||||
|
||||
QLOG_INFO() << "closeEvent";
|
||||
QObject *object = view->rootObject();
|
||||
QMetaObject::invokeMethod(object, "exit");
|
||||
container->close();
|
||||
|
103
YACReaderLibrary/headless/console_ui_library_creator.cpp
Normal file
103
YACReaderLibrary/headless/console_ui_library_creator.cpp
Normal file
@ -0,0 +1,103 @@
|
||||
#include "console_ui_library_creator.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "library_creator.h"
|
||||
#include "yacreader_libraries.h"
|
||||
|
||||
|
||||
ConsoleUILibraryCreator::ConsoleUILibraryCreator(QObject *parent) :
|
||||
QObject(parent), numComicsProcessed(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ConsoleUILibraryCreator::createLibrary(const QString & name, const QString & path)
|
||||
{
|
||||
QEventLoop eventLoop;
|
||||
LibraryCreator * libraryCreator = new LibraryCreator();
|
||||
|
||||
libraryCreator->createLibrary(QDir::cleanPath(path),QDir::cleanPath(path)+"/.yacreaderlibrary");
|
||||
|
||||
connect(libraryCreator, &LibraryCreator::finished, this, &ConsoleUILibraryCreator::done);
|
||||
connect(libraryCreator, &LibraryCreator::comicAdded, this, &ConsoleUILibraryCreator::newComic);
|
||||
connect(libraryCreator, &LibraryCreator::failedCreatingDB, this, &ConsoleUILibraryCreator::manageCreatingError);
|
||||
|
||||
connect(libraryCreator, &LibraryCreator::finished, &eventLoop, &QEventLoop::quit);
|
||||
|
||||
std::cout << "Processing comics";
|
||||
|
||||
libraryCreator->start();
|
||||
eventLoop.exec();
|
||||
|
||||
//TODO, at some point some checking is needed for avoiding duplicated libraries
|
||||
YACReaderLibraries yacreaderLibraries;
|
||||
yacreaderLibraries.load();
|
||||
yacreaderLibraries.addLibrary(name, path);
|
||||
yacreaderLibraries.save();
|
||||
}
|
||||
|
||||
void ConsoleUILibraryCreator::updateLibrary(const QString & path)
|
||||
{
|
||||
QEventLoop eventLoop;
|
||||
LibraryCreator * libraryCreator = new LibraryCreator();
|
||||
|
||||
libraryCreator->updateLibrary(QDir::cleanPath(path),QDir::cleanPath(path)+"/.yacreaderlibrary");
|
||||
|
||||
connect(libraryCreator, &LibraryCreator::finished, this, &ConsoleUILibraryCreator::done);
|
||||
connect(libraryCreator, &LibraryCreator::comicAdded, this, &ConsoleUILibraryCreator::newComic);
|
||||
connect(libraryCreator, &LibraryCreator::failedOpeningDB, this, &ConsoleUILibraryCreator::manageUpdatingError);
|
||||
|
||||
connect(libraryCreator, &LibraryCreator::finished, &eventLoop, &QEventLoop::quit);
|
||||
|
||||
std::cout << "Processing comics";
|
||||
|
||||
libraryCreator->start();
|
||||
eventLoop.exec();
|
||||
}
|
||||
|
||||
void ConsoleUILibraryCreator::addExistingLibrary(const QString & name, const QString & path)
|
||||
{
|
||||
//TODO add error handling
|
||||
YACReaderLibraries yacreaderLibraries;
|
||||
yacreaderLibraries.load();
|
||||
yacreaderLibraries.addLibrary(name, path);
|
||||
yacreaderLibraries.save();
|
||||
|
||||
std::cout << "Library added : " << name.toUtf8().constData() << " at " << path.toUtf8().constData() << std::endl;
|
||||
}
|
||||
|
||||
void ConsoleUILibraryCreator::removeLibrary(const QString & name)
|
||||
{
|
||||
//TODO add error handling
|
||||
YACReaderLibraries yacreaderLibraries;
|
||||
yacreaderLibraries.load();
|
||||
yacreaderLibraries.remove(name);
|
||||
yacreaderLibraries.save();
|
||||
|
||||
std::cout << "Library removed : " << name.toUtf8().constData() << std::endl;
|
||||
}
|
||||
|
||||
void ConsoleUILibraryCreator::newComic(const QString & /*relativeComicPath*/, const QString & /*coverPath*/)
|
||||
{
|
||||
numComicsProcessed++;
|
||||
std::cout << ".";
|
||||
}
|
||||
|
||||
void ConsoleUILibraryCreator::manageCreatingError(const QString & error)
|
||||
{
|
||||
std::cout << std::endl << "Error creating library! " << error.toUtf8().constData();
|
||||
}
|
||||
|
||||
void ConsoleUILibraryCreator::manageUpdatingError(const QString & error)
|
||||
{
|
||||
std::cout << std::endl << "Error updating library! " << error.toUtf8().constData();
|
||||
}
|
||||
|
||||
void ConsoleUILibraryCreator::done()
|
||||
{
|
||||
std::cout << "Done!" << std::endl;
|
||||
|
||||
if(numComicsProcessed > 0)
|
||||
std::cout << "Number of comis processed = " << numComicsProcessed << std::endl;
|
||||
}
|
29
YACReaderLibrary/headless/console_ui_library_creator.h
Normal file
29
YACReaderLibrary/headless/console_ui_library_creator.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef CONSOLE_UI_LIBRARY_CREATOR_H
|
||||
#define CONSOLE_UI_LIBRARY_CREATOR_H
|
||||
|
||||
#include <QtCore>
|
||||
|
||||
class ConsoleUILibraryCreator : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ConsoleUILibraryCreator(QObject *parent = 0);
|
||||
void createLibrary(const QString & name, const QString & path);
|
||||
void updateLibrary(const QString & path);
|
||||
void addExistingLibrary(const QString & name, const QString & path);
|
||||
void removeLibrary(const QString & name);
|
||||
|
||||
private:
|
||||
uint numComicsProcessed;
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
protected slots:
|
||||
void newComic(const QString & relativeComicPath, const QString & coverPath);
|
||||
void manageCreatingError(const QString & error);
|
||||
void manageUpdatingError(const QString & error);
|
||||
void done();
|
||||
};
|
||||
|
||||
#endif // CONSOLE_UI_LIBRARY_CREATOR_H
|
6
YACReaderLibrary/headless/images.qrc
Normal file
6
YACReaderLibrary/headless/images.qrc
Normal file
@ -0,0 +1,6 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>../../images/f_overlayed.png</file>
|
||||
<file>../../images/f_overlayed_retina.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
321
YACReaderLibrary/headless/main.cpp
Normal file
321
YACReaderLibrary/headless/main.cpp
Normal file
@ -0,0 +1,321 @@
|
||||
#include <QtCore>
|
||||
|
||||
#include "comic_db.h"
|
||||
#include "db_helper.h"
|
||||
#include "startup.h"
|
||||
#include "yacreader_global.h"
|
||||
#include "yacreader_libraries.h"
|
||||
#include "yacreader_local_server.h"
|
||||
|
||||
#include "console_ui_library_creator.h"
|
||||
|
||||
#include "QsLog.h"
|
||||
#include "QsLogDest.h"
|
||||
|
||||
|
||||
|
||||
using namespace QsLogging;
|
||||
|
||||
void logSystemAndConfig()
|
||||
{
|
||||
QLOG_INFO() << "---------- System & configuration ----------";
|
||||
#if defined(Q_OS_WIN)
|
||||
switch (QSysInfo::windowsVersion())
|
||||
{
|
||||
case QSysInfo::WV_NT:
|
||||
QLOG_INFO() << "SO : Windows NT";
|
||||
break;
|
||||
case QSysInfo::WV_2000:
|
||||
QLOG_INFO() << "SO : Windows 2000";
|
||||
break;
|
||||
case QSysInfo::WV_XP:
|
||||
QLOG_INFO() << "SO : Windows XP";
|
||||
break;
|
||||
case QSysInfo::WV_2003:
|
||||
QLOG_INFO() << "SO : Windows 2003";
|
||||
break;
|
||||
case QSysInfo::WV_VISTA:
|
||||
QLOG_INFO() << "SO : Windows Vista";
|
||||
break;
|
||||
case QSysInfo::WV_WINDOWS7:
|
||||
QLOG_INFO() << "SO : Windows 7";
|
||||
break;
|
||||
case QSysInfo::WV_WINDOWS8:
|
||||
QLOG_INFO() << "SO : Windows 8";
|
||||
break;
|
||||
default:
|
||||
QLOG_INFO() << "Windows (unknown version)";
|
||||
break;
|
||||
}
|
||||
|
||||
#elif defined(Q_OS_MAC)
|
||||
|
||||
switch (QSysInfo::MacVersion())
|
||||
{
|
||||
case QSysInfo::MV_SNOWLEOPARD:
|
||||
QLOG_INFO() << "SO : MacOSX Snow Leopard";
|
||||
break;
|
||||
case QSysInfo::MV_LION:
|
||||
QLOG_INFO() << "SO : MacOSX Lion";
|
||||
break;
|
||||
case QSysInfo::MV_MOUNTAINLION:
|
||||
QLOG_INFO() << "SO : MacOSX Mountain Lion";
|
||||
break;
|
||||
#if QT_VERSION >= 0x050000
|
||||
case QSysInfo::MV_MAVERICKS:
|
||||
QLOG_INFO() << "SO : MacOSX Maverics";
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
QLOG_INFO() << "SO : MacOSX (unknown version)";
|
||||
break;
|
||||
}
|
||||
|
||||
#elif defined(Q_OS_LINUX)
|
||||
QLOG_INFO() << "SO : Linux (unknown version)";
|
||||
|
||||
#else
|
||||
QLOG_INFO() << "SO : Unknown";
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
if(QLibrary::isLibrary(QCoreApplication::applicationDirPath()+"/utils/7z.dll"))
|
||||
#elif defined Q_OS_UNIX && !defined Q_OS_MAC
|
||||
if(QLibrary::isLibrary(QString(LIBDIR)+"/yacreader/7z.so") | QLibrary::isLibrary(QString(LIBDIR)+"/p7zip/7z.so"))
|
||||
#else
|
||||
if(QLibrary::isLibrary(QApplication::applicationDirPath()+"/utils/7z.so"))
|
||||
#endif
|
||||
QLOG_INFO() << "7z : found";
|
||||
else
|
||||
QLOG_ERROR() << "7z : not found";
|
||||
|
||||
/* TODO: qrencode could be helpfull for showing a qr code in the web client for client devices
|
||||
#if defined Q_OS_UNIX && !defined Q_OS_MAC
|
||||
if(QFileInfo(QString(BINDIR)+"/qrencode").exists())
|
||||
#else
|
||||
if(QFileInfo(QCoreApplication::applicationDirPath()+"/utils/qrencode.exe").exists() || QFileInfo("./util/qrencode").exists())
|
||||
#endif
|
||||
QLOG_INFO() << "qrencode : found";
|
||||
else
|
||||
QLOG_INFO() << "qrencode : not found";
|
||||
*/
|
||||
|
||||
QLOG_INFO() << "Libraries: " << DBHelper::getLibraries().getLibraries();
|
||||
QLOG_INFO() << "--------------------------------------------";
|
||||
}
|
||||
|
||||
int main( int argc, char ** argv )
|
||||
{
|
||||
QCoreApplication *app = new QCoreApplication(argc, argv);
|
||||
|
||||
app->setApplicationName("YACReaderLibrary");
|
||||
app->setOrganizationName("YACReader");
|
||||
app->setApplicationVersion(VERSION);
|
||||
|
||||
QTextStream qout(stdout);
|
||||
|
||||
//general help
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription(QCoreApplication::tr("\nYACReaderLibraryServer is the headless (no gui) version of YACReaderLibrary"));
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
parser.addPositionalArgument("command", "The command to execute. [start, create-library, update-library, add-library, remove-library, list-libraries]");
|
||||
|
||||
parser.parse(QCoreApplication::arguments());
|
||||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
const QString command = args.isEmpty() ? QString() : args.first();
|
||||
|
||||
if(command == "start")
|
||||
{
|
||||
QString destLog = YACReader::getSettingsPath()+"/yacreaderlibrary.log";
|
||||
QDir().mkpath(YACReader::getSettingsPath());
|
||||
|
||||
Logger& logger = Logger::instance();
|
||||
logger.setLoggingLevel(QsLogging::TraceLevel);
|
||||
|
||||
DestinationPtr fileDestination(DestinationFactory::MakeFileDestination(
|
||||
destLog, EnableLogRotation, MaxSizeBytes(1048576), MaxOldLogCount(2)));
|
||||
DestinationPtr debugDestination(DestinationFactory::MakeDebugOutputDestination());
|
||||
logger.addDestination(debugDestination);
|
||||
logger.addDestination(fileDestination);
|
||||
|
||||
QTranslator translator;
|
||||
QString sufix = QLocale::system().name();
|
||||
#if defined Q_OS_UNIX && !defined Q_OS_MAC
|
||||
translator.load(QString(DATADIR)+"/yacreader/languages/yacreaderlibrary_"+sufix);
|
||||
#else
|
||||
translator.load(QCoreApplication::applicationDirPath()+"/languages/yacreaderlibrary_"+sufix);
|
||||
#endif
|
||||
app->installTranslator(&translator);
|
||||
|
||||
QTranslator viewerTranslator;
|
||||
#if defined Q_OS_UNIX && !defined Q_OS_MAC
|
||||
viewerTranslator.load(QString(DATADIR)+"/yacreader/languages/yacreader_"+sufix);
|
||||
#else
|
||||
viewerTranslator.load(QCoreApplication::applicationDirPath()+"/languages/yacreader_"+sufix);
|
||||
#endif
|
||||
app->installTranslator(&viewerTranslator);
|
||||
|
||||
qRegisterMetaType<ComicDB>("ComicDB");
|
||||
|
||||
QSettings * settings = new QSettings(YACReader::getSettingsPath()+"/"+QCoreApplication::applicationName()+".ini",QSettings::IniFormat);
|
||||
settings->beginGroup("libraryConfig");
|
||||
|
||||
//server
|
||||
Startup *s = new Startup();
|
||||
s->start();
|
||||
|
||||
QLOG_INFO() << "YACReaderLibraryServer attempting to start";
|
||||
|
||||
logSystemAndConfig();
|
||||
|
||||
if(YACReaderLocalServer::isRunning()) //s�lo se permite una instancia de YACReaderLibrary
|
||||
{
|
||||
QLOG_WARN() << "another instance of YACReaderLibrary is running";
|
||||
QsLogging::Logger::destroyInstance();
|
||||
return 0;
|
||||
}
|
||||
QLOG_INFO() << "YACReaderLibrary starting";
|
||||
|
||||
YACReaderLocalServer * localServer = new YACReaderLocalServer();
|
||||
|
||||
int ret = app->exec();
|
||||
|
||||
QLOG_INFO() << "YACReaderLibrary closed with exit code :" << ret;
|
||||
|
||||
//shutdown
|
||||
s->stop();
|
||||
delete s;
|
||||
localServer->close();
|
||||
delete localServer;
|
||||
|
||||
QsLogging::Logger::destroyInstance();
|
||||
|
||||
return ret;
|
||||
}
|
||||
else if(command == "create-library")
|
||||
{
|
||||
QCommandLineParser parser;
|
||||
|
||||
parser.addHelpOption();
|
||||
|
||||
parser.parse(QCoreApplication::arguments());
|
||||
|
||||
parser.clearPositionalArguments();
|
||||
parser.addPositionalArgument("create-library", "Creates a library named \"name\" in the specified destination <path>");
|
||||
parser.addPositionalArgument("name", "Library name", "\"name\"");
|
||||
parser.addPositionalArgument("path", "Path to the folder where the library will be created", "<path>");
|
||||
parser.process(*app);
|
||||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
if(args.length() != 3)
|
||||
{
|
||||
parser.showHelp();
|
||||
return 0;
|
||||
}
|
||||
|
||||
const QStringList createArgs = parser.positionalArguments();
|
||||
|
||||
ConsoleUILibraryCreator * libraryCreatorUI = new ConsoleUILibraryCreator;
|
||||
libraryCreatorUI->createLibrary(createArgs.at(1), createArgs.at(2));
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if(command == "update-library")
|
||||
{
|
||||
QCommandLineParser parser;
|
||||
|
||||
parser.addHelpOption();
|
||||
|
||||
parser.parse(QCoreApplication::arguments());
|
||||
|
||||
parser.clearPositionalArguments();
|
||||
parser.addPositionalArgument("update-library", "Updates an existing library at <path>");
|
||||
parser.addPositionalArgument("path", "Path to the library to be updated", "<path>");
|
||||
parser.process(*app);
|
||||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
if(args.length() != 2)
|
||||
{
|
||||
parser.showHelp();
|
||||
return 0;
|
||||
}
|
||||
|
||||
const QStringList updateArgs = parser.positionalArguments();
|
||||
|
||||
ConsoleUILibraryCreator * libraryCreatorUI = new ConsoleUILibraryCreator;
|
||||
libraryCreatorUI->updateLibrary(updateArgs.at(1));
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if(command == "add-library")
|
||||
{
|
||||
QCommandLineParser parser;
|
||||
|
||||
parser.addHelpOption();
|
||||
|
||||
parser.parse(QCoreApplication::arguments());
|
||||
|
||||
parser.clearPositionalArguments();
|
||||
parser.addPositionalArgument("add-library", "Adds an exiting library named \"name\" at the specified origin <path>");
|
||||
parser.addPositionalArgument("name", "Library name", "\"name\"");
|
||||
parser.addPositionalArgument("path", "Path to the folder where the library is", "<path>");
|
||||
parser.process(*app);
|
||||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
if(args.length() != 3)
|
||||
{
|
||||
parser.showHelp();
|
||||
return 0;
|
||||
}
|
||||
|
||||
const QStringList addArgs = parser.positionalArguments();
|
||||
|
||||
ConsoleUILibraryCreator * libraryCreatorUI = new ConsoleUILibraryCreator;
|
||||
libraryCreatorUI->addExistingLibrary(addArgs.at(1), addArgs.at(2));
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if(command == "remove-library")
|
||||
{
|
||||
QCommandLineParser parser;
|
||||
|
||||
parser.addHelpOption();
|
||||
|
||||
parser.parse(QCoreApplication::arguments());
|
||||
|
||||
parser.clearPositionalArguments();
|
||||
parser.addPositionalArgument("remove-library", "Removes a library named \"name\" from the list of libraries");
|
||||
parser.addPositionalArgument("name", "Library name", "\"name\"");
|
||||
parser.process(*app);
|
||||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
if(args.length() != 2)
|
||||
{
|
||||
parser.showHelp();
|
||||
return 0;
|
||||
}
|
||||
|
||||
const QStringList removeArgs = parser.positionalArguments();
|
||||
|
||||
ConsoleUILibraryCreator * libraryCreatorUI = new ConsoleUILibraryCreator;
|
||||
libraryCreatorUI->removeLibrary(removeArgs.at(1));
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if(command == "list-libraries")
|
||||
{
|
||||
YACReaderLibraries libraries = DBHelper::getLibraries();
|
||||
for(QString libraryName : libraries.getNames())
|
||||
qout << libraryName << " : " << libraries.getPath(libraryName) << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
else //error
|
||||
{
|
||||
parser.showHelp();
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
#include <QDebug>
|
||||
#include <QSqlQuery>
|
||||
#include <QSqlRecord>
|
||||
#include <QApplication>
|
||||
#include <QCoreApplication>
|
||||
#include <QLibrary>
|
||||
|
||||
#include "data_base_management.h"
|
||||
@ -127,13 +127,13 @@ void LibraryCreator::run()
|
||||
#if defined Q_OS_UNIX && !defined Q_OS_MAC
|
||||
QLibrary *sevenzLib = new QLibrary(QString(LIBDIR)+"/p7zip/7z.so");
|
||||
#else
|
||||
QLibrary *sevenzLib = new QLibrary(QApplication::applicationDirPath()+"/utils/7z");
|
||||
QLibrary *sevenzLib = new QLibrary(QCoreApplication::applicationDirPath()+"/utils/7z");
|
||||
#endif
|
||||
|
||||
if(!sevenzLib->load())
|
||||
{
|
||||
QLOG_ERROR() << "Loading 7z.dll : " + sevenzLib->errorString() << endl;
|
||||
QApplication::exit(YACReader::SevenZNotFound);
|
||||
QCoreApplication::exit(YACReader::SevenZNotFound);
|
||||
exit();
|
||||
}
|
||||
sevenzLib->deleteLater();
|
||||
@ -636,7 +636,7 @@ void ThumbnailCreator::create()
|
||||
#else
|
||||
QImage p = pdfComic->page(_coverPage-1)->renderToImage(72,72);
|
||||
#endif
|
||||
_cover = QPixmap::fromImage(p);
|
||||
_cover = p;
|
||||
if(_target!="")
|
||||
{
|
||||
QImage scaled;
|
||||
|
@ -78,14 +78,14 @@
|
||||
QString _target;
|
||||
QString _currentName;
|
||||
int _numPages;
|
||||
QPixmap _cover;
|
||||
QImage _cover;
|
||||
int _coverPage;
|
||||
static bool crash;
|
||||
|
||||
public slots:
|
||||
void create();
|
||||
int getNumPages(){return _numPages;};
|
||||
QPixmap getCover(){return _cover;};
|
||||
int getNumPages(){return _numPages;}
|
||||
QPixmap getCover(){return QPixmap::fromImage(_cover);}
|
||||
signals:
|
||||
void openingError(QProcess::ProcessError error);
|
||||
|
||||
|
@ -1325,6 +1325,9 @@ void LibraryWindow::loadLibrary(const QString & name)
|
||||
|
||||
void LibraryWindow::loadCoversFromCurrentModel()
|
||||
{
|
||||
//TODO this is a workaround for the crash in GridComicsView::setModel crash on views switching
|
||||
if(typeid(*comicsView) == typeid(GridComicsView))
|
||||
comicsView->setModel(new ComicModel());
|
||||
comicsView->setModel(comicsModel);
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <QMap>
|
||||
#include <QModelIndex>
|
||||
#include <QFileInfo>
|
||||
#include "yacreader_global.h"
|
||||
#include "yacreader_global_gui.h"
|
||||
#include "yacreader_libraries.h"
|
||||
|
||||
#include "yacreader_navigation_controller.h"
|
||||
|
@ -155,31 +155,9 @@ int main( int argc, char ** argv )
|
||||
|
||||
app.setApplicationName("YACReaderLibrary");
|
||||
app.setOrganizationName("YACReader");
|
||||
app.setApplicationVersion(VERSION);
|
||||
|
||||
app.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
//simple command line parser
|
||||
//will be replaced by QCommandLineParser in the future
|
||||
//TODO: --headless, --server=[on|off], support for file and directory arguments
|
||||
if (argc > 1)
|
||||
{
|
||||
QTextStream parser(stdout);
|
||||
QStringList optlist = QCoreApplication::arguments().filter(QRegExp ("^-{1,2}"));
|
||||
if (optlist.contains("--version") || optlist.contains("-v"))
|
||||
{
|
||||
parser << app.applicationName() << " " << QString(VERSION) << endl << "Copyright 2014 by Luis Angel San Martin Rodriguez" << endl;
|
||||
return 0;
|
||||
}
|
||||
if (optlist.contains("--help") || optlist.contains("-h"))
|
||||
{
|
||||
parser << endl << "Usage:" << "\tYACReaderLibrary [Option]" << endl << endl;
|
||||
parser << "Options:" << endl;
|
||||
parser << " none\t\t\tStart YACReaderLibrary" << endl;
|
||||
parser << " -h, --help\t\tDisplay help text and exit." << endl;
|
||||
parser << " -v, --version\t\tDisplay version information and exit." << endl;
|
||||
return 0;
|
||||
}
|
||||
parser << "Unsupported command line options. See YACReaderLibrary --help for further information." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString destLog = YACReader::getSettingsPath()+"/yacreaderlibrary.log";
|
||||
QDir().mkpath(YACReader::getSettingsPath());
|
||||
@ -209,7 +187,6 @@ int main( int argc, char ** argv )
|
||||
viewerTranslator.load(QCoreApplication::applicationDirPath()+"/languages/yacreader_"+sufix);
|
||||
#endif
|
||||
app.installTranslator(&viewerTranslator);
|
||||
app.setApplicationName("YACReaderLibrary");
|
||||
|
||||
qRegisterMetaType<ComicDB>("ComicDB");
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <QDateTime>
|
||||
#include "httpsession.h"
|
||||
#include "static.h"
|
||||
#include <QApplication>
|
||||
#include <QCoreApplication>
|
||||
|
||||
|
||||
StaticFileController::StaticFileController(QSettings* settings, QObject* parent)
|
||||
@ -29,8 +29,8 @@ StaticFileController::StaticFileController(QSettings* settings, QObject* parent)
|
||||
QFileInfo configFile(QString(DATADIR)+"/yacreader");
|
||||
docroot=QFileInfo(QString(DATADIR)+"/yacreader",docroot).absoluteFilePath();
|
||||
#else
|
||||
QFileInfo configFile(QApplication::applicationDirPath());
|
||||
docroot=QFileInfo(QApplication::applicationDirPath(),docroot).absoluteFilePath();
|
||||
QFileInfo configFile(QCoreApplication::applicationDirPath());
|
||||
docroot=QFileInfo(QCoreApplication::applicationDirPath(),docroot).absoluteFilePath();
|
||||
#endif
|
||||
}
|
||||
qDebug("StaticFileController: docroot=%s, encoding=%s, maxAge=%i",qPrintable(docroot),qPrintable(encoding),maxAge);
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <QStringList>
|
||||
#include <QDir>
|
||||
#include <QSet>
|
||||
#include <QApplication>
|
||||
#include <QCoreApplication>
|
||||
|
||||
TemplateLoader::TemplateLoader(QSettings* settings, QObject* parent)
|
||||
: QObject(parent)
|
||||
@ -26,8 +26,8 @@ TemplateLoader::TemplateLoader(QSettings* settings, QObject* parent)
|
||||
QFileInfo configFile(QString(DATADIR)+"/yacreader");
|
||||
templatePath=QFileInfo(QString(DATADIR)+"/yacreader",templatePath).absoluteFilePath();
|
||||
#else
|
||||
QFileInfo configFile(QApplication::applicationDirPath());
|
||||
templatePath=QFileInfo(QApplication::applicationDirPath(),templatePath).absoluteFilePath();
|
||||
QFileInfo configFile(QCoreApplication::applicationDirPath());
|
||||
templatePath=QFileInfo(QCoreApplication::applicationDirPath(),templatePath).absoluteFilePath();
|
||||
#endif
|
||||
}
|
||||
fileNameSuffix=settings->value("suffix",".tpl").toString();
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "yacreader_global.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QApplication>
|
||||
#include <QCoreApplication>
|
||||
|
||||
/** Name of this application */
|
||||
#define APPNAME "YACReaderLibrary"
|
||||
@ -26,9 +26,8 @@
|
||||
|
||||
void Startup::start() {
|
||||
// Initialize the core application
|
||||
QCoreApplication* app = QApplication::instance();
|
||||
app->setApplicationName(APPNAME);
|
||||
app->setOrganizationName(ORGANISATION);
|
||||
QCoreApplication* app = QCoreApplication::instance();
|
||||
|
||||
QString configFileName=YACReader::getSettingsPath()+"/"+QCoreApplication::applicationName()+".ini";
|
||||
|
||||
// Configure logging into files
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <QBitmap>
|
||||
|
||||
#include "startup.h"
|
||||
#include "yacreader_global.h"
|
||||
#include "yacreader_global_gui.h"
|
||||
|
||||
#include "qnaturalsorting.h"
|
||||
|
||||
|
@ -102,7 +102,7 @@ void YACReaderLibraries::addLibrary(const QString &name, const QString &path)
|
||||
|
||||
void YACReaderLibraries::load()
|
||||
{
|
||||
QSettings settings(YACReader::getSettingsPath()+"/YACReaderLibrary.ini",QSettings::IniFormat);
|
||||
QSettings settings(YACReader::getSettingsPath()+"/"+QCoreApplication::applicationName()+".ini",QSettings::IniFormat);
|
||||
|
||||
if(settings.value(LIBRARIES).isValid())
|
||||
{
|
||||
@ -136,7 +136,7 @@ void YACReaderLibraries::load()
|
||||
|
||||
bool YACReaderLibraries::save()
|
||||
{
|
||||
QSettings settings(YACReader::getSettingsPath()+"/YACReaderLibrary.ini",QSettings::IniFormat);
|
||||
QSettings settings(YACReader::getSettingsPath()+"/"+QCoreApplication::applicationName()+".ini",QSettings::IniFormat);
|
||||
|
||||
QByteArray data;
|
||||
QDataStream out(&data, QIODevice::WriteOnly);
|
||||
|
@ -127,10 +127,10 @@ void YACReaderClientConnectionWorker::run()
|
||||
tries = 0;
|
||||
QByteArray data;
|
||||
int dataRead = 0;
|
||||
while(data.size() < totalSize && tries < 200)
|
||||
while((quint32)data.size() < totalSize && tries < 200)
|
||||
{
|
||||
data.append(clientConnection->readAll());
|
||||
if(data.length() < totalSize)
|
||||
if((quint32)data.length() < totalSize)
|
||||
clientConnection->waitForReadyRead(100);
|
||||
if(dataRead == data.length()) //no bytes were read
|
||||
tries++;
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QList>
|
||||
|
||||
#include "yacreader_global.h"
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "check_new_version.h"
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <QUrl>
|
||||
#include <QtGlobal>
|
||||
#include <QStringList>
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include "http_worker.h"
|
||||
#include "yacreader_global.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QByteArray>
|
||||
#include <QThread>
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "http_worker.h"
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <QUrl>
|
||||
#include <QtGlobal>
|
||||
#include <QStringList>
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef __HTTP_WORKER_H
|
||||
#define __HTTP_WORKER_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QByteArray>
|
||||
#include <QThread>
|
||||
#include <QUrl>
|
||||
|
@ -28,7 +28,7 @@
|
||||
#define PICTUREFLOW_H
|
||||
|
||||
#include <qwidget.h>
|
||||
#include "yacreader_global.h" //FlowType
|
||||
#include "yacreader_global_gui.h" //FlowType
|
||||
|
||||
class PictureFlowPrivate;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
51
common/yacreader_global_gui.cpp
Normal file
51
common/yacreader_global_gui.cpp
Normal 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;
|
||||
}
|
98
common/yacreader_global_gui.h
Normal file
98
common/yacreader_global_gui.h
Normal 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
|
||||
|
@ -73,12 +73,12 @@ struct SevenZipInterface {
|
||||
|
||||
//SevenZipInterface * szInterface;
|
||||
|
||||
const char rar[7]={static_cast<char>(0x52), static_cast<char>(0x61), static_cast<char>(0x72), static_cast<char>(0x21), static_cast<char>(0x1A), static_cast<char>(0x07), static_cast<char>(0x00)};
|
||||
const char rar5[8]={static_cast<char>(0x52), static_cast<char>(0x61), static_cast<char>(0x72), static_cast<char>(0x21), static_cast<char>(0x1A), static_cast<char>(0x07), static_cast<char>(0x01), static_cast<char>(0x00)};
|
||||
const char zip[2]={static_cast<char>(0x50), static_cast<char>(0x4B)};
|
||||
const char sevenz[6]={static_cast<char>(0x37), static_cast<char>(0x7A), static_cast<char>(0xBC), static_cast<char>(0xAF), static_cast<char>(0x27), static_cast<char>(0x1C)};
|
||||
const char tar[6]="ustar";
|
||||
const char arj[2]={static_cast<char>(0x60), static_cast<char>(0xEA)};
|
||||
const unsigned char rar[7]={static_cast<unsigned char>(0x52), static_cast<unsigned char>(0x61), static_cast<unsigned char>(0x72), static_cast<unsigned char>(0x21), static_cast<unsigned char>(0x1A), static_cast<unsigned char>(0x07), static_cast<unsigned char>(0x00)};
|
||||
const unsigned char rar5[8]={static_cast<unsigned char>(0x52), static_cast<unsigned char>(0x61), static_cast<unsigned char>(0x72), static_cast<unsigned char>(0x21), static_cast<unsigned char>(0x1A), static_cast<unsigned char>(0x07), static_cast<unsigned char>(0x01), static_cast<unsigned char>(0x00)};
|
||||
const unsigned char zip[2]={static_cast<unsigned char>(0x50), static_cast<unsigned char>(0x4B)};
|
||||
const unsigned char sevenz[6]={static_cast<unsigned char>(0x37), static_cast<unsigned char>(0x7A), static_cast<unsigned char>(0xBC), static_cast<unsigned char>(0xAF), static_cast<unsigned char>(0x27), static_cast<unsigned char>(0x1C)};
|
||||
const unsigned char tar[6]="ustar";
|
||||
const unsigned char arj[2]={static_cast<unsigned char>(0x60), static_cast<unsigned char>(0xEA)};
|
||||
|
||||
CompressedArchive::CompressedArchive(const QString & filePath, QObject *parent) :
|
||||
QObject(parent),sevenzLib(0),valid(false),tools(false)
|
||||
@ -404,7 +404,7 @@ QVector<quint32> CompressedArchive::translateIndexes(const QVector<quint32> & in
|
||||
|
||||
foreach(quint32 i, indexes)
|
||||
{
|
||||
if(i < offsets.length())
|
||||
if(i < (quint32)offsets.length())
|
||||
translatedIndexes.append(offsets.at(i));
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "yacreader_library_list_widget.h"
|
||||
#include "yacreader_search_line_edit.h"
|
||||
#include "yacreader_titled_toolbar.h"
|
||||
|
||||
#include "yacreader_global_gui.h"
|
||||
|
||||
YACReaderSideBar::YACReaderSideBar(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
|
Reference in New Issue
Block a user