diff --git a/application/sources/component_preview_images_decorator.cc b/application/sources/component_preview_images_decorator.cc index 9478539f..790b37a4 100644 --- a/application/sources/component_preview_images_decorator.cc +++ b/application/sources/component_preview_images_decorator.cc @@ -20,16 +20,17 @@ void ComponentPreviewImagesDecorator::decorate() m_resultImages = std::make_unique>>(); + QPointF iconOffset(Theme::previewIconMargin, 0); for (auto &it: *m_previewInputs) { if (it.isDirectory) { QPainter painter(it.image.get()); painter.setRenderHints(QPainter::Antialiasing); QPolygonF polygon; - polygon << QPointF(it.image->width() / 4, 0.0) << QPointF(it.image->width() / 2.5, 0.0); - polygon << QPointF(0.0, it.image->height() / 2.5) << QPointF(0.0, it.image->height() / 4); + polygon << iconOffset + QPointF(it.image->width() / 4, 0) << iconOffset + QPointF(it.image->width() / 2, 0); + polygon << iconOffset + QPointF(0.0, it.image->height() / 2) << iconOffset + QPointF(0.0, it.image->height() / 4); QPainterPath painterPath; painterPath.addPolygon(polygon); - painter.setBrush(Theme::white); + painter.setBrush(Theme::green); painter.setPen(Qt::NoPen); painter.drawPath(painterPath); } diff --git a/application/sources/preview_grid_view.cc b/application/sources/preview_grid_view.cc index afd352a0..b27cc09d 100644 --- a/application/sources/preview_grid_view.cc +++ b/application/sources/preview_grid_view.cc @@ -9,9 +9,9 @@ PreviewGridView::PreviewGridView(QWidget *parent): viewPalette.setColor(QPalette::Base, Qt::transparent); setPalette(viewPalette); - auto borderSize = std::max(1, Theme::partPreviewImageSize / 20); - auto margin = std::max(1, borderSize / 2); - auto borderRadius = std::max(3, Theme::partPreviewImageSize / 10); + auto borderSize = Theme::previewIconBorderSize; + auto margin = Theme::previewIconMargin; + auto borderRadius = Theme::previewIconBorderRadius; setStyleSheet( "QListView::item {border:" + QString::number(borderSize) + "px solid transparent; margin:" + QString::number(margin) + "px; background-color: " + Theme::gray.name() +"; border-radius: " + QString::number(borderRadius) + ";}" + "QListView::item:selected {border-color: " + Theme::red.name() + ";}" diff --git a/application/sources/theme.cc b/application/sources/theme.cc index b1b3373a..06e1470a 100644 --- a/application/sources/theme.cc +++ b/application/sources/theme.cc @@ -22,6 +22,9 @@ int Theme::miniIconSize = 0; int Theme::partPreviewImageSize = 0; int Theme::materialPreviewImageSize = 0; int Theme::sidebarPreferredWidth = 0; +int Theme::previewIconBorderSize = 0; +int Theme::previewIconMargin = 0; +int Theme::previewIconBorderRadius = 0; void Theme::initialize() { @@ -55,6 +58,9 @@ void Theme::initialize() Theme::partPreviewImageSize = (Theme::miniIconSize * 2); Theme::sidebarPreferredWidth = Theme::partPreviewImageSize * 4.5; Theme::materialPreviewImageSize = Theme::sidebarPreferredWidth * 0.4; + Theme::previewIconBorderSize = std::max(1, Theme::partPreviewImageSize / 20); + Theme::previewIconMargin = std::max(1, Theme::previewIconBorderSize / 2); + Theme::previewIconBorderRadius = std::max(3, Theme::partPreviewImageSize / 10); } QtAwesome *Theme::awesome() diff --git a/application/sources/theme.h b/application/sources/theme.h index 37043e77..05e7ee37 100644 --- a/application/sources/theme.h +++ b/application/sources/theme.h @@ -28,6 +28,9 @@ public: static int partPreviewImageSize; static int materialPreviewImageSize; static int sidebarPreferredWidth; + static int previewIconBorderSize; + static int previewIconMargin; + static int previewIconBorderRadius; static void initialize(); static QtAwesome *awesome();