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_Autoplay,
BC_Volume, BC_Volume,
BC_SamplePosition, BC_SamplePosition,
BC_CollectionView, BC_Hives,
BC_DirCtrl, BC_DirCtrl,
BC_SampleListView, BC_SampleListView,
BC_Search, BC_Search,
BC_MediaCtrl, BC_MediaCtrl,
BC_TrashPane, BC_TrashPane,
BC_RestoreTrashedItemButton, BC_RestoreTrashedItemButton,
BC_CollectionViewAdd, BC_HiveAdd,
BC_CollectionViewRemove, BC_HiveRemove,
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Setting dialog controls // Setting dialog controls
@ -50,8 +50,8 @@ enum ControlIDs
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// CollectionView Menu items // CollectionView Menu items
MN_CreateFolder, MN_CreateHive,
MN_RemoveFolder, MN_RemoveHive,
MN_RemoveSample, MN_RemoveSample,
MN_FilterSampleView, MN_FilterSampleView,
MN_ShowInLibrary, MN_ShowInLibrary,

View File

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

View File

@ -33,18 +33,18 @@ class Database
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Create the table // Create the table
void CreateTableSamples(); void CreateTableSamples();
void CreateTableCollections(); void CreateTableHives();
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Insert into database // Insert into database
void InsertIntoSamples(std::vector<Sample>); void InsertIntoSamples(std::vector<Sample>);
void InsertIntoCollections(const std::string& folderName); void InsertIntoHives(const std::string& folderName);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Update database // Update database
void UpdateFavoriteColumn(const std::string& filename, int value); void UpdateFavoriteColumn(const std::string& filename, int value);
void UpdateFolder(const std::string& folderName); void UpdateFolder(const std::string& folderName);
void UpdateFavoriteFolder(const std::string& filename, void UpdateHiveName(const std::string& filename,
const std::string& folderName); const std::string& folderName);
void UpdateTrashColumn(const std::string& filename, int value); void UpdateTrashColumn(const std::string& filename, int value);
void UpdateSamplePack(const std::string& filename, const std::string& samplePack); void UpdateSamplePack(const std::string& filename, const std::string& samplePack);
@ -53,7 +53,7 @@ class Database
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Get from database // Get from database
int GetFavoriteColumnValueByFilename(const std::string& filename); 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 GetSamplePathByFilename(const std::string& filename);
std::string GetSampleFileExtension(const std::string& filename); std::string GetSampleFileExtension(const std::string& filename);
std::string GetSampleType(const std::string& filename); std::string GetSampleType(const std::string& filename);
@ -66,21 +66,21 @@ class Database
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Remove from database // Remove from database
void RemoveSampleFromDatabase(const std::string& filename); void RemoveSampleFromDatabase(const std::string& filename);
void RemoveFolderFromCollections(const std::string& folderName); void RemoveHiveFromDatabase(const std::string& folderName);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
wxVector<wxVector<wxVariant>> wxVector<wxVector<wxVariant>>
// LoadDatabase(wxVector<wxVector<wxVariant>> &vecSet, // LoadDatabase(wxVector<wxVector<wxVariant>> &vecSet,
// wxTreeCtrl& favorite_tree, wxTreeItemId& favorite_item, // wxTreeCtrl& favorite_tree, wxTreeItemId& favorite_item,
// wxTreeCtrl& trash_tree, wxTreeItemId& trash_item, bool show_extension); // wxTreeCtrl& trash_tree, wxTreeItemId& trash_item, bool show_extension);
LoadDatabase(wxVector<wxVector<wxVariant>>& vecSet, LoadSamplesDatabase(wxVector<wxVector<wxVariant>>& vecSet,
wxDataViewTreeCtrl& favorite_tree, wxDataViewItem& favorite_item, wxDataViewTreeCtrl& favorite_tree, wxDataViewItem& favorite_item,
wxTreeCtrl& trash_tree, wxTreeItemId& trash_item, bool show_extension); wxTreeCtrl& trash_tree, wxTreeItemId& trash_item, bool show_extension);
void LoadCollectionFolder(wxDataViewTreeCtrl& favorite_tree); void LoadHivesDatabase(wxDataViewTreeCtrl& favorite_tree);
wxVector<wxVector<wxVariant>> wxVector<wxVector<wxVariant>>
FilterDatabaseBySampleName(wxVector<wxVector<wxVariant>>& sampleVec, FilterDatabaseBySampleName(wxVector<wxVector<wxVariant>>& sampleVec,
const std::string& sampleName, bool show_extension); const std::string& sampleName, bool show_extension);
wxVector<wxVector<wxVariant>> wxVector<wxVector<wxVariant>>
FilterDatabaseByFolderName(wxVector<wxVector<wxVariant>>& sampleVec, FilterDatabaseByHiveName(wxVector<wxVector<wxVariant>>& sampleVec,
const std::string& folderName, bool show_extension); 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 // Left panel controls
wxPanel* m_BottomLeftPanel; wxPanel* m_BottomLeftPanel;
wxPanel* m_CollectionViewPanel; wxPanel* m_HivesPanel;
wxWindow* m_TrashPaneWindow; wxWindow* m_TrashPaneWindow;
wxNotebook* m_ViewChoice; wxNotebook* m_ViewChoice;
wxBoxSizer* m_BottomLeftPanelMainSizer; wxBoxSizer* m_BottomLeftPanelMainSizer;
wxBoxSizer* m_CollectionViewMainSizer; wxBoxSizer* m_HivesMainSizer;
wxBoxSizer* m_CollectionViewFavoritesSizer; wxBoxSizer* m_HivesFavoritesSizer;
wxBoxSizer* m_CollectionViewTrashSizer; wxBoxSizer* m_HivesViewTrashSizer;
wxBoxSizer* m_CollectionViewButtonSizer; wxBoxSizer* m_HivesButtonSizer;
wxBoxSizer* m_TrashItemSizer; wxBoxSizer* m_TrashItemSizer;
wxSizerItem *m_CollectionViewTrashSizerItem; wxSizerItem* m_HivesViewTrashSizerItem;
wxDirCtrl* m_DirCtrl; wxDirCtrl* m_DirCtrl;
wxDataViewTreeCtrl* m_CollectionView; wxDataViewTreeCtrl* m_Hives;
wxDataViewItem favorites_folder; wxDataViewItem favorites_folder;
wxTreeItemId trash_root_node; wxTreeItemId trash_root_node;
wxCollapsiblePane* m_TrashPane; wxCollapsiblePane* m_TrashPane;
wxTreeCtrl* m_TrashedItems; wxTreeCtrl* m_TrashedItems;
wxButton* m_AddTreeItemButton; wxButton* m_AddHiveButton;
wxButton* m_RemoveTreeItemButton; wxButton* m_RemoveHiveButton;
wxButton* m_RestoreTrashedItemButton; wxButton* m_RestoreTrashedItemButton;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@ -159,12 +159,11 @@ class MainFrame : public wxFrame
void OnClickRestoreTrashItem(wxCommandEvent& event); void OnClickRestoreTrashItem(wxCommandEvent& event);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// CollectionViewPanel button event handlers // Hives panel button event handlers
void OnClickCollectionView(wxDataViewEvent& event); void OnDragAndDropToHives(wxDropFilesEvent& event);
void OnDragAndDropToCollectionView(wxDropFilesEvent& event); void OnClickAddHive(wxCommandEvent& event);
void OnClickCollectionAdd(wxCommandEvent& event); void OnClickRemoveHive(wxCommandEvent& event);
void OnClickCollectionRemove(wxCommandEvent& event); void OnShowHivesContextMenu(wxDataViewEvent& event);
void OnShowCollectionViewContextMenu(wxDataViewEvent& event);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// SearchCtrl event handlers // SearchCtrl event handlers