mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-12 13:00:32 +00:00
Refactor qrenderdoc to provide stable, clean and deliberate API
* Note, this API is still in-flux and beta, so there may still be some more changes before it's 'stable', and even then it will still be subject to some amount of change. * This API is then exposed to python via SWIG bindings and hides internals that don't need to be visible, and means the actual API is easier to work with. * We also use this API to reduce inter-dependencies between different windows that need to interact with each other at a high level. * The naming is python/standard RenderDoc TitleCase method names, not Qt style camelCase methods. # Conflicts: # qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp # qrenderdoc/Windows/TextureViewer.cpp
This commit is contained in:
@@ -24,13 +24,13 @@
|
||||
|
||||
#include "SettingsDialog.h"
|
||||
#include "Code/CaptureContext.h"
|
||||
#include "Code/PersistantConfig.h"
|
||||
#include "Code/Interface/QRDInterface.h"
|
||||
#include "Code/QRDUtils.h"
|
||||
#include "Windows/Dialogs/OrderedListEditor.h"
|
||||
#include "CaptureDialog.h"
|
||||
#include "ui_SettingsDialog.h"
|
||||
|
||||
SettingsDialog::SettingsDialog(CaptureContext &ctx, QWidget *parent)
|
||||
SettingsDialog::SettingsDialog(ICaptureContext &ctx, QWidget *parent)
|
||||
: QDialog(parent), ui(new Ui::SettingsDialog), m_Ctx(ctx)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@@ -44,49 +44,49 @@ SettingsDialog::SettingsDialog(CaptureContext &ctx, QWidget *parent)
|
||||
|
||||
m_Init = true;
|
||||
|
||||
for(int i = 0; i < (int)PersistantConfig::TimeUnit::Count; i++)
|
||||
for(int i = 0; i < (int)TimeUnit::Count; i++)
|
||||
{
|
||||
ui->EventBrowser_TimeUnit->addItem(PersistantConfig::UnitPrefix((PersistantConfig::TimeUnit)i));
|
||||
ui->EventBrowser_TimeUnit->addItem(UnitPrefix((TimeUnit)i));
|
||||
}
|
||||
|
||||
ui->pages->clearSelection();
|
||||
ui->pages->setItemSelected(ui->pages->item(0), true);
|
||||
ui->tabWidget->setCurrentIndex(0);
|
||||
|
||||
ui->saveDirectory->setText(m_Ctx.Config.DefaultCaptureSaveDirectory);
|
||||
ui->tempDirectory->setText(m_Ctx.Config.TemporaryCaptureDirectory);
|
||||
ui->saveDirectory->setText(m_Ctx.Config().DefaultCaptureSaveDirectory);
|
||||
ui->tempDirectory->setText(m_Ctx.Config().TemporaryCaptureDirectory);
|
||||
|
||||
if(!m_Ctx.Config.SPIRVDisassemblers.isEmpty())
|
||||
if(!m_Ctx.Config().SPIRVDisassemblers.isEmpty())
|
||||
{
|
||||
ui->externalDisassemblerArgs->setText(m_Ctx.Config.SPIRVDisassemblers[0].args);
|
||||
ui->externalDisassemblePath->setText(m_Ctx.Config.SPIRVDisassemblers[0].executable);
|
||||
ui->externalDisassemblerArgs->setText(m_Ctx.Config().SPIRVDisassemblers[0].args);
|
||||
ui->externalDisassemblePath->setText(m_Ctx.Config().SPIRVDisassemblers[0].executable);
|
||||
}
|
||||
ui->Android_AdbExecutablePath->setText(m_Ctx.Config.Android_AdbExecutablePath);
|
||||
ui->Android_MaxConnectTimeout->setValue(m_Ctx.Config.Android_MaxConnectTimeout);
|
||||
ui->Android_AdbExecutablePath->setText(m_Ctx.Config().Android_AdbExecutablePath);
|
||||
ui->Android_MaxConnectTimeout->setValue(m_Ctx.Config().Android_MaxConnectTimeout);
|
||||
|
||||
ui->TextureViewer_ResetRange->setChecked(m_Ctx.Config.TextureViewer_ResetRange);
|
||||
ui->TextureViewer_PerTexSettings->setChecked(m_Ctx.Config.TextureViewer_PerTexSettings);
|
||||
ui->ShaderViewer_FriendlyNaming->setChecked(m_Ctx.Config.ShaderViewer_FriendlyNaming);
|
||||
ui->CheckUpdate_AllowChecks->setChecked(m_Ctx.Config.CheckUpdate_AllowChecks);
|
||||
ui->Font_PreferMonospaced->setChecked(m_Ctx.Config.Font_PreferMonospaced);
|
||||
ui->TextureViewer_ResetRange->setChecked(m_Ctx.Config().TextureViewer_ResetRange);
|
||||
ui->TextureViewer_PerTexSettings->setChecked(m_Ctx.Config().TextureViewer_PerTexSettings);
|
||||
ui->ShaderViewer_FriendlyNaming->setChecked(m_Ctx.Config().ShaderViewer_FriendlyNaming);
|
||||
ui->CheckUpdate_AllowChecks->setChecked(m_Ctx.Config().CheckUpdate_AllowChecks);
|
||||
ui->Font_PreferMonospaced->setChecked(m_Ctx.Config().Font_PreferMonospaced);
|
||||
|
||||
ui->AlwaysReplayLocally->setChecked(m_Ctx.Config.AlwaysReplayLocally);
|
||||
ui->AlwaysReplayLocally->setChecked(m_Ctx.Config().AlwaysReplayLocally);
|
||||
|
||||
ui->AllowGlobalHook->setChecked(m_Ctx.Config.AllowGlobalHook);
|
||||
ui->AllowGlobalHook->setChecked(m_Ctx.Config().AllowGlobalHook);
|
||||
|
||||
ui->EventBrowser_TimeUnit->setCurrentIndex((int)m_Ctx.Config.EventBrowser_TimeUnit);
|
||||
ui->EventBrowser_HideEmpty->setChecked(m_Ctx.Config.EventBrowser_HideEmpty);
|
||||
ui->EventBrowser_HideAPICalls->setChecked(m_Ctx.Config.EventBrowser_HideAPICalls);
|
||||
ui->EventBrowser_ApplyColors->setChecked(m_Ctx.Config.EventBrowser_ApplyColors);
|
||||
ui->EventBrowser_ColorEventRow->setChecked(m_Ctx.Config.EventBrowser_ColorEventRow);
|
||||
ui->EventBrowser_TimeUnit->setCurrentIndex((int)m_Ctx.Config().EventBrowser_TimeUnit);
|
||||
ui->EventBrowser_HideEmpty->setChecked(m_Ctx.Config().EventBrowser_HideEmpty);
|
||||
ui->EventBrowser_HideAPICalls->setChecked(m_Ctx.Config().EventBrowser_HideAPICalls);
|
||||
ui->EventBrowser_ApplyColors->setChecked(m_Ctx.Config().EventBrowser_ApplyColors);
|
||||
ui->EventBrowser_ColorEventRow->setChecked(m_Ctx.Config().EventBrowser_ColorEventRow);
|
||||
|
||||
// disable sub-checkbox
|
||||
ui->EventBrowser_ColorEventRow->setEnabled(ui->EventBrowser_ApplyColors->isChecked());
|
||||
|
||||
ui->Formatter_MinFigures->setValue(m_Ctx.Config.Formatter_MinFigures);
|
||||
ui->Formatter_MaxFigures->setValue(m_Ctx.Config.Formatter_MaxFigures);
|
||||
ui->Formatter_NegExp->setValue(m_Ctx.Config.Formatter_NegExp);
|
||||
ui->Formatter_PosExp->setValue(m_Ctx.Config.Formatter_PosExp);
|
||||
ui->Formatter_MinFigures->setValue(m_Ctx.Config().Formatter_MinFigures);
|
||||
ui->Formatter_MaxFigures->setValue(m_Ctx.Config().Formatter_MaxFigures);
|
||||
ui->Formatter_NegExp->setValue(m_Ctx.Config().Formatter_NegExp);
|
||||
ui->Formatter_PosExp->setValue(m_Ctx.Config().Formatter_PosExp);
|
||||
|
||||
m_Init = false;
|
||||
|
||||
@@ -128,76 +128,76 @@ void SettingsDialog::on_okButton_accepted()
|
||||
// general
|
||||
void SettingsDialog::formatter_valueChanged(int val)
|
||||
{
|
||||
m_Ctx.Config.Formatter_MinFigures = ui->Formatter_MinFigures->value();
|
||||
m_Ctx.Config.Formatter_MaxFigures = ui->Formatter_MaxFigures->value();
|
||||
m_Ctx.Config.Formatter_NegExp = ui->Formatter_NegExp->value();
|
||||
m_Ctx.Config.Formatter_PosExp = ui->Formatter_PosExp->value();
|
||||
m_Ctx.Config().Formatter_MinFigures = ui->Formatter_MinFigures->value();
|
||||
m_Ctx.Config().Formatter_MaxFigures = ui->Formatter_MaxFigures->value();
|
||||
m_Ctx.Config().Formatter_NegExp = ui->Formatter_NegExp->value();
|
||||
m_Ctx.Config().Formatter_PosExp = ui->Formatter_PosExp->value();
|
||||
|
||||
m_Ctx.Config.SetupFormatting();
|
||||
m_Ctx.Config().SetupFormatting();
|
||||
|
||||
m_Ctx.Config.Save();
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_tempDirectory_textEdited(const QString &dir)
|
||||
{
|
||||
if(QDir(dir).exists())
|
||||
m_Ctx.Config.TemporaryCaptureDirectory = dir;
|
||||
m_Ctx.Config().TemporaryCaptureDirectory = dir;
|
||||
else
|
||||
m_Ctx.Config.TemporaryCaptureDirectory = "";
|
||||
m_Ctx.Config().TemporaryCaptureDirectory = "";
|
||||
|
||||
m_Ctx.Config.Save();
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_saveDirectory_textEdited(const QString &dir)
|
||||
{
|
||||
if(QDir(dir).exists() || dir == "")
|
||||
m_Ctx.Config.DefaultCaptureSaveDirectory = dir;
|
||||
m_Ctx.Config().DefaultCaptureSaveDirectory = dir;
|
||||
|
||||
m_Ctx.Config.Save();
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_browseSaveCaptureDirectory_clicked()
|
||||
{
|
||||
QString dir = RDDialog::getExistingDirectory(this, "Choose default directory for saving captures",
|
||||
m_Ctx.Config.DefaultCaptureSaveDirectory);
|
||||
m_Ctx.Config().DefaultCaptureSaveDirectory);
|
||||
|
||||
if(dir != "")
|
||||
m_Ctx.Config.DefaultCaptureSaveDirectory = dir;
|
||||
m_Ctx.Config().DefaultCaptureSaveDirectory = dir;
|
||||
|
||||
m_Ctx.Config.Save();
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_AllowGlobalHook_toggled(bool checked)
|
||||
{
|
||||
m_Ctx.Config.AllowGlobalHook = ui->AllowGlobalHook->isChecked();
|
||||
m_Ctx.Config().AllowGlobalHook = ui->AllowGlobalHook->isChecked();
|
||||
|
||||
m_Ctx.Config.Save();
|
||||
m_Ctx.Config().Save();
|
||||
|
||||
if(m_Ctx.hasCaptureDialog())
|
||||
m_Ctx.captureDialog()->updateGlobalHook();
|
||||
if(m_Ctx.HasCaptureDialog())
|
||||
m_Ctx.GetCaptureDialog()->UpdateGlobalHook();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_CheckUpdate_AllowChecks_toggled(bool checked)
|
||||
{
|
||||
m_Ctx.Config.CheckUpdate_AllowChecks = ui->CheckUpdate_AllowChecks->isChecked();
|
||||
m_Ctx.Config().CheckUpdate_AllowChecks = ui->CheckUpdate_AllowChecks->isChecked();
|
||||
|
||||
m_Ctx.Config.Save();
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_Font_PreferMonospaced_toggled(bool checked)
|
||||
{
|
||||
m_Ctx.Config.Font_PreferMonospaced = ui->Font_PreferMonospaced->isChecked();
|
||||
m_Ctx.Config().Font_PreferMonospaced = ui->Font_PreferMonospaced->isChecked();
|
||||
|
||||
m_Ctx.Config.SetupFormatting();
|
||||
m_Ctx.Config().SetupFormatting();
|
||||
|
||||
m_Ctx.Config.Save();
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_AlwaysReplayLocally_toggled(bool checked)
|
||||
{
|
||||
m_Ctx.Config.AlwaysReplayLocally = ui->AlwaysReplayLocally->isChecked();
|
||||
m_Ctx.Config().AlwaysReplayLocally = ui->AlwaysReplayLocally->isChecked();
|
||||
|
||||
m_Ctx.Config.Save();
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
// core
|
||||
@@ -206,36 +206,37 @@ void SettingsDialog::on_chooseSearchPaths_clicked()
|
||||
OrderedListEditor listEd(tr("Shader debug info search paths"), tr("Search Path"),
|
||||
BrowseMode::Folder, this);
|
||||
|
||||
listEd.setItems(m_Ctx.Config.GetConfigSetting("shader.debug.searchPaths")
|
||||
listEd.setItems(m_Ctx.Config()
|
||||
.GetConfigSetting("shader.debug.searchPaths")
|
||||
.split(QChar(';'), QString::SkipEmptyParts));
|
||||
|
||||
int res = RDDialog::show(&listEd);
|
||||
|
||||
if(res)
|
||||
m_Ctx.Config.SetConfigSetting("shader.debug.searchPaths", listEd.getItems().join(QChar(';')));
|
||||
m_Ctx.Config().SetConfigSetting("shader.debug.searchPaths", listEd.getItems().join(QChar(';')));
|
||||
}
|
||||
|
||||
// texture viewer
|
||||
void SettingsDialog::on_TextureViewer_PerTexSettings_toggled(bool checked)
|
||||
{
|
||||
m_Ctx.Config.TextureViewer_PerTexSettings = ui->TextureViewer_PerTexSettings->isChecked();
|
||||
m_Ctx.Config().TextureViewer_PerTexSettings = ui->TextureViewer_PerTexSettings->isChecked();
|
||||
|
||||
m_Ctx.Config.Save();
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_TextureViewer_ResetRange_toggled(bool checked)
|
||||
{
|
||||
m_Ctx.Config.TextureViewer_ResetRange = ui->TextureViewer_ResetRange->isChecked();
|
||||
m_Ctx.Config().TextureViewer_ResetRange = ui->TextureViewer_ResetRange->isChecked();
|
||||
|
||||
m_Ctx.Config.Save();
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
// shader viewer
|
||||
void SettingsDialog::on_ShaderViewer_FriendlyNaming_toggled(bool checked)
|
||||
{
|
||||
m_Ctx.Config.ShaderViewer_FriendlyNaming = ui->ShaderViewer_FriendlyNaming->isChecked();
|
||||
m_Ctx.Config().ShaderViewer_FriendlyNaming = ui->ShaderViewer_FriendlyNaming->isChecked();
|
||||
|
||||
m_Ctx.Config.Save();
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_browseExtDisasemble_clicked()
|
||||
@@ -251,28 +252,28 @@ void SettingsDialog::on_browseExtDisasemble_clicked()
|
||||
|
||||
void SettingsDialog::on_externalDisassemblePath_textEdited(const QString &path)
|
||||
{
|
||||
if(m_Ctx.Config.SPIRVDisassemblers.isEmpty())
|
||||
if(m_Ctx.Config().SPIRVDisassemblers.isEmpty())
|
||||
{
|
||||
m_Ctx.Config.SPIRVDisassemblers.push_back(SPIRVDisassembler());
|
||||
m_Ctx.Config.SPIRVDisassemblers.back().name = "Unknown";
|
||||
m_Ctx.Config().SPIRVDisassemblers.push_back(SPIRVDisassembler());
|
||||
m_Ctx.Config().SPIRVDisassemblers.back().name = "Unknown";
|
||||
}
|
||||
|
||||
m_Ctx.Config.SPIRVDisassemblers.back().executable = path;
|
||||
m_Ctx.Config().SPIRVDisassemblers.back().executable = path;
|
||||
|
||||
m_Ctx.Config.Save();
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_externalDisassemblerArgs_textEdited(const QString &args)
|
||||
{
|
||||
if(m_Ctx.Config.SPIRVDisassemblers.isEmpty())
|
||||
if(m_Ctx.Config().SPIRVDisassemblers.isEmpty())
|
||||
{
|
||||
m_Ctx.Config.SPIRVDisassemblers.push_back(SPIRVDisassembler());
|
||||
m_Ctx.Config.SPIRVDisassemblers.back().name = "Unknown";
|
||||
m_Ctx.Config().SPIRVDisassemblers.push_back(SPIRVDisassembler());
|
||||
m_Ctx.Config().SPIRVDisassemblers.back().name = "Unknown";
|
||||
}
|
||||
|
||||
m_Ctx.Config.SPIRVDisassemblers.back().args = args;
|
||||
m_Ctx.Config().SPIRVDisassemblers.back().args = args;
|
||||
|
||||
m_Ctx.Config.Save();
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
// event browser
|
||||
@@ -281,75 +282,74 @@ void SettingsDialog::on_EventBrowser_TimeUnit_currentIndexChanged(int index)
|
||||
if(m_Init)
|
||||
return;
|
||||
|
||||
m_Ctx.Config.EventBrowser_TimeUnit =
|
||||
(PersistantConfig::TimeUnit)ui->EventBrowser_TimeUnit->currentIndex();
|
||||
m_Ctx.Config().EventBrowser_TimeUnit = (TimeUnit)ui->EventBrowser_TimeUnit->currentIndex();
|
||||
|
||||
m_Ctx.Config.Save();
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_EventBrowser_HideEmpty_toggled(bool checked)
|
||||
{
|
||||
m_Ctx.Config.EventBrowser_HideEmpty = ui->EventBrowser_HideEmpty->isChecked();
|
||||
m_Ctx.Config().EventBrowser_HideEmpty = ui->EventBrowser_HideEmpty->isChecked();
|
||||
|
||||
m_Ctx.Config.Save();
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_EventBrowser_HideAPICalls_toggled(bool checked)
|
||||
{
|
||||
m_Ctx.Config.EventBrowser_HideAPICalls = ui->EventBrowser_HideAPICalls->isChecked();
|
||||
m_Ctx.Config().EventBrowser_HideAPICalls = ui->EventBrowser_HideAPICalls->isChecked();
|
||||
|
||||
m_Ctx.Config.Save();
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_EventBrowser_ApplyColors_toggled(bool checked)
|
||||
{
|
||||
m_Ctx.Config.EventBrowser_ApplyColors = ui->EventBrowser_ApplyColors->isChecked();
|
||||
m_Ctx.Config().EventBrowser_ApplyColors = ui->EventBrowser_ApplyColors->isChecked();
|
||||
|
||||
m_Ctx.Config.Save();
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_EventBrowser_ColorEventRow_toggled(bool checked)
|
||||
{
|
||||
m_Ctx.Config.EventBrowser_ColorEventRow = ui->EventBrowser_ColorEventRow->isChecked();
|
||||
m_Ctx.Config().EventBrowser_ColorEventRow = ui->EventBrowser_ColorEventRow->isChecked();
|
||||
|
||||
m_Ctx.Config.Save();
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
// android
|
||||
void SettingsDialog::on_browseTempCaptureDirectory_clicked()
|
||||
{
|
||||
QString dir = RDDialog::getExistingDirectory(this, "Choose directory for temporary captures",
|
||||
m_Ctx.Config.TemporaryCaptureDirectory);
|
||||
m_Ctx.Config().TemporaryCaptureDirectory);
|
||||
|
||||
if(dir != "")
|
||||
m_Ctx.Config.TemporaryCaptureDirectory = dir;
|
||||
m_Ctx.Config().TemporaryCaptureDirectory = dir;
|
||||
|
||||
m_Ctx.Config.Save();
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_browseAdbPath_clicked()
|
||||
{
|
||||
QString adb = RDDialog::getExecutableFileName(
|
||||
this, "Locate adb executable",
|
||||
QFileInfo(m_Ctx.Config.Android_AdbExecutablePath).absoluteDir().path());
|
||||
QFileInfo(m_Ctx.Config().Android_AdbExecutablePath).absoluteDir().path());
|
||||
|
||||
if(adb != "")
|
||||
m_Ctx.Config.Android_AdbExecutablePath = adb;
|
||||
m_Ctx.Config().Android_AdbExecutablePath = adb;
|
||||
|
||||
m_Ctx.Config.Save();
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_Android_MaxConnectTimeout_valueChanged(double timeout)
|
||||
{
|
||||
m_Ctx.Config.Android_MaxConnectTimeout = ui->Android_MaxConnectTimeout->value();
|
||||
m_Ctx.Config().Android_MaxConnectTimeout = ui->Android_MaxConnectTimeout->value();
|
||||
|
||||
m_Ctx.Config.Save();
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_Android_AdbExecutablePath_textEdited(const QString &adb)
|
||||
{
|
||||
if(QFileInfo::exists(adb))
|
||||
m_Ctx.Config.Android_AdbExecutablePath = adb;
|
||||
m_Ctx.Config().Android_AdbExecutablePath = adb;
|
||||
|
||||
m_Ctx.Config.Save();
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user