diff options
author | Your Name <you@example.com> | 2020-11-07 09:30:53 -0500 |
---|---|---|
committer | Your Name <you@example.com> | 2020-11-07 09:30:53 -0500 |
commit | 89a449c2ab9d736c1f03c78b745e814424e01360 (patch) | |
tree | 25c4d03bd39a5ddbe1b7f28713e82bf174a29216 /mods.h | |
download | biblereader-89a449c2ab9d736c1f03c78b745e814424e01360.tar.gz biblereader-89a449c2ab9d736c1f03c78b745e814424e01360.tar.bz2 biblereader-89a449c2ab9d736c1f03c78b745e814424e01360.zip |
Initial commit
Diffstat (limited to 'mods.h')
-rw-r--r-- | mods.h | 53 |
1 files changed, 53 insertions, 0 deletions
@@ -0,0 +1,53 @@ +#pragma once +#include <glib.h> +#include <thread> +#include <mutex> +#include <vector> +#include <string> +#include <gtkmm.h> +#include <libbible.h> + +using namespace std; + +class Header; + +/* + * Credit goes to the Xiphos project for this part of the code: + * https://github.com/crosswire/xiphos/ + */ + +class Mods : public Gtk::Frame, public libbible::Status +{ +public: + Mods(Header *header, Gtk::Window *window); + virtual ~Mods(); + + void installMods(std::vector<std::string> filenames); + void uninstallMods(std::vector<std::string> modnames); + void updateInstallable(); + void displayMain(); + void displayDownload(); + + // This is for Status. Huzzah for multiple inheritance! + virtual void update(unsigned long totalBytes, unsigned long completedBytes, std::string message); + +protected: + Header *header; + Gtk::Window *window; + std::map<std::string, std::vector<std::string>> modsAvailable; + + Gtk::MessageDialog progressDialog; + Gtk::ProgressBar progressBar; + Glib::Dispatcher dispatcher; + mutable std::mutex progressMutex; + double fracDone; + std::string message; + std::thread *worker; + bool complete; + void getStatus(double *fractionDone, std::string *mess, bool *isComplete) const; + void onNotify(); + + void showProgress(std::string message); + void endProgress(); + +}; |