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/assets/userscript.js b/assets/userscript.js index 671f18c..578087e 100644 --- a/assets/userscript.js +++ b/assets/userscript.js @@ -111,16 +111,21 @@ setInterval(() => { } } + // Add about text in settings if ( document.getElementsByClassName("dirscordScreenaudioAboutText").length == 0 ) { 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.2"; aboutEl.style.fontSize = "12px"; aboutEl.style.color = "var(--text-muted)"; aboutEl.classList.add("dirscordScreenaudioAboutText"); 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/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 diff --git a/src/discordpage.cpp b/src/discordpage.cpp index 3e89c49..1aa3914 100644 --- a/src/discordpage.cpp +++ b/src/discordpage.cpp @@ -83,7 +83,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}); } @@ -97,6 +97,7 @@ void DiscordPage::javaScriptConsoleMessage( m_streamDialog.setHidden(false); else m_streamDialog.activateWindow(); + m_streamDialog.updateTargets(); } else if (message == "!discord-screenaudio-stream-stopped") { stopVirtmic(); } else { @@ -109,7 +110,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) diff --git a/src/main.cpp b/src/main.cpp index 9f1e217..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-alpha"); + QApplication::setApplicationVersion("1.0.0-rc.2"); QCommandLineParser parser; parser.setApplicationDescription( 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(); };