mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
SettingsDialog: Add timer to constantly update session table
This commit is contained in:
parent
aa241ecc9e
commit
fb01a28623
@ -14,7 +14,8 @@
|
|||||||
|
|
||||||
SettingsDialog::SettingsDialog(QWidget* parent) :
|
SettingsDialog::SettingsDialog(QWidget* parent) :
|
||||||
QDialog(parent, Qt::Dialog),
|
QDialog(parent, Qt::Dialog),
|
||||||
ui(new Ui::SettingsDialog)
|
ui(new Ui::SettingsDialog),
|
||||||
|
sessionTableTimer(new QTimer)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->websocketSessionTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
|
ui->websocketSessionTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
|
||||||
@ -25,14 +26,17 @@ SettingsDialog::SettingsDialog(QWidget* parent) :
|
|||||||
this, &SettingsDialog::EnableAuthenticationCheckBoxChanged);
|
this, &SettingsDialog::EnableAuthenticationCheckBoxChanged);
|
||||||
connect(ui->copyPasswordButton, &QPushButton::clicked,
|
connect(ui->copyPasswordButton, &QPushButton::clicked,
|
||||||
this, &SettingsDialog::CopyPasswordButtonClicked);
|
this, &SettingsDialog::CopyPasswordButtonClicked);
|
||||||
|
connect(sessionTableTimer, &QTimer::timeout,
|
||||||
|
this, &SettingsDialog::FillSessionTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsDialog::~SettingsDialog()
|
SettingsDialog::~SettingsDialog()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
|
delete sessionTableTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::showEvent(QShowEvent* event)
|
void SettingsDialog::showEvent(QShowEvent *event)
|
||||||
{
|
{
|
||||||
auto conf = GetConfig();
|
auto conf = GetConfig();
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
@ -48,6 +52,14 @@ void SettingsDialog::showEvent(QShowEvent* event)
|
|||||||
ui->serverPasswordLineEdit->setEnabled(conf->AuthRequired);
|
ui->serverPasswordLineEdit->setEnabled(conf->AuthRequired);
|
||||||
|
|
||||||
FillSessionTable();
|
FillSessionTable();
|
||||||
|
|
||||||
|
sessionTableTimer->start(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::closeEvent(QCloseEvent *event)
|
||||||
|
{
|
||||||
|
if (sessionTableTimer->isActive())
|
||||||
|
sessionTableTimer->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::ToggleShowHide()
|
void SettingsDialog::ToggleShowHide()
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QtWidgets/QDialog>
|
#include <QtWidgets/QDialog>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
#include "ui_SettingsDialog.h"
|
#include "ui_SettingsDialog.h"
|
||||||
|
|
||||||
@ -11,16 +12,17 @@ class SettingsDialog : public QDialog
|
|||||||
public:
|
public:
|
||||||
explicit SettingsDialog(QWidget* parent = 0);
|
explicit SettingsDialog(QWidget* parent = 0);
|
||||||
~SettingsDialog();
|
~SettingsDialog();
|
||||||
void showEvent(QShowEvent* event);
|
void showEvent(QShowEvent *event);
|
||||||
|
void closeEvent(QCloseEvent *event);
|
||||||
void ToggleShowHide();
|
void ToggleShowHide();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void FormAccepted();
|
void FormAccepted();
|
||||||
void EnableAuthenticationCheckBoxChanged();
|
void EnableAuthenticationCheckBoxChanged();
|
||||||
void CopyPasswordButtonClicked();
|
void CopyPasswordButtonClicked();
|
||||||
|
void FillSessionTable();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::SettingsDialog* ui;
|
Ui::SettingsDialog *ui;
|
||||||
|
QTimer *sessionTableTimer;
|
||||||
void FillSessionTable();
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user