1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
//===========================================
// Lumina-DE source code
// Copyright (c) 2015, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
#ifndef _LUMINA_FM_DIRECTORY_BROWSER_WIDGET_H
#define _LUMINA_FM_DIRECTORY_BROWSER_WIDGET_H
#include <QList>
#include <QWidget>
#include <QObject>
#include <QMenu>
#include <QToolBar>
#include <QLineEdit>
#include <QShortcut>
#include <QFileSystemWatcher>
#include <QFileSystemModel>
#include <QTimer>
#include <QFuture>
#include "../BrowserWidget.h"
#define ZSNAPDIR QString("/.zfs/snapshot/")
namespace Ui{
class DirWidget;
};
class DirWidget : public QWidget{
Q_OBJECT
public:
enum DETAILTYPES{ NAME, SIZE, TYPE, DATEMOD, DATECREATE};
DirWidget(QString objID, QSettings *settings, QWidget *parent = 0); //needs a unique ID (to distinguish from other DirWidgets)
~DirWidget();
void cleanup(); //called before the browser is closed down
//Directory Managment
void ChangeDir(QString dirpath);
void setDirCompleter(QCompleter *comp);
//Information
QString id();
QString currentDir();
QFileSystemModel *dirtreeModel;
QStringList PREFAPPS;
//View Settings
void setShowDetails(bool show);
void showHidden(bool show);
void showThumbnails(bool show);
void setThumbnailSize(int px);
void setFocusLineDir();
void adjustTreeWidget(float percent); //percent between 0-100
void setTreeSortMode(int num); //0-4
BrowserWidget* currentBrowser();
static void createNewFolder(QWidget *parent, BrowserWidget *browser);
public slots:
//void LoadDir(QString dir, LFileInfoList list);
void LoadSnaps(QString basedir, QStringList snaps);
//Refresh options
void refresh(); //Refresh current directory
//Theme change functions
void UpdateIcons();
void UpdateText();
private:
Ui::DirWidget *ui;
BrowserWidget *BW, *RCBW; //Main BrowserWidget and right-column browser widget
QString ID, cBID; //unique ID assigned by the parent, and currently active browser widget
QString normalbasedir, snapbasedir, snaprelpath, rootfmdir; //for maintaining directory context while moving between snapshots
QStringList snapshots, needThumbs, tmpSel;
QSettings *settings;
bool canmodify;
//The Toolbar and associated items
QToolBar *toolbar;
QLineEdit *line_dir;
//The context menu and associated items
QMenu *contextMenu, *cNewMenu, *cOpenMenu, *cFModMenu, *cFViewMenu, *cOpenWithMenu, *cArchiveMenu;
//The keyboard shortcuts for context menu items
QShortcut *kZoomIn, *kZoomOut, *kNewFile, *kNewDir, *kNewXDG, *kCut, *kCopy, *kPaste, *kRename, \
*kFav, *kDel, *kOpSS, *kOpMM, *kOpTerm, *kExtract, *kArchive;
//Functions for internal use
void createShortcuts(); //on init only
void createMenus(); //on init only
QStringList currentDirFiles(); //all the "files" available within the current dir/browser
//QProcess *pExtract;
//OpenWithMenu
QString fileEXT, filePath;
QStringList mimetypes, keys, files;
//QStringList getPreferredApplications();
private slots:
//UI BUTTONS/Actions
void splitterMoved();
// -- Bottom Action Buttons
void on_tool_zoom_in_clicked();
void on_tool_zoom_out_clicked();
// -- Top Snapshot Buttons
void on_tool_snap_newer_clicked();
void on_tool_snap_older_clicked();
void on_slider_snap_valueChanged(int val = -1);
void direct_snap_selected(QAction*);
//Top Toolbar buttons
void on_actionBack_triggered();
void on_actionUp_triggered();
void on_actionHome_triggered();
void dir_changed(); //user manually changed the directory
void on_actionSingleColumn_triggered(bool);
void on_actionDualColumn_triggered(bool);
void on_actionMenu_triggered();
// - Other Actions without a specific button on the side
void fileCheckSums();
void fileProperties();
void openTerminal();
void openRootFM();
//Browser Functions
void OpenContextMenu();
void UpdateContextMenu();
void currentDirectoryChanged(QString dir, bool widgetonly = false);
void currentDirectoryChanged(bool widgetonly = false);
void dirStatusChanged(QString);
void setCurrentBrowser(QString);
void on_folderViewPane_clicked(const QModelIndex &index);
//Context Menu Functions
// - DIRECTORY operations
void createNewFile();
void createNewDir();
void createNewXDGEntry();
//void createNewSymlink();
// - Selected FILE operations
void cutFiles();
void copyFiles();
void pasteFiles();
void renameFiles();
void favoriteFiles();
void removeFiles();
void runFiles();
void runWithFiles();
//void attachToNewEmail();
void autoExtractFiles();
void autoArchiveFiles();
void setAsWallpaper();
// - Context-specific operations
void openInSlideshow();
void openMultimedia();
void OpenWithApp(QAction*);
signals:
//Directory loading/finding signals
void OpenDirectories(QStringList); //Directories to open in other tabs/columns
void findSnaps(QString, QString); //ID, dirpath (Request snapshot information for a directory)
void CloseBrowser(QString); //ID (Request that this browser be closed)
void treeWidgetSizeChanged(float); //percent width
//External App/Widget launching
void PlayFiles(LFileInfoList); //open in multimedia player
void ViewFiles(LFileInfoList); //open in slideshow
void LaunchTerminal(QString); //dirpath
//System Interactions
void CutFiles(QStringList); //file selection
void CopyFiles(QStringList); //file selection
void PasteFiles(QString, QStringList); //current dir
void FavoriteFiles(QStringList); //file selection
void RenameFiles(QStringList); //file selection
void RemoveFiles(QStringList); //file selection
void TabNameChanged(QString, QString); //objID, new tab name
protected:
void mouseReleaseEvent(QMouseEvent *);
};
#endif
|