reapack

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

commit 3a9a8b543f08560406ad678125f97c0d4a680859
parent fb7e7a72ed65516a1abe35b0b882d3f7778677ad
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Fri,  2 Jun 2017 20:58:22 -0400

import: add a "Discover repositories..." button opening https://reapack.com/repos

Diffstat:
Msrc/about.cpp | 10++--------
Msrc/dialog.cpp | 6++++++
Msrc/dialog.hpp | 1+
Msrc/import.cpp | 8++++++--
Msrc/import.hpp | 1+
Msrc/resource.hpp | 1+
Msrc/resource.rc | 3++-
7 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/src/about.cpp b/src/about.cpp @@ -244,7 +244,7 @@ void About::selectLink(const int ctrl) m_tabs->setFocus(); if(count == 1) { - openLink(links.front()); + openURL(links.front()->url); return; } @@ -258,13 +258,7 @@ void About::selectLink(const int ctrl) const int choice = menu.show(getControl(ctrl), handle()); if(choice >> 8 == ctrl) - openLink(links[choice & 0xff]); -} - -void About::openLink(const Link *link) -{ - const auto_string &url = make_autostring(link->url); - ShellExecute(nullptr, AUTO_STR("open"), url.c_str(), nullptr, nullptr, SW_SHOW); + openURL(links[choice & 0xff]->url); } void About::updateList() diff --git a/src/dialog.cpp b/src/dialog.cpp @@ -344,6 +344,12 @@ void Dialog::setClipboard(const vector<string> &values) setClipboard(boost::algorithm::join(values, "\n")); } +void Dialog::openURL(const string &utf8) +{ + const auto_string &url = make_autostring(utf8); + ShellExecute(nullptr, AUTO_STR("open"), url.c_str(), nullptr, nullptr, SW_SHOW); +} + HWND Dialog::getControl(const int idc) { return GetDlgItem(m_handle, idc); diff --git a/src/dialog.hpp b/src/dialog.hpp @@ -100,6 +100,7 @@ public: void stopTimer(int id); void setClipboard(const std::string &); void setClipboard(const std::vector<std::string> &); + static void openURL(const std::string &url); HWND getControl(int idc); std::string getText(HWND); void setAnchor(HWND, int flags); diff --git a/src/import.cpp b/src/import.cpp @@ -32,6 +32,7 @@ using namespace std; static const auto_char *TITLE = AUTO_STR("ReaPack: Import a repository"); +static const string DISCOVER_URL = "https://reapack.com/repos"; Import::Import(ReaPack *reapack) : Dialog(IDD_IMPORT_DIALOG), m_reapack(reapack), m_download(nullptr) @@ -46,10 +47,9 @@ void Import::onInit() m_url = getControl(IDC_URL); m_progress = getControl(IDC_PROGRESS); + m_discover = getControl(IDC_DISCOVER); m_ok = getControl(IDOK); - hide(m_progress); - #ifdef PBM_SETMARQUEE SendMessage(m_progress, PBM_SETMARQUEE, 1, 0); #endif @@ -61,6 +61,9 @@ void Import::onCommand(const int id, int) case IDOK: fetch(); break; + case IDC_DISCOVER: + openURL(DISCOVER_URL); + break; case IDCANCEL: if(m_download) m_download->abort(); @@ -212,6 +215,7 @@ bool Import::import(const Remote &remote) void Import::setWaiting(const bool wait) { setVisible(wait, m_progress); + setVisible(!wait, m_discover); setEnabled(!wait, m_url); #ifndef PBM_SETMARQUEE diff --git a/src/import.hpp b/src/import.hpp @@ -50,6 +50,7 @@ private: HWND m_url; HWND m_progress; + HWND m_discover; HWND m_ok; }; diff --git a/src/resource.hpp b/src/resource.hpp @@ -70,5 +70,6 @@ #define IDC_SCREENSHOT 231 #define IDC_ENABLE 232 #define IDC_CHANGELOG 233 +#define IDC_DISCOVER 234 #endif diff --git a/src/resource.rc b/src/resource.rc @@ -78,7 +78,8 @@ BEGIN EDITTEXT IDC_URL, 60, 16, 220, 14, ES_AUTOHSCROLL LTEXT "Type or paste the URL to a repository index in the box above.", IDC_LABEL2, 60, 33, 220, 10 - CONTROL "", IDC_PROGRESS, PROGRESS_CLASS, PBS_MARQUEE, 10, 54, 150, 5 + CONTROL "", IDC_PROGRESS, PROGRESS_CLASS, PBS_MARQUEE | NOT WS_VISIBLE, 10, 54, 150, 5 + PUSHBUTTON "&Discover repositories...", IDC_DISCOVER, 5, 50, 90, 14 DEFPUSHBUTTON "&OK", IDOK, 201, 50, 40, 14 PUSHBUTTON "&Cancel", IDCANCEL, 244, 50, 40, 14 END