Skip to content

Commit

Permalink
Merge pull request #1444 from 1445643474/zeno-727
Browse files Browse the repository at this point in the history
update run button and kill button when process status changed
  • Loading branch information
legobadman authored Sep 25, 2023
2 parents 5be403f + 1a1b30b commit 5e67819
Show file tree
Hide file tree
Showing 9 changed files with 201 additions and 55 deletions.
13 changes: 11 additions & 2 deletions ui/zenoedit/dock/docktabcontent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ void DockContent_Editor::initToolbar(QHBoxLayout* pToolLayout)
m_btnRun->setText(tr("Run"));
m_btnRun->setCursor(QCursor(Qt::PointingHandCursor));
m_btnRun->setMargins(ZenoStyle::dpiScaledMargins(QMargins(11, 5, 14, 5)));
m_btnRun->setBackgroundClr(QColor("#4578AC"), QColor("#4578AC"), QColor("#4578AC"), QColor("#4578AC"));
m_btnRun->setBackgroundClr(QColor("#4578AC"), QColor("#4578AC"), QColor("#4578AC"), QColor("#4578AC"), QColor("#4D5561"));
m_btnRun->setTextClr(QColor("#FFFFFF"), QColor("#FFFFFF"), QColor("#FFFFFF"), QColor("#FFFFFF"));
ZenoSettingsManager &settings = ZenoSettingsManager::GetInstance();
m_btnRun->setShortcut(settings.getShortCut(ShortCut_Run));
Expand All @@ -350,10 +350,11 @@ void DockContent_Editor::initToolbar(QHBoxLayout* pToolLayout)
m_btnKill->setText(tr("Kill"));
m_btnKill->setCursor(QCursor(Qt::PointingHandCursor));
m_btnKill->setMargins(ZenoStyle::dpiScaledMargins(QMargins(11, 5, 14, 5)));
m_btnKill->setBackgroundClr(QColor("#4D5561"), QColor("#4D5561"), QColor("#4D5561"), QColor("#4D5561"));
m_btnKill->setBackgroundClr(QColor("#4578AC"), QColor("#4578AC"), QColor("#4578AC"), QColor("#4578AC"), QColor("#4D5561"));
m_btnKill->setTextClr(QColor("#FFFFFF"), QColor("#FFFFFF"), QColor("#FFFFFF"), QColor("#FFFFFF"));
m_btnKill->setShortcut(settings.getShortCut(ShortCut_Kill));
m_btnKill->setCursor(QCursor(Qt::PointingHandCursor));
m_btnKill->setEnabled(false);

QStringList runList{tr("disable"), tr("alwaysAll"), tr("alwaysLightCamera"), tr("alwaysMaterial")};
m_btnAlways = new ZComboBox(this);
Expand Down Expand Up @@ -552,6 +553,8 @@ void DockContent_Editor::initConnections()
});

connect(m_btnRun, &ZToolMenuButton::clicked, this, [=]() {
m_btnRun->setEnabled(false);
m_btnKill->setEnabled(true);
std::shared_ptr<ZCacheMgr> mgr = zenoApp->cacheMgr();
ZASSERT_EXIT(mgr);
ZenoMainWindow *pMainWin = zenoApp->getMainWindow();
Expand Down Expand Up @@ -626,6 +629,12 @@ ZenoGraphsEditor* DockContent_Editor::getEditor() const
return m_pEditor;
}

void DockContent_Editor::runFinished()
{
m_btnRun->setEnabled(true);
m_btnKill->setEnabled(false);
}

void DockContent_Editor::onCommandDispatched(QAction* pAction, bool bTriggered)
{
if (m_pEditor)
Expand Down
1 change: 1 addition & 0 deletions ui/zenoedit/dock/docktabcontent.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class DockContent_Editor : public DockToolbarWidget
explicit DockContent_Editor(QWidget* parent = nullptr);
void onCommandDispatched(QAction* pAction, bool bTriggered);
ZenoGraphsEditor* getEditor() const;
void runFinished();

protected:
void initToolbar(QHBoxLayout* pToolLayout) override;
Expand Down
4 changes: 4 additions & 0 deletions ui/zenoedit/dock/ztabdockwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,10 @@ void ZTabDockWidget::onRunFinished()
ZASSERT_EXIT(pWid);
pWid->onRunFinished();
}
else if (DockContent_Editor* pView = qobject_cast<DockContent_Editor*>(m_tabWidget->widget(i)))
{
pView->runFinished();
}
}
}

