diff --git a/0001-fix-sidebar-display-error-and-search-issue.patch b/0001-fix-sidebar-display-error-and-search-issue.patch new file mode 100644 index 0000000000000000000000000000000000000000..7d374750d24d1483a703b2a1b0e348ea311da153 --- /dev/null +++ b/0001-fix-sidebar-display-error-and-search-issue.patch @@ -0,0 +1,311 @@ +From 52a9554710664adf59cc742c6340ca1ea8d20a78 Mon Sep 17 00:00:00 2001 +From: dou33 +Date: Wed, 27 Oct 2021 15:27:16 +0800 +Subject: [PATCH] fix sidebar display error and search issue + +--- + .../delegate/icon-view-delegate.cpp | 6 +- + .../delegate/icon-view-delegate.h | 2 +- + .../file-launcher/file-lauch-dialog.cpp | 3 + + .../model/side-bar-file-system-item.cpp | 4 +- + .../vfs/peony-search-vfs-file-enumerator.cpp | 2 +- + .../desktop-icon-view-delegate.cpp | 56 +++++++++++++---- + peony-qt-desktop/desktop-index-widget.cpp | 61 +++++++++++++++---- + src/control/navigation-side-bar.cpp | 11 ++++ + 8 files changed, 117 insertions(+), 28 deletions(-) + +diff --git a/libpeony-qt/controls/directory-view/delegate/icon-view-delegate.cpp b/libpeony-qt/controls/directory-view/delegate/icon-view-delegate.cpp +index f5f5fd6..080bee1 100755 +--- a/libpeony-qt/controls/directory-view/delegate/icon-view-delegate.cpp ++++ b/libpeony-qt/controls/directory-view/delegate/icon-view-delegate.cpp +@@ -381,7 +381,7 @@ QSize IconViewTextHelper::getTextSizeForIndex(const QStyleOptionViewItem &option + return QSize(fixedWidth, textHight); + } + +-void IconViewTextHelper::paintText(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index, int textMaxHeight, int horizalMargin, int maxLineCount, bool useSystemPalette) ++void IconViewTextHelper::paintText(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index, int textMaxHeight, int horizalMargin, int maxLineCount, bool useSystemPalette, const QColor &customColor) + { + painter->save(); + painter->translate(horizalMargin, 0); +@@ -393,6 +393,10 @@ void IconViewTextHelper::paintText(QPainter *painter, const QStyleOptionViewItem + painter->setPen(option.palette.text().color()); + } + ++ if (customColor != Qt::transparent) { ++ painter->setPen(customColor); ++ } ++ + int lineCount = 0; + + QString text = option.text; +diff --git a/libpeony-qt/controls/directory-view/delegate/icon-view-delegate.h b/libpeony-qt/controls/directory-view/delegate/icon-view-delegate.h +index 213f700..bf80df8 100755 +--- a/libpeony-qt/controls/directory-view/delegate/icon-view-delegate.h ++++ b/libpeony-qt/controls/directory-view/delegate/icon-view-delegate.h +@@ -98,7 +98,7 @@ class PEONYCORESHARED_EXPORT IconViewTextHelper + const QModelIndex &index, + int textMaxHeight, + int horizalMargin = 0, +- int maxLineCount = 0, bool useSystemPalette = true); ++ int maxLineCount = 0, bool useSystemPalette = true, const QColor &customColor = Qt::transparent); + }; + + } +diff --git a/libpeony-qt/file-launcher/file-lauch-dialog.cpp b/libpeony-qt/file-launcher/file-lauch-dialog.cpp +index 2e85cda..f7a2f07 100755 +--- a/libpeony-qt/file-launcher/file-lauch-dialog.cpp ++++ b/libpeony-qt/file-launcher/file-lauch-dialog.cpp +@@ -62,6 +62,9 @@ FileLauchDialog::FileLauchDialog(const QString &uri, QWidget *parent) : QDialog( + m_uri = uri; + auto actions = FileLaunchManager::getAllActions(uri); + for (auto action : actions) { ++ //fix show no icon app in list issue, bug#18171 ++ if (action->icon().isNull()) ++ continue; + action->setParent(this); + //qDebug() << "lauch actions:" <icon() <iconText() <text(); + auto item = new QListWidgetItem(!action->icon().isNull()? action->icon(): QIcon::fromTheme("application-x-desktop"), +diff --git a/libpeony-qt/model/side-bar-file-system-item.cpp b/libpeony-qt/model/side-bar-file-system-item.cpp +index e0177f4..61b9f28 100755 +--- a/libpeony-qt/model/side-bar-file-system-item.cpp ++++ b/libpeony-qt/model/side-bar-file-system-item.cpp +@@ -498,11 +498,11 @@ GAsyncReadyCallback SideBarFileSystemItem::eject_cb(GFile *file, GAsyncResult *r + g_error_free(err); + } else { + // remove item anyway +- int index = p_this->parent()->m_children->indexOf(p_this); ++ /*int index = p_this->parent()->m_children->indexOf(p_this); + p_this->m_model->beginRemoveRows(p_this->parent()->firstColumnIndex(), index, index); + p_this->parent()->m_children->removeOne(p_this); + p_this->m_model->endRemoveRows(); +- p_this->deleteLater(); ++ p_this->deleteLater();*/ + } + return nullptr; + } +diff --git a/libpeony-qt/vfs/peony-search-vfs-file-enumerator.cpp b/libpeony-qt/vfs/peony-search-vfs-file-enumerator.cpp +index a0b53fc..ef71036 100755 +--- a/libpeony-qt/vfs/peony-search-vfs-file-enumerator.cpp ++++ b/libpeony-qt/vfs/peony-search-vfs-file-enumerator.cpp +@@ -85,7 +85,7 @@ static void peony_search_vfs_file_enumerator_init(PeonySearchVFSFileEnumerator * + self->priv->save_result = false; + self->priv->search_hidden = true; + self->priv->use_regexp = true; +- self->priv->case_sensitive = true; ++ self->priv->case_sensitive = false; + self->priv->match_name_or_content = true; + } + +diff --git a/peony-qt-desktop/desktop-icon-view-delegate.cpp b/peony-qt-desktop/desktop-icon-view-delegate.cpp +index f44277e..2442935 100755 +--- a/peony-qt-desktop/desktop-icon-view-delegate.cpp ++++ b/peony-qt-desktop/desktop-icon-view-delegate.cpp +@@ -41,6 +41,9 @@ + #include + #include + ++//qt's global function ++extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); ++ + using namespace Peony; + using namespace Peony::DirectoryView; + +@@ -135,24 +138,55 @@ void DesktopIconViewDelegate::paint(QPainter *painter, const QStyleOptionViewIte + //paint text shadow + painter->save(); + painter->translate(1, 1 + iconSizeExpected.height() + 10); +- //painter->setFont(opt.font); ++ ++ auto expectedSize = IconViewTextHelper::getTextSizeForIndex(opt, index, 2); ++ QPixmap pixmap(expectedSize); ++ pixmap.fill(Qt::transparent); ++ QPainter shadowPainter(&pixmap); + QColor shadow = Qt::black; +- shadow.setAlpha(127); +- painter->setPen(shadow); +- IconViewTextHelper::paintText(painter, +- opt, +- index, +- maxTextHight, +- 0, +- 2, +- false); ++ shadowPainter.setPen(shadow); ++ IconViewTextHelper::paintText(&shadowPainter, opt, index, maxTextHight, 2, 0, false, shadow); ++ shadowPainter.end(); ++ ++ QImage shadowImage(expectedSize + QSize(4, 4), QImage::Format_ARGB32_Premultiplied); ++ shadowImage.fill(Qt::transparent); ++ shadowPainter.begin(&shadowImage); ++ shadowPainter.drawPixmap(2, 2, pixmap); ++ qt_blurImage(shadowImage, 8, false, false); ++ ++ for (int x = 0; x < shadowImage.width(); x++) { ++ for (int y = 0; y < shadowImage.height(); y++) { ++ auto color = shadowImage.pixelColor(x, y); ++ if (color.alpha() > 0) { ++ color.setAlphaF(qMin(color.alphaF() * 1.5, 1.0)); ++ shadowImage.setPixelColor(x, y, color); ++ } ++ } ++ } ++ ++ shadowPainter.end(); ++ ++ painter->translate(-4, -2); ++ painter->drawImage(0, 0, shadowImage); ++ ++ //painter->setFont(opt.font); ++// painter->setPen(shadow); ++// IconViewTextHelper::paintText(painter, ++// opt, ++// index, ++// maxTextHight, ++// 0, ++// 2, ++// false); + painter->restore(); + + //paint text + painter->save(); + painter->translate(0, 0 + iconSizeExpected.height() + 10); + //painter->setFont(opt.font); +- painter->setPen(opt.palette.highlightedText().color()); ++ QColor textColor = Qt::white; ++ textColor.setAlphaF(0.9); ++ painter->setPen(textColor); + IconViewTextHelper::paintText(painter, + opt, + index, +diff --git a/peony-qt-desktop/desktop-index-widget.cpp b/peony-qt-desktop/desktop-index-widget.cpp +index 958ff57..a358262 100755 +--- a/peony-qt-desktop/desktop-index-widget.cpp ++++ b/peony-qt-desktop/desktop-index-widget.cpp +@@ -38,6 +38,9 @@ + + #include + ++//qt's global function ++extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); ++ + using namespace Peony; + + DesktopIndexWidget::DesktopIndexWidget(DesktopIconViewDelegate *delegate, +@@ -85,7 +88,10 @@ void DesktopIndexWidget::paintEvent(QPaintEvent *e) + + //qDebug()<<"paint"; + auto visualRect = m_delegate->getView()->visualRect(m_index); +- move(visualRect.topLeft()); ++ if (this->pos() != visualRect.topLeft()) { ++ move(visualRect.topLeft()); ++ return; ++ } + + Q_UNUSED(e) + QPainter p(this); +@@ -105,6 +111,8 @@ void DesktopIndexWidget::paintEvent(QPaintEvent *e) + int y_delta = iconSizeExcepted.height() - iconRect.height(); + opt.rect.moveTo(opt.rect.x(), opt.rect.y() + y_delta); + ++ int maxTextHight = this->height() - iconSizeExcepted.height() - 10; ++ + //setFixedHeight(opt.rect.height() + y_delta); + + // draw icon +@@ -121,17 +129,46 @@ void DesktopIndexWidget::paintEvent(QPaintEvent *e) + } + // draw text shadow + p.save(); +- p.translate(1, 1); +- QColor shadow = Qt::black; +- shadow.setAlpha(127); +- p.setPen(shadow); +- Peony::DirectoryView::IconViewTextHelper::paintText(&p, +- m_option, +- m_index, +- 9999, +- 2, +- 0, +- false); ++ ++ auto expectedSize = Peony::DirectoryView::IconViewTextHelper::getTextSizeForIndex(m_option, m_index, 2); ++ QPixmap pixmap(expectedSize); ++ pixmap.fill(Qt::transparent); ++ QPainter shadowPainter(&pixmap); ++ shadowPainter.setPen(Qt::black); ++ Peony::DirectoryView::IconViewTextHelper::paintText(&shadowPainter, m_option, m_index, maxTextHight, 2, 0, false, Qt::black); ++ shadowPainter.end(); ++ ++ QImage shadowImage(expectedSize + QSize(4, 4), QImage::Format_ARGB32_Premultiplied); ++ shadowImage.fill(Qt::transparent); ++ shadowPainter.begin(&shadowImage); ++ shadowPainter.drawPixmap(2, 2, pixmap); ++ qt_blurImage(shadowImage, 8, false, false); ++ ++ for (int x = 0; x < shadowImage.width(); x++) { ++ for (int y = 0; y < shadowImage.height(); y++) { ++ auto color = shadowImage.pixelColor(x, y); ++ if (color.alpha() > 0) { ++ color.setAlphaF(qMin(color.alphaF() * 1.5, 1.0)); ++ shadowImage.setPixelColor(x, y, color); ++ } ++ } ++ } ++ ++ shadowPainter.end(); ++ ++ p.translate(-3, -1); ++ p.drawImage(0, 0, shadowImage); ++ ++// QColor shadow = Qt::black; ++// shadow.setAlpha(127); ++// p.setPen(shadow); ++// Peony::DirectoryView::IconViewTextHelper::paintText(&p, ++// m_option, ++// m_index, ++// 9999, ++// 2, ++// 0, ++// false); + // QFontMetrics fm(m_current_font); + + // style()->drawItemText(&p, +diff --git a/src/control/navigation-side-bar.cpp b/src/control/navigation-side-bar.cpp +index c68345d..de0a144 100755 +--- a/src/control/navigation-side-bar.cpp ++++ b/src/control/navigation-side-bar.cpp +@@ -24,6 +24,7 @@ + #include "side-bar-model.h" + #include "side-bar-proxy-filter-sort-model.h" + #include "side-bar-abstract-item.h" ++#include "volume-manager.h" + + #include "side-bar-menu.h" + #include "side-bar-abstract-item.h" +@@ -54,6 +55,8 @@ + + #include + ++using namespace Peony; ++ + NavigationSideBar::NavigationSideBar(QWidget *parent) : QTreeView(parent) + { + setIconSize(QSize(16, 16)); +@@ -95,6 +98,14 @@ NavigationSideBar::NavigationSideBar(QWidget *parent) : QTreeView(parent) + + this->setModel(m_proxy_model); + ++ VolumeManager *volumeManager = VolumeManager::getInstance(); ++ connect(volumeManager,&Peony::VolumeManager::volumeAdded,this,[=](const std::shared_ptr &volume){ ++ m_proxy_model->invalidate();//display DVD device in real time. ++ }); ++ connect(volumeManager,&Peony::VolumeManager::volumeRemoved,this,[=](const std::shared_ptr &volume){ ++ m_proxy_model->invalidate();//The drive does not display when the DVD device is removed. ++ }); ++ + connect(this, &QTreeView::expanded, [=](const QModelIndex &index) { + auto item = m_proxy_model->itemFromIndex(index); + qDebug()<uri(); +-- +2.24.3 (Apple Git-128) + diff --git a/peony.spec b/peony.spec index 5f1abecc54de6b5a6615a1f09e8d442a6b26f7b9..6e64067988efc81e338449a833b679875c71cc66 100644 --- a/peony.spec +++ b/peony.spec @@ -2,7 +2,7 @@ Name: peony Version: 3.0.4 -Release: 2 +Release: 3 Summary: file Manager for the UKUI desktop License: GPL-2.0+ GPL-3.0+ Expat LGPL-3.0+ URL: http://www.ukui.org @@ -18,6 +18,7 @@ Requires: gvfs patch0: 001-fix-excute-file.patch patch1: 0001-adjust-desktop-readonly-icon-agree-with-icon-view.patch +patch2: 0001-fix-sidebar-display-error-and-search-issue %description Peony is the official file manager for the UKUI desktop. It allows one @@ -75,6 +76,7 @@ Provides: libpeony %setup -q %patch0 -p1 %patch1 -p1 +%patch2 -p1 %build qmake-qt5 @@ -126,6 +128,11 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Wed Oct 27 2021 douyan - 3.0.4-3 +- add patch:0001-fix-sidebar-display-error-and-search-issue +- fix search case sensitive issue +- fix select open file app list show no icon app issue + * Tue Oct 26 2021 douyan - 3.0.4-2 - add patch:0001-adjust-desktop-readonly-icon-agree-with-icon-view.patch