aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-10-20 15:14:24 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-10-20 15:14:24 +0200
commit88492823826b3720be4ba29d246848031418bfb5 (patch)
tree4f17cc7f4ef3f76f869a1d4fcb94722464aa9d0b
parentHostlist test: test non-empty domain (diff)
downloadsmolbote-88492823826b3720be4ba29d246848031418bfb5.tar.xz
Add Kconfiglib to parse Kconfig/.config
-rw-r--r--.gitmodules3
-rw-r--r--CMakeLists.txt16
-rw-r--r--Kconfig20
-rw-r--r--baseconfig100
-rw-r--r--cmake/VendorConfig.cmake58
-rw-r--r--doc/Development/Configuring.asciidoc34
-rw-r--r--lib/configuration/CMakeLists.txt6
-rw-r--r--lib/configuration/configuration.cpp24
-rw-r--r--linux/.config40
-rw-r--r--plugins/ConfigurationEditor/CMakeLists.txt4
-rw-r--r--plugins/ProfileEditor/CMakeLists.txt4
-rw-r--r--src/CMakeLists.txt14
-rw-r--r--src/Kconfig82
-rw-r--r--src/browser.cpp5
-rw-r--r--src/webengine/webpage.cpp27
-rw-r--r--src/webengine/webpage.h3
-rw-r--r--src/webengine/webview.cpp3
m---------tools/Kconfiglib0
-rwxr-xr-xtools/config.py64
19 files changed, 287 insertions, 220 deletions
diff --git a/.gitmodules b/.gitmodules
index 6da4114..2e84ecd 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -4,3 +4,6 @@
[submodule "3rd-party/SingleApplication/SingleApplication.git"]
path = 3rd-party/SingleApplication/SingleApplication.git
url = https://github.com/itay-grudev/SingleApplication.git
+[submodule "tools/Kconfiglib"]
+ path = tools/Kconfiglib
+ url = https://github.com/ulfalizer/Kconfiglib.git
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f959a8d..cfb121d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,18 +1,16 @@
cmake_minimum_required(VERSION 3.10.0)
project(smolbote)
+find_package(Qt5 5.11.0 COMPONENTS Core Widgets WebEngineWidgets REQUIRED)
+find_package(Boost 1.66 COMPONENTS program_options REQUIRED)
+find_package(ECM 1.6.0 NO_MODULE)
+
# add cmake/ to module path
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
include(FeatureSummary)
include(VendorConfig)
-# Libraries
-find_package(Qt5 5.11.0 COMPONENTS Core Widgets WebEngineWidgets REQUIRED)
-find_package(Boost 1.66 COMPONENTS program_options REQUIRED)
-
if(CONFIG_USEPLASMA)
- find_package(ECM 1.6.0 REQUIRED NO_MODULE)
- set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
find_package(KF5 "5.6.0" COMPONENTS Wallet WindowSystem REQUIRED)
endif(CONFIG_USEPLASMA)
@@ -58,5 +56,9 @@ message(STATUS "CXX compiler: ${CMAKE_CXX_COMPILER_ID}")
message(STATUS "CXX flags: ${CMAKE_CXX_FLAGS}")
message(STATUS "CXX flags dbg: ${CMAKE_CXX_FLAGS_DEBUG}")
message(STATUS "CXX flags rel: ${CMAKE_CXX_FLAGS_RELEASE}")
+message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
+message(STATUS "Install bindir ${CONFIG_INSTALL_BINDIR}")
+message(STATUS "Install libdir ${CONFIG_INSTALL_LIBDIR}")
+message(STATUS "Install plugins ${CONFIG_INSTALL_PLUGINDIR}")
feature_summary(WHAT ALL)
diff --git a/Kconfig b/Kconfig
new file mode 100644
index 0000000..67265fc
--- /dev/null
+++ b/Kconfig
@@ -0,0 +1,20 @@
+mainmenu "smolbote configuration"
+
+comment "Build system settings"
+menu "Install paths"
+ config INSTALL_BINDIR
+ string "User executables"
+ default "bin"
+
+ config INSTALL_LIBDIR
+ string "Object code libraries"
+ default "lib64"
+
+ config INSTALL_PLUGINDIR
+ string "Plugins"
+ default "lib64/plugins"
+
+endmenu
+
+comment "Application Settings"
+rsource src/Kconfig
diff --git a/baseconfig b/baseconfig
deleted file mode 100644
index 0e2fb71..0000000
--- a/baseconfig
+++ /dev/null
@@ -1,100 +0,0 @@
-mainmenu "smolbote configuration"
-
-comment "Build"
-menu "Compiler settings"
- config CXX_FLAGS
- string "Compiler Flags"
- help
- Compiler flags that should be applied to both Debug and Release builds.
- default "-pipe -fstack-protector-strong -fno-plt -fPIE"
-
- config CXX_FLAGS_DEBUG
- string "Debug Flags"
- help
- Compiler flags that should be applied to Debug builds. These flags, together with the Compiler Flags, are appended to CMAKE_CXX_FLAGS_DEBUG.
- default ""
-
- config CXX_FLAGS_RELEASE
- string "Release Flags"
- help
- Compiler flags that should be applied to Release builds. These flags, together with the Compiler Flags, are appended to CMAKE_CXX_FLAGS_RELEASE.
- - -march=native -mtune=native will build executables that are optimized for the build environment's native arch.
- default ""
-endmenu
-
-menu "Install paths"
- config INSTALL_PREFIX
- string "Install prefix"
- default "/usr/local"
- config INSTALL_BIN
- string "bin/ prefix"
- default "bin"
- config INSTALL_LIB
- string "lib/ prefix"
- default "lib/smolbote"
-endmenu
-
-comment "Branding"
-config POI_NAME
- string "Application name"
- default "smolbote"
-config POI_EXE
- string "Executable name"
- default "poi"
-
-comment "Browser configuration"
-menu "Configuration defaults"
- config PATH_CONFIG
- string "Configuration location"
- default "~/.config/smolbote/smolbote.cfg"
- config PATH_CRASHDUMP
- string "Crash dump location"
- default "~/.config/smolbote/crash.d"
- config PATH_FILTER
- string "Host filter path"
- default "~/.config/smolbote/hosts.d"
- config PATH_PLUGINS
- string "Plugin load location"
- default "~/.config/smolbote/plugins.d"
- config PATH_PROFILES
- string "Profile load location"
- default "~/.config/smolbote/profiles.d"
- config PATH_BOOKMARKS
- string "Bookmarks location"
- default "~/.config/smolbote/bookmarks.xbel"
- config PATH_DOWNLOADS
- string "Downloads location"
- default "~/Downloads"
-endmenu
-
-config USEPLASMA
- bool "Enable KDE Frameworks integration"
- default n
- help
- This is a help message
-
-config USEBREAKPAD
- bool "Enable Breakpad integration"
- default n
-
-comment "Devel"
-config QTWARNINGS
- bool "Enable Qt deprecated API warnings"
- default y
-
-config TESTS
- bool "Build tests"
- default n
-
-config LLVMLIBCPP
- bool "Link against the LLVM C++ standard library"
- default n
-
-menu "Workarounds"
- config QTBUG-62511
- bool "Use RCC version 1 format"
- default y
- help
- See QTBUG-62511: rcc embeds time in output
-
-endmenu
diff --git a/cmake/VendorConfig.cmake b/cmake/VendorConfig.cmake
index 1e12b33..c4f3ce9 100644
--- a/cmake/VendorConfig.cmake
+++ b/cmake/VendorConfig.cmake
@@ -1,3 +1,5 @@
+find_package(PythonInterp 3.2 REQUIRED)
+
string(TOLOWER ${CMAKE_SYSTEM_NAME} SYSTEM_NAME)
if (NOT EXISTS "${PROJECT_SOURCE_DIR}/${SYSTEM_NAME}/.config")
@@ -5,28 +7,34 @@ if (NOT EXISTS "${PROJECT_SOURCE_DIR}/${SYSTEM_NAME}/.config")
endif()
# the .config has been found
-
-# read .config entries that start with CONFIG_ to a list of strings
-file(STRINGS ${PROJECT_SOURCE_DIR}/${SYSTEM_NAME}/.config vendor_config REGEX "^CONFIG_")
-
-# for every item in the list, turn it into a list and set it
-foreach(item IN LISTS vendor_config)
- #message("${item}")
- string(REPLACE "\"" "" item ${item})
- string(REGEX REPLACE "(^CONFIG_[^=]*)=(.*$)" "\\1;\\2" item_list ${item})
- #message("${item_list}")
- set(${item_list})
+add_custom_target(config_header
+ BYPRODUCTS "${PROJECT_BINARY_DIR}/include/config.h"
+ COMMAND ${CMAKE_COMMAND} -E env "srctree=${PROJECT_SOURCE_DIR}"
+ ${PYTHON_EXECUTABLE} "${PROJECT_SOURCE_DIR}/tools/Kconfiglib/genconfig.py" "--header-path=${PROJECT_BINARY_DIR}/include/config.h" "${PROJECT_SOURCE_DIR}/src/Kconfig"
+ WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/${SYSTEM_NAME}")
+
+function(config KEY KCONFIG)
+execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} "${PROJECT_SOURCE_DIR}/tools/config.py" "--kconfig=${PROJECT_SOURCE_DIR}/${KCONFIG}" "--dotconfig=${PROJECT_SOURCE_DIR}/${SYSTEM_NAME}/.config" ${KEY}
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE output OUTPUT_STRIP_TRAILING_WHITESPACE)
+ set("CONFIG_${KEY}" ${output} PARENT_SCOPE)
+endfunction()
+
+config("POI_NAME" "src/Kconfig")
+config("POI_EXE" "src/Kconfig")
+
+config("INSTALL_BINDIR" "Kconfig")
+config("INSTALL_LIBDIR" "Kconfig")
+config("INSTALL_PLUGINDIR" "Kconfig")
+
+# QTBUG defines
+execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} "${PROJECT_SOURCE_DIR}/tools/config.py" "--kconfig=${PROJECT_SOURCE_DIR}/src/Kconfig" "--dotconfig=${PROJECT_SOURCE_DIR}/${SYSTEM_NAME}/.config" "QTBUG"
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE QTBUGS OUTPUT_STRIP_TRAILING_WHITESPACE)
+foreach(bug IN LISTS QTBUGS)
+ set(${bug} CACHE STRING "${bug} workaround")
endforeach()
-# Compiler settings
-# Compiler flags
-set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${CONFIG_CXX_FLAGS} ${CONFIG_CXX_FLAGS_DEBUG}")
-set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CONFIG_CXX_FLAGS} ${CONFIG_CXX_FLAGS_RELEASE}")
-
-# Install paths
-if(NOT CONFIG_INSTALL_PREFIX STREQUAL "")
- set(CMAKE_INSTALL_PREFIX ${CONFIG_INSTALL_PREFIX})
-endif()
## Version information, used in src/version.h.in
if (EXISTS "${PROJECT_SOURCE_DIR}/.git")
@@ -39,13 +47,3 @@ endif()
set(poi_Version "r${VerRevision}" CACHE STRING "Short version string")
set(poi_Describe "r${VerRevision}-${VerShortId}" CACHE STRING "Long version string")
set(poi_Build "${VerBranch}-${VerCommit}" CACHE STRING "Build string")
-
-# linking to libc++ doesn't work
-if (CONFIG_LLVMLIBCPP)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
-endif (CONFIG_LLVMLIBCPP)
-
-if(CONFIG_QTWARNINGS)
- add_definitions(-DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050900)
-endif(CONFIG_QTWARNINGS)
diff --git a/doc/Development/Configuring.asciidoc b/doc/Development/Configuring.asciidoc
new file mode 100644
index 0000000..f436da5
--- /dev/null
+++ b/doc/Development/Configuring.asciidoc
@@ -0,0 +1,34 @@
+=== CMake
+
+==== Compiler flags
+-pipe -fstack-protector-strong -fno-plt -fPIE
+-march=native -mtune=native
+
+==== Install paths
+CMAKE_INSTALL_PREFIX is prepended onto all install paths. This variable defaults
+to /usr/local on *nix and c:/Program Files/${PROJECT_NAME} on Windows.
+
+On *nix you can use DESTDIR to relocate the entire installation. DESTDIR is
+prepended to CMAKE_INSTALL_PREFIX.
+
+This will install the project to /ports/pkg/install/usr:
+
+[source, sh]
+----
+cmake -DCMAKE_INSTALL_PREFIX=/usr ...
+...
+make DESTDIR=/ports/pkg/install install
+----
+
+==== clang-tidy
+CMAKE_CXX_CLANG_TIDY="clang-tidy;-checks=*"
+
+==== cppcheck
+CMAKE_CXX_CPPCHECK="cppcheck"
+
+==== ccache
+-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
+
+==== llvm libcpp
+CMAKE_CXX_FLAGS: -stdlib=libc++"
+CMAKE_EXE_LINKER_FLAGS -stdlib=libc++
diff --git a/lib/configuration/CMakeLists.txt b/lib/configuration/CMakeLists.txt
index 581e1eb..def0356 100644
--- a/lib/configuration/CMakeLists.txt
+++ b/lib/configuration/CMakeLists.txt
@@ -6,14 +6,14 @@ set(CMAKE_AUTOMOC ON)
#set(CMAKE_AUTOUIC ON)
#set(CMAKE_AUTORCC ON)
-configure_file(defaults.h.in ${PROJECT_BINARY_DIR}/lib/configuration/defaults.h)
-
add_library(configuration
configuration.cpp
configuration.h)
target_include_directories(configuration
- PRIVATE ${Boost_INCLUDE_DIRS})
+ PRIVATE ${Boost_INCLUDE_DIRS}
+ PRIVATE ${PROJECT_BINARY_DIR}/include
+)
target_link_libraries(configuration
Qt5::Core Qt5::Widgets
diff --git a/lib/configuration/configuration.cpp b/lib/configuration/configuration.cpp
index 25f783c..99efb14 100644
--- a/lib/configuration/configuration.cpp
+++ b/lib/configuration/configuration.cpp
@@ -12,14 +12,14 @@
#include <boost/algorithm/string/predicate.hpp>
#include <iostream>
#include <QCoreApplication>
-#include "defaults.h"
+#include "config.h"
namespace po = boost::program_options;
inline std::string defaultUserConfigLocation()
{
-#ifdef Path_Config
- return Path_Config;
+#ifdef CONFIG_PATH_CONFIG
+ return CONFIG_PATH_CONFIG;
#else
// try to locate an existing config
QString path = QStandardPaths::locate(QStandardPaths::ConfigLocation, "smolbote/smolbote.cfg");
@@ -55,14 +55,16 @@ Configuration::Configuration(QObject *parent)
("browser.locale", po::value<std::string>(), "Set Qt localization.")
("browser.translation", po::value<std::string>(), "Set application localization.")
- ("browser.crash.path", po::value<std::string>()->default_value(Path_Crashdump))
- ("browser.crash.handler", po::value<std::string>())
+#ifdef CONFIG_USEBREAKPAD
+ ("browser.crash.path", po::value<std::string>()->default_value(CONFIG_PATH_CRASHDUMP))
+ ("browser.crash.handler", po::value<std::string>()->default_value(CONFIG_PATH_CRASHHANDLER))
+#endif
// main window ui
("mainwindow.height", po::value<int>()->default_value(720))
("mainwindow.width", po::value<int>()->default_value(1280))
("mainwindow.maximized", po::value<bool>()->default_value(true))
- ("mainwindow.title", po::value<std::string>()->default_value("smolbote"))
+ ("mainwindow.title", po::value<std::string>()->default_value(CONFIG_POI_NAME))
// main window shortcuts
("mainwindow.shortcuts.newGroup", po::value<std::string>()->default_value("Ctrl+G"))
@@ -100,7 +102,7 @@ Configuration::Configuration(QObject *parent)
("subwindow.shortcuts.fullscreen", po::value<std::string>()->default_value("F11"))
// Filter settings
- ("filter.hosts", po::value<std::string>()->default_value(Path_Filter))
+ ("filter.hosts", po::value<std::string>()->default_value(CONFIG_PATH_FILTER))
("filter.adblock", po::value<std::string>())
("filter.header", po::value<std::vector<std::string>>())
// ("filter.cookies.block.all", po::value<bool>()->default_value(false))
@@ -108,22 +110,22 @@ Configuration::Configuration(QObject *parent)
// ("filter.cookies.path", po::value<std::string>()->default_value("~/.config/smolbote/cookies.d"))
// Plugin settings
- ("plugins.path", po::value<std::string>()->default_value(Path_Plugins))
+ ("plugins.path", po::value<std::string>()->default_value(CONFIG_PATH_PLUGINS))
// Profile settings
// default profile name the browser should use; "" is off-the-record
("profile.default", po::value<std::string>()->default_value(""))
- ("profile.path", po::value<std::string>()->default_value(Path_Profiles))
+ ("profile.path", po::value<std::string>()->default_value(CONFIG_PATH_PROFILES))
("profile.search", po::value<std::string>()->default_value("https://duckduckgo.com/?q=%1&ia=web"))
("profile.homepage", po::value<std::string>()->default_value("about:blank"))
("profile.newtab", po::value<std::string>()->default_value("about:blank"))
// Bookmark settings
- ("bookmarks.path", po::value<std::string>()->default_value(Path_Bookmarks))
+ ("bookmarks.path", po::value<std::string>()->default_value(CONFIG_PATH_BOOKMARKS))
("bookmarks.shortcut", po::value<std::string>()->default_value("Ctrl+B"))
// Downloads settings
- ("downloads.path", po::value<std::string>()->default_value(Path_Downloads))
+ ("downloads.path", po::value<std::string>()->default_value(CONFIG_PATH_DOWNLOADS))
("downloads.shortcut", po::value<std::string>()->default_value("Ctrl+D"))
;
}
diff --git a/linux/.config b/linux/.config
index 09b5a4a..e04f44a 100644
--- a/linux/.config
+++ b/linux/.config
@@ -1,57 +1,47 @@
-#
-# Automatically generated file; DO NOT EDIT.
-# smolbote configuration
-#
+# Generated by Kconfiglib (https://github.com/ulfalizer/Kconfiglib)
#
-# Build
+# Build system settings
#
#
-# Compiler settings
+# Install paths
#
-CONFIG_CXX_FLAGS="-pipe -fstack-protector-strong -fno-plt -fPIE"
-CONFIG_CXX_FLAGS_DEBUG=""
-CONFIG_CXX_FLAGS_RELEASE=""
+CONFIG_INSTALL_BINDIR="bin"
+CONFIG_INSTALL_LIBDIR="lib64/smolbote"
+CONFIG_INSTALL_PLUGINDIR="lib64/smolbote/plugins"
#
-# Install paths
+# Application Settings
#
-CONFIG_INSTALL_PREFIX=""
-CONFIG_INSTALL_BIN="bin"
-CONFIG_INSTALL_LIB="lib/smolbote"
#
-# Branding
+# Application
#
CONFIG_POI_NAME="smolbote"
CONFIG_POI_EXE="poi"
-
-#
-# Browser configuration
-#
+CONFIG_POI_ICON=":/icon.svg"
#
# Configuration defaults
#
CONFIG_PATH_CONFIG="~/.config/smolbote/smolbote.cfg"
-CONFIG_PATH_CRASHDUMP="~/.config/smolbote/crash.d"
CONFIG_PATH_FILTER="~/.config/smolbote/hosts.d"
CONFIG_PATH_PLUGINS="~/.config/smolbote/plugins.d"
CONFIG_PATH_PROFILES="~/.config/smolbote/profiles.d"
CONFIG_PATH_BOOKMARKS="~/.config/smolbote/bookmarks.xbel"
CONFIG_PATH_DOWNLOADS="~/Downloads"
CONFIG_USEPLASMA=y
-# CONFIG_USEBREAKPAD is not set
#
-# Devel
+# KDE Integration
#
-CONFIG_QTWARNINGS=y
-CONFIG_TESTS=y
-# CONFIG_LLVMLIBCPP is not set
+# CONFIG_PLASMA_BLUR is not set
+CONFIG_WALLET_FOLDER="smolbote"
+# CONFIG_USEBREAKPAD is not set
#
# Workarounds
#
-CONFIG_QTBUG-62511=y
+CONFIG_QTBUG_62511=y
+CONFIG_QTBUG_65223=y
diff --git a/plugins/ConfigurationEditor/CMakeLists.txt b/plugins/ConfigurationEditor/CMakeLists.txt
index 5f66e13..7eb6de4 100644
--- a/plugins/ConfigurationEditor/CMakeLists.txt
+++ b/plugins/ConfigurationEditor/CMakeLists.txt
@@ -24,7 +24,7 @@ target_link_libraries(ConfigurationEditorPlugin
)
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
- install(TARGETS ConfigurationEditorPlugin RUNTIME DESTINATION ${CONFIG_INSTALL_LIB} CONFIGURATIONS Release)
+ install(TARGETS ConfigurationEditorPlugin RUNTIME DESTINATION ${CONFIG_INSTALL_PLUGINDIR} CONFIGURATIONS Release)
else()
- install(TARGETS ConfigurationEditorPlugin LIBRARY DESTINATION ${CONFIG_INSTALL_LIB} CONFIGURATIONS Release)
+ install(TARGETS ConfigurationEditorPlugin LIBRARY DESTINATION ${CONFIG_INSTALL_PLUGINDIR} CONFIGURATIONS Release)
endif()
diff --git a/plugins/ProfileEditor/CMakeLists.txt b/plugins/ProfileEditor/CMakeLists.txt
index 6f16b48..25a9638 100644
--- a/plugins/ProfileEditor/CMakeLists.txt
+++ b/plugins/ProfileEditor/CMakeLists.txt
@@ -41,7 +41,7 @@ target_link_libraries(ProfileEditorPlugin
)
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
- install(TARGETS ProfileEditorPlugin RUNTIME DESTINATION ${CONFIG_INSTALL_LIB} CONFIGURATIONS Release)
+ install(TARGETS ProfileEditorPlugin RUNTIME DESTINATION ${CONFIG_INSTALL_PLUGINDIR} CONFIGURATIONS Release)
else()
- install(TARGETS ProfileEditorPlugin LIBRARY DESTINATION ${CONFIG_INSTALL_LIB} CONFIGURATIONS Release)
+ install(TARGETS ProfileEditorPlugin LIBRARY DESTINATION ${CONFIG_INSTALL_PLUGINDIR} CONFIGURATIONS Release)
endif()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 975cc1b..fbb71aa 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -57,24 +57,27 @@ set(srclist
${PROJECT_SOURCE_DIR}/include/browserinterface.h
)
-if(CONFIG_QTBUG-62511)
+if(DEFINED QTBUG-62511)
set_property(SOURCE ${PROJECT_SOURCE_DIR}/data/resources.qrc PROPERTY AUTORCC_OPTIONS "--format-version=1")
-endif(CONFIG_QTBUG-62511)
+endif()
# if you are using a custom build location for breakpad:
#if(CONFIG_USEBREAKPAD)
# link_directories("${BREAKPAD_LIBRARY_DIRS}")
#endif(CONFIG_USEBREAKPAD)
-if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
+if(WIN32)
add_executable(${CONFIG_POI_EXE} WIN32 ${srclist} ${PROJECT_SOURCE_DIR}/data/windows.rc)
else()
add_executable(${CONFIG_POI_EXE} ${srclist})
endif()
+add_dependencies(${CONFIG_POI_EXE} config_header)
+
target_include_directories(${CONFIG_POI_EXE}
PRIVATE ${Boost_INCLUDE_DIRS}
PRIVATE ${PROJECT_SOURCE_DIR}/include
+ PRIVATE ${PROJECT_BINARY_DIR}/include
PRIVATE ${PROJECT_SOURCE_DIR}/lib
PRIVATE ${PROJECT_SOURCE_DIR}/plugins
)
@@ -104,9 +107,6 @@ endif(CONFIG_USEPLASMA)
target_compile_definitions(${CONFIG_POI_EXE}
PRIVATE QAPPLICATION_CLASS=QApplication
- PRIVATE POI_NAME="${CONFIG_POI_NAME}"
- PRIVATE QTBUG_65223_WORKAROUND
- #PRIVATE QTBUG_68224_WORKAROUND
)
-install(TARGETS ${CONFIG_POI_EXE} RUNTIME DESTINATION ${CONFIG_INSTALL_BIN} CONFIGURATIONS Release)
+install(TARGETS ${CONFIG_POI_EXE} RUNTIME DESTINATION ${CONFIG_INSTALL_BINDIR} CONFIGURATIONS Release)
diff --git a/src/Kconfig b/src/Kconfig
new file mode 100644
index 0000000..fcecdea
--- /dev/null
+++ b/src/Kconfig
@@ -0,0 +1,82 @@
+menu "Application"
+ config POI_NAME
+ string "Application name"
+ default "smolbote"
+ config POI_EXE
+ string "Executable name"
+ default "poi"
+ config POI_ICON
+ string "Path to icon"
+ default ":/icons/poi.svg"
+endmenu
+
+menu "Configuration defaults"
+ config PATH_CONFIG
+ string "Configuration location"
+ default "~/.config/smolbote/smolbote.cfg"
+ config PATH_FILTER
+ string "Host filter path"
+ default "~/.config/smolbote/hosts.d"
+ config PATH_PLUGINS
+ string "Plugin load location"
+ default "~/.config/smolbote/plugins.d"
+ config PATH_PROFILES
+ string "Profile load location"
+ default "~/.config/smolbote/profiles.d"
+ config PATH_BOOKMARKS
+ string "Bookmarks location"
+ default "~/.config/smolbote/bookmarks.xbel"
+ config PATH_DOWNLOADS
+ string "Downloads location"
+ default "~/Downloads"
+endmenu
+
+config USEPLASMA
+ bool "Enable KDE Frameworks integration"
+ default n
+ select SHOW_KDE_INTEGRATION
+ help
+ This is a help message
+
+menu "KDE Integration"
+ depends on USEPLASMA
+
+ config PLASMA_BLUR
+ bool "Enable translucent background and blur behind window"
+ default n
+
+ config WALLET_FOLDER
+ string "KDE Wallet folder name"
+ default "smolbote"
+endmenu
+
+config USEBREAKPAD
+ bool "Enable Breakpad integration"
+ default n
+
+menu "Breakpad Integration"
+ depends on USEBREAKPAD
+
+ config PATH_CRASHDUMP
+ string "Crash dump location"
+ default "~/.config/smolbote/crash.d"
+
+ config PATH_CRASHHANDLER
+ string "Crash handler location"
+ default ""
+endmenu
+
+menu "Workarounds"
+ config QTBUG_62511
+ bool "Use RCC version 1 format"
+ default y
+ help
+ See QTBUG-62511: rcc embeds time in output
+
+ config QTBUG_65223
+ bool "Manually emit loadFinished"
+ default y
+ help
+ See QTBUG-65223: loadStarted is emitted twice when loading link with anchor
+
+endmenu
diff --git a/src/browser.cpp b/src/browser.cpp
index 27dda2b..cf39c4e 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -30,12 +30,13 @@
#include "webengine/filter.h"
#include <QPluginLoader>
#include <plugininterface.h>
+#include "config.h"
Browser::Browser(int &argc, char *argv[], bool allowSecondary)
: SingleApplication(argc, argv, allowSecondary, SingleApplication::User | SingleApplication::SecondaryNotification | SingleApplication::ExcludeAppVersion)
{
- setApplicationName(POI_NAME);
- setWindowIcon(QIcon(":/icon.svg"));
+ setApplicationName(CONFIG_POI_NAME);
+ setWindowIcon(QIcon(CONFIG_POI_ICON));
setApplicationVersion(poi_Version);
}
diff --git a/src/webengine/webpage.cpp b/src/webengine/webpage.cpp
index 1c5e659..0e1238a 100644
--- a/src/webengine/webpage.cpp
+++ b/src/webengine/webpage.cpp
@@ -91,33 +91,6 @@ bool WebPage::certificateError(const QWebEngineCertificateError &certificateErro
return resp == QMessageBox::Ignore;
}
-#ifdef QTBUG_68224_WORKAROUND
-bool WebPage::acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame)
-{
- /* Workaround for https://bugreports.qt.io/browse/QTBUG-68224
- * Only affects 5.11.0; should be fixed in 5.11.1
- */
-
- auto *layout = this->view()->layout();
- auto count = layout->count();
-
- if(count > 1) {
- for(int i = 0; i < count; ++i) {
- auto *item = layout->itemAt(i);
- if(item == nullptr)
- continue;
- auto *widget = item->widget();
- if(widget != this->view()->focusProxy()) {
- //qDebug("Removing widget");
- layout->removeWidget(widget);
- }
- }
- }
-
- return true;
-}
-#endif
-
void WebPage::featurePermissionDialog(const QUrl &securityOrigin, QWebEnginePage::Feature feature)
{
QMessageBox messageBox;
diff --git a/src/webengine/webpage.h b/src/webengine/webpage.h
index a24370e..48011cb 100644
--- a/src/webengine/webpage.h
+++ b/src/webengine/webpage.h
@@ -19,9 +19,6 @@ public:
protected:
bool certificateError(const QWebEngineCertificateError &certificateError) override;
-#ifdef QTBUG_68224_WORKAROUND
- bool acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame) override;
-#endif
private slots:
void featurePermissionDialog(const QUrl &securityOrigin, QWebEnginePage::Feature feature);
diff --git a/src/webengine/webview.cpp b/src/webengine/webview.cpp
index 59ad32a..671b32f 100644
--- a/src/webengine/webview.cpp
+++ b/src/webengine/webview.cpp
@@ -24,6 +24,7 @@
#include <web/webprofile.h>
#include "browser.h"
#include "wallet/wallet.h"
+#include "config.h"
inline QAction *historyAction(QWebEngineView *view, const QWebEngineHistoryItem &item)
{
@@ -56,7 +57,7 @@ WebView::WebView(WebProfile *profile, QWidget *parent)
m_loaded = true;
});
-#if defined(QTBUG_65223_WORKAROUND)
+#ifdef CONFIG_QTBUG_65223
connect(this, &QWebEngineView::loadProgress, this, [this](int progress) {
if(progress == 100) {
emit loadFinished(true);
diff --git a/tools/Kconfiglib b/tools/Kconfiglib
new file mode 160000
+Subproject 5d918357dd5734b900e1fdf074090ea662debd9
diff --git a/tools/config.py b/tools/config.py
new file mode 100755
index 0000000..22defdd
--- /dev/null
+++ b/tools/config.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python3
+
+import argparse
+from Kconfiglib import kconfiglib
+
+def search(node, term):
+ while node:
+ if isinstance(node.item, kconfiglib.Symbol):
+ if node.item.name == term:
+ return node.item.str_value
+
+ if node.list:
+ r = search(node.list, term)
+ if r is not None:
+ return r
+
+ node = node.next
+
+def searchBug(node, term):
+ bugs = ""
+
+ while node:
+ if isinstance(node.item, kconfiglib.Symbol):
+ if node.item.name.startswith(term):
+ if bugs is not "":
+ bugs += ";"
+ bugs += node.item.name
+
+ if node.list:
+ r = searchBug(node.list, term)
+ if r is not None and r is not "":
+ if bugs is not "":
+ bugs += ";"
+ bugs += r
+
+ node = node.next
+ return bugs
+
+def main(args):
+ kconf = kconfiglib.Kconfig(args.kconfig)
+ if args.dotconfig is not None:
+ kconf.load_config(args.dotconfig)
+
+ i = ""
+ if args.setting.endswith("BUG"):
+ i = searchBug(kconf.top_node, args.setting)
+ else:
+ i = search(kconf.top_node, args.setting)
+
+ if i is not None:
+ print(i)
+
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser()
+
+ parser.add_argument("--kconfig", metavar="Kconfig", nargs="?", default="Kconfig", help="Top-level Kconfig file (default: Kconfig)")
+
+ parser.add_argument("--dotconfig", metavar="dotconfig", nargs="?", help=".config")
+
+ parser.add_argument("setting", metavar="CONFIG_KEY", nargs="?", help="Top-level Kconfig file (default: Kconfig)")
+
+ args = parser.parse_args()
+ main(args)