aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-11-29 15:44:40 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2018-11-29 15:44:40 +0100
commite4402ac5ca0966515b00c278bb8c6fa1df07fc66 (patch)
treeb9eaf705eeea19c7bbd218ed2a9e792fcddb7f35
parentRemove old session code (diff)
downloadsmolbote-e4402ac5ca0966515b00c278bb8c6fa1df07fc66.tar.xz
Add --session and --pick-session
-s,--session replaces --browser.session --pick-session shows the SessionDialog instead of creating a session on startup
-rw-r--r--doc/Usage/CommandLine.asciidoc10
-rw-r--r--doc/Usage/Configuration.asciidoc66
-rw-r--r--doc/Usage/Plugins.asciidoc7
-rw-r--r--doc/meson.build2
-rw-r--r--doc/smolbote.7.asciidoc4
-rw-r--r--lib/configuration/Kconfig4
-rw-r--r--lib/configuration/configuration.cpp11
-rw-r--r--linux/.config1
-rw-r--r--src/main.cpp15
9 files changed, 54 insertions, 66 deletions
diff --git a/doc/Usage/CommandLine.asciidoc b/doc/Usage/CommandLine.asciidoc
index a21b7c2..00a8d6c 100644
--- a/doc/Usage/CommandLine.asciidoc
+++ b/doc/Usage/CommandLine.asciidoc
@@ -1,8 +1,14 @@
== Command-line Options
=== General
-* `-h`, `--help`: Display this help.
+* `-h`, `--help`: Display command-line options list..
* `-v`, `--version`: Display version information.
-* `--build`: Display build branch and commit.
+* `--build`: Display build commit.
+
+=== Configuration
* `-c`, `--config`: Set configuration file.
* `--no-remote`: Don't check for other instances when starting.
+
+=== Sessions
+* `-s, --session`: Open the selected session.
+* `--pick-session`: Open all available sessions and select which one to open.
diff --git a/doc/Usage/Configuration.asciidoc b/doc/Usage/Configuration.asciidoc
index 44e6b92..b1dbec5 100644
--- a/doc/Usage/Configuration.asciidoc
+++ b/doc/Usage/Configuration.asciidoc
@@ -1,56 +1,14 @@
== 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'.
-
-You can overwrite options at runtime using the option path as a command line
-parameter.
-
-- 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)
-
+The Configuration is loaded from the path specified by `--config`, by default
+_~/.config/smolbote/smolbote.cfg_.
+
+You can set the value of configuration options using its name in a key=value
+pair, for example:
+[source, ini]
+----
+mainwindow.height=600
+----
+For a full list of options, check `--help`.
+
+You can overwrite options at runtime using the option name as a parameter.
diff --git a/doc/Usage/Plugins.asciidoc b/doc/Usage/Plugins.asciidoc
new file mode 100644
index 0000000..1f2d3a0
--- /dev/null
+++ b/doc/Usage/Plugins.asciidoc
@@ -0,0 +1,7 @@
+== 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.
+
diff --git a/doc/meson.build b/doc/meson.build
index 0e1b49d..6e51e39 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -2,6 +2,8 @@ if get_option('manpage').enabled()
asciidoctor = find_program('asciidoctor', required: true)
custom_target('manpage',
+ # list depend_files so the output can be updated if any of them are changed
+ depend_files: ['smolbote.7.asciidoc', 'Usage/CommandLine.asciidoc', 'Usage/Configuration.asciidoc', 'Usage/Profile.asciidoc', 'Usage/Plugins.asciidoc', 'Usage/Filter.asciidoc'],
input: 'smolbote.7.asciidoc',
output: 'smolbote.7',
command: [asciidoctor, '--backend=manpage', '--out-file=@OUTPUT@', '@INPUT@'],
diff --git a/doc/smolbote.7.asciidoc b/doc/smolbote.7.asciidoc
index ec1150f..a950816 100644
--- a/doc/smolbote.7.asciidoc
+++ b/doc/smolbote.7.asciidoc
@@ -21,6 +21,10 @@ include::Usage/Configuration.asciidoc[]
include::Usage/Profile.asciidoc[]
+include::Usage/Plugins.asciidoc[]
+
+include::Usage/Filter.asciidoc[]
+
== Copyright
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as
diff --git a/lib/configuration/Kconfig b/lib/configuration/Kconfig
index 3e77434..b165093 100644
--- a/lib/configuration/Kconfig
+++ b/lib/configuration/Kconfig
@@ -1,4 +1,3 @@
-
menu "Configuration defaults"
config PATH_CONFIG
string "Configuration location"
@@ -18,6 +17,9 @@ menu "Configuration defaults"
config PATH_DOWNLOADS
string "Downloads location"
default "~/Downloads"
+ config PATH_SESSION
+ string "Session location"
+ default "~/.config/smolbote/session.d"
endmenu
menu "Keyboard shortcuts"
diff --git a/lib/configuration/configuration.cpp b/lib/configuration/configuration.cpp
index 398044b..98ab20a 100644
--- a/lib/configuration/configuration.cpp
+++ b/lib/configuration/configuration.cpp
@@ -37,13 +37,16 @@ Configuration::Configuration(QObject *parent)
, m_homePath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation).toStdString())
{
commandLine_desc.add_options()
- ("help,h", "Display this help.")
+ ("help,h", "Display command-line options list.")
("version,v", "Display version information.")
- ("build", "Display build branch and commit.")
+ ("build", "Display build commit.")
("config,c", po::value<std::string>()->default_value(defaultUserConfigLocation()), "Set the configuration file.")
("no-remote", "Do not accept or send remote commands.")
+ ("session,s", po::value<std::string>(), "Open the selected session.")
+ ("pick-session", "Show all available sessions and select which one to open.")
+
("args", po::value<std::vector<std::string>>(), "Command(s) and/or URL(s).")
;
@@ -51,11 +54,11 @@ Configuration::Configuration(QObject *parent)
configuration_desc.add_options()
("browser.stylesheet", po::value<std::string>())
- ("browser.session", po::value<std::string>(), "Load session data from specified arg.")
("browser.locale", po::value<std::string>(), "Set Qt localization.")
("browser.translation", po::value<std::string>(), "Set application localization.")
- ("browser.session.path", po::value<std::string>()->default_value("~/.config/smolbote/session.d"))
+ // sessions
+ ("browser.session.path", po::value<std::string>()->default_value(CONFIG_PATH_SESSION))
#ifdef CONFIG_USEBREAKPAD
("browser.crash.path", po::value<std::string>()->default_value(CONFIG_PATH_CRASHDUMP))
diff --git a/linux/.config b/linux/.config
index 42e015b..3a2c718 100644
--- a/linux/.config
+++ b/linux/.config
@@ -15,6 +15,7 @@ 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_PATH_SESSION="~/.config/smolbote/session.d"
#
# Keyboard shortcuts
diff --git a/src/main.cpp b/src/main.cpp
index 34f8a1a..7cc8757 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -9,6 +9,7 @@
#include "browser.h"
#include "configuration.h"
#include "session/session.h"
+#include "session/sessiondialog.h"
#include "util.h"
#include <QFile>
#include <QLibraryInfo>
@@ -205,10 +206,11 @@ int main(int argc, char **argv)
}
// command line arguments
- bool isStandalone = config->exists("no-remote");
- auto arguments = config->value<std::vector<std::string>>("args");
- auto session = config->value<QString>("browser.session");
- auto profile = config->value<QString>("profile.default");
+ const bool isStandalone = config->exists("no-remote");
+ const auto arguments = config->value<std::vector<std::string>>("args");
+ const bool pickSession = config->exists("pick-session");
+ const auto session = config->value<QString>("session");
+ const auto profile = config->value<QString>("profile.default");
app.setConfiguration(config);
app.setup(plugins);
@@ -235,7 +237,10 @@ int main(int argc, char **argv)
});
}
- {
+ if(pickSession) {
+ auto *dlg = new SessionDialog();
+ dlg->exec();
+ } else {
QJsonObject sessionData;
if(session) {
QFile sessionJson(session.value());