45class DesktopWindow :
public View {
48 friend class Application;
59 explicit DesktopWindow(
int screenNum,
const QString& screenName = QString());
60 virtual ~DesktopWindow();
62 void setForeground(
const QColor& color);
63 void setShadow(
const QColor& color);
64 void setBackground(
const QColor& color);
65 void setDesktopFolder();
66 void setWallpaperFile(
const QString& filename);
67 void setWallpaperMode(WallpaperMode mode = WallpaperStretch);
68 void setLastSlide(
const QString& filename);
69 void setWallpaperDir(
const QString& dirname);
70 void setSlideShowInterval(
int interval);
71 void setWallpaperRandomize(
bool randomize);
74 void updateWallpaper(
bool checkMTime =
false);
77 void updateFromSettings(
Settings& settings,
bool changeSlide =
true);
79 void queueRelayout(
int delay = 0);
81 int screenNum()
const {
84 void setScreenNum(
int num);
86 QString screenName()
const {
90 QScreen* getDesktopScreen()
const;
93 virtual void prepareFolderMenu(Fm::FolderMenu* menu)
override;
94 virtual void prepareFileMenu(Fm::FileMenu* menu)
override;
95 virtual void resizeEvent(QResizeEvent* event)
override;
96 virtual void onFileClicked(
int type,
const std::shared_ptr<const Fm::FileInfo>& fileInfo)
override;
98 void loadItemPositions();
99 void saveItemPositions();
100 void retrieveCustomPos();
101 void storeCustomPos();
103 QImage loadWallpaperFile(QSize requiredSize,
bool checkMTime);
105 virtual bool event(QEvent* event)
override;
106 virtual bool eventFilter(QObject* watched, QEvent* event)
override;
108 virtual void childDragMoveEvent(QDragMoveEvent* e)
override;
109 virtual void childDropEvent(QDropEvent* e)
override;
110 virtual void closeEvent(QCloseEvent* event)
override;
111 virtual void paintEvent(QPaintEvent* event)
override;
114 void onDesktopPreferences();
115 void onCreatingShortcut();
117 void invertSelection();
118 void toggleDesktop();
120 void onRowsAboutToBeRemoved(
const QModelIndex& parent,
int start,
int end);
121 void onRowsInserted(
const QModelIndex& parent,
int start,
int end);
122 void onLayoutChanged();
123 void onModelSortFilterChanged();
124 void onFolderStartLoading();
125 void onFolderFinishLoading();
126 void onFilesAdded(
const Fm::FileInfoList files);
128 void relayoutItems();
129 void onStickToCurrentPos(
bool toggled);
134 void onCutActivated();
135 void onCopyActivated();
136 void onCopyFullPathActivated();
137 void onPasteActivated();
138 void onRenameActivated();
139 void onBulkRenameActivated();
140 void onDeleteActivated();
141 void onFilePropertiesActivated();
143 void updateTrashIcon();
145 void onInlineRenaming(
const QString& oldName,
const QString& newName);
147 void onDecidingDrop(
bool accepted);
150 void removeBottomGap();
151 QRect getWorkArea(QScreen* screen)
const;
152 void addDesktopActions(QMenu* menu);
153 void paintBackground(QPaintEvent* event);
154 void paintDropIndicator();
155 bool stickToPosition(
const std::string& file, QPoint& pos,
156 const QRect& workArea,
const QSize& grid,
157 bool reachedLastCell,
158 const std::set<std::string>& droppedFiles,
159 const std::set<std::string>& draggedFiles = std::set<std::string>{});
160 static void alignToGrid(QPoint& pos,
const QPoint& topLeft,
const QSize& grid,
const int spacing);
162 void updateShortcutsFromSettings(
Settings& settings);
163 void createTrashShortcut(
int items);
164 void createHomeShortcut();
165 void createComputerShortcut();
166 void createNetworkShortcut();
169 static void onTrashChanged(GFileMonitor* monitor, GFile* gf, GFile* other, GFileMonitorEvent evt, DesktopWindow* pThis);
170 void trustOurDesktopShortcut(std::shared_ptr<const Fm::FileInfo> file);
171 bool isTrashCan(std::shared_ptr<const Fm::FileInfo> file)
const;
173 QImage getWallpaperImage()
const;
175 QModelIndex navigateWithKey(
int key, Qt::KeyboardModifiers modifiers,
const QModelIndex& start = QModelIndex());
177 QModelIndex indexForPos(
bool* isTrash,
const QPoint& pos,
const QRect& workArea,
const QSize& grid)
const;
180 Fm::ProxyFolderModel* proxyModel_;
181 Fm::FolderModel* model_;
182 std::shared_ptr<Fm::Folder> folder_;
183 Fm::FolderViewListView* listView_;
188 QString wallpaperFile_;
189 WallpaperMode wallpaperMode_;
191 QString wallpaperDir_;
192 int slideShowInterval_;
193 QTimer* wallpaperTimer_;
194 bool wallpaperRandomize_;
195 QPixmap wallpaperPixmap_;
197 bool desktopHideItems_;
201 std::unordered_map<std::string, QPoint> customItemPos_;
202 std::unordered_map<std::string, QPoint> customPosStorage_;
203 QTimer* relayoutTimer_;
204 QTimer* selectionTimer_;
208 QTimer* trashUpdateTimer_;
209 GFileMonitor* trashMonitor_;
211 QStringList filesToTrust_;