Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
Blake-Madden committed Apr 12, 2024
1 parent 3415cf6 commit 781ec8d
Showing 1 changed file with 83 additions and 51 deletions.
134 changes: 83 additions & 51 deletions src/ui/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,32 @@
#ifndef __BASEAPP_H__
#define __BASEAPP_H__

#include <wx/wx.h>
#include <wx/stdpaths.h>
#include <wx/print.h>
#include <wx/printdlg.h>
#include <wx/utils.h>
#include <wx/mimetype.h>
#include "../debug/debug_profile.h"
#include "../i18n-check/src/donttranslate.h"
#include "../math/safe_math.h"
#include "../util/logfile.h"
#include "../util/resource_manager.h"
#include "mainframe.h"
#include <wx/cmdline.h>
#include <wx/config.h>
#include <wx/debugrpt.h>
#include <wx/docview.h>
#include <wx/fileconf.h>
#include <wx/fs_mem.h>
#include <wx/fs_zip.h>
#include <wx/sysopt.h>
#include <wx/splash.h>
#include <wx/image.h>
#include <wx/fileconf.h>
#include <wx/cmdline.h>
#include <wx/debugrpt.h>
#include <wx/log.h>
#include <wx/uilocale.h>
#include <wx/fs_mem.h>
#include <wx/config.h>
#include <wx/mimetype.h>
#include <wx/print.h>
#include <wx/printdlg.h>
#include <wx/propgrid/propgrid.h>
#include <wx/splash.h>
#include <wx/stdpaths.h>
#include <wx/sysopt.h>
#include <wx/uilocale.h>
#include <wx/utils.h>
#include <wx/webrequest.h>
#include "../util/logfile.h"
#include "../util/resource_manager.h"
#include "../i18n-check/src/donttranslate.h"
#include "../debug/debug_profile.h"
#include "../math/safe_math.h"
#include "mainframe.h"
#include <wx/wx.h>

