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
@ -778,10 +778,10 @@ void CutterCore::startDebug()
|
||||
emit registersChanged();
|
||||
if (!currentlyDebugging) {
|
||||
setConfig("asm.flags", false);
|
||||
currentlyDebugging = true;
|
||||
emit changeDebugView();
|
||||
emit flagsChanged();
|
||||
emit refreshCodeViews();
|
||||
currentlyDebugging = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -798,11 +798,11 @@ void CutterCore::startEmulation()
|
||||
setConfig("asm.flags", false);
|
||||
// allows to view self-modifying code changes or other binary changes
|
||||
setConfig("io.cache", true);
|
||||
currentlyDebugging = true;
|
||||
currentlyEmulating = true;
|
||||
emit changeDebugView();
|
||||
emit flagsChanged();
|
||||
emit refreshCodeViews();
|
||||
currentlyDebugging = true;
|
||||
currentlyEmulating = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -819,9 +819,9 @@ void CutterCore::attachDebug(int pid)
|
||||
if (!currentlyDebugging || !currentlyEmulating) {
|
||||
// prevent register flags from appearing during debug/emul
|
||||
setConfig("asm.flags", false);
|
||||
currentlyDebugging = true;
|
||||
emit changeDebugView();
|
||||
emit flagsChanged();
|
||||
currentlyDebugging = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2034,6 +2034,22 @@ QList<QString> CutterCore::getColorThemes()
|
||||
return r;
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -267,7 +267,8 @@ void MainWindow::initUI()
|
||||
connect(core, &CutterCore::changeDefinedView, this, &MainWindow::changeDefinedView);
|
||||
|
||||
updateTasksIndicator();
|
||||
connect(core->getAsyncTaskManager(), &AsyncTaskManager::tasksChanged, this, &MainWindow::updateTasksIndicator);
|
||||
connect(core->getAsyncTaskManager(), &AsyncTaskManager::tasksChanged, this,
|
||||
&MainWindow::updateTasksIndicator);
|
||||
|
||||
/* Load plugins */
|
||||
QList<CutterPlugin *> plugins = Core()->getCutterPlugins();
|
||||
@ -337,7 +338,8 @@ void MainWindow::openNewFileFailed()
|
||||
mb.setIcon(QMessageBox::Critical);
|
||||
mb.setStandardButtons(QMessageBox::Ok);
|
||||
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();
|
||||
}
|
||||
|
||||
@ -557,9 +559,9 @@ void MainWindow::restoreDocks()
|
||||
tabifyDockWidget(dashboardDock, vTablesDock);
|
||||
|
||||
// Add Stack, Registers and Backtrace vertically stacked
|
||||
addExtraWidget(stackDock);
|
||||
splitDockWidget(sidebarDock, stackDock, Qt::Horizontal);
|
||||
splitDockWidget(stackDock, registersDock, Qt::Vertical);
|
||||
splitDockWidget(stackDock, backtraceDock, Qt::Vertical);
|
||||
tabifyDockWidget(stackDock, backtraceDock);
|
||||
// MemoryMap/Breakpoint widget goes in the center tabs
|
||||
tabifyDockWidget(dashboardDock, memoryMapDock);
|
||||
tabifyDockWidget(dashboardDock, breakpointDock);
|
||||
|
@ -9,16 +9,17 @@
|
||||
#include "utils/Helpers.h"
|
||||
#include "utils/Configuration.h"
|
||||
|
||||
GeneralOptionsWidget::GeneralOptionsWidget(PreferencesDialog */*dialog*/, QWidget *parent)
|
||||
GeneralOptionsWidget::GeneralOptionsWidget(PreferencesDialog *dialog, QWidget *parent)
|
||||
: QDialog(parent),
|
||||
ui(new Ui::GeneralOptionsWidget)
|
||||
{
|
||||
Q_UNUSED(dialog);
|
||||
ui->setupUi(this);
|
||||
|
||||
updateFontFromConfig();
|
||||
updateThemeFromConfig();
|
||||
|
||||
//connect(Config(), SIGNAL(fontsUpdated()), this, SLOT(updateFontFromConfig()));
|
||||
connect(Config(), &Configuration::fontsUpdated, this, &GeneralOptionsWidget::updateFontFromConfig);
|
||||
//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(3, new QStandardItem(tr("Func Name")));
|
||||
modelBacktrace->setHorizontalHeaderItem(4, new QStandardItem(tr("Description")));
|
||||
viewBacktrace->setStyleSheet("QTableView {font-family: mono}");
|
||||
viewBacktrace->setFont(Config()->getFont());
|
||||
viewBacktrace->setModel(modelBacktrace);
|
||||
ui->verticalLayout->addWidget(viewBacktrace);
|
||||
|
||||
connect(Core(), &CutterCore::refreshAll, this, &BacktraceWidget::updateContents);
|
||||
connect(Core(), &CutterCore::seekChanged, this, &BacktraceWidget::updateContents);
|
||||
connect(Config(), &Configuration::fontsUpdated, this, &BacktraceWidget::fontsUpdatedSlot);
|
||||
}
|
||||
|
||||
BacktraceWidget::~BacktraceWidget() {}
|
||||
@ -61,3 +62,8 @@ void BacktraceWidget::setBacktraceGrid()
|
||||
viewBacktrace->setModel(modelBacktrace);
|
||||
viewBacktrace->resizeColumnsToContents();;
|
||||
}
|
||||
|
||||
void BacktraceWidget::fontsUpdatedSlot()
|
||||
{
|
||||
viewBacktrace->setFont(Config()->getFont());
|
||||
}
|
@ -25,6 +25,7 @@ public:
|
||||
private slots:
|
||||
void updateContents();
|
||||
void setBacktraceGrid();
|
||||
void fontsUpdatedSlot();
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui::BacktraceWidget> ui;
|
||||
|
@ -376,21 +376,21 @@ void DisassemblerGraphView::drawBlock(QPainter &p, GraphView::GraphBlock &block)
|
||||
block.width, block.height);
|
||||
|
||||
// Draw different background for selected instruction
|
||||
bool paintedSelected = false;
|
||||
if (selected_instruction != RVA_INVALID) {
|
||||
int y = block.y + (2 * charWidth) + (db.header_text.lines.size() * charHeight);
|
||||
for (Instr &instr : db.instrs) {
|
||||
if (instr.addr > selected_instruction) {
|
||||
break;
|
||||
}
|
||||
auto selected = instr.addr == selected_instruction;
|
||||
//auto traceCount = dbgfunctions->GetTraceRecordHitCount(instr.addr);
|
||||
auto traceCount = 0;
|
||||
if (selected && traceCount) {
|
||||
p.fillRect(QRect(block.x + charWidth, y, block.width - (10 + 2 * charWidth),
|
||||
int(instr.text.lines.size()) * charHeight), disassemblyTracedSelectionColor);
|
||||
paintedSelected = true;
|
||||
} else if (selected) {
|
||||
p.fillRect(QRect(block.x + charWidth, y, block.width - (10 + 2 * charWidth),
|
||||
int(instr.text.lines.size()) * charHeight), disassemblySelectionColor);
|
||||
paintedSelected = true;
|
||||
} else if (traceCount) {
|
||||
// Color depending on how often a sequence of code is executed
|
||||
int exponent = 1;
|
||||
@ -407,10 +407,6 @@ void DisassemblerGraphView::drawBlock(QPainter &p, GraphView::GraphBlock &block)
|
||||
QColor(disassemblyTracedColor.red(),
|
||||
disassemblyTracedColor.green(),
|
||||
std::max(0, std::min(256, disassemblyTracedColor.blue() + colorDiff))));
|
||||
paintedSelected = true;
|
||||
}
|
||||
if (paintedSelected) {
|
||||
break;
|
||||
}
|
||||
y += int(instr.text.lines.size()) * charHeight;
|
||||
}
|
||||
@ -420,11 +416,13 @@ void DisassemblerGraphView::drawBlock(QPainter &p, GraphView::GraphBlock &block)
|
||||
if (PCInBlock) {
|
||||
int y = block.y + (2 * charWidth) + (db.header_text.lines.size() * charHeight);
|
||||
for (Instr &instr : db.instrs) {
|
||||
if (instr.addr > PCAddr) {
|
||||
break;
|
||||
}
|
||||
auto PC = instr.addr == PCAddr;
|
||||
if (PC) {
|
||||
p.fillRect(QRect(block.x + charWidth, y, block.width - (10 + 2 * charWidth),
|
||||
int(instr.text.lines.size()) * charHeight), PCSelectionColor);
|
||||
break;
|
||||
}
|
||||
y += int(instr.text.lines.size()) * charHeight;
|
||||
}
|
||||
@ -677,8 +675,7 @@ void DisassemblerGraphView::seekPrev()
|
||||
{
|
||||
if (seekable->getSyncWithCore()) {
|
||||
Core()->seekPrev();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
seekable->seek(seekable->getPrevIndependentOffset());
|
||||
}
|
||||
}
|
||||
|
@ -66,16 +66,14 @@ void RegistersWidget::setRegisterGrid()
|
||||
// check if we already filled this grid space with label/value
|
||||
if (!registerLayout->itemAtPosition(i, col)) {
|
||||
registerLabel = new QLabel;
|
||||
registerLabel->setStyleSheet("font-weight: bold; font-family: mono");
|
||||
registerLabel->setStyleSheet("font-weight: bold; font-family: mono;");
|
||||
registerEditValue = new QLineEdit;
|
||||
QFont font = registerEditValue->font();
|
||||
font.setWeight(QFont::Monospace);
|
||||
registerEditValue->setFont(font);
|
||||
registerEditValue->setFixedWidth(140);
|
||||
registerEditValue->setFont(Config()->getFont());
|
||||
// add label and register value to grid
|
||||
registerLayout->addWidget(registerLabel, i, col);
|
||||
registerLayout->addWidget(registerEditValue, i, col + 1);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
QWidget *regNameWidget = registerLayout->itemAtPosition(i, col)->widget();
|
||||
QWidget *regValueWidget = registerLayout->itemAtPosition(i, col + 1)->widget();
|
||||
registerLabel = qobject_cast<QLabel *>(regNameWidget);
|
||||
@ -84,8 +82,7 @@ void RegistersWidget::setRegisterGrid()
|
||||
// decide to highlight QLine Box in case of change of register value
|
||||
if (regValue != registerEditValue->text() && registerEditValue->text() != 0) {
|
||||
registerEditValue->setStyleSheet("QLineEdit {border: 1px solid green;} QLineEdit:hover { border: 1px solid #3daee9; color: #eff0f1;}");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// reset stylesheet
|
||||
registerEditValue->setStyleSheet("");
|
||||
}
|
||||
|
@ -13,23 +13,28 @@
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Registers</string>
|
||||
</property>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
<number>6</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -16,7 +16,7 @@ StackWidget::StackWidget(MainWindow *main, QAction *action) :
|
||||
modelStack->setHorizontalHeaderItem(0, new QStandardItem(tr("Offset")));
|
||||
modelStack->setHorizontalHeaderItem(1, new QStandardItem(tr("Value")));
|
||||
modelStack->setHorizontalHeaderItem(2, new QStandardItem(tr("Reference")));
|
||||
viewStack->setStyleSheet("QTableView {font-family: mono}");
|
||||
viewStack->setFont(Config()->getFont());
|
||||
viewStack->setModel(modelStack);
|
||||
viewStack->verticalHeader()->hide();
|
||||
viewStack->setSortingEnabled(true);
|
||||
@ -24,6 +24,7 @@ StackWidget::StackWidget(MainWindow *main, QAction *action) :
|
||||
|
||||
connect(Core(), &CutterCore::refreshAll, this, &StackWidget::updateContents);
|
||||
connect(Core(), &CutterCore::seekChanged, this, &StackWidget::updateContents);
|
||||
connect(Config(), &Configuration::fontsUpdated, this, &StackWidget::fontsUpdatedSlot);
|
||||
}
|
||||
|
||||
StackWidget::~StackWidget() {}
|
||||
@ -56,3 +57,8 @@ void StackWidget::setStackGrid()
|
||||
viewStack->setModel(modelStack);
|
||||
viewStack->resizeColumnsToContents();;
|
||||
}
|
||||
|
||||
void StackWidget::fontsUpdatedSlot()
|
||||
{
|
||||
viewStack->setFont(Config()->getFont());
|
||||
}
|
@ -25,6 +25,7 @@ public:
|
||||
private slots:
|
||||
void updateContents();
|
||||
void setStackGrid();
|
||||
void fontsUpdatedSlot();
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui::StackWidget> ui;
|
||||
|
Loading…
Reference in New Issue
Block a user