reapack

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

commit 4599355b119629eb87587aab8394acead3154dd0
parent 5dde65efff32f3f31cb53017e6ce9cf7eb1992f9
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Tue, 20 Jun 2017 20:32:51 -0400

manager: make the about repository dialog follow selection

Diffstat:
Msrc/manager.cpp | 18+++++++++++++++++-
Msrc/manager.hpp | 2++
Msrc/reapack.cpp | 4++--
Msrc/reapack.hpp | 2+-
4 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/src/manager.cpp b/src/manager.cpp @@ -72,7 +72,8 @@ void Manager::onInit() {AUTO_STR("State"), 60}, }); - m_list->onActivate([=] { m_reapack->about(getRemote(m_list->currentIndex())); }); + m_list->onActivate(bind(&Manager::aboutRepo, this, true)); + m_list->onSelect(bind(&Dialog::startTimer, this, 100, 0, true)); m_list->onContextMenu(bind(&Manager::fillContextMenu, this, placeholders::_1, placeholders::_2)); @@ -93,6 +94,16 @@ void Manager::onInit() m_list->autoSizeHeader(); } +void Manager::onTimer(const int id) +{ + stopTimer(id); + + if(About *about = m_reapack->about(false)) { + if(about->testDelegate<AboutIndexDelegate>()) + aboutRepo(false); + } +} + void Manager::onClose() { Serializer::Data data; @@ -463,6 +474,11 @@ void Manager::copyUrl() setClipboard(values); } +void Manager::aboutRepo(const bool focus) +{ + m_reapack->about(getRemote(m_list->currentIndex()), focus); +} + void Manager::importExport() { Menu menu; diff --git a/src/manager.hpp b/src/manager.hpp @@ -45,6 +45,7 @@ protected: void onInit() override; void onCommand(int, int) override; bool onKeyDown(int, int) override; + void onTimer(int) override; void onClose() override; private: @@ -75,6 +76,7 @@ private: void setupNetwork(); void importArchive(); void exportArchive(); + void aboutRepo(bool focus = true); void setChange(int); bool confirm() const; diff --git a/src/reapack.cpp b/src/reapack.cpp @@ -227,7 +227,7 @@ Remote ReaPack::remote(const string &name) const return m_config->remotes.get(name); } -void ReaPack::about(const Remote &repo) +void ReaPack::about(const Remote &repo, const bool focus) { Transaction *tx = setupTransaction(); if(!tx) @@ -239,7 +239,7 @@ void ReaPack::about(const Remote &repo) tx->onFinish([=] { const auto &indexes = tx->getIndexes(repos); if(!indexes.empty()) - about()->setDelegate(make_shared<AboutIndexDelegate>(indexes.front())); + about()->setDelegate(make_shared<AboutIndexDelegate>(indexes.front()), focus); }); tx->runTasks(); } diff --git a/src/reapack.hpp b/src/reapack.hpp @@ -69,7 +69,7 @@ public: void importRemote(); void manageRemotes(); void aboutSelf(); - void about(const Remote &); + void about(const Remote &, bool focus = true); About *about(bool instantiate = true); Browser *browsePackages(); void refreshManager();