namespace Wisteria::UI
{
Expand All @@ -46,7 +46,7 @@ namespace Wisteria::UI
/// main frame built-in.
class BaseApp : public wxApp
{
public:
public:
/// @brief Constructor.
BaseApp();
/// @private
Expand All @@ -68,16 +68,20 @@ namespace Wisteria::UI
/// @returns The number of active documents.
[[nodiscard]]
size_t GetDocumentCount() const
{ return m_docManager->GetDocuments().GetCount(); }
{
return m_docManager->GetDocuments().GetCount();
}

/// @returns The application's main file extension.
[[nodiscard]]
const wxString& GetAppFileExtension() const noexcept
{ return m_fileExtension; }
{
return m_fileExtension;
}

/// @brief Sets the application's main file extension.
/// @param extension The file extension to use.
void SetAppFileExtension(const wxString& extension)
{ m_fileExtension = extension; }
void SetAppFileExtension(const wxString& extension) { m_fileExtension = extension; }

// MRU menu functions
/// @private
Expand All @@ -90,11 +94,17 @@ namespace Wisteria::UI
/// @returns The mainframe.
[[nodiscard]]
BaseMainFrame* GetMainFrame() noexcept
{ return m_mainFrame; }
{
return m_mainFrame;
}

/// @private
[[nodiscard]]
const BaseMainFrame* GetMainFrame() const noexcept
{ return m_mainFrame; }
{
return m_mainFrame;
}

/// @brief Sets the mainframe.
/// @param frame The mainframe to use.
void SetMainFrame(BaseMainFrame* frame)
Expand All @@ -106,45 +116,60 @@ namespace Wisteria::UI
/// @returns The document manager.
[[nodiscard]]
wxDocManager* GetDocManager() noexcept
{ return m_docManager; }
{
return m_docManager;
}

/// @brief Sets the document manager.
/// @param docManager The document manager to use.
void SetDocManager(wxDocManager* docManager) noexcept
{ m_docManager = docManager; }
void SetDocManager(wxDocManager* docManager) noexcept { m_docManager = docManager; }

/// @brief Sets a descriptive name for the application's document type.
/// @param documentTypeName The descriptives.
void SetDocumentTypeName(const wxString& documentTypeName)
{ m_documentTypeName = documentTypeName; }
{
m_documentTypeName = documentTypeName;
}

/// @returns The application's document version number.
[[nodiscard]]
const wxString& GetDocumentVersionNumber() const noexcept
{ return m_documentVersionNumber; }
{
return m_documentVersionNumber;
}

/// @brief Sets the application's document version number.
/// @param versionNumber The version number.
void SetDocumentVersionNumber(const wxString& versionNumber)
{ m_documentVersionNumber = versionNumber; }
{
m_documentVersionNumber = versionNumber;
}

/// @returns The application's subname.
[[nodiscard]]
const wxString& GetAppSubName() const noexcept
{ return m_appSubName; }
{
return m_appSubName;
}

/// @brief Sets the application's subname.
/// @param name The subname.
void SetAppSubName(const wxString& name)
{ m_appSubName = name; }
void SetAppSubName(const wxString& name) { m_appSubName = name; }

/// @returns The path of where the debug profiling data is being saved.
/// @details This is only used if profiling is enabled.
[[nodiscard]]
const wxString& GetProfileReportPath() const noexcept
{ return m_profileReportPath; }
{
return m_profileReportPath;
}

/// @returns Everything sent to the logging system as a formatted string.
[[nodiscard]]
wxString GetLogReport()
{ return m_logFile->Read(); }
{
return m_logFile->Read();
}

/// @return The file logging systems used by the application.
[[nodiscard]]
Expand All @@ -155,20 +180,23 @@ namespace Wisteria::UI

/// @brief Sets a support email for the application.
/// @param email The email address.
void SetSupportEmail(const wxString& email)
{ m_supportEmail = email; }
void SetSupportEmail(const wxString& email) { m_supportEmail = email; }

/// @returns The printer settings.
[[nodiscard]]
wxPrintData* GetPrintData()
{
if (GetMainFrame())
{
return &GetMainFrame()->GetDocumentManager()->
GetPageSetupDialogData().GetPrintData();
return &GetMainFrame()
->GetDocumentManager()
->GetPageSetupDialogData()
.GetPrintData();
}
else
{ return nullptr; }
{
return nullptr;
}
}

/// @returns The path to a file in the application's resource directory,
Expand All @@ -187,12 +215,16 @@ namespace Wisteria::UI
/// XRC files from a resource archive.
[[nodiscard]]
ResourceManager& GetResourceManager() noexcept
{ return m_resManager; }
{
return m_resManager;
}

/// @private
[[nodiscard]]
const ResourceManager& GetResourceManager() const noexcept
{ return m_resManager; }
{
return m_resManager;
}

/** @brief Creates a program's splashscreen using a base image and
various program information.
Expand All @@ -206,12 +238,12 @@ namespace Wisteria::UI
@returns The decorated splashscreen.*/
[[nodiscard]]
wxBitmap CreateSplashscreen(const wxBitmap& bitmap, const wxString& appName,
const wxString& appSubName, const wxString& vendorName,
const bool includeCopyright);
private:
const wxString& appSubName, const wxString& vendorName,
const bool includeCopyright);

private:
[[nodiscard]]
wxString FindResourceFileWithAppInfo(const wxString& folder,
const wxString& subFile) const;
wxString FindResourceFileWithAppInfo(const wxString& folder, const wxString& subFile) const;
[[nodiscard]]
wxString FindResourceDirectoryWithAppInfo(const wxString& folder,
const wxString& subFile) const;
Expand All @@ -228,7 +260,7 @@ namespace Wisteria::UI
wxString m_profileReportPath;
wxString m_supportEmail;
};
}
} // namespace Wisteria::UI

/** @}*/

Expand Down

0 comments on commit 781ec8d

Please sign in to comment.