mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
faster, synchronized spinners
This commit is contained in:
parent
1e2f801dfe
commit
c2ddc91d58
@ -60,7 +60,7 @@ ChatMessage::Ptr ChatMessage::createChatMessage(const QString &sender, const QSt
|
|||||||
|
|
||||||
msg->addColumn(new Text(isAction ? "<div class=action>*</div>" : sender, isMe ? Style::getFont(Style::BigBold) : Style::getFont(Style::Big), isAction ? false : true, sender), ColumnFormat(NAME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right));
|
msg->addColumn(new Text(isAction ? "<div class=action>*</div>" : sender, isMe ? Style::getFont(Style::BigBold) : Style::getFont(Style::Big), isAction ? false : true, sender), ColumnFormat(NAME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right));
|
||||||
msg->addColumn(new Text(text, Style::getFont(Style::Big), false, isAction ? QString("*%1 %2*").arg(sender, rawMessage) : rawMessage), ColumnFormat(1.0, ColumnFormat::VariableSize));
|
msg->addColumn(new Text(text, Style::getFont(Style::Big), false, isAction ? QString("*%1 %2*").arg(sender, rawMessage) : rawMessage), ColumnFormat(1.0, ColumnFormat::VariableSize));
|
||||||
msg->addColumn(new Spinner(":/ui/chatArea/spinner.svg", QSize(16, 16), 4.0), ColumnFormat(TIME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right));
|
msg->addColumn(new Spinner(":/ui/chatArea/spinner.svg", QSize(16, 16), 360.0/1.6), ColumnFormat(TIME_COL_WIDTH, ColumnFormat::FixedSize, ColumnFormat::Right));
|
||||||
|
|
||||||
if(!date.isNull())
|
if(!date.isNull())
|
||||||
msg->markAsSent(date);
|
msg->markAsSent(date);
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
|
#include <QTime>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
Spinner::Spinner(const QString &img, QSize Size, qreal speed)
|
Spinner::Spinner(const QString &img, QSize Size, qreal speed)
|
||||||
@ -44,7 +45,7 @@ void Spinner::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, Q
|
|||||||
|
|
||||||
QTransform rotMat;
|
QTransform rotMat;
|
||||||
rotMat.translate(size.width() / 2.0, size.height() / 2.0);
|
rotMat.translate(size.width() / 2.0, size.height() / 2.0);
|
||||||
rotMat.rotate(rot);
|
rotMat.rotate(QTime::currentTime().msecsSinceStartOfDay() / 1000.0 * rotSpeed);
|
||||||
rotMat.translate(-size.width() / 2.0, -size.height() / 2.0);
|
rotMat.translate(-size.width() / 2.0, -size.height() / 2.0);
|
||||||
|
|
||||||
painter->translate(-size.width() / 2.0, -size.height() / 2.0);
|
painter->translate(-size.width() / 2.0, -size.height() / 2.0);
|
||||||
@ -76,8 +77,6 @@ qreal Spinner::getAscent() const
|
|||||||
|
|
||||||
void Spinner::timeout()
|
void Spinner::timeout()
|
||||||
{
|
{
|
||||||
rot += rotSpeed;
|
|
||||||
|
|
||||||
if(scene())
|
if(scene())
|
||||||
scene()->invalidate(sceneBoundingRect());
|
scene()->invalidate(sceneBoundingRect());
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,6 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
QSize size;
|
QSize size;
|
||||||
QPixmap pmap;
|
QPixmap pmap;
|
||||||
qreal rot = 0.0;
|
|
||||||
qreal rotSpeed;
|
qreal rotSpeed;
|
||||||
QTimer timer;
|
QTimer timer;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user