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