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()
{
const QList<QDockWidget *> zenDocks = { functionsDock,
dashboardDock,
stringsDock,
graphDock,
disassemblyDock,
hexdumpDock,
searchDock
searchDock,
importsDock,
#ifdef CUTTER_ENABLE_JUPYTER
jupyterDock
#endif
};
for (auto w : dockWidgets) {
if (zenDocks.contains(w)) {
@ -698,35 +673,13 @@ void MainWindow::resetToDefaultLayout()
{
hideAllDocks();
restoreDocks();
showDefaultDocks();
showZenDocks();
dashboardDock->raise();
// ugly workaround to set the default widths of functions and sidebar 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
// 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(), 200);
qApp->processEvents();
restoreFunctionDock.restoreWidth(functionsDock->widget());
core->setMemoryWidgetPriority(CutterCore::MemoryWidgetType::Disassembly);
@ -782,11 +735,6 @@ void MainWindow::on_actionDefault_triggered()
resetToDefaultLayout();
}
void MainWindow::on_actionZen_triggered()
{
resetToZenLayout();
}
/**
* @brief MainWindow::on_actionNew_triggered
* Open a new Cutter session.

View File

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

View File

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