aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-08-23 14:52:58 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2017-08-23 14:52:58 +0200
commit3810a2bff06a38c9d4098560cd94a17a24031e23 (patch)
treed3f079161dcd3b7a37f3d2a737c6c72f8a49e187
parentAdded URL bar completer (diff)
downloadsmolbote-3810a2bff06a38c9d4098560cd94a17a24031e23.tar.xz
Split address bar off into static library
-rw-r--r--docs/DESIGN.md5
-rw-r--r--smolbote.qbs12
-rw-r--r--src/lib/navigation/navigation.qbs21
-rw-r--r--src/lib/navigation/urllineedit.cpp (renamed from src/widgets/urllineedit.cpp)8
-rw-r--r--src/lib/navigation/urllineedit.h (renamed from src/widgets/urllineedit.h)0
-rw-r--r--src/mainwindow.h2
6 files changed, 40 insertions, 8 deletions
diff --git a/docs/DESIGN.md b/docs/DESIGN.md
index 8e88200..4d13ed6 100644
--- a/docs/DESIGN.md
+++ b/docs/DESIGN.md
@@ -63,6 +63,11 @@ library name and repository location.
- tinytoml
## Components
+Components should, when possible, be split off into self-contained static
+libraries. This is to reduce recompile times.
+
+### Navigation
+Includes the Address bar (URLLineEdit).
### Bookmarks [TODO]
diff --git a/smolbote.qbs b/smolbote.qbs
index a70d49e..ea05578 100644
--- a/smolbote.qbs
+++ b/smolbote.qbs
@@ -15,6 +15,10 @@ Project {
// The code also fails to compile if you use APIs deprecated before Qt 5.9.
property string deprecatedBefore: "0x050900"
+ references: [
+ "src/lib/navigation/navigation.qbs"
+ ]
+
CppApplication {
id: poi
name: "poi"
@@ -26,6 +30,10 @@ Project {
submodules: ["core", "widgets", "webengine", "webenginewidgets"]
}
+ Depends {
+ name: "navigation"
+ }
+
Probe {
id: git
property string version: ""
@@ -46,7 +54,7 @@ Project {
cpp.cxxFlags: ["-Xclang", "-load", "-Xclang", "ClangLazy.so", "-Xclang", "-add-plugin", "-Xclang", "clang-lazy"]
}
// global includes
- cpp.includePaths: ['src', 'src/3rd-party']
+ cpp.includePaths: ['src', 'src/3rd-party', 'src/lib']
// global defines
cpp.defines: {
if(project.deprecatedWarnings)
@@ -92,8 +100,6 @@ Project {
"src/widgets/loadingbar.h",
"src/widgets/mainwindowmenubar.cpp",
"src/widgets/mainwindowmenubar.h",
- "src/widgets/urllineedit.cpp",
- "src/widgets/urllineedit.h",
"src/widgets/webviewtabbar.cpp",
"src/widgets/webviewtabbar.h",
]
diff --git a/src/lib/navigation/navigation.qbs b/src/lib/navigation/navigation.qbs
new file mode 100644
index 0000000..5f7ba41
--- /dev/null
+++ b/src/lib/navigation/navigation.qbs
@@ -0,0 +1,21 @@
+import qbs 1.0
+
+Project {
+ name: "navigation"
+
+ StaticLibrary {
+ id: navigation
+ name: "navigation"
+
+ Depends {
+ name: "Qt"
+ versionAtLeast: "5.9.0"
+ submodules: ["core", "widgets"]
+ }
+
+ files: [
+ "urllineedit.cpp",
+ "urllineedit.h",
+ ]
+ }
+}
diff --git a/src/widgets/urllineedit.cpp b/src/lib/navigation/urllineedit.cpp
index 871cd53..8083088 100644
--- a/src/widgets/urllineedit.cpp
+++ b/src/lib/navigation/urllineedit.cpp
@@ -24,7 +24,7 @@
#include <QAction>
#include <QStyle>
-#include "browser.h"
+//#include "browser.h"
#include <QWidgetAction>
@@ -135,9 +135,9 @@ void UrlLineEdit::clearTextFormat()
QUrl UrlLineEdit::urlFromUserInput(const QString &input)
{
- if(input.startsWith('#')) {
- return QUrl::fromUserInput(qApp->settings()->value("general.search").toString().replace("$term", input.mid(1)));
- }
+// if(input.startsWith('#')) {
+// return QUrl::fromUserInput(qApp->settings()->value("general.search").toString().replace("$term", input.mid(1)));
+// }
return QUrl::fromUserInput(input);
}
diff --git a/src/widgets/urllineedit.h b/src/lib/navigation/urllineedit.h
index 548000a..548000a 100644
--- a/src/widgets/urllineedit.h
+++ b/src/lib/navigation/urllineedit.h
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 4e0ed3a..12ebb0d 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -23,7 +23,7 @@
#include <QMainWindow>
#include <QToolBar>
-#include "widgets/urllineedit.h"
+#include <navigation/urllineedit.h>
#include <QWebEngineView>
#include "webengine/webengineprofile.h"
#include <QUrl>