Make default mode being zen (#732)

* Make default mode being zen
* Added imports widgets
* Make dashboard default
This commit is contained in:
xarkes 2018-09-30 22:00:44 +02:00 committed by GitHub
parent 5366c49c49
commit 0aace76065
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 69 deletions

View File

@ -625,44 +625,19 @@ void MainWindow::updateDockActionsChecked()
} }
} }
void MainWindow::showDefaultDocks()
{
const QList<QDockWidget *> defaultDocks = { sectionsDock,
entrypointDock,
functionsDock,
commentsDock,
stringsDock,
consoleDock,
importsDock,
symbolsDock,
graphDock,
disassemblyDock,
sidebarDock,
hexdumpDock,
pseudocodeDock,
dashboardDock,
#ifdef CUTTER_ENABLE_JUPYTER
jupyterDock
#endif
};
for (auto w : dockWidgets) {
if (defaultDocks.contains(w)) {
w->show();
}
}
updateDockActionsChecked();
}
void MainWindow::showZenDocks() void MainWindow::showZenDocks()
{ {
const QList<QDockWidget *> zenDocks = { functionsDock, const QList<QDockWidget *> zenDocks = { functionsDock,
dashboardDock,
stringsDock, stringsDock,
graphDock, graphDock,
disassemblyDock, disassemblyDock,
hexdumpDock, hexdumpDock,
searchDock searchDock,
importsDock,
#ifdef CUTTER_ENABLE_JUPYTER
jupyterDock
#endif
}; };
for (auto w : dockWidgets) { for (auto w : dockWidgets) {
if (zenDocks.contains(w)) { if (zenDocks.contains(w)) {
@ -698,35 +673,13 @@ void MainWindow::resetToDefaultLayout()
{ {
hideAllDocks(); hideAllDocks();
restoreDocks(); restoreDocks();
showDefaultDocks(); showZenDocks();
dashboardDock->raise(); dashboardDock->raise();
// ugly workaround to set the default widths of functions and sidebar docks // Ugly workaround to set the default widths of functions docks
// if anyone finds a way to do this cleaner that also works, feel free to change it!
auto restoreFunctionDock = qhelpers::forceWidth(functionsDock->widget(), 300);
auto restoreSidebarDock = qhelpers::forceWidth(sidebarDock->widget(), 300);
qApp->processEvents();
restoreFunctionDock.restoreWidth(functionsDock->widget());
restoreSidebarDock.restoreWidth(sidebarDock->widget());
core->setMemoryWidgetPriority(CutterCore::MemoryWidgetType::Disassembly);
}
void MainWindow::resetToZenLayout()
{
hideAllDocks();
restoreDocks();
showZenDocks();
disassemblyDock->raise();
// ugly workaround to set the default widths of functions
// if anyone finds a way to do this cleaner that also works, feel free to change it! // if anyone finds a way to do this cleaner that also works, feel free to change it!
auto restoreFunctionDock = qhelpers::forceWidth(functionsDock->widget(), 200); auto restoreFunctionDock = qhelpers::forceWidth(functionsDock->widget(), 200);
qApp->processEvents(); qApp->processEvents();
restoreFunctionDock.restoreWidth(functionsDock->widget()); restoreFunctionDock.restoreWidth(functionsDock->widget());
core->setMemoryWidgetPriority(CutterCore::MemoryWidgetType::Disassembly); core->setMemoryWidgetPriority(CutterCore::MemoryWidgetType::Disassembly);
@ -782,11 +735,6 @@ void MainWindow::on_actionDefault_triggered()
resetToDefaultLayout(); resetToDefaultLayout();
} }
void MainWindow::on_actionZen_triggered()
{
resetToZenLayout();
}
/** /**
* @brief MainWindow::on_actionNew_triggered * @brief MainWindow::on_actionNew_triggered
* Open a new Cutter session. * Open a new Cutter session.

View File

@ -66,7 +66,7 @@ public:
bool responsive; bool responsive;
explicit MainWindow(QWidget *parent = nullptr); explicit MainWindow(QWidget *parent = nullptr);
~MainWindow(); ~MainWindow() override;
void openNewFile(InitialOptions options = InitialOptions(), bool skipOptionsDialog = false); void openNewFile(InitialOptions options = InitialOptions(), bool skipOptionsDialog = false);
void displayNewFileDialog(); void displayNewFileDialog();
@ -133,7 +133,6 @@ private slots:
void on_actionDisasAdd_comment_triggered(); void on_actionDisasAdd_comment_triggered();
void on_actionDefault_triggered(); void on_actionDefault_triggered();
void on_actionZen_triggered();
void on_actionFunctionsRename_triggered(); void on_actionFunctionsRename_triggered();
@ -170,7 +169,7 @@ private slots:
void updateTasksIndicator(); void updateTasksIndicator();
void mousePressEvent(QMouseEvent *event) override; void mousePressEvent(QMouseEvent *event) override;
bool eventFilter(QObject *object, QEvent *event); bool eventFilter(QObject *object, QEvent *event) override;
void changeDebugView(); void changeDebugView();
void changeDefinedView(); void changeDefinedView();
@ -236,12 +235,10 @@ private:
void displayInitialOptionsDialog(const InitialOptions &options = InitialOptions(), bool skipOptionsDialog = false); void displayInitialOptionsDialog(const InitialOptions &options = InitialOptions(), bool skipOptionsDialog = false);
void resetToDefaultLayout(); void resetToDefaultLayout();
void resetToZenLayout();
void resetToDebugLayout(); void resetToDebugLayout();
void restoreDocks(); void restoreDocks();
void hideAllDocks(); void hideAllDocks();
void showDefaultDocks();
void showZenDocks(); void showZenDocks();
void showDebugDocks(); void showDebugDocks();
void updateDockActionsChecked(); void updateDockActionsChecked();

View File

@ -80,7 +80,7 @@ QToolTip {
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1013</width> <width>1013</width>
<height>21</height> <height>20</height>
</rect> </rect>
</property> </property>
<property name="defaultUp"> <property name="defaultUp">
@ -94,8 +94,8 @@ QToolTip {
<rect> <rect>
<x>378</x> <x>378</x>
<y>100</y> <y>100</y>
<width>136</width> <width>151</width>
<height>271</height> <height>240</height>
</rect> </rect>
</property> </property>
<property name="title"> <property name="title">
@ -125,7 +125,6 @@ QToolTip {
<addaction name="actionRefresh_contents"/> <addaction name="actionRefresh_contents"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionDefault"/> <addaction name="actionDefault"/>
<addaction name="actionZen"/>
<addaction name="actionReset_settings"/> <addaction name="actionReset_settings"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionLock"/> <addaction name="actionLock"/>