This commit is contained in:
Luis Ángel San Martín 2016-02-06 15:52:08 +01:00
commit ef21cf7c73
18 changed files with 438 additions and 177 deletions

View File

@ -8,17 +8,26 @@ make install
from the source dir. For seperate builds of YACReader or YACReaderLibrary, enter their respective subfolders and run the commands from there.
For the headless version of YACReaderLibrary enter the YACReaderLibrary folder and run:
qmake-qt5 YACReaderLibraryServer.pro
This will select the build config for the headless version instead of the gui version. You can then continue the build as described above.
Dependencies:
-----------------------
- Qt >= 5.3 with the following modules:
- declarative
- quickcontrols
- sql
- script
- multimedia
- imageformats
- opengl
- sql-sqlite
- network
- poppler-qt5
- qrencode
@ -26,9 +35,12 @@ Dependencies:
- glu
- a decompression backend, either 7zip or unarr (see below)
Please note that not all of these dependencies are needed at build time. A good example for this is YACReaderLibrary's GridView mode which will
silently fail and only show a white page if the proper qml modules (declarative, quickcontrols) are not installed.
Decompression backend:
---------------------------------------
--------------------------------------
YACReader supports two decompression backends:
@ -50,8 +62,9 @@ If you chose to build YACReader with p7zip as a backend on Linux/Unix, please ta
If your system already ships with p7zip > 9.20.1 you can place 7z.so and the Codecs folder with the Rar29.so from p7zip 9.20.1 in /usr/lib/yacreader
YACReader will check this folder first and can thus continue using 7zip as a backend with p7zip > 9.20.1 installed on your system.
Other build options:
---------------------
------------------------------
You can adjust the installation prefix as well als the path make install uses to install the files.
Use "qmake PREFIX=DIR" to configure YACReader for your systems default prefix (for example "/", "/usr", "/usr/local").
@ -67,7 +80,8 @@ On embedded devices that don't support desktop OpenGL, it is recommended to use
qmake CONFIG+=no_opengl
This will remove any dependency on desktop OpenGL and hardlock rendering to software.
This will remove any dependency on desktop OpenGL and hardlock YACReader's coverflow to software rendering. Please note that it
doesn't actually remove OpenGL from the build, the Qt toolkit will still make use of it.
DO YOU WANT TO HELP YACREADER?

View File

@ -11,25 +11,15 @@ NotificationsLabelWidget::NotificationsLabelWidget(QWidget * parent)
setAttribute(Qt::WA_LayoutUsesWidgetRect,true);
effect = new QGraphicsOpacityEffect(this);
effect->setOpacity(1.0);
effect2= new QGraphicsOpacityEffect(this);
effect->setOpacity(1.0);
effect->setOpacity(1.0);
anim = new QPropertyAnimation(effect,"opacity");
anim->setDuration(500);
anim->setStartValue(1.0);
anim->setEndValue(0.0);
anim->setStartValue(1.0);
anim->setEndValue(0.0);
anim->setEasingCurve(QEasingCurve::InExpo);
anim2 = new QPropertyAnimation(effect2,"opacity");
anim2->setDuration(500);
anim2->setStartValue(1.0);
anim2->setEndValue(0.0);
anim2->setEasingCurve(QEasingCurve::InExpo);
anim2->start();
connect(anim,SIGNAL(finished()),this,SLOT(hide()));
connect(anim,SIGNAL(finished()),this,SLOT(hide()));
textLabel = new QLabel(this);
textLabel->setAlignment(Qt::AlignVCenter|Qt::AlignHCenter);
@ -41,7 +31,6 @@ NotificationsLabelWidget::NotificationsLabelWidget(QWidget * parent)
//TODO check if the effects still be broken in OSX yet
#ifndef Q_OS_MAC
this->setGraphicsEffect(effect);
textLabel->setGraphicsEffect(effect2);
#endif
layout->addWidget(textLabel);
@ -66,9 +55,7 @@ void NotificationsLabelWidget::flash()
{
updatePosition();
anim->stop();
anim2->stop();
anim->start();
anim2->start();
setVisible(true);
}

View File

@ -13,9 +13,7 @@ Q_OBJECT
private:
QLabel * textLabel;
QPropertyAnimation * anim;
QPropertyAnimation * anim2;
QGraphicsOpacityEffect * effect;
QGraphicsOpacityEffect * effect2;
protected:
void paintEvent(QPaintEvent *);

