mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
ping time display is working again
This commit is contained in:
parent
4fac0e5b5a
commit
6c93b1e9b7
5 changed files with 26 additions and 47 deletions
|
|
@ -26,34 +26,6 @@
|
|||
#include "window_deckeditor.h"
|
||||
#include "tab_supervisor.h"
|
||||
|
||||
PingWidget::PingWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
setPercentage(0, -1);
|
||||
}
|
||||
|
||||
QSize PingWidget::sizeHint() const
|
||||
{
|
||||
return QSize(15, 15);
|
||||
}
|
||||
|
||||
void PingWidget::paintEvent(QPaintEvent */*event*/)
|
||||
{
|
||||
QPainter painter(this);
|
||||
QRadialGradient g(QPointF((double) width() / 2, (double) height() / 2), qMin(width(), height()) / 2.0);
|
||||
g.setColorAt(0, color);
|
||||
g.setColorAt(1, Qt::transparent);
|
||||
painter.fillRect(0, 0, width(), height(), QBrush(g));
|
||||
}
|
||||
|
||||
void PingWidget::setPercentage(int value, int max)
|
||||
{
|
||||
if (max == -1)
|
||||
color = Qt::black;
|
||||
else
|
||||
color.setHsv(120 * (1.0 - ((double) value / max)), 255, 255);
|
||||
update();
|
||||
}
|
||||
/*
|
||||
void MainWindow::playerAdded(Player *player)
|
||||
{
|
||||
|
|
@ -75,7 +47,6 @@ void MainWindow::statusChanged(ClientStatus _status)
|
|||
// delete game;
|
||||
// game = 0;
|
||||
// }
|
||||
// pingWidget->setPercentage(0, -1);
|
||||
aConnect->setEnabled(true);
|
||||
aDisconnect->setEnabled(false);
|
||||
// aRestartGame->setEnabled(false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue