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 switchToNewTab()
const {
441 return switchToNewTab_;
444 void setSwitchToNewTab(
bool showTabClose) {
445 switchToNewTab_ = showTabClose;
448 bool reopenLastTabs()
const {
449 return reopenLastTabs_;
452 void setReopenLastTabs(
bool reopenLastTabs) {
453 reopenLastTabs_ = reopenLastTabs;
456 QStringList tabPaths()
const {
460 void setTabPaths(
const QStringList& tabPaths) {
461 tabPaths_ = tabPaths;
464 bool rememberWindowSize()
const {
465 return rememberWindowSize_;
468 void setRememberWindowSize(
bool rememberWindowSize) {
469 rememberWindowSize_ = rememberWindowSize;
472 int windowWidth()
const {
473 if(rememberWindowSize_) {
474 return lastWindowWidth_;
477 return fixedWindowWidth_;
481 int windowHeight()
const {
482 if(rememberWindowSize_) {
483 return lastWindowHeight_;
486 return fixedWindowHeight_;
490 bool windowMaximized()
const {
491 if(rememberWindowSize_) {
492 return lastWindowMaximized_;
499 int fixedWindowWidth()
const {
500 return fixedWindowWidth_;
503 void setFixedWindowWidth(
int fixedWindowWidth) {
504 fixedWindowWidth_ = fixedWindowWidth;
507 int fixedWindowHeight()
const {
508 return fixedWindowHeight_;
511 void setFixedWindowHeight(
int fixedWindowHeight) {
512 fixedWindowHeight_ = fixedWindowHeight;
515 void setLastWindowWidth(
int lastWindowWidth) {
516 lastWindowWidth_ = lastWindowWidth;
519 void setLastWindowHeight(
int lastWindowHeight) {
520 lastWindowHeight_ = lastWindowHeight;
523 void setLastWindowMaximized(
bool lastWindowMaximized) {
524 lastWindowMaximized_ = lastWindowMaximized;
527 int splitterPos()
const {
531 void setSplitterPos(
int splitterPos) {
532 splitterPos_ = splitterPos;
535 bool isSidePaneVisible()
const {
536 return sidePaneVisible_;
539 void showSidePane(
bool show) {
540 sidePaneVisible_ = show;
543 Fm::SidePane::Mode sidePaneMode()
const {
544 return sidePaneMode_;
547 void setSidePaneMode(Fm::SidePane::Mode sidePaneMode) {
548 sidePaneMode_ = sidePaneMode;
551 bool showMenuBar()
const {
555 void setShowMenuBar(
bool showMenuBar) {
556 showMenuBar_ = showMenuBar;
559 bool splitView()
const {
563 void setSplitView(
bool split) {
567 Fm::FolderView::ViewMode viewMode()
const {
571 void setViewMode(Fm::FolderView::ViewMode viewMode) {
572 viewMode_ = viewMode;
575 bool showHidden()
const {
579 void setShowHidden(
bool showHidden) {
580 showHidden_ = showHidden;
583 bool sortCaseSensitive()
const {
584 return sortCaseSensitive_;
587 void setSortCaseSensitive(
bool value) {
588 sortCaseSensitive_ = value;
591 QSet<QString> getHiddenPlaces()
const {
592 return hiddenPlaces_;
595 void setHiddenPlace(
const QString& str,
bool hide) {
597 hiddenPlaces_ << str;
600 hiddenPlaces_.remove(str);
604 Qt::SortOrder sortOrder()
const {
608 void setSortOrder(Qt::SortOrder sortOrder) {
609 sortOrder_ = sortOrder;
612 Fm::FolderModel::ColumnId sortColumn()
const {
616 void setSortColumn(Fm::FolderModel::ColumnId sortColumn) {
617 sortColumn_ = sortColumn;
620 bool sortFolderFirst()
const {
621 return sortFolderFirst_;
624 void setSortFolderFirst(
bool folderFirst) {
625 sortFolderFirst_ = folderFirst;
628 bool sortHiddenLast()
const {
629 return sortHiddenLast_;
632 void setSortHiddenLast(
bool hiddenLast) {
633 sortHiddenLast_ = hiddenLast;
636 bool showFilter()
const {
640 void setShowFilter(
bool value) {
644 bool pathBarButtons()
const {
645 return pathBarButtons_;
648 void setPathBarButtons(
bool value) {
649 pathBarButtons_ = value;
653 bool singleClick()
const {
657 void setSingleClick(
bool singleClick) {
658 singleClick_ = singleClick;
661 int autoSelectionDelay()
const {
662 return autoSelectionDelay_;
665 void setAutoSelectionDelay(
int value) {
666 autoSelectionDelay_ = value;
669 bool ctrlRightClick()
const {
670 return ctrlRightClick_;
673 void setCtrlRightClick(
bool value) {
674 ctrlRightClick_ = value;
677 bool useTrash()
const {
684 void setUseTrash(
bool useTrash) {
685 useTrash_ = useTrash;
688 bool confirmDelete()
const {
689 return confirmDelete_;
692 void setConfirmDelete(
bool confirmDelete) {
693 confirmDelete_ = confirmDelete;
696 bool noUsbTrash()
const {
700 void setNoUsbTrash(
bool noUsbTrash) {
701 noUsbTrash_ = noUsbTrash;
702 fm_config->no_usb_trash = noUsbTrash_;
705 bool confirmTrash()
const {
706 return confirmTrash_;
709 void setConfirmTrash(
bool value) {
710 confirmTrash_ = value;
713 bool quickExec()
const {
717 void setQuickExec(
bool value) {
719 fm_config->quick_exec = quickExec_;
722 bool selectNewFiles()
const {
723 return selectNewFiles_;
726 void setSelectNewFiles(
bool value) {
727 selectNewFiles_ = value;
733 int bigIconSize()
const {
737 void setBigIconSize(
int bigIconSize) {
738 bigIconSize_ = bigIconSize;
741 int smallIconSize()
const {
742 return smallIconSize_;
745 void setSmallIconSize(
int smallIconSize) {
746 smallIconSize_ = smallIconSize;
749 int sidePaneIconSize()
const {
750 return sidePaneIconSize_;
753 void setSidePaneIconSize(
int sidePaneIconSize) {
754 sidePaneIconSize_ = sidePaneIconSize;
757 int thumbnailIconSize()
const {
758 return thumbnailIconSize_;
761 QSize folderViewCellMargins()
const {
762 return folderViewCellMargins_;
765 void setFolderViewCellMargins(QSize size) {
766 folderViewCellMargins_ = size;
769 QSize desktopCellMargins()
const {
770 return desktopCellMargins_;
773 void setDesktopCellMargins(QSize size) {
774 desktopCellMargins_ = size;
777 bool openWithDefaultFileManager()
const {
778 return openWithDefaultFileManager_;
781 void setOpenWithDefaultFileManager(
bool open) {
782 openWithDefaultFileManager_ = open;
785 bool showThumbnails() {
786 return showThumbnails_;
789 void setShowThumbnails(
bool show) {
790 showThumbnails_ = show;
793 void setThumbnailLocalFilesOnly(
bool value) {
794 Fm::ThumbnailJob::setLocalFilesOnly(value);
797 bool thumbnailLocalFilesOnly()
const {
798 return Fm::ThumbnailJob::localFilesOnly();
801 int maxThumbnailFileSize()
const {
802 return Fm::ThumbnailJob::maxThumbnailFileSize();
805 void setMaxThumbnailFileSize(
int size) {
806 Fm::ThumbnailJob::setMaxThumbnailFileSize(size);
809 void setThumbnailIconSize(
int thumbnailIconSize) {
810 thumbnailIconSize_ = thumbnailIconSize;
817 void setSiUnit(
bool siUnit) {
820 fm_config->si_unit = (gboolean)siUnit_;
823 bool backupAsHidden()
const {
824 return backupAsHidden_;
827 void setBackupAsHidden(
bool value) {
828 backupAsHidden_ = value;
829 fm_config->backup_as_hidden = backupAsHidden_;
832 bool showFullNames()
const {
833 return showFullNames_;
836 void setShowFullNames(
bool value) {
837 showFullNames_ = value;
840 bool shadowHidden()
const {
841 return shadowHidden_;
844 void setShadowHidden(
bool value) {
845 shadowHidden_ = value;
848 bool noItemTooltip()
const {
849 return noItemTooltip_;
852 void setNoItemTooltip(
bool noTooltip) {
853 noItemTooltip_ = noTooltip;
856 bool onlyUserTemplates()
const {
857 return onlyUserTemplates_;
860 void setOnlyUserTemplates(
bool value) {
861 onlyUserTemplates_ = value;
862 fm_config->only_user_templates = onlyUserTemplates_;
865 bool templateTypeOnce()
const {
866 return templateTypeOnce_;
869 void setTemplateTypeOnce(
bool value) {
870 templateTypeOnce_ = value;
871 fm_config->template_type_once = templateTypeOnce_;
874 bool templateRunApp()
const {
875 return templateRunApp_;
878 void setTemplateRunApp(
bool value) {
879 templateRunApp_ = value;
880 fm_config->template_run_app = templateRunApp_;
884 FolderSettings loadFolderSettings(
const Fm::FilePath& path)
const;
886 void saveFolderSettings(
const Fm::FilePath& path,
const FolderSettings& settings);
888 void clearFolderSettings(
const Fm::FilePath& path)
const;
890 bool searchNameCaseInsensitive()
const {
891 return searchNameCaseInsensitive_;
894 void setSearchNameCaseInsensitive(
bool caseInsensitive) {
895 searchNameCaseInsensitive_ = caseInsensitive;
898 bool searchContentCaseInsensitive()
const {
899 return searchContentCaseInsensitive_;
902 void setsearchContentCaseInsensitive(
bool caseInsensitive) {
903 searchContentCaseInsensitive_ = caseInsensitive;
906 bool searchNameRegexp()
const {
907 return searchNameRegexp_;
910 void setSearchNameRegexp(
bool reg) {
911 searchNameRegexp_ = reg;
914 bool searchContentRegexp()
const {
915 return searchContentRegexp_;
918 void setSearchContentRegexp(
bool reg) {
919 searchContentRegexp_ = reg;
922 bool searchRecursive()
const {
923 return searchRecursive_;
926 void setSearchRecursive(
bool rec) {
927 searchRecursive_ = rec;
930 bool searchhHidden()
const {
931 return searchhHidden_;
934 void setSearchhHidden(
bool hidden) {
935 searchhHidden_ = hidden;
938 QList<int> getCustomColumnWidths()
const {
940 for(
auto width : qAsConst(customColumnWidths_)) {
946 void setCustomColumnWidths(
const QList<int> &widths) {
947 customColumnWidths_.clear();
948 for(
auto width : widths) {
949 customColumnWidths_ << QVariant(width);
953 QList<int> getHiddenColumns()
const {
955 for(
auto width : qAsConst(hiddenColumns_)) {
961 void setHiddenColumns(
const QList<int> &columns) {
962 hiddenColumns_.clear();
963 for(
auto column : columns) {
964 hiddenColumns_ << QVariant(column);
969 int toIconSize(
int size, IconType type)
const;
971 QString profileName_;
975 QString fallbackIconThemeName_;
976 bool useFallbackIconTheme_;
978 bool singleWindowMode_;
979 OpenDirTargetType bookmarkOpenMethod_;
982 bool mountOnStartup_;
983 bool mountRemovable_;
985 bool closeOnUnmount_;
989 QSize wallpaperDialogSize_;
990 int wallpaperDialogSplitterPos_;
992 QString wallpaperDir_;
993 int slideShowInterval_;
994 bool wallpaperRandomize_;
995 bool transformWallpaper_;
996 bool perScreenWallpaper_;
997 QColor desktopBgColor_;
998 QColor desktopFgColor_;
999 QColor desktopShadowColor_;
1001 int desktopIconSize_;
1002 QStringList desktopShortcuts_;
1004 bool desktopShowHidden_;
1005 bool desktopHideItems_;
1006 Qt::SortOrder desktopSortOrder_;
1007 Fm::FolderModel::ColumnId desktopSortColumn_;
1008 bool desktopSortFolderFirst_;
1009 bool desktopSortHiddenLast_;
1011 bool alwaysShowTabs_;
1013 bool switchToNewTab_;
1014 bool reopenLastTabs_;
1015 QStringList tabPaths_;
1016 bool rememberWindowSize_;
1017 int fixedWindowWidth_;
1018 int fixedWindowHeight_;
1019 int lastWindowWidth_;
1020 int lastWindowHeight_;
1021 bool lastWindowMaximized_;
1023 bool sidePaneVisible_;
1024 Fm::SidePane::Mode sidePaneMode_;
1028 Fm::FolderView::ViewMode viewMode_;
1030 Qt::SortOrder sortOrder_;
1031 Fm::FolderModel::ColumnId sortColumn_;
1032 bool sortFolderFirst_;
1033 bool sortHiddenLast_;
1034 bool sortCaseSensitive_;
1036 bool pathBarButtons_;
1040 int autoSelectionDelay_;
1041 bool ctrlRightClick_;
1043 bool confirmDelete_;
1047 bool selectNewFiles_;
1049 bool showThumbnails_;
1053 bool backupAsHidden_;
1054 bool showFullNames_;
1056 bool noItemTooltip_;
1058 QSet<QString> hiddenPlaces_;
1062 int sidePaneIconSize_;
1063 int thumbnailIconSize_;
1065 bool onlyUserTemplates_;
1066 bool templateTypeOnce_;
1067 bool templateRunApp_;
1069 QSize folderViewCellMargins_;
1070 QSize desktopCellMargins_;
1072 bool openWithDefaultFileManager_;
1075 bool searchNameCaseInsensitive_;
1076 bool searchContentCaseInsensitive_;
1077 bool searchNameRegexp_;
1078 bool searchContentRegexp_;
1079 bool searchRecursive_;
1080 bool searchhHidden_;
1083 QList<QVariant> customColumnWidths_;
1084 QList<QVariant> hiddenColumns_;
Definition: settings.h:42
Definition: settings.h:134