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;
730 int bigIconSize()
const {
734 void setBigIconSize(
int bigIconSize) {
735 bigIconSize_ = bigIconSize;
738 int smallIconSize()
const {
739 return smallIconSize_;
742 void setSmallIconSize(
int smallIconSize) {
743 smallIconSize_ = smallIconSize;
746 int sidePaneIconSize()
const {
747 return sidePaneIconSize_;
750 void setSidePaneIconSize(
int sidePaneIconSize) {
751 sidePaneIconSize_ = sidePaneIconSize;
754 int thumbnailIconSize()
const {
755 return thumbnailIconSize_;
758 QSize folderViewCellMargins()
const {
759 return folderViewCellMargins_;
762 void setFolderViewCellMargins(QSize size) {
763 folderViewCellMargins_ = size;
766 QSize desktopCellMargins()
const {
767 return desktopCellMargins_;
770 void setDesktopCellMargins(QSize size) {
771 desktopCellMargins_ = size;
774 bool openWithDefaultFileManager()
const {
775 return openWithDefaultFileManager_;
778 void setOpenWithDefaultFileManager(
bool open) {
779 openWithDefaultFileManager_ = open;
782 bool showThumbnails() {
783 return showThumbnails_;
786 void setShowThumbnails(
bool show) {
787 showThumbnails_ = show;
790 void setThumbnailLocalFilesOnly(
bool value) {
791 Fm::ThumbnailJob::setLocalFilesOnly(value);
794 bool thumbnailLocalFilesOnly()
const {
795 return Fm::ThumbnailJob::localFilesOnly();
798 int maxThumbnailFileSize()
const {
799 return Fm::ThumbnailJob::maxThumbnailFileSize();
802 void setMaxThumbnailFileSize(
int size) {
803 Fm::ThumbnailJob::setMaxThumbnailFileSize(size);
806 int maxExternalThumbnailFileSize()
const {
807 return Fm::ThumbnailJob::maxExternalThumbnailFileSize();
810 void setMaxExternalThumbnailFileSize(
int size) {
811 Fm::ThumbnailJob::setMaxExternalThumbnailFileSize(size);
814 void setThumbnailIconSize(
int thumbnailIconSize) {
815 thumbnailIconSize_ = thumbnailIconSize;
822 void setSiUnit(
bool siUnit) {
825 fm_config->si_unit = (gboolean)siUnit_;
828 bool backupAsHidden()
const {
829 return backupAsHidden_;
832 void setBackupAsHidden(
bool value) {
833 backupAsHidden_ = value;
834 fm_config->backup_as_hidden = backupAsHidden_;
837 bool showFullNames()
const {
838 return showFullNames_;
841 void setShowFullNames(
bool value) {
842 showFullNames_ = value;
845 bool shadowHidden()
const {
846 return shadowHidden_;
849 void setShadowHidden(
bool value) {
850 shadowHidden_ = value;
853 bool noItemTooltip()
const {
854 return noItemTooltip_;
857 void setNoItemTooltip(
bool noTooltip) {
858 noItemTooltip_ = noTooltip;
861 bool onlyUserTemplates()
const {
862 return onlyUserTemplates_;
865 void setOnlyUserTemplates(
bool value) {
866 onlyUserTemplates_ = value;
867 fm_config->only_user_templates = onlyUserTemplates_;
870 bool templateTypeOnce()
const {
871 return templateTypeOnce_;
874 void setTemplateTypeOnce(
bool value) {
875 templateTypeOnce_ = value;
876 fm_config->template_type_once = templateTypeOnce_;
879 bool templateRunApp()
const {
880 return templateRunApp_;
883 void setTemplateRunApp(
bool value) {
884 templateRunApp_ = value;
885 fm_config->template_run_app = templateRunApp_;
889 FolderSettings loadFolderSettings(
const Fm::FilePath& path)
const;
891 void saveFolderSettings(
const Fm::FilePath& path,
const FolderSettings& settings);
893 void clearFolderSettings(
const Fm::FilePath& path)
const;
895 bool searchNameCaseInsensitive()
const {
896 return searchNameCaseInsensitive_;
899 void setSearchNameCaseInsensitive(
bool caseInsensitive) {
900 searchNameCaseInsensitive_ = caseInsensitive;
903 bool searchContentCaseInsensitive()
const {
904 return searchContentCaseInsensitive_;
907 void setsearchContentCaseInsensitive(
bool caseInsensitive) {
908 searchContentCaseInsensitive_ = caseInsensitive;
911 bool searchNameRegexp()
const {
912 return searchNameRegexp_;
915 void setSearchNameRegexp(
bool reg) {
916 searchNameRegexp_ = reg;
919 bool searchContentRegexp()
const {
920 return searchContentRegexp_;
923 void setSearchContentRegexp(
bool reg) {
924 searchContentRegexp_ = reg;
927 bool searchRecursive()
const {
928 return searchRecursive_;
931 void setSearchRecursive(
bool rec) {
932 searchRecursive_ = rec;
935 bool searchhHidden()
const {
936 return searchhHidden_;
939 void setSearchhHidden(
bool hidden) {
940 searchhHidden_ = hidden;
943 QList<int> getCustomColumnWidths()
const {
945 for(
auto width : qAsConst(customColumnWidths_)) {
951 void setCustomColumnWidths(
const QList<int> &widths) {
952 customColumnWidths_.clear();
953 for(
auto width : widths) {
954 customColumnWidths_ << QVariant(width);
958 QList<int> getHiddenColumns()
const {
960 for(
auto width : qAsConst(hiddenColumns_)) {
966 void setHiddenColumns(
const QList<int> &columns) {
967 hiddenColumns_.clear();
968 for(
auto column : columns) {
969 hiddenColumns_ << QVariant(column);
974 int toIconSize(
int size, IconType type)
const;
976 QString profileName_;
980 QString fallbackIconThemeName_;
981 bool useFallbackIconTheme_;
983 bool singleWindowMode_;
984 OpenDirTargetType bookmarkOpenMethod_;
987 bool mountOnStartup_;
988 bool mountRemovable_;
990 bool closeOnUnmount_;
994 QSize wallpaperDialogSize_;
995 int wallpaperDialogSplitterPos_;
997 QString wallpaperDir_;
998 int slideShowInterval_;
999 bool wallpaperRandomize_;
1000 bool transformWallpaper_;
1001 bool perScreenWallpaper_;
1002 QColor desktopBgColor_;
1003 QColor desktopFgColor_;
1004 QColor desktopShadowColor_;
1006 int desktopIconSize_;
1007 QStringList desktopShortcuts_;
1009 bool desktopShowHidden_;
1010 bool desktopHideItems_;
1011 Qt::SortOrder desktopSortOrder_;
1012 Fm::FolderModel::ColumnId desktopSortColumn_;
1013 bool desktopSortFolderFirst_;
1014 bool desktopSortHiddenLast_;
1016 bool alwaysShowTabs_;
1018 bool switchToNewTab_;
1019 bool reopenLastTabs_;
1020 QStringList tabPaths_;
1021 bool rememberWindowSize_;
1022 int fixedWindowWidth_;
1023 int fixedWindowHeight_;
1024 int lastWindowWidth_;
1025 int lastWindowHeight_;
1026 bool lastWindowMaximized_;
1028 bool sidePaneVisible_;
1029 Fm::SidePane::Mode sidePaneMode_;
1033 Fm::FolderView::ViewMode viewMode_;
1035 Qt::SortOrder sortOrder_;
1036 Fm::FolderModel::ColumnId sortColumn_;
1037 bool sortFolderFirst_;
1038 bool sortHiddenLast_;
1039 bool sortCaseSensitive_;
1041 bool pathBarButtons_;
1045 int autoSelectionDelay_;
1046 bool ctrlRightClick_;
1048 bool confirmDelete_;
1052 bool selectNewFiles_;
1054 bool showThumbnails_;
1058 bool backupAsHidden_;
1059 bool showFullNames_;
1061 bool noItemTooltip_;
1063 QSet<QString> hiddenPlaces_;
1067 int sidePaneIconSize_;
1068 int thumbnailIconSize_;
1070 bool onlyUserTemplates_;
1071 bool templateTypeOnce_;
1072 bool templateRunApp_;
1074 QSize folderViewCellMargins_;
1075 QSize desktopCellMargins_;
1077 bool openWithDefaultFileManager_;
1080 bool searchNameCaseInsensitive_;
1081 bool searchContentCaseInsensitive_;
1082 bool searchNameRegexp_;
1083 bool searchContentRegexp_;
1084 bool searchRecursive_;
1085 bool searchhHidden_;
1088 QList<QVariant> customColumnWidths_;
1089 QList<QVariant> hiddenColumns_;
Definition: settings.h:42
Definition: settings.h:134