Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
不卤废丝
taskbus
提交
1fe187f6
taskbus
项目概览
不卤废丝
/
taskbus
与 Fork 源项目一致
Fork自
colorEagleStdio / taskbus
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
taskbus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1fe187f6
编写于
4月 17, 2022
作者:
D
dev
提交者:
dev
4月 17, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
加入实时鼠标位置和连线功能,更加便利了。
上级
b2805694
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
104 addition
and
35 deletion
+104
-35
taskbusplatform/CMakeLists.txt
taskbusplatform/CMakeLists.txt
+2
-0
taskbusplatform/gui/pdesignerview.cpp
taskbusplatform/gui/pdesignerview.cpp
+5
-8
taskbusplatform/gui/pdesignerview.h
taskbusplatform/gui/pdesignerview.h
+4
-5
taskbusplatform/gui/pdesignerview.ui
taskbusplatform/gui/pdesignerview.ui
+0
-18
taskbusplatform/gui/tbscene.cpp
taskbusplatform/gui/tbscene.cpp
+52
-0
taskbusplatform/gui/tbscene.h
taskbusplatform/gui/tbscene.h
+21
-0
taskbusplatform/gui/tgraphicstaskitem.cpp
taskbusplatform/gui/tgraphicstaskitem.cpp
+15
-1
taskbusplatform/gui/tgraphicstaskitem.h
taskbusplatform/gui/tgraphicstaskitem.h
+1
-0
taskbusplatform/taskBusPlatform_zh_CN.qm
taskbusplatform/taskBusPlatform_zh_CN.qm
+0
-0
taskbusplatform/taskbusplatform.pro
taskbusplatform/taskbusplatform.pro
+4
-3
未找到文件。
taskbusplatform/CMakeLists.txt
浏览文件 @
1fe187f6
...
...
@@ -56,6 +56,7 @@ set(PRJ_HEADERS_GUI
gui/taskmodule.h
gui/tgraphicstaskitem.h
gui/dlgabout.h
gui/tbscene.h
)
set
(
PRJ_SOURCES_CORE
core/tasknode.cpp
...
...
@@ -74,6 +75,7 @@ set(PRJ_SOURCES_GUI
gui/taskmodule.cpp
gui/tgraphicstaskitem.cpp
gui/custom_item_editor.cpp
gui/tbscene.cpp
)
set
(
PRJ_FORMS
gui/taskbusplatformfrm.ui
...
...
taskbusplatform/gui/pdesignerview.cpp
浏览文件 @
1fe187f6
#
include
"pdesignerview.h"
#include "pdesignerview.h"
#include "ui_pdesignerview.h"
#include <QDragEnterEvent>
#include <QMimeData>
...
...
@@ -8,7 +8,6 @@
#include <QMdiSubWindow>
#include <QDataStream>
#include <QClipboard>
#include <QGraphicsScene>
#include <QGraphicsLineItem>
#include <QMessageBox>
#include <QJsonObject>
...
...
@@ -21,13 +20,13 @@
#include "tb_interface.h"
#include "core/process_prctl.h"
#include "watchdog/profile_log.h"
#include "tbscene.h"
int
PDesignerView
::
m_nextCV
=
1
;
PDesignerView
::
PDesignerView
(
taskBusPlatformFrm
*
pMainfrm
,
QWidget
*
parent
)
:
QWidget
(
parent
),
ui
(
new
Ui
::
PDesignerView
),
m_scene
(
new
QGraphics
Scene
(
0
,
0
,
4096
,
3072
,
this
)),
m_scene
(
new
TB
Scene
(
0
,
0
,
4096
,
3072
,
this
)),
m_project
(
new
taskProject
(
0
)),
m_pRunThread
(
new
QThread
(
this
)),
m_pMainFrm
(
pMainfrm
)
...
...
@@ -75,7 +74,6 @@ PDesignerView::PDesignerView(taskBusPlatformFrm * pMainfrm,QWidget *parent) :
}
{
QToolBar
*
bar
=
new
QToolBar
(
tr
(
"Designer"
),
this
)
;
bar
->
addAction
(
ui
->
actionConnectLine
);
addAction
(
ui
->
actionConnectLine
);
bar
->
addAction
(
ui
->
actionDeleteLine
);
addAction
(
ui
->
actionDeleteLine
);
bar
->
addAction
(
ui
->
actionPinUp
);
addAction
(
ui
->
actionPinUp
);
bar
->
addAction
(
ui
->
actionPinDown
);
addAction
(
ui
->
actionPinDown
);
...
...
@@ -576,7 +574,8 @@ void PDesignerView::on_actionCut_triggered()
}
}
void
PDesignerView
::
on_actionConnectLine_triggered
()
void
PDesignerView
::
connectPins
()
{
int
gIns
=
0
;
foreach
(
TGraphicsTaskItem
::
pin_info
p
,
TGraphicsTaskItem
::
m_pinList
)
...
...
@@ -614,8 +613,6 @@ void PDesignerView::on_actionConnectLine_triggered()
TGraphicsTaskItem
::
m_pinList
.
clear
();
m_project
->
refresh_idxes
();
ui
->
graphicsView_main
->
scale
(
0.5
,
1
);
ui
->
graphicsView_main
->
scale
(
2
,
1
);
appendUndoList
();
}
...
...
taskbusplatform/gui/pdesignerview.h
浏览文件 @
1fe187f6
/*!
/*!
* PDesignerView provides a modular drag-and-drop interface like Simulink or
* gnu-radio that can be used to implement (quasi-)real-time processing logic
* on a general-purpose computer.
...
...
@@ -18,7 +18,7 @@
#include "core/taskproject.h"
class
TGraphicsTaskItem
;
class
taskNode
;
class
QGraphics
Scene
;
class
TB
Scene
;
class
QGraphicsLineItem
;
class
taskBusPlatformFrm
;
namespace
Ui
{
...
...
@@ -68,7 +68,7 @@ private:
//进程对应的图形
//Graphics for process corresponding
QVector
<
TGraphicsTaskItem
*>
m_vec_gitems
;
QGraphics
Scene
*
m_scene
;
TB
Scene
*
m_scene
;
//连线,在update_paths更新
//lines, uodated in void update_paths();
QVector
<
QGraphicsLineItem
*>
m_lines
;
...
...
@@ -104,7 +104,7 @@ public:
void
savedUndoState
();
public
slots
:
void
appendUndoList
();
void
connectPins
();
protected:
void
set_modified
(
bool
bmod
=
true
);
protected:
...
...
@@ -124,7 +124,6 @@ private slots:
void
on_actionCopy_triggered
();
void
on_actionPaste_triggered
();
void
on_actionCut_triggered
();
void
on_actionConnectLine_triggered
();
void
on_actionDeleteLine_triggered
();
void
on_actionPinUp_triggered
();
void
on_actionPinDown_triggered
();
...
...
taskbusplatform/gui/pdesignerview.ui
浏览文件 @
1fe187f6
...
...
@@ -52,9 +52,6 @@
<property
name=
"alignment"
>
<set>
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
</set>
</property>
<property
name=
"renderHints"
>
<set>
QPainter::HighQualityAntialiasing|QPainter::SmoothPixmapTransform|QPainter::TextAntialiasing
</set>
</property>
<property
name=
"dragMode"
>
<enum>
QGraphicsView::ScrollHandDrag
</enum>
</property>
...
...
@@ -184,21 +181,6 @@
<string>
Ctrl+X
</string>
</property>
</action>
<action
name=
"actionConnectLine"
>
<property
name=
"icon"
>
<iconset
resource=
"../taskbusplatform.qrc"
>
<normaloff>
:/taskBus/images/H. line.png
</normaloff>
:/taskBus/images/H. line.png
</iconset>
</property>
<property
name=
"text"
>
<string>
ConnectLine
</string>
</property>
<property
name=
"toolTip"
>
<string>
ConnectLine, Ctrl+L
</string>
</property>
<property
name=
"shortcut"
>
<string>
Ctrl+L
</string>
</property>
</action>
<action
name=
"actionDeleteLine"
>
<property
name=
"icon"
>
<iconset
resource=
"../taskbusplatform.qrc"
>
...
...
taskbusplatform/gui/tbscene.cpp
0 → 100644
浏览文件 @
1fe187f6
#include "tbscene.h"
#include "tgraphicstaskitem.h"
#include <QGraphicsSceneMouseEvent>
TBScene
::
TBScene
(
QObject
*
parent
)
:
QGraphicsScene
{
parent
}
,
m_pinLine
(
new
QGraphicsLineItem
())
{
addItem
(
m_pinLine
);
m_nTimerID
=
startTimer
(
500
);
}
TBScene
::
TBScene
(
const
QRectF
&
sceneRect
,
QObject
*
parent
)
:
QGraphicsScene
(
sceneRect
,
parent
)
,
m_pinLine
(
new
QGraphicsLineItem
())
{
addItem
(
m_pinLine
);
m_nTimerID
=
startTimer
(
500
);
}
TBScene
::
TBScene
(
qreal
x
,
qreal
y
,
qreal
width
,
qreal
height
,
QObject
*
parent
)
:
QGraphicsScene
(
x
,
y
,
width
,
height
,
parent
)
,
m_pinLine
(
new
QGraphicsLineItem
())
{
addItem
(
m_pinLine
);
m_nTimerID
=
startTimer
(
500
);
}
void
TBScene
::
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
e
)
{
QGraphicsScene
::
mouseMoveEvent
(
e
);
if
(
TGraphicsTaskItem
::
m_pinList
.
size
()
==
1
)
{
m_pinLine
->
setLine
(
TGraphicsTaskItem
::
m_pinPoint
.
x
(),
TGraphicsTaskItem
::
m_pinPoint
.
y
(),
e
->
lastScenePos
().
x
(),
e
->
lastScenePos
().
y
());
}
}
void
TBScene
::
timerEvent
(
QTimerEvent
*
e
)
{
static
unsigned
long
long
colori
=
0
;
if
(
e
->
timerId
()
==
m_nTimerID
)
{
if
(
TGraphicsTaskItem
::
m_pinList
.
size
()
==
1
)
{
QPen
pen
(
Qt
::
DotLine
);
pen
.
setWidth
(
2
);
pen
.
setColor
(
QColor
(
++
colori
*
49999473677
%
0xffffff
));
m_pinLine
->
setPen
(
QPen
(
pen
));
}
else
if
(
m_pinLine
->
line
().
x1
()
||
m_pinLine
->
line
().
x2
())
{
m_pinLine
->
setLine
(
0
,
0
,
0
,
0
);
}
}
}
taskbusplatform/gui/tbscene.h
0 → 100644
浏览文件 @
1fe187f6
#ifndef TBSCENE_H
#define TBSCENE_H
#include <QGraphicsScene>
#include <QGraphicsLineItem>
class
TBScene
:
public
QGraphicsScene
{
Q_OBJECT
public:
TBScene
(
QObject
*
parent
=
nullptr
);
TBScene
(
const
QRectF
&
sceneRect
,
QObject
*
parent
=
nullptr
);
TBScene
(
qreal
x
,
qreal
y
,
qreal
width
,
qreal
height
,
QObject
*
parent
=
nullptr
);
protected:
void
timerEvent
(
QTimerEvent
*
e
)
override
;
void
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
e
)
override
;
private:
QGraphicsLineItem
*
m_pinLine
=
nullptr
;
int
m_nTimerID
=
-
1
;
};
#endif // TBSCENE_H
taskbusplatform/gui/tgraphicstaskitem.cpp
浏览文件 @
1fe187f6
#
include
"tgraphicstaskitem.h"
#include "tgraphicstaskitem.h"
#include <QPainter>
#include <QDebug>
#include <QFileInfo>
...
...
@@ -9,6 +9,8 @@
#include "taskmodule.h"
QSet
<
TGraphicsTaskItem
::
pin_info
>
TGraphicsTaskItem
::
m_pinList
;
QPointF
TGraphicsTaskItem
::
m_pinPoint
(
0
,
0
)
;
TGraphicsTaskItem
::
TGraphicsTaskItem
(
PDesignerView
*
pv
,
taskModule
*
pm
,
QGraphicsItem
*
para
)
:
QGraphicsItem
(
para
),
m_pPrjView
(
pv
),
...
...
@@ -105,6 +107,8 @@ void TGraphicsTaskItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
painter
->
setBrush
(
brold
);
m_insbpos
[
src
]
=
this
->
mapToScene
(
QPointF
(
-
100
,
cell_height
/
2
-
szz
*
32
+
16
+
4
));
m_icol
[
src
]
=
linec
;
if
(
m_pinList
.
contains
(
info
))
m_pinPoint
=
m_insbpos
[
src
];
QColor
ash
=
QColor
(
0
,
0
,
0
);
painter
->
setPen
(
ash
);
painter
->
drawLine
(
-
100
+
8
,
cell_height
/
2
-
szz
*
32
+
16
+
4
...
...
@@ -120,6 +124,8 @@ void TGraphicsTaskItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
painter
->
setBrush
(
brold
);
m_insbpos
[
src
]
=
this
->
mapToScene
(
QPointF
(
100
,
cell_height
/
2
-
szz
*
32
+
16
+
4
));
m_icol
[
src
]
=
linec
;
if
(
m_pinList
.
contains
(
info
))
m_pinPoint
=
m_insbpos
[
src
];
QColor
ash
=
QColor
(
0
,
0
,
0
);
painter
->
setPen
(
ash
);
painter
->
drawLine
(
100
-
8
,
cell_height
/
2
-
szz
*
32
+
16
+
4
...
...
@@ -160,6 +166,8 @@ void TGraphicsTaskItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
50
,
8
);
painter
->
setBrush
(
brold
);
m_outsbpos
[
dst
]
=
this
->
mapToScene
(
QPointF
(
100
,
cell_height
/
2
-
szz
*
32
+
16
+
4
));
if
(
m_pinList
.
contains
(
info
))
m_pinPoint
=
m_outsbpos
[
dst
];
QColor
ash
=
QColor
(
0
,
0
,
0
);
painter
->
setPen
(
ash
);
painter
->
drawLine
(
100
-
8
,
cell_height
/
2
-
szz
*
32
+
16
...
...
@@ -174,6 +182,8 @@ void TGraphicsTaskItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
50
,
8
);
painter
->
setBrush
(
brold
);
m_outsbpos
[
dst
]
=
this
->
mapToScene
(
QPointF
(
-
100
,
cell_height
/
2
-
szz
*
32
+
16
+
4
));
if
(
m_pinList
.
contains
(
info
))
m_pinPoint
=
m_outsbpos
[
dst
];
QColor
ash
=
QColor
(
0
,
0
,
0
);
painter
->
setPen
(
ash
);
painter
->
drawLine
(
-
100
+
8
,
cell_height
/
2
-
szz
*
32
+
16
...
...
@@ -297,6 +307,10 @@ void TGraphicsTaskItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
m_pinList
.
clear
();
}
else
if
(
m_pinList
.
size
()
>
1
)
{
m_pPrjView
->
connectPins
();
}
}
QGraphicsItem
::
mousePressEvent
(
event
);
...
...
taskbusplatform/gui/tgraphicstaskitem.h
浏览文件 @
1fe187f6
...
...
@@ -52,6 +52,7 @@ protected:
QMap
<
QString
,
QColor
>
m_icol
;
int
cellSize
(
QMap
<
QString
,
int
>
*
mp_SrcPos
,
QMap
<
QString
,
int
>
*
mp_DstPos
)
const
;
public:
static
QPointF
m_pinPoint
;
static
QSet
<
pin_info
>
m_pinList
;
};
...
...
taskbusplatform/taskBusPlatform_zh_CN.qm
0 → 100644
浏览文件 @
1fe187f6
文件已添加
taskbusplatform/taskbusplatform.pro
浏览文件 @
1fe187f6
...
...
@@ -59,7 +59,8 @@ SOURCES += \
core
/
process_prctl
.
cpp
\
watchdog
/
tbwatchdog
.
cpp
\
watchdog
/
watchmemmodule
.
cpp
\
gui
/
custom_item_editor
.
cpp
gui
/
custom_item_editor
.
cpp
\
gui
/
tbscene
.
cpp
HEADERS
+=
\
core
/
tasknode
.
h
\
...
...
@@ -78,8 +79,8 @@ HEADERS += \
..
/
tb_interface
/
tb_interface
.
h
\
watchdog
/
profile_log
.
h
\
watchdog
/
tbwatchdog
.
h
\
watchdog
/
watchmemmodule
.
h
watchdog
/
watchmemmodule
.
h
\
gui
/
tbscene
.
h
FORMS
+=
\
gui
/
taskbusplatformfrm
.
ui
\
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录