From 7f3561cc43064fae48459c78b4e3ee32d7870804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20J=C3=BCrgens?= Date: Thu, 14 Jul 2022 11:57:44 +0200 Subject: [PATCH 1/5] refresh targets if needed --- src/discordpage.cpp | 1 + src/streamdialog.cpp | 13 +++++++++---- src/streamdialog.h | 3 +++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/discordpage.cpp b/src/discordpage.cpp index 1946de3..ee62975 100644 --- a/src/discordpage.cpp +++ b/src/discordpage.cpp @@ -98,6 +98,7 @@ void DiscordPage::javaScriptConsoleMessage( m_streamDialog.setHidden(false); else m_streamDialog.activateWindow(); + m_streamDialog.updateTargets(); } else if (message == "!discord-screenaudio-stream-stopped") { stopVirtmic(); } else { diff --git a/src/streamdialog.cpp b/src/streamdialog.cpp index 3aa3de9..0ea9ade 100644 --- a/src/streamdialog.cpp +++ b/src/streamdialog.cpp @@ -19,10 +19,7 @@ StreamDialog::StreamDialog() : QWidget() { layout->addWidget(targetLabel); m_targetComboBox = new QComboBox; - m_targetComboBox->addItem("None"); - for (auto target : Virtmic::getTargets()) { - m_targetComboBox->addItem(target); - } + updateTargets(); layout->addWidget(m_targetComboBox); auto qualityLabel = new QLabel; @@ -71,3 +68,11 @@ void StreamDialog::startStream() { m_qualityFPSComboBox->currentData().toUInt()); setHidden(true); } + +void StreamDialog::updateTargets() { + m_targetComboBox->clear(); + m_targetComboBox->addItem("None"); + for (auto target : Virtmic::getTargets()) { + m_targetComboBox->addItem(target); + } +} diff --git a/src/streamdialog.h b/src/streamdialog.h index 6818d8f..c2f833c 100644 --- a/src/streamdialog.h +++ b/src/streamdialog.h @@ -19,6 +19,9 @@ Q_SIGNALS: void requestedStreamStart(QString target, uint width, uint height, uint frameRate); +public Q_SLOTS: + void updateTargets(); + private Q_SLOTS: void startStream(); }; From 06412b182e24884faf79e004bec643ba27269411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20J=C3=BCrgens?= Date: Thu, 14 Jul 2022 11:58:29 +0200 Subject: [PATCH 2/5] bump version to 1.0.0-rc.1 --- assets/userscript.js | 2 +- src/main.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/userscript.js b/assets/userscript.js index 671f18c..cf6cf57 100644 --- a/assets/userscript.js +++ b/assets/userscript.js @@ -116,7 +116,7 @@ setInterval(() => { ) { for (const el of document.getElementsByClassName("info-3pQQBb")) { const aboutEl = document.createElement("div"); - aboutEl.innerText = "discord-screenaudio v1.0.0-alpha"; + aboutEl.innerText = "discord-screenaudio v1.0.0-rc.1"; aboutEl.style.fontSize = "12px"; aboutEl.style.color = "var(--text-muted)"; aboutEl.classList.add("dirscordScreenaudioAboutText"); diff --git a/src/main.cpp b/src/main.cpp index 9f1e217..a4730e7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,7 +7,7 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); QApplication::setApplicationName("discord-screenaudio"); - QApplication::setApplicationVersion("1.0.0-alpha"); + QApplication::setApplicationVersion("1.0.0-rc.1"); QCommandLineParser parser; parser.setApplicationDescription( From e462dc299063dc5bfa9b4cb5fc145224aff56593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20J=C3=BCrgens?= Date: Thu, 14 Jul 2022 14:43:52 +0200 Subject: [PATCH 3/5] fix --- assets/userscript.js | 5 +++++ src/discordpage.cpp | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/assets/userscript.js b/assets/userscript.js index cf6cf57..4e10533 100644 --- a/assets/userscript.js +++ b/assets/userscript.js @@ -111,6 +111,7 @@ setInterval(() => { } } + // Add about text in settings if ( document.getElementsByClassName("dirscordScreenaudioAboutText").length == 0 ) { @@ -123,4 +124,8 @@ setInterval(() => { el.appendChild(aboutEl); } } + + // Remove stream settings if stream is active + document.getElementById("manage-streams-change-windows")?.remove(); + document.querySelector(`[aria-label="Stream Settings"]`)?.remove(); }, 1000); diff --git a/src/discordpage.cpp b/src/discordpage.cpp index ee62975..ef7ae34 100644 --- a/src/discordpage.cpp +++ b/src/discordpage.cpp @@ -84,7 +84,7 @@ void DiscordPage::stopVirtmic() { } void DiscordPage::startVirtmic(QString target) { - if (target != "") { + if (target != "None") { qDebug() << "[virtmic] Starting Virtmic with target" << target; m_virtmicProcess.start(QApplication::arguments()[0], {"--virtmic", target}); } @@ -111,7 +111,7 @@ void DiscordPage::startStream(QString target, uint width, uint height, stopVirtmic(); startVirtmic(target); // Wait a bit for the virtmic to start - QTimer::singleShot(target == "" ? 0 : 200, [=]() { + QTimer::singleShot(target == "None" ? 0 : 200, [=]() { runJavaScript(QString("window.discordScreenaudioStartStream(%1, %2, %3);") .arg(width) .arg(height) From d57155b25dd6344a78b2db8c99083cdd9377b16d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20J=C3=BCrgens?= Date: Sat, 16 Jul 2022 17:23:25 +0200 Subject: [PATCH 4/5] bump version to 1.0.0-rc.2 --- assets/userscript.js | 2 +- src/main.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/userscript.js b/assets/userscript.js index 4e10533..578087e 100644 --- a/assets/userscript.js +++ b/assets/userscript.js @@ -117,7 +117,7 @@ setInterval(() => { ) { for (const el of document.getElementsByClassName("info-3pQQBb")) { const aboutEl = document.createElement("div"); - aboutEl.innerText = "discord-screenaudio v1.0.0-rc.1"; + aboutEl.innerText = "discord-screenaudio v1.0.0-rc.2"; aboutEl.style.fontSize = "12px"; aboutEl.style.color = "var(--text-muted)"; aboutEl.classList.add("dirscordScreenaudioAboutText"); diff --git a/src/main.cpp b/src/main.cpp index a4730e7..603379a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,7 +7,7 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); QApplication::setApplicationName("discord-screenaudio"); - QApplication::setApplicationVersion("1.0.0-rc.1"); + QApplication::setApplicationVersion("1.0.0-rc.2"); QCommandLineParser parser; parser.setApplicationDescription( From 504d655de662db93be1557beb3fa166094a100d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20J=C3=BCrgens?= Date: Sat, 16 Jul 2022 22:32:01 +0200 Subject: [PATCH 5/5] add install script --- README | 7 ++----- scripts/install.sh | 6 ++++++ 2 files changed, 8 insertions(+), 5 deletions(-) create mode 100755 scripts/install.sh diff --git a/README b/README index 24f6f10..2c2dd53 100644 --- a/README +++ b/README @@ -1,9 +1,6 @@ --- Build instructions -- +-- Install instructions -- -mkdir build -cd build -cmake ../ -make +Just run `scripts/install.sh` ./discord-screenaudio diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100755 index 0000000..e7e393e --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,6 @@ +#!/usr/bin/bash + +export CMAKE_GENERATOR="Ninja" +cmake -B build +cmake --build build --config Release +sudo cmake --install build