Moved graph from MemoryWidget to MainWindow

(Broke other dock windows -- not refreshed)
This commit is contained in:
xarkes 2017-10-11 13:22:30 +02:00
parent 27d2bca4f9
commit d53fd621c5
5 changed files with 22 additions and 83 deletions

View File

@ -183,6 +183,13 @@ void MainWindow::initUI()
*/
dockWidgets.reserve(12);
// Add graph view as dockable
graphDock = new QDockWidget(tr("Graph"), this);
graphDock->setAllowedAreas(Qt::AllDockWidgetAreas);
DisassemblerGraphView *gv = new DisassemblerGraphView(graphDock);
graphDock->setWidget(gv);
dockWidgets.push_back(graphDock);
// Add Memory DockWidget
this->memoryDock = new MemoryWidget();
dockWidgets.push_back(memoryDock);
@ -496,6 +503,8 @@ void MainWindow::refreshComments()
void MainWindow::updateFrames()
{
/* TODO Widgets are independants and responsible to update their own
* content right? Just send a signal.
if (core == NULL)
return;
@ -520,6 +529,7 @@ void MainWindow::updateFrames()
// graphicsBar->refreshColorBar();
graphicsBar->fillData();
*/
}
void MainWindow::on_actionLock_triggered()
@ -740,6 +750,7 @@ void MainWindow::restoreDocks()
addDockWidget(Qt::RightDockWidgetArea, sectionsDock);
addDockWidget(Qt::TopDockWidgetArea, this->dashboardDock);
this->tabifyDockWidget(sectionsDock, this->commentsDock);
this->tabifyDockWidget(this->dashboardDock, this->graphDock);
this->tabifyDockWidget(this->dashboardDock, this->memoryDock);
this->tabifyDockWidget(this->dashboardDock, this->entrypointDock);
this->tabifyDockWidget(this->dashboardDock, this->functionsDock);
@ -773,7 +784,8 @@ void MainWindow::hideAllDocks()
void MainWindow::showDefaultDocks()
{
const QList<DockWidget *> defaultDocks = { sectionsDock,
const QList<QDockWidget *> defaultDocks = { sectionsDock,
graphDock,
entrypointDock,
functionsDock,
memoryDock,
@ -949,7 +961,8 @@ void MainWindow::on_actionQuit_triggered()
void MainWindow::refreshVisibleDockWidgets()
{
// There seems to be no convenience function to check if a QDockWidget
/* TODO Just send a signal no?
* // There seems to be no convenience function to check if a QDockWidget
// is really visible or hidden in a tabbed dock. So:
auto isDockVisible = [](const QDockWidget * const pWidget)
{
@ -963,6 +976,7 @@ void MainWindow::refreshVisibleDockWidgets()
w->refresh();
}
}
*/
}
void MainWindow::on_actionRefresh_contents_triggered()

View File

@ -169,6 +169,7 @@ private slots:
private:
CutterCore *core;
QDockWidget *graphDock;
QDockWidget *asmDock;
QDockWidget *calcDock;
Omnibar *omnibar;
@ -182,7 +183,7 @@ private:
ut64 hexdumpBottomOffset;
RVA cursorAddress;
QString filename;
QList<DockWidget *> dockWidgets;
QList<QDockWidget *> dockWidgets;
std::unique_ptr<Ui::MainWindow> ui;
Highlighter *highlighter;
AsciiHighlighter *hex_highlighter;

View File

@ -134,11 +134,6 @@ MemoryWidget::MemoryWidget() :
connect(new QShortcut(Qt::SHIFT + Qt::Key_X, ui->disasTextEdit_2),
SIGNAL(activated()), this, SLOT(showXrefsDialog()));
// Create Graph View
ui->tabGraph->setLayout(new QGridLayout);
mGraphView = new DisassemblerGraphView(ui->tabGraph);
ui->tabGraph->layout()->addWidget(mGraphView);
// Space to switch between disassembly and graph
QShortcut *graph_shortcut = new QShortcut(QKeySequence(Qt::Key_Space), this);
connect(graph_shortcut, SIGNAL(activated()), this, SLOT(cycleViews()));
@ -1040,16 +1035,11 @@ void MemoryWidget::cycleViews()
switch (ui->memTabWidget->currentIndex())
{
case 0:
// Show graph
ui->graphButton->setChecked(true);
on_graphButton_clicked();
break;
case 1:
// Show hexdump
ui->hexButton->setChecked(true);
on_hexButton_clicked();
break;
case 2:
case 1:
// Show disasm
ui->disasButton->setChecked(true);
on_disasButton_clicked();
@ -1134,18 +1124,12 @@ void MemoryWidget::on_disasButton_clicked()
ui->memSideTabWidget_2->setCurrentIndex(0);
}
void MemoryWidget::on_graphButton_clicked()
void MemoryWidget::on_hexButton_clicked()
{
ui->memTabWidget->setCurrentIndex(1);
ui->memSideTabWidget_2->setCurrentIndex(1);
}
void MemoryWidget::on_hexButton_clicked()
{
ui->memTabWidget->setCurrentIndex(2);
ui->memSideTabWidget_2->setCurrentIndex(2);
}
void MemoryWidget::on_actionSend_to_Notepad_triggered()
{
QTextCursor cursor = ui->disasTextEdit_2->textCursor();

View File

@ -16,7 +16,6 @@
#include "utils/HexAsciiHighlighter.h"
#include "utils/HexHighlighter.h"
#include "Dashboard.h"
#include "widgets/DisassemblerGraphView.h"
namespace Ui
@ -45,7 +44,6 @@ public:
QTreeWidget *xreFromTreeWidget_2;
QTabWidget *memTabWidget;
QWebEngineView *histoWebView;
DisassemblerGraphView *mGraphView;
Highlighter *highlighter;
Highlighter *highlighter_5;
@ -133,7 +131,6 @@ private slots:
void on_actionHideGraph_side_panel_triggered();
void on_disasButton_clicked();
void on_graphButton_clicked();
void on_hexButton_clicked();
void showDisasContextMenu(const QPoint &pt);
void showHexdumpContextMenu(const QPoint &pt);

View File

@ -139,63 +139,6 @@ QToolTip {
</attribute>
</widget>
</item>
<item>
<widget class="QToolButton" name="graphButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Graph</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:checked {
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>...</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/img/icons/graph_light.svg</normaloff>
<normalon>:/img/icons/graph_white.svg</normalon>:/img/icons/graph_light.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item>
<widget class="QToolButton" name="hexButton">
<property name="sizePolicy">
@ -1245,7 +1188,7 @@ border-top: 0px;
<enum>QTabWidget::South</enum>
</property>
<property name="currentIndex">
<number>2</number>
<number>1</number>
</property>
<widget class="QWidget" name="tab_3">
<attribute name="title">
@ -2940,8 +2883,8 @@ QToolTip {
</resources>
<connections/>
<buttongroups>
<buttongroup name="buttonGroup_3"/>
<buttongroup name="buttonGroup"/>
<buttongroup name="buttonGroup_2"/>
<buttongroup name="buttonGroup_3"/>
</buttongroups>
</ui>