Fix segmentation fault when using -r flag on the command line and add double click to play a sample.
This commit is contained in:
parent
66ce190098
commit
7f13c45c40
33
src/App.cpp
33
src/App.cpp
|
|
@ -40,18 +40,6 @@ cApp::cApp()
|
||||||
|
|
||||||
cApp::~cApp()
|
cApp::~cApp()
|
||||||
{
|
{
|
||||||
SampleHive::cSerializer serializer;
|
|
||||||
|
|
||||||
if (serializer.DeserializeDemoMode())
|
|
||||||
{
|
|
||||||
if (wxFileExists("tempdb.db"))
|
|
||||||
if (wxRemoveFile("tempdb.db"))
|
|
||||||
SH_LOG_WARN("Deleted temporary database file..");
|
|
||||||
else
|
|
||||||
SH_LOG_ERROR("Could not delete file..");
|
|
||||||
else
|
|
||||||
SH_LOG_DEBUG("File doesn't exists");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cApp::OnInit()
|
bool cApp::OnInit()
|
||||||
|
|
@ -107,13 +95,32 @@ bool cApp::OnCmdLineParsed(wxCmdLineParser& parser)
|
||||||
if (parser.Found("version"))
|
if (parser.Found("version"))
|
||||||
{
|
{
|
||||||
std::cout << PROJECT_NAME << ' ' << PROJECT_VERSION << std::endl;
|
std::cout << PROJECT_NAME << ' ' << PROJECT_VERSION << std::endl;
|
||||||
|
std::cout <<
|
||||||
|
"\nCopyright (C) 2021 Apoorv Singh"
|
||||||
|
"\nA simple, modern audio sample browser/manager for GNU/Linux."
|
||||||
|
"\n"
|
||||||
|
"\nThis file is a part of SampleHive"
|
||||||
|
"\n"
|
||||||
|
"\nSampleHive is free software: you can redistribute it and/or modify"
|
||||||
|
"\nit under the terms of the GNU General Public License as published by"
|
||||||
|
"\nthe Free Software Foundation, either version 3 of the License, or"
|
||||||
|
"\n(at your option) any later version."
|
||||||
|
"\n"
|
||||||
|
"\nSampleHive is distributed in the hope that it will be useful,"
|
||||||
|
"\nbut WITHOUT ANY WARRANTY; without even the implied warranty of"
|
||||||
|
"\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
|
||||||
|
"\nGNU General Public License for more details."
|
||||||
|
"\n"
|
||||||
|
"\nYou should have received a copy of the GNU General Public License"
|
||||||
|
"\nalong with this program. If not, see <https://www.gnu.org/licenses/>."
|
||||||
|
<< std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (parser.Found("reset"))
|
else if (parser.Found("reset"))
|
||||||
{
|
{
|
||||||
char ans;
|
char ans;
|
||||||
|
|
||||||
std::cout << "Are you sure you want reset app data? [y/N] ";
|
std::cout << "Are you sure you want clear all app data? [y/N] ";
|
||||||
std::cin >> ans;
|
std::cin >> ans;
|
||||||
|
|
||||||
if (ans == 'y' || ans == 'Y')
|
if (ans == 'y' || ans == 'Y')
|
||||||
|
|
|
||||||
|
|
@ -1048,7 +1048,6 @@ void cDatabase::OpenDatabase()
|
||||||
|
|
||||||
void cDatabase::OpenTemporaryDatabase()
|
void cDatabase::OpenTemporaryDatabase()
|
||||||
{
|
{
|
||||||
SH_LOG_WARN("Creating temporary in memory database, all samples will be deleted on application exit.");
|
|
||||||
throw_on_sqlite3_error(sqlite3_open("tempdb.db", &m_pDatabase));
|
throw_on_sqlite3_error(sqlite3_open("tempdb.db", &m_pDatabase));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
cSettings::cSettings(wxWindow *window)
|
cSettings::cSettings(wxWindow *window)
|
||||||
: wxDialog(window, wxID_ANY, "cSettings", wxDefaultPosition,
|
: wxDialog(window, wxID_ANY, "cSettings", wxDefaultPosition,
|
||||||
wxSize(720, 270), wxDEFAULT_DIALOG_STYLE | wxSTAY_ON_TOP),
|
wxSize(720, 300), wxDEFAULT_DIALOG_STYLE | wxSTAY_ON_TOP),
|
||||||
m_pWindow(window)
|
m_pWindow(window)
|
||||||
{
|
{
|
||||||
m_pPanel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
m_pPanel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||||
|
|
@ -76,6 +76,7 @@ cSettings::cSettings(wxWindow *window)
|
||||||
m_pCollectionImportDirSizer = new wxBoxSizer(wxHORIZONTAL);
|
m_pCollectionImportDirSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
m_pCollectionImportOptionsSizer = new wxBoxSizer(wxHORIZONTAL);
|
m_pCollectionImportOptionsSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
m_pCollectionShowExtensionSizer = new wxBoxSizer(wxVERTICAL);
|
m_pCollectionShowExtensionSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
m_pDoubleClickToPlaySizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
wxString defaultDir = wxGetHomeDir();
|
wxString defaultDir = wxGetHomeDir();
|
||||||
|
|
||||||
|
|
@ -98,6 +99,8 @@ cSettings::cSettings(wxWindow *window)
|
||||||
m_pShowFileExtensionCheck = new wxCheckBox(m_pCollectionSettingPanel, SampleHive::ID::SD_ShowFileExtension,
|
m_pShowFileExtensionCheck = new wxCheckBox(m_pCollectionSettingPanel, SampleHive::ID::SD_ShowFileExtension,
|
||||||
"Show file extension", wxDefaultPosition, wxDefaultSize, 0);
|
"Show file extension", wxDefaultPosition, wxDefaultSize, 0);
|
||||||
m_pShowFileExtensionCheck->SetToolTip("Weather to show file extension");
|
m_pShowFileExtensionCheck->SetToolTip("Weather to show file extension");
|
||||||
|
m_pDoubleClickToPlayCheck = new wxCheckBox(m_pCollectionSettingPanel, SampleHive::ID::SD_DoubleClickToPlay,
|
||||||
|
"Enable double click to play sample", wxDefaultPosition, wxDefaultSize, 0);
|
||||||
|
|
||||||
m_pConfigurationSettingPanel = new wxPanel(m_pNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
m_pConfigurationSettingPanel = new wxPanel(m_pNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||||
|
|
||||||
|
|
@ -133,6 +136,7 @@ cSettings::cSettings(wxWindow *window)
|
||||||
Bind(wxEVT_CHECKBOX, &cSettings::OnCheckFollowSymLinks, this, SampleHive::ID::SD_FollowSymLinks);
|
Bind(wxEVT_CHECKBOX, &cSettings::OnCheckFollowSymLinks, this, SampleHive::ID::SD_FollowSymLinks);
|
||||||
Bind(wxEVT_CHECKBOX, &cSettings::OnCheckRecursiveImport, this, SampleHive::ID::SD_RecursiveImport);
|
Bind(wxEVT_CHECKBOX, &cSettings::OnCheckRecursiveImport, this, SampleHive::ID::SD_RecursiveImport);
|
||||||
Bind(wxEVT_CHECKBOX, &cSettings::OnCheckShowFileExtension, this, SampleHive::ID::SD_ShowFileExtension);
|
Bind(wxEVT_CHECKBOX, &cSettings::OnCheckShowFileExtension, this, SampleHive::ID::SD_ShowFileExtension);
|
||||||
|
Bind(wxEVT_CHECKBOX, &cSettings::OnCheckEnableDoubleClickToPlay, this, SampleHive::ID::SD_DoubleClickToPlay);
|
||||||
Bind(wxEVT_SPINCTRL, &cSettings::OnChangeFontSize, this, SampleHive::ID::SD_FontSize);
|
Bind(wxEVT_SPINCTRL, &cSettings::OnChangeFontSize, this, SampleHive::ID::SD_FontSize);
|
||||||
Bind(wxEVT_BUTTON, &cSettings::OnSelectFont, this, SampleHive::ID::SD_FontBrowseButton);
|
Bind(wxEVT_BUTTON, &cSettings::OnSelectFont, this, SampleHive::ID::SD_FontBrowseButton);
|
||||||
Bind(wxEVT_BUTTON, &cSettings::OnClickBrowseAutoImportDir, this, SampleHive::ID::SD_BrowseAutoImportDir);
|
Bind(wxEVT_BUTTON, &cSettings::OnClickBrowseAutoImportDir, this, SampleHive::ID::SD_BrowseAutoImportDir);
|
||||||
|
|
@ -170,10 +174,12 @@ cSettings::cSettings(wxWindow *window)
|
||||||
m_pCollectionImportOptionsSizer->Add(m_pFollowSymLinksCheck, 0, wxALL, 2);
|
m_pCollectionImportOptionsSizer->Add(m_pFollowSymLinksCheck, 0, wxALL, 2);
|
||||||
m_pCollectionImportOptionsSizer->Add(m_pRecursiveImportCheck, 0, wxALL, 2);
|
m_pCollectionImportOptionsSizer->Add(m_pRecursiveImportCheck, 0, wxALL, 2);
|
||||||
m_pCollectionShowExtensionSizer->Add(m_pShowFileExtensionCheck, 0, wxALL, 2);
|
m_pCollectionShowExtensionSizer->Add(m_pShowFileExtensionCheck, 0, wxALL, 2);
|
||||||
|
m_pDoubleClickToPlaySizer->Add(m_pDoubleClickToPlayCheck, 0, wxALL, 2);
|
||||||
|
|
||||||
m_pCollectionMainSizer->Add(m_pCollectionImportDirSizer, 0, wxALL | wxEXPAND, 2);
|
m_pCollectionMainSizer->Add(m_pCollectionImportDirSizer, 0, wxALL | wxEXPAND, 2);
|
||||||
m_pCollectionMainSizer->Add(m_pCollectionImportOptionsSizer, 0, wxALL | wxEXPAND, 2);
|
m_pCollectionMainSizer->Add(m_pCollectionImportOptionsSizer, 0, wxALL | wxEXPAND, 2);
|
||||||
m_pCollectionMainSizer->Add(m_pCollectionShowExtensionSizer, 0, wxALL | wxEXPAND, 2);
|
m_pCollectionMainSizer->Add(m_pCollectionShowExtensionSizer, 0, wxALL | wxEXPAND, 2);
|
||||||
|
m_pCollectionMainSizer->Add(m_pDoubleClickToPlaySizer, 0, wxALL | wxEXPAND, 2);
|
||||||
|
|
||||||
m_pButtonSizer->Add(m_pOkButton, 0, wxALL | wxALIGN_BOTTOM, 2);
|
m_pButtonSizer->Add(m_pOkButton, 0, wxALL | wxALIGN_BOTTOM, 2);
|
||||||
m_pButtonSizer->Add(m_pCancelButton, 0, wxALL | wxALIGN_BOTTOM, 2);
|
m_pButtonSizer->Add(m_pCancelButton, 0, wxALL | wxALIGN_BOTTOM, 2);
|
||||||
|
|
@ -299,6 +305,13 @@ void cSettings::OnCheckShowFileExtension(wxCommandEvent& event)
|
||||||
serializer.SerializeShowFileExtension(m_pShowFileExtensionCheck->GetValue());
|
serializer.SerializeShowFileExtension(m_pShowFileExtensionCheck->GetValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cSettings::OnCheckEnableDoubleClickToPlay(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
SampleHive::cSerializer serializer;
|
||||||
|
|
||||||
|
serializer.SerializeDoubleClickToPlay(m_pDoubleClickToPlayCheck->GetValue());
|
||||||
|
}
|
||||||
|
|
||||||
void cSettings::OnClickBrowseAutoImportDir(wxCommandEvent& event)
|
void cSettings::OnClickBrowseAutoImportDir(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
SampleHive::cSerializer serializer;
|
SampleHive::cSerializer serializer;
|
||||||
|
|
@ -418,6 +431,7 @@ void cSettings::LoadDefaultConfig()
|
||||||
m_pAutoImportCheck->SetValue(m_bAutoImport);
|
m_pAutoImportCheck->SetValue(m_bAutoImport);
|
||||||
m_pImportDirLocation->SetValue(serializer.DeserializeAutoImport().second);
|
m_pImportDirLocation->SetValue(serializer.DeserializeAutoImport().second);
|
||||||
m_pShowFileExtensionCheck->SetValue(serializer.DeserializeShowFileExtension());
|
m_pShowFileExtensionCheck->SetValue(serializer.DeserializeShowFileExtension());
|
||||||
|
m_pDoubleClickToPlayCheck->SetValue(serializer.DeserializeDoubleClickToPlay());
|
||||||
m_pFollowSymLinksCheck->SetValue(serializer.DeserializeFollowSymLink());
|
m_pFollowSymLinksCheck->SetValue(serializer.DeserializeFollowSymLink());
|
||||||
m_pRecursiveImportCheck->SetValue(serializer.DeserializeRecursiveImport());
|
m_pRecursiveImportCheck->SetValue(serializer.DeserializeRecursiveImport());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ class cSettings : public wxDialog
|
||||||
void OnCheckFollowSymLinks(wxCommandEvent& event);
|
void OnCheckFollowSymLinks(wxCommandEvent& event);
|
||||||
void OnCheckRecursiveImport(wxCommandEvent& event);
|
void OnCheckRecursiveImport(wxCommandEvent& event);
|
||||||
void OnCheckShowFileExtension(wxCommandEvent& event);
|
void OnCheckShowFileExtension(wxCommandEvent& event);
|
||||||
|
void OnCheckEnableDoubleClickToPlay(wxCommandEvent& event);
|
||||||
void OnClickBrowseAutoImportDir(wxCommandEvent& event);
|
void OnClickBrowseAutoImportDir(wxCommandEvent& event);
|
||||||
void OnChangeFontSize(wxSpinEvent& event);
|
void OnChangeFontSize(wxSpinEvent& event);
|
||||||
void OnSelectFont(wxCommandEvent& event);
|
void OnSelectFont(wxCommandEvent& event);
|
||||||
|
|
@ -126,10 +127,12 @@ class cSettings : public wxDialog
|
||||||
wxBoxSizer* m_pCollectionImportDirSizer = nullptr;
|
wxBoxSizer* m_pCollectionImportDirSizer = nullptr;
|
||||||
wxBoxSizer* m_pCollectionImportOptionsSizer = nullptr;
|
wxBoxSizer* m_pCollectionImportOptionsSizer = nullptr;
|
||||||
wxBoxSizer* m_pCollectionShowExtensionSizer = nullptr;
|
wxBoxSizer* m_pCollectionShowExtensionSizer = nullptr;
|
||||||
|
wxBoxSizer* m_pDoubleClickToPlaySizer = nullptr;
|
||||||
wxCheckBox* m_pAutoImportCheck = nullptr;
|
wxCheckBox* m_pAutoImportCheck = nullptr;
|
||||||
wxCheckBox* m_pFollowSymLinksCheck = nullptr;
|
wxCheckBox* m_pFollowSymLinksCheck = nullptr;
|
||||||
wxCheckBox* m_pRecursiveImportCheck = nullptr;
|
wxCheckBox* m_pRecursiveImportCheck = nullptr;
|
||||||
wxCheckBox* m_pShowFileExtensionCheck = nullptr;
|
wxCheckBox* m_pShowFileExtensionCheck = nullptr;
|
||||||
|
wxCheckBox* m_pDoubleClickToPlayCheck = nullptr;
|
||||||
wxTextCtrl* m_pImportDirLocation = nullptr;
|
wxTextCtrl* m_pImportDirLocation = nullptr;
|
||||||
wxButton* m_pBrowseAutoImportDirButton = nullptr;
|
wxButton* m_pBrowseAutoImportDirButton = nullptr;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,7 @@ cListCtrl::cListCtrl(wxWindow* window)
|
||||||
this->EnableDragSource(wxDF_FILENAME);
|
this->EnableDragSource(wxDF_FILENAME);
|
||||||
|
|
||||||
Bind(wxEVT_DATAVIEW_SELECTION_CHANGED, &cListCtrl::OnClickLibrary, this, SampleHive::ID::BC_Library);
|
Bind(wxEVT_DATAVIEW_SELECTION_CHANGED, &cListCtrl::OnClickLibrary, this, SampleHive::ID::BC_Library);
|
||||||
|
Bind(wxEVT_DATAVIEW_ITEM_ACTIVATED, &cListCtrl::OnDoubleClickLibrary, this, SampleHive::ID::BC_Library);
|
||||||
Bind(wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, &cListCtrl::OnDragFromLibrary, this);
|
Bind(wxEVT_DATAVIEW_ITEM_BEGIN_DRAG, &cListCtrl::OnDragFromLibrary, this);
|
||||||
this->Connect(wxEVT_DROP_FILES, wxDropFilesEventHandler(cListCtrl::OnDragAndDropToLibrary), NULL, this);
|
this->Connect(wxEVT_DROP_FILES, wxDropFilesEventHandler(cListCtrl::OnDragAndDropToLibrary), NULL, this);
|
||||||
Bind(wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, &cListCtrl::OnShowLibraryContextMenu, this, SampleHive::ID::BC_Library);
|
Bind(wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU, &cListCtrl::OnShowLibraryContextMenu, this, SampleHive::ID::BC_Library);
|
||||||
|
|
@ -244,6 +245,54 @@ void cListCtrl::OnClickLibrary(wxDataViewEvent& event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cListCtrl::OnDoubleClickLibrary(wxDataViewEvent& event)
|
||||||
|
{
|
||||||
|
cDatabase db;
|
||||||
|
SampleHive::cSerializer serializer;
|
||||||
|
|
||||||
|
int selected_row = this->ItemToRow(event.GetItem());
|
||||||
|
int current_row = this->ItemToRow(this->GetCurrentItem());
|
||||||
|
|
||||||
|
if (selected_row < 0 || !event.GetItem().IsOk())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (selected_row != current_row)
|
||||||
|
{
|
||||||
|
this->SetCurrentItem(event.GetItem());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the waveform bitmap
|
||||||
|
SampleHive::cSignal::SendWaveformUpdateStatus(*this);
|
||||||
|
|
||||||
|
// Update LoopAB button value
|
||||||
|
SampleHive::cSignal::SendLoopABButtonValueChange(*this);
|
||||||
|
|
||||||
|
// Stop the timer
|
||||||
|
SampleHive::cSignal::SendTimerStopStatus(*this);
|
||||||
|
|
||||||
|
wxString selection = this->GetTextValue(selected_row, 1);
|
||||||
|
|
||||||
|
// Get curremt column
|
||||||
|
wxDataViewColumn* CurrentColumn = this->GetCurrentColumn();
|
||||||
|
|
||||||
|
// Get favorite column
|
||||||
|
wxDataViewColumn* FavoriteColumn = this->GetColumn(0);
|
||||||
|
|
||||||
|
if (!CurrentColumn)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (CurrentColumn != FavoriteColumn)
|
||||||
|
{
|
||||||
|
// ClearLoopPoints();
|
||||||
|
SampleHive::cSignal::SendClearLoopPointsStatus(*this);
|
||||||
|
|
||||||
|
// Play the sample
|
||||||
|
if (serializer.DeserializeDoubleClickToPlay())
|
||||||
|
SampleHive::cSignal::SendCallFunctionPlay(selection, false, *this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void cListCtrl::OnDragAndDropToLibrary(wxDropFilesEvent& event)
|
void cListCtrl::OnDragAndDropToLibrary(wxDropFilesEvent& event)
|
||||||
{
|
{
|
||||||
SH_LOG_DEBUG("Start Inserting Samples");
|
SH_LOG_DEBUG("Start Inserting Samples");
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ class cListCtrl : public wxDataViewListCtrl
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Library event handlers
|
// Library event handlers
|
||||||
void OnClickLibrary(wxDataViewEvent& event);
|
void OnClickLibrary(wxDataViewEvent& event);
|
||||||
|
void OnDoubleClickLibrary(wxDataViewEvent& event);
|
||||||
void OnDragAndDropToLibrary(wxDropFilesEvent& event);
|
void OnDragAndDropToLibrary(wxDropFilesEvent& event);
|
||||||
void OnDragFromLibrary(wxDataViewEvent& event);
|
void OnDragFromLibrary(wxDataViewEvent& event);
|
||||||
void OnShowLibraryContextMenu(wxDataViewEvent& event);
|
void OnShowLibraryContextMenu(wxDataViewEvent& event);
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,11 @@ cMainFrame::cMainFrame()
|
||||||
|
|
||||||
m_pLibrary = new cLibrary(m_pBottomSplitter);
|
m_pLibrary = new cLibrary(m_pBottomSplitter);
|
||||||
|
|
||||||
|
if (m_bDemoMode)
|
||||||
|
{
|
||||||
|
m_pLibrary->GetInfoBarObject()->ShowMessage("WARNING: Demo mode is turned on, all samples will be deleted on application exit.", wxICON_WARNING);
|
||||||
|
}
|
||||||
|
|
||||||
SampleHive::cHiveData::Get().InitHiveData(*m_pLibrary->GetListCtrlObject(),
|
SampleHive::cHiveData::Get().InitHiveData(*m_pLibrary->GetListCtrlObject(),
|
||||||
*m_pNotebook->GetHivesPanel()->GetHivesObject(),
|
*m_pNotebook->GetHivesPanel()->GetHivesObject(),
|
||||||
m_pNotebook->GetHivesPanel()->GetFavoritesHive(),
|
m_pNotebook->GetHivesPanel()->GetFavoritesHive(),
|
||||||
|
|
@ -957,4 +962,17 @@ cMainFrame::~cMainFrame()
|
||||||
|
|
||||||
// Delete wxFilesystemWatcher
|
// Delete wxFilesystemWatcher
|
||||||
delete m_pFsWatcher;
|
delete m_pFsWatcher;
|
||||||
|
|
||||||
|
SampleHive::cSerializer serializer;
|
||||||
|
|
||||||
|
if (serializer.DeserializeDemoMode())
|
||||||
|
{
|
||||||
|
if (wxFileExists("tempdb.db"))
|
||||||
|
if (wxRemoveFile("tempdb.db"))
|
||||||
|
SH_LOG_WARN("Deleted temporary database file..");
|
||||||
|
else
|
||||||
|
SH_LOG_ERROR("Could not delete file..");
|
||||||
|
else
|
||||||
|
SH_LOG_DEBUG("File doesn't exists");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ namespace SampleHive { namespace ID {
|
||||||
SD_FollowSymLinks,
|
SD_FollowSymLinks,
|
||||||
SD_RecursiveImport,
|
SD_RecursiveImport,
|
||||||
SD_ShowFileExtension,
|
SD_ShowFileExtension,
|
||||||
|
SD_DoubleClickToPlay,
|
||||||
SD_BrowseAutoImportDir,
|
SD_BrowseAutoImportDir,
|
||||||
SD_FontType,
|
SD_FontType,
|
||||||
SD_FontSize,
|
SD_FontSize,
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,7 @@ namespace SampleHive {
|
||||||
m_Emitter << YAML::Key << "FollowSymLink" << YAML::Value << false;
|
m_Emitter << YAML::Key << "FollowSymLink" << YAML::Value << false;
|
||||||
m_Emitter << YAML::Key << "RecursiveImport" << YAML::Value << false;
|
m_Emitter << YAML::Key << "RecursiveImport" << YAML::Value << false;
|
||||||
m_Emitter << YAML::Key << "ShowFileExtension" << YAML::Value << true;
|
m_Emitter << YAML::Key << "ShowFileExtension" << YAML::Value << true;
|
||||||
|
m_Emitter << YAML::Key << "DoubleClickToPlay" << YAML::Value << false;
|
||||||
m_Emitter << YAML::EndMap << YAML::Newline;
|
m_Emitter << YAML::EndMap << YAML::Newline;
|
||||||
|
|
||||||
m_Emitter << YAML::EndMap;
|
m_Emitter << YAML::EndMap;
|
||||||
|
|
@ -811,6 +812,59 @@ namespace SampleHive {
|
||||||
return show_extension;
|
return show_extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cSerializer::SerializeDoubleClickToPlay(bool enableDoubleClick)
|
||||||
|
{
|
||||||
|
YAML::Emitter out;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
YAML::Node config = YAML::LoadFile(static_cast<std::string>(CONFIG_FILEPATH));
|
||||||
|
|
||||||
|
if (auto doubleClickValue = config["Collection"])
|
||||||
|
{
|
||||||
|
doubleClickValue["DoubleClickToPlay"] = enableDoubleClick;
|
||||||
|
|
||||||
|
out << config;
|
||||||
|
|
||||||
|
std::ofstream ofstrm(static_cast<std::string>(CONFIG_FILEPATH));
|
||||||
|
ofstrm << out.c_str();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SH_LOG_ERROR("Error! Cannot store show enable double click to play value.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (const YAML::ParserException& ex)
|
||||||
|
{
|
||||||
|
SH_LOG_ERROR(ex.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cSerializer::DeserializeDoubleClickToPlay() const
|
||||||
|
{
|
||||||
|
bool double_click_to_play = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
YAML::Node config = YAML::LoadFile(static_cast<std::string>(CONFIG_FILEPATH));
|
||||||
|
|
||||||
|
if (auto doubleClickValue = config["Collection"])
|
||||||
|
{
|
||||||
|
double_click_to_play = doubleClickValue["DoubleClickToPlay"].as<bool>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SH_LOG_ERROR("Error! Cannot fetch double click to play value.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (const YAML::ParserException& ex)
|
||||||
|
{
|
||||||
|
SH_LOG_ERROR(ex.what());
|
||||||
|
}
|
||||||
|
|
||||||
|
return double_click_to_play;
|
||||||
|
}
|
||||||
|
|
||||||
void cSerializer::SerializeDemoMode(bool showDemoMode)
|
void cSerializer::SerializeDemoMode(bool showDemoMode)
|
||||||
{
|
{
|
||||||
YAML::Emitter out;
|
YAML::Emitter out;
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,10 @@ namespace SampleHive {
|
||||||
void SerializeShowFileExtension(bool showExtension);
|
void SerializeShowFileExtension(bool showExtension);
|
||||||
bool DeserializeShowFileExtension() const;
|
bool DeserializeShowFileExtension() const;
|
||||||
|
|
||||||
|
// Enable double click to play
|
||||||
|
void SerializeDoubleClickToPlay(bool showExtension);
|
||||||
|
bool DeserializeDoubleClickToPlay() const;
|
||||||
|
|
||||||
// Demo mode
|
// Demo mode
|
||||||
void SerializeDemoMode(bool showDemoMode);
|
void SerializeDemoMode(bool showDemoMode);
|
||||||
bool DeserializeDemoMode() const;
|
bool DeserializeDemoMode() const;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue