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