aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--about.ui12
-rw-r--r--main.cpp1
-rw-r--r--player.cpp20
-rw-r--r--player.h6
-rw-r--r--player.ui30
5 files changed, 57 insertions, 12 deletions
diff --git a/about.ui b/about.ui
index d5737ef..bee1c35 100644
--- a/about.ui
+++ b/about.ui
@@ -17,9 +17,9 @@
<property name="geometry">
<rect>
<x>90</x>
- <y>60</y>
- <width>231</width>
- <height>18</height>
+ <y>80</y>
+ <width>215</width>
+ <height>30</height>
</rect>
</property>
<property name="font">
@@ -35,9 +35,9 @@
<property name="geometry">
<rect>
<x>30</x>
- <y>20</y>
- <width>351</width>
- <height>31</height>
+ <y>40</y>
+ <width>340</width>
+ <height>30</height>
</rect>
</property>
<property name="font">
diff --git a/main.cpp b/main.cpp
index bc83fdc..2797bd5 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,5 +1,6 @@
#include <iostream>
#include "player.h"
+#include <QMessageBox>
#include <QApplication>
diff --git a/player.cpp b/player.cpp
index 6c2a311..d2476dc 100644
--- a/player.cpp
+++ b/player.cpp
@@ -3,6 +3,7 @@
#include "ui_player.h"
#include "about.h"
#include <QMediaPlayer>
+#include <QFileDialog>
Player::Player(QWidget *parent)
@@ -24,11 +25,12 @@ void Player::on_actionQuit_triggered()
close();
}
-void Player::on_pushButton_pressed()
+void Player::on_playButton_pressed()
{
+ QPushButton mPlay;
+
std::cout << "Playing music...\n";
- mPlayer->setMedia(QUrl::fromLocalFile("/home/andrew/Music/4616-werq-by-kevin-macleod.mp3"));
- mPlayer->setVolume(50);
+
mPlayer->play();
}
@@ -39,3 +41,15 @@ void Player::on_actionAbout_triggered()
about.setModal(true);
about.exec();
}
+
+void Player::on_pauseButton_pressed()
+{
+ mPlayer->pause();
+}
+
+void Player::on_pushButton_pressed()
+{
+ QString mFile;
+ mFile = QFileDialog::getOpenFileName(this, "Open any audio file", QDir::homePath(), tr("Audio Files (*.mp3)"));
+ mPlayer->setMedia(QUrl::fromLocalFile(mFile));
+}
diff --git a/player.h b/player.h
index 0879d61..8d26e48 100644
--- a/player.h
+++ b/player.h
@@ -20,10 +20,14 @@ public:
private slots:
void on_actionQuit_triggered();
- void on_pushButton_pressed();
+ void on_playButton_pressed();
void on_actionAbout_triggered();
+ void on_pauseButton_pressed();
+
+ void on_pushButton_pressed();
+
private:
Ui::Player *ui;
};
diff --git a/player.ui b/player.ui
index f03497e..8cb0eda 100644
--- a/player.ui
+++ b/player.ui
@@ -14,10 +14,10 @@
<string>AleePlayer</string>
</property>
<widget class="QWidget" name="centralwidget">
- <widget class="QPushButton" name="pushButton">
+ <widget class="QPushButton" name="playButton">
<property name="geometry">
<rect>
- <x>10</x>
+ <x>20</x>
<y>20</y>
<width>88</width>
<height>34</height>
@@ -27,6 +27,32 @@
<string>Play Audio</string>
</property>
</widget>
+ <widget class="QPushButton" name="pauseButton">
+ <property name="geometry">
+ <rect>
+ <x>130</x>
+ <y>20</y>
+ <width>88</width>
+ <height>34</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Pause</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton">
+ <property name="geometry">
+ <rect>
+ <x>240</x>
+ <y>20</y>
+ <width>88</width>
+ <height>34</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Set Media</string>
+ </property>
+ </widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">