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 
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  bool openWithDefaultFileManager() const {
792  return openWithDefaultFileManager_;
793  }
794 
795  void setOpenWithDefaultFileManager(bool open) {
796  openWithDefaultFileManager_ = open;
797  }
798 
799  bool allSticky() const {
800  return allSticky_;
801  }
802 
803  void setAllSticky(bool sticky) {
804  allSticky_ = sticky;
805  }
806 
807  bool showThumbnails() {
808  return showThumbnails_;
809  }
810 
811  void setShowThumbnails(bool show) {
812  showThumbnails_ = show;
813  }
814 
815  void setThumbnailLocalFilesOnly(bool value) {
816  Fm::ThumbnailJob::setLocalFilesOnly(value);
817  }
818 
819  bool thumbnailLocalFilesOnly() const {
820  return Fm::ThumbnailJob::localFilesOnly();
821  }
822 
823  int maxThumbnailFileSize() const {
824  return Fm::ThumbnailJob::maxThumbnailFileSize();
825  }
826 
827  void setMaxThumbnailFileSize(int size) {
828  Fm::ThumbnailJob::setMaxThumbnailFileSize(size);
829  }
830 
831  int maxExternalThumbnailFileSize() const {
832  return Fm::ThumbnailJob::maxExternalThumbnailFileSize();
833  }
834 
835  void setMaxExternalThumbnailFileSize(int size) {
836  Fm::ThumbnailJob::setMaxExternalThumbnailFileSize(size);
837  }
838 
839  void setThumbnailIconSize(int thumbnailIconSize) {
840  thumbnailIconSize_ = thumbnailIconSize;
841  }
842 
843  bool siUnit() {
844  return siUnit_;
845  }
846 
847  void setSiUnit(bool siUnit) {
848  siUnit_ = siUnit;
849  // override libfm FmConfig settings. FIXME: should we do this?
850  fm_config->si_unit = (gboolean)siUnit_;
851  }
852 
853  bool backupAsHidden() const {
854  return backupAsHidden_;
855  }
856 
857  void setBackupAsHidden(bool value) {
858  backupAsHidden_ = value;
859  fm_config->backup_as_hidden = backupAsHidden_; // also set this to libfm since fm_file_info_is_hidden() reads this value internally.
860  }
861 
862  bool showFullNames() const {
863  return showFullNames_;
864  }
865 
866  void setShowFullNames(bool value) {
867  showFullNames_ = value;
868  }
869 
870  bool shadowHidden() const {
871  return shadowHidden_;
872  }
873 
874  void setShadowHidden(bool value) {
875  shadowHidden_ = value;
876  }
877 
878  bool noItemTooltip() const {
879  return noItemTooltip_;
880  }
881 
882  void setNoItemTooltip(bool noTooltip) {
883  noItemTooltip_ = noTooltip;
884  }
885 
886  bool scrollPerPixel() const {
887  return scrollPerPixel_;
888  }
889 
890  void setScrollPerPixel(bool perPixel) {
891  scrollPerPixel_ = perPixel;
892  }
893 
894  bool onlyUserTemplates() const {
895  return onlyUserTemplates_;
896  }
897 
898  void setOnlyUserTemplates(bool value) {
899  onlyUserTemplates_ = value;
900  fm_config->only_user_templates = onlyUserTemplates_;
901  }
902 
903  bool templateTypeOnce() const {
904  return templateTypeOnce_;
905  }
906 
907  void setTemplateTypeOnce(bool value) {
908  templateTypeOnce_ = value;
909  fm_config->template_type_once = templateTypeOnce_;
910  }
911 
912  bool templateRunApp() const {
913  return templateRunApp_;
914  }
915 
916  void setTemplateRunApp(bool value) {
917  templateRunApp_ = value;
918  fm_config->template_run_app = templateRunApp_;
919  }
920 
921  // per-folder settings
922  FolderSettings loadFolderSettings(const Fm::FilePath& path) const;
923 
924  void saveFolderSettings(const Fm::FilePath& path, const FolderSettings& settings);
925 
926  void clearFolderSettings(const Fm::FilePath& path) const;
927 
928  bool searchNameCaseInsensitive() const {
929  return searchNameCaseInsensitive_;
930  }
931 
932  void setSearchNameCaseInsensitive(bool caseInsensitive) {
933  searchNameCaseInsensitive_ = caseInsensitive;
934  }
935 
936  bool searchContentCaseInsensitive() const {
937  return searchContentCaseInsensitive_;
938  }
939 
940  void setsearchContentCaseInsensitive(bool caseInsensitive) {
941  searchContentCaseInsensitive_ = caseInsensitive;
942  }
943 
944  bool searchNameRegexp() const {
945  return searchNameRegexp_;
946  }
947 
948  void setSearchNameRegexp(bool reg) {
949  searchNameRegexp_ = reg;
950  }
951 
952  bool searchContentRegexp() const {
953  return searchContentRegexp_;
954  }
955 
956  void setSearchContentRegexp(bool reg) {
957  searchContentRegexp_ = reg;
958  }
959 
960  bool searchRecursive() const {
961  return searchRecursive_;
962  }
963 
964  void setSearchRecursive(bool rec) {
965  searchRecursive_ = rec;
966  }
967 
968  bool searchhHidden() const {
969  return searchhHidden_;
970  }
971 
972  void setSearchhHidden(bool hidden) {
973  searchhHidden_ = hidden;
974  }
975 
976  QList<int> getCustomColumnWidths() const {
977  QList<int> l;
978  for(auto width : qAsConst(customColumnWidths_)) {
979  l << width.toInt();
980  }
981  return l;
982  }
983 
984  void setCustomColumnWidths(const QList<int> &widths) {
985  customColumnWidths_.clear();
986  for(auto width : widths) {
987  customColumnWidths_ << QVariant(width);
988  }
989  }
990 
991  QList<int> getHiddenColumns() const {
992  QList<int> l;
993  for(auto width : qAsConst(hiddenColumns_)) {
994  l << width.toInt();
995  }
996  return l;
997  }
998 
999  void setHiddenColumns(const QList<int> &columns) {
1000  hiddenColumns_.clear();
1001  for(auto column : columns) {
1002  hiddenColumns_ << QVariant(column);
1003  }
1004  }
1005 
1006  int getRecentFilesNumber() const {
1007  return recentFilesNumber_;
1008  }
1009  void setRecentFilesNumber(int n);
1010 
1011  QStringList getRecentFiles() const {
1012  return recentFiles_;
1013  }
1014  void clearRecentFiles();
1015  void addRecentFile(const QString& file);
1016 
1017  void loadRecentFiles();
1018  void saveRecentFiles();
1019 
1020 private:
1021  bool loadFile(QString filePath);
1022  bool saveFile(QString filePath);
1023 
1024  int toIconSize(int size, IconType type) const;
1025 
1026 private:
1027  QString profileName_;
1028  bool supportTrash_;
1029 
1030  // PCManFM specific
1031  QString fallbackIconThemeName_;
1032  bool useFallbackIconTheme_;
1033 
1034  bool singleWindowMode_;
1035  OpenDirTargetType bookmarkOpenMethod_;
1036  QString suCommand_;
1037  QString terminal_;
1038  bool mountOnStartup_;
1039  bool mountRemovable_;
1040  bool autoRun_;
1041  bool closeOnUnmount_;
1042 
1043  int wallpaperMode_;
1044  QString wallpaper_;
1045  QSize wallpaperDialogSize_;
1046  int wallpaperDialogSplitterPos_;
1047  QString lastSlide_;
1048  QString wallpaperDir_;
1049  int slideShowInterval_;
1050  bool wallpaperRandomize_;
1051  bool transformWallpaper_;
1052  bool perScreenWallpaper_;
1053  QColor desktopBgColor_;
1054  QColor desktopFgColor_;
1055  QColor desktopShadowColor_;
1056  QFont desktopFont_;
1057  int desktopIconSize_;
1058  QStringList desktopShortcuts_;
1059 
1060  bool desktopShowHidden_;
1061  bool desktopHideItems_;
1062  Qt::SortOrder desktopSortOrder_;
1063  Fm::FolderModel::ColumnId desktopSortColumn_;
1064  bool desktopSortFolderFirst_;
1065  bool desktopSortHiddenLast_;
1066 
1067  bool alwaysShowTabs_;
1068  bool showTabClose_;
1069  bool switchToNewTab_;
1070  bool reopenLastTabs_;
1071  QStringList tabPaths_;
1072  bool rememberWindowSize_;
1073  int fixedWindowWidth_;
1074  int fixedWindowHeight_;
1075  int lastWindowWidth_;
1076  int lastWindowHeight_;
1077  bool lastWindowMaximized_;
1078  int splitterPos_;
1079  bool sidePaneVisible_;
1080  Fm::SidePane::Mode sidePaneMode_;
1081  bool showMenuBar_;
1082  bool splitView_;
1083 
1084  Fm::FolderView::ViewMode viewMode_;
1085  bool showHidden_;
1086  Qt::SortOrder sortOrder_;
1087  Fm::FolderModel::ColumnId sortColumn_;
1088  bool sortFolderFirst_;
1089  bool sortHiddenLast_;
1090  bool sortCaseSensitive_;
1091  bool showFilter_;
1092  bool pathBarButtons_;
1093 
1094  // settings for use with libfm
1095  bool singleClick_;
1096  int autoSelectionDelay_;
1097  bool ctrlRightClick_;
1098  bool useTrash_;
1099  bool confirmDelete_;
1100  bool noUsbTrash_; // do not trash files on usb removable devices
1101  bool confirmTrash_; // Confirm before moving files into "trash can"
1102  bool quickExec_; // Don't ask options on launch executable file
1103  bool selectNewFiles_;
1104 
1105  bool showThumbnails_;
1106 
1107  QString archiver_;
1108  bool siUnit_;
1109  bool backupAsHidden_;
1110  bool showFullNames_;
1111  bool shadowHidden_;
1112  bool noItemTooltip_;
1113  bool scrollPerPixel_;
1114 
1115  QSet<QString> hiddenPlaces_;
1116 
1117  int bigIconSize_;
1118  int smallIconSize_;
1119  int sidePaneIconSize_;
1120  int thumbnailIconSize_;
1121 
1122  bool onlyUserTemplates_;
1123  bool templateTypeOnce_;
1124  bool templateRunApp_;
1125 
1126  QSize folderViewCellMargins_;
1127  QSize desktopCellMargins_;
1128 
1129  bool openWithDefaultFileManager_;
1130 
1131  bool allSticky_;
1132 
1133  // search settings
1134  bool searchNameCaseInsensitive_;
1135  bool searchContentCaseInsensitive_;
1136  bool searchNameRegexp_;
1137  bool searchContentRegexp_;
1138  bool searchRecursive_;
1139  bool searchhHidden_;
1140 
1141  // detailed list columns
1142  QList<QVariant> customColumnWidths_;
1143  QList<QVariant> hiddenColumns_;
1144 
1145  // recent files
1146  int recentFilesNumber_;
1147  QStringList recentFiles_;
1148 };
1149 
1150 }
1151 
1152 #endif // PCMANFM_SETTINGS_H
Definition: settings.h:42
Definition: settings.h:154