aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-11-20 12:59:53 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2018-11-20 12:59:53 +0100
commitdb58900d3d289e2b25112963375edf183dca032f (patch)
tree629b49ebeb26b988706560b0cb965ec5ff04fadc /lib
parentAdd adblockrule_parse (diff)
downloadsmolbote-db58900d3d289e2b25112963375edf183dca032f.tar.xz
Make keyboard shortcut defaults configurable
Diffstat (limited to 'lib')
-rw-r--r--lib/configuration/Kconfig129
-rw-r--r--lib/configuration/configuration.cpp60
2 files changed, 159 insertions, 30 deletions
diff --git a/lib/configuration/Kconfig b/lib/configuration/Kconfig
new file mode 100644
index 0000000..3e77434
--- /dev/null
+++ b/lib/configuration/Kconfig
@@ -0,0 +1,129 @@
+
+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
+
+menu "Keyboard shortcuts"
+ comment "Main Window shortcuts"
+ config SHORTCUT_WINDOW_NEWGROUP
+ string "New Group shortcut"
+ default "Ctrl+G"
+ config SHORTCUT_WINDOW_NEWWINDOW
+ string "New Window shortcut"
+ default "Ctrl+N"
+ config SHORTCUT_WINDOW_ABOUT
+ string "Show About Dialog"
+ default "Ctrl+H"
+ config SHORTCUT_WINDOW_QUIT
+ string "Quit shortcut"
+ default "Ctrl+Q"
+
+ config SHORTCUT_WINDOW_SEARCH
+ string "Show or hide search box"
+ default "F3"
+
+ config SHORTCUT_WINDOW_BOOKMARKS
+ string "Show bookmarks dialog in this window"
+ default "Ctrl+B"
+ config SHORTCUT_WINDOW_DOWNLOADS
+ string "Show downloads dialog in this window"
+ default "Ctrl+D"
+
+ comment "Navigation Bar shortcuts"
+ config SHORTCUT_NAVIGATION_BACK
+ string "Go back in history"
+ default "Ctrl+Left"
+ config SHORTCUT_NAVIGATION_BACKMENU
+ string "Show Back history menu"
+ default "Ctrl+Down"
+ config SHORTCUT_NAVIGATION_FORWARD
+ string "Go forward in history"
+ default "Ctrl+Right"
+ config SHORTCUT_NAVIGATION_FORWARDMENU
+ string "Show Forward history menu"
+ default "Ctrl+Up"
+ config SHORTCUT_NAVIGATION_REFRESH
+ string "Refresh the page"
+ default "F5"
+ config SHORTCUT_NAVIGATION_RELOAD
+ string "Reload the page"
+ default "Ctrl+F5"
+ config SHORTCUT_NAVIGATION_HOME
+ string "Load homepage"
+ default "Ctrl+Home"
+
+ comment "Address Bar shortcuts"
+ config SHORTCUT_ADDRESS_FOCUS
+ string "Focus the Address Bar"
+ default "F4"
+ config SHORTCUT_ADDRESS_MENU
+ string "Show Address Bar menu"
+ default "F2"
+
+ comment "Subwindow shortcuts"
+ config SHORTCUT_SUBWINDOW_MENU
+ string "Subwindow context menu"
+ default "F1"
+ config SHORTCUT_SUBWINDOW_TILE
+ string "Tile subwindows"
+ default "F9"
+ config SHORTCUT_SUBWINDOW_CASCADE
+ string "Cascade subwindow"
+ default "F10"
+ config SHORTCUT_SUBWINDOW_FULLSCREEN
+ string "Make current subwindow fullscreen"
+ default "F11"
+
+ config SHORTCUT_SUBWINDOW_NEWTAB
+ string "Create new tab"
+ default "Ctrl+T"
+ config SHORTCUT_SUBWINDOW_CLOSETAB
+ string "Close current tab"
+ default "Ctrl+X"
+ config SHORTCUT_SUBWINDOW_TABLEFT
+ string "Switch to the tab on the left"
+ default "Ctrl+O"
+ config SHORTCUT_SUBWINDOW_MOVETABLEFT
+ string "Move tab to the left"
+ default "Ctrl+Shift+O"
+ config SHORTCUT_SUBWINDOW_TABRIGHT
+ string "Switch to the tab on the right"
+ default "Ctrl+P"
+ config SHORTCUT_SUBWINDOW_MOVETABRIGHT
+ string "Move tab to the right"
+ default "Ctrl+Shift+P"
+
+endmenu
+
+menu "Profile defaults"
+ config PROFILE_DEFAULT
+ string "Default profile"
+ default ""
+ config PROFILE_DEFAULT_SEARCH
+ string "Search engine"
+ default "https://duckduckgo.com/?q=%1&ia=web"
+ config PROFILE_DEFAULT_HOMEPAGE
+ string "Homepage"
+ default "about:blank"
+ config PROFILE_DEFAULT_NEWTAB
+ string "New tab page"
+ default "about:blank"
+endmenu
+
diff --git a/lib/configuration/configuration.cpp b/lib/configuration/configuration.cpp
index 99efb14..388c7bd 100644
--- a/lib/configuration/configuration.cpp
+++ b/lib/configuration/configuration.cpp
@@ -67,39 +67,39 @@ Configuration::Configuration(QObject *parent)
("mainwindow.title", po::value<std::string>()->default_value(CONFIG_POI_NAME))
// main window shortcuts
- ("mainwindow.shortcuts.newGroup", po::value<std::string>()->default_value("Ctrl+G"))
- ("mainwindow.shortcuts.newWindow", po::value<std::string>()->default_value("Ctrl+N"))
+ ("mainwindow.shortcuts.newGroup", po::value<std::string>()->default_value(CONFIG_SHORTCUT_WINDOW_NEWGROUP))
+ ("mainwindow.shortcuts.newWindow", po::value<std::string>()->default_value(CONFIG_SHORTCUT_WINDOW_NEWWINDOW))
- ("mainwindow.shortcuts.about", po::value<std::string>()->default_value("Ctrl+H"))
- ("mainwindow.shortcuts.quit", po::value<std::string>()->default_value("Ctrl+Q"))
+ ("mainwindow.shortcuts.about", po::value<std::string>()->default_value(CONFIG_SHORTCUT_WINDOW_ABOUT))
+ ("mainwindow.shortcuts.quit", po::value<std::string>()->default_value(CONFIG_SHORTCUT_WINDOW_QUIT))
- ("mainwindow.shortcuts.search", po::value<std::string>()->default_value("F3"))
- ("mainwindow.shortcuts.tileWindows", po::value<std::string>()->default_value("F9"))
- ("mainwindow.shortcuts.cascadeWindows", po::value<std::string>()->default_value("F10"))
+ ("mainwindow.shortcuts.search", po::value<std::string>()->default_value(CONFIG_SHORTCUT_WINDOW_SEARCH))
+ ("mainwindow.shortcuts.tileWindows", po::value<std::string>()->default_value(CONFIG_SHORTCUT_SUBWINDOW_TILE))
+ ("mainwindow.shortcuts.cascadeWindows", po::value<std::string>()->default_value(CONFIG_SHORTCUT_SUBWINDOW_CASCADE))
// navigation
("navigation.movable", po::value<bool>()->default_value(false))
- ("navigation.shortcuts.back", po::value<std::string>()->default_value("Ctrl+Left"))
- ("navigation.shortcuts.backMenu", po::value<std::string>()->default_value("Ctrl+Down"))
- ("navigation.shortcuts.forward", po::value<std::string>()->default_value("Ctrl+Right"))
- ("navigation.shortcuts.forwardMenu", po::value<std::string>()->default_value("Ctrl+Up"))
- ("navigation.shortcuts.refresh", po::value<std::string>()->default_value("F5"))
- ("navigation.shortcuts.reload", po::value<std::string>()->default_value("Ctrl+F5"))
- ("navigation.shortcuts.home", po::value<std::string>()->default_value("Ctrl+Home"))
+ ("navigation.shortcuts.back", po::value<std::string>()->default_value(CONFIG_SHORTCUT_NAVIGATION_BACK))
+ ("navigation.shortcuts.backMenu", po::value<std::string>()->default_value(CONFIG_SHORTCUT_NAVIGATION_BACKMENU))
+ ("navigation.shortcuts.forward", po::value<std::string>()->default_value(CONFIG_SHORTCUT_NAVIGATION_FORWARD))
+ ("navigation.shortcuts.forwardMenu", po::value<std::string>()->default_value(CONFIG_SHORTCUT_NAVIGATION_FORWARDMENU))
+ ("navigation.shortcuts.refresh", po::value<std::string>()->default_value(CONFIG_SHORTCUT_NAVIGATION_REFRESH))
+ ("navigation.shortcuts.reload", po::value<std::string>()->default_value(CONFIG_SHORTCUT_NAVIGATION_RELOAD))
+ ("navigation.shortcuts.home", po::value<std::string>()->default_value(CONFIG_SHORTCUT_NAVIGATION_HOME))
// address bar
- ("addressbar.shortcuts.focus", po::value<std::string>()->default_value("F4"))
- ("addressbar.shortcuts.menu", po::value<std::string>()->default_value("F2"))
+ ("addressbar.shortcuts.focus", po::value<std::string>()->default_value(CONFIG_SHORTCUT_ADDRESS_FOCUS))
+ ("addressbar.shortcuts.menu", po::value<std::string>()->default_value(CONFIG_SHORTCUT_ADDRESS_MENU))
// subwindow
- ("subwindow.shortcuts.menu", po::value<std::string>()->default_value("F1"))
- ("subwindow.shortcuts.new", po::value<std::string>()->default_value("Ctrl+T"))
- ("subwindow.shortcuts.close", po::value<std::string>()->default_value("Ctrl+X"))
- ("subwindow.shortcuts.left", po::value<std::string>()->default_value("Ctrl+O"))
- ("subwindow.shortcuts.moveLeft", po::value<std::string>()->default_value("Ctrl+Shift+O"))
- ("subwindow.shortcuts.right", po::value<std::string>()->default_value("Ctrl+P"))
- ("subwindow.shortcuts.moveRight", po::value<std::string>()->default_value("Ctrl+Shift+P"))
- ("subwindow.shortcuts.fullscreen", po::value<std::string>()->default_value("F11"))
+ ("subwindow.shortcuts.menu", po::value<std::string>()->default_value(CONFIG_SHORTCUT_SUBWINDOW_MENU))
+ ("subwindow.shortcuts.new", po::value<std::string>()->default_value(CONFIG_SHORTCUT_SUBWINDOW_NEWTAB))
+ ("subwindow.shortcuts.close", po::value<std::string>()->default_value(CONFIG_SHORTCUT_SUBWINDOW_CLOSETAB))
+ ("subwindow.shortcuts.left", po::value<std::string>()->default_value(CONFIG_SHORTCUT_SUBWINDOW_TABLEFT))
+ ("subwindow.shortcuts.moveLeft", po::value<std::string>()->default_value(CONFIG_SHORTCUT_SUBWINDOW_MOVETABLEFT))
+ ("subwindow.shortcuts.right", po::value<std::string>()->default_value(CONFIG_SHORTCUT_SUBWINDOW_TABRIGHT))
+ ("subwindow.shortcuts.moveRight", po::value<std::string>()->default_value(CONFIG_SHORTCUT_SUBWINDOW_MOVETABRIGHT))
+ ("subwindow.shortcuts.fullscreen", po::value<std::string>()->default_value(CONFIG_SHORTCUT_SUBWINDOW_FULLSCREEN))
// Filter settings
("filter.hosts", po::value<std::string>()->default_value(CONFIG_PATH_FILTER))
@@ -114,19 +114,19 @@ Configuration::Configuration(QObject *parent)
// Profile settings
// default profile name the browser should use; "" is off-the-record
- ("profile.default", po::value<std::string>()->default_value(""))
+ ("profile.default", po::value<std::string>()->default_value(CONFIG_PROFILE_DEFAULT))
("profile.path", po::value<std::string>()->default_value(CONFIG_PATH_PROFILES))
- ("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"))
+ ("profile.search", po::value<std::string>()->default_value(CONFIG_PROFILE_DEFAULT_SEARCH))
+ ("profile.homepage", po::value<std::string>()->default_value(CONFIG_PROFILE_DEFAULT_HOMEPAGE))
+ ("profile.newtab", po::value<std::string>()->default_value(CONFIG_PROFILE_DEFAULT_NEWTAB))
// Bookmark settings
("bookmarks.path", po::value<std::string>()->default_value(CONFIG_PATH_BOOKMARKS))
- ("bookmarks.shortcut", po::value<std::string>()->default_value("Ctrl+B"))
+ ("bookmarks.shortcut", po::value<std::string>()->default_value(CONFIG_SHORTCUT_WINDOW_BOOKMARKS))
// Downloads settings
("downloads.path", po::value<std::string>()->default_value(CONFIG_PATH_DOWNLOADS))
- ("downloads.shortcut", po::value<std::string>()->default_value("Ctrl+D"))
+ ("downloads.shortcut", po::value<std::string>()->default_value(CONFIG_SHORTCUT_WINDOW_DOWNLOADS))
;
}