From 29e2434dd9ca1eb37625b094a3e9a03fcb88302e Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Wed, 22 Jan 2020 21:08:59 -0500 Subject: UI change and working volume slider --- about.ui | 136 +++++++++++++++++++------------ player.cpp | 20 +++-- player.h | 2 + player.ui | 268 ++++++++++++++++++++++++++++++++++++++----------------------- 4 files changed, 267 insertions(+), 159 deletions(-) diff --git a/about.ui b/about.ui index 41e5125..e8751e5 100644 --- a/about.ui +++ b/about.ui @@ -28,56 +28,83 @@ false - - - - 130 - 70 - 215 - 30 - - - - - 16 - - - - Licensed with GPL-3.0 - - - - - - 80 - 30 - 371 - 30 - - - - - 16 - - - - AleePlayer 0.1 by Alee Productions - - - - - - 20 - 130 - 471 - 241 - - - - true - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 8 + 21 + + + + + + + + + 16 + + + + AleePlayer 0.1 by Alee Productions + + + Qt::AlignCenter + + + + + + + + 16 + + + + Licensed with GPL-3.0 + + + Qt::AlignCenter + + + + + + + Website: https://alee-productions.xyz + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> @@ -98,9 +125,14 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans';"> You should have received a copy of the GNU General Public License</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans';"> along with this program. If not, see &lt;https://www.gnu.org/licenses/&gt;.</span></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Noto Sans';"><br /></p></body></html> - - + + + + + + licenseText + diff --git a/player.cpp b/player.cpp index dd95b23..e618afc 100644 --- a/player.cpp +++ b/player.cpp @@ -27,6 +27,7 @@ void Player::mFileDialog() msgbox.setText("This audio file has been loaded."); msgbox.setIcon(QMessageBox::Information); msgbox.exec(); + ui->volumeSlider->setValue(100); return; } } @@ -37,8 +38,6 @@ Player::Player(QWidget *parent) : QMainWindow(parent) , ui(new Ui::Player) { - QSlider volumeSlider; - //connect() ui->setupUi(this); } @@ -57,15 +56,16 @@ void Player::on_actionQuit_triggered() void Player::on_playButton_pressed() { - QPushButton playButton; + ui->playbackSlider->setEnabled(true); + ui->volumeSlider->setEnabled(true); if (mPlayer->state() == mPlayer->PlayingState) { qDebug() << "Pausing music..."; mPlayer->pause(); - playButton.setText("Pause"); + ui->playButton->setText("Pause"); } else { qDebug() << "Playing music..."; mPlayer->play(); - playButton.setText("Play"); + ui->playButton->setText("Play"); } } @@ -73,6 +73,10 @@ void Player::on_stopButton_pressed() { qInfo() << "Stopping music..."; mPlayer->stop(); + ui->volumeSlider->setEnabled(false); + ui->volumeSlider->setValue(100); + ui->playbackSlider->setEnabled(false); + ui->playbackSlider->setValue(0); } void Player::on_actionAbout_triggered() @@ -91,3 +95,9 @@ void Player::on_actionOpen_triggered() { mFileDialog(); } + + +void Player::on_volumeSlider_sliderMoved(int position) +{ + mPlayer->setVolume(position); +} diff --git a/player.h b/player.h index d8424f2..fae3e58 100644 --- a/player.h +++ b/player.h @@ -32,6 +32,8 @@ private slots: void mFileDialog(); + void on_volumeSlider_sliderMoved(int position); + private: Ui::Player *ui; }; diff --git a/player.ui b/player.ui index 2128933..4df7103 100644 --- a/player.ui +++ b/player.ui @@ -14,108 +14,166 @@ AleePlayer - - - - 20 - 500 - 80 - 26 - - - - Set Media - - - false - - - - - - 280 - 500 - 80 - 26 - - - - Play/Pause - - - false - - - false - - - false - - - - - - 560 - 500 - 211 - 31 - - - - 0 - - - Qt::Horizontal - - - QSlider::NoTicks - - - 0 - - - - - - 400 - 500 - 80 - 26 - - - - Stop - - - false - - - - - - 650 - 530 - 51 - 18 - - - - Volume - - - - - - 40 - 445 - 741 - 31 - - - - Qt::Horizontal - - + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + false + + + 99 + + + Qt::Horizontal + + + QSlider::NoTicks + + + 0 + + + + + + + Volume + + + + + + + 0 + + + + Library + + + + + + + 14 + + + + <html><head/><body><p>Coming soon in a later update!</p></body></html> + + + Qt::AlignCenter + + + + + + + + Playlist + + + + + + + + false + + + Qt::Horizontal + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Play + + + false + + + false + + + false + + + + + + + Stop + + + false + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Browse + + + false + + + + @@ -142,6 +200,9 @@ Quit + + Ctrl+W + @@ -152,6 +213,9 @@ Open + + Ctrl+O + -- cgit v1.2.3