Add option to disable splash on startup and some cleanup.
This commit is contained in:
parent
dde610a78f
commit
1ccb616b93
48
src/App.cpp
48
src/App.cpp
|
|
@ -27,7 +27,8 @@
|
||||||
#include <wx/filefn.h>
|
#include <wx/filefn.h>
|
||||||
#include <wx/fswatcher.h>
|
#include <wx/fswatcher.h>
|
||||||
#include <wx/gdicmn.h>
|
#include <wx/gdicmn.h>
|
||||||
#include <wx/splash.h>
|
#include <wx/image.h>
|
||||||
|
#include <wx/imagpng.h>
|
||||||
|
|
||||||
wxIMPLEMENT_APP(cApp);
|
wxIMPLEMENT_APP(cApp);
|
||||||
|
|
||||||
|
|
@ -47,25 +48,34 @@ bool cApp::OnInit()
|
||||||
if (!wxApp::OnInit())
|
if (!wxApp::OnInit())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
SampleHive::cSerializer serializer;
|
||||||
|
|
||||||
wxLog::AddTraceMask("EventSource");
|
wxLog::AddTraceMask("EventSource");
|
||||||
wxLog::AddTraceMask(wxTRACE_FSWATCHER);
|
wxLog::AddTraceMask(wxTRACE_FSWATCHER);
|
||||||
|
|
||||||
m_Frame = new cMainFrame();
|
// Add image handler for PNG
|
||||||
|
wxImage::AddHandler(new wxPNGHandler);
|
||||||
|
|
||||||
|
m_pFrame = new cMainFrame();
|
||||||
|
|
||||||
wxBitmap bitmap;
|
wxBitmap bitmap;
|
||||||
wxSplashScreen* splash;
|
|
||||||
|
|
||||||
if (bitmap.LoadFile(SPLASH_LOGO, wxBITMAP_TYPE_PNG))
|
if (bitmap.LoadFile(SPLASH_LOGO, wxBITMAP_TYPE_PNG))
|
||||||
{
|
{
|
||||||
splash = new wxSplashScreen(bitmap,
|
m_pSplash = new wxSplashScreen(bitmap,
|
||||||
wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT,
|
wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT,
|
||||||
2000, NULL, -1, wxDefaultPosition, wxDefaultSize,
|
10000, NULL, -1, wxDefaultPosition, wxDefaultSize,
|
||||||
wxBORDER_SIMPLE | wxSTAY_ON_TOP);
|
wxBORDER_SIMPLE | wxSTAY_ON_TOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!serializer.DeserializeShowSplash())
|
||||||
|
m_pSplash->Hide();
|
||||||
|
else
|
||||||
|
m_pSplash->Show();
|
||||||
|
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
m_Frame->Show(true);
|
m_pFrame->Show(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -97,31 +107,31 @@ bool cApp::OnCmdLineParsed(wxCmdLineParser& parser)
|
||||||
|
|
||||||
if (ans == 'y' || ans == 'Y')
|
if (ans == 'y' || ans == 'Y')
|
||||||
{
|
{
|
||||||
if (!wxFileExists(CONFIG_FILEPATH))
|
if (!wxFileExists(static_cast<std::string>(CONFIG_FILEPATH)))
|
||||||
{
|
{
|
||||||
SH_LOG_ERROR("Error! File {} doesn't exist.", CONFIG_FILEPATH);
|
SH_LOG_ERROR("Error! File {} doesn't exist.", static_cast<std::string>(CONFIG_FILEPATH));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool config_is_deleted = wxRemoveFile(CONFIG_FILEPATH);
|
bool config_is_deleted = wxRemoveFile(static_cast<std::string>(CONFIG_FILEPATH));
|
||||||
|
|
||||||
if (config_is_deleted)
|
if (config_is_deleted)
|
||||||
SH_LOG_INFO("Deleted {}", CONFIG_FILEPATH);
|
SH_LOG_INFO("Deleted {}", static_cast<std::string>(CONFIG_FILEPATH));
|
||||||
else
|
else
|
||||||
SH_LOG_ERROR("Could not delete {}", CONFIG_FILEPATH);
|
SH_LOG_ERROR("Could not delete {}", static_cast<std::string>(CONFIG_FILEPATH));
|
||||||
|
|
||||||
if (!wxFileExists(DATABASE_FILEPATH))
|
if (!wxFileExists(static_cast<std::string>(DATABASE_FILEPATH)))
|
||||||
{
|
{
|
||||||
SH_LOG_ERROR("Error! File {} doesn't exist.", DATABASE_FILEPATH);
|
SH_LOG_ERROR("Error! File {} doesn't exist.", static_cast<std::string>(DATABASE_FILEPATH));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool db_is_deleted = wxRemoveFile(DATABASE_FILEPATH);
|
bool db_is_deleted = wxRemoveFile(static_cast<std::string>(DATABASE_FILEPATH));
|
||||||
|
|
||||||
if (db_is_deleted)
|
if (db_is_deleted)
|
||||||
SH_LOG_INFO("Deleted {}", DATABASE_FILEPATH);
|
SH_LOG_INFO("Deleted {}", static_cast<std::string>(DATABASE_FILEPATH));
|
||||||
else
|
else
|
||||||
SH_LOG_ERROR("Could not delete {}", DATABASE_FILEPATH);
|
SH_LOG_ERROR("Could not delete {}", static_cast<std::string>(DATABASE_FILEPATH));
|
||||||
|
|
||||||
if (config_is_deleted && db_is_deleted)
|
if (config_is_deleted && db_is_deleted)
|
||||||
SH_LOG_INFO("Successfully cleared app data");
|
SH_LOG_INFO("Successfully cleared app data");
|
||||||
|
|
@ -144,6 +154,6 @@ bool cApp::OnCmdLineParsed(wxCmdLineParser& parser)
|
||||||
|
|
||||||
void cApp::OnEventLoopEnter(wxEventLoopBase* event)
|
void cApp::OnEventLoopEnter(wxEventLoopBase* event)
|
||||||
{
|
{
|
||||||
if (m_Frame->CreateWatcherIfNecessary())
|
if (m_pFrame->CreateWatcherIfNecessary())
|
||||||
SH_LOG_INFO("Filesystem watcher created sucessfully");
|
SH_LOG_INFO("Filesystem watcher created sucessfully");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include <wx/app.h>
|
#include <wx/app.h>
|
||||||
#include <wx/cmdline.h>
|
#include <wx/cmdline.h>
|
||||||
|
#include <wx/splash.h>
|
||||||
|
|
||||||
class cApp : public wxApp
|
class cApp : public wxApp
|
||||||
{
|
{
|
||||||
|
|
@ -38,5 +39,6 @@ class cApp : public wxApp
|
||||||
virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
|
virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cMainFrame* m_Frame = nullptr;
|
wxSplashScreen* m_pSplash = nullptr;
|
||||||
|
cMainFrame* m_pFrame = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,9 @@ cSettings::cSettings(wxWindow *window)
|
||||||
serializer.DeserializeWaveformColour(),
|
serializer.DeserializeWaveformColour(),
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxCLRP_DEFAULT_STYLE);
|
wxCLRP_DEFAULT_STYLE);
|
||||||
|
m_pShowSplashCheck = new wxCheckBox(m_pDisplaySettingPanel, SampleHive::ID::SD_ShowSplash, "Show splash on startup",
|
||||||
|
wxDefaultPosition, wxDefaultSize, 0);
|
||||||
|
m_pShowSplashCheck->SetValue(serializer.DeserializeShowSplash());
|
||||||
|
|
||||||
m_pCollectionSettingPanel = new wxPanel(m_pNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
m_pCollectionSettingPanel = new wxPanel(m_pNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||||
|
|
||||||
|
|
@ -104,13 +107,13 @@ cSettings::cSettings(wxWindow *window)
|
||||||
|
|
||||||
m_pConfigLabel = new wxStaticText(m_pConfigurationSettingPanel, wxID_ANY,
|
m_pConfigLabel = new wxStaticText(m_pConfigurationSettingPanel, wxID_ANY,
|
||||||
"Default configuration file location", wxDefaultPosition, wxDefaultSize);
|
"Default configuration file location", wxDefaultPosition, wxDefaultSize);
|
||||||
m_pConfigText = new wxTextCtrl(m_pConfigurationSettingPanel, wxID_ANY, CONFIG_FILEPATH,
|
m_pConfigText = new wxTextCtrl(m_pConfigurationSettingPanel, wxID_ANY, static_cast<std::string>(CONFIG_FILEPATH),
|
||||||
wxDefaultPosition, wxDefaultSize);
|
wxDefaultPosition, wxDefaultSize);
|
||||||
m_pConfigBrowse = new wxButton(m_pConfigurationSettingPanel, SampleHive::ID::SD_BrowseConfigDir, "Browse",
|
m_pConfigBrowse = new wxButton(m_pConfigurationSettingPanel, SampleHive::ID::SD_BrowseConfigDir, "Browse",
|
||||||
wxDefaultPosition, wxDefaultSize, 0);
|
wxDefaultPosition, wxDefaultSize, 0);
|
||||||
m_pDatabaseLabel = new wxStaticText(m_pConfigurationSettingPanel, wxID_ANY, "Default database location",
|
m_pDatabaseLabel = new wxStaticText(m_pConfigurationSettingPanel, wxID_ANY, "Default database location",
|
||||||
wxDefaultPosition, wxDefaultSize);
|
wxDefaultPosition, wxDefaultSize);
|
||||||
m_pDatabaseText = new wxTextCtrl(m_pConfigurationSettingPanel, wxID_ANY, DATABASE_FILEPATH,
|
m_pDatabaseText = new wxTextCtrl(m_pConfigurationSettingPanel, wxID_ANY, static_cast<std::string>(DATABASE_FILEPATH),
|
||||||
wxDefaultPosition, wxDefaultSize);
|
wxDefaultPosition, wxDefaultSize);
|
||||||
m_pDatabaseBrowse = new wxButton(m_pConfigurationSettingPanel, SampleHive::ID::SD_BrowseDatabaseDir, "Browse",
|
m_pDatabaseBrowse = new wxButton(m_pConfigurationSettingPanel, SampleHive::ID::SD_BrowseDatabaseDir, "Browse",
|
||||||
wxDefaultPosition, wxDefaultSize, 0);
|
wxDefaultPosition, wxDefaultSize, 0);
|
||||||
|
|
@ -135,6 +138,7 @@ cSettings::cSettings(wxWindow *window)
|
||||||
Bind(wxEVT_BUTTON, &cSettings::OnClickConfigBrowse, this, SampleHive::ID::SD_BrowseConfigDir);
|
Bind(wxEVT_BUTTON, &cSettings::OnClickConfigBrowse, this, SampleHive::ID::SD_BrowseConfigDir);
|
||||||
Bind(wxEVT_BUTTON, &cSettings::OnClickDatabaseBrowse, this, SampleHive::ID::SD_BrowseDatabaseDir);
|
Bind(wxEVT_BUTTON, &cSettings::OnClickDatabaseBrowse, this, SampleHive::ID::SD_BrowseDatabaseDir);
|
||||||
Bind(wxEVT_COLOURPICKER_CHANGED, &cSettings::OnChangeWaveformColour, this, SampleHive::ID::SD_WaveformColourPickerCtrl);
|
Bind(wxEVT_COLOURPICKER_CHANGED, &cSettings::OnChangeWaveformColour, this, SampleHive::ID::SD_WaveformColourPickerCtrl);
|
||||||
|
Bind(wxEVT_CHECKBOX, &cSettings::OnCheckShowSplash, this, SampleHive::ID::SD_ShowSplash);
|
||||||
|
|
||||||
// Adding controls to sizers
|
// Adding controls to sizers
|
||||||
m_pNotebookSizer->Add(m_pNotebook, 1, wxALL | wxEXPAND, 2);
|
m_pNotebookSizer->Add(m_pNotebook, 1, wxALL | wxEXPAND, 2);
|
||||||
|
|
@ -156,6 +160,7 @@ cSettings::cSettings(wxWindow *window)
|
||||||
|
|
||||||
m_pDisplayTopSizer->Add(m_pDisplayFontSizer, 0, wxALL | wxEXPAND, 2);
|
m_pDisplayTopSizer->Add(m_pDisplayFontSizer, 0, wxALL | wxEXPAND, 2);
|
||||||
m_pDisplayTopSizer->Add(m_pWaveformColourSizer, 0, wxALL | wxEXPAND, 2);
|
m_pDisplayTopSizer->Add(m_pWaveformColourSizer, 0, wxALL | wxEXPAND, 2);
|
||||||
|
m_pDisplayTopSizer->Add(m_pShowSplashCheck, 0, wxALL | wxEXPAND, 2);
|
||||||
|
|
||||||
m_pCollectionImportDirSizer->Add(m_pAutoImportCheck, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
|
m_pCollectionImportDirSizer->Add(m_pAutoImportCheck, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
|
||||||
m_pCollectionImportDirSizer->Add(m_pImportDirLocation, 1, wxALL | wxALIGN_CENTER_VERTICAL, 2);
|
m_pCollectionImportDirSizer->Add(m_pImportDirLocation, 1, wxALL | wxALIGN_CENTER_VERTICAL, 2);
|
||||||
|
|
@ -501,6 +506,13 @@ void cSettings::OnChangeWaveformColour(wxColourPickerEvent& event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cSettings::OnCheckShowSplash(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
SampleHive::cSerializer serializer;
|
||||||
|
|
||||||
|
serializer.SerializeShowSplash(m_pShowSplashCheck->GetValue());
|
||||||
|
}
|
||||||
|
|
||||||
cSettings::~cSettings()
|
cSettings::~cSettings()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ class cSettings : public wxDialog
|
||||||
void OnChangeFontSize(wxSpinEvent& event);
|
void OnChangeFontSize(wxSpinEvent& event);
|
||||||
void OnSelectFont(wxCommandEvent& event);
|
void OnSelectFont(wxCommandEvent& event);
|
||||||
void OnChangeWaveformColour(wxColourPickerEvent& event);
|
void OnChangeWaveformColour(wxColourPickerEvent& event);
|
||||||
|
void OnCheckShowSplash(wxCommandEvent& event);
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
void SetCustomFont();
|
void SetCustomFont();
|
||||||
|
|
@ -117,6 +118,7 @@ class cSettings : public wxDialog
|
||||||
wxBoxSizer* m_pWaveformColourSizer = nullptr;
|
wxBoxSizer* m_pWaveformColourSizer = nullptr;
|
||||||
wxStaticText* m_pWaveformColourLabel = nullptr;
|
wxStaticText* m_pWaveformColourLabel = nullptr;
|
||||||
wxColourPickerCtrl* m_pWaveformColourPickerCtrl = nullptr;
|
wxColourPickerCtrl* m_pWaveformColourPickerCtrl = nullptr;
|
||||||
|
wxCheckBox* m_pShowSplashCheck = nullptr;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Collection page
|
// Collection page
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ cMainFrame::cMainFrame()
|
||||||
int status_width[4] = { 300, -6, -1, -2 };
|
int status_width[4] = { 300, -6, -1, -2 };
|
||||||
m_pStatusBar->SetStatusWidths(4, status_width);
|
m_pStatusBar->SetStatusWidths(4, status_width);
|
||||||
|
|
||||||
m_pHiveBitmap = new wxStaticBitmap(m_pStatusBar, wxID_ANY, wxBitmap(ICON_HIVE_24px));
|
m_pHiveBitmap = new wxStaticBitmap(m_pStatusBar, wxID_ANY, wxBitmap(ICON_HIVE_24px, wxBITMAP_TYPE_PNG));
|
||||||
|
|
||||||
// Initialize menubar and menus
|
// Initialize menubar and menus
|
||||||
m_pMenuBar = new wxMenuBar();
|
m_pMenuBar = new wxMenuBar();
|
||||||
|
|
@ -252,8 +252,6 @@ void cMainFrame::UpdateElapsedTime(wxTimerEvent& event)
|
||||||
|
|
||||||
m_pTransportControls->SetSamplePositionText(wxString::Format(wxT("%s/%s"), position.c_str(), duration.c_str()));
|
m_pTransportControls->SetSamplePositionText(wxString::Format(wxT("%s/%s"), position.c_str(), duration.c_str()));
|
||||||
|
|
||||||
this->Refresh();
|
|
||||||
m_pTransportControls->Refresh();
|
|
||||||
m_pWaveformViewer->Refresh();
|
m_pWaveformViewer->Refresh();
|
||||||
|
|
||||||
if (m_bLoopPointsSet && m_pTransportControls->IsLoopABOn())
|
if (m_bLoopPointsSet && m_pTransportControls->IsLoopABOn())
|
||||||
|
|
@ -648,7 +646,8 @@ void cMainFrame::OnSelectResetAppData(wxCommandEvent& event)
|
||||||
wxMessageDialog clearDataDialog(this, wxString::Format(_("Warning! This will delete configuration file "
|
wxMessageDialog clearDataDialog(this, wxString::Format(_("Warning! This will delete configuration file "
|
||||||
"\"%s\" and database file \"%s\" permanently, "
|
"\"%s\" and database file \"%s\" permanently, "
|
||||||
"are you sure you want to delete these files?"),
|
"are you sure you want to delete these files?"),
|
||||||
CONFIG_FILEPATH, DATABASE_FILEPATH),
|
static_cast<std::string>(CONFIG_FILEPATH),
|
||||||
|
static_cast<std::string>(DATABASE_FILEPATH)),
|
||||||
_("Clear app data?"), wxYES_NO | wxNO_DEFAULT | wxCENTRE, wxDefaultPosition);
|
_("Clear app data?"), wxYES_NO | wxNO_DEFAULT | wxCENTRE, wxDefaultPosition);
|
||||||
|
|
||||||
bool remove = false;
|
bool remove = false;
|
||||||
|
|
@ -660,31 +659,31 @@ void cMainFrame::OnSelectResetAppData(wxCommandEvent& event)
|
||||||
|
|
||||||
if (remove)
|
if (remove)
|
||||||
{
|
{
|
||||||
if (!wxFileExists(CONFIG_FILEPATH))
|
if (!wxFileExists(static_cast<std::string>(CONFIG_FILEPATH)))
|
||||||
{
|
{
|
||||||
SH_LOG_ERROR("Error! File {} doesn't exist.", CONFIG_FILEPATH);
|
SH_LOG_ERROR("Error! File {} doesn't exist.", static_cast<std::string>(CONFIG_FILEPATH));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool config_is_deleted = wxRemoveFile(CONFIG_FILEPATH);
|
bool config_is_deleted = wxRemoveFile(static_cast<std::string>(CONFIG_FILEPATH));
|
||||||
|
|
||||||
if (config_is_deleted)
|
if (config_is_deleted)
|
||||||
SH_LOG_INFO("Deleted {}", CONFIG_FILEPATH);
|
SH_LOG_INFO("Deleted {}", static_cast<std::string>(CONFIG_FILEPATH));
|
||||||
else
|
else
|
||||||
SH_LOG_ERROR("Could not delete {}", CONFIG_FILEPATH);
|
SH_LOG_ERROR("Could not delete {}", static_cast<std::string>(CONFIG_FILEPATH));
|
||||||
|
|
||||||
if (!wxFileExists(DATABASE_FILEPATH))
|
if (!wxFileExists(static_cast<std::string>(DATABASE_FILEPATH)))
|
||||||
{
|
{
|
||||||
SH_LOG_ERROR("Error! File {} doesn't exist.", DATABASE_FILEPATH);
|
SH_LOG_ERROR("Error! File {} doesn't exist.", static_cast<std::string>(DATABASE_FILEPATH));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool db_is_deleted = wxRemoveFile(DATABASE_FILEPATH);
|
bool db_is_deleted = wxRemoveFile(static_cast<std::string>(DATABASE_FILEPATH));
|
||||||
|
|
||||||
if (db_is_deleted)
|
if (db_is_deleted)
|
||||||
SH_LOG_INFO("Deleted {}", DATABASE_FILEPATH);
|
SH_LOG_INFO("Deleted {}", static_cast<std::string>(DATABASE_FILEPATH));
|
||||||
else
|
else
|
||||||
SH_LOG_ERROR("Could not delete {}", DATABASE_FILEPATH);
|
SH_LOG_ERROR("Could not delete {}", static_cast<std::string>(DATABASE_FILEPATH));
|
||||||
|
|
||||||
if (config_is_deleted && db_is_deleted)
|
if (config_is_deleted && db_is_deleted)
|
||||||
{
|
{
|
||||||
|
|
@ -707,7 +706,7 @@ void cMainFrame::OnSelectAbout(wxCommandEvent& event)
|
||||||
wxAboutDialogInfo aboutInfo;
|
wxAboutDialogInfo aboutInfo;
|
||||||
|
|
||||||
aboutInfo.SetName(PROJECT_NAME);
|
aboutInfo.SetName(PROJECT_NAME);
|
||||||
aboutInfo.SetIcon(wxIcon(ICON_HIVE_64px));
|
aboutInfo.SetIcon(wxIcon(ICON_HIVE_64px, wxBITMAP_TYPE_PNG));
|
||||||
aboutInfo.AddArtist(PROJECT_AUTHOR);
|
aboutInfo.AddArtist(PROJECT_AUTHOR);
|
||||||
aboutInfo.SetVersion(PROJECT_VERSION, _("Version 0.9.0_alpha.1"));
|
aboutInfo.SetVersion(PROJECT_VERSION, _("Version 0.9.0_alpha.1"));
|
||||||
aboutInfo.SetDescription(_(PROJECT_DESCRIPTION));
|
aboutInfo.SetDescription(_(PROJECT_DESCRIPTION));
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ void cWaveformViewer::UpdateWaveformBitmap()
|
||||||
wxString path = selection.Contains(wxString::Format(".%s", extension)) ?
|
wxString path = selection.Contains(wxString::Format(".%s", extension)) ?
|
||||||
filepath_with_extension : filepath_without_extension;
|
filepath_with_extension : filepath_without_extension;
|
||||||
|
|
||||||
SndfileHandle snd_file(path);
|
SndfileHandle snd_file(path.ToStdString().c_str());
|
||||||
|
|
||||||
int channels = snd_file.channels();
|
int channels = snd_file.channels();
|
||||||
double sample_rate = snd_file.samplerate();
|
double sample_rate = snd_file.samplerate();
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ namespace SampleHive { namespace ID {
|
||||||
SD_FontSize,
|
SD_FontSize,
|
||||||
SD_FontBrowseButton,
|
SD_FontBrowseButton,
|
||||||
SD_WaveformColourPickerCtrl,
|
SD_WaveformColourPickerCtrl,
|
||||||
|
SD_ShowSplash,
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// App Menu items
|
// App Menu items
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,10 @@ namespace SampleHive {
|
||||||
m_Emitter << YAML::BeginMap;
|
m_Emitter << YAML::BeginMap;
|
||||||
m_Emitter << YAML::Key << "Colour" << YAML::Value << colour.GetAsString().ToStdString();
|
m_Emitter << YAML::Key << "Colour" << YAML::Value << colour.GetAsString().ToStdString();
|
||||||
m_Emitter << YAML::EndMap;
|
m_Emitter << YAML::EndMap;
|
||||||
|
m_Emitter << YAML::Key << "Splash";
|
||||||
|
m_Emitter << YAML::BeginMap;
|
||||||
|
m_Emitter << YAML::Key << "ShowSplashOnStartup" << YAML::Value << true;
|
||||||
|
m_Emitter << YAML::EndMap;
|
||||||
m_Emitter << YAML::EndMap << YAML::Newline;
|
m_Emitter << YAML::EndMap << YAML::Newline;
|
||||||
|
|
||||||
m_Emitter << YAML::Newline << YAML::Key << "Collection";
|
m_Emitter << YAML::Newline << YAML::Key << "Collection";
|
||||||
|
|
@ -100,10 +104,10 @@ namespace SampleHive {
|
||||||
|
|
||||||
m_Emitter << YAML::EndMap;
|
m_Emitter << YAML::EndMap;
|
||||||
|
|
||||||
std::ofstream ofstrm(CONFIG_FILEPATH);
|
std::ofstream ofstrm(static_cast<std::string>(CONFIG_FILEPATH));
|
||||||
ofstrm << m_Emitter.c_str();
|
ofstrm << m_Emitter.c_str();
|
||||||
|
|
||||||
SH_LOG_INFO("Generated {} successfully!", CONFIG_FILEPATH);
|
SH_LOG_INFO("Generated {} successfully!", static_cast<std::string>(CONFIG_FILEPATH));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -529,6 +533,63 @@ namespace SampleHive {
|
||||||
return static_cast<wxString>(colour);
|
return static_cast<wxString>(colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cSerializer::SerializeShowSplash(bool value)
|
||||||
|
{
|
||||||
|
YAML::Emitter out;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
YAML::Node config = YAML::LoadFile(static_cast<std::string>(CONFIG_FILEPATH));
|
||||||
|
|
||||||
|
auto display = config["Display"];
|
||||||
|
|
||||||
|
if (auto splash = display["Splash"])
|
||||||
|
{
|
||||||
|
splash["ShowSplashOnStartup"] = value;
|
||||||
|
|
||||||
|
out << config;
|
||||||
|
|
||||||
|
std::ofstream ofstrm(static_cast<std::string>(CONFIG_FILEPATH));
|
||||||
|
ofstrm << out.c_str();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SH_LOG_ERROR("Error! Cannot store show splash value.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (const YAML::ParserException& ex)
|
||||||
|
{
|
||||||
|
SH_LOG_ERROR(ex.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cSerializer::DeserializeShowSplash() const
|
||||||
|
{
|
||||||
|
bool show = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
YAML::Node config = YAML::LoadFile(static_cast<std::string>(CONFIG_FILEPATH));
|
||||||
|
|
||||||
|
auto display = config["Display"];
|
||||||
|
|
||||||
|
if (auto splash = display["Splash"])
|
||||||
|
{
|
||||||
|
show = splash["ShowSplashOnStartup"].as<bool>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SH_LOG_ERROR("Error! Cannot fetch show splash value.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (const YAML::ParserException& ex)
|
||||||
|
{
|
||||||
|
SH_LOG_ERROR(ex.what());
|
||||||
|
}
|
||||||
|
|
||||||
|
return show;
|
||||||
|
}
|
||||||
|
|
||||||
void cSerializer::SerializeAutoImport(bool autoImport, const std::string& importDir)
|
void cSerializer::SerializeAutoImport(bool autoImport, const std::string& importDir)
|
||||||
{
|
{
|
||||||
YAML::Emitter out;
|
YAML::Emitter out;
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,11 @@ namespace SampleHive {
|
||||||
void SerializeWaveformColour(wxColour& colour);
|
void SerializeWaveformColour(wxColour& colour);
|
||||||
wxColour DeserializeWaveformColour() const;
|
wxColour DeserializeWaveformColour() const;
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
// Splash screen
|
||||||
|
void SerializeShowSplash(bool value);
|
||||||
|
bool DeserializeShowSplash() const;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Auto import settings
|
// Auto import settings
|
||||||
void SerializeAutoImport(bool autoImport, const std::string& importDir);
|
void SerializeAutoImport(bool autoImport, const std::string& importDir);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue