-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add feature to save previously used icons (#15)
* working changes * basic delete/select working * collection feature working * add hashing to avoid duplicate copies * increment version * sort categories alphabetically
- Loading branch information
Showing
17 changed files
with
437 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#pragma once | ||
|
||
#include <borealis.hpp> | ||
#include "view/recycling_grid.hpp" | ||
#include "state/image_state.hpp" | ||
|
||
#include <borealis/core/event.hpp> | ||
|
||
namespace collection { | ||
|
||
struct CollectionItem { | ||
std::string file = ""; | ||
Image image; | ||
bool selected = false; | ||
}; | ||
|
||
class RecyclerCell | ||
: public RecyclingGridItem | ||
{ | ||
public: | ||
RecyclerCell(); | ||
|
||
BRLS_BIND(brls::Image, image, "image"); | ||
|
||
virtual void prepareForReuse() override | ||
{ | ||
image->clear(); | ||
img.clear(); | ||
} | ||
|
||
virtual void cacheForReuse() override | ||
{ | ||
image->clear(); | ||
img.clear(); | ||
} | ||
|
||
virtual void onFocusGained() override; | ||
|
||
static RecyclerCell *create(std::function<void(std::string)> cb); | ||
CollectionItem* ref; | ||
std::string img = ""; | ||
std::function<void(std::string)> cb; | ||
}; | ||
|
||
class DataSource | ||
: public RecyclingGridDataSource | ||
{ | ||
public: | ||
DataSource(std::vector<CollectionItem> items, std::function<void(std::string)> onSelected, brls::View *parent); | ||
bool onItemAction(RecyclingGrid *recycler, size_t index, brls::ControllerButton button) override; | ||
|
||
RecyclingGridItem *cellForRow(RecyclingGrid *recycler, size_t index) override; | ||
|
||
void onItemSelected(RecyclingGrid *recycler, size_t index) override; | ||
|
||
void clearData() override; | ||
|
||
size_t getItemCount() override; | ||
|
||
void deleteSelected(); | ||
|
||
void updateCell(RecyclingGridItem* item, size_t index) override; | ||
|
||
std::function<void(std::string)> onSelected; | ||
std::vector<CollectionItem> items; | ||
brls::View *parent = nullptr; | ||
}; | ||
|
||
class CollectionGrid : public brls::Box | ||
{ | ||
public: | ||
CollectionGrid(const std::vector<std::string> &files, std::string title, ImageState &state, std::function<void(std::string)> onSelected, std::function<void(std::string, ImageState &state)> onFocused); | ||
|
||
BRLS_BIND(RecyclingGrid, recycler, "recycler"); | ||
BRLS_BIND(brls::Image, workingImage, "image"); | ||
BRLS_BIND(brls::Button, confirmDelete, "confirm_delete"); | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<brls:Box | ||
width="auto" | ||
height="auto" | ||
axis="row"> | ||
|
||
<brls:Box | ||
width="60%" | ||
height="auto"> | ||
<RecyclingGrid | ||
id="recycler" | ||
width="auto" | ||
height="auto" | ||
grow="1.0" | ||
spanCount="5" | ||
itemHeight="128px" | ||
itemSpace="2px" | ||
paddingTop="@style/brls/sidebar/padding_top" | ||
paddingRight="@style/brls/sidebar/padding_right" | ||
paddingBottom="@style/brls/sidebar/padding_bottom" | ||
paddingLeft="@style/brls/sidebar/padding_left" /> | ||
|
||
</brls:Box> | ||
<brls:Box | ||
width="40%" | ||
height="auto" | ||
justifyContent="flexStart" | ||
alignItems="center" | ||
axis="column" | ||
paddingTop="60px"> | ||
|
||
<brls:Label | ||
width="auto" | ||
height="auto" | ||
text="@i18n/app/main/new_icon" | ||
fontSize="26" | ||
marginBottom="20px" /> | ||
|
||
<brls:Image | ||
id="image" | ||
width="340px" | ||
height="340px" | ||
borderThickness="5px" | ||
cornerRadius="5px" | ||
borderColor="@theme/brls/applet_frame/separator" /> | ||
|
||
<brls:Button | ||
id="confirm_delete" | ||
width="75%" | ||
height="auto" | ||
text="@i18n/app/main/confirm_delete" | ||
marginTop="20px" /> | ||
|
||
|
||
</brls:Box> | ||
|
||
</brls:Box> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.