reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit 4f380d8a6fd5ad6a5157736f0219b95069099c0c
parent 2067a47de22528b4baa891fa7737b6f506837dce
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Thu,  5 Jan 2017 04:06:37 -0500

about: remember window position and size

Diffstat:
Msrc/about.cpp | 10++++++++++
Msrc/about.hpp | 6++++--
Msrc/config.cpp | 9++++++++-
Msrc/config.hpp | 18++++++++++++------
4 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/src/about.cpp b/src/about.cpp @@ -74,6 +74,16 @@ void About::onInit() setAnchor(getControl(IDC_ACTION), AnchorAll); setAnchor(getControl(IDOK), AnchorAll); // link buttons are anchored in setMetadata + + auto data = m_serializer.read(m_reapack->config()->about.state, 1); + restoreState(data); +} + +void About::onClose() +{ + Serializer::Data data; + saveState(data); + m_reapack->config()->about.state = m_serializer.write(data); } void About::onCommand(const int id, int) diff --git a/src/about.hpp b/src/about.hpp @@ -20,12 +20,12 @@ #include "dialog.hpp" +#include "version.hpp" + #include <map> #include <memory> #include <vector> -#include "version.hpp" - class AboutDelegate; class Index; class ListView; @@ -61,6 +61,7 @@ protected: void onInit() override; void onCommand(int, int) override; bool onKeyDown(int, int) override; + void onClose() override; private: void selectLink(int control); @@ -77,6 +78,7 @@ private: ListView *m_list; DelegatePtr m_delegate; + Serializer m_serializer; }; class AboutDelegate { diff --git a/src/config.cpp b/src/config.cpp @@ -35,6 +35,8 @@ static const auto_char *AUTOINSTALL_KEY = AUTO_STR("autoinstall"); static const auto_char *PRERELEASES_KEY = AUTO_STR("prereleases"); static const auto_char *PROMPTOBSOLETE_KEY = AUTO_STR("promptobsolete"); +static const auto_char *ABOUT_GRP = AUTO_STR("about"); + static const auto_char *BROWSER_GRP = AUTO_STR("browser"); static const auto_char *SHOWDESCS_KEY = AUTO_STR("showdescs"); static const auto_char *STATE_KEY = AUTO_STR("state"); @@ -63,8 +65,9 @@ Config::Config() void Config::resetOptions() { + about = {""}; + browser = {"", true}; install = {false, false, true}; - browser = {true, ""}; network = {"", true}; } @@ -139,6 +142,8 @@ void Config::read(const Path &path) install.promptObsolete = getUInt(INSTALL_GRP, PROMPTOBSOLETE_KEY, install.promptObsolete) > 0; + about.state = getString(ABOUT_GRP, STATE_KEY, about.state); + browser.showDescs = getUInt(BROWSER_GRP, SHOWDESCS_KEY, browser.showDescs) > 0; browser.state = getString(BROWSER_GRP, STATE_KEY, browser.state); @@ -160,6 +165,8 @@ void Config::write() setUInt(INSTALL_GRP, PRERELEASES_KEY, install.bleedingEdge); setUInt(INSTALL_GRP, PROMPTOBSOLETE_KEY, install.promptObsolete); + setString(ABOUT_GRP, STATE_KEY, about.state); + setUInt(BROWSER_GRP, SHOWDESCS_KEY, browser.showDescs); setString(BROWSER_GRP, STATE_KEY, browser.state); diff --git a/src/config.hpp b/src/config.hpp @@ -25,15 +25,19 @@ class Path; -struct InstallOpts { - bool autoInstall; - bool bleedingEdge; - bool promptObsolete; +struct AboutOpts { + std::string state; }; struct BrowserOpts { - bool showDescs; std::string state; + bool showDescs; +}; + +struct InstallOpts { + bool autoInstall; + bool bleedingEdge; + bool promptObsolete; }; struct NetworkOpts { @@ -53,9 +57,11 @@ public: bool isFirstRun() const { return m_isFirstRun; } - InstallOpts install; + AboutOpts about; BrowserOpts browser; + InstallOpts install; NetworkOpts network; + RemoteList remotes; private: