21 #ifndef NDEFILEMAN_DESKTOPWINDOW_H 22 #define NDEFILEMAN_DESKTOPWINDOW_H 26 #include <unordered_map> 34 #include <libfm-qt/core/folder.h> 36 #include <QDesktopWidget> 37 #include <QFileSystemWatcher> 40 #include <QStandardPaths> 41 #include <XdgDesktopFile> 47 class CachedFolderModel;
48 class ProxyFolderModel;
49 class FolderViewListView;
74 void setForeground(
const QColor& color);
75 void setShadow(
const QColor& color);
76 void setBackground(
const QColor& color);
77 void setDesktopFolder();
78 void setWallpaperFile(QString filename);
79 void setWallpaperMode(WallpaperMode mode = WallpaperStretch);
80 void setLastSlide(QString filename);
81 void setWallpaperDir(QString dirname);
82 void setSlideShowInterval(
int interval);
83 void setWallpaperRandomize(
bool randomize);
86 void updateWallpaper();
89 void updateFromSettings(
Settings& settings,
bool changeSlide =
true);
91 void queueRelayout(
int delay = 100);
93 int screenNum()
const {
97 void setScreenNum(
int num);
99 QScreen* getDesktopScreen()
const;
101 bool isPanelPositionChange() {
102 return isPanelPositionChange_;
104 void setPanelPositionChange(
bool change) {
105 isPanelPositionChange_ = change;
109 virtual void prepareFolderMenu(Fm::FolderMenu* menu)
override;
110 virtual void prepareFileMenu(Fm::FileMenu* menu)
override;
111 virtual void resizeEvent(QResizeEvent* event)
override;
112 virtual void onFileClicked(
int type,
const std::shared_ptr<const Fm::FileInfo>& fileInfo)
override;
114 void loadItemPositions();
115 void saveItemPositions();
118 QImage loadWallpaperFile(QSize requiredSize);
120 virtual bool event(QEvent* event)
override;
121 virtual bool eventFilter(QObject* watched, QEvent* event)
override;
123 virtual void childDragMoveEvent(QDragMoveEvent* e)
override;
124 virtual void childDropEvent(QDropEvent* e)
override;
125 virtual void closeEvent(QCloseEvent* event)
override;
126 virtual void paintEvent(QPaintEvent* event)
override;
129 void onOpenDirRequested(
const Fm::FilePath& path,
int target);
130 void onDesktopPreferences();
133 void onRowsAboutToBeRemoved(
const QModelIndex& parent,
int start,
int end);
134 void onRowsInserted(
const QModelIndex& parent,
int start,
int end);
135 void onLayoutChanged();
136 void onModelSortFilterChanged();
137 void onDataChanged(
const QModelIndex& topLeft,
const QModelIndex& bottomRight);
138 void onFolderStartLoading();
139 void onFolderFinishLoading();
140 void onFilesAdded(
const Fm::FileInfoList files);
142 void relayoutItems();
143 void onStickToCurrentPos(
bool toggled);
148 void onCutActivated();
149 void onCopyActivated();
150 void onCopyFullPathActivated();
151 void onPasteActivated();
152 void onRenameActivated();
153 void onBulkRenameActivated();
154 void onDeleteActivated();
155 void onFilePropertiesActivated();
156 void onDesktopReloadActivated();
158 void updateTrashIcon();
160 void onOpenSystemInfo();
161 void onCancelAllStickPos();
162 void onDisplaySettings();
163 void onPersonalise();
164 void onDesktopSortActionTriggered(
bool checked);
165 void desktopResize();
166 void toggleAutoSort();
167 void appDirectoryChanged(
const QString &path);
168 bool removeDesktopIcon(
const QSet<QString> deletedFiles,
const QString &path);
171 void removeBottomGap();
172 void addDesktopActions(QMenu* menu);
173 void paintBackground(QPaintEvent* event);
174 void paintDropIndicator();
176 bool stickToPosition(
const std::string& file, QPoint& pos,
const QRect& workArea,
const QSize& grid,
bool reachedLastCell =
false);
178 bool stickToPosition(
const QPoint& selPos,
const std::string& file, QPoint& pos,
const QRect& workArea,
const QSize& grid,
bool reachedLastCell =
false);
179 static void alignToGrid(QPoint& pos,
const QPoint& topLeft,
const QSize& grid,
const int spacing);
181 void updateShortcutsFromSettings(
Settings& settings);
182 void createTrashShortcut(
int items);
183 void createHomeShortcut();
184 void createComputerShortcut();
185 void createNetworkShortcut();
188 static void onTrashChanged(GFileMonitor* monitor, GFile* gf, GFile* other, GFileMonitorEvent evt,
DesktopWindow* pThis);
189 void trustOurDesktopShortcut(std::shared_ptr<const Fm::FileInfo> file);
190 bool isTrashCan(std::shared_ptr<const Fm::FileInfo> file);
192 void createDesktopViewMenu(QMenu* menu);
193 void createDesktopSortMenu(QMenu* menu);
194 void addDesktopSortMenuItem(QMenu* menu,
const QString &title,
int id);
195 void desktopAutoSort();
196 bool stickToAutoSortPosition(
const std::string& file, QPoint& pos,
const QPoint& selPos,
const QRect& workArea,
const QSize& grid,
bool reachedLastCell =
false);
197 void panelPositionChanged();
198 void removeItemsOnAutoSort();
199 void initsetting(
void);
202 Fm::ProxyFolderModel* proxyModel_;
203 Fm::CachedFolderModel* model_;
204 std::shared_ptr<Fm::Folder> folder_;
205 Fm::FolderViewListView* listView_;
206 QDesktopWidget *desktopwidget;
211 QString wallpaperFile_;
212 WallpaperMode wallpaperMode_;
214 QString wallpaperDir_;
215 int slideShowInterval_;
216 QTimer* wallpaperTimer_;
217 bool wallpaperRandomize_;
218 QPixmap wallpaperPixmap_;
222 bool desktopAutoSort_;
225 bool isResizeDesktop_;
226 bool isPanelPositionChange_;
227 bool isAutoSortAndResize_;
228 bool isDesktopOrderRefresh_;
234 std::unordered_map<std::string, QPoint> customItemPos_;
235 QHash<QModelIndex, QString> displayNames_;
236 QTimer* relayoutTimer_;
237 QTimer* selectionTimer_;
241 QTimer* trashUpdateTimer_;
242 GFileMonitor* trashMonitor_;
244 QMenu* desktopViewMenu_;
245 QMenu* desktopSortMenu_;
246 QActionGroup* desktopSortActionGroup_;
247 QPoint desktopWorkArea_;
248 QPoint desktopLastIconPosition_;
251 QFileSystemWatcher* desktopFileDirectoryWatcher;
252 QMap<QString,QStringList> currentContsMap;
259 #endif // NDEFILEMAN_DESKTOPWINDOW_H Definition: desktopwindow.h:46
Definition: desktopwindow.h:57
Definition: launcher.h:30
Definition: settings.h:170
Definition: application.h:60
Definition: application.cpp:67