Expand Down
Binary file modified ui/zenoedit/res/languages/zh.qm
Binary file not shown.
174 changes: 136 additions & 38 deletions ui/zenoedit/res/languages/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,55 +24,82 @@
<translation>系统信息</translation>
</message>
</context>
<context>
<name>ColorWidget</name>
<message>
<source>More Color</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DesignerMainWin</name>
<message>
<source>Open</source>
<translation type="obsolete">打开</translation>
<translation type="unfinished">打开</translation>
</message>
<message>
<source>File</source>
<translation type="obsolete">文件</translation>
<translation type="unfinished">文件</translation>
</message>
<message>
<source>New</source>
<translation type="obsolete">新建</translation>
<translation type="unfinished">新建</translation>
</message>
<message>
<source>Save</source>
<translation type="obsolete">保存</translation>
<translation type="unfinished">保存</translation>
</message>
<message>
<source>Edit</source>
<translation type="obsolete">编辑</translation>
<translation type="unfinished">编辑</translation>
</message>
<message>
<source>Undo</source>
<translation type="obsolete">撤销</translation>
<translation type="unfinished">撤销</translation>
</message>
<message>
<source>Redo</source>
<translation type="obsolete">重做</translation>
<translation type="unfinished">重做</translation>
</message>
<message>
<source>Cut</source>
<translation type="obsolete">剪切</translation>
<translation type="unfinished">剪切</translation>
</message>
<message>
<source>Copy</source>
<translation type="obsolete">复制</translation>
<translation type="unfinished">复制</translation>
</message>
<message>
<source>Paste</source>
<translation type="obsolete">粘贴</translation>
<translation type="unfinished">粘贴</translation>
</message>
<message>
<source>Help</source>
<translation type="obsolete">帮助</translation>
<translation type="unfinished">帮助</translation>
</message>
<message>
<source>Play</source>
<translation type="obsolete">播放</translation>
<translation type="unfinished">播放</translation>
</message>
<message>
<source>node</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>mdiWin2</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Quit</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Layout</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>View</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
Expand Down Expand Up @@ -634,14 +661,21 @@
<name>ImageGroupBox</name>
<message>
<source>Select an image</source>
<translation type="vanished">选择一张图片</translation>
<translation>选择一张图片</translation>
</message>
</context>
<context>
<name>LayerTreeitemDelegate</name>
<message>
<source>Select an image</source>
<translation type="vanished">选择一张图片</translation>
<translation>选择一张图片</translation>
</message>
</context>
<context>
<name>LayerWidget</name>
<message>
<source>Layer</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
Expand Down Expand Up @@ -962,12 +996,20 @@
<source>Please input the title of blackboard</source>
<translation type="vanished">请输入黑板的标题</translation>
</message>
<message>
<source>content</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>title</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NodesWidget</name>
<message>
<source>Save As</source>
<translation type="vanished">另存为</translation>
<translation>另存为</translation>
</message>
</context>
<context>
Expand Down Expand Up @@ -996,6 +1038,13 @@
<translation>参数名字已存在</translation>
</message>
</context>
<context>
<name>PropertyPane</name>
<message>
<source>Inspector</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
Expand Down Expand Up @@ -2576,6 +2625,14 @@
the save action will lose them, we recommand you choose &quot;Save As&quot; to save it</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Kill Process</source>
<translation type="unfinished">结束进程</translation>
</message>
<message>
<source>Background process is running, you need kill the process.</source>
<translation type="unfinished">后台进程正在运行,您需要终止该进程。</translation>
</message>
</context>
<context>
<name>ZenoNode</name>
Expand Down Expand Up @@ -2651,95 +2708,136 @@ the save action will lose them, we recommand you choose &quot;Save As&quot; to s
<name>ZenoPlayer</name>
<message>
<source>File</source>
<translation type="obsolete">文件</translation>
<translation type="unfinished">文件</translation>
</message>
<message>
<source>Open</source>
<translation type="obsolete">打开</translation>
<translation type="unfinished">打开</translation>
</message>
<message>
<source>Display</source>
<translation type="obsolete">显示</translation>
<translation type="unfinished">显示</translation>
</message>
<message>
<source>Show Grid</source>
<translation type="obsolete">显示网格</translation>
<translation type="unfinished">显示网格</translation>
</message>
<message>
<source>Background Color</source>
<translation type="obsolete">背景颜色</translation>
<translation type="unfinished">背景颜色</translation>
</message>
<message>
<source>Smooth Shading</source>
<translation type="obsolete">平滑渲染</translation>
<translation type="unfinished">平滑渲染</translation>
</message>
<message>
<source>Normal Check</source>
<translation type="obsolete">法线检查</translation>
<translation type="unfinished">法线检查</translation>
</message>
<message>
<source>Wireframe</source>
<translation type="obsolete">线框</translation>
<translation type="unfinished">线框</translation>
</message>
<message>
<source>Solid</source>
<translation type="obsolete">实体</translation>
<translation type="unfinished">实体</translation>
</message>
<message>
<source>Shading</source>
<translation type="obsolete">上色</translation>
<translation type="unfinished">上色</translation>
</message>
<message>
<source>VXGI</source>
<translation type="obsolete">全局光照</translation>
<translation type="unfinished">全局光照</translation>
</message>
<message>
<source>Optix</source>
<translation type="obsolete">光线追踪</translation>
<translation type="unfinished">光线追踪</translation>
</message>
<message>
<source>Camera Keyframe</source>
<translation type="obsolete">摄像机关键帧</translation>
<translation type="unfinished">摄像机关键帧</translation>
</message>
<message>
<source>English / Chinese</source>
<translation type="obsolete">中英文切换</translation>
<translation type="unfinished">中英文切换</translation>
</message>
<message>
<source>Record</source>
<translation type="obsolete">导出</translation>
<translation type="unfinished">导出</translation>
</message>
<message>
<source>Screenshot</source>
<translation type="obsolete">截屏</translation>
<translation type="unfinished">截屏</translation>
</message>
<message>
<source>Path to Save</source>
<translation type="obsolete">文件保存路径</translation>
<translation type="unfinished">文件保存路径</translation>
</message>
<message>
<source>PNG images(*.png);;JPEG images(*.jpg);;BMP images(*.bmp);;EXR images(*.exr);;HDR images(*.hdr);;</source>
<translation type="obsolete">PNG图像(*.png);;JPEG图像(*.jpg);;BMP图像(*.bmp);;EXR图像(*.exr);;HDR图像(*.hdr);;</translation>
<translation type="unfinished">PNG图像(*.png);;JPEG图像(*.jpg);;BMP图像(*.bmp);;EXR图像(*.exr);;HDR图像(*.hdr);;</translation>
</message>
<message>
<source>Record Video</source>
<translation type="obsolete">录制视频</translation>
<translation type="unfinished">录制视频</translation>
</message>
<message>
<source>EnvTex</source>
<translation type="obsolete">环境贴图</translation>
<translation type="unfinished">环境贴图</translation>
</message>
<message>
<source>Error</source>
<translation type="obsolete">错误</translation>
<translation type="unfinished">错误</translation>
</message>
<message>
<source>Open %1 error!</source>
<translation type="obsolete">打开%1错误!</translation>
<translation type="unfinished">打开%1错误!</translation>
</message>
<message>
<source>Default</source>
<translation type="obsolete">默认</translation>
<translation type="unfinished">默认</translation>
</message>
<message>
<source>Ctrl+O</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Shift+F12</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>BlackWhite</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Creek</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Daylight</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Footballfield</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Forest</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Lake</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sea</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Zensim Graph File (*.zsg)
All Files (*)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
Expand Down
Loading

0 comments on commit 5e67819

Please sign in to comment.