From d2738a223a4707c78de9ce0e22d2c0a573ff7642 Mon Sep 17 00:00:00 2001 From: Melroy van den Berg Date: Sun, 28 Mar 2021 22:56:10 +0200 Subject: [PATCH 1/7] Introduce Settings schema file (gsettings) --- src/CMakeLists.txt | 64 ++++++++++++++++++++++++---- src/mainwindow.cc | 32 ++++++++++++-- src/mainwindow.h | 5 ++- src/org.libreweb.browser.gschema.xml | 17 ++++++++ 4 files changed, 105 insertions(+), 13 deletions(-) create mode 100644 src/org.libreweb.browser.gschema.xml diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3767114..0e770b4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,11 +18,11 @@ set(PROJECT_TARGET libreweb-browser) set(THREADS_PREFER_PTHREAD_FLAG ON) +# Find required dependencies find_package(Threads REQUIRED) - find_package(PkgConfig REQUIRED) -pkg_check_modules(GTKMM gtkmm-3.0) -pkg_check_modules(CAIRO cairomm-1.0) +pkg_check_modules(GTKMM REQUIRED gtkmm-3.0) +pkg_check_modules(GLIB REQUIRED glib-2.0) add_definitions(${GTKMM_CFLAGS_OTHER}) @@ -39,8 +39,39 @@ if(NOT json_POPULATED) add_subdirectory(${json_SOURCE_DIR} ${json_BINARY_DIR} EXCLUDE_FROM_ALL) endif() +# Generate Project version header file configure_file(${CMAKE_CURRENT_SOURCE_DIR}/project_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/project_config.h) + # Find the GLib path for schema installation + execute_process( + COMMAND + ${PKG_CONFIG_EXECUTABLE} + glib-2.0 + --variable prefix + OUTPUT_VARIABLE + _glib_prefix + OUTPUT_STRIP_TRAILING_WHITESPACE +) +set(GSETTINGS_DIR "${_glib_prefix}/share/glib-2.0/schemas/" CACHE INTERNAL "") + +# Fetch path for schema compiler from pkg-config +execute_process( + COMMAND + ${PKG_CONFIG_EXECUTABLE} + gio-2.0 + --variable + glib_compile_schemas + OUTPUT_VARIABLE + _glib_compile_schemas + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +# Set glib schema compiler command +set(glib_schema_compiler ${_glib_compile_schemas} CACHE INTERNAL "") + +set(SCHEMA_FILE ${CMAKE_CURRENT_SOURCE_DIR}/org.libreweb.browser.gschema.xml) + +# Source code set(HEADERS about.h file.h @@ -51,7 +82,6 @@ set(HEADERS draw.h source-code-dialog.h ) - set(SOURCES main.cc about.cc @@ -67,6 +97,21 @@ set(SOURCES add_executable(${PROJECT_TARGET} ${SOURCES}) +# Copy gschema.xml file to build directory +set(SCHEMA_DIR ${CMAKE_CURRENT_BINARY_DIR}/gsettings) +add_custom_command( + TARGET ${PROJECT_TARGET} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${SCHEMA_FILE} + ${SCHEMA_DIR}/org.libreweb.browser.gschema.xml +) + +add_custom_command( + TARGET ${PROJECT_TARGET} POST_BUILD + COMMAND ${glib_schema_compiler} ${SCHEMA_DIR} + COMMENT "Compiling schemas in folder: ${SCHEMA_DIR}" +) + # Add fallback for std filesystem in older GCC versions if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.4) @@ -88,15 +133,18 @@ target_include_directories(${PROJECT_TARGET} PRIVATE ${CMAKE_BINARY_DIR} ${CMAKE_EXTENSIONS_BINARY_DIR} ${GTKMM_INCLUDE_DIRS} - ${CAIRO_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/lib/ipfs-http-client/include - ) +) target_link_directories(${PROJECT_TARGET} PRIVATE ${GTKMM_LIBRARY_DIRS} - ${CAIRO_LIBRARY_DIRS} ) -target_link_libraries(${PROJECT_TARGET} PRIVATE LibCommonMarker LibCommonMarkerExtensions ipfs-http-client Threads::Threads ${CXX_FILESYSTEM_LIBRARIES} ${GTKMM_LIBRARIES} ${CAIRO_LIBRARIES} nlohmann_json::nlohmann_json) +target_link_libraries(${PROJECT_TARGET} PRIVATE LibCommonMarker LibCommonMarkerExtensions ipfs-http-client Threads::Threads ${CXX_FILESYSTEM_LIBRARIES} ${GTKMM_LIBRARIES} nlohmann_json::nlohmann_json) +# Install browser binary install(TARGETS ${PROJECT_TARGET} RUNTIME DESTINATION "bin" COMPONENT applications) + +# Install & compile GTK schema file +install(FILES ${SCHEMA_FILE} DESTINATION ${GSETTINGS_DIR}) +install(CODE "execute_process (COMMAND ${glib_schema_compiler} ${GSETTINGS_DIR})") diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 288d598..f785a77 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -10,14 +10,16 @@ #include #include #include +#include #include #include #include #include MainWindow::MainWindow() - : accelGroup(Gtk::AccelGroup::create()), - m_menu(accelGroup), + : m_accelGroup(Gtk::AccelGroup::create()), + m_settings(), + m_menu(m_accelGroup), m_draw_main(*this), m_draw_secondary(*this), m_vbox(Gtk::ORIENTATION_VERTICAL, 0), @@ -41,7 +43,17 @@ MainWindow::MainWindow() set_title(m_appName); set_default_size(1000, 800); set_position(Gtk::WIN_POS_CENTER); - add_accel_group(accelGroup); + add_accel_group(m_accelGroup); + + // if(app is not installed/DEBUG?) + Glib::setenv("GSETTINGS_SCHEMA_DIR", "/media/melroy/Data/Projects/browser/build/src/gsettings", true); + m_settings = Gio::Settings::create("org.libreweb.browser"); + + m_settings->set_int("width", this->get_width()); + m_settings->set_int("height", this->get_height()); + m_settings->set_boolean("is-maximized", this->is_maximized()); + // Fullscreen will be availible with gtkmm-4.0 + //m_settings->set_boolean("is-fullscreen", this->is_fullscreen()); m_statusPopover.set_position(Gtk::POS_BOTTOM); m_statusPopover.set_size_request(200, 80); @@ -53,7 +65,10 @@ MainWindow::MainWindow() // Timeouts this->statusTimerHandler = Glib::signal_timeout().connect(sigc::mem_fun(this, &MainWindow::update_connection_status), 3000); - // Connect signals + // Window signals + this->signal_delete_event().connect(sigc::mem_fun(this, &MainWindow::delete_window)); + + // Menu & toolbar signals m_menu.new_doc.connect(sigc::mem_fun(this, &MainWindow::new_doc)); /*!< Menu item for new document */ m_menu.open.connect(sigc::mem_fun(this, &MainWindow::open)); /*!< Menu item for opening existing document */ m_menu.save.connect(sigc::mem_fun(this, &MainWindow::save)); /*!< Menu item for save document */ @@ -404,6 +419,15 @@ void MainWindow::doRequest(const std::string &path, bool setAddressBar, bool isH } } +/** + * \brief Called when Window is closed + */ +bool MainWindow::delete_window(GdkEventAny* any_event) +{ + std::cout << "Yes.." << std::endl; + return false; +} + /** * \brief Timeout slot: Update the IPFS connection status every x seconds */ diff --git a/src/mainwindow.h b/src/mainwindow.h index 5d0663d..4c1fea3 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -19,6 +19,7 @@ #include #include #include +#include #include /** @@ -33,6 +34,7 @@ public: protected: // Signal handlers + bool delete_window(GdkEventAny* any_event); bool update_connection_status(); void cut(); void copy(); @@ -60,7 +62,8 @@ protected: void show_source_code_dialog(); void get_heading(); - Glib::RefPtr accelGroup; /*!< Accelerator group, used for keyboard shortcut bindings */ + Glib::RefPtr m_accelGroup; /*!< Accelerator group, used for keyboard shortcut bindings */ + Glib::RefPtr m_settings; /*!< Settings to store our preferences, even during restarts */ // Child widgets Menu m_menu; diff --git a/src/org.libreweb.browser.gschema.xml b/src/org.libreweb.browser.gschema.xml new file mode 100644 index 0000000..f0ef68d --- /dev/null +++ b/src/org.libreweb.browser.gschema.xml @@ -0,0 +1,17 @@ + + + + + 1000 + Window width + + + 800 + Window height + + + false + Window maximized + + + From b0fcea83318e55afcc7ac40c45aeef9761062183 Mon Sep 17 00:00:00 2001 From: Melroy van den Berg Date: Mon, 29 Mar 2021 00:24:58 +0200 Subject: [PATCH 2/7] Working schema file, plus detect when application is installed run-time. --- src/ipfs.cc | 4 +- src/mainwindow.cc | 72 +++++++++++++++++++++------- src/mainwindow.h | 1 + src/org.libreweb.browser.gschema.xml | 8 +++- src/project_config.h.in | 10 ++-- 5 files changed, 69 insertions(+), 26 deletions(-) diff --git a/src/ipfs.cc b/src/ipfs.cc index 4a88408..a9d8ee2 100644 --- a/src/ipfs.cc +++ b/src/ipfs.cc @@ -127,12 +127,12 @@ bool IPFS::shouldKillRunningProcess() std::string path = "/proc/" + std::to_string(pid) + "/exe"; if (readlink(path.c_str(), pathbuf, sizeof(pathbuf) - 1) > 0) { - // TODO: Compare version or file path location - char beginPath[28] = "/usr/share/libreweb-browser"; + char beginPath[] = "/usr/share/libreweb-browser"; // If the begin path does not path (!= 0), return true, // meaning the process will be killed. return (strncmp(pathbuf, beginPath, strlen(beginPath)) != 0); } + // TODO: Compare IPFS version as well, maybe? } else { diff --git a/src/mainwindow.cc b/src/mainwindow.cc index f785a77..d661009 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -1,5 +1,6 @@ #include "mainwindow.h" +#include "project_config.h" #include "md-parser.h" #include "menu.h" #include "file.h" @@ -16,6 +17,11 @@ #include #include +/** + * For info: NDEBUG variable be used for debugging purpose, example: + * #ifdef NDEBUG + * #endif +*/ MainWindow::MainWindow() : m_accelGroup(Gtk::AccelGroup::create()), m_settings(), @@ -45,15 +51,16 @@ MainWindow::MainWindow() set_position(Gtk::WIN_POS_CENTER); add_accel_group(m_accelGroup); - // if(app is not installed/DEBUG?) - Glib::setenv("GSETTINGS_SCHEMA_DIR", "/media/melroy/Data/Projects/browser/build/src/gsettings", true); + // Change schema directory when browser is not installed + if (!this->isInstalled()) + { + Glib::setenv("GSETTINGS_SCHEMA_DIR", "/media/melroy/Data/Projects/browser/build/src/gsettings", true); + } + // Load schema settings file m_settings = Gio::Settings::create("org.libreweb.browser"); - - m_settings->set_int("width", this->get_width()); - m_settings->set_int("height", this->get_height()); - m_settings->set_boolean("is-maximized", this->is_maximized()); - // Fullscreen will be availible with gtkmm-4.0 - //m_settings->set_boolean("is-fullscreen", this->is_fullscreen()); + set_default_size(m_settings->get_int("width"), m_settings->get_int("height")); + if (m_settings->get_boolean("maximized")) + this->maximize(); m_statusPopover.set_position(Gtk::POS_BOTTOM); m_statusPopover.set_size_request(200, 80); @@ -387,13 +394,18 @@ MainWindow::MainWindow() // timer will do the updates later this->update_connection_status(); -#ifdef NDEBUG - // Show start page by default - go_home(); -#else - // Load test.md file in debug - doRequest("file://../../test.md", true); -#endif + if (this->isInstalled()) + { + std::cout << "INFO: App installed!" << std::endl; + // Show homepage + go_home(); + } + else + { + std::cout << "INFO: App NOT installed.." << std::endl; + // Load test file when developing + doRequest("file://../../test.md", true); + } } /** @@ -422,9 +434,14 @@ void MainWindow::doRequest(const std::string &path, bool setAddressBar, bool isH /** * \brief Called when Window is closed */ -bool MainWindow::delete_window(GdkEventAny* any_event) +bool MainWindow::delete_window(GdkEventAny *any_event) { - std::cout << "Yes.." << std::endl; + // Save the schema settings + m_settings->set_int("width", this->get_width()); + m_settings->set_int("height", this->get_height()); + m_settings->set_boolean("maximized", this->is_maximized()); + // Fullscreen will be availible with gtkmm-4.0 + //m_settings->set_boolean("fullscreen", this->is_fullscreen()); return false; } @@ -452,7 +469,7 @@ bool MainWindow::update_connection_status() // And also update text m_statusLabel.set_text("IPFS Network Stats:\n\nConnected peers: " + std::to_string(nrPeers) + "\nRate in: " + in + " kB/s" + - "\nRate out: " + out + " kB/s"); + "\nRate out: " + out + " kB/s"); } else { @@ -833,6 +850,25 @@ void MainWindow::refresh() doRequest(); } +/** + * \brief Determing run-time if the application is installed or running from build + * \return true if the current running process is installed (to the install prefix path) + */ +bool MainWindow::isInstalled() +{ + char pathbuf[1024]; + memset(pathbuf, 0, sizeof(pathbuf)); + if (readlink("/proc/self/exe", pathbuf, sizeof(pathbuf) - 1) > 0) + { + // If current binary path starts with the install prefix, it's installed + return (strncmp(pathbuf, INSTALL_PREFIX, strlen(INSTALL_PREFIX)) == 0); + } + else + { + return true; // fallback + } +} + void MainWindow::enableEdit() { // Inform the Draw class that we are creating a new document diff --git a/src/mainwindow.h b/src/mainwindow.h index 4c1fea3..f583892 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -161,6 +161,7 @@ private: sigc::connection statusTimerHandler; IPFS ipfs; + bool isInstalled(); void enableEdit(); void disableEdit(); void postDoRequest(const std::string &path, bool setAddressBar, bool isHistoryRequest); diff --git a/src/org.libreweb.browser.gschema.xml b/src/org.libreweb.browser.gschema.xml index f0ef68d..94b7d13 100644 --- a/src/org.libreweb.browser.gschema.xml +++ b/src/org.libreweb.browser.gschema.xml @@ -9,9 +9,13 @@ 800 Window height - + false - Window maximized + Is window maximized + + + false + Is window fullscreen diff --git a/src/project_config.h.in b/src/project_config.h.in index 94830fe..8d63cb3 100644 --- a/src/project_config.h.in +++ b/src/project_config.h.in @@ -1,10 +1,12 @@ -#ifndef INCLUDE_GUARD -#define INCLUDE_GUARD +#ifndef PROJECT_CONFIG_H +#define PROJECT_CONFIG_H #define PROJECT_NAME "@PROJECT_NAME@" #define PROJECT_VER "@PROJECT_VERSION@" #define PROJECT_VER_MAJOR "@PROJECT_VERSION_MAJOR@" #define PROJECT_VER_MINOR "@PROJECT_VERSION_MINOR@" -#define PTOJECT_VER_PATCH "@PROJECT_VERSION_PATCH@" +#define PROJECT_VER_PATCH "@PROJECT_VERSION_PATCH@" -#endif // INCLUDE_GUARD \ No newline at end of file +#define INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@" + +#endif // PROJECT_CONFIG_H \ No newline at end of file From a6e75fafd7b40d2fac727c25b4c149f07cc33ef8 Mon Sep 17 00:00:00 2001 From: Melroy van den Berg Date: Mon, 29 Mar 2021 00:27:13 +0200 Subject: [PATCH 3/7] Add unused attribute --- src/mainwindow.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mainwindow.cc b/src/mainwindow.cc index d661009..9a4fa82 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -434,7 +434,7 @@ void MainWindow::doRequest(const std::string &path, bool setAddressBar, bool isH /** * \brief Called when Window is closed */ -bool MainWindow::delete_window(GdkEventAny *any_event) +bool MainWindow::delete_window(GdkEventAny *any_event __attribute__((unused))) { // Save the schema settings m_settings->set_int("width", this->get_width()); From 0602abef71ad9a2dae9778e09ff09be3d2146cd2 Mon Sep 17 00:00:00 2001 From: Melroy van den Berg Date: Mon, 29 Mar 2021 00:53:12 +0200 Subject: [PATCH 4/7] Check where package binary now gets installed? --- cmake/packaging.cmake | 2 +- src/CMakeLists.txt | 2 +- src/mainwindow.cc | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmake/packaging.cmake b/cmake/packaging.cmake index 4d9d30a..ba0cc30 100644 --- a/cmake/packaging.cmake +++ b/cmake/packaging.cmake @@ -9,7 +9,7 @@ set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}") set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_TARGET}-${CPACK_PACKAGE_VERSION}") set(CPACK_DEBIAN_PACKAGE_SECTION "web") -set(CPACK_RPM_PACKAGE_GROUP "Applications/Internet") +set(CPACK_RPM_PACKAGE_GROUP "Applications/Internet") set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-v${CPACK_PACKAGE_VERSION}") # Without '-Linux' suffix if (${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND EXISTS "/etc/os-release") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0e770b4..08eada8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -143,7 +143,7 @@ target_link_directories(${PROJECT_TARGET} PRIVATE target_link_libraries(${PROJECT_TARGET} PRIVATE LibCommonMarker LibCommonMarkerExtensions ipfs-http-client Threads::Threads ${CXX_FILESYSTEM_LIBRARIES} ${GTKMM_LIBRARIES} nlohmann_json::nlohmann_json) # Install browser binary -install(TARGETS ${PROJECT_TARGET} RUNTIME DESTINATION "bin" COMPONENT applications) +install(TARGETS ${PROJECT_TARGET} RUNTIME DESTINATION bin) # Install & compile GTK schema file install(FILES ${SCHEMA_FILE} DESTINATION ${GSETTINGS_DIR}) diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 9a4fa82..8de0924 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -860,6 +860,9 @@ bool MainWindow::isInstalled() memset(pathbuf, 0, sizeof(pathbuf)); if (readlink("/proc/self/exe", pathbuf, sizeof(pathbuf) - 1) > 0) { + std::cout << "Current dir: " << pathbuf << std::endl; + + std::cout << "Prefix dir: " << INSTALL_PREFIX << std::endl; // If current binary path starts with the install prefix, it's installed return (strncmp(pathbuf, INSTALL_PREFIX, strlen(INSTALL_PREFIX)) == 0); } From 760f11c52f0ecdbe45f095a7428cb92a24e7f1e9 Mon Sep 17 00:00:00 2001 From: Melroy van den Berg Date: Mon, 29 Mar 2021 01:22:34 +0200 Subject: [PATCH 5/7] Working schema and app installation detection. --- cmake/packaging.cmake | 3 +-- scripts/build_prod.sh | 5 ++++- src/mainwindow.cc | 27 +++++++++++---------------- src/project_config.h.in | 1 + 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/cmake/packaging.cmake b/cmake/packaging.cmake index ba0cc30..fce3176 100644 --- a/cmake/packaging.cmake +++ b/cmake/packaging.cmake @@ -1,4 +1,3 @@ - # Example: https://github.com/MariaDB/server/tree/10.5/cmake set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LibreWeb Browser - Decentralized Web-Browser") set(CPACK_PACKAGE_VENDOR "Melroy van den Berg") @@ -9,7 +8,7 @@ set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}") set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_TARGET}-${CPACK_PACKAGE_VERSION}") set(CPACK_DEBIAN_PACKAGE_SECTION "web") -set(CPACK_RPM_PACKAGE_GROUP "Applications/Internet") +set(CPACK_RPM_PACKAGE_GROUP "Applications/Internet") set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-v${CPACK_PACKAGE_VERSION}") # Without '-Linux' suffix if (${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND EXISTS "/etc/os-release") diff --git a/scripts/build_prod.sh b/scripts/build_prod.sh index 73dc95a..52cde43 100755 --- a/scripts/build_prod.sh +++ b/scripts/build_prod.sh @@ -2,10 +2,13 @@ # By: Melroy van den Berg # Description: Release production build + create Debian package file (.deb), # RPM [Red Hat] Package Manager (.rpm) and compressed file (.tgz/.tar.gz) +# +# Installs into /usr folder (prefix) + rm -rf build_prod mkdir build_prod cd build_prod -cmake -GNinja -DCMAKE_BUILD_TYPE=Release .. +cmake -GNinja -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_BUILD_TYPE=Release .. ninja && echo "INFO: Building packages..."; cpack -G "TGZ;DEB;RPM" diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 8de0924..bf1bd07 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -54,7 +54,9 @@ MainWindow::MainWindow() // Change schema directory when browser is not installed if (!this->isInstalled()) { - Glib::setenv("GSETTINGS_SCHEMA_DIR", "/media/melroy/Data/Projects/browser/build/src/gsettings", true); + std::string schemaDir = std::string(BINARY_DIR) + "/gsettings"; + std::cout << "INFO: Use settings from: " << schemaDir << std::endl; + Glib::setenv("GSETTINGS_SCHEMA_DIR", schemaDir); } // Load schema settings file m_settings = Gio::Settings::create("org.libreweb.browser"); @@ -394,18 +396,14 @@ MainWindow::MainWindow() // timer will do the updates later this->update_connection_status(); - if (this->isInstalled()) - { - std::cout << "INFO: App installed!" << std::endl; - // Show homepage + // Show homepage if debugging is disabled + #ifdef NDEBUG go_home(); - } - else - { - std::cout << "INFO: App NOT installed.." << std::endl; + #else + std::cout << "INFO: Running as Debug mode, opening test.md." << std::endl; // Load test file when developing doRequest("file://../../test.md", true); - } + #endif } /** @@ -851,8 +849,8 @@ void MainWindow::refresh() } /** - * \brief Determing run-time if the application is installed or running from build - * \return true if the current running process is installed (to the install prefix path) + * \brief Determing if browser is installed from current binary path, at runtime + * \return true if the current running process is installed (to the installed prefix path) */ bool MainWindow::isInstalled() { @@ -860,15 +858,12 @@ bool MainWindow::isInstalled() memset(pathbuf, 0, sizeof(pathbuf)); if (readlink("/proc/self/exe", pathbuf, sizeof(pathbuf) - 1) > 0) { - std::cout << "Current dir: " << pathbuf << std::endl; - - std::cout << "Prefix dir: " << INSTALL_PREFIX << std::endl; // If current binary path starts with the install prefix, it's installed return (strncmp(pathbuf, INSTALL_PREFIX, strlen(INSTALL_PREFIX)) == 0); } else { - return true; // fallback + return true; // fallback; always installed } } diff --git a/src/project_config.h.in b/src/project_config.h.in index 8d63cb3..1d884b9 100644 --- a/src/project_config.h.in +++ b/src/project_config.h.in @@ -8,5 +8,6 @@ #define PROJECT_VER_PATCH "@PROJECT_VERSION_PATCH@" #define INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@" +#define BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@" #endif // PROJECT_CONFIG_H \ No newline at end of file From db4a2c9d39ce799bc901e833626f05f636ad40e3 Mon Sep 17 00:00:00 2001 From: Melroy van den Berg Date: Mon, 29 Mar 2021 01:42:02 +0200 Subject: [PATCH 6/7] Improve package desc --- README.md | 6 +++--- cmake/packaging.cmake | 2 +- misc/package_desc.txt | 8 ++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 misc/package_desc.txt diff --git a/README.md b/README.md index b612a12..f2ed8d5 100644 --- a/README.md +++ b/README.md @@ -40,11 +40,11 @@ The current success criteria: ## Developers -Decentralized Browser written in C++20 with C libraries. And using the [cmark-gfm](https://github.com/github/cmark-gfm) library, used for CommonMark (markdown) parsing. +Decentralized Browser is written C++ together with some [libraries](/lib). It's using the [cmark-gfm](https://github.com/github/cmark-gfm) library for example, which is used for CommonMark (markdown) parsing. -Browser is using GTK 3 as UI library including Pango & Cairo for text drawing and manipulation. +We're using markdown as the source-code of the content/site. No HTML and JavaScript anymore, content is king after all. -For now we will use markdown as the source of the site. No HTML and JavaScript anymore, content is king after all. +LibreWeb Browser is using [Gnome GTK3](https://developer.gnome.org/gtk3/stable/) as UI framework. ### Development Environment diff --git a/cmake/packaging.cmake b/cmake/packaging.cmake index fce3176..f47bd42 100644 --- a/cmake/packaging.cmake +++ b/cmake/packaging.cmake @@ -3,7 +3,7 @@ set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LibreWeb Browser - Decentralized Web-Brow set(CPACK_PACKAGE_VENDOR "Melroy van den Berg") set(CPACK_PACKAGE_CONTACT "Melroy van den Berg ") set(CPACK_PACKAGE_HOMEPAGE_URL "https://libreweb.org") -set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md") +set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/misc/package_desc.txt") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}") set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_TARGET}-${CPACK_PACKAGE_VERSION}") diff --git a/misc/package_desc.txt b/misc/package_desc.txt new file mode 100644 index 0000000..33aefb3 --- /dev/null +++ b/misc/package_desc.txt @@ -0,0 +1,8 @@ +LibreWeb Browser is a fully decentralized free software and open-source Web Browser. +Allowing users to easily browse and host new content on the decentralized web. Build on top of IPFS. + +Decentralization comes with many benefits like resilient to censorship and no single point of failure. + +I was inspired by Douglas Engelbart, Tim Berners-Lee and Ted Nelson as well as projects like IPFS, Jekyll and ARPANET. + +Please read the documentation at https://docs.libreweb.org. \ No newline at end of file From 25cd1287c418e482d0fac85b69b5639ad388ef39 Mon Sep 17 00:00:00 2001 From: Melroy van den Berg Date: Mon, 29 Mar 2021 01:46:06 +0200 Subject: [PATCH 7/7] Improve readme --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f2ed8d5..325ec0e 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ What would you do different; if you could **reinvent** The Internet in 21st cent I was inspired by Douglas Engelbart, Tim Berners-Lee and Ted Nelson as well as projects like IPFS, Jekyll, ARPANET, and more. -*Note:* Project is still in Alpha phase! +*Note:* Project is still in development! ## Download @@ -19,6 +19,10 @@ I was inspired by Douglas Engelbart, Tim Berners-Lee and Ted Nelson as well as p ![Browser Screenshot](./misc/browser_screenshot.png) ![Browser Markdown Editor](./misc/browser_screenshot_2.png) +## Documentation + +Visit the [dedicated documentation site](https://docs.libreweb.org) for user documentation. + ## Ideas/Features The current success criteria: @@ -57,10 +61,10 @@ For the build you need at least: * GCC 9 or higher (GCC 8 should also work, but not adviced. Package: `build-essential`) * CMake (Package: `cmake`) * Ninja build system (Package: `ninja-build`) -* GTK & Cairo & Pango (including C++ bindings): +* GTK & Pango (including C++ bindings): * Package: `libgtkmm-3.0-dev` under Debian based distros -### Documentation +### Developer Docs See latest [Developer Docs](https://gitlab.melroy.org/libreweb/browser/-/jobs/artifacts/master/file/build/docs/html/index.html?job=doxygen).