View File

@ -14,21 +14,8 @@ INCLUDEPATH += ../common \
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
}
}
#do a basic dependency check
include(headless_config.pri)
win32 {
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -luser32
@ -144,13 +131,13 @@ DATADIR = $$PREFIX/share
DEFINES += "LIBDIR=\\\"$$LIBDIR\\\"" "DATADIR=\\\"$$DATADIR\\\"" "BINDIR=\\\"$$BINDIR\\\""
#MAKE INSTALL
INSTALLS += bin icon desktop server translation manpage
INSTALLS += bin server translation #manpage
bin.path = $$BINDIR
isEmpty(DESTDIR) {
bin.files = YACReaderLibrary
bin.files = YACReaderLibraryServer
} else {
bin.files = $$DESTDIR/YACReaderLibrary
bin.files = $$DESTDIR/YACReaderLibraryServer
}
server.path = $$DATADIR/yacreader
@ -159,6 +146,6 @@ server.files = ../release/server
translation.path = $$DATADIR/yacreader/languages
translation.files = ../release/languages/yacreaderlibrary_*
manpage.path = $$DATADIR/man/man1
manpage.files = ../YACReaderLibrary.1
#manpage.path = $$DATADIR/man/man1
#manpage.files = ../YACReaderLibrary.1
}

View File

