aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-fm/MainUI.h
blob: 875a64944bb61b9011c7859738a1847f7a0e68b2 (plain)
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
200
201
202
203
204
205
//===========================================
//  Lumina-DE source code
//  Copyright (c) 2014-2015, Ken Moore
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
//  This is the main interface for the Lumina File Manager (Insight)
//===========================================
#ifndef _LUMINA_FILE_MANAGER_UI_H
#define _LUMINA_FILE_MANAGER_UI_H
// Qt includes
#include <QMainWindow>
#include <QTabBar>
#include <QLineEdit>
#include <QFileSystemModel>
#include <QStringList>
#include <QDebug>
#include <QAction>
#include <QProcess>
#include <QSettings>
#include <QInputDialog>
#include <QMessageBox>
#include <QDir>
#include <QTimer>
#include <QDateTime>
#include <QShortcut>
#include <QCompleter>
#include <QClipboard>
#include <QMimeData>
#include <QTreeWidgetItem>
#include <QListWidgetItem>
#include <QRadioButton>
#include <QWidgetAction>
#include <QImageReader>
#include <QScrollBar>
#include <QFileDialog>
#include <QResizeEvent>
#include <QDesktopWidget>
#include <QThread>
#include <QUrl>
#include <QThread>

//Multimedia Widgets
#include <QVideoWidget>
#include <QMediaPlayer>

// libLumina includes
#include <LuminaXDG.h>
#include <LuminaOS.h>
#include <LFileInfo.h>

// Local includes
//#include "FODialog.h" //file operation dialog
#include "TrayUI.h"
#include "BMMDialog.h" //bookmark manager dialog

#include "DirData.h"
#include "widgets/MultimediaWidget.h"
#include "widgets/SlideshowWidget.h"
#include "widgets/DirWidget2.h"

namespace Ui{
    class MainUI;
};

class MainUI : public QMainWindow{
    Q_OBJECT
public:
    MainUI();
    ~MainUI();
    //bool rootmode;

public slots:
    void OpenDirs(QStringList);	 //also called from the main.cpp after initialization
    void setupIcons(); 			//used during initialization

private:
    Ui::MainUI *ui;
    QThread *workThread;
    DirData *worker;
    //Internal non-ui widgets
    QTabBar *tabBar;
    //QFileSystemModel *fsmod;
    QMenu *contextMenu, * menuSort_Mode;
    QRadioButton *radio_view_details, *radio_view_list, *radio_sort_name, *radio_sort_size, *radio_sort_type, *radio_sort_datemod, *radio_sort_datecre;//, *radio_view_tabs, *radio_view_cols;
    QWidgetAction *detWA, *listWA, *sortnameA, *sortsizeA, *sorttypeA, *sortdateMA, *sortdateCA; //, *tabsWA, *colsWA;

    //UI Widgets
    QList<DirWidget*> DWLIST;
    MultimediaWidget *MW;
    SlideshowWidget *SW;
    TrayUI *TRAY;
    bool waitingToClose;

    QSettings *settings;
    QShortcut *nextTabLShort, *nextTabRShort, *togglehiddenfilesShort, *focusDirWidgetShort;
    //QShortcut *toggledirtreepaneShort;
    //QCompleter *dirCompleter;

    //Simplification Functions
    void setupConnections(); 	//used during initialization
    void loadSettings(); 		//used during initialization

    void RebuildBookmarksMenu();
    void RebuildDeviceMenu();

    DirWidget* FindActiveBrowser();

private slots:
    void slotSingleInstance(QStringList in){
      this->show();
      this->raise();
      this->activateWindow();
      this->OpenDirs(in);
    }

    //void slotStartSyncTimer();

    //Menu Actions
    void on_actionNew_Window_triggered();
    void on_actionNew_Tab_triggered();
    void on_actionSearch_triggered();
    void on_actionClose_Browser_triggered();
    void on_actionClose_triggered();
    void on_actionNew_Dir_triggered();
    /*void on_actionRename_triggered();
    void on_actionCut_Selection_triggered();
    void on_actionCopy_Selection_triggered();
    void on_actionPaste_triggered();
    void on_actionDelete_Selection_triggered();*/
    void on_actionRefresh_triggered();
    void on_actionView_Hidden_Files_triggered();
    void on_actionVerify_File_Delete_triggered();
    //void on_actionView_showDirTreePane_triggered();
    //void on_actionShow_Action_Buttons_triggered();
    void treeWidgetWidthChanged(float percent);
    void on_actionShow_Thumbnails_triggered();
    void goToBookmark(QAction*);
    void goToDevice(QAction*);
    void viewModeChanged(bool);
    void sortModeName(bool);
    void sortModeSize(bool);
    void sortModeType(bool);
   void sortModeDateM(bool);
   void sortModeDateC(bool);

    //void groupModeChanged(bool);
    void on_actionLarger_Icons_triggered();
    void on_actionSmaller_Icons_triggered();
    void CreateBookMark();
    //Git Menu options
    void on_menuGit_aboutToShow();
    void on_actionRepo_Status_triggered();
    void on_actionClone_Repository_triggered();

    //Tab interactions
    void tabChanged(int tab = -1);
    void tabClosed(int tab = -1);
    void nextTab(); //For keyboard shortcuts
    void prevTab(); //For keyboard shortcuts

    //Other Shortcuts
    void togglehiddenfiles();
    //void toggleDirTreePane();
    void focusDirWidget();

    //Backend Info passing
    //void DirDataAvailable(QString, QString, LFileInfoList);
    void SnapshotDataAvailable(QString, QString, QStringList);

    //Dir Browser Interactions
    void OpenPlayer(LFileInfoList);
    void OpenImages(LFileInfoList);
    void OpenTerminal(QString dirpath);
    void CutFiles(QStringList); //file selection
    void CopyFiles(QStringList); //file selection
    void PasteFiles(QString, QStringList raw = QStringList() ); //current dir, optional list of commands
    void FavoriteFiles(QStringList); //file selection
    void RenameFiles(QStringList); //file selection
    void RemoveFiles(QStringList); //file selection
    void CloseBrowser(QString); //ID
    void TabNameChanged(QString, QString); // ID/name

    //file info in status bar
    void DisplayStatusBar(QString);

    void TrayJobsFinished();

    void on_actionOpen_as_Root_triggered();

signals:
    void Si_AdaptStatusBar(QFileInfoList fileList, QString path, QString messageFolders, QString messageFiles);

protected:
    void resizeEvent(QResizeEvent *ev){
      //Save the new size to the settings file for later
      settings->setValue("preferences/MainWindowSize", ev->size());
      QMainWindow::resizeEvent(ev); //just in case the window needs to see the event too
    }

    void closeEvent(QCloseEvent *ev);

};

#endif
bgstack15