Formatting and small changes

This commit is contained in:
Wizzard 2023-07-12 16:49:47 -04:00
parent 65b7556523
commit 1a60367c0a
3 changed files with 24 additions and 18 deletions

View File

@ -7,6 +7,7 @@
#include <QWebEngineScript> #include <QWebEngineScript>
#include <QWebEngineScriptCollection> #include <QWebEngineScriptCollection>
#include <QWebEngineSettings> #include <QWebEngineSettings>
#include <QWebEngineView>
CentralWidget::CentralWidget(QWidget *parent) : QWidget(parent) { CentralWidget::CentralWidget(QWidget *parent) : QWidget(parent) {
setStyleSheet("background-color:#313338;"); setStyleSheet("background-color:#313338;");

View File

@ -1,4 +1,5 @@
#pragma once #ifndef CENTRALWIDGET_H
#define CENTRALWIDGET_H
#include <QLabel> #include <QLabel>
#include <QVBoxLayout> #include <QVBoxLayout>
@ -7,23 +8,28 @@
#include <QWebEngineView> #include <QWebEngineView>
#include <QWidget> #include <QWidget>
#ifdef KNOTIFICATIONS
constexpr bool USE_KF5_NOTIFICATIONS = true;
#else
constexpr bool USE_KF5_NOTIFICATIONS = false;
#endif
class CentralWidget : public QWidget { class CentralWidget : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
CentralWidget(QWidget *parent = nullptr); CentralWidget(QWidget *parent = nullptr);
public slots:
void setLoadingIndicator(QString text);
private: private:
void setupWebView(); void setupWebView();
QVBoxLayout *m_layout; QVBoxLayout *m_layout;
QWebEngineView *m_webView; QWebEngineView *m_webView;
#ifdef KNOTIFICATIONS QLabel *m_loadingLabel;
bool m_useKF5Notifications = true; bool m_useKF5Notifications;
#else
bool m_useKF5Notifications = false;
#endif
QLabel *m_loadingLabel = nullptr;
public Q_SLOTS:
void setLoadingIndicator(QString text);
}; };
#endif // CENTRALWIDGET_H

View File

@ -21,6 +21,7 @@ UserScript::UserScript() : QObject() {
setupVirtmic(); setupVirtmic();
} }
void UserScript::setupHelpMenu() { void UserScript::setupHelpMenu() {
#ifdef KXMLGUI #ifdef KXMLGUI
m_kxmlgui = true; m_kxmlgui = true;
@ -83,8 +84,7 @@ void UserScript::setupShortcutsDialog() {
void UserScript::setupStreamDialog() { void UserScript::setupStreamDialog() {
m_streamDialog = new StreamDialog(MainWindow::instance()); m_streamDialog = new StreamDialog(MainWindow::instance());
connect(m_streamDialog, &StreamDialog::requestedStreamStart, this, connect(m_streamDialog, &StreamDialog::requestedStreamStart, this, &UserScript::startStream);
&UserScript::startStream);
} }
void UserScript::setupVirtmic() { void UserScript::setupVirtmic() {
@ -155,13 +155,13 @@ void UserScript::startVirtmic(QString target) {
m_virtmicProcess.start(QApplication::arguments()[0], {"--virtmic", target}); m_virtmicProcess.start(QApplication::arguments()[0], {"--virtmic", target});
} }
void UserScript::startStream(bool video, bool audio, int width, int height, void UserScript::startStream(bool video, bool audio, int width, int height, int frameRate, QString target) {
int frameRate, QString target) {
stopVirtmic(); stopVirtmic();
startVirtmic(audio ? target : "[None]"); startVirtmic(audio ? target : "[None]");
// Wait a bit for the virtmic to start // Wait a bit for the virtmic to start
QTimer::singleShot( QTimer::singleShot(200, [=]() {
200, [=]() { emit streamStarted(video, width, height, frameRate); }); emit streamStarted(video, width, height, frameRate);
});
} }
void UserScript::showStreamDialog() { void UserScript::showStreamDialog() {
@ -173,8 +173,7 @@ void UserScript::showStreamDialog() {
} }
void UserScript::showThemeDialog() { void UserScript::showThemeDialog() {
auto url = QInputDialog::getText(MainWindow::instance(), "Theme Installation", auto url = QInputDialog::getText(MainWindow::instance(), "Theme Installation", "Please enter the URL of the Theme");
"Please enter the URL of the Theme");
if (url != "") if (url != "")
emit shouldInstallUserStyles(url); emit shouldInstallUserStyles(url);
} }