2 // tmpwindow.cpp: Disk structure window
4 // Part of the WOZ Maker project
6 // (C) 2018 Underground Software
14 TmpWindow::TmpWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Window)
16 setGeometry(QRect(0, 0, 1024, 1024));
17 setMinimumWidth(1024);
18 setMinimumHeight(1024);
19 setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
23 TmpWindow::~TmpWindow(void)
28 void TmpWindow::paintEvent(QPaintEvent * /*event*/)
30 QPainter painter(this);
31 painter.setRenderHint(QPainter::Antialiasing);
33 QPen dkGreyPen(QColor(0x3A, 0x3B, 0x3A, 0xFF), 1.0, Qt::SolidLine);
34 QBrush dkGreyBrush(QColor(0x3A, 0x3B, 0x3A, 0xFF));
37 painter.setPen(dkGreyPen);
38 painter.setBrush(dkGreyBrush);
39 painter.drawEllipse(0, 0, 1024, 1024);
40 painter.setPen(Qt::white);
41 painter.setBrush(Qt::white);
42 painter.drawEllipse(388, 388, 248, 248);
44 // Draw disk track data
45 uint8_t lastLocation = 0xFF;
46 uint32_t x = 4, y = 4, w = 1024 - (2 * 4);
48 for(uint32_t str=0; str<Global::numStreams; str++)
50 if (Global::stream[str]->location != lastLocation)
52 uint32_t splicePoint = Uint32LE(Global::stream[str]->estLoopPoint);
53 float angleTime = (float)splicePoint / (5760.0f / 2.0f);
56 float curTime = angleTime;
58 for(uint32_t i=0; i<5760; i+=2)
62 while (strTime < curTime)
64 while (Global::stream[str]->data[pos] == 0xFF)
65 strTime += Global::stream[str]->data[pos++];
67 strTime += Global::stream[str]->data[pos++];
71 uint32_t color = ((ones * 32.0f) / angleTime) * 255.0f;
76 painter.setPen(QPen(QColor(color, color, color, 0xFF), 1.0, Qt::SolidLine));
77 painter.drawArc(x, y, w, w, -i, 2);
78 painter.drawArc(x+1, y+1, w-2, w-2, -i, 2);
86 lastLocation = Global::stream[str]->location;