Update dependencies
This commit is contained in:
parent
828de30570
commit
4c6942552d
5 changed files with 32 additions and 15 deletions
2
external/rei-json
vendored
2
external/rei-json
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 90c2f0e783b4f5e4a346a6a94a1319a5b2b66d61
|
Subproject commit 2041a0aafe85085dcf35a37437db493898f1be3c
|
2
external/selenite
vendored
2
external/selenite
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 9cba85a21aa6c2eee6101dd38252249283816327
|
Subproject commit 3fb5f620fdc3e422d468642263858ffce72cdbb9
|
|
@ -31,7 +31,7 @@ public:
|
||||||
const std::string graphqlQuery = "query Query($userName: String $type: MediaType) {\\n MediaListCollection(userName: $userName, type: $type) {\\n lists {\\n name\\n entries {\\n media {\\n id\\n title {\\n romaji\\n }\\n description\\n episodes\\n genres\\n status\\n startDate {\\n year\\n month\\n day\\n }\\n endDate {\\n year\\n month\\n day\\n }\\n coverImage {\\n extraLarge\\n }\\n idMal\\n isAdult\\n siteUrl\\n bannerImage\\n }\\n }\\n }\\n }\\n}";
|
const std::string graphqlQuery = "query Query($userName: String $type: MediaType) {\\n MediaListCollection(userName: $userName, type: $type) {\\n lists {\\n name\\n entries {\\n media {\\n id\\n title {\\n romaji\\n }\\n description\\n episodes\\n genres\\n status\\n startDate {\\n year\\n month\\n day\\n }\\n endDate {\\n year\\n month\\n day\\n }\\n coverImage {\\n extraLarge\\n }\\n idMal\\n isAdult\\n siteUrl\\n bannerImage\\n }\\n }\\n }\\n }\\n}";
|
||||||
|
|
||||||
variables.set("type", "ANIME").set("userName", userName);
|
variables.set("type", "ANIME").set("userName", userName);
|
||||||
body.set("query", graphqlQuery).addObject("variables", variables);
|
body.set("query", graphqlQuery).set("variables", variables);
|
||||||
auto res = cli.Post("/", rei::json::toString(body), "application/json");
|
auto res = cli.Post("/", rei::json::toString(body), "application/json");
|
||||||
|
|
||||||
if (res.error() != httplib::Error::Success) {
|
if (res.error() != httplib::Error::Success) {
|
||||||
|
@ -71,7 +71,7 @@ public:
|
||||||
const std::string graphqlQuery = "query Query($mediaId: Int) {\\n Media(id: $mediaId) {\\n id\\n title {\\n romaji\\n }\\n description\\n episodes\\n genres\\n status\\n startDate {\\n year\\n month\\n day\\n }\\n endDate {\\n year\\n month\\n day\\n }\\n coverImage {\\n extraLarge\\n }\\n idMal\\n isAdult\\n siteUrl\\n bannerImage\\n }\\n}";
|
const std::string graphqlQuery = "query Query($mediaId: Int) {\\n Media(id: $mediaId) {\\n id\\n title {\\n romaji\\n }\\n description\\n episodes\\n genres\\n status\\n startDate {\\n year\\n month\\n day\\n }\\n endDate {\\n year\\n month\\n day\\n }\\n coverImage {\\n extraLarge\\n }\\n idMal\\n isAdult\\n siteUrl\\n bannerImage\\n }\\n}";
|
||||||
|
|
||||||
variables.set("mediaId", id);
|
variables.set("mediaId", id);
|
||||||
body.set("query", graphqlQuery).addObject("variables", variables);
|
body.set("query", graphqlQuery).set("variables", variables);
|
||||||
auto res = cli.Post("/", rei::json::toString(body), "application/json");
|
auto res = cli.Post("/", rei::json::toString(body), "application/json");
|
||||||
|
|
||||||
if (res.error() != httplib::Error::Success) {
|
if (res.error() != httplib::Error::Success) {
|
||||||
|
|
|
@ -94,7 +94,7 @@ public:
|
||||||
std::println(std::cerr, "can't open file {}", saveFilePath);
|
std::println(std::cerr, "can't open file {}", saveFilePath);
|
||||||
json = rei::json::JsonObject{};
|
json = rei::json::JsonObject{};
|
||||||
json.set("version", 1);
|
json.set("version", 1);
|
||||||
json.addArray("lists", rei::json::JsonArray{});
|
json.set("lists", rei::json::JsonArray{});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::stringstream buffer;
|
std::stringstream buffer;
|
||||||
|
@ -226,10 +226,10 @@ public:
|
||||||
rei::json::JsonArray animesJson{};
|
rei::json::JsonArray animesJson{};
|
||||||
field.asObject().getArray("entries").forEach([&](rei::json::FieldValue& value, int index) {
|
field.asObject().getArray("entries").forEach([&](rei::json::FieldValue& value, int index) {
|
||||||
auto animeJson = value.asObject().getObject("media");
|
auto animeJson = value.asObject().getObject("media");
|
||||||
animesJson.pushObject(animeJson);
|
animesJson.push(animeJson);
|
||||||
});
|
});
|
||||||
|
|
||||||
listJson.addArray("animes", animesJson);
|
listJson.set("animes", animesJson);
|
||||||
});
|
});
|
||||||
std::optional<int> existingListIndex;
|
std::optional<int> existingListIndex;
|
||||||
json.getArray("lists").forEach([&](rei::json::FieldValue& value, int index) {
|
json.getArray("lists").forEach([&](rei::json::FieldValue& value, int index) {
|
||||||
|
@ -241,7 +241,7 @@ public:
|
||||||
json.getArray("lists").getObject(existingListIndex.value()) = listJson;
|
json.getArray("lists").getObject(existingListIndex.value()) = listJson;
|
||||||
selectList(existingListIndex.value());
|
selectList(existingListIndex.value());
|
||||||
} else {
|
} else {
|
||||||
json.getArray("lists").pushObject(listJson);
|
json.getArray("lists").push(listJson);
|
||||||
listsSlint->push_back(ui::List{
|
listsSlint->push_back(ui::List{
|
||||||
.name = slint::SharedString(listName),
|
.name = slint::SharedString(listName),
|
||||||
.selected = false
|
.selected = false
|
||||||
|
@ -256,9 +256,9 @@ public:
|
||||||
listJson.set("name", listName);
|
listJson.set("name", listName);
|
||||||
listJson.set("source", "local");
|
listJson.set("source", "local");
|
||||||
listJson.set("type", "animes");
|
listJson.set("type", "animes");
|
||||||
listJson.addArray("animes", rei::json::JsonArray{});
|
listJson.set("animes", rei::json::JsonArray{});
|
||||||
|
|
||||||
json.getArray("lists").pushObject(listJson);
|
json.getArray("lists").push(listJson);
|
||||||
listsSlint->push_back(ui::List{
|
listsSlint->push_back(ui::List{
|
||||||
.name = slint::SharedString(listName),
|
.name = slint::SharedString(listName),
|
||||||
.selected = false
|
.selected = false
|
||||||
|
@ -275,7 +275,7 @@ public:
|
||||||
std::println("{}", rei::json::toString(res.value()));
|
std::println("{}", rei::json::toString(res.value()));
|
||||||
|
|
||||||
rei::json::JsonArray& listJson = json.getArray("lists").getObject(currentListIndex).getArray("animes");
|
rei::json::JsonArray& listJson = json.getArray("lists").getObject(currentListIndex).getArray("animes");
|
||||||
listJson.pushObject(res.value().getObject("data").getObject("Media"));
|
listJson.push(res.value().getObject("data").getObject("Media"));
|
||||||
selectList(currentListIndex);
|
selectList(currentListIndex);
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { State, ListSource } from "./state.slint";
|
import { State, ListSource } from "./state.slint";
|
||||||
import { VText, VTextInput , VButton, ToggleButton, VActionButton, Svg, Palette } from "@selenite";
|
import { VText, VTextInput , VButton, ToggleButton, VActionButton, VPopupIconMenu, Svg, Palette } from "@selenite";
|
||||||
import { ComboBox } from "std-widgets.slint";
|
import { ComboBox } from "std-widgets.slint";
|
||||||
|
|
||||||
export component AppWindow inherits Window {
|
export component AppWindow inherits Window {
|
||||||
|
@ -139,7 +139,7 @@ export component AppWindow inherits Window {
|
||||||
private property <int> number-of-items: State.current-list.animes.length;
|
private property <int> number-of-items: State.current-list.animes.length;
|
||||||
private property <length> grid-spacing: 16px;
|
private property <length> grid-spacing: 16px;
|
||||||
|
|
||||||
private property <length> item-min-width: 300px;
|
private property <length> item-min-width: 256px;
|
||||||
private property <int> item-per-row: floor(self.viewport-width / (item-min-width + grid-spacing));
|
private property <int> item-per-row: floor(self.viewport-width / (item-min-width + grid-spacing));
|
||||||
|
|
||||||
private property <length> item-width: (parent.width - ((item-per-row - 1) * grid-spacing)) / item-per-row;
|
private property <length> item-width: (parent.width - ((item-per-row - 1) * grid-spacing)) / item-per-row;
|
||||||
|
@ -155,8 +155,6 @@ export component AppWindow inherits Window {
|
||||||
height: item-height;
|
height: item-height;
|
||||||
//background: #444444;
|
//background: #444444;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
height: parent.height;
|
height: parent.height;
|
||||||
width: parent.width;
|
width: parent.width;
|
||||||
|
@ -171,6 +169,25 @@ export component AppWindow inherits Window {
|
||||||
source: anime.image;
|
source: anime.image;
|
||||||
image-fit: ImageFit.cover;
|
image-fit: ImageFit.cover;
|
||||||
}
|
}
|
||||||
|
popup := VPopupIconMenu {
|
||||||
|
VActionButton {
|
||||||
|
icon-svg: Svg.trash;
|
||||||
|
icon-colorize: Colors.red;
|
||||||
|
icon-size: 1.5rem;
|
||||||
|
border-radius: 0;
|
||||||
|
clicked => {
|
||||||
|
// TODO : Missing feature to delete json value in rei-json
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TouchArea {
|
||||||
|
pointer-event(e) => {
|
||||||
|
if (e.button == PointerEventButton.right && e.kind == PointerEventKind.up) {
|
||||||
|
popup.show(self.mouse-x, self.mouse-y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
animeTitle := VText {
|
animeTitle := VText {
|
||||||
text: anime.title;
|
text: anime.title;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue