This commit is contained in:
Wizzard 2023-07-12 18:28:56 -04:00
parent 1a60367c0a
commit a8d7965c43
3 changed files with 134 additions and 105 deletions

View File

@ -340,6 +340,16 @@ function main() {
// }) // })
// ); // );
section.appendChild(
createSwitch(
"Allow audio from your mic (and audio you pass through) to become stereo",
await userscript.getBoolPref("stereoMic", false),
(enabled) => {
userscript.setStereoMic(enabled);
}
)
);
section.appendChild( section.appendChild(
createSwitch( createSwitch(
"Move discord-awesomeaudio to the system tray instead of closing", "Move discord-awesomeaudio to the system tray instead of closing",

View File

@ -18,8 +18,22 @@
#include <QTimer> #include <QTimer>
#include <QUrl> #include <QUrl>
#include <QWebEngineFullScreenRequest> #include <QWebEngineFullScreenRequest>
#include <QWebEngineProfile>
#include <QWebEngineUrlRequestInterceptor>
#include <QWidget> #include <QWidget>
// Custom network interceptor class
class NetworkInterceptor : public QWebEngineUrlRequestInterceptor {
public:
NetworkInterceptor(QObject* parent = nullptr) : QWebEngineUrlRequestInterceptor(parent) {}
void interceptRequest(QWebEngineUrlRequestInfo& info) override {
// Modify the request headers here as needed
info.setHttpHeader("Access-Control-Allow-Origin", "*");
info.setHttpHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
}
};
MainWindow *MainWindow::m_instance = nullptr; MainWindow *MainWindow::m_instance = nullptr;
MainWindow::MainWindow(bool useNotifySend, QWidget *parent) MainWindow::MainWindow(bool useNotifySend, QWidget *parent)
@ -30,6 +44,11 @@ MainWindow::MainWindow(bool useNotifySend, QWidget *parent)
m_settings->setValue("useNotifySend", useNotifySend); m_settings->setValue("useNotifySend", useNotifySend);
m_centralWidget = new CentralWidget(this); m_centralWidget = new CentralWidget(this);
setCentralWidget(m_centralWidget); setCentralWidget(m_centralWidget);
// Create and install the network interceptor
NetworkInterceptor* networkInterceptor = new NetworkInterceptor(this);
QWebEngineProfile::defaultProfile()->setRequestInterceptor(networkInterceptor);
setupTrayIcon(); setupTrayIcon();
setMinimumSize(800, 300); setMinimumSize(800, 300);
connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this), connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this),

View File

@ -10,6 +10,7 @@
#include <QSystemTrayIcon> #include <QSystemTrayIcon>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QVector> #include <QVector>
#include <QWebEngineUrlRequestInterceptor>
class MainWindow : public QMainWindow { class MainWindow : public QMainWindow {
Q_OBJECT Q_OBJECT
@ -24,7 +25,6 @@ private:
void setupTrayIcon(); void setupTrayIcon();
void cleanTrayIcon(); void cleanTrayIcon();
void setupSettings(); void setupSettings();
QWebEngineProfile *prepareProfile();
void closeEvent(QCloseEvent *event) override; void closeEvent(QCloseEvent *event) override;
QSystemTrayIcon *m_trayIcon = nullptr; QSystemTrayIcon *m_trayIcon = nullptr;
QMenu *m_trayIconMenu; QMenu *m_trayIconMenu;