reapack

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

reapack.hpp (2387B)


      1 /* ReaPack: Package manager for REAPER
      2  * Copyright (C) 2015-2025  Christian Fillion
      3  *
      4  * This program is free software: you can redistribute it and/or modify
      5  * it under the terms of the GNU Lesser General Public License as published by
      6  * the Free Software Foundation, either version 3 of the License, or
      7  * (at your option) any later version.
      8  *
      9  * This program is distributed in the hope that it will be useful,
     10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12  * GNU Lesser General Public License for more details.
     13  *
     14  * You should have received a copy of the GNU Lesser General Public License
     15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
     16  */
     17 
     18 #ifndef REAPACK_REAPACK_HPP
     19 #define REAPACK_REAPACK_HPP
     20 
     21 #include "action.hpp"
     22 #include "api.hpp"
     23 #include "browser.hpp"
     24 #include "browser_entry.hpp"
     25 #include "config.hpp"
     26 #include "path.hpp"
     27 
     28 #include <list>
     29 
     30 #include <reaper_plugin.h>
     31 
     32 class About;
     33 class Browser;
     34 class Manager;
     35 class Progress;
     36 class Remote;
     37 class Transaction;
     38 
     39 #define g_reapack (ReaPack::instance())
     40 
     41 class ReaPack {
     42 public:
     43   static ReaPack *instance() { return s_instance; }
     44   static Path resourcePath();
     45 
     46   ReaPack(REAPER_PLUGIN_HINSTANCE, HWND mainWindow);
     47   ~ReaPack();
     48 
     49   ActionList *actions() { return &m_actions; }
     50 
     51   void synchronizeAll();
     52   void uninstall(const Remote &);
     53 
     54   void uploadPackage();
     55   void importRemote();
     56   void manageRemotes();
     57   void aboutSelf();
     58   void about(const Remote &, bool focus = true);
     59   About *about(bool instantiate = true);
     60   Browser *browsePackages();
     61   void refreshManager();
     62   void refreshBrowser();
     63 
     64   void addSetRemote(const Remote &);
     65   Remote remote(const std::string &name) const;
     66 
     67   Transaction *setupTransaction();
     68   void commitConfig(bool refresh = true);
     69   Config *config() { return &m_config; }
     70 
     71 private:
     72   static ReaPack *s_instance;
     73 
     74   void createDirectories();
     75   void registerSelf();
     76   void setupActions();
     77   void setupAPI();
     78   void teardownTransaction();
     79 
     80   REAPER_PLUGIN_HINSTANCE m_instance;
     81   HWND m_mainWindow;
     82 
     83   UseRootPath m_useRootPath;
     84   Config m_config;
     85   ActionList m_actions;
     86   std::list<APIReg> m_api;
     87 
     88   Transaction *m_tx;
     89   std::unique_ptr<About> m_about;
     90   std::unique_ptr<Browser> m_browser;
     91   std::unique_ptr<Manager> m_manager;
     92   std::unique_ptr<Progress> m_progress;
     93 };
     94 
     95 #endif