Skip to content

Commit

Permalink
Edited message boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
Younitea committed May 8, 2024
1 parent a46cfb8 commit 694819f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Charcoal/Charcoal/Charcoal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void Charcoal::deleteBooks(const JSObject& thisobject, const JSArgs& args)
}

void Charcoal::grayscaleName(const JSObject& thisobject, const JSArgs& args) {
MessageBoxA(NULL, "Grayscale Books Hook", "Grayscale Books Hook", MB_OK);
MessageBoxA(NULL, "Started Grayscaling book", "Started Grayscaling book", MB_OK);
// Get the first argument
JSValueRef arg = args[0];
JSContextRef ctx = JSGlobalContextCreate(NULL);
Expand All @@ -109,7 +109,7 @@ void Charcoal::grayscaleName(const JSObject& thisobject, const JSArgs& args) {

// Call the grayscale method
ebooks.grayscale(ID);

MessageBoxA(NULL, "Finished Grayscaling book", "Finished Grayscaling book", MB_OK);
return;
}

Expand Down
1 change: 0 additions & 1 deletion Charcoal/Charcoal/Epub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ book Epub::add(std::string npath)
}

void Epub::grayscaleEpub(std::string path) {
//std::string npath = wstrtostr(path);
using namespace libzippp;
ZipArchive zipArchive(path);
zipArchive.open(ZipArchive::Write);
Expand Down
14 changes: 8 additions & 6 deletions Charcoal/Charcoal/Library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,16 @@ std::string Library::getFileExtension(const std::string& filePath)
int ID = 0;
std::string Library::add(PWSTR path)
{
std::string f = getFileExtension(wstrtostr(path));
std::string npath = wstrtostr(path);
std::string f = getFileExtension(npath);
if (f == "epub")
{
Epub e;
std::string npath = wstrtostr(path);

book curr = e.add(npath);
curr.ID = ID;
curr.path = npath;

++ID;
collection.push_back(curr);
titles.push_back(curr.title);
Expand Down Expand Up @@ -125,11 +127,11 @@ std::vector<std::string> Library::getBookTitles() {
return titles;
}

int Library::remove(int ID) // this actually removes the book from the library.
int Library::remove(int book_ID) // this actually removes the book from the library.
{
for (int i = 0; i < collection.size(); i++)
{
if (collection[i].ID == ID)
if (collection[i].ID == book_ID)
{
collection.erase(collection.begin() + i);
return 1;
Expand All @@ -138,11 +140,11 @@ int Library::remove(int ID) // this actually removes the book from the library.
return -1;
}

int Library::grayscale(int ID)
int Library::grayscale(int book_ID)
{
for (int i = 0; i < collection.size(); i++)
{
if (collection[i].ID == ID)
if (collection[i].ID == book_ID)
{
std::string path = collection[i].path;
std::string f = getFileExtension((path));
Expand Down

0 comments on commit 694819f

Please sign in to comment.