21 #ifndef PCMANFM_DESKTOPWINDOW_H
22 #define PCMANFM_DESKTOPWINDOW_H
26 #include <unordered_map>
34 #include <libfm-qt/core/folder.h>
37 class CachedFolderModel;
38 class ProxyFolderModel;
39 class FolderViewListView;
63 void setForeground(
const QColor& color);
64 void setShadow(
const QColor& color);
65 void setBackground(
const QColor& color);
66 void setDesktopFolder();
67 void setWallpaperFile(QString filename);
68 void setWallpaperMode(WallpaperMode mode = WallpaperStretch);
69 void setLastSlide(QString filename);
70 void setWallpaperDir(QString dirname);
71 void setSlideShowInterval(
int interval);
72 void setWallpaperRandomize(
bool randomize);
75 void updateWallpaper();
78 void updateFromSettings(
Settings& settings,
bool changeSlide =
true);
80 void queueRelayout(
int delay = 0);
82 int screenNum()
const {
86 void setScreenNum(
int num);
88 QScreen* getDesktopScreen()
const;
91 virtual void prepareFolderMenu(Fm::FolderMenu* menu)
override;
92 virtual void prepareFileMenu(Fm::FileMenu* menu)
override;
93 virtual void resizeEvent(QResizeEvent* event)
override;
94 virtual void onFileClicked(
int type,
const std::shared_ptr<const Fm::FileInfo>& fileInfo)
override;
96 void loadItemPositions();
97 void saveItemPositions();
99 QImage loadWallpaperFile(QSize requiredSize);
101 virtual bool event(QEvent* event)
override;
102 virtual bool eventFilter(QObject* watched, QEvent* event)
override;
104 virtual void childDragMoveEvent(QDragMoveEvent* e)
override;
105 virtual void childDropEvent(QDropEvent* e)
override;
106 virtual void closeEvent(QCloseEvent* event)
override;
107 virtual void paintEvent(QPaintEvent* event)
override;
110 void onDesktopPreferences();
111 void onCreatingShortcut();
113 void toggleDesktop();
115 void onRowsAboutToBeRemoved(
const QModelIndex& parent,
int start,
int end);
116 void onRowsInserted(
const QModelIndex& parent,
int start,
int end);
117 void onLayoutChanged();
118 void onModelSortFilterChanged();
119 void onFolderStartLoading();
120 void onFolderFinishLoading();
121 void onFilesAdded(
const Fm::FileInfoList files);
123 void relayoutItems();
124 void onStickToCurrentPos(
bool toggled);
129 void onCutActivated();
130 void onCopyActivated();
131 void onCopyFullPathActivated();
132 void onPasteActivated();
133 void onRenameActivated();
134 void onBulkRenameActivated();
135 void onDeleteActivated();
136 void onFilePropertiesActivated();
138 void updateTrashIcon();
141 void removeBottomGap();
142 void addDesktopActions(QMenu* menu);
143 void paintBackground(QPaintEvent* event);
144 void paintDropIndicator();
145 bool stickToPosition(
const std::string& file, QPoint& pos,
const QRect& workArea,
const QSize& grid,
bool reachedLastCell =
false);
146 static void alignToGrid(QPoint& pos,
const QPoint& topLeft,
const QSize& grid,
const int spacing);
148 void updateShortcutsFromSettings(
Settings& settings);
149 void createTrashShortcut(
int items);
150 void createHomeShortcut();
151 void createComputerShortcut();
152 void createNetworkShortcut();
155 static void onTrashChanged(GFileMonitor* monitor, GFile* gf, GFile* other, GFileMonitorEvent evt,
DesktopWindow* pThis);
156 void trustOurDesktopShortcut(std::shared_ptr<const Fm::FileInfo> file);
157 bool isTrashCan(std::shared_ptr<const Fm::FileInfo> file)
const;
159 QImage getWallpaperImage()
const;
161 QModelIndex navigateWithKey(
int key, Qt::KeyboardModifiers modifiers,
const QModelIndex& start = QModelIndex());
163 QModelIndex indexForPos(
bool* isTrash,
const QPoint& pos,
const QRect& workArea,
const QSize& grid)
const;
166 Fm::ProxyFolderModel* proxyModel_;
167 Fm::FolderModel* model_;
168 std::shared_ptr<Fm::Folder> folder_;
169 Fm::FolderViewListView* listView_;
174 QString wallpaperFile_;
175 WallpaperMode wallpaperMode_;
177 QString wallpaperDir_;
178 int slideShowInterval_;
179 QTimer* wallpaperTimer_;
180 bool wallpaperRandomize_;
181 QPixmap wallpaperPixmap_;
183 bool desktopHideItems_;
186 std::unordered_map<std::string, QPoint> customItemPos_;
187 QTimer* relayoutTimer_;
188 QTimer* selectionTimer_;
192 QTimer* trashUpdateTimer_;
193 GFileMonitor* trashMonitor_;
195 QStringList filesToTrust_;
Definition: application.h:56
Definition: desktopwindow.h:46
Definition: launcher.h:30
Definition: settings.h:134