| 198 | } |
| 199 | |
| 200 | void GridComicsView::updateBackgroundConfig() |
| 201 | { |
| 202 | if (this->model == NULL) |
| 203 | return; |
| 204 | |
| 205 | QQmlContext *ctxt = view->rootContext(); |
| 206 | |
| 207 | // backgroun image configuration |
| 208 | bool useBackgroundImage = settings->value(USE_BACKGROUND_IMAGE_IN_GRID_VIEW, true).toBool(); |
| 209 | |
| 210 | if (useBackgroundImage && this->model->rowCount() > 0) { |
| 211 | float opacity = settings->value(OPACITY_BACKGROUND_IMAGE_IN_GRID_VIEW, 0.2).toFloat(); |
| 212 | float blurRadius = settings->value(BLUR_RADIUS_BACKGROUND_IMAGE_IN_GRID_VIEW, 75).toInt(); |
| 213 | |
| 214 | int row = settings->value(USE_SELECTED_COMIC_COVER_AS_BACKGROUND_IMAGE_IN_GRID_VIEW, false).toBool() ? currentIndex().row() : 0; |
| 215 | |
| 216 | ctxt->setContextProperty("backgroundImage", this->model->data(this->model->index(row, 0), ComicModel::CoverPathRole)); |
| 217 | ctxt->setContextProperty("backgroundBlurOpacity", opacity); |
| 218 | ctxt->setContextProperty("backgroundBlurRadius", blurRadius); |
| 219 | ctxt->setContextProperty("backgroundBlurVisible", true); |
| 220 | } else { |
| 221 | ctxt->setContextProperty("backgroundImage", QUrl()); |
| 222 | ctxt->setContextProperty("backgroundBlurOpacity", 0.0); |
| 223 | ctxt->setContextProperty("backgroundBlurRadius", 0.0); |
| 224 | ctxt->setContextProperty("backgroundBlurVisible", QVariant(false)); |
| 225 | } |
| 226 | |
| 227 | // Use theme colors for cell and selected colors |
| 228 | const auto &giv = theme.gridAndInfoView; |
| 229 | ctxt->setContextProperty("backgroundColor", useBackgroundImage ? giv.backgroundBlurOverlayColor : giv.backgroundColor); |
| 230 | ctxt->setContextProperty("cellColor", useBackgroundImage ? giv.cellColorWithBackground : giv.cellColor); |
| 231 | ctxt->setContextProperty("cellSelectedColor", giv.cellSelectedColor); |
| 232 | } |
| 233 | |
| 234 | void GridComicsView::showInfo() |
| 235 | { |