This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository minilauncher-for-slippi.
View the commit online.
commit 3195a055678642553f291ca3ba3105fce58a1e07
Author: Nekobit <m...@ow.nekobit.net>
AuthorDate: Wed Sep 13 23:00:00 2023 -0400
Dropdown list trees
---
{assets => data/assets}/stock/0_0.png | Bin
{assets => data/assets}/stock/10_0.png | Bin
{assets => data/assets}/stock/11_0.png | Bin
{assets => data/assets}/stock/12_0.png | Bin
{assets => data/assets}/stock/13_0.png | Bin
{assets => data/assets}/stock/14_0.png | Bin
{assets => data/assets}/stock/15_0.png | Bin
{assets => data/assets}/stock/16_0.png | Bin
{assets => data/assets}/stock/17_0.png | Bin
{assets => data/assets}/stock/18_0.png | Bin
{assets => data/assets}/stock/19_0.png | Bin
{assets => data/assets}/stock/1_0.png | Bin
{assets => data/assets}/stock/20_0.png | Bin
{assets => data/assets}/stock/21_0.png | Bin
{assets => data/assets}/stock/22_0.png | Bin
{assets => data/assets}/stock/23_0.png | Bin
{assets => data/assets}/stock/24_0.png | Bin
{assets => data/assets}/stock/25_0.png | Bin
{assets => data/assets}/stock/26_0.png | Bin
{assets => data/assets}/stock/27_0.png | Bin
{assets => data/assets}/stock/28_0.png | Bin
{assets => data/assets}/stock/29_0.png | Bin
{assets => data/assets}/stock/2_0.png | Bin
{assets => data/assets}/stock/30_0.png | Bin
{assets => data/assets}/stock/31_0.png | Bin
{assets => data/assets}/stock/32_0.png | Bin
{assets => data/assets}/stock/3_0.png | Bin
{assets => data/assets}/stock/4_0.png | Bin
{assets => data/assets}/stock/5_0.png | Bin
{assets => data/assets}/stock/6_0.png | Bin
{assets => data/assets}/stock/7_0.png | Bin
{assets => data/assets}/stock/8_0.png | Bin
{assets => data/assets}/stock/9_0.png | Bin
main.c | 3 +
replay.c | 129 +++++++++++++++++++++++++++++----
35 files changed, 119 insertions(+), 13 deletions(-)
diff --git a/assets/stock/0_0.png b/data/assets/stock/0_0.png
similarity index 100%
rename from assets/stock/0_0.png
rename to data/assets/stock/0_0.png
diff --git a/assets/stock/10_0.png b/data/assets/stock/10_0.png
similarity index 100%
rename from assets/stock/10_0.png
rename to data/assets/stock/10_0.png
diff --git a/assets/stock/11_0.png b/data/assets/stock/11_0.png
similarity index 100%
rename from assets/stock/11_0.png
rename to data/assets/stock/11_0.png
diff --git a/assets/stock/12_0.png b/data/assets/stock/12_0.png
similarity index 100%
rename from assets/stock/12_0.png
rename to data/assets/stock/12_0.png
diff --git a/assets/stock/13_0.png b/data/assets/stock/13_0.png
similarity index 100%
rename from assets/stock/13_0.png
rename to data/assets/stock/13_0.png
diff --git a/assets/stock/14_0.png b/data/assets/stock/14_0.png
similarity index 100%
rename from assets/stock/14_0.png
rename to data/assets/stock/14_0.png
diff --git a/assets/stock/15_0.png b/data/assets/stock/15_0.png
similarity index 100%
rename from assets/stock/15_0.png
rename to data/assets/stock/15_0.png
diff --git a/assets/stock/16_0.png b/data/assets/stock/16_0.png
similarity index 100%
rename from assets/stock/16_0.png
rename to data/assets/stock/16_0.png
diff --git a/assets/stock/17_0.png b/data/assets/stock/17_0.png
similarity index 100%
rename from assets/stock/17_0.png
rename to data/assets/stock/17_0.png
diff --git a/assets/stock/18_0.png b/data/assets/stock/18_0.png
similarity index 100%
rename from assets/stock/18_0.png
rename to data/assets/stock/18_0.png
diff --git a/assets/stock/19_0.png b/data/assets/stock/19_0.png
similarity index 100%
rename from assets/stock/19_0.png
rename to data/assets/stock/19_0.png
diff --git a/assets/stock/1_0.png b/data/assets/stock/1_0.png
similarity index 100%
rename from assets/stock/1_0.png
rename to data/assets/stock/1_0.png
diff --git a/assets/stock/20_0.png b/data/assets/stock/20_0.png
similarity index 100%
rename from assets/stock/20_0.png
rename to data/assets/stock/20_0.png
diff --git a/assets/stock/21_0.png b/data/assets/stock/21_0.png
similarity index 100%
rename from assets/stock/21_0.png
rename to data/assets/stock/21_0.png
diff --git a/assets/stock/22_0.png b/data/assets/stock/22_0.png
similarity index 100%
rename from assets/stock/22_0.png
rename to data/assets/stock/22_0.png
diff --git a/assets/stock/23_0.png b/data/assets/stock/23_0.png
similarity index 100%
rename from assets/stock/23_0.png
rename to data/assets/stock/23_0.png
diff --git a/assets/stock/24_0.png b/data/assets/stock/24_0.png
similarity index 100%
rename from assets/stock/24_0.png
rename to data/assets/stock/24_0.png
diff --git a/assets/stock/25_0.png b/data/assets/stock/25_0.png
similarity index 100%
rename from assets/stock/25_0.png
rename to data/assets/stock/25_0.png
diff --git a/assets/stock/26_0.png b/data/assets/stock/26_0.png
similarity index 100%
rename from assets/stock/26_0.png
rename to data/assets/stock/26_0.png
diff --git a/assets/stock/27_0.png b/data/assets/stock/27_0.png
similarity index 100%
rename from assets/stock/27_0.png
rename to data/assets/stock/27_0.png
diff --git a/assets/stock/28_0.png b/data/assets/stock/28_0.png
similarity index 100%
rename from assets/stock/28_0.png
rename to data/assets/stock/28_0.png
diff --git a/assets/stock/29_0.png b/data/assets/stock/29_0.png
similarity index 100%
rename from assets/stock/29_0.png
rename to data/assets/stock/29_0.png
diff --git a/assets/stock/2_0.png b/data/assets/stock/2_0.png
similarity index 100%
rename from assets/stock/2_0.png
rename to data/assets/stock/2_0.png
diff --git a/assets/stock/30_0.png b/data/assets/stock/30_0.png
similarity index 100%
rename from assets/stock/30_0.png
rename to data/assets/stock/30_0.png
diff --git a/assets/stock/31_0.png b/data/assets/stock/31_0.png
similarity index 100%
rename from assets/stock/31_0.png
rename to data/assets/stock/31_0.png
diff --git a/assets/stock/32_0.png b/data/assets/stock/32_0.png
similarity index 100%
rename from assets/stock/32_0.png
rename to data/assets/stock/32_0.png
diff --git a/assets/stock/3_0.png b/data/assets/stock/3_0.png
similarity index 100%
rename from assets/stock/3_0.png
rename to data/assets/stock/3_0.png
diff --git a/assets/stock/4_0.png b/data/assets/stock/4_0.png
similarity index 100%
rename from assets/stock/4_0.png
rename to data/assets/stock/4_0.png
diff --git a/assets/stock/5_0.png b/data/assets/stock/5_0.png
similarity index 100%
rename from assets/stock/5_0.png
rename to data/assets/stock/5_0.png
diff --git a/assets/stock/6_0.png b/data/assets/stock/6_0.png
similarity index 100%
rename from assets/stock/6_0.png
rename to data/assets/stock/6_0.png
diff --git a/assets/stock/7_0.png b/data/assets/stock/7_0.png
similarity index 100%
rename from assets/stock/7_0.png
rename to data/assets/stock/7_0.png
diff --git a/assets/stock/8_0.png b/data/assets/stock/8_0.png
similarity index 100%
rename from assets/stock/8_0.png
rename to data/assets/stock/8_0.png
diff --git a/assets/stock/9_0.png b/data/assets/stock/9_0.png
similarity index 100%
rename from assets/stock/9_0.png
rename to data/assets/stock/9_0.png
diff --git a/main.c b/main.c
index c45f3e2..b76d472 100644
--- a/main.c
+++ b/main.c
@@ -14,6 +14,9 @@ int opt_mallocd = -1;
char* game_path = "SSBM.iso";
char* dolphin_emu_file = "slippi-netplay-dolphin";
char* dolphin_replay_file = "slippi-playback-dolphin";
+#ifndef DATA_DIR
+#define DATA_DIR "data/"
+#endif
Ecore_Exe* dolphin_netplay_exe;
Evas_Object* mainer;
diff --git a/replay.c b/replay.c
index 1b2726e..3c8f2e8 100644
--- a/replay.c
+++ b/replay.c
@@ -10,6 +10,9 @@ Evas_Object* tab_replays = NULL;
char* replays_dir = "replays/";
Ecore_Exe* dolphin_replay_exe;
extern char* dolphin_replay_file, *game_path;
+#ifndef DATA_DIR
+#define DATA_DIR "data/"
+#endif
struct replay
{
@@ -190,24 +193,71 @@ gameend2str(int code)
}
}
+Evas_Object*
+replays_content(void* data, Evas_Object* obj, const char* part)
+{
+ char* c;
+ if (strcmp(part, "elm.swallow.icon"))
+ {
+ Evas_Object* box = elm_box_add(obj);
+ {
+ elm_box_horizontal_set(box, EINA_TRUE);
+ asprintf(&c, DATA_DIR "assets/stock/15_0.png");
+
+ Evas_Object* ic = elm_icon_add(box);
+ {
+ elm_image_file_set(ic, c, NULL);
+ elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
+ evas_object_show(ic);
+ elm_box_pack_end(box, ic);
+ }
+ Evas_Object* lbl = elm_label_add(box);
+ {
+ elm_object_text_set(lbl, " vs. ");
+ elm_object_scale_set(lbl, 1.2);
+ evas_object_show(lbl);
+ elm_box_pack_end(box, lbl);
+ }
+ ic = elm_icon_add(box);
+ {
+ elm_image_file_set(ic, c, NULL);
+ elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
+ evas_object_show(ic);
+ elm_box_pack_end(box, ic);
+ }
+ evas_object_show(box);
+ }
+ return box;
+ }
+ return NULL;
+}
+
static char*
replays_strings(void* data, Evas_Object* obj, const char* part)
{
long idx = data;
+ char* c;
// Check this is text for the part we're expecting
- if (strcmp(part, "elm.text") == 0 &&
+ if (strcmp(part, "elm.text") == 0)
/* DQ after join */
- (replays[idx].p1 != NULL && replays[idx].p2 != NULL))
+
+ {
+ if (replays[idx].p1 != NULL && replays[idx].p2 != NULL)
+ {
+ asprintf(&c, "%s (%s) Vs. %s (%s)",
+ replays[idx].p1, replays[idx].p1code,
+ replays[idx].p2, replays[idx].p2code);
+ return c;
+ }
+ else if (replays[idx].p1 == NULL || replays[idx].p2 == NULL)
+ printf("[Replay Warning] %s is a incomplete replay. Good idea to delete it.\n",
+ replays[idx].filename);
+ }
+ else if (strcmp(part, "elm.text.sub") == 0)
{
- char* c;
- asprintf(&c, "%s (%s) Vs. %s (%s)",
- replays[idx].p1, replays[idx].p1code,
- replays[idx].p2, replays[idx].p2code);
+ asprintf(&c, "%s * (3-0)", gameend2str(replays[idx].game_state));
return c;
}
- else if (replays[idx].p1 == NULL || replays[idx].p2 == NULL)
- printf("[Replay Warning] %s is a incomplete replay. Good idea to delete it.\n",
- replays[idx].filename);
else
return NULL;
}
@@ -243,16 +293,69 @@ _item_select_cb(void *data, Evas_Object *obj, void *event_info)
free(jason);
}
+static void
+_dd_exp(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ long idx = (long)data;
+ Elm_Object_Item *glit = event_info;
+ Evas_Object* gl = elm_object_item_widget_get(glit);
+
+ Elm_Genlist_Item_Class* _itc_sub = elm_genlist_item_class_new();
+ _itc_sub->item_style = "default";
+ _itc_sub->func.text_get = NULL;
+ _itc_sub->func.content_get = NULL;
+ _itc_sub->func.state_get = NULL;
+ _itc_sub->func.del = NULL;
+
+ for (int i = 0; i < 2; ++i)
+ {
+ elm_genlist_item_append(gl, _itc_sub,
+ (void *)(long) (idx)/* item data */,
+ glit/* parent */,
+ ELM_GENLIST_ITEM_NONE, NULL/* func */,
+ NULL/* func data */);
+ }
+}
+
+
+static void
+_dd_con(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ Elm_Object_Item *glit = event_info;
+ elm_genlist_item_subitems_clear(glit);
+}
+
+static void
+_dd_exp_req(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ Elm_Object_Item *glit = event_info;
+ elm_genlist_item_expanded_set(glit, EINA_TRUE);
+}
+
+static void
+_dd_con_req(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ Elm_Object_Item *glit = event_info;
+ elm_genlist_item_expanded_set(glit, EINA_FALSE);
+}
+
Evas_Object*
tab_replays_setup(Evas_Object* parent)
{
tab_replays = elm_genlist_add(parent);
+ evas_object_smart_callback_add(tab_replays, "expand,request", _dd_exp_req, tab_replays);
+ evas_object_smart_callback_add(tab_replays, "contract,request", _dd_con_req, tab_replays);
+ evas_object_smart_callback_add(tab_replays, "expanded", _dd_exp, tab_replays);
+ evas_object_smart_callback_add(tab_replays, "contracted", _dd_con, tab_replays);
+
+ elm_genlist_tree_effect_enabled_set(tab_replays, EINA_TRUE);
+
elm_genlist_homogeneous_set(tab_replays, EINA_TRUE);
evas_object_resize(tab_replays, 40, 40);
Elm_Genlist_Item_Class *_itc = elm_genlist_item_class_new();
_itc->item_style = "double_label";
_itc->func.text_get = replays_strings;
- _itc->func.content_get = NULL;
+ _itc->func.content_get = replays_content;
_itc->func.state_get = NULL;
_itc->func.del = NULL;
@@ -260,12 +363,12 @@ tab_replays_setup(Evas_Object* parent)
for (int i = 0; i < replays_len; ++i)
{
- elm_genlist_item_append(tab_replays,
+ Evas_Object* root = elm_genlist_item_append(tab_replays,
_itc,
i, // Item data
NULL, // Parent item for trees, NULL if none
- ELM_GENLIST_ITEM_NONE, // Item type; this is the common one
- _item_select_cb, // Callback on selection of the item
+ ELM_GENLIST_ITEM_TREE, // Item type; this is the common one
+ NULL, // Callback on selection of the item
(long)i // Data for that callback function
);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.