Skip to content

Commit

Permalink
Fix the issue that some functions in the context menu of the floating…
Browse files Browse the repository at this point in the history
… window cannot be used

Signed-off-by: xiaoming <2014500726@smail.xtu.edu.cn>
  • Loading branch information
QQxiaoming committed Aug 22, 2024
1 parent dbd5d52 commit 7fdc00d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ en-US:
- Fix the issue that clicking the new tab button in split screen mode may not create the session correctly or be located under the wrong tab group
- Fix the issue that the SSH connection cannot be reconnected by tapping the Enter key in some cases
- Fix the issue that the target session object is inaccurate when locking/unlocking the session
- Fix the issue that some functions in the context menu of the floating window cannot be used

zh-CN:

Expand All @@ -27,6 +28,7 @@ zh-CN:
- 修复分屏模式下某些情况点击新标签按钮会话未正确创建或位于错误的标签页组下
- 修复ssh连接部分情况下无法通过敲击回车键发起重连的问题
- 修复锁定/解锁会话时目标会话对象不准确
- 修复浮动窗口上下文菜单中部分功能无法使用的问题

## [[V0.4.8](https://github.com/QQxiaoming/quardCRT/releases/tag/V0.4.8)] - 2024-07-26

Expand Down
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- Fix the issue that clicking the new tab button in split screen mode may not create the session correctly or be located under the wrong tab group
- Fix the issue that the SSH connection cannot be reconnected by tapping the Enter key in some cases
- Fix the issue that the target session object is inaccurate when locking/unlocking the session
- Fix the issue that some functions in the context menu of the floating window cannot be used

## [[V0.4.8](https://github.com/QQxiaoming/quardCRT/releases/tag/V0.4.8)] - 2024-07-26

Expand Down
26 changes: 13 additions & 13 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1555,9 +1555,9 @@ void CentralWidget::restoreSettings(void) {
}
}

