Skip to content

Commit

Permalink
feat: add view options UI
Browse files Browse the repository at this point in the history
New toolbar view options panel

Log: add view options UI
  • Loading branch information
wyu71 committed Oct 28, 2024
1 parent 5e11a78 commit 14d4eba
Show file tree
Hide file tree
Showing 24 changed files with 768 additions and 51 deletions.
6 changes: 6 additions & 0 deletions src/dfm-base/base/application/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ void ApplicationPrivate::_q_onSettingsValueChanged(const QString &group, const Q
Q_EMIT self->iconSizeLevelChanged(value.toInt());
} else if (aa == Application::kViewMode) {
Q_EMIT self->viewModeChanged(value.toInt());
} else if (aa == Application::kGridDensityLevel) {
Q_EMIT self->gridDensityLevelChanged(value.toInt());
} else if (aa == Application::kListHeightLevel) {
Q_EMIT self->listHeightLevelChanged(value.toInt());
} else if (aa == Application::kShowedDisplayPreview) {
Q_EMIT self->showedDisplayPreviewChanged(value.toBool());
}
} else if (group == QT_STRINGIFY(GenericAttribute)) {
const QMetaEnum &me = QMetaEnum::fromType<Application::GenericAttribute>();
Expand Down
12 changes: 9 additions & 3 deletions src/dfm-base/base/application/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ class Application : public QObject
kUrlOfNewTab, // default path to new tabs
kThemeName,
kFileAndDirMixedSort, // Mixed sorting of ordinary files and directories
kListItemExpandable // Item expandable as tree in FileView with list view mode
kListItemExpandable, // Item expandable as tree in FileView with list view mode
kGridDensityLevel, // grid density level
kListHeightLevel, // list view height level
kShowedDisplayPreview, // show preview in file manager
};

Q_ENUM(ApplicationAttribute)
Expand Down Expand Up @@ -65,8 +68,8 @@ class Application : public QObject
Q_ENUM(GenericAttribute)

enum TriggerAttribute {
kRestoreViewMode, // restore defualt view mode to all dir
kClearSearchHistory // clear search history
kRestoreViewMode, // restore defualt view mode to all dir
kClearSearchHistory // clear search history
};

Q_ENUM(TriggerAttribute)
Expand Down Expand Up @@ -101,13 +104,16 @@ class Application : public QObject
void appAttributeEdited(ApplicationAttribute aa, const QVariant &value);
void genericAttributeEdited(GenericAttribute ga, const QVariant &value);
void iconSizeLevelChanged(int level);
void gridDensityLevelChanged(int level);
void listHeightLevelChanged(int level);
void viewModeChanged(int mode);
void previewCompressFileChanged(bool enable);
void showedFileSuffixChanged(bool enable);
void previewAttributeChanged(GenericAttribute ga, bool enable);
void showedHiddenFilesChanged(bool enable);
void csdClickableAreaAttributeChanged(bool enabled);
void indexFullTextSearchChanged(bool enabled);
void showedDisplayPreviewChanged(bool enable);

void genericSettingCreated(Settings *settings);
void appSettingCreated(Settings *settings);
Expand Down
7 changes: 5 additions & 2 deletions src/dfm-base/qrc/configure/dde-file-manager.default.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
{
"ApplicationAttribute": {
"AllwayOpenOnNewWindow": false,
"IconSizeLevel": 1,
"IconSizeLevel": 5,
"ViewMode": 1,
"ViewSizeAdjustable": true,
"ViewComppactMode": false,
"ViewAutoCompace": false,
"OpenFileMode": 1,
"UrlOfNewWindow": "computer:///",
"UrlOfNewTab": "",
"ThemeName": "light"
"ThemeName": "light",
"GridDensityLevel": 3,
"ListHeightLevel": 0,
"ShowedDisplayPreview": false
},
"GenericAttribute": {
"IndexInternal": true,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/dfm-base/qrc/resources/resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,11 @@
<file>icons/deepin/builtin/texts/dfm_view_filter_16px.svg</file>
<file>icons/deepin/builtin/texts/dfm_sortby_arrange_16px.svg</file>
<file>icons/deepin/builtin/texts/dfm_viewoption_16px.svg</file>
<file>icons/deepin/builtin/texts/dfm_viewoptions_mingrid_16px.svg</file>
<file>icons/deepin/builtin/texts/dfm_viewoptions_maxgrid_16px.svg</file>
<file>icons/deepin/builtin/texts/dfm_viewoptions_minicon_16px.svg</file>
<file>icons/deepin/builtin/texts/dfm_viewoptions_maxicon_16px.svg</file>
<file>icons/deepin/builtin/texts/dfm_viewoptions_minlist_16px.svg</file>
<file>icons/deepin/builtin/texts/dfm_viewoptions_maxlist_16px.svg</file>
</qresource>
</RCC>
11 changes: 9 additions & 2 deletions src/dfm-base/utils/universalutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,15 @@ bool UniversalUtils::checkLaunchAppInterface()
bool UniversalUtils::launchAppByDBus(const QString &desktopFile, const QStringList &filePaths)
{
#ifdef COMPILE_ON_V23
const auto &AppId = DUtil::getAppIdFromAbsolutePath(desktopFile);
const auto &DBusAppId = DUtil::escapeToObjectPath(AppId);
const auto &file = QFileInfo { desktopFile };
constexpr auto kDesktopSuffix { u8"desktop" };

if (file.suffix() != kDesktopSuffix) {
qCDebug(logDFMBase) << "invalid desktop file:" << desktopFile << file;
return false;
}

const auto &DBusAppId = DUtil::escapeToObjectPath(file.completeBaseName());
const auto &currentAppPath = QString { APP_MANAGER_PATH_PREFIX } + "/" + DBusAppId;
qCDebug(logDFMBase) << "app object path:" << currentAppPath;
QDBusInterface appManager(APP_MANAGER_SERVICE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ inline constexpr char kAcComputerTitleBarBackBtn[] { "back_button" };
inline constexpr char kAcComputerTitleBarForwardBtn[] { "forword_button" };
inline constexpr char kAcComputerTitleBarSearchBtn[] { "search_button" };
inline constexpr char kAcComputerTitleBarDetailBtn[] { "detail_button" };
inline constexpr char kAcComputerTitleBarViewOptionsBtn[] { "viewoptions_button" };
inline constexpr char kAcComputerTitleBarListViewBtn[] { "listView_button" };
inline constexpr char kAcComputerTitleBarIconViewBtn[] { "iconView_button" };
inline constexpr char kAcComputerTitleBarTreeViewBtn[] { "treeView_button" };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ void TitleBarEventCaller::sendViewMode(QWidget *sender, DFMBASE_NAMESPACE::Globa
void TitleBarEventCaller::sendDetailViewState(QWidget *sender, bool checked)
{
quint64 id = TitleBarHelper::windowId(sender);
Q_ASSERT(id > 0);
if (id < 1) {
fmWarning() << "Invalid window id: " << id;
return;
}
dpfSlotChannel->push("dfmplugin_detailspace", "slot_DetailView_Show", id, checked);
}

Expand Down
Loading

0 comments on commit 14d4eba

Please sign in to comment.