mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-21 12:26:11 +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,18 +1,19 @@
|
||||
<?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>
|
||||
<widget class="QWidget" name="dockWidgetContents">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
@ -142,6 +143,7 @@ QToolButton:pressed {
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../resources.qrc"/>
|
||||
</resources>
|
||||
|
@ -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