mirror of
https://github.com/rizinorg/cutter.git
synced 2025-02-21 14:16:08 +00:00
Use global font for Hexdump, Remove old menu
This commit is contained in:
parent
e9c09d8fa1
commit
2775b4bb0a
@ -34,11 +34,6 @@ HexdumpWidget::HexdumpWidget(QWidget *parent, Qt::WindowFlags flags) :
|
|||||||
//connect(ui->hexHexText, SIGNAL(cursorPositionChanged()), this, SLOT(highlightHexCurrentLine()));
|
//connect(ui->hexHexText, SIGNAL(cursorPositionChanged()), this, SLOT(highlightHexCurrentLine()));
|
||||||
//highlightHexCurrentLine();
|
//highlightHexCurrentLine();
|
||||||
|
|
||||||
// Normalize fonts for other OS
|
|
||||||
/*qhelpers::normalizeFont(ui->hexOffsetText);
|
|
||||||
qhelpers::normalizeFont(ui->hexHexText);
|
|
||||||
qhelpers::normalizeFont(ui->hexASCIIText);*/
|
|
||||||
|
|
||||||
int margin = static_cast<int>(ui->hexOffsetText->document()->documentMargin());
|
int margin = static_cast<int>(ui->hexOffsetText->document()->documentMargin());
|
||||||
ui->offsetHeaderLabel->setContentsMargins(margin, 0, margin, 0);
|
ui->offsetHeaderLabel->setContentsMargins(margin, 0, margin, 0);
|
||||||
|
|
||||||
@ -48,15 +43,9 @@ HexdumpWidget::HexdumpWidget(QWidget *parent, Qt::WindowFlags flags) :
|
|||||||
margin = static_cast<int>(ui->hexASCIIText->document()->documentMargin());
|
margin = static_cast<int>(ui->hexASCIIText->document()->documentMargin());
|
||||||
ui->asciiHeaderLabel->setContentsMargins(margin, 0, margin, 0);
|
ui->asciiHeaderLabel->setContentsMargins(margin, 0, margin, 0);
|
||||||
|
|
||||||
setFonts();
|
setupFonts();
|
||||||
updateHeaders();
|
updateHeaders();
|
||||||
|
|
||||||
// Popup menu on Settings toolbutton
|
|
||||||
QMenu *memMenu = new QMenu();
|
|
||||||
ui->memSettingsButton_2->addAction(ui->actionSettings_menu_1);
|
|
||||||
memMenu->addAction(ui->actionSettings_menu_1);
|
|
||||||
ui->memSettingsButton_2->setMenu(memMenu);
|
|
||||||
|
|
||||||
// Set hexdump context menu
|
// Set hexdump context menu
|
||||||
ui->hexHexText->setContextMenuPolicy(Qt::CustomContextMenu);
|
ui->hexHexText->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(ui->hexHexText, SIGNAL(customContextMenuRequested(const QPoint &)),
|
connect(ui->hexHexText, SIGNAL(customContextMenuRequested(const QPoint &)),
|
||||||
@ -70,6 +59,8 @@ HexdumpWidget::HexdumpWidget(QWidget *parent, Qt::WindowFlags flags) :
|
|||||||
// Control Disasm and Hex scroll to add more contents
|
// Control Disasm and Hex scroll to add more contents
|
||||||
connectScroll(false);
|
connectScroll(false);
|
||||||
|
|
||||||
|
connect(Config(), SIGNAL(fontsUpdated()), this, SLOT(fontsUpdated()));
|
||||||
|
|
||||||
connect(Core(), SIGNAL(seekChanged(RVA)), this, SLOT(on_seekChanged(RVA)));
|
connect(Core(), SIGNAL(seekChanged(RVA)), this, SLOT(on_seekChanged(RVA)));
|
||||||
connect(Core(), SIGNAL(raisePrioritizedMemoryWidget(CutterCore::MemoryWidgetType)), this, SLOT(raisePrioritizedMemoryWidget(CutterCore::MemoryWidgetType)));
|
connect(Core(), SIGNAL(raisePrioritizedMemoryWidget(CutterCore::MemoryWidgetType)), this, SLOT(raisePrioritizedMemoryWidget(CutterCore::MemoryWidgetType)));
|
||||||
|
|
||||||
@ -714,30 +705,10 @@ void HexdumpWidget::showHexASCIIContextMenu(const QPoint &pt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Actions callback functions
|
|
||||||
*/
|
|
||||||
|
|
||||||
void HexdumpWidget::on_actionSettings_menu_1_triggered()
|
void HexdumpWidget::setupFonts()
|
||||||
{
|
{
|
||||||
/*bool ok = true;
|
QFont font = Config()->getFont();
|
||||||
|
|
||||||
QFont font = QFont("Monospace", 8);
|
|
||||||
// TODO Use global configuration
|
|
||||||
//QFont font = QFontDialog::getFont(&ok, ui->disasTextEdit_2->font(), this);
|
|
||||||
|
|
||||||
if (ok)
|
|
||||||
{
|
|
||||||
setFonts(font);
|
|
||||||
|
|
||||||
//emit fontChanged(font);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void HexdumpWidget::setFonts()
|
|
||||||
{
|
|
||||||
QFont font = QFont("Monospace", 8);
|
|
||||||
// TODO Use global configuration
|
|
||||||
|
|
||||||
ui->hexOffsetText->setFont(font);
|
ui->hexOffsetText->setFont(font);
|
||||||
ui->hexHexText->setFont(font);
|
ui->hexHexText->setFont(font);
|
||||||
@ -748,6 +719,18 @@ void HexdumpWidget::setFonts()
|
|||||||
ui->asciiHeaderLabel->setFont(font);
|
ui->asciiHeaderLabel->setFont(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HexdumpWidget::fontsUpdated()
|
||||||
|
{
|
||||||
|
setupFonts();
|
||||||
|
resizeHexdump();
|
||||||
|
adjustHexdumpLines();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions callback functions
|
||||||
|
*/
|
||||||
|
|
||||||
void HexdumpWidget::on_actionHideHexdump_side_panel_triggered()
|
void HexdumpWidget::on_actionHideHexdump_side_panel_triggered()
|
||||||
{
|
{
|
||||||
if (ui->hexSideTab_2->isVisible())
|
if (ui->hexSideTab_2->isVisible())
|
||||||
|
@ -77,15 +77,15 @@ private:
|
|||||||
void connectScroll(bool disconnect);
|
void connectScroll(bool disconnect);
|
||||||
void setupScrollSync();
|
void setupScrollSync();
|
||||||
|
|
||||||
|
void setupFonts();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_seekChanged(RVA addr);
|
void on_seekChanged(RVA addr);
|
||||||
void raisePrioritizedMemoryWidget(CutterCore::MemoryWidgetType type);
|
void raisePrioritizedMemoryWidget(CutterCore::MemoryWidgetType type);
|
||||||
|
|
||||||
void highlightHexCurrentLine();
|
void highlightHexCurrentLine();
|
||||||
void setFonts();
|
|
||||||
|
|
||||||
void highlightHexWords(const QString &str);
|
void highlightHexWords(const QString &str);
|
||||||
void on_actionSettings_menu_1_triggered();
|
|
||||||
void on_actionHideHexdump_side_panel_triggered();
|
void on_actionHideHexdump_side_panel_triggered();
|
||||||
|
|
||||||
void showHexdumpContextMenu(const QPoint &pt);
|
void showHexdumpContextMenu(const QPoint &pt);
|
||||||
@ -106,6 +106,8 @@ private slots:
|
|||||||
void resizeHexdump();
|
void resizeHexdump();
|
||||||
void adjustHexdumpLines();
|
void adjustHexdumpLines();
|
||||||
|
|
||||||
|
void fontsUpdated();
|
||||||
|
|
||||||
void on_codeCombo_2_currentTextChanged(const QString &arg1);
|
void on_codeCombo_2_currentTextChanged(const QString &arg1);
|
||||||
void on_hexSideTab_2_currentChanged(int index);
|
void on_hexSideTab_2_currentChanged(int index);
|
||||||
void on_memSideToolButton_clicked();
|
void on_memSideToolButton_clicked();
|
||||||
|
@ -147,60 +147,6 @@ QToolTip {
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="Line" name="line">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="memSettingsButton_2">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string notr="true">Settings</string>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QToolButton { /* all types of tool button */
|
|
||||||
border: 5px solid #333;
|
|
||||||
border-left: 10px solid #333;
|
|
||||||
border-right: 10px solid #333;
|
|
||||||
border-radius: 0px;
|
|
||||||
background-color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
QToolButton:hover {
|
|
||||||
border: 5px solid #444;
|
|
||||||
border-radius: 0px;
|
|
||||||
background-color: #444;
|
|
||||||
}
|
|
||||||
|
|
||||||
QToolButton:pressed {
|
|
||||||
border: 5px solid #2180a9;
|
|
||||||
border-radius: 0px;
|
|
||||||
background-color: #2180a9;
|
|
||||||
}
|
|
||||||
|
|
||||||
QToolTip {
|
|
||||||
background-color: #444;
|
|
||||||
border: 3px solid #444;
|
|
||||||
color: rgb(232, 232, 232);
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../resources.qrc">
|
|
||||||
<normaloff>:/img/icons/cog_light.svg</normaloff>:/img/icons/cog_light.svg</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="popupMode">
|
|
||||||
<enum>QToolButton::InstantPopup</enum>
|
|
||||||
</property>
|
|
||||||
<property name="autoRaise">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -929,14 +875,6 @@ QToolTip {
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<action name="actionSettings_menu_1">
|
|
||||||
<property name="text">
|
|
||||||
<string>Change font</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Change font</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionHideHexdump_side_panel">
|
<action name="actionHideHexdump_side_panel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Hexdump side panel</string>
|
<string>Hexdump side panel</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user