-
Notifications
You must be signed in to change notification settings - Fork 0
/
menuactions.cpp
107 lines (90 loc) · 3.43 KB
/
menuactions.cpp
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
#ifndef MENUACTIONS_H
#define MENUACTIONS_H
#include "mainwindow.h"
void MainWindow::open()
{
QString * defaultMusicDirectory = new QString(QStandardPaths::locate(QStandardPaths::MusicLocation, "", QStandardPaths::LocateDirectory));
QStringList fileNames = _openFileDialog(getAudioFileTypes(),defaultMusicDirectory);
if(fileNames.size())
{
QList<QMediaContent> playListFiles;
for(QStringList::iterator file = fileNames.begin(); file < fileNames.end(); file++)
playListFiles.append(QMediaContent(QUrl::fromLocalFile(*file)));
if(_currentPlayer == _players->at(_playlistTabs->currentIndex()))
{
_currentPlayer->pause();
_currentPlayer->playlist()->clear();
_currentPlayer->playlist()->addMedia(playListFiles);
_currentPlayer->playlist()->setCurrentIndex(0);
if(_isPlaying) _currentPlayer->play();
}
else
{
_players->at(_playlistTabs->currentIndex())->playlist()->clear();
_players->at(_playlistTabs->currentIndex())->playlist()->addMedia(playListFiles);
_players->at(_playlistTabs->currentIndex())->playlist()->setCurrentIndex(0);
}
refreshPlaylistView();
}
}
void MainWindow::addMedia()
{
QString * defaultMusicDirectory = new QString(QStandardPaths::locate(QStandardPaths::MusicLocation, "", QStandardPaths::LocateDirectory));
QStringList fileNames = _openFileDialog(getAudioFileTypes(),defaultMusicDirectory);
if(fileNames.size())
{
QList<QMediaContent> playListFiles;
for(QStringList::iterator file = fileNames.begin(); file < fileNames.end(); file++)
playListFiles.append(QMediaContent(QUrl::fromLocalFile(*file)));
if(_players->at(_playlistTabs->currentIndex())->playlist())
{
if(_players->at(_playlistTabs->currentIndex())->playlist()->isEmpty())
{
_players->at(_playlistTabs->currentIndex())->playlist()->addMedia(playListFiles);
_players->at(_playlistTabs->currentIndex())->playlist()->setCurrentIndex(0);
}
else _players->at(_playlistTabs->currentIndex())->playlist()->addMedia(playListFiles);
}
refreshPlaylistView();
}
}
void MainWindow::about()
{
#ifndef __ANDROID__
_infoLabel->setText(tr("Invoked <b>Help|About</b>"));
#endif
QMessageBox::about(this, tr("About Menu"),
tr("CS 372 - Software Construction"
"<p>Final Project - \"<a href='https://github.com/FizzyGalacticus/MusicPlayer'>Music Player</a>\""
"<p>Spring Semester 2014"
"<p><b>Instructor:</b> Chris Hartman"));
}
void MainWindow::aboutQt()
{
#ifndef __ANDROID__
_infoLabel->setText(tr("Invoked <b>Help|About Qt</b>"));
#endif
}
void MainWindow::aboutAuthors()
{
#ifndef __ANDROID__
_infoLabel->setText(tr("Invoked <b>Help|About</b>"));
#endif
QMessageBox::about
(
this,
tr("Authors Menu"),
tr
(
"<b><center>Authors:</center></b>"
"<p>Dustin Dodson"
"<b><center>Previous Contributors:</center></b>"
"<p>Erik Talvi"
"<p>Matthew Parrish"
"<p>Nate Helms"
"<p>Nicholas Mardeusz"
"<p>Thomas Cerny"
)
);
}
#endif // MENUACTIONS_H