-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.h
More file actions
166 lines (127 loc) · 4.18 KB
/
mainwindow.h
File metadata and controls
166 lines (127 loc) · 4.18 KB
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
#pragma once
#include <memory>
#include <QMainWindow>
#include "scheduleitem.h"
#include "schedulegriditem.h"
namespace OATS{
class ScheduleItem;
class OutputPanel;
}
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
struct CurrentPlayItem{
OATS::ScheduleItem* item;
int schedule_index{-1};
int grid_index{-1};
};
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
constexpr static int MAX_GRID_ITEMS = 5;
constexpr static int MAX_SCHEDULE_ITEMS = 10;
constexpr static int YIELD_FADE_DELAY = 3000;
constexpr static int YIELD_FADE_OUT = 7000;
MainWindow(QWidget *parent = nullptr);
~MainWindow();
void load_schedule(int);
void make_schedule_grid();
void display_schedule(int start_index=0);
std::string play_channel();
OATS::ScheduleItem* schedule_item(int);
OATS::ScheduleItem* subject_item(int);
int index_of(int);
int grid_index_of(int);
void print_schedule_items();
void print_grid_items();
std::unique_ptr<OATS::ScheduleItem> make_schedule_item();
void refresh_schedule(int,int);
void go_current();
std::string minute_to_str(int);
void fill_hour_strings();
void make_str(int, int);
OATS::ScheduleItem* find_next_schedule_item(OATS::ScheduleItem*);
bool is_schedule_item(OATS::ScheduleItem*);
void make_output_panels();
void cue_next_schedule(OATS::ScheduleItem*, OATS::OutputPanel*);
OATS::OutputPanel* create_output_panel(const QString);
OATS::OutputPanel* find_output_panel(int);
int next_output_panel_id(int);
void compute_schedule_time();
void calculate_trigger_times();
int calculate_yield_contribution(OATS::ScheduleItem*);
void set_current_play_item();
long get_tick_count();
void test_setup();
void test_set_current_playing_item();
private slots:
void item_move_up(int,int);
void item_move_down(int,int);
void delete_schedule_item(int);
void insert_schedule_item(int, int);
void make_item_current(int, int);
void play_current_item(int, int);
// void play_audio(int, OATS::ScheduleItem*);
// void stop_audio(int, OATS::ScheduleItem*);
void play_audio(OATS::OutputPanel*);
void stop_audio(OATS::OutputPanel*);
void scroll_changed(int);
void show_time();
void slow_flash();
void fast_flash();
void status_timer();
void test();
void test_slow_flash();
void test_fast_flash();
void test_main_timer();
void test_change_outputA_status(int);
void test_change_outputB_status(int);
void test_set_triggerA();
void test_set_triggerB();
void test_set_fadeA();
void test_set_fadeB();
void count_down();
public slots:
void test_set_RT_outputA();
void test_set_RT_outputB();
private:
Ui::MainWindow *ui;
std::vector<std::unique_ptr<OATS::ScheduleItem>> m_grid_subjects;
std::vector<std::unique_ptr<OATS::ScheduleGridItem>> m_schedule_grid;
std::vector<std::unique_ptr<OATS::ScheduleItem>> m_schedule_items;
OATS::OutputPanel* m_outputA;
OATS::OutputPanel* m_outputB;
std::unique_ptr<OATS::OutputPanel> m_outputC;
std::vector<std::unique_ptr<OATS::OutputPanel>> m_output_panels;
std::unique_ptr<QTimer> m_time_timer;
std::map<int, std::string> m_hour_strings;
std::unique_ptr<QTimer> m_slow_flash_timer;
std::unique_ptr<QTimer> m_fast_flash_timer;
std::unique_ptr<QTimer> m_countdown_timer;
std::unique_ptr<QTimer> m_main_player_timer;
static int s_sched_ref;
static std::string s_channel;
CurrentPlayItem m_current_playing_item;
};
struct FindByRef{
FindByRef(int ref)
:m_ref{ref}
{
}
bool operator()(std::unique_ptr<OATS::ScheduleItem> const& item){
return (item->schedule_ref() == m_ref);
}
private:
int m_ref;
};
struct FindGridItemByRef{
FindGridItemByRef(int ref)
:m_ref{ref}
{}
bool operator()(std::unique_ptr<OATS::ScheduleGridItem>const& item){
return (item->schedule_item()->schedule_ref()==m_ref);
}
private:
int m_ref;
};