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