2021-06-11 19:24:52 +02:00
// MassBuilderSaveTool
2022-01-30 11:36:56 +01:00
// Copyright (C) 2021-2022 Guillaume Jacquemin
2021-06-11 19:24:52 +02:00
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
# include "SaveTool.h"
# include <Corrade/version.h>
2022-03-04 21:18:55 +01:00
# include <Corrade/Containers/StringView.h>
2021-06-11 19:24:52 +02:00
# include <Magnum/version.h>
# include <Magnum/versionIntegration.h>
# include <Magnum/ImGuiIntegration/Integration.h>
# include <zipconf.h>
# include "../FontAwesome/IconsFontAwesome5.h"
# include "../FontAwesome/IconsFontAwesome5Brands.h"
extern const ImVec2 center_pivot ;
void SaveTool : : drawAbout ( ) {
ImGui : : SetNextWindowPos ( ImVec2 { Vector2 { windowSize ( ) / 2.0f } } , ImGuiCond_Always , center_pivot ) ;
ImGui : : SetNextWindowSize ( { windowSize ( ) . x ( ) * 0.8f , windowSize ( ) . y ( ) * 0.75f } , ImGuiCond_Always ) ;
ImGui : : OpenPopup ( " About##AboutPopup " ) ;
if ( ! ImGui : : BeginPopupModal ( " About##AboutPopup " , & _aboutPopup ,
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse ) )
{
return ;
}
if ( ImGui : : BeginTable ( " ##TitleTable " , 3 ) ) {
ImGui : : TableSetupColumn ( " ##Empty1 " , ImGuiTableColumnFlags_WidthStretch ) ;
ImGui : : TableSetupColumn ( " ##Button " , ImGuiTableColumnFlags_WidthFixed ) ;
ImGui : : TableSetupColumn ( " ##Empty2 " , ImGuiTableColumnFlags_WidthStretch ) ;
ImGui : : TableNextRow ( ) ;
ImGui : : TableSetColumnIndex ( 1 ) ;
2021-07-13 18:46:21 +02:00
ImGui : : TextUnformatted ( SDL_GetWindowTitle ( window ( ) ) ) ;
2021-06-11 19:24:52 +02:00
ImGui : : EndTable ( ) ;
}
ImGui : : Dummy ( { 0.0f , ImGui : : GetFontSize ( ) } ) ;
ImGui : : TextWrapped ( " This application, made for the M.A.S.S. Builder community by Guillaume Jacquemin (aka William JCM), "
" is a rewrite of the wxWidgets-powered M.A.S.S. Builder Save Tool (formerly known as wxMASSManager). " ) ;
2022-03-31 19:19:59 +02:00
auto website = " https://williamjcm.ovh/coding/mbst " ;
drawAlignedText ( ICON_FA_GLOBE " %s " , website ) ;
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Copy to clipboard " ) ) {
ImGui : : SetClipboardText ( website ) ;
}
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Open in browser " ) ) {
openUri ( website ) ;
}
2022-03-04 21:18:55 +01:00
auto repo = " https://williamjcm.ovh/git/williamjcm/MassBuilderSaveTool " ;
2022-02-23 21:59:00 +01:00
drawAlignedText ( ICON_FA_GIT_ALT " %s " , repo ) ;
2021-06-11 19:24:52 +02:00
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Copy to clipboard " ) ) {
ImGui : : SetClipboardText ( repo ) ;
}
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Open in browser " ) ) {
openUri ( repo ) ;
}
ImGui : : Separator ( ) ;
if ( ImGui : : CollapsingHeader ( " Licence " ) ) {
ImGui : : TextWrapped ( " This application is made available under the terms of the GNU General Public License, version 3, the full text of which is available below: " ) ;
if ( ImGui : : BeginChild ( " ##GPL " , { 0.0f , windowSize ( ) . y ( ) * 0.3f } , true ) ) {
2022-03-04 21:18:55 +01:00
static auto licence = _rs . getRaw ( " COPYING " ) ;
2021-06-11 19:24:52 +02:00
ImGui : : PushFont ( ImGui : : GetIO ( ) . Fonts - > Fonts [ 1 ] ) ;
2022-03-31 19:19:59 +02:00
ImGui : : TextEx ( licence . data ( ) , licence . data ( ) + licence . size ( ) , ImGuiTextFlags_None ) ;
2021-06-11 19:24:52 +02:00
ImGui : : PopFont ( ) ;
}
ImGui : : EndChild ( ) ;
}
if ( ImGui : : CollapsingHeader ( " Third-party components " ) ) {
ImGui : : TextWrapped ( " This application uses the following third-party components: " ) ;
ImGui : : PushStyleVar ( ImGuiStyleVar_IndentSpacing , 0.0f ) ;
if ( ImGui : : TreeNodeEx ( " Corrade " , ImGuiTreeNodeFlags_SpanAvailWidth ) ) {
ImGui : : Text ( " Version used: %s " , CORRADE_VERSION_STRING ) ;
2022-03-04 21:18:55 +01:00
auto corrade_website = " https://magnum.graphics/corrade " ;
2022-02-23 21:59:00 +01:00
drawAlignedText ( ICON_FA_GLOBE " %s " , corrade_website ) ;
2021-06-11 19:24:52 +02:00
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Copy to clipboard " ) ) {
ImGui : : SetClipboardText ( corrade_website ) ;
}
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Open in browser " ) ) {
openUri ( corrade_website ) ;
}
ImGui : : TextUnformatted ( " Licence: MIT " ) ;
2022-03-04 21:18:55 +01:00
static auto corrade_licence = _rs . getRaw ( " COPYING.Corrade " ) ;
2021-06-11 19:24:52 +02:00
if ( ImGui : : BeginChild ( " ##CorradeLicence " , { 0.0f , windowSize ( ) . y ( ) * 0.3f } , true ) ) {
ImGui : : PushFont ( ImGui : : GetIO ( ) . Fonts - > Fonts [ 1 ] ) ;
2022-03-31 19:19:59 +02:00
ImGui : : TextEx ( corrade_licence . data ( ) , corrade_licence . data ( ) + corrade_licence . size ( ) , ImGuiTextFlags_None ) ;
2021-06-11 19:24:52 +02:00
ImGui : : PopFont ( ) ;
}
ImGui : : EndChild ( ) ;
ImGui : : TreePop ( ) ;
}
if ( ImGui : : TreeNodeEx ( " Magnum and integration libraries " , ImGuiTreeNodeFlags_SpanAvailWidth ) ) {
ImGui : : TextUnformatted ( " Versions used: " ) ;
ImGui : : BulletText ( " Magnum: %s " , MAGNUM_VERSION_STRING ) ;
ImGui : : BulletText ( " Integration: %s " , MAGNUMINTEGRATION_VERSION_STRING ) ;
2022-03-04 21:18:55 +01:00
auto magnum_website = " https://magnum.graphics " ;
2022-02-23 21:59:00 +01:00
drawAlignedText ( ICON_FA_GLOBE " %s " , magnum_website ) ;
2021-06-11 19:24:52 +02:00
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Copy to clipboard " ) ) {
ImGui : : SetClipboardText ( magnum_website ) ;
}
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Open in browser " ) ) {
openUri ( magnum_website ) ;
}
ImGui : : TextUnformatted ( " Licence: MIT " ) ;
2022-03-04 21:18:55 +01:00
static auto magnum_licence = _rs . getRaw ( " COPYING.Magnum " ) ;
2021-06-11 19:24:52 +02:00
if ( ImGui : : BeginChild ( " ##MagnumLicence " , { 0.0f , windowSize ( ) . y ( ) * 0.3f } , true ) ) {
ImGui : : PushFont ( ImGui : : GetIO ( ) . Fonts - > Fonts [ 1 ] ) ;
2022-03-31 19:19:59 +02:00
ImGui : : TextEx ( magnum_licence . data ( ) , magnum_licence . data ( ) + magnum_licence . size ( ) , ImGuiTextFlags_None ) ;
2021-06-11 19:24:52 +02:00
ImGui : : PopFont ( ) ;
}
ImGui : : EndChild ( ) ;
ImGui : : TreePop ( ) ;
}
if ( ImGui : : TreeNodeEx ( " Dear ImGui " , ImGuiTreeNodeFlags_SpanAvailWidth ) ) {
ImGui : : Text ( " Version used: %s " , IMGUI_VERSION ) ;
2022-03-04 21:18:55 +01:00
auto imgui_repo = " https://github.com/ocornut/imgui " ;
2022-02-23 21:59:00 +01:00
drawAlignedText ( ICON_FA_GITHUB " %s " , imgui_repo ) ;
2021-06-11 19:24:52 +02:00
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Copy to clipboard " ) ) {
ImGui : : SetClipboardText ( imgui_repo ) ;
}
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Open in browser " ) ) {
openUri ( imgui_repo ) ;
}
ImGui : : TextUnformatted ( " Licence: MIT " ) ;
2022-03-04 21:18:55 +01:00
static auto imgui_licence = _rs . getRaw ( " LICENSE.ImGui " ) ;
2021-06-11 19:24:52 +02:00
if ( ImGui : : BeginChild ( " ##ImGuiLicence " , { 0.0f , windowSize ( ) . y ( ) * 0.3f } , true ) ) {
ImGui : : PushFont ( ImGui : : GetIO ( ) . Fonts - > Fonts [ 1 ] ) ;
2022-03-31 19:19:59 +02:00
ImGui : : TextEx ( imgui_licence . data ( ) , imgui_licence . data ( ) + imgui_licence . size ( ) , ImGuiTextFlags_None ) ;
2021-06-11 19:24:52 +02:00
ImGui : : PopFont ( ) ;
}
ImGui : : EndChild ( ) ;
ImGui : : TreePop ( ) ;
}
if ( ImGui : : TreeNodeEx ( " Simple DirectMedia Layer (SDL) 2 " , ImGuiTreeNodeFlags_SpanAvailWidth ) ) {
ImGui : : Text ( " Version used: %i.%i.%i " , SDL_MAJOR_VERSION , SDL_MINOR_VERSION , SDL_PATCHLEVEL ) ;
2022-03-04 21:18:55 +01:00
auto sdl_website = " https://www.libsdl.org/ " ;
2022-02-23 21:59:00 +01:00
drawAlignedText ( ICON_FA_GLOBE " %s " , sdl_website ) ;
2021-06-11 19:24:52 +02:00
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Copy to clipboard " ) ) {
ImGui : : SetClipboardText ( sdl_website ) ;
}
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Open in browser " ) ) {
openUri ( sdl_website ) ;
}
ImGui : : TextUnformatted ( " Licence: zlib " ) ;
2022-03-04 21:18:55 +01:00
static auto sdl_licence = _rs . getRaw ( " LICENSE.SDL " ) ;
2021-06-11 19:24:52 +02:00
if ( ImGui : : BeginChild ( " ##SDLLicence " , { 0.0f , windowSize ( ) . y ( ) * 0.3f } , true ) ) {
ImGui : : PushFont ( ImGui : : GetIO ( ) . Fonts - > Fonts [ 1 ] ) ;
2022-03-31 19:19:59 +02:00
ImGui : : TextEx ( sdl_licence . data ( ) , sdl_licence . data ( ) + sdl_licence . size ( ) , ImGuiTextFlags_None ) ;
2021-06-11 19:24:52 +02:00
ImGui : : PopFont ( ) ;
}
ImGui : : EndChild ( ) ;
ImGui : : TreePop ( ) ;
}
if ( ImGui : : TreeNodeEx ( " libzip " , ImGuiTreeNodeFlags_SpanAvailWidth ) ) {
ImGui : : Text ( " Version used: %s " , LIBZIP_VERSION ) ;
2022-03-04 21:18:55 +01:00
auto libzip_website = " https://libzip.org/ " ;
2022-02-23 21:59:00 +01:00
drawAlignedText ( ICON_FA_GLOBE " %s " , libzip_website ) ;
2021-06-11 19:24:52 +02:00
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Copy to clipboard " ) ) {
ImGui : : SetClipboardText ( libzip_website ) ;
}
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Open in browser " ) ) {
openUri ( libzip_website ) ;
}
ImGui : : TextUnformatted ( " Licence: 3-clause BSD " ) ;
2022-03-04 21:18:55 +01:00
static auto libzip_licence = _rs . getRaw ( " LICENSE.libzip " ) ;
2021-06-11 19:24:52 +02:00
if ( ImGui : : BeginChild ( " ##libzipLicence " , { 0.0f , windowSize ( ) . y ( ) * 0.3f } , true ) ) {
ImGui : : PushFont ( ImGui : : GetIO ( ) . Fonts - > Fonts [ 1 ] ) ;
2022-03-31 19:19:59 +02:00
ImGui : : TextEx ( libzip_licence . data ( ) , libzip_licence . data ( ) + libzip_licence . size ( ) , ImGuiTextFlags_None ) ;
2021-06-11 19:24:52 +02:00
ImGui : : PopFont ( ) ;
}
ImGui : : EndChild ( ) ;
ImGui : : TreePop ( ) ;
}
if ( ImGui : : TreeNodeEx ( " Entropia File System Watcher (efsw) " , ImGuiTreeNodeFlags_SpanAvailWidth ) ) {
2022-03-04 21:18:55 +01:00
auto efsw_repo = " https://github.com/SpartanJ/efsw " ;
2022-02-23 21:59:00 +01:00
drawAlignedText ( ICON_FA_GITHUB " %s " , efsw_repo ) ;
2021-06-11 19:24:52 +02:00
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Copy to clipboard " ) ) {
2022-03-06 09:25:23 +01:00
ImGui : : SetClipboardText ( efsw_repo ) ;
2021-06-11 19:24:52 +02:00
}
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Open in browser " ) ) {
openUri ( efsw_repo ) ;
}
ImGui : : TextUnformatted ( " Licence: MIT " ) ;
2022-03-04 21:18:55 +01:00
static auto efsw_licence = _rs . getRaw ( " LICENSE.efsw " ) ;
2021-06-11 19:24:52 +02:00
if ( ImGui : : BeginChild ( " ##efswLicence " , { 0.0f , windowSize ( ) . y ( ) * 0.3f } , true ) ) {
ImGui : : PushFont ( ImGui : : GetIO ( ) . Fonts - > Fonts [ 1 ] ) ;
2022-03-31 19:19:59 +02:00
ImGui : : TextEx ( efsw_licence . data ( ) , efsw_licence . data ( ) + efsw_licence . size ( ) , ImGuiTextFlags_None ) ;
2021-06-11 19:24:52 +02:00
ImGui : : PopFont ( ) ;
}
ImGui : : EndChild ( ) ;
ImGui : : TreePop ( ) ;
}
2022-03-31 19:19:59 +02:00
if ( ImGui : : TreeNodeEx ( " libcurl " , ImGuiTreeNodeFlags_SpanAvailWidth ) ) {
auto curl_website = " https://curl.se/libcurl " ;
drawAlignedText ( ICON_FA_GLOBE " %s " , curl_website ) ;
2021-07-28 14:27:44 +02:00
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Copy to clipboard " ) ) {
2022-03-31 19:19:59 +02:00
ImGui : : SetClipboardText ( curl_website ) ;
2021-07-28 14:27:44 +02:00
}
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Open in browser " ) ) {
2022-03-31 19:19:59 +02:00
openUri ( curl_website ) ;
2021-07-28 14:27:44 +02:00
}
2022-03-31 19:19:59 +02:00
ImGui : : TextUnformatted ( " Licence: MIT/X derivative " ) ;
2021-07-28 14:27:44 +02:00
2022-03-31 19:19:59 +02:00
static auto curl_licence = _rs . getRaw ( " LICENSE.curl " ) ;
if ( ImGui : : BeginChild ( " ##libcurlLicence " , { 0.0f , windowSize ( ) . y ( ) * 0.3f } , true ) ) {
2021-07-28 14:27:44 +02:00
ImGui : : PushFont ( ImGui : : GetIO ( ) . Fonts - > Fonts [ 1 ] ) ;
2022-03-31 19:19:59 +02:00
ImGui : : TextEx ( curl_licence . data ( ) , curl_licence . data ( ) + curl_licence . size ( ) , ImGuiTextFlags_None ) ;
2021-07-28 14:27:44 +02:00
ImGui : : PopFont ( ) ;
}
ImGui : : EndChild ( ) ;
ImGui : : TreePop ( ) ;
}
2021-06-11 19:24:52 +02:00
if ( ImGui : : TreeNodeEx ( " Font Awesome " , ImGuiTreeNodeFlags_SpanAvailWidth ) ) {
ImGui : : TextUnformatted ( " Version used: 5.15.3 " ) ;
2022-03-04 21:18:55 +01:00
auto fa_website = " https://fontawesome.com/ " ;
2022-02-23 21:59:00 +01:00
drawAlignedText ( ICON_FA_GLOBE " %s " , fa_website ) ;
2021-06-11 19:24:52 +02:00
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Copy to clipboard " ) ) {
ImGui : : SetClipboardText ( fa_website ) ;
}
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Open in browser " ) ) {
openUri ( fa_website ) ;
}
ImGui : : TextUnformatted ( " Licence: SIL Open Font License 1.1 " ) ;
ImGui : : TreePop ( ) ;
}
if ( ImGui : : TreeNodeEx ( " IconFontCppHeaders " , ImGuiTreeNodeFlags_SpanAvailWidth ) ) {
2022-03-04 21:18:55 +01:00
auto icon_repo = " https://github.com/juliettef/IconFontCppHeaders " ;
2022-02-23 21:59:00 +01:00
drawAlignedText ( ICON_FA_GITHUB " %s " , icon_repo ) ;
2021-06-11 19:24:52 +02:00
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Copy to clipboard " ) ) {
ImGui : : SetClipboardText ( icon_repo ) ;
}
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Open in browser " ) ) {
openUri ( icon_repo ) ;
}
ImGui : : TextUnformatted ( " Licence: zlib " ) ;
ImGui : : TreePop ( ) ;
}
ImGui : : PopStyleVar ( ) ;
}
ImGui : : EndPopup ( ) ;
}