@ -10,12 +10,54 @@
#include "comic_files_manager.h"
#include "QsLog.h"
void testListView(QListView * l)
{
QStringListModel * slm = new QStringListModel(QStringList() << "Lorem ipsum" << "Hailer skualer"<< "Mumbaluba X" << "Finger layden" << "Pacum tactus filer" << "Aposum" << "En" << "Lorem ipsum" << "Hailer skualer" << "Mumbaluba X" << "Finger layden" << "Pacum tactus filer" << "Aposum" << "En" );
l->setModel(slm);
}
class ListviewDelegate : public QStyledItemDelegate
{
public:
ListviewDelegate() : QStyledItemDelegate() {}
virtual ~ListviewDelegate() {}
void paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
painter->save();
QFontMetrics fm(option.font);
QString text = qvariant_cast<QString>(index.data(Qt::DisplayRole));
QRect textRect = option.rect;
textRect.setLeft(std::max(0, (option.rect.size().width() - fm.width(text)) / 2));
painter->drawText(textRect,text);
painter->restore();
//TODO add mouse hover style ??
}
QSize sizeHint(const QStyleOptionViewItem &option,
const QModelIndex &index ) const
{
QFontMetrics fm(option.font);
QString text = qvariant_cast<QString>(index.data(Qt::DisplayRole));
return QSize(fm.width(text),fm.height());
}
};
EmptyFolderWidget::EmptyFolderWidget(QWidget *parent) :
EmptyContainerInfo(parent),subfoldersModel(new QStringListModel())
{
@ -25,9 +67,8 @@ EmptyFolderWidget::EmptyFolderWidget(QWidget *parent) :
titleLabel->setText(tr("Subfolders in this folder"));
foldersView = new QListView();
foldersView->setMinimumWidth(282);
//foldersView->setWrapping(true);
foldersView->setAttribute(Qt::WA_MacShowFocusRect,false);
foldersView->setItemDelegate(new ListviewDelegate);
#ifdef Q_OS_MAC
foldersView->setStyleSheet("QListView {background-color:transparent; border: none; color:#959595; outline:0; font-size: 18px; show-decoration-selected: 0; margin:0}"
"QListView::item:selected {background-color: #EFEFEF; color:#CCCCCC;}"
@ -65,10 +106,9 @@ EmptyFolderWidget::EmptyFolderWidget(QWidget *parent) :
#endif
foldersView->setSizePolicy(QSizePolicy ::Expanding , QSizePolicy ::Expanding );
testListView(foldersView);
layout->addSpacing(12);
layout->addWidget(foldersView,1,Qt::AlignHCenter);
layout->addWidget(foldersView,1);
layout->addStretch();
layout->setMargin(0);
layout->setSpacing(0);

View File

@ -39,7 +39,6 @@ GridComicsView::GridComicsView(QWidget *parent) :
container->setMinimumSize(200, 200);
container->setFocusPolicy(Qt::TabFocus);
view->setSource(QUrl("qrc:/qml/GridComicsView.qml"));
createCoverSizeSliderWidget();
@ -81,6 +80,25 @@ GridComicsView::GridComicsView(QWidget *parent) :
ctxt->setContextProperty("fontSpacing", 0.5);
#endif
ctxt->setContextProperty("backgroundImage", QUrl());
ctxt->setContextProperty("backgroundBlurOpacity", 0.0);
ctxt->setContextProperty("backgroundBlurRadius", 0.0);
ctxt->setContextProperty("backgroundBlurVisible", false);
ComicModel *model = new ComicModel();
QItemSelectionModel *selectionModel = new QItemSelectionModel(model);
ctxt->setContextProperty("comicsList", model);
ctxt->setContextProperty("comicsSelection", selectionModel);
ctxt->setContextProperty("contextMenuHelper",this);
ctxt->setContextProperty("comicsSelectionHelper", this);
ctxt->setContextProperty("comicRatingHelper", this);
ctxt->setContextProperty("dummyValue", true);
ctxt->setContextProperty("dragManager", this);
ctxt->setContextProperty("dropManager", this);
view->setSource(QUrl("qrc:/qml/GridComicsView.qml"));
setShowMarks(true);//TODO save this in settings
QVBoxLayout * l = new QVBoxLayout;
@ -179,16 +197,18 @@ void GridComicsView::updateBackgroundConfig()
float opacity = settings->value(OPACITY_BACKGROUND_IMAGE_IN_GRID_VIEW, 0.2).toFloat();
float blurRadius = settings->value(BLUR_RADIUS_BACKGROUND_IMAGE_IN_GRID_VIEW, 75).toInt();
ctxt->setContextProperty("backgroundImage", this->model->data(this->model->index(0, 0), ComicModel::CoverPathRole));
int row = settings->value(USE_SELECTED_COMIC_COVER_AS_BACKGROUND_IMAGE_IN_GRID_VIEW, false).toBool() ? currentIndex().row() : 0;
ctxt->setContextProperty("backgroundImage", this->model->data(this->model->index(row, 0), ComicModel::CoverPathRole));
ctxt->setContextProperty("backgroundBlurOpacity", opacity);
ctxt->setContextProperty("backgroundBlurRadius", blurRadius);
ctxt->setContextProperty("backgroundBlurVisible", true);
}
else
{
ctxt->setContextProperty("backgroundImage", QVariant());
ctxt->setContextProperty("backgroundBlurOpacity", 0);
ctxt->setContextProperty("backgroundBlurRadius", 0);
ctxt->setContextProperty("backgroundImage", QUrl());
ctxt->setContextProperty("backgroundBlurOpacity", 0.0);
ctxt->setContextProperty("backgroundBlurRadius", 0.0);
ctxt->setContextProperty("backgroundBlurVisible", false);
}
@ -206,16 +226,27 @@ void GridComicsView::setCurrentIndex(const QModelIndex &index)
_selectionModel->clear();
_selectionModel->select(index, QItemSelectionModel::Select | QItemSelectionModel::Rows);
view->rootContext()->setContextProperty("dummyValue", true);
if(settings->value(USE_SELECTED_COMIC_COVER_AS_BACKGROUND_IMAGE_IN_GRID_VIEW, false).toBool())
updateBackgroundConfig();
}
QModelIndex GridComicsView::currentIndex()
{
if(!_selectionModel)
return QModelIndex();
QModelIndexList indexes = _selectionModel->selectedRows();
if(indexes.length()>0)
return indexes[0];
this->selectIndex(0);
return _selectionModel->selectedRows()[0];
indexes = _selectionModel->selectedRows();
if(indexes.length()>0)
return indexes[0];
else
return QModelIndex();
}
QItemSelectionModel *GridComicsView::selectionModel()

View File

@ -56,6 +56,28 @@ void ConsoleUILibraryCreator::updateLibrary(const QString & path)
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++;

View File

@ -10,6 +10,8 @@ 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;

View File

@ -108,7 +108,7 @@ int main( int argc, char ** argv )
{
QCoreApplication *app = new QCoreApplication(argc, argv);
app->setApplicationName("YACReaderLibraryServer");
app->setApplicationName("YACReaderLibrary");
app->setOrganizationName("YACReader");
app->setApplicationVersion(VERSION);
@ -119,7 +119,7 @@ int main( int argc, char ** argv )
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, list-libraries]");
parser.addPositionalArgument("command", "The command to execute. [start, create-library, update-library, add-library, remove-library, list-libraries]");
parser.parse(QCoreApplication::arguments());
@ -128,7 +128,71 @@ int main( int argc, char ** argv )
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")
{
@ -185,6 +249,61 @@ int main( int argc, char ** argv )
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();
@ -196,71 +315,7 @@ int main( int argc, char ** argv )
else //error
{
parser.showHelp();
}
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;
}

