Skip to content

Commit

Permalink
feat: Play/Pause icons in Nothings style
Browse files Browse the repository at this point in the history
  • Loading branch information
SebiAi committed Jan 30, 2024
1 parent 68ada66 commit 9858ed8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions assets/icons/media/media_pause.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/icons/media/media_play.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@
<file alias="led_c1_zones">assets/glyphs/phone2/led_c1_zones.svg</file>
<file alias="led_d_zones">assets/glyphs/phone2/led_d_zones.svg</file>
</qresource>
<qresource prefix="/icons">
<file alias="media_pause">assets/icons/media/media_pause.svg</file>
<file alias="media_play">assets/icons/media/media_play.svg</file>
</qresource>
</RCC>
6 changes: 3 additions & 3 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ MainWindow::MainWindow(QWidget *parent)

// Play button
this->playPauseButton = new QToolButton();
this->playPauseButton->setIcon(this->style()->standardIcon(QStyle::StandardPixmap::SP_MediaPlay));
this->playPauseButton->setIcon(this->iconMediaPlay);
this->playPauseButton->setIconSize(QSize(40, 40));
this->playPauseButton->setAutoRaise(true);
playerControlsLayout->addWidget(this->playPauseButton);
Expand Down Expand Up @@ -424,13 +424,13 @@ void MainWindow::glyphWidget_onPlaybackStateChanged(QMediaPlayer::PlaybackState
switch (newState)
{
case QMediaPlayer::PlaybackState::PlayingState:
this->playPauseButton->setIcon(this->style()->standardIcon(QStyle::StandardPixmap::SP_MediaPause));
this->playPauseButton->setIcon(this->iconMediaPause);
break;
case QMediaPlayer::PlaybackState::StoppedState:
// Stop the player to reset the position to 0
this->glyphWidget->compositionManager->player->stop();
case QMediaPlayer::PlaybackState::PausedState:
this->playPauseButton->setIcon(this->style()->standardIcon(QStyle::StandardPixmap::SP_MediaPlay));
this->playPauseButton->setIcon(this->iconMediaPlay);
break;
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ class MainWindow : public QMainWindow
SeekBarStyle *seekBarStyle;
QLabel *lengthTimeLabel;

const QIcon iconMediaPlay = QIcon(":/icons/media_play"); // Doesn't work when static - probably because of the QPaintDevice inside which needs a QApplication instance
const QIcon iconMediaPause = QIcon(":/icons/media_pause"); // Doesn't work when static - probably because of the QPaintDevice inside which needs a QApplication instance

Config *config = nullptr;

UpdateChecker *updateChecker;
Expand Down

0 comments on commit 9858ed8

Please sign in to comment.