diff --git a/src/main/mainwindow.cpp b/src/main/mainwindow.cpp index 86a1da583..aa8338367 100644 --- a/src/main/mainwindow.cpp +++ b/src/main/mainwindow.cpp @@ -183,7 +183,9 @@ inline void MainWindow::slotTabBarClicked(int index, QString tabIdentifier) inline void MainWindow::slotTabCurrentChanged(int index) { - focusPage(m_tabbar->identifier(index)); + const QString identifier = m_tabbar->identifier(index); + focusPage(identifier); + updateWindowTitle(); } inline void MainWindow::slotTabAddRequested() @@ -932,6 +934,7 @@ void MainWindow::onTermTitleChanged(QString title) const bool customName = tabPage->property("TAB_CUSTOM_NAME_PROPERTY").toBool(); if (!customName) m_tabbar->setTabText(tabPage->identifier(), title); + updateWindowTitle(); // 判定第一次修改标题的时候,认为终端已经创建成功 // 以此认为第一次打开终端窗口结束,记录时间 @@ -2507,6 +2510,11 @@ void MainWindow::onCommandActionTriggered() this->currentPage()->sendTextToCurrentTerm(command); } +inline void MainWindow::updateWindowTitle() +{ + setWindowTitle(QString("%1 - %2").arg(m_tabbar->tabText(m_tabbar->currentIndex())).arg(QObject::tr("Terminal"))); +} + ///////////////////////////////////////////////////////////////////////////////////////////////////// /** 普通终端窗口 diff --git a/src/main/mainwindow.h b/src/main/mainwindow.h index 7d2c1c460..fec2fe027 100644 --- a/src/main/mainwindow.h +++ b/src/main/mainwindow.h @@ -794,6 +794,11 @@ protected slots: */ void setTitlebarNoFocus(QWidget * titlebar); + /** + * @brief 根据当前标签页标题更新窗口名 + */ + inline void updateWindowTitle(); + protected: // 初始化标题栏 virtual void initTitleBar() = 0; diff --git a/translations/deepin-terminal.ts b/translations/deepin-terminal.ts index 3480a6b0b..a26fb315f 100644 --- a/translations/deepin-terminal.ts +++ b/translations/deepin-terminal.ts @@ -187,35 +187,35 @@ MainWindow - - + + New window - + Settings - + Cancel button - + Close button - + Type path to download file - + Custom Theme @@ -259,7 +259,7 @@ - + Blur background @@ -280,7 +280,7 @@ - + Opacity @@ -321,14 +321,15 @@ - + Others - + + Terminal @@ -339,61 +340,61 @@ - + Custom commands - + Display shortcuts - + Remote management - + New tab - + Next tab - + Previous tab - + Select left workspace - + Select lower workspace - + Select right workspace - + Select upper workspace @@ -404,55 +405,55 @@ - + Go to tab 1 - + Go to tab 2 - + Go to tab 3 - + Go to tab 4 - + Go to tab 5 - + Go to tab 6 - + Go to tab 7 - + Go to tab 8 - + Go to tab 9 @@ -480,31 +481,31 @@ - + Rename title - + Fullscreen - + Copy - + Default size - + Paste @@ -515,7 +516,7 @@ - + Select all @@ -531,13 +532,13 @@ - + Zoom in - + Zoom out @@ -547,29 +548,29 @@ - + - + Close other workspaces - + Could not find "%1", starting "%2" instead. Please check your shell profile. - + Could not open "%1", unable to run it - + Could not find "%1", unable to run it - + Output has been suspended by pressing Ctrl+S. Pressing Ctrl+Q to resume. @@ -579,32 +580,32 @@ - + - + Close workspace - + Horizontal split - + Vertical split - + Find - + please set another one. @@ -616,34 +617,34 @@ - + Tabs - + Close tab - + Select tab - + Switch focus to "+" icon - + Select file to upload - + Upload @@ -684,7 +685,7 @@ - + Select a directory to save the file @@ -760,7 +761,7 @@ - + Select @@ -784,7 +785,7 @@ - + Close other tabs @@ -977,7 +978,7 @@ Service - + OK button @@ -1091,90 +1092,90 @@ TermWidget - + Copy - + Paste - + Open - + Open in file manager - - + + Horizontal split - - + + Vertical split - - + + New tab - + Exit fullscreen - + Fullscreen - + Find - + Search - + Encoding - + Custom commands - + Remote management - + Upload file - + Download file - + Settings diff --git a/translations/deepin-terminal_zh_CN.ts b/translations/deepin-terminal_zh_CN.ts index 22793eb84..aef0c394b 100644 --- a/translations/deepin-terminal_zh_CN.ts +++ b/translations/deepin-terminal_zh_CN.ts @@ -187,35 +187,35 @@ MainWindow - - + + New window 新建窗口 - + Settings 设置 - + Cancel button 取 消 - + Close button 关 闭 - + Type path to download file 请输入下载文件的路径 - + Custom Theme 自定义主题 @@ -245,36 +245,36 @@ 确 定 - + - + Close workspace 关闭工作区 - + - + Close other workspaces 关闭其他工作区 - + Could not find "%1", starting "%2" instead. Please check your shell profile. 找不到 “%1”,已启动“%2”代替。请检查Shell配置。 - + Could not open "%1", unable to run it 打不开“%1”,无法正常使用 - + Could not find "%1", unable to run it 找不到“%1”,无法正常使用 - + Output has been suspended by pressing Ctrl+S. Pressing Ctrl+Q to resume. 已经按下Ctrl+S,输出被挂起。可以按下Ctrl+Q继续。 @@ -294,19 +294,19 @@ - + Rename title 重命名标题 - + Close tab 关闭标签页 - + Close other tabs 关闭其他标签页 @@ -351,7 +351,7 @@ - + Blur background 背景模糊 @@ -372,7 +372,7 @@ - + Opacity 透明度 @@ -413,14 +413,15 @@ - + Others 其他 - + + Terminal 终端 @@ -431,43 +432,43 @@ - + Custom commands 自定义命令 - + Display shortcuts 显示快捷键 - + Remote management 远程管理 - + Fullscreen 全屏 - + Copy 复制 - + Default size 默认大小 - + Paste 粘贴 @@ -478,7 +479,7 @@ - + Select all 全选 @@ -494,13 +495,13 @@ - + Zoom in 放大 - + Zoom out 缩小 @@ -516,61 +517,61 @@ - + Horizontal split 横向分屏 - + New tab 新建标签页 - + Next tab 下一个标签页 - + Previous tab 上一个标签页 - + Select left workspace 选择左边的工作区 - + Select lower workspace 选择下面的工作区 - + Select right workspace 选择右边的工作区 - + Select upper workspace 选择上面的工作区 - + Vertical split 纵向分屏 - + Find 查找 @@ -581,55 +582,55 @@ - + Go to tab 1 切换到标签 1 - + Go to tab 2 切换到标签 2 - + Go to tab 3 切换到标签 3 - + Go to tab 4 切换到标签 4 - + Go to tab 5 切换到标签 5 - + Go to tab 6 切换到标签 6 - + Go to tab 7 切换到标签 7 - + Go to tab 8 切换到标签 8 - + Go to tab 9 切换到标签 9 @@ -666,7 +667,7 @@ - + Select 选择 @@ -677,40 +678,40 @@ 终端是一款集工作区、多窗口、远程管理、雷神模式等功能的高级终端模拟器。 - + Tabs 标签页 - + Switch focus to "+" icon 光标焦点切换至“+”图标 - + Select tab 选择标签页 - + Select file to upload 选择要上传的文件 - + Upload 上传 - + Select a directory to save the file 选择下载文件的保存目录 - + please set another one. @@ -981,7 +982,7 @@ Service - + OK button 确 定 @@ -1095,90 +1096,90 @@ TermWidget - + Copy 复制 - + Paste 粘贴 - + Open 打开 - + Open in file manager 在文件管理器中打开 - - + + Horizontal split 横向分屏 - - + + Vertical split 纵向分屏 - - + + New tab 新建标签页 - + Exit fullscreen 退出全屏 - + Fullscreen 全屏 - + Find 查找 - + Search 搜索 - + Encoding 编码 - + Custom commands 自定义命令 - + Remote management 远程管理 - + Upload file 上传文件 - + Download file 下载文件 - + Settings 设置 diff --git a/translations/deepin-terminal_zh_HK.ts b/translations/deepin-terminal_zh_HK.ts index 81ff0b8d4..dd5e46f90 100644 --- a/translations/deepin-terminal_zh_HK.ts +++ b/translations/deepin-terminal_zh_HK.ts @@ -187,35 +187,35 @@ MainWindow - - + + New window 新建視窗 - + Settings 設置 - + Cancel button 取 消 - + Close button 關 閉 - + Type path to download file 請輸入下載文件的路徑 - + Custom Theme 自定義主題 @@ -245,36 +245,36 @@ 確 定 - + - + Close workspace 關閉工作區 - + - + Close other workspaces 關閉其他工作區 - + Could not find "%1", starting "%2" instead. Please check your shell profile. 找不到 「%1」,已啟動「%2」代替。請檢查Shell配置。 - + Could not open "%1", unable to run it 打不開“%1”,無法正常使用 - + Could not find "%1", unable to run it 找不到「%1」,無法正常使用 - + Output has been suspended by pressing Ctrl+S. Pressing Ctrl+Q to resume. 已經按下Ctrl+S,輸出被掛起。可以按下Ctrl+Q繼續。 @@ -294,19 +294,19 @@ - + Rename title 重命名標題 - + Close tab 關閉標籤頁 - + Close other tabs 關閉其他標籤頁 @@ -351,7 +351,7 @@ - + Blur background 背景模糊 @@ -372,7 +372,7 @@ - + Opacity 透明度 @@ -413,14 +413,15 @@ - + Others 其他 - + + Terminal 終端 @@ -431,43 +432,43 @@ - + Custom commands 自定義命令 - + Display shortcuts 顯示快捷鍵 - + Remote management 遠程管理 - + Fullscreen 全螢幕 - + Copy 複製 - + Default size 默認大小 - + Paste 貼上 @@ -478,7 +479,7 @@ - + Select all 選擇全部 @@ -494,13 +495,13 @@ - + Zoom in 拉近 - + Zoom out 拉遠 @@ -516,61 +517,61 @@ - + Horizontal split 橫向分屏 - + New tab 新建標籤頁 - + Next tab 下一個標籤頁 - + Previous tab 上一個標籤頁 - + Select left workspace 選擇左邊的工作區 - + Select lower workspace 選擇下面的工作區 - + Select right workspace 選擇右邊的工作區 - + Select upper workspace 選擇上面的工作區 - + Vertical split 縱向分屏 - + Find 查找 @@ -581,55 +582,55 @@ - + Go to tab 1 切換到標籤 1 - + Go to tab 2 切換到標籤 2 - + Go to tab 3 切換到標籤 3 - + Go to tab 4 切換到標籤 4 - + Go to tab 5 切換到標籤 5 - + Go to tab 6 切換到標籤 6 - + Go to tab 7 切換到標籤 7 - + Go to tab 8 切換到標籤 8 - + Go to tab 9 切換到標籤 9 @@ -666,7 +667,7 @@ - + Select 選擇 @@ -677,40 +678,40 @@ 終端是⼀款集⼯作區、多視窗、遠程管理、雷神模式等功能的⾼級終端模擬器。 - + Tabs 標籤頁 - + Switch focus to "+" icon 光標焦點切換至「+」圖標 - + Select tab 選擇標籤頁 - + Select file to upload 選擇要上傳的文件 - + Upload 上傳 - + Select a directory to save the file 選擇下載文件的保存目錄 - + please set another one. @@ -981,7 +982,7 @@ Service - + OK button 確 定 @@ -1095,90 +1096,90 @@ TermWidget - + Copy 複製 - + Paste 貼上 - + Open 開啟 - + Open in file manager 在文件管理器中打開 - - + + Horizontal split 橫向分屏 - - + + Vertical split 縱向分屏 - - + + New tab 新建標籤頁 - + Exit fullscreen 退出全螢幕 - + Fullscreen 全螢幕 - + Find 查找 - + Search 搜尋 - + Encoding 編碼 - + Custom commands 自定義命令 - + Remote management 遠程管理 - + Upload file 上傳文件 - + Download file 下載文件 - + Settings 設置 diff --git a/translations/deepin-terminal_zh_TW.ts b/translations/deepin-terminal_zh_TW.ts index 769cb405c..616a0c5ac 100644 --- a/translations/deepin-terminal_zh_TW.ts +++ b/translations/deepin-terminal_zh_TW.ts @@ -187,35 +187,35 @@ MainWindow - - + + New window 新增視窗 - + Settings 設定 - + Cancel button 取 消 - + Close button 離 開 - + Type path to download file 輸入位置以下載檔案 - + Custom Theme 自訂主題 @@ -245,36 +245,36 @@ 確 定 - + - + Close workspace 關閉工作區 - + - + Close other workspaces 關閉其他工作區 - + Could not find "%1", starting "%2" instead. Please check your shell profile. 找不到 「%1」,已啟動「%2」代替。請檢查Shell配置。 - + Could not open "%1", unable to run it 打不開“%1”,無法正常使用 - + Could not find "%1", unable to run it 找不到「%1」,無法正常使用 - + Output has been suspended by pressing Ctrl+S. Pressing Ctrl+Q to resume. 已經按下Ctrl+S,輸出被掛起。可以按下Ctrl+Q繼續。 @@ -294,19 +294,19 @@ - + Rename title 重命名分頁 - + Close tab 關閉標籤頁 - + Close other tabs 關閉其他標籤頁 @@ -351,7 +351,7 @@ - + Blur background 模糊背景 @@ -372,7 +372,7 @@ - + Opacity 不透明度 @@ -413,14 +413,15 @@ - + Others 其他 - + + Terminal 終端機 @@ -431,43 +432,43 @@ - + Custom commands 自訂命令 - + Display shortcuts 顯示快速鍵 - + Remote management 遠端管理 - + Fullscreen 全螢幕 - + Copy 複製 - + Default size 預設大小 - + Paste 貼上 @@ -478,7 +479,7 @@ - + Select all 全選 @@ -494,13 +495,13 @@ - + Zoom in 放大 - + Zoom out 縮小 @@ -516,61 +517,61 @@ - + Horizontal split 水平分割 - + New tab 建立標籤頁 - + Next tab 下一個標籤頁 - + Previous tab 上一個標籤頁 - + Select left workspace 選擇左邊的工作區 - + Select lower workspace 選擇下面的工作區 - + Select right workspace 選擇右邊的工作區 - + Select upper workspace 選擇上面的工作區 - + Vertical split 垂直分割 - + Find 尋找 @@ -581,55 +582,55 @@ - + Go to tab 1 切換到標籤 1 - + Go to tab 2 切換到標籤 2 - + Go to tab 3 切換到標籤 3 - + Go to tab 4 切換到標籤 4 - + Go to tab 5 切換到標籤 5 - + Go to tab 6 切換到標籤 6 - + Go to tab 7 切換到標籤 7 - + Go to tab 8 切換到標籤 8 - + Go to tab 9 切換到標籤 9 @@ -666,7 +667,7 @@ - + Select 選擇 @@ -677,40 +678,40 @@ 終端機是個進階的終端模擬器,具備視窗切割、工作區、遠端管理、雷神模式等其他功能。 - + Tabs 標籤頁 - + Switch focus to "+" icon 光標焦點切換至「+」圖標 - + Select tab 選擇標籤頁 - + Select file to upload 選擇要上傳的檔案 - + Upload 上傳 - + Select a directory to save the file 選擇檔案儲存路徑 - + please set another one. @@ -981,7 +982,7 @@ Service - + OK button 確 定 @@ -1095,90 +1096,90 @@ TermWidget - + Copy 複製 - + Paste 貼上 - + Open 開啟 - + Open in file manager 在檔案管理器中開啟 - - + + Horizontal split 水平分割 - - + + Vertical split 垂直分割 - - + + New tab 建立標籤頁 - + Exit fullscreen 退出全螢幕 - + Fullscreen 全螢幕 - + Find 尋找 - + Search 搜尋 - + Encoding 編碼 - + Custom commands 自訂命令 - + Remote management 遠端管理 - + Upload file 上傳檔案 - + Download file 下載檔案 - + Settings 設定