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 <QWebEngineScriptCollection>
#include <QWebEngineSettings>
#include <QWebEngineView>
CentralWidget::CentralWidget(QWidget *parent) : QWidget(parent) {
setStyleSheet("background-color:#313338;");

View File

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

View File

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