Refactoring, organizing files in directories. Add directory watcher, removed unnecessary calls to settings dialog.
This commit is contained in:
parent
5714beab03
commit
c52d7708d8
26
meson.build
26
meson.build
|
|
@ -113,18 +113,24 @@ snd_opts.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON',
|
||||||
src = [
|
src = [
|
||||||
|
|
||||||
'src/App.cpp',
|
'src/App.cpp',
|
||||||
'src/MainFrame.cpp',
|
|
||||||
'src/SettingsDialog.cpp',
|
'src/GUI/MainFrame.cpp',
|
||||||
'src/TagEditorDialog.cpp',
|
'src/GUI/WaveformViewer.cpp',
|
||||||
'src/Database.cpp',
|
|
||||||
'src/Sample.cpp',
|
'src/GUI/Dialogs/Settings.cpp',
|
||||||
'src/Serialize.cpp',
|
'src/GUI/Dialogs/TagEditor.cpp',
|
||||||
'src/Tags.cpp',
|
|
||||||
'src/WaveformViewer.cpp',
|
'src/Database/Database.cpp',
|
||||||
'src/SH_Event.cpp',
|
|
||||||
|
'src/Utility/Sample.cpp',
|
||||||
|
'src/Utility/Serialize.cpp',
|
||||||
|
'src/Utility/Tags.cpp',
|
||||||
|
'src/Utility/SH_Event.cpp',
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
include_dirs = include_directories('src')
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
wx = dependency('wxwidgets', version: '>=3.1.5', required: false)
|
wx = dependency('wxwidgets', version: '>=3.1.5', required: false)
|
||||||
|
|
||||||
|
|
@ -197,12 +203,14 @@ if wx_found
|
||||||
sources: src,
|
sources: src,
|
||||||
cpp_args: [wx_cxx_flags],
|
cpp_args: [wx_cxx_flags],
|
||||||
link_args: [wx_libs],
|
link_args: [wx_libs],
|
||||||
|
include_directories : include_dirs,
|
||||||
dependencies: [wx, taglib, sqlite3, yaml, snd],
|
dependencies: [wx, taglib, sqlite3, yaml, snd],
|
||||||
install: true,
|
install: true,
|
||||||
install_rpath: prefix / 'lib')
|
install_rpath: prefix / 'lib')
|
||||||
else
|
else
|
||||||
executable('SampleHive',
|
executable('SampleHive',
|
||||||
sources: src,
|
sources: src,
|
||||||
|
include_directories : include_dirs,
|
||||||
dependencies: [wx, taglib, sqlite3, yaml, snd],
|
dependencies: [wx, taglib, sqlite3, yaml, snd],
|
||||||
install: true,
|
install: true,
|
||||||
install_rpath: prefix / 'lib')
|
install_rpath: prefix / 'lib')
|
||||||
|
|
|
||||||
10
src/App.cpp
10
src/App.cpp
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include <wx/bitmap.h>
|
#include <wx/bitmap.h>
|
||||||
#include <wx/defs.h>
|
#include <wx/defs.h>
|
||||||
|
#include <wx/fswatcher.h>
|
||||||
#include <wx/gdicmn.h>
|
#include <wx/gdicmn.h>
|
||||||
#include <wx/splash.h>
|
#include <wx/splash.h>
|
||||||
|
|
||||||
|
|
@ -45,6 +46,9 @@ bool App::OnInit()
|
||||||
if (!wxApp::OnInit())
|
if (!wxApp::OnInit())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
wxLog::AddTraceMask("EventSource");
|
||||||
|
wxLog::AddTraceMask(wxTRACE_FSWATCHER);
|
||||||
|
|
||||||
m_Frame = new MainFrame();
|
m_Frame = new MainFrame();
|
||||||
|
|
||||||
wxBitmap bitmap;
|
wxBitmap bitmap;
|
||||||
|
|
@ -85,3 +89,9 @@ bool App::OnCmdLineParsed(wxCmdLineParser& parser)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void App::OnEventLoopEnter(wxEventLoopBase* event)
|
||||||
|
{
|
||||||
|
if (m_Frame->CreateWatcherIfNecessary())
|
||||||
|
wxLogDebug("Filesystem watcher created sucessfully");
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "MainFrame.hpp"
|
#include "GUI/MainFrame.hpp"
|
||||||
|
|
||||||
#include <wx/app.h>
|
#include <wx/app.h>
|
||||||
#include <wx/cmdline.h>
|
#include <wx/cmdline.h>
|
||||||
|
|
@ -36,6 +36,7 @@ class App : public wxApp
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool OnInit();
|
virtual bool OnInit();
|
||||||
|
virtual void OnEventLoopEnter(wxEventLoopBase* event);
|
||||||
virtual void OnInitCmdLine(wxCmdLineParser& parser);
|
virtual void OnInitCmdLine(wxCmdLineParser& parser);
|
||||||
virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
|
virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Database.hpp"
|
#include "Database/Database.hpp"
|
||||||
|
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
@ -126,7 +126,7 @@ void Database::CreateTableHives()
|
||||||
}
|
}
|
||||||
catch (const std::exception &e)
|
catch (const std::exception &e)
|
||||||
{
|
{
|
||||||
show_modal_dialog_and_log("Error! Cannot create table hives: ", "Error", e.what());
|
show_modal_dialog_and_log("Error! Cannot create hives table", "Error", e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -548,9 +548,12 @@ std::string Database::GetSampleFileExtension(const std::string &filename)
|
||||||
return extension;
|
return extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxVector<wxVector<wxVariant>> Database::LoadSamplesDatabase(wxDataViewTreeCtrl &favorite_tree, wxDataViewItem &favorite_item,
|
wxVector<wxVector<wxVariant>> Database::LoadSamplesDatabase(wxDataViewTreeCtrl &favorite_tree,
|
||||||
wxTreeCtrl &trash_tree, wxTreeItemId &trash_item, bool show_extension,
|
wxDataViewItem &favorite_item,
|
||||||
const std::string &icon_star_filled, const std::string &icon_star_empty)
|
wxTreeCtrl &trash_tree, wxTreeItemId &trash_item,
|
||||||
|
bool show_extension,
|
||||||
|
const std::string &icon_star_filled,
|
||||||
|
const std::string &icon_star_empty)
|
||||||
{
|
{
|
||||||
wxVector<wxVector<wxVariant>> vecSet;
|
wxVector<wxVector<wxVariant>> vecSet;
|
||||||
|
|
||||||
|
|
@ -560,17 +563,17 @@ wxVector<wxVector<wxVariant>> Database::LoadSamplesDatabase(wxDataViewTreeCtrl &
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int numRows = 0;
|
int num_rows = 0;
|
||||||
|
|
||||||
Sqlite3Statement statement1(m_Database, "SELECT Count(*) FROM SAMPLES;");
|
Sqlite3Statement statement1(m_Database, "SELECT Count(*) FROM SAMPLES;");
|
||||||
|
|
||||||
if (SQLITE_ROW == sqlite3_step(statement1.stmt))
|
if (SQLITE_ROW == sqlite3_step(statement1.stmt))
|
||||||
{
|
{
|
||||||
numRows = sqlite3_column_int(statement1.stmt, 0);
|
num_rows = sqlite3_column_int(statement1.stmt, 0);
|
||||||
|
|
||||||
wxLogDebug("rows %d", numRows);
|
wxLogDebug("Loading %d samples..", num_rows);
|
||||||
|
|
||||||
vecSet.reserve(numRows);
|
vecSet.reserve(num_rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
Sqlite3Statement statement(m_Database, "SELECT FAVORITE, FILENAME, EXTENSION, SAMPLEPACK, \
|
Sqlite3Statement statement(m_Database, "SELECT FAVORITE, FILENAME, EXTENSION, SAMPLEPACK, \
|
||||||
|
|
@ -615,8 +618,6 @@ wxVector<wxVector<wxVariant>> Database::LoadSamplesDatabase(wxDataViewTreeCtrl &
|
||||||
// vec.push_back(true);
|
// vec.push_back(true);
|
||||||
vec.push_back(icon_filled);
|
vec.push_back(icon_filled);
|
||||||
|
|
||||||
wxLogDebug("Loading hives..");
|
|
||||||
|
|
||||||
std::deque<wxDataViewItem> nodes;
|
std::deque<wxDataViewItem> nodes;
|
||||||
nodes.push_back(favorite_tree.GetNthChild(wxDataViewItem(wxNullPtr), 0));
|
nodes.push_back(favorite_tree.GetNthChild(wxDataViewItem(wxNullPtr), 0));
|
||||||
|
|
||||||
|
|
@ -633,7 +634,6 @@ wxVector<wxVector<wxVariant>> Database::LoadSamplesDatabase(wxDataViewTreeCtrl &
|
||||||
if (favorite_tree.GetItemText(current_item) == hive_name)
|
if (favorite_tree.GetItemText(current_item) == hive_name)
|
||||||
{
|
{
|
||||||
found_item = current_item;
|
found_item = current_item;
|
||||||
wxLogDebug("Loading, hive name: %s", hive_name);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -652,21 +652,14 @@ wxVector<wxVector<wxVariant>> Database::LoadSamplesDatabase(wxDataViewTreeCtrl &
|
||||||
|
|
||||||
if (found_item.IsOk())
|
if (found_item.IsOk())
|
||||||
{
|
{
|
||||||
// wxLogDebug("Another hive by the name %s already exist. Please try with a different name.",
|
|
||||||
// hive_name);
|
|
||||||
if (show_extension)
|
if (show_extension)
|
||||||
favorite_tree.AppendItem(found_item,
|
favorite_tree.AppendItem(found_item,
|
||||||
wxString::Format("%s.%s", filename, file_extension));
|
wxString::Format("%s.%s", filename, file_extension));
|
||||||
else
|
else
|
||||||
favorite_tree.AppendItem(found_item, filename);
|
favorite_tree.AppendItem(found_item, filename);
|
||||||
}
|
}
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// favorite_tree.AppendItem(wxDataViewItem(wxNullPtr), hive_name);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// vec.push_back(false);
|
|
||||||
vec.push_back(icon_empty);
|
vec.push_back(icon_empty);
|
||||||
|
|
||||||
if (show_extension)
|
if (show_extension)
|
||||||
|
|
@ -744,13 +737,6 @@ Database::FilterDatabaseBySampleName(const std::string &sampleName, bool show_ex
|
||||||
else
|
else
|
||||||
vec.push_back(icon_empty);
|
vec.push_back(icon_empty);
|
||||||
|
|
||||||
// if (favorite == 1)
|
|
||||||
// vec.push_back(true);
|
|
||||||
// else
|
|
||||||
// vec.push_back(false);
|
|
||||||
|
|
||||||
// vec.push_back(filename);
|
|
||||||
|
|
||||||
if (show_extension)
|
if (show_extension)
|
||||||
{
|
{
|
||||||
vec.push_back(path.AfterLast('/'));
|
vec.push_back(path.AfterLast('/'));
|
||||||
|
|
@ -872,8 +858,10 @@ void Database::LoadHivesDatabase(wxDataViewTreeCtrl &treeCtrl)
|
||||||
|
|
||||||
while (SQLITE_ROW == sqlite3_step(statement.stmt))
|
while (SQLITE_ROW == sqlite3_step(statement.stmt))
|
||||||
{
|
{
|
||||||
wxLogDebug("Record found, fetching..");
|
wxLogDebug("Loading hives..");
|
||||||
const auto hive = wxString(std::string(reinterpret_cast<const char *>(sqlite3_column_text(statement.stmt, 0))));
|
|
||||||
|
const auto hive = wxString(std::string(reinterpret_cast<const char *>
|
||||||
|
(sqlite3_column_text(statement.stmt, 0))));
|
||||||
|
|
||||||
treeCtrl.AppendContainer(wxDataViewItem(wxNullPtr), hive);
|
treeCtrl.AppendContainer(wxDataViewItem(wxNullPtr), hive);
|
||||||
}
|
}
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Sample.hpp"
|
#include "Utility/Sample.hpp"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
@ -18,9 +18,9 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ControlID_Enums.hpp"
|
#include "GUI/Dialogs/Settings.hpp"
|
||||||
#include "SettingsDialog.hpp"
|
#include "Utility/ControlID_Enums.hpp"
|
||||||
#include "Serialize.hpp"
|
#include "Utility/Serialize.hpp"
|
||||||
|
|
||||||
#include <wx/defs.h>
|
#include <wx/defs.h>
|
||||||
#include <wx/gdicmn.h>
|
#include <wx/gdicmn.h>
|
||||||
|
|
@ -52,34 +52,50 @@ Settings::Settings(wxWindow* window, const std::string& configFilepath, const st
|
||||||
m_DisplayFontSizer = new wxBoxSizer(wxHORIZONTAL);
|
m_DisplayFontSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
m_WaveformColourSizer = new wxBoxSizer(wxHORIZONTAL);
|
m_WaveformColourSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
|
||||||
wxString fontChoices[] = {"System default"};
|
|
||||||
Serializer serializer(m_ConfigFilepath);
|
Serializer serializer(m_ConfigFilepath);
|
||||||
// m_RowHeightText = new wxStaticText();
|
|
||||||
m_FontTypeText = new wxStaticText(m_DisplaySettingPanel, wxID_ANY, "Font", wxDefaultPosition, wxDefaultSize, 0);
|
wxString fontChoices[] = { "System default" };
|
||||||
// m_RowHeight = new wxChoice();
|
|
||||||
m_FontType = new wxChoice(m_DisplaySettingPanel, SD_FontType, wxDefaultPosition, wxDefaultSize, 1, fontChoices, 0);
|
m_FontTypeText = new wxStaticText(m_DisplaySettingPanel, wxID_ANY, "Font",
|
||||||
|
wxDefaultPosition, wxDefaultSize, 0);
|
||||||
|
m_FontType = new wxChoice(m_DisplaySettingPanel, SD_FontType,
|
||||||
|
wxDefaultPosition, wxDefaultSize, 1, fontChoices, 0);
|
||||||
m_FontType->SetSelection(0);
|
m_FontType->SetSelection(0);
|
||||||
m_FontSize = new wxSpinCtrl(m_DisplaySettingPanel, SD_FontSize, "Default", wxDefaultPosition, wxDefaultSize);
|
m_FontSize = new wxSpinCtrl(m_DisplaySettingPanel, SD_FontSize, "Default",
|
||||||
|
wxDefaultPosition, wxDefaultSize);
|
||||||
m_FontSize->SetValue(window->GetFont().GetPointSize());
|
m_FontSize->SetValue(window->GetFont().GetPointSize());
|
||||||
m_FontBrowseButton = new wxButton(m_DisplaySettingPanel, SD_FontBrowseButton, "Select font", wxDefaultPosition, wxDefaultSize, 0);
|
m_FontBrowseButton = new wxButton(m_DisplaySettingPanel, SD_FontBrowseButton, "Select font",
|
||||||
m_WaveformColourLabel = new wxStaticText(m_DisplaySettingPanel, wxID_ANY, "Waveform colour", wxDefaultPosition, wxDefaultSize, 0);
|
wxDefaultPosition, wxDefaultSize, 0);
|
||||||
m_WaveformColourPickerCtrl = new wxColourPickerCtrl(m_DisplaySettingPanel, SD_WaveformColourPickerCtrl, serializer.DeserializeWaveformColour(),
|
m_WaveformColourLabel = new wxStaticText(m_DisplaySettingPanel, wxID_ANY, "Waveform colour",
|
||||||
wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE);
|
wxDefaultPosition, wxDefaultSize, 0);
|
||||||
|
m_WaveformColourPickerCtrl = new wxColourPickerCtrl(m_DisplaySettingPanel, SD_WaveformColourPickerCtrl,
|
||||||
|
serializer.DeserializeWaveformColour(),
|
||||||
|
wxDefaultPosition, wxDefaultSize,
|
||||||
|
wxCLRP_DEFAULT_STYLE);
|
||||||
|
|
||||||
m_CollectionSettingPanel = new wxPanel(m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
m_CollectionSettingPanel = new wxPanel(m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||||
|
|
||||||
m_CollectionTopSizer = new wxBoxSizer(wxVERTICAL);
|
m_CollectionMainSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
m_CollectionImportDirSizer = new wxBoxSizer(wxHORIZONTAL);
|
m_CollectionImportDirSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
m_ShowFileExtensionSizer = new wxBoxSizer(wxHORIZONTAL);
|
m_CollectionBottomSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
wxString defaultDir = wxGetHomeDir();
|
wxString defaultDir = wxGetHomeDir();
|
||||||
|
|
||||||
m_AutoImportCheck = new wxCheckBox(m_CollectionSettingPanel, SD_AutoImport, "Auto import", wxDefaultPosition, wxDefaultSize, 0);
|
m_AutoImportCheck = new wxCheckBox(m_CollectionSettingPanel, SD_AutoImport, "Auto import",
|
||||||
m_ImportDirLocation = new wxTextCtrl(m_CollectionSettingPanel, wxID_ANY, defaultDir, wxDefaultPosition, wxDefaultSize, 0);
|
wxDefaultPosition, wxDefaultSize, 0);
|
||||||
|
m_ImportDirLocation = new wxTextCtrl(m_CollectionSettingPanel, wxID_ANY, defaultDir,
|
||||||
|
wxDefaultPosition, wxDefaultSize, 0);
|
||||||
m_ImportDirLocation->Disable();
|
m_ImportDirLocation->Disable();
|
||||||
m_BrowseAutoImportDirButton = new wxButton(m_CollectionSettingPanel, SD_BrowseAutoImportDir, "Browse", wxDefaultPosition, wxDefaultSize, 0);
|
m_BrowseAutoImportDirButton = new wxButton(m_CollectionSettingPanel, SD_BrowseAutoImportDir, "Browse",
|
||||||
|
wxDefaultPosition, wxDefaultSize, 0);
|
||||||
m_BrowseAutoImportDirButton->Disable();
|
m_BrowseAutoImportDirButton->Disable();
|
||||||
m_ShowFileExtensionCheck = new wxCheckBox(m_CollectionSettingPanel, SD_ShowFileExtension, "Show file extension", wxDefaultPosition, wxDefaultSize, 0);
|
m_FollowSymLinksCheck = new wxCheckBox(m_CollectionSettingPanel, SD_FollowSymLinks,
|
||||||
|
"Follow symbolic links", wxDefaultPosition, wxDefaultSize, 0);
|
||||||
|
m_FollowSymLinksCheck->SetToolTip("Wheather to follow symbolic links");
|
||||||
|
m_FollowSymLinksCheck->Disable();
|
||||||
|
m_ShowFileExtensionCheck = new wxCheckBox(m_CollectionSettingPanel, SD_ShowFileExtension,
|
||||||
|
"Show file extension", wxDefaultPosition, wxDefaultSize, 0);
|
||||||
|
m_ShowFileExtensionCheck->SetToolTip("Weather to show file extension");
|
||||||
|
|
||||||
m_ConfigurationSettingPanel = new wxPanel(m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
m_ConfigurationSettingPanel = new wxPanel(m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||||
|
|
||||||
|
|
@ -88,12 +104,18 @@ Settings::Settings(wxWindow* window, const std::string& configFilepath, const st
|
||||||
m_GeneralMainSizer->SetFlexibleDirection(wxBOTH);
|
m_GeneralMainSizer->SetFlexibleDirection(wxBOTH);
|
||||||
m_GeneralMainSizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
|
m_GeneralMainSizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
|
||||||
|
|
||||||
m_ConfigLabel = new wxStaticText(m_ConfigurationSettingPanel, wxID_ANY, "Default configuration file location", wxDefaultPosition, wxDefaultSize);
|
m_ConfigLabel = new wxStaticText(m_ConfigurationSettingPanel, wxID_ANY,
|
||||||
m_ConfigText = new wxTextCtrl(m_ConfigurationSettingPanel, wxID_ANY, configFilepath, wxDefaultPosition, wxDefaultSize);
|
"Default configuration file location", wxDefaultPosition, wxDefaultSize);
|
||||||
m_ConfigBrowse = new wxButton(m_ConfigurationSettingPanel, SD_BrowseConfigDir, "Browse", wxDefaultPosition, wxDefaultSize, 0);
|
m_ConfigText = new wxTextCtrl(m_ConfigurationSettingPanel, wxID_ANY, configFilepath,
|
||||||
m_DatabaseLabel = new wxStaticText(m_ConfigurationSettingPanel, wxID_ANY, "Default database location", wxDefaultPosition, wxDefaultSize);
|
wxDefaultPosition, wxDefaultSize);
|
||||||
m_DatabaseText = new wxTextCtrl(m_ConfigurationSettingPanel, wxID_ANY, databaseFilepath, wxDefaultPosition, wxDefaultSize);
|
m_ConfigBrowse = new wxButton(m_ConfigurationSettingPanel, SD_BrowseConfigDir, "Browse",
|
||||||
m_DatabaseBrowse = new wxButton(m_ConfigurationSettingPanel, SD_BrowseDatabaseDir, "Browse", wxDefaultPosition, wxDefaultSize, 0);
|
wxDefaultPosition, wxDefaultSize, 0);
|
||||||
|
m_DatabaseLabel = new wxStaticText(m_ConfigurationSettingPanel, wxID_ANY, "Default database location",
|
||||||
|
wxDefaultPosition, wxDefaultSize);
|
||||||
|
m_DatabaseText = new wxTextCtrl(m_ConfigurationSettingPanel, wxID_ANY, databaseFilepath,
|
||||||
|
wxDefaultPosition, wxDefaultSize);
|
||||||
|
m_DatabaseBrowse = new wxButton(m_ConfigurationSettingPanel, SD_BrowseDatabaseDir, "Browse",
|
||||||
|
wxDefaultPosition, wxDefaultSize, 0);
|
||||||
|
|
||||||
m_Notebook->AddPage(m_DisplaySettingPanel, "Display");
|
m_Notebook->AddPage(m_DisplaySettingPanel, "Display");
|
||||||
m_Notebook->AddPage(m_CollectionSettingPanel, "Collection");
|
m_Notebook->AddPage(m_CollectionSettingPanel, "Collection");
|
||||||
|
|
@ -106,6 +128,7 @@ Settings::Settings(wxWindow* window, const std::string& configFilepath, const st
|
||||||
|
|
||||||
// Bind events
|
// Bind events
|
||||||
Bind(wxEVT_CHECKBOX, &Settings::OnCheckAutoImport, this, SD_AutoImport);
|
Bind(wxEVT_CHECKBOX, &Settings::OnCheckAutoImport, this, SD_AutoImport);
|
||||||
|
Bind(wxEVT_CHECKBOX, &Settings::OnCheckFollowSymLinks, this, SD_FollowSymLinks);
|
||||||
Bind(wxEVT_CHECKBOX, &Settings::OnCheckShowFileExtension, this, SD_ShowFileExtension);
|
Bind(wxEVT_CHECKBOX, &Settings::OnCheckShowFileExtension, this, SD_ShowFileExtension);
|
||||||
Bind(wxEVT_SPINCTRL, &Settings::OnChangeFontSize, this, SD_FontSize);
|
Bind(wxEVT_SPINCTRL, &Settings::OnChangeFontSize, this, SD_FontSize);
|
||||||
Bind(wxEVT_BUTTON, &Settings::OnSelectFont, this, SD_FontBrowseButton);
|
Bind(wxEVT_BUTTON, &Settings::OnSelectFont, this, SD_FontBrowseButton);
|
||||||
|
|
@ -139,10 +162,11 @@ Settings::Settings(wxWindow* window, const std::string& configFilepath, const st
|
||||||
m_CollectionImportDirSizer->Add(m_ImportDirLocation, 1, wxALL | wxALIGN_CENTER_VERTICAL, 2);
|
m_CollectionImportDirSizer->Add(m_ImportDirLocation, 1, wxALL | wxALIGN_CENTER_VERTICAL, 2);
|
||||||
m_CollectionImportDirSizer->Add(m_BrowseAutoImportDirButton, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
|
m_CollectionImportDirSizer->Add(m_BrowseAutoImportDirButton, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
|
||||||
|
|
||||||
m_ShowFileExtensionSizer->Add(m_ShowFileExtensionCheck, 0, wxALL, 2);
|
m_CollectionBottomSizer->Add(m_FollowSymLinksCheck, 0, wxALL, 2);
|
||||||
|
m_CollectionBottomSizer->Add(m_ShowFileExtensionCheck, 0, wxALL, 2);
|
||||||
|
|
||||||
m_CollectionTopSizer->Add(m_CollectionImportDirSizer, 0, wxALL | wxEXPAND, 2);
|
m_CollectionMainSizer->Add(m_CollectionImportDirSizer, 0, wxALL | wxEXPAND, 2);
|
||||||
m_CollectionTopSizer->Add(m_ShowFileExtensionSizer, 0, wxALL | wxEXPAND, 2);
|
m_CollectionMainSizer->Add(m_CollectionBottomSizer, 0, wxALL | wxEXPAND, 2);
|
||||||
|
|
||||||
m_ButtonSizer->Add(m_OkButton, 0, wxALL | wxALIGN_BOTTOM, 2);
|
m_ButtonSizer->Add(m_OkButton, 0, wxALL | wxALIGN_BOTTOM, 2);
|
||||||
m_ButtonSizer->Add(m_CancelButton, 0, wxALL | wxALIGN_BOTTOM, 2);
|
m_ButtonSizer->Add(m_CancelButton, 0, wxALL | wxALIGN_BOTTOM, 2);
|
||||||
|
|
@ -163,10 +187,10 @@ Settings::Settings(wxWindow* window, const std::string& configFilepath, const st
|
||||||
m_DisplayTopSizer->Layout();
|
m_DisplayTopSizer->Layout();
|
||||||
|
|
||||||
// Collection panel layout
|
// Collection panel layout
|
||||||
m_CollectionSettingPanel->SetSizer(m_CollectionTopSizer);
|
m_CollectionSettingPanel->SetSizer(m_CollectionMainSizer);
|
||||||
m_CollectionTopSizer->Fit(m_CollectionSettingPanel);
|
m_CollectionMainSizer->Fit(m_CollectionSettingPanel);
|
||||||
m_CollectionTopSizer->SetSizeHints(m_CollectionSettingPanel);
|
m_CollectionMainSizer->SetSizeHints(m_CollectionSettingPanel);
|
||||||
m_CollectionTopSizer->Layout();
|
m_CollectionMainSizer->Layout();
|
||||||
|
|
||||||
// Configuration panel layout
|
// Configuration panel layout
|
||||||
m_ConfigurationSettingPanel->SetSizer(m_GeneralMainSizer);
|
m_ConfigurationSettingPanel->SetSizer(m_GeneralMainSizer);
|
||||||
|
|
@ -179,17 +203,17 @@ void Settings::OnClickConfigBrowse(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
wxString initial_dir = wxGetHomeDir();
|
wxString initial_dir = wxGetHomeDir();
|
||||||
|
|
||||||
m_DirDialog = new wxDirDialog(this, "Select a directory..", initial_dir,
|
wxDirDialog dir_dialog(this, "Select a directory..", initial_dir,
|
||||||
wxDD_DEFAULT_STYLE |
|
wxDD_DEFAULT_STYLE |
|
||||||
wxDD_DIR_MUST_EXIST |
|
wxDD_DIR_MUST_EXIST |
|
||||||
wxDD_NEW_DIR_BUTTON,
|
wxDD_NEW_DIR_BUTTON,
|
||||||
wxDefaultPosition, wxDefaultSize);
|
wxDefaultPosition, wxDefaultSize);
|
||||||
|
|
||||||
switch (m_DirDialog->ShowModal())
|
switch (dir_dialog.ShowModal())
|
||||||
{
|
{
|
||||||
case wxID_OK:
|
case wxID_OK:
|
||||||
{
|
{
|
||||||
wxString path = m_DirDialog->GetPath();
|
wxString path = dir_dialog.GetPath();
|
||||||
m_ConfigText->SetValue(path + "/config.yaml");
|
m_ConfigText->SetValue(path + "/config.yaml");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -202,17 +226,17 @@ void Settings::OnClickDatabaseBrowse(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
wxString initial_dir = wxGetHomeDir();
|
wxString initial_dir = wxGetHomeDir();
|
||||||
|
|
||||||
m_DirDialog = new wxDirDialog(this, "Select a directory..", initial_dir,
|
wxDirDialog dir_dialog(this, "Select a directory..", initial_dir,
|
||||||
wxDD_DEFAULT_STYLE |
|
wxDD_DEFAULT_STYLE |
|
||||||
wxDD_DIR_MUST_EXIST |
|
wxDD_DIR_MUST_EXIST |
|
||||||
wxDD_NEW_DIR_BUTTON,
|
wxDD_NEW_DIR_BUTTON,
|
||||||
wxDefaultPosition, wxDefaultSize);
|
wxDefaultPosition, wxDefaultSize);
|
||||||
|
|
||||||
switch (m_DirDialog->ShowModal())
|
switch (dir_dialog.ShowModal())
|
||||||
{
|
{
|
||||||
case wxID_OK:
|
case wxID_OK:
|
||||||
{
|
{
|
||||||
wxString path = m_DirDialog->GetPath();
|
wxString path = dir_dialog.GetPath();
|
||||||
m_DatabaseText->SetValue(path + "/config.yaml");
|
m_DatabaseText->SetValue(path + "/config.yaml");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -230,33 +254,33 @@ void Settings::OnCheckAutoImport(wxCommandEvent& event)
|
||||||
bAutoImport = false;
|
bAutoImport = false;
|
||||||
m_ImportDirLocation->Disable();
|
m_ImportDirLocation->Disable();
|
||||||
m_BrowseAutoImportDirButton->Disable();
|
m_BrowseAutoImportDirButton->Disable();
|
||||||
|
m_FollowSymLinksCheck->Disable();
|
||||||
|
|
||||||
serializer.SerializeAutoImportSettings(*m_ImportDirLocation, *m_AutoImportCheck);
|
serializer.SerializeAutoImportSettings(bAutoImport, m_ImportDirLocation->GetValue().ToStdString());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bAutoImport = true;
|
bAutoImport = true;
|
||||||
m_ImportDirLocation->Enable();
|
m_ImportDirLocation->Enable();
|
||||||
m_BrowseAutoImportDirButton->Enable();
|
m_BrowseAutoImportDirButton->Enable();
|
||||||
|
m_FollowSymLinksCheck->Enable();
|
||||||
|
|
||||||
serializer.SerializeAutoImportSettings(*m_ImportDirLocation, *m_AutoImportCheck);
|
serializer.SerializeAutoImportSettings(bAutoImport, m_ImportDirLocation->GetValue().ToStdString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Settings::OnCheckFollowSymLinks(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
Serializer serialize(m_ConfigFilepath);
|
||||||
|
|
||||||
|
serialize.SerializeFollowSymLink(m_FollowSymLinksCheck->GetValue());
|
||||||
|
}
|
||||||
|
|
||||||
void Settings::OnCheckShowFileExtension(wxCommandEvent& event)
|
void Settings::OnCheckShowFileExtension(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
Serializer serialize(m_ConfigFilepath);
|
Serializer serialize(m_ConfigFilepath);
|
||||||
|
|
||||||
if (!m_ShowFileExtensionCheck->GetValue())
|
serialize.SerializeShowFileExtensionSetting(m_ShowFileExtensionCheck->GetValue());
|
||||||
{
|
|
||||||
bShowExtension = false;
|
|
||||||
serialize.SerializeShowFileExtensionSetting(*m_ShowFileExtensionCheck);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bShowExtension = true;
|
|
||||||
serialize.SerializeShowFileExtensionSetting(*m_ShowFileExtensionCheck);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::OnClickBrowseAutoImportDir(wxCommandEvent& event)
|
void Settings::OnClickBrowseAutoImportDir(wxCommandEvent& event)
|
||||||
|
|
@ -265,20 +289,20 @@ void Settings::OnClickBrowseAutoImportDir(wxCommandEvent& event)
|
||||||
|
|
||||||
wxString initial_dir = wxGetHomeDir();
|
wxString initial_dir = wxGetHomeDir();
|
||||||
|
|
||||||
m_DirDialog = new wxDirDialog(this, "Select a directory..", initial_dir,
|
wxDirDialog dir_dialog(this, "Select a directory..", initial_dir,
|
||||||
wxDD_DEFAULT_STYLE |
|
wxDD_DEFAULT_STYLE |
|
||||||
wxDD_DIR_MUST_EXIST |
|
wxDD_DIR_MUST_EXIST |
|
||||||
wxDD_NEW_DIR_BUTTON,
|
wxDD_NEW_DIR_BUTTON,
|
||||||
wxDefaultPosition, wxDefaultSize);
|
wxDefaultPosition, wxDefaultSize);
|
||||||
|
|
||||||
switch (m_DirDialog->ShowModal())
|
switch (dir_dialog.ShowModal())
|
||||||
{
|
{
|
||||||
case wxID_OK:
|
case wxID_OK:
|
||||||
{
|
{
|
||||||
wxString path = m_DirDialog->GetPath();
|
wxString path = dir_dialog.GetPath();
|
||||||
m_ImportDirLocation->SetValue(path);
|
m_ImportDirLocation->SetValue(path);
|
||||||
|
|
||||||
serializer.SerializeAutoImportSettings(*m_ImportDirLocation, *m_AutoImportCheck);
|
serializer.SerializeAutoImportSettings(bAutoImport, m_ImportDirLocation->GetValue().ToStdString());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
@ -288,13 +312,13 @@ void Settings::OnClickBrowseAutoImportDir(wxCommandEvent& event)
|
||||||
|
|
||||||
void Settings::OnSelectFont(wxCommandEvent& event)
|
void Settings::OnSelectFont(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
m_FontDialog = new wxFontDialog(this);
|
wxFontDialog font_dialog(this);
|
||||||
|
|
||||||
switch (m_FontDialog->ShowModal())
|
switch (font_dialog.ShowModal())
|
||||||
{
|
{
|
||||||
case wxID_OK:
|
case wxID_OK:
|
||||||
{
|
{
|
||||||
wxFontData fontData = m_FontDialog->GetFontData();
|
wxFontData fontData = font_dialog.GetFontData();
|
||||||
m_Font = fontData.GetChosenFont();
|
m_Font = fontData.GetChosenFont();
|
||||||
|
|
||||||
if (m_FontType->GetCount() > 1)
|
if (m_FontType->GetCount() > 1)
|
||||||
|
|
@ -324,7 +348,7 @@ void Settings::OnChangeFontSize(wxSpinEvent& event)
|
||||||
|
|
||||||
int font_size = m_FontSize->GetValue();
|
int font_size = m_FontSize->GetValue();
|
||||||
|
|
||||||
if ( m_FontType->GetStringSelection() == "System default" )
|
if (m_FontType->GetStringSelection() == "System default")
|
||||||
m_Font = wxSystemSettings::GetFont(wxSYS_SYSTEM_FONT);
|
m_Font = wxSystemSettings::GetFont(wxSYS_SYSTEM_FONT);
|
||||||
|
|
||||||
m_Font.SetPointSize(font_size);
|
m_Font.SetPointSize(font_size);
|
||||||
|
|
@ -343,13 +367,13 @@ void Settings::LoadDefaultConfig()
|
||||||
Serializer serializer(m_ConfigFilepath);
|
Serializer serializer(m_ConfigFilepath);
|
||||||
|
|
||||||
wxFont sys_font = wxSystemSettings::GetFont(wxSYS_SYSTEM_FONT);
|
wxFont sys_font = wxSystemSettings::GetFont(wxSYS_SYSTEM_FONT);
|
||||||
std::string system_font = sys_font.GetFaceName().ToStdString();
|
wxString system_font = sys_font.GetFaceName();
|
||||||
int system_font_size = sys_font.GetPointSize();
|
int system_font_size = sys_font.GetPointSize();
|
||||||
|
|
||||||
wxString font_face = serializer.DeserializeDisplaySettings().font_face;
|
wxString font_face = serializer.DeserializeDisplaySettings().GetFaceName();
|
||||||
int font_size = serializer.DeserializeDisplaySettings().font_size;
|
int font_size = serializer.DeserializeDisplaySettings().GetPointSize();
|
||||||
|
|
||||||
if ( system_font != font_face )
|
if (system_font != font_face)
|
||||||
{
|
{
|
||||||
if (m_FontType->GetCount() > 1)
|
if (m_FontType->GetCount() > 1)
|
||||||
{
|
{
|
||||||
|
|
@ -373,21 +397,29 @@ void Settings::LoadDefaultConfig()
|
||||||
m_FontSize->SetValue(font_size);
|
m_FontSize->SetValue(font_size);
|
||||||
SetCustomFont();
|
SetCustomFont();
|
||||||
|
|
||||||
bAutoImport = serializer.DeserializeAutoImportSettings().auto_import;
|
bAutoImport = serializer.DeserializeAutoImportSettings().first;
|
||||||
wxString location = serializer.DeserializeAutoImportSettings().import_dir;
|
wxString location = serializer.DeserializeAutoImportSettings().second;
|
||||||
bShowExtension = serializer.DeserializeShowFileExtensionSetting();
|
|
||||||
|
|
||||||
m_AutoImportCheck->SetValue(bAutoImport);
|
m_AutoImportCheck->SetValue(bAutoImport);
|
||||||
m_ImportDirLocation->SetValue(location);
|
m_ImportDirLocation->SetValue(location);
|
||||||
m_ShowFileExtensionCheck->SetValue(bShowExtension);
|
m_ShowFileExtensionCheck->SetValue(serializer.DeserializeShowFileExtensionSetting());
|
||||||
|
|
||||||
if (bAutoImport)
|
if (bAutoImport)
|
||||||
{
|
{
|
||||||
m_ImportDirLocation->Enable();
|
m_ImportDirLocation->Enable();
|
||||||
m_BrowseAutoImportDirButton->Enable();
|
m_BrowseAutoImportDirButton->Enable();
|
||||||
|
m_FollowSymLinksCheck->Enable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Settings::SetShowExtension(bool value)
|
||||||
|
{
|
||||||
|
Serializer serializer(m_ConfigFilepath);
|
||||||
|
|
||||||
|
m_ShowFileExtensionCheck->SetValue(value);
|
||||||
|
serializer.SerializeShowFileExtensionSetting(value);
|
||||||
|
}
|
||||||
|
|
||||||
void Settings::PrintFont()
|
void Settings::PrintFont()
|
||||||
{
|
{
|
||||||
wxLogDebug("Font face: %s", m_Font.GetFaceName());
|
wxLogDebug("Font face: %s", m_Font.GetFaceName());
|
||||||
|
|
@ -405,10 +437,10 @@ void Settings::SetCustomFont()
|
||||||
std::string system_font = sys_font.GetFaceName().ToStdString();
|
std::string system_font = sys_font.GetFaceName().ToStdString();
|
||||||
int system_font_size = sys_font.GetPointSize();
|
int system_font_size = sys_font.GetPointSize();
|
||||||
|
|
||||||
wxString font_face = serializer.DeserializeDisplaySettings().font_face;
|
wxString font_face = serializer.DeserializeDisplaySettings().GetFaceName();
|
||||||
int font_size = serializer.DeserializeDisplaySettings().font_size;
|
int font_size = serializer.DeserializeDisplaySettings().GetPointSize();
|
||||||
|
|
||||||
if ( m_FontType->GetStringSelection() == "System default" )
|
if (m_FontType->GetStringSelection() == "System default")
|
||||||
{
|
{
|
||||||
m_Window->SetFont(sys_font);
|
m_Window->SetFont(sys_font);
|
||||||
this->SetFont(sys_font);
|
this->SetFont(sys_font);
|
||||||
|
|
@ -452,6 +484,8 @@ void Settings::OnChangeWaveformColour(wxColourPickerEvent& event)
|
||||||
{
|
{
|
||||||
wxLogDebug("Waveform colour not changed.");
|
wxLogDebug("Waveform colour not changed.");
|
||||||
bWaveformColourChanged = false;
|
bWaveformColourChanged = false;
|
||||||
|
|
||||||
|
serializer.SerializeWaveformColour(colour);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -45,7 +45,6 @@ class Settings : public wxDialog
|
||||||
public:
|
public:
|
||||||
Settings(const std::string& configFilepath, const std::string& databaseFilepath);
|
Settings(const std::string& configFilepath, const std::string& databaseFilepath);
|
||||||
Settings(wxWindow* window, const std::string& configFilepath, const std::string& databaseFilepath);
|
Settings(wxWindow* window, const std::string& configFilepath, const std::string& databaseFilepath);
|
||||||
|
|
||||||
~Settings();
|
~Settings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -84,7 +83,6 @@ class Settings : public wxDialog
|
||||||
wxStaticText* m_FontTypeText;
|
wxStaticText* m_FontTypeText;
|
||||||
wxChoice* m_RowHeight;
|
wxChoice* m_RowHeight;
|
||||||
wxChoice* m_FontType;
|
wxChoice* m_FontType;
|
||||||
wxFontDialog* m_FontDialog;
|
|
||||||
wxButton* m_FontBrowseButton;
|
wxButton* m_FontBrowseButton;
|
||||||
wxSpinCtrl* m_FontSize;
|
wxSpinCtrl* m_FontSize;
|
||||||
wxBoxSizer* m_WaveformColourSizer;
|
wxBoxSizer* m_WaveformColourSizer;
|
||||||
|
|
@ -93,14 +91,14 @@ class Settings : public wxDialog
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Collection page
|
// Collection page
|
||||||
wxBoxSizer* m_CollectionTopSizer;
|
wxBoxSizer* m_CollectionMainSizer;
|
||||||
wxBoxSizer* m_CollectionImportDirSizer;
|
wxBoxSizer* m_CollectionImportDirSizer;
|
||||||
wxBoxSizer* m_ShowFileExtensionSizer;
|
wxBoxSizer* m_CollectionBottomSizer;
|
||||||
wxCheckBox* m_AutoImportCheck;
|
wxCheckBox* m_AutoImportCheck;
|
||||||
|
wxCheckBox* m_FollowSymLinksCheck;
|
||||||
wxCheckBox* m_ShowFileExtensionCheck;
|
wxCheckBox* m_ShowFileExtensionCheck;
|
||||||
wxTextCtrl* m_ImportDirLocation;
|
wxTextCtrl* m_ImportDirLocation;
|
||||||
wxButton* m_BrowseAutoImportDirButton;
|
wxButton* m_BrowseAutoImportDirButton;
|
||||||
wxDirDialog* m_DirDialog;
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// General configuration page
|
// General configuration page
|
||||||
|
|
@ -124,7 +122,8 @@ class Settings : public wxDialog
|
||||||
private:
|
private:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
bool bAutoImport = false;
|
bool bAutoImport = false;
|
||||||
bool bShowExtension = true;
|
// bool bFollowSymLinks = false;
|
||||||
|
// bool bShowExtension = true;
|
||||||
bool bWaveformColourChanged = false;
|
bool bWaveformColourChanged = false;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -132,6 +131,7 @@ class Settings : public wxDialog
|
||||||
void OnClickConfigBrowse(wxCommandEvent& event);
|
void OnClickConfigBrowse(wxCommandEvent& event);
|
||||||
void OnClickDatabaseBrowse(wxCommandEvent& event);
|
void OnClickDatabaseBrowse(wxCommandEvent& event);
|
||||||
void OnCheckAutoImport(wxCommandEvent& event);
|
void OnCheckAutoImport(wxCommandEvent& event);
|
||||||
|
void OnCheckFollowSymLinks(wxCommandEvent& event);
|
||||||
void OnCheckShowFileExtension(wxCommandEvent& event);
|
void OnCheckShowFileExtension(wxCommandEvent& event);
|
||||||
void OnClickBrowseAutoImportDir(wxCommandEvent& event);
|
void OnClickBrowseAutoImportDir(wxCommandEvent& event);
|
||||||
void OnChangeFontSize(wxSpinEvent& event);
|
void OnChangeFontSize(wxSpinEvent& event);
|
||||||
|
|
@ -150,9 +150,14 @@ class Settings : public wxDialog
|
||||||
// Getters
|
// Getters
|
||||||
wxString GetImportDirPath();
|
wxString GetImportDirPath();
|
||||||
|
|
||||||
inline wxFont GetFontType() { return m_Font; };
|
// inline wxFont GetFontType() { return m_Font; };
|
||||||
inline bool CanAutoImport() { return bAutoImport; };
|
inline bool CanAutoImport() { return bAutoImport; };
|
||||||
inline bool ShouldShowFileExtension() { return bShowExtension; };
|
// inline bool ShouldFollowSymLinks() { return bFollowSymLinks; };
|
||||||
|
// inline bool ShouldShowFileExtension() { return bShowExtension; };
|
||||||
inline bool IsWaveformColourChanged() { return bWaveformColourChanged; }
|
inline bool IsWaveformColourChanged() { return bWaveformColourChanged; }
|
||||||
inline wxColour GetWaveformColour() { return m_WaveformColourPickerCtrl->GetColour(); }
|
// inline wxColour GetWaveformColour() { return m_WaveformColourPickerCtrl->GetColour(); }
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
// Setters
|
||||||
|
void SetShowExtension(bool value);
|
||||||
};
|
};
|
||||||
|
|
@ -18,9 +18,9 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ControlID_Enums.hpp"
|
#include "Utility/ControlID_Enums.hpp"
|
||||||
#include "Database.hpp"
|
#include "Database/Database.hpp"
|
||||||
#include "TagEditorDialog.hpp"
|
#include "GUI/Dialogs/TagEditor.hpp"
|
||||||
|
|
||||||
#include <wx/defs.h>
|
#include <wx/defs.h>
|
||||||
#include <wx/gdicmn.h>
|
#include <wx/gdicmn.h>
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Tags.hpp"
|
#include "Utility/Tags.hpp"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -20,10 +20,11 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Database.hpp"
|
#include "Database/Database.hpp"
|
||||||
#include "WaveformViewer.hpp"
|
#include "GUI/WaveformViewer.hpp"
|
||||||
#include "SampleHiveConfig.hpp"
|
#include "SampleHiveConfig.hpp"
|
||||||
#include "SH_Event.hpp"
|
#include "Utility/Serialize.hpp"
|
||||||
|
#include "Utility/SH_Event.hpp"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
@ -192,6 +193,8 @@ class MainFrame : public wxFrame
|
||||||
bool bMuted = false;
|
bool bMuted = false;
|
||||||
bool bStopped = false;
|
bool bStopped = false;
|
||||||
bool bFiltered = false;
|
bool bFiltered = false;
|
||||||
|
bool bShowMenuBar = false;
|
||||||
|
bool bShowStatusBar = false;
|
||||||
bool bLoopPointsSet = false;
|
bool bLoopPointsSet = false;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
|
@ -290,6 +293,8 @@ class MainFrame : public wxFrame
|
||||||
// Directory watchers
|
// Directory watchers
|
||||||
bool CreateWatcherIfNecessary();
|
bool CreateWatcherIfNecessary();
|
||||||
void CreateWatcher();
|
void CreateWatcher();
|
||||||
|
void AddWatchEntry(wxFSWPathType type, std::string path);
|
||||||
|
void OnFileSystemEvent(wxFileSystemWatcherEvent& event);
|
||||||
|
|
||||||
// wxString TagLibTowx(const TagLib::String& in);
|
// wxString TagLibTowx(const TagLib::String& in);
|
||||||
|
|
||||||
|
|
@ -18,12 +18,10 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "WaveformViewer.hpp"
|
#include "GUI/WaveformViewer.hpp"
|
||||||
#include "Database.hpp"
|
#include "Utility/Serialize.hpp"
|
||||||
#include "SettingsDialog.hpp"
|
#include "Utility/Tags.hpp"
|
||||||
#include "Serialize.hpp"
|
#include "Utility/SH_Event.hpp"
|
||||||
#include "Tags.hpp"
|
|
||||||
#include "SH_Event.hpp"
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
@ -38,11 +36,12 @@
|
||||||
|
|
||||||
#include <sndfile.hh>
|
#include <sndfile.hh>
|
||||||
|
|
||||||
WaveformViewer::WaveformViewer(wxWindow* parentFrame, wxWindow* window, wxDataViewListCtrl& library,
|
WaveformViewer::WaveformViewer(wxWindow* window, wxDataViewListCtrl& library,
|
||||||
wxMediaCtrl& mediaCtrl, Database& database,
|
wxMediaCtrl& mediaCtrl, Database& database,
|
||||||
const std::string& configFilepath, const std::string& databaseFilepath)
|
const std::string& configFilepath, const std::string& databaseFilepath)
|
||||||
: wxPanel(window, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxNO_BORDER | wxFULL_REPAINT_ON_RESIZE),
|
: wxPanel(window, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
||||||
m_ParentFrame(parentFrame), m_Window(window), m_Database(database), m_Library(library), m_MediaCtrl(mediaCtrl),
|
wxTAB_TRAVERSAL | wxNO_BORDER | wxFULL_REPAINT_ON_RESIZE),
|
||||||
|
m_Window(window), m_Database(database), m_Library(library), m_MediaCtrl(mediaCtrl),
|
||||||
m_ConfigFilepath(configFilepath), m_DatabaseFilepath(databaseFilepath)
|
m_ConfigFilepath(configFilepath), m_DatabaseFilepath(databaseFilepath)
|
||||||
{
|
{
|
||||||
this->SetDoubleBuffered(true);
|
this->SetDoubleBuffered(true);
|
||||||
|
|
@ -99,7 +98,8 @@ void WaveformViewer::OnPaint(wxPaintEvent& event)
|
||||||
{
|
{
|
||||||
dc.SetPen(wxPen(wxColour(200, 200, 200, 255), 4, wxPENSTYLE_SOLID));
|
dc.SetPen(wxPen(wxColour(200, 200, 200, 255), 4, wxPENSTYLE_SOLID));
|
||||||
dc.SetBrush(wxBrush(wxColour(200, 200, 200, 80), wxBRUSHSTYLE_SOLID));
|
dc.SetBrush(wxBrush(wxColour(200, 200, 200, 80), wxBRUSHSTYLE_SOLID));
|
||||||
dc.DrawRectangle(wxRect(m_AnchorPoint.x, -2, m_CurrentPoint.x - m_AnchorPoint.x, this->GetSize().GetHeight() + 5));
|
dc.DrawRectangle(wxRect(m_AnchorPoint.x, -2, m_CurrentPoint.x - m_AnchorPoint.x,
|
||||||
|
this->GetSize().GetHeight() + 5));
|
||||||
|
|
||||||
bAreaSelected = true;
|
bAreaSelected = true;
|
||||||
SendLoopPoints();
|
SendLoopPoints();
|
||||||
|
|
@ -148,7 +148,6 @@ void WaveformViewer::RenderPlayhead(wxDC& dc)
|
||||||
|
|
||||||
void WaveformViewer::UpdateWaveformBitmap()
|
void WaveformViewer::UpdateWaveformBitmap()
|
||||||
{
|
{
|
||||||
Settings settings(m_ParentFrame, m_ConfigFilepath, m_DatabaseFilepath);
|
|
||||||
Serializer serializer(m_ConfigFilepath);
|
Serializer serializer(m_ConfigFilepath);
|
||||||
|
|
||||||
int selected_row = m_Library.GetSelectedRow();
|
int selected_row = m_Library.GetSelectedRow();
|
||||||
|
|
@ -158,10 +157,11 @@ void WaveformViewer::UpdateWaveformBitmap()
|
||||||
|
|
||||||
wxString selection = m_Library.GetTextValue(selected_row, 1);
|
wxString selection = m_Library.GetTextValue(selected_row, 1);
|
||||||
|
|
||||||
wxString filepath_with_extension = m_Database.GetSamplePathByFilename(selection.BeforeLast('.').ToStdString());
|
wxString filepath_with_extension =
|
||||||
|
m_Database.GetSamplePathByFilename(selection.BeforeLast('.').ToStdString());
|
||||||
wxString filepath_without_extension = m_Database.GetSamplePathByFilename(selection.ToStdString());
|
wxString filepath_without_extension = m_Database.GetSamplePathByFilename(selection.ToStdString());
|
||||||
|
|
||||||
std::string extension = settings.ShouldShowFileExtension() ?
|
std::string extension = serializer.DeserializeShowFileExtensionSetting() ?
|
||||||
m_Database.GetSampleFileExtension(selection.ToStdString()) :
|
m_Database.GetSampleFileExtension(selection.ToStdString()) :
|
||||||
m_Database.GetSampleFileExtension(selection.BeforeLast('.').ToStdString());
|
m_Database.GetSampleFileExtension(selection.BeforeLast('.').ToStdString());
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Database.hpp"
|
#include "Database/Database.hpp"
|
||||||
|
|
||||||
#include <wx/dataview.h>
|
#include <wx/dataview.h>
|
||||||
#include <wx/bitmap.h>
|
#include <wx/bitmap.h>
|
||||||
|
|
@ -38,14 +38,13 @@
|
||||||
class WaveformViewer : public wxPanel
|
class WaveformViewer : public wxPanel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WaveformViewer(wxWindow* parentFrame, wxWindow* window, wxDataViewListCtrl& library,
|
WaveformViewer(wxWindow* window, wxDataViewListCtrl& library,
|
||||||
wxMediaCtrl& mediaCtrl, Database& database,
|
wxMediaCtrl& mediaCtrl, Database& database,
|
||||||
const std::string& configFilepath, const std::string& databaseFilepath);
|
const std::string& configFilepath, const std::string& databaseFilepath);
|
||||||
~WaveformViewer();
|
~WaveformViewer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
wxWindow* m_ParentFrame;
|
|
||||||
wxWindow* m_Window;
|
wxWindow* m_Window;
|
||||||
|
|
||||||
Database& m_Database;
|
Database& m_Database;
|
||||||
|
|
@ -55,6 +55,7 @@ enum ControlIDs
|
||||||
SD_BrowseConfigDir,
|
SD_BrowseConfigDir,
|
||||||
SD_BrowseDatabaseDir,
|
SD_BrowseDatabaseDir,
|
||||||
SD_AutoImport,
|
SD_AutoImport,
|
||||||
|
SD_FollowSymLinks,
|
||||||
SD_ShowFileExtension,
|
SD_ShowFileExtension,
|
||||||
SD_BrowseAutoImportDir,
|
SD_BrowseAutoImportDir,
|
||||||
SD_FontType,
|
SD_FontType,
|
||||||
|
|
@ -1,4 +1,24 @@
|
||||||
#include "SH_Event.hpp"
|
/* SampleHive
|
||||||
|
* Copyright (C) 2021 Apoorv Singh
|
||||||
|
* A simple, modern audio sample browser/manager for GNU/Linux.
|
||||||
|
*
|
||||||
|
* This file is a part of SampleHive
|
||||||
|
*
|
||||||
|
* SampleHive 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.
|
||||||
|
*
|
||||||
|
* SampleHive 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 "Utility/SH_Event.hpp"
|
||||||
|
|
||||||
namespace SampleHive
|
namespace SampleHive
|
||||||
{
|
{
|
||||||
|
|
@ -1,3 +1,23 @@
|
||||||
|
/* SampleHive
|
||||||
|
* Copyright (C) 2021 Apoorv Singh
|
||||||
|
* A simple, modern audio sample browser/manager for GNU/Linux.
|
||||||
|
*
|
||||||
|
* This file is a part of SampleHive
|
||||||
|
*
|
||||||
|
* SampleHive 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.
|
||||||
|
*
|
||||||
|
* SampleHive 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
@ -26,10 +26,13 @@
|
||||||
* @copyright GNU GPL v3
|
* @copyright GNU GPL v3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Sample.hpp"
|
#include "Utility/Sample.hpp"
|
||||||
|
|
||||||
///Default Constructor, Creates an empty sample profile
|
///Default Constructor, Creates an empty sample profile
|
||||||
Sample::Sample(){}
|
Sample::Sample()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
///Overloaded Constructor, Creates a sample profile with supplied data. @see Set()
|
///Overloaded Constructor, Creates a sample profile with supplied data. @see Set()
|
||||||
Sample::Sample(int favorite, const std::string& filename, const std::string& fileExtension,
|
Sample::Sample(int favorite, const std::string& filename, const std::string& fileExtension,
|
||||||
|
|
@ -56,18 +59,6 @@ void Sample::Clear()
|
||||||
m_Path = "";
|
m_Path = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// int Sample::GetFavorite() { return m_Favorite; }
|
|
||||||
// int Sample::GetChannels() { return m_Channels; }
|
|
||||||
// int Sample::GetLength() { return m_Length; }
|
|
||||||
// int Sample::GetSampleRate() { return m_SampleRate; }
|
|
||||||
// int Sample::GetBitrate() { return m_Bitrate; }
|
|
||||||
// int Sample::GetTrashed () { return m_Trashed; }
|
|
||||||
// std::string Sample::GetFilename() { return m_Filename; }
|
|
||||||
// std::string Sample::GetFileExtension() { return m_FileExtension; }
|
|
||||||
// std::string Sample::GetSamplePack() { return m_SamplePack; }
|
|
||||||
// std::string Sample::GetType() { return m_Type; }
|
|
||||||
// std::string Sample::GetPath() { return m_Path; }
|
|
||||||
|
|
||||||
void Sample::Set(int favorite, const std::string& filename, const std::string& fileExtension,
|
void Sample::Set(int favorite, const std::string& filename, const std::string& fileExtension,
|
||||||
const std::string& samplePack, const std::string& type, int channels, int length,
|
const std::string& samplePack, const std::string& type, int channels, int length,
|
||||||
int sampleRate, int bitrate, const std::string& path, int trashed)
|
int sampleRate, int bitrate, const std::string& path, int trashed)
|
||||||
|
|
@ -84,15 +75,3 @@ void Sample::Set(int favorite, const std::string& filename, const std::string& f
|
||||||
m_Path = path;
|
m_Path = path;
|
||||||
m_Trashed = trashed;
|
m_Trashed = trashed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// void Sample::SetFavorite(int favorite) { m_Favorite = favorite; }
|
|
||||||
// void Sample::SetChannels(int channels) { m_Channels = channels; }
|
|
||||||
// void Sample::SetLength(int length) { m_Length = length; }
|
|
||||||
// void Sample::SetSampleRate(int sampleRate) { m_SampleRate = sampleRate; }
|
|
||||||
// void Sample::SetBitrate(int bitrate) { m_Bitrate = bitrate; }
|
|
||||||
// void Sample::SetTrashed (int trashed) { m_Trashed = trashed; }
|
|
||||||
// void Sample::SetFilename(std::string filename) { m_Filename = filename; }
|
|
||||||
// void Sample::SetFileExtension(std::string fileExtension) { m_FileExtension = fileExtension; }
|
|
||||||
// void Sample::SetSamplePack(std::string samplePack) { m_SamplePack = samplePack; }
|
|
||||||
// void Sample::SetType(std::string type) { m_Type = type; }
|
|
||||||
// void Sample::SetPath(std::string path) { m_Path = path; }
|
|
||||||
|
|
@ -26,8 +26,7 @@
|
||||||
* @copyright GNU GPL v3
|
* @copyright GNU GPL v3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SAMPLE_HPP__
|
#pragma once
|
||||||
#define _SAMPLE_HPP__
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
@ -62,18 +61,6 @@ class Sample
|
||||||
public:
|
public:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Getters
|
// Getters
|
||||||
// int GetFavorite();
|
|
||||||
// int GetChannels();
|
|
||||||
// int GetLength();
|
|
||||||
// int GetSampleRate();
|
|
||||||
// int GetBitrate();
|
|
||||||
// int GetTrashed ();
|
|
||||||
// std::string GetFilename();
|
|
||||||
// std::string GetFileExtension();
|
|
||||||
// std::string GetSamplePack();
|
|
||||||
// std::string GetType();
|
|
||||||
// std::string GetPath();
|
|
||||||
|
|
||||||
int GetFavorite() const { return m_Favorite; }
|
int GetFavorite() const { return m_Favorite; }
|
||||||
int GetChannels() const { return m_Channels; }
|
int GetChannels() const { return m_Channels; }
|
||||||
int GetLength() const { return m_Length; }
|
int GetLength() const { return m_Length; }
|
||||||
|
|
@ -86,28 +73,12 @@ class Sample
|
||||||
std::string GetType() const { return m_Type; }
|
std::string GetType() const { return m_Type; }
|
||||||
std::string GetPath() const { return m_Path; }
|
std::string GetPath() const { return m_Path; }
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
// Clear sample data
|
|
||||||
void Clear();
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Setters
|
// Setters
|
||||||
void Set(int favorite, const std::string& filename, const std::string& fileExtension,
|
void Set(int favorite, const std::string& filename, const std::string& fileExtension,
|
||||||
const std::string& samplePack, const std::string& type, int channels, int length,
|
const std::string& samplePack, const std::string& type, int channels, int length,
|
||||||
int sampleRate, int bitrate, const std::string& path, int trashed);
|
int sampleRate, int bitrate, const std::string& path, int trashed);
|
||||||
|
|
||||||
// void SetFavorite(int favorite);
|
|
||||||
// void SetChannels(int channels);
|
|
||||||
// void SetLength(int length);
|
|
||||||
// void SetSampleRate(int sampleRate);
|
|
||||||
// void SetBitrate(int bitrate);
|
|
||||||
// void SetTrashed(int trashed);
|
|
||||||
// void SetFilename(std::string filename);
|
|
||||||
// void SetFileExtension(std::string fileExtension);
|
|
||||||
// void SetSamplePack(std::string samplePack);
|
|
||||||
// void SetType(std::string type);
|
|
||||||
// void SetPath(std::string path);
|
|
||||||
|
|
||||||
void SetFavorite(int favorite) { m_Favorite = favorite; }
|
void SetFavorite(int favorite) { m_Favorite = favorite; }
|
||||||
void SetChannels(int channels) { m_Channels = channels; }
|
void SetChannels(int channels) { m_Channels = channels; }
|
||||||
void SetLength(int length) { m_Length = length; }
|
void SetLength(int length) { m_Length = length; }
|
||||||
|
|
@ -119,6 +90,8 @@ class Sample
|
||||||
void SetSamplePack(const std::string& samplePack) { m_SamplePack = samplePack; }
|
void SetSamplePack(const std::string& samplePack) { m_SamplePack = samplePack; }
|
||||||
void SetType(const std::string& type) { m_Type = type; }
|
void SetType(const std::string& type) { m_Type = type; }
|
||||||
void SetPath(const std::string& path) { m_Path = path; }
|
void SetPath(const std::string& path) { m_Path = path; }
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
// -------------------------------------------------------------------
|
||||||
|
// Clear sample data
|
||||||
|
void Clear();
|
||||||
|
};
|
||||||
|
|
@ -18,14 +18,13 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Serialize.hpp"
|
#include "Utility/Serialize.hpp"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include <wx/colour.h>
|
#include <wx/colour.h>
|
||||||
#include <wx/log.h>
|
#include <wx/log.h>
|
||||||
// #include <wx/stdpaths.h>
|
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
|
|
||||||
#include <yaml-cpp/emittermanip.h>
|
#include <yaml-cpp/emittermanip.h>
|
||||||
|
|
@ -58,6 +57,8 @@ Serializer::Serializer(const std::string& filepath)
|
||||||
m_Emitter << YAML::BeginMap;
|
m_Emitter << YAML::BeginMap;
|
||||||
m_Emitter << YAML::Key << "Width" << YAML::Value << 1280;
|
m_Emitter << YAML::Key << "Width" << YAML::Value << 1280;
|
||||||
m_Emitter << YAML::Key << "Height" << YAML::Value << 720;
|
m_Emitter << YAML::Key << "Height" << YAML::Value << 720;
|
||||||
|
m_Emitter << YAML::Key << "ShowMenuBar" << YAML::Value << true;
|
||||||
|
m_Emitter << YAML::Key << "ShowStatusBar" << YAML::Value << true;
|
||||||
m_Emitter << YAML::EndMap << YAML::Newline;
|
m_Emitter << YAML::EndMap << YAML::Newline;
|
||||||
|
|
||||||
m_Emitter << YAML::Newline << YAML::Key << "Media";
|
m_Emitter << YAML::Newline << YAML::Key << "Media";
|
||||||
|
|
@ -74,17 +75,17 @@ Serializer::Serializer(const std::string& filepath)
|
||||||
m_Emitter << YAML::Key << "Family" << YAML::Value << system_font_face;
|
m_Emitter << YAML::Key << "Family" << YAML::Value << system_font_face;
|
||||||
m_Emitter << YAML::Key << "Size" << YAML::Value << system_font_size;
|
m_Emitter << YAML::Key << "Size" << YAML::Value << system_font_size;
|
||||||
m_Emitter << YAML::EndMap;
|
m_Emitter << YAML::EndMap;
|
||||||
m_Emitter << YAML::EndMap << YAML::Newline;
|
m_Emitter << YAML::Key << "Waveform";
|
||||||
|
|
||||||
m_Emitter << YAML::Newline << YAML::Key << "Waveform";
|
|
||||||
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 << YAML::Newline;
|
m_Emitter << YAML::EndMap << YAML::Newline;
|
||||||
|
|
||||||
m_Emitter << YAML::Newline << YAML::Key << "Collection";
|
m_Emitter << YAML::Newline << YAML::Key << "Collection";
|
||||||
m_Emitter << YAML::BeginMap;
|
m_Emitter << YAML::BeginMap;
|
||||||
m_Emitter << YAML::Key << "AutoImport" << YAML::Value << false;
|
m_Emitter << YAML::Key << "AutoImport" << YAML::Value << false;
|
||||||
m_Emitter << YAML::Key << "Directory" << YAML::Value << dir;
|
m_Emitter << YAML::Key << "Directory" << YAML::Value << dir;
|
||||||
|
m_Emitter << YAML::Key << "FollowSymLink" << YAML::Value << false;
|
||||||
m_Emitter << YAML::Key << "ShowFileExtension" << YAML::Value << true;
|
m_Emitter << YAML::Key << "ShowFileExtension" << YAML::Value << true;
|
||||||
m_Emitter << YAML::EndMap << YAML::Newline;
|
m_Emitter << YAML::EndMap << YAML::Newline;
|
||||||
|
|
||||||
|
|
@ -95,10 +96,6 @@ Serializer::Serializer(const std::string& filepath)
|
||||||
|
|
||||||
wxLogDebug("Generated %s successfully!", m_Filepath);
|
wxLogDebug("Generated %s successfully!", m_Filepath);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
wxLogDebug("Config file already exists! Skipping..");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Serializer::~Serializer()
|
Serializer::~Serializer()
|
||||||
|
|
@ -106,32 +103,23 @@ Serializer::~Serializer()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Serializer::DeserializeWinSize(std::string key, int size) const
|
WindowSize Serializer::DeserializeWinSize() const
|
||||||
{
|
{
|
||||||
int width = 800, height = 600;
|
int width = 800, height = 600;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
YAML::Node data = YAML::LoadFile(m_Filepath);
|
YAML::Node config = YAML::LoadFile(m_Filepath);
|
||||||
|
|
||||||
if (!data["Window"])
|
if (!config["Window"])
|
||||||
{
|
{
|
||||||
return false;
|
return { width, height };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto win = data["Window"])
|
if (auto win = config["Window"])
|
||||||
{
|
{
|
||||||
if (key == "Height")
|
height = win["Height"].as<int>();
|
||||||
{
|
width = win["Width"].as<int>();
|
||||||
size = height;
|
|
||||||
size = win["Height"].as<int>();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key == "Width")
|
|
||||||
{
|
|
||||||
size = width;
|
|
||||||
size = win["Width"].as<int>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(const YAML::ParserException& ex)
|
catch(const YAML::ParserException& ex)
|
||||||
|
|
@ -139,14 +127,73 @@ int Serializer::DeserializeWinSize(std::string key, int size) const
|
||||||
std::cout << ex.what() << std::endl;
|
std::cout << ex.what() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogDebug("Window size: %d", size);
|
wxLogDebug("Window size: %d, %d", width, height);
|
||||||
|
|
||||||
return size;
|
return { width, height };
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Serializer::DeserializeBrowserControls(std::string key, bool control) const
|
void Serializer::SerializeShowMenuAndStatusBar(std::string key, bool value)
|
||||||
{
|
{
|
||||||
bool autoplay = false; bool loop = false; bool muted = false;
|
YAML::Emitter out;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
YAML::Node config = YAML::LoadFile(m_Filepath);
|
||||||
|
|
||||||
|
if (auto bar = config["Window"])
|
||||||
|
{
|
||||||
|
if (key == "menubar")
|
||||||
|
bar["ShowMenuBar"] = value;
|
||||||
|
|
||||||
|
if (key == "statusbar")
|
||||||
|
bar["ShowStatusBar"] = value;
|
||||||
|
|
||||||
|
out << config;
|
||||||
|
|
||||||
|
std::ofstream ofstrm(m_Filepath);
|
||||||
|
ofstrm << out.c_str();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
wxLogDebug("Error! Cannot store show bar values.");
|
||||||
|
}
|
||||||
|
catch(const YAML::ParserException& ex)
|
||||||
|
{
|
||||||
|
std::cout << ex.what() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Serializer::DeserializeShowMenuAndStatusBar(std::string key) const
|
||||||
|
{
|
||||||
|
bool show = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
YAML::Node config = YAML::LoadFile(m_Filepath);
|
||||||
|
|
||||||
|
if (auto bar = config["Window"])
|
||||||
|
{
|
||||||
|
if (key == "menubar")
|
||||||
|
show = bar["ShowMenuBar"].as<bool>();
|
||||||
|
|
||||||
|
if (key == "statusbar")
|
||||||
|
show = bar["ShowStatusBar"].as<bool>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxLogDebug("Error! Cannot fetch show bar values.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(const YAML::ParserException& ex)
|
||||||
|
{
|
||||||
|
std::cout << ex.what() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return show;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Serializer::SerializeBrowserControls(std::string key, bool value)
|
||||||
|
{
|
||||||
|
YAML::Emitter out;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -155,37 +202,56 @@ bool Serializer::DeserializeBrowserControls(std::string key, bool control) const
|
||||||
if (auto media = config["Media"])
|
if (auto media = config["Media"])
|
||||||
{
|
{
|
||||||
if (key == "autoplay")
|
if (key == "autoplay")
|
||||||
{
|
media["Autoplay"] = value;
|
||||||
control = autoplay;
|
|
||||||
autoplay = media["Autoplay"].as<bool>();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key == "loop")
|
if (key == "loop")
|
||||||
{
|
media["Loop"] = value;
|
||||||
control = loop;
|
|
||||||
loop = media["Loop"].as<bool>();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key == "muted")
|
if (key == "muted")
|
||||||
{
|
media["Muted"] = value;
|
||||||
control = muted;
|
|
||||||
muted = media["Muted"].as<bool>();
|
out << config;
|
||||||
}
|
|
||||||
|
std::ofstream ofstrm(m_Filepath);
|
||||||
|
ofstrm << out.c_str();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
wxLogDebug("Error! Cannot store media values.");
|
||||||
|
}
|
||||||
|
catch(const YAML::ParserException& ex)
|
||||||
|
{
|
||||||
|
std::cout << ex.what() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Serializer::DeserializeBrowserControls(std::string key) const
|
||||||
|
{
|
||||||
|
bool control = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
YAML::Node config = YAML::LoadFile(m_Filepath);
|
||||||
|
|
||||||
|
if (auto media = config["Media"])
|
||||||
{
|
{
|
||||||
wxLogDebug("Error! Cannot fetch values.");
|
if (key == "autoplay")
|
||||||
|
control = media["Autoplay"].as<bool>();
|
||||||
|
|
||||||
|
if (key == "loop")
|
||||||
|
control = media["Loop"].as<bool>();
|
||||||
|
|
||||||
|
if (key == "muted")
|
||||||
|
control = media["Muted"].as<bool>();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
wxLogDebug("Error! Cannot fetch values.");
|
||||||
}
|
}
|
||||||
catch(const YAML::ParserException& ex)
|
catch(const YAML::ParserException& ex)
|
||||||
{
|
{
|
||||||
std::cout << ex.what() << std::endl;
|
std::cout << ex.what() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogDebug("Autoplay: %s, Loop: %s, Muted: %s",
|
wxLogDebug("%s: %s", key, control ? "enabled" : "disabled");
|
||||||
autoplay ? "enabled" : "disabled",
|
|
||||||
loop ? "enabled" : "disabled",
|
|
||||||
muted ? "muted" : "unmuted");
|
|
||||||
|
|
||||||
return control;
|
return control;
|
||||||
}
|
}
|
||||||
|
|
@ -205,10 +271,6 @@ void Serializer::SerializeDisplaySettings(wxFont& font)
|
||||||
|
|
||||||
if (auto fontSetting = display["Font"])
|
if (auto fontSetting = display["Font"])
|
||||||
{
|
{
|
||||||
wxLogDebug("Changing font settings");
|
|
||||||
wxLogDebug("Font face: %s", font_face);
|
|
||||||
wxLogDebug("Font size: %d", font_size);
|
|
||||||
|
|
||||||
fontSetting["Family"] = font_face;
|
fontSetting["Family"] = font_face;
|
||||||
fontSetting["Size"] = font_size;
|
fontSetting["Size"] = font_size;
|
||||||
|
|
||||||
|
|
@ -228,8 +290,10 @@ void Serializer::SerializeDisplaySettings(wxFont& font)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FontType Serializer::DeserializeDisplaySettings() const
|
wxFont Serializer::DeserializeDisplaySettings() const
|
||||||
{
|
{
|
||||||
|
wxFont font;
|
||||||
|
|
||||||
wxString face;
|
wxString face;
|
||||||
int size = 0 ;
|
int size = 0 ;
|
||||||
|
|
||||||
|
|
@ -243,6 +307,9 @@ FontType Serializer::DeserializeDisplaySettings() const
|
||||||
{
|
{
|
||||||
face = font_setting["Family"].as<std::string>();
|
face = font_setting["Family"].as<std::string>();
|
||||||
size = font_setting["Size"].as<int>();
|
size = font_setting["Size"].as<int>();
|
||||||
|
|
||||||
|
font.SetFaceName(face);
|
||||||
|
font.SetPointSize(size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -254,7 +321,7 @@ FontType Serializer::DeserializeDisplaySettings() const
|
||||||
std::cout << ex.what() << std::endl;
|
std::cout << ex.what() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return { face, size };
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Serializer::SerializeWaveformColour(wxColour& colour)
|
void Serializer::SerializeWaveformColour(wxColour& colour)
|
||||||
|
|
@ -267,11 +334,10 @@ void Serializer::SerializeWaveformColour(wxColour& colour)
|
||||||
{
|
{
|
||||||
YAML::Node config = YAML::LoadFile(m_Filepath);
|
YAML::Node config = YAML::LoadFile(m_Filepath);
|
||||||
|
|
||||||
if (auto waveform = config["Waveform"])
|
auto display = config["Display"];
|
||||||
{
|
|
||||||
wxLogDebug("Changing waveform colour");
|
|
||||||
wxLogDebug("Waveform colour: %s", colour_string);
|
|
||||||
|
|
||||||
|
if (auto waveform = display["Waveform"])
|
||||||
|
{
|
||||||
waveform["Colour"] = colour_string;
|
waveform["Colour"] = colour_string;
|
||||||
|
|
||||||
out << config;
|
out << config;
|
||||||
|
|
@ -298,7 +364,9 @@ wxColour Serializer::DeserializeWaveformColour() const
|
||||||
{
|
{
|
||||||
YAML::Node config = YAML::LoadFile(m_Filepath);
|
YAML::Node config = YAML::LoadFile(m_Filepath);
|
||||||
|
|
||||||
if (auto waveform = config["Waveform"])
|
auto display = config["Display"];
|
||||||
|
|
||||||
|
if (auto waveform = display["Waveform"])
|
||||||
{
|
{
|
||||||
colour = waveform["Colour"].as<std::string>();
|
colour = waveform["Colour"].as<std::string>();
|
||||||
}
|
}
|
||||||
|
|
@ -315,21 +383,18 @@ wxColour Serializer::DeserializeWaveformColour() const
|
||||||
return static_cast<wxString>(colour);
|
return static_cast<wxString>(colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Serializer::SerializeAutoImportSettings(wxTextCtrl& textCtrl, wxCheckBox& checkBox)
|
void Serializer::SerializeAutoImportSettings(bool autoImport, const std::string& importDir)
|
||||||
{
|
{
|
||||||
YAML::Emitter out;
|
YAML::Emitter out;
|
||||||
|
|
||||||
std::string import_dir = textCtrl.GetValue().ToStdString();
|
|
||||||
bool auto_import = checkBox.GetValue();
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
YAML::Node config = YAML::LoadFile(m_Filepath);
|
YAML::Node config = YAML::LoadFile(m_Filepath);
|
||||||
|
|
||||||
if (auto autoImportInfo = config["Collection"])
|
if (auto autoImportInfo = config["Collection"])
|
||||||
{
|
{
|
||||||
autoImportInfo["AutoImport"] = auto_import;
|
autoImportInfo["AutoImport"] = autoImport;
|
||||||
autoImportInfo["Directory"] = import_dir;
|
autoImportInfo["Directory"] = importDir;
|
||||||
|
|
||||||
out << config;
|
out << config;
|
||||||
|
|
||||||
|
|
@ -366,38 +431,87 @@ ImportDirInfo Serializer::DeserializeAutoImportSettings() const
|
||||||
wxLogDebug("Error! Cannot fetch import dir values.");
|
wxLogDebug("Error! Cannot fetch import dir values.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (const YAML::ParserException& ex)
|
||||||
|
{
|
||||||
|
std::cout << ex.what() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { auto_import, dir };
|
||||||
|
}
|
||||||
|
|
||||||
|
void Serializer::SerializeFollowSymLink(bool followSymLinks)
|
||||||
|
{
|
||||||
|
YAML::Emitter out;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
YAML::Node config = YAML::LoadFile(m_Filepath);
|
||||||
|
|
||||||
|
if (auto followSymLinks = config["Collection"])
|
||||||
|
{
|
||||||
|
followSymLinks["FollowSymLinks"] = followSymLinks;
|
||||||
|
|
||||||
|
out << config;
|
||||||
|
|
||||||
|
std::ofstream ofstrm(m_Filepath);
|
||||||
|
ofstrm << out.c_str();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxLogDebug("Error! Cannot store follow symbolic links value.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(const YAML::ParserException& ex)
|
||||||
|
{
|
||||||
|
std::cout << ex.what() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Serializer::DeserializeFollowSymLink() const
|
||||||
|
{
|
||||||
|
bool follow_sym_links = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
YAML::Node config = YAML::LoadFile(m_Filepath);
|
||||||
|
|
||||||
|
if (auto followSymLinks = config["Collection"])
|
||||||
|
{
|
||||||
|
follow_sym_links = followSymLinks["FollowSymLinks"].as<bool>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxLogDebug("Error! Cannot fetch follow symbolic links value.");
|
||||||
|
}
|
||||||
|
}
|
||||||
catch(const YAML::ParserException& ex)
|
catch(const YAML::ParserException& ex)
|
||||||
{
|
{
|
||||||
std::cout << ex.what() << std::endl;
|
std::cout << ex.what() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return { auto_import, dir};
|
return follow_sym_links;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Serializer::SerializeShowFileExtensionSetting(wxCheckBox& checkBox)
|
void Serializer::SerializeShowFileExtensionSetting(bool showExtension)
|
||||||
{
|
{
|
||||||
YAML::Emitter out;
|
YAML::Emitter out;
|
||||||
|
|
||||||
bool show_extension = checkBox.GetValue();
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
YAML::Node config = YAML::LoadFile(m_Filepath);
|
YAML::Node config = YAML::LoadFile(m_Filepath);
|
||||||
|
|
||||||
if (auto fileExtensionInfo = config["Collection"])
|
if (auto fileExtensionInfo = config["Collection"])
|
||||||
{
|
{
|
||||||
fileExtensionInfo["ShowFileExtension"] = show_extension;
|
fileExtensionInfo["ShowFileExtension"] = showExtension;
|
||||||
|
|
||||||
out << config;
|
out << config;
|
||||||
|
|
||||||
wxLogDebug("Changing show file extension value.");
|
|
||||||
|
|
||||||
std::ofstream ofstrm(m_Filepath);
|
std::ofstream ofstrm(m_Filepath);
|
||||||
ofstrm << out.c_str();
|
ofstrm << out.c_str();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxLogDebug("Error! Cannot store import dir values.");
|
wxLogDebug("Error! Cannot store show file extension value.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(const YAML::ParserException& ex)
|
catch(const YAML::ParserException& ex)
|
||||||
|
|
@ -421,7 +535,7 @@ bool Serializer::DeserializeShowFileExtensionSetting() const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxLogDebug("Error! Cannot fetch import dir values.");
|
wxLogDebug("Error! Cannot fetch show file extension value.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(const YAML::ParserException& ex)
|
catch(const YAML::ParserException& ex)
|
||||||
|
|
@ -431,41 +545,3 @@ bool Serializer::DeserializeShowFileExtensionSetting() const
|
||||||
|
|
||||||
return show_extension;
|
return show_extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Serializer::SerializeDataViewTreeCtrlItems(wxTreeCtrl& tree, wxTreeItemId& item)
|
|
||||||
{
|
|
||||||
std::string path = "tree.yaml";
|
|
||||||
|
|
||||||
std::ifstream ifstrm(path);
|
|
||||||
|
|
||||||
YAML::Emitter out;
|
|
||||||
|
|
||||||
out << YAML::BeginMap; // Container
|
|
||||||
out << YAML::Key << "Container" << YAML::Value << "";
|
|
||||||
|
|
||||||
if (tree.HasChildren(item))
|
|
||||||
{
|
|
||||||
out << YAML::Key << "Child";
|
|
||||||
out << YAML::BeginMap; // Child
|
|
||||||
|
|
||||||
for ( size_t i = 0; i < tree.GetChildrenCount(item); i++ )
|
|
||||||
{
|
|
||||||
// wxTreeItemIdValue cookie;
|
|
||||||
wxString child = tree.GetItemText(tree.GetSelection());
|
|
||||||
out << YAML::Key << "Item" << YAML::Value << child.ToStdString();
|
|
||||||
}
|
|
||||||
|
|
||||||
out << YAML::EndMap; // Child
|
|
||||||
}
|
|
||||||
|
|
||||||
out << YAML::EndMap; // Container
|
|
||||||
|
|
||||||
std::ofstream ofstrm(path);
|
|
||||||
ofstrm << out.c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Serializer::DeserializeDataViewTreeCtrlItems(YAML::Emitter &out, wxDataViewItem item) const
|
|
||||||
{
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
@ -38,17 +38,9 @@
|
||||||
#include <yaml-cpp/null.h>
|
#include <yaml-cpp/null.h>
|
||||||
#include <yaml-cpp/emittermanip.h>
|
#include <yaml-cpp/emittermanip.h>
|
||||||
|
|
||||||
struct FontType
|
typedef std::pair<int, int> WindowSize;
|
||||||
{
|
// typedef std::pair<wxString, int> FontType;
|
||||||
wxString font_face;
|
typedef std::pair<bool, wxString> ImportDirInfo;
|
||||||
int font_size;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ImportDirInfo
|
|
||||||
{
|
|
||||||
bool auto_import;
|
|
||||||
wxString import_dir;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Serializer
|
class Serializer
|
||||||
{
|
{
|
||||||
|
|
@ -60,37 +52,46 @@ class Serializer
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
const std::string& m_Filepath;
|
const std::string& m_Filepath;
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
YAML::Emitter m_Emitter;
|
YAML::Emitter m_Emitter;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Window size
|
// Window size
|
||||||
int DeserializeWinSize(std::string key, int size) const;
|
WindowSize DeserializeWinSize() const;
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
// Menu and status bar
|
||||||
|
void SerializeShowMenuAndStatusBar(std::string key, bool value);
|
||||||
|
bool DeserializeShowMenuAndStatusBar(std::string key) const;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Browser controls
|
// Browser controls
|
||||||
void SerializeBrowserControls();
|
void SerializeBrowserControls(std::string key, bool value);
|
||||||
bool DeserializeBrowserControls(std::string key, bool control) const;
|
bool DeserializeBrowserControls(std::string key) const;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Display settings
|
// Display settings
|
||||||
void SerializeDisplaySettings(wxFont& font);
|
void SerializeDisplaySettings(wxFont& font);
|
||||||
FontType DeserializeDisplaySettings() const;
|
wxFont DeserializeDisplaySettings() const;
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
// Waveform colour
|
||||||
void SerializeWaveformColour(wxColour& colour);
|
void SerializeWaveformColour(wxColour& colour);
|
||||||
wxColour DeserializeWaveformColour() const;
|
wxColour DeserializeWaveformColour() const;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Auto import settings
|
// Auto import settings
|
||||||
void SerializeAutoImportSettings(wxTextCtrl& textCtrl, wxCheckBox& checkBox);
|
void SerializeAutoImportSettings(bool autoImport, const std::string& importDir);
|
||||||
ImportDirInfo DeserializeAutoImportSettings() const;
|
ImportDirInfo DeserializeAutoImportSettings() const;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Show file extension
|
// Follow symbolic links
|
||||||
void SerializeShowFileExtensionSetting(wxCheckBox& checkBox);
|
void SerializeFollowSymLink(bool followSymLink);
|
||||||
bool DeserializeShowFileExtensionSetting() const;
|
bool DeserializeFollowSymLink() const;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Favorite samples
|
// Show file extension
|
||||||
void SerializeDataViewTreeCtrlItems(wxTreeCtrl& tree, wxTreeItemId& item);
|
void SerializeShowFileExtensionSetting(bool showExtension);
|
||||||
bool DeserializeDataViewTreeCtrlItems(YAML::Emitter& out, wxDataViewItem item) const;
|
bool DeserializeShowFileExtensionSetting() const;
|
||||||
};
|
};
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Tags.hpp"
|
#include "Utility/Tags.hpp"
|
||||||
#include "SampleHiveConfig.hpp"
|
#include "SampleHiveConfig.hpp"
|
||||||
|
|
||||||
#include <taglib/tag.h>
|
#include <taglib/tag.h>
|
||||||
Loading…
Reference in New Issue