-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
executable file
·127 lines (107 loc) · 3.39 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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "datastore.h"
#include "downloadmanager.h"
#include "showlistmodel.h"
#include "showlistproxymodel.h"
#include "show.h"
#include <QMainWindow>
#include <QHash>
#include <QTimer>
#include <QItemSelection>
#include <QLabel>
#include <QProgressBar>
#include <QSystemTrayIcon>
#include <QSettings>
#ifdef USE_QT_MULTIMEDIA
#include <QMediaPlayer>
#include <QSoundEffect>
#endif
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
public slots:
void status(QString msg);
private slots:
void onInit();
void onInitted();
void onShowHide(bool checked);
void onTray(QSystemTrayIcon::ActivationReason);
void onShowProgress(int row, int progress);
void onShowQueued(int row);
void onShowUnqueued(int row);
void onShowStarted(int row);
void onShowFinished(int row);
void onShowError(int row);
void onThumbFinished(QByteArray data, QUrl url);
void onProgressStart();
void onProgress(qint64, qint64);
void onProgressFinish(const QVector<Show> & new_shows, const QVector<Show> & new_fav_shows);
void on_btnUpdate_clicked();
void on_chkFavsOnly_toggled(bool checked);
void on_selectionChanged(const QItemSelection & selected, const QItemSelection & deselected);
void on_chkFav_toggled(bool checked);
void on_btnDownload_clicked();
void on_lstShowView_clicked(const QModelIndex &index);
void on_txtRegex_textChanged(const QString &arg1);
void on_chkViewed_toggled(bool checked);
void on_lstShowView_doubleClicked(const QModelIndex &);
void on_actionAbout_Qt_triggered();
void on_actionSettings_triggered();
void on_actionOpenDownloads_triggered();
void on_actionAbout_triggered();
#ifdef USE_QT_MULTIMEDIA
// Multimedia related functions
void onDurationChanged(qint64 pos);
void onPositionChanged(qint64 pos);
void onAntinoise();
void onMediaState(QMediaPlayer::State state);
void onMediaAvailable(bool available);
void onMediaSeekable(bool seekable);
void on_btnFocusPlayingShow_clicked();
void on_sliPosition_sliderMoved(int position);
void on_sliVolume_valueChanged(int value);
void on_sliPosition_valueChanged(int value);
void on_btnStop_clicked();
void on_btnMute_toggled(bool checked);
void on_btnPlay_clicked();
void on_btnPause_clicked();
#endif
private:
Ui::MainWindow *ui;
DataStore data_store;
DownloadManager download_manager;
ShowListModel *model;
ShowListProxyModel *proxyModel;
QSettings settings;
QTimer refresh_timer;
QLabel * status_text;
QProgressBar * status_progress;
QSystemTrayIcon * tray_icon;
QMenu * tray_menu;
void updateList();
void updateRow(int row, Show & cur_show);
void enableElements(bool enable);
void setInfo();
void setPlayer(const Show & cur_show, bool play = false);
void setupRefreshTimer();
int selectedRow();
Show & selectedShow();
Show & selected_show;
int selected_row;
Show invalid_show;
int playing_show_row;
#ifdef USE_QT_MULTIMEDIA
// Multimedia related
QMediaPlayer player;
QSoundEffect alert_sound;
QTimer antinoise;
#endif
};
#endif // MAINWINDOW_H