1 |
2 |
EziDebug |
#include <QtGui>
|
2 |
|
|
|
3 |
|
|
#include "toolwindow.h"
|
4 |
|
|
#include "treeview.h"
|
5 |
|
|
#include "treeitem.h"
|
6 |
|
|
//#include "ezidebugprj.h"
|
7 |
|
|
#include "ezidebugmodule.h"
|
8 |
|
|
#include "updatedetectthread.h"
|
9 |
|
|
#include "ezidebuginstancetreeitem.h"
|
10 |
|
|
#include "ezidebugtreemodel.h"
|
11 |
|
|
#include "ezidebugscanchain.h"
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
#include<QDebug>
|
15 |
|
|
|
16 |
|
|
ListWindow::ListWindow(QWidget *parent, Qt::WindowFlags f) :
|
17 |
|
|
QWidget(parent, f)
|
18 |
|
|
{
|
19 |
|
|
QStringList ifileList ;
|
20 |
|
|
QTextCodec::setCodecForTr(QTextCodec::codecForName("gb18030"));
|
21 |
|
|
setMouseTracking(true);
|
22 |
|
|
getToolWindowPointer(parent);
|
23 |
|
|
|
24 |
|
|
findDialog = 0;
|
25 |
|
|
moduleTreeView = NULL ;
|
26 |
|
|
m_peziDebugTreeModel = NULL ;
|
27 |
|
|
eDirection = eNone ;
|
28 |
|
|
isLeftButtonPress = false ;
|
29 |
|
|
|
30 |
|
|
//创建菜单栏和按钮
|
31 |
|
|
//createButtons();
|
32 |
|
|
// createActions();
|
33 |
|
|
// createMenus();
|
34 |
|
|
// QPalette palette;
|
35 |
|
|
// palette.setBrush(QColor(255,255,255));
|
36 |
|
|
// menuBar->setPalette(palette);
|
37 |
|
|
// menuBar->setWindowOpacity(0);
|
38 |
|
|
|
39 |
|
|
//创建标题栏
|
40 |
|
|
titleBar = new TitleBar(this);
|
41 |
|
|
|
42 |
|
|
connect(titleBar->closeButton, SIGNAL(clicked()), this, SLOT(close()));
|
43 |
|
|
//创建工具栏
|
44 |
|
|
//QToolBar toolBar = new ToolBar(this);
|
45 |
|
|
//创建内容区域
|
46 |
|
|
//QPushButton *btn = new QPushButton(this);
|
47 |
|
|
//btn->setText(tr("cancel"));
|
48 |
|
|
//QWidget *contentWidget = new QWidget(this);
|
49 |
|
|
//分栏
|
50 |
|
|
// closeButton = new Button(tr(":/images/ListWindowExit.bmp"), this);
|
51 |
|
|
// //closeButton = new Button ;
|
52 |
|
|
// closeButton->setIconSize(QSize(11, 10));
|
53 |
|
|
// // closeButton->setGeometry(QRect(this->geometry().left()-20, 7, 11, 10));
|
54 |
|
|
// closeButton->setGeometry(QRect(this->geometry().width()-20, 7, 11, 10));
|
55 |
|
|
// qDebug()<< this->geometry().width()<<geometry().height();
|
56 |
|
|
// connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
|
57 |
|
|
// button1 = new QPushButton(tr("hello"),this);
|
58 |
|
|
// button1->setGeometry(QRect(10,7, 11, 10));
|
59 |
|
|
// connect(button1, SIGNAL(clicked()), this, SLOT(close()));
|
60 |
|
|
m_pmessageTreeView = new TreeView(this) ;
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
m_iShowMessageModel = new QStandardItemModel(0,2,this);
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
m_iShowMessageModel->setHeaderData(0, Qt::Horizontal, QObject::tr("Type"));
|
67 |
|
|
m_iShowMessageModel->setHeaderData(1, Qt::Horizontal, QObject::tr("Message"));
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
moduleTreeView = new TreeView(this);
|
71 |
|
|
|
72 |
|
|
moduleTreeView->setWindowTitle(QObject::tr("Simple Tree Model"));
|
73 |
|
|
m_pcontextMenu = new QMenu(moduleTreeView);
|
74 |
4 |
EziDebug |
|
75 |
|
|
#if 0
|
76 |
2 |
EziDebug |
m_paddChainAct = m_pcontextMenu->addAction(QIcon(":/images/insert.png"),tr("添加链"));
|
77 |
|
|
m_pdeleteChainAct = m_pcontextMenu->addAction(QIcon(":/images/delete.png"),tr("删除链"));
|
78 |
4 |
EziDebug |
#else
|
79 |
|
|
m_paddChainAct = m_pcontextMenu->addAction(QIcon(":/images/insert.png"),tr("insert scanchain"));
|
80 |
|
|
m_pdeleteChainAct = m_pcontextMenu->addAction(QIcon(":/images/delete.png"),tr("delete scanchain"));
|
81 |
|
|
#endif
|
82 |
|
|
|
83 |
2 |
EziDebug |
connect(m_paddChainAct,SIGNAL(triggered()), toolWindow, SLOT(addScanChain()));
|
84 |
|
|
connect(m_pdeleteChainAct,SIGNAL(triggered()),toolWindow, SLOT(deleteScanChain()));
|
85 |
|
|
|
86 |
|
|
moduleTreeView->setModel(NULL);
|
87 |
|
|
m_pmessageTreeView->setModel(m_iShowMessageModel);
|
88 |
|
|
|
89 |
|
|
mainSplitter = new Splitter(Qt::Horizontal, this);
|
90 |
|
|
|
91 |
|
|
|
92 |
|
|
mainSplitter->addWidget(moduleTreeView);
|
93 |
|
|
mainSplitter->addWidget(m_pmessageTreeView);
|
94 |
|
|
|
95 |
|
|
|
96 |
|
|
moduleTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
|
97 |
|
|
connect(moduleTreeView, SIGNAL(customContextMenuRequested(const QPoint&)),
|
98 |
|
|
this, SLOT(show_contextmenu(const QPoint&)));
|
99 |
|
|
moduleTreeView->show();
|
100 |
|
|
|
101 |
4 |
EziDebug |
addMessage("welcome","####Welcome to EziDebug####");
|
102 |
2 |
EziDebug |
|
103 |
|
|
/* 根据工程 文件是否创建 来是否显示 树状结构图*/
|
104 |
|
|
// 在 toolwindow 的 构造 时 检测是否存在 默认路径 ,如果存在有效的默认路径,则会根据该路径1个工程对象
|
105 |
|
|
// 构造完 toolwindow 后 接着 构造 listwindow ,如果 listwidow 检查 toolwindow 下的
|
106 |
|
|
// 工程对象指针来 判断 是否 需要 重现 树状结构 ,如果 工程对象指针 不为空的话 ,
|
107 |
|
|
|
108 |
|
|
// 1 、根据工程对象指针 来判断 是否存在 log 文件、以及工程文件
|
109 |
|
|
// 如果没有的话 不在窗口构造的时候 构造树形结构,在旁边的 文本栏 提示错误信息:默认路径 不存在有效数据
|
110 |
|
|
// 2 、从log 文件恢复 所有数据,恢复时 检测 log 文件 是否 ok,如果有错误,则在 文本栏提示 错误信息 log 文件被破坏
|
111 |
|
|
//
|
112 |
|
|
// 当构造函数完成最后,开启 进程信息,并开启定时器,定时器定时 从工程文件中提取所有的 代码文件信息,与目前工程文件中保存的
|
113 |
|
|
// 所有文件信息进行对比,检查 代码文件是否 被更新,如果更新 则将 部分更新按钮 有效
|
114 |
|
|
//
|
115 |
|
|
// 部分更新按钮初始化后不可用,待线程启用后,检测到文件可更新时,再可用
|
116 |
|
|
ToolWindow * pparent = static_cast<ToolWindow*>(toolWindow) ;
|
117 |
|
|
EziDebugPrj* prj ;
|
118 |
|
|
if(prj = const_cast<EziDebugPrj*>(pparent->getCurrentProject()))
|
119 |
|
|
{
|
120 |
|
|
/*检查所需工程文件是否存在 0:存在 1:不存在*/
|
121 |
|
|
|
122 |
|
|
if(!prj->isPrjFileExist())
|
123 |
|
|
{
|
124 |
|
|
addMessage("error",tr("EziDebug error: There is no Project file in the default path:%1").arg(prj->getCurrentDir().absolutePath()));
|
125 |
|
|
delete prj ;
|
126 |
|
|
pparent->setCurrentProject(NULL);
|
127 |
|
|
}
|
128 |
|
|
else
|
129 |
|
|
{
|
130 |
|
|
// 检测log文件是否存在
|
131 |
|
|
if(prj->getCurrentDir().exists("config.ezi"))
|
132 |
|
|
{
|
133 |
|
|
prj->setLogFileExistFlag(true);
|
134 |
|
|
|
135 |
|
|
prj->setLogFileName(prj->getCurrentDir().absoluteFilePath("config.ezi")) ;
|
136 |
|
|
|
137 |
|
|
/*检查保存的log文件是否ok 并恢复log文件中的扫描链信息,用于检测要扫描的工程是否被修改导致扫描链被破坏,提取所有信息*/
|
138 |
|
|
if(prj->detectLogFile(READ_MODULE_INFO|READ_FILE_INFO|READ_CHAIN_INFO))
|
139 |
|
|
{
|
140 |
|
|
// do nothing until the toolwindow show!!
|
141 |
|
|
// listwindow will show infomation after toolwindow show!
|
142 |
|
|
}
|
143 |
|
|
else
|
144 |
|
|
{
|
145 |
|
|
prj->clearupCheckedChainList();
|
146 |
|
|
prj->clearupDestroyedChainList();
|
147 |
|
|
// 对所有改动过的文件(文件时间不一致、文件增、删)进行扫描
|
148 |
|
|
if(EziDebugPrj::ToolQuartus == prj->getToolType())
|
149 |
|
|
{
|
150 |
|
|
prj->parseQuartusPrjFile(ifileList);
|
151 |
|
|
}
|
152 |
|
|
else if(EziDebugPrj::ToolIse == prj->getToolType())
|
153 |
|
|
{
|
154 |
|
|
prj->parseIsePrjFile(ifileList);
|
155 |
|
|
}
|
156 |
|
|
else
|
157 |
|
|
{
|
158 |
|
|
addMessage("error","EziDebug error: EziDebug is not support this kind project file parse!");
|
159 |
|
|
delete prj ;
|
160 |
|
|
pparent->setCurrentProject(NULL);
|
161 |
|
|
}
|
162 |
|
|
|
163 |
|
|
QStringList iaddFileList ;
|
164 |
|
|
QStringList idelFileList ;
|
165 |
|
|
QStringList ichgFileList ;
|
166 |
|
|
|
167 |
|
|
QList<EziDebugPrj::LOG_FILE_INFO*> iaddedinfoList ;
|
168 |
|
|
QList<EziDebugPrj::LOG_FILE_INFO*> ideletedinfoList ;
|
169 |
|
|
|
170 |
|
|
ifileList.sort();
|
171 |
|
|
|
172 |
|
|
prj->compareFileList(ifileList,iaddFileList,idelFileList,ichgFileList);
|
173 |
|
|
|
174 |
|
|
if(prj->updatePrjAllFile(iaddFileList,idelFileList,ichgFileList,iaddedinfoList,ideletedinfoList,false))
|
175 |
|
|
{
|
176 |
|
|
delete prj ;
|
177 |
|
|
pparent->setCurrentProject(NULL);
|
178 |
|
|
qDeleteAll(iaddedinfoList);
|
179 |
|
|
qDeleteAll(ideletedinfoList);
|
180 |
|
|
}
|
181 |
|
|
else
|
182 |
|
|
{
|
183 |
|
|
// store to macro
|
184 |
|
|
prj->addToMacroMap();
|
185 |
|
|
|
186 |
|
|
QString itopModule = prj->getTopModule() ;
|
187 |
|
|
|
188 |
|
|
QString itopModuleComboName = itopModule + QObject::tr(":")+ itopModule ;
|
189 |
|
|
EziDebugInstanceTreeItem* pnewHeadItem = new EziDebugInstanceTreeItem(itopModule,itopModule);
|
190 |
|
|
if(!pnewHeadItem)
|
191 |
|
|
{
|
192 |
|
|
addMessage("error","EziDebug error: There is no memory left!");
|
193 |
|
|
delete prj ;
|
194 |
|
|
pparent->setCurrentProject(NULL);
|
195 |
|
|
}
|
196 |
|
|
else
|
197 |
|
|
{
|
198 |
|
|
if(!itopModule.isEmpty())
|
199 |
|
|
{
|
200 |
|
|
if(prj->getScanChainInfo().count())
|
201 |
|
|
{
|
202 |
|
|
// 通过备份 进行还原
|
203 |
|
|
prj->backupChainMap();
|
204 |
|
|
prj->cleanupBakChainTreeItemMap();
|
205 |
|
|
prj->cleanupChainTreeItemMap();
|
206 |
|
|
}
|
207 |
|
|
// set the headitem
|
208 |
|
|
prj->setInstanceTreeHeadItem(pnewHeadItem) ;
|
209 |
|
|
if(prj->traverseModuleTree(itopModuleComboName,pnewHeadItem))
|
210 |
|
|
{
|
211 |
|
|
qDebug() << tr("从log文件恢复失败") << __FILE__ << __LINE__ ;
|
212 |
|
|
addMessage("error","EziDebug error: resume data failed from EziDebug config file!");
|
213 |
|
|
|
214 |
|
|
prj->resumeChainMap();
|
215 |
|
|
prj->updateOperation(EziDebugPrj::OperateTypeNone,NULL,NULL);
|
216 |
|
|
delete pnewHeadItem ;
|
217 |
|
|
delete prj ;
|
218 |
|
|
pparent->setCurrentProject(NULL);
|
219 |
|
|
qDeleteAll(iaddedinfoList);
|
220 |
|
|
qDeleteAll(ideletedinfoList);
|
221 |
|
|
//return ;
|
222 |
|
|
}
|
223 |
|
|
else
|
224 |
|
|
{
|
225 |
|
|
|
226 |
|
|
if(prj->getBackupChainMap().count())
|
227 |
|
|
{
|
228 |
|
|
prj->resumeChainMap();
|
229 |
|
|
prj->resumeChainTreeItemMap();
|
230 |
|
|
// 用于清空 备份的 map
|
231 |
|
|
prj->updateOperation(EziDebugPrj::OperateTypeNone,NULL,NULL);
|
232 |
|
|
}
|
233 |
|
|
|
234 |
|
|
|
235 |
|
|
EziDebugInstanceTreeItem::setProject(prj);
|
236 |
|
|
|
237 |
|
|
if(prj->changedLogFile(iaddedinfoList,ideletedinfoList))
|
238 |
|
|
{
|
239 |
|
|
//提示 保存 log 文件出错
|
240 |
|
|
addMessage("info","EziDebug info: changedLogFile encounter some problem!");
|
241 |
|
|
}
|
242 |
|
|
|
243 |
|
|
// 删除 新分配的 log_file_info 指针
|
244 |
|
|
qDeleteAll(iaddedinfoList);
|
245 |
|
|
qDeleteAll(ideletedinfoList);
|
246 |
|
|
|
247 |
|
|
m_peziDebugTreeModel = new EziDebugTreeModel(pnewHeadItem,this);
|
248 |
|
|
moduleTreeView->setModel(m_peziDebugTreeModel);
|
249 |
|
|
|
250 |
|
|
// welcomeinfoinit(prj);
|
251 |
|
|
#if 0
|
252 |
|
|
QStringList iunexistChainList = prj->checkChainExist();
|
253 |
|
|
if(iunexistChainList.count())
|
254 |
|
|
{
|
255 |
|
|
addMessage("warning","EziDebug warning: Some chains lost partly or full for some reasons!");
|
256 |
|
|
for(int i = 0 ; i < iunexistChainList.count() ;i++)
|
257 |
|
|
{
|
258 |
|
|
addMessage("warning",tr("EziDebug chain:%1").arg(iunexistChainList.at(i)));
|
259 |
|
|
}
|
260 |
|
|
}
|
261 |
|
|
|
262 |
|
|
if(prj->getDestroyedChainList().count())
|
263 |
|
|
{
|
264 |
|
|
// 把所有破坏掉的链打印出来
|
265 |
|
|
|
266 |
|
|
QString ichain ;
|
267 |
|
|
QStringList idestroyedChainList = prj->getDestroyedChainList() ;
|
268 |
|
|
|
269 |
|
|
addMessage("warning","The destroyed chain are:");
|
270 |
|
|
for(int i = 0 ; i < idestroyedChainList.count() ;i++)
|
271 |
|
|
{
|
272 |
|
|
QString ichainName = idestroyedChainList.at(i) ;
|
273 |
|
|
|
274 |
|
|
EziDebugInstanceTreeItem *pitem = prj->getChainTreeItemMap().value(ichainName);
|
275 |
|
|
if(pitem)
|
276 |
|
|
{
|
277 |
|
|
ichain.append(tr("EziDebug chain: %1 topInstance: %2:%3").arg(ichainName)\
|
278 |
|
|
.arg(pitem->getModuleName()).arg(pitem->getInstanceName())) ;
|
279 |
|
|
}
|
280 |
|
|
addMessage("warning",ichain);
|
281 |
|
|
}
|
282 |
|
|
|
283 |
|
|
// 扫描链被破坏 ,提示删除 部分扫描链被破坏 是否删除相关扫描链代码,否则相应扫描链不可用!
|
284 |
|
|
QMessageBox::StandardButton rb = QMessageBox::question(this, tr("部分扫描链被破坏"), tr("相关扫描链不可用,是否删除相关扫描链代码?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
285 |
|
|
if(rb == QMessageBox::Yes)
|
286 |
|
|
{
|
287 |
|
|
QStringList iunDelChainList = prj->deleteDestroyedChain() ;
|
288 |
|
|
if(iunDelChainList.count())
|
289 |
|
|
{
|
290 |
|
|
addMessage("error","EziDebug error: Some chains do not be deleted for some reasons!");
|
291 |
|
|
for(int i = 0 ; i < iunDelChainList.count() ;i++)
|
292 |
|
|
{
|
293 |
|
|
addMessage("error",tr("EziDebug chain:%1").arg(iunDelChainList.at(i)));
|
294 |
|
|
}
|
295 |
|
|
addMessage("error","EziDebug error: Please check the code file is compiled successed!");
|
296 |
|
|
}
|
297 |
|
|
|
298 |
|
|
for(int i = 0 ; i < idestroyedChainList.count() ; i++)
|
299 |
|
|
{
|
300 |
|
|
QString idestroyedChain = idestroyedChainList.at(i) ;
|
301 |
|
|
if(!iunDelChainList.contains(idestroyedChain))
|
302 |
|
|
{
|
303 |
|
|
struct EziDebugPrj::LOG_FILE_INFO* pdelChainInfo = new EziDebugPrj::LOG_FILE_INFO ;
|
304 |
|
|
memcpy(pdelChainInfo->ainfoName,idestroyedChain.toAscii().data(),idestroyedChain.size()+1);
|
305 |
|
|
pdelChainInfo->pinfo = NULL ;
|
306 |
|
|
pdelChainInfo->etype = EziDebugPrj::infoTypeScanChainStructure ;
|
307 |
|
|
ideletedinfoList << pdelChainInfo ;
|
308 |
|
|
}
|
309 |
|
|
|
310 |
|
|
}
|
311 |
|
|
|
312 |
|
|
}
|
313 |
|
|
|
314 |
|
|
}
|
315 |
|
|
|
316 |
|
|
|
317 |
|
|
#if 0
|
318 |
|
|
if(prj->getScanChainInfo().count())
|
319 |
|
|
{
|
320 |
|
|
QMap<QString,EziDebugScanChain*>::const_iterator iaddedChainIter = prj->getScanChainInfo().constBegin() ;
|
321 |
|
|
while(iaddedChainIter != prj->getScanChainInfo().constEnd())
|
322 |
|
|
{
|
323 |
|
|
QString ichainName = iaddedChainIter.key();
|
324 |
|
|
struct EziDebugPrj::LOG_FILE_INFO* pinfo = new EziDebugPrj::LOG_FILE_INFO ;
|
325 |
|
|
memcpy(pinfo->ainfoName ,ichainName.toAscii().data(),ichainName.size()+1);
|
326 |
|
|
pinfo->pinfo = iaddedChainIter.value() ;
|
327 |
|
|
pinfo->etype = EziDebugPrj::infoTypeScanChainStructure ;
|
328 |
|
|
iaddedinfoList << pinfo ;
|
329 |
|
|
++iaddedChainIter ;
|
330 |
|
|
}
|
331 |
|
|
}
|
332 |
|
|
#endif
|
333 |
|
|
|
334 |
|
|
if(prj->changedLogFile(iaddedinfoList,ideletedinfoList))
|
335 |
|
|
{
|
336 |
|
|
//提示 保存 log 文件出错
|
337 |
|
|
addMessage("info","EziDebug info: changedLogFile encounter some problem!");
|
338 |
|
|
}
|
339 |
|
|
|
340 |
|
|
|
341 |
|
|
// 删除 新分配的 log_file_info 指针
|
342 |
|
|
|
343 |
|
|
qDeleteAll(iaddedinfoList);
|
344 |
|
|
qDeleteAll(ideletedinfoList);
|
345 |
|
|
|
346 |
|
|
QStandardItem * pitem = addMessage("info",tr("EziDebug info: The default project parameter:"));
|
347 |
|
|
addMessage("process",tr(" Scanchain Max Reg Number: %1").arg(prj->getMaxRegNumPerChain()),pitem);
|
348 |
|
|
addMessage("process",tr(" Project Path: %1").arg(prj->getCurrentDir().absolutePath()),pitem);
|
349 |
|
|
addMessage("process",tr(" Compile Software: \"%1\"").arg((prj->getToolType() == EziDebugPrj::ToolQuartus) ? ("quartus") :("ise")),pitem);
|
350 |
|
|
|
351 |
|
|
if(prj->getChainTreeItemMap().count())
|
352 |
|
|
{
|
353 |
|
|
QStandardItem * psecondItem = addMessage("info"," EziDebug info: The complete chain are:",pitem);
|
354 |
|
|
QMap<QString,EziDebugInstanceTreeItem*> itreeItemMap = prj->getChainTreeItemMap() ;
|
355 |
|
|
QMap<QString,EziDebugInstanceTreeItem*>::const_iterator i = itreeItemMap.constBegin() ;
|
356 |
|
|
while( i!= itreeItemMap.constEnd())
|
357 |
|
|
{
|
358 |
|
|
EziDebugInstanceTreeItem* pitem = i.value();
|
359 |
|
|
addMessage("process",tr(" EziDebug chain: %1\tInstance Node:%2").arg(i.key()).arg(pitem->getNameData()),psecondItem);
|
360 |
|
|
EziDebugScanChain *pscanChain = pitem->getScanChainInfo();
|
361 |
|
|
QString iclockNumStr ;
|
362 |
|
|
QString itraversedInstStr ;
|
363 |
|
|
QMap<QString,QVector<QStringList> > iregChain = pscanChain->getRegChain();
|
364 |
|
|
QMap<QString,QVector<QStringList> >::const_iterator iregChainIter = iregChain.constBegin() ;
|
365 |
|
|
while( iregChainIter != iregChain.constEnd())
|
366 |
|
|
{
|
367 |
|
|
iclockNumStr.append(tr("%1 (%2) ").arg(pscanChain->getChainRegCount(iregChainIter.key())).arg(iregChainIter.key()));
|
368 |
|
|
++iregChainIter ;
|
369 |
|
|
}
|
370 |
|
|
|
371 |
|
|
addMessage("process" , tr(" The chain total reg number: %1").arg(iclockNumStr),psecondItem);
|
372 |
|
|
addMessage("process" , tr(" The traversed NodeList:"),psecondItem);
|
373 |
|
|
|
374 |
|
|
for(int j = 0 ; j < pscanChain->getInstanceItemList().count() ;j++)
|
375 |
|
|
{
|
376 |
|
|
itraversedInstStr.append(tr(" -> ") + pscanChain->getInstanceItemList().at(j)) ;
|
377 |
|
|
if((j+1)%3 == 0)
|
378 |
|
|
{
|
379 |
|
|
addMessage("process" , tr(" ") + itraversedInstStr,psecondItem);
|
380 |
|
|
itraversedInstStr.clear();
|
381 |
|
|
}
|
382 |
|
|
}
|
383 |
|
|
addMessage("process" , tr(" ") + itraversedInstStr,psecondItem);
|
384 |
|
|
|
385 |
|
|
++i ;
|
386 |
|
|
}
|
387 |
|
|
}
|
388 |
|
|
|
389 |
|
|
|
390 |
|
|
UpdateDetectThread * pthread = prj->getThread() ;
|
391 |
|
|
pthread->start();
|
392 |
|
|
#endif
|
393 |
|
|
}
|
394 |
|
|
}
|
395 |
|
|
else
|
396 |
|
|
{
|
397 |
|
|
addMessage("error","EziDebug error: There is no top module definition!");
|
398 |
|
|
delete pnewHeadItem ;
|
399 |
|
|
delete prj ;
|
400 |
|
|
pparent->setCurrentProject(NULL);
|
401 |
|
|
}
|
402 |
|
|
}
|
403 |
|
|
}
|
404 |
|
|
}
|
405 |
|
|
|
406 |
|
|
}
|
407 |
|
|
else
|
408 |
|
|
{
|
409 |
|
|
/*向文本栏 传递错误信息 默认路径不存在log文件*/
|
410 |
|
|
addMessage("warning","EziDebug warning: There is no EziDebug config File !");
|
411 |
|
|
delete prj ;
|
412 |
|
|
pparent->setCurrentProject(NULL);
|
413 |
|
|
}
|
414 |
|
|
}
|
415 |
|
|
}
|
416 |
|
|
else
|
417 |
|
|
{
|
418 |
|
|
addMessage("info",tr("EziDebug info: There is no default EziDebug project file!"));
|
419 |
|
|
moduleTreeView->setModel(NULL);
|
420 |
|
|
}
|
421 |
|
|
|
422 |
|
|
// //创建状态栏
|
423 |
|
|
// //m_pStatuBar = new StatuBar(this);
|
424 |
|
|
|
425 |
|
|
//创建布局
|
426 |
|
|
//QHBoxLayout *secondLayout = new QHBoxLayout(this);
|
427 |
|
|
QVBoxLayout *mainLayout = new QVBoxLayout(this) ;
|
428 |
|
|
//将部件加入到布局中
|
429 |
|
|
mainLayout->addWidget(titleBar);
|
430 |
|
|
//mainLayout->addWidget(closeButton);
|
431 |
|
|
//secondLayout->addStretch(1);
|
432 |
|
|
//secondLayout->addWidget(closeButton);
|
433 |
|
|
//mainLayout->addLayout(secondLayout);
|
434 |
|
|
mainLayout->addWidget(mainSplitter);
|
435 |
|
|
|
436 |
|
|
//mainLayout->addWidget(m_pStatuBar);
|
437 |
|
|
|
438 |
|
|
|
439 |
|
|
// mainSplitter->setStyleSheet("Splitter{margin-left:8px;margin-right:6px;margin-top:6px;margin-bottom:10px;}");
|
440 |
|
|
mainSplitter->setStyleSheet("Splitter{margin-left:6px;margin-right:6px;margin-top:3px;margin-bottom:10px;}");
|
441 |
|
|
//设置间距与边缘空白
|
442 |
|
|
mainLayout->setSpacing(0);
|
443 |
|
|
mainLayout->setContentsMargins(0,0,0,0);
|
444 |
|
|
// mainLayout->setGeometry(QRect(this->geometry().left(),this->geometry().top(),100,100));
|
445 |
|
|
setLayout(mainLayout);
|
446 |
|
|
|
447 |
|
|
|
448 |
|
|
|
449 |
|
|
//设置列表窗口的背景
|
450 |
|
|
setAutoFillBackground(true);
|
451 |
|
|
//设置调色板
|
452 |
|
|
listBackground.load(":/images/listBackground.bmp",//4.jpg",
|
453 |
|
|
0,Qt::AvoidDither|Qt::ThresholdDither|Qt::ThresholdAlphaDither);
|
454 |
|
|
QPalette palette;
|
455 |
|
|
palette.setBrush(QPalette::Background, QBrush(listBackground));//竖条纹背景对应这QBrush(listBackground.copy(0, 0, 850, 480))
|
456 |
|
|
// palette.setBrush(QPalette::Window,
|
457 |
|
|
// QBrush(listBackground.scaled(size(), Qt::IgnoreAspectRatio,
|
458 |
|
|
// Qt::SmoothTransformation)));
|
459 |
|
|
setPalette(palette);
|
460 |
|
|
// setGeometry(QRect(toolWindow->frameGeometry().bottomLeft().rx(),
|
461 |
|
|
// toolWindow->frameGeometry().bottomLeft().ry(),
|
462 |
|
|
// 290, 105));
|
463 |
|
|
//setGeometry(QRect(100, 100, 290, 105));
|
464 |
|
|
resize(listBackground.size());
|
465 |
|
|
|
466 |
|
|
//isListWindowAdsorbedFlag = true;//初始状态下,ListWindow吸附在toolWindow下方
|
467 |
|
|
|
468 |
|
|
//设置掩板
|
469 |
|
|
//生成一张位图
|
470 |
|
|
QBitmap objBitmap(size());
|
471 |
|
|
//QPainter用于在位图上绘画
|
472 |
|
|
QPainter painter(&objBitmap);
|
473 |
|
|
//填充位图矩形框(用白色填充)
|
474 |
|
|
painter.fillRect(rect(),Qt::white);
|
475 |
|
|
painter.setBrush(QColor(0,0,0));
|
476 |
|
|
//在位图上画圆角矩形(用黑色填充)
|
477 |
|
|
painter.drawRoundedRect(this->rect(),4,4);
|
478 |
|
|
//使用setmask过滤即可
|
479 |
|
|
setMask(objBitmap);
|
480 |
|
|
|
481 |
|
|
|
482 |
|
|
//设置为无边框
|
483 |
|
|
//setWindowFlags(Qt::FramelessWindowHint);
|
484 |
|
|
//设置窗口的最大尺寸(桌面)和最小尺寸(图片的尺寸)
|
485 |
|
|
setMinimumSize(listBackground.size());
|
486 |
|
|
setMaximumSize(qApp->desktop()->size());
|
487 |
|
|
//setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
|
488 |
|
|
isMaxWin = false; //初始状态下不是最大化的窗口
|
489 |
|
|
//isDrag = true ;
|
490 |
|
|
isDrag = false ;
|
491 |
|
|
isStick = false ;
|
492 |
|
|
|
493 |
|
|
|
494 |
|
|
//放大,方便调试
|
495 |
|
|
// resize(291,106);
|
496 |
|
|
|
497 |
|
|
|
498 |
|
|
//设置普通模式下的按键
|
499 |
|
|
//exitButton->setGeometry(QRect(273, 4, 11, 10));
|
500 |
|
|
//menuBar->setGeometry(1, 18, 273, 18);//1, 18, 274, 34
|
501 |
|
|
//titleBar->setGeometry(0,0,290,17);
|
502 |
|
|
qDebug()<< this->hasMouseTracking();
|
503 |
|
|
}
|
504 |
|
|
|
505 |
|
|
ListWindow::~ListWindow()
|
506 |
|
|
{
|
507 |
|
|
qDebug() << "Attention: Begin destruct listwindow object!";
|
508 |
|
|
if(m_peziDebugTreeModel)
|
509 |
|
|
delete m_peziDebugTreeModel ;
|
510 |
|
|
|
511 |
|
|
}
|
512 |
|
|
|
513 |
|
|
QStandardItem *ListWindow::addMessage(const QString &type ,const QString &message ,QStandardItem *parentitem)
|
514 |
|
|
{
|
515 |
|
|
if(!m_iShowMessageModel)
|
516 |
|
|
{
|
517 |
|
|
return NULL ;
|
518 |
|
|
}
|
519 |
|
|
QStandardItem* pparentItem ;
|
520 |
|
|
QStandardItem* piconItem ;
|
521 |
|
|
QStandardItem* pstrItem ;
|
522 |
|
|
QList<QStandardItem*> iitemList ;
|
523 |
|
|
|
524 |
|
|
if(!parentitem)
|
525 |
|
|
{
|
526 |
|
|
pparentItem = m_iShowMessageModel->invisibleRootItem() ;
|
527 |
|
|
}
|
528 |
|
|
else
|
529 |
|
|
{
|
530 |
|
|
pparentItem = parentitem ;
|
531 |
|
|
}
|
532 |
|
|
|
533 |
|
|
if(type.toLower() == "warning")
|
534 |
|
|
{
|
535 |
|
|
QIcon iwarning(":/images/warning");
|
536 |
|
|
piconItem = new QStandardItem(iwarning,"");
|
537 |
|
|
pstrItem = new QStandardItem(message);
|
538 |
|
|
//pstrItem->setForeground(QBrush(QColor(22,130,54)));
|
539 |
|
|
pstrItem->setForeground(QBrush(QColor(21,255,21)));
|
540 |
|
|
pstrItem->setFont(QFont("Times", 10 , QFont::Bold));
|
541 |
|
|
}
|
542 |
|
|
else if(type.toLower() == "info")
|
543 |
|
|
{
|
544 |
|
|
QIcon iinfo(":/images/info");
|
545 |
|
|
piconItem = new QStandardItem(iinfo,"");
|
546 |
|
|
pstrItem = new QStandardItem(message);
|
547 |
|
|
pstrItem->setFont(QFont("Times", 10 , QFont::Black));
|
548 |
|
|
}
|
549 |
|
|
else if(type.toLower() == "error")
|
550 |
|
|
{
|
551 |
|
|
QIcon ierror(":/images/error");
|
552 |
|
|
piconItem = new QStandardItem(ierror,"");
|
553 |
|
|
pstrItem = new QStandardItem(message);
|
554 |
|
|
pstrItem->setForeground(QBrush(QColor(255,0,0)));
|
555 |
|
|
pstrItem->setFont(QFont("Times", 10 , QFont::Normal));
|
556 |
|
|
}
|
557 |
|
|
else if(type.toLower() == "process")
|
558 |
|
|
{
|
559 |
|
|
QIcon iok(":/images/ok");
|
560 |
|
|
piconItem = new QStandardItem(iok,"");
|
561 |
|
|
pstrItem = new QStandardItem(message);
|
562 |
|
|
pstrItem->setForeground(QBrush(QColor(0,0,255)));
|
563 |
|
|
pstrItem->setFont(QFont("Times", 10 , QFont::Normal));
|
564 |
|
|
}
|
565 |
|
|
else if(type.toLower() == "welcome")
|
566 |
|
|
{
|
567 |
|
|
QIcon iok1(":/images/ok_1");
|
568 |
|
|
piconItem = new QStandardItem(iok1,"");
|
569 |
|
|
pstrItem = new QStandardItem(message);
|
570 |
|
|
pstrItem->setFont(QFont("Times", 10 , QFont::Bold));
|
571 |
|
|
}
|
572 |
|
|
else
|
573 |
|
|
{
|
574 |
|
|
QIcon iinfo(":/images/info");
|
575 |
|
|
piconItem = new QStandardItem(iinfo,"");
|
576 |
|
|
pstrItem = new QStandardItem(message);
|
577 |
|
|
pstrItem->setFont(QFont("Times", 10 , QFont::Black));
|
578 |
|
|
}
|
579 |
|
|
|
580 |
|
|
iitemList << piconItem << pstrItem ;
|
581 |
|
|
pparentItem->appendRow(iitemList);
|
582 |
|
|
|
583 |
|
|
|
584 |
|
|
return pparentItem->child((pparentItem->rowCount()-1),0) ;
|
585 |
|
|
}
|
586 |
|
|
|
587 |
|
|
|
588 |
|
|
//获取ToolWindow的指针,以获取其位置等信息
|
589 |
|
|
void ListWindow::getToolWindowPointer(QWidget *toolWin)
|
590 |
|
|
{
|
591 |
|
|
toolWindow = toolWin;
|
592 |
|
|
}
|
593 |
|
|
|
594 |
|
|
void ListWindow::createButtons()
|
595 |
|
|
{
|
596 |
|
|
|
597 |
|
|
// exitButton = createToolButton(tr("退出"),
|
598 |
|
|
// QIcon(":/images/ListWindowExit.bmp"),
|
599 |
|
|
// QSize(11, 10),
|
600 |
|
|
// SLOT(close()));
|
601 |
|
|
|
602 |
|
|
}
|
603 |
|
|
|
604 |
|
|
void ListWindow::createActions()
|
605 |
|
|
{
|
606 |
|
|
proSettingWizardAct = new QAction(tr("工程设置向导"), this);
|
607 |
|
|
//normalAct->setShortcuts(QKeySequence::Quit);
|
608 |
|
|
//normalAct->setStatusTip(tr("Exit the application"));
|
609 |
|
|
connect(proSettingWizardAct, SIGNAL(triggered()), this, SLOT(proSetting()));
|
610 |
|
|
|
611 |
|
|
setProPathAct = new QAction(tr("工程目录"), this);
|
612 |
|
|
connect(setProPathAct, SIGNAL(triggered()), this, SLOT(proUpdate()));
|
613 |
|
|
|
614 |
|
|
setRegNumACt = new QAction(tr("设置寄存器个数"), this);
|
615 |
|
|
connect(setRegNumACt, SIGNAL(triggered()), this, SLOT(proUpdate()));
|
616 |
|
|
|
617 |
|
|
useVerilogAct = new QAction(tr("使用verilog语言"), this);
|
618 |
|
|
useVerilogAct->setCheckable(true);
|
619 |
|
|
//useVerilogAct->setChecked(spreadsheet->showGrid());
|
620 |
|
|
connect(useVerilogAct, SIGNAL(triggered()), this, SLOT(proUpdate()));
|
621 |
|
|
|
622 |
|
|
useVHDLAct = new QAction(tr("使用VHDL语言"), this);
|
623 |
|
|
useVHDLAct->setCheckable(true);
|
624 |
|
|
//useVerilogAct->setChecked(spreadsheet->showGrid());
|
625 |
|
|
connect(useVHDLAct, SIGNAL(triggered()), this, SLOT(proUpdate()));
|
626 |
|
|
|
627 |
|
|
useMixeLanguagedAct = new QAction(tr("使用verilong和VHDL语言"), this);
|
628 |
|
|
useMixeLanguagedAct->setCheckable(true);
|
629 |
|
|
//useVerilogAct->setChecked(spreadsheet->showGrid());
|
630 |
|
|
connect(useMixeLanguagedAct, SIGNAL(triggered()), this, SLOT(proUpdate()));
|
631 |
|
|
|
632 |
|
|
setSlotAct = new QAction(tr("设置计时器的时钟"), this);
|
633 |
|
|
connect(setSlotAct, SIGNAL(triggered()), this, SLOT(proUpdate()));
|
634 |
|
|
|
635 |
|
|
useAlteraAct = new QAction(tr("使用Altera"), this);
|
636 |
|
|
useAlteraAct->setCheckable(true);
|
637 |
|
|
//useVerilogAct->setChecked(spreadsheet->showGrid());
|
638 |
|
|
connect(useAlteraAct, SIGNAL(triggered()), this, SLOT(proUpdate()));
|
639 |
|
|
|
640 |
|
|
useXilinxAct = new QAction(tr("使用Xilinx"), this);
|
641 |
|
|
useXilinxAct->setCheckable(true);
|
642 |
|
|
//useVerilogAct->setChecked(spreadsheet->showGrid());
|
643 |
|
|
connect(useXilinxAct, SIGNAL(triggered()), this, SLOT(proUpdate()));
|
644 |
|
|
|
645 |
|
|
exitAct = new QAction(tr("退出"), this);
|
646 |
|
|
exitAct->setShortcuts(QKeySequence::Quit);
|
647 |
|
|
//exitAct->setStatusTip(tr("退出"));
|
648 |
|
|
connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
|
649 |
|
|
|
650 |
|
|
|
651 |
|
|
rankAfterFileNameAct = new QAction(tr("按文件名"), this);
|
652 |
|
|
connect(rankAfterFileNameAct, SIGNAL(triggered()), this, SLOT(proUpdate()));
|
653 |
|
|
|
654 |
|
|
rankAfterPathNameAct = new QAction(tr("按路径名"), this);
|
655 |
|
|
connect(rankAfterPathNameAct, SIGNAL(triggered()), this, SLOT(proUpdate()));
|
656 |
|
|
|
657 |
|
|
|
658 |
|
|
fastOrientAct = new QAction(tr("快速定位"), this);
|
659 |
|
|
connect(fastOrientAct, SIGNAL(triggered()), this, SLOT(proUpdate()));
|
660 |
|
|
|
661 |
|
|
findAct = new QAction(tr("查找"), this);
|
662 |
|
|
//connect(findAct, SIGNAL(triggered()), this, SLOT());
|
663 |
|
|
connect(findAct, SIGNAL(triggered()), this, SLOT(find()));
|
664 |
|
|
|
665 |
|
|
findNextAct = new QAction(tr("查找下一个"), this);
|
666 |
|
|
connect(findNextAct, SIGNAL(triggered()), this, SLOT(proUpdate()));
|
667 |
|
|
|
668 |
|
|
|
669 |
|
|
aboutEziDebugAct = new QAction(tr("关于..."), this);
|
670 |
|
|
connect(aboutEziDebugAct, SIGNAL(triggered()), this, SLOT(about()));
|
671 |
|
|
|
672 |
|
|
helpFileAct = new QAction(tr("帮助"), this);
|
673 |
|
|
connect(helpFileAct, SIGNAL(triggered()), this, SLOT(proUpdate()));
|
674 |
|
|
}
|
675 |
|
|
|
676 |
|
|
void ListWindow::createMenus()
|
677 |
|
|
{
|
678 |
|
|
menuBar = new MenuBar(this);
|
679 |
|
|
|
680 |
|
|
addMenu = menuBar->addMenu(tr("添加"));
|
681 |
|
|
addMenu->addAction(proSettingWizardAct);
|
682 |
|
|
addMenu->addAction(setProPathAct);
|
683 |
|
|
addMenu->addAction(setRegNumACt);
|
684 |
|
|
addMenu->addSeparator();
|
685 |
|
|
addMenu->addAction(useVerilogAct);
|
686 |
|
|
addMenu->addAction(useVHDLAct);
|
687 |
|
|
addMenu->addAction(useMixeLanguagedAct);
|
688 |
|
|
addMenu->addSeparator();
|
689 |
|
|
addMenu->addAction(setSlotAct);
|
690 |
|
|
addMenu->addSeparator();
|
691 |
|
|
addMenu->addAction(useAlteraAct);
|
692 |
|
|
addMenu->addAction(useXilinxAct);
|
693 |
|
|
addMenu->addSeparator();
|
694 |
|
|
addMenu->addAction(exitAct);
|
695 |
|
|
|
696 |
|
|
checkMenu = menuBar->addMenu(tr("查看"));
|
697 |
|
|
|
698 |
|
|
sortMenu = menuBar->addMenu(tr("排序"));
|
699 |
|
|
sortMenu->addAction(rankAfterFileNameAct);
|
700 |
|
|
sortMenu->addAction(rankAfterPathNameAct);
|
701 |
|
|
|
702 |
|
|
findMenu = menuBar->addMenu(tr("查找"));
|
703 |
|
|
findMenu->addAction(fastOrientAct);
|
704 |
|
|
findMenu->addSeparator();
|
705 |
|
|
findMenu->addAction(findAct);
|
706 |
|
|
findMenu->addAction(findNextAct);
|
707 |
|
|
|
708 |
|
|
helpMenu = menuBar->addMenu(tr("帮助"));
|
709 |
|
|
helpMenu->addAction(aboutEziDebugAct);
|
710 |
|
|
helpMenu->addAction(helpFileAct);
|
711 |
|
|
|
712 |
|
|
// //获取图像
|
713 |
|
|
// QPixmap objPixmap(tr(":/images/listWindowMenubar.bmp"));
|
714 |
|
|
// //得到图像宽和高
|
715 |
|
|
// int nPixWidth = objPixmap.width() / 5;
|
716 |
|
|
// int nPixHeight = objPixmap.height();
|
717 |
|
|
// addMenu->setIcon(QIcon(objPixmap.copy(nPixWidth*0,0,nPixWidth,nPixHeight)));
|
718 |
|
|
// checkMenu->setIcon(QIcon(objPixmap.copy(nPixWidth*1,0,nPixWidth,nPixHeight)));
|
719 |
|
|
// sortMenu->setIcon(QIcon(objPixmap.copy(nPixWidth*2,0,nPixWidth,nPixHeight)));
|
720 |
|
|
// findMenu->setIcon(QIcon(objPixmap.copy(nPixWidth*3,0,nPixWidth,nPixHeight)));
|
721 |
|
|
// helpMenu->setIcon(QIcon(objPixmap.copy(nPixWidth*4,0,nPixWidth,nPixHeight)));
|
722 |
|
|
|
723 |
|
|
// addMenu->setContentsMargins(0,0,0,0);
|
724 |
|
|
// //addMenu->setBaseSize(QSize(nPixWidth,nPixHeight));
|
725 |
|
|
// //addMenu->setSizeIncrement(nPixWidth,nPixHeight);
|
726 |
|
|
// addMenu->setFixedSize(nPixWidth,nPixHeight);
|
727 |
|
|
|
728 |
|
|
|
729 |
|
|
}
|
730 |
|
|
|
731 |
|
|
//void ListWindow::contextMenuEvent(QContextMenuEvent *event)
|
732 |
|
|
//{
|
733 |
|
|
// QMenu menu(this);
|
734 |
|
|
// menu.addAction(ListWindowmizeAct);
|
735 |
|
|
// menu.addAction(normalAct);
|
736 |
|
|
// menu.addAction(exitAct);
|
737 |
|
|
// menu.exec(event->globalPos());
|
738 |
|
|
//}
|
739 |
|
|
|
740 |
|
|
|
741 |
|
|
|
742 |
|
|
|
743 |
|
|
|
744 |
|
|
|
745 |
|
|
//void ListWindow::mousePressEvent(QMouseEvent * event)
|
746 |
|
|
//{
|
747 |
|
|
// if (event->button() == Qt::LeftButton) //点击左边鼠标
|
748 |
|
|
// {
|
749 |
|
|
// //globalPos()获取根窗口的相对路径,frameGeometry().topLeft()获取主窗口左上角的位置
|
750 |
|
|
// dragPosition = event->globalPos() - frameGeometry().topLeft();
|
751 |
|
|
// event->accept(); //鼠标事件被系统接收
|
752 |
|
|
// }
|
753 |
|
|
// // if (event->button() == Qt::RightButton)
|
754 |
|
|
// // {
|
755 |
|
|
// // close();
|
756 |
|
|
// // }
|
757 |
|
|
//}
|
758 |
|
|
|
759 |
|
|
//void ListWindow::mouseMoveEvent(QMouseEvent * event)
|
760 |
|
|
//{
|
761 |
|
|
// if (event->buttons() == Qt::LeftButton) //当满足鼠标左键被点击时。
|
762 |
|
|
// {
|
763 |
|
|
// move(event->globalPos() - dragPosition);//移动窗口
|
764 |
|
|
//// //如果ListWindow的上边沿和ToolWindow的下边沿靠近,则移至紧紧贴合的位置
|
765 |
|
|
//// int disY = toolWindow->geometry().bottom() - this->geometry().top();
|
766 |
|
|
//// if(disY < 5 || disY > -5){
|
767 |
|
|
//// move(this->geometry().left(), this->geometry().top() + disY);
|
768 |
|
|
//// }
|
769 |
|
|
// event->accept();
|
770 |
|
|
// }
|
771 |
|
|
//}
|
772 |
|
|
|
773 |
|
|
//void ListWindow::mouseReleaseEvent(QMouseEvent *event)
|
774 |
|
|
//{
|
775 |
|
|
//// if (event->buttons() == Qt::LeftButton) //当满足鼠标左键被点击时。
|
776 |
|
|
//// {
|
777 |
|
|
|
778 |
|
|
// //如果ListWindow的上边沿和ToolWindow的下边沿靠近,则移至紧紧贴合的位置
|
779 |
|
|
// int disY = toolWindow->geometry().bottom() - this->geometry().top();
|
780 |
|
|
// if((disY < 15) && (disY > -15)){
|
781 |
|
|
// move(this->geometry().left(), this->geometry().top() + disY);//移动窗口
|
782 |
|
|
// toolWindow->setListWindowAdsorbedFlag(true);
|
783 |
|
|
// }
|
784 |
|
|
// else{
|
785 |
|
|
// toolWindow->setListWindowAdsorbedFlag(false);
|
786 |
|
|
// }
|
787 |
|
|
|
788 |
|
|
// event->accept();
|
789 |
|
|
//// }
|
790 |
|
|
//}
|
791 |
|
|
|
792 |
|
|
|
793 |
|
|
|
794 |
|
|
|
795 |
|
|
//当鼠标移动到主界面内部周围5像素时,改变鼠标形状;当进行伸缩拖动时,根据拖动方向进行主界面的位置和大小设置即可。
|
796 |
|
|
//鼠标按下事件
|
797 |
|
|
void ListWindow::mousePressEvent(QMouseEvent *event)
|
798 |
|
|
{
|
799 |
|
|
// static int i = 0 ;
|
800 |
|
|
// qDebug()<<"mouse Press Event"<<i++ ;
|
801 |
|
|
if (event->button() == Qt::LeftButton)
|
802 |
|
|
{
|
803 |
|
|
oldPointGlobal = pointPressGlobal = event->globalPos();
|
804 |
|
|
isLeftButtonPress = true;
|
805 |
|
|
|
806 |
|
|
oldWindowPoint = this->geometry().topLeft();
|
807 |
|
|
|
808 |
|
|
mousePressPoint = event->pos();
|
809 |
|
|
parentRect = parentWidget()->geometry();
|
810 |
|
|
//isDrag = true ;
|
811 |
|
|
}
|
812 |
|
|
event->accept();
|
813 |
|
|
}
|
814 |
|
|
|
815 |
|
|
// 窗体拖动事件
|
816 |
|
|
void ListWindow::moveEvent(QMoveEvent *event)
|
817 |
|
|
{
|
818 |
|
|
// static int i = 0 ;
|
819 |
|
|
// qDebug()<<"moveEvent"<<i++ ;
|
820 |
|
|
// QWidget * parent = this->parentWidget();
|
821 |
|
|
// const int disMax = 30;
|
822 |
|
|
// ToolWindow* parent_tool = static_cast<ToolWindow*>(parent);
|
823 |
|
|
// parent_tool->setListWindowAdsorbedFlag(false);
|
824 |
|
|
|
825 |
|
|
// int dis = parent_tool->geometry().bottom() - this->geometry().top();
|
826 |
|
|
// if((dis < disMax) && (dis > -disMax)){
|
827 |
|
|
//// move(this->geometry().left(), parent->geometry().bottom());//移动窗口
|
828 |
|
|
//// move(200,300);
|
829 |
|
|
// qDebug()<< parent_tool->geometry().left()<< parent_tool->geometry().right() \
|
830 |
|
|
// << parent_tool->geometry().top()<< parent_tool->geometry().bottom ();
|
831 |
|
|
|
832 |
|
|
// qDebug()<< this->geometry().left()<< this->geometry().right() \
|
833 |
|
|
// << this->geometry().top()<< this->geometry().bottom ();
|
834 |
|
|
|
835 |
|
|
// move(300,400);
|
836 |
|
|
// qDebug()<<"move the widget to bottom of parent !";
|
837 |
|
|
// parent_tool->setListWindowAdsorbedFlag(true);
|
838 |
|
|
// }
|
839 |
|
|
// dis = parent->geometry().top() - this->geometry().bottom();
|
840 |
|
|
// if((dis < disMax) && (dis > -disMax)){
|
841 |
|
|
// move(this->geometry().left(), this->geometry().top() + dis);//移动窗口
|
842 |
|
|
// parent_tool->setListWindowAdsorbedFlag(true);
|
843 |
|
|
// }
|
844 |
|
|
// dis = parent->geometry().right() - this->geometry().left();
|
845 |
|
|
// if((dis < disMax) && (dis > -disMax)){
|
846 |
|
|
// move(parent->geometry().right(), this->geometry().top());//移动窗口
|
847 |
|
|
// parent_tool->setListWindowAdsorbedFlag(true);
|
848 |
|
|
// }
|
849 |
|
|
// dis = parent->geometry().left() - this->geometry().right();
|
850 |
|
|
// if((dis < disMax) && (dis > -disMax)){
|
851 |
|
|
// move(this->geometry().left() + dis, this->geometry().top());//移动窗口
|
852 |
|
|
// parent_tool->setListWindowAdsorbedFlag(true);
|
853 |
|
|
// }
|
854 |
|
|
// event->accept();
|
855 |
|
|
event->ignore();
|
856 |
|
|
|
857 |
|
|
// event->accept();
|
858 |
|
|
// QWidget::moveEvent(event);
|
859 |
|
|
//event->accept();
|
860 |
|
|
}
|
861 |
|
|
|
862 |
|
|
//鼠标移动事件
|
863 |
|
|
void ListWindow::mouseMoveEvent(QMouseEvent *event)
|
864 |
|
|
{
|
865 |
|
|
//qDebug()<<"ListWindow::mouseMoveEvent" ;
|
866 |
|
|
// qDebug()<<"ListWindow::mouseMoveEvent"<<this->geometry().width()<<this->geometry().height()<<"mouse track!"<<event->x()<<event->y();
|
867 |
|
|
if(!isLeftButtonPress)
|
868 |
|
|
{
|
869 |
|
|
eDirection = (enum_Direction)PointValid(event->x(),event->y());
|
870 |
|
|
|
871 |
|
|
SetCursorStyle(eDirection);
|
872 |
|
|
|
873 |
|
|
}
|
874 |
|
|
else
|
875 |
|
|
{
|
876 |
|
|
int nXGlobal = event->globalX();
|
877 |
|
|
int nYGlobal = event->globalY();
|
878 |
|
|
NewPointGlobal = event->globalPos();
|
879 |
|
|
SetDrayMove(nXGlobal,nYGlobal,eDirection);
|
880 |
|
|
pointPressGlobal =QPoint(nXGlobal,nYGlobal);
|
881 |
|
|
if(cursor().shape() == Qt::ArrowCursor)
|
882 |
|
|
{
|
883 |
|
|
mouseMovePoint = event->pos() ;
|
884 |
|
|
diffPos = event->pos() - mousePressPoint;
|
885 |
|
|
magneticMove(parentRect,geometry());
|
886 |
|
|
}
|
887 |
|
|
|
888 |
|
|
}
|
889 |
|
|
event->accept();
|
890 |
|
|
}
|
891 |
|
|
//鼠标释放事件
|
892 |
|
|
void ListWindow::mouseReleaseEvent(QMouseEvent *event)
|
893 |
|
|
{
|
894 |
|
|
if (event->button() == Qt::LeftButton)
|
895 |
|
|
{
|
896 |
|
|
isLeftButtonPress = false;
|
897 |
|
|
eDirection = eNone;
|
898 |
|
|
//isDrag = false ;
|
899 |
|
|
}
|
900 |
|
|
event->accept();
|
901 |
|
|
}
|
902 |
|
|
|
903 |
|
|
//鼠标双击事件
|
904 |
|
|
void ListWindow::mouseDoubleClickEvent(QMouseEvent *event)
|
905 |
|
|
{
|
906 |
|
|
//Null
|
907 |
|
|
// qDebug()<< "list window"<<this->frameGeometry().left() << this->frameGeometry().top();
|
908 |
|
|
if ((event->button() == Qt::LeftButton) && (event->y()<= 10))
|
909 |
|
|
//if ((event->button() == Qt::LeftButton) && (event->y()<= titleBar->height()))
|
910 |
|
|
{
|
911 |
|
|
if(!isMaxWin)
|
912 |
|
|
{
|
913 |
|
|
rectRestoreWindow = geometry();
|
914 |
|
|
setGeometry(qApp->desktop()->availableGeometry());
|
915 |
|
|
}
|
916 |
|
|
else
|
917 |
|
|
{
|
918 |
|
|
setGeometry(rectRestoreWindow);
|
919 |
|
|
}
|
920 |
|
|
isMaxWin = !isMaxWin;
|
921 |
|
|
}
|
922 |
|
|
event->accept();
|
923 |
|
|
}
|
924 |
|
|
|
925 |
|
|
void ListWindow::magneticMove(const QRect &bechmarkRect, const QRect &targetRect)
|
926 |
|
|
{
|
927 |
|
|
int bechmarkLeft = bechmarkRect.left();
|
928 |
|
|
int bechmarkRight = bechmarkRect.right();
|
929 |
|
|
int bechmarkTop = bechmarkRect.top();
|
930 |
|
|
int bechmarkBottom = bechmarkRect.bottom();
|
931 |
|
|
int targetLeft = targetRect.left();
|
932 |
|
|
int targetRight = targetRect.right();
|
933 |
|
|
int targetTop = targetRect.top();
|
934 |
|
|
int targetBottom = targetRect.bottom();
|
935 |
|
|
QPoint finalPosition;
|
936 |
|
|
const int magneticOffset = 12 ;
|
937 |
|
|
|
938 |
|
|
isStick = false;
|
939 |
|
|
// qDebug()<< "move widget"<<tr("上") <<targetTop <<tr("下") << targetBottom \
|
940 |
|
|
// <<tr("左")<< targetLeft <<tr("右")<< targetRight ;
|
941 |
|
|
|
942 |
|
|
// qDebug()<< "static widget"<<tr("上") <<bechmarkTop <<tr("下") << bechmarkBottom \
|
943 |
|
|
// <<tr("左")<< bechmarkLeft <<tr("右")<< bechmarkRight ;
|
944 |
|
|
|
945 |
|
|
// qDebug()<< "magneticMove" << mousePressPoint.x() << mousePressPoint.y() \
|
946 |
|
|
// << mouseMovePoint.x()<< mouseMovePoint.y()<< this->parentWidget()->geometry().bottom()\
|
947 |
|
|
// << this->parentWidget()->geometry().right();
|
948 |
|
|
/*
|
949 |
|
|
qDebug() << "bechmarkLeft - targetLeft:" << qAbs(bechmarkLeft - targetLeft);
|
950 |
|
|
qDebug() << "pos().y():" << pos().y();
|
951 |
|
|
qDebug() << "geometry().top():" << geometry().top();
|
952 |
|
|
qDebug() << "bechmarkBottom:" << bechmarkBottom;
|
953 |
|
|
qDebug() << "bechmarkTop - targetRect.height()):" << bechmarkTop - targetRect.height();
|
954 |
|
|
*/
|
955 |
|
|
|
956 |
|
|
//if (qAbs(bechmarkLeft - targetLeft) < qAbs(bechmarkRight - targetLeft))
|
957 |
|
|
//move(pos() + diffPos);
|
958 |
|
|
// 移动窗口 的 pos()
|
959 |
|
|
//horizontal-1:left to left
|
960 |
|
|
//&& (pos().y() <= bechmarkBottom && pos().y() >= (bechmarkTop - targetRect.height()))
|
961 |
|
|
if(qAbs(diffPos.x()) < magneticOffset \
|
962 |
|
|
&&qAbs(bechmarkLeft - targetLeft) < magneticOffset
|
963 |
|
|
&& bechmarkRect.intersects(geometry()))
|
964 |
|
|
{
|
965 |
|
|
qDebug() << "Left To Left" << endl;
|
966 |
|
|
//move(geometry().topLeft() + diffPos);
|
967 |
|
|
//move(bechmarkLeft, pos().y() + diffPos.y());
|
968 |
|
|
finalPosition.setX(bechmarkLeft);
|
969 |
|
|
finalPosition.setY(pos().y() + diffPos.y());
|
970 |
|
|
isStick |= true;
|
971 |
|
|
}
|
972 |
|
|
|
973 |
|
|
//horizontal-2:left to right
|
974 |
|
|
if (qAbs(diffPos.x()) < magneticOffset
|
975 |
|
|
&& qAbs(bechmarkRight - targetLeft) < magneticOffset
|
976 |
|
|
&& bechmarkRect.intersects(QRect(pos().x() - magneticOffset, pos().y(),
|
977 |
|
|
targetRect.width(), targetRect.height())))
|
978 |
|
|
{
|
979 |
|
|
qDebug() << "Left To Right" << endl;
|
980 |
|
|
//move(bechmarkRight, pos().y() + diffPos.y());
|
981 |
|
|
finalPosition.setX(bechmarkRight);
|
982 |
|
|
finalPosition.setY(pos().y() + diffPos.y());
|
983 |
|
|
isStick |= true;
|
984 |
|
|
}
|
985 |
|
|
|
986 |
|
|
//horizontal-3:right to left
|
987 |
|
|
if (qAbs(diffPos.x()) < magneticOffset
|
988 |
|
|
&& qAbs(bechmarkLeft - targetRight) < magneticOffset
|
989 |
|
|
&& bechmarkRect.intersects(QRect(pos().x(), pos().y(),
|
990 |
|
|
targetRect.width() + magneticOffset, targetRect.height())))
|
991 |
|
|
{
|
992 |
|
|
qDebug() << "Right TO Left" << endl;
|
993 |
|
|
//move(pos().x() + (bechmarkLeft - targetRight),
|
994 |
|
|
// pos().y() + diffPos.y());
|
995 |
|
|
finalPosition.setX(pos().x() + bechmarkLeft - targetRight);
|
996 |
|
|
finalPosition.setY(pos().y() + diffPos.y());
|
997 |
|
|
qDebug() << "finalPosition.x():" << finalPosition.x() << endl;
|
998 |
|
|
qDebug() << "bechmarkLeft - targetRect.width():" << bechmarkLeft - targetRect.width();
|
999 |
|
|
isStick |= true;
|
1000 |
|
|
}
|
1001 |
|
|
|
1002 |
|
|
//horizontal-4:right to right
|
1003 |
|
|
if (qAbs(diffPos.x()) < magneticOffset
|
1004 |
|
|
&& qAbs(bechmarkRight - targetRight) < magneticOffset
|
1005 |
|
|
//&& bechmarkRect.intersects(geometry())
|
1006 |
|
|
)
|
1007 |
|
|
{
|
1008 |
|
|
qDebug() << "Right TO Right" << endl;
|
1009 |
|
|
//move(pos().x() + (bechmarkRight - targetRight), pos().y() + diffPos.y());
|
1010 |
|
|
finalPosition.setX(pos().x() + (bechmarkRight - targetRight));
|
1011 |
|
|
//finalPosition.setX(targetLeft + (bechmarkRight - targetRight));
|
1012 |
|
|
finalPosition.setY(pos().y() + diffPos.y());
|
1013 |
|
|
isStick |= true;
|
1014 |
|
|
}
|
1015 |
|
|
|
1016 |
|
|
//veritcal-1:top to top
|
1017 |
|
|
if (qAbs(diffPos.y()) < magneticOffset
|
1018 |
|
|
&& qAbs(bechmarkTop - targetTop) < magneticOffset \
|
1019 |
|
|
&& bechmarkRect.intersects(geometry())
|
1020 |
|
|
//&& (isStick || bechmarkRect.intersects(geometry()))
|
1021 |
|
|
)
|
1022 |
|
|
{
|
1023 |
|
|
qDebug() << "Top TO Top" << endl;
|
1024 |
|
|
|
1025 |
|
|
if (isStick)
|
1026 |
|
|
finalPosition.setY(bechmarkTop);
|
1027 |
|
|
else
|
1028 |
|
|
{
|
1029 |
|
|
finalPosition.setX(pos().x() + diffPos.x());
|
1030 |
|
|
finalPosition.setY(bechmarkTop);
|
1031 |
|
|
}
|
1032 |
|
|
|
1033 |
|
|
//move(pos().x() + diffPos.x(), bechmarkTop);
|
1034 |
|
|
isStick |= true;
|
1035 |
|
|
}
|
1036 |
|
|
|
1037 |
|
|
//veritcal-2:top to bottom
|
1038 |
|
|
if (qAbs(diffPos.y()) < magneticOffset
|
1039 |
|
|
&& qAbs(bechmarkBottom - targetTop) < magneticOffset
|
1040 |
|
|
&& bechmarkRect.intersects(QRect(pos().x(), pos().y()- magneticOffset,
|
1041 |
|
|
targetRect.width(), targetRect.height())))
|
1042 |
|
|
{
|
1043 |
|
|
qDebug() << "Top To Bottom" << endl;
|
1044 |
|
|
//move(pos().x() + diffPos.x(), bechmarkBottom);
|
1045 |
|
|
if (isStick)
|
1046 |
|
|
{
|
1047 |
|
|
qDebug() << "case 1" ;
|
1048 |
|
|
finalPosition.setY(bechmarkBottom);
|
1049 |
|
|
}
|
1050 |
|
|
else
|
1051 |
|
|
{
|
1052 |
|
|
// finalPosition.setX(pos().x() + diffPos.x());
|
1053 |
|
|
finalPosition.setX(pos().x()+diffPos.x());
|
1054 |
|
|
finalPosition.setY(bechmarkBottom);
|
1055 |
|
|
}
|
1056 |
|
|
isStick |= true;
|
1057 |
|
|
}
|
1058 |
|
|
|
1059 |
|
|
//veritcal-3:bottom to top
|
1060 |
|
|
if (qAbs(diffPos.y()) < magneticOffset
|
1061 |
|
|
&& qAbs(bechmarkTop - targetBottom) < magneticOffset
|
1062 |
|
|
&& bechmarkRect.intersects(QRect(pos().x(), pos().y(),
|
1063 |
|
|
targetRect.width(), targetRect.height() + magneticOffset)))
|
1064 |
|
|
{
|
1065 |
|
|
qDebug() << "Bottom TO Top" << endl;
|
1066 |
|
|
if (isStick)
|
1067 |
|
|
{
|
1068 |
|
|
qDebug() << "case 2";
|
1069 |
|
|
finalPosition.setY(pos().y() + (bechmarkTop - targetBottom));
|
1070 |
|
|
}
|
1071 |
|
|
else
|
1072 |
|
|
{
|
1073 |
|
|
finalPosition.setX(pos().x() + diffPos.x());
|
1074 |
|
|
finalPosition.setY(pos().y() + (bechmarkTop - targetBottom));
|
1075 |
|
|
}
|
1076 |
|
|
//move(pos().x() + diffPos.x(), pos().y() + (bechmarkTop - targetBottom));
|
1077 |
|
|
isStick |= true;
|
1078 |
|
|
}
|
1079 |
|
|
|
1080 |
|
|
//veritcal-4:bottom to bottom
|
1081 |
|
|
if (qAbs(diffPos.y()) < magneticOffset
|
1082 |
|
|
&& qAbs(bechmarkBottom - targetBottom) < magneticOffset
|
1083 |
|
|
&& bechmarkRect.intersects(geometry()))
|
1084 |
|
|
{
|
1085 |
|
|
qDebug() << "Bottom TO Bottom" << endl;
|
1086 |
|
|
|
1087 |
|
|
if (isStick)
|
1088 |
|
|
finalPosition.setY(pos().y() + (bechmarkBottom - targetBottom));
|
1089 |
|
|
else
|
1090 |
|
|
{
|
1091 |
|
|
finalPosition.setX(pos().x() + diffPos.x());
|
1092 |
|
|
finalPosition.setY(pos().y() + (bechmarkBottom - targetBottom));
|
1093 |
|
|
}
|
1094 |
|
|
//move(pos().x() + diffPos.x(), pos().y() + (bechmarkBottom - targetBottom));
|
1095 |
|
|
|
1096 |
|
|
isStick |= true;
|
1097 |
|
|
}
|
1098 |
|
|
|
1099 |
|
|
if (isStick)
|
1100 |
|
|
{
|
1101 |
|
|
qDebug()<< "finalPosition" << finalPosition.x()<< finalPosition.y() << isStick ;
|
1102 |
|
|
move(finalPosition);
|
1103 |
|
|
}
|
1104 |
|
|
else
|
1105 |
|
|
{
|
1106 |
|
|
|
1107 |
|
|
qDebug()<<"!!!move the widget!!!" << diffPos.x()<< diffPos.y()\
|
1108 |
|
|
<< (pos() + diffPos).x()<<(pos() + diffPos).y() << isStick;
|
1109 |
|
|
|
1110 |
|
|
move(pos() + diffPos);
|
1111 |
|
|
}
|
1112 |
|
|
// move(oldWindowPoint+NewPointGlobal-oldPointGlobal);
|
1113 |
|
|
// i++ ;
|
1114 |
|
|
//// move(700,10+i*10);
|
1115 |
|
|
// move(700+diffPos.x(),i*5+diffPos.y());
|
1116 |
|
|
}
|
1117 |
|
|
|
1118 |
|
|
//判断鼠标所在位置在当前窗口的什么位置,上下左右 边界上,或者都不是
|
1119 |
|
|
int ListWindow::PointValid(int x, int y)
|
1120 |
|
|
{
|
1121 |
|
|
enum_Direction direction = eNone;
|
1122 |
|
|
|
1123 |
|
|
// int top = geometry().top();
|
1124 |
|
|
// int bottom = geometry().bottom();
|
1125 |
|
|
// int left = geometry().left();
|
1126 |
|
|
// int right = geometry().right();
|
1127 |
|
|
// int width = this->width();
|
1128 |
|
|
// int height = this->height();
|
1129 |
|
|
|
1130 |
|
|
// int ra = this->x();
|
1131 |
|
|
// int rb = this->y();
|
1132 |
|
|
|
1133 |
|
|
// QRect rr = rect();
|
1134 |
|
|
// QRect rg = geometry();
|
1135 |
|
|
// QPoint q1 = geometry().topLeft();
|
1136 |
|
|
// QPoint q2 = geometry().bottomRight();
|
1137 |
|
|
|
1138 |
|
|
// QSize rsize = this->size();
|
1139 |
|
|
|
1140 |
|
|
|
1141 |
|
|
// if ((x >= left) && (x < left + 5))
|
1142 |
|
|
// {
|
1143 |
|
|
// if((y >= top) && (y < top + 5))
|
1144 |
|
|
// direction = eLeftTop;
|
1145 |
|
|
// else if((y > bottom - 5) && (y <= bottom))
|
1146 |
|
|
// direction = eBottomLeft;
|
1147 |
|
|
// else
|
1148 |
|
|
// direction = eLeft;
|
1149 |
|
|
// }
|
1150 |
|
|
// else if((x > right - 5) && (x <= right))
|
1151 |
|
|
// {
|
1152 |
|
|
// if((y >= top) && (y < top + 5))
|
1153 |
|
|
// direction = eTopRight;
|
1154 |
|
|
// else if((y > bottom - 5) && (y <= bottom))
|
1155 |
|
|
// direction = eRightBottom;
|
1156 |
|
|
// else
|
1157 |
|
|
// direction = eLeft;
|
1158 |
|
|
// }
|
1159 |
|
|
// this is listwindow
|
1160 |
|
|
if ((x >= 0) && (x < 5))
|
1161 |
|
|
{
|
1162 |
|
|
if((y >= 0) && (y < 5))
|
1163 |
|
|
direction = eLeftTop;
|
1164 |
|
|
else if((y > this->height() - 5) && (y <= this->height()))
|
1165 |
|
|
direction = eBottomLeft;
|
1166 |
|
|
else
|
1167 |
|
|
direction = eLeft;
|
1168 |
|
|
}
|
1169 |
|
|
else if((x > this->width() - 5) && (x <= this->width()))
|
1170 |
|
|
{
|
1171 |
|
|
if((y >= 0) && (y < 5))
|
1172 |
|
|
direction = eTopRight;
|
1173 |
|
|
else if((y > this->height() - 5) && (y <= this->height()))
|
1174 |
|
|
direction = eRightBottom;
|
1175 |
|
|
else
|
1176 |
|
|
direction = eRight;
|
1177 |
|
|
}
|
1178 |
|
|
else if((y >= 0) && (y < 5))
|
1179 |
|
|
{
|
1180 |
|
|
direction = eTop;
|
1181 |
|
|
}
|
1182 |
|
|
else if((y > this->height() - 5) && (y <= this->height()))
|
1183 |
|
|
{
|
1184 |
|
|
direction = eBottom;
|
1185 |
|
|
}
|
1186 |
|
|
|
1187 |
|
|
//qDebug() << "judget direction" << x << y << direction ;
|
1188 |
|
|
return (int)direction;
|
1189 |
|
|
}
|
1190 |
|
|
|
1191 |
|
|
//设置鼠标样式
|
1192 |
|
|
void ListWindow::SetCursorStyle(enum_Direction direction)
|
1193 |
|
|
{
|
1194 |
|
|
//设置上下左右以及右上、右下、左上、坐下的鼠标形状
|
1195 |
|
|
//isDrag = false ;
|
1196 |
|
|
switch(direction)
|
1197 |
|
|
{
|
1198 |
|
|
case eTop:
|
1199 |
|
|
case eBottom:
|
1200 |
|
|
setCursor(Qt::SizeVerCursor);
|
1201 |
|
|
break;
|
1202 |
|
|
case eRight:
|
1203 |
|
|
case eLeft:
|
1204 |
|
|
setCursor(Qt::SizeHorCursor);
|
1205 |
|
|
break;
|
1206 |
|
|
case eTopRight:
|
1207 |
|
|
case eBottomLeft:
|
1208 |
|
|
setCursor(Qt::SizeBDiagCursor);
|
1209 |
|
|
break;
|
1210 |
|
|
case eRightBottom:
|
1211 |
|
|
case eLeftTop:
|
1212 |
|
|
setCursor(Qt::SizeFDiagCursor);
|
1213 |
|
|
break;
|
1214 |
|
|
default:
|
1215 |
|
|
{
|
1216 |
|
|
setCursor(Qt::ArrowCursor);
|
1217 |
|
|
//isDrag = true ;
|
1218 |
|
|
}
|
1219 |
|
|
break;
|
1220 |
|
|
}
|
1221 |
|
|
}
|
1222 |
|
|
|
1223 |
|
|
//设置鼠标拖动的窗口位置信息
|
1224 |
|
|
void ListWindow::SetDrayMove(int nXGlobal,int nYGlobal,enum_Direction direction)
|
1225 |
|
|
{
|
1226 |
|
|
// //计算偏差
|
1227 |
|
|
// int ndX = nXGlobal - pointPressGlobal.x();
|
1228 |
|
|
// int ndY = nYGlobal - pointPressGlobal.y();
|
1229 |
|
|
//获得主窗口位置信息
|
1230 |
|
|
|
1231 |
|
|
QRect rectWindow = geometry();
|
1232 |
|
|
qDebug()<< "direction" << direction << geometry().bottom()<<geometry().right();
|
1233 |
|
|
//判别方向
|
1234 |
|
|
switch(direction)
|
1235 |
|
|
{
|
1236 |
|
|
case eTop:
|
1237 |
|
|
rectWindow.setTop(nYGlobal);
|
1238 |
|
|
break;
|
1239 |
|
|
case eBottom:
|
1240 |
|
|
rectWindow.setBottom(nYGlobal);
|
1241 |
|
|
break;
|
1242 |
|
|
case eRight:
|
1243 |
|
|
rectWindow.setRight(nXGlobal);
|
1244 |
|
|
//titleBar->lineLabel->
|
1245 |
|
|
//resize(titleBar->lineLabel->size().width() + ndX,
|
1246 |
|
|
// titleBar->lineLabel->size().height());
|
1247 |
|
|
break;
|
1248 |
|
|
case eLeft:
|
1249 |
|
|
rectWindow.setLeft(nXGlobal);
|
1250 |
|
|
break;
|
1251 |
|
|
case eTopRight:
|
1252 |
|
|
rectWindow.setTop(nYGlobal);
|
1253 |
|
|
rectWindow.setRight(nXGlobal);
|
1254 |
|
|
break;
|
1255 |
|
|
case eBottomLeft:
|
1256 |
|
|
rectWindow.setBottom(nYGlobal);
|
1257 |
|
|
rectWindow.setLeft(nXGlobal);
|
1258 |
|
|
break;
|
1259 |
|
|
case eRightBottom:
|
1260 |
|
|
rectWindow.setBottom(nYGlobal);
|
1261 |
|
|
rectWindow.setRight(nXGlobal);
|
1262 |
|
|
break;
|
1263 |
|
|
case eLeftTop:
|
1264 |
|
|
rectWindow.setTop(nYGlobal);
|
1265 |
|
|
rectWindow.setLeft(nXGlobal);
|
1266 |
|
|
break;
|
1267 |
|
|
default:
|
1268 |
|
|
break;
|
1269 |
|
|
}
|
1270 |
|
|
|
1271 |
|
|
qDebug()<< "new pos" << rectWindow.top()<< rectWindow.left()<<rectWindow.width()<< rectWindow.height() \
|
1272 |
|
|
<<nXGlobal << nYGlobal;
|
1273 |
|
|
if(rectWindow.width()< minimumWidth() || rectWindow.height()<minimumHeight())
|
1274 |
|
|
{
|
1275 |
|
|
qDebug()<< "the window size less than miniumWidth ";
|
1276 |
|
|
|
1277 |
|
|
|
1278 |
|
|
return;
|
1279 |
|
|
}
|
1280 |
|
|
|
1281 |
|
|
// qDebug()<< "new pos" << rectWindow.top()<< rectWindow.left()<<rectWindow.width()<< rectWindow.height();
|
1282 |
|
|
qDebug()<< "move positon";
|
1283 |
|
|
//重新设置窗口位置为新位置信息
|
1284 |
|
|
setGeometry(rectWindow);
|
1285 |
|
|
// move(100,200);
|
1286 |
|
|
}
|
1287 |
|
|
|
1288 |
|
|
|
1289 |
|
|
|
1290 |
|
|
|
1291 |
|
|
|
1292 |
|
|
|
1293 |
|
|
|
1294 |
|
|
|
1295 |
|
|
|
1296 |
|
|
|
1297 |
|
|
|
1298 |
|
|
|
1299 |
|
|
|
1300 |
|
|
|
1301 |
|
|
//bool ListWindow::isAdsorbed()
|
1302 |
|
|
//{
|
1303 |
|
|
// return isNormalListWindowAdsorbed;
|
1304 |
|
|
//}
|
1305 |
|
|
|
1306 |
|
|
//void ListWindow::paintEvent(QPaintEvent *)
|
1307 |
|
|
//{
|
1308 |
|
|
// QPainter painter(this);//创建一个QPainter对象
|
1309 |
|
|
// painter.drawPixmap(0,0,QPixmap(":/images/Watermelon.png"));//绘制图片到窗口
|
1310 |
|
|
// /*
|
1311 |
|
|
// QPixmap(":/images/Watermelon.png")如果改为QPixmap(),则只能看到绘制出的框架,看不到图片颜色,也就是看不到图片。
|
1312 |
|
|
// */
|
1313 |
|
|
//}
|
1314 |
|
|
|
1315 |
|
|
// 随着窗体变化而设置背景
|
1316 |
|
|
void ListWindow::resizeEvent(QResizeEvent *event)
|
1317 |
|
|
{
|
1318 |
|
|
// QWidget::resizeEvent(event);
|
1319 |
|
|
// QPalette pal(palette());
|
1320 |
|
|
// pal.setBrush(QPalette::Window,
|
1321 |
|
|
// QBrush(listBackground.scaled(event->size(),
|
1322 |
|
|
// Qt::IgnoreAspectRatio,
|
1323 |
|
|
// Qt::SmoothTransformation)));
|
1324 |
|
|
//// pal.setBrush(QPalette::Window,
|
1325 |
|
|
//// QBrush(_image.scaled(event->size(), Qt::IgnoreAspectRatio,
|
1326 |
|
|
//// Qt::SmoothTransformation)));
|
1327 |
|
|
// setPalette(pal);
|
1328 |
|
|
|
1329 |
|
|
QWidget::resizeEvent(event);
|
1330 |
|
|
|
1331 |
|
|
|
1332 |
|
|
|
1333 |
|
|
//背景图片缩放,九宫格,四个角不变,其他缩放
|
1334 |
|
|
int dx = event->size().width() - listBackground.width();
|
1335 |
|
|
int dy = event->size().height() - listBackground.height();
|
1336 |
|
|
/*暂时去掉 最小窗口时 无法扩大 */
|
1337 |
|
|
// if(dx < 1 || dy <1)
|
1338 |
|
|
// {
|
1339 |
|
|
// qDebug()<< "no zoom !";
|
1340 |
|
|
// return;
|
1341 |
|
|
// }
|
1342 |
|
|
qDebug()<< "begin zoom !";
|
1343 |
|
|
|
1344 |
|
|
//创建一个size为变化后size的新画布
|
1345 |
|
|
QImage img(event->size(), QImage::Format_ARGB32);
|
1346 |
|
|
QPainter *paint = new QPainter(&img);
|
1347 |
|
|
//在新区域画图
|
1348 |
|
|
//左上-fixed,中上-x方向scaled,右上-fixed
|
1349 |
|
|
paint->drawPixmap(0, 0, listBackground.copy(0, 0, 5, 27));
|
1350 |
|
|
paint->drawPixmap(5, 0, listBackground.copy(5, 0, 321, 27).scaled(QSize(321 + dx, 27),
|
1351 |
|
|
Qt::IgnoreAspectRatio,
|
1352 |
|
|
Qt::SmoothTransformation));
|
1353 |
|
|
paint->drawPixmap(326 + dx, 0, listBackground.copy(326, 0, 42, 27));
|
1354 |
|
|
//左下-fixed,中下-x方向scaled,右下-fixed
|
1355 |
|
|
paint->drawPixmap(0, 359 + dy, listBackground.copy(0, 359, 4, 10));
|
1356 |
|
|
paint->drawPixmap(4, 359 + dy, listBackground.copy(4, 359, 363, 10).scaled(QSize(363 + dx, 10),
|
1357 |
|
|
Qt::IgnoreAspectRatio,
|
1358 |
|
|
Qt::SmoothTransformation));
|
1359 |
|
|
paint->drawPixmap(363 + dx, 359 + dy, listBackground.copy(363, 359, 5, 10));
|
1360 |
|
|
//左中-y方向scaled,中中-xy方向scaled,右中-y方向scaled
|
1361 |
|
|
paint->drawPixmap(0, 27, listBackground.copy(0, 27, 4, 333).scaled(QSize(4, 333 + dy),
|
1362 |
|
|
Qt::IgnoreAspectRatio,
|
1363 |
|
|
Qt::SmoothTransformation));
|
1364 |
|
|
paint->drawPixmap(4, 27, listBackground.copy(4, 27, 358, 333).scaled(QSize(358 + dx, 333 + dy),
|
1365 |
|
|
Qt::IgnoreAspectRatio,
|
1366 |
|
|
Qt::SmoothTransformation));
|
1367 |
|
|
paint->drawPixmap(363 + dx, 27, listBackground.copy(363, 27, 5, 333).scaled(QSize(5, 333 + dy),
|
1368 |
|
|
Qt::IgnoreAspectRatio,
|
1369 |
|
|
Qt::SmoothTransformation));
|
1370 |
|
|
|
1371 |
|
|
|
1372 |
|
|
//保留原背景图片对应的resize参数,以供参考和查错
|
1373 |
|
|
// //左上-fixed,中上-x方向scaled,右上-fixed
|
1374 |
|
|
// paint->drawPixmap(0, 0, listBackground.copy(0, 0, 24, 40));
|
1375 |
|
|
// paint->drawPixmap(24, 0, listBackground.copy(24, 0, 240, 40).scaled(QSize(240 + dx, 40),
|
1376 |
|
|
// Qt::IgnoreAspectRatio,
|
1377 |
|
|
// Qt::SmoothTransformation));
|
1378 |
|
|
// paint->drawPixmap(264 + dx, 0, listBackground.copy(264, 0, 25, 40));
|
1379 |
|
|
// //左下-fixed,中下-x方向scaled,右下-fixed
|
1380 |
|
|
// paint->drawPixmap(0, 52 + dy, listBackground.copy(0, 52, 24, 53));
|
1381 |
|
|
// paint->drawPixmap(24, 52 + dy, listBackground.copy(24, 52, 240, 53).scaled(QSize(240 + dx, 53),
|
1382 |
|
|
// Qt::IgnoreAspectRatio,
|
1383 |
|
|
// Qt::SmoothTransformation));
|
1384 |
|
|
// paint->drawPixmap(264 + dx, 52 + dy, listBackground.copy(264, 52, 25, 53));
|
1385 |
|
|
// //左中-y方向scaled,中中-xy方向scaled,右中-y方向scaled
|
1386 |
|
|
// paint->drawPixmap(0, 40, listBackground.copy(0, 40, 24, 12).scaled(QSize(24, 12 + dy),
|
1387 |
|
|
// Qt::IgnoreAspectRatio,
|
1388 |
|
|
// Qt::SmoothTransformation));
|
1389 |
|
|
// paint->drawPixmap(24, 40, listBackground.copy(24, 40, 240, 12).scaled(QSize(240 + dx, 12 + dy),
|
1390 |
|
|
// Qt::IgnoreAspectRatio,
|
1391 |
|
|
// Qt::SmoothTransformation));
|
1392 |
|
|
// paint->drawPixmap(264 + dx, 40, listBackground.copy(264, 40, 25, 12).scaled(QSize(25, 12 + dy),
|
1393 |
|
|
// Qt::IgnoreAspectRatio,
|
1394 |
|
|
// Qt::SmoothTransformation));
|
1395 |
|
|
paint->end();
|
1396 |
|
|
|
1397 |
|
|
// QLabel *l = new QLabel;
|
1398 |
|
|
// l->setPixmap(QPixmap::fromImage(img));
|
1399 |
|
|
// l->show();
|
1400 |
|
|
|
1401 |
|
|
QPalette pal(palette());
|
1402 |
|
|
pal.setBrush(QPalette::Window,QBrush(img));
|
1403 |
|
|
// pal.setBrush(QPalette::Window,
|
1404 |
|
|
// QBrush(backgroundPix.scaled(event->size(),
|
1405 |
|
|
// Qt::IgnoreAspectRatio,
|
1406 |
|
|
// Qt::SmoothTransformation)));
|
1407 |
|
|
setPalette(pal);
|
1408 |
|
|
|
1409 |
|
|
//设置掩板
|
1410 |
|
|
//生成一张位图
|
1411 |
|
|
QBitmap objBitmap(size());
|
1412 |
|
|
//QPainter用于在位图上绘画
|
1413 |
|
|
QPainter painter(&objBitmap);
|
1414 |
|
|
//填充位图矩形框(用白色填充)
|
1415 |
|
|
painter.fillRect(rect(),Qt::white);
|
1416 |
|
|
painter.setBrush(QColor(0,0,0));
|
1417 |
|
|
//在位图上画圆角矩形(用黑色填充)
|
1418 |
|
|
painter.drawRoundedRect(this->rect(),4,4);
|
1419 |
|
|
//使用setmask过滤即可
|
1420 |
|
|
setMask(objBitmap);
|
1421 |
|
|
// closeButton->setGeometry(QRect(this->geometry().width()-18, 5, 11, 10));
|
1422 |
|
|
}
|
1423 |
|
|
|
1424 |
|
|
|
1425 |
|
|
|
1426 |
|
|
//点击右上角标题栏按钮时,仅隐藏列表窗口
|
1427 |
|
|
void ListWindow::close()
|
1428 |
|
|
{
|
1429 |
|
|
setListWindowHidden(true);
|
1430 |
|
|
}
|
1431 |
|
|
|
1432 |
|
|
|
1433 |
|
|
|
1434 |
|
|
//void ListWindow::moveListWindow(const QPoint &p, QPoint bottomLeft, QPoint bottomRight)
|
1435 |
|
|
//{
|
1436 |
|
|
// QPoint listWtopLeft = this->geometry().topLeft();
|
1437 |
|
|
// if((listWtopLeft.ry() == bottomLeft.ry())
|
1438 |
|
|
// &&((listWtopLeft.rx() <= bottomRight.rx())
|
1439 |
|
|
// || (geometry().topRight().rx() >= bottomLeft.rx()))){
|
1440 |
|
|
// move(p + geometry().topLeft());
|
1441 |
|
|
// }
|
1442 |
|
|
//}
|
1443 |
|
|
|
1444 |
|
|
//void ListWindow::toMiniMode()
|
1445 |
|
|
//{
|
1446 |
|
|
// toolWindow->hide();
|
1447 |
|
|
// this->hide();
|
1448 |
|
|
// miniWindow->show();
|
1449 |
|
|
// if(!miniWindow->statusWidgetHidden())
|
1450 |
|
|
// miniWindow->setStatusWidgetHidden(false);
|
1451 |
|
|
//}
|
1452 |
|
|
|
1453 |
|
|
//void ListWindow::deleteChain()
|
1454 |
|
|
//{
|
1455 |
|
|
|
1456 |
|
|
//}
|
1457 |
|
|
|
1458 |
|
|
void ListWindow::testbenchGeneration()
|
1459 |
|
|
{
|
1460 |
|
|
|
1461 |
|
|
}
|
1462 |
|
|
|
1463 |
|
|
void ListWindow::about()
|
1464 |
|
|
{
|
1465 |
|
|
QMessageBox::about(this, tr("About EziDebug"),
|
1466 |
|
|
tr("<h2>EziDebug 0.1</h2>"
|
1467 |
|
|
"<p>Copyright © 2012 Software Inc."
|
1468 |
|
|
"<p>EziDebug is a application that... "
|
1469 |
|
|
""
|
1470 |
|
|
));
|
1471 |
|
|
}
|
1472 |
|
|
|
1473 |
|
|
|
1474 |
|
|
void ListWindow::show_contextmenu(const QPoint& pos)
|
1475 |
|
|
{
|
1476 |
|
|
QModelIndex index = moduleTreeView->indexAt(pos) ;
|
1477 |
|
|
EziDebugPrj * pcurrentPrj = NULL ;
|
1478 |
|
|
pcurrentPrj = const_cast<EziDebugPrj *>(EziDebugInstanceTreeItem::getProject());
|
1479 |
|
|
if(index.isValid())
|
1480 |
|
|
{
|
1481 |
|
|
m_ptreeItem = static_cast<EziDebugInstanceTreeItem *>(index.internalPointer());
|
1482 |
|
|
|
1483 |
|
|
if(m_ptreeItem)
|
1484 |
|
|
{
|
1485 |
|
|
if(!m_ptreeItem->getScanChainInfo())
|
1486 |
|
|
{
|
1487 |
|
|
/*可以添加链 不能删除链*/
|
1488 |
|
|
m_paddChainAct->setEnabled(true); ;
|
1489 |
|
|
m_pdeleteChainAct->setEnabled(false);
|
1490 |
|
|
}
|
1491 |
|
|
else
|
1492 |
|
|
{
|
1493 |
|
|
/*可以删除链 不能添加链*/
|
1494 |
|
|
m_paddChainAct->setEnabled(false);
|
1495 |
|
|
m_pdeleteChainAct->setEnabled(true);
|
1496 |
|
|
}
|
1497 |
|
|
}
|
1498 |
|
|
|
1499 |
|
|
if(m_ptreeItem->getModuleName() == pcurrentPrj->getTopModule())
|
1500 |
|
|
{
|
1501 |
|
|
m_paddChainAct->setEnabled(false);
|
1502 |
|
|
m_pdeleteChainAct->setEnabled(false);
|
1503 |
|
|
}
|
1504 |
|
|
|
1505 |
|
|
if(pcurrentPrj->getPrjModuleMap().value(m_ptreeItem->getModuleName())->isLibaryCore())
|
1506 |
|
|
{
|
1507 |
|
|
m_paddChainAct->setEnabled(false);
|
1508 |
|
|
m_pdeleteChainAct->setEnabled(false);
|
1509 |
|
|
}
|
1510 |
|
|
}
|
1511 |
|
|
else
|
1512 |
|
|
{
|
1513 |
|
|
m_paddChainAct->setEnabled(false);
|
1514 |
|
|
m_pdeleteChainAct->setEnabled(false);
|
1515 |
|
|
}
|
1516 |
|
|
|
1517 |
|
|
QPoint mm = QCursor::pos();
|
1518 |
|
|
if(m_pcontextMenu)
|
1519 |
|
|
m_pcontextMenu->exec(mm) ;
|
1520 |
|
|
|
1521 |
|
|
|
1522 |
|
|
// m_pcontextMenu->exec(pos) ;
|
1523 |
|
|
}
|
1524 |
|
|
|
1525 |
|
|
void ListWindow::generateTreeView(EziDebugInstanceTreeItem* item)
|
1526 |
|
|
{
|
1527 |
|
|
// item 是 要显示的节点的头节点
|
1528 |
|
|
// QString itopModuleComboName ;
|
1529 |
|
|
// QString itopModule ;
|
1530 |
|
|
// EziDebugPrj *pcurrentPrj = NULL ;
|
1531 |
|
|
if(!m_peziDebugTreeModel)
|
1532 |
|
|
{
|
1533 |
|
|
qDebug() << "Generate Tree View!!!" << item->getNameData();
|
1534 |
|
|
m_peziDebugTreeModel = new EziDebugTreeModel(item,this);
|
1535 |
|
|
moduleTreeView->setModel(m_peziDebugTreeModel);
|
1536 |
|
|
}
|
1537 |
|
|
else
|
1538 |
|
|
{
|
1539 |
|
|
qDebug() << "Generate Tree View!!!" ;
|
1540 |
|
|
|
1541 |
|
|
// 插入链 删除链
|
1542 |
|
|
moduleTreeView->setModel(NULL);
|
1543 |
|
|
// 更新 图标
|
1544 |
|
|
if(!item)
|
1545 |
|
|
{
|
1546 |
|
|
}
|
1547 |
|
|
else
|
1548 |
|
|
{
|
1549 |
|
|
#if 0
|
1550 |
|
|
EziDebugInstanceTreeItem* poldTreeRootItem = m_peziDebugTreeModel->getInstanceTreeRootItem() ;
|
1551 |
|
|
qDebug() << "top item "<< item ;
|
1552 |
|
|
// 替换为新的头节点
|
1553 |
|
|
m_peziDebugTreeModel->setInstanceTreeRootItem(item);
|
1554 |
|
|
|
1555 |
|
|
/*成功则 删除 上次更新的所有节点 ,插入链的节点咱不能删除 */
|
1556 |
|
|
delete poldTreeRootItem ;
|
1557 |
|
|
|
1558 |
|
|
moduleTreeView->setModel(m_peziDebugTreeModel);
|
1559 |
|
|
#else
|
1560 |
|
|
// EziDebugInstanceTreeItem* poldTreeRootItem = m_peziDebugTreeModel->getInstanceTreeRootItem() ;
|
1561 |
|
|
|
1562 |
|
|
delete m_peziDebugTreeModel ;
|
1563 |
|
|
// 替换为新的头节点
|
1564 |
|
|
m_peziDebugTreeModel = new EziDebugTreeModel(item,this);
|
1565 |
|
|
|
1566 |
|
|
/*成功则 删除 上次更新的所有节点 ,插入链的节点咱不能删除 */
|
1567 |
|
|
//delete poldTreeRootItem ;
|
1568 |
|
|
|
1569 |
|
|
moduleTreeView->setModel(m_peziDebugTreeModel);
|
1570 |
|
|
|
1571 |
|
|
#endif
|
1572 |
|
|
}
|
1573 |
|
|
|
1574 |
|
|
}
|
1575 |
|
|
}
|
1576 |
|
|
|
1577 |
|
|
void ListWindow::clearTreeView(void)
|
1578 |
|
|
{
|
1579 |
|
|
if(moduleTreeView)
|
1580 |
|
|
{
|
1581 |
|
|
moduleTreeView->setModel(NULL);
|
1582 |
|
|
if(m_peziDebugTreeModel)
|
1583 |
|
|
{
|
1584 |
|
|
delete m_peziDebugTreeModel ;
|
1585 |
|
|
m_peziDebugTreeModel = NULL ;
|
1586 |
|
|
}
|
1587 |
|
|
}
|
1588 |
|
|
}
|
1589 |
|
|
|
1590 |
|
|
void ListWindow::welcomeinfoinit(EziDebugPrj *prj)
|
1591 |
|
|
{
|
1592 |
|
|
#if 0
|
1593 |
|
|
// (代码中的扫描链 在 log文件中不存在 说明log文件曾经被破坏过!)
|
1594 |
|
|
if(prj->getLogFileExistFlag()&&prj->getLogfileDestroyedFlag())
|
1595 |
|
|
{
|
1596 |
|
|
// 提示删除所有链 部分扫描链信息丢失 是否删除所有扫描链代码
|
1597 |
|
|
QMessageBox::StandardButton rb = QMessageBox::question(this, tr("部分扫描链信息丢失"), tr("是否删除所有扫描链代码?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
1598 |
|
|
if(rb == QMessageBox::Yes)
|
1599 |
|
|
{
|
1600 |
|
|
// 删除所有链代码
|
1601 |
|
|
currentPrj->deleteAllEziDebugCode(ivlgFileMap,ivhdlFileMap);
|
1602 |
|
|
// 删除所有链相关的信息
|
1603 |
|
|
QMap<QString,EziDebugScanChain*> ichainMap = currentPrj->getScanChainInfo();
|
1604 |
|
|
QMap<QString,EziDebugScanChain*>::const_iterator k = ichainMap.constBegin() ;
|
1605 |
|
|
while(k != ichainMap.constEnd())
|
1606 |
|
|
{
|
1607 |
|
|
EziDebugScanChain* pchain = k.value() ;
|
1608 |
|
|
if(pchain)
|
1609 |
|
|
{
|
1610 |
|
|
delete pchain ;
|
1611 |
|
|
pchain = NULL ;
|
1612 |
|
|
}
|
1613 |
|
|
++k ;
|
1614 |
|
|
}
|
1615 |
|
|
currentPrj->cleanupChainMap();
|
1616 |
|
|
currentPrj->cleanupChainTreeItemMap();
|
1617 |
|
|
currentPrj->cleanupChainQueryTreeItemMap();
|
1618 |
|
|
|
1619 |
|
|
// 删除log所有链信息 (新的log文件所以不用添加信息,此步可跳过)
|
1620 |
|
|
|
1621 |
|
|
// 清空 被破坏的扫描链list
|
1622 |
|
|
currentPrj->clearupDestroyedChainList();
|
1623 |
|
|
|
1624 |
|
|
}
|
1625 |
|
|
else
|
1626 |
|
|
{
|
1627 |
|
|
// 不处理
|
1628 |
|
|
}
|
1629 |
|
|
|
1630 |
|
|
}
|
1631 |
|
|
#endif
|
1632 |
|
|
if(prj)
|
1633 |
|
|
{
|
1634 |
|
|
if(!m_peziDebugTreeModel)
|
1635 |
|
|
{
|
1636 |
|
|
ToolWindow * pparent = static_cast<ToolWindow*>(toolWindow) ;
|
1637 |
|
|
|
1638 |
|
|
/*向文本栏 传递错误信息 待窗体显示的时候,显示给用户看*/
|
1639 |
|
|
addMessage("error","EziDebug error: The EziDebug config file has been destroyed!");
|
1640 |
|
|
|
1641 |
|
|
// log 文件被破坏, 可能还没有扫描到扫描链
|
1642 |
|
|
//if(prj->getScanChainInfo().count())
|
1643 |
|
|
//{
|
1644 |
|
|
// 配置文件被破坏 是否删除工程代码中所有的扫描链代码?
|
1645 |
4 |
EziDebug |
#if 0
|
1646 |
2 |
EziDebug |
QMessageBox::StandardButton rb = QMessageBox::question(this, tr("配置文件被破坏"), tr("是否删除工程代码中所有扫描链代码?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
1647 |
4 |
EziDebug |
#else
|
1648 |
|
|
QMessageBox::StandardButton rb = QMessageBox::question(this, tr("EziDebug"), tr("The configuration file has been destroyed,\n Do you want to delete all scan chain code ?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
1649 |
2 |
EziDebug |
|
1650 |
4 |
EziDebug |
#endif
|
1651 |
|
|
|
1652 |
2 |
EziDebug |
if(rb == QMessageBox::Yes)
|
1653 |
|
|
{
|
1654 |
|
|
QMap<QString,EziDebugVlgFile*> ivlgFileMap ;
|
1655 |
|
|
QMap<QString,EziDebugVhdlFile*> ivhdlFileMap ;
|
1656 |
|
|
if(EziDebugPrj::ToolQuartus == prj->getToolType())
|
1657 |
|
|
{
|
1658 |
|
|
prj->parseQuartusPrjFile(ivlgFileMap,ivhdlFileMap);
|
1659 |
|
|
}
|
1660 |
|
|
else if(EziDebugPrj::ToolIse == prj->getToolType())
|
1661 |
|
|
{
|
1662 |
|
|
prj->parseIsePrjFile(ivlgFileMap,ivhdlFileMap);
|
1663 |
|
|
}
|
1664 |
|
|
else
|
1665 |
|
|
{
|
1666 |
|
|
addMessage("error","EziDebug error: EziDebug is not support this kind project file parse!");
|
1667 |
|
|
delete prj ;
|
1668 |
|
|
pparent->setCurrentProject(NULL);
|
1669 |
|
|
}
|
1670 |
|
|
|
1671 |
|
|
// delete all ezidebug code
|
1672 |
|
|
prj->deleteAllEziDebugCode(ivlgFileMap,ivhdlFileMap) ;
|
1673 |
|
|
|
1674 |
|
|
// delete all log file
|
1675 |
|
|
addMessage("warning","EziDebug warning: The EziDebug config file has been deleted!");
|
1676 |
|
|
QFile ilogFile(prj->getCurrentDir().absoluteFilePath("config.ezi"));
|
1677 |
|
|
ilogFile.remove();
|
1678 |
|
|
|
1679 |
|
|
// set exist flag false
|
1680 |
|
|
//prj->setLogFileExistFlag(false);
|
1681 |
|
|
|
1682 |
|
|
delete prj ;
|
1683 |
|
|
pparent->setCurrentProject(NULL);
|
1684 |
|
|
|
1685 |
|
|
}
|
1686 |
|
|
else
|
1687 |
|
|
{
|
1688 |
|
|
// 如果不删除代码,不进行恢复
|
1689 |
|
|
delete prj ;
|
1690 |
|
|
pparent->setCurrentProject(NULL);
|
1691 |
|
|
}
|
1692 |
|
|
//}
|
1693 |
|
|
}
|
1694 |
|
|
else
|
1695 |
|
|
{
|
1696 |
|
|
QList<EziDebugPrj::LOG_FILE_INFO*> iaddedinfoList ;
|
1697 |
|
|
QList<EziDebugPrj::LOG_FILE_INFO*> ideletedinfoList ;
|
1698 |
|
|
QStringList iunDelChainList ;
|
1699 |
|
|
QStringList ideletedChainList ;
|
1700 |
|
|
|
1701 |
|
|
// (代码中的扫描链 在 log文件中不存在 说明log文件曾经被破坏过!)
|
1702 |
|
|
if(prj->getLogFileExistFlag()&&prj->getLogfileDestroyedFlag())
|
1703 |
|
|
{
|
1704 |
|
|
// 提示删除所有链
|
1705 |
|
|
// 部分扫描链信息丢失 是否删除所有扫描链代码
|
1706 |
4 |
EziDebug |
#if 0
|
1707 |
2 |
EziDebug |
QMessageBox::StandardButton rb = QMessageBox::question(this, tr("部分扫描链信息丢失"), tr("是否删除所有扫描链代码?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
1708 |
4 |
EziDebug |
#else
|
1709 |
|
|
QMessageBox::StandardButton rb = QMessageBox::question(this, tr("EziDebug"), tr("Some scan chain information has lost, \n Do you want to delete all scan chain code ?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
1710 |
|
|
#endif
|
1711 |
2 |
EziDebug |
if(rb == QMessageBox::Yes)
|
1712 |
|
|
{
|
1713 |
|
|
// 删除所有链代码
|
1714 |
|
|
|
1715 |
|
|
prj->deleteAllEziDebugCode(prj->getPrjVlgFileMap(),prj->getPrjVhdlFileMap());
|
1716 |
|
|
|
1717 |
|
|
QMap<QString,EziDebugVlgFile*>::const_iterator ivlgFileIter = prj->getPrjVlgFileMap().constBegin() ;
|
1718 |
|
|
while(ivlgFileIter != prj->getPrjVlgFileMap().constEnd())
|
1719 |
|
|
{
|
1720 |
|
|
QString irelativeFileName = ivlgFileIter.key() ;
|
1721 |
|
|
EziDebugVlgFile* pfile = ivlgFileIter.value() ;
|
1722 |
|
|
|
1723 |
|
|
EziDebugPrj::LOG_FILE_INFO* pdelFileInfo = new EziDebugPrj::LOG_FILE_INFO ;
|
1724 |
|
|
pdelFileInfo->etype = EziDebugPrj::infoTypeFileInfo ;
|
1725 |
|
|
pdelFileInfo->pinfo = NULL ;
|
1726 |
|
|
memcpy(pdelFileInfo->ainfoName , irelativeFileName.toAscii().data() , irelativeFileName.size()+1);
|
1727 |
|
|
ideletedinfoList.append(pdelFileInfo);
|
1728 |
|
|
|
1729 |
|
|
struct EziDebugPrj::LOG_FILE_INFO* paddFileInfo = new EziDebugPrj::LOG_FILE_INFO ;
|
1730 |
|
|
paddFileInfo->etype = EziDebugPrj::infoTypeFileInfo ;
|
1731 |
|
|
paddFileInfo->pinfo = pfile ;
|
1732 |
|
|
memcpy(paddFileInfo->ainfoName , irelativeFileName.toAscii().data(), irelativeFileName.size()+1);
|
1733 |
|
|
iaddedinfoList.append(paddFileInfo);
|
1734 |
|
|
|
1735 |
|
|
++ivlgFileIter ;
|
1736 |
|
|
}
|
1737 |
|
|
|
1738 |
|
|
|
1739 |
|
|
QMap<QString,EziDebugVhdlFile*>::const_iterator ivhdlFileIter = prj->getPrjVhdlFileMap().constBegin() ;
|
1740 |
|
|
while(ivhdlFileIter != prj->getPrjVhdlFileMap().constEnd())
|
1741 |
|
|
{
|
1742 |
|
|
QString irelativeFileName = ivhdlFileIter.key() ;
|
1743 |
|
|
EziDebugVhdlFile* pfile = ivhdlFileIter.value() ;
|
1744 |
|
|
EziDebugPrj::LOG_FILE_INFO* pdelFileInfo = new EziDebugPrj::LOG_FILE_INFO ;
|
1745 |
|
|
pdelFileInfo->etype = EziDebugPrj::infoTypeFileInfo ;
|
1746 |
|
|
pdelFileInfo->pinfo = NULL ;
|
1747 |
|
|
memcpy(pdelFileInfo->ainfoName , irelativeFileName.toAscii().data() , irelativeFileName.size()+1);
|
1748 |
|
|
ideletedinfoList.append(pdelFileInfo);
|
1749 |
|
|
|
1750 |
|
|
struct EziDebugPrj::LOG_FILE_INFO* paddFileInfo = new EziDebugPrj::LOG_FILE_INFO ;
|
1751 |
|
|
paddFileInfo->etype = EziDebugPrj::infoTypeFileInfo ;
|
1752 |
|
|
paddFileInfo->pinfo = pfile ;
|
1753 |
|
|
memcpy(paddFileInfo->ainfoName , irelativeFileName.toAscii().data(), irelativeFileName.size()+1);
|
1754 |
|
|
iaddedinfoList.append(paddFileInfo);
|
1755 |
|
|
++ivhdlFileIter ;
|
1756 |
|
|
}
|
1757 |
|
|
|
1758 |
|
|
|
1759 |
|
|
// 删除所有链相关的信息
|
1760 |
|
|
QMap<QString,EziDebugScanChain*> ichainMap = prj->getScanChainInfo();
|
1761 |
|
|
QMap<QString,EziDebugScanChain*>::const_iterator k = ichainMap.constBegin() ;
|
1762 |
|
|
while(k != ichainMap.constEnd())
|
1763 |
|
|
{
|
1764 |
|
|
QString ichainName = k.key() ;
|
1765 |
|
|
EziDebugScanChain* pchain = k.value() ;
|
1766 |
|
|
|
1767 |
|
|
// 从log文件中删除相关信息
|
1768 |
|
|
struct EziDebugPrj::LOG_FILE_INFO* pdelChainInfo = new EziDebugPrj::LOG_FILE_INFO ;
|
1769 |
|
|
memcpy(pdelChainInfo->ainfoName,ichainName.toAscii().data(),ichainName.size()+1);
|
1770 |
|
|
pdelChainInfo->pinfo = NULL ;
|
1771 |
|
|
pdelChainInfo->etype = EziDebugPrj::infoTypeScanChainStructure ;
|
1772 |
|
|
ideletedinfoList << pdelChainInfo ;
|
1773 |
|
|
|
1774 |
|
|
if(pchain)
|
1775 |
|
|
{
|
1776 |
|
|
delete pchain ;
|
1777 |
|
|
pchain = NULL ;
|
1778 |
|
|
}
|
1779 |
|
|
++k ;
|
1780 |
|
|
}
|
1781 |
|
|
prj->cleanupChainMap();
|
1782 |
|
|
prj->cleanupChainTreeItemMap();
|
1783 |
|
|
prj->cleanupChainQueryTreeItemMap();
|
1784 |
|
|
|
1785 |
|
|
// 删除log所有链信息 (新的log文件所以不用添加信息,此步可跳过)
|
1786 |
|
|
|
1787 |
|
|
// 清空 被破坏的扫描链list
|
1788 |
|
|
prj->clearupDestroyedChainList();
|
1789 |
|
|
|
1790 |
|
|
}
|
1791 |
|
|
else
|
1792 |
|
|
{
|
1793 |
|
|
// 不处理
|
1794 |
|
|
}
|
1795 |
|
|
|
1796 |
|
|
}
|
1797 |
|
|
|
1798 |
|
|
|
1799 |
|
|
if(prj->getDestroyedChainList().count())
|
1800 |
|
|
{
|
1801 |
|
|
// 把所有破坏掉的链打印出来
|
1802 |
|
|
|
1803 |
|
|
QString ichain ;
|
1804 |
|
|
QStringList idestroyedChainList = prj->getDestroyedChainList() ;
|
1805 |
|
|
|
1806 |
|
|
addMessage("error","The destroyed chain are:");
|
1807 |
|
|
for(int i = 0 ; i < idestroyedChainList.count() ;i++)
|
1808 |
|
|
{
|
1809 |
|
|
QString ichainName = idestroyedChainList.at(i) ;
|
1810 |
|
|
|
1811 |
|
|
EziDebugInstanceTreeItem *pitem = prj->getChainTreeItemMap().value(ichainName);
|
1812 |
|
|
if(pitem)
|
1813 |
|
|
{
|
1814 |
|
|
ichain.append(tr("EziDebug chain: %1 topInstance: %2:%3").arg(ichainName)\
|
1815 |
|
|
.arg(pitem->getModuleName()).arg(pitem->getInstanceName())) ;
|
1816 |
|
|
}
|
1817 |
|
|
addMessage("error",ichain);
|
1818 |
|
|
}
|
1819 |
|
|
|
1820 |
|
|
// 是否删除相关扫描链代码,否则相应扫描链不可用!
|
1821 |
4 |
EziDebug |
#if 0
|
1822 |
2 |
EziDebug |
QMessageBox::StandardButton rb = QMessageBox::question(this, tr("部分扫描链被破坏"), tr("相关扫描链不可用,是否删除相关扫描链代码?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
1823 |
4 |
EziDebug |
#else
|
1824 |
|
|
QMessageBox::StandardButton rb = QMessageBox::question(this, tr("EziDebug"), tr("Some scan chains has been destroyed ,\n Do you want to delete all scan chain code ?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
1825 |
|
|
#endif
|
1826 |
2 |
EziDebug |
if(rb == QMessageBox::Yes)
|
1827 |
|
|
{
|
1828 |
|
|
iunDelChainList = prj->deleteDestroyedChain(iaddedinfoList,ideletedinfoList) ;
|
1829 |
|
|
if(iunDelChainList.count())
|
1830 |
|
|
{
|
1831 |
4 |
EziDebug |
addMessage("error","EziDebug error: Some chains can not be deleted for some reasons!");
|
1832 |
2 |
EziDebug |
for(int i = 0 ; i < iunDelChainList.count() ;i++)
|
1833 |
|
|
{
|
1834 |
|
|
addMessage("error",tr("EziDebug chain:%1").arg(iunDelChainList.at(i)));
|
1835 |
|
|
}
|
1836 |
4 |
EziDebug |
addMessage("error","EziDebug error: Please check the code file is compiled successfully or not!");
|
1837 |
2 |
EziDebug |
}
|
1838 |
|
|
|
1839 |
|
|
for(int i = 0 ; i < idestroyedChainList.count() ; i++)
|
1840 |
|
|
{
|
1841 |
|
|
QString idestroyedChain = idestroyedChainList.at(i) ;
|
1842 |
|
|
if(!iunDelChainList.contains(idestroyedChain))
|
1843 |
|
|
{
|
1844 |
|
|
ideletedChainList.append(idestroyedChain);
|
1845 |
|
|
struct EziDebugPrj::LOG_FILE_INFO* pdelChainInfo = new EziDebugPrj::LOG_FILE_INFO ;
|
1846 |
|
|
memcpy(pdelChainInfo->ainfoName,idestroyedChain.toAscii().data(),idestroyedChain.size()+1);
|
1847 |
|
|
pdelChainInfo->pinfo = NULL ;
|
1848 |
|
|
pdelChainInfo->etype = EziDebugPrj::infoTypeScanChainStructure ;
|
1849 |
|
|
ideletedinfoList << pdelChainInfo ;
|
1850 |
|
|
}
|
1851 |
|
|
}
|
1852 |
|
|
|
1853 |
|
|
}
|
1854 |
|
|
}
|
1855 |
|
|
|
1856 |
|
|
QStringList icheckChainList = prj->checkChainExist();
|
1857 |
|
|
|
1858 |
|
|
for(int i = 0 ; i < icheckChainList.count() ;i++)
|
1859 |
|
|
{
|
1860 |
|
|
QString iupdatedChain = icheckChainList.at(i) ;
|
1861 |
|
|
if(!ideletedChainList.contains(iupdatedChain))
|
1862 |
|
|
{
|
1863 |
|
|
struct EziDebugPrj::LOG_FILE_INFO* pdelChainInfo = new EziDebugPrj::LOG_FILE_INFO ;
|
1864 |
|
|
memcpy(pdelChainInfo->ainfoName,iupdatedChain.toAscii().data(),iupdatedChain.size()+1);
|
1865 |
|
|
pdelChainInfo->pinfo = NULL ;
|
1866 |
|
|
pdelChainInfo->etype = EziDebugPrj::infoTypeScanChainStructure ;
|
1867 |
|
|
ideletedinfoList << pdelChainInfo ;
|
1868 |
|
|
|
1869 |
|
|
struct EziDebugPrj::LOG_FILE_INFO* paddChainInfo = new EziDebugPrj::LOG_FILE_INFO ;
|
1870 |
|
|
memcpy(paddChainInfo->ainfoName,iupdatedChain.toAscii().data(),iupdatedChain.size()+1);
|
1871 |
|
|
paddChainInfo->pinfo = paddChainInfo ;
|
1872 |
|
|
paddChainInfo->etype = EziDebugPrj::infoTypeScanChainStructure ;
|
1873 |
|
|
iaddedinfoList << paddChainInfo ;
|
1874 |
|
|
}
|
1875 |
|
|
}
|
1876 |
|
|
|
1877 |
|
|
#if 0
|
1878 |
|
|
if(prj->getScanChainInfo().count())
|
1879 |
|
|
{
|
1880 |
|
|
QMap<QString,EziDebugScanChain*>::const_iterator iaddedChainIter = prj->getScanChainInfo().constBegin() ;
|
1881 |
|
|
while(iaddedChainIter != prj->getScanChainInfo().constEnd())
|
1882 |
|
|
{
|
1883 |
|
|
QString ichainName = iaddedChainIter.key();
|
1884 |
|
|
struct EziDebugPrj::LOG_FILE_INFO* pinfo = new EziDebugPrj::LOG_FILE_INFO ;
|
1885 |
|
|
memcpy(pinfo->ainfoName ,ichainName.toAscii().data(),ichainName.size()+1);
|
1886 |
|
|
pinfo->pinfo = iaddedChainIter.value() ;
|
1887 |
|
|
pinfo->etype = EziDebugPrj::infoTypeScanChainStructure ;
|
1888 |
|
|
iaddedinfoList << pinfo ;
|
1889 |
|
|
++iaddedChainIter ;
|
1890 |
|
|
}
|
1891 |
|
|
}
|
1892 |
|
|
#endif
|
1893 |
|
|
|
1894 |
|
|
if(prj->changedLogFile(iaddedinfoList,ideletedinfoList))
|
1895 |
|
|
{
|
1896 |
|
|
//提示 保存 log 文件出错
|
1897 |
|
|
addMessage("info","EziDebug info: changedLogFile encounter some problem!");
|
1898 |
|
|
}
|
1899 |
|
|
|
1900 |
|
|
|
1901 |
|
|
// 删除 新分配的 log_file_info 指针
|
1902 |
|
|
|
1903 |
|
|
qDeleteAll(iaddedinfoList);
|
1904 |
|
|
qDeleteAll(ideletedinfoList);
|
1905 |
|
|
|
1906 |
4 |
EziDebug |
QStandardItem * pitem = addMessage("info",tr("EziDebug info: The default project parameters:"));
|
1907 |
|
|
addMessage("process",tr(" Scanchain Max Register Number: %1").arg(prj->getMaxRegNumPerChain()),pitem);
|
1908 |
2 |
EziDebug |
addMessage("process",tr(" Project Path: %1").arg(prj->getCurrentDir().absolutePath()),pitem);
|
1909 |
|
|
addMessage("process",tr(" Compile Software: \"%1\"").arg((prj->getToolType() == EziDebugPrj::ToolQuartus) ? ("quartus") :("ise")),pitem);
|
1910 |
|
|
|
1911 |
|
|
if(prj->getChainTreeItemMap().count())
|
1912 |
|
|
{
|
1913 |
|
|
QStandardItem * psecondItem = addMessage("info"," EziDebug info: The existed chains are:",pitem);
|
1914 |
|
|
QMap<QString,EziDebugInstanceTreeItem*> itreeItemMap = prj->getChainTreeItemMap() ;
|
1915 |
|
|
QMap<QString,EziDebugInstanceTreeItem*>::const_iterator i = itreeItemMap.constBegin() ;
|
1916 |
|
|
while( i!= itreeItemMap.constEnd())
|
1917 |
|
|
{
|
1918 |
|
|
EziDebugInstanceTreeItem* pitem = i.value();
|
1919 |
|
|
addMessage("process",tr(" EziDebug chain: %1\tInstance Node:%2").arg(i.key()).arg(pitem->getNameData()),psecondItem);
|
1920 |
|
|
EziDebugScanChain *pscanChain = pitem->getScanChainInfo();
|
1921 |
|
|
QString iclockNumStr ;
|
1922 |
|
|
QString itraversedInstStr ;
|
1923 |
|
|
QMap<QString,QVector<QStringList> > iregChain = pscanChain->getRegChain();
|
1924 |
|
|
QMap<QString,QVector<QStringList> >::const_iterator iregChainIter = iregChain.constBegin() ;
|
1925 |
|
|
while( iregChainIter != iregChain.constEnd())
|
1926 |
|
|
{
|
1927 |
|
|
iclockNumStr.append(tr("%1 (%2) ").arg(pscanChain->getChainRegCount(iregChainIter.key())).arg(iregChainIter.key()));
|
1928 |
|
|
++iregChainIter ;
|
1929 |
|
|
}
|
1930 |
|
|
|
1931 |
|
|
addMessage("process" , tr(" The chain total reg number: %1").arg(iclockNumStr),psecondItem);
|
1932 |
|
|
addMessage("process" , tr(" The traversed NodeList:"),psecondItem);
|
1933 |
|
|
|
1934 |
|
|
for(int j = 0 ; j < pscanChain->getInstanceItemList().count() ;j++)
|
1935 |
|
|
{
|
1936 |
|
|
itraversedInstStr.append(tr(" -> ") + pscanChain->getInstanceItemList().at(j)) ;
|
1937 |
|
|
if((j+1)%3 == 0)
|
1938 |
|
|
{
|
1939 |
|
|
addMessage("process" , tr(" ") + itraversedInstStr,psecondItem);
|
1940 |
|
|
itraversedInstStr.clear();
|
1941 |
|
|
}
|
1942 |
|
|
}
|
1943 |
|
|
addMessage("process" , tr(" ") + itraversedInstStr,psecondItem);
|
1944 |
|
|
|
1945 |
|
|
++i ;
|
1946 |
|
|
}
|
1947 |
|
|
}
|
1948 |
|
|
|
1949 |
|
|
|
1950 |
|
|
UpdateDetectThread * pthread = prj->getThread() ;
|
1951 |
|
|
pthread->start();
|
1952 |
|
|
}
|
1953 |
|
|
}
|
1954 |
|
|
}
|
1955 |
|
|
|
1956 |
|
|
|
1957 |
|
|
QPushButton *ListWindow::createToolButton(const QString &toolTip, const QIcon &icon,
|
1958 |
|
|
const QSize &size, const char *member)
|
1959 |
|
|
{
|
1960 |
|
|
QPushButton *button = new QPushButton(this);
|
1961 |
|
|
button->setToolTip(toolTip);
|
1962 |
|
|
button->setIcon(icon);
|
1963 |
|
|
button->setIconSize(size);//(QSize(10, 10));
|
1964 |
|
|
// button->setSizeIncrement(size);
|
1965 |
|
|
//button->setSizePolicy(size.width(), size.height());
|
1966 |
|
|
button->setFlat(true);
|
1967 |
|
|
connect(button, SIGNAL(clicked()), this, member);
|
1968 |
|
|
|
1969 |
|
|
return button;
|
1970 |
|
|
}
|
1971 |
|
|
|
1972 |
|
|
void ListWindow::find()
|
1973 |
|
|
{
|
1974 |
|
|
if (!findDialog) {
|
1975 |
|
|
findDialog = new FindDialog;
|
1976 |
|
|
// connect(findDialog, SIGNAL(findNext(const QString &,
|
1977 |
|
|
// Qt::CaseSensitivity)),
|
1978 |
|
|
// spreadsheet, SLOT(findNext(const QString &,
|
1979 |
|
|
// Qt::CaseSensitivity)));
|
1980 |
|
|
// connect(findDialog, SIGNAL(findPrevious(const QString &,
|
1981 |
|
|
// Qt::CaseSensitivity)),
|
1982 |
|
|
// spreadsheet, SLOT(findPrevious(const QString &,
|
1983 |
|
|
// Qt::CaseSensitivity)));
|
1984 |
|
|
}
|
1985 |
|
|
|
1986 |
|
|
findDialog->show();
|
1987 |
|
|
findDialog->raise();
|
1988 |
|
|
findDialog->activateWindow();
|
1989 |
|
|
}
|
1990 |
|
|
|
1991 |
|
|
|
1992 |
|
|
//控制列表窗口是否隐藏
|
1993 |
|
|
void ListWindow::setListWindowHidden(bool flag)
|
1994 |
|
|
{
|
1995 |
|
|
isListWindowHiddenFlag = flag;
|
1996 |
|
|
if(isListWindowHiddenFlag)
|
1997 |
|
|
this->hide();
|
1998 |
|
|
else
|
1999 |
|
|
this->showNormal();
|
2000 |
|
|
}
|
2001 |
|
|
|
2002 |
|
|
//获取普通模式下,ToolWindow不隐藏时,列表窗口是否隐藏
|
2003 |
|
|
bool ListWindow::isListWindowHidden()
|
2004 |
|
|
{
|
2005 |
|
|
return isListWindowHiddenFlag;
|
2006 |
|
|
}
|
2007 |
|
|
|
2008 |
|
|
void ListWindow::enterEvent(QEvent * event)
|
2009 |
|
|
{
|
2010 |
|
|
// QMouseEvent * mouseEvent = (QMouseEvent *) event ;
|
2011 |
|
|
// qDebug()<<"enter Event" << mouseEvent->x()<< mouseEvent->y()<< this->frameGeometry().right();
|
2012 |
|
|
// eDirection = (enum_Direction)PointValid(mouseEvent->x(),mouseEvent->y());
|
2013 |
|
|
// SetCursorStyle(eDirection);
|
2014 |
|
|
}
|
2015 |
|
|
|
2016 |
|
|
void ListWindow::leaveEvent(QEvent * event)
|
2017 |
|
|
{
|
2018 |
|
|
// QMouseEvent * mouseEvent = (QMouseEvent *) event ;
|
2019 |
|
|
// qDebug()<<"leave Event" << mouseEvent->x()<< mouseEvent->y()<< this->frameGeometry().right();
|
2020 |
|
|
// eDirection = (enum_Direction)PointValid(mouseEvent->x(),mouseEvent->y());
|
2021 |
|
|
// SetCursorStyle(eDirection);
|
2022 |
|
|
}
|
2023 |
|
|
|
2024 |
|
|
void ListWindow::setChainActEnable(bool addenable,bool delenable)
|
2025 |
|
|
{
|
2026 |
|
|
// m_paddChainAct->setEnabled(addenable) ;
|
2027 |
|
|
// m_pdeleteChainAct->setEnabled(delenable) ;
|
2028 |
|
|
}
|
2029 |
|
|
|
2030 |
|
|
////工具栏窗口只需要获取isListWindowAdsorbed,而不需要更改之
|
2031 |
|
|
//bool ListWindow::isListWindowAdsorbed()
|
2032 |
|
|
//{
|
2033 |
|
|
// return isListWindowAdsorbedFlag;
|
2034 |
|
|
//}
|
2035 |
|
|
|
2036 |
|
|
EziDebugInstanceTreeItem * ListWindow::getCurrentTreeItem(void)
|
2037 |
|
|
{
|
2038 |
|
|
return m_ptreeItem ;
|
2039 |
|
|
}
|
2040 |
|
|
|
2041 |
|
|
void ListWindow::setCurrentTreeItem(EziDebugInstanceTreeItem * item)
|
2042 |
|
|
{
|
2043 |
|
|
m_ptreeItem = item ;
|
2044 |
|
|
}
|