diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 0f20cb2..cdfa8f3 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -29,6 +29,7 @@ jobs:
if_true: >-
git
make
+ unzip
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ninja
@@ -41,6 +42,7 @@ jobs:
if_false: >-
git
make
+ unzip
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ninja
@@ -95,6 +97,11 @@ jobs:
mkdir -p 16x16/devices 24x24/devices 32x32/devices 48x48/devices 64x64/devices 96x96/devices scalable/devices
mkdir -p 16x16/status 24x24/status 32x32/status 48x48/status 64x64/status 96x96/status scalable/status
cd ${GITHUB_WORKSPACE}
+ wget https://github.com/rtlewis1/GTK/archive/refs/heads/Material-Black-Colors-Desktop.zip
+ unzip Material-Black-Colors-Desktop.zip 'GTK-Material-Black-Colors-Desktop/Material-Black-Cherry/**/*'
+ mkdir -p ${artifact_dir}/share/themes
+ mv ./GTK-Material-Black-Colors-Desktop/Material-Black-Cherry ${artifact_dir}/share/themes/Material-Black-Cherry
+ cp -r ci/tree/. ${artifact_dir}
cp ci/gtk-for-windows/gtk-nsis-pack/share/icons/Adwaita/index.theme ${artifact_dir}/share/icons/Adwaita/index.theme
cat "ci/used-icons.txt" | sed 's/\r$//' | xargs -I % cp ci/gtk-for-windows/gtk-nsis-pack/share/icons/Adwaita/16x16/%.symbolic.png ${artifact_dir}/share/icons/Adwaita/16x16/%.symbolic.png || :
cat "ci/used-icons.txt" | sed 's/\r$//' | xargs -I % cp ci/gtk-for-windows/gtk-nsis-pack/share/icons/Adwaita/24x24/%.symbolic.png ${artifact_dir}/share/icons/Adwaita/24x24/%.symbolic.png || :
diff --git a/.readme/s5.png b/.readme/s5.png
new file mode 100644
index 0000000..b49c0c5
Binary files /dev/null and b/.readme/s5.png differ
diff --git a/.readme/s6.png b/.readme/s6.png
new file mode 100644
index 0000000..3152293
Binary files /dev/null and b/.readme/s6.png differ
diff --git a/.readme/s7.png b/.readme/s7.png
new file mode 100644
index 0000000..e605c55
Binary files /dev/null and b/.readme/s7.png differ
diff --git a/.readme/s8.png b/.readme/s8.png
new file mode 100644
index 0000000..c9d3157
Binary files /dev/null and b/.readme/s8.png differ
diff --git a/README.md b/README.md
index 0038f1f..b47e895 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,16 @@
---
Alternative Discord client made in C++ with GTK
-
+
@@ -11,7 +20,7 @@ Current features:
* Not Electron
* Voice support
* Handles most types of chat messages including embeds, images, and replies
-* Completely styleable/customizable with CSS (if you have a system GTK theme it won't really use it though)
+* Completely styleable/customizable
* Identifies to Discord as the web client unlike other clients so less likely to be falsely flagged as spam1
* Set status
* Unread and mention indicators
@@ -199,11 +208,6 @@ spam filter's wrath:
| `.embed-field-value` | The value of an embed field |
| `.embed-footer` | The footer of an embed |
| `.member-list` | Container of the member list |
-| `.status-indicator` | The status indicator |
-| `.online` | Applied to status indicators when the associated user is online |
-| `.idle` | Applied to status indicators when the associated user is away |
-| `.dnd` | Applied to status indicators when the associated user is on do not disturb |
-| `.offline` | Applied to status indicators when the associated user is offline |
| `.typing-indicator` | The typing indicator (also used for replies) |
Used in reorderable list implementation:
@@ -306,10 +310,8 @@ For example, memory_db would be set by adding `memory_db = true` under the line
| Setting | Type | Description |
|-------------------------|--------|-----------------------------------------------------|
-| `linkcolor` | string | color to use for links in messages |
| `expandercolor` | string | color to use for the expander in the channel list |
| `nsfwchannelcolor` | string | color to use for NSFW channels in the channel list |
-| `channelcolor` | string | color to use for SFW channels in the channel list |
| `mentionbadgecolor` | string | background color for mention badges |
| `mentionbadgetextcolor` | string | color to use for number displayed on mention badges |
| `unreadcolor` | string | color to use for the unread indicator |
diff --git a/ci/msys-deps.txt b/ci/msys-deps.txt
index dd807e6..d37418b 100644
--- a/ci/msys-deps.txt
+++ b/ci/msys-deps.txt
@@ -38,6 +38,7 @@
/bin/libidn2-0.dll
/bin/libintl-8.dll
/bin/libjpeg-8.dll
+/bin/liblzma-5.dll
/bin/libnghttp2-14.dll
/bin/libopus-0.dll
/bin/libpango-1.0-0.dll
@@ -49,8 +50,9 @@
/bin/libpixman-1-0.dll
/bin/libpng16-16.dll
/bin/libpsl-5.dll
+/bin/librsvg-2-2.dll
/bin/libsigc-2.0-0.dll
-/bin/libsodium-23.dll
+/bin/libsodium-26.dll
/bin/libspdlog.dll
/bin/libsqlite3-0.dll
/bin/libssh2-1.dll
@@ -59,6 +61,7 @@
/bin/libthai-0.dll
/bin/libunistring-5.dll
/bin/libwinpthread-1.dll
+/bin/libxml2-2.dll
/bin/libzstd.dll
/bin/zlib1.dll
/../usr/bin/msys-2.0.dll
diff --git a/ci/tree/etc/gtk-3.0/settings.ini b/ci/tree/etc/gtk-3.0/settings.ini
new file mode 100644
index 0000000..a148875
--- /dev/null
+++ b/ci/tree/etc/gtk-3.0/settings.ini
@@ -0,0 +1,2 @@
+[Settings]
+gtk-theme-name=Material-Black-Cherry
diff --git a/res/css/application-low-priority.css b/res/css/application-low-priority.css
deleted file mode 100644
index 130033f..0000000
--- a/res/css/application-low-priority.css
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
-application wide stuff
-has to be separate to allow main.css to override certain things
-*/
-
-.app-window label:not(:disabled) {
- color: @text_color;
-}
-
-.app-window entry {
- background: @secondary_color;
- color: @text_color;
- border: 1px solid #1c2e40;
-}
-
-.app-window button {
- background: @secondary_color;
- color: @text_color;
- text-shadow: none;
- box-shadow: none;
-}
-
-.app-window button:checked {
- border-top: 0px;
- border-left: 0px;
- border-right: 0px;
- border-bottom: 3px solid #39a2ed;
- color: #ffffff;
-}
-
-.app-window button:not(:checked) {
- border: 3px #0000ff;
-}
-
-.app-window.background {
- background: @background_color;
-}
-
-.app-window treeview {
- color: @text_color;
-}
-
-.app-window treeview:not(:selected) {
- background: @secondary_color;
-}
-
-.app-window list, .app-popup list {
- background: @secondary_color;
-}
-
-.app-window paned separator {
- background: @background_color;
-}
-
-.app-window scrollbar {
- background: @background_color;
- border-left: 1px solid transparent;
-}
-
-.app-window menubar, menu {
- background: @background_color;
- color: #cccccc;
-}
-
-.app-window textview text {
- caret-color: #ababab;
-}
-
-.app-window check,
-.app-window radio {
- background-clip: padding-box;
- background: @secondary_color;
- border-color: #070707;
- box-shadow: 0 1px rgba(0, 0, 0, 0);
- color: #dddddd;
-}
-
-.app-window check:checked,
-.app-window radio:checked {
- background-clip: border-box;
- background: #0b4285;
- border-color: #092444;
- box-shadow: 0 1px rgba(0, 0, 0, 0);
- color: #dddddd;
-}
-
-.app-window colorswatch {
- box-shadow: 0 1px rgba(0, 0, 0, 0);
-}
-
-.app-window scale {
- padding-top: 0px;
- padding-bottom: 0px;
- margin-top: 0px;
- margin-bottom: 0px;
- color: @text_color;
-}
diff --git a/res/css/bare.css b/res/css/bare.css
deleted file mode 100644
index 80ef2f8..0000000
--- a/res/css/bare.css
+++ /dev/null
@@ -1,35 +0,0 @@
-.embed {
- border-radius: 5px;
- padding: 10px;
-}
-
-.embed-footer {
- margin-top: 5px;
- font-size: 11px;
-}
-
-.embed-author {
- margin-bottom: 10px;
- font-size: 12px;
-}
-
-.message-attachment-box {
- border: 1px solid #aaaaaa;
- padding: 2px 5px 2px 5px;
-}
-
-.status-indicator.dnd {
- color: #982929;
-}
-
-.status-indicator.online {
- color: #43B581;
-}
-
-.status-indicator.offline {
- color: #808080;
-}
-
-.status-indicator.idle {
- color: #FAA61A;
-}
diff --git a/res/css/main.css b/res/css/main.css
index 2cc4727..ae7bf60 100644
--- a/res/css/main.css
+++ b/res/css/main.css
@@ -1,12 +1,7 @@
-@define-color background_color #141414;
-@define-color secondary_color #111111;
-@define-color text_color #fbfbfb;
-
.embed {
- background-color: rgba(0, 0, 0, 0.2);
- color: #cbcbcb;
border-radius: 5px;
padding: 10px;
+ background-color: rgba(0.0, 0.0, 0.0, 0.1);
}
.embed-footer {
@@ -19,140 +14,7 @@
font-size: 12px;
}
-.channel-list {
- background-color: @secondary_color;
-}
-
-.channel-row-label {
- padding: 5px;
-}
-
-.channel-row-label, .channel-row-label text {
- color: @text_color;
- background: rgba(0, 0, 0, 0);
-}
-
-.channel-row-label.nsfw text {
- color: #ed6666;
-}
-
-.channel-row:focus {
- background-color: #34495e;
-}
-
-.channel-row-category {
- padding-left: 15px;
- color: #ff5370;
-}
-
-.channel-row-channel {
- padding-left: 30px;
-}
-
-.messages, .message-container {
- background-color: @background_color;
-}
-
-.messages {
- padding: 15px;
-}
-
-.message-container-extra {
- color: #78909c;
-}
-
-.message-container-timestamp {
- color: #78909c;
-}
-
-.message-text {
- /* this isnt stricly necessary but it fixes emoji clipping */
- padding-bottom: 5px;
-}
-
-.message-text:not(.failed) text, .message-reply {
- color: @text_color;
-}
-
-.message-text.pending text {
- color: shade(@text_color, 0.5);
-}
-
-.message-text.failed text {
- color: #b72d4f;
-}
-
-.message-reply {
- border-left: 2px solid gray;
- padding-left: 20px;
- padding-top: 6px;
- padding-bottom: 6px;
- opacity: 0.7;
-}
-
-.message-text + .message-text {
- padding-top: 5px;
-}
-
-.message-text text {
- background-color: @background_color;
-}
-
-.message-input, .message-input textview, .message-input textview text {
- background-color: #242424;
- color: #adadad;
- border-radius: 3px;
- border: 1px solid transparent;
-}
-
-.message-input {
- border: 1px solid #444444;
- margin-right: 15px;
-}
-
-.message-input.replying {
- border: 1px solid #026FB9;
-}
-
-.message-input.editing {
- border: 1px solid #b9026f;
-}
-
-.message-input.bad-input {
- border: 1px solid #dd3300;
-}
-
-.message-input-browse-icon {
- color: #b9bbbe;
- margin-left: 5px;
- margin-top: 11px;
-}
-
-/* i dont think theres a way to circumvent having to do this to adjust around the browse icon */
-.message-input:not(.with-browser-icon) {
- padding: 0px 0px 0px 5px;
-}
-
-.message-input.with-browse-icon {
- padding: 0px 0px 0px 30px;
-}
-
-.members {
- background-color: @background_color;
-}
-
-.members-row-label {
- color: @text_color;
- padding: 5px;
-}
-
-.members-row-member {
- padding: 0;
- padding-left: 15px;
-}
-
.message-attachment-box {
- color: #aaaaaa;
border: 1px solid #aaaaaa;
padding: 2px 5px 2px 5px;
}
@@ -161,61 +23,6 @@
margin: 5px;
}
-.message-component {
- margin: 5px;
-}
-
-.message-component.primary {
- background: #5865F2;
-}
-
-.message-component.secondary, .message-component.link {
- background: #4F545C;
-}
-
-.message-component.success {
- background: #43B581;
-}
-
-.message-component.danger {
- background: #F04747;
-}
-
-.reaction-box {
- padding: 2px 5px 2px 5px;
- margin: 0px 0px 0px 0px;
- background-color: rgba(0.4, 0.4, 0.4, 0.4);
- border-radius: 5px;
- border: 1px solid transparent;
-}
-
-.reaction-box.reacted {
- border: 1px solid white;
-}
-
-.reaction-count {
- color: @text_color;
-}
-
-.completer {
- background-color: @secondary_color;
- padding: 5px;
-}
-
-.completer-entry {
- color: @text_color;
-}
-
-.completer-entry-image {
- margin-right: 6px;
-}
-
-.typing-indicator {
- margin-top: 10px;
- margin-bottom: -7px;
- color: @text_color;
-}
-
.status-indicator.dnd {
color: #982929;
}
@@ -232,6 +39,26 @@
color: #FAA61A;
}
+.message-input textview, .message-input textview text {
+ background-color: inherit;
+}
+
+.message-text, .message-text text {
+ background: inherit;
+}
+
+.message-input textview {
+ padding: 10px 5px;
+}
+
+.message-reply {
+ border-left: 2px solid gray;
+ padding-left: 10px;
+ padding-top: 6px;
+ padding-bottom: 6px;
+ opacity: 0.8;
+}
+
.profile-main-container {
padding: 20px;
}
@@ -242,31 +69,13 @@
}
.profile-username-nondisplay {
- margin-left: 10px;
-}
-
-.profile-badge {
- margin-right: 10px;
+ margin-left: 10px;
}
.profile-switcher {
padding-top: 5px;
}
-.profile-connections {
- margin-top: 10px;
-}
-
-.profile-connection {
- background: @secondary_color;
- border-radius: 15px;
- margin-right: 20px;
-}
-
-.profile-connection box {
- padding: 5px;
-}
-
.profile-stack {
padding-top: 5px;
}
@@ -276,126 +85,63 @@
padding-bottom: 5px;
}
-.profile-notes-text, .profile-notes-text text {
- background: @secondary_color;
-}
-
-.profile-notes-text text {
- border-radius: 5px;
- border: 1px solid #36515e;
- color: @text_color;
- padding-bottom: 5px;
-}
-
.profile-badges {
padding-left: 5px;
}
-.guild-members-pane-info {
- padding: 10px;
+.profile-badge {
+ margin-right: 5px;
}
-.drag-hover-top {
- background: linear-gradient(to bottom, rgba(255, 66, 66, 0.65) 0%, rgba(0, 0, 0, 0) 35%);
-}
-
-.drag-hover-bottom {
- background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 65%, rgba(255, 66, 66, 0.65) 100%);
-}
-
-.friends-list list {
- background: @background_color;
- padding-left: 10px;
-}
-
-.friends-list-row-bot {
- color: #ff0000;
-}
-
-.channel-tab-switcher .box {
- margin: -7px -1px -7px -1px;
- background: #2a2a2a;
- border: 1px solid black;
-}
-
-.channel-tab-switcher tab:hover {
- box-shadow: inset 0 -6px #17633e;
-}
-
-.channel-tab-switcher tab:checked {
- box-shadow: inset 0 -6px #2feb90;
-}
-
-.channel-tab-switcher tab {
- background: #1A1A1A;
- border: 1px solid #808080;
- min-height: 35px;
-}
-
-.channel-tab-switcher tab.needs-attention:not(:checked) {
- font-weight: bold;
- animation: 150ms ease-in;
- /* background-image: radial-gradient(ellipse at bottom, #FF5370, #1A1A1A 30%); */
- box-shadow: inset 0 -6px red;
-}
-
-.channel-tab-switcher tab > button {
- border: none;
- padding: 0;
- margin: 5px;
- min-width: 16px;
- min-height: 16px;
- color: #FF5370;
- background-color: rgba(0.21, 0.21, 0.21, 0.5);
-}
-
-.channel-tab-switcher tab > button:hover {
- background-color: alpha(#ff0000, 0.5);
-}
-
-.message-progress {
- border: none;
- margin-bottom: -8px;
-}
-
-.message-progress trough {
- border: none;
- background-color: transparent;
-}
-
-.message-progress progress {
- border: none;
- background-color: #dd3300;
- margin-left: 1px;
-}
-
-.voice-info {
- background-color: #0B0B0B;
- padding: 5px;
- border: 1px solid #202020;
-}
-
-.voice-info-disconnect-image {
- color: #DDDDDD;
-}
-
-.voice-info-status {
- font-weight: bold;
-}
-
-.voice-info-location {
-
-}
-
-.voice-state-server {
- color: red;
-}
-
-spinbutton {
- color: @text_color;
+.profile-connections {
margin-top: 10px;
}
-.emoji-picker, .emoji-picker stack box {
- background-color: @background_color;
+.profile-connection {
+ padding: 5px;
+ border-radius: 10px;
+ border: 1px solid @theme_fg_color;
+}
+
+.profile-connection-image {
+ padding-right: 5px;
+}
+
+.reaction-box {
+ padding: 2px 5px 2px 5px;
+ border-radius: 5px;
+ border: 1px solid @theme_fg_color;
+}
+
+.reaction-box.reacted {
+ border: 1px solid #5865f2;
+ background-color: alpha(@theme_selected_bg_color, 0.5);
+}
+
+.set-status-dialog .dialog-vbox {
+ padding: 5px;
+}
+
+.set-status-dialog .dialog-action-area {
+ margin: 10px 5px 5px 5px;
+}
+
+.voice-settings-window > box {
+ padding: 5px;
+}
+
+.voice-settings-window scale {
+ margin-right: 8px;
+}
+
+.message-input scrollbar.vertical slider {
+ min-height: 0px;
+}
+
+.message-text.pending {
+ color: alpha(currentColor, 0.5);
+}
+
+.message-text.failed {
+ color: red;
}
diff --git a/src/abaddon.cpp b/src/abaddon.cpp
index 6557182..8b8a0b2 100644
--- a/src/abaddon.cpp
+++ b/src/abaddon.cpp
@@ -177,6 +177,7 @@ static void MainEventHandler(GdkEvent *event, void *main_window) {
int Abaddon::StartGTK() {
m_gtk_app = Gtk::Application::create("com.github.uowuo.abaddon");
+ Glib::set_application_name(APP_TITLE);
#ifdef WITH_LIBHANDY
m_gtk_app->signal_activate().connect([] {
@@ -191,13 +192,6 @@ int Abaddon::StartGTK() {
dlg.run();
});
- m_css_low_provider = Gtk::CssProvider::create();
- m_css_low_provider->signal_parsing_error().connect([](const Glib::RefPtr §ion, const Glib::Error &error) {
- Gtk::MessageDialog dlg("low-priority css failed parsing (" + error.what() + ")", false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
- dlg.set_position(Gtk::WIN_POS_CENTER);
- dlg.run();
- });
-
#ifdef _WIN32
bool png_found = false;
bool gif_found = false;
@@ -253,7 +247,6 @@ int Abaddon::StartGTK() {
Gtk::MessageDialog dlg(*m_main_window, "The audio engine could not be initialized!", false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
dlg.set_position(Gtk::WIN_POS_CENTER);
dlg.run();
- return 1;
}
#endif
@@ -1086,10 +1079,6 @@ void Abaddon::ActionReloadCSS() {
Gtk::StyleContext::remove_provider_for_screen(Gdk::Screen::get_default(), m_css_provider);
m_css_provider->load_from_path(GetCSSPath("/" + GetSettings().MainCSS));
Gtk::StyleContext::add_provider_for_screen(Gdk::Screen::get_default(), m_css_provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-
- Gtk::StyleContext::remove_provider_for_screen(Gdk::Screen::get_default(), m_css_low_provider);
- m_css_low_provider->load_from_path(GetCSSPath("/application-low-priority.css"));
- Gtk::StyleContext::add_provider_for_screen(Gdk::Screen::get_default(), m_css_low_provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION - 1);
} catch (Glib::Error &e) {
Gtk::MessageDialog dlg(*m_main_window, "css failed to load (" + e.what() + ")", false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
dlg.set_position(Gtk::WIN_POS_CENTER);
diff --git a/src/abaddon.hpp b/src/abaddon.hpp
index 85b2fa0..6093523 100644
--- a/src/abaddon.hpp
+++ b/src/abaddon.hpp
@@ -182,7 +182,6 @@ private:
mutable std::mutex m_mutex;
Glib::RefPtr m_gtk_app;
Glib::RefPtr m_css_provider;
- Glib::RefPtr m_css_low_provider; // registered with a lower priority to allow better customization
Glib::RefPtr m_tray;
std::unique_ptr m_main_window; // wah wah cant create a gtkstylecontext fuck you
diff --git a/src/audio/manager.cpp b/src/audio/manager.cpp
index 0336699..8f2a5a3 100644
--- a/src/audio/manager.cpp
+++ b/src/audio/manager.cpp
@@ -8,7 +8,7 @@
#include "manager.hpp"
#include
#include
-#include
+#include
#include
#include
#include
@@ -61,9 +61,37 @@ void capture_data_callback(ma_device *pDevice, void *pOutput, const void *pInput
mgr->m_rtp_timestamp += 480;
}
-AudioManager::AudioManager() {
+void mgr_log_callback(void *pUserData, ma_uint32 level, const char *pMessage) {
+ auto *log = static_cast(pUserData);
+
+ gchar *msg = g_strstrip(g_strdup(pMessage));
+
+ switch (level) {
+ case MA_LOG_LEVEL_DEBUG:
+ log->debug(msg);
+ break;
+ case MA_LOG_LEVEL_INFO:
+ log->info(msg);
+ break;
+ case MA_LOG_LEVEL_WARNING:
+ log->warn(msg);
+ break;
+ case MA_LOG_LEVEL_ERROR:
+ log->error(msg);
+ default:
+ break;
+ }
+
+ g_free(msg);
+}
+
+AudioManager::AudioManager()
+ : m_log(spdlog::stdout_color_mt("miniaudio")) {
m_ok = true;
+ ma_log_init(nullptr, &m_ma_log);
+ ma_log_register_callback(&m_ma_log, ma_log_callback_init(mgr_log_callback, m_log.get()));
+
#ifdef WITH_RNNOISE
RNNoiseInitialize();
#endif
@@ -77,7 +105,9 @@ AudioManager::AudioManager() {
}
opus_encoder_ctl(m_encoder, OPUS_SET_BITRATE(64000));
- if (ma_context_init(nullptr, 0, nullptr, &m_context) != MA_SUCCESS) {
+ auto ctx_cfg = ma_context_config_init();
+ ctx_cfg.pLog = &m_ma_log;
+ if (ma_context_init(nullptr, 0, &ctx_cfg, &m_context) != MA_SUCCESS) {
spdlog::get("audio")->error("failed to initialize context");
m_ok = false;
return;
@@ -99,14 +129,14 @@ AudioManager::AudioManager() {
m_playback_id = *playback_id;
m_playback_config.playback.pDeviceID = &m_playback_id;
- if (ma_device_init(&m_context, &m_playback_config, &m_playback_device) != MA_SUCCESS) {
- spdlog::get("audio")->error("failed to initialize playback device");
+ if (auto code = ma_device_init(&m_context, &m_playback_config, &m_playback_device); code != MA_SUCCESS) {
+ spdlog::get("audio")->error("failed to initialize playback device (code: {})", static_cast(code));
m_ok = false;
return;
}
- if (ma_device_start(&m_playback_device) != MA_SUCCESS) {
- spdlog::get("audio")->error("failed to start playback");
+ if (auto code = ma_device_start(&m_playback_device); code != MA_SUCCESS) {
+ spdlog::get("audio")->error("failed to start playback (code: {})", static_cast(code));
ma_device_uninit(&m_playback_device);
m_ok = false;
return;
@@ -129,8 +159,8 @@ AudioManager::AudioManager() {
m_capture_id = *capture_id;
m_capture_config.capture.pDeviceID = &m_capture_id;
- if (ma_device_init(&m_context, &m_capture_config, &m_capture_device) != MA_SUCCESS) {
- spdlog::get("audio")->error("failed to initialize capture device");
+ if (auto code = ma_device_init(&m_context, &m_capture_config, &m_capture_device); code != MA_SUCCESS) {
+ spdlog::get("audio")->error("failed to initialize capture device (code: {})", static_cast(code));
m_ok = false;
return;
}
@@ -185,7 +215,7 @@ void AudioManager::SetOpusBuffer(uint8_t *ptr) {
}
void AudioManager::FeedMeOpus(uint32_t ssrc, const std::vector &data) {
- if (!m_should_playback) return;
+ if (!m_should_playback || ma_device_get_state(&m_playback_device) != ma_device_state_started) return;
std::lock_guard _(m_mutex);
if (m_muted_ssrcs.find(ssrc) != m_muted_ssrcs.end()) return;
diff --git a/src/audio/manager.hpp b/src/audio/manager.hpp
index 5321cb5..f5b433f 100644
--- a/src/audio/manager.hpp
+++ b/src/audio/manager.hpp
@@ -14,6 +14,7 @@
#include
#include
#include
+#include
#ifdef WITH_RNNOISE
#include
@@ -163,6 +164,9 @@ private:
#endif
std::atomic m_rtp_timestamp = 0;
+ ma_log m_ma_log;
+ std::shared_ptr m_log;
+
public:
using type_signal_opus_packet = sigc::signal;
type_signal_opus_packet signal_opus_packet();
diff --git a/src/components/cellrenderermemberlist.cpp b/src/components/cellrenderermemberlist.cpp
index 66b223e..ee1ea3e 100644
--- a/src/components/cellrenderermemberlist.cpp
+++ b/src/components/cellrenderermemberlist.cpp
@@ -6,7 +6,8 @@ CellRendererMemberList::CellRendererMemberList()
, m_property_id(*this, "id")
, m_property_name(*this, "name")
, m_property_pixbuf(*this, "pixbuf")
- , m_property_color(*this, "color") {
+ , m_property_color(*this, "color")
+ , m_property_status(*this, "status") {
property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE;
property_xpad() = 2;
property_ypad() = 2;
@@ -35,6 +36,10 @@ Glib::PropertyProxy CellRendererMemberList::property_color() {
return m_property_color.get_proxy();
}
+Glib::PropertyProxy CellRendererMemberList::property_status() {
+ return m_property_status.get_proxy();
+}
+
void CellRendererMemberList::get_preferred_width_vfunc(Gtk::Widget &widget, int &minimum_width, int &natural_width) const {
switch (m_property_type.get_value()) {
case MemberListRenderType::Role:
@@ -117,8 +122,9 @@ void CellRendererMemberList::get_preferred_height_for_width_vfunc_member(Gtk::Wi
}
void CellRendererMemberList::render_vfunc_member(const Cairo::RefPtr &cr, Gtk::Widget &widget, const Gdk::Rectangle &background_area, const Gdk::Rectangle &cell_area, Gtk::CellRendererState flags) {
+ // Text
Gdk::Rectangle text_cell_area = cell_area;
- text_cell_area.set_x(22);
+ text_cell_area.set_x(31);
const auto color = m_property_color.get_value();
if (color.get_alpha_u() > 0) {
m_renderer_text.property_foreground_rgba().set_value(color);
@@ -126,6 +132,30 @@ void CellRendererMemberList::render_vfunc_member(const Cairo::RefPtrbegin_new_path();
+ switch (m_property_status.get_value()) {
+ case PresenceStatus::Online:
+ cr->set_source_rgb(33.0 / 255.0, 157.0 / 255.0, 86.0 / 255.0);
+ break;
+ case PresenceStatus::Idle:
+ cr->set_source_rgb(230.0 / 255.0, 170.0 / 255.0, 48.0 / 255.0);
+ break;
+ case PresenceStatus::DND:
+ cr->set_source_rgb(233.0 / 255.0, 61.0 / 255.0, 65.0 / 255.0);
+ break;
+ case PresenceStatus::Offline:
+ cr->set_source_rgb(122.0 / 255.0, 126.0 / 255.0, 135.0 / 255.0);
+ break;
+ }
+
+ cr->arc(background_area.get_x() + 6.0 + 16.0 + 6.0, background_area.get_y() + background_area.get_height() / 2.0, 2.0, 0.0, 2 * (4 * std::atan(1)));
+ cr->close_path();
+ cr->fill_preserve();
+ cr->stroke();
+
+ // Icon
const double icon_x = background_area.get_x() + 6.0;
const double icon_y = background_area.get_y() + background_area.get_height() / 2.0 - 8.0;
Gdk::Cairo::set_source_pixbuf(cr, m_property_pixbuf.get_value(), icon_x, icon_y);
diff --git a/src/components/cellrenderermemberlist.hpp b/src/components/cellrenderermemberlist.hpp
index 7a49ccf..79d32e3 100644
--- a/src/components/cellrenderermemberlist.hpp
+++ b/src/components/cellrenderermemberlist.hpp
@@ -1,5 +1,6 @@
#pragma once
#include
+#include "discord/activity.hpp"
enum class MemberListRenderType : uint8_t {
Role,
@@ -16,6 +17,7 @@ public:
Glib::PropertyProxy property_name();
Glib::PropertyProxy> property_pixbuf();
Glib::PropertyProxy property_color();
+ Glib::PropertyProxy property_status();
protected:
void get_preferred_width_vfunc(Gtk::Widget &widget, int &minimum_width, int &natural_width) const override;
@@ -56,6 +58,7 @@ private:
Glib::Property m_property_name;
Glib::Property> m_property_pixbuf;
Glib::Property m_property_color;
+ Glib::Property m_property_status;
using type_signal_render = sigc::signal;
type_signal_render m_signal_render;
diff --git a/src/components/channellist/cellrendererchannels.cpp b/src/components/channellist/cellrendererchannels.cpp
index e0079cd..3db136b 100644
--- a/src/components/channellist/cellrendererchannels.cpp
+++ b/src/components/channellist/cellrendererchannels.cpp
@@ -7,6 +7,49 @@ constexpr static double M_PI = 3.14159265358979;
constexpr static double M_PI_H = M_PI / 2.0;
constexpr static double M_PI_3_2 = M_PI * 3.0 / 2.0;
+void AddUnreadIndicator(const Cairo::RefPtr &cr, Gtk::Widget &widget, const Gdk::Rectangle &background_area) {
+ static const auto color_setting = Gdk::RGBA(Abaddon::Get().GetSettings().UnreadIndicatorColor);
+
+ const auto color = color_setting.get_alpha_u() > 0 ? color_setting : widget.get_style_context()->get_background_color(Gtk::STATE_FLAG_SELECTED);
+
+ cr->set_source_rgb(color.get_red(), color.get_green(), color.get_blue());
+ const auto x = background_area.get_x();
+ const auto y = background_area.get_y();
+ const auto w = background_area.get_width();
+ const auto h = background_area.get_height();
+ cr->rectangle(x, y, 3, h);
+ cr->fill();
+}
+
+void RenderExpander(int x_offset, const Cairo::RefPtr &cr, Gtk::Widget &widget, const Gdk::Rectangle &background_area, bool is_expanded) {
+ constexpr static int len = 5;
+ int x1, y1, x2, y2, x3, y3;
+ if (is_expanded) {
+ x1 = background_area.get_x() + x_offset;
+ y1 = background_area.get_y() + background_area.get_height() / 2 - len;
+ x2 = background_area.get_x() + x_offset + len;
+ y2 = background_area.get_y() + background_area.get_height() / 2 + len;
+ x3 = background_area.get_x() + x_offset + len * 2;
+ y3 = background_area.get_y() + background_area.get_height() / 2 - len;
+ } else {
+ x1 = background_area.get_x() + x_offset;
+ y1 = background_area.get_y() + background_area.get_height() / 2 - len;
+ x2 = background_area.get_x() + x_offset + len * 2;
+ y2 = background_area.get_y() + background_area.get_height() / 2;
+ x3 = background_area.get_x() + x_offset;
+ y3 = background_area.get_y() + background_area.get_height() / 2 + len;
+ }
+ cr->move_to(x1, y1);
+ cr->line_to(x2, y2);
+ cr->line_to(x3, y3);
+ auto expander_color = Gdk::RGBA(Abaddon::Get().GetSettings().ChannelsExpanderColor);
+ if (expander_color.get_alpha_u() == 0) {
+ expander_color = widget.get_style_context()->get_background_color(Gtk::STATE_FLAG_SELECTED);
+ }
+ cr->set_source_rgb(expander_color.get_red(), expander_color.get_green(), expander_color.get_blue());
+ cr->stroke();
+}
+
CellRendererChannels::CellRendererChannels()
: Glib::ObjectBase(typeid(CellRendererChannels))
, Gtk::CellRenderer()
@@ -207,30 +250,7 @@ void CellRendererChannels::get_preferred_height_for_width_vfunc_folder(Gtk::Widg
}
void CellRendererChannels::render_vfunc_folder(const Cairo::RefPtr &cr, Gtk::Widget &widget, const Gdk::Rectangle &background_area, const Gdk::Rectangle &cell_area, Gtk::CellRendererState flags) {
- constexpr static int len = 5;
- int x1, y1, x2, y2, x3, y3;
- if (property_expanded()) {
- x1 = background_area.get_x() + 7;
- y1 = background_area.get_y() + background_area.get_height() / 2 - len;
- x2 = background_area.get_x() + 7 + len;
- y2 = background_area.get_y() + background_area.get_height() / 2 + len;
- x3 = background_area.get_x() + 7 + len * 2;
- y3 = background_area.get_y() + background_area.get_height() / 2 - len;
- } else {
- x1 = background_area.get_x() + 7;
- y1 = background_area.get_y() + background_area.get_height() / 2 - len;
- x2 = background_area.get_x() + 7 + len * 2;
- y2 = background_area.get_y() + background_area.get_height() / 2;
- x3 = background_area.get_x() + 7;
- y3 = background_area.get_y() + background_area.get_height() / 2 + len;
- }
- cr->move_to(x1, y1);
- cr->line_to(x2, y2);
- cr->line_to(x3, y3);
- const auto expander_color = Gdk::RGBA(Abaddon::Get().GetSettings().ChannelsExpanderColor);
- cr->set_source_rgb(expander_color.get_red(), expander_color.get_green(), expander_color.get_blue());
- cr->stroke();
-
+ RenderExpander(7, cr, widget, background_area, property_expanded());
Gtk::Requisition text_minimum, text_natural;
m_renderer_text.get_preferred_size(widget, text_minimum, text_natural);
@@ -241,11 +261,8 @@ void CellRendererChannels::render_vfunc_folder(const Cairo::RefPtr(text_w),
static_cast(text_h));
- static const auto color = Gdk::RGBA(Abaddon::Get().GetSettings().ChannelColor);
- m_renderer_text.property_foreground_rgba() = color;
m_renderer_text.render(cr, widget, background_area, text_cell_area, flags);
const bool hover_only = Abaddon::Get().GetSettings().AnimatedGuildHoverOnly;
@@ -373,14 +388,9 @@ void CellRendererChannels::render_vfunc_guild(const Cairo::RefPtrset_source_rgb(color.get_red(), color.get_green(), color.get_blue());
- const auto x = background_area.get_x();
- const auto y = background_area.get_y();
- const auto w = background_area.get_width();
- const auto h = background_area.get_height();
- cr->rectangle(x, y + h / 2.0 - 24.0 / 2.0, 3.0, 24.0);
- cr->fill();
+ auto area = background_area;
+ area.set_y(area.get_y() + area.get_height() / 2.0 - 24.0 / 2.0);
+ AddUnreadIndicator(cr, widget, area);
}
if (total_mentions < 1) return;
@@ -410,42 +420,8 @@ void CellRendererChannels::get_preferred_height_for_width_vfunc_category(Gtk::Wi
m_renderer_text.get_preferred_height_for_width(widget, width, minimum_height, natural_height);
}
-void AddUnreadIndicator(const Cairo::RefPtr &cr, const Gdk::Rectangle &background_area) {
- static const auto color = Gdk::RGBA(Abaddon::Get().GetSettings().UnreadIndicatorColor);
- cr->set_source_rgb(color.get_red(), color.get_green(), color.get_blue());
- const auto x = background_area.get_x();
- const auto y = background_area.get_y();
- const auto w = background_area.get_width();
- const auto h = background_area.get_height();
- cr->rectangle(x, y, 3, h);
- cr->fill();
-}
-
void CellRendererChannels::render_vfunc_category(const Cairo::RefPtr &cr, Gtk::Widget &widget, const Gdk::Rectangle &background_area, const Gdk::Rectangle &cell_area, Gtk::CellRendererState flags) {
- // todo: figure out how Gtk::Arrow is rendered because i like it better :^)
- constexpr static int len = 5;
- int x1, y1, x2, y2, x3, y3;
- if (property_expanded()) {
- x1 = background_area.get_x() + 7;
- y1 = background_area.get_y() + background_area.get_height() / 2 - len;
- x2 = background_area.get_x() + 7 + len;
- y2 = background_area.get_y() + background_area.get_height() / 2 + len;
- x3 = background_area.get_x() + 7 + len * 2;
- y3 = background_area.get_y() + background_area.get_height() / 2 - len;
- } else {
- x1 = background_area.get_x() + 7;
- y1 = background_area.get_y() + background_area.get_height() / 2 - len;
- x2 = background_area.get_x() + 7 + len * 2;
- y2 = background_area.get_y() + background_area.get_height() / 2;
- x3 = background_area.get_x() + 7;
- y3 = background_area.get_y() + background_area.get_height() / 2 + len;
- }
- cr->move_to(x1, y1);
- cr->line_to(x2, y2);
- cr->line_to(x3, y3);
- const auto expander_color = Gdk::RGBA(Abaddon::Get().GetSettings().ChannelsExpanderColor);
- cr->set_source_rgb(expander_color.get_red(), expander_color.get_green(), expander_color.get_blue());
- cr->stroke();
+ RenderExpander(7, cr, widget, background_area, property_expanded());
Gtk::Requisition text_minimum, text_natural;
m_renderer_text.get_preferred_size(widget, text_minimum, text_natural);
@@ -457,23 +433,14 @@ void CellRendererChannels::render_vfunc_category(const Cairo::RefPtr 0) {
- AddUnreadIndicator(cr, background_area);
+ AddUnreadIndicator(cr, widget, background_area);
}
- m_renderer_text.property_foreground_rgba() = color;
}
m_renderer_text.render(cr, widget, background_area, text_cell_area, flags);
- m_renderer_text.property_foreground_set() = false;
}
// text channel
@@ -509,23 +476,14 @@ void CellRendererChannels::render_vfunc_channel(const Cairo::RefPtrget_color(Gtk::STATE_FLAG_NORMAL);
+ if (property_nsfw()) color = nsfw_color;
+ if (is_muted) color.set_alpha(0.6);
+
+ m_renderer_text.property_foreground_rgba() = color;
m_renderer_text.render(cr, widget, background_area, text_cell_area, flags);
- // unset foreground to default so properties dont bleed
m_renderer_text.property_foreground_set() = false;
// unread
@@ -535,7 +493,7 @@ void CellRendererChannels::render_vfunc_channel(const Cairo::RefPtrset_source_rgb(color.get_red(), color.get_green(), color.get_blue());
- const auto x = background_area.get_x();
- const auto y = background_area.get_y();
- const auto w = background_area.get_width();
- const auto h = background_area.get_height();
- cr->rectangle(x, y, 3, h);
- cr->fill();
+ AddUnreadIndicator(cr, widget, background_area);
}
if (unread_state < 1) return;
@@ -667,31 +607,7 @@ void CellRendererChannels::render_vfunc_voice_channel(const Cairo::RefPtrshow_in_cairo_context(cr);
- // expander
- constexpr static int len = 5;
- constexpr static int offset = 24;
- int x1, y1, x2, y2, x3, y3;
- if (property_expanded()) {
- x1 = background_area.get_x() + offset;
- y1 = background_area.get_y() + background_area.get_height() / 2 - len;
- x2 = background_area.get_x() + offset + len;
- y2 = background_area.get_y() + background_area.get_height() / 2 + len;
- x3 = background_area.get_x() + offset + len * 2;
- y3 = background_area.get_y() + background_area.get_height() / 2 - len;
- } else {
- x1 = background_area.get_x() + offset;
- y1 = background_area.get_y() + background_area.get_height() / 2 - len;
- x2 = background_area.get_x() + offset + len * 2;
- y2 = background_area.get_y() + background_area.get_height() / 2;
- x3 = background_area.get_x() + offset;
- y3 = background_area.get_y() + background_area.get_height() / 2 + len;
- }
- cr->move_to(x1, y1);
- cr->line_to(x2, y2);
- cr->line_to(x3, y3);
- const auto expander_color = Gdk::RGBA(Abaddon::Get().GetSettings().ChannelsExpanderColor);
- cr->set_source_rgb(expander_color.get_red(), expander_color.get_green(), expander_color.get_blue());
- cr->stroke();
+ RenderExpander(24, cr, widget, background_area, property_expanded());
}
// voice participant
@@ -897,18 +813,7 @@ void CellRendererChannels::render_vfunc_dm(const Cairo::RefPtr &
const auto id = m_property_id.get_value();
const bool is_muted = discord.IsChannelMuted(id);
- static const auto color = Gdk::RGBA(Abaddon::Get().GetSettings().ChannelColor);
- if (Abaddon::Get().GetDiscordClient().IsChannelMuted(m_property_id.get_value())) {
- auto muted = color;
- muted.set_red(muted.get_red() * 0.5);
- muted.set_green(muted.get_green() * 0.5);
- muted.set_blue(muted.get_blue() * 0.5);
- m_renderer_text.property_foreground_rgba() = muted;
- } else {
- m_renderer_text.property_foreground_rgba() = color;
- }
m_renderer_text.render(cr, widget, background_area, text_cell_area, flags);
- m_renderer_text.property_foreground_set() = false;
Gdk::Cairo::set_source_pixbuf(cr, m_property_pixbuf.get_value(), icon_x, icon_y);
cr->rectangle(icon_x, icon_y, icon_w, icon_h);
@@ -921,14 +826,7 @@ void CellRendererChannels::render_vfunc_dm(const Cairo::RefPtr &
if (unread_state < 0) return;
if (!is_muted) {
- static const auto color = Gdk::RGBA(Abaddon::Get().GetSettings().UnreadIndicatorColor);
- cr->set_source_rgb(color.get_red(), color.get_green(), color.get_blue());
- const auto x = background_area.get_x();
- const auto y = background_area.get_y();
- const auto w = background_area.get_width();
- const auto h = background_area.get_height();
- cr->rectangle(x, y, 3, h);
- cr->fill();
+ AddUnreadIndicator(cr, widget, background_area);
}
}
@@ -955,8 +853,11 @@ void CellRendererChannels::unread_render_mentions(const Cairo::RefPtrget_pixel_size(width, height);
{
- static const auto bg = Gdk::RGBA(Abaddon::Get().GetSettings().MentionBadgeColor);
- static const auto text = Gdk::RGBA(Abaddon::Get().GetSettings().MentionBadgeTextColor);
+ static const auto badge_setting = Gdk::RGBA(Abaddon::Get().GetSettings().MentionBadgeColor);
+ static const auto text_setting = Gdk::RGBA(Abaddon::Get().GetSettings().MentionBadgeTextColor);
+
+ auto bg = badge_setting.get_alpha_u() > 0 ? badge_setting : widget.get_style_context()->get_background_color(Gtk::STATE_FLAG_SELECTED);
+ auto text = text_setting.get_alpha_u() > 0 ? text_setting : widget.get_style_context()->get_color(Gtk::STATE_FLAG_SELECTED);
const auto x = cell_area.get_x() + edge - width - MentionsRightPad;
const auto y = cell_area.get_y() + cell_area.get_height() / 2.0 - height / 2.0 - 1;
diff --git a/src/components/channellist/channellisttree.cpp b/src/components/channellist/channellisttree.cpp
index c166d42..0e2cda6 100644
--- a/src/components/channellist/channellisttree.cpp
+++ b/src/components/channellist/channellisttree.cpp
@@ -1,6 +1,5 @@
#include "channellisttree.hpp"
#include "imgmanager.hpp"
-#include "components/statusindicator.hpp"
#include
#include