diff options
| author | Victor Blanchard <[email protected]> | 2025-05-28 12:33:52 +0200 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2025-05-28 10:33:52 +0000 |
| commit | edda24eb851c2647f7dde01885008ef60fcadd9a (patch) | |
| tree | b49978ac3135b7de5346a93f43ff013898f3c365 /src/settings | |
| parent | 0959642be297bf0749467c204e511f5887b17ee1 (diff) | |
dolphinview: Add a dynamic view option
Added a 'dynamic view' option, which allows to switch from a 'compact' or 'details' view to an 'icons' view if most of the files in the directory are images or videos. It reverts to the previous view mode when we switch to a directory which doesn't meet that criteria.
The view mode is only changed once so users don't have to undo that for specific folders when they don't want icon view.
A setting is added in the "Display style" section of the general view setting page.
BUG: 491139
Diffstat (limited to 'src/settings')
4 files changed, 16 insertions, 0 deletions
diff --git a/src/settings/dolphin_directoryviewpropertysettings.kcfg b/src/settings/dolphin_directoryviewpropertysettings.kcfg index e0c8aa1cc..bae1f409f 100644 --- a/src/settings/dolphin_directoryviewpropertysettings.kcfg +++ b/src/settings/dolphin_directoryviewpropertysettings.kcfg @@ -77,6 +77,11 @@ <whatsthis context="@info:whatsthis">The last time these properties were changed by the user.</whatsthis> </entry> + <entry name="DynamicViewPassed" type="Bool"> + <label context="@label">View mode changed once by dynamic view</label> + <default>false</default> + </entry> + <!-- Obsolete - replaced by VisibleRoles --> <entry name="AdditionalInfo" type="StringList"> <label context="@label">Additional Information</label> diff --git a/src/settings/dolphin_generalsettings.kcfg b/src/settings/dolphin_generalsettings.kcfg index e950099ec..2252eed28 100644 --- a/src/settings/dolphin_generalsettings.kcfg +++ b/src/settings/dolphin_generalsettings.kcfg @@ -153,6 +153,10 @@ <label>Also hide files with application/x-trash mimetype</label> <default>false</default> </entry> + <entry name="DynamicView" type="Bool"> + <label>Enable dynamic view</label> + <default>false</default> + </entry> </group> <group name="Notification Messages"> <entry name="ConfirmOpenManyFolders" type="Bool"> diff --git a/src/settings/viewmodes/generalviewsettingspage.cpp b/src/settings/viewmodes/generalviewsettingspage.cpp index 7caffe0f9..988f243c1 100644 --- a/src/settings/viewmodes/generalviewsettingspage.cpp +++ b/src/settings/viewmodes/generalviewsettingspage.cpp @@ -47,6 +47,8 @@ GeneralViewSettingsPage::GeneralViewSettingsPage(const QUrl &url, QWidget *paren localViewPropsLabel->setWordWrap(true); localViewPropsLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + m_dynamicView = new QCheckBox(i18nc("option:check", "Use icons view mode for locations which mostly contain media files")); + QButtonGroup *viewGroup = new QButtonGroup(this); viewGroup->addButton(m_globalViewProps); viewGroup->addButton(m_localViewProps); @@ -54,6 +56,7 @@ GeneralViewSettingsPage::GeneralViewSettingsPage(const QUrl &url, QWidget *paren topLayout->addRow(QString(), globalViewPropsLabel); topLayout->addRow(QString(), m_localViewProps); topLayout->addRow(QString(), localViewPropsLabel); + topLayout->addRow(QString(), m_dynamicView); topLayout->addItem(new QSpacerItem(0, Dolphin::VERTICAL_SPACER_HEIGHT, QSizePolicy::Fixed, QSizePolicy::Fixed)); @@ -191,6 +194,7 @@ GeneralViewSettingsPage::GeneralViewSettingsPage(const QUrl &url, QWidget *paren connect(m_showSelectionToggle, &QCheckBox::toggled, this, &GeneralViewSettingsPage::changed); connect(m_renameInline, &QCheckBox::toggled, this, &GeneralViewSettingsPage::changed); connect(m_hideXtrashFiles, &QCheckBox::toggled, this, &GeneralViewSettingsPage::changed); + connect(m_dynamicView, &QCheckBox::toggled, this, &GeneralViewSettingsPage::changed); connect(m_doubleClickViewCustomAction, &QLineEdit::textChanged, this, &GeneralViewSettingsPage::changed); connect(m_doubleClickViewComboBox, qOverload<int>(&QComboBox::currentIndexChanged), this, &GeneralViewSettingsPage::changed); connect(m_doubleClickViewComboBox, qOverload<int>(&QComboBox::currentIndexChanged), this, &GeneralViewSettingsPage::updateCustomActionVisibility); @@ -212,6 +216,7 @@ void GeneralViewSettingsPage::applySettings() settings->setShowSelectionToggle(m_showSelectionToggle->isChecked()); settings->setRenameInline(m_renameInline->isChecked()); settings->setHideXTrashFile(m_hideXtrashFiles->isChecked()); + settings->setDynamicView(m_dynamicView->isChecked()); settings->setAutoExpandFolders(m_autoExpandFolders->isChecked()); settings->setBrowseThroughArchives(m_openArchivesAsFolder->isChecked()); settings->setDoubleClickViewCustomAction(m_doubleClickViewCustomAction->text()); @@ -246,6 +251,7 @@ void GeneralViewSettingsPage::loadSettings() m_showSelectionToggle->setChecked(GeneralSettings::showSelectionToggle()); m_renameInline->setChecked(GeneralSettings::renameInline()); m_hideXtrashFiles->setChecked(GeneralSettings::hideXTrashFile()); + m_dynamicView->setChecked(GeneralSettings::dynamicView()); m_localViewProps->setChecked(!useGlobalViewProps); m_globalViewProps->setChecked(useGlobalViewProps); diff --git a/src/settings/viewmodes/generalviewsettingspage.h b/src/settings/viewmodes/generalviewsettingspage.h index 1d4caab65..77ab004a6 100644 --- a/src/settings/viewmodes/generalviewsettingspage.h +++ b/src/settings/viewmodes/generalviewsettingspage.h @@ -51,6 +51,7 @@ private: QCheckBox *m_openArchivesAsFolder = nullptr; QCheckBox *m_autoExpandFolders = nullptr; QCheckBox *m_hideXtrashFiles = nullptr; + QCheckBox *m_dynamicView = nullptr; QComboBox *m_doubleClickViewComboBox = nullptr; QLineEdit *m_doubleClickViewCustomAction = nullptr; QLabel *m_doubleClickViewCustomActionInfo = nullptr; |
