PCManFM-Qt
Loading...
Searching...
No Matches
settings.h
1/*
2
3 Copyright (C) 2013 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18*/
19
20
21#ifndef PCMANFM_SETTINGS_H
22#define PCMANFM_SETTINGS_H
23
24#include <QObject>
25#include <libfm-qt6/folderview.h>
26#include <libfm-qt6/foldermodel.h>
27#include "desktopwindow.h"
28#include <libfm-qt6/sidepane.h>
29#include <libfm-qt6/core/thumbnailjob.h>
30#include <libfm-qt6/core/archiver.h>
31#include <libfm-qt6/core/legacy/fm-config.h>
32
33namespace PCManFM {
34
35enum OpenDirTargetType {
36 OpenInCurrentTab,
37 OpenInNewTab,
38 OpenInNewWindow,
39 OpenInLastActiveWindow
40};
41
42class FolderSettings {
43public:
44 FolderSettings():
45 isCustomized_(false),
46 // NOTE: The default values of the following variables should be
47 // the same as those of their corresponding variables in Settings:
48 sortOrder_(Qt::AscendingOrder),
49 sortColumn_(Fm::FolderModel::ColumnFileName),
50 viewMode_(Fm::FolderView::IconMode),
51 showHidden_(false),
52 sortFolderFirst_(true),
53 sortHiddenLast_(false),
54 sortCaseSensitive_(true),
55 recursive_(false) {
56 }
57
58 bool isCustomized() const {
59 return isCustomized_;
60 }
61
62 void setCustomized(bool value) {
63 isCustomized_ = value;
64 }
65
66 Qt::SortOrder sortOrder() const {
67 return sortOrder_;
68 }
69
70 void setSortOrder(Qt::SortOrder value) {
71 sortOrder_ = value;
72 }
73
74 Fm::FolderModel::ColumnId sortColumn() const {
75 return sortColumn_;
76 }
77
78 void setSortColumn(Fm::FolderModel::ColumnId value) {
79 sortColumn_ = value;
80 }
81
82 Fm::FolderView::ViewMode viewMode() const {
83 return viewMode_;
84 }
85
86 void setViewMode(Fm::FolderView::ViewMode value) {
87 viewMode_ = value;
88 }
89
90 bool sortFolderFirst() const {
91 return sortFolderFirst_;
92 }
93
94 void setSortFolderFirst(bool value) {
95 sortFolderFirst_ = value;
96 }
97
98 bool sortHiddenLast() const {
99 return sortHiddenLast_;
100 }
101
102 void setSortHiddenLast(bool value) {
103 sortHiddenLast_ = value;
104 }
105
106 bool showHidden() const {
107 return showHidden_;
108 }
109
110 void setShowHidden(bool value) {
111 showHidden_ = value;
112 }
113
114 bool sortCaseSensitive() const {
115 return sortCaseSensitive_;
116 }
117
118 void setSortCaseSensitive(bool value) {
119 sortCaseSensitive_ = value;
120 }
121
122 bool recursive() const {
123 return recursive_;
124 }
125
126 void setRecursive(bool value) {
127 recursive_ = value;
128 }
129
130 Fm::FilePath inheritedPath() const {
131 return inheritedPath_;
132 }
133
134 void seInheritedPath(const Fm::FilePath& path) {
135 inheritedPath_ = std::move(path);
136 }
137
138
139private:
140 bool isCustomized_;
141 Qt::SortOrder sortOrder_;
142 Fm::FolderModel::ColumnId sortColumn_;
143 Fm::FolderView::ViewMode viewMode_;
144 bool showHidden_;
145 bool sortFolderFirst_;
146 bool sortHiddenLast_;
147 bool sortCaseSensitive_;
148 bool recursive_;
149 Fm::FilePath inheritedPath_;
150 // columns?
151};
152
153
154class Settings : public QObject {
155 Q_OBJECT
156public:
157 enum IconType {
158 Small,
159 Big,
160 Thumbnail
161 };
162
163 Settings();
164 virtual ~Settings();
165
166 bool load(QString profile = QStringLiteral("default"));
167 bool save(QString profile = QString());
168
169 static QString xdgUserConfigDir();
170 static const QList<int>& iconSizes(IconType type);
171 static int wallpaperModeFromString(const QString str);
172
173 QString profileDir(QString profile, bool useFallback = false);
174
175 // setter/getter functions
176 QString profileName() const {
177 return profileName_;
178 }
179
180 bool supportTrash() const {
181 return supportTrash_;
182 }
183
184 QString fallbackIconThemeName() const {
185 return fallbackIconThemeName_;
186 }
187
188 bool useFallbackIconTheme() const {
189 return useFallbackIconTheme_;
190 }
191
192 void setFallbackIconThemeName(QString iconThemeName) {
193 fallbackIconThemeName_ = iconThemeName;
194 }
195
196 bool singleWindowMode() const {
197 return singleWindowMode_;
198 }
199
200 void setSingleWindowMode(bool singleWindowMode) {
201 singleWindowMode_ = singleWindowMode;
202 }
203
204 OpenDirTargetType bookmarkOpenMethod() {
205 return bookmarkOpenMethod_;
206 }
207
208 void setBookmarkOpenMethod(OpenDirTargetType bookmarkOpenMethod) {
209 bookmarkOpenMethod_ = bookmarkOpenMethod;
210 }
211
212 QString suCommand() const {
213 return suCommand_;
214 }
215
216 void setSuCommand(QString suCommand) {
217 suCommand_ = suCommand;
218 }
219
220 QString terminal() {
221 return terminal_;
222 }
223 void setTerminal(QString terminalCommand);
224
225 QString archiver() const {
226 return archiver_;
227 }
228
229 void setArchiver(QString archiver) {
230 archiver_ = archiver;
231 Fm::Archiver::setDefaultArchiverByName(archiver_.toLocal8Bit().constData());
232 }
233
234 bool mountOnStartup() const {
235 return mountOnStartup_;
236 }
237
238 void setMountOnStartup(bool mountOnStartup) {
239 mountOnStartup_ = mountOnStartup;
240 }
241
242 bool mountRemovable() {
243 return mountRemovable_;
244 }
245
246 void setMountRemovable(bool mountRemovable) {
247 mountRemovable_ = mountRemovable;
248 }
249
250 bool autoRun() const {
251 return autoRun_;
252 }
253
254 void setAutoRun(bool autoRun) {
255 autoRun_ = autoRun;
256 }
257
258 bool closeOnUnmount() const {
259 return closeOnUnmount_;
260 }
261
262 void setCloseOnUnmount(bool value) {
263 closeOnUnmount_ = value;
264 }
265
266 DesktopWindow::WallpaperMode wallpaperMode() const {
267 return DesktopWindow::WallpaperMode(wallpaperMode_);
268 }
269
270 void setWallpaperMode(int wallpaperMode) {
271 wallpaperMode_ = wallpaperMode;
272 }
273
274 QString wallpaper() const {
275 return wallpaper_;
276 }
277
278 void setWallpaper(const QString& wallpaper) {
279 wallpaper_ = wallpaper;
280 }
281
282 QSize wallpaperDialogSize() const {
283 return wallpaperDialogSize_;
284 }
285
286 void setWallpaperDialogSize(const QSize& size) {
287 wallpaperDialogSize_ = size;
288 }
289
290 int wallpaperDialogSplitterPos() const {
291 return wallpaperDialogSplitterPos_;
292 }
293
294 void setWallpaperDialogSplitterPos(int pos) {
295 wallpaperDialogSplitterPos_ = pos;
296 }
297
298 QString wallpaperDir() const {
299 return wallpaperDir_;
300 }
301
302 void setLastSlide(QString wallpaper) {
303 lastSlide_ = wallpaper;
304 }
305
306 QString lastSlide() const {
307 return lastSlide_;
308 }
309
310 void setWallpaperDir(QString dir) {
311 wallpaperDir_ = dir;
312 }
313
314 int slideShowInterval() const {
315 return slideShowInterval_;
316 }
317
318 void setSlideShowInterval(int interval) {
319 slideShowInterval_ = interval;
320 }
321
322 bool wallpaperRandomize() const {
323 return wallpaperRandomize_;
324 }
325
326 void setWallpaperRandomize(bool randomize) {
327 wallpaperRandomize_ = randomize;
328 }
329
330
331 bool noWallpaperCache() const {
332 return noWallpaperCache_;
333 }
334
335 void setNoWallpaperCache(bool nwc) {
336 noWallpaperCache_ = nwc;
337 }
338
339 bool transformWallpaper() const {
340 return transformWallpaper_;
341 }
342
343 void setTransformWallpaper(bool tr) {
344 transformWallpaper_ = tr;
345 }
346
347 bool perScreenWallpaper() const {
348 return perScreenWallpaper_;
349 }
350
351 void setPerScreenWallpaper(bool psw) {
352 perScreenWallpaper_ = psw;
353 }
354
355 const QColor& desktopBgColor() const {
356 return desktopBgColor_;
357 }
358
359 void setDesktopBgColor(QColor desktopBgColor) {
360 desktopBgColor_ = desktopBgColor;
361 }
362
363 const QColor& desktopFgColor() const {
364 return desktopFgColor_;
365 }
366
367 void setDesktopFgColor(QColor desktopFgColor) {
368 desktopFgColor_ = desktopFgColor;
369 }
370
371 const QColor& desktopShadowColor() const {
372 return desktopShadowColor_;
373 }
374
375 void setDesktopShadowColor(QColor desktopShadowColor) {
376 desktopShadowColor_ = desktopShadowColor;
377 }
378
379 QFont desktopFont() const {
380 return desktopFont_;
381 }
382
383 void setDesktopFont(QFont font) {
384 desktopFont_ = font;
385 }
386
387 int desktopIconSize() const {
388 return desktopIconSize_;
389 }
390
391 void setDesktopIconSize(int desktopIconSize) {
392 desktopIconSize_ = desktopIconSize;
393 }
394
395 QStringList desktopShortcuts() const {
396 return desktopShortcuts_;
397 }
398
399 void setDesktopShortcuts(const QStringList& list) {
400 desktopShortcuts_ = list;
401 }
402
403 bool desktopShowHidden() const {
404 return desktopShowHidden_;
405 }
406
407 void setDesktopShowHidden(bool desktopShowHidden) {
408 desktopShowHidden_ = desktopShowHidden;
409 }
410
411 bool desktopHideItems(const QString& screenName = QString()) const {
412 if(screenName.isEmpty()) { // X11
413 return desktopHideItems_;
414 }
415 return desktopHideItemsOnScreens_.value(screenName, false); // Wayland
416 }
417
418 void setDesktopHideItems(bool hide, const QString& screenName = QString()) {
419 if(screenName.isEmpty()) { // X11
420 desktopHideItems_ = hide;
421 }
422 else { // Wayland
423 if(!screenNames_.contains(screenName)) {
424 screenNames_ << screenName;
425 }
426 desktopHideItemsOnScreens_.insert(screenName, hide);
427 }
428 }
429
430 Qt::SortOrder desktopSortOrder() const {
431 return desktopSortOrder_;
432 }
433
434 void setDesktopSortOrder(Qt::SortOrder desktopSortOrder) {
435 desktopSortOrder_ = desktopSortOrder;
436 }
437
438 Fm::FolderModel::ColumnId desktopSortColumn() const {
439 return desktopSortColumn_;
440 }
441
442 void setDesktopSortColumn(Fm::FolderModel::ColumnId desktopSortColumn) {
443 desktopSortColumn_ = desktopSortColumn;
444 }
445
446 bool desktopSortFolderFirst() const {
447 return desktopSortFolderFirst_;
448 }
449
450 void setDesktopSortFolderFirst(bool desktopFolderFirst) {
451 desktopSortFolderFirst_ = desktopFolderFirst;
452 }
453
454 bool desktopSortHiddenLast() const {
455 return desktopSortHiddenLast_;
456 }
457
458 void setDesktopSortHiddenLast(bool desktopHiddenLast) {
459 desktopSortHiddenLast_ = desktopHiddenLast;
460 }
461
462 bool desktopNoTooltip() const {
463 return desktopNoTooltip_;
464 }
465
466 void setDesktopNoTooltip(bool noTooltip) {
467 desktopNoTooltip_ = noTooltip;
468 }
469
470 bool alwaysShowTabs() const {
471 return alwaysShowTabs_;
472 }
473
474 void setAlwaysShowTabs(bool alwaysShowTabs) {
475 alwaysShowTabs_ = alwaysShowTabs;
476 }
477
478 bool showTabClose() const {
479 return showTabClose_;
480 }
481
482 void setShowTabClose(bool showTabClose) {
483 showTabClose_ = showTabClose;
484 }
485
486 bool switchToNewTab() const {
487 return switchToNewTab_;
488 }
489
490 void setSwitchToNewTab(bool showTabClose) {
491 switchToNewTab_ = showTabClose;
492 }
493
494 bool reopenLastTabs() const {
495 return reopenLastTabs_;
496 }
497
498 void setReopenLastTabs(bool reopenLastTabs) {
499 reopenLastTabs_ = reopenLastTabs;
500 }
501
502 int splitViewTabsNum() const {
503 return splitViewTabsNum_;
504 }
505
506 void setSplitViewTabsNum(int n) {
507 splitViewTabsNum_ = n;
508 }
509
510 QStringList tabPaths() const {
511 return tabPaths_;
512 }
513
514 void setTabPaths(const QStringList& tabPaths) {
515 tabPaths_ = tabPaths;
516 }
517
518 bool rememberWindowSize() const {
519 return rememberWindowSize_;
520 }
521
522 void setRememberWindowSize(bool rememberWindowSize) {
523 rememberWindowSize_ = rememberWindowSize;
524 }
525
526 int windowWidth() const {
527 if(rememberWindowSize_) {
528 return lastWindowWidth_;
529 }
530 else {
531 return fixedWindowWidth_;
532 }
533 }
534
535 int windowHeight() const {
536 if(rememberWindowSize_) {
537 return lastWindowHeight_;
538 }
539 else {
540 return fixedWindowHeight_;
541 }
542 }
543
544 bool windowMaximized() const {
545 if(rememberWindowSize_) {
546 return lastWindowMaximized_;
547 }
548 else {
549 return false;
550 }
551 }
552
553 int fixedWindowWidth() const {
554 return fixedWindowWidth_;
555 }
556
557 void setFixedWindowWidth(int fixedWindowWidth) {
558 fixedWindowWidth_ = fixedWindowWidth;
559 }
560
561 int fixedWindowHeight() const {
562 return fixedWindowHeight_;
563 }
564
565 void setFixedWindowHeight(int fixedWindowHeight) {
566 fixedWindowHeight_ = fixedWindowHeight;
567 }
568
569 void setLastWindowWidth(int lastWindowWidth) {
570 lastWindowWidth_ = lastWindowWidth;
571 }
572
573 void setLastWindowHeight(int lastWindowHeight) {
574 lastWindowHeight_ = lastWindowHeight;
575 }
576
577 void setLastWindowMaximized(bool lastWindowMaximized) {
578 lastWindowMaximized_ = lastWindowMaximized;
579 }
580
581 int splitterPos() const {
582 return splitterPos_;
583 }
584
585 void setSplitterPos(int splitterPos) {
586 splitterPos_ = splitterPos;
587 }
588
589 bool isSidePaneVisible() const {
590 return sidePaneVisible_;
591 }
592
593 void showSidePane(bool show) {
594 sidePaneVisible_ = show;
595 }
596
597 Fm::SidePane::Mode sidePaneMode() const {
598 return sidePaneMode_;
599 }
600
601 void setSidePaneMode(Fm::SidePane::Mode sidePaneMode) {
602 sidePaneMode_ = sidePaneMode;
603 }
604
605 bool showMenuBar() const {
606 return showMenuBar_;
607 }
608
609 void setShowMenuBar(bool showMenuBar) {
610 showMenuBar_ = showMenuBar;
611 }
612
613 bool splitView() const {
614 return splitView_;
615 }
616
617 void setSplitView(bool split) {
618 splitView_ = split;
619 }
620
621 Fm::FolderView::ViewMode viewMode() const {
622 return viewMode_;
623 }
624
625 void setViewMode(Fm::FolderView::ViewMode viewMode) {
626 viewMode_ = viewMode;
627 }
628
629 bool showHidden() const {
630 return showHidden_;
631 }
632
633 void setShowHidden(bool showHidden) {
634 showHidden_ = showHidden;
635 }
636
637 bool sortCaseSensitive() const {
638 return sortCaseSensitive_;
639 }
640
641 void setSortCaseSensitive(bool value) {
642 sortCaseSensitive_ = value;
643 }
644
645 QSet<QString> getHiddenPlaces() const {
646 return hiddenPlaces_;
647 }
648
649 void setHiddenPlace(const QString& str, bool hide) {
650 if(hide) {
651 hiddenPlaces_ << str;
652 }
653 else {
654 hiddenPlaces_.remove(str);
655 }
656 }
657
658 Qt::SortOrder sortOrder() const {
659 return sortOrder_;
660 }
661
662 void setSortOrder(Qt::SortOrder sortOrder) {
663 sortOrder_ = sortOrder;
664 }
665
666 Fm::FolderModel::ColumnId sortColumn() const {
667 return sortColumn_;
668 }
669
670 void setSortColumn(Fm::FolderModel::ColumnId sortColumn) {
671 sortColumn_ = sortColumn;
672 }
673
674 bool sortFolderFirst() const {
675 return sortFolderFirst_;
676 }
677
678 void setSortFolderFirst(bool folderFirst) {
679 sortFolderFirst_ = folderFirst;
680 }
681
682 bool sortHiddenLast() const {
683 return sortHiddenLast_;
684 }
685
686 void setSortHiddenLast(bool hiddenLast) {
687 sortHiddenLast_ = hiddenLast;
688 }
689
690 bool showFilter() const {
691 return showFilter_;
692 }
693
694 void setShowFilter(bool value) {
695 showFilter_ = value;
696 }
697
698 bool pathBarButtons() const {
699 return pathBarButtons_;
700 }
701
702 void setPathBarButtons(bool value) {
703 pathBarButtons_ = value;
704 }
705
706 // settings for use with libfm
707 bool singleClick() const {
708 return singleClick_;
709 }
710
711 void setSingleClick(bool singleClick) {
712 singleClick_ = singleClick;
713 }
714
715 int autoSelectionDelay() const {
716 return autoSelectionDelay_;
717 }
718
719 void setAutoSelectionDelay(int value) {
720 autoSelectionDelay_ = value;
721 }
722
723 bool ctrlRightClick() const {
724 return ctrlRightClick_;
725 }
726
727 void setCtrlRightClick(bool value) {
728 ctrlRightClick_ = value;
729 }
730
731 bool useTrash() const {
732 if(!supportTrash_) {
733 return false;
734 }
735 return useTrash_;
736 }
737
738 void setUseTrash(bool useTrash) {
739 useTrash_ = useTrash;
740 }
741
742 bool confirmDelete() const {
743 return confirmDelete_;
744 }
745
746 void setConfirmDelete(bool confirmDelete) {
747 confirmDelete_ = confirmDelete;
748 }
749
750 bool noUsbTrash() const {
751 return noUsbTrash_;
752 }
753
754 void setNoUsbTrash(bool noUsbTrash) {
755 noUsbTrash_ = noUsbTrash;
756 fm_config->no_usb_trash = noUsbTrash_; // also set this to libfm since FmFileOpsJob reads this config value before trashing files.
757 }
758
759 bool confirmTrash() const {
760 return confirmTrash_;
761 }
762
763 void setConfirmTrash(bool value) {
764 confirmTrash_ = value;
765 }
766
767 bool quickExec() const {
768 return quickExec_;
769 }
770
771 void setQuickExec(bool value) {
772 quickExec_ = value;
773 fm_config->quick_exec = quickExec_;
774 }
775
776 bool selectNewFiles() const {
777 return selectNewFiles_;
778 }
779
780 void setSelectNewFiles(bool value) {
781 selectNewFiles_ = value;
782 }
783
784 int bigIconSize() const {
785 return bigIconSize_;
786 }
787
788 void setBigIconSize(int bigIconSize) {
789 bigIconSize_ = bigIconSize;
790 }
791
792 int smallIconSize() const {
793 return smallIconSize_;
794 }
795
796 void setSmallIconSize(int smallIconSize) {
797 smallIconSize_ = smallIconSize;
798 }
799
800 int sidePaneIconSize() const {
801 return sidePaneIconSize_;
802 }
803
804 void setSidePaneIconSize(int sidePaneIconSize) {
805 sidePaneIconSize_ = sidePaneIconSize;
806 }
807
808 int thumbnailIconSize() const {
809 return thumbnailIconSize_;
810 }
811
812 QSize folderViewCellMargins() const {
813 return folderViewCellMargins_;
814 }
815
816 void setFolderViewCellMargins(QSize size) {
817 folderViewCellMargins_ = size;
818 }
819
820 QSize desktopCellMargins() const {
821 return desktopCellMargins_;
822 }
823
824 void setDesktopCellMargins(QSize size) {
825 desktopCellMargins_ = size;
826 }
827
828 QMargins workAreaMargins() const {
829 return workAreaMargins_;
830 }
831
832 void setWorkAreaMargins(QMargins margins) {
833 workAreaMargins_ = margins;
834 }
835
836 bool openWithDefaultFileManager() const {
837 return openWithDefaultFileManager_;
838 }
839
840 void setOpenWithDefaultFileManager(bool open) {
841 openWithDefaultFileManager_ = open;
842 }
843
844 bool allSticky() const {
845 return allSticky_;
846 }
847
848 void setAllSticky(bool sticky) {
849 allSticky_ = sticky;
850 }
851
852 bool showThumbnails() {
853 return showThumbnails_;
854 }
855
856 void setShowThumbnails(bool show) {
857 showThumbnails_ = show;
858 }
859
860 void setThumbnailLocalFilesOnly(bool value) {
861 Fm::ThumbnailJob::setLocalFilesOnly(value);
862 }
863
864 bool thumbnailLocalFilesOnly() const {
865 return Fm::ThumbnailJob::localFilesOnly();
866 }
867
868 int maxThumbnailFileSize() const {
869 return Fm::ThumbnailJob::maxThumbnailFileSize();
870 }
871
872 void setMaxThumbnailFileSize(int size) {
873 Fm::ThumbnailJob::setMaxThumbnailFileSize(size);
874 }
875
876 int maxExternalThumbnailFileSize() const {
877 return Fm::ThumbnailJob::maxExternalThumbnailFileSize();
878 }
879
880 void setMaxExternalThumbnailFileSize(int size) {
881 Fm::ThumbnailJob::setMaxExternalThumbnailFileSize(size);
882 }
883
884 void setThumbnailIconSize(int thumbnailIconSize) {
885 thumbnailIconSize_ = thumbnailIconSize;
886 }
887
888 bool siUnit() {
889 return siUnit_;
890 }
891
892 void setSiUnit(bool siUnit) {
893 siUnit_ = siUnit;
894 // override libfm FmConfig settings. FIXME: should we do this?
895 fm_config->si_unit = (gboolean)siUnit_;
896 }
897
898 bool backupAsHidden() const {
899 return backupAsHidden_;
900 }
901
902 void setBackupAsHidden(bool value) {
903 backupAsHidden_ = value;
904 fm_config->backup_as_hidden = backupAsHidden_; // also set this to libfm since fm_file_info_is_hidden() reads this value internally.
905 }
906
907 bool showFullNames() const {
908 return showFullNames_;
909 }
910
911 void setShowFullNames(bool value) {
912 showFullNames_ = value;
913 }
914
915 bool shadowHidden() const {
916 return shadowHidden_;
917 }
918
919 void setShadowHidden(bool value) {
920 shadowHidden_ = value;
921 }
922
923 bool noItemTooltip() const {
924 return noItemTooltip_;
925 }
926
927 void setNoItemTooltip(bool noTooltip) {
928 noItemTooltip_ = noTooltip;
929 }
930
931 bool scrollPerPixel() const {
932 return scrollPerPixel_;
933 }
934
935 void setScrollPerPixel(bool perPixel) {
936 scrollPerPixel_ = perPixel;
937 }
938
939 bool onlyUserTemplates() const {
940 return onlyUserTemplates_;
941 }
942
943 void setOnlyUserTemplates(bool value) {
944 onlyUserTemplates_ = value;
945 fm_config->only_user_templates = onlyUserTemplates_;
946 }
947
948 bool templateTypeOnce() const {
949 return templateTypeOnce_;
950 }
951
952 void setTemplateTypeOnce(bool value) {
953 templateTypeOnce_ = value;
954 fm_config->template_type_once = templateTypeOnce_;
955 }
956
957 bool templateRunApp() const {
958 return templateRunApp_;
959 }
960
961 void setTemplateRunApp(bool value) {
962 templateRunApp_ = value;
963 fm_config->template_run_app = templateRunApp_;
964 }
965
966 // per-folder settings
967 FolderSettings loadFolderSettings(const Fm::FilePath& path) const;
968
969 void saveFolderSettings(const Fm::FilePath& path, const FolderSettings& settings);
970
971 void clearFolderSettings(const Fm::FilePath& path) const;
972
973 bool searchNameCaseInsensitive() const {
974 return searchNameCaseInsensitive_;
975 }
976
977 void setSearchNameCaseInsensitive(bool caseInsensitive) {
978 searchNameCaseInsensitive_ = caseInsensitive;
979 }
980
981 bool searchContentCaseInsensitive() const {
982 return searchContentCaseInsensitive_;
983 }
984
985 void setsearchContentCaseInsensitive(bool caseInsensitive) {
986 searchContentCaseInsensitive_ = caseInsensitive;
987 }
988
989 bool searchNameRegexp() const {
990 return searchNameRegexp_;
991 }
992
993 void setSearchNameRegexp(bool reg) {
994 searchNameRegexp_ = reg;
995 }
996
997 bool searchContentRegexp() const {
998 return searchContentRegexp_;
999 }
1000
1001 void setSearchContentRegexp(bool reg) {
1002 searchContentRegexp_ = reg;
1003 }
1004
1005 bool searchRecursive() const {
1006 return searchRecursive_;
1007 }
1008
1009 void setSearchRecursive(bool rec) {
1010 searchRecursive_ = rec;
1011 }
1012
1013 bool searchhHidden() const {
1014 return searchhHidden_;
1015 }
1016
1017 void setSearchhHidden(bool hidden) {
1018 searchhHidden_ = hidden;
1019 }
1020
1021 // incremental listing takes more CPU time, sometimes much more, and doesn't work
1022 // with the detailed list view mode, so it's opt-in and off by default
1023 bool incrementalSearch() const {
1024 return incrementalSearch_;
1025 }
1026
1027 void setIncrementalSearch(bool incremental) {
1028 incrementalSearch_ = incremental;
1029 }
1030
1031 int maxSearchHistory() const {
1032 return maxSearchHistory_;
1033 }
1034
1035 void setMaxSearchHistory(int max);
1036
1037 void clearSearchHistory();
1038
1039 QStringList namePatterns() const {
1040 return namePatterns_;
1041 }
1042
1043 void addNamePattern(const QString& pattern);
1044
1045 QStringList contentPatterns() const {
1046 return contentPatterns_;
1047 }
1048
1049 void addContentPattern(const QString& pattern);
1050
1051 QList<int> getCustomColumnWidths() const {
1052 QList<int> l;
1053 for(auto width : std::as_const(customColumnWidths_)) {
1054 l << width.toInt();
1055 }
1056 return l;
1057 }
1058
1059 void setCustomColumnWidths(const QList<int> &widths) {
1060 customColumnWidths_.clear();
1061 for(auto width : widths) {
1062 customColumnWidths_ << QVariant(width);
1063 }
1064 }
1065
1066 QList<int> getHiddenColumns() const {
1067 QList<int> l;
1068 for(auto width : std::as_const(hiddenColumns_)) {
1069 l << width.toInt();
1070 }
1071 return l;
1072 }
1073
1074 void setHiddenColumns(const QList<int> &columns) {
1075 hiddenColumns_.clear();
1076 for(auto column : columns) {
1077 hiddenColumns_ << QVariant(column);
1078 }
1079 }
1080
1081 int getRecentFilesNumber() const {
1082 return recentFilesNumber_;
1083 }
1084 void setRecentFilesNumber(int n);
1085
1086 QStringList getRecentFiles() const {
1087 return recentFiles_;
1088 }
1089 void clearRecentFiles();
1090 void addRecentFile(const QString& file);
1091
1092 void loadRecentFiles();
1093 void saveRecentFiles();
1094
1095private:
1096 bool loadFile(QString filePath);
1097 bool saveFile(QString filePath);
1098
1099 int toIconSize(int size, IconType type) const;
1100
1101private:
1102 QString profileName_;
1103 bool supportTrash_;
1104
1105 // PCManFM specific
1106 QString fallbackIconThemeName_;
1107 bool useFallbackIconTheme_;
1108
1109 bool singleWindowMode_;
1110 OpenDirTargetType bookmarkOpenMethod_;
1111 QString suCommand_;
1112 QString terminal_;
1113 bool mountOnStartup_;
1114 bool mountRemovable_;
1115 bool autoRun_;
1116 bool closeOnUnmount_;
1117
1118 int wallpaperMode_;
1119 QString wallpaper_;
1120 QSize wallpaperDialogSize_;
1121 int wallpaperDialogSplitterPos_;
1122 QString lastSlide_;
1123 QString wallpaperDir_;
1124 int slideShowInterval_;
1125 bool wallpaperRandomize_;
1126 bool noWallpaperCache_;
1127 bool transformWallpaper_;
1128 bool perScreenWallpaper_;
1129 QColor desktopBgColor_;
1130 QColor desktopFgColor_;
1131 QColor desktopShadowColor_;
1132 QFont desktopFont_;
1133 int desktopIconSize_;
1134 QStringList desktopShortcuts_;
1135
1136 bool desktopShowHidden_;
1137 bool desktopHideItems_;
1138 QHash<QString, bool> desktopHideItemsOnScreens_; // on Wayland
1139 Qt::SortOrder desktopSortOrder_;
1140 Fm::FolderModel::ColumnId desktopSortColumn_;
1141 bool desktopSortFolderFirst_;
1142 bool desktopSortHiddenLast_;
1143 bool desktopNoTooltip_;
1144
1145 bool alwaysShowTabs_;
1146 bool showTabClose_;
1147 bool switchToNewTab_;
1148 bool reopenLastTabs_;
1149 int splitViewTabsNum_; // number of tabs in the first view frame when reopening last tabs
1150 QStringList tabPaths_;
1151 bool rememberWindowSize_;
1152 int fixedWindowWidth_;
1153 int fixedWindowHeight_;
1154 int lastWindowWidth_;
1155 int lastWindowHeight_;
1156 bool lastWindowMaximized_;
1157 int splitterPos_;
1158 bool sidePaneVisible_;
1159 Fm::SidePane::Mode sidePaneMode_;
1160 bool showMenuBar_;
1161 bool splitView_;
1162
1163 Fm::FolderView::ViewMode viewMode_;
1164 bool showHidden_;
1165 Qt::SortOrder sortOrder_;
1166 Fm::FolderModel::ColumnId sortColumn_;
1167 bool sortFolderFirst_;
1168 bool sortHiddenLast_;
1169 bool sortCaseSensitive_;
1170 bool showFilter_;
1171 bool pathBarButtons_;
1172
1173 // settings for use with libfm
1174 bool singleClick_;
1175 int autoSelectionDelay_;
1176 bool ctrlRightClick_;
1177 bool useTrash_;
1178 bool confirmDelete_;
1179 bool noUsbTrash_; // do not trash files on usb removable devices
1180 bool confirmTrash_; // Confirm before moving files into "trash can"
1181 bool quickExec_; // Don't ask options on launch executable file
1182 bool selectNewFiles_;
1183
1184 bool showThumbnails_;
1185
1186 QString archiver_;
1187 bool siUnit_;
1188 bool backupAsHidden_;
1189 bool showFullNames_;
1190 bool shadowHidden_;
1191 bool noItemTooltip_;
1192 bool scrollPerPixel_;
1193
1194 QSet<QString> hiddenPlaces_;
1195
1196 int bigIconSize_;
1197 int smallIconSize_;
1198 int sidePaneIconSize_;
1199 int thumbnailIconSize_;
1200
1201 bool onlyUserTemplates_;
1202 bool templateTypeOnce_;
1203 bool templateRunApp_;
1204
1205 QSize folderViewCellMargins_;
1206 QSize desktopCellMargins_;
1207 QMargins workAreaMargins_;
1208
1209 bool openWithDefaultFileManager_;
1210
1211 bool allSticky_;
1212
1213 // search settings
1214 bool searchNameCaseInsensitive_;
1215 bool searchContentCaseInsensitive_;
1216 bool searchNameRegexp_;
1217 bool searchContentRegexp_;
1218 bool searchRecursive_;
1219 bool searchhHidden_;
1220 bool incrementalSearch_;
1221 int maxSearchHistory_;
1222 QStringList namePatterns_;
1223 QStringList contentPatterns_;
1224
1225 // detailed list columns
1226 QList<QVariant> customColumnWidths_;
1227 QList<QVariant> hiddenColumns_;
1228
1229 // recent files
1230 int recentFilesNumber_;
1231 QStringList recentFiles_;
1232
1233 QStringList screenNames_; // on Wayland
1234};
1235
1236}
1237
1238#endif // PCMANFM_SETTINGS_H
Definition settings.h:42