21#ifndef NDEFILEMAN_DESKTOPWINDOW_H
22#define NDEFILEMAN_DESKTOPWINDOW_H
26#include <unordered_map>
34#include <libfm-qt-nde/core/folder.h>
36#include <QDesktopWidget>
39class CachedFolderModel;
40class ProxyFolderModel;
41class FolderViewListView;
65 void setForeground(
const QColor& color);
66 void setShadow(
const QColor& color);
67 void setBackground(
const QColor& color);
68 void setDesktopFolder();
69 void setWallpaperFile(QString filename);
70 void setWallpaperMode(WallpaperMode mode = WallpaperStretch);
71 void setLastSlide(QString filename);
72 void setWallpaperDir(QString dirname);
73 void setSlideShowInterval(
int interval);
74 void setWallpaperRandomize(
bool randomize);
77 void updateWallpaper();
80 void updateFromSettings(
Settings& settings,
bool changeSlide =
true);
82 void queueRelayout(
int delay = 0);
84 int screenNum()
const {
88 void setScreenNum(
int num);
90 QScreen* getDesktopScreen()
const;
92 bool isPanelPositionChange() {
93 return isPanelPositionChange_;
95 void setPanelPositionChange(
bool change) {
96 isPanelPositionChange_ = change;
100 virtual void prepareFolderMenu(Fm::FolderMenu* menu)
override;
101 virtual void prepareFileMenu(Fm::FileMenu* menu)
override;
102 virtual void resizeEvent(QResizeEvent* event)
override;
103 virtual void onFileClicked(
int type,
const std::shared_ptr<const Fm::FileInfo>& fileInfo)
override;
105 void loadItemPositions();
106 void saveItemPositions();
108 QImage loadWallpaperFile(QSize requiredSize);
110 virtual bool event(QEvent* event)
override;
111 virtual bool eventFilter(QObject* watched, QEvent* event)
override;
113 virtual void childDragMoveEvent(QDragMoveEvent* e)
override;
114 virtual void childDropEvent(QDropEvent* e)
override;
115 virtual void closeEvent(QCloseEvent* event)
override;
116 virtual void paintEvent(QPaintEvent* event)
override;
119 void onOpenDirRequested(
const Fm::FilePath& path,
int target);
120 void onDesktopPreferences();
123 void onRowsAboutToBeRemoved(
const QModelIndex& parent,
int start,
int end);
124 void onRowsInserted(
const QModelIndex& parent,
int start,
int end);
125 void onLayoutChanged();
126 void onModelSortFilterChanged();
127 void onDataChanged(
const QModelIndex& topLeft,
const QModelIndex& bottomRight);
128 void onFolderStartLoading();
129 void onFolderFinishLoading();
130 void onFilesAdded(
const Fm::FileInfoList files);
132 void relayoutItems();
133 void onStickToCurrentPos(
bool toggled);
138 void onCutActivated();
139 void onCopyActivated();
140 void onCopyFullPathActivated();
141 void onPasteActivated();
142 void onRenameActivated();
143 void onBulkRenameActivated();
144 void onDeleteActivated();
145 void onFilePropertiesActivated();
146 void onDesktopReloadActivated();
148 void updateTrashIcon();
150 void onOpenSystemInfo();
151 void onCancelAllStickPos();
152 void onDisplaySettings();
153 void onPersonalise();
154 void onDesktopSortActionTriggered(
bool checked);
155 void desktopResize();
156 void toggleAutoSort();
159 void removeBottomGap();
160 void addDesktopActions(QMenu* menu);
161 void paintBackground(QPaintEvent* event);
162 void paintDropIndicator();
163 bool stickToPosition(
const std::string& file, QPoint& pos,
const QRect& workArea,
const QSize& grid,
bool reachedLastCell =
false);
164 static void alignToGrid(QPoint& pos,
const QPoint& topLeft,
const QSize& grid,
const int spacing);
166 void updateShortcutsFromSettings(
Settings& settings);
167 void createTrashShortcut(
int items);
168 void createHomeShortcut();
169 void createComputerShortcut();
170 void createNetworkShortcut();
173 static void onTrashChanged(GFileMonitor* monitor, GFile* gf, GFile* other, GFileMonitorEvent evt,
DesktopWindow* pThis);
174 void trustOurDesktopShortcut(std::shared_ptr<const Fm::FileInfo> file);
175 bool isTrashCan(std::shared_ptr<const Fm::FileInfo> file);
177 void createDesktopViewMenu(QMenu* menu);
178 void createDesktopSortMenu(QMenu* menu);
179 void addDesktopSortMenuItem(QMenu* menu,
const QString &title,
int id);
180 void desktopAutoSort();
181 bool stickToAutoSortPosition(
const std::string& file, QPoint& pos,
const QPoint& selPos,
const QRect& workArea,
const QSize& grid,
bool reachedLastCell =
false);
182 void panelPositionChanged();
183 void removeItemsOnAutoSort();
184 void initsetting(
void);
187 Fm::ProxyFolderModel* proxyModel_;
188 Fm::CachedFolderModel* model_;
189 std::shared_ptr<Fm::Folder> folder_;
190 Fm::FolderViewListView* listView_;
191 QDesktopWidget *desktopwidget;
196 QString wallpaperFile_;
197 WallpaperMode wallpaperMode_;
199 QString wallpaperDir_;
200 int slideShowInterval_;
201 QTimer* wallpaperTimer_;
202 bool wallpaperRandomize_;
203 QPixmap wallpaperPixmap_;
207 bool desktopAutoSort_;
210 bool isResizeDesktop_;
211 bool isPanelPositionChange_;
212 bool isAutoSortAndResize_;
213 bool isDesktopOrderRefresh_;
219 std::unordered_map<std::string, QPoint> customItemPos_;
220 QHash<QModelIndex, QString> displayNames_;
221 QTimer* relayoutTimer_;
222 QTimer* selectionTimer_;
226 QTimer* trashUpdateTimer_;
227 GFileMonitor* trashMonitor_;
229 QMenu* desktopViewMenu_;
230 QMenu* desktopSortMenu_;
231 QActionGroup* desktopSortActionGroup_;
232 QPoint desktopWorkArea_;
Definition application.h:56
Definition desktopwindow.h:48
Definition settings.h:170