diff options
-rw-r--r-- | doc/Building/QtWebEngine.md | 7 | ||||
-rw-r--r-- | doc/Building/smolbote.md (renamed from doc/Building.md) | 12 | ||||
-rw-r--r-- | doc/Usage/CommandLine.md | 12 | ||||
-rw-r--r-- | doc/Usage/Configuration.md | 53 | ||||
-rw-r--r-- | doc/Usage/Profile.md (renamed from doc/Profile.md) | 0 | ||||
-rw-r--r-- | doc/Usage/Session.md (renamed from doc/Session.md) | 0 | ||||
-rw-r--r-- | lib/configuration/CMakeLists.txt | 6 | ||||
-rw-r--r-- | lib/configuration/configuration.cpp | 14 | ||||
-rw-r--r-- | lib/configuration/defaults.h.in | 13 | ||||
-rw-r--r-- | lib/configuration/defaults.h.linux | 10 | ||||
-rw-r--r-- | lib/configuration/defaults.h.win32 | 12 | ||||
-rw-r--r-- | vendor.cmake | 33 |
12 files changed, 128 insertions, 44 deletions
diff --git a/doc/Building/QtWebEngine.md b/doc/Building/QtWebEngine.md new file mode 100644 index 0000000..7d72dd6 --- /dev/null +++ b/doc/Building/QtWebEngine.md @@ -0,0 +1,7 @@ +- download qtwebengine + +~~~sh +mkdir build && cd build +qmake ../qtwebengine-version-source/qtwebengine.pro +make +~~~ diff --git a/doc/Building.md b/doc/Building/smolbote.md index ab731dc..e40132c 100644 --- a/doc/Building.md +++ b/doc/Building/smolbote.md @@ -1,13 +1,15 @@ ## Customizing -### Version +Set through vendor.cmake. + +### Configuration defaults + +### Version information +Building without git metadata requires the version be set in vendor.cmake. -### Configuration -Configuration values are set from defaults.h, which is generated from -defaults.h.{linux;win32}. ## Building on Windows -~~~ +~~~sh set INSTALL_DIR="C:\projects\smolbote-install" mkdir %INSTALL_DIR% diff --git a/doc/Usage/CommandLine.md b/doc/Usage/CommandLine.md new file mode 100644 index 0000000..1c532ce --- /dev/null +++ b/doc/Usage/CommandLine.md @@ -0,0 +1,12 @@ +## Command-line options + +### General +* `-h`, `--help`: Display this help. +* `-v`, `--version`: Display version information. +* `--build`: Display build branch and commit. +* `-c`, `--config`: Set configuration file. +* `--no-remote`: Don't check for other instances when starting. + +### Tweaking configuration +You can overwrite options at runtime using the option path as a command line +parameter. diff --git a/doc/Usage/Configuration.md b/doc/Usage/Configuration.md new file mode 100644 index 0000000..3bf55b9 --- /dev/null +++ b/doc/Usage/Configuration.md @@ -0,0 +1,53 @@ +## Configuration + +The Configuration is loaded from _~/.config/smolbote/smolbote.cfg_. Most +settings are only loaded on launch. + +For a full list of settings, check `--help`. + +### Browser (group: browser) + +### Main Window (group: mainwindow) +A main window contains one or more subwindows. + +### Subwindow (group: window) +A subwindow contains multiple tabs and functions similarly to a tab group. + +### Navigation bar (group: navigation) +The navigation bar is the toolbar that holds the history, reload and home +buttons, as well as the address bar. It can be made movable through the +navigation.movable option. + +### Address bar (group: addressbar) + +### Filter (group: filter) + +### Plugins (group: plugins) +Plugins a way of extending smolbote's functionality using the Qt plugin system. +They are not to be confused with NPAPI/PPAPI or WebExtension plugins. + +To enable a plugin either copy it or symlink it in the plugins.path location, +or set its absolute path as the plugins.path. + +### Profiles (group: profile) +A Profile is a collection of settings, policies, scripts, cookies, cache and +history. Profiles can be used to isolate pages from each other. + +Each window has a default profile it uses when opening new tabs. This can be +set by the profile.default option, and can be changed from the window's menu. +Additionally, tabs can have their profiles individually changed from their page +menu. + +Because profiles store all their data separately, you can log in into the same +site with a different account from each profile. However, links opened into new +tabs will still use the subwindow's default profile. For example, you can set a +profile to hold login information for a site, but all new tabs opened from that +site would still be using the default off-the-record profile. + +Profile definitions are stored in the profiles.path location. To create a new +profile, create a profile-id.profile file in that location. + +### Bookmarks (group: bookmarks) + +### Downloads (group: downloads) + diff --git a/doc/Profile.md b/doc/Usage/Profile.md index d205a86..d205a86 100644 --- a/doc/Profile.md +++ b/doc/Usage/Profile.md diff --git a/doc/Session.md b/doc/Usage/Session.md index 3018253..3018253 100644 --- a/doc/Session.md +++ b/doc/Usage/Session.md diff --git a/lib/configuration/CMakeLists.txt b/lib/configuration/CMakeLists.txt index dc5bf6d..581e1eb 100644 --- a/lib/configuration/CMakeLists.txt +++ b/lib/configuration/CMakeLists.txt @@ -6,11 +6,7 @@ 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() +configure_file(defaults.h.in ${PROJECT_BINARY_DIR}/lib/configuration/defaults.h) add_library(configuration configuration.cpp diff --git a/lib/configuration/configuration.cpp b/lib/configuration/configuration.cpp index 9931ec5..a61247b 100644 --- a/lib/configuration/configuration.cpp +++ b/lib/configuration/configuration.cpp @@ -18,8 +18,8 @@ namespace po = boost::program_options; inline std::string defaultUserConfigLocation() { -#ifdef config_path - return config_path; +#ifdef ConfigPath + return ConfigPath; #else // try to locate an existing config QString path = QStandardPaths::locate(QStandardPaths::ConfigLocation, "smolbote/smolbote.cfg"); @@ -96,7 +96,7 @@ Configuration::Configuration(QObject *parent) ("subwindow.shortcuts.fullscreen", po::value<std::string>()->default_value("F11")) // Filter settings - ("filter.path", po::value<std::string>()->default_value(filter_path)) + ("filter.path", po::value<std::string>()->default_value(FilterPath)) ("filter.adblock", po::value<std::string>()) ("filter.header", po::value<std::vector<std::string>>()) // ("filter.cookies.block.all", po::value<bool>()->default_value(false)) @@ -104,22 +104,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(plugins_path)) + ("plugins.path", po::value<std::string>()->default_value(PluginsPath)) // 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(profiles_path)) + ("profile.path", po::value<std::string>()->default_value(ProfilesPath)) ("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(bookmarks_path)) + ("bookmarks.path", po::value<std::string>()->default_value(BookmarksPath)) ("bookmarks.shortcut", po::value<std::string>()->default_value("Ctrl+B")) // Downloads settings - ("downloads.path", po::value<std::string>()->default_value(downloads_path)) + ("downloads.path", po::value<std::string>()->default_value(DownloadsPath)) ("downloads.shortcut", po::value<std::string>()->default_value("Ctrl+D")) ; } diff --git a/lib/configuration/defaults.h.in b/lib/configuration/defaults.h.in new file mode 100644 index 0000000..8c4b334 --- /dev/null +++ b/lib/configuration/defaults.h.in @@ -0,0 +1,13 @@ +#ifndef SMOLBOTE_DEFAULTS +#define SMOLBOTE_DEFAULTS + +#cmakedefine ConfigPath "@ConfigPath@" + +#cmakedefine FilterPath "@FilterPath@" +#cmakedefine PluginsPath "@PluginsPath@" +#cmakedefine ProfilesPath "@ProfilesPath@" + +#cmakedefine BookmarksPath "@BookmarksPath@" +#cmakedefine DownloadsPath "@DownloadsPath@" + +#endif // SMOLBOTE_DEFAULTS diff --git a/lib/configuration/defaults.h.linux b/lib/configuration/defaults.h.linux deleted file mode 100644 index 983e36b..0000000 --- a/lib/configuration/defaults.h.linux +++ /dev/null @@ -1,10 +0,0 @@ -#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 deleted file mode 100644 index dee9b14..0000000 --- a/lib/configuration/defaults.h.win32 +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef SMOLBOTE_DEFAULTS -#define SMOLBOTE_DEFAULTS - -#define config_path "smolbote.ini" - -#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/vendor.cmake b/vendor.cmake index 45a9f7e..27d9893 100644 --- a/vendor.cmake +++ b/vendor.cmake @@ -9,6 +9,28 @@ set(poi_exe poi) # Application name set(poi_name "smolbote") +## Configuration paths, used in lib/configuration/defaults.h.in +if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + set(ConfigPath "smolbote.ini") + + set(FilterPath "hosts") + set(PluginsPath "plugins") + set(ProfilesPath "profiles") + + set(BookmarksPath "bookmarks.xbel") + set(DownloadsPath "~/Downloads") +else() + set(ConfigPath "~/.config/smolbote/smolbote.cfg") + + set(FilterPath "~/.config/smolbote/hosts.d") + set(PluginsPath "~/.config/smolbote/plugins.d") + set(ProfilesPath "~/.config/smolbote/profiles.d") + + set(BookmarksPath "~/.config/smolbote/bookmarks.xbel") + set(DownloadsPath "~/Downloads") +endif() + + ## Install Paths # Binaries will be installed to ${CMAKE_INSTALL_PREFIX}/${installPath_bin} set(installPath_bin bin) @@ -20,7 +42,7 @@ else() set(installPath_plugin lib/smolbote) endif() -# version information +## Version information, used in src/version.h.in if (EXISTS "${PROJECT_SOURCE_DIR}/.git") execute_process(COMMAND git rev-list --count HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerRevision OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND git rev-parse --short HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerShortId OUTPUT_STRIP_TRAILING_WHITESPACE) @@ -29,10 +51,11 @@ if (EXISTS "${PROJECT_SOURCE_DIR}/.git") execute_process(COMMAND git rev-parse HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerCommit OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND git rev-parse --abbrev-ref HEAD WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerBranch OUTPUT_STRIP_TRAILING_WHITESPACE) else() - set(VerTag "0.2.2") - set(VerDescribe "0.2.2-unknown") - set(VerCommit "00000000") - set(VerBranch "unknown") + message(FATAL_ERROR "Cannot find repository metadata. Please set version information in vendor.cmake") + #set(VerTag "0.2.2") + #set(VerDescribe "0.2.2-unknown") + #set(VerCommit "00000000") + #set(VerBranch "unknown") endif() if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") |