Browse Source

Sort modules by plugin brand instead of plugin name. WIP Plugins menu bar item.

tags/v1.0.0
Andrew Belt 5 years ago
parent
commit
31cc663dd8
5 changed files with 47 additions and 14 deletions
  1. +6
    -1
      .github/ISSUE_TEMPLATE/bug_report.md
  2. +3
    -1
      include/plugin.hpp
  3. +11
    -2
      src/app/MenuBar.cpp
  4. +3
    -3
      src/app/ModuleBrowser.cpp
  5. +24
    -7
      src/plugin.cpp

+ 6
- 1
.github/ISSUE_TEMPLATE/bug_report.md View File

@@ -6,8 +6,13 @@ about: Bugs, build errors, compatibility/stability issues

<--
To file a bug report, fill out the form below.
Post screenshots if the bug is visual.
Use a descriptive title that best explains the bug in one sentence.
Attach screenshots if the bug is visual.
Attach your `<Rack user dir>/log.txt` file if something is crashing or not loading.
Surround terminal output with three tildes
```
like this.
```
-->

### Details


+ 3
- 1
include/plugin.hpp View File

@@ -16,6 +16,7 @@ namespace plugin {

struct Update {
std::string pluginSlug;
std::string pluginName;
std::string version;
std::string changelogUrl;
float progress = 0.f;
@@ -26,10 +27,11 @@ void init();
void destroy();
void logIn(const std::string &email, const std::string &password);
void logOut();
bool isLoggedIn();
void queryUpdates();
void syncUpdate(Update *update);
void syncUpdates();
bool isLoggedIn();
bool isSyncing();
Plugin *getPlugin(const std::string &pluginSlug);
Model *getModel(const std::string &pluginSlug, const std::string &modelSlug);
std::string normalizeTag(const std::string &tag);


+ 11
- 2
src/app/MenuBar.cpp View File

@@ -495,6 +495,11 @@ struct LogInItem : ui::MenuItem {
};

struct SyncItem : ui::MenuItem {
void step() override {
disabled = plugin::isSyncing();
MenuItem::step();
}

void onAction(const event::Action &e) override {
std::thread t([=]() {
plugin::syncUpdates();
@@ -509,7 +514,7 @@ struct PluginSyncItem : ui::MenuItem {

void setUpdate(plugin::Update *update) {
this->update = update;
text = update->pluginSlug;
text = update->pluginName;
plugin::Plugin *p = plugin::getPlugin(update->pluginSlug);
if (p) {
rightText += "v" + p->version + " → ";
@@ -532,6 +537,7 @@ struct PluginSyncItem : ui::MenuItem {
}

void step() override {
disabled = plugin::isSyncing();
if (update->progress >= 1) {
rightText = CHECKMARK_STRING;
}
@@ -610,7 +616,10 @@ struct PluginsMenu : ui::Menu {
void refresh() {
clearChildren();

if (!plugin::isLoggedIn()) {
if (settings::devMode) {
addChild(createMenuLabel("Disabled in development mode"));
}
else if (!plugin::isLoggedIn()) {
UrlItem *registerItem = new UrlItem;
registerItem->text = "Register VCV account";
registerItem->url = "https://vcvrack.com/";


+ 3
- 3
src/app/ModuleBrowser.cpp View File

@@ -515,9 +515,9 @@ struct ModuleBrowser : widget::OpaqueWidget {
float score2 = get_default(settings::favoriteScores, std::make_tuple(m2->model->plugin->slug, m2->model->slug), 0.f);
if (score1 != score2)
return score1 > score2;
// Sort by plugin name
if (m1->model->plugin->name != m2->model->plugin->name)
return m1->model->plugin->name < m2->model->plugin->name;
// Sort by plugin brand
if (m1->model->plugin->brand != m2->model->plugin->brand)
return m1->model->plugin->brand < m2->model->plugin->brand;
// Sort by module name
return m1->model->name < m2->model->name;
});


+ 24
- 7
src/plugin.cpp View File

@@ -339,6 +339,10 @@ void logOut() {
settings::token = "";
}

bool isLoggedIn() {
return settings::token != "";
}

void queryUpdates() {
if (settings::token.empty())
return;
@@ -393,8 +397,12 @@ void queryUpdates() {
continue;
}

// Get plugin name
json_t *nameJ = json_object_get(manifestJ, "name");
if (nameJ)
update.pluginName = json_string_value(nameJ);

// Get version
// TODO Change this to "version" when API changes
json_t *versionJ = json_object_get(manifestJ, "version");
if (!versionJ) {
WARN("Plugin %s has no version in manifest", update.pluginSlug.c_str());
@@ -425,7 +433,15 @@ void queryUpdates() {
}
}

static bool isSyncingUpdate = false;
static bool isSyncingUpdates = false;

void syncUpdate(Update *update) {
isSyncingUpdate = true;
DEFER({
isSyncingUpdate = false;
});

#if defined ARCH_WIN
std::string arch = "win";
#elif ARCH_MAC
@@ -451,6 +467,11 @@ void syncUpdate(Update *update) {
}

void syncUpdates() {
isSyncingUpdates = true;
DEFER({
isSyncingUpdates = false;
});

if (settings::token.empty())
return;

@@ -459,12 +480,8 @@ void syncUpdates() {
}
}

void cancelDownload() {
// TODO
}

bool isLoggedIn() {
return settings::token != "";
bool isSyncing() {
return isSyncingUpdate || isSyncingUpdates;
}

Plugin *getPlugin(const std::string &pluginSlug) {


Loading…
Cancel
Save