-
Notifications
You must be signed in to change notification settings - Fork 0
/
nw_main_win.h
174 lines (122 loc) · 3.55 KB
/
nw_main_win.h
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
/****************************************************************************
**
** NightWatch Video Navigator
** 2020 (c) Vladi Belperchinov-Shabanski
** https://github.com/cade-vs/nightwatch
**
****************************************************************************/
#ifndef _NW_MAIN_WIN_H_
#define _NW_MAIN_WIN_H_
#include <QMainWindow>
#include <QTreeWidget>
#include <QDir>
#include <QMenu>
#include <QString>
#include <QDialog>
#include <QWidget>
#include <QImage>
#include <QTimer>
#include <QProcess>
#include <QFileSystemWatcher>
class NWMainWindow;
class NWTreeWidgetItem : public QTreeWidgetItem
{
public:
NWTreeWidgetItem();
QString fn;
int is_dir;
};
class NWPoster : public QWidget
{
Q_OBJECT
QString fn;
QImage im;
public:
void loadImage( const QString file_name );
void rescaleImage();
protected:
void paintEvent( QPaintEvent * e );
};
class NWTreeWidget : public QTreeWidget
{
Q_OBJECT
public:
NWMainWindow *main_window;
NWTreeWidget();
NWTreeWidget( QWidget *parent );
void findNext( QString str, int full_match = 0 );
void findNextThe( QString str );
protected:
void keyPressEvent(QKeyEvent *event);
};
class NWMainWindow : public QMainWindow
{
Q_OBJECT
int rand_seeded;
int first_load;
public:
NWTreeWidget *tree;
NWPoster *poster;
QTimer *timer;
QDir cdir;
int videos_count;
int videos_posters;
QFileSystemWatcher dir_watcher;
int last_sort_col;
int last_sort_ord;
int auto_play;
QTimer *auto_play_timer;
NWTreeWidgetItem *last_played;
NWMainWindow();
~NWMainWindow();
void closeAllViews();
void loadDir( QString path, int mode ); // modes: 0 reload, 1 enter new, 2 go up
void goToDir( int mode );
void goPrevNext( int r, int skip_dirs = 1 );
void goPrevNextDir( int r );
void sortColumn( int n, int d = 'A' );
int deleteItems( int current_only );
void addPlayLocation( QString location );
void beginAutoPlay();
void cancelAutoPlay();
protected:
void showEvent(QShowEvent *event);
void keyPressEvent(QKeyEvent *event);
void resizeEvent(QResizeEvent *event);
void moveEvent(QMoveEvent *event);
public slots:
void toggleSortColumns();
void enter( QTreeWidgetItem *item );
void enterCurrent();
void actionTriggered(QAction *action);
void switchLayoutDirection();
void slotItemActivated( QTreeWidgetItem *item, int column );
void slotCurrentItemChanged( QTreeWidgetItem *current, QTreeWidgetItem *previous );
void slotLoadCurrentImage();
void slotPlayerFinished(int exitCode, QProcess::ExitStatus exitStatus);
void slotAutoPlayNext();
void slotNewWindow();
void slotGoUp();
void slotChangeDir();
void slotHomeDir();
void slotReloadDir();
void slotDirChanged( const QString &dir );
void slotSortByName();
void slotSortByModTime();
void slotTogglePerDirSorting();
void slotRandomItem();
void slotKeypadMenu();
void slotStopPlayer();
void slotHelp();
void slotAbout();
void slotSelectLastPlayLocation();
void slotSelectMainListBigFont();
void slotSelectMainListSmallFont();
void slotSelectKeyPadFont();
void slotStatusBarFont();
void slotResetFonts();
private:
void setupMenuBar();
};
#endif