mirror of
https://gitlab.com/samplehive/sample-hive.git
synced 2026-10-11 23:44:12 +02:00
Added ability to install SampleHive, added _() macro for translation support, much more clearer log messages and general clean up.
This commit is contained in:
+4
-1
@@ -1,10 +1,13 @@
|
||||
#include "App.hpp"
|
||||
#include "SampleHiveConfig.hpp"
|
||||
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/defs.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/splash.h>
|
||||
|
||||
#define SPLASH_LOGO SAMPLEHIVE_DATADIR "/assets/logo/logo-hive_768x432.png"
|
||||
|
||||
wxIMPLEMENT_APP(App);
|
||||
|
||||
App::App()
|
||||
@@ -27,7 +30,7 @@ bool App::OnInit()
|
||||
wxBitmap bitmap;
|
||||
wxSplashScreen* splash;
|
||||
|
||||
if (bitmap.LoadFile("../assets/logo/logo-hive_768x432.png", wxBITMAP_TYPE_PNG))
|
||||
if (bitmap.LoadFile(SPLASH_LOGO, wxBITMAP_TYPE_PNG))
|
||||
{
|
||||
splash = new wxSplashScreen(bitmap,
|
||||
wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT,
|
||||
|
||||
+52
-52
@@ -23,7 +23,7 @@ Database::~Database()
|
||||
|
||||
}
|
||||
|
||||
void Database::CreateTableSamples()
|
||||
void Database::CreateTableSamples(const std::string& dbPath)
|
||||
{
|
||||
/* Create SQL statement */
|
||||
std::string samples = "CREATE TABLE IF NOT EXISTS SAMPLES("
|
||||
@@ -42,7 +42,7 @@ void Database::CreateTableSamples()
|
||||
|
||||
try
|
||||
{
|
||||
if (sqlite3_open("sample.hive", &m_Database) != SQLITE_OK)
|
||||
if (sqlite3_open(dbPath.c_str(), &m_Database) != SQLITE_OK)
|
||||
{
|
||||
wxLogDebug("Error opening DB");
|
||||
throw sqlite3_errmsg(m_Database);
|
||||
@@ -63,7 +63,7 @@ void Database::CreateTableSamples()
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogDebug("Table created successfully.");
|
||||
wxLogDebug("Samples table created successfully.");
|
||||
}
|
||||
|
||||
rc = sqlite3_close(m_Database);
|
||||
@@ -79,14 +79,14 @@ void Database::CreateTableSamples()
|
||||
}
|
||||
}
|
||||
|
||||
void Database::CreateTableHives()
|
||||
void Database::CreateTableHives(const std::string& dbPath)
|
||||
{
|
||||
/* Create SQL statement */
|
||||
std::string hives = "CREATE TABLE IF NOT EXISTS HIVES(HIVE TEXT NOT NULL);";
|
||||
|
||||
try
|
||||
{
|
||||
if (sqlite3_open("sample.hive", &m_Database) != SQLITE_OK)
|
||||
if (sqlite3_open(dbPath.c_str(), &m_Database) != SQLITE_OK)
|
||||
{
|
||||
wxLogDebug("Error opening DB");
|
||||
throw sqlite3_errmsg(m_Database);
|
||||
@@ -107,7 +107,7 @@ void Database::CreateTableHives()
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogDebug("Table created successfully.");
|
||||
wxLogDebug("Hives table created successfully.");
|
||||
}
|
||||
|
||||
rc = sqlite3_close(m_Database);
|
||||
@@ -124,11 +124,11 @@ void Database::CreateTableHives()
|
||||
}
|
||||
|
||||
//Loops through a Sample array and adds them to the database
|
||||
void Database::InsertIntoSamples(std::vector<Sample> samples)
|
||||
void Database::InsertIntoSamples(const std::string& dbPath, std::vector<Sample> samples)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (sqlite3_open("sample.hive", &m_Database) != SQLITE_OK)
|
||||
if (sqlite3_open(dbPath.c_str(), &m_Database) != SQLITE_OK)
|
||||
{
|
||||
wxLogDebug("Error opening DB");
|
||||
throw sqlite3_errmsg(m_Database);
|
||||
@@ -235,11 +235,11 @@ void Database::InsertIntoSamples(std::vector<Sample> samples)
|
||||
}
|
||||
}
|
||||
|
||||
void Database::InsertIntoHives(const std::string& hiveName)
|
||||
void Database::InsertIntoHives(const std::string& dbPath, const std::string& hiveName)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (sqlite3_open("sample.hive", &m_Database) != SQLITE_OK)
|
||||
if (sqlite3_open(dbPath.c_str(), &m_Database) != SQLITE_OK)
|
||||
{
|
||||
wxLogDebug("Error opening DB");
|
||||
throw sqlite3_errmsg(m_Database);
|
||||
@@ -333,11 +333,11 @@ void Database::InsertIntoHives(const std::string& hiveName)
|
||||
}
|
||||
}
|
||||
|
||||
void Database::UpdateHive(const std::string& hiveOldName, const std::string& hiveNewName)
|
||||
void Database::UpdateHive(const std::string& dbPath, const std::string& hiveOldName, const std::string& hiveNewName)
|
||||
{
|
||||
try
|
||||
{
|
||||
rc = sqlite3_open("sample.hive", &m_Database);
|
||||
rc = sqlite3_open(dbPath.c_str(), &m_Database);
|
||||
|
||||
std::string update = "UPDATE HIVES SET HIVE = ? WHERE HIVE = ?;";
|
||||
|
||||
@@ -374,11 +374,11 @@ void Database::UpdateHive(const std::string& hiveOldName, const std::string& hiv
|
||||
}
|
||||
}
|
||||
|
||||
void Database::UpdateHiveName(const std::string& filename, const std::string& hiveName)
|
||||
void Database::UpdateHiveName(const std::string& dbPath, const std::string& filename, const std::string& hiveName)
|
||||
{
|
||||
try
|
||||
{
|
||||
rc = sqlite3_open("sample.hive", &m_Database);
|
||||
rc = sqlite3_open(dbPath.c_str(), &m_Database);
|
||||
|
||||
std::string update = "UPDATE SAMPLES SET HIVE = ? WHERE FILENAME = ?;";
|
||||
|
||||
@@ -413,11 +413,11 @@ void Database::UpdateHiveName(const std::string& filename, const std::string& hi
|
||||
}
|
||||
}
|
||||
|
||||
void Database::UpdateFavoriteColumn(const std::string& filename, int value)
|
||||
void Database::UpdateFavoriteColumn(const std::string& dbPath, const std::string& filename, int value)
|
||||
{
|
||||
try
|
||||
{
|
||||
rc = sqlite3_open("sample.hive", &m_Database);
|
||||
rc = sqlite3_open(dbPath.c_str(), &m_Database);
|
||||
|
||||
std::string update = "UPDATE SAMPLES SET FAVORITE = ? WHERE FILENAME = ?;";
|
||||
|
||||
@@ -452,11 +452,11 @@ void Database::UpdateFavoriteColumn(const std::string& filename, int value)
|
||||
}
|
||||
}
|
||||
|
||||
void Database::UpdateSamplePack(const std::string& filename, const std::string& samplePack)
|
||||
void Database::UpdateSamplePack(const std::string& dbPath, const std::string& filename, const std::string& samplePack)
|
||||
{
|
||||
try
|
||||
{
|
||||
rc = sqlite3_open("sample.hive", &m_Database);
|
||||
rc = sqlite3_open(dbPath.c_str(), &m_Database);
|
||||
|
||||
std::string update = "UPDATE SAMPLES SET SAMPLEPACK = ? WHERE FILENAME = ?;";
|
||||
|
||||
@@ -491,11 +491,11 @@ void Database::UpdateSamplePack(const std::string& filename, const std::string&
|
||||
}
|
||||
}
|
||||
|
||||
void Database::UpdateSampleType(const std::string& filename, const std::string& type)
|
||||
void Database::UpdateSampleType(const std::string& dbPath, const std::string& filename, const std::string& type)
|
||||
{
|
||||
try
|
||||
{
|
||||
rc = sqlite3_open("sample.hive", &m_Database);
|
||||
rc = sqlite3_open(dbPath.c_str(), &m_Database);
|
||||
|
||||
std::string update = "UPDATE SAMPLES SET TYPE = ? WHERE FILENAME = ?;";
|
||||
|
||||
@@ -530,13 +530,13 @@ void Database::UpdateSampleType(const std::string& filename, const std::string&
|
||||
}
|
||||
}
|
||||
|
||||
std::string Database::GetSampleType(const std::string& filename)
|
||||
std::string Database::GetSampleType(const std::string& dbPath, const std::string& filename)
|
||||
{
|
||||
std::string type;
|
||||
|
||||
try
|
||||
{
|
||||
rc = sqlite3_open("sample.hive", &m_Database);
|
||||
rc = sqlite3_open(dbPath.c_str(), &m_Database);
|
||||
|
||||
std::string select = "SELECT TYPE FROM SAMPLES WHERE FILENAME = ?;";
|
||||
|
||||
@@ -575,13 +575,13 @@ std::string Database::GetSampleType(const std::string& filename)
|
||||
return type;
|
||||
}
|
||||
|
||||
int Database::GetFavoriteColumnValueByFilename(const std::string& filename)
|
||||
int Database::GetFavoriteColumnValueByFilename(const std::string& dbPath, const std::string& filename)
|
||||
{
|
||||
int value = 0;
|
||||
|
||||
try
|
||||
{
|
||||
rc = sqlite3_open("sample.hive", &m_Database);
|
||||
rc = sqlite3_open(dbPath.c_str(), &m_Database);
|
||||
|
||||
std::string select = "SELECT FAVORITE FROM SAMPLES WHERE FILENAME = ?;";
|
||||
|
||||
@@ -619,13 +619,13 @@ int Database::GetFavoriteColumnValueByFilename(const std::string& filename)
|
||||
return value;
|
||||
}
|
||||
|
||||
std::string Database::GetHiveByFilename(const std::string& filename)
|
||||
std::string Database::GetHiveByFilename(const std::string& dbPath, const std::string& filename)
|
||||
{
|
||||
std::string hive;
|
||||
|
||||
try
|
||||
{
|
||||
rc = sqlite3_open("sample.hive", &m_Database);
|
||||
rc = sqlite3_open(dbPath.c_str(), &m_Database);
|
||||
|
||||
std::string select = "SELECT HIVE FROM SAMPLES WHERE FILENAME = ?;";
|
||||
|
||||
@@ -664,11 +664,11 @@ std::string Database::GetHiveByFilename(const std::string& filename)
|
||||
return hive;
|
||||
}
|
||||
|
||||
void Database::RemoveSampleFromDatabase(const std::string& filename)
|
||||
void Database::RemoveSampleFromDatabase(const std::string& dbPath, const std::string& filename)
|
||||
{
|
||||
try
|
||||
{
|
||||
rc = sqlite3_open("sample.hive", &m_Database);
|
||||
rc = sqlite3_open(dbPath.c_str(), &m_Database);
|
||||
|
||||
std::string remove = "DELETE FROM SAMPLES WHERE FILENAME = ?;";
|
||||
|
||||
@@ -703,11 +703,11 @@ void Database::RemoveSampleFromDatabase(const std::string& filename)
|
||||
}
|
||||
}
|
||||
|
||||
void Database::RemoveHiveFromDatabase(const std::string& hiveName)
|
||||
void Database::RemoveHiveFromDatabase(const std::string& dbPath, const std::string& hiveName)
|
||||
{
|
||||
try
|
||||
{
|
||||
rc = sqlite3_open("sample.hive", &m_Database);
|
||||
rc = sqlite3_open(dbPath.c_str(), &m_Database);
|
||||
|
||||
std::string remove = "DELETE FROM HIVES WHERE HIVE = ?;";
|
||||
|
||||
@@ -742,13 +742,13 @@ void Database::RemoveHiveFromDatabase(const std::string& hiveName)
|
||||
}
|
||||
}
|
||||
|
||||
std::string Database::GetSamplePathByFilename(const std::string& filename)
|
||||
std::string Database::GetSamplePathByFilename(const std::string& dbPath, const std::string& filename)
|
||||
{
|
||||
std::string path;
|
||||
|
||||
try
|
||||
{
|
||||
rc = sqlite3_open("sample.hive", &m_Database);
|
||||
rc = sqlite3_open(dbPath.c_str(), &m_Database);
|
||||
|
||||
std::string select = "SELECT PATH FROM SAMPLES WHERE FILENAME = ?;";
|
||||
|
||||
@@ -786,13 +786,13 @@ std::string Database::GetSamplePathByFilename(const std::string& filename)
|
||||
return path;
|
||||
}
|
||||
|
||||
std::string Database::GetSampleFileExtension(const std::string& filename)
|
||||
std::string Database::GetSampleFileExtension(const std::string& dbPath, const std::string& filename)
|
||||
{
|
||||
std::string extension;
|
||||
|
||||
try
|
||||
{
|
||||
rc = sqlite3_open("sample.hive", &m_Database);
|
||||
rc = sqlite3_open(dbPath.c_str(), &m_Database);
|
||||
|
||||
std::string select = "SELECT EXTENSION FROM SAMPLES WHERE FILENAME = ?;";
|
||||
|
||||
@@ -831,7 +831,7 @@ std::string Database::GetSampleFileExtension(const std::string& filename)
|
||||
}
|
||||
|
||||
wxVector<wxVector<wxVariant>>
|
||||
Database::LoadSamplesDatabase(wxVector<wxVector<wxVariant>>& vecSet,
|
||||
Database::LoadSamplesDatabase(const std::string& dbPath, wxVector<wxVector<wxVariant>>& vecSet,
|
||||
// wxTreeCtrl& favorite_tree, wxTreeItemId& favorite_item,
|
||||
wxDataViewTreeCtrl& favorite_tree, wxDataViewItem& favorite_item,
|
||||
wxTreeCtrl& trash_tree, wxTreeItemId& trash_item, bool show_extension,
|
||||
@@ -839,7 +839,7 @@ Database::LoadSamplesDatabase(wxVector<wxVector<wxVariant>>& vecSet,
|
||||
{
|
||||
try
|
||||
{
|
||||
if (sqlite3_open("sample.hive", &m_Database) != SQLITE_OK)
|
||||
if (sqlite3_open(dbPath.c_str(), &m_Database) != SQLITE_OK)
|
||||
{
|
||||
wxLogDebug("Error opening DB");
|
||||
throw sqlite3_errmsg(m_Database);
|
||||
@@ -989,13 +989,13 @@ Database::LoadSamplesDatabase(wxVector<wxVector<wxVariant>>& vecSet,
|
||||
}
|
||||
|
||||
wxVector<wxVector<wxVariant>>
|
||||
Database::FilterDatabaseBySampleName(wxVector<wxVector<wxVariant>>& sampleVec,
|
||||
Database::FilterDatabaseBySampleName(const std::string& dbPath, wxVector<wxVector<wxVariant>>& sampleVec,
|
||||
const std::string& sampleName, bool show_extension,
|
||||
const std::string& icon_star_filled, const std::string& icon_star_empty)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (sqlite3_open("sample.hive", &m_Database) != SQLITE_OK)
|
||||
if (sqlite3_open(dbPath.c_str(), &m_Database) != SQLITE_OK)
|
||||
{
|
||||
wxLogDebug("Error opening DB");
|
||||
throw sqlite3_errmsg(m_Database);
|
||||
@@ -1087,13 +1087,13 @@ Database::FilterDatabaseBySampleName(wxVector<wxVector<wxVariant>>& sampleVec,
|
||||
}
|
||||
|
||||
wxVector<wxVector<wxVariant>>
|
||||
Database::FilterDatabaseByHiveName(wxVector<wxVector<wxVariant>>& sampleVec,
|
||||
Database::FilterDatabaseByHiveName(const std::string& dbPath, wxVector<wxVector<wxVariant>>& sampleVec,
|
||||
const std::string& hiveName, bool show_extension,
|
||||
const std::string& icon_star_filled, const std::string& icon_star_empty)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (sqlite3_open("sample.hive", &m_Database) != SQLITE_OK)
|
||||
if (sqlite3_open(dbPath.c_str(), &m_Database) != SQLITE_OK)
|
||||
{
|
||||
wxLogDebug("Error opening DB");
|
||||
throw sqlite3_errmsg(m_Database);
|
||||
@@ -1184,11 +1184,11 @@ Database::FilterDatabaseByHiveName(wxVector<wxVector<wxVariant>>& sampleVec,
|
||||
return sampleVec;
|
||||
}
|
||||
|
||||
void Database::LoadHivesDatabase(wxDataViewTreeCtrl& treeCtrl)
|
||||
void Database::LoadHivesDatabase(const std::string& dbPath, wxDataViewTreeCtrl& treeCtrl)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (sqlite3_open("sample.hive", &m_Database) != SQLITE_OK)
|
||||
if (sqlite3_open(dbPath.c_str(), &m_Database) != SQLITE_OK)
|
||||
{
|
||||
wxLogDebug("Error opening DB");
|
||||
throw sqlite3_errmsg(m_Database);
|
||||
@@ -1227,7 +1227,7 @@ void Database::LoadHivesDatabase(wxDataViewTreeCtrl& treeCtrl)
|
||||
}
|
||||
|
||||
//Compares the input array with the database and removes duplicates.
|
||||
wxArrayString Database::CheckDuplicates(const wxArrayString& files)
|
||||
wxArrayString Database::CheckDuplicates(const std::string& dbPath, const wxArrayString& files)
|
||||
{
|
||||
wxArrayString sorted_files;
|
||||
|
||||
@@ -1236,7 +1236,7 @@ wxArrayString Database::CheckDuplicates(const wxArrayString& files)
|
||||
|
||||
try
|
||||
{
|
||||
rc = sqlite3_open("sample.hive", &m_Database);
|
||||
rc = sqlite3_open(dbPath.c_str(), &m_Database);
|
||||
|
||||
std::string select = "SELECT * FROM SAMPLES WHERE FILENAME = ?;";
|
||||
|
||||
@@ -1268,11 +1268,11 @@ wxArrayString Database::CheckDuplicates(const wxArrayString& files)
|
||||
return sorted_files;
|
||||
}
|
||||
|
||||
bool Database::IsTrashed(const std::string& filename)
|
||||
bool Database::IsTrashed(const std::string& dbPath, const std::string& filename)
|
||||
{
|
||||
try
|
||||
{
|
||||
rc = sqlite3_open("sample.hive", &m_Database);
|
||||
rc = sqlite3_open(dbPath.c_str(), &m_Database);
|
||||
|
||||
std::string select = "SELECT TRASHED FROM SAMPLES WHERE FILENAME = ?;";
|
||||
|
||||
@@ -1312,11 +1312,11 @@ bool Database::IsTrashed(const std::string& filename)
|
||||
return false;
|
||||
}
|
||||
|
||||
void Database::UpdateTrashColumn(const std::string& filename, int value)
|
||||
void Database::UpdateTrashColumn(const std::string& dbPath, const std::string& filename, int value)
|
||||
{
|
||||
try
|
||||
{
|
||||
rc = sqlite3_open("sample.hive", &m_Database);
|
||||
rc = sqlite3_open(dbPath.c_str(), &m_Database);
|
||||
|
||||
std::string update = "UPDATE SAMPLES SET TRASHED = ? WHERE FILENAME = ?;";
|
||||
|
||||
@@ -1353,13 +1353,13 @@ void Database::UpdateTrashColumn(const std::string& filename, int value)
|
||||
}
|
||||
|
||||
wxVector<wxVector<wxVariant>>
|
||||
Database::RestoreFromTrashByFilename(const std::string& filename, wxVector<wxVector<wxVariant>>& vecSet,
|
||||
bool show_extension, const std::string& icon_star_filled,
|
||||
const std::string& icon_star_empty)
|
||||
Database::RestoreFromTrashByFilename(const std::string& dbPath, const std::string& filename,
|
||||
wxVector<wxVector<wxVariant>>& vecSet, bool show_extension,
|
||||
const std::string& icon_star_filled, const std::string& icon_star_empty)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (sqlite3_open("sample.hive", &m_Database) != SQLITE_OK)
|
||||
if (sqlite3_open(dbPath.c_str(), &m_Database) != SQLITE_OK)
|
||||
{
|
||||
wxLogDebug("Error opening DB");
|
||||
throw sqlite3_errmsg(m_Database);
|
||||
|
||||
+26
-26
@@ -32,61 +32,61 @@ class Database
|
||||
public:
|
||||
// -------------------------------------------------------------------
|
||||
// Create the table
|
||||
void CreateTableSamples();
|
||||
void CreateTableHives();
|
||||
void CreateTableSamples(const std::string& dbPath);
|
||||
void CreateTableHives(const std::string& dbPath);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Insert into database
|
||||
void InsertIntoSamples(std::vector<Sample>);
|
||||
void InsertIntoHives(const std::string& hiveName);
|
||||
void InsertIntoSamples(const std::string& dbPath, std::vector<Sample>);
|
||||
void InsertIntoHives(const std::string& dbPath, const std::string& hiveName);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Update database
|
||||
void UpdateFavoriteColumn(const std::string& filename, int value);
|
||||
void UpdateHive(const std::string& hiveOldName, const std::string& hiveNewName);
|
||||
void UpdateHiveName(const std::string& filename, const std::string& hiveName);
|
||||
void UpdateTrashColumn(const std::string& filename, int value);
|
||||
void UpdateSamplePack(const std::string& filename, const std::string& samplePack);
|
||||
void UpdateSampleType(const std::string& filename, const std::string& type);
|
||||
void UpdateFavoriteColumn(const std::string& dbPath, const std::string& filename, int value);
|
||||
void UpdateHive(const std::string& dbPath, const std::string& hiveOldName, const std::string& hiveNewName);
|
||||
void UpdateHiveName(const std::string& dbPath, const std::string& filename, const std::string& hiveName);
|
||||
void UpdateTrashColumn(const std::string& dbPath, const std::string& filename, int value);
|
||||
void UpdateSamplePack(const std::string& dbPath, const std::string& filename, const std::string& samplePack);
|
||||
void UpdateSampleType(const std::string& dbPath, const std::string& filename, const std::string& type);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Get from database
|
||||
int GetFavoriteColumnValueByFilename(const std::string& filename);
|
||||
std::string GetHiveByFilename(const std::string& filename);
|
||||
std::string GetSamplePathByFilename(const std::string& filename);
|
||||
std::string GetSampleFileExtension(const std::string& filename);
|
||||
std::string GetSampleType(const std::string& filename);
|
||||
int GetFavoriteColumnValueByFilename(const std::string& dbPath, const std::string& filename);
|
||||
std::string GetHiveByFilename(const std::string& dbPath, const std::string& filename);
|
||||
std::string GetSamplePathByFilename(const std::string& dbPath, const std::string& filename);
|
||||
std::string GetSampleFileExtension(const std::string& dbPath, const std::string& filename);
|
||||
std::string GetSampleType(const std::string& dbPath, const std::string& filename);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Check database
|
||||
bool IsTrashed(const std::string& filename);
|
||||
wxArrayString CheckDuplicates(const wxArrayString& files);
|
||||
bool IsTrashed(const std::string& dbPath, const std::string& filename);
|
||||
wxArrayString CheckDuplicates(const std::string& dbPath, const wxArrayString& files);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Remove from database
|
||||
void RemoveSampleFromDatabase(const std::string& filename);
|
||||
void RemoveHiveFromDatabase(const std::string& hiveName);
|
||||
void RemoveSampleFromDatabase(const std::string& dbPath, const std::string& filename);
|
||||
void RemoveHiveFromDatabase(const std::string& dbPath, const std::string& hiveName);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
wxVector<wxVector<wxVariant>>
|
||||
// LoadDatabase(wxVector<wxVector<wxVariant>> &vecSet,
|
||||
// wxTreeCtrl& favorite_tree, wxTreeItemId& favorite_item,
|
||||
// wxTreeCtrl& trash_tree, wxTreeItemId& trash_item, bool show_extension);
|
||||
LoadSamplesDatabase(wxVector<wxVector<wxVariant>>& vecSet,
|
||||
LoadSamplesDatabase(const std::string& dbPath, wxVector<wxVector<wxVariant>>& vecSet,
|
||||
wxDataViewTreeCtrl& favorite_tree, wxDataViewItem& favorite_item,
|
||||
wxTreeCtrl& trash_tree, wxTreeItemId& trash_item, bool show_extension,
|
||||
const std::string& icon_star_filled, const std::string& icon_star_emtpy);
|
||||
void LoadHivesDatabase(wxDataViewTreeCtrl& favorite_tree);
|
||||
void LoadHivesDatabase(const std::string& dbPath, wxDataViewTreeCtrl& favorite_tree);
|
||||
wxVector<wxVector<wxVariant>>
|
||||
RestoreFromTrashByFilename(const std::string& filename, wxVector<wxVector<wxVariant>>& vecSet,
|
||||
bool show_extension, const std::string& icon_star_filled,
|
||||
const std::string& icon_star_empty);
|
||||
RestoreFromTrashByFilename(const std::string& dbPath, const std::string& filename,
|
||||
wxVector<wxVector<wxVariant>>& vecSet, bool show_extension,
|
||||
const std::string& icon_star_filled, const std::string& icon_star_empty);
|
||||
wxVector<wxVector<wxVariant>>
|
||||
FilterDatabaseBySampleName(wxVector<wxVector<wxVariant>>& sampleVec,
|
||||
FilterDatabaseBySampleName(const std::string& dbPath, wxVector<wxVector<wxVariant>>& sampleVec,
|
||||
const std::string& sampleName, bool show_extension,
|
||||
const std::string& icon_star_filled, const std::string& icon_star_empty);
|
||||
wxVector<wxVector<wxVariant>>
|
||||
FilterDatabaseByHiveName(wxVector<wxVector<wxVariant>>& sampleVec,
|
||||
FilterDatabaseByHiveName(const std::string& dbPath, wxVector<wxVector<wxVariant>>& sampleVec,
|
||||
const std::string& hiveName, bool show_extension,
|
||||
const std::string& icon_star_filled, const std::string& icon_star_empty);
|
||||
};
|
||||
|
||||
+394
-326
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,6 @@
|
||||
#include <wx/collpane.h>
|
||||
#include <wx/dataview.h>
|
||||
#include <wx/dirctrl.h>
|
||||
// #include <wx/dirdlg.h>
|
||||
#include <wx/event.h>
|
||||
#include <wx/frame.h>
|
||||
#include <wx/fswatcher.h>
|
||||
|
||||
+12
-4
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <wx/log.h>
|
||||
#include <wx/stdpaths.h>
|
||||
#include <wx/filename.h>
|
||||
|
||||
#include <yaml-cpp/emittermanip.h>
|
||||
#include <yaml-cpp/node/parse.h>
|
||||
@@ -22,8 +23,10 @@ Serializer::Serializer(const std::string& filepath)
|
||||
|
||||
if (!ifstrm)
|
||||
{
|
||||
m_Emitter << YAML::Comment("This is the configuration file for the Sample Browser,"
|
||||
"feel free to edit this file as needed");
|
||||
wxLogDebug("Genrating configuration file..");
|
||||
|
||||
m_Emitter << YAML::Comment("This is the configuration file for SampleHive,"
|
||||
"feel free to edit the file as needed");
|
||||
m_Emitter << YAML::Newline;
|
||||
|
||||
m_Emitter << YAML::BeginMap;
|
||||
@@ -61,6 +64,8 @@ Serializer::Serializer(const std::string& filepath)
|
||||
|
||||
std::ofstream ofstrm(m_Filepath);
|
||||
ofstrm << m_Emitter.c_str();
|
||||
|
||||
wxLogDebug("Generated %s successfully!", m_Filepath);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -106,7 +111,7 @@ int Serializer::DeserializeWinSize(std::string key, int size) const
|
||||
std::cout << ex.what() << std::endl;
|
||||
}
|
||||
|
||||
wxLogDebug("size: %d", size);
|
||||
wxLogDebug("Window size: %d", size);
|
||||
|
||||
return size;
|
||||
}
|
||||
@@ -149,7 +154,10 @@ bool Serializer::DeserializeBrowserControls(std::string key, bool control) const
|
||||
std::cout << ex.what() << std::endl;
|
||||
}
|
||||
|
||||
wxLogDebug("Control: %d", control);
|
||||
wxLogDebug("Autoplay: %s, Loop: %s, Muted: %s",
|
||||
autoplay ? "enabled" : "disabled",
|
||||
loop ? "enabled" : "disabled",
|
||||
muted ? "muted" : "unmuted");
|
||||
|
||||
return control;
|
||||
}
|
||||
|
||||
@@ -107,9 +107,9 @@ Settings::Settings(wxWindow* window, const std::string& configFilepath, const st
|
||||
|
||||
m_DisplayTopSizer->Add(m_DisplayFontSizer, 1, wxALL | wxEXPAND, 2);
|
||||
|
||||
m_CollectionImportDirSizer->Add(m_AutoImportCheck, 0, wxALL | wxALIGN_LEFT, 2);
|
||||
m_CollectionImportDirSizer->Add(m_ImportDirLocation, 1, wxALL, 2);
|
||||
m_CollectionImportDirSizer->Add(m_BrowseAutoImportDirButton, 0, wxALL | wxALIGN_RIGHT, 2);
|
||||
m_CollectionImportDirSizer->Add(m_AutoImportCheck, 0, wxALL | wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, 2);
|
||||
m_CollectionImportDirSizer->Add(m_ImportDirLocation, 1, wxALL | wxALIGN_CENTER_VERTICAL, 2);
|
||||
m_CollectionImportDirSizer->Add(m_BrowseAutoImportDirButton, 0, wxALL | wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 2);
|
||||
|
||||
m_ShowFileExtensionSizer->Add(m_ShowFileExtensionCheck, 0, wxALL | wxALIGN_LEFT, 2);
|
||||
|
||||
|
||||
@@ -125,6 +125,6 @@ class Settings : public wxDialog
|
||||
wxString GetImportDirPath();
|
||||
|
||||
inline wxFont GetFontType() { return m_Font; };
|
||||
inline bool IsAutoImport() { return bAutoImport; };
|
||||
inline bool IsShowFileExtension() { return bShowExtension; };
|
||||
inline bool CanAutoImport() { return bAutoImport; };
|
||||
inline bool ShouldShowFileExtension() { return bShowExtension; };
|
||||
};
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
#include "Database.hpp"
|
||||
#include "TagEditorDialog.hpp"
|
||||
|
||||
TagEditor::TagEditor(wxWindow* window, const std::string& filename, wxInfoBar& info_bar)
|
||||
TagEditor::TagEditor(wxWindow* window, const std::string& dbPath, const std::string& filename, wxInfoBar& info_bar)
|
||||
: wxDialog(window, wxID_ANY, "Edit tags", wxDefaultPosition,
|
||||
wxSize(640, 360), wxDEFAULT_DIALOG_STYLE | wxSTAY_ON_TOP),
|
||||
m_Window(window), m_Filename(filename), m_InfoBar(info_bar), tags(filename)
|
||||
m_Window(window), m_DatabaseFilepath(dbPath), m_Filename(filename), m_InfoBar(info_bar), tags(filename)
|
||||
{
|
||||
m_Panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||
|
||||
@@ -215,7 +215,7 @@ void TagEditor::OnClickApply(wxCommandEvent& event)
|
||||
wxString comment = m_CommentText->GetValue();
|
||||
wxString type = m_SampleTypeChoice->GetStringSelection();
|
||||
|
||||
std::string sampleType = db.GetSampleType(m_Filename);
|
||||
std::string sampleType = db.GetSampleType(m_DatabaseFilepath, m_Filename);
|
||||
|
||||
std::string filename = wxString(m_Filename).AfterLast('/').BeforeLast('.').ToStdString();
|
||||
|
||||
@@ -245,7 +245,7 @@ void TagEditor::OnClickApply(wxCommandEvent& event)
|
||||
wxLogDebug("Changing artist tag..");
|
||||
tags.SetArtist(artist.ToStdString());
|
||||
|
||||
db.UpdateSamplePack(m_Filename, artist.ToStdString());
|
||||
db.UpdateSamplePack(m_DatabaseFilepath, m_Filename, artist.ToStdString());
|
||||
|
||||
wxLogDebug("SAMPLE FILENAME HERE: %s", m_Filename);
|
||||
|
||||
@@ -279,7 +279,7 @@ void TagEditor::OnClickApply(wxCommandEvent& event)
|
||||
if (m_SampleTypeCheck->GetValue() && m_SampleTypeChoice->GetStringSelection() != sampleType)
|
||||
{
|
||||
wxLogDebug("Changing type tag..");
|
||||
db.UpdateSampleType(filename, type.ToStdString());
|
||||
db.UpdateSampleType(m_DatabaseFilepath, filename, type.ToStdString());
|
||||
|
||||
info_msg = wxString::Format("Successfully changed type tag to %s", type);
|
||||
}
|
||||
|
||||
@@ -19,12 +19,13 @@
|
||||
class TagEditor : public wxDialog
|
||||
{
|
||||
public:
|
||||
TagEditor(wxWindow* window, const std::string& filename, wxInfoBar& info_bar);
|
||||
TagEditor(wxWindow* window, const std::string& dbPath, const std::string& filename, wxInfoBar& info_bar);
|
||||
~TagEditor();
|
||||
|
||||
private:
|
||||
// -------------------------------------------------------------------
|
||||
wxWindow* m_Window;
|
||||
const std::string m_DatabaseFilepath;
|
||||
const std::string m_Filename;
|
||||
|
||||
wxInfoBar& m_InfoBar;
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
#include "TreeItemDialog.hpp"
|
||||
|
||||
TreeItemDialog::TreeItemDialog(wxWindow* window):
|
||||
wxDialog(window, wxID_ANY, "Add root", wxDefaultPosition, wxDefaultSize,
|
||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxSTAY_ON_TOP)
|
||||
{
|
||||
mainSizer = new wxBoxSizer(wxVERTICAL);
|
||||
titleSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
buttonSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
mainPanel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||
|
||||
addRootLabel = new wxStaticText(mainPanel, wxID_ANY, "Title", wxDefaultPosition, wxDefaultSize);
|
||||
|
||||
addRootText = new wxTextCtrl(mainPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize);
|
||||
|
||||
addRootButton = new wxButton(mainPanel, wxID_OK, "Ok", wxDefaultPosition, wxDefaultSize, 0);
|
||||
cancelButton = new wxButton(mainPanel, wxID_CANCEL, "Cancel", wxDefaultPosition, wxDefaultSize, 0);
|
||||
|
||||
titleSizer->Add(addRootLabel, 0, wxALL, 2);
|
||||
titleSizer->Add(addRootText, 1, wxALL, 2);
|
||||
|
||||
buttonSizer->Add(addRootButton, 0, wxALL | wxALIGN_BOTTOM, 2);
|
||||
buttonSizer->Add(cancelButton, 0, wxALL | wxALIGN_BOTTOM, 2);
|
||||
|
||||
mainSizer->Add(titleSizer, 0, wxALL | wxEXPAND, 2);
|
||||
mainSizer->Add(buttonSizer, 1, wxALL | wxALIGN_RIGHT, 2);
|
||||
|
||||
mainPanel->SetSizer(mainSizer);
|
||||
mainSizer->Fit(mainPanel);
|
||||
mainSizer->SetSizeHints(mainPanel);
|
||||
mainSizer->Layout();
|
||||
}
|
||||
|
||||
TreeItemDialog::~TreeItemDialog()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <wx/button.h>
|
||||
#include <wx/defs.h>
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/stringimpl.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/window.h>
|
||||
|
||||
class TreeItemDialog : public wxDialog
|
||||
{
|
||||
public:
|
||||
TreeItemDialog(wxWindow* window);
|
||||
~TreeItemDialog();
|
||||
|
||||
public:
|
||||
wxPanel* mainPanel;
|
||||
|
||||
wxBoxSizer* mainSizer;
|
||||
wxBoxSizer* titleSizer;
|
||||
wxBoxSizer* buttonSizer;
|
||||
|
||||
wxStaticText* addRootLabel;
|
||||
|
||||
wxTextCtrl* addRootText;
|
||||
|
||||
wxButton* addRootButton;
|
||||
wxButton* cancelButton;
|
||||
};
|
||||
Reference in New Issue
Block a user