diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2020-01-19 23:30:36 -0500 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2020-01-19 23:30:36 -0500 |
| commit | 261dc10a82fadee5df1942340eaa7b101ff9323d (patch) | |
| tree | d42bf7558efaeca485f99a8ed145515f883ac40a | |
| parent | 7e166acd060dfefb3ffd74e7fb1eea18a57afe4c (diff) | |
| download | erable-godot-261dc10a82fadee5df1942340eaa7b101ff9323d.tar.gz erable-godot-261dc10a82fadee5df1942340eaa7b101ff9323d.tar.bz2 erable-godot-261dc10a82fadee5df1942340eaa7b101ff9323d.zip | |
Added about page and finally music is playing :D
| -rw-r--r-- | AleePlayer.pro | 4 | ||||
| -rw-r--r-- | about.cpp | 14 | ||||
| -rw-r--r-- | about.h | 22 | ||||
| -rw-r--r-- | about.ui | 55 | ||||
| -rw-r--r-- | player.cpp | 22 | ||||
| -rw-r--r-- | player.h | 6 | ||||
| -rw-r--r-- | player.ui | 30 |
7 files changed, 144 insertions, 9 deletions
diff --git a/AleePlayer.pro b/AleePlayer.pro index 1b6707b..1e93944 100644 --- a/AleePlayer.pro +++ b/AleePlayer.pro @@ -1,4 +1,5 @@ QT += core gui +QT += multimedia greaterThan(QT_MAJOR_VERSION, 4): QT += widgets @@ -16,13 +17,16 @@ DEFINES += QT_DEPRECATED_WARNINGS #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ + about.cpp \ main.cpp \ player.cpp HEADERS += \ + about.h \ player.h FORMS += \ + about.ui \ player.ui TRANSLATIONS += \ diff --git a/about.cpp b/about.cpp new file mode 100644 index 0000000..5bea58a --- /dev/null +++ b/about.cpp @@ -0,0 +1,14 @@ +#include "about.h" +#include "ui_about.h" + +About::About(QWidget *parent) : + QDialog(parent), + ui(new Ui::About) +{ + ui->setupUi(this); +} + +About::~About() +{ + delete ui; +} @@ -0,0 +1,22 @@ +#ifndef ABOUT_H +#define ABOUT_H + +#include <QDialog> + +namespace Ui { +class About; +} + +class About : public QDialog +{ + Q_OBJECT + +public: + explicit About(QWidget *parent = nullptr); + ~About(); + +private: + Ui::About *ui; +}; + +#endif // ABOUT_H diff --git a/about.ui b/about.ui new file mode 100644 index 0000000..d5737ef --- /dev/null +++ b/about.ui @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>About</class> + <widget class="QDialog" name="About"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>About</string> + </property> + <widget class="QLabel" name="label_2"> + <property name="geometry"> + <rect> + <x>90</x> + <y>60</y> + <width>231</width> + <height>18</height> + </rect> + </property> + <property name="font"> + <font> + <pointsize>16</pointsize> + </font> + </property> + <property name="text"> + <string>Licensed with GPL-3.0</string> + </property> + </widget> + <widget class="QLabel" name="label"> + <property name="geometry"> + <rect> + <x>30</x> + <y>20</y> + <width>351</width> + <height>31</height> + </rect> + </property> + <property name="font"> + <font> + <pointsize>16</pointsize> + </font> + </property> + <property name="text"> + <string>AleePlayer 0.1 by Alee Productions</string> + </property> + </widget> + </widget> + <resources/> + <connections/> +</ui> @@ -1,6 +1,9 @@ #include <iostream> #include "player.h" #include "ui_player.h" +#include "about.h" +#include <QMediaPlayer> + Player::Player(QWidget *parent) : QMainWindow(parent) @@ -11,11 +14,28 @@ Player::Player(QWidget *parent) Player::~Player() { + std::cout << "Closing AleePlayer...\n"; + mPlayer->deleteLater(); delete ui; } void Player::on_actionQuit_triggered() { - std::cout << "Closing AleePlayer...\n"; close(); } + +void Player::on_pushButton_pressed() +{ + std::cout << "Playing music...\n"; + mPlayer->setMedia(QUrl::fromLocalFile("/home/andrew/Music/4616-werq-by-kevin-macleod.mp3")); + mPlayer->setVolume(50); + mPlayer->play(); +} + +void Player::on_actionAbout_triggered() +{ + std::cout << "Opening dialog\n"; + About about; + about.setModal(true); + about.exec(); +} @@ -1,5 +1,6 @@ #ifndef PLAYER_H #define PLAYER_H +#include <QMediaPlayer> #include <QMainWindow> @@ -14,10 +15,15 @@ class Player : public QMainWindow public: Player(QWidget *parent = nullptr); ~Player(); + QMediaPlayer* mPlayer = new QMediaPlayer(); private slots: void on_actionQuit_triggered(); + void on_pushButton_pressed(); + + void on_actionAbout_triggered(); + private: Ui::Player *ui; }; @@ -11,9 +11,23 @@ </rect> </property> <property name="windowTitle"> - <string>Player</string> + <string>AleePlayer</string> </property> - <widget class="QWidget" name="centralwidget"/> + <widget class="QWidget" name="centralwidget"> + <widget class="QPushButton" name="pushButton"> + <property name="geometry"> + <rect> + <x>10</x> + <y>20</y> + <width>88</width> + <height>34</height> + </rect> + </property> + <property name="text"> + <string>Play Audio</string> + </property> + </widget> + </widget> <widget class="QMenuBar" name="menubar"> <property name="geometry"> <rect> @@ -27,15 +41,10 @@ <property name="title"> <string>File</string> </property> + <addaction name="actionAbout"/> <addaction name="actionQuit"/> </widget> - <widget class="QMenu" name="menuAbout"> - <property name="title"> - <string>About</string> - </property> - </widget> <addaction name="menuFile"/> - <addaction name="menuAbout"/> </widget> <widget class="QStatusBar" name="statusbar"/> <action name="actionQuit"> @@ -43,6 +52,11 @@ <string>Quit</string> </property> </action> + <action name="actionAbout"> + <property name="text"> + <string>About</string> + </property> + </action> </widget> <resources/> <connections/> |
