forked from lthn/blockchain
converted local UI config into JSON
This commit is contained in:
parent
bd3cd91379
commit
b952183623
3 changed files with 18 additions and 8 deletions
|
|
@ -211,7 +211,7 @@
|
|||
#define MINER_CONFIG_FILENAME "miner_conf.json"
|
||||
#define GUI_SECURE_CONFIG_FILENAME "gui_secure_conf.bin"
|
||||
#define GUI_CONFIG_FILENAME "gui_settings.json"
|
||||
#define GUI_INTERNAL_CONFIG "gui_internal_config.bin"
|
||||
#define GUI_INTERNAL_CONFIG2 "gui_internal_config.json"
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -387,9 +387,9 @@ void MainWindow::changeEvent(QEvent *e)
|
|||
bool MainWindow::store_app_config()
|
||||
{
|
||||
TRY_ENTRY();
|
||||
std::string conf_path = m_backend.get_config_folder() + "/" + GUI_INTERNAL_CONFIG;
|
||||
LOG_PRINT_L0("storing gui internal config from " << conf_path);
|
||||
CHECK_AND_ASSERT_MES(tools::serialize_obj_to_file(m_config, conf_path), false, "failed to store gui internal config");
|
||||
std::string conf_path = m_backend.get_config_folder() + "/" + GUI_INTERNAL_CONFIG2;
|
||||
LOG_PRINT_L0("storing gui internal config to " << conf_path);
|
||||
CHECK_AND_ASSERT_MES(epee::serialization::store_t_to_json_file(m_config, conf_path), false, "failed to store gui internal config");
|
||||
return true;
|
||||
CATCH_ENTRY2(false);
|
||||
}
|
||||
|
|
@ -397,9 +397,9 @@ bool MainWindow::store_app_config()
|
|||
bool MainWindow::load_app_config()
|
||||
{
|
||||
TRY_ENTRY();
|
||||
std::string conf_path = m_backend.get_config_folder() + "/" + GUI_INTERNAL_CONFIG;
|
||||
std::string conf_path = m_backend.get_config_folder() + "/" + GUI_INTERNAL_CONFIG2;
|
||||
LOG_PRINT_L0("loading gui internal config from " << conf_path);
|
||||
bool r = tools::unserialize_obj_from_file(m_config, conf_path);
|
||||
bool r = epee::serialization::load_t_from_json_file(m_config, conf_path);
|
||||
LOG_PRINT_L0("gui internal config " << (r ? "loaded ok" : "was not loaded"));
|
||||
return r;
|
||||
CATCH_ENTRY2(false);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include <QWebChannel>
|
||||
|
||||
#include "wallet/view_iface.h"
|
||||
#include "serialization/keyvalue_helper_structs.h"
|
||||
|
||||
#ifndef Q_MOC_RUN
|
||||
#include "wallet/wallets_manager.h"
|
||||
|
|
@ -60,11 +61,20 @@ public:
|
|||
|
||||
struct app_config
|
||||
{
|
||||
std::pair<int64_t, int64_t> m_window_position;
|
||||
std::pair<int64_t, int64_t> m_window_size;
|
||||
|
||||
epee::kvserializable_pair<int64_t, int64_t> m_window_position;
|
||||
epee::kvserializable_pair<int64_t, int64_t> m_window_size;
|
||||
bool is_maximazed;
|
||||
bool is_showed;
|
||||
bool disable_notifications;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(m_window_position)
|
||||
KV_SERIALIZE(m_window_size)
|
||||
KV_SERIALIZE(is_maximazed)
|
||||
KV_SERIALIZE(is_showed)
|
||||
KV_SERIALIZE(disable_notifications)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
protected slots:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue