forked from mpc-qt/mpc-qt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.h
471 lines (430 loc) · 16.8 KB
/
mainwindow.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
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
#ifndef HOSTWINDOW_H
#define HOSTWINDOW_H
#include <QMainWindow>
#include <mpvwidget.h>
#include <QMenuBar>
#include <QTimer>
#include <QSystemTrayIcon>
#include "helpers.h"
#include "widgets/drawnslider.h"
#include "widgets/drawnstatus.h"
#include "manager.h"
#include "playlistwindow.h"
#include "platform/screensaver.h"
#include "platform/windowmanager.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
private:
enum DecorationState { AllDecorations, NoMenu, NoDecorations };
enum ZoomMode { RegularZoom, Autofit, AutofitSmaller, AutofitLarger,
FitToWindow };
enum OnTopMode { OnTopDefault, AlwaysOnTop, OnTopWhenPlaying,
OnTopForVideos };
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
MpvObject *mpvObject();
QMainWindow *dockHost();
PlaylistWindow *playlistWindow();
QList<QAction *> editableActions();
QVariantMap mouseMapDefaults();
QMap<int, QAction *> wmCommandMap();
QVariantMap state();
void setState(const QVariantMap &map);
void setScreensaverAbilities(QSet<ScreenSaver::Ability> ab);
QSize desirableSize(bool first_run = false);
QPoint desirablePosition(QSize &size, bool first_run = false);
void unfreezeWindow();
protected:
void resizeEvent(QResizeEvent *event);
bool eventFilter(QObject *object, QEvent *event);
void closeEvent(QCloseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
private:
bool mouseStateEvent(const MouseState &state);
MediaSlider *positionSlider();
VolumeSlider *volumeSlider();
DecorationState decorationState();
bool fullscreenMode();
QSize noVideoSize();
double sizeFactor();
void setDiscState(bool playingADisc);
void setupMenu();
void setupContextMenu();
void setupTrayIcon();
void setupActionGroups();
void setupPositionSlider();
void setupVolumeSlider();
void setupMpvHost();
void setupMpvObject();
void setupMpvWidget(Helpers::MpvWidgetType widgetType);
void setupPlaylist();
void setupStatus();
void setupSizing();
void setupBottomArea();
void setupIconThemer();
void setupHideTimer();
void connectActionsToSignals();
void connectActionsToSlots();
void connectButtonsToActions();
void connectPlaylistWindowToActions();
void globalizeAllActions();
void setUiDecorationState(DecorationState state);
void setOSDPage(int page);
void setUiEnabledState(bool enabled);
void reparentBottomArea(bool overlay);
void checkBottomArea(QPointF mousePosition);
void leaveBottomArea();
void updateBottomAreaGeometry();
void updateTime();
void updateFramedrops();
void updateBitrate();
void updatePlaybackStatus();
void updateSize(bool first_run = false);
void updateInfostats();
void updateOnTop();
void updateWindowFlags();
void updateMouseHideTime();
void updateDiscList();
QList<QUrl> doQuickOpenFileDialog();
signals:
void instanceShouldQuit();
void fileOpened(QUrl what, QUrl subs);
void severalFilesOpened(QList<QUrl> what, bool important = false);
void severalFilesOpenedForPlaylist(QUuid destination, QList<QUrl> what);
void dvdbdOpened(QUrl what);
void streamOpened(QUrl what);
void recentOpened(TrackInfo info, bool isFromRecents = false);
void recentClear();
void takeImage(Helpers::ScreenshotRender render);
void takeImageAutomatically(Helpers::ScreenshotRender render);
void takeThumbnails();
void subtitlesLoaded(QUrl subs);
void showFileProperties();
void showLogWindow();
void hideLogWindow();
void showLibraryWindow();
void hideLibraryWindow();
void optionsOpenRequested();
void paused();
void unpaused();
void stopped();
void stepBackward();
void stepForward();
void speedDown();
void speedUp();
void speedReset();
void relativeSeek(bool forwards, bool isSmall);
void audioTrackSelected(int64_t id, bool userSelected);
void subtitleTrackSelected(int64_t id, bool userSelected);
void videoTrackSelected(int64_t id, bool userSelected);
void subtitlesEnabled(bool enabled);
void nextSubtitleSelected();
void previousSubtitleSelected();
void volumeChanged(int64_t volume);
void volumeMuteChanged(bool muted);
void afterPlaybackOnce(Helpers::AfterPlayback action);
void afterPlaybackAlways(Helpers::AfterPlayback action);
void chapterPrevious();
void chapterNext();
void filePrevious(bool forceFolderFallback);
void fileNext(bool forceFolderFallback);
void chapterSelected(int64_t id);
void timeSelected(double time);
void fullscreenModeChanged(bool fullscreen);
void zoomPresetChanged(int which);
void playCurrentItemRequested();
void favoriteCurrentTrack();
void organizeFavorites();
void fullscreenHideControls(bool checked);
void timeShortModeSet(bool timeShortMode);
public slots:
void httpQuickOpenFile();
void httpOpenFileUrl();
void httpSaveImage();
void httpSaveImageAuto();
void httpSaveThumbnails();
void httpClose();
void httpProperties();
void httpExit();
void httpPlay();
void httpPause();
void httpStop();
void httpFrameStep();
void httpFrameStepBack();
void httpIncreaseRate();
void httpDecreaseRate();
void httpQuickAddFavorite();
void httpOrganizeFavories();
void httpToggleCaptionMenu();
void httpToggleSeekBar();
void httpToogleControls();
void httpToggleInformation();
void httpToggleStatistics();
void httpToggleStatus();
void httpTogglePlaylistBar();
void httpViewMinimal();
void httpViewCompact();
void httpViewNormal();
void httpFullscreen();
void httpZoom25();
void httpZoom50();
void httpZoom100();
void httpZoom200();
void httpZoomAutoFit();
void httpZoomAutoFitLarger();
void httpVolumeUp();
void httpVolumeDown();
void httpVolumeMute();
void httpNextSubtitle();
void httpPrevSubtitle();
void httpOnOffSubtitles();
void httpAfterPlaybackNothing();
void httpAfterPlaybackPlayNext();
void httpAfterPlaybackExit();
void httpAfterPlaybackStandBy();
void httpAfterPlaybackHibernate();
void httpAfterPlaybackShutdown();
void httpAfterPlaybackLogOff();
void httpAfterPlaybackLock();
void setFreestanding(bool freestanding);
void setFullscreenMode(bool fullscreenMode);
void setNoVideoSize(const QSize &sz);
void setTrayIcon(bool enabled);
void setWindowedMouseMap(const MouseStateMap &map);
void setFullscreenMouseMap(const MouseStateMap &map);
void setRecentDocuments(QList<TrackInfo> tracks);
void setControlsInFullscreen(bool hide, int showWhen, int showWhenDuration, bool setControlsInFullscreen);
void setFavoriteTracks(QList<TrackInfo> files, QList<TrackInfo> streams);
void setIconTheme(IconThemer::FolderMode mode, QString fallback, QString custom);
void setHighContrastWidgets(bool yes);
void setInfoColors(const QColor &foreground, const QColor &background);
void setTime(double time, double length);
void setMediaTitle(QString title);
void setChapterTitle(QString title);
void setVideoSize(QSize size);
void setVolumeStep(int stepSize);
void setSizeFactor(double factor);
void setFitFactor(double fitFactor);
void setZoomMode(MainWindow::ZoomMode mode);
void setZoomPreset(int which, double fitFactor = -1.0);
void setZoomCenter(bool yes);
void setFullscreenName(QString screenName);
void setFullscreenOnPlay(bool onPlay);
void setFullscreenExitOnEnd(bool exitOnEnd);
void setMouseHideTimeFullscreen(int msec);
void setMouseHideTimeWindowed(int msec);
void setBottomAreaBehavior(Helpers::ControlHiding method);
void setBottomAreaHideTime(int milliseconds);
void setTimeTooltip(bool show, bool above);
void setFullscreenHidePanels(bool hidden);
void setPlaybackState(PlaybackManager::PlaybackState state);
void setPlaybackType(PlaybackManager::PlaybackType type);
void disableChaptersMenus();
void setChapters(QList<QPair<double,QString>> chapters);
void setAudioTracks(QList<QPair<int64_t,QString>> tracks);
void setVideoTracks(QList<QPair<int64_t,QString>> tracks);
void setSubtitleTracks(QList<QPair<int64_t,QString>> tracks);
void audioTrackSet(int64_t id);
void videoTrackSet(int64_t id);
void subtitleTrackSet(int64_t id);
void setSubtitleText(QString subText);
void setVolume(int level);
void setVolumeDouble(double level);
void setVolumeMax(int level);
void setSubtitlesDelayStep(int subtitlesDelayStep);
void setTimeShortMode(bool shortened);
void resetPlayAfterOnce();
void setPlayAfterAlways(Helpers::AfterPlayback action);
void setPlayAfterAlwaysDefault(Helpers::AfterPlayback action);
void setFps(double fps);
void setAvsync(double sync);
void setDisplayFramedrops(int64_t count);
void setDecoderFramedrops(int64_t count);
void setPlaylistVisibleState(bool yes);
void setPlaylistQuickQueueMode(bool yes);
void setAudioBitrate(double bitrate);
void setVideoBitrate(double bitrate);
void logWindowClosed();
void libraryWindowClosed();
private slots:
void on_actionFileOpenQuick_triggered();
void on_actionFileOpen_triggered();
void on_actionFileOpenDvdbd_triggered();
void on_actionFileOpenDirectory_triggered();
void on_actionFileOpenNetworkStream_triggered();
void on_actionFileRecentClear_triggered();
void on_actionFileSaveImage_triggered();
void on_actionFileSaveImageAuto_triggered();
void on_actionFileSavePlainImage_triggered();
void on_actionFileSavePlainImageAuto_triggered();
void on_actionFileSaveWindowImage_triggered();
void on_actionFileSaveWindowImageAuto_triggered();
void on_actionFileClose_triggered();
void on_actionFileExit_triggered();
void on_actionViewHideMenu_triggered();
void on_actionViewHideSeekbar_toggled(bool checked);
void on_actionViewHideControls_toggled(bool checked);
void on_actionViewHideInformation_toggled(bool checked);
void on_actionViewHideStatistics_toggled(bool checked);
void on_actionViewHideStatus_toggled(bool checked);
void on_actionViewHideSubresync_toggled(bool checked);
void on_actionViewHidePlaylist_toggled(bool checked);
void on_actionViewHideCapture_toggled(bool checked);
void on_actionViewHideNavigation_toggled(bool checked);
void on_actionViewHideLog_toggled(bool checked);
void on_actionViewHideLibrary_toggled(bool checked);
void on_actionViewHideControlsInFullscreen_toggled(bool checked);
void on_actionViewOSDNone_triggered();
void on_actionViewOSDMessages_triggered();
void on_actionViewOSDStatistics_triggered();
void on_actionViewOSDFrameTimings_triggered();
void on_actionViewOSDCycle_triggered();
void on_actionViewPresetsMinimal_triggered();
void on_actionViewPresetsCompact_triggered();
void on_actionViewPresetsNormal_triggered();
void on_actionViewFullscreen_toggled(bool checked);
void on_actionViewFullscreenEscape_triggered();
void on_actionViewZoom025_triggered();
void on_actionViewZoom050_triggered();
void on_actionViewZoom075_triggered();
void on_actionViewZoom100_triggered();
void on_actionViewZoom150_triggered();
void on_actionViewZoom200_triggered();
void on_actionViewZoom300_triggered();
void on_actionViewZoom400_triggered();
void on_actionViewZoomAutofit_triggered();
void on_actionViewZoomAutofitLarger_triggered();
void on_actionViewZoomAutofitSmaller_triggered();
void on_actionViewZoomDisable_triggered();
void on_actionViewOntopDefault_toggled(bool checked);
void on_actionViewOntopAlways_toggled(bool checked);
void on_actionViewOntopPlaying_toggled(bool checked);
void on_actionViewOntopVideo_toggled(bool checked);
void on_actionViewOptions_triggered();
void on_actionPlayPause_triggered(bool checked);
void on_actionPlayStop_triggered();
void on_actionPlayFrameBackward_triggered();
void on_actionPlayFrameForward_triggered();
void on_actionPlayRateDecrease_triggered();
void on_actionPlayRateIncrease_triggered();
void on_actionPlayRateReset_triggered();
void on_actionPlaySeekForwards_triggered();
void on_actionPlaySeekBackwards_triggered();
void on_actionPlaySeekForwardsFine_triggered();
void on_actionPlaySeekBackwardsFine_triggered();
void on_actionPlaySubtitlesEnabled_triggered(bool checked);
void on_actionPlaySubtitlesNext_triggered();
void on_actionPlaySubtitlesPrevious_triggered();
void on_actionPlaySubtitlesCopy_triggered();
void on_actionDecreaseSubtitlesDelay_triggered();
void on_actionIncreaseSubtitlesDelay_triggered();
void on_actionPlayLoopStart_triggered();
void on_actionPlayLoopEnd_triggered();
void on_actionPlayLoopUse_triggered(bool checked);
void on_actionPlayLoopClear_triggered();
void on_actionPlayVolumeUp_triggered();
void on_actionPlayVolumeDown_triggered();
void on_actionPlayVolumeMute_toggled(bool checked);
void on_actionPlayAfterOnceExit_triggered();
void on_actionPlayAfterOnceStandby_triggered();
void on_actionPlayAfterOnceHibernate_triggered();
void on_actionPlayAfterOnceShutdown_triggered();
void on_actionPlayAfterOnceLogoff_triggered();
void on_actionPlayAfterOnceLock_triggered();
void on_actionPlayAfterOnceNothing_triggered();
void on_actionPlayAfterOnceRepeat_triggered();
void on_actionPlayAfterAlwaysRepeat_triggered();
void on_actionPlayAfterAlwaysExit_triggered();
void on_actionPlayAfterAlwaysNothing_triggered();
void on_actionPlayAfterAlwaysNext_triggered();
void on_actionNavigateChaptersPrevious_triggered();
void on_actionNavigateChaptersNext_triggered();
void on_actionNavigateFilesPrevious_triggered();
void on_actionNavigateFilesNext_triggered();
void on_actionHelpHomepage_triggered();
void on_actionHelpAbout_triggered();
void on_actionPlaylistSearch_triggered();
void mpvw_customContextMenuRequested(const QPoint &pos);
void position_sliderMoved(int position);
void position_hoverValue(double value, QString text, double x);
void on_play_clicked();
void volume_sliderMoved(double position);
void playlistWindow_windowDocked();
void playlistWindow_playlistAddItem(const QUuid &playlistUuid);
void hideTimer_timeout();
void on_actionFileLoadSubtitle_triggered();
void on_actionFavoritesAdd_triggered();
void on_actionFavoritesOrganize_triggered();
private:
Ui::MainWindow *ui = nullptr;
QMainWindow *mpvHost_ = nullptr;
MpvObject *mpvObject_ = nullptr;
QWidget *mpvw = nullptr;
//MpvGlCbWidget *mpvw = nullptr;
MediaSlider *positionSlider_ = nullptr;
VolumeSlider *volumeSlider_ = nullptr;
StatusTime *timePosition = nullptr;
StatusTime *timeDuration = nullptr;
PlaylistWindow *playlistWindow_ = nullptr;
QMenu *contextMenu = nullptr;
QMenu *trayMenu = nullptr;
QTimer hideTimer;
QSystemTrayIcon *trayIcon = nullptr;
QActionGroup* audioTracksGroup = nullptr;
QActionGroup* videoTracksGroup = nullptr;
QActionGroup* subtitleTracksGroup = nullptr;
bool freestanding_ = false;
DecorationState decorationState_ = AllDecorations;
QString fullscreenName;
FullscreenMemory fullscreenMemory;
bool fullscreenOnPlay = false;
bool fullscreenExitOnEnd = false;
bool fullscreenMaximized = false;
bool fullscreenMode_ = false;
bool fullscreenHidePanels = true;
Helpers::ControlHiding bottomAreaBehavior = Helpers::ShowWhenHovering;
int bottomAreaHeight = 0;
int bottomAreaHideTime = 0;
bool timeTooltipShown = true;
bool timeTooltipAbove = true;
bool timeShortMode = false;
QString previousOpenDir;
QSize noVideoSize_ = QSize(500,270);
bool isPlaying = false;
bool isPaused = false;
bool hasVideo = false;
bool hasAudio = false;
bool hasSubs = false;
QString subtitleText;
int subtitlesDelayStep = 500;
int volumeStep = 10;
bool frozenWindow = true;
double sizeFactor_ = 1;
double fitFactor_ = 0.75;
ZoomMode zoomMode = RegularZoom;
bool zoomCenter = true;
OnTopMode onTopMode = OnTopDefault;
bool showOnTop = false;
int mouseHideTimeWindowed = 1000;
int mouseHideTimeFullscreen = 1000;
int64_t displayDrops = 0;
int64_t decoderDrops = 0;
double audioBitrate = 0;
double videoBitrate = 0;
IconThemer themer;
QList<QAction *> menuFavoritesTail;
MouseStateMap mouseMapWindowed;
MouseStateMap mouseMapFullscreen;
};
#endif // HOSTWINDOW_H