2022-11-18 01:48:53 +01:00
|
|
|
#pragma once
|
|
|
|
|
2022-11-20 00:02:14 +01:00
|
|
|
#include <SFML/System/Time.hpp>
|
2022-11-18 01:48:53 +01:00
|
|
|
#include <filesystem>
|
|
|
|
|
|
|
|
#include <toml++/toml.h>
|
|
|
|
|
2022-11-21 03:31:26 +01:00
|
|
|
#include "quantization_colors.hpp"
|
|
|
|
#include "linear_view_colors.hpp"
|
|
|
|
#include "linear_view_sizes.hpp"
|
2022-11-18 01:48:53 +01:00
|
|
|
#include "marker.hpp"
|
2022-11-19 03:29:49 +01:00
|
|
|
#include "widgets/lane_order.hpp"
|
2022-11-18 01:48:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
namespace config {
|
|
|
|
struct Marker {
|
|
|
|
std::optional<std::filesystem::path> folder;
|
|
|
|
std::optional<Judgement> ending_state;
|
|
|
|
|
|
|
|
void load_from_v1_0_0_table(const toml::table& tbl);
|
|
|
|
void dump_as_v1_0_0(toml::table& tbl);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct LinearView {
|
2022-11-19 03:29:49 +01:00
|
|
|
linear_view::Colors colors;
|
|
|
|
linear_view::Sizes sizes;
|
|
|
|
linear_view::LaneOrder lane_order;
|
2022-11-20 00:02:14 +01:00
|
|
|
int zoom = 0;
|
2022-11-21 03:31:26 +01:00
|
|
|
bool use_quantization_colors = false;
|
|
|
|
linear_view::QuantizationColors quantization_colors;
|
2022-11-20 00:02:14 +01:00
|
|
|
|
|
|
|
void load_from_v1_0_0_table(const toml::table& tbl);
|
|
|
|
void dump_as_v1_0_0(toml::table& tbl);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Editor {
|
|
|
|
sf::Time collision_zone = sf::seconds(1);
|
2022-11-18 01:48:53 +01:00
|
|
|
|
|
|
|
void load_from_v1_0_0_table(const toml::table& tbl);
|
|
|
|
void dump_as_v1_0_0(toml::table& tbl);
|
|
|
|
};
|
|
|
|
|
|
|
|
/* RAII-style class that holds settings we wish to save on disk and saves
|
|
|
|
them upon being destroyed */
|
|
|
|
class Config {
|
|
|
|
public:
|
|
|
|
Config(const std::filesystem::path& settings);
|
|
|
|
~Config();
|
|
|
|
|
|
|
|
const std::string version = "1.0.0";
|
|
|
|
|
|
|
|
Marker marker;
|
|
|
|
LinearView linear_view;
|
2022-11-20 00:02:14 +01:00
|
|
|
Editor editor;
|
2022-11-18 01:48:53 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
void load_from_v1_0_0_table(const toml::table& tbl);
|
|
|
|
toml::table dump_as_v1_0_0();
|
|
|
|
|
|
|
|
std::filesystem::path config_path;
|
|
|
|
};
|
|
|
|
}
|