summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/abaddon.cpp22
-rw-r--r--src/abaddon.hpp2
-rw-r--r--src/components/voiceinfobox.cpp12
-rw-r--r--src/components/voiceinfobox.hpp1
4 files changed, 27 insertions, 10 deletions
diff --git a/src/abaddon.cpp b/src/abaddon.cpp
index 8b760fd..5ed17be 100644
--- a/src/abaddon.cpp
+++ b/src/abaddon.cpp
@@ -432,6 +432,19 @@ void Abaddon::DiscordOnThreadUpdate(const ThreadUpdateData &data) {
#ifdef WITH_VOICE
void Abaddon::OnVoiceConnected() {
m_audio->StartCaptureDevice();
+ ShowVoiceWindow();
+}
+
+void Abaddon::OnVoiceDisconnected() {
+ m_audio->StopCaptureDevice();
+ m_audio->RemoveAllSSRCs();
+ if (m_voice_window != nullptr) {
+ m_voice_window->close();
+ }
+}
+
+void Abaddon::ShowVoiceWindow() {
+ if (m_voice_window != nullptr) return;
auto *wnd = new VoiceWindow(m_discord.GetVoiceChannelID());
m_voice_window = wnd;
@@ -470,21 +483,12 @@ void Abaddon::OnVoiceConnected() {
wnd->show();
wnd->signal_hide().connect([this, wnd]() {
- m_discord.DisconnectFromVoice();
m_voice_window = nullptr;
delete wnd;
delete m_user_menu;
SetupUserMenu();
});
}
-
-void Abaddon::OnVoiceDisconnected() {
- m_audio->StopCaptureDevice();
- m_audio->RemoveAllSSRCs();
- if (m_voice_window != nullptr) {
- m_voice_window->close();
- }
-}
#endif
SettingsManager::Settings &Abaddon::GetSettings() {
diff --git a/src/abaddon.hpp b/src/abaddon.hpp
index f45f435..5540c5a 100644
--- a/src/abaddon.hpp
+++ b/src/abaddon.hpp
@@ -92,6 +92,8 @@ public:
#ifdef WITH_VOICE
void OnVoiceConnected();
void OnVoiceDisconnected();
+
+ void ShowVoiceWindow();
#endif
SettingsManager::Settings &GetSettings();
diff --git a/src/components/voiceinfobox.cpp b/src/components/voiceinfobox.cpp
index f4dc6ed..456c5f0 100644
--- a/src/components/voiceinfobox.cpp
+++ b/src/components/voiceinfobox.cpp
@@ -70,6 +70,15 @@ VoiceInfoBox::VoiceInfoBox()
m_status.set_label(label);
});
+ AddPointerCursor(m_status_ev);
+ m_status_ev.signal_button_press_event().connect([this](GdkEventButton *ev) -> bool {
+ if (ev->type == GDK_BUTTON_PRESS && ev->button == GDK_BUTTON_PRIMARY) {
+ Abaddon::Get().ShowVoiceWindow();
+ return true;
+ }
+ return false;
+ });
+
m_status.set_ellipsize(Pango::ELLIPSIZE_END);
m_location.set_ellipsize(Pango::ELLIPSIZE_END);
@@ -79,7 +88,8 @@ VoiceInfoBox::VoiceInfoBox()
m_disconnect_img.set_hexpand(true);
m_disconnect_img.set_halign(Gtk::ALIGN_END);
- m_left.add(m_status);
+ m_status_ev.add(m_status);
+ m_left.add(m_status_ev);
m_left.add(m_location);
add(m_left);
diff --git a/src/components/voiceinfobox.hpp b/src/components/voiceinfobox.hpp
index e0bc4e8..0117c0d 100644
--- a/src/components/voiceinfobox.hpp
+++ b/src/components/voiceinfobox.hpp
@@ -11,6 +11,7 @@ public:
private:
Gtk::Box m_left;
+ Gtk::EventBox m_status_ev;
Gtk::Label m_status;
Gtk::Label m_location;