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