MainWidgetGroup* CentralWidget::findCurrentFocusGroup(bool forceFind) {
MainWidgetGroup* CentralWidget::findCurrentFocusGroup(bool forceFind, bool includefloating) {
foreach(MainWidgetGroup *mainWidgetGroup, mainWidgetGroupList) {
if(mainWidgetGroup->type() != MainWidgetGroup::EMBEDDED) {
if((!includefloating) && mainWidgetGroup->type() != MainWidgetGroup::EMBEDDED) {
continue;
}
if(mainWidgetGroup->size().width() == 0) {
Expand All @@ -1568,7 +1568,7 @@ MainWidgetGroup* CentralWidget::findCurrentFocusGroup(bool forceFind) {
}
}
foreach(MainWidgetGroup *mainWidgetGroup, mainWidgetGroupList) {
if(mainWidgetGroup->type() != MainWidgetGroup::EMBEDDED) {
if((!includefloating) && mainWidgetGroup->type() != MainWidgetGroup::EMBEDDED) {
continue;
}
if(mainWidgetGroup->size().width() == 0) {
Expand All @@ -1580,7 +1580,7 @@ MainWidgetGroup* CentralWidget::findCurrentFocusGroup(bool forceFind) {
}
if(forceFind) {
foreach(MainWidgetGroup *mainWidgetGroup, mainWidgetGroupList) {
if(mainWidgetGroup->type() != MainWidgetGroup::EMBEDDED) {
if((!includefloating) && mainWidgetGroup->type() != MainWidgetGroup::EMBEDDED) {
continue;
}
if(mainWidgetGroup->size().width() != 0) {
Expand All @@ -1593,8 +1593,8 @@ MainWidgetGroup* CentralWidget::findCurrentFocusGroup(bool forceFind) {
}
}

QWidget *CentralWidget::findCurrentFocusWidget(void) {
SessionTab *sessionTab = findCurrentFocusGroup()->sessionTab;
QWidget *CentralWidget::findCurrentFocusWidget(bool includefloating) {
SessionTab *sessionTab = findCurrentFocusGroup(true,includefloating)->sessionTab;
if(sessionTab->count() == 0) return nullptr;
return sessionTab->currentWidget();
}
Expand Down Expand Up @@ -2830,13 +2830,13 @@ void CentralWidget::menuAndToolBarConnectSignals(void) {
});

connect(copyAction,&QAction::triggered,this,[=](){
QWidget *widget = findCurrentFocusWidget();
QWidget *widget = findCurrentFocusWidget(true);
if(widget == nullptr) return;
SessionsWindow *sessionsWindow = widget->property("session").value<SessionsWindow *>();
sessionsWindow->copyClipboard();
});
connect(pasteAction,&QAction::triggered,this,[=](){
QWidget *widget = findCurrentFocusWidget();
QWidget *widget = findCurrentFocusWidget(true);
if(widget == nullptr) return;
SessionsWindow *sessionsWindow = widget->property("session").value<SessionsWindow *>();
sessionsWindow->pasteClipboard();
Expand All @@ -2849,13 +2849,13 @@ void CentralWidget::menuAndToolBarConnectSignals(void) {
sessionsWindow->pasteClipboard();
});
connect(selectAllAction,&QAction::triggered,this,[=](){
QWidget *widget = findCurrentFocusWidget();
QWidget *widget = findCurrentFocusWidget(true);
if(widget == nullptr) return;
SessionsWindow *sessionsWindow = widget->property("session").value<SessionsWindow *>();
sessionsWindow->selectAll();
});
connect(findAction,&QAction::triggered,this,[=](){
QWidget *widget = findCurrentFocusWidget();
QWidget *widget = findCurrentFocusWidget(true);
if(widget == nullptr) return;
SessionsWindow *sessionsWindow = widget->property("session").value<SessionsWindow *>();
sessionsWindow->toggleShowSearchBar();
Expand Down Expand Up @@ -2935,19 +2935,19 @@ void CentralWidget::menuAndToolBarConnectSignals(void) {
}
});
connect(clearScrollbackAction,&QAction::triggered,this,[=](){
QWidget *widget = findCurrentFocusWidget();
QWidget *widget = findCurrentFocusWidget(true);
if(widget == nullptr) return;
SessionsWindow *sessionsWindow = widget->property("session").value<SessionsWindow *>();
sessionsWindow->clearScrollback();
});
connect(clearScreenAction,&QAction::triggered,this,[=](){
QWidget *widget = findCurrentFocusWidget();
QWidget *widget = findCurrentFocusWidget(true);
if(widget == nullptr) return;
SessionsWindow *sessionsWindow = widget->property("session").value<SessionsWindow *>();
sessionsWindow->clearScreen();
});
connect(clearScreenAndScrollbackAction,&QAction::triggered,this,[=](){
QWidget *widget = findCurrentFocusWidget();
QWidget *widget = findCurrentFocusWidget(true);
if(widget == nullptr) return;
SessionsWindow *sessionsWindow = widget->property("session").value<SessionsWindow *>();
sessionsWindow->clear();
Expand Down
4 changes: 2 additions & 2 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ class CentralWidget : public QMainWindow
int stopAllSession(bool force = false);
int cloneTargetSession(MainWidgetGroup *group, QString name,SessionsWindow *sessionsWindow);
int cloneCurrentSession(MainWidgetGroup *group, QString name = QString());
MainWidgetGroup *findCurrentFocusGroup(bool forceFind=true);
QWidget *findCurrentFocusWidget(void);
MainWidgetGroup *findCurrentFocusGroup(bool forceFind = true, bool includefloating = false);
QWidget *findCurrentFocusWidget(bool includefloating = false);
QMenu *createPopupMenu(void) override;
void setSessionClassActionEnable(bool enable);
void setGlobalOptions(SessionsWindow *window);
Expand Down

0 comments on commit 7fdc00d

Please sign in to comment.