提交 67aa313a 编写于 作者: D dev

Add cmd display view

上级 c4875118
......@@ -674,6 +674,7 @@ void taskProject::slot_new_package(QByteArrayList pkgs)
*/
void taskProject::slot_new_command(QMap<QString,QVariant> cmd)
{
emit sig_cmd_display(cmd);
if (cmd.size())
{
QString source;
......
......@@ -148,6 +148,7 @@ signals:
void sig_cmd_stop(QObject * node);
void sig_cmd_write(QObject * node, QByteArray arr);
void sig_cmd_sendcmd(QMap<QString,QVariant> cmd,QSet<QString> destions);
void sig_cmd_display(QMap<QString,QVariant> cmd);
//外部通信 External communication
void sig_outside_new_package(QByteArray);
void sig_started();
......
......@@ -20,6 +20,7 @@ taskBusPlatformFrm::taskBusPlatformFrm(QWidget *parent) :
ui(new Ui::taskBus),
m_pTrayIcon(new QSystemTrayIcon(this)),
m_pMsgModel(new QStandardItemModel(this)),
m_pCmdViewModel(new QStandardItemModel(this)),
m_pClassModel(new QStandardItemModel(this))
{
ui->setupUi(this);
......@@ -33,14 +34,15 @@ taskBusPlatformFrm::taskBusPlatformFrm(QWidget *parent) :
ui->comboBox_class->setModel(m_pClassModel);
//消息 message module
ui->listView_messages->setModel(m_pMsgModel);
ui->listView_commands->setModel(m_pCmdViewModel);
//状态栏 status bar
m_pStatus = new QLabel(this);
statusBar()->addWidget(m_pStatus);
m_nTmid = startTimer(1000);
tabifyDockWidget(ui->dockWidget_message,ui->dockWidget_watch);
tabifyDockWidget(ui->dockWidget_message,ui->dockWidget_props);
tabifyDockWidget(ui->dockWidget_props,ui->dockWidget_cmd);
tabifyDockWidget(ui->dockWidget_props,ui->dockWidget_watch);
tabifyDockWidget(ui->dockWidget_props,ui->dockWidget_message);
m_iconTray[0].addFile(":/taskBus/images/ticon1.png");
m_iconTray[1].addFile(":/taskBus/images/ticon2.png");
m_pTrayIcon->setIcon(m_iconTray[0]);
......@@ -56,6 +58,7 @@ taskBusPlatformFrm::taskBusPlatformFrm(QWidget *parent) :
ui->menu_View->insertAction(ui->actionhideWindow,ui->dockWidget_props->toggleViewAction());
ui->menu_View->insertAction(ui->actionhideWindow,ui->dockWidget_watch->toggleViewAction());
m_bShowCmds = false;
}
taskBusPlatformFrm::~taskBusPlatformFrm()
......@@ -338,3 +341,20 @@ void taskBusPlatformFrm::on_listView_modules_doubleClicked(const QModelIndex &in
}
}
}
void taskBusPlatformFrm::on_checkBox_showCmd_stateChanged(int /*arg1*/)
{
m_bShowCmds = ui->checkBox_showCmd->isChecked();
}
void taskBusPlatformFrm::slot_cmd_show(QMap<QString,QVariant> cmd)
{
if (m_bShowCmds==false)
return;
const int keepRows = 128;
QString prefix = QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss");
QString str = taskCell::map_to_string(cmd);
m_pCmdViewModel->appendRow(new QStandardItem(prefix+">"+str));
if (m_pCmdViewModel->rowCount()>keepRows)
m_pCmdViewModel->removeRows(0,m_pCmdViewModel->rowCount()-keepRows);
ui->listView_commands->scrollToBottom();
}
......@@ -28,6 +28,7 @@ private slots:
void slot_projstarted();
void slot_projstopped();
void slot_traymessage(QSystemTrayIcon::ActivationReason r);
void slot_cmd_show(QMap<QString,QVariant>);
void on_action_Load_Module_triggered();
void on_action_New_Project_triggered();
void on_action_About_triggered();
......@@ -40,6 +41,7 @@ private slots:
void on_actionhideWindow_toggled(bool arg1);
void on_action_Save_Project_As_triggered();
void on_listView_modules_doubleClicked(const QModelIndex &index);
void on_checkBox_showCmd_stateChanged(int arg1);
signals:
void showSplash(QString msg,Qt::Alignment, QColor);
......@@ -59,10 +61,11 @@ private:
taskModule * m_pRefModule = nullptr;
QMap<QString,QMdiSubWindow *> m_activePagesFileName;
QStandardItemModel * m_pMsgModel;
QStandardItemModel * m_pCmdViewModel;
QStandardItemModel * m_pClassModel;
QString inifile();
static int m_doc_ins;
bool m_bShowCmds;
};
#endif // PROGRESSBUSPLATFORMFRM_H
......@@ -90,7 +90,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>22</height>
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="menu_Application">
......@@ -247,8 +247,8 @@
</property>
<property name="minimumSize">
<size>
<width>72</width>
<height>91</height>
<width>85</width>
<height>103</height>
</size>
</property>
<property name="features">
......@@ -310,8 +310,8 @@
<widget class="QDockWidget" name="dockWidget_message">
<property name="minimumSize">
<size>
<width>72</width>
<height>91</height>
<width>85</width>
<height>103</height>
</size>
</property>
<property name="floating">
......@@ -359,7 +359,7 @@
<widget class="QDockWidget" name="dockWidget_watch">
<property name="minimumSize">
<size>
<width>66</width>
<width>85</width>
<height>73</height>
</size>
</property>
......@@ -392,6 +392,50 @@
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="dockWidget_cmd">
<property name="windowTitle">
<string>comma&amp;nds</string>
</property>
<attribute name="dockWidgetArea">
<number>8</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents_5">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>1</number>
</property>
<property name="leftMargin">
<number>1</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<property name="bottomMargin">
<number>1</number>
</property>
<item>
<widget class="QListView" name="listView_commands">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_showCmd">
<property name="text">
<string>Show</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<action name="action_Exit">
<property name="icon">
<iconset resource="../taskbusplatform.qrc">
......@@ -503,6 +547,7 @@
</action>
<zorder>dockWidget_message</zorder>
<zorder>dockWidget_watch</zorder>
<zorder>dockWidget_cmd</zorder>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
......
......@@ -27,6 +27,7 @@ void taskBusPlatformFrm::on_action_New_Project_triggered()
connect (v,&PDesignerView::sig_projstarted,this,&taskBusPlatformFrm::slot_projstarted,Qt::QueuedConnection);
connect (v,&PDesignerView::sig_projstopped,this,&taskBusPlatformFrm::slot_projstopped,Qt::QueuedConnection);
connect (v->project(), &taskProject::sig_iostat,ui->form_stat->wmod(),&WatchMemModule::slot_packio);
connect (v->project(), &taskProject::sig_cmd_display,this,&taskBusPlatformFrm::slot_cmd_show,Qt::QueuedConnection);
}
void taskBusPlatformFrm::on_action_Save_Project_triggered()
......@@ -151,6 +152,7 @@ void taskBusPlatformFrm::slot_openprj(QString newfm)
connect (dv,&PDesignerView::sig_projstarted,this,&taskBusPlatformFrm::slot_projstarted,Qt::QueuedConnection);
connect (dv,&PDesignerView::sig_projstopped,this,&taskBusPlatformFrm::slot_projstopped,Qt::QueuedConnection);
connect (dv->project(), &taskProject::sig_iostat,ui->form_stat->wmod(),&WatchMemModule::slot_packio);
connect (dv->project(), &taskProject::sig_cmd_display,this,&taskBusPlatformFrm::slot_cmd_show,Qt::QueuedConnection);
QCoreApplication::processEvents();
dv->project()->refresh_idxes();
QCoreApplication::processEvents();
......
......@@ -435,53 +435,63 @@
<translation>状态</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.ui" line="401"/>
<location filename="gui/taskbusplatformfrm.ui" line="397"/>
<source>comma&amp;nds</source>
<translation>指令(&amp;n)</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.ui" line="432"/>
<source>Show</source>
<translation>显示</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.ui" line="445"/>
<source>&amp;Exit</source>
<translation>退出(&amp;e)</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.ui" line="404"/>
<location filename="gui/taskbusplatformfrm.ui" line="448"/>
<source>Exit from this application.</source>
<translation>退出当前程序</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.ui" line="413"/>
<location filename="gui/taskbusplatformfrm.ui" line="457"/>
<source>&amp;Load Module</source>
<translation>载入模块(&amp;L)</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.ui" line="416"/>
<location filename="gui/taskbusplatformfrm.ui" line="460"/>
<source>Load a module executable file from disk.</source>
<translation>从磁盘的可执行文件模块载入元数据</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.ui" line="428"/>
<location filename="gui/taskbusplatformfrm.ui" line="472"/>
<source>Start &amp;project</source>
<oldsource>&amp;Start project</oldsource>
<translation>执行(&amp;P)</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.ui" line="431"/>
<location filename="gui/taskbusplatformfrm.ui" line="475"/>
<source>Start current project.</source>
<translation>执行当前工程</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.ui" line="440"/>
<location filename="gui/taskbusplatformfrm.ui" line="484"/>
<source>&amp;New Project</source>
<translation>新建工程(&amp;N)</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.ui" line="443"/>
<location filename="gui/taskbusplatformfrm.ui" line="487"/>
<source>Create New Project</source>
<translation>建立新工程</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.ui" line="493"/>
<location filename="gui/taskbusplatformfrm.ui" line="537"/>
<source>&amp;Hide</source>
<translation>隐藏&amp;H)</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.ui" line="501"/>
<location filename="gui/taskbusplatformfrm.ui" line="545"/>
<source>Save Project &amp;As...</source>
<translation>工程另存为&amp;A)...</translation>
</message>
......@@ -507,27 +517,27 @@
<translation type="vanished">显示/隐藏属性窗口</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.ui" line="452"/>
<location filename="gui/taskbusplatformfrm.ui" line="496"/>
<source>&amp;Open Project</source>
<translation>打开工程(&amp;O)</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.ui" line="461"/>
<location filename="gui/taskbusplatformfrm.ui" line="505"/>
<source>&amp;Save Project</source>
<translation>保存工程(&amp;S)</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.ui" line="466"/>
<location filename="gui/taskbusplatformfrm.ui" line="510"/>
<source>&amp;About</source>
<translation>关于(&amp;A)</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.ui" line="478"/>
<location filename="gui/taskbusplatformfrm.ui" line="522"/>
<source>S&amp;top project</source>
<translation>终止运行(&amp;T)</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.ui" line="481"/>
<location filename="gui/taskbusplatformfrm.ui" line="525"/>
<source>stop current project</source>
<translation>停止执行当前工程</translation>
</message>
......@@ -540,7 +550,7 @@
<translation type="vanished">隐藏至任务栏图标&amp;h</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.ui" line="496"/>
<location filename="gui/taskbusplatformfrm.ui" line="540"/>
<source>hide window and show tray icon</source>
<translation>把主界面隐藏起来到状态栏图标里</translation>
</message>
......@@ -552,19 +562,19 @@
<context>
<name>taskBusPlatformFrm</name>
<message>
<location filename="gui/taskbusplatformfrm.cpp" line="28"/>
<location filename="gui/taskbusplatformfrm.cpp" line="29"/>
<location filename="gui/taskbusplatformfrm.cpp" line="32"/>
<location filename="gui/taskbusplatformfrm.cpp" line="30"/>
<location filename="gui/taskbusplatformfrm.cpp" line="33"/>
<source>All</source>
<translation>所有</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.cpp" line="187"/>
<location filename="gui/taskbusplatformfrm.cpp" line="189"/>
<source>Init Modules...</source>
<translation>初始化...</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.cpp" line="187"/>
<location filename="gui/taskbusplatformfrm.cpp" line="189"/>
<source>Init modules from default_mods.text</source>
<translation>正在从 default_mods.text 加载模块</translation>
</message>
......@@ -573,32 +583,32 @@
<translation type="vanished">进程总线工作室</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.cpp" line="189"/>
<location filename="gui/taskbusplatformfrm.cpp" line="191"/>
<source>Succeed.</source>
<translation>成功</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.cpp" line="189"/>
<location filename="gui/taskbusplatformfrm.cpp" line="191"/>
<source>Init modules from default_mods.text succeed!</source>
<translation>成功从default_mods.text加载模块</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.cpp" line="293"/>
<location filename="gui/taskbusplatformfrm.cpp" line="295"/>
<source>Still running</source>
<translation>项目仍在运行中</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.cpp" line="293"/>
<location filename="gui/taskbusplatformfrm.cpp" line="295"/>
<source>Project is still running, please stop all projects first.</source>
<translation>项目仍在运行请先关闭后再退出</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.cpp" line="299"/>
<location filename="gui/taskbusplatformfrm.cpp" line="301"/>
<source>Close without saving?</source>
<translation>不保存就关闭吗</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm.cpp" line="299"/>
<location filename="gui/taskbusplatformfrm.cpp" line="301"/>
<source>Project has been modified, Close it anyway?</source>
<translation>项目已经编辑了是否不保存就继续关闭</translation>
</message>
......@@ -622,14 +632,14 @@
<translation>载入模块</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm_project.cpp" line="54"/>
<location filename="gui/taskbusplatformfrm_project.cpp" line="101"/>
<location filename="gui/taskbusplatformfrm_project.cpp" line="55"/>
<location filename="gui/taskbusplatformfrm_project.cpp" line="102"/>
<source>Save project</source>
<translation>保存工程</translation>
</message>
<message>
<location filename="gui/taskbusplatformfrm_project.cpp" line="78"/>
<location filename="gui/taskbusplatformfrm_project.cpp" line="124"/>
<location filename="gui/taskbusplatformfrm_project.cpp" line="79"/>
<location filename="gui/taskbusplatformfrm_project.cpp" line="125"/>
<source>Save Failed</source>
<translation>保存失败</translation>
</message>
......@@ -637,7 +647,7 @@
<context>
<name>taskBusPlatformFrm::taskBusPlatformFrm</name>
<message>
<location filename="gui/taskbusplatformfrm_project.cpp" line="169"/>
<location filename="gui/taskbusplatformfrm_project.cpp" line="171"/>
<source>Open project</source>
<translation>打开工程</translation>
</message>
......@@ -710,13 +720,13 @@
<translation></translation>
</message>
<message>
<location filename="core/taskproject.cpp" line="910"/>
<location filename="core/taskproject.cpp" line="911"/>
<source>No valid inside maps for inid %1 .</source>
<translatorcomment>输入专题%1没有备选的内部映射</translatorcomment>
<translation></translation>
</message>
<message>
<location filename="core/taskproject.cpp" line="927"/>
<location filename="core/taskproject.cpp" line="928"/>
<source>outside input subject &quot;%1&quot; does not exits.</source>
<translatorcomment>输出专题%1不存在</translatorcomment>
<translation></translation>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册