Merge pull request #581 from andreasb242/windows-build

Windows build
presentation
andreasb242 7 years ago committed by GitHub
commit 3660ea9bb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 31
      src/pdf/popplerapi/PopplerGlibDocument.cpp
  2. 2
      src/util/Util.cpp
  3. 5
      src/util/XournalType.cpp

@ -2,6 +2,7 @@
#include "PopplerGlibPage.h"
#include "PopplerGlibPageBookmarkIterator.h"
#include <Util.h>
#include <memory>
@ -58,6 +59,20 @@ bool PopplerGlibDocument::equals(XojPdfDocumentInterface* doc)
return document == ((PopplerGlibDocument*)doc)->document;
}
string pathToUri(path filename, GError** error)
{
char * uri = g_filename_to_uri(PATH_TO_CSTR(filename), NULL, error);
if (uri == NULL)
{
return "";
}
string uriString = uri;
g_free(uri);
return uriString;
}
bool PopplerGlibDocument::save(path filename, GError** error)
{
XOJ_CHECK_TYPE(PopplerGlibDocument);
@ -67,8 +82,11 @@ bool PopplerGlibDocument::save(path filename, GError** error)
return false;
}
string uri = "file://";
uri += filename.string();
string uri = pathToUri(filename, error);
if (*error != NULL)
{
return false;
}
return poppler_document_save(document, uri.c_str(), error);
}
@ -76,10 +94,13 @@ bool PopplerGlibDocument::load(path filename, string password, GError** error)
{
XOJ_CHECK_TYPE(PopplerGlibDocument);
string uri = "file://";
uri += filename.string();
this->document = poppler_document_new_from_file(uri.c_str(), password.c_str(), error);
string uri = pathToUri(filename, error);
if (*error != NULL)
{
return false;
}
this->document = poppler_document_new_from_file(uri.c_str(), password.c_str(), error);
return this->document != NULL;
}

@ -149,7 +149,7 @@ void Util::openFileWithFilebrowser(path filename)
#ifdef __APPLE__
#define OPEN_PATTERN "open \"{1}\""
#elif _WIN32 // note the underscore: without it, it's not msdn official!
#elif WIN32
#define OPEN_PATTERN "explorer.exe /n,/e,\"{1}\""
#else // linux, unix, ...
#define OPEN_PATTERN "nautilus \"file://{1}\" || dolphin \"file://{1}\" || konqueror \"file://{1}\" &"

@ -2,7 +2,6 @@
#include "StringUtils.h"
#include <config-dev.h>
#include <i18n.h>
#include <glib.h>
@ -90,11 +89,11 @@ void xoj_momoryleak_printRemainingObjects()
if (x != 0)
{
sum += x;
cout << FORMAT_STR("MemoryLeak: {1} objects of type: {2}") % x % xoj_type_getName(i) << endl;
g_warning("MemoryLeak: %i objects of type: %s", x, xoj_type_getName(i));
}
}
cout << FORMAT_STR("MemoryLeak: sum {1} objects.") % sum << endl;
g_message("MemoryLeak: sum %i objects.", sum);
}
#endif // DEV_MEMORY_LEAK_CHECKING

Loading…
Cancel
Save