Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cutter 2.2.1 cherry-picks #3168

Merged
merged 8 commits into from
May 14, 2023
Merged
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
4 changes: 2 additions & 2 deletions src/common/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ Configuration::Configuration() : QObject(), nativePalette(qApp->palette())
mPtr = this;
if (!s.isWritable()) {
QMessageBox::critical(
nullptr, tr("Critical!"),
tr("!!! Settings are not writable! Make sure you have a write access to \"%1\"")
nullptr, tr("Critical Error!"),
tr("Settings are not writable! Make sure you have a write access to \"%1\".")
.arg(s.fileName()));
}
#ifdef CUTTER_ENABLE_KSYNTAXHIGHLIGHTING
Expand Down
7 changes: 0 additions & 7 deletions src/common/DisassemblyPreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ bool DisassemblyPreview::showDisasPreview(QWidget *parent, const QPoint &pointOf
}

RVA offsetTo = refs.at(0).to; // This is the offset we want to preview

if (Q_UNLIKELY(offsetFrom != refs.at(0).from)) {
qWarning() << QObject::tr("offsetFrom (%1) differs from refs.at(0).from (%(2))")
.arg(offsetFrom)
.arg(refs.at(0).from);
}

/*
* Only if the offset we point *to* is different from the one the cursor is currently
* on *and* the former is a valid offset, we are allowed to get a preview of offsetTo
Expand Down
2 changes: 1 addition & 1 deletion src/common/IOModesController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ bool IOModesController::askCommitUnsavedChanges()
// Check if there are uncommitted changes
if (!allChangesComitted()) {
QMessageBox::StandardButton ret = QMessageBox::question(
NULL, QObject::tr("Uncomitted changes"),
NULL, QObject::tr("Uncommitted changes"),
QObject::tr("It seems that you have changes or patches that are not committed to "
"the file.\n"
"Do you want to commit them now?"),
Expand Down
2 changes: 1 addition & 1 deletion src/dialogs/InitialOptionsDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@
</size>
</property>
<property name="text">
<string>Auto Exp</string>
<string>Experimental</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
Expand Down
2 changes: 1 addition & 1 deletion src/dialogs/MapFileDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void MapFileDialog::on_buttonBox_accepted()
}

if (!Core()->mapFile(filePath, mapAddress)) {
QMessageBox::critical(this, tr("Map new file file"), tr("Failed to map a new file"));
QMessageBox::critical(this, tr("Map new file"), tr("Failed to map a new file"));
return;
}
close();
Expand Down
2 changes: 1 addition & 1 deletion src/dialogs/NewFileDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ void NewFileDialog::fillIOPluginsList()
{
ui->ioPlugin->clear();
ui->ioPlugin->addItem("file://");
ui->ioPlugin->setItemData(0, tr("Open a file with no extra treatment."), Qt::ToolTipRole);
ui->ioPlugin->setItemData(0, tr("Open a file without additional options/settings."), Qt::ToolTipRole);

int index = 1;
QList<RzIOPluginDescription> ioPlugins = Core()->getRIOPluginDescriptions();
Expand Down
4 changes: 2 additions & 2 deletions src/dialogs/preferences/AsmOptionsWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
<item row="17" column="1">
<widget class="QLabel" name="asmTabsOffLabel">
<property name="text">
<string>Tabs before assembly (asm.tabs.off):</string>
<string>The number of tabulate spaces after the offset (asm.tabs.off):</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
Expand Down Expand Up @@ -479,7 +479,7 @@
<item>
<widget class="QCheckBox" name="varsubCheckBox">
<property name="text">
<string>Substitute variables (asm.sub.var)</string>
<string>Substitute variables in disassembly (asm.sub.var)</string>
</property>
</widget>
</item>
Expand Down
2 changes: 1 addition & 1 deletion src/menus/DisassemblyContextMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ DisassemblyContextMenu::~DisassemblyContextMenu() {}

void DisassemblyContextMenu::addSetBaseMenu()
{
setBaseMenu = addMenu(tr("Set Immediate Base to..."));
setBaseMenu = addMenu(tr("Set base of immediate value to.."));

initAction(&actionSetBaseBinary, tr("Binary"));
setBaseMenu->addAction(&actionSetBaseBinary);
Expand Down
2 changes: 1 addition & 1 deletion src/translations
3 changes: 1 addition & 2 deletions src/widgets/ColorThemeListView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,7 @@ const QMap<QString, OptionInfo> optionInfoMap__ = {
{ "fname", { QObject::tr("Color of names of functions"), QObject::tr("Function name") } },
{ "floc", { QObject::tr("Color of function location"), QObject::tr("Function location") } },
{ "fline",
{ QObject::tr(
"Color of ascii line in left side that shows what opcodes are belong to function"),
{ QObject::tr("Color of the line which shows which opcodes belongs to a function"),
QObject::tr("Function line") } },
{ "flag",
{ QObject::tr("Color of flags (similar to bookmarks for offset)"), QObject::tr("Flag") } },
Expand Down
17 changes: 16 additions & 1 deletion src/widgets/DisassemblyWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ DisassemblyWidget::DisassemblyWidget(MainWindow *main)
connect(Core(), &CutterCore::functionRenamed, this, [this]() { refreshDisasm(); });
connect(Core(), SIGNAL(varsChanged()), this, SLOT(refreshDisasm()));
connect(Core(), SIGNAL(asmOptionsChanged()), this, SLOT(refreshDisasm()));
connect(Core(), &CutterCore::instructionChanged, this, &DisassemblyWidget::refreshIfInRange);
connect(Core(), &CutterCore::instructionChanged, this, &DisassemblyWidget::instructionChanged);
connect(Core(), &CutterCore::breakpointsChanged, this, &DisassemblyWidget::refreshIfInRange);
connect(Core(), SIGNAL(refreshCodeViews()), this, SLOT(refreshDisasm()));

Expand Down Expand Up @@ -226,6 +226,12 @@ void DisassemblyWidget::refreshIfInRange(RVA offset)
}
}

void DisassemblyWidget::instructionChanged(RVA offset)
{
leftPanel->clearArrowFrom(offset);
refreshDisasm();
}

void DisassemblyWidget::refreshDisasm(RVA offset)
{
if (!disasmRefresh->attemptRefresh(offset == RVA_INVALID ? nullptr : new RVA(offset))) {
Expand Down Expand Up @@ -988,3 +994,12 @@ void DisassemblyLeftPanel::paintEvent(QPaintEvent *event)

lastBeginOffset = lines.first().offset;
}

void DisassemblyLeftPanel::clearArrowFrom(RVA offset)
{
auto it = std::find_if(arrows.begin(), arrows.end(),
[&](const Arrow &it) { return it.jmpFromOffset() == offset; });
if (it != arrows.end()) {
arrows.erase(it);
}
}
2 changes: 2 additions & 0 deletions src/widgets/DisassemblyWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public slots:
protected slots:
void on_seekChanged(RVA offset);
void refreshIfInRange(RVA offset);
void instructionChanged(RVA offset);
void refreshDisasm(RVA offset = RVA_INVALID);

bool updateMaxLines();
Expand Down Expand Up @@ -153,6 +154,7 @@ class DisassemblyLeftPanel : public QFrame
DisassemblyLeftPanel(DisassemblyWidget *disas);
void paintEvent(QPaintEvent *event) override;
void wheelEvent(QWheelEvent *event) override;
void clearArrowFrom(RVA offset);

private:
DisassemblyWidget *disas;
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/HexWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ HexWidget::HexWidget(QWidget *parent)
connect(actionWriteCString, &QAction::triggered, this, &HexWidget::w_writeCString);
actionsWriteString.append(actionWriteCString);

QAction *actionWrite64 = new QAction(tr("Write De\\Encoded Base64 string"), this);
QAction *actionWrite64 = new QAction(tr("Write a decoded or encoded Base64 string"), this);
connect(actionWrite64, &QAction::triggered, this, &HexWidget::w_write64);
actionsWriteString.append(actionWrite64);

Expand Down Expand Up @@ -1407,7 +1407,7 @@ void HexWidget::w_writeRandom()
}

bool ok = false;
int nbytes = QInputDialog::getInt(this, tr("Write random"), tr("Number of bytes:"), size, 1,
int nbytes = QInputDialog::getInt(this, tr("Write random bytes"), tr("Number of bytes:"), size, 1,
0x7FFFFFFF, 1, &ok);
if (!ok) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/RizinGraphWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void GenericRizinGraphView::loadCurrentGraph()
return;
}

CutterJson functionsDoc = Core()->cmdj(QString("%1j").arg(graphCommand));
CutterJson functionsDoc = Core()->cmdj(QString("%1 json").arg(graphCommand));
auto nodes = functionsDoc["nodes"];

for (CutterJson block : nodes) {
Expand Down