Add auto-generated Git version to window titles

This commit is contained in:
Connor McLaughlin
2020-04-17 01:56:11 +10:00
parent 610ebcf2fa
commit 277c03aca0
17 changed files with 642 additions and 8 deletions

View File

@ -48,7 +48,7 @@ add_executable(duckstation-qt
settingsdialog.ui
)
target_link_libraries(duckstation-qt PRIVATE frontend-common core common imgui glad minizip Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Network)
target_link_libraries(duckstation-qt PRIVATE frontend-common core common imgui glad minizip scmversion Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Network)
if(WIN32)
target_sources(duckstation-qt PRIVATE

View File

@ -95,6 +95,9 @@
<ProjectReference Include="..\frontend-common\frontend-common.vcxproj">
<Project>{6245dec8-d2da-47ee-a373-cbd6fcf3ece6}</Project>
</ProjectReference>
<ProjectReference Include="..\scmversion\scmversion.vcxproj">
<Project>{075ced82-6a20-46df-94c7-9624ac9ddbeb}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<QtUi Include="audiosettingswidget.ui">

View File

@ -8,6 +8,7 @@
#include "qtdisplaywidget.h"
#include "qthostinterface.h"
#include "qtsettingsinterface.h"
#include "scmversion/scmversion.h"
#include "settingsdialog.h"
#include "settingwidgetbinder.h"
#include <QtCore/QDebug>
@ -24,6 +25,11 @@ static constexpr char DISC_IMAGE_FILTER[] =
"All File Types (*.bin *.img *.cue *.chd *.exe *.psexe);;Single-Track Raw Images (*.bin *.img);;Cue Sheets "
"(*.cue);;MAME CHD Images (*.chd);;PlayStation Executables (*.exe *.psexe);;Portable Sound Format Files (*.psf)";
ALWAYS_INLINE static QString getWindowTitle()
{
return QStringLiteral("DuckStation %1 (%2)").arg(g_scm_tag_str).arg(g_scm_branch_str);
}
MainWindow::MainWindow(QtHostInterface* host_interface) : QMainWindow(nullptr), m_host_interface(host_interface)
{
m_host_interface->setMainWindow(this);
@ -209,7 +215,7 @@ void MainWindow::onRunningGameChanged(const QString& filename, const QString& ga
{
m_host_interface->populateSaveStateMenus(game_code.toStdString().c_str(), m_ui.menuLoadState, m_ui.menuSaveState);
if (game_title.isEmpty())
setWindowTitle(tr("DuckStation"));
setWindowTitle(getWindowTitle());
else
setWindowTitle(game_title);
@ -368,6 +374,8 @@ void MainWindow::onGameListContextMenuRequested(const QPoint& point, const GameL
void MainWindow::setupAdditionalUi()
{
setWindowTitle(getWindowTitle());
m_game_list_widget = new GameListWidget(m_ui.mainContainer);
m_game_list_widget->initialize(m_host_interface);
m_ui.mainContainer->insertWidget(0, m_game_list_widget);