mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Added support for showing the first cover of a folder as the background image in the grid view. The setting strings have been added too, but by now they are not written, only the defaults are read when the folder's content is loaded.
This commit is contained in:
parent
2bc9f88400
commit
de59cbd9e3
@ -160,6 +160,37 @@ void GridComicsView::setModel(ComicModel *model)
|
||||
ctxt->setContextProperty("dragManager", this);
|
||||
ctxt->setContextProperty("dropManager", this);
|
||||
|
||||
|
||||
//backgroun image configuration
|
||||
bool useBackgroundImage = settings->value(USE_BACKGROUND_IMAGE_IN_GRID_VIEW, true).toBool();
|
||||
|
||||
if(useBackgroundImage)
|
||||
{
|
||||
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).toFloat();
|
||||
|
||||
ctxt->setContextProperty("backgroundImage", this->model->data(this->model->index(0, 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("backgroundBlurVisible", false);
|
||||
}
|
||||
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
ctxt->setContextProperty("cellColor", useBackgroundImage?"#99FFFFFF":"#FFFFFF");
|
||||
ctxt->setContextProperty("selectedColor", "#FFFFFF");
|
||||
#else
|
||||
ctxt->setContextProperty("cellColor", useBackgroundImage?"#99212121":"#212121");
|
||||
ctxt->setContextProperty("selectedColor", "#121212");
|
||||
#endif
|
||||
|
||||
if(model->rowCount()>0)
|
||||
setCurrentIndex(model->index(0,0));
|
||||
}
|
||||
|
@ -2,9 +2,33 @@ import QtQuick 2.3
|
||||
|
||||
import QtQuick.Controls 1.2
|
||||
import comicModel 1.0
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
Rectangle {
|
||||
id: main
|
||||
clip: true
|
||||
|
||||
Image {
|
||||
id: backgroundImg
|
||||
anchors.fill: parent
|
||||
source: backgroundImage
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
smooth: true
|
||||
mipmap: true
|
||||
asynchronous : true
|
||||
cache: false //TODO clear cache only when it is needed
|
||||
opacity: 0
|
||||
visible: false
|
||||
}
|
||||
|
||||
FastBlur {
|
||||
anchors.fill: backgroundImg
|
||||
source: backgroundImg
|
||||
radius: backgroundBlurRadius
|
||||
opacity: backgroundBlurOpacity
|
||||
visible: backgroundBlurVisible
|
||||
}
|
||||
|
||||
color: backgroundColor
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
@ -25,7 +49,7 @@ Rectangle {
|
||||
id: cell
|
||||
width: grid.cellWidth
|
||||
height: grid.cellHeight
|
||||
color: backgroundColor
|
||||
color: "#00000000"
|
||||
|
||||
|
||||
Rectangle {
|
||||
@ -54,7 +78,6 @@ Rectangle {
|
||||
color: ((dummyValue || !dummyValue) && comicsSelectionHelper.isSelectedIndex(index))?selectedColor:cellColor;
|
||||
border.color: ((dummyValue || !dummyValue) && comicsSelectionHelper.isSelectedIndex(index))?selectedBorderColor:borderColor;
|
||||
border.width: (Qt.platform.os === "osx")?1:0;
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
MouseArea {
|
||||
@ -367,7 +390,7 @@ Rectangle {
|
||||
footer: Rectangle { //fix for the scroll issue, TODO find what causes the issue (some times the bottoms cells are hidden for the toolbar, no full scroll)
|
||||
height : 25
|
||||
width : parent.width
|
||||
color : backgroundColor
|
||||
color : "#00000000"
|
||||
}
|
||||
|
||||
move: Transition {
|
||||
|
@ -62,6 +62,10 @@
|
||||
#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"
|
||||
|
||||
#define NUM_DAYS_BETWEEN_VERSION_CHECKS "NUM_DAYS_BETWEEN_VERSION_CHECKS"
|
||||
#define LAST_VERSION_CHECK "LAST_VERSION_CHECK"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user