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>
35 enum 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) {
57 bool isCustomized()
const {
61 void setCustomized(
bool value) {
62 isCustomized_ = value;
65 Qt::SortOrder sortOrder()
const {
69 void setSortOrder(Qt::SortOrder value) {
73 Fm::FolderModel::ColumnId sortColumn()
const {
77 void setSortColumn(Fm::FolderModel::ColumnId value) {
81 Fm::FolderView::ViewMode viewMode()
const {
85 void setViewMode(Fm::FolderView::ViewMode value) {
89 bool sortFolderFirst()
const {
90 return sortFolderFirst_;
93 void setSortFolderFirst(
bool value) {
94 sortFolderFirst_ = value;
97 bool sortHiddenLast()
const {
98 return sortHiddenLast_;
101 void setSortHiddenLast(
bool value) {
102 sortHiddenLast_ = value;
105 bool showHidden()
const {
109 void setShowHidden(
bool value) {
113 bool sortCaseSensitive()
const {
114 return sortCaseSensitive_;
117 void setSortCaseSensitive(
bool value) {
118 sortCaseSensitive_ = value;
123 Qt::SortOrder sortOrder_;
124 Fm::FolderModel::ColumnId sortColumn_;
125 Fm::FolderView::ViewMode viewMode_;
127 bool sortFolderFirst_;
128 bool sortHiddenLast_;
129 bool sortCaseSensitive_;
146 bool load(QString profile = QStringLiteral(
"default"));
147 bool save(QString profile = QString());
149 bool loadFile(QString filePath);
150 bool saveFile(QString filePath);
152 static QString xdgUserConfigDir();
153 static const QList<int> & iconSizes(IconType type);
155 QString profileDir(QString profile,
bool useFallback =
false);
158 QString profileName()
const {
162 bool supportTrash()
const {
163 return supportTrash_;
166 QString fallbackIconThemeName()
const {
167 return fallbackIconThemeName_;
170 bool useFallbackIconTheme()
const {
171 return useFallbackIconTheme_;
174 void setFallbackIconThemeName(QString iconThemeName) {
175 fallbackIconThemeName_ = iconThemeName;
178 bool singleWindowMode()
const {
179 return singleWindowMode_;
182 void setSingleWindowMode(
bool singleWindowMode) {
183 singleWindowMode_ = singleWindowMode;
186 OpenDirTargetType bookmarkOpenMethod() {
187 return bookmarkOpenMethod_;
190 void setBookmarkOpenMethod(OpenDirTargetType bookmarkOpenMethod) {
191 bookmarkOpenMethod_ = bookmarkOpenMethod;
194 QString suCommand()
const {
198 void setSuCommand(QString suCommand) {
199 suCommand_ = suCommand;
205 void setTerminal(QString terminalCommand);
207 QString archiver()
const {
211 void setArchiver(QString archiver) {
212 archiver_ = archiver;
213 Fm::Archiver::setDefaultArchiverByName(archiver_.toLocal8Bit().constData());
216 bool mountOnStartup()
const {
217 return mountOnStartup_;
220 void setMountOnStartup(
bool mountOnStartup) {
221 mountOnStartup_ = mountOnStartup;
224 bool mountRemovable() {
225 return mountRemovable_;
228 void setMountRemovable(
bool mountRemovable) {
229 mountRemovable_ = mountRemovable;
232 bool autoRun()
const {
236 void setAutoRun(
bool autoRun) {
240 bool closeOnUnmount()
const {
241 return closeOnUnmount_;
244 void setCloseOnUnmount(
bool value) {
245 closeOnUnmount_ = value;
248 DesktopWindow::WallpaperMode wallpaperMode()
const {
249 return DesktopWindow::WallpaperMode(wallpaperMode_);
252 void setWallpaperMode(
int wallpaperMode) {
253 wallpaperMode_ = wallpaperMode;
256 QString wallpaper()
const {
260 void setWallpaper(QString wallpaper) {
261 wallpaper_ = wallpaper;
264 QSize wallpaperDialogSize()
const {
265 return wallpaperDialogSize_;
268 void setWallpaperDialogSize(
const QSize& size) {
269 wallpaperDialogSize_ = size;
272 int wallpaperDialogSplitterPos()
const {
273 return wallpaperDialogSplitterPos_;
276 void setWallpaperDialogSplitterPos(
int pos) {
277 wallpaperDialogSplitterPos_ = pos;
280 QString wallpaperDir()
const {
281 return wallpaperDir_;
284 void setLastSlide(QString wallpaper) {
285 lastSlide_ = wallpaper;
288 QString lastSlide()
const {
292 void setWallpaperDir(QString dir) {
296 int slideShowInterval()
const {
297 return slideShowInterval_;
300 void setSlideShowInterval(
int interval) {
301 slideShowInterval_ = interval;
304 bool wallpaperRandomize()
const {
305 return wallpaperRandomize_;
308 void setWallpaperRandomize(
bool randomize) {
309 wallpaperRandomize_ = randomize;
312 bool transformWallpaper()
const {
313 return transformWallpaper_;
316 void setTransformWallpaper(
bool tr) {
317 transformWallpaper_ = tr;
320 bool perScreenWallpaper()
const {
321 return perScreenWallpaper_;
324 void setPerScreenWallpaper(
bool tr) {
325 perScreenWallpaper_ = tr;
328 const QColor& desktopBgColor()
const {
329 return desktopBgColor_;
332 void setDesktopBgColor(QColor desktopBgColor) {
333 desktopBgColor_ = desktopBgColor;
336 const QColor& desktopFgColor()
const {
337 return desktopFgColor_;
340 void setDesktopFgColor(QColor desktopFgColor) {
341 desktopFgColor_ = desktopFgColor;
344 const QColor& desktopShadowColor()
const {
345 return desktopShadowColor_;
348 void setDesktopShadowColor(QColor desktopShadowColor) {
349 desktopShadowColor_ = desktopShadowColor;
352 QFont desktopFont()
const {
356 void setDesktopFont(QFont font) {
360 int desktopIconSize()
const {
361 return desktopIconSize_;
364 void setDesktopIconSize(
int desktopIconSize) {
365 desktopIconSize_ = desktopIconSize;
368 QStringList desktopShortcuts()
const {
369 return desktopShortcuts_;
372 void setDesktopShortcuts(
const QStringList& list) {
373 desktopShortcuts_ = list;
376 bool desktopShowHidden()
const {
377 return desktopShowHidden_;
380 void setDesktopShowHidden(
bool desktopShowHidden) {
381 desktopShowHidden_ = desktopShowHidden;
384 bool desktopHideItems()
const {
385 return desktopHideItems_;
388 void setDesktopHideItems(
bool hide) {
389 desktopHideItems_ = hide;
392 Qt::SortOrder desktopSortOrder()
const {
393 return desktopSortOrder_;
396 void setDesktopSortOrder(Qt::SortOrder desktopSortOrder) {
397 desktopSortOrder_ = desktopSortOrder;
400 Fm::FolderModel::ColumnId desktopSortColumn()
const {
401 return desktopSortColumn_;
404 void setDesktopSortColumn(Fm::FolderModel::ColumnId desktopSortColumn) {
405 desktopSortColumn_ = desktopSortColumn;
408 bool desktopSortFolderFirst()
const {
409 return desktopSortFolderFirst_;
412 void setDesktopSortFolderFirst(
bool desktopFolderFirst) {
413 desktopSortFolderFirst_ = desktopFolderFirst;
416 bool desktopSortHiddenLast()
const {
417 return desktopSortHiddenLast_;
420 void setDesktopSortHiddenLast(
bool desktopHiddenLast) {
421 desktopSortHiddenLast_ = desktopHiddenLast;
424 bool alwaysShowTabs()
const {
425 return alwaysShowTabs_;
428 void setAlwaysShowTabs(
bool alwaysShowTabs) {
429 alwaysShowTabs_ = alwaysShowTabs;
432 bool showTabClose()
const {
433 return showTabClose_;
436 void setShowTabClose(
bool showTabClose) {
437 showTabClose_ = showTabClose;
440 bool rememberWindowSize()
const {
441 return rememberWindowSize_;
444 void setRememberWindowSize(
bool rememberWindowSize) {
445 rememberWindowSize_ = rememberWindowSize;
448 int windowWidth()
const {
449 if(rememberWindowSize_) {
450 return lastWindowWidth_;
453 return fixedWindowWidth_;
457 int windowHeight()
const {
458 if(rememberWindowSize_) {
459 return lastWindowHeight_;
462 return fixedWindowHeight_;
466 bool windowMaximized()
const {
467 if(rememberWindowSize_) {
468 return lastWindowMaximized_;
475 int fixedWindowWidth()
const {
476 return fixedWindowWidth_;
479 void setFixedWindowWidth(
int fixedWindowWidth) {
480 fixedWindowWidth_ = fixedWindowWidth;
483 int fixedWindowHeight()
const {
484 return fixedWindowHeight_;
487 void setFixedWindowHeight(
int fixedWindowHeight) {
488 fixedWindowHeight_ = fixedWindowHeight;
491 void setLastWindowWidth(
int lastWindowWidth) {
492 lastWindowWidth_ = lastWindowWidth;
495 void setLastWindowHeight(
int lastWindowHeight) {
496 lastWindowHeight_ = lastWindowHeight;
499 void setLastWindowMaximized(
bool lastWindowMaximized) {
500 lastWindowMaximized_ = lastWindowMaximized;
503 int splitterPos()
const {
507 void setSplitterPos(
int splitterPos) {
508 splitterPos_ = splitterPos;
511 bool isSidePaneVisible()
const {
512 return sidePaneVisible_;
515 void showSidePane(
bool show) {
516 sidePaneVisible_ = show;
519 Fm::SidePane::Mode sidePaneMode()
const {
520 return sidePaneMode_;
523 void setSidePaneMode(Fm::SidePane::Mode sidePaneMode) {
524 sidePaneMode_ = sidePaneMode;
527 bool showMenuBar()
const {
531 void setShowMenuBar(
bool showMenuBar) {
532 showMenuBar_ = showMenuBar;
535 bool splitView()
const {
539 void setSplitView(
bool split) {
543 Fm::FolderView::ViewMode viewMode()
const {
547 void setViewMode(Fm::FolderView::ViewMode viewMode) {
548 viewMode_ = viewMode;
551 bool showHidden()
const {
555 void setShowHidden(
bool showHidden) {
556 showHidden_ = showHidden;
559 bool sortCaseSensitive()
const {
560 return sortCaseSensitive_;
563 void setSortCaseSensitive(
bool value) {
564 sortCaseSensitive_ = value;
568 bool placesHome()
const {
572 void setPlacesHome(
bool placesHome) {
573 placesHome_ = placesHome;
576 bool placesDesktop()
const {
577 return placesDesktop_;
580 void setPlacesDesktop(
bool placesDesktop) {
581 placesDesktop_ = placesDesktop;
584 bool placesApplications()
const {
585 return placesApplications_;
588 void setPlacesApplications(
bool placesApplications) {
589 placesApplications_ = placesApplications;
592 bool placesTrash()
const {
596 void setPlacesTrash(
bool placesTrash) {
597 placesTrash_ = placesTrash;
600 bool placesRoot()
const {
604 void setPlacesRoot(
bool placesRoot) {
605 placesRoot_ = placesRoot;
608 bool placesComputer()
const {
609 return placesComputer_;
612 void setPlacesComputer(
bool placesComputer) {
613 placesComputer_ = placesComputer;
616 bool placesNetwork()
const {
617 return placesNetwork_;
620 void setPlacesNetwork(
bool placesNetwork) {
621 placesNetwork_ = placesNetwork;
624 QSet<QString> getHiddenPlaces()
const {
625 return hiddenPlaces_;
628 void setHiddenPlace(
const QString& str,
bool hide) {
630 hiddenPlaces_ << str;
633 hiddenPlaces_.remove(str);
638 Qt::SortOrder sortOrder()
const {
642 void setSortOrder(Qt::SortOrder sortOrder) {
643 sortOrder_ = sortOrder;
646 Fm::FolderModel::ColumnId sortColumn()
const {
650 void setSortColumn(Fm::FolderModel::ColumnId sortColumn) {
651 sortColumn_ = sortColumn;
654 bool sortFolderFirst()
const {
655 return sortFolderFirst_;
658 void setSortFolderFirst(
bool folderFirst) {
659 sortFolderFirst_ = folderFirst;
662 bool sortHiddenLast()
const {
663 return sortHiddenLast_;
666 void setSortHiddenLast(
bool hiddenLast) {
667 sortHiddenLast_ = hiddenLast;
670 bool showFilter()
const {
674 void setShowFilter(
bool value) {
678 bool pathBarButtons()
const {
679 return pathBarButtons_;
682 void setPathBarButtons(
bool value) {
683 pathBarButtons_ = value;
687 bool singleClick()
const {
691 void setSingleClick(
bool singleClick) {
692 singleClick_ = singleClick;
695 int autoSelectionDelay()
const {
696 return autoSelectionDelay_;
699 void setAutoSelectionDelay(
int value) {
700 autoSelectionDelay_ = value;
703 bool ctrlRightClick()
const {
704 return ctrlRightClick_;
707 void setCtrlRightClick(
bool value) {
708 ctrlRightClick_ = value;
711 bool useTrash()
const {
718 void setUseTrash(
bool useTrash) {
719 useTrash_ = useTrash;
722 bool confirmDelete()
const {
723 return confirmDelete_;
726 void setConfirmDelete(
bool confirmDelete) {
727 confirmDelete_ = confirmDelete;
730 bool noUsbTrash()
const {
734 void setNoUsbTrash(
bool noUsbTrash) {
735 noUsbTrash_ = noUsbTrash;
736 fm_config->no_usb_trash = noUsbTrash_;
739 bool confirmTrash()
const {
740 return confirmTrash_;
743 void setConfirmTrash(
bool value) {
744 confirmTrash_ = value;
747 bool quickExec()
const {
751 void setQuickExec(
bool value) {
753 fm_config->quick_exec = quickExec_;
756 bool selectNewFiles()
const {
757 return selectNewFiles_;
760 void setSelectNewFiles(
bool value) {
761 selectNewFiles_ = value;
767 int bigIconSize()
const {
771 void setBigIconSize(
int bigIconSize) {
772 bigIconSize_ = bigIconSize;
775 int smallIconSize()
const {
776 return smallIconSize_;
779 void setSmallIconSize(
int smallIconSize) {
780 smallIconSize_ = smallIconSize;
783 int sidePaneIconSize()
const {
784 return sidePaneIconSize_;
787 void setSidePaneIconSize(
int sidePaneIconSize) {
788 sidePaneIconSize_ = sidePaneIconSize;
791 int thumbnailIconSize()
const {
792 return thumbnailIconSize_;
795 QSize folderViewCellMargins()
const {
796 return folderViewCellMargins_;
799 void setFolderViewCellMargins(QSize size) {
800 folderViewCellMargins_ = size;
803 QSize desktopCellMargins()
const {
804 return desktopCellMargins_;
807 void setDesktopCellMargins(QSize size) {
808 desktopCellMargins_ = size;
812 bool showThumbnails() {
813 return showThumbnails_;
816 void setShowThumbnails(
bool show) {
817 showThumbnails_ = show;
820 void setThumbnailLocalFilesOnly(
bool value) {
821 Fm::ThumbnailJob::setLocalFilesOnly(value);
824 bool thumbnailLocalFilesOnly()
const {
825 return Fm::ThumbnailJob::localFilesOnly();
828 int maxThumbnailFileSize()
const {
829 return Fm::ThumbnailJob::maxThumbnailFileSize();
832 void setMaxThumbnailFileSize(
int size) {
833 Fm::ThumbnailJob::setMaxThumbnailFileSize(size);
836 void setThumbnailIconSize(
int thumbnailIconSize) {
837 thumbnailIconSize_ = thumbnailIconSize;
844 void setSiUnit(
bool siUnit) {
847 fm_config->si_unit = (gboolean)siUnit_;
850 bool backupAsHidden()
const {
851 return backupAsHidden_;
854 void setBackupAsHidden(
bool value) {
855 backupAsHidden_ = value;
856 fm_config->backup_as_hidden = backupAsHidden_;
859 bool showFullNames()
const {
860 return showFullNames_;
863 void setShowFullNames(
bool value) {
864 showFullNames_ = value;
867 bool shadowHidden()
const {
868 return shadowHidden_;
871 void setShadowHidden(
bool value) {
872 shadowHidden_ = value;
875 bool onlyUserTemplates()
const {
876 return onlyUserTemplates_;
879 void setOnlyUserTemplates(
bool value) {
880 onlyUserTemplates_ = value;
881 fm_config->only_user_templates = onlyUserTemplates_;
884 bool templateTypeOnce()
const {
885 return templateTypeOnce_;
888 void setTemplateTypeOnce(
bool value) {
889 templateTypeOnce_ = value;
890 fm_config->template_type_once = templateTypeOnce_;
893 bool templateRunApp()
const {
894 return templateRunApp_;
897 void setTemplateRunApp(
bool value) {
898 templateRunApp_ = value;
899 fm_config->template_run_app = templateRunApp_;
903 FolderSettings loadFolderSettings(
const Fm::FilePath& path)
const;
905 void saveFolderSettings(
const Fm::FilePath& path,
const FolderSettings& settings);
907 void clearFolderSettings(
const Fm::FilePath& path)
const;
909 bool searchNameCaseInsensitive()
const {
910 return searchNameCaseInsensitive_;
913 void setSearchNameCaseInsensitive(
bool caseInsensitive) {
914 searchNameCaseInsensitive_ = caseInsensitive;
917 bool searchContentCaseInsensitive()
const {
918 return searchContentCaseInsensitive_;
921 void setsearchContentCaseInsensitive(
bool caseInsensitive) {
922 searchContentCaseInsensitive_ = caseInsensitive;
925 bool searchNameRegexp()
const {
926 return searchNameRegexp_;
929 void setSearchNameRegexp(
bool reg) {
930 searchNameRegexp_ = reg;
933 bool searchContentRegexp()
const {
934 return searchContentRegexp_;
937 void setSearchContentRegexp(
bool reg) {
938 searchContentRegexp_ = reg;
941 bool searchRecursive()
const {
942 return searchRecursive_;
945 void setSearchRecursive(
bool rec) {
946 searchRecursive_ = rec;
949 bool searchhHidden()
const {
950 return searchhHidden_;
953 void setSearchhHidden(
bool hidden) {
954 searchhHidden_ = hidden;
957 QList<int> getCustomColumnWidths()
const {
959 for(
auto width : qAsConst(customColumnWidths_)) {
965 void setCustomColumnWidths(
const QList<int> &widths) {
966 customColumnWidths_.clear();
967 for(
auto width : widths) {
968 customColumnWidths_ << QVariant(width);
972 QList<int> getHiddenColumns()
const {
974 for(
auto width : qAsConst(hiddenColumns_)) {
980 void setHiddenColumns(
const QList<int> &columns) {
981 hiddenColumns_.clear();
982 for(
auto column : columns) {
983 hiddenColumns_ << QVariant(column);
988 int toIconSize(
int size, IconType type)
const;
990 QString profileName_;
994 QString fallbackIconThemeName_;
995 bool useFallbackIconTheme_;
997 bool singleWindowMode_;
998 OpenDirTargetType bookmarkOpenMethod_;
1001 bool mountOnStartup_;
1002 bool mountRemovable_;
1004 bool closeOnUnmount_;
1008 QSize wallpaperDialogSize_;
1009 int wallpaperDialogSplitterPos_;
1011 QString wallpaperDir_;
1012 int slideShowInterval_;
1013 bool wallpaperRandomize_;
1014 bool transformWallpaper_;
1015 bool perScreenWallpaper_;
1016 QColor desktopBgColor_;
1017 QColor desktopFgColor_;
1018 QColor desktopShadowColor_;
1020 int desktopIconSize_;
1021 QStringList desktopShortcuts_;
1023 bool desktopShowHidden_;
1024 bool desktopHideItems_;
1025 Qt::SortOrder desktopSortOrder_;
1026 Fm::FolderModel::ColumnId desktopSortColumn_;
1027 bool desktopSortFolderFirst_;
1028 bool desktopSortHiddenLast_;
1030 bool alwaysShowTabs_;
1032 bool rememberWindowSize_;
1033 int fixedWindowWidth_;
1034 int fixedWindowHeight_;
1035 int lastWindowWidth_;
1036 int lastWindowHeight_;
1037 bool lastWindowMaximized_;
1039 bool sidePaneVisible_;
1040 Fm::SidePane::Mode sidePaneMode_;
1044 Fm::FolderView::ViewMode viewMode_;
1046 Qt::SortOrder sortOrder_;
1047 Fm::FolderModel::ColumnId sortColumn_;
1048 bool sortFolderFirst_;
1049 bool sortHiddenLast_;
1050 bool sortCaseSensitive_;
1052 bool pathBarButtons_;
1056 int autoSelectionDelay_;
1057 bool ctrlRightClick_;
1059 bool confirmDelete_;
1063 bool selectNewFiles_;
1065 bool showThumbnails_;
1069 bool backupAsHidden_;
1070 bool showFullNames_;
1074 bool placesDesktop_;
1075 bool placesApplications_;
1078 bool placesComputer_;
1079 bool placesNetwork_;
1080 QSet<QString> hiddenPlaces_;
1084 int sidePaneIconSize_;
1085 int thumbnailIconSize_;
1087 bool onlyUserTemplates_;
1088 bool templateTypeOnce_;
1089 bool templateRunApp_;
1091 QSize folderViewCellMargins_;
1092 QSize desktopCellMargins_;
1095 bool searchNameCaseInsensitive_;
1096 bool searchContentCaseInsensitive_;
1097 bool searchNameRegexp_;
1098 bool searchContentRegexp_;
1099 bool searchRecursive_;
1100 bool searchhHidden_;
1103 QList<QVariant> customColumnWidths_;
1104 QList<QVariant> hiddenColumns_;
1109 #endif // PCMANFM_SETTINGS_H