-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2. Add bit count for frame 3. fix compile error under vs2012
- Loading branch information
Showing
18 changed files
with
383 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,7 @@ | |
|
||
#include <time.h> | ||
#include <math.h> | ||
#include <functional> | ||
|
||
using namespace std; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#include "timelineframeitem.h" | ||
#include <QDebug> | ||
#include <QPen> | ||
#include <QFont> | ||
#include <QBrush> | ||
#include <QColor> | ||
TimeLineFrameItem::TimeLineFrameItem(int iPercent, int iPOC) | ||
{ | ||
m_iMaxWidth = 20; | ||
m_iMaxHeight = 50; | ||
m_iPOC = iPOC; | ||
|
||
/// layout | ||
m_cFrameBar.setRect(0,0,m_iMaxWidth,m_iMaxHeight); | ||
|
||
m_cHitArea.setRect(0,-m_iMaxHeight*1.5,m_iMaxWidth,m_iMaxHeight*3); | ||
m_cHitArea.setPen(Qt::NoPen); | ||
|
||
m_cPocText.setPos(0,0); | ||
|
||
QFont cFont; | ||
cFont.setPointSize(12); | ||
cFont.setBold(true); | ||
m_cPocText.setFont(cFont); | ||
m_cPocText.setBrush(QBrush(QColor(Qt::gray))); | ||
m_cPocText.setText(QString("#%1").arg(m_iPOC)); | ||
m_cPocText.setPos(19,10); | ||
m_cPocText.setRotation(90); | ||
|
||
|
||
/// change frame bar height | ||
setHeightPercent(iPercent); | ||
|
||
/// group | ||
this->addToGroup(&m_cFrameBar); | ||
this->addToGroup(&m_cHitArea); | ||
this->addToGroup(&m_cPocText); | ||
|
||
/// | ||
setAcceptHoverEvents(true); | ||
} | ||
|
||
void TimeLineFrameItem::mousePressEvent(QGraphicsSceneMouseEvent * event) | ||
{ | ||
if(m_iPOC < 0) | ||
{ | ||
qWarning() << QString("Frame Bar With Invalid POC Num %1").arg(m_iPOC); | ||
return; | ||
} | ||
emit barClick(m_iPOC); | ||
} | ||
|
||
void TimeLineFrameItem::hoverEnterEvent(QGraphicsSceneHoverEvent * event) | ||
{ | ||
m_cHitArea.setBrush(QBrush(QColor(0,255,0,50))); | ||
m_cHitArea.update(m_cHitArea.rect()); | ||
} | ||
|
||
void TimeLineFrameItem::hoverLeaveEvent(QGraphicsSceneHoverEvent * event) | ||
{ | ||
m_cHitArea.setBrush(QBrush(QColor(0,255,0,0))); | ||
m_cHitArea.update(m_cHitArea.rect()); | ||
} | ||
|
||
|
||
void TimeLineFrameItem::setHeightPercent(int iPercent) | ||
{ | ||
if(iPercent < 0 || iPercent > 100) | ||
{ | ||
qWarning() << QString("Invalid Timeline Frame Bar Height Percentage %1").arg(iPercent); | ||
return; | ||
} | ||
m_iHeightPercent = iPercent; | ||
QRectF cRect= m_cFrameBar.rect(); | ||
cRect.setHeight(-m_iMaxHeight*iPercent/100); | ||
m_cFrameBar.setRect(cRect); | ||
|
||
/// set fill color according to height | ||
m_cFrameBar.setPen(QPen(QColor(255,255,255,128))); | ||
QColor cFillColor; | ||
|
||
int iClip = VALUE_CLIP(0, 240, iPercent*240/100); | ||
double dHue = (240-iClip)/360.0; | ||
cFillColor.setHsvF(dHue, 1.0, 1.0, 0.6); | ||
m_cFrameBar.setBrush(QBrush(cFillColor)); | ||
|
||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#ifndef TIMELINEFRAMEITEM_H | ||
#define TIMELINEFRAMEITEM_H | ||
|
||
#include <QGraphicsItemGroup> | ||
#include <QGraphicsRectItem> | ||
#include <QGraphicsSimpleTextItem> | ||
#include <QObject> | ||
#include "gitldef.h" | ||
|
||
class TimeLineFrameItem : public QObject, public QGraphicsItemGroup | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit TimeLineFrameItem(int iPercent = 0, int iPOC = -1); | ||
void setHeightPercent(int iPercent); | ||
protected: | ||
void mousePressEvent(QGraphicsSceneMouseEvent * event); | ||
void hoverEnterEvent(QGraphicsSceneHoverEvent * event); | ||
void hoverLeaveEvent(QGraphicsSceneHoverEvent * event); | ||
signals: | ||
void barClick(int iPOC); | ||
|
||
|
||
ADD_CLASS_FIELD(int, iPOC, getPOC, setPOC) | ||
ADD_CLASS_FIELD_NOSETTER(int, iHeightPercent, getHeightPercent) | ||
ADD_CLASS_FIELD(int, iMaxHeight, getMaxHeight, setMaxHeight) | ||
ADD_CLASS_FIELD(int, iMaxWidth, getMaxWidth, setMaxWidth) | ||
|
||
ADD_CLASS_FIELD_PRIVATE(QGraphicsRectItem, cFrameBar) | ||
ADD_CLASS_FIELD_PRIVATE(QGraphicsRectItem, cHitArea) | ||
ADD_CLASS_FIELD_PRIVATE(QGraphicsSimpleTextItem, cPocText) | ||
}; | ||
|
||
#endif // TIMELINEFRAMEITEM_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "timelineindicatoritem.h" | ||
#include <QColor> | ||
#include <QPen> | ||
#include <QBrush> | ||
TimelineIndicatorItem::TimelineIndicatorItem() | ||
{ | ||
|
||
m_cRectTop.setRect(0,0,10,16); | ||
m_cRectTop.setPen(QColor(255,255,255,128)); | ||
m_cRectTop.setBrush(QColor(255,0,0,255)); | ||
addToGroup(&m_cRectTop); | ||
|
||
|
||
QRectF cUpperRect = m_cRectTop.rect(); | ||
QPointF cBL = (cUpperRect.bottomLeft()+cUpperRect.bottomRight())/2; | ||
|
||
m_cRectBar.setRect(cBL.x()-1,cBL.y(),3,65); | ||
m_cRectBar.setPen(Qt::NoPen); | ||
m_cRectBar.setBrush(QColor(255,0,0,255)); | ||
addToGroup(&m_cRectBar); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef TIMELINEINDICATORITEM_H | ||
#define TIMELINEINDICATORITEM_H | ||
|
||
#include <QGraphicsItemGroup> | ||
#include <QGraphicsPolygonItem> | ||
#include <QGraphicsRectItem> | ||
#include "gitldef.h" | ||
|
||
class TimelineIndicatorItem : public QGraphicsItemGroup | ||
{ | ||
public: | ||
TimelineIndicatorItem(); | ||
|
||
|
||
|
||
ADD_CLASS_FIELD_PRIVATE(QGraphicsRectItem, cRectTop) | ||
ADD_CLASS_FIELD_PRIVATE(QGraphicsRectItem, cRectBar) | ||
|
||
}; | ||
|
||
#endif // TIMELINEINDICATORITEM_H |
Oops, something went wrong.