Skip to content

Commit

Permalink
move 'load' to menu and 'pause' to front
Browse files Browse the repository at this point in the history
  • Loading branch information
BLumia committed Nov 3, 2022
1 parent 19494ea commit cf74d30
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/windows-msys2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
msystem: MINGW64
update: true
pacboy: >-
toolchain:p ninja:p cmake:p extra-cmake-modules:p
toolchain:p ninja:p cmake:p extra-cmake-modules:p icoutils:p
qt5-static:p bison: flex:
- name: Build
run: |
Expand Down
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ add_compile_definitions(PATH_VALSIZE=${PATH_VALSIZE})

add_executable(thplayer
main.cpp
loopedpcmstreamer.cpp
mainwindow.cpp
outputselectiondialog.cpp
songlist.cpp
thdatwrapper.cpp
loopedpcmstreamer.cpp loopedpcmstreamer.hpp
mainwindow.cpp mainwindow.hpp
outputselectiondialog.cpp outputselectiondialog.hpp
songlist.cpp songlist.hpp
thdatwrapper.cpp thdatwrapper.hpp

mainwindow.ui
outputselectiondialog.ui
Expand Down
26 changes: 21 additions & 5 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,6 @@ void MainWindow::seek()
st->seek_sample(ui->progressslider->value() / 100. * (cursong.length / 4.)); //TODO: don't hardcode the 4 here
}

void MainWindow::on_playButton_clicked()
{
LoadFile(QFileDialog::getExistingDirectory(this, "Select game directory"));
}

QAudioFormat MainWindow::getAudioFormat(unsigned rate)
{
QAudioFormat audioFormat;
Expand Down Expand Up @@ -368,3 +363,24 @@ void MainWindow::on_pauseButton_clicked(bool checked)
if (checked) audioOutput->suspend();
else audioOutput->resume();
}

void MainWindow::on_action_Open_triggered()
{
LoadFile(QFileDialog::getExistingDirectory(this, "Select game directory"));
}


void MainWindow::on_actionAbout_Qt_triggered()
{
qApp->aboutQt();
}


void MainWindow::on_action_About_triggered()
{
QMessageBox::about(this, "About TouHou Player",
QString("TouHou Player") + "\n"
"TouHou BGM player for all platform." + "\n\n" +
"https:://github.com/BearKidsTeam/thplayer");
}

4 changes: 3 additions & 1 deletion mainwindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@ private slots:
void dropEvent(QDropEvent *event);
void updateWidgets();
void seek();
void on_playButton_clicked();
void on_playlistTable_doubleClicked(const QModelIndex &index);
void on_loopButton_clicked();
void on_prevButton_clicked();
void on_nextButton_clicked();
void on_pauseButton_clicked(bool checked);
void on_action_Open_triggered();
void on_actionAbout_Qt_triggered();
void on_action_About_triggered();
};

#endif // MAINWINDOW_H
95 changes: 59 additions & 36 deletions mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,13 @@
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="0">
<widget class="QPushButton" name="playButton">
<property name="text">
<string>Load</string>
</property>
</widget>
</item>
<item row="3" column="6">
<widget class="QPushButton" name="loopButton">
<property name="text">
<string>Loop: On</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QPushButton" name="nextButton">
<property name="text">
<string>Next</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="7">
<widget class="QLabel" name="songnameLabel">
<property name="text">
Expand Down Expand Up @@ -112,26 +98,6 @@
</widget>
</widget>
</item>
<item row="3" column="5">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="prevButton">
<property name="text">
<string>Prev</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="7">
<widget class="QClickableSlider" name="progressslider">
<property name="orientation">
Expand All @@ -146,7 +112,7 @@
</property>
</widget>
</item>
<item row="3" column="4">
<item row="3" column="0">
<widget class="QPushButton" name="pauseButton">
<property name="enabled">
<bool>false</bool>
Expand All @@ -159,6 +125,33 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="prevButton">
<property name="text">
<string>Prev</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="nextButton">
<property name="text">
<string>Next</string>
</property>
</widget>
</item>
<item row="3" column="3" colspan="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
Expand All @@ -167,10 +160,40 @@
<x>0</x>
<y>0</y>
<width>686</width>
<height>31</height>
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="menu_File">
<property name="title">
<string>&amp;File</string>
</property>
<addaction name="action_Open"/>
</widget>
<widget class="QMenu" name="menu_Help">
<property name="title">
<string>&amp;Help</string>
</property>
<addaction name="action_About"/>
<addaction name="actionAbout_Qt"/>
</widget>
<addaction name="menu_File"/>
<addaction name="menu_Help"/>
</widget>
<action name="action_Open">
<property name="text">
<string>&amp;Open</string>
</property>
</action>
<action name="actionAbout_Qt">
<property name="text">
<string>About &amp;Qt</string>
</property>
</action>
<action name="action_About">
<property name="text">
<string>&amp;About...</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
Expand Down

0 comments on commit cf74d30

Please sign in to comment.