mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-01 17:03:19 +00:00
Generate default config file if it doesn't exist
This commit is contained in:
parent
cbaa1b58d8
commit
924e35ecc4
2 changed files with 13 additions and 1 deletions
10
external/mirai-core/src/ConfigImpl.cpp
vendored
10
external/mirai-core/src/ConfigImpl.cpp
vendored
|
@ -5,9 +5,9 @@
|
|||
*/
|
||||
|
||||
#include "ConfigImpl.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -16,6 +16,14 @@ namespace mirai
|
|||
ConfigImpl::ConfigImpl(const std::string &path) : path_(path)
|
||||
{
|
||||
std::ifstream file(path_);
|
||||
if (!file) {
|
||||
configJson_ = nlohmann::json::parse(R"(
|
||||
{
|
||||
"files": []
|
||||
}
|
||||
)");
|
||||
return;
|
||||
}
|
||||
configJson_ = nlohmann::json::parse(file);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,10 @@ export component MainView inherits Rectangle {
|
|||
VerticalLayout {
|
||||
alignment: start;
|
||||
spacing: 16px;
|
||||
if Backend.visible_tasks.length == 0 : VText {
|
||||
text: "There is no task to show";
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
for day[dayIndex] in Backend.visible_tasks: VerticalLayout {
|
||||
Rectangle {
|
||||
background: Palette.card-background;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue