mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-19 17:49:14 +00:00
UI: Differentiate between crash & session log dialogs
This commit is contained in:
parent
8f0d2cb890
commit
c878bfcb1f
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -292,7 +292,7 @@ private:
|
|||
void UpdateVolumeControlsPeakMeterType();
|
||||
void ClearVolumeControls();
|
||||
|
||||
void UploadLog(const char *subdir, const char *file);
|
||||
void UploadLog(const char *subdir, const char *file, const bool crash);
|
||||
|
||||
void Save(const char *file);
|
||||
void Load(const char *file);
|
||||
|
@ -923,6 +923,8 @@ private slots:
|
|||
void PauseToggled();
|
||||
|
||||
void logUploadFinished(const QString &text, const QString &error);
|
||||
void crashUploadFinished(const QString &text, const QString &error);
|
||||
void openLogDialog(const QString &text, const bool crash);
|
||||
|
||||
void updateCheckFinished();
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "window-log-reply.hpp"
|
||||
#include "obs-app.hpp"
|
||||
|
||||
OBSLogReply::OBSLogReply(QWidget *parent, const QString &url)
|
||||
OBSLogReply::OBSLogReply(QWidget *parent, const QString &url, const bool crash)
|
||||
: QDialog(parent), ui(new Ui::OBSLogReply)
|
||||
{
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
@ -27,6 +27,7 @@ OBSLogReply::OBSLogReply(QWidget *parent, const QString &url)
|
|||
ui->urlEdit->setText(url);
|
||||
|
||||
installEventFilter(CreateShortcutFilter());
|
||||
UNUSED_PARAMETER(crash);
|
||||
}
|
||||
|
||||
void OBSLogReply::on_copyURL_clicked()
|
||||
|
|
|
@ -27,7 +27,7 @@ private:
|
|||
std::unique_ptr<Ui::OBSLogReply> ui;
|
||||
|
||||
public:
|
||||
OBSLogReply(QWidget *parent, const QString &url);
|
||||
OBSLogReply(QWidget *parent, const QString &url, const bool crash);
|
||||
|
||||
private slots:
|
||||
void on_copyURL_clicked();
|
||||
|
|
Loading…
Reference in a new issue