mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 11:26:11 +00:00
parent
8e0ca36e98
commit
e3e108f354
@ -105,7 +105,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
gotoEntry(nullptr),
|
gotoEntry(nullptr),
|
||||||
sdbDock(nullptr),
|
sdbDock(nullptr),
|
||||||
sectionsDock(nullptr),
|
sectionsDock(nullptr),
|
||||||
consoleWidget(nullptr)
|
consoleDock(nullptr)
|
||||||
{
|
{
|
||||||
doLock = false;
|
doLock = false;
|
||||||
configuration = new Configuration();
|
configuration = new Configuration();
|
||||||
@ -130,8 +130,6 @@ void MainWindow::initUI()
|
|||||||
// Hide central tab widget tabs
|
// Hide central tab widget tabs
|
||||||
QTabBar *centralbar = ui->centralTabWidget->tabBar();
|
QTabBar *centralbar = ui->centralTabWidget->tabBar();
|
||||||
centralbar->setVisible(false);
|
centralbar->setVisible(false);
|
||||||
consoleWidget = new ConsoleWidget(this);
|
|
||||||
ui->tabVerticalLayout->addWidget(consoleWidget);
|
|
||||||
|
|
||||||
// Sepparator between back/forward and undo/redo buttons
|
// Sepparator between back/forward and undo/redo buttons
|
||||||
QWidget *spacer4 = new QWidget();
|
QWidget *spacer4 = new QWidget();
|
||||||
@ -195,12 +193,19 @@ void MainWindow::initUI()
|
|||||||
pseudocodeDock = new PseudocodeWidget(tr("Pseudocode"), this);
|
pseudocodeDock = new PseudocodeWidget(tr("Pseudocode"), this);
|
||||||
dockWidgets.push_back(pseudocodeDock);
|
dockWidgets.push_back(pseudocodeDock);
|
||||||
|
|
||||||
|
consoleDock = new ConsoleWidget(tr("Console"), this);
|
||||||
|
dockWidgets.push_back(consoleDock);
|
||||||
|
|
||||||
// Add graph view as dockable
|
// Add graph view as dockable
|
||||||
graphDock = new QDockWidget(tr("Graph"), this);
|
graphDock = new QDockWidget(tr("Graph"), this);
|
||||||
graphDock->setObjectName("Graph");
|
graphDock->setObjectName("Graph");
|
||||||
graphDock->setAllowedAreas(Qt::AllDockWidgetAreas);
|
graphDock->setAllowedAreas(Qt::AllDockWidgetAreas);
|
||||||
graphView = new DisassemblerGraphView(graphDock);
|
graphView = new DisassemblerGraphView(graphDock);
|
||||||
graphDock->setWidget(graphView);
|
graphDock->setWidget(graphView);
|
||||||
|
|
||||||
|
// Hide centralWidget as we do not need it
|
||||||
|
ui->centralWidget->hide();
|
||||||
|
|
||||||
connect(graphDock, &QDockWidget::visibilityChanged, graphDock, [](bool visibility)
|
connect(graphDock, &QDockWidget::visibilityChanged, graphDock, [](bool visibility)
|
||||||
{
|
{
|
||||||
if (visibility)
|
if (visibility)
|
||||||
@ -287,7 +292,7 @@ void MainWindow::initUI()
|
|||||||
*/
|
*/
|
||||||
// Period goes to command entry
|
// Period goes to command entry
|
||||||
QShortcut *cmd_shortcut = new QShortcut(QKeySequence(Qt::Key_Period), this);
|
QShortcut *cmd_shortcut = new QShortcut(QKeySequence(Qt::Key_Period), this);
|
||||||
connect(cmd_shortcut, SIGNAL(activated()), consoleWidget, SLOT(focusInputLineEdit()));
|
connect(cmd_shortcut, SIGNAL(activated()), consoleDock, SLOT(focusInputLineEdit()));
|
||||||
|
|
||||||
// G and S goes to goto entry
|
// G and S goes to goto entry
|
||||||
QShortcut *goto_shortcut = new QShortcut(QKeySequence(Qt::Key_G), this);
|
QShortcut *goto_shortcut = new QShortcut(QKeySequence(Qt::Key_G), this);
|
||||||
@ -645,18 +650,18 @@ void MainWindow::on_actionDisasAdd_comment_triggered()
|
|||||||
|
|
||||||
void MainWindow::restoreDocks()
|
void MainWindow::restoreDocks()
|
||||||
{
|
{
|
||||||
// bottom right
|
// In the upper half the functions are the first widget
|
||||||
addDockWidget(Qt::RightDockWidgetArea, sectionsDock);
|
|
||||||
|
|
||||||
// left
|
|
||||||
addDockWidget(Qt::TopDockWidgetArea, functionsDock);
|
addDockWidget(Qt::TopDockWidgetArea, functionsDock);
|
||||||
|
|
||||||
// center
|
// Function | Dashboard | Sidebar
|
||||||
splitDockWidget(functionsDock, dashboardDock, Qt::Horizontal);
|
splitDockWidget(functionsDock, dashboardDock, Qt::Horizontal);
|
||||||
|
|
||||||
// right (sidebar)
|
|
||||||
splitDockWidget(dashboardDock, sidebarDock, Qt::Horizontal);
|
splitDockWidget(dashboardDock, sidebarDock, Qt::Horizontal);
|
||||||
|
|
||||||
|
// In the lower half the console is the first widget
|
||||||
|
addDockWidget(Qt::BottomDockWidgetArea, consoleDock);
|
||||||
|
|
||||||
|
// Console | Sections
|
||||||
|
splitDockWidget(consoleDock, sectionsDock, Qt::Horizontal);
|
||||||
|
|
||||||
// tabs for center (must be applied after splitDockWidget())
|
// tabs for center (must be applied after splitDockWidget())
|
||||||
tabifyDockWidget(sectionsDock, commentsDock);
|
tabifyDockWidget(sectionsDock, commentsDock);
|
||||||
@ -674,7 +679,6 @@ void MainWindow::restoreDocks()
|
|||||||
tabifyDockWidget(dashboardDock, notepadDock);
|
tabifyDockWidget(dashboardDock, notepadDock);
|
||||||
|
|
||||||
dashboardDock->raise();
|
dashboardDock->raise();
|
||||||
sectionsDock->raise();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -693,6 +697,7 @@ void MainWindow::showDefaultDocks()
|
|||||||
functionsDock,
|
functionsDock,
|
||||||
commentsDock,
|
commentsDock,
|
||||||
stringsDock,
|
stringsDock,
|
||||||
|
consoleDock,
|
||||||
importsDock,
|
importsDock,
|
||||||
symbolsDock,
|
symbolsDock,
|
||||||
notepadDock,
|
notepadDock,
|
||||||
@ -739,18 +744,6 @@ void MainWindow::on_actionDefaut_triggered()
|
|||||||
resetToDefaultLayout();
|
resetToDefaultLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionhide_bottomPannel_triggered()
|
|
||||||
{
|
|
||||||
if (ui->centralWidget->isVisible())
|
|
||||||
{
|
|
||||||
ui->centralWidget->hide();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ui->centralWidget->show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::sendToNotepad(const QString &txt)
|
void MainWindow::sendToNotepad(const QString &txt)
|
||||||
{
|
{
|
||||||
core->setNotes(core->getNotes() + "```\n" + txt + "\n```");
|
core->setNotes(core->getNotes() + "```\n" + txt + "\n```");
|
||||||
@ -766,13 +759,13 @@ void MainWindow::on_actionFunctionsRename_triggered()
|
|||||||
|
|
||||||
void MainWindow::addOutput(const QString &msg)
|
void MainWindow::addOutput(const QString &msg)
|
||||||
{
|
{
|
||||||
consoleWidget->addOutput(msg);
|
consoleDock->addOutput(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::addDebugOutput(const QString &msg)
|
void MainWindow::addDebugOutput(const QString &msg)
|
||||||
{
|
{
|
||||||
printf("debug output: %s\n", msg.toLocal8Bit().constData());
|
printf("debug output: %s\n", msg.toLocal8Bit().constData());
|
||||||
consoleWidget->addDebugOutput(msg);
|
consoleDock->addDebugOutput(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionNew_triggered()
|
void MainWindow::on_actionNew_triggered()
|
||||||
|
@ -108,8 +108,6 @@ public slots:
|
|||||||
|
|
||||||
void on_actionTabs_triggered();
|
void on_actionTabs_triggered();
|
||||||
|
|
||||||
void on_actionhide_bottomPannel_triggered();
|
|
||||||
|
|
||||||
void lockUnlock_Docks(bool what);
|
void lockUnlock_Docks(bool what);
|
||||||
|
|
||||||
void on_actionDashboard_triggered();
|
void on_actionDashboard_triggered();
|
||||||
@ -202,7 +200,7 @@ private:
|
|||||||
SdbDock *sdbDock;
|
SdbDock *sdbDock;
|
||||||
//QAction *sidebar_action;
|
//QAction *sidebar_action;
|
||||||
SectionsDock *sectionsDock;
|
SectionsDock *sectionsDock;
|
||||||
ConsoleWidget *consoleWidget;
|
ConsoleWidget *consoleDock;
|
||||||
|
|
||||||
void toggleDockWidget(QDockWidget *dock_widget);
|
void toggleDockWidget(QDockWidget *dock_widget);
|
||||||
|
|
||||||
|
@ -90,8 +90,8 @@ static bool isForbidden(const QString &input)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleWidget::ConsoleWidget(QWidget *parent) :
|
ConsoleWidget::ConsoleWidget(QWidget *parent, Qt::WindowFlags flags) :
|
||||||
QWidget(parent),
|
QDockWidget(parent, flags),
|
||||||
ui(new Ui::ConsoleWidget),
|
ui(new Ui::ConsoleWidget),
|
||||||
debugOutputEnabled(true),
|
debugOutputEnabled(true),
|
||||||
maxHistoryEntries(100),
|
maxHistoryEntries(100),
|
||||||
@ -144,6 +144,12 @@ ConsoleWidget::ConsoleWidget(QWidget *parent) :
|
|||||||
connect(Config(), SIGNAL(fontsUpdated()), this, SLOT(setupFont()));
|
connect(Config(), SIGNAL(fontsUpdated()), this, SLOT(setupFont()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConsoleWidget::ConsoleWidget(const QString &title, QWidget *parent, Qt::WindowFlags flags)
|
||||||
|
: ConsoleWidget(parent, flags)
|
||||||
|
{
|
||||||
|
setWindowTitle(title);
|
||||||
|
}
|
||||||
|
|
||||||
ConsoleWidget::~ConsoleWidget() {}
|
ConsoleWidget::~ConsoleWidget() {}
|
||||||
|
|
||||||
void ConsoleWidget::setupFont()
|
void ConsoleWidget::setupFont()
|
||||||
|
@ -11,12 +11,14 @@ namespace Ui
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ConsoleWidget : public QWidget
|
class ConsoleWidget : public QDockWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ConsoleWidget(QWidget *parent = 0);
|
explicit ConsoleWidget(const QString &title, QWidget *parent = nullptr, Qt::WindowFlags flags = 0);
|
||||||
|
explicit ConsoleWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = 0);
|
||||||
|
|
||||||
~ConsoleWidget();
|
~ConsoleWidget();
|
||||||
|
|
||||||
void addOutput(const QString &msg);
|
void addOutput(const QString &msg);
|
||||||
|
@ -1,111 +1,112 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>ConsoleWidget</class>
|
<class>ConsoleWidget</class>
|
||||||
<widget class="QWidget" name="ConsoleWidget">
|
<widget class="QDockWidget" name="ConsoleWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>583</width>
|
<width>400</width>
|
||||||
<height>534</height>
|
<height>300</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string notr="true">Entry Points</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<widget class="QWidget" name="dockWidgetContents">
|
||||||
<property name="spacing">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<number>0</number>
|
<property name="spacing">
|
||||||
</property>
|
<number>0</number>
|
||||||
<property name="leftMargin">
|
</property>
|
||||||
<number>0</number>
|
<property name="leftMargin">
|
||||||
</property>
|
<number>0</number>
|
||||||
<property name="topMargin">
|
</property>
|
||||||
<number>0</number>
|
<property name="topMargin">
|
||||||
</property>
|
<number>0</number>
|
||||||
<property name="rightMargin">
|
</property>
|
||||||
<number>0</number>
|
<property name="rightMargin">
|
||||||
</property>
|
<number>0</number>
|
||||||
<property name="bottomMargin">
|
</property>
|
||||||
<number>0</number>
|
<property name="bottomMargin">
|
||||||
</property>
|
<number>0</number>
|
||||||
<item>
|
</property>
|
||||||
<widget class="QPlainTextEdit" name="outputTextEdit">
|
<item>
|
||||||
<property name="sizePolicy">
|
<widget class="QPlainTextEdit" name="outputTextEdit">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<property name="sizePolicy">
|
||||||
<horstretch>0</horstretch>
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<verstretch>0</verstretch>
|
<horstretch>0</horstretch>
|
||||||
</sizepolicy>
|
<verstretch>0</verstretch>
|
||||||
</property>
|
</sizepolicy>
|
||||||
<property name="font">
|
</property>
|
||||||
<font>
|
<property name="font">
|
||||||
<family>Monaco</family>
|
<font>
|
||||||
<pointsize>11</pointsize>
|
<family>Monaco</family>
|
||||||
</font>
|
<pointsize>11</pointsize>
|
||||||
</property>
|
</font>
|
||||||
<property name="frameShape">
|
</property>
|
||||||
<enum>QFrame::NoFrame</enum>
|
<property name="frameShape">
|
||||||
</property>
|
<enum>QFrame::NoFrame</enum>
|
||||||
<property name="lineWidth">
|
</property>
|
||||||
<number>0</number>
|
<property name="lineWidth">
|
||||||
</property>
|
<number>0</number>
|
||||||
<property name="undoRedoEnabled">
|
</property>
|
||||||
<bool>false</bool>
|
<property name="undoRedoEnabled">
|
||||||
</property>
|
<bool>false</bool>
|
||||||
<property name="readOnly">
|
</property>
|
||||||
<bool>true</bool>
|
<property name="readOnly">
|
||||||
</property>
|
<bool>true</bool>
|
||||||
<property name="plainText">
|
</property>
|
||||||
<string/>
|
<property name="plainText">
|
||||||
</property>
|
<string/>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
</widget>
|
||||||
<item>
|
</item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<item>
|
||||||
<property name="spacing">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<number>4</number>
|
<property name="spacing">
|
||||||
</property>
|
<number>4</number>
|
||||||
<property name="leftMargin">
|
</property>
|
||||||
<number>5</number>
|
<property name="leftMargin">
|
||||||
</property>
|
<number>5</number>
|
||||||
<property name="topMargin">
|
</property>
|
||||||
<number>3</number>
|
<property name="topMargin">
|
||||||
</property>
|
<number>3</number>
|
||||||
<property name="rightMargin">
|
</property>
|
||||||
<number>5</number>
|
<property name="rightMargin">
|
||||||
</property>
|
<number>5</number>
|
||||||
<property name="bottomMargin">
|
</property>
|
||||||
<number>3</number>
|
<property name="bottomMargin">
|
||||||
</property>
|
<number>3</number>
|
||||||
<item>
|
</property>
|
||||||
<widget class="QLineEdit" name="inputLineEdit">
|
<item>
|
||||||
<property name="styleSheet">
|
<widget class="QLineEdit" name="inputLineEdit">
|
||||||
<string notr="true">border: 2px solid palette(base);</string>
|
<property name="styleSheet">
|
||||||
</property>
|
<string notr="true">border: 2px solid palette(base);</string>
|
||||||
<property name="frame">
|
</property>
|
||||||
<bool>false</bool>
|
<property name="frame">
|
||||||
</property>
|
<bool>false</bool>
|
||||||
<property name="placeholderText">
|
</property>
|
||||||
<string> Type "?" for help</string>
|
<property name="placeholderText">
|
||||||
</property>
|
<string> Type "?" for help</string>
|
||||||
<property name="clearButtonEnabled">
|
</property>
|
||||||
<bool>true</bool>
|
<property name="clearButtonEnabled">
|
||||||
</property>
|
<bool>true</bool>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
</widget>
|
||||||
<item>
|
</item>
|
||||||
<widget class="QToolButton" name="execButton">
|
<item>
|
||||||
<property name="sizePolicy">
|
<widget class="QToolButton" name="execButton">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
<property name="sizePolicy">
|
||||||
<horstretch>0</horstretch>
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
<verstretch>0</verstretch>
|
<horstretch>0</horstretch>
|
||||||
</sizepolicy>
|
<verstretch>0</verstretch>
|
||||||
</property>
|
</sizepolicy>
|
||||||
<property name="toolTip">
|
</property>
|
||||||
<string>Execute command</string>
|
<property name="toolTip">
|
||||||
</property>
|
<string>Execute command</string>
|
||||||
<property name="styleSheet">
|
</property>
|
||||||
<string notr="true">
|
<property name="styleSheet">
|
||||||
|
<string notr="true">
|
||||||
QToolButton { /* all types of tool button */
|
QToolButton { /* all types of tool button */
|
||||||
margin-bottom: 1px;
|
margin-bottom: 1px;
|
||||||
margin-top: 1px;
|
margin-top: 1px;
|
||||||
@ -113,7 +114,7 @@ QToolButton { /* all types of tool button */
|
|||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
padding-top: 1px;
|
padding-top: 1px;
|
||||||
padding-bottom: 1px;
|
padding-bottom: 1px;
|
||||||
background-color: palette(light);
|
background-color: palette(light);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
border-top: 2px solid palette(light);
|
border-top: 2px solid palette(light);
|
||||||
border-bottom: 2px solid palette(light);
|
border-bottom: 2px solid palette(light);
|
||||||
@ -122,25 +123,26 @@ QToolButton { /* all types of tool button */
|
|||||||
}
|
}
|
||||||
|
|
||||||
QToolButton:pressed {
|
QToolButton:pressed {
|
||||||
background-color: palette(dark);
|
background-color: palette(dark);
|
||||||
border-top: 2px solid palette(dark);
|
border-top: 2px solid palette(dark);
|
||||||
border-bottom: 2px solid palette(dark);
|
border-bottom: 2px solid palette(dark);
|
||||||
border-left: 2px solid palette(dark);
|
border-left: 2px solid palette(dark);
|
||||||
border-right: 2px solid palette(dark);
|
border-right: 2px solid palette(dark);
|
||||||
}</string>
|
}</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../resources.qrc">
|
<iconset resource="../resources.qrc">
|
||||||
<normaloff>:/img/icons/play.svg</normaloff>:/img/icons/play.svg</iconset>
|
<normaloff>:/img/icons/play.svg</normaloff>:/img/icons/play.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../resources.qrc"/>
|
<include location="../resources.qrc"/>
|
||||||
|
@ -40,19 +40,6 @@ void SideBar::on_tabsButton_clicked()
|
|||||||
this->main->on_actionTabs_triggered();
|
this->main->on_actionTabs_triggered();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideBar::on_consoleButton_clicked()
|
|
||||||
{
|
|
||||||
this->main->on_actionhide_bottomPannel_triggered();
|
|
||||||
if (ui->consoleButton->isChecked())
|
|
||||||
{
|
|
||||||
ui->consoleButton->setIcon(QIcon(":/img/icons/up_white.svg"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ui->consoleButton->setIcon(QIcon(":/img/icons/down_white.svg"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SideBar::on_lockButton_clicked()
|
void SideBar::on_lockButton_clicked()
|
||||||
{
|
{
|
||||||
if (ui->lockButton->isChecked())
|
if (ui->lockButton->isChecked())
|
||||||
|
@ -26,8 +26,6 @@ private slots:
|
|||||||
|
|
||||||
void on_tabsButton_clicked();
|
void on_tabsButton_clicked();
|
||||||
|
|
||||||
void on_consoleButton_clicked();
|
|
||||||
|
|
||||||
void on_lockButton_clicked();
|
void on_lockButton_clicked();
|
||||||
|
|
||||||
void on_themesButton_clicked();
|
void on_themesButton_clicked();
|
||||||
|
Loading…
Reference in New Issue
Block a user