Renamed collection to hive and fixed some error handling.

This commit is contained in:
apoorv569 2021-06-27 22:55:23 +05:30
parent b9c61c02fe
commit 632534d7ad
5 changed files with 299 additions and 297 deletions

View File

@ -19,15 +19,15 @@ enum ControlIDs
BC_Autoplay,
BC_Volume,
BC_SamplePosition,
BC_CollectionView,
BC_Hives,
BC_DirCtrl,
BC_SampleListView,
BC_Search,
BC_MediaCtrl,
BC_TrashPane,
BC_RestoreTrashedItemButton,
BC_CollectionViewAdd,
BC_CollectionViewRemove,
BC_HiveAdd,
BC_HiveRemove,
// -------------------------------------------------------------------
// Setting dialog controls
@ -50,8 +50,8 @@ enum ControlIDs
// -------------------------------------------------------------------
// CollectionView Menu items
MN_CreateFolder,
MN_RemoveFolder,
MN_CreateHive,
MN_RemoveHive,
MN_RemoveSample,
MN_FilterSampleView,
MN_ShowInLibrary,

View File

@ -79,7 +79,7 @@ void Database::CreateTableSamples()
}
}
void Database::CreateTableCollections()
void Database::CreateTableHives()
{
/* Create SQL statement */
std::string collections = "CREATE TABLE IF NOT EXISTS COLLECTIONS(FOLDERNAME TEXT NOT NULL);";
@ -235,7 +235,7 @@ void Database::InsertIntoSamples(std::vector<Sample> samples)
}
}
void Database::InsertIntoCollections(const std::string& folderName)
void Database::InsertIntoHives(const std::string& folderName)
{
try
{
@ -373,7 +373,7 @@ void Database::UpdateFolder(const std::string& folderName)
}
}
void Database::UpdateFavoriteFolder(const std::string& filename, const std::string& folderName)
void Database::UpdateHiveName(const std::string& filename, const std::string& folderName)
{
try
{
@ -618,7 +618,7 @@ int Database::GetFavoriteColumnValueByFilename(const std::string& filename)
return value;
}
std::string Database::GetFavoriteFolderByFilename(const std::string& filename)
std::string Database::GetHiveByFilename(const std::string& filename)
{
std::string folder;
@ -702,7 +702,7 @@ void Database::RemoveSampleFromDatabase(const std::string& filename)
}
}
void Database::RemoveFolderFromCollections(const std::string& folderName)
void Database::RemoveHiveFromDatabase(const std::string& folderName)
{
try
{
@ -830,7 +830,7 @@ std::string Database::GetSampleFileExtension(const std::string& filename)
}
wxVector<wxVector<wxVariant>>
Database::LoadDatabase(wxVector<wxVector<wxVariant>>& vecSet,
Database::LoadSamplesDatabase(wxVector<wxVector<wxVariant>>& vecSet,
// wxTreeCtrl& favorite_tree, wxTreeItemId& favorite_item,
wxDataViewTreeCtrl& favorite_tree, wxDataViewItem& favorite_item,
wxTreeCtrl& trash_tree, wxTreeItemId& trash_item,
@ -1083,7 +1083,7 @@ Database::FilterDatabaseBySampleName(wxVector<wxVector<wxVariant>>& sampleVec,
}
wxVector<wxVector<wxVariant>>
Database::FilterDatabaseByFolderName(wxVector<wxVector<wxVariant>>& sampleVec,
Database::FilterDatabaseByHiveName(wxVector<wxVector<wxVariant>>& sampleVec,
const std::string& folderName, bool show_extension)
{
try
@ -1178,7 +1178,7 @@ Database::FilterDatabaseByFolderName(wxVector<wxVector<wxVariant>>& sampleVec,
return sampleVec;
}
void Database::LoadCollectionFolder(wxDataViewTreeCtrl& treeCtrl)
void Database::LoadHivesDatabase(wxDataViewTreeCtrl& treeCtrl)
{
try
{

View File

@ -33,18 +33,18 @@ class Database
// -------------------------------------------------------------------
// Create the table
void CreateTableSamples();
void CreateTableCollections();
void CreateTableHives();
// -------------------------------------------------------------------
// Insert into database
void InsertIntoSamples(std::vector<Sample>);
void InsertIntoCollections(const std::string& folderName);
void InsertIntoHives(const std::string& folderName);
// -------------------------------------------------------------------
// Update database
void UpdateFavoriteColumn(const std::string& filename, int value);
void UpdateFolder(const std::string& folderName);
void UpdateFavoriteFolder(const std::string& filename,
void UpdateHiveName(const std::string& filename,
const std::string& folderName);
void UpdateTrashColumn(const std::string& filename, int value);
void UpdateSamplePack(const std::string& filename, const std::string& samplePack);
@ -53,7 +53,7 @@ class Database
// -------------------------------------------------------------------
// Get from database
int GetFavoriteColumnValueByFilename(const std::string& filename);
std::string GetFavoriteFolderByFilename(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);
@ -66,21 +66,21 @@ class Database
// -------------------------------------------------------------------
// Remove from database
void RemoveSampleFromDatabase(const std::string& filename);
void RemoveFolderFromCollections(const std::string& folderName);
void RemoveHiveFromDatabase(const std::string& folderName);
// -------------------------------------------------------------------
wxVector<wxVector<wxVariant>>
// LoadDatabase(wxVector<wxVector<wxVariant>> &vecSet,
// wxTreeCtrl& favorite_tree, wxTreeItemId& favorite_item,
// wxTreeCtrl& trash_tree, wxTreeItemId& trash_item, bool show_extension);
LoadDatabase(wxVector<wxVector<wxVariant>>& vecSet,
wxDataViewTreeCtrl& favorite_tree, wxDataViewItem& favorite_item,
wxTreeCtrl& trash_tree, wxTreeItemId& trash_item, bool show_extension);
void LoadCollectionFolder(wxDataViewTreeCtrl& favorite_tree);
LoadSamplesDatabase(wxVector<wxVector<wxVariant>>& vecSet,
wxDataViewTreeCtrl& favorite_tree, wxDataViewItem& favorite_item,
wxTreeCtrl& trash_tree, wxTreeItemId& trash_item, bool show_extension);
void LoadHivesDatabase(wxDataViewTreeCtrl& favorite_tree);
wxVector<wxVector<wxVariant>>
FilterDatabaseBySampleName(wxVector<wxVector<wxVariant>>& sampleVec,
const std::string& sampleName, bool show_extension);
wxVector<wxVector<wxVariant>>
FilterDatabaseByFolderName(wxVector<wxVector<wxVariant>>& sampleVec,
FilterDatabaseByHiveName(wxVector<wxVector<wxVariant>>& sampleVec,
const std::string& folderName, bool show_extension);
};

File diff suppressed because it is too large Load Diff

View File

@ -82,24 +82,24 @@ class MainFrame : public wxFrame
// -------------------------------------------------------------------
// Left panel controls
wxPanel* m_BottomLeftPanel;
wxPanel* m_CollectionViewPanel;
wxPanel* m_HivesPanel;
wxWindow* m_TrashPaneWindow;
wxNotebook* m_ViewChoice;
wxBoxSizer* m_BottomLeftPanelMainSizer;
wxBoxSizer* m_CollectionViewMainSizer;
wxBoxSizer* m_CollectionViewFavoritesSizer;
wxBoxSizer* m_CollectionViewTrashSizer;
wxBoxSizer* m_CollectionViewButtonSizer;
wxBoxSizer* m_HivesMainSizer;
wxBoxSizer* m_HivesFavoritesSizer;
wxBoxSizer* m_HivesViewTrashSizer;
wxBoxSizer* m_HivesButtonSizer;
wxBoxSizer* m_TrashItemSizer;
wxSizerItem *m_CollectionViewTrashSizerItem;
wxSizerItem* m_HivesViewTrashSizerItem;
wxDirCtrl* m_DirCtrl;
wxDataViewTreeCtrl* m_CollectionView;
wxDataViewTreeCtrl* m_Hives;
wxDataViewItem favorites_folder;
wxTreeItemId trash_root_node;
wxCollapsiblePane* m_TrashPane;
wxTreeCtrl* m_TrashedItems;
wxButton* m_AddTreeItemButton;
wxButton* m_RemoveTreeItemButton;
wxButton* m_AddHiveButton;
wxButton* m_RemoveHiveButton;
wxButton* m_RestoreTrashedItemButton;
// -------------------------------------------------------------------
@ -159,12 +159,11 @@ class MainFrame : public wxFrame
void OnClickRestoreTrashItem(wxCommandEvent& event);
// -------------------------------------------------------------------
// CollectionViewPanel button event handlers
void OnClickCollectionView(wxDataViewEvent& event);
void OnDragAndDropToCollectionView(wxDropFilesEvent& event);
void OnClickCollectionAdd(wxCommandEvent& event);
void OnClickCollectionRemove(wxCommandEvent& event);
void OnShowCollectionViewContextMenu(wxDataViewEvent& event);
// Hives panel button event handlers
void OnDragAndDropToHives(wxDropFilesEvent& event);
void OnClickAddHive(wxCommandEvent& event);
void OnClickRemoveHive(wxCommandEvent& event);
void OnShowHivesContextMenu(wxDataViewEvent& event);
// -------------------------------------------------------------------
// SearchCtrl event handlers