UI: Differentiate between crash & session log dialogs
This commit is contained in:
parent
8f0d2cb890
commit
c878bfcb1f
4 changed files with 39 additions and 10 deletions
|
|
@ -5016,7 +5016,7 @@ static BPtr<char> ReadLogFile(const char *subdir, const char *log)
|
|||
return file;
|
||||
}
|
||||
|
||||
void OBSBasic::UploadLog(const char *subdir, const char *file)
|
||||
void OBSBasic::UploadLog(const char *subdir, const char *file, const bool crash)
|
||||
{
|
||||
BPtr<char> fileString{ReadLogFile(subdir, file)};
|
||||
|
||||
|
|
@ -5027,6 +5027,7 @@ void OBSBasic::UploadLog(const char *subdir, const char *file)
|
|||
return;
|
||||
|
||||
ui->menuLogFiles->setEnabled(false);
|
||||
ui->menuCrashLogs->setEnabled(false);
|
||||
|
||||
stringstream ss;
|
||||
ss << "OBS " << App()->GetVersionString() << " log file uploaded at "
|
||||
|
|
@ -5042,8 +5043,13 @@ void OBSBasic::UploadLog(const char *subdir, const char *file)
|
|||
"text/plain", ss.str().c_str());
|
||||
|
||||
logUploadThread.reset(thread);
|
||||
connect(thread, &RemoteTextThread::Result, this,
|
||||
&OBSBasic::logUploadFinished);
|
||||
if (crash) {
|
||||
connect(thread, &RemoteTextThread::Result, this,
|
||||
&OBSBasic::crashUploadFinished);
|
||||
} else {
|
||||
connect(thread, &RemoteTextThread::Result, this,
|
||||
&OBSBasic::logUploadFinished);
|
||||
}
|
||||
logUploadThread->start();
|
||||
}
|
||||
|
||||
|
|
@ -5059,12 +5065,12 @@ void OBSBasic::on_actionShowLogs_triggered()
|
|||
|
||||
void OBSBasic::on_actionUploadCurrentLog_triggered()
|
||||
{
|
||||
UploadLog("obs-studio/logs", App()->GetCurrentLog());
|
||||
UploadLog("obs-studio/logs", App()->GetCurrentLog(), false);
|
||||
}
|
||||
|
||||
void OBSBasic::on_actionUploadLastLog_triggered()
|
||||
{
|
||||
UploadLog("obs-studio/logs", App()->GetLastLog());
|
||||
UploadLog("obs-studio/logs", App()->GetLastLog(), false);
|
||||
}
|
||||
|
||||
void OBSBasic::on_actionViewCurrentLog_triggered()
|
||||
|
|
@ -5095,7 +5101,7 @@ void OBSBasic::on_actionShowCrashLogs_triggered()
|
|||
|
||||
void OBSBasic::on_actionUploadLastCrashLog_triggered()
|
||||
{
|
||||
UploadLog("obs-studio/crashes", App()->GetLastCrashLog());
|
||||
UploadLog("obs-studio/crashes", App()->GetLastCrashLog(), true);
|
||||
}
|
||||
|
||||
void OBSBasic::on_actionCheckForUpdates_triggered()
|
||||
|
|
@ -5106,6 +5112,7 @@ void OBSBasic::on_actionCheckForUpdates_triggered()
|
|||
void OBSBasic::logUploadFinished(const QString &text, const QString &error)
|
||||
{
|
||||
ui->menuLogFiles->setEnabled(true);
|
||||
ui->menuCrashLogs->setEnabled(true);
|
||||
|
||||
if (text.isEmpty()) {
|
||||
OBSMessageBox::critical(
|
||||
|
|
@ -5113,13 +5120,32 @@ void OBSBasic::logUploadFinished(const QString &text, const QString &error)
|
|||
error);
|
||||
return;
|
||||
}
|
||||
openLogDialog(text, false);
|
||||
}
|
||||
|
||||
void OBSBasic::crashUploadFinished(const QString &text, const QString &error)
|
||||
{
|
||||
ui->menuLogFiles->setEnabled(true);
|
||||
ui->menuCrashLogs->setEnabled(true);
|
||||
|
||||
if (text.isEmpty()) {
|
||||
OBSMessageBox::critical(
|
||||
this, QTStr("LogReturnDialog.ErrorUploadingLog"),
|
||||
error);
|
||||
return;
|
||||
}
|
||||
openLogDialog(text, true);
|
||||
}
|
||||
|
||||
void OBSBasic::openLogDialog(const QString &text, const bool crash)
|
||||
{
|
||||
|
||||
obs_data_t *returnData = obs_data_create_from_json(QT_TO_UTF8(text));
|
||||
string resURL = obs_data_get_string(returnData, "url");
|
||||
QString logURL = resURL.c_str();
|
||||
obs_data_release(returnData);
|
||||
|
||||
OBSLogReply logDialog(this, logURL);
|
||||
OBSLogReply logDialog(this, logURL, crash);
|
||||
logDialog.exec();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue