UI: Do not always have log viewer loaded

This object should not always be created on startup. Instead, only load
it specifically when the user wants to load it.

This fixes a freeze some users were experiencing due to the text widget.
Unfortunately, it is not yet known how that freeze occurred with the log
viewer, so for the time being do not load the log viewer object unless
explicitly created.
This commit is contained in:
jp9000 2020-09-15 20:29:40 -07:00
parent 531120da99
commit c0f19b95d5
4 changed files with 15 additions and 14 deletions

View File

@ -37,8 +37,11 @@ OBSLogViewer::OBSLogViewer(QWidget *parent) : QDialog(parent)
QPushButton *closeButton = new QPushButton(QTStr("Close"));
connect(closeButton, &QPushButton::clicked, this, &QDialog::hide);
bool showLogViewerOnStartup = config_get_bool(
App()->GlobalConfig(), "LogViewer", "ShowLogStartup");
QCheckBox *showStartup = new QCheckBox(QTStr("ShowOnStartup"));
showStartup->setChecked(ShowOnStartup());
showStartup->setChecked(showLogViewerOnStartup);
connect(showStartup, SIGNAL(toggled(bool)), this,
SLOT(ToggleShowStartup(bool)));
@ -81,12 +84,6 @@ void OBSLogViewer::ToggleShowStartup(bool checked)
checked);
}
bool OBSLogViewer::ShowOnStartup()
{
return config_get_bool(App()->GlobalConfig(), "LogViewer",
"ShowLogStartup");
}
extern QPointer<OBSLogViewer> obsLogViewer;
void OBSLogViewer::InitLog()

View File

@ -20,6 +20,4 @@ private slots:
public:
OBSLogViewer(QWidget *parent = 0);
~OBSLogViewer();
bool ShowOnStartup();
};

View File

@ -193,9 +193,6 @@ extern void RegisterRestreamAuth();
OBSBasic::OBSBasic(QWidget *parent)
: OBSMainWindow(parent), ui(new Ui::OBSBasic)
{
/* setup log viewer */
logView = new OBSLogViewer();
qRegisterMetaTypeStreamOperators<SignalContainer<OBSScene>>(
"SignalContainer<OBSScene>");
@ -1955,8 +1952,14 @@ void OBSBasic::OnFirstLoad()
Auth::Load();
if (logView && logView->ShowOnStartup())
bool showLogViewerOnStartup = config_get_bool(
App()->GlobalConfig(), "LogViewer", "ShowLogStartup");
if (showLogViewerOnStartup) {
if (!logView)
logView = new OBSLogViewer();
logView->show();
}
}
void OBSBasic::DeferredSysTrayLoad(int requeueCount)
@ -5331,6 +5334,9 @@ void OBSBasic::on_actionUploadLastLog_triggered()
void OBSBasic::on_actionViewCurrentLog_triggered()
{
if (!logView)
logView = new OBSLogViewer();
if (!logView->isVisible()) {
logView->setVisible(true);
} else {

View File

@ -214,7 +214,7 @@ private:
QPointer<QDockWidget> statsDock;
QPointer<OBSAbout> about;
OBSLogViewer *logView;
OBSLogViewer *logView = nullptr;
QPointer<QTimer> cpuUsageTimer;
QPointer<QTimer> diskFullTimer;