diff --git a/dolphin-patched/src/dolphinmainwindow.cpp.orig b/dolphin-patched/src/dolphinmainwindow.cpp
--- a/dolphin-patched/src/dolphinmainwindow.cpp.orig
+++ b/dolphin-patched/src/dolphinmainwindow.cpp
@@ -823,6 +823,7 @@
addActionToMenu(ac->action(QStringLiteral("sort")), menu) |
addActionToMenu(ac->action(QStringLiteral("additional_info")), menu) |
addActionToMenu(ac->action(QStringLiteral("show_preview")), menu) |
+ addActionToMenu(ac->action("unframed_previews"), menu) |
addActionToMenu(ac->action(QStringLiteral("show_in_groups")), menu) |
addActionToMenu(ac->action(QStringLiteral("show_hidden_files")), menu);
diff --git a/dolphin-patched/src/dolphinpart.rc.orig b/dolphin-patched/src/dolphinpart.rc
--- a/dolphin-patched/src/dolphinpart.rc.orig
+++ b/dolphin-patched/src/dolphinpart.rc
@@ -24,6 +24,7 @@
+
diff --git a/dolphin-patched/src/dolphinui.rc.orig b/dolphin-patched/src/dolphinui.rc
--- a/dolphin-patched/src/dolphinui.rc.orig
+++ b/dolphin-patched/src/dolphinui.rc
@@ -23,6 +23,7 @@
+
diff --git a/dolphin-patched/src/kitemviews/kfileitemlistview.h.orig b/dolphin-patched/src/kitemviews/kfileitemlistview.h
--- a/dolphin-patched/src/kitemviews/kfileitemlistview.h.orig
+++ b/dolphin-patched/src/kitemviews/kfileitemlistview.h
@@ -47,6 +47,9 @@
void setPreviewsShown(bool show);
bool previewsShown() const;
+ void setUnframedPreviews(bool unframed);
+ bool unframedPreviews() const;
+
/**
* If enabled a small preview gets upscaled to the icon size in case where
* the icon size is larger than the preview. Per default enlarging is
@@ -78,6 +81,7 @@
virtual KItemListWidgetCreatorBase* defaultWidgetCreator() const Q_DECL_OVERRIDE;
virtual void initializeItemListWidget(KItemListWidget* item) Q_DECL_OVERRIDE;
virtual void onPreviewsShownChanged(bool shown);
+ virtual void onUnframedPreviewsChanged(bool unframed);
virtual void onItemLayoutChanged(ItemLayout current, ItemLayout previous) Q_DECL_OVERRIDE;
virtual void onModelChanged(KItemModelBase* current, KItemModelBase* previous) Q_DECL_OVERRIDE;
virtual void onScrollOrientationChanged(Qt::Orientation current, Qt::Orientation previous) Q_DECL_OVERRIDE;
diff --git a/dolphin-patched/src/kitemviews/kfileitemlistview.cpp.orig b/dolphin-patched/src/kitemviews/kfileitemlistview.cpp
--- a/dolphin-patched/src/kitemviews/kfileitemlistview.cpp.orig
+++ b/dolphin-patched/src/kitemviews/kfileitemlistview.cpp
@@ -93,6 +93,25 @@
return m_modelRolesUpdater ? m_modelRolesUpdater->previewsShown() : false;
}
+void KFileItemListView::setUnframedPreviews(bool unframed)
+{
+ if (!m_modelRolesUpdater) {
+ return;
+ }
+
+ if (m_modelRolesUpdater->unframedPreviews() != unframed) {
+ beginTransaction();
+ m_modelRolesUpdater->setUnframedPreviews(unframed);
+ onUnframedPreviewsChanged(unframed);
+ endTransaction();
+ }
+}
+
+bool KFileItemListView::unframedPreviews() const
+{
+ return m_modelRolesUpdater ? m_modelRolesUpdater->unframedPreviews() : false;
+}
+
void KFileItemListView::setEnlargeSmallPreviews(bool enlarge)
{
if (m_modelRolesUpdater) {
@@ -217,6 +236,12 @@
Q_UNUSED(shown);
}
+void KFileItemListView::onUnframedPreviewsChanged(bool unframed)
+{
+ Q_UNUSED(unframed);
+ triggerVisibleIndexRangeUpdate();
+}
+
void KFileItemListView::onItemLayoutChanged(ItemLayout current, ItemLayout previous)
{
KStandardItemListView::onItemLayoutChanged(current, previous);
diff --git a/dolphin-patched/src/kitemviews/kfileitemmodelrolesupdater.h.orig b/dolphin-patched/src/kitemviews/kfileitemmodelrolesupdater.h
--- a/dolphin-patched/src/kitemviews/kfileitemmodelrolesupdater.h.orig
+++ b/dolphin-patched/src/kitemviews/kfileitemmodelrolesupdater.h
@@ -117,6 +117,14 @@
bool previewsShown() const;
/**
+ * If \a unframed is set to true, the "iconPixmap" role will not have a frame around the preview
+ * of the file. If \a unframed is false a frame will be drawn around the "iconPixmap"
+ * role.
+ */
+ void setUnframedPreviews(bool unframed);
+ bool unframedPreviews() const;
+
+ /**
* If enabled a small preview gets upscaled to the icon size in case where
* the icon size is larger than the preview. Per default enlarging is
* enabled.
@@ -288,12 +296,16 @@
// Property changes during pausing must be remembered to be able
// to react when unpausing again:
bool m_previewChangedDuringPausing;
+ bool m_unframedPreviewsChangedDuringPausing;
bool m_iconSizeChangedDuringPausing;
bool m_rolesChangedDuringPausing;
// Property for setPreviewsShown()/previewsShown().
bool m_previewShown;
+ // Property for setUnframedPreviews()/unframedPreviews().
+ bool m_unframedPreview;
+
// Property for setEnlargeSmallPreviews()/enlargeSmallPreviews()
bool m_enlargeSmallPreviews;
@@ -351,4 +363,3 @@
#endif
-
diff --git a/dolphin-patched/src/kitemviews/kfileitemmodelrolesupdater.cpp.orig b/dolphin-patched/src/kitemviews/kfileitemmodelrolesupdater.cpp
--- a/dolphin-patched/src/kitemviews/kfileitemmodelrolesupdater.cpp.orig
+++ b/dolphin-patched/src/kitemviews/kfileitemmodelrolesupdater.cpp
@@ -72,7 +72,9 @@
m_previewChangedDuringPausing(false),
m_iconSizeChangedDuringPausing(false),
m_rolesChangedDuringPausing(false),
+ m_unframedPreviewsChangedDuringPausing(false),
m_previewShown(false),
+ m_unframedPreview(false),
m_enlargeSmallPreviews(true),
m_clearPreviews(false),
m_finishedItems(),
@@ -215,6 +217,31 @@
return m_previewShown;
}
+void KFileItemModelRolesUpdater::setUnframedPreviews(bool unframed)
+{
+ if (unframed == m_unframedPreview) {
+ return;
+ }
+
+ m_unframedPreview = unframed;
+ if (m_state == Paused) {
+ m_unframedPreviewsChangedDuringPausing = true;
+ } else if (m_previewShown) {
+ // Changed framing state requires the regenerating of icons previews
+
+ //m_finishedItems.clear();
+ //startUpdating();
+
+ m_clearPreviews = true;
+ updateAllPreviews();
+ }
+}
+
+bool KFileItemModelRolesUpdater::unframedPreviews() const
+{
+ return m_unframedPreview;
+}
+
void KFileItemModelRolesUpdater::setEnlargeSmallPreviews(bool enlarge)
{
if (enlarge != m_enlargeSmallPreviews) {
@@ -250,7 +277,10 @@
m_state = Paused;
killPreviewJob();
} else {
- const bool updatePreviews = (m_iconSizeChangedDuringPausing && m_previewShown) ||
+ const bool updatePreviews = ( ( m_iconSizeChangedDuringPausing || m_unframedPreviewsChangedDuringPausing
+ ) &&
+ m_previewShown
+ ) ||
m_previewChangedDuringPausing;
const bool resolveAll = updatePreviews || m_rolesChangedDuringPausing;
if (resolveAll) {
@@ -260,6 +290,7 @@
m_iconSizeChangedDuringPausing = false;
m_previewChangedDuringPausing = false;
m_rolesChangedDuringPausing = false;
+ m_unframedPreviewsChangedDuringPausing = false;
if (!m_pendingSortRoleItems.isEmpty()) {
m_state = ResolvingSortRole;
@@ -511,8 +542,12 @@
mimeType == QLatin1String("application/x-msdownload");
if (!isFolderPreview && !isFontPreview && !isWindowsExePreview) {
+ // Unframed icons option detection (icons must pass a test)
if (m_enlargeSmallPreviews) {
- KPixmapModifier::applyFrame(scaledPixmap, m_iconSize);
+ if (m_unframedPreview)
+ KPixmapModifier::scale(scaledPixmap, m_iconSize);
+ else
+ KPixmapModifier::applyFrame(scaledPixmap, m_iconSize);
} else {
// Assure that small previews don't get enlarged. Instead they
// should be shown centered within the frame.
@@ -526,7 +561,8 @@
QPixmap largeFrame(frameSize);
largeFrame.fill(Qt::transparent);
- KPixmapModifier::applyFrame(largeFrame, frameSize);
+ if (! m_unframedPreview)
+ KPixmapModifier::applyFrame(largeFrame, frameSize);
QPainter painter(&largeFrame);
painter.drawPixmap((largeFrame.width() - scaledPixmap.width() / scaledPixmap.devicePixelRatio()) / 2,
@@ -536,7 +572,10 @@
} else {
// The image must be shrinked as it is too large to fit into
// the available icon size
- KPixmapModifier::applyFrame(scaledPixmap, m_iconSize);
+ if (m_unframedPreview)
+ KPixmapModifier::scale(scaledPixmap, m_iconSize);
+ else
+ KPixmapModifier::applyFrame(scaledPixmap, m_iconSize);
}
}
} else {
diff --git a/dolphin-patched/src/settings/dolphin_directoryviewpropertysettings.kcfg.orig b/dolphin-patched/src/settings/dolphin_directoryviewpropertysettings.kcfg
--- a/dolphin-patched/src/settings/dolphin_directoryviewpropertysettings.kcfg.orig
+++ b/dolphin-patched/src/settings/dolphin_directoryviewpropertysettings.kcfg
@@ -33,6 +33,12 @@
false
+
+
+ When this option is enabled the icons previews will be unframed.
+ false
+
+
When this option is enabled, the sorted items are categorized into groups.
diff --git a/dolphin-patched/src/settings/viewpropertiesdialog.h.orig b/dolphin-patched/src/settings/viewpropertiesdialog.h
--- a/dolphin-patched/src/settings/viewpropertiesdialog.h.orig
+++ b/dolphin-patched/src/settings/viewpropertiesdialog.h
@@ -58,6 +58,7 @@
void slotGroupedSortingChanged();
void slotSortFoldersFirstChanged();
void slotShowPreviewChanged();
+ void slotShowUnframePreviewsChanged();
void slotShowHiddenFilesChanged();
void markAsDirty(bool isDirty);
void configureAdditionalInfo();
@@ -79,6 +80,7 @@
KComboBox* m_sorting;
QCheckBox* m_sortFoldersFirst;
QCheckBox* m_previewsShown;
+ QCheckBox* m_unframedPreviews;
QCheckBox* m_showInGroups;
QCheckBox* m_showHiddenFiles;
QPushButton* m_additionalInfo;
diff --git a/dolphin-patched/src/settings/viewpropertiesdialog.cpp.orig b/dolphin-patched/src/settings/viewpropertiesdialog.cpp
--- a/dolphin-patched/src/settings/viewpropertiesdialog.cpp.orig
+++ b/dolphin-patched/src/settings/viewpropertiesdialog.cpp
@@ -58,6 +58,7 @@
m_sorting(0),
m_sortFoldersFirst(0),
m_previewsShown(0),
+ m_unframedPreviews(0),
m_showInGroups(0),
m_showHiddenFiles(0),
m_additionalInfo(0),
@@ -110,6 +111,7 @@
m_sortFoldersFirst = new QCheckBox(i18nc("@option:check", "Show folders first"));
m_previewsShown = new QCheckBox(i18nc("@option:check", "Show preview"));
+ m_unframedPreviews = new QCheckBox(i18nc("@option:check", "Unframed previews"));
m_showInGroups = new QCheckBox(i18nc("@option:check", "Show in groups"));
m_showHiddenFiles = new QCheckBox(i18nc("@option:check", "Show hidden files"));
@@ -131,6 +133,7 @@
propsBoxLayout->addWidget(propsGrid);
propsBoxLayout->addWidget(m_sortFoldersFirst);
propsBoxLayout->addWidget(m_previewsShown);
+ propsBoxLayout->addWidget(m_unframedPreviews);
propsBoxLayout->addWidget(m_showInGroups);
propsBoxLayout->addWidget(m_showHiddenFiles);
propsBoxLayout->addWidget(m_additionalInfo);
@@ -147,6 +150,8 @@
this, &ViewPropertiesDialog::slotSortFoldersFirstChanged);
connect(m_previewsShown, &QCheckBox::clicked,
this, &ViewPropertiesDialog::slotShowPreviewChanged);
+ connect(m_unframedPreviews, SIGNAL(clicked()),
+ this, SLOT(slotShowUnframePreviewsChanged()));
connect(m_showInGroups, &QCheckBox::clicked,
this, &ViewPropertiesDialog::slotGroupedSortingChanged);
connect(m_showHiddenFiles, &QCheckBox::clicked,
@@ -277,6 +282,13 @@
markAsDirty(true);
}
+void ViewPropertiesDialog::slotShowUnframePreviewsChanged()
+{
+ const bool unframed = m_unframedPreviews->isChecked();
+ m_viewProps->setUnframedPreviews(unframed);
+ markAsDirty(true);
+}
+
void ViewPropertiesDialog::slotShowHiddenFilesChanged()
{
const bool show = m_showHiddenFiles->isChecked();
@@ -375,6 +387,7 @@
m_dolphinView->setGroupedSorting(m_viewProps->groupedSorting());
m_dolphinView->setVisibleRoles(m_viewProps->visibleRoles());
m_dolphinView->setPreviewsShown(m_viewProps->previewsShown());
+ m_dolphinView->setUnframedPreviews(m_viewProps->unframedPreviews());
m_dolphinView->setHiddenFilesShown(m_viewProps->hiddenFilesShown());
m_viewProps->save();
@@ -410,6 +423,7 @@
// Load show preview, show in groups and show hidden files settings
m_previewsShown->setChecked(m_viewProps->previewsShown());
+ m_unframedPreviews->setChecked(m_viewProps->unframedPreviews());
m_showInGroups->setChecked(m_viewProps->groupedSorting());
m_showHiddenFiles->setChecked(m_viewProps->hiddenFilesShown());
markAsDirty(false);
diff --git a/dolphin-patched/src/views/dolphinitemlistview.h.orig b/dolphin-patched/src/views/dolphinitemlistview.h
--- a/dolphin-patched/src/views/dolphinitemlistview.h.orig
+++ b/dolphin-patched/src/views/dolphinitemlistview.h
@@ -53,6 +53,7 @@
virtual bool itemLayoutSupportsItemExpanding(ItemLayout layout) const Q_DECL_OVERRIDE;
virtual void onItemLayoutChanged(ItemLayout current, ItemLayout previous) Q_DECL_OVERRIDE;
virtual void onPreviewsShownChanged(bool shown) Q_DECL_OVERRIDE;
+ virtual void onUnframedPreviewsChanged(bool unframed) Q_DECL_OVERRIDE;
virtual void onVisibleRolesChanged(const QList& current,
const QList& previous) Q_DECL_OVERRIDE;
diff --git a/dolphin-patched/src/views/dolphinitemlistview.cpp.orig b/dolphin-patched/src/views/dolphinitemlistview.cpp
--- a/dolphin-patched/src/views/dolphinitemlistview.cpp.orig
+++ b/dolphin-patched/src/views/dolphinitemlistview.cpp
@@ -136,6 +136,12 @@
updateGridSize();
}
+void DolphinItemListView::onUnframedPreviewsChanged(bool unframed)
+{
+ Q_UNUSED(unframed);
+ updateGridSize();
+}
+
void DolphinItemListView::onVisibleRolesChanged(const QList& current,
const QList& previous)
{
diff --git a/dolphin-patched/src/views/dolphinview.h.orig b/dolphin-patched/src/views/dolphinview.h
--- a/dolphin-patched/src/views/dolphinview.h.orig
+++ b/dolphin-patched/src/views/dolphinview.h
@@ -55,6 +55,7 @@
* - sort type
* - show hidden files
* - show previews
+ * - unframed previews
* - enable grouping
*/
class DOLPHIN_EXPORT DolphinView : public QWidget
@@ -128,6 +129,16 @@
bool previewsShown() const;
/**
+ * Turns off the frames on file preview for the all files of the current directory,
+ * if \a unframed is true.
+ * If the view properties should be remembered for each directory
+ * (GeneralSettings::globalViewProps() returns false), then the
+ * unframed setting will be stored automatically.
+ */
+ void setUnframedPreviews(bool unframed);
+ bool unframedPreviews() const;
+
+ /**
* Shows all hidden files of the current directory,
* if \a show is true.
* If the view properties should be remembered for each directory
@@ -411,6 +422,9 @@
/** Is emitted if the 'show preview' property has been changed. */
void previewsShownChanged(bool shown);
+ /** Is emitted if the 'preview unframed' property has been changed. */
+ void unframedPreviewsChanged(bool unframed);
+
/** Is emitted if the 'show hidden files' property has been changed. */
void hiddenFilesShownChanged(bool shown);
diff --git a/dolphin-patched/src/views/dolphinview.cpp.orig b/dolphin-patched/src/views/dolphinview.cpp
--- a/dolphin-patched/src/views/dolphinview.cpp.orig
+++ b/dolphin-patched/src/views/dolphinview.cpp
@@ -269,6 +269,25 @@
return m_view->previewsShown();
}
+void DolphinView::setUnframedPreviews(bool unframed)
+{
+ if (unframedPreviews() == unframed) {
+ return;
+ }
+
+ ViewProperties props(viewPropertiesUrl());
+ props.setUnframedPreviews(unframed);
+ // props.save();
+
+ emit unframedPreviewsChanged(unframed);
+}
+
+bool DolphinView::unframedPreviews() const
+{
+ return m_view->unframedPreviews();
+ //return m_model->unframedPreviews();
+}
+
void DolphinView::setHiddenFilesShown(bool show)
{
if (m_model->showHiddenFiles() == show) {
@@ -1596,6 +1615,12 @@
}
}
+ const bool unframedPreviews = props.unframedPreviews();
+ if (unframedPreviews != m_view->unframedPreviews()) {
+ m_view->setUnframedPreviews(unframedPreviews);
+ emit unframedPreviewsChanged(unframedPreviews);
+ }
+
const bool hiddenFilesShown = props.hiddenFilesShown();
if (hiddenFilesShown != m_model->showHiddenFiles()) {
m_model->setShowHiddenFiles(hiddenFilesShown);
diff --git a/dolphin-patched/src/views/dolphinviewactionhandler.h.orig b/dolphin-patched/src/views/dolphinviewactionhandler.h
--- a/dolphin-patched/src/views/dolphinviewactionhandler.h.orig
+++ b/dolphin-patched/src/views/dolphinviewactionhandler.h
@@ -125,6 +125,14 @@
/** Updates the state of the 'Show preview' menu action. */
void slotPreviewsShownChanged(bool shown);
+ /**
+ * Switches between showing unframed previews of the files content and showing the icons.
+ */
+ void toggleUnframedPreviews(bool);
+
+ /** Updates the state of the 'Unframed previews' menu action. */
+ void slotUnframedPreviewsChanged(bool unframed);
+
/** Increases the size of the current set view mode. */
void zoomIn();
diff --git a/dolphin-patched/src/views/dolphinviewactionhandler.cpp.orig b/dolphin-patched/src/views/dolphinviewactionhandler.cpp
--- a/dolphin-patched/src/views/dolphinviewactionhandler.cpp.orig
+++ b/dolphin-patched/src/views/dolphinviewactionhandler.cpp
@@ -71,6 +71,8 @@
this, &DolphinViewActionHandler::updateViewActions);
connect(view, &DolphinView::previewsShownChanged,
this, &DolphinViewActionHandler::slotPreviewsShownChanged);
+ connect(view, &DolphinView::unframedPreviewsChanged,
+ this, &DolphinViewActionHandler::slotUnframedPreviewsChanged);
connect(view, &DolphinView::sortOrderChanged,
this, &DolphinViewActionHandler::slotSortOrderChanged);
connect(view, &DolphinView::sortFoldersFirstChanged,
@@ -167,6 +169,10 @@
showPreview->setIcon(QIcon::fromTheme(QStringLiteral("view-preview")));
connect(showPreview, &KToggleAction::triggered, this, &DolphinViewActionHandler::togglePreview);
+ KToggleAction* unframedPreviews = m_actionCollection->add("unframed_previews");
+ unframedPreviews->setText(i18nc("@action:inmenu View", "Unframed previews"));
+ connect(unframedPreviews, SIGNAL(triggered(bool)), this, SLOT(toggleUnframedPreviews(bool)));
+
KToggleAction* sortDescending = m_actionCollection->add(QStringLiteral("descending"));
sortDescending->setText(i18nc("@action:inmenu Sort", "Descending"));
connect(sortDescending, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleSortOrder);
@@ -334,6 +340,19 @@
updateViewActions();
}
+void DolphinViewActionHandler::toggleUnframedPreviews(bool unframed)
+{
+ emit actionBeingHandled();
+ m_currentView->setUnframedPreviews(unframed);
+}
+
+void DolphinViewActionHandler::slotUnframedPreviewsChanged(bool unframed)
+{
+ QAction* unframedPreviewsAction = m_actionCollection->action("unframed_previews");
+ unframedPreviewsAction->setChecked(unframed);
+ // updateViewActions();
+}
+
QString DolphinViewActionHandler::currentViewModeActionName() const
{
switch (m_currentView->mode()) {
@@ -368,6 +387,9 @@
QAction* showPreviewAction = m_actionCollection->action(QStringLiteral("show_preview"));
showPreviewAction->setChecked(m_currentView->previewsShown());
+ QAction* unframedPreviewsAction = m_actionCollection->action("unframed_previews");
+ unframedPreviewsAction->setChecked(m_currentView->unframedPreviews());
+
slotSortOrderChanged(m_currentView->sortOrder());
slotSortFoldersFirstChanged(m_currentView->sortFoldersFirst());
slotVisibleRolesChanged(m_currentView->visibleRoles(), QList());
diff --git a/dolphin-patched/src/views/viewproperties.h.orig b/dolphin-patched/src/views/viewproperties.h
--- a/dolphin-patched/src/views/viewproperties.h.orig
+++ b/dolphin-patched/src/views/viewproperties.h
@@ -59,6 +59,9 @@
void setPreviewsShown(bool show);
bool previewsShown() const;
+ void setUnframedPreviews(bool unframed);
+ bool unframedPreviews() const;
+
void setHiddenFilesShown(bool show);
bool hiddenFilesShown() const;
diff --git a/dolphin-patched/src/views/viewproperties.cpp.orig b/dolphin-patched/src/views/viewproperties.cpp
--- a/dolphin-patched/src/views/viewproperties.cpp.orig
+++ b/dolphin-patched/src/views/viewproperties.cpp
@@ -170,6 +170,19 @@
return m_node->previewsShown();
}
+void ViewProperties::setUnframedPreviews(bool unframed)
+{
+ if (m_node->unframedPreviews() != unframed) {
+ m_node->setUnframedPreviews(unframed);
+ update();
+ }
+}
+
+bool ViewProperties::unframedPreviews() const
+{
+ return m_node->unframedPreviews();
+}
+
void ViewProperties::setHiddenFilesShown(bool show)
{
if (m_node->hiddenFilesShown() != show) {
@@ -338,6 +351,7 @@
{
setViewMode(props.viewMode());
setPreviewsShown(props.previewsShown());
+ setUnframedPreviews(props.unframedPreviews());
setHiddenFilesShown(props.hiddenFilesShown());
setGroupedSorting(props.groupedSorting());
setSortRole(props.sortRole());