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