Merge branch 'master' into appimage

This commit is contained in:
Malte Jürgens 2022-07-17 19:43:36 +02:00
commit 6681c0591a
No known key found for this signature in database
GPG Key ID: D29FBD5F93C0CFC3
7 changed files with 30 additions and 13 deletions

7
README
View File

@ -1,9 +1,6 @@
-- Build instructions --
-- Install instructions --
mkdir build
cd build
cmake ../
make
Just run `scripts/install.sh`
./discord-screenaudio

View File

@ -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);

6
scripts/install.sh Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/bash
export CMAKE_GENERATOR="Ninja"
cmake -B build
cmake --build build --config Release
sudo cmake --install build

View File

@ -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)

View File

@ -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(

View File

@ -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);
}
}

View File

@ -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();
};