aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/Building.md (renamed from doc/Windows.md)9
-rw-r--r--lib/configuration/CMakeLists.txt6
-rw-r--r--lib/configuration/configuration.cpp17
-rw-r--r--lib/configuration/defaults.h.linux10
-rw-r--r--lib/configuration/defaults.h.win3210
-rw-r--r--plugins/ConfigurationEditor/CMakeLists.txt4
-rw-r--r--plugins/ProfileEditor/CMakeLists.txt4
7 files changed, 48 insertions, 12 deletions
diff --git a/doc/Windows.md b/doc/Building.md
index aee65b3..ab731dc 100644
--- a/doc/Windows.md
+++ b/doc/Building.md
@@ -1,3 +1,12 @@
+## Customizing
+### Version
+
+### Configuration
+Configuration values are set from defaults.h, which is generated from
+defaults.h.{linux;win32}.
+
+## Building on Windows
+
~~~
set INSTALL_DIR="C:\projects\smolbote-install"
mkdir %INSTALL_DIR%
diff --git a/lib/configuration/CMakeLists.txt b/lib/configuration/CMakeLists.txt
index ed0235d..dc5bf6d 100644
--- a/lib/configuration/CMakeLists.txt
+++ b/lib/configuration/CMakeLists.txt
@@ -6,6 +6,12 @@ set(CMAKE_AUTOMOC ON)
#set(CMAKE_AUTOUIC ON)
#set(CMAKE_AUTORCC ON)
+if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
+ configure_file(defaults.h.win32 ${PROJECT_BINARY_DIR}/lib/configuration/defaults.h)
+else()
+ configure_file(defaults.h.linux ${PROJECT_BINARY_DIR}/lib/configuration/defaults.h)
+endif()
+
add_library(configuration
configuration.cpp
configuration.h)
diff --git a/lib/configuration/configuration.cpp b/lib/configuration/configuration.cpp
index c7209e3..cae21fd 100644
--- a/lib/configuration/configuration.cpp
+++ b/lib/configuration/configuration.cpp
@@ -12,6 +12,7 @@
#include <boost/algorithm/string/predicate.hpp>
#include <iostream>
#include <QCoreApplication>
+#include "defaults.h"
namespace po = boost::program_options;
@@ -90,28 +91,28 @@ Configuration::Configuration(QObject *parent)
("window.shortcuts.fullscreen", po::value<std::string>()->default_value("F11"))
// Filter settings
- ("filter.path", po::value<std::string>()->default_value("~/.config/smolbote/hosts.d"))
- ("filter.cookies.block.all", po::value<bool>()->default_value(false))
- ("filter.cookies.block.thirdParty", po::value<bool>()->default_value(true))
- ("filter.cookies.path", po::value<std::string>()->default_value("~/.config/smolbote/cookies.d"))
+ ("filter.path", po::value<std::string>()->default_value(filter_path))
+// ("filter.cookies.block.all", po::value<bool>()->default_value(false))
+// ("filter.cookies.block.thirdParty", po::value<bool>()->default_value(true))
+// ("filter.cookies.path", po::value<std::string>()->default_value("~/.config/smolbote/cookies.d"))
// Plugin settings
- ("plugins.path", po::value<std::string>()->default_value("~/.config/smolbote/plugins.d"))
+ ("plugins.path", po::value<std::string>()->default_value(plugins_path))
// 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("~/.config/smolbote/profiles.d"))
+ ("profile.path", po::value<std::string>()->default_value(profiles_path))
("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("~/.config/smolbote/bookmarks.xbel"))
+ ("bookmarks.path", po::value<std::string>()->default_value(bookmarks_path))
("bookmarks.shortcut", po::value<std::string>()->default_value("Ctrl+B"))
// Downloads settings
- ("downloads.path", po::value<std::string>()->default_value("~/Downloads"))
+ ("downloads.path", po::value<std::string>()->default_value(downloads_path))
("downloads.shortcut", po::value<std::string>()->default_value("Ctrl+D"))
;
}
diff --git a/lib/configuration/defaults.h.linux b/lib/configuration/defaults.h.linux
new file mode 100644
index 0000000..983e36b
--- /dev/null
+++ b/lib/configuration/defaults.h.linux
@@ -0,0 +1,10 @@
+#ifndef SMOLBOTE_DEFAULTS
+#define SMOLBOTE_DEFAULTS
+
+#define filter_path "~/.config/smolbote/hosts.d"
+#define plugins_path "~/.config/smolbote/plugins.d"
+#define profiles_path "~/.config/smolbote/profiles.d"
+#define bookmarks_path "~/.config/smolbote/bookmarks.xbel"
+#define downloads_path "~/Downloads"
+
+#endif // SMOLBOTE_DEFAULTS
diff --git a/lib/configuration/defaults.h.win32 b/lib/configuration/defaults.h.win32
new file mode 100644
index 0000000..9a8d5b3
--- /dev/null
+++ b/lib/configuration/defaults.h.win32
@@ -0,0 +1,10 @@
+#ifndef SMOLBOTE_DEFAULTS
+#define SMOLBOTE_DEFAULTS
+
+#define filter_path "hosts"
+#define plugins_path "plugins"
+#define profiles_path "profiles"
+#define bookmarks_path "bookmarks.xbel"
+#define downloads_path "~/Downloads"
+
+#endif // SMOLBOTE_DEFAULTS
diff --git a/plugins/ConfigurationEditor/CMakeLists.txt b/plugins/ConfigurationEditor/CMakeLists.txt
index 2d97cc5..ed88877 100644
--- a/plugins/ConfigurationEditor/CMakeLists.txt
+++ b/plugins/ConfigurationEditor/CMakeLists.txt
@@ -23,8 +23,8 @@ target_link_libraries(ConfigurationEditorPlugin
PRIVATE configuration
)
-if(WIN32)
- install(TARGETS ConfigurationEditorPlugin RUNTIME DESTINATION lib/smolbote CONFIGURATIONS Release)
+if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
+ install(TARGETS ConfigurationEditorPlugin RUNTIME DESTINATION bin/plugins CONFIGURATIONS Release)
else()
install(TARGETS ConfigurationEditorPlugin LIBRARY DESTINATION lib/smolbote CONFIGURATIONS Release)
endif()
diff --git a/plugins/ProfileEditor/CMakeLists.txt b/plugins/ProfileEditor/CMakeLists.txt
index fc7cf96..4f3e026 100644
--- a/plugins/ProfileEditor/CMakeLists.txt
+++ b/plugins/ProfileEditor/CMakeLists.txt
@@ -26,8 +26,8 @@ target_link_libraries(ProfileEditorPlugin
PRIVATE web
)
-if(WIN32)
- install(TARGETS ProfileEditorPlugin RUNTIME DESTINATION lib/smolbote CONFIGURATIONS Release)
+if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
+ install(TARGETS ProfileEditorPlugin RUNTIME DESTINATION bin/plugins CONFIGURATIONS Release)
else()
install(TARGETS ProfileEditorPlugin LIBRARY DESTINATION lib/smolbote CONFIGURATIONS Release)
endif()