aboutsummaryrefslogtreecommitdiff
path: root/src/mods.h
diff options
context:
space:
mode:
authorYour Name <you@example.com>2022-02-19 10:54:35 -0500
committerYour Name <you@example.com>2022-02-19 10:54:35 -0500
commit4f26d55e01f9424ba5660cb27076eafba4c88b21 (patch)
tree41131c34e6610cd1b3c52b2b771ef550134a725d /src/mods.h
parenta5cdc506789ac6aeb6f4256b892fedf046fff06c (diff)
downloadbiblereader-4f26d55e01f9424ba5660cb27076eafba4c88b21.tar.gz
biblereader-4f26d55e01f9424ba5660cb27076eafba4c88b21.tar.bz2
biblereader-4f26d55e01f9424ba5660cb27076eafba4c88b21.zip
Reorganized sources
Diffstat (limited to 'src/mods.h')
-rw-r--r--src/mods.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/mods.h b/src/mods.h
new file mode 100644
index 0000000..7373961
--- /dev/null
+++ b/src/mods.h
@@ -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();
+
+};