View File

@ -0,0 +1,71 @@
#functions to automatically initialize some of YACReader's build options to
#default values if they're not set on build time
#for a more detailed description, see INSTALL.TXT
#check Qt version
QT_VERSION = $$[QT_VERSION]
QT_VERSION = $$split(QT_VERSION, ".")
QT_VER_MAJ = $$member(QT_VERSION, 0)
QT_VER_MIN = $$member(QT_VERSION, 1)
lessThan(QT_VER_MAJ, 5) {
error(YACReader requires Qt 5 or newer but Qt $$[QT_VERSION] was detected.)
}
lessThan(QT_VER_MIN, 3){
error ("You need at least Qt 5.3 to build YACReader or YACReaderLibrary")
}
!CONFIG(unarr):!CONFIG(7zip) {
unix {
!macx {
CONFIG+=unarr
}
else {
CONFIG+=7zip
}
}
win32 {
CONFIG+=7zip
}
}
unix {
!macx {
packagesExist(QtCore) {
message("Found QtCore")
}
else: {
error("Missing dependency: QtCore")
}
packagesExist(QtGui) {
message("Found QtGui")
}
else: {
error("Missing dependency: QtGui")
}
packagesExist(poppler-qt5) {
message("Found poppler-qt5")
}
else: {
error("Missing dependency: poppler-qt5")
}
packagesExist(QtNetwork) {
message("Found QtNetwork")
}
else: {
error("Missing dependency: QtNetwork")
}
packagesExist(QtSql) {
message("Found QtSql")
}
else: {
error("Missing dependency: QtSql")
}
packagesExist(sqlite3) {
message("Found sqlite3")
}
else: {
error("Missing dependency: sqlite3")
}
}
}

View File

@ -155,7 +155,7 @@ int main( int argc, char ** argv )
app.setApplicationName("YACReaderLibrary");
app.setOrganizationName("YACReader");
app.setApplicationName(VERSION);
app.setApplicationVersion(VERSION);
app.setAttribute(Qt::AA_UseHighDpiPixmaps);

View File

