From 2c20acb1981fc8fbd884dbece2a1115ca37732d2 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Wed, 19 Sep 2018 23:35:43 +0200 Subject: Update documentation --- doc/Building.md | 28 -------------------- doc/Building/QtWebEngine.md | 7 +++++ doc/Building/smolbote.md | 30 +++++++++++++++++++++ doc/Profile.md | 17 ------------ doc/Session.md | 30 --------------------- doc/Usage/CommandLine.md | 12 +++++++++ doc/Usage/Configuration.md | 53 +++++++++++++++++++++++++++++++++++++ doc/Usage/Profile.md | 17 ++++++++++++ doc/Usage/Session.md | 30 +++++++++++++++++++++ lib/configuration/CMakeLists.txt | 6 +---- lib/configuration/configuration.cpp | 14 +++++----- lib/configuration/defaults.h.in | 13 +++++++++ lib/configuration/defaults.h.linux | 10 ------- lib/configuration/defaults.h.win32 | 12 --------- vendor.cmake | 33 +++++++++++++++++++---- 15 files changed, 198 insertions(+), 114 deletions(-) delete mode 100644 doc/Building.md create mode 100644 doc/Building/QtWebEngine.md create mode 100644 doc/Building/smolbote.md delete mode 100644 doc/Profile.md delete mode 100644 doc/Session.md create mode 100644 doc/Usage/CommandLine.md create mode 100644 doc/Usage/Configuration.md create mode 100644 doc/Usage/Profile.md create mode 100644 doc/Usage/Session.md create mode 100644 lib/configuration/defaults.h.in delete mode 100644 lib/configuration/defaults.h.linux delete mode 100644 lib/configuration/defaults.h.win32 diff --git a/doc/Building.md b/doc/Building.md deleted file mode 100644 index ab731dc..0000000 --- a/doc/Building.md +++ /dev/null @@ -1,28 +0,0 @@ -## 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% - -mkdir C:\projects\smolbote-build -cd C:\projects\smolbote-build - -set QT="C:\Qt\5.11.0\msvc2017_64" -set BOOST_ROOT="C:\Libraries\boost_1_66_0" -set BOOST_LIBDIR="C:\Libraries\boost_1_66_0\lib64-msvc-14.1" -cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DCMAKE_PREFIX_PATH=%QT%;%BOOST_ROOT% -DBOOST_ROOT=%BOOST_ROOT% -DBOOST_LIBRARYDIR=%BOOST_LIBDIR% -DBoost_USE_STATIC_LIBS=On C:\projects\smolbote-hg -cmake --build . --target poi --config Release -cmake --build . --target install --config Release -cd %INSTALL_DIR% -C:\Qt\5.10.1\msvc2017_64\bin\windeployqt.exe bin\poi.exe - -7z a C:\projects\smolbote-hg\smolbote.7z %INSTALL_DIR% -~~~ - 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/smolbote.md b/doc/Building/smolbote.md new file mode 100644 index 0000000..e40132c --- /dev/null +++ b/doc/Building/smolbote.md @@ -0,0 +1,30 @@ +## Customizing +Set through vendor.cmake. + +### Configuration defaults + +### Version information +Building without git metadata requires the version be set in vendor.cmake. + + +## Building on Windows + +~~~sh +set INSTALL_DIR="C:\projects\smolbote-install" +mkdir %INSTALL_DIR% + +mkdir C:\projects\smolbote-build +cd C:\projects\smolbote-build + +set QT="C:\Qt\5.11.0\msvc2017_64" +set BOOST_ROOT="C:\Libraries\boost_1_66_0" +set BOOST_LIBDIR="C:\Libraries\boost_1_66_0\lib64-msvc-14.1" +cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DCMAKE_PREFIX_PATH=%QT%;%BOOST_ROOT% -DBOOST_ROOT=%BOOST_ROOT% -DBOOST_LIBRARYDIR=%BOOST_LIBDIR% -DBoost_USE_STATIC_LIBS=On C:\projects\smolbote-hg +cmake --build . --target poi --config Release +cmake --build . --target install --config Release +cd %INSTALL_DIR% +C:\Qt\5.10.1\msvc2017_64\bin\windeployqt.exe bin\poi.exe + +7z a C:\projects\smolbote-hg\smolbote.7z %INSTALL_DIR% +~~~ + diff --git a/doc/Profile.md b/doc/Profile.md deleted file mode 100644 index d205a86..0000000 --- a/doc/Profile.md +++ /dev/null @@ -1,17 +0,0 @@ -Profiles are read from profile.path - -## Settings - -- otr (defaults to true) - is this profile off-the-record -- name (defaults to the configuration file name) -- search (defaults to profile.search) - search engine url -- homepage (defaults to profile.homepage) -- newtab (defaults to profile.newtab) - -### Properties -Key is property name; value is property value - -### Attributes -see QWebEngineSetting::WebAttribute for list of IDs. -Key is attribute id; value is attribute value (true/false) - diff --git a/doc/Session.md b/doc/Session.md deleted file mode 100644 index 3018253..0000000 --- a/doc/Session.md +++ /dev/null @@ -1,30 +0,0 @@ -## Session format -A session is a single window, which contains a list of subwindows. - -Each subwindow has a profile (profile id), and a list of tabs. - -Each tab has a profile (profile id) and url. - -~~~json -{ - "subwindows": [ - { - "profile": "", - "tabs": [ - { - "profile": "", - "url": "" - }, - { - ... - } - ] - } - ] -} - -~~~ - -## --session -This command-line option causes the browser to load the specified json file. - 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/Usage/Profile.md b/doc/Usage/Profile.md new file mode 100644 index 0000000..d205a86 --- /dev/null +++ b/doc/Usage/Profile.md @@ -0,0 +1,17 @@ +Profiles are read from profile.path + +## Settings + +- otr (defaults to true) - is this profile off-the-record +- name (defaults to the configuration file name) +- search (defaults to profile.search) - search engine url +- homepage (defaults to profile.homepage) +- newtab (defaults to profile.newtab) + +### Properties +Key is property name; value is property value + +### Attributes +see QWebEngineSetting::WebAttribute for list of IDs. +Key is attribute id; value is attribute value (true/false) + diff --git a/doc/Usage/Session.md b/doc/Usage/Session.md new file mode 100644 index 0000000..3018253 --- /dev/null +++ b/doc/Usage/Session.md @@ -0,0 +1,30 @@ +## Session format +A session is a single window, which contains a list of subwindows. + +Each subwindow has a profile (profile id), and a list of tabs. + +Each tab has a profile (profile id) and url. + +~~~json +{ + "subwindows": [ + { + "profile": "", + "tabs": [ + { + "profile": "", + "url": "" + }, + { + ... + } + ] + } + ] +} + +~~~ + +## --session +This command-line option causes the browser to load the specified json file. + 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()->default_value("F11")) // Filter settings - ("filter.path", po::value()->default_value(filter_path)) + ("filter.path", po::value()->default_value(FilterPath)) ("filter.adblock", po::value()) ("filter.header", po::value>()) // ("filter.cookies.block.all", po::value()->default_value(false)) @@ -104,22 +104,22 @@ Configuration::Configuration(QObject *parent) // ("filter.cookies.path", po::value()->default_value("~/.config/smolbote/cookies.d")) // Plugin settings - ("plugins.path", po::value()->default_value(plugins_path)) + ("plugins.path", po::value()->default_value(PluginsPath)) // Profile settings // default profile name the browser should use; "" is off-the-record ("profile.default", po::value()->default_value("")) - ("profile.path", po::value()->default_value(profiles_path)) + ("profile.path", po::value()->default_value(ProfilesPath)) ("profile.search", po::value()->default_value("https://duckduckgo.com/?q=%1&ia=web")) ("profile.homepage", po::value()->default_value("about:blank")) ("profile.newtab", po::value()->default_value("about:blank")) // Bookmark settings - ("bookmarks.path", po::value()->default_value(bookmarks_path)) + ("bookmarks.path", po::value()->default_value(BookmarksPath)) ("bookmarks.shortcut", po::value()->default_value("Ctrl+B")) // Downloads settings - ("downloads.path", po::value()->default_value(downloads_path)) + ("downloads.path", po::value()->default_value(DownloadsPath)) ("downloads.shortcut", po::value()->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") -- cgit v1.2.1