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 bool transformWallpaper() const {
331 return transformWallpaper_;
332 }
333
334 void setTransformWallpaper(bool tr) {
335 transformWallpaper_ = tr;
336 }
337
338 bool perScreenWallpaper() const {
339 return perScreenWallpaper_;
340 }
341
342 void setPerScreenWallpaper(bool tr) {
343 perScreenWallpaper_ = tr;
344 }
345
346 const QColor& desktopBgColor() const {
347 return desktopBgColor_;
348 }
349
350 void setDesktopBgColor(QColor desktopBgColor) {
351 desktopBgColor_ = desktopBgColor;
352 }
353
354 const QColor& desktopFgColor() const {
355 return desktopFgColor_;
356 }
357
358 void setDesktopFgColor(QColor desktopFgColor) {
359 desktopFgColor_ = desktopFgColor;
360 }
361
362 const QColor& desktopShadowColor() const {
363 return desktopShadowColor_;
364 }
365
366 void setDesktopShadowColor(QColor desktopShadowColor) {
367 desktopShadowColor_ = desktopShadowColor;
368 }
369
370 QFont desktopFont() const {
371 return desktopFont_;
372 }
373
374 void setDesktopFont(QFont font) {
375 desktopFont_ = font;
376 }
377
378 int desktopIconSize() const {
379 return desktopIconSize_;
380 }
381
382 void setDesktopIconSize(int desktopIconSize) {
383 desktopIconSize_ = desktopIconSize;
384 }
385
386 QStringList desktopShortcuts() const {
387 return desktopShortcuts_;
388 }
389
390 void setDesktopShortcuts(const QStringList& list) {
391 desktopShortcuts_ = list;
392 }
393
394 bool desktopShowHidden() const {
395 return desktopShowHidden_;
396 }
397
398 void setDesktopShowHidden(bool desktopShowHidden) {
399 desktopShowHidden_ = desktopShowHidden;
400 }
401
402 bool desktopHideItems(const QString& screenName = QString()) const {
403 if(screenName.isEmpty()) { // X11
404 return desktopHideItems_;
405 }
406 return desktopHideItemsOnScreens_.value(screenName, false); // Wayland
407 }
408
409 void setDesktopHideItems(bool hide, const QString& screenName = QString()) {
410 if(screenName.isEmpty()) { // X11
411 desktopHideItems_ = hide;
412 }
413 else { // Wayland
414 if(!screenNames_.contains(screenName)) {
415 screenNames_ << screenName;
416 }
417 desktopHideItemsOnScreens_.insert(screenName, hide);
418 }
419 }
420
421 Qt::SortOrder desktopSortOrder() const {
422 return desktopSortOrder_;
423 }
424
425 void setDesktopSortOrder(Qt::SortOrder desktopSortOrder) {
426 desktopSortOrder_ = desktopSortOrder;
427 }
428
429 Fm::FolderModel::ColumnId desktopSortColumn() const {
430 return desktopSortColumn_;
431 }
432
433 void setDesktopSortColumn(Fm::FolderModel::ColumnId desktopSortColumn) {
434 desktopSortColumn_ = desktopSortColumn;
435 }
436
437 bool desktopSortFolderFirst() const {
438 return desktopSortFolderFirst_;
439 }
440
441 void setDesktopSortFolderFirst(bool desktopFolderFirst) {
442 desktopSortFolderFirst_ = desktopFolderFirst;
443 }
444
445 bool desktopSortHiddenLast() const {
446 return desktopSortHiddenLast_;
447 }
448
449 void setDesktopSortHiddenLast(bool desktopHiddenLast) {
450 desktopSortHiddenLast_ = desktopHiddenLast;
451 }
452
453 bool desktopNoTooltip() const {
454 return desktopNoTooltip_;
455 }
456
457 void setDesktopNoTooltip(bool noTooltip) {
458 desktopNoTooltip_ = noTooltip;
459 }
460
461 bool alwaysShowTabs() const {
462 return alwaysShowTabs_;
463 }
464
465 void setAlwaysShowTabs(bool alwaysShowTabs) {
466 alwaysShowTabs_ = alwaysShowTabs;
467 }
468
469 bool showTabClose() const {
470 return showTabClose_;
471 }
472
473 void setShowTabClose(bool showTabClose) {
474 showTabClose_ = showTabClose;
475 }
476
477 bool switchToNewTab() const {
478 return switchToNewTab_;
479 }
480
481 void setSwitchToNewTab(bool showTabClose) {
482 switchToNewTab_ = showTabClose;
483 }
484
485 bool reopenLastTabs() const {
486 return reopenLastTabs_;
487 }
488
489 void setReopenLastTabs(bool reopenLastTabs) {
490 reopenLastTabs_ = reopenLastTabs;
491 }
492
493 int splitViewTabsNum() const {
494 return splitViewTabsNum_;
495 }
496
497 void setSplitViewTabsNum(int n) {
498 splitViewTabsNum_ = n;
499 }
500
501 QStringList tabPaths() const {
502 return tabPaths_;
503 }
504
505 void setTabPaths(const QStringList& tabPaths) {
506 tabPaths_ = tabPaths;
507 }
508
509 bool rememberWindowSize() const {
510 return rememberWindowSize_;
511 }
512
513 void setRememberWindowSize(bool rememberWindowSize) {
514 rememberWindowSize_ = rememberWindowSize;
515 }
516
517 int windowWidth() const {
518 if(rememberWindowSize_) {
519 return lastWindowWidth_;
520 }
521 else {
522 return fixedWindowWidth_;
523 }
524 }
525
526 int windowHeight() const {
527 if(rememberWindowSize_) {
528 return lastWindowHeight_;
529 }
530 else {
531 return fixedWindowHeight_;
532 }
533 }
534
535 bool windowMaximized() const {
536 if(rememberWindowSize_) {
537 return lastWindowMaximized_;
538 }
539 else {
540 return false;
541 }
542 }
543
544 int fixedWindowWidth() const {
545 return fixedWindowWidth_;
546 }
547
548 void setFixedWindowWidth(int fixedWindowWidth) {
549 fixedWindowWidth_ = fixedWindowWidth;
550 }
551
552 int fixedWindowHeight() const {
553 return fixedWindowHeight_;
554 }
555
556 void setFixedWindowHeight(int fixedWindowHeight) {
557 fixedWindowHeight_ = fixedWindowHeight;
558 }
559
560 void setLastWindowWidth(int lastWindowWidth) {
561 lastWindowWidth_ = lastWindowWidth;
562 }
563
564 void setLastWindowHeight(int lastWindowHeight) {
565 lastWindowHeight_ = lastWindowHeight;
566 }
567
568 void setLastWindowMaximized(bool lastWindowMaximized) {
569 lastWindowMaximized_ = lastWindowMaximized;
570 }
571
572 int splitterPos() const {
573 return splitterPos_;
574 }
575
576 void setSplitterPos(int splitterPos) {
577 splitterPos_ = splitterPos;
578 }
579
580 bool isSidePaneVisible() const {
581 return sidePaneVisible_;
582 }
583
584 void showSidePane(bool show) {
585 sidePaneVisible_ = show;
586 }
587
588 Fm::SidePane::Mode sidePaneMode() const {
589 return sidePaneMode_;
590 }
591
592 void setSidePaneMode(Fm::SidePane::Mode sidePaneMode) {
593 sidePaneMode_ = sidePaneMode;
594 }
595
596 bool showMenuBar() const {
597 return showMenuBar_;
598 }
599
600 void setShowMenuBar(bool showMenuBar) {
601 showMenuBar_ = showMenuBar;
602 }
603
604 bool splitView() const {
605 return splitView_;
606 }
607
608 void setSplitView(bool split) {
609 splitView_ = split;
610 }
611
612 Fm::FolderView::ViewMode viewMode() const {
613 return viewMode_;
614 }
615
616 void setViewMode(Fm::FolderView::ViewMode viewMode) {
617 viewMode_ = viewMode;
618 }
619
620 bool showHidden() const {
621 return showHidden_;
622 }
623
624 void setShowHidden(bool showHidden) {
625 showHidden_ = showHidden;
626 }
627
628 bool sortCaseSensitive() const {
629 return sortCaseSensitive_;
630 }
631
632 void setSortCaseSensitive(bool value) {
633 sortCaseSensitive_ = value;
634 }
635
636 QSet<QString> getHiddenPlaces() const {
637 return hiddenPlaces_;
638 }
639
640 void setHiddenPlace(const QString& str, bool hide) {
641 if(hide) {
642 hiddenPlaces_ << str;
643 }
644 else {
645 hiddenPlaces_.remove(str);
646 }
647 }
648
649 Qt::SortOrder sortOrder() const {
650 return sortOrder_;
651 }
652
653 void setSortOrder(Qt::SortOrder sortOrder) {
654 sortOrder_ = sortOrder;
655 }
656
657 Fm::FolderModel::ColumnId sortColumn() const {
658 return sortColumn_;
659 }
660
661 void setSortColumn(Fm::FolderModel::ColumnId sortColumn) {
662 sortColumn_ = sortColumn;
663 }
664
665 bool sortFolderFirst() const {
666 return sortFolderFirst_;
667 }
668
669 void setSortFolderFirst(bool folderFirst) {
670 sortFolderFirst_ = folderFirst;
671 }
672
673 bool sortHiddenLast() const {
674 return sortHiddenLast_;
675 }
676
677 void setSortHiddenLast(bool hiddenLast) {
678 sortHiddenLast_ = hiddenLast;
679 }
680
681 bool showFilter() const {
682 return showFilter_;
683 }
684
685 void setShowFilter(bool value) {
686 showFilter_ = value;
687 }
688
689 bool pathBarButtons() const {
690 return pathBarButtons_;
691 }
692
693 void setPathBarButtons(bool value) {
694 pathBarButtons_ = value;
695 }
696
697 // settings for use with libfm
698 bool singleClick() const {
699 return singleClick_;
700 }
701
702 void setSingleClick(bool singleClick) {
703 singleClick_ = singleClick;
704 }
705
706 int autoSelectionDelay() const {
707 return autoSelectionDelay_;
708 }
709
710 void setAutoSelectionDelay(int value) {
711 autoSelectionDelay_ = value;
712 }
713
714 bool ctrlRightClick() const {
715 return ctrlRightClick_;
716 }
717
718 void setCtrlRightClick(bool value) {
719 ctrlRightClick_ = value;
720 }
721
722 bool useTrash() const {
723 if(!supportTrash_) {
724 return false;
725 }
726 return useTrash_;
727 }
728
729 void setUseTrash(bool useTrash) {
730 useTrash_ = useTrash;
731 }
732
733 bool confirmDelete() const {
734 return confirmDelete_;
735 }
736
737 void setConfirmDelete(bool confirmDelete) {
738 confirmDelete_ = confirmDelete;
739 }
740
741 bool noUsbTrash() const {
742 return noUsbTrash_;
743 }
744
745 void setNoUsbTrash(bool noUsbTrash) {
746 noUsbTrash_ = noUsbTrash;
747 fm_config->no_usb_trash = noUsbTrash_; // also set this to libfm since FmFileOpsJob reads this config value before trashing files.
748 }
749
750 bool confirmTrash() const {
751 return confirmTrash_;
752 }
753
754 void setConfirmTrash(bool value) {
755 confirmTrash_ = value;
756 }
757
758 bool quickExec() const {
759 return quickExec_;
760 }
761
762 void setQuickExec(bool value) {
763 quickExec_ = value;
764 fm_config->quick_exec = quickExec_;
765 }
766
767 bool selectNewFiles() const {
768 return selectNewFiles_;
769 }
770
771 void setSelectNewFiles(bool value) {
772 selectNewFiles_ = value;
773 }
774
775 int bigIconSize() const {
776 return bigIconSize_;
777 }
778
779 void setBigIconSize(int bigIconSize) {
780 bigIconSize_ = bigIconSize;
781 }
782
783 int smallIconSize() const {
784 return smallIconSize_;
785 }
786
787 void setSmallIconSize(int smallIconSize) {
788 smallIconSize_ = smallIconSize;
789 }
790
791 int sidePaneIconSize() const {
792 return sidePaneIconSize_;
793 }
794
795 void setSidePaneIconSize(int sidePaneIconSize) {
796 sidePaneIconSize_ = sidePaneIconSize;
797 }
798
799 int thumbnailIconSize() const {
800 return thumbnailIconSize_;
801 }
802
803 QSize folderViewCellMargins() const {
804 return folderViewCellMargins_;
805 }
806
807 void setFolderViewCellMargins(QSize size) {
808 folderViewCellMargins_ = size;
809 }
810
811 QSize desktopCellMargins() const {
812 return desktopCellMargins_;
813 }
814
815 void setDesktopCellMargins(QSize size) {
816 desktopCellMargins_ = size;
817 }
818
819 QMargins workAreaMargins() const {
820 return workAreaMargins_;
821 }
822
823 void setWorkAreaMargins(QMargins margins) {
824 workAreaMargins_ = margins;
825 }
826
827 bool openWithDefaultFileManager() const {
828 return openWithDefaultFileManager_;
829 }
830
831 void setOpenWithDefaultFileManager(bool open) {
832 openWithDefaultFileManager_ = open;
833 }
834
835 bool allSticky() const {
836 return allSticky_;
837 }
838
839 void setAllSticky(bool sticky) {
840 allSticky_ = sticky;
841 }
842
843 bool showThumbnails() {
844 return showThumbnails_;
845 }
846
847 void setShowThumbnails(bool show) {
848 showThumbnails_ = show;
849 }
850
851 void setThumbnailLocalFilesOnly(bool value) {
852 Fm::ThumbnailJob::setLocalFilesOnly(value);
853 }
854
855 bool thumbnailLocalFilesOnly() const {
856 return Fm::ThumbnailJob::localFilesOnly();
857 }
858
859 int maxThumbnailFileSize() const {
860 return Fm::ThumbnailJob::maxThumbnailFileSize();
861 }
862
863 void setMaxThumbnailFileSize(int size) {
864 Fm::ThumbnailJob::setMaxThumbnailFileSize(size);
865 }
866
867 int maxExternalThumbnailFileSize() const {
868 return Fm::ThumbnailJob::maxExternalThumbnailFileSize();
869 }
870
871 void setMaxExternalThumbnailFileSize(int size) {
872 Fm::ThumbnailJob::setMaxExternalThumbnailFileSize(size);
873 }
874
875 void setThumbnailIconSize(int thumbnailIconSize) {
876 thumbnailIconSize_ = thumbnailIconSize;
877 }
878
879 bool siUnit() {
880 return siUnit_;
881 }
882
883 void setSiUnit(bool siUnit) {
884 siUnit_ = siUnit;
885 // override libfm FmConfig settings. FIXME: should we do this?
886 fm_config->si_unit = (gboolean)siUnit_;
887 }
888
889 bool backupAsHidden() const {
890 return backupAsHidden_;
891 }
892
893 void setBackupAsHidden(bool value) {
894 backupAsHidden_ = value;
895 fm_config->backup_as_hidden = backupAsHidden_; // also set this to libfm since fm_file_info_is_hidden() reads this value internally.
896 }
897
898 bool showFullNames() const {
899 return showFullNames_;
900 }
901
902 void setShowFullNames(bool value) {
903 showFullNames_ = value;
904 }
905
906 bool shadowHidden() const {
907 return shadowHidden_;
908 }
909
910 void setShadowHidden(bool value) {
911 shadowHidden_ = value;
912 }
913
914 bool noItemTooltip() const {
915 return noItemTooltip_;
916 }
917
918 void setNoItemTooltip(bool noTooltip) {
919 noItemTooltip_ = noTooltip;
920 }
921
922 bool scrollPerPixel() const {
923 return scrollPerPixel_;
924 }
925
926 void setScrollPerPixel(bool perPixel) {
927 scrollPerPixel_ = perPixel;
928 }
929
930 bool onlyUserTemplates() const {
931 return onlyUserTemplates_;
932 }
933
934 void setOnlyUserTemplates(bool value) {
935 onlyUserTemplates_ = value;
936 fm_config->only_user_templates = onlyUserTemplates_;
937 }
938
939 bool templateTypeOnce() const {
940 return templateTypeOnce_;
941 }
942
943 void setTemplateTypeOnce(bool value) {
944 templateTypeOnce_ = value;
945 fm_config->template_type_once = templateTypeOnce_;
946 }
947
948 bool templateRunApp() const {
949 return templateRunApp_;
950 }
951
952 void setTemplateRunApp(bool value) {
953 templateRunApp_ = value;
954 fm_config->template_run_app = templateRunApp_;
955 }
956
957 // per-folder settings
958 FolderSettings loadFolderSettings(const Fm::FilePath& path) const;
959
960 void saveFolderSettings(const Fm::FilePath& path, const FolderSettings& settings);
961
962 void clearFolderSettings(const Fm::FilePath& path) const;
963
964 bool searchNameCaseInsensitive() const {
965 return searchNameCaseInsensitive_;
966 }
967
968 void setSearchNameCaseInsensitive(bool caseInsensitive) {
969 searchNameCaseInsensitive_ = caseInsensitive;
970 }
971
972 bool searchContentCaseInsensitive() const {
973 return searchContentCaseInsensitive_;
974 }
975
976 void setsearchContentCaseInsensitive(bool caseInsensitive) {
977 searchContentCaseInsensitive_ = caseInsensitive;
978 }
979
980 bool searchNameRegexp() const {
981 return searchNameRegexp_;
982 }
983
984 void setSearchNameRegexp(bool reg) {
985 searchNameRegexp_ = reg;
986 }
987
988 bool searchContentRegexp() const {
989 return searchContentRegexp_;
990 }
991
992 void setSearchContentRegexp(bool reg) {
993 searchContentRegexp_ = reg;
994 }
995
996 bool searchRecursive() const {
997 return searchRecursive_;
998 }
999
1000 void setSearchRecursive(bool rec) {
1001 searchRecursive_ = rec;
1002 }
1003
1004 bool searchhHidden() const {
1005 return searchhHidden_;
1006 }
1007
1008 void setSearchhHidden(bool hidden) {
1009 searchhHidden_ = hidden;
1010 }
1011
1012 int maxSearchHistory() const {
1013 return maxSearchHistory_;
1014 }
1015
1016 void setMaxSearchHistory(int max);
1017
1018 void clearSearchHistory();
1019
1020 QStringList namePatterns() const {
1021 return namePatterns_;
1022 }
1023
1024 void addNamePattern(const QString& pattern);
1025
1026 QStringList contentPatterns() const {
1027 return contentPatterns_;
1028 }
1029
1030 void addContentPattern(const QString& pattern);
1031
1032 QList<int> getCustomColumnWidths() const {
1033 QList<int> l;
1034 for(auto width : std::as_const(customColumnWidths_)) {
1035 l << width.toInt();
1036 }
1037 return l;
1038 }
1039
1040 void setCustomColumnWidths(const QList<int> &widths) {
1041 customColumnWidths_.clear();
1042 for(auto width : widths) {
1043 customColumnWidths_ << QVariant(width);
1044 }
1045 }
1046
1047 QList<int> getHiddenColumns() const {
1048 QList<int> l;
1049 for(auto width : std::as_const(hiddenColumns_)) {
1050 l << width.toInt();
1051 }
1052 return l;
1053 }
1054
1055 void setHiddenColumns(const QList<int> &columns) {
1056 hiddenColumns_.clear();
1057 for(auto column : columns) {
1058 hiddenColumns_ << QVariant(column);
1059 }
1060 }
1061
1062 int getRecentFilesNumber() const {
1063 return recentFilesNumber_;
1064 }
1065 void setRecentFilesNumber(int n);
1066
1067 QStringList getRecentFiles() const {
1068 return recentFiles_;
1069 }
1070 void clearRecentFiles();
1071 void addRecentFile(const QString& file);
1072
1073 void loadRecentFiles();
1074 void saveRecentFiles();
1075
1076private:
1077 bool loadFile(QString filePath);
1078 bool saveFile(QString filePath);
1079
1080 int toIconSize(int size, IconType type) const;
1081
1082private:
1083 QString profileName_;
1084 bool supportTrash_;
1085
1086 // PCManFM specific
1087 QString fallbackIconThemeName_;
1088 bool useFallbackIconTheme_;
1089
1090 bool singleWindowMode_;
1091 OpenDirTargetType bookmarkOpenMethod_;
1092 QString suCommand_;
1093 QString terminal_;
1094 bool mountOnStartup_;
1095 bool mountRemovable_;
1096 bool autoRun_;
1097 bool closeOnUnmount_;
1098
1099 int wallpaperMode_;
1100 QString wallpaper_;
1101 QSize wallpaperDialogSize_;
1102 int wallpaperDialogSplitterPos_;
1103 QString lastSlide_;
1104 QString wallpaperDir_;
1105 int slideShowInterval_;
1106 bool wallpaperRandomize_;
1107 bool transformWallpaper_;
1108 bool perScreenWallpaper_;
1109 QColor desktopBgColor_;
1110 QColor desktopFgColor_;
1111 QColor desktopShadowColor_;
1112 QFont desktopFont_;
1113 int desktopIconSize_;
1114 QStringList desktopShortcuts_;
1115
1116 bool desktopShowHidden_;
1117 bool desktopHideItems_;
1118 QHash<QString, bool> desktopHideItemsOnScreens_; // on Wayland
1119 Qt::SortOrder desktopSortOrder_;
1120 Fm::FolderModel::ColumnId desktopSortColumn_;
1121 bool desktopSortFolderFirst_;
1122 bool desktopSortHiddenLast_;
1123 bool desktopNoTooltip_;
1124
1125 bool alwaysShowTabs_;
1126 bool showTabClose_;
1127 bool switchToNewTab_;
1128 bool reopenLastTabs_;
1129 int splitViewTabsNum_; // number of tabs in the first view frame when reopening last tabs
1130 QStringList tabPaths_;
1131 bool rememberWindowSize_;
1132 int fixedWindowWidth_;
1133 int fixedWindowHeight_;
1134 int lastWindowWidth_;
1135 int lastWindowHeight_;
1136 bool lastWindowMaximized_;
1137 int splitterPos_;
1138 bool sidePaneVisible_;
1139 Fm::SidePane::Mode sidePaneMode_;
1140 bool showMenuBar_;
1141 bool splitView_;
1142
1143 Fm::FolderView::ViewMode viewMode_;
1144 bool showHidden_;
1145 Qt::SortOrder sortOrder_;
1146 Fm::FolderModel::ColumnId sortColumn_;
1147 bool sortFolderFirst_;
1148 bool sortHiddenLast_;
1149 bool sortCaseSensitive_;
1150 bool showFilter_;
1151 bool pathBarButtons_;
1152
1153 // settings for use with libfm
1154 bool singleClick_;
1155 int autoSelectionDelay_;
1156 bool ctrlRightClick_;
1157 bool useTrash_;
1158 bool confirmDelete_;
1159 bool noUsbTrash_; // do not trash files on usb removable devices
1160 bool confirmTrash_; // Confirm before moving files into "trash can"
1161 bool quickExec_; // Don't ask options on launch executable file
1162 bool selectNewFiles_;
1163
1164 bool showThumbnails_;
1165
1166 QString archiver_;
1167 bool siUnit_;
1168 bool backupAsHidden_;
1169 bool showFullNames_;
1170 bool shadowHidden_;
1171 bool noItemTooltip_;
1172 bool scrollPerPixel_;
1173
1174 QSet<QString> hiddenPlaces_;
1175
1176 int bigIconSize_;
1177 int smallIconSize_;
1178 int sidePaneIconSize_;
1179 int thumbnailIconSize_;
1180
1181 bool onlyUserTemplates_;
1182 bool templateTypeOnce_;
1183 bool templateRunApp_;
1184
1185 QSize folderViewCellMargins_;
1186 QSize desktopCellMargins_;
1187 QMargins workAreaMargins_;
1188
1189 bool openWithDefaultFileManager_;
1190
1191 bool allSticky_;
1192
1193 // search settings
1194 bool searchNameCaseInsensitive_;
1195 bool searchContentCaseInsensitive_;
1196 bool searchNameRegexp_;
1197 bool searchContentRegexp_;
1198 bool searchRecursive_;
1199 bool searchhHidden_;
1200 int maxSearchHistory_;
1201 QStringList namePatterns_;
1202 QStringList contentPatterns_;
1203
1204 // detailed list columns
1205 QList<QVariant> customColumnWidths_;
1206 QList<QVariant> hiddenColumns_;
1207
1208 // recent files
1209 int recentFilesNumber_;
1210 QStringList recentFiles_;
1211
1212 QStringList screenNames_; // on Wayland
1213};
1214
1215}
1216
1217#endif // PCMANFM_SETTINGS_H
Definition settings.h:42