@ -63,12 +63,18 @@ OptionsDialog::OptionsDialog(QWidget * parent)
backgroundImageBlurRadiusSlider = new QSlider(Qt::Horizontal);
backgroundImageBlurRadiusSlider->setRange(0,100);
useCurrentComicCoverCheck = new QCheckBox(tr("Use selectec comic cover as background"));
resetButton = new QPushButton(tr("Restore defautls"));
QVBoxLayout * gridBackgroundLayout = new QVBoxLayout();
gridBackgroundLayout->addWidget(useBackgroundImageCheck);
gridBackgroundLayout->addWidget(opacityLabel);
gridBackgroundLayout->addWidget(backgroundImageOpacitySlider);
gridBackgroundLayout->addWidget(blurLabel);
gridBackgroundLayout->addWidget(backgroundImageBlurRadiusSlider);
gridBackgroundLayout->addWidget(useCurrentComicCoverCheck);
gridBackgroundLayout->addWidget(resetButton,0,Qt::AlignRight);
QGroupBox * gridBackgroundGroup = new QGroupBox(tr("Background"));
gridBackgroundGroup->setLayout(gridBackgroundLayout);
@ -79,6 +85,8 @@ OptionsDialog::OptionsDialog(QWidget * parent)
connect(useBackgroundImageCheck, SIGNAL(clicked(bool)), this, SLOT(useBackgroundImageCheckClicked(bool)));
connect(backgroundImageOpacitySlider, SIGNAL(valueChanged(int)), this, SLOT(backgroundImageOpacitySliderChanged(int)));
connect(backgroundImageBlurRadiusSlider, SIGNAL(valueChanged(int)), this, SLOT(backgroundImageBlurRadiusSliderChanged(int)));
connect(useCurrentComicCoverCheck, &QCheckBox::clicked, this, &OptionsDialog::useCurrentComicCoverCheckClicked);
connect(resetButton, &QPushButton::clicked, this, &OptionsDialog::resetToDefaults);
//end grid view background config
QWidget * comicFlowW = new QWidget;
@ -125,11 +133,13 @@ void OptionsDialog::restoreOptions(QSettings * settings)
useBackgroundImageCheck->setChecked(useBackgroundImage);
backgroundImageOpacitySlider->setValue(settings->value(OPACITY_BACKGROUND_IMAGE_IN_GRID_VIEW, 0.2).toFloat()*100);
backgroundImageBlurRadiusSlider->setValue(settings->value(BLUR_RADIUS_BACKGROUND_IMAGE_IN_GRID_VIEW, 75).toInt());
useCurrentComicCoverCheck->setChecked(settings->value(USE_SELECTED_COMIC_COVER_AS_BACKGROUND_IMAGE_IN_GRID_VIEW, false).toBool());
backgroundImageOpacitySlider->setVisible(useBackgroundImage);
backgroundImageBlurRadiusSlider->setVisible(useBackgroundImage);
opacityLabel->setVisible(useBackgroundImage);
blurLabel->setVisible(useBackgroundImage);
useCurrentComicCoverCheck->setVisible(useBackgroundImage);
}
void OptionsDialog::useBackgroundImageCheckClicked(bool checked)
@ -140,6 +150,7 @@ void OptionsDialog::useBackgroundImageCheckClicked(bool checked)
backgroundImageBlurRadiusSlider->setVisible(checked);
opacityLabel->setVisible(checked);
blurLabel->setVisible(checked);
useCurrentComicCoverCheck->setVisible(checked);
emit optionsChanged();
}
@ -157,3 +168,21 @@ void OptionsDialog::backgroundImageBlurRadiusSliderChanged(int value)
emit optionsChanged();
}
void OptionsDialog::useCurrentComicCoverCheckClicked(bool checked)
{
settings->setValue(USE_SELECTED_COMIC_COVER_AS_BACKGROUND_IMAGE_IN_GRID_VIEW, checked);
emit optionsChanged();
}
void OptionsDialog::resetToDefaults()
{
settings->setValue(OPACITY_BACKGROUND_IMAGE_IN_GRID_VIEW, 0.2);
settings->setValue(BLUR_RADIUS_BACKGROUND_IMAGE_IN_GRID_VIEW, 75);
settings->setValue(USE_SELECTED_COMIC_COVER_AS_BACKGROUND_IMAGE_IN_GRID_VIEW, false);
restoreOptions(settings);
emit optionsChanged();
}

View File

@ -23,12 +23,16 @@ Q_OBJECT
void useBackgroundImageCheckClicked(bool checked);
void backgroundImageOpacitySliderChanged(int value);
void backgroundImageBlurRadiusSliderChanged(int value);
void useCurrentComicCoverCheckClicked(bool checked);
void resetToDefaults();
private:
QCheckBox * useBackgroundImageCheck;
QCheckBox * useCurrentComicCoverCheck;
QSlider * backgroundImageOpacitySlider;
QSlider * backgroundImageBlurRadiusSlider;
QLabel * opacityLabel;
QLabel * blurLabel;
QPushButton * resetButton;
};

View File

