-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
247 lines (185 loc) · 5.88 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
// --------------------------
// Kevin Doveton
// Copyright 2015
// --------------------------
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
// QT
#include <QtCore>
#include <QtGui>
#include <QMainWindow>
#include <QTimer>
// General
#include <iostream> // General IO (cout/cin)
#include <string> // Strings - STD :: String
#include <sstream> // String Streams - STD :: stringstream
#include <iomanip> // IOMainIP - time
#include <ctime> // C-Time - time
#include <chrono> // Chrono - STD :: chrono
#include <vector>
// GUI
#include "ui_mainwindow.h" // Main Form
#include "ListViewMusicDelegateGrid.h" // listviewMusic Delegate
#include "ListViewMusicDelegateList.h"
// Music
#include "libraries/bass/bass.h" // Bass
#include <alsa/asoundlib.h> // Alsa (System Volume)
#include <taglib/tag.h> // Taglib (ID3 Tags)
#include <taglib/taglib.h> // Taglib
#include <taglib/tstring.h> // Taglib
#include <taglib/fileref.h> // Taglib
#include <sqlite3.h> // SQLite (Data Storage)
#include "libraries/SQLiteCpp/SQLiteCpp.h" // SQLiteCPP (SQLite API)
// Clases
#include "ClassMusic.h" // Song Data
#include "ClassSystemVolume.h"
#include "ClassMusicDB.h"
#include "ClassMusicPlayer.h"
#include "ClassAudioPlayerQT.h"
#include "ClassOfono.h"
#include "ClassContactDB.h"
#include "ClassMapData.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private slots:
// --------------------------------------
// frameTopBar
// --------------------------------------
void on_buttonNowPlayingVolumeUp_released();
// --------------------------------------
// TODO
// Volume up in top frame
// Turns volume up by 5%
void on_buttonNowPlayingVolumeDown_released();
// --------------------------------------
// TODO
// Volume down in top frame
// Turns volume down by 5%
void on_buttonNowPlayingPlayPause_released();
// Play/Pause button top frame
// Swaps image from play/pause
// Play/Pause music
// --------------------------------------
// TODO
// Plays random song if nothing selected
void on_buttonNowPlayingNext_released();
// Next button in top frame
// Removes current song from upNext and
// places in recentlyPlayed
// Plays next song in upNext
// --------------------------------------
// TODO
// Error check // no song next
void on_buttonNowPlayingPrevious_released();
// Previous button in top frame
// Removes current song from upNext and
// places in recentlyPlayed
// removes last element from recentlyPlayed
// and places as first element in upNext
// Plays song
// --------------------------------------
// TODO
// Error check // no song
// --------------------------------------
// frameTabBar
// --------------------------------------
void on_buttonRBHome_released();
// Switches to home frame
// switches selected label to home
void on_buttonMusic_released();
// Switches to music frame
// Switches selected label to music
void on_buttonPhone_released();
// Switches to phone frame
// Switches selected label to phone
void on_buttonMaps_released();
// Switches to maps frame
// Switches selected label to map
void on_buttonAirplay_released();
// --------------------------------------
//musicTabBar
// --------------------------------------
void on_buttonArtist_released();
// Switches to artist view
// Selected label to artists
void on_buttonAlbum_released();
// Switches to album view for last selected artist
// Selected label to album
void on_buttonSong_released();
// Switches to song view for last selected artist
// Selected label to song
void on_buttonRBNowPlaying_released();
// --------------------------------------
// frameHome
// --------------------------------------
void on_buttonQuit_released();
// Quit button, home screen
// On release, program will quit.
// --------------------------------------
// frameMusic
// --------------------------------------
void on_listviewMusic_clicked(const QModelIndex &index);
// Items on music frame
// switch statement, on click will go from artist -> album
// -> song view -> play song
// --------------------------------------
// frameIncomingCall
// --------------------------------------
void incomingCall(QString number);
// --------------------------------------
// Loops
// --------------------------------------
void runLoop();
// general run loop
// checks time
// checks music
// void call();
private:
Ui::MainWindow *ui;
void setSongTags(std::string title, std::string album, std::string artist, std::string albumImagePath);
// set the song labels
void setButtonPlayPauseText(int playStatus);
// set the text according to current playing ness
void hideAllCentreFrames();
// hide all the frames in the centre
void showMenuButtons();
// show standard menu buttons
void showMusicButtons();
// show music specific buttons
void hideMusicButtons();
// hide music specific buttons
int selectedFrame(int selected = -1);
// set selected frame
// 0 = home, 1 = music, 2 = phone, 3 = maps
// if set blank or incorrectly will return the
// currently selected frame
void hideAllTabSelected();
// hide all the selected labels for the tab bar
// Music
int currentView = 1; // start up in artist mode
QStandardItemModel* model; // used for music
std::vector<SongData> upNext;
std::vector<SongData> recentlyPlayed;
int artistIDCur = -1;
int albumIDCur = -1;
int songIDCur = -1;
// Objects
AudioPlayerQT musicPlayer;
MusicDB musicDB;
SystemVolume systemVolume;
Ofono *ofono = new Ofono();
ContactDB contactDB;
MapData *mapData;
AudioPlayerQT audioPlayer;
// Maps
};
std::string getCurrentTime();
// return current time as string
#endif // MAINWINDOW_H