aboutsummaryrefslogtreecommitdiff
path: root/src
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 /src
parentHostlist test: test non-empty domain (diff)
downloadsmolbote-88492823826b3720be4ba29d246848031418bfb5.tar.xz
Add Kconfiglib to parse Kconfig/.config
Diffstat (limited to 'src')
-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
6 files changed, 94 insertions, 40 deletions
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);