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