source: lumina/lumina-fm/MainUI.h @ 0494142

enter/10releng/10.0.3releng/10.1releng/10.1.1releng/10.1.2releng/10.2
Last change on this file since 0494142 was 0494142, checked in by Ken Moore <ken@…>, 14 months ago

Add auto-detection of multimedia file extensions into lumina-fm, and also add a function into libLumina for converting a mime-type into a list of file extensions.

  • Property mode set to 100644
File size: 5.3 KB
Line 
1//===========================================
2//  Lumina-DE source code
3//  Copyright (c) 2014, Ken Moore
4//  Available under the 3-clause BSD license
5//  See the LICENSE file for full details
6//===========================================
7//  This is the main interface for the Lumina File Manager (Insight)
8//===========================================
9#ifndef _LUMINA_FILE_MANAGER_UI_H
10#define _LUMINA_FILE_MANAGER_UI_H
11// Qt includes
12#include <QMainWindow>
13#include <QTabBar>
14#include <QLineEdit>
15#include <QFileSystemModel>
16#include <QStringList>
17#include <QDebug>
18#include <QAction>
19#include <QProcess>
20#include <QSettings>
21#include <QInputDialog>
22#include <QMessageBox>
23#include <QDir>
24#include <QTimer>
25#include <QDateTime>
26#include <QShortcut>
27#include <QCompleter>
28#include <QClipboard>
29#include <QMimeData>
30#include <QTreeWidgetItem>
31#include <QListWidgetItem>
32#include <QRadioButton>
33#include <QWidgetAction>
34#include <QFileSystemWatcher>
35#include <QImageReader>
36
37//Phonon widgets
38#include <Phonon/BackendCapabilities>
39#include <Phonon/MediaObject>
40#include <Phonon/VideoWidget>
41#include <Phonon/AudioOutput>
42#include <Phonon/SeekSlider>
43#include <Phonon/MediaSource>
44
45// libLumina includes
46#include <LuminaXDG.h>
47#include <LuminaOS.h>
48
49// Local includes
50#include "FODialog.h" //file operation dialog
51#include "BMMDialog.h" //bookmark manager dialog
52
53namespace Ui{
54        class MainUI;
55};
56
57class MainUI : public QMainWindow{
58        Q_OBJECT
59public:
60        MainUI();
61        ~MainUI();
62
63        void OpenDirs(QStringList); //called from the main.cpp after initialization
64
65private:
66        Ui::MainUI *ui;
67        //Internal non-ui widgets
68        QTabBar *tabBar;
69        QLineEdit *currentDir;
70        QFileSystemModel *fsmod, *snapmod;
71        QMenu *contextMenu;
72        QRadioButton *radio_view_details, *radio_view_list, *radio_view_icons;
73        QWidgetAction *detWA, *listWA, *icoWA;
74
75        //Phonon Widgets for the multimedia player
76        Phonon::MediaObject *mediaObj;
77        Phonon::VideoWidget *videoDisplay;
78        Phonon::AudioOutput *audioOut;
79        Phonon::SeekSlider *playerSlider;
80        QFile *playerFile;
81        QString playerTTime; //total time - to prevent recalculation every tick
82
83        //Internal variables
84        QStringList snapDirs; //internal saved variable for the discovered zfs snapshot dirs
85        QString CItem; //the item that was right-clicked (for the context menu)
86        QStringList imgFilter, multiFilter; //image/multimedia filters
87        QSettings *settings;
88        QShortcut *nextTabLShort, *nextTabRShort, *closeTabShort, *copyFilesShort, *pasteFilesShort, *deleteFilesShort;
89        QCompleter *dirCompleter;
90        QFileSystemWatcher *dirWatcher;
91        bool isUserWritable, keepFocus;
92
93        //Simplification Functions
94        void setupIcons();                      //used during initialization
95        void setupConnections();        //used during initialization
96        void loadSettings();            //used during initialization
97       
98        void RebuildBookmarksMenu();
99        void RebuildDeviceMenu();
100       
101        bool checkUserPerms();
102        QString bytesToText(qint64 bytes);
103        QString msToText(qint64 ms);
104       
105        //Common functions for browser info/usage
106        QString getCurrentDir();
107        void setCurrentDir(QString);
108        QStringList getSelectedItems();
109
110private slots:
111        void slotSingleInstance(const QString &in){
112          this->show();
113          this->raise();
114          this->OpenDirs(in.split("\n"));
115        }
116       
117        //General button check functions (start in a new thread!)
118        void checkForMultimediaFiles();
119        void checkForBackups();
120        void checkForPictures();
121       
122        //General page switching
123        void goToMultimediaPage();
124        void goToRestorePage();
125        void goToSlideshowPage();
126        void goToBrowserPage();
127       
128        //Menu Actions
129        void on_actionNew_Tab_triggered();
130        void on_actionClose_triggered();
131        void on_actionView_Hidden_Files_triggered();
132        void goToBookmark(QAction*);
133        void goToDevice(QAction*);
134        void viewModeChanged(bool);
135       
136        //Toolbar Actions
137        void on_actionBack_triggered();
138        void on_actionUpDir_triggered();
139        void on_actionHome_triggered();
140        void on_actionBookMark_triggered();
141
142        //Browser Functions
143        void startEditDir(QWidget *old, QWidget *now);
144        void goToDirectory(); //go to a manually typed in directory
145        void loadDirectory(); //Update the widget with the dir contents
146        void on_tool_addToDir_clicked();
147        void tabChanged(int tab);
148        void tabClosed(int tab = -1);
149        void prevTab();
150        void nextTab();
151        void ItemRun( const QModelIndex&);
152        void ItemRun(QTreeWidgetItem *item);
153        void ItemRun(QListWidgetItem *item);
154        void OpenContextMenu(const QPoint&);
155
156        //Slideshow Functions
157        void showNewPicture();
158        void firstPicture();
159        void prevPicture();
160        void nextPicture();
161        void lastPicture();
162       
163        //ZFS Restore Functions
164        void snapshotLoaded();
165        void showSnapshot();
166        void nextSnapshot();
167        void prevSnapshot();
168        void restoreItems();
169       
170        //Multimedia Player Functions
171        void playerStart();
172        void playerStop();
173        void playerPause();
174        void playerNext();
175        void playerPrevious();
176        void playerFinished(); //automatically called by the media object
177        void playerStateChanged(Phonon::State newstate, Phonon::State oldstate); //automatically called by the media object
178        void playerVideoAvailable(bool showVideo); //automatically called by the media object
179        void playerTimeChanged(qint64 ctime); //automatically called by the media object
180        void playerFileChanged();
181       
182        //Context Menu Actions
183         // - single item actions
184        void OpenItem(); //run "lumina-open" on it
185        void OpenItemWith(); //run "lumina-open -select" on it
186        void OpenDir(); //open the dir in a new tab
187        void RemoveItem(); //Remove the item permanently
188        void RenameItem();
189         // - full selection actions
190        void CutItems();
191        void CopyItems();
192        void PasteItems();
193
194};
195
196#endif
Note: See TracBrowser for help on using the repository browser.