@ -314,10 +314,10 @@ Rectangle {
}
YACReaderScrollView {
__wheelAreaScrollSpeed: grid.cellHeight * 0.30
id: scrollView
anchors.fill: parent
anchors.margins: 0
//QTBUG-39453
//Another fu%$·#& bug in Qt
//https://bugreports.qt.io/browse/QTBUG-39453
@ -373,7 +373,7 @@ Rectangle {
objectName: "grid"
anchors.fill: parent
cellHeight: cellCustomHeight
highlight: appHighlight
//highlight: appHighlight
focus: true
model: comicsList
delegate: appDelegate
@ -432,7 +432,7 @@ Rectangle {
var rest = width - (cWidth * wholeCells)
grid.cellWidth = cWidth + Math.floor(rest / wholeCells);
console.log("cWidth",cWidth,"wholeCells=",wholeCells,"rest=",rest,"cellWidth=",cellWidth,"width=",width);
//console.log("cWidth",cWidth,"wholeCells=",wholeCells,"rest=",rest,"cellWidth=",cellWidth,"width=",width);
}
}

View File

@ -1,38 +1,34 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Quick Controls module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
** of its contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPLv3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl.html.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or later as published by the Free
** Software Foundation and appearing in the file LICENSE.GPL included in
** the packaging of this file. Please review the following information to
** ensure the GNU General Public License version 2.0 requirements will be
** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
@ -50,6 +46,8 @@ import QtQuick.Controls.Styles 1.1
\ingroup views
\brief Provides a scrolling view within another Item.
\image scrollview.png
A ScrollView can be used either to replace a \l Flickable or decorate an
existing \l Flickable. Depending on the platform, it will add scroll bars and
a content frame.
@ -81,7 +79,7 @@ import QtQuick.Controls.Styles 1.1
\l flickableItem.
You can create a custom appearance for a ScrollView by
assigning a \l {QtQuick.Controls.Styles::ScrollViewStyle}{ScrollViewStyle}.
assigning a \l {ScrollViewStyle}.
*/
FocusScope {
@ -98,6 +96,36 @@ FocusScope {
*/
property bool frameVisible: false
/*! \qmlproperty enumeration ScrollView::horizontalScrollBarPolicy
\since QtQuick.Controls 1.3
This property holds the policy for showing the horizontal scrollbar.
It can be any of the following values:
\list
\li Qt.ScrollBarAsNeeded
\li Qt.ScrollBarAlwaysOff
\li Qt.ScrollBarAlwaysOn
\endlist
The default policy is \c Qt.ScrollBarAsNeeded.
*/
property alias horizontalScrollBarPolicy: scroller.horizontalScrollBarPolicy
/*! \qmlproperty enumeration ScrollView::verticalScrollBarPolicy
\since QtQuick.Controls 1.3
This property holds the policy for showing the vertical scrollbar.
It can be any of the following values:
\list
\li Qt.ScrollBarAsNeeded
\li Qt.ScrollBarAlwaysOff
\li Qt.ScrollBarAlwaysOn
\endlist
The default policy is \c Qt.ScrollBarAsNeeded.
*/
property alias verticalScrollBarPolicy: scroller.verticalScrollBarPolicy
/*!
This property controls if there should be a highlight
around the frame when the ScrollView has input focus.
@ -152,7 +180,7 @@ FocusScope {
\sa {Qt Quick Controls Styles QML Types}
*/
property Component style: Qt.createComponent(Settings.style + "/ScrollViewStyle.qml", root)
property Component style: Settings.styleComponent(Settings.style, "ScrollViewStyle.qml", root)
/*! \internal */
property Style __style: styleLoader.item
@ -160,7 +188,7 @@ FocusScope {
activeFocusOnTab: true
onContentItemChanged: {
//console.log("onContentItemChanged");
if (contentItem.hasOwnProperty("contentY") && // Check if flickable
contentItem.hasOwnProperty("contentHeight")) {
internal.flickableItem = contentItem // "Use content if it is a flickable
@ -208,14 +236,12 @@ FocusScope {
target: flickableItem
onContentYChanged: {
//console.log("onContentYChanged2");
scroller.blockUpdates = true
scroller.verticalScrollBar.value = flickableItem.contentY
scroller.blockUpdates = false
}
onContentXChanged: {
//console.log("onContentXChanged2");
scroller.blockUpdates = true
scroller.horizontalScrollBar.value = flickableItem.contentX
scroller.blockUpdates = false
@ -233,13 +259,11 @@ FocusScope {
WheelArea {
id: wheelArea
parent: flickableItem
z: -1
// ### Note this is needed due to broken mousewheel behavior in Flickable.
anchors.fill: parent
property int stepSize: 295
property int acceleration: 40
property int flickThreshold: Settings.dragThreshold
property real speedThreshold: 3
@ -255,17 +279,21 @@ FocusScope {
verticalMinimumValue: flickableItem ? flickableItem.originY : 0
verticalMaximumValue: flickableItem ? flickableItem.originY + flickableItem.contentHeight - viewport.height + __viewTopMargin : 0
// The default scroll speed for typical angle-based mouse wheels. The value
// comes originally from QTextEdit, which sets 20px steps by default, as well as
// QQuickWheelArea.
// TODO: centralize somewhere, QPlatformTheme?
scrollSpeed: 20 * (__style.__wheelScrollLines || 1)
Connections {
target: flickableItem
onContentYChanged: {
//console.log("onContentYChanged");
wheelArea.verticalRecursionGuard = true
wheelArea.verticalValue = flickableItem.contentY
wheelArea.verticalRecursionGuard = false
}
onContentXChanged: {
//console.log("onContentXChanged");
wheelArea.horizontalRecursionGuard = true
wheelArea.horizontalValue = flickableItem.contentX
wheelArea.horizontalRecursionGuard = false
@ -280,14 +308,8 @@ FocusScope {
- flickThreshold - viewport.height && verticalDelta < -speedThreshold) {
flickableItem.flick(ignored, Math.max(-maxFlick, acceleration * verticalDelta))
} else {
var absDelta = Math.abs(verticalDelta);
if(verticalDelta < 0)
flickableItem.contentY = Math.min(verticalMaximumValue, verticalValue + Math.min(98,0.93*absDelta+4.5));
else
flickableItem.contentY = Math.max(0, verticalValue - Math.min(98,0.93*absDelta+4.5));
flickableItem.contentY = verticalValue
}
flickableItem.contentY = Math.min(verticalMaximumValue, Math.max(0, flickableItem.contentY));
}
}

View File

@ -10,10 +10,10 @@
#include <QNetworkRequest>
#include <QNetworkReply>
#define PREVIOUS_VERSION "6.0.0"
#define PREVIOUS_VERSION_TESTING "6.0.0"
HttpVersionChecker::HttpVersionChecker()
:HttpWorker("https://bitbucket.org/luisangelsm/yacreader/wiki/Home")
:HttpWorker("https://bitbucket.org/luisangelsm/yacreader/wiki/Home")
{
connect(this,SIGNAL(dataReady(const QByteArray &)),this,SLOT(checkNewVersion(const QByteArray &)));
}
@ -26,15 +26,15 @@ void HttpVersionChecker::checkNewVersion(const QByteArray & data)
bool HttpVersionChecker::checkNewVersion(QString sourceContent)
{
#ifdef Q_OS_WIN32
QRegExp rx(".*YACReader\\-([0-9]+).([0-9]+).([0-9]+)\\.?([0-9]+)?.{0,5}win32.*");
QRegExp rx("YACReader\\-([0-9]+).([0-9]+).([0-9]+)\\.?([0-9]+)?.{0,5}win32");
#endif
#if defined Q_OS_UNIX && !defined Q_OS_MAC
QRegExp rx(".*YACReader\\-([0-9]+).([0-9]+).([0-9]+)\\.?([0-9]+)?.{0,5}X11.*");
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.*");
QRegExp rx("YACReader\\-([0-9]+).([0-9]+).([0-9]+)\\.?([0-9]+)?.{0,5}Mac");
#endif
int index = 0;
@ -42,9 +42,9 @@ bool HttpVersionChecker::checkNewVersion(QString sourceContent)
bool sameVersion = true;
//bool currentVersionIsNewer = false;
#ifdef QT_DEBUG
QString version(PREVIOUS_VERSION);
QString version(PREVIOUS_VERSION_TESTING);
#else
QString version(VERSION);
QString version(VERSION);
#endif
QStringList sl = version.split(".");
if((index = rx.indexIn(sourceContent))!=-1)
@ -68,8 +68,6 @@ bool HttpVersionChecker::checkNewVersion(QString sourceContent)
if((sl.size()==3)&&(rx.cap(4)!=""))
newVersion = true;
}
}
if(newVersion == true)

View File

@ -12,6 +12,7 @@
#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"
#define USE_SELECTED_COMIC_COVER_AS_BACKGROUND_IMAGE_IN_GRID_VIEW "USE_SELECTED_COMIC_COVER_AS_BACKGROUND_IMAGE_IN_GRID_VIEW"
#define NUM_DAYS_BETWEEN_VERSION_CHECKS "NUM_DAYS_BETWEEN_VERSION_CHECKS"
#define LAST_VERSION_CHECK "LAST_VERSION_CHECK"

View File

@ -20,7 +20,7 @@ HEADERS+=$$PWD/unarr-master/common/allocator.h\
$$PWD/unarr-master/lzmasdk/Ppmd.h\
$$PWD/unarr-master/lzmasdk/LzmaDec.h\
$$PWD/unarr-master/lzmasdk/Ppmd8.h\
$$PWD/unarr-master/lzmasdk/Types.h\
$$PWD/unarr-master/lzmasdk/7zTypes.h\
$$PWD/unarr-master/tar/tar.h\
$$PWD/unarr-master/_7z/_7z.h\
$$PWD/unarr-master/unarr.h