mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 03:16:10 +00:00
Monospace fonts (#584)
* Use preferences font in debug widgets and astyle cleanup * Use pref font in backtrace widget * Fix opening correct panel in the preferences dialog via the contextmenu * Fix highlighting in selected instruction and RIP
This commit is contained in:
parent
43215a06ac
commit
96f832dafb
@ -565,7 +565,7 @@ QString CutterCore::getConfig(const QString &k)
|
|||||||
|
|
||||||
void CutterCore::setConfig(const QString &k, const QVariant &v)
|
void CutterCore::setConfig(const QString &k, const QVariant &v)
|
||||||
{
|
{
|
||||||
switch(v.type()) {
|
switch (v.type()) {
|
||||||
case QVariant::Type::Bool:
|
case QVariant::Type::Bool:
|
||||||
setConfig(k, v.toBool());
|
setConfig(k, v.toBool());
|
||||||
break;
|
break;
|
||||||
@ -778,10 +778,10 @@ void CutterCore::startDebug()
|
|||||||
emit registersChanged();
|
emit registersChanged();
|
||||||
if (!currentlyDebugging) {
|
if (!currentlyDebugging) {
|
||||||
setConfig("asm.flags", false);
|
setConfig("asm.flags", false);
|
||||||
|
currentlyDebugging = true;
|
||||||
emit changeDebugView();
|
emit changeDebugView();
|
||||||
emit flagsChanged();
|
emit flagsChanged();
|
||||||
emit refreshCodeViews();
|
emit refreshCodeViews();
|
||||||
currentlyDebugging = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -798,11 +798,11 @@ void CutterCore::startEmulation()
|
|||||||
setConfig("asm.flags", false);
|
setConfig("asm.flags", false);
|
||||||
// allows to view self-modifying code changes or other binary changes
|
// allows to view self-modifying code changes or other binary changes
|
||||||
setConfig("io.cache", true);
|
setConfig("io.cache", true);
|
||||||
|
currentlyDebugging = true;
|
||||||
|
currentlyEmulating = true;
|
||||||
emit changeDebugView();
|
emit changeDebugView();
|
||||||
emit flagsChanged();
|
emit flagsChanged();
|
||||||
emit refreshCodeViews();
|
emit refreshCodeViews();
|
||||||
currentlyDebugging = true;
|
|
||||||
currentlyEmulating = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -819,9 +819,9 @@ void CutterCore::attachDebug(int pid)
|
|||||||
if (!currentlyDebugging || !currentlyEmulating) {
|
if (!currentlyDebugging || !currentlyEmulating) {
|
||||||
// prevent register flags from appearing during debug/emul
|
// prevent register flags from appearing during debug/emul
|
||||||
setConfig("asm.flags", false);
|
setConfig("asm.flags", false);
|
||||||
|
currentlyDebugging = true;
|
||||||
emit changeDebugView();
|
emit changeDebugView();
|
||||||
emit flagsChanged();
|
emit flagsChanged();
|
||||||
currentlyDebugging = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2034,12 +2034,28 @@ QList<QString> CutterCore::getColorThemes()
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CutterCore::setCutterPlugins(QList<CutterPlugin*> plugins)
|
RCoreTask *CutterCore::startTask(const QString &cmd)
|
||||||
|
{
|
||||||
|
RCoreTask *task = r_core_task_new (core_, true, cmd.toLocal8Bit().constData(), nullptr, nullptr);
|
||||||
|
r_core_task_enqueue(core_, task);
|
||||||
|
return task;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CutterCore::joinTask(RCoreTask *task)
|
||||||
|
{
|
||||||
|
r_core_task_join(core_, nullptr, task);
|
||||||
|
}
|
||||||
|
void CutterCore::deleteTask(RCoreTask *task)
|
||||||
|
{
|
||||||
|
r_core_task_del(core_, task->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CutterCore::setCutterPlugins(QList<CutterPlugin *> plugins)
|
||||||
{
|
{
|
||||||
this->plugins = plugins;
|
this->plugins = plugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<CutterPlugin*> CutterCore::getCutterPlugins()
|
QList<CutterPlugin *> CutterCore::getCutterPlugins()
|
||||||
{
|
{
|
||||||
return plugins;
|
return plugins;
|
||||||
}
|
}
|
||||||
|
@ -267,10 +267,11 @@ void MainWindow::initUI()
|
|||||||
connect(core, &CutterCore::changeDefinedView, this, &MainWindow::changeDefinedView);
|
connect(core, &CutterCore::changeDefinedView, this, &MainWindow::changeDefinedView);
|
||||||
|
|
||||||
updateTasksIndicator();
|
updateTasksIndicator();
|
||||||
connect(core->getAsyncTaskManager(), &AsyncTaskManager::tasksChanged, this, &MainWindow::updateTasksIndicator);
|
connect(core->getAsyncTaskManager(), &AsyncTaskManager::tasksChanged, this,
|
||||||
|
&MainWindow::updateTasksIndicator);
|
||||||
|
|
||||||
/* Load plugins */
|
/* Load plugins */
|
||||||
QList<CutterPlugin*> plugins = Core()->getCutterPlugins();
|
QList<CutterPlugin *> plugins = Core()->getCutterPlugins();
|
||||||
for (auto plugin : plugins) {
|
for (auto plugin : plugins) {
|
||||||
CutterDockWidget *pluginDock = plugin->setupInterface(this);
|
CutterDockWidget *pluginDock = plugin->setupInterface(this);
|
||||||
tabifyDockWidget(dashboardDock, pluginDock);
|
tabifyDockWidget(dashboardDock, pluginDock);
|
||||||
@ -337,7 +338,8 @@ void MainWindow::openNewFileFailed()
|
|||||||
mb.setIcon(QMessageBox::Critical);
|
mb.setIcon(QMessageBox::Critical);
|
||||||
mb.setStandardButtons(QMessageBox::Ok);
|
mb.setStandardButtons(QMessageBox::Ok);
|
||||||
mb.setWindowTitle(tr("Cannot open file!"));
|
mb.setWindowTitle(tr("Cannot open file!"));
|
||||||
mb.setText(tr("Could not open the file! Make sure the file exists and that you have the correct permissions."));
|
mb.setText(
|
||||||
|
tr("Could not open the file! Make sure the file exists and that you have the correct permissions."));
|
||||||
mb.exec();
|
mb.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -557,9 +559,9 @@ void MainWindow::restoreDocks()
|
|||||||
tabifyDockWidget(dashboardDock, vTablesDock);
|
tabifyDockWidget(dashboardDock, vTablesDock);
|
||||||
|
|
||||||
// Add Stack, Registers and Backtrace vertically stacked
|
// Add Stack, Registers and Backtrace vertically stacked
|
||||||
addExtraWidget(stackDock);
|
splitDockWidget(sidebarDock, stackDock, Qt::Horizontal);
|
||||||
splitDockWidget(stackDock, registersDock, Qt::Vertical);
|
splitDockWidget(stackDock, registersDock, Qt::Vertical);
|
||||||
splitDockWidget(stackDock, backtraceDock, Qt::Vertical);
|
tabifyDockWidget(stackDock, backtraceDock);
|
||||||
// MemoryMap/Breakpoint widget goes in the center tabs
|
// MemoryMap/Breakpoint widget goes in the center tabs
|
||||||
tabifyDockWidget(dashboardDock, memoryMapDock);
|
tabifyDockWidget(dashboardDock, memoryMapDock);
|
||||||
tabifyDockWidget(dashboardDock, breakpointDock);
|
tabifyDockWidget(dashboardDock, breakpointDock);
|
||||||
@ -625,7 +627,7 @@ void MainWindow::showZenDocks()
|
|||||||
disassemblyDock,
|
disassemblyDock,
|
||||||
hexdumpDock,
|
hexdumpDock,
|
||||||
searchDock
|
searchDock
|
||||||
};
|
};
|
||||||
for (auto w : dockWidgets) {
|
for (auto w : dockWidgets) {
|
||||||
if (zenDocks.contains(w)) {
|
if (zenDocks.contains(w)) {
|
||||||
w->show();
|
w->show();
|
||||||
@ -637,16 +639,16 @@ void MainWindow::showZenDocks()
|
|||||||
void MainWindow::showDebugDocks()
|
void MainWindow::showDebugDocks()
|
||||||
{
|
{
|
||||||
const QList<QDockWidget *> debugDocks = { functionsDock,
|
const QList<QDockWidget *> debugDocks = { functionsDock,
|
||||||
stringsDock,
|
stringsDock,
|
||||||
graphDock,
|
graphDock,
|
||||||
disassemblyDock,
|
disassemblyDock,
|
||||||
hexdumpDock,
|
hexdumpDock,
|
||||||
searchDock,
|
searchDock,
|
||||||
stackDock,
|
stackDock,
|
||||||
registersDock,
|
registersDock,
|
||||||
backtraceDock,
|
backtraceDock,
|
||||||
memoryMapDock,
|
memoryMapDock,
|
||||||
breakpointDock
|
breakpointDock
|
||||||
};
|
};
|
||||||
for (auto w : dockWidgets) {
|
for (auto w : dockWidgets) {
|
||||||
if (debugDocks.contains(w)) {
|
if (debugDocks.contains(w)) {
|
||||||
@ -954,7 +956,7 @@ void MainWindow::mousePressEvent(QMouseEvent *event)
|
|||||||
bool MainWindow::eventFilter(QObject *, QEvent *event)
|
bool MainWindow::eventFilter(QObject *, QEvent *event)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::MouseButtonPress) {
|
if (event->type() == QEvent::MouseButtonPress) {
|
||||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
|
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||||
if (mouseEvent->button() == Qt::ForwardButton || mouseEvent->button() == Qt::BackButton) {
|
if (mouseEvent->button() == Qt::ForwardButton || mouseEvent->button() == Qt::BackButton) {
|
||||||
mousePressEvent(mouseEvent);
|
mousePressEvent(mouseEvent);
|
||||||
return true;
|
return true;
|
||||||
|
@ -9,16 +9,17 @@
|
|||||||
#include "utils/Helpers.h"
|
#include "utils/Helpers.h"
|
||||||
#include "utils/Configuration.h"
|
#include "utils/Configuration.h"
|
||||||
|
|
||||||
GeneralOptionsWidget::GeneralOptionsWidget(PreferencesDialog */*dialog*/, QWidget *parent)
|
GeneralOptionsWidget::GeneralOptionsWidget(PreferencesDialog *dialog, QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
ui(new Ui::GeneralOptionsWidget)
|
ui(new Ui::GeneralOptionsWidget)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(dialog);
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
updateFontFromConfig();
|
updateFontFromConfig();
|
||||||
updateThemeFromConfig();
|
updateThemeFromConfig();
|
||||||
|
|
||||||
//connect(Config(), SIGNAL(fontsUpdated()), this, SLOT(updateFontFromConfig()));
|
connect(Config(), &Configuration::fontsUpdated, this, &GeneralOptionsWidget::updateFontFromConfig);
|
||||||
//connect(Config(), SIGNAL(colorsUpdated()), this, SLOT(updateThemeFromConfig()));
|
//connect(Config(), SIGNAL(colorsUpdated()), this, SLOT(updateThemeFromConfig()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,12 +18,13 @@ BacktraceWidget::BacktraceWidget(MainWindow *main, QAction *action) :
|
|||||||
modelBacktrace->setHorizontalHeaderItem(2, new QStandardItem(tr("Frame Size")));
|
modelBacktrace->setHorizontalHeaderItem(2, new QStandardItem(tr("Frame Size")));
|
||||||
modelBacktrace->setHorizontalHeaderItem(3, new QStandardItem(tr("Func Name")));
|
modelBacktrace->setHorizontalHeaderItem(3, new QStandardItem(tr("Func Name")));
|
||||||
modelBacktrace->setHorizontalHeaderItem(4, new QStandardItem(tr("Description")));
|
modelBacktrace->setHorizontalHeaderItem(4, new QStandardItem(tr("Description")));
|
||||||
viewBacktrace->setStyleSheet("QTableView {font-family: mono}");
|
viewBacktrace->setFont(Config()->getFont());
|
||||||
viewBacktrace->setModel(modelBacktrace);
|
viewBacktrace->setModel(modelBacktrace);
|
||||||
ui->verticalLayout->addWidget(viewBacktrace);
|
ui->verticalLayout->addWidget(viewBacktrace);
|
||||||
|
|
||||||
connect(Core(), &CutterCore::refreshAll, this, &BacktraceWidget::updateContents);
|
connect(Core(), &CutterCore::refreshAll, this, &BacktraceWidget::updateContents);
|
||||||
connect(Core(), &CutterCore::seekChanged, this, &BacktraceWidget::updateContents);
|
connect(Core(), &CutterCore::seekChanged, this, &BacktraceWidget::updateContents);
|
||||||
|
connect(Config(), &Configuration::fontsUpdated, this, &BacktraceWidget::fontsUpdatedSlot);
|
||||||
}
|
}
|
||||||
|
|
||||||
BacktraceWidget::~BacktraceWidget() {}
|
BacktraceWidget::~BacktraceWidget() {}
|
||||||
@ -61,3 +62,8 @@ void BacktraceWidget::setBacktraceGrid()
|
|||||||
viewBacktrace->setModel(modelBacktrace);
|
viewBacktrace->setModel(modelBacktrace);
|
||||||
viewBacktrace->resizeColumnsToContents();;
|
viewBacktrace->resizeColumnsToContents();;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BacktraceWidget::fontsUpdatedSlot()
|
||||||
|
{
|
||||||
|
viewBacktrace->setFont(Config()->getFont());
|
||||||
|
}
|
@ -25,6 +25,7 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void updateContents();
|
void updateContents();
|
||||||
void setBacktraceGrid();
|
void setBacktraceGrid();
|
||||||
|
void fontsUpdatedSlot();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Ui::BacktraceWidget> ui;
|
std::unique_ptr<Ui::BacktraceWidget> ui;
|
||||||
|
@ -376,21 +376,21 @@ void DisassemblerGraphView::drawBlock(QPainter &p, GraphView::GraphBlock &block)
|
|||||||
block.width, block.height);
|
block.width, block.height);
|
||||||
|
|
||||||
// Draw different background for selected instruction
|
// Draw different background for selected instruction
|
||||||
bool paintedSelected = false;
|
|
||||||
if (selected_instruction != RVA_INVALID) {
|
if (selected_instruction != RVA_INVALID) {
|
||||||
int y = block.y + (2 * charWidth) + (db.header_text.lines.size() * charHeight);
|
int y = block.y + (2 * charWidth) + (db.header_text.lines.size() * charHeight);
|
||||||
for (Instr &instr : db.instrs) {
|
for (Instr &instr : db.instrs) {
|
||||||
|
if (instr.addr > selected_instruction) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
auto selected = instr.addr == selected_instruction;
|
auto selected = instr.addr == selected_instruction;
|
||||||
//auto traceCount = dbgfunctions->GetTraceRecordHitCount(instr.addr);
|
//auto traceCount = dbgfunctions->GetTraceRecordHitCount(instr.addr);
|
||||||
auto traceCount = 0;
|
auto traceCount = 0;
|
||||||
if (selected && traceCount) {
|
if (selected && traceCount) {
|
||||||
p.fillRect(QRect(block.x + charWidth, y, block.width - (10 + 2 * charWidth),
|
p.fillRect(QRect(block.x + charWidth, y, block.width - (10 + 2 * charWidth),
|
||||||
int(instr.text.lines.size()) * charHeight), disassemblyTracedSelectionColor);
|
int(instr.text.lines.size()) * charHeight), disassemblyTracedSelectionColor);
|
||||||
paintedSelected = true;
|
|
||||||
} else if (selected) {
|
} else if (selected) {
|
||||||
p.fillRect(QRect(block.x + charWidth, y, block.width - (10 + 2 * charWidth),
|
p.fillRect(QRect(block.x + charWidth, y, block.width - (10 + 2 * charWidth),
|
||||||
int(instr.text.lines.size()) * charHeight), disassemblySelectionColor);
|
int(instr.text.lines.size()) * charHeight), disassemblySelectionColor);
|
||||||
paintedSelected = true;
|
|
||||||
} else if (traceCount) {
|
} else if (traceCount) {
|
||||||
// Color depending on how often a sequence of code is executed
|
// Color depending on how often a sequence of code is executed
|
||||||
int exponent = 1;
|
int exponent = 1;
|
||||||
@ -407,10 +407,6 @@ void DisassemblerGraphView::drawBlock(QPainter &p, GraphView::GraphBlock &block)
|
|||||||
QColor(disassemblyTracedColor.red(),
|
QColor(disassemblyTracedColor.red(),
|
||||||
disassemblyTracedColor.green(),
|
disassemblyTracedColor.green(),
|
||||||
std::max(0, std::min(256, disassemblyTracedColor.blue() + colorDiff))));
|
std::max(0, std::min(256, disassemblyTracedColor.blue() + colorDiff))));
|
||||||
paintedSelected = true;
|
|
||||||
}
|
|
||||||
if (paintedSelected) {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
y += int(instr.text.lines.size()) * charHeight;
|
y += int(instr.text.lines.size()) * charHeight;
|
||||||
}
|
}
|
||||||
@ -420,11 +416,13 @@ void DisassemblerGraphView::drawBlock(QPainter &p, GraphView::GraphBlock &block)
|
|||||||
if (PCInBlock) {
|
if (PCInBlock) {
|
||||||
int y = block.y + (2 * charWidth) + (db.header_text.lines.size() * charHeight);
|
int y = block.y + (2 * charWidth) + (db.header_text.lines.size() * charHeight);
|
||||||
for (Instr &instr : db.instrs) {
|
for (Instr &instr : db.instrs) {
|
||||||
|
if (instr.addr > PCAddr) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
auto PC = instr.addr == PCAddr;
|
auto PC = instr.addr == PCAddr;
|
||||||
if (PC) {
|
if (PC) {
|
||||||
p.fillRect(QRect(block.x + charWidth, y, block.width - (10 + 2 * charWidth),
|
p.fillRect(QRect(block.x + charWidth, y, block.width - (10 + 2 * charWidth),
|
||||||
int(instr.text.lines.size()) * charHeight), PCSelectionColor);
|
int(instr.text.lines.size()) * charHeight), PCSelectionColor);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
y += int(instr.text.lines.size()) * charHeight;
|
y += int(instr.text.lines.size()) * charHeight;
|
||||||
}
|
}
|
||||||
@ -677,8 +675,7 @@ void DisassemblerGraphView::seekPrev()
|
|||||||
{
|
{
|
||||||
if (seekable->getSyncWithCore()) {
|
if (seekable->getSyncWithCore()) {
|
||||||
Core()->seekPrev();
|
Core()->seekPrev();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
seekable->seek(seekable->getPrevIndependentOffset());
|
seekable->seek(seekable->getPrevIndependentOffset());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,8 +127,8 @@ void GraphView::adjustSize(int new_width, int new_height, QPoint mouse)
|
|||||||
|
|
||||||
int dx = newMaxX - originalRangeX;
|
int dx = newMaxX - originalRangeX;
|
||||||
int dy = newMaxY - originalRangeY;
|
int dy = newMaxY - originalRangeY;
|
||||||
horizontalScrollBar()->setValue(topX + dx*((float)mouseLocal.x()/new_width));
|
horizontalScrollBar()->setValue(topX + dx * ((float)mouseLocal.x() / new_width));
|
||||||
verticalScrollBar()->setValue(topY + dy*((float)mouseLocal.y()/new_height));
|
verticalScrollBar()->setValue(topY + dy * ((float)mouseLocal.y() / new_height));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GraphView::event(QEvent *event)
|
bool GraphView::event(QEvent *event)
|
||||||
@ -864,8 +864,8 @@ void GraphView::mouseMoveEvent(QMouseEvent *event)
|
|||||||
int y_delta = scroll_base_y - event->y();
|
int y_delta = scroll_base_y - event->y();
|
||||||
scroll_base_x = event->x();
|
scroll_base_x = event->x();
|
||||||
scroll_base_y = event->y();
|
scroll_base_y = event->y();
|
||||||
horizontalScrollBar()->setValue(horizontalScrollBar()->value() + x_delta * (1/current_scale));
|
horizontalScrollBar()->setValue(horizontalScrollBar()->value() + x_delta * (1 / current_scale));
|
||||||
verticalScrollBar()->setValue(verticalScrollBar()->value() + y_delta * (1/current_scale));
|
verticalScrollBar()->setValue(verticalScrollBar()->value() + y_delta * (1 / current_scale));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -912,7 +912,7 @@ void GraphView::wheelEvent(QWheelEvent *event)
|
|||||||
const QPoint delta = -event->angleDelta();
|
const QPoint delta = -event->angleDelta();
|
||||||
int x_delta = delta.x();
|
int x_delta = delta.x();
|
||||||
int y_delta = delta.y();
|
int y_delta = delta.y();
|
||||||
horizontalScrollBar()->setValue(horizontalScrollBar()->value() + x_delta * (1/current_scale));
|
horizontalScrollBar()->setValue(horizontalScrollBar()->value() + x_delta * (1 / current_scale));
|
||||||
verticalScrollBar()->setValue(verticalScrollBar()->value() + y_delta * (1/current_scale));
|
verticalScrollBar()->setValue(verticalScrollBar()->value() + y_delta * (1 / current_scale));
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
@ -29,12 +29,12 @@ void RegistersWidget::updateContents()
|
|||||||
setRegisterGrid();
|
setRegisterGrid();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegistersWidget::handleButton()
|
void RegistersWidget::handleButton()
|
||||||
{
|
{
|
||||||
int j = 0;
|
int j = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int col = 0;
|
int col = 0;
|
||||||
for (j = 0; j<registerLen; j++) {
|
for (j = 0; j < registerLen; j++) {
|
||||||
QWidget *regName = registerLayout->itemAtPosition(i, col)->widget();
|
QWidget *regName = registerLayout->itemAtPosition(i, col)->widget();
|
||||||
QWidget *regValue = registerLayout->itemAtPosition(i, col + 1)->widget();
|
QWidget *regValue = registerLayout->itemAtPosition(i, col + 1)->widget();
|
||||||
QLabel *regLabel = qobject_cast<QLabel *>(regName);
|
QLabel *regLabel = qobject_cast<QLabel *>(regName);
|
||||||
@ -43,13 +43,13 @@ void RegistersWidget::updateContents()
|
|||||||
QString regValueString = regLine->text();
|
QString regValueString = regLine->text();
|
||||||
Core()->setRegister(regNameString, regValueString);
|
Core()->setRegister(regNameString, regValueString);
|
||||||
i++;
|
i++;
|
||||||
if (i >= registerLen/numCols + 1) {
|
if (i >= registerLen / numCols + 1) {
|
||||||
i = 0;
|
i = 0;
|
||||||
col += 2;
|
col += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setRegisterGrid();
|
setRegisterGrid();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegistersWidget::setRegisterGrid()
|
void RegistersWidget::setRegisterGrid()
|
||||||
{
|
{
|
||||||
@ -66,16 +66,14 @@ void RegistersWidget::setRegisterGrid()
|
|||||||
// check if we already filled this grid space with label/value
|
// check if we already filled this grid space with label/value
|
||||||
if (!registerLayout->itemAtPosition(i, col)) {
|
if (!registerLayout->itemAtPosition(i, col)) {
|
||||||
registerLabel = new QLabel;
|
registerLabel = new QLabel;
|
||||||
registerLabel->setStyleSheet("font-weight: bold; font-family: mono");
|
registerLabel->setStyleSheet("font-weight: bold; font-family: mono;");
|
||||||
registerEditValue = new QLineEdit;
|
registerEditValue = new QLineEdit;
|
||||||
QFont font = registerEditValue->font();
|
registerEditValue->setFixedWidth(140);
|
||||||
font.setWeight(QFont::Monospace);
|
registerEditValue->setFont(Config()->getFont());
|
||||||
registerEditValue->setFont(font);
|
|
||||||
// add label and register value to grid
|
// add label and register value to grid
|
||||||
registerLayout->addWidget(registerLabel, i, col);
|
registerLayout->addWidget(registerLabel, i, col);
|
||||||
registerLayout->addWidget(registerEditValue, i, col + 1);
|
registerLayout->addWidget(registerEditValue, i, col + 1);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
QWidget *regNameWidget = registerLayout->itemAtPosition(i, col)->widget();
|
QWidget *regNameWidget = registerLayout->itemAtPosition(i, col)->widget();
|
||||||
QWidget *regValueWidget = registerLayout->itemAtPosition(i, col + 1)->widget();
|
QWidget *regValueWidget = registerLayout->itemAtPosition(i, col + 1)->widget();
|
||||||
registerLabel = qobject_cast<QLabel *>(regNameWidget);
|
registerLabel = qobject_cast<QLabel *>(regNameWidget);
|
||||||
@ -84,8 +82,7 @@ void RegistersWidget::setRegisterGrid()
|
|||||||
// decide to highlight QLine Box in case of change of register value
|
// decide to highlight QLine Box in case of change of register value
|
||||||
if (regValue != registerEditValue->text() && registerEditValue->text() != 0) {
|
if (regValue != registerEditValue->text() && registerEditValue->text() != 0) {
|
||||||
registerEditValue->setStyleSheet("QLineEdit {border: 1px solid green;} QLineEdit:hover { border: 1px solid #3daee9; color: #eff0f1;}");
|
registerEditValue->setStyleSheet("QLineEdit {border: 1px solid green;} QLineEdit:hover { border: 1px solid #3daee9; color: #eff0f1;}");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// reset stylesheet
|
// reset stylesheet
|
||||||
registerEditValue->setStyleSheet("");
|
registerEditValue->setStyleSheet("");
|
||||||
}
|
}
|
||||||
@ -95,7 +92,7 @@ void RegistersWidget::setRegisterGrid()
|
|||||||
registerEditValue->setText(regValue);
|
registerEditValue->setText(regValue);
|
||||||
i++;
|
i++;
|
||||||
// decide if we should change column
|
// decide if we should change column
|
||||||
if (i >= registerLen/numCols + 1) {
|
if (i >= registerLen / numCols + 1) {
|
||||||
i = 0;
|
i = 0;
|
||||||
col += 2;
|
col += 2;
|
||||||
}
|
}
|
||||||
|
@ -13,22 +13,27 @@
|
|||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string notr="true">Registers</string>
|
<string notr="true">Registers</string>
|
||||||
</property>
|
</property>
|
||||||
|
<widget class="QScrollArea" name="scrollArea">
|
||||||
|
<property name="widgetResizable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<widget class="QWidget" name="dockWidgetContents">
|
<widget class="QWidget" name="dockWidgetContents">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>10</number>
|
<number>10</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
@ -16,7 +16,7 @@ StackWidget::StackWidget(MainWindow *main, QAction *action) :
|
|||||||
modelStack->setHorizontalHeaderItem(0, new QStandardItem(tr("Offset")));
|
modelStack->setHorizontalHeaderItem(0, new QStandardItem(tr("Offset")));
|
||||||
modelStack->setHorizontalHeaderItem(1, new QStandardItem(tr("Value")));
|
modelStack->setHorizontalHeaderItem(1, new QStandardItem(tr("Value")));
|
||||||
modelStack->setHorizontalHeaderItem(2, new QStandardItem(tr("Reference")));
|
modelStack->setHorizontalHeaderItem(2, new QStandardItem(tr("Reference")));
|
||||||
viewStack->setStyleSheet("QTableView {font-family: mono}");
|
viewStack->setFont(Config()->getFont());
|
||||||
viewStack->setModel(modelStack);
|
viewStack->setModel(modelStack);
|
||||||
viewStack->verticalHeader()->hide();
|
viewStack->verticalHeader()->hide();
|
||||||
viewStack->setSortingEnabled(true);
|
viewStack->setSortingEnabled(true);
|
||||||
@ -24,6 +24,7 @@ StackWidget::StackWidget(MainWindow *main, QAction *action) :
|
|||||||
|
|
||||||
connect(Core(), &CutterCore::refreshAll, this, &StackWidget::updateContents);
|
connect(Core(), &CutterCore::refreshAll, this, &StackWidget::updateContents);
|
||||||
connect(Core(), &CutterCore::seekChanged, this, &StackWidget::updateContents);
|
connect(Core(), &CutterCore::seekChanged, this, &StackWidget::updateContents);
|
||||||
|
connect(Config(), &Configuration::fontsUpdated, this, &StackWidget::fontsUpdatedSlot);
|
||||||
}
|
}
|
||||||
|
|
||||||
StackWidget::~StackWidget() {}
|
StackWidget::~StackWidget() {}
|
||||||
@ -56,3 +57,8 @@ void StackWidget::setStackGrid()
|
|||||||
viewStack->setModel(modelStack);
|
viewStack->setModel(modelStack);
|
||||||
viewStack->resizeColumnsToContents();;
|
viewStack->resizeColumnsToContents();;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StackWidget::fontsUpdatedSlot()
|
||||||
|
{
|
||||||
|
viewStack->setFont(Config()->getFont());
|
||||||
|
}
|
@ -25,6 +25,7 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void updateContents();
|
void updateContents();
|
||||||
void setStackGrid();
|
void setStackGrid();
|
||||||
|
void fontsUpdatedSlot();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Ui::StackWidget> ui;
|
std::unique_ptr<Ui::StackWidget> ui;
|
||||||
|
Loading…
Reference in New Issue
Block a user