chore: add about dialog

to make it easier to know if taglib and/or libchardet are used.
This commit is contained in:
Gary Wang 2024-09-23 19:48:26 +08:00
parent b88ee1d0f1
commit 618a350e0d
No known key found for this signature in database
GPG Key ID: 5D30A4F15EA78760
4 changed files with 47 additions and 8 deletions

View File

@ -68,19 +68,13 @@ if (WIN32)
endif () endif ()
if (NOT TagLib_FOUND) if (NOT TagLib_FOUND)
message (WARNING "TagLib not found!") target_compile_definitions(${EXE_NAME} PRIVATE NO_TAGLIB=1)
target_compile_definitions(${EXE_NAME} PRIVATE
NO_TAGLIB=1
)
else () else ()
target_link_libraries(${EXE_NAME} PRIVATE PkgConfig::TagLib) target_link_libraries(${EXE_NAME} PRIVATE PkgConfig::TagLib)
endif () endif ()
if (NOT uchardet_FOUND) if (NOT uchardet_FOUND)
message (WARNING "uchardet not found!") target_compile_definitions(${EXE_NAME} PRIVATE NO_UCHARDET=1)
target_compile_definitions(${EXE_NAME} PRIVATE
NO_UCHARDET=1
)
else () else ()
target_link_libraries (${EXE_NAME} PRIVATE uchardet::libuchardet) target_link_libraries (${EXE_NAME} PRIVATE uchardet::libuchardet)
endif () endif ()

View File

@ -29,6 +29,8 @@
#include <QStandardPaths> #include <QStandardPaths>
#include <QMediaDevices> #include <QMediaDevices>
#include <QAudioDevice> #include <QAudioDevice>
#include <QMessageBox>
#include <QStringBuilder>
constexpr QSize miniSize(490, 160); constexpr QSize miniSize(490, 160);
constexpr QSize fullSize(490, 420); constexpr QSize fullSize(490, 420);
@ -50,6 +52,9 @@ MainWindow::MainWindow(QWidget *parent)
m_mediaPlayer->setLoops(QMediaPlayer::Infinite); m_mediaPlayer->setLoops(QMediaPlayer::Infinite);
ui->playlistView->setModel(m_playlistManager->model()); ui->playlistView->setModel(m_playlistManager->model());
ui->actionHelp->setShortcut(QKeySequence::HelpContents);
addAction(ui->actionHelp);
setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint); setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint);
setAttribute(Qt::WA_TranslucentBackground, true); setAttribute(Qt::WA_TranslucentBackground, true);
@ -599,3 +604,31 @@ void MainWindow::on_lrcBtn_clicked()
} }
} }
void MainWindow::on_actionHelp_triggered()
{
QMessageBox infoBox(this);
infoBox.setIcon(QMessageBox::Information);
infoBox.setWindowTitle(tr("About"));
infoBox.setStandardButtons(QMessageBox::Ok);
infoBox.setText(
tr("Pineapple Music") %
"\n\n" %
tr("Based on the following free software libraries:") %
"\n\n" %
QStringLiteral("- [Qt](https://www.qt.io/) %1\n").arg(QT_VERSION_STR) %
#ifndef NO_TAGLIB
QStringLiteral("- [TagLib](https://github.com/taglib/taglib)\n") %
#endif // NO_TAGLIB
#ifndef NO_UCHARDET
QStringLiteral("- [uchardet](https://www.freedesktop.org/wiki/Software/uchardet/)\n") %
#endif // NO_TAGLIB
"\n"
"[Source Code](https://github.com/BLumia/pineapple-music)\n"
"\n"
"Copyright &copy; 2024 [BLumia](https://github.com/BLumia/)"
);
infoBox.setTextFormat(Qt::MarkdownText);
infoBox.exec();
}

View File

@ -75,6 +75,7 @@ private slots:
void on_playListBtn_clicked(); void on_playListBtn_clicked();
void on_playlistView_activated(const QModelIndex &index); void on_playlistView_activated(const QModelIndex &index);
void on_lrcBtn_clicked(); void on_lrcBtn_clicked();
void on_actionHelp_triggered();
signals: signals:
void playbackModeChanged(enum PlaybackMode mode); void playbackModeChanged(enum PlaybackMode mode);

View File

@ -657,6 +657,17 @@ QListView {
</item> </item>
</layout> </layout>
</widget> </widget>
<action name="actionHelp">
<property name="text">
<string>help</string>
</property>
<property name="shortcut">
<string>F1</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>