mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-08-12 20:55:39 +08:00
@@ -1,10 +1,7 @@
|
||||
<!--
|
||||
SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors
|
||||
SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
-->
|
||||
|
||||
# Changelog
|
||||
|
||||
---
|
||||
|
||||
## swift 0.16.0 (XX.XX.20XX)
|
||||
|
||||
### Features
|
||||
|
||||
@@ -238,3 +238,9 @@ path = "src/sound/share/sounds/supervisormessage.wav"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "Notification.wav by finn.appleton -- https://freesound.org/s/560880/ -- License: Creative Commons 0; Modified by swift contributors"
|
||||
SPDX-License-Identifier = "CC0-1.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "CHANGELOG.md"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "Copyright (C) swift Project Community / Contributors"
|
||||
SPDX-License-Identifier = "GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1"
|
||||
|
||||
@@ -8,4 +8,10 @@ add_custom_command(TARGET resources
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different share/ ${PROJECT_BINARY_DIR}/out/share/
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_custom_command(TARGET resources
|
||||
PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${PROJECT_SOURCE_DIR}/CHANGELOG.md
|
||||
${PROJECT_BINARY_DIR}/out/share/CHANGELOG.md)
|
||||
|
||||
install(DIRECTORY share/ DESTINATION ${CMAKE_INSTALL_PREFIX}/share)
|
||||
install(FILES ${PROJECT_SOURCE_DIR}/CHANGELOG.md DESTINATION ${CMAKE_INSTALL_PREFIX}/share)
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <QCloseEvent>
|
||||
#include <QCommandLineParser>
|
||||
#include <QDesktopServices>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QDir>
|
||||
#include <QEventLoop>
|
||||
#include <QFont>
|
||||
@@ -22,9 +23,11 @@
|
||||
#include <QStringList>
|
||||
#include <QStyle>
|
||||
#include <QStyleFactory>
|
||||
#include <QTextBrowser>
|
||||
#include <QToolBar>
|
||||
#include <QUrl>
|
||||
#include <QWhatsThis>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
#include <Qt>
|
||||
#include <QtGlobal>
|
||||
@@ -765,6 +768,11 @@ namespace swift::gui
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||
Q_UNUSED(c)
|
||||
|
||||
a = menu.addAction(QApplication::windowIcon(), "Changelog");
|
||||
c = connect(a, &QAction::triggered, this, [=, this]() { this->showChangelog(); });
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||
Q_UNUSED(c)
|
||||
|
||||
// https://joekuan.wordpress.com/2015/09/23/list-of-qt-icons/
|
||||
a = menu.addAction(QApplication::style()->standardIcon(QStyle::SP_TitleBarMenuButton), "About Qt");
|
||||
c = connect(a, &QAction::triggered, this, []() { QApplication::aboutQt(); });
|
||||
@@ -780,6 +788,40 @@ namespace swift::gui
|
||||
QDesktopServices::openUrl(helpPage);
|
||||
}
|
||||
|
||||
void CGuiApplication::showChangelog() const
|
||||
{
|
||||
if (this->isShuttingDown()) { return; }
|
||||
|
||||
QWidget *parent = CGuiApplication::mainApplicationWidget();
|
||||
if (!parent) { return; }
|
||||
|
||||
const QString changelogPath = CFileUtils::appendFilePaths(CSwiftDirectories::shareDirectory(), "CHANGELOG.md");
|
||||
const QString changelog = CFileUtils::readFileToString(changelogPath);
|
||||
if (changelog.isEmpty())
|
||||
{
|
||||
QMessageBox::warning(parent, QGuiApplication::applicationDisplayName(),
|
||||
QStringLiteral("Unable to load changelog from %1").arg(changelogPath));
|
||||
return;
|
||||
}
|
||||
|
||||
QDialog dialog(parent);
|
||||
dialog.setWindowTitle(QStringLiteral("Changelog"));
|
||||
dialog.setWindowFlags(dialog.windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
||||
auto *layout = new QVBoxLayout(&dialog);
|
||||
auto *browser = new QTextBrowser(&dialog);
|
||||
browser->setMarkdown(changelog);
|
||||
browser->setOpenExternalLinks(true);
|
||||
layout->addWidget(browser);
|
||||
|
||||
auto *buttons = new QDialogButtonBox(QDialogButtonBox::Ok, &dialog);
|
||||
connect(buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
|
||||
layout->addWidget(buttons);
|
||||
|
||||
dialog.resize(900, 700);
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
const CStyleSheetUtility &CGuiApplication::getStyleSheetUtility() const { return m_styleSheetUtility; }
|
||||
|
||||
QString CGuiApplication::getWidgetStyle() const
|
||||
|
||||
@@ -160,6 +160,9 @@ namespace swift::gui
|
||||
//! Show help page (online help)
|
||||
void showHelp(const QString &subpath = {}) const;
|
||||
|
||||
//! Show changelog popup
|
||||
void showChangelog() const;
|
||||
|
||||
//! Style sheet handling
|
||||
const CStyleSheetUtility &getStyleSheetUtility() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user