Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tools/hrdb/models/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Session::Session() :
// Default settings
m_settings.m_bSquarePixels = false;
m_settings.m_bDisassHexNumerics = false;
m_settings.m_bConfirmMemoryLoss = true;
m_settings.m_profileDisplayMode = Settings::kTotal;
m_settings.m_liveRefresh = false;
m_settings.m_font = QFontDatabase::systemFont(QFontDatabase::FixedFont);
Expand Down Expand Up @@ -103,6 +104,7 @@ void Session::loadSettings()
}
m_settings.m_bSquarePixels = settings.value("squarePixels", QVariant(false)).toBool();
m_settings.m_bDisassHexNumerics = settings.value("disassHexNumerics", QVariant(false)).toBool();
m_settings.m_bConfirmMemoryLoss = settings.value("confirmMemoryLoss", QVariant(true)).toBool(); //True: Keep original behaviour
m_settings.m_liveRefresh = settings.value("liveRefresh", QVariant(false)).toBool();
m_settings.m_profileDisplayMode = settings.value("profileDisplayMode", QVariant(Settings::kTotal)).toInt();
settings.endGroup();
Expand All @@ -116,6 +118,7 @@ void Session::saveSettings()
settings.beginGroup("Session");
settings.setValue("font", m_settings.m_font.toString());
settings.setValue("squarePixels", m_settings.m_bSquarePixels);
settings.setValue("confirmMemoryLoss", m_settings.m_bConfirmMemoryLoss);
settings.setValue("disassHexNumerics", m_settings.m_bDisassHexNumerics);
settings.setValue("liveRefresh", m_settings.m_liveRefresh);
settings.setValue("profileDisplayMode", m_settings.m_profileDisplayMode);
Expand Down
2 changes: 2 additions & 0 deletions tools/hrdb/models/session.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ class Session : public QObject
bool m_bSquarePixels;
// DISASSEMBLY
bool m_bDisassHexNumerics;
// RESETTING
bool m_bConfirmMemoryLoss;
//
enum ProfileDisplayMode
{
Expand Down
26 changes: 16 additions & 10 deletions tools/hrdb/ui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,20 +578,26 @@ void MainWindow::DisconnectTriggered()

void MainWindow::WarmResetTriggered()
{
int ret = ShowResetWarning();
// Use the shared session call for this, which handles
// things like symbol loading
if (ret == QMessageBox::Yes)
m_session.resetWarm();
if (m_session.GetSettings().m_bConfirmMemoryLoss) {
int ret = ShowResetWarning();
// Use the shared session call for this, which handles
// things like symbol loading
if (ret == QMessageBox::No)
return;
}
m_session.resetWarm();
}

void MainWindow::ColdResetTriggered()
{
int ret = ShowResetWarning();
// Use the shared session call for this, which handles
// things like symbol loading
if (ret == QMessageBox::Yes)
m_session.resetCold();
if (m_session.GetSettings().m_bConfirmMemoryLoss) {
int ret = ShowResetWarning();
// Use the shared session call for this, which handles
// things like symbol loading
if (ret == QMessageBox::No)
return;
}
m_session.resetCold();
}

void MainWindow::FastForwardTriggered()
Expand Down
9 changes: 9 additions & 0 deletions tools/hrdb/ui/prefsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ PrefsDialog::PrefsDialog(QWidget *parent, Session* pSession) :
m_pLiveRefresh = new QCheckBox(tr("Live Refresh"), this);
m_pGraphicsSquarePixels = new QCheckBox(tr("Graphics Inspector: Square Pixels"), this);
m_pDisassHexNumerics = new QCheckBox(tr("Disassembly: Use hex address register offsets"), this);
m_pConfirmMemoryLoss = new QCheckBox(tr("Reset: Ask for confirmation"), this);
m_pProfileDisplayCombo = new QComboBox(this);
m_pProfileDisplayCombo->insertItem(Session::Settings::kTotal, "Total");
m_pProfileDisplayCombo->insertItem(Session::Settings::kMean, "Mean");
Expand All @@ -55,6 +56,7 @@ PrefsDialog::PrefsDialog(QWidget *parent, Session* pSession) :
gridLayout->addWidget(m_pLiveRefresh, row++, 0, 1, 2);
gridLayout->addWidget(m_pGraphicsSquarePixels, row++, 0, 1, 2);
gridLayout->addWidget(m_pDisassHexNumerics, row++, 0, 1, 2);
gridLayout->addWidget(m_pConfirmMemoryLoss, row++, 0, 1, 2);
gridLayout->addWidget(pProfileDisplay, row, 0);
gridLayout->addWidget(m_pProfileDisplayCombo, row++, 1);
gridLayout->addWidget(m_pFontLabel, row, 0);
Expand All @@ -71,6 +73,7 @@ PrefsDialog::PrefsDialog(QWidget *parent, Session* pSession) :

connect(m_pGraphicsSquarePixels, &QPushButton::clicked, this, &PrefsDialog::squarePixelsClicked);
connect(m_pDisassHexNumerics, &QPushButton::clicked, this, &PrefsDialog::disassHexNumbersClicked);
connect(m_pConfirmMemoryLoss, &QPushButton::clicked, this, &PrefsDialog::confirmMemoryLossClicked);
connect(m_pLiveRefresh, &QPushButton::clicked, this, &PrefsDialog::liveRefreshClicked);
connect(pFontButton, &QPushButton::clicked, this, &PrefsDialog::fontSelectClicked);

Expand Down Expand Up @@ -143,6 +146,11 @@ void PrefsDialog::disassHexNumbersClicked()
m_settingsCopy.m_bDisassHexNumerics = m_pDisassHexNumerics->isChecked();
}

void PrefsDialog::confirmMemoryLossClicked()
{
m_settingsCopy.m_bConfirmMemoryLoss = m_pConfirmMemoryLoss->isChecked();
}

void PrefsDialog::liveRefreshClicked()
{
m_settingsCopy.m_liveRefresh = m_pLiveRefresh->isChecked();
Expand Down Expand Up @@ -171,6 +179,7 @@ void PrefsDialog::UpdateUIElements()
m_pGraphicsSquarePixels->setChecked(m_settingsCopy.m_bSquarePixels);
m_pDisassHexNumerics->setChecked(m_settingsCopy.m_bDisassHexNumerics);
m_pProfileDisplayCombo->setCurrentIndex(m_settingsCopy.m_profileDisplayMode);
m_pConfirmMemoryLoss->setChecked(m_settingsCopy.m_bConfirmMemoryLoss);
m_pLiveRefresh->setChecked(m_settingsCopy.m_liveRefresh);

QFontInfo info(m_settingsCopy.m_font);
Expand Down
2 changes: 2 additions & 0 deletions tools/hrdb/ui/prefsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ private slots:
void okClicked();
void squarePixelsClicked();
void disassHexNumbersClicked();
void confirmMemoryLossClicked();
void liveRefreshClicked();
void fontSelectClicked();

Expand All @@ -44,6 +45,7 @@ private slots:
// UI elements
QCheckBox* m_pGraphicsSquarePixels;
QCheckBox* m_pDisassHexNumerics;
QCheckBox* m_pConfirmMemoryLoss;
QComboBox* m_pProfileDisplayCombo;
QCheckBox* m_pLiveRefresh;
QLabel* m_pFontLabel;
Expand Down