21#ifndef NDEFILEMAN_SETTINGS_H
22#define NDEFILEMAN_SETTINGS_H
25#include <libfm-qt-nde/folderview.h>
26#include <libfm-qt-nde/foldermodel.h>
27#include "desktopwindow.h"
28#include <libfm-qt-nde/sidepane.h>
29#include <libfm-qt-nde/core/thumbnailjob.h>
30#include <libfm-qt-nde/core/archiver.h>
31#include <libfm-qt-nde/core/legacy/fm-config.h>
35enum OpenDirTargetType {
39 OpenInLastActiveWindow
64 QList<data> loadData(dataType type);
66 bool save(dataType type);
67 bool saveData(QList<data> list,dataType type);
69 bool addData(
data info,dataType type);
70 void deleteData(
int index, dataType type);
72 void changeFavoriteName(
int index, QString text);
75 QStringList connectFavorites()
const {
76 return connectFavorites_;
79 void setConnectFavorites(
const QStringList& list) {
80 connectFavorites_ = list;
84 QStringList connectFavorites_;
85 QStringList connectHistorys_;
86 QString configFilePath;
94 sortOrder_(Qt::AscendingOrder),
95 sortColumn_(Fm::FolderModel::ColumnFileName),
96 viewMode_(Fm::FolderView::DetailedListMode),
98 sortFolderFirst_(
true),
99 sortCaseSensitive_(
true) {
102 bool isCustomized()
const {
103 return isCustomized_;
106 void setCustomized(
bool value) {
107 isCustomized_ = value;
110 Qt::SortOrder sortOrder()
const {
114 void setSortOrder(Qt::SortOrder value) {
118 Fm::FolderModel::ColumnId sortColumn()
const {
122 void setSortColumn(Fm::FolderModel::ColumnId value) {
126 Fm::FolderView::ViewMode viewMode()
const {
130 void setViewMode(Fm::FolderView::ViewMode value) {
134 bool sortFolderFirst()
const {
135 return sortFolderFirst_;
138 void setSortFolderFirst(
bool value) {
139 sortFolderFirst_ = value;
142 bool showHidden()
const {
146 void setShowHidden(
bool value) {
150 bool sortCaseSensitive()
const {
151 return sortCaseSensitive_;
154 void setSortCaseSensitive(
bool value) {
155 sortCaseSensitive_ = value;
160 Qt::SortOrder sortOrder_;
161 Fm::FolderModel::ColumnId sortColumn_;
162 Fm::FolderView::ViewMode viewMode_;
164 bool sortFolderFirst_;
165 bool sortCaseSensitive_;
182 bool load(QString profile =
"default");
183 bool save(QString profile = QString());
185 bool loadFile(QString filePath);
186 bool saveFile(QString filePath);
188 static QString xdgUserConfigDir();
189 static const QList<int> & iconSizes(IconType type);
191 QString profileDir(QString profile,
bool useFallback =
false);
194 QString profileName()
const {
198 bool supportTrash()
const {
199 return supportTrash_;
202 QString fallbackIconThemeName()
const {
203 return fallbackIconThemeName_;
206 bool useFallbackIconTheme()
const {
207 return useFallbackIconTheme_;
210 void setFallbackIconThemeName(QString iconThemeName) {
211 fallbackIconThemeName_ = iconThemeName;
214 OpenDirTargetType bookmarkOpenMethod() {
215 return bookmarkOpenMethod_;
218 void setBookmarkOpenMethod(OpenDirTargetType bookmarkOpenMethod) {
219 bookmarkOpenMethod_ = bookmarkOpenMethod;
222 QString suCommand()
const {
226 void setSuCommand(QString suCommand) {
227 suCommand_ = suCommand;
233 void setTerminal(QString terminalCommand);
235 QString archiver()
const {
239 void setArchiver(QString archiver) {
240 archiver_ = archiver;
241 Fm::Archiver::setDefaultArchiverByName(archiver_.toLocal8Bit().constData());
244 bool mountOnStartup()
const {
245 return mountOnStartup_;
248 void setMountOnStartup(
bool mountOnStartup) {
249 mountOnStartup_ = mountOnStartup;
252 bool mountRemovable() {
253 return mountRemovable_;
256 void setMountRemovable(
bool mountRemovable) {
257 mountRemovable_ = mountRemovable;
260 bool autoRun()
const {
264 void setAutoRun(
bool autoRun) {
268 bool closeOnUnmount()
const {
269 return closeOnUnmount_;
272 void setCloseOnUnmount(
bool value) {
273 closeOnUnmount_ = value;
276 DesktopWindow::WallpaperMode wallpaperMode()
const {
277 return DesktopWindow::WallpaperMode(wallpaperMode_);
280 void setWallpaperMode(
int wallpaperMode) {
281 wallpaperMode_ = wallpaperMode;
284 QString wallpaper()
const {
288 void setWallpaper(QString wallpaper) {
289 wallpaper_ = wallpaper;
292 QString wallpaperDir()
const {
293 return wallpaperDir_;
296 void setLastSlide(QString wallpaper) {
297 lastSlide_ = wallpaper;
300 QString lastSlide()
const {
304 void setWallpaperDir(QString dir) {
308 int slideShowInterval()
const {
309 return slideShowInterval_;
312 void setSlideShowInterval(
int interval) {
313 slideShowInterval_ = interval;
316 bool wallpaperRandomize()
const {
317 return wallpaperRandomize_;
320 void setWallpaperRandomize(
bool randomize) {
321 wallpaperRandomize_ = randomize;
324 const QColor& desktopBgColor()
const {
325 return desktopBgColor_;
328 void setDesktopBgColor(QColor desktopBgColor) {
329 desktopBgColor_ = desktopBgColor;
332 const QColor& desktopFgColor()
const {
333 return desktopFgColor_;
336 void setDesktopFgColor(QColor desktopFgColor) {
337 desktopFgColor_ = desktopFgColor;
340 const QColor& desktopShadowColor()
const {
341 return desktopShadowColor_;
344 void setDesktopShadowColor(QColor desktopShadowColor) {
345 desktopShadowColor_ = desktopShadowColor;
348 QFont desktopFont()
const {
352 void setDesktopFont(QFont font) {
356 int desktopIconSize()
const {
357 return desktopIconSize_;
360 void setDesktopIconSize(
int desktopIconSize) {
361 desktopIconSize_ = desktopIconSize;
364 QStringList desktopShortcuts()
const {
365 return desktopShortcuts_;
368 void setDesktopShortcuts(
const QStringList& list) {
369 desktopShortcuts_ = list;
372 bool showWmMenu()
const {
376 void setShowWmMenu(
bool value) {
380 bool desktopShowHidden()
const {
381 return desktopShowHidden_;
384 void setDesktopShowHidden(
bool desktopShowHidden) {
385 desktopShowHidden_ = desktopShowHidden;
396 bool desktopAutoSort()
const {
397 return desktopAutoSort_;
400 void setDesktopAutoSort(
bool hide) {
401 desktopAutoSort_ = hide;
404 Qt::SortOrder desktopSortOrder()
const {
405 return desktopSortOrder_;
408 void setDesktopSortOrder(Qt::SortOrder desktopSortOrder) {
409 desktopSortOrder_ = desktopSortOrder;
412 Fm::FolderModel::ColumnId desktopSortColumn()
const {
413 return desktopSortColumn_;
416 void setDesktopSortColumn(Fm::FolderModel::ColumnId desktopSortColumn) {
417 desktopSortColumn_ = desktopSortColumn;
420 bool desktopSortFolderFirst()
const {
421 return desktopSortFolderFirst_;
424 void setDesktopSortFolderFirst(
bool desktopFolderFirst) {
425 desktopSortFolderFirst_ = desktopFolderFirst;
428 bool alwaysShowTabs()
const {
429 return alwaysShowTabs_;
432 void setAlwaysShowTabs(
bool alwaysShowTabs) {
433 alwaysShowTabs_ = alwaysShowTabs;
436 bool showTabClose()
const {
437 return showTabClose_;
440 void setShowTabClose(
bool showTabClose) {
441 showTabClose_ = showTabClose;
444 bool rememberWindowSize()
const {
445 return rememberWindowSize_;
448 void setRememberWindowSize(
bool rememberWindowSize) {
449 rememberWindowSize_ = rememberWindowSize;
452 int windowWidth()
const {
453 if(rememberWindowSize_) {
454 return lastWindowWidth_;
457 return fixedWindowWidth_;
461 int windowHeight()
const {
462 if(rememberWindowSize_) {
463 return lastWindowHeight_;
466 return fixedWindowHeight_;
470 bool windowMaximized()
const {
471 if(rememberWindowSize_) {
472 return lastWindowMaximized_;
479 int fixedWindowWidth()
const {
480 return fixedWindowWidth_;
483 void setFixedWindowWidth(
int fixedWindowWidth) {
484 fixedWindowWidth_ = fixedWindowWidth;
487 int fixedWindowHeight()
const {
488 return fixedWindowHeight_;
491 void setFixedWindowHeight(
int fixedWindowHeight) {
492 fixedWindowHeight_ = fixedWindowHeight;
495 void setLastWindowWidth(
int lastWindowWidth) {
496 lastWindowWidth_ = lastWindowWidth;
499 void setLastWindowHeight(
int lastWindowHeight) {
500 lastWindowHeight_ = lastWindowHeight;
503 void setLastWindowMaximized(
bool lastWindowMaximized) {
504 lastWindowMaximized_ = lastWindowMaximized;
507 int splitterPos()
const {
511 void setSplitterPos(
int splitterPos) {
512 splitterPos_ = splitterPos;
515 Fm::SidePane::Mode sidePaneMode()
const {
516 return sidePaneMode_;
519 void setSidePaneMode(Fm::SidePane::Mode sidePaneMode) {
520 sidePaneMode_ = sidePaneMode;
523 bool showMenuBar()
const {
527 void setShowMenuBar(
bool showMenuBar) {
528 showMenuBar_ = showMenuBar;
531 bool splitView()
const {
535 void setSplitView(
bool split) {
539 Fm::FolderView::ViewMode viewMode()
const {
543 void setViewMode(Fm::FolderView::ViewMode viewMode) {
544 viewMode_ = viewMode;
547 bool showHidden()
const {
551 void setShowHidden(
bool showHidden) {
552 showHidden_ = showHidden;
555 bool sortCaseSensitive()
const {
556 return sortCaseSensitive_;
559 void setSortCaseSensitive(
bool value) {
560 sortCaseSensitive_ = value;
564 bool placesHome()
const {
568 void setPlacesHome(
bool placesHome) {
569 placesHome_ = placesHome;
572 bool placesDesktop()
const {
573 return placesDesktop_;
576 void setPlacesDesktop(
bool placesDesktop) {
577 placesDesktop_ = placesDesktop;
580 bool placesApplications()
const {
581 return placesApplications_;
584 void setPlacesApplications(
bool placesApplications) {
585 placesApplications_ = placesApplications;
588 bool placesTrash()
const {
592 void setPlacesTrash(
bool placesTrash) {
593 placesTrash_ = placesTrash;
596 bool placesRoot()
const {
600 void setPlacesRoot(
bool placesRoot) {
601 placesRoot_ = placesRoot;
604 bool placesComputer()
const {
605 return placesComputer_;
608 void setPlacesComputer(
bool placesComputer) {
609 placesComputer_ = placesComputer;
612 bool placesNetwork()
const {
613 return placesNetwork_;
616 void setPlacesNetwork(
bool placesNetwork) {
617 placesNetwork_ = placesNetwork;
620 QSet<QString> getHiddenPlaces()
const {
621 return hiddenPlaces_;
624 void setHiddenPlace(
const QString& str,
bool hide) {
626 hiddenPlaces_ << str;
629 hiddenPlaces_.remove(str);
634 Qt::SortOrder sortOrder()
const {
638 void setSortOrder(Qt::SortOrder sortOrder) {
639 sortOrder_ = sortOrder;
642 Fm::FolderModel::ColumnId sortColumn()
const {
646 void setSortColumn(Fm::FolderModel::ColumnId sortColumn) {
647 sortColumn_ = sortColumn;
650 bool sortFolderFirst()
const {
651 return sortFolderFirst_;
654 void setSortFolderFirst(
bool folderFirst) {
655 sortFolderFirst_ = folderFirst;
658 bool showFilter()
const {
662 void setShowFilter(
bool value) {
666 bool pathBarButtons()
const {
667 return pathBarButtons_;
670 void setPathBarButtons(
bool value) {
671 pathBarButtons_ = value;
675 bool singleClick()
const {
679 void setSingleClick(
bool singleClick) {
680 singleClick_ = singleClick;
683 int autoSelectionDelay()
const {
684 return autoSelectionDelay_;
687 void setAutoSelectionDelay(
int value) {
688 autoSelectionDelay_ = value;
691 bool useTrash()
const {
698 void setUseTrash(
bool useTrash) {
699 useTrash_ = useTrash;
702 bool confirmDelete()
const {
703 return confirmDelete_;
706 void setConfirmDelete(
bool confirmDelete) {
707 confirmDelete_ = confirmDelete;
710 bool noUsbTrash()
const {
714 void setNoUsbTrash(
bool noUsbTrash) {
715 noUsbTrash_ = noUsbTrash;
716 fm_config->no_usb_trash = noUsbTrash_;
719 bool confirmTrash()
const {
720 return confirmTrash_;
723 void setConfirmTrash(
bool value) {
724 confirmTrash_ = value;
727 bool quickExec()
const {
731 void setQuickExec(
bool value) {
733 fm_config->quick_exec = quickExec_;
736 bool selectNewFiles()
const {
737 return selectNewFiles_;
740 void setSelectNewFiles(
bool value) {
741 selectNewFiles_ = value;
747 int bigIconSize()
const {
751 void setBigIconSize(
int bigIconSize) {
752 bigIconSize_ = bigIconSize;
755 int smallIconSize()
const {
756 return smallIconSize_;
759 void setSmallIconSize(
int smallIconSize) {
760 smallIconSize_ = smallIconSize;
763 int sidePaneIconSize()
const {
764 return sidePaneIconSize_;
767 void setSidePaneIconSize(
int sidePaneIconSize) {
768 sidePaneIconSize_ = sidePaneIconSize;
771 int thumbnailIconSize()
const {
772 return thumbnailIconSize_;
775 QSize folderViewCellMargins()
const {
776 return folderViewCellMargins_;
779 void setFolderViewCellMargins(QSize size) {
780 folderViewCellMargins_ = size;
783 QSize desktopCellMargins()
const {
784 return desktopCellMargins_;
787 void setDesktopCellMargins(QSize size) {
788 desktopCellMargins_ = size;
792 bool showThumbnails() {
793 return showThumbnails_;
796 void setShowThumbnails(
bool show) {
797 showThumbnails_ = show;
800 void setThumbnailLocalFilesOnly(
bool value) {
801 Fm::ThumbnailJob::setLocalFilesOnly(value);
804 bool thumbnailLocalFilesOnly()
const {
805 return Fm::ThumbnailJob::localFilesOnly();
808 int maxThumbnailFileSize()
const {
809 return Fm::ThumbnailJob::maxThumbnailFileSize();
812 void setMaxThumbnailFileSize(
int size) {
813 Fm::ThumbnailJob::setMaxThumbnailFileSize(size);
816 void setThumbnailIconSize(
int thumbnailIconSize) {
817 thumbnailIconSize_ = thumbnailIconSize;
824 void setSiUnit(
bool siUnit) {
827 fm_config->si_unit = (gboolean)siUnit_;
830 bool backupAsHidden()
const {
831 return backupAsHidden_;
834 void setBackupAsHidden(
bool value) {
835 backupAsHidden_ = value;
836 fm_config->backup_as_hidden = backupAsHidden_;
839 bool showFullNames()
const {
840 return showFullNames_;
843 void setShowFullNames(
bool value) {
844 showFullNames_ = value;
847 bool shadowHidden()
const {
848 return shadowHidden_;
851 void setShadowHidden(
bool value) {
852 shadowHidden_ = value;
855 bool onlyUserTemplates()
const {
856 return onlyUserTemplates_;
859 void setOnlyUserTemplates(
bool value) {
860 onlyUserTemplates_ = value;
861 fm_config->only_user_templates = onlyUserTemplates_;
864 bool templateTypeOnce()
const {
865 return templateTypeOnce_;
868 void setTemplateTypeOnce(
bool value) {
869 templateTypeOnce_ = value;
870 fm_config->template_type_once = templateTypeOnce_;
873 bool templateRunApp()
const {
874 return templateRunApp_;
877 void setTemplateRunApp(
bool value) {
878 templateRunApp_ = value;
879 fm_config->template_run_app = templateRunApp_;
883 FolderSettings loadFolderSettings(
const Fm::FilePath& path)
const;
885 void saveFolderSettings(
const Fm::FilePath& path,
const FolderSettings& settings);
887 void clearFolderSettings(
const Fm::FilePath& path)
const;
889 bool searchNameCaseInsensitive()
const {
890 return searchNameCaseInsensitive_;
893 void setSearchNameCaseInsensitive(
bool caseInsensitive) {
894 searchNameCaseInsensitive_ = caseInsensitive;
897 bool searchContentCaseInsensitive()
const {
898 return searchContentCaseInsensitive_;
901 void setsearchContentCaseInsensitive(
bool caseInsensitive) {
902 searchContentCaseInsensitive_ = caseInsensitive;
905 bool searchNameRegexp()
const {
906 return searchNameRegexp_;
909 void setSearchNameRegexp(
bool reg) {
910 searchNameRegexp_ = reg;
913 bool searchContentRegexp()
const {
914 return searchContentRegexp_;
917 void setSearchContentRegexp(
bool reg) {
918 searchContentRegexp_ = reg;
921 bool searchRecursive()
const {
922 return searchRecursive_;
925 void setSearchRecursive(
bool rec) {
926 searchRecursive_ = rec;
929 bool searchhHidden()
const {
930 return searchhHidden_;
933 void setSearchhHidden(
bool hidden) {
934 searchhHidden_ = hidden;
937 QList<int> getCustomColumnWidths()
const {
939 for(
auto width : qAsConst(customColumnWidths_)) {
945 void setCustomColumnWidths(
const QList<int> &widths) {
946 customColumnWidths_.clear();
947 for(
auto width : widths) {
948 customColumnWidths_ << QVariant(width);
952 QList<int> getHiddenColumns()
const {
954 for(
auto width : qAsConst(hiddenColumns_)) {
960 void setHiddenColumns(
const QList<int> &columns) {
961 hiddenColumns_.clear();
962 for(
auto column : columns) {
963 hiddenColumns_ << QVariant(column);
968 int toIconSize(
int size, IconType type)
const;
970 QString profileName_;
974 QString fallbackIconThemeName_;
975 bool useFallbackIconTheme_;
977 OpenDirTargetType bookmarkOpenMethod_;
980 bool mountOnStartup_;
981 bool mountRemovable_;
983 bool closeOnUnmount_;
988 QString wallpaperDir_;
989 int slideShowInterval_;
990 bool wallpaperRandomize_;
991 QColor desktopBgColor_;
992 QColor desktopFgColor_;
993 QColor desktopShadowColor_;
995 int desktopIconSize_;
996 QStringList desktopShortcuts_;
999 bool desktopShowHidden_;
1001 bool desktopAutoSort_;
1002 Qt::SortOrder desktopSortOrder_;
1003 Fm::FolderModel::ColumnId desktopSortColumn_;
1004 bool desktopSortFolderFirst_;
1006 bool alwaysShowTabs_;
1008 bool rememberWindowSize_;
1009 int fixedWindowWidth_;
1010 int fixedWindowHeight_;
1011 int lastWindowWidth_;
1012 int lastWindowHeight_;
1013 bool lastWindowMaximized_;
1015 Fm::SidePane::Mode sidePaneMode_;
1019 Fm::FolderView::ViewMode viewMode_;
1021 Qt::SortOrder sortOrder_;
1022 Fm::FolderModel::ColumnId sortColumn_;
1023 bool sortFolderFirst_;
1024 bool sortCaseSensitive_;
1026 bool pathBarButtons_;
1030 int autoSelectionDelay_;
1032 bool confirmDelete_;
1036 bool selectNewFiles_;
1038 bool showThumbnails_;
1042 bool backupAsHidden_;
1043 bool showFullNames_;
1047 bool placesDesktop_;
1048 bool placesApplications_;
1051 bool placesComputer_;
1052 bool placesNetwork_;
1053 QSet<QString> hiddenPlaces_;
1057 int sidePaneIconSize_;
1058 int thumbnailIconSize_;
1060 bool onlyUserTemplates_;
1061 bool templateTypeOnce_;
1062 bool templateRunApp_;
1064 QSize folderViewCellMargins_;
1065 QSize desktopCellMargins_;
1068 bool searchNameCaseInsensitive_;
1069 bool searchContentCaseInsensitive_;
1070 bool searchNameRegexp_;
1071 bool searchContentRegexp_;
1072 bool searchRecursive_;
1073 bool searchhHidden_;
1076 QList<QVariant> customColumnWidths_;
1077 QList<QVariant> hiddenColumns_;
Definition settings.h:170