21#ifndef PCMANFM_SETTINGS_H
22#define PCMANFM_SETTINGS_H
25#include <libfm-qt/folderview.h>
26#include <libfm-qt/foldermodel.h>
27#include "desktopwindow.h"
28#include <libfm-qt/sidepane.h>
29#include <libfm-qt/core/thumbnailjob.h>
30#include <libfm-qt/core/archiver.h>
31#include <libfm-qt/core/legacy/fm-config.h>
35enum OpenDirTargetType {
39 OpenInLastActiveWindow
48 sortOrder_(Qt::AscendingOrder),
49 sortColumn_(Fm::FolderModel::ColumnFileName),
50 viewMode_(Fm::FolderView::IconMode),
52 sortFolderFirst_(
true),
53 sortHiddenLast_(
false),
54 sortCaseSensitive_(
true),
58 bool isCustomized()
const {
62 void setCustomized(
bool value) {
63 isCustomized_ = value;
66 Qt::SortOrder sortOrder()
const {
70 void setSortOrder(Qt::SortOrder value) {
74 Fm::FolderModel::ColumnId sortColumn()
const {
78 void setSortColumn(Fm::FolderModel::ColumnId value) {
82 Fm::FolderView::ViewMode viewMode()
const {
86 void setViewMode(Fm::FolderView::ViewMode value) {
90 bool sortFolderFirst()
const {
91 return sortFolderFirst_;
94 void setSortFolderFirst(
bool value) {
95 sortFolderFirst_ = value;
98 bool sortHiddenLast()
const {
99 return sortHiddenLast_;
102 void setSortHiddenLast(
bool value) {
103 sortHiddenLast_ = value;
106 bool showHidden()
const {
110 void setShowHidden(
bool value) {
114 bool sortCaseSensitive()
const {
115 return sortCaseSensitive_;
118 void setSortCaseSensitive(
bool value) {
119 sortCaseSensitive_ = value;
122 bool recursive()
const {
126 void setRecursive(
bool value) {
130 Fm::FilePath inheritedPath()
const {
131 return inheritedPath_;
134 void seInheritedPath(
const Fm::FilePath& path) {
135 inheritedPath_ = std::move(path);
141 Qt::SortOrder sortOrder_;
142 Fm::FolderModel::ColumnId sortColumn_;
143 Fm::FolderView::ViewMode viewMode_;
145 bool sortFolderFirst_;
146 bool sortHiddenLast_;
147 bool sortCaseSensitive_;
149 Fm::FilePath inheritedPath_;
166 bool load(QString profile = QStringLiteral(
"default"));
167 bool save(QString profile = QString());
169 static QString xdgUserConfigDir();
170 static const QList<int> & iconSizes(IconType type);
172 QString profileDir(QString profile,
bool useFallback =
false);
175 QString profileName()
const {
179 bool supportTrash()
const {
180 return supportTrash_;
183 QString fallbackIconThemeName()
const {
184 return fallbackIconThemeName_;
187 bool useFallbackIconTheme()
const {
188 return useFallbackIconTheme_;
191 void setFallbackIconThemeName(QString iconThemeName) {
192 fallbackIconThemeName_ = iconThemeName;
195 bool singleWindowMode()
const {
196 return singleWindowMode_;
199 void setSingleWindowMode(
bool singleWindowMode) {
200 singleWindowMode_ = singleWindowMode;
203 OpenDirTargetType bookmarkOpenMethod() {
204 return bookmarkOpenMethod_;
207 void setBookmarkOpenMethod(OpenDirTargetType bookmarkOpenMethod) {
208 bookmarkOpenMethod_ = bookmarkOpenMethod;
211 QString suCommand()
const {
215 void setSuCommand(QString suCommand) {
216 suCommand_ = suCommand;
222 void setTerminal(QString terminalCommand);
224 QString archiver()
const {
228 void setArchiver(QString archiver) {
229 archiver_ = archiver;
230 Fm::Archiver::setDefaultArchiverByName(archiver_.toLocal8Bit().constData());
233 bool mountOnStartup()
const {
234 return mountOnStartup_;
237 void setMountOnStartup(
bool mountOnStartup) {
238 mountOnStartup_ = mountOnStartup;
241 bool mountRemovable() {
242 return mountRemovable_;
245 void setMountRemovable(
bool mountRemovable) {
246 mountRemovable_ = mountRemovable;
249 bool autoRun()
const {
253 void setAutoRun(
bool autoRun) {
257 bool closeOnUnmount()
const {
258 return closeOnUnmount_;
261 void setCloseOnUnmount(
bool value) {
262 closeOnUnmount_ = value;
265 DesktopWindow::WallpaperMode wallpaperMode()
const {
266 return DesktopWindow::WallpaperMode(wallpaperMode_);
269 void setWallpaperMode(
int wallpaperMode) {
270 wallpaperMode_ = wallpaperMode;
273 QString wallpaper()
const {
277 void setWallpaper(
const QString& wallpaper) {
278 wallpaper_ = wallpaper;
281 QSize wallpaperDialogSize()
const {
282 return wallpaperDialogSize_;
285 void setWallpaperDialogSize(
const QSize& size) {
286 wallpaperDialogSize_ = size;
289 int wallpaperDialogSplitterPos()
const {
290 return wallpaperDialogSplitterPos_;
293 void setWallpaperDialogSplitterPos(
int pos) {
294 wallpaperDialogSplitterPos_ = pos;
297 QString wallpaperDir()
const {
298 return wallpaperDir_;
301 void setLastSlide(QString wallpaper) {
302 lastSlide_ = wallpaper;
305 QString lastSlide()
const {
309 void setWallpaperDir(QString dir) {
313 int slideShowInterval()
const {
314 return slideShowInterval_;
317 void setSlideShowInterval(
int interval) {
318 slideShowInterval_ = interval;
321 bool wallpaperRandomize()
const {
322 return wallpaperRandomize_;
325 void setWallpaperRandomize(
bool randomize) {
326 wallpaperRandomize_ = randomize;
329 bool transformWallpaper()
const {
330 return transformWallpaper_;
333 void setTransformWallpaper(
bool tr) {
334 transformWallpaper_ = tr;
337 bool perScreenWallpaper()
const {
338 return perScreenWallpaper_;
341 void setPerScreenWallpaper(
bool tr) {
342 perScreenWallpaper_ = tr;
345 const QColor& desktopBgColor()
const {
346 return desktopBgColor_;
349 void setDesktopBgColor(QColor desktopBgColor) {
350 desktopBgColor_ = desktopBgColor;
353 const QColor& desktopFgColor()
const {
354 return desktopFgColor_;
357 void setDesktopFgColor(QColor desktopFgColor) {
358 desktopFgColor_ = desktopFgColor;
361 const QColor& desktopShadowColor()
const {
362 return desktopShadowColor_;
365 void setDesktopShadowColor(QColor desktopShadowColor) {
366 desktopShadowColor_ = desktopShadowColor;
369 QFont desktopFont()
const {
373 void setDesktopFont(QFont font) {
377 int desktopIconSize()
const {
378 return desktopIconSize_;
381 void setDesktopIconSize(
int desktopIconSize) {
382 desktopIconSize_ = desktopIconSize;
385 QStringList desktopShortcuts()
const {
386 return desktopShortcuts_;
389 void setDesktopShortcuts(
const QStringList& list) {
390 desktopShortcuts_ = list;
393 bool desktopShowHidden()
const {
394 return desktopShowHidden_;
397 void setDesktopShowHidden(
bool desktopShowHidden) {
398 desktopShowHidden_ = desktopShowHidden;
401 bool desktopHideItems()
const {
402 return desktopHideItems_;
405 void setDesktopHideItems(
bool hide) {
406 desktopHideItems_ = hide;
409 Qt::SortOrder desktopSortOrder()
const {
410 return desktopSortOrder_;
413 void setDesktopSortOrder(Qt::SortOrder desktopSortOrder) {
414 desktopSortOrder_ = desktopSortOrder;
417 Fm::FolderModel::ColumnId desktopSortColumn()
const {
418 return desktopSortColumn_;
421 void setDesktopSortColumn(Fm::FolderModel::ColumnId desktopSortColumn) {
422 desktopSortColumn_ = desktopSortColumn;
425 bool desktopSortFolderFirst()
const {
426 return desktopSortFolderFirst_;
429 void setDesktopSortFolderFirst(
bool desktopFolderFirst) {
430 desktopSortFolderFirst_ = desktopFolderFirst;
433 bool desktopSortHiddenLast()
const {
434 return desktopSortHiddenLast_;
437 void setDesktopSortHiddenLast(
bool desktopHiddenLast) {
438 desktopSortHiddenLast_ = desktopHiddenLast;
441 bool alwaysShowTabs()
const {
442 return alwaysShowTabs_;
445 void setAlwaysShowTabs(
bool alwaysShowTabs) {
446 alwaysShowTabs_ = alwaysShowTabs;
449 bool showTabClose()
const {
450 return showTabClose_;
453 void setShowTabClose(
bool showTabClose) {
454 showTabClose_ = showTabClose;
457 bool switchToNewTab()
const {
458 return switchToNewTab_;
461 void setSwitchToNewTab(
bool showTabClose) {
462 switchToNewTab_ = showTabClose;
465 bool reopenLastTabs()
const {
466 return reopenLastTabs_;
469 void setReopenLastTabs(
bool reopenLastTabs) {
470 reopenLastTabs_ = reopenLastTabs;
473 QStringList tabPaths()
const {
477 void setTabPaths(
const QStringList& tabPaths) {
478 tabPaths_ = tabPaths;
481 bool rememberWindowSize()
const {
482 return rememberWindowSize_;
485 void setRememberWindowSize(
bool rememberWindowSize) {
486 rememberWindowSize_ = rememberWindowSize;
489 int windowWidth()
const {
490 if(rememberWindowSize_) {
491 return lastWindowWidth_;
494 return fixedWindowWidth_;
498 int windowHeight()
const {
499 if(rememberWindowSize_) {
500 return lastWindowHeight_;
503 return fixedWindowHeight_;
507 bool windowMaximized()
const {
508 if(rememberWindowSize_) {
509 return lastWindowMaximized_;
516 int fixedWindowWidth()
const {
517 return fixedWindowWidth_;
520 void setFixedWindowWidth(
int fixedWindowWidth) {
521 fixedWindowWidth_ = fixedWindowWidth;
524 int fixedWindowHeight()
const {
525 return fixedWindowHeight_;
528 void setFixedWindowHeight(
int fixedWindowHeight) {
529 fixedWindowHeight_ = fixedWindowHeight;
532 void setLastWindowWidth(
int lastWindowWidth) {
533 lastWindowWidth_ = lastWindowWidth;
536 void setLastWindowHeight(
int lastWindowHeight) {
537 lastWindowHeight_ = lastWindowHeight;
540 void setLastWindowMaximized(
bool lastWindowMaximized) {
541 lastWindowMaximized_ = lastWindowMaximized;
544 int splitterPos()
const {
548 void setSplitterPos(
int splitterPos) {
549 splitterPos_ = splitterPos;
552 bool isSidePaneVisible()
const {
553 return sidePaneVisible_;
556 void showSidePane(
bool show) {
557 sidePaneVisible_ = show;
560 Fm::SidePane::Mode sidePaneMode()
const {
561 return sidePaneMode_;
564 void setSidePaneMode(Fm::SidePane::Mode sidePaneMode) {
565 sidePaneMode_ = sidePaneMode;
568 bool showMenuBar()
const {
572 void setShowMenuBar(
bool showMenuBar) {
573 showMenuBar_ = showMenuBar;
576 bool splitView()
const {
580 void setSplitView(
bool split) {
584 Fm::FolderView::ViewMode viewMode()
const {
588 void setViewMode(Fm::FolderView::ViewMode viewMode) {
589 viewMode_ = viewMode;
592 bool showHidden()
const {
596 void setShowHidden(
bool showHidden) {
597 showHidden_ = showHidden;
600 bool sortCaseSensitive()
const {
601 return sortCaseSensitive_;
604 void setSortCaseSensitive(
bool value) {
605 sortCaseSensitive_ = value;
608 QSet<QString> getHiddenPlaces()
const {
609 return hiddenPlaces_;
612 void setHiddenPlace(
const QString& str,
bool hide) {
614 hiddenPlaces_ << str;
617 hiddenPlaces_.remove(str);
621 Qt::SortOrder sortOrder()
const {
625 void setSortOrder(Qt::SortOrder sortOrder) {
626 sortOrder_ = sortOrder;
629 Fm::FolderModel::ColumnId sortColumn()
const {
633 void setSortColumn(Fm::FolderModel::ColumnId sortColumn) {
634 sortColumn_ = sortColumn;
637 bool sortFolderFirst()
const {
638 return sortFolderFirst_;
641 void setSortFolderFirst(
bool folderFirst) {
642 sortFolderFirst_ = folderFirst;
645 bool sortHiddenLast()
const {
646 return sortHiddenLast_;
649 void setSortHiddenLast(
bool hiddenLast) {
650 sortHiddenLast_ = hiddenLast;
653 bool showFilter()
const {
657 void setShowFilter(
bool value) {
661 bool pathBarButtons()
const {
662 return pathBarButtons_;
665 void setPathBarButtons(
bool value) {
666 pathBarButtons_ = value;
670 bool singleClick()
const {
674 void setSingleClick(
bool singleClick) {
675 singleClick_ = singleClick;
678 int autoSelectionDelay()
const {
679 return autoSelectionDelay_;
682 void setAutoSelectionDelay(
int value) {
683 autoSelectionDelay_ = value;
686 bool ctrlRightClick()
const {
687 return ctrlRightClick_;
690 void setCtrlRightClick(
bool value) {
691 ctrlRightClick_ = value;
694 bool useTrash()
const {
701 void setUseTrash(
bool useTrash) {
702 useTrash_ = useTrash;
705 bool confirmDelete()
const {
706 return confirmDelete_;
709 void setConfirmDelete(
bool confirmDelete) {
710 confirmDelete_ = confirmDelete;
713 bool noUsbTrash()
const {
717 void setNoUsbTrash(
bool noUsbTrash) {
718 noUsbTrash_ = noUsbTrash;
719 fm_config->no_usb_trash = noUsbTrash_;
722 bool confirmTrash()
const {
723 return confirmTrash_;
726 void setConfirmTrash(
bool value) {
727 confirmTrash_ = value;
730 bool quickExec()
const {
734 void setQuickExec(
bool value) {
736 fm_config->quick_exec = quickExec_;
739 bool selectNewFiles()
const {
740 return selectNewFiles_;
743 void setSelectNewFiles(
bool value) {
744 selectNewFiles_ = value;
747 int bigIconSize()
const {
751 void setBigIconSize(
int bigIconSize) {
752 bigIconSize_ = bigIconSize;
755 int smallIconSize()
const {
756 return smallIconSize_;
759 void setSmallIconSize(
int smallIconSize) {
760 smallIconSize_ = smallIconSize;
763 int sidePaneIconSize()
const {
764 return sidePaneIconSize_;
767 void setSidePaneIconSize(
int sidePaneIconSize) {
768 sidePaneIconSize_ = sidePaneIconSize;
771 int thumbnailIconSize()
const {
772 return thumbnailIconSize_;
775 QSize folderViewCellMargins()
const {
776 return folderViewCellMargins_;
779 void setFolderViewCellMargins(QSize size) {
780 folderViewCellMargins_ = size;
783 QSize desktopCellMargins()
const {
784 return desktopCellMargins_;
787 void setDesktopCellMargins(QSize size) {
788 desktopCellMargins_ = size;
791 QMargins workAreaMargins()
const {
792 return workAreaMargins_;
795 void setWorkAreaMargins(QMargins margins) {
796 workAreaMargins_ = margins;
799 bool openWithDefaultFileManager()
const {
800 return openWithDefaultFileManager_;
803 void setOpenWithDefaultFileManager(
bool open) {
804 openWithDefaultFileManager_ = open;
807 bool allSticky()
const {
811 void setAllSticky(
bool sticky) {
815 bool showThumbnails() {
816 return showThumbnails_;
819 void setShowThumbnails(
bool show) {
820 showThumbnails_ = show;
823 void setThumbnailLocalFilesOnly(
bool value) {
824 Fm::ThumbnailJob::setLocalFilesOnly(value);
827 bool thumbnailLocalFilesOnly()
const {
828 return Fm::ThumbnailJob::localFilesOnly();
831 int maxThumbnailFileSize()
const {
832 return Fm::ThumbnailJob::maxThumbnailFileSize();
835 void setMaxThumbnailFileSize(
int size) {
836 Fm::ThumbnailJob::setMaxThumbnailFileSize(size);
839 int maxExternalThumbnailFileSize()
const {
840 return Fm::ThumbnailJob::maxExternalThumbnailFileSize();
843 void setMaxExternalThumbnailFileSize(
int size) {
844 Fm::ThumbnailJob::setMaxExternalThumbnailFileSize(size);
847 void setThumbnailIconSize(
int thumbnailIconSize) {
848 thumbnailIconSize_ = thumbnailIconSize;
855 void setSiUnit(
bool siUnit) {
858 fm_config->si_unit = (gboolean)siUnit_;
861 bool backupAsHidden()
const {
862 return backupAsHidden_;
865 void setBackupAsHidden(
bool value) {
866 backupAsHidden_ = value;
867 fm_config->backup_as_hidden = backupAsHidden_;
870 bool showFullNames()
const {
871 return showFullNames_;
874 void setShowFullNames(
bool value) {
875 showFullNames_ = value;
878 bool shadowHidden()
const {
879 return shadowHidden_;
882 void setShadowHidden(
bool value) {
883 shadowHidden_ = value;
886 bool noItemTooltip()
const {
887 return noItemTooltip_;
890 void setNoItemTooltip(
bool noTooltip) {
891 noItemTooltip_ = noTooltip;
894 bool scrollPerPixel()
const {
895 return scrollPerPixel_;
898 void setScrollPerPixel(
bool perPixel) {
899 scrollPerPixel_ = perPixel;
902 bool onlyUserTemplates()
const {
903 return onlyUserTemplates_;
906 void setOnlyUserTemplates(
bool value) {
907 onlyUserTemplates_ = value;
908 fm_config->only_user_templates = onlyUserTemplates_;
911 bool templateTypeOnce()
const {
912 return templateTypeOnce_;
915 void setTemplateTypeOnce(
bool value) {
916 templateTypeOnce_ = value;
917 fm_config->template_type_once = templateTypeOnce_;
920 bool templateRunApp()
const {
921 return templateRunApp_;
924 void setTemplateRunApp(
bool value) {
925 templateRunApp_ = value;
926 fm_config->template_run_app = templateRunApp_;
930 FolderSettings loadFolderSettings(
const Fm::FilePath& path)
const;
932 void saveFolderSettings(
const Fm::FilePath& path,
const FolderSettings& settings);
934 void clearFolderSettings(
const Fm::FilePath& path)
const;
936 bool searchNameCaseInsensitive()
const {
937 return searchNameCaseInsensitive_;
940 void setSearchNameCaseInsensitive(
bool caseInsensitive) {
941 searchNameCaseInsensitive_ = caseInsensitive;
944 bool searchContentCaseInsensitive()
const {
945 return searchContentCaseInsensitive_;
948 void setsearchContentCaseInsensitive(
bool caseInsensitive) {
949 searchContentCaseInsensitive_ = caseInsensitive;
952 bool searchNameRegexp()
const {
953 return searchNameRegexp_;
956 void setSearchNameRegexp(
bool reg) {
957 searchNameRegexp_ = reg;
960 bool searchContentRegexp()
const {
961 return searchContentRegexp_;
964 void setSearchContentRegexp(
bool reg) {
965 searchContentRegexp_ = reg;
968 bool searchRecursive()
const {
969 return searchRecursive_;
972 void setSearchRecursive(
bool rec) {
973 searchRecursive_ = rec;
976 bool searchhHidden()
const {
977 return searchhHidden_;
980 void setSearchhHidden(
bool hidden) {
981 searchhHidden_ = hidden;
984 int maxSearchHistory()
const {
985 return maxSearchHistory_;
988 void setMaxSearchHistory(
int max);
990 void clearSearchHistory();
992 QStringList namePatterns()
const {
993 return namePatterns_;
996 void addNamePattern(
const QString& pattern);
998 QStringList contentPatterns()
const {
999 return contentPatterns_;
1002 void addContentPattern(
const QString& pattern);
1004 QList<int> getCustomColumnWidths()
const {
1006 for(
auto width : qAsConst(customColumnWidths_)) {
1012 void setCustomColumnWidths(
const QList<int> &widths) {
1013 customColumnWidths_.clear();
1014 for(
auto width : widths) {
1015 customColumnWidths_ << QVariant(width);
1019 QList<int> getHiddenColumns()
const {
1021 for(
auto width : qAsConst(hiddenColumns_)) {
1027 void setHiddenColumns(
const QList<int> &columns) {
1028 hiddenColumns_.clear();
1029 for(
auto column : columns) {
1030 hiddenColumns_ << QVariant(column);
1034 int getRecentFilesNumber()
const {
1035 return recentFilesNumber_;
1037 void setRecentFilesNumber(
int n);
1039 QStringList getRecentFiles()
const {
1040 return recentFiles_;
1042 void clearRecentFiles();
1043 void addRecentFile(
const QString& file);
1045 void loadRecentFiles();
1046 void saveRecentFiles();
1049 bool loadFile(QString filePath);
1050 bool saveFile(QString filePath);
1052 int toIconSize(
int size, IconType type)
const;
1055 QString profileName_;
1059 QString fallbackIconThemeName_;
1060 bool useFallbackIconTheme_;
1062 bool singleWindowMode_;
1063 OpenDirTargetType bookmarkOpenMethod_;
1066 bool mountOnStartup_;
1067 bool mountRemovable_;
1069 bool closeOnUnmount_;
1073 QSize wallpaperDialogSize_;
1074 int wallpaperDialogSplitterPos_;
1076 QString wallpaperDir_;
1077 int slideShowInterval_;
1078 bool wallpaperRandomize_;
1079 bool transformWallpaper_;
1080 bool perScreenWallpaper_;
1081 QColor desktopBgColor_;
1082 QColor desktopFgColor_;
1083 QColor desktopShadowColor_;
1085 int desktopIconSize_;
1086 QStringList desktopShortcuts_;
1088 bool desktopShowHidden_;
1089 bool desktopHideItems_;
1090 Qt::SortOrder desktopSortOrder_;
1091 Fm::FolderModel::ColumnId desktopSortColumn_;
1092 bool desktopSortFolderFirst_;
1093 bool desktopSortHiddenLast_;
1095 bool alwaysShowTabs_;
1097 bool switchToNewTab_;
1098 bool reopenLastTabs_;
1099 QStringList tabPaths_;
1100 bool rememberWindowSize_;
1101 int fixedWindowWidth_;
1102 int fixedWindowHeight_;
1103 int lastWindowWidth_;
1104 int lastWindowHeight_;
1105 bool lastWindowMaximized_;
1107 bool sidePaneVisible_;
1108 Fm::SidePane::Mode sidePaneMode_;
1112 Fm::FolderView::ViewMode viewMode_;
1114 Qt::SortOrder sortOrder_;
1115 Fm::FolderModel::ColumnId sortColumn_;
1116 bool sortFolderFirst_;
1117 bool sortHiddenLast_;
1118 bool sortCaseSensitive_;
1120 bool pathBarButtons_;
1124 int autoSelectionDelay_;
1125 bool ctrlRightClick_;
1127 bool confirmDelete_;
1131 bool selectNewFiles_;
1133 bool showThumbnails_;
1137 bool backupAsHidden_;
1138 bool showFullNames_;
1140 bool noItemTooltip_;
1141 bool scrollPerPixel_;
1143 QSet<QString> hiddenPlaces_;
1147 int sidePaneIconSize_;
1148 int thumbnailIconSize_;
1150 bool onlyUserTemplates_;
1151 bool templateTypeOnce_;
1152 bool templateRunApp_;
1154 QSize folderViewCellMargins_;
1155 QSize desktopCellMargins_;
1156 QMargins workAreaMargins_;
1158 bool openWithDefaultFileManager_;
1163 bool searchNameCaseInsensitive_;
1164 bool searchContentCaseInsensitive_;
1165 bool searchNameRegexp_;
1166 bool searchContentRegexp_;
1167 bool searchRecursive_;
1168 bool searchhHidden_;
1169 int maxSearchHistory_;
1170 QStringList namePatterns_;
1171 QStringList contentPatterns_;
1174 QList<QVariant> customColumnWidths_;
1175 QList<QVariant> hiddenColumns_;
1178 int recentFilesNumber_;
1179 QStringList recentFiles_;
Definition settings.h:154