- menu item for close / close all / maximize editor

This commit is contained in:
royqh1979 2021-09-02 20:12:16 +08:00
parent 805533664f
commit 9fa098960b
5 changed files with 319 additions and 226 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -37,7 +37,8 @@ MainWindow::MainWindow(QWidget *parent)
mOpenClosingBottomPanel(false),
mOpenClosingLeftPanel(false),
mCheckSyntaxInBack(false),
mClosing(false)
mClosing(false),
mSystemTurnedOff(false)
{
ui->setupUi(this);
// status bar
@ -210,6 +211,9 @@ void MainWindow::updateEditorActions()
//code
ui->actionReformat_Code->setEnabled(false);
ui->actionClose->setEnabled(false);
ui->actionClose_All->setEnabled(false);
} else {
ui->actionAuto_Detect->setEnabled(true);
ui->actionEncode_in_ANSI->setEnabled(true);
@ -241,6 +245,9 @@ void MainWindow::updateEditorActions()
//code
ui->actionReformat_Code->setEnabled(true);
ui->actionClose->setEnabled(true);
ui->actionClose_All->setEnabled(true);
updateCompileActions();
}
@ -1082,6 +1089,17 @@ void MainWindow::buildContextMenus()
ui->watchView->addAction(ui->actionModify_Watch);
}
void MainWindow::maximizeEditor()
{
if (mLeftPanelOpenned || mBottomPanelOpenned) {
openCloseBottomPanel(false);
openCloseLeftPanel(false);
} else {
openCloseBottomPanel(true);
openCloseLeftPanel(true);
}
}
void MainWindow::onAutoSaveTimeout()
{
if (!pSettings->editor().enableAutoSave())
@ -2050,13 +2068,7 @@ void MainWindow::on_splitterMessages_splitterMoved(int, int)
void MainWindow::on_EditorTabsLeft_tabBarDoubleClicked(int index)
{
if (mLeftPanelOpenned || mBottomPanelOpenned ) {
openCloseBottomPanel(false);
openCloseLeftPanel(false);
} else {
openCloseBottomPanel(true);
openCloseLeftPanel(true);
}
maximizeEditor();
}
@ -2067,5 +2079,20 @@ void MainWindow::on_actionClose_triggered()
if (e) {
mEditorList->closeEditor(e);
}
mClosing = false;
}
void MainWindow::on_actionClose_All_triggered()
{
mClosing = true;
mEditorList->closeAll(mSystemTurnedOff);
mClosing = false;
}
void MainWindow::on_actionMaximize_Editor_triggered()
{
maximizeEditor();
}

View File

@ -119,11 +119,9 @@ public slots:
void onEndParsing(int total, int updateView);
void onEvalValueReady(const QString& value);
protected:
private:
void openFiles(const QStringList& files);
void openFile(const QString& filename);
private:
CompileTarget getCompileTarget();
bool debugInferiorhasBreakpoint();
void setupActions();
@ -132,6 +130,7 @@ private:
void prepareDebugger();
void doAutoSave(Editor *e);
void buildContextMenus();
void maximizeEditor();
private slots:
void onAutoSaveTimeout();
@ -255,6 +254,10 @@ private slots:
void on_actionClose_triggered();
void on_actionClose_All_triggered();
void on_actionMaximize_Editor_triggered();
private:
Ui::MainWindow *ui;
EditorList *mEditorList;
@ -296,7 +299,8 @@ private:
CaretList mCaretList;
bool mClosing = false;
bool mClosing;
bool mSystemTurnedOff;
// QWidget interface

View File

@ -841,6 +841,8 @@
<property name="title">
<string>Window</string>
</property>
<addaction name="actionClose_All"/>
<addaction name="actionMaximize_Editor"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuEdit"/>
@ -1461,6 +1463,19 @@
<string>Ctrl+Shift+W</string>
</property>
</action>
<action name="actionMaximize_Editor">
<property name="icon">
<iconset>
<normalon>:/icons/images/newlook24/030-dos.png</normalon>
</iconset>
</property>
<property name="text">
<string>Maximize Editor</string>
</property>
<property name="shortcut">
<string>Ctrl+F11</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>