aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-08-18 23:52:33 +0200
committerdec05eba <dec05eba@protonmail.com>2020-08-19 00:06:08 +0200
commit9e529f8e88fdce04118a5bd7eb3b53369ea72421 (patch)
tree37f097570ba58c162808792adfd55e33a21291a7
parent16f091d587d6e16cecb468e041e4a2f138901be0 (diff)
WIP: FIX p2p
-rw-r--r--.gitmodules4
-rw-r--r--.vscode/launch.json27
-rw-r--r--.vscode/settings.json68
-rw-r--r--README.md3
m---------depends/dchat_core0
-rw-r--r--src/ImagePreview.cpp5
-rw-r--r--src/Text.cpp5
-rw-r--r--src/Video.cpp5
-rw-r--r--src/main.cpp5
9 files changed, 13 insertions, 109 deletions
diff --git a/.gitmodules b/.gitmodules
index 5f59175..358574b 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,6 +1,6 @@
[submodule "depends/sibs-functional"]
path = depends/sibs-functional
- url = https://gitlab.com/DEC05EBA/sibs-functional.git
+ url = https://git.dec05eba.com/sibs-functional
[submodule "depends/dchat_core"]
path = depends/dchat_core
- url = https://gitlab.com/DEC05EBA/dchat_core.git
+ url = https://git.dec05eba.com/dchat-core
diff --git a/.vscode/launch.json b/.vscode/launch.json
deleted file mode 100644
index d49b13b..0000000
--- a/.vscode/launch.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- // Use IntelliSense to learn about possible attributes.
- // Hover to view descriptions of existing attributes.
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
- "version": "0.2.0",
- "configurations": [
- {
- "name": "(gdb) Launch",
- "type": "cppdbg",
- "request": "launch",
- "program": "${workspaceFolder}/sibs-build/debug/dchat",
- "args": [],
- "stopAtEntry": false,
- "cwd": "${workspaceFolder}",
- "environment": [],
- "externalConsole": true,
- "MIMode": "gdb",
- "setupCommands": [
- {
- "description": "Enable pretty-printing for gdb",
- "text": "-enable-pretty-printing",
- "ignoreFailures": true
- }
- ]
- }
- ]
-} \ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
deleted file mode 100644
index 34ba634..0000000
--- a/.vscode/settings.json
+++ /dev/null
@@ -1,68 +0,0 @@
-{
- "files.associations": {
- "*.ipp": "cpp",
- "hash_map": "cpp",
- "hash_set": "cpp",
- "*.tcc": "cpp",
- "string_view": "cpp",
- "typeindex": "cpp",
- "typeinfo": "cpp",
- "cctype": "cpp",
- "clocale": "cpp",
- "cmath": "cpp",
- "csignal": "cpp",
- "cstdarg": "cpp",
- "cstddef": "cpp",
- "cstdio": "cpp",
- "cstdlib": "cpp",
- "cstring": "cpp",
- "ctime": "cpp",
- "cwchar": "cpp",
- "cwctype": "cpp",
- "__config": "cpp",
- "__nullptr": "cpp",
- "array": "cpp",
- "atomic": "cpp",
- "strstream": "cpp",
- "bitset": "cpp",
- "chrono": "cpp",
- "cinttypes": "cpp",
- "codecvt": "cpp",
- "complex": "cpp",
- "condition_variable": "cpp",
- "cstdint": "cpp",
- "deque": "cpp",
- "forward_list": "cpp",
- "list": "cpp",
- "unordered_map": "cpp",
- "unordered_set": "cpp",
- "vector": "cpp",
- "exception": "cpp",
- "fstream": "cpp",
- "functional": "cpp",
- "future": "cpp",
- "initializer_list": "cpp",
- "iomanip": "cpp",
- "iosfwd": "cpp",
- "iostream": "cpp",
- "istream": "cpp",
- "limits": "cpp",
- "memory": "cpp",
- "mutex": "cpp",
- "new": "cpp",
- "numeric": "cpp",
- "optional": "cpp",
- "ostream": "cpp",
- "ratio": "cpp",
- "sstream": "cpp",
- "stdexcept": "cpp",
- "streambuf": "cpp",
- "system_error": "cpp",
- "thread": "cpp",
- "type_traits": "cpp",
- "tuple": "cpp",
- "utility": "cpp",
- "variant": "cpp"
- },
- "cquery.cacheDirectory": "${workspaceFolder}/.vscode/cquery_cached_index/"
-} \ No newline at end of file
diff --git a/README.md b/README.md
index d916aa6..6cafe51 100644
--- a/README.md
+++ b/README.md
@@ -6,6 +6,7 @@ boost, libnsgif, mpv, sfml, curl
# Building
Using [sibs](https://github.com/DEC05EBA/sibs) run `sibs build --release` in the root directory of the project and then run dchat using `./sibs-build/<platform>/release/dchat`
# TODO
-Use a http(s) library to download content (curl?) and stream gif. If content is html, then stop downloading after we have retrieved title, header image and paragraph
+Use a http(s) library to download content (curl?) and stream gif. If content is html, then stop downloading after we have retrieved title, header image and paragraph.\
+Use std::search for StringView find
# Screenshot
![Sample screenshot](screenshot.png)
diff --git a/depends/dchat_core b/depends/dchat_core
-Subproject f8ec6a14e0c7b3b6da4bbde441242e999a487df
+Subproject 65155171305a3f5cdadb914fcd129cb7ef61f91
diff --git a/src/ImagePreview.cpp b/src/ImagePreview.cpp
index 683bc1f..424aefa 100644
--- a/src/ImagePreview.cpp
+++ b/src/ImagePreview.cpp
@@ -73,9 +73,8 @@ namespace dchat
if(event.type == sf::Event::MouseButtonPressed && mouseInside && !imagePreviewUrl.empty())
{
// TODO: Implement for other platforms than linux
- std::string cmd = "xdg-open '";
- cmd += escapeCommand(imagePreviewUrl);
- cmd += "'";
+ std::string cmd = "xdg-open ";
+ cmd += escapeCommandArg(imagePreviewUrl);
printf("Clicked on web page preview, opening web page by running command: %s\n", cmd.c_str());
system(cmd.c_str());
}
diff --git a/src/Text.cpp b/src/Text.cpp
index 6e3aac9..3c26b5a 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -779,9 +779,8 @@ namespace dchat
if(event.x >= pos.x && event.x <= pos.x + previewWidth && event.y >= pos.y && event.y <= pos.y + imageHeight)
{
// TODO: Implement for other platforms than linux
- std::string cmd = "xdg-open '";
- cmd += escapeCommand(utf8Str);
- cmd += "'";
+ std::string cmd = "xdg-open ";
+ cmd += escapeCommandArg(utf8Str);
printf("Clicked on web page preview, opening web page by running command: %s\n", cmd.c_str());
system(cmd.c_str());
return;
diff --git a/src/Video.cpp b/src/Video.cpp
index 4ef3128..2b32daf 100644
--- a/src/Video.cpp
+++ b/src/Video.cpp
@@ -70,8 +70,9 @@ namespace dchat
if(mpv_initialize(mpv) < 0)
throw VideoInitializationException("Failed to initialize mpv");
- mpv_set_option_string(mpv, "vo", "opengl-cb");
- mpv_set_option_string(mpv, "hwdec", "auto");
+ // TODO: Enable this again, but right now it can caused Xorg process to use 100% cpu.
+ //mpv_set_option_string(mpv, "vo", "opengl-cb");
+ //mpv_set_option_string(mpv, "hwdec", "auto");
if(loop)
mpv_set_option_string(mpv, "loop", "inf");
mpvGl = (mpv_opengl_cb_context*)mpv_get_sub_api(mpv, MPV_SUB_API_OPENGL_CB);
diff --git a/src/main.cpp b/src/main.cpp
index 1ae5eb6..92d70b0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -160,9 +160,8 @@ int main(int argc, char **argv)
#endif
if(request.room->localUser && request.room->localUser != request.message->creator)
{
- string cmd = "notify-send dchat '";
- cmd += escapeCommand(request.message->text);
- cmd += "'";
+ string cmd = "notify-send dchat ";
+ cmd += escapeCommandArg(request.message->text);
system(cmd.c_str());
}
}