mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-01 17:03:19 +00:00
Compare commits
3 commits
2e1e5db5ea
...
ef56efd314
Author | SHA1 | Date | |
---|---|---|---|
ef56efd314 | |||
72b004b7b0 | |||
f2f472a595 |
26 changed files with 112 additions and 25034 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -13,3 +13,6 @@
|
||||||
[submodule "external/rei-json"]
|
[submodule "external/rei-json"]
|
||||||
path = external/rei-json
|
path = external/rei-json
|
||||||
url = https://codeberg.org/vyn/rei-json.git
|
url = https://codeberg.org/vyn/rei-json.git
|
||||||
|
[submodule "external/mirai-core/external/rei-json"]
|
||||||
|
path = external/mirai-core/external/rei-json
|
||||||
|
url = https://codeberg.org/vyn/rei-json.git
|
||||||
|
|
|
@ -31,7 +31,6 @@ add_subdirectory(external/evalyte-cpp-common)
|
||||||
add_executable(mirai
|
add_executable(mirai
|
||||||
src/main.cpp
|
src/main.cpp
|
||||||
src/windows/AppWindow/AppWindow.cpp
|
src/windows/AppWindow/AppWindow.cpp
|
||||||
src/windows/SettingsWindow/SettingsWindow.cpp
|
|
||||||
src/SeleniteSetup.cpp
|
src/SeleniteSetup.cpp
|
||||||
src/shared/Utils.cpp
|
src/shared/Utils.cpp
|
||||||
)
|
)
|
||||||
|
@ -49,6 +48,10 @@ target_link_libraries(mirai PRIVATE evalyte-cpp-common)
|
||||||
target_include_directories(mirai PRIVATE "external")
|
target_include_directories(mirai PRIVATE "external")
|
||||||
target_link_libraries(mirai PRIVATE mirai-core)
|
target_link_libraries(mirai PRIVATE mirai-core)
|
||||||
|
|
||||||
|
add_subdirectory(external/rei-json)
|
||||||
|
target_include_directories(mirai PRIVATE "external/rei-json/include")
|
||||||
|
target_link_libraries(mirai PRIVATE rei-json)
|
||||||
|
|
||||||
slint_target_sources(
|
slint_target_sources(
|
||||||
mirai src/ui.slint
|
mirai src/ui.slint
|
||||||
NAMESPACE ui
|
NAMESPACE ui
|
||||||
|
|
4
external/mirai-core/CMakeLists.txt
vendored
4
external/mirai-core/CMakeLists.txt
vendored
|
@ -21,3 +21,7 @@ add_library(mirai-core
|
||||||
|
|
||||||
target_include_directories(mirai-core PRIVATE "external")
|
target_include_directories(mirai-core PRIVATE "external")
|
||||||
target_include_directories(mirai-core PRIVATE "include/mirai-core")
|
target_include_directories(mirai-core PRIVATE "include/mirai-core")
|
||||||
|
|
||||||
|
add_subdirectory(external/rei-json)
|
||||||
|
target_include_directories(mirai-core PRIVATE "external/rei-json/include")
|
||||||
|
target_link_libraries(mirai-core PRIVATE rei-json)
|
||||||
|
|
24767
external/mirai-core/external/nlohmann/json.hpp
vendored
24767
external/mirai-core/external/nlohmann/json.hpp
vendored
File diff suppressed because it is too large
Load diff
1
external/mirai-core/external/rei-json
vendored
Submodule
1
external/mirai-core/external/rei-json
vendored
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 63e7986b0901449657c3874ed7b19618315e9f01
|
69
external/mirai-core/src/Mirai.cpp
vendored
69
external/mirai-core/src/Mirai.cpp
vendored
|
@ -8,8 +8,11 @@
|
||||||
#include "DataProvider.h"
|
#include "DataProvider.h"
|
||||||
#include "MarkdownDataProvider.h"
|
#include "MarkdownDataProvider.h"
|
||||||
#include "Source.h"
|
#include "Source.h"
|
||||||
#include "nlohmann/json.hpp"
|
#include "rei-json/Array.h"
|
||||||
|
#include "rei-json/Object.h"
|
||||||
|
#include "rei-json/json.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cassert>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <print>
|
#include <print>
|
||||||
|
@ -21,31 +24,32 @@ namespace mirai
|
||||||
|
|
||||||
void Mirai::loadConfig(const std::string &path)
|
void Mirai::loadConfig(const std::string &path)
|
||||||
{
|
{
|
||||||
auto configJson = nlohmann::json::parse(R"(
|
|
||||||
{
|
|
||||||
"files": []
|
|
||||||
}
|
|
||||||
)");
|
|
||||||
std::ifstream file(path);
|
std::ifstream file(path);
|
||||||
if (!file) {
|
if (!file) {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
configJson = nlohmann::json::parse(file);
|
std::stringstream buffer;
|
||||||
|
buffer << file.rdbuf();
|
||||||
|
auto jsonStr = buffer.str();
|
||||||
|
|
||||||
assert(configJson.is_object());
|
auto configJson = rei::json::parse(jsonStr);
|
||||||
assert(configJson["files"].is_array());
|
|
||||||
auto jsonSources = configJson["files"];
|
assert(configJson.isObject());
|
||||||
for (const auto &filePath : jsonSources) {
|
assert(configJson.asObject()["files"].isArray());
|
||||||
assert(filePath.is_object());
|
auto jsonSources = configJson.asObject()["files"].asArray();
|
||||||
const auto name = filePath["name"].get<std::string>();
|
for (int i = 0; i < jsonSources.count(); ++i) {
|
||||||
const auto path = filePath["path"].get<std::string>();
|
auto &filePath = jsonSources[i];
|
||||||
|
assert(filePath.isObject());
|
||||||
|
const auto name = filePath.asObject().getString("name");
|
||||||
|
const auto path = filePath.asObject().getString("path");
|
||||||
std::unique_ptr<DataProvider> file = std::make_unique<MarkdownDataProvider>(path);
|
std::unique_ptr<DataProvider> file = std::make_unique<MarkdownDataProvider>(path);
|
||||||
DataProvider *sourceDataProvider = file.release();
|
DataProvider *sourceDataProvider = file.release();
|
||||||
sourceDataProvider->load();
|
sourceDataProvider->load();
|
||||||
sources_.push_back(std::make_unique<Source>(
|
sources_.push_back(
|
||||||
SourceConstructor{.name = name, .sourceDataProvider = sourceDataProvider}
|
std::make_unique<Source>(
|
||||||
));
|
SourceConstructor{.name = name, .sourceDataProvider = sourceDataProvider}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,20 +60,19 @@ void Mirai::saveConfig()
|
||||||
std::print(std::cerr, "Can't save config to {}", configPath_);
|
std::print(std::cerr, "Can't save config to {}", configPath_);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto configJson = nlohmann::json::parse(R"(
|
auto files = rei::json::JsonArray{};
|
||||||
{
|
auto configJson = rei::json::JsonObject{};
|
||||||
"files": []
|
configJson.set("files", files);
|
||||||
}
|
|
||||||
)");
|
|
||||||
for (auto &source : sources_) {
|
for (auto &source : sources_) {
|
||||||
nlohmann::json jsonSource;
|
|
||||||
jsonSource["name"] = source->name();
|
rei::json::JsonObject jsonSource;
|
||||||
|
jsonSource.set("name", source->name());
|
||||||
auto dataProvider = dynamic_cast<MarkdownDataProvider *>(source->dataProvider());
|
auto dataProvider = dynamic_cast<MarkdownDataProvider *>(source->dataProvider());
|
||||||
jsonSource["path"] = dataProvider->path();
|
jsonSource.set("path", dataProvider->path());
|
||||||
jsonSource["type"] = "FileSystemMarkdown";
|
jsonSource.set("type", "FileSystemMarkdown");
|
||||||
configJson["files"].push_back(jsonSource);
|
configJson.getArray("files").push(jsonSource);
|
||||||
}
|
}
|
||||||
file << configJson.dump(4);
|
file << rei::json::toString(configJson);
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,9 +87,11 @@ void Mirai::addSource(
|
||||||
{
|
{
|
||||||
DataProvider *sourceDataProvider = source.release();
|
DataProvider *sourceDataProvider = source.release();
|
||||||
sourceDataProvider->load();
|
sourceDataProvider->load();
|
||||||
sources_.push_back(std::make_unique<Source>(
|
sources_.push_back(
|
||||||
SourceConstructor{.name = name, .sourceDataProvider = sourceDataProvider}
|
std::make_unique<Source>(
|
||||||
));
|
SourceConstructor{.name = name, .sourceDataProvider = sourceDataProvider}
|
||||||
|
)
|
||||||
|
);
|
||||||
saveConfig();
|
saveConfig();
|
||||||
sourceAdded.emit(nullptr);
|
sourceAdded.emit(nullptr);
|
||||||
};
|
};
|
||||||
|
|
2
external/rei-json
vendored
2
external/rei-json
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 2639dba60a990f9dbc79b5204a925a101ecf24ba
|
Subproject commit 63e7986b0901449657c3874ed7b19618315e9f01
|
2
external/selenite
vendored
2
external/selenite
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 810607c01fa659f31bd11bd41a9ee5611e5db8ea
|
Subproject commit 6ff7dd8ea890bec8f4f61304e64bbfeabd61e7a8
|
|
@ -150,7 +150,6 @@ export component Calendar inherits Rectangle {
|
||||||
ta := TouchArea {
|
ta := TouchArea {
|
||||||
pointer-event(e) => {
|
pointer-event(e) => {
|
||||||
if (e.button == PointerEventButton.right && e.kind == PointerEventKind.up) {
|
if (e.button == PointerEventButton.right && e.kind == PointerEventKind.up) {
|
||||||
debug(ta.mouse-x, " ", ta.mouse-y);
|
|
||||||
eventActionsPopup.show(ta.mouse-x, ta.mouse-y);
|
eventActionsPopup.show(ta.mouse-x, ta.mouse-y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { AppWindowModels } from "../windows/AppWindow/Models.slint";
|
import { AppModels } from "../shared/Models.slint";
|
||||||
import { Date, Time, Button, VerticalBox, CheckBox, ScrollView, ComboBox } from "std-widgets.slint";
|
import { Date, Time, Button, VerticalBox, CheckBox, ScrollView, ComboBox } from "std-widgets.slint";
|
||||||
import { VPopupIconMenu, VDatePicker, VTimePicker, VCheckBox, VButton, VActionButton, VTag, VText, Svg, VTextInput, Palette } from "@selenite";
|
import { VPopupIconMenu, VDatePicker, VTimePicker, VCheckBox, VButton, VActionButton, VTag, VText, Svg, VTextInput, Palette } from "@selenite";
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ export component CreateTaskOrEvent inherits Rectangle {
|
||||||
|
|
||||||
function accepted() {
|
function accepted() {
|
||||||
root.create-task({
|
root.create-task({
|
||||||
sourceId: AppWindowModels.get-source-id-from-name(sourceInput.current-value),
|
sourceId: AppModels.get-source-id-from-name(sourceInput.current-value),
|
||||||
title: newTaskTitleInput.text,
|
title: newTaskTitleInput.text,
|
||||||
date: taskDateInput.date
|
date: taskDateInput.date
|
||||||
});
|
});
|
||||||
|
@ -39,7 +39,7 @@ export component CreateTaskOrEvent inherits Rectangle {
|
||||||
newTaskTitleInput := VTextInput {
|
newTaskTitleInput := VTextInput {
|
||||||
placeholder: "Enter new task";
|
placeholder: "Enter new task";
|
||||||
started-writting() => {
|
started-writting() => {
|
||||||
sourceInput.current-index = AppWindowModels.default-source-index;
|
sourceInput.current-index = AppModels.default-source-index;
|
||||||
}
|
}
|
||||||
accepted => { accepted() }
|
accepted => { accepted() }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Event } from "../windows/AppWindow/Models.slint";
|
import { Event } from "../shared/Models.slint";
|
||||||
import { ScrollView } from "std-widgets.slint";
|
import { ScrollView } from "std-widgets.slint";
|
||||||
import { VCheckBox, VTextInput, VButton, VActionButton, Svg, VTag, VPopupIconMenu, VText, Palette } from "@selenite";
|
import { VCheckBox, VTextInput, VButton, VActionButton, Svg, VTag, VPopupIconMenu, VText, Palette } from "@selenite";
|
||||||
import { TaskLine } from "./TaskLine.slint";
|
import { TaskLine } from "./TaskLine.slint";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Palette } from "@selenite";
|
import { Palette } from "@selenite";
|
||||||
import { VTextInput } from "../../external/selenite/components/TextInput.slint";
|
import { VTextInput } from "../../external/selenite/components/TextInput.slint";
|
||||||
import { VButton, VText, VDatePicker } from "../../external/selenite/components/index.slint";
|
import { VButton, VText, VDatePicker } from "../../external/selenite/components/index.slint";
|
||||||
import { AppWindowActions } from "../windows/AppWindow/Actions.slint";
|
import { AppActions } from "../shared/Actions.slint";
|
||||||
import { Modal } from "../../external/selenite/components/Modal.slint";
|
import { Modal } from "../../external/selenite/components/Modal.slint";
|
||||||
import { VTimePicker } from "../../external/selenite/components/TimePicker.slint";
|
import { VTimePicker } from "../../external/selenite/components/TimePicker.slint";
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ export component AddEventModal inherits Modal {
|
||||||
VButton {
|
VButton {
|
||||||
text: "Create";
|
text: "Create";
|
||||||
clicked => {
|
clicked => {
|
||||||
AppWindowActions.create-event({
|
AppActions.create-event({
|
||||||
title: titleInput.text,
|
title: titleInput.text,
|
||||||
date: dateInput.date,
|
date: dateInput.date,
|
||||||
startsAt: startTimeInput.time,
|
startsAt: startTimeInput.time,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Palette } from "@selenite";
|
import { Palette } from "@selenite";
|
||||||
import { VTextInput } from "../../external/selenite/components/TextInput.slint";
|
import { VTextInput } from "../../external/selenite/components/TextInput.slint";
|
||||||
import { VButton } from "../../external/selenite/components/index.slint";
|
import { VButton } from "../../external/selenite/components/index.slint";
|
||||||
import { AppWindowModels } from "../windows/AppWindow/Models.slint";
|
import { AppModels } from "../shared/Models.slint";
|
||||||
import { AppWindowActions } from "../windows/AppWindow/Actions.slint";
|
import { AppActions } from "../shared/Actions.slint";
|
||||||
import { Modal } from "../../external/selenite/components/Modal.slint";
|
import { Modal } from "../../external/selenite/components/Modal.slint";
|
||||||
|
|
||||||
export component AddSourceModal inherits Modal {
|
export component AddSourceModal inherits Modal {
|
||||||
|
@ -28,7 +28,7 @@ export component AddSourceModal inherits Modal {
|
||||||
VButton {
|
VButton {
|
||||||
text: "Add";
|
text: "Add";
|
||||||
clicked => {
|
clicked => {
|
||||||
AppWindowActions.add-source(name, path);
|
AppActions.add-source(name, path);
|
||||||
root.close();
|
root.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Palette } from "@selenite";
|
import { Palette } from "@selenite";
|
||||||
import { VTextInput } from "../../external/selenite/components/TextInput.slint";
|
import { VTextInput } from "../../external/selenite/components/TextInput.slint";
|
||||||
import { VButton } from "../../external/selenite/components/index.slint";
|
import { VButton } from "../../external/selenite/components/index.slint";
|
||||||
import { AppWindowModels } from "../windows/AppWindow/Models.slint";
|
import { AppModels } from "../shared/Models.slint";
|
||||||
import { AppWindowActions } from "../windows/AppWindow/Actions.slint";
|
import { AppActions } from "../shared/Actions.slint";
|
||||||
import { Modal } from "../../external/selenite/components/Modal.slint";
|
import { Modal } from "../../external/selenite/components/Modal.slint";
|
||||||
|
|
||||||
export component EditSourceModal inherits Modal {
|
export component EditSourceModal inherits Modal {
|
||||||
|
@ -12,8 +12,8 @@ export component EditSourceModal inherits Modal {
|
||||||
|
|
||||||
public function edit(source-id: int) {
|
public function edit(source-id: int) {
|
||||||
source-id-to-edit = source-id;
|
source-id-to-edit = source-id;
|
||||||
root.name = AppWindowModels.get-source-name-from-id(source-id);
|
root.name = AppModels.get-source-name-from-id(source-id);
|
||||||
root.path = AppWindowModels.get-source-path-from-id(source-id);
|
root.path = AppModels.get-source-path-from-id(source-id);
|
||||||
root.show();
|
root.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ export component EditSourceModal inherits Modal {
|
||||||
VButton {
|
VButton {
|
||||||
text: "Save";
|
text: "Save";
|
||||||
clicked => {
|
clicked => {
|
||||||
AppWindowActions.edit-source(source-id-to-edit, name, path);
|
AppActions.edit-source(source-id-to-edit, name, path);
|
||||||
root.close();
|
root.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Date, Time } from "std-widgets.slint";
|
import { Date, Time } from "std-widgets.slint";
|
||||||
import { CalendarDay } from "../../components/Calendar.slint";
|
import { CalendarDay } from "../components/Calendar.slint";
|
||||||
|
|
||||||
export struct NewTaskData {
|
export struct NewTaskData {
|
||||||
sourceId: int,
|
sourceId: int,
|
||||||
|
@ -17,22 +17,6 @@ export struct SaveTaskData {
|
||||||
date: Date,
|
date: Date,
|
||||||
}
|
}
|
||||||
|
|
||||||
export struct NewEventParams {
|
|
||||||
title: string,
|
|
||||||
date: Date,
|
|
||||||
startsAt: Time,
|
|
||||||
endsAt: Time
|
|
||||||
}
|
|
||||||
|
|
||||||
export struct SaveEventParams {
|
|
||||||
sourceId: int,
|
|
||||||
id: int,
|
|
||||||
title: string,
|
|
||||||
date: Date,
|
|
||||||
startsAt: Time,
|
|
||||||
endsAt: Time
|
|
||||||
}
|
|
||||||
|
|
||||||
struct OpenNewTaskFormParams {
|
struct OpenNewTaskFormParams {
|
||||||
eventSourceId: int,
|
eventSourceId: int,
|
||||||
eventId: int,
|
eventId: int,
|
||||||
|
@ -45,23 +29,15 @@ export struct CreateEventParams {
|
||||||
endsAt: Time
|
endsAt: Time
|
||||||
}
|
}
|
||||||
|
|
||||||
export global AppWindowActions {
|
export global AppActions {
|
||||||
callback task-clicked(int, int);
|
callback task-clicked(int, int);
|
||||||
callback source-clicked(int);
|
callback source-clicked(int);
|
||||||
callback open-settings-window();
|
|
||||||
callback open-add-source-window();
|
|
||||||
callback add-source(name: string, path: string);
|
callback add-source(name: string, path: string);
|
||||||
callback edit-source(sourceId: int, name: string, path: string);
|
callback edit-source(sourceId: int, name: string, path: string);
|
||||||
|
|
||||||
callback open-new-task-form(OpenNewTaskFormParams);
|
|
||||||
callback open-edit-task-form(int, int);
|
|
||||||
callback open-new-event-form();
|
|
||||||
callback open-edit-event-form(int, int);
|
|
||||||
callback toggle-show-completed-tasks();
|
callback toggle-show-completed-tasks();
|
||||||
callback delete-task-clicked(int, int);
|
callback delete-task-clicked(int, int);
|
||||||
|
|
||||||
callback open-add-event-window();
|
|
||||||
|
|
||||||
callback create-task(NewTaskData);
|
callback create-task(NewTaskData);
|
||||||
callback save-task(SaveTaskData);
|
callback save-task(SaveTaskData);
|
||||||
callback create-event(CreateEventParams);
|
callback create-event(CreateEventParams);
|
|
@ -1,5 +1,5 @@
|
||||||
import { Date, Time } from "std-widgets.slint";
|
import { Date, Time } from "std-widgets.slint";
|
||||||
import { CalendarDay } from "../../components/Calendar.slint";
|
import { CalendarDay } from "../components/Calendar.slint";
|
||||||
|
|
||||||
export struct Source {
|
export struct Source {
|
||||||
id: int,
|
id: int,
|
||||||
|
@ -37,7 +37,7 @@ export struct Day {
|
||||||
relativeDaysDiff: int
|
relativeDaysDiff: int
|
||||||
}
|
}
|
||||||
|
|
||||||
export global AppWindowModels {
|
export global AppModels {
|
||||||
in-out property<[Source]> sources-selected;
|
in-out property<[Source]> sources-selected;
|
||||||
in-out property<int> default-source-index;
|
in-out property<int> default-source-index;
|
||||||
in-out property<[string]> sources;
|
in-out property<[string]> sources;
|
|
@ -1,8 +1,7 @@
|
||||||
import { AppWindowModels } from "windows/AppWindow/Models.slint";
|
import { AppModels } from "shared/Models.slint";
|
||||||
import { AppWindowActions } from "windows/AppWindow/Actions.slint";
|
import { AppActions } from "shared/Actions.slint";
|
||||||
import { AppWindow } from "windows/AppWindow/AppWindow.slint";
|
import { AppWindow } from "windows/AppWindow/AppWindow.slint";
|
||||||
import { SettingsWindow } from "windows/SettingsWindow/SettingsWindow.slint";
|
|
||||||
import { Utils } from "shared/Utils.slint";
|
import { Utils } from "shared/Utils.slint";
|
||||||
import { Palette } from "@selenite";
|
import { Palette } from "@selenite";
|
||||||
|
|
||||||
export { Utils, Palette, AppWindow, AppWindowModels, AppWindowActions, SettingsWindow }
|
export { Utils, Palette, AppWindow, AppModels, AppActions }
|
||||||
|
|
|
@ -12,28 +12,22 @@
|
||||||
#include "mirai-core/MarkdownDataProvider.h"
|
#include "mirai-core/MarkdownDataProvider.h"
|
||||||
#include "mirai-core/Mirai.h"
|
#include "mirai-core/Mirai.h"
|
||||||
#include "selenite/palette.h"
|
#include "selenite/palette.h"
|
||||||
#include "slint.h"
|
|
||||||
#include "slint_string.h"
|
#include "slint_string.h"
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#include <bits/chrono.h>
|
#include <bits/chrono.h>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <charconv>
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cstdio>
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <ctime>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <ostream>
|
|
||||||
#include <print>
|
#include <print>
|
||||||
#include <ranges>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
AppWindow::AppWindow(mirai::Mirai *miraiInstance)
|
AppWindow::AppWindow(mirai::Mirai *miraiInstance)
|
||||||
: miraiInstance_(miraiInstance), settingsWindow_(miraiInstance), view_(miraiInstance)
|
: miraiInstance_(miraiInstance), view_(miraiInstance)
|
||||||
{
|
{
|
||||||
sources_ = std::make_shared<slint::VectorModel<ui::Source>>();
|
sources_ = std::make_shared<slint::VectorModel<ui::Source>>();
|
||||||
days_ = std::make_shared<slint::VectorModel<ui::Day>>();
|
days_ = std::make_shared<slint::VectorModel<ui::Day>>();
|
||||||
|
@ -120,20 +114,6 @@ void AppWindow::setupCallbacks()
|
||||||
miraiInstance_->onSourceDeleted([&](int id) {
|
miraiInstance_->onSourceDeleted([&](int id) {
|
||||||
refreshModels();
|
refreshModels();
|
||||||
});
|
});
|
||||||
actions().on_open_settings_window([&]() {
|
|
||||||
settingsWindow_.open();
|
|
||||||
});
|
|
||||||
actions().on_open_add_source_window([&]() {
|
|
||||||
// addSourceWindow_.open();
|
|
||||||
});
|
|
||||||
/*actions().on_open_edit_source_window([&](int sourceId) {*/
|
|
||||||
/*auto source = miraiInstance_->getSourceById(sourceId);*/
|
|
||||||
/*assert(source);*/
|
|
||||||
/*editSourceWindow_.open(source);*/
|
|
||||||
/*});*/
|
|
||||||
actions().on_open_add_event_window([&]() {
|
|
||||||
// editEventWindow_.open();
|
|
||||||
});
|
|
||||||
|
|
||||||
actions().on_task_clicked([&](int sourceId, int taskId) {
|
actions().on_task_clicked([&](int sourceId, int taskId) {
|
||||||
auto source = miraiInstance_->getSourceById(sourceId);
|
auto source = miraiInstance_->getSourceById(sourceId);
|
||||||
|
@ -248,7 +228,6 @@ void AppWindow::setupCallbacks()
|
||||||
});
|
});
|
||||||
|
|
||||||
actions().on_create_event([&](ui::CreateEventParams newEventParams) {
|
actions().on_create_event([&](ui::CreateEventParams newEventParams) {
|
||||||
std::println("okkk");
|
|
||||||
const ui::Date &date = newEventParams.date;
|
const ui::Date &date = newEventParams.date;
|
||||||
const std::string dateStr = SlintDateToStdString(date);
|
const std::string dateStr = SlintDateToStdString(date);
|
||||||
const auto sourceId = models().get_default_source_index();
|
const auto sourceId = models().get_default_source_index();
|
||||||
|
@ -264,24 +243,6 @@ void AppWindow::setupCallbacks()
|
||||||
view_.update();
|
view_.update();
|
||||||
reloadTasks();
|
reloadTasks();
|
||||||
});
|
});
|
||||||
|
|
||||||
/*actions().on_save_event([&](ui::SaveEventParams newEventParams) {*/
|
|
||||||
/*const ui::Date &date = newEventParams.date;*/
|
|
||||||
/*const std::string dateStr = SlintDateToStdString(date);*/
|
|
||||||
/*auto source = miraiInstance_->getSourceById(newEventParams.sourceId);*/
|
|
||||||
/*assert(source);*/
|
|
||||||
/*auto event = source->getEventById(newEventParams.id);*/
|
|
||||||
/*assert(event);*/
|
|
||||||
/*event->setTitle(std::string(newEventParams.title));*/
|
|
||||||
/*event->setStartTime(SlintTimeToMiraiTime(newEventParams.startsAt));*/
|
|
||||||
/*event->setEndTime(SlintTimeToMiraiTime(newEventParams.endsAt));*/
|
|
||||||
|
|
||||||
/*// TODO we can't change the date of the event for now.*/
|
|
||||||
|
|
||||||
/*miraiInstance_->save();*/
|
|
||||||
/*view_.update();*/
|
|
||||||
/*reloadTasks();*/
|
|
||||||
/*});*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<slint::VectorModel<slint::SharedString>>
|
std::shared_ptr<slint::VectorModel<slint::SharedString>>
|
||||||
|
@ -454,12 +415,12 @@ void AppWindow::run()
|
||||||
mainWindow_->run();
|
mainWindow_->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
const ui::AppWindowModels &AppWindow::models()
|
const ui::AppModels &AppWindow::models()
|
||||||
{
|
{
|
||||||
return mainWindow_->global<ui::AppWindowModels>();
|
return mainWindow_->global<ui::AppModels>();
|
||||||
}
|
}
|
||||||
|
|
||||||
const ui::AppWindowActions &AppWindow::actions()
|
const ui::AppActions &AppWindow::actions()
|
||||||
{
|
{
|
||||||
return mainWindow_->global<ui::AppWindowActions>();
|
return mainWindow_->global<ui::AppActions>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../SettingsWindow/SettingsWindow.h"
|
|
||||||
#include "mirai-core/Mirai.h"
|
#include "mirai-core/Mirai.h"
|
||||||
#include "mirai-core/View.h"
|
#include "mirai-core/View.h"
|
||||||
#include "slint.h"
|
#include "slint.h"
|
||||||
|
@ -26,8 +25,8 @@ class AppWindow
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupCallbacks();
|
void setupCallbacks();
|
||||||
const ui::AppWindowModels &models();
|
const ui::AppModels &models();
|
||||||
const ui::AppWindowActions &actions();
|
const ui::AppActions &actions();
|
||||||
|
|
||||||
std::shared_ptr<slint::VectorModel<ui::Source>> sources_;
|
std::shared_ptr<slint::VectorModel<ui::Source>> sources_;
|
||||||
std::shared_ptr<slint::VectorModel<ui::Day>> days_;
|
std::shared_ptr<slint::VectorModel<ui::Day>> days_;
|
||||||
|
@ -35,7 +34,6 @@ class AppWindow
|
||||||
std::shared_ptr<slint::VectorModel<ui::TaskData>> unscheduledTasks_;
|
std::shared_ptr<slint::VectorModel<ui::TaskData>> unscheduledTasks_;
|
||||||
|
|
||||||
slint::ComponentHandle<ui::AppWindow> mainWindow_ = ui::AppWindow::create();
|
slint::ComponentHandle<ui::AppWindow> mainWindow_ = ui::AppWindow::create();
|
||||||
SettingsWindow settingsWindow_;
|
|
||||||
|
|
||||||
mirai::Mirai *miraiInstance_;
|
mirai::Mirai *miraiInstance_;
|
||||||
mirai::View view_;
|
mirai::View view_;
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
import { AppWindowModels } from "Models.slint";
|
import { AppModels } from "../../shared/Models.slint";
|
||||||
import { Button, VerticalBox, CheckBox } from "std-widgets.slint";
|
import { Button, VerticalBox, CheckBox } from "std-widgets.slint";
|
||||||
import { MainView } from "views/TasksView.slint";
|
import { MainView } from "views/TasksView.slint";
|
||||||
import { SettingsWindow } from "../SettingsWindow/SettingsWindow.slint";
|
|
||||||
import { Palette } from "@selenite";
|
import { Palette } from "@selenite";
|
||||||
import { CalendarView } from "views/CalendarView.slint";
|
import { CalendarView } from "views/CalendarView.slint";
|
||||||
import { VButton } from "../../../external/selenite/components/Button.slint";
|
import { VButton } from "../../../external/selenite/components/Button.slint";
|
||||||
import { ToggleButton } from "../../../external/selenite/components/index.slint";
|
import { ToggleButton } from "../../../external/selenite/components/index.slint";
|
||||||
import { VTextInput } from "../../../external/selenite/components/TextInput.slint";
|
import { VTextInput } from "../../../external/selenite/components/TextInput.slint";
|
||||||
import { AppWindowActions } from "Actions.slint";
|
import { AppActions } from "../../shared/Actions.slint";
|
||||||
import { SideBar } from "views/SideBar.slint";
|
import { SideBar } from "views/SideBar.slint";
|
||||||
|
|
||||||
export component AppWindow inherits Window {
|
export component AppWindow inherits Window {
|
||||||
|
@ -70,4 +69,4 @@ export component AppWindow inherits Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { AppWindowModels, Palette, SettingsWindow } // Export to make it visible to the C++ backend
|
export { AppModels, Palette } // Export to make it visible to the C++ backend
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { AppWindowModels, TaskData } from "../Models.slint";
|
import { AppModels, TaskData } from "../../../shared/Models.slint";
|
||||||
import { AppWindowActions, NewTaskData, SaveTaskData } from "../Actions.slint";
|
import { AppActions, NewTaskData, SaveTaskData } from "../../../shared/Actions.slint";
|
||||||
import { Button, VerticalBox, CheckBox, ScrollView, ComboBox } from "std-widgets.slint";
|
import { Button, VerticalBox, CheckBox, ScrollView, ComboBox } from "std-widgets.slint";
|
||||||
import { TaskLine } from "../../../components/TaskLine.slint";
|
import { TaskLine } from "../../../components/TaskLine.slint";
|
||||||
import { EventGroup } from "../../../components/EventGroup.slint";
|
import { EventGroup } from "../../../components/EventGroup.slint";
|
||||||
|
@ -38,9 +38,10 @@ export component CalendarView inherits Rectangle {
|
||||||
height: 1px;
|
height: 1px;
|
||||||
}
|
}
|
||||||
Calendar {
|
Calendar {
|
||||||
delete-event-request(source-id, event-id) => { debug("DEELTE", source-id);AppWindowActions.delete-event(source-id, event-id) }
|
delete-event-request(source-id, event-id) => {
|
||||||
init => { debug("cal len", AppWindowModels.calendar.length) }
|
AppActions.delete-event(source-id, event-id)
|
||||||
days: AppWindowModels.calendar;
|
}
|
||||||
|
days: AppModels.calendar;
|
||||||
current-date: Utils.current-date;
|
current-date: Utils.current-date;
|
||||||
current-time: Utils.current-time;
|
current-time: Utils.current-time;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { AppWindowModels, TaskData } from "../Models.slint";
|
import { AppModels, TaskData } from "../../../shared/Models.slint";
|
||||||
import { AppWindowActions } from "../Actions.slint";
|
import { AppActions } from "../../../shared/Actions.slint";
|
||||||
import { VButton, ToggleButton, VActionButton, VText, Svg, Palette } from "@selenite";
|
import { VButton, ToggleButton, VActionButton, VText, Svg, Palette } from "@selenite";
|
||||||
import { EditSourceModal } from "../../../modals/EditSourceModal.slint";
|
import { EditSourceModal } from "../../../modals/EditSourceModal.slint";
|
||||||
import { AddSourceModal } from "../../../modals/AddSourceModal.slint";
|
import { AddSourceModal } from "../../../modals/AddSourceModal.slint";
|
||||||
|
@ -46,16 +46,16 @@ export component SideBar inherits Rectangle {
|
||||||
ToggleButton {
|
ToggleButton {
|
||||||
text: "All";
|
text: "All";
|
||||||
text-alignment: left;
|
text-alignment: left;
|
||||||
active: AppWindowModels.no-source-selected;
|
active: AppModels.no-source-selected;
|
||||||
clicked => { AppWindowActions.source-clicked(-1) }
|
clicked => { AppActions.source-clicked(-1) }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
for item[index] in AppWindowModels.sources-selected: ToggleButton {
|
for item[index] in AppModels.sources-selected: ToggleButton {
|
||||||
text: item.name;
|
text: item.name;
|
||||||
text-alignment: left;
|
text-alignment: left;
|
||||||
active: item.selected;
|
active: item.selected;
|
||||||
clicked => { AppWindowActions.source-clicked(item.id) }
|
clicked => { AppActions.source-clicked(item.id) }
|
||||||
VActionButton {
|
VActionButton {
|
||||||
visible: parent.active;
|
visible: parent.active;
|
||||||
icon-svg: Svg.cog;
|
icon-svg: Svg.cog;
|
||||||
|
@ -70,7 +70,7 @@ export component SideBar inherits Rectangle {
|
||||||
icon-svg: Svg.cog;
|
icon-svg: Svg.cog;
|
||||||
text: "Settings";
|
text: "Settings";
|
||||||
background: transparent;
|
background: transparent;
|
||||||
clicked => { AppWindowModels.open-settings-window() }
|
clicked => { AppModels.open-settings-window() }
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { AppWindowModels, TaskData } from "../Models.slint";
|
import { AppModels, TaskData } from "../../../shared/Models.slint";
|
||||||
import { AppWindowActions, NewTaskData, SaveTaskData } from "../Actions.slint";
|
import { AppActions, NewTaskData, SaveTaskData } from "../../../shared/Actions.slint";
|
||||||
import { Button, VerticalBox, CheckBox, ScrollView, ComboBox } from "std-widgets.slint";
|
import { Button, VerticalBox, CheckBox, ScrollView, ComboBox } from "std-widgets.slint";
|
||||||
import { TaskLine } from "../../../components/TaskLine.slint";
|
import { TaskLine } from "../../../components/TaskLine.slint";
|
||||||
import { EventGroup } from "../../../components/EventGroup.slint";
|
import { EventGroup } from "../../../components/EventGroup.slint";
|
||||||
|
@ -23,7 +23,7 @@ export component MainView inherits Rectangle {
|
||||||
VButton {
|
VButton {
|
||||||
text: "Show/Hide completed tasks";
|
text: "Show/Hide completed tasks";
|
||||||
clicked => {
|
clicked => {
|
||||||
AppWindowActions.toggle-show-completed-tasks();
|
AppActions.toggle-show-completed-tasks();
|
||||||
completed-tasks-visible = !completed-tasks-visible;
|
completed-tasks-visible = !completed-tasks-visible;
|
||||||
}
|
}
|
||||||
icon-svg: completed-tasks-visible ? icon-visible : icon-not-visible;
|
icon-svg: completed-tasks-visible ? icon-visible : icon-not-visible;
|
||||||
|
@ -37,9 +37,9 @@ export component MainView inherits Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateTaskOrEvent {
|
CreateTaskOrEvent {
|
||||||
sources: AppWindowModels.sources;
|
sources: AppModels.sources;
|
||||||
create-task(data) => {
|
create-task(data) => {
|
||||||
AppWindowActions.create-task({
|
AppActions.create-task({
|
||||||
sourceId: data.sourceId,
|
sourceId: data.sourceId,
|
||||||
eventId: -1,
|
eventId: -1,
|
||||||
title: data.title,
|
title: data.title,
|
||||||
|
@ -54,12 +54,12 @@ export component MainView inherits Rectangle {
|
||||||
horizontal-stretch: 1;
|
horizontal-stretch: 1;
|
||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
alignment: start;
|
alignment: start;
|
||||||
if AppWindowModels.days.length == 0 && AppWindowModels.unscheduled-tasks.length == 0 : VText {
|
if AppModels.days.length == 0 && AppModels.unscheduled-tasks.length == 0 : VText {
|
||||||
text: "There is no task to show";
|
text: "There is no task to show";
|
||||||
horizontal-alignment: center;
|
horizontal-alignment: center;
|
||||||
vertical-alignment: center;
|
vertical-alignment: center;
|
||||||
}
|
}
|
||||||
for day[dayIndex] in AppWindowModels.days: VerticalLayout {
|
for day[dayIndex] in AppModels.days: VerticalLayout {
|
||||||
spacing: day.tasks.length > 0 ? 16px : 0px;
|
spacing: day.tasks.length > 0 ? 16px : 0px;
|
||||||
padding-bottom: 32px;
|
padding-bottom: 32px;
|
||||||
|
|
||||||
|
@ -92,19 +92,19 @@ export component MainView inherits Rectangle {
|
||||||
padding-bottom: 8px;
|
padding-bottom: 8px;
|
||||||
TaskLine {
|
TaskLine {
|
||||||
title: task.title;
|
title: task.title;
|
||||||
source-name: AppWindowModels.get-source-name-from-id(task.sourceId);
|
source-name: AppModels.get-source-name-from-id(task.sourceId);
|
||||||
scheduled: task.date.year != 0;
|
scheduled: task.date.year != 0;
|
||||||
date: day.date;
|
date: day.date;
|
||||||
checked: task.checked;
|
checked: task.checked;
|
||||||
allow-edit-date: true;
|
allow-edit-date: true;
|
||||||
delete => {
|
delete => {
|
||||||
AppWindowActions.delete-task-clicked(task.sourceId, task.id)
|
AppActions.delete-task-clicked(task.sourceId, task.id)
|
||||||
}
|
}
|
||||||
toggle-check => {
|
toggle-check => {
|
||||||
AppWindowActions.task-clicked(task.sourceId, task.id);
|
AppActions.task-clicked(task.sourceId, task.id);
|
||||||
}
|
}
|
||||||
edited(data) => {
|
edited(data) => {
|
||||||
AppWindowActions.save-task({
|
AppActions.save-task({
|
||||||
id: task.id,
|
id: task.id,
|
||||||
sourceId: task.sourceId,
|
sourceId: task.sourceId,
|
||||||
title: data.title,
|
title: data.title,
|
||||||
|
@ -117,7 +117,7 @@ export component MainView inherits Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if AppWindowModels.unscheduled-tasks.length > 0 : VerticalLayout {
|
if AppModels.unscheduled-tasks.length > 0 : VerticalLayout {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
//background: Palette.card-background;
|
//background: Palette.card-background;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
|
@ -130,22 +130,22 @@ export component MainView inherits Rectangle {
|
||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for task[taskIndex] in AppWindowModels.unscheduled-tasks: VerticalLayout {
|
for task[taskIndex] in AppModels.unscheduled-tasks: VerticalLayout {
|
||||||
padding-top: taskIndex == 0 ? 16px : 0px;
|
padding-top: taskIndex == 0 ? 16px : 0px;
|
||||||
padding-bottom: 8px;
|
padding-bottom: 8px;
|
||||||
TaskLine {
|
TaskLine {
|
||||||
title: task.title;
|
title: task.title;
|
||||||
source-name: AppWindowModels.get-source-name-from-id(task.sourceId);
|
source-name: AppModels.get-source-name-from-id(task.sourceId);
|
||||||
checked: task.checked;
|
checked: task.checked;
|
||||||
allow-edit-date: true;
|
allow-edit-date: true;
|
||||||
delete => {
|
delete => {
|
||||||
AppWindowActions.delete-task-clicked(task.sourceId, task.id)
|
AppActions.delete-task-clicked(task.sourceId, task.id)
|
||||||
}
|
}
|
||||||
toggle-check => {
|
toggle-check => {
|
||||||
AppWindowActions.task-clicked(task.sourceId, task.id);
|
AppActions.task-clicked(task.sourceId, task.id);
|
||||||
}
|
}
|
||||||
edited(data) => {
|
edited(data) => {
|
||||||
AppWindowActions.save-task({
|
AppActions.save-task({
|
||||||
id: task.id,
|
id: task.id,
|
||||||
sourceId: task.sourceId,
|
sourceId: task.sourceId,
|
||||||
title: data.title,
|
title: data.title,
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
/*
|
|
||||||
* Mirai. Copyright (C) 2024 Vyn
|
|
||||||
* This file is licensed under version 3 of the GNU General Public License (GPL-3.0-only)
|
|
||||||
* The license can be found in the LICENSE file or at https://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "SettingsWindow.h"
|
|
||||||
#include "../../SeleniteSetup.h"
|
|
||||||
#include "evalyte-cpp-common/evalyte.h"
|
|
||||||
#include "mirai-core/DataProvider.h"
|
|
||||||
#include "mirai-core/MarkdownDataProvider.h"
|
|
||||||
#include "mirai-core/Mirai.h"
|
|
||||||
#include "slint.h"
|
|
||||||
#include "slint_string.h"
|
|
||||||
#include <bits/chrono.h>
|
|
||||||
#include <cassert>
|
|
||||||
#include <cstdio>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <ctime>
|
|
||||||
#include <memory>
|
|
||||||
#include <optional>
|
|
||||||
#include <print>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
SettingsWindow::SettingsWindow(mirai::Mirai *miraiInstance) : miraiInstance_(miraiInstance)
|
|
||||||
{
|
|
||||||
|
|
||||||
const auto palettePath = std::string(getenv("HOME")) + "/.config/evalyte/theme.json";
|
|
||||||
const auto palette = selenite::parseJson(palettePath);
|
|
||||||
|
|
||||||
if (palette.has_value()) {
|
|
||||||
setSelenitePalette(window_->global<ui::Palette>(), palette.value());
|
|
||||||
}
|
|
||||||
|
|
||||||
setupCallbacks();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsWindow::setupCallbacks()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsWindow::open()
|
|
||||||
{
|
|
||||||
window_->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsWindow::close()
|
|
||||||
{
|
|
||||||
window_->hide();
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
/*
|
|
||||||
* Mirai. Copyright (C) 2024 Vyn
|
|
||||||
* This file is licensed under version 3 of the GNU General Public License (GPL-3.0-only)
|
|
||||||
* The license can be found in the LICENSE file or at https://www.gnu.org/licenses/gpl-3.0.txt
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "mirai-core/Mirai.h"
|
|
||||||
#include "slint.h"
|
|
||||||
#include "ui.h"
|
|
||||||
|
|
||||||
class SettingsWindow
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
SettingsWindow(mirai::Mirai *mirai);
|
|
||||||
|
|
||||||
void open();
|
|
||||||
void close();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void setupCallbacks();
|
|
||||||
|
|
||||||
std::shared_ptr<slint::VectorModel<ui::Source>> sources_;
|
|
||||||
slint::ComponentHandle<ui::SettingsWindow> window_ = ui::SettingsWindow::create();
|
|
||||||
mirai::Mirai *miraiInstance_;
|
|
||||||
};
|
|
|
@ -1,26 +0,0 @@
|
||||||
import { AppWindowModels } from "../AppWindow/Models.slint";
|
|
||||||
import { Button, VerticalBox, CheckBox } from "std-widgets.slint";
|
|
||||||
import { VText, VTextInput, Palette } from "@selenite";
|
|
||||||
|
|
||||||
export component SettingsWindow inherits Window {
|
|
||||||
|
|
||||||
title: "Mirai - Settings";
|
|
||||||
min-height: 100px;
|
|
||||||
max-height: 4000px; // needed, otherwise the window wants to fit the content (on Swaywm)
|
|
||||||
background: Palette.background;
|
|
||||||
|
|
||||||
VerticalLayout {
|
|
||||||
padding: 16px;
|
|
||||||
spacing: 8px;
|
|
||||||
for source[source-index] in AppWindowModels.sources-selected: VerticalLayout {
|
|
||||||
VText {
|
|
||||||
text: source.name;
|
|
||||||
}
|
|
||||||
VTextInput {
|
|
||||||
text: source.path;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { AppWindowModels, Palette } // Export to make it visible to the C++ backend
|
|
Loading…
Add table
Add a link
Reference in a new issue