Skip to content

Commit b0d700e

Browse files
author
Mich
committed
Full code upload
1 parent 5e88638 commit b0d700e

38 files changed

+43300
-0
lines changed

3dres.qrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<RCC>
2+
<qresource prefix="/">
3+
<file>presentation/3DOrientationV2.uia</file>
4+
<file>presentation/presentations/3DOrientationV2.uip</file>
5+
<file>presentation/materials/circle-stroke-01p.materialdef</file>
6+
<file>presentation/materials/Material.materialdef</file>
7+
<file>presentation/materials/Material2.materialdef</file>
8+
<file>presentation/materials/Material4.materialdef</file>
9+
<file>presentation/materials/Material5.materialdef</file>
10+
<file>presentation/materials/Material32.materialdef</file>
11+
<file>presentation/materials/materialCube1.materialdef</file>
12+
<file>presentation/materials/materialCube2.materialdef</file>
13+
</qresource>
14+
</RCC>

3dres2.qrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<RCC>
2+
<qresource prefix="/">
3+
<file>presentation2/SampleProject.uia</file>
4+
<file>presentation2/SampleProject.uip</file>
5+
<file>presentation2/models/Speedometer/Speedometer.import</file>
6+
<file>presentation2/maps/materials/shadow.png</file>
7+
<file>presentation2/maps/materials/spherical_checker.png</file>
8+
<file>presentation2/materials/simple_glass.material</file>
9+
<file>presentation2/models/Speedometer/maps/Speed.png</file>
10+
<file>presentation2/models/Speedometer/meshes/NeedleSpeed.mesh</file>
11+
<file>presentation2/models/Speedometer/meshes/Speedometer.mesh</file>
12+
</qresource>
13+
</RCC>

3dview.qrc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<RCC>
2+
<qresource prefix="/">
3+
<file>presentation/materials/circle-stroke-01p.materialdef</file>
4+
<file>presentation/materials/Material.materialdef</file>
5+
<file>presentation/materials/Material2.materialdef</file>
6+
<file>presentation/materials/Material4.materialdef</file>
7+
<file>presentation/materials/Material5.materialdef</file>
8+
<file>presentation/materials/Material32.materialdef</file>
9+
<file>presentation/materials/materialCube1.materialdef</file>
10+
<file>presentation/materials/materialCube2.materialdef</file>
11+
<file>presentation/maps/circle-stroke-01p.png</file>
12+
<file>presentation/3DOrientationV2.uia</file>
13+
<file>presentation/presentations/3DOrientationV2.uip</file>
14+
</qresource>
15+
</RCC>

QtSM.ico

18.5 KB
Binary file not shown.

advancedgraphmenu.cpp

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#include "advancedgraphmenu.h"
2+
#include "ui_advancedgraphmenu.h"
3+
4+
AdvancedGraphMenu::AdvancedGraphMenu(QWidget *parent) :
5+
QDialog(parent),
6+
ui(new Ui::AdvancedGraphMenu)
7+
{
8+
ui->setupUi(this);
9+
10+
QObject::connect(ui->listWidgetLabels, SIGNAL(itemChanged(QListWidgetItem*)),
11+
this, SLOT(highlightChecked(QListWidgetItem*)));
12+
}
13+
14+
AdvancedGraphMenu::~AdvancedGraphMenu()
15+
{
16+
delete ui;
17+
}
18+
19+
void AdvancedGraphMenu::createConnections()
20+
{
21+
for(int i = 0; i < ui->listWidgetLabels->count(); ++i)
22+
{
23+
ui->listWidgetLabels->item(i)->setFlags(ui->listWidgetLabels->item(i)->flags() | Qt::ItemIsUserCheckable);
24+
}
25+
}
26+
27+
void AdvancedGraphMenu::addLabelToList(QString label)
28+
{
29+
ui->listWidgetLabels->addItem(label);
30+
ui->listWidgetLabels->item(ui->listWidgetLabels->count() - 1)->setFlags(ui->listWidgetLabels->item(ui->listWidgetLabels->count() - 1)->flags() | Qt::ItemIsUserCheckable);
31+
ui->listWidgetLabels->item(ui->listWidgetLabels->count() - 1)->setCheckState(Qt::Unchecked);
32+
}
33+
34+
void AdvancedGraphMenu::highlightChecked(QListWidgetItem* item)
35+
{
36+
qDebug() << item->text();
37+
}
38+
39+
bool AdvancedGraphMenu::searchForItem(QString label)
40+
{
41+
for (auto i = 0; i < ui->listWidgetLabels->count(); ++i)
42+
{
43+
if (ui->listWidgetLabels->item(i)->text().compare(label) == 0)
44+
return true;
45+
}
46+
47+
return false;
48+
}
49+
50+
void AdvancedGraphMenu::clearLabelList()
51+
{
52+
ui->listWidgetLabels->clear();
53+
}
54+
55+
void AdvancedGraphMenu::removeLabelAt(int index)
56+
{
57+
ui->listWidgetLabels->takeItem(index);
58+
}
59+
60+
void AdvancedGraphMenu::on_pushButtonApply_clicked()
61+
{
62+
QList<QString> labels;
63+
64+
for (auto i = 0; i < ui->listWidgetLabels->count(); ++i)
65+
{
66+
if (ui->listWidgetLabels->item(i)->checkState())
67+
labels.append(ui->listWidgetLabels->item(i)->text());
68+
}
69+
70+
emit readyToSyncLabelList(&labels);
71+
}
72+
73+
void AdvancedGraphMenu::on_pushButtonCheckAll_clicked()
74+
{
75+
for (auto i = 0; i < ui->listWidgetLabels->count(); ++i)
76+
{
77+
ui->listWidgetLabels->item(i)->setCheckState(Qt::CheckState::Checked);
78+
}
79+
}
80+
81+
void AdvancedGraphMenu::on_pushButtonUncheckAll_clicked()
82+
{
83+
for (auto i = 0; i < ui->listWidgetLabels->count(); ++i)
84+
{
85+
ui->listWidgetLabels->item(i)->setCheckState(Qt::CheckState::Unchecked);
86+
}
87+
}
88+
89+
void AdvancedGraphMenu::on_pushButtonClear_clicked()
90+
{
91+
ui->listWidgetLabels->clear();
92+
}

config.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#ifndef CONFIG_H
2+
#define CONFIG_H
3+
4+
#define VERSION "1.9"
5+
#define CHANGELOG_TEXT ""
6+
7+
#endif // CONFIG_H

dataratechart.cpp

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#include "dataratechart.h"
2+
3+
DataRateChart::DataRateChart(QObject *parent, QCustomPlot *plotWidget) : QObject(parent)
4+
{
5+
dataRatePlot = plotWidget;
6+
createDataRateChart();
7+
8+
appRunningClock.start();
9+
}
10+
11+
void DataRateChart::disableDataRateChart()
12+
{
13+
dataRatePlot->clearGraphs();
14+
dataRatePlot->xAxis->setVisible(false);
15+
dataRatePlot->xAxis2->setVisible(false);
16+
dataRatePlot->yAxis->setVisible(false);
17+
dataRatePlot->yAxis2->setVisible(false);
18+
dataRatePlot->replot();
19+
}
20+
21+
void DataRateChart::createDataRateChart()
22+
{
23+
QSharedPointer<QCPAxisTickerTime> xTicker(new QCPAxisTickerTime);
24+
QSharedPointer<QCPAxisTicker> yTicker(new QCPAxisTicker);
25+
xTicker->setTimeFormat("%h:%m:%s:%z");
26+
xTicker->setTickCount(5);
27+
yTicker->setTickCount(3);
28+
yTicker->setTickStepStrategy(QCPAxisTicker::TickStepStrategy::tssReadability);
29+
30+
dataRatePlot->xAxis->setTicker(xTicker);
31+
dataRatePlot->yAxis->setTicker(yTicker);
32+
dataRatePlot->xAxis->setTickLabels(false);
33+
dataRatePlot->yAxis->setLabel("[ kB / s ]");
34+
dataRatePlot->yAxis->setLabelPadding(5);
35+
dataRatePlot->axisRect()->insetLayout()->setInsetAlignment(0, Qt::AlignBottom|Qt::AlignLeft);
36+
dataRatePlot->axisRect()->setAutoMargins(QCP::msLeft);
37+
dataRatePlot->axisRect()->setMargins(QMargins(0,0,0,0));
38+
dataRatePlot->axisRect()->setupFullAxesBox(true);
39+
dataRatePlot->legend->setVisible(false);
40+
dataRatePlot->setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu);
41+
42+
dataRatePlot->addGraph();
43+
dataRatePlot->graph()->setName("dataRateBytesPerSec");
44+
// ui->widgetChart->graph()->selectionDecorator()-> setPen(QPen(Qt::darkBlue, 1.0, Qt::PenStyle::SolidLine));
45+
46+
dataRatePlot->graph()->setLineStyle(QCPGraph::LineStyle::lsLine);
47+
dataRatePlot->graph()->setScatterStyle(QCPScatterStyle::ScatterShape::ssNone);
48+
dataRatePlot->graph()->setPen(QPen(Qt::GlobalColor::darkGreen));
49+
50+
connect(dataRatePlot, SIGNAL(beforeReplot()), this, SLOT(chartDataRateRunAutoTrackSlot()));
51+
52+
dataRatePlot->replot();
53+
}
54+
55+
void DataRateChart::clearDataRateChart(bool replot)
56+
{
57+
if (dataRatePlot->graphCount() > 0)
58+
dataRatePlot->graph()->data().data()->clear();
59+
60+
if (replot)
61+
dataRatePlot->replot();
62+
}
63+
64+
void DataRateChart::processDataRateChart(QString input)
65+
{
66+
static unsigned long long lastTime = 0;
67+
unsigned long long deltaT = appRunningClock.elapsed() - lastTime;
68+
lastTime = appRunningClock.elapsed();
69+
70+
static float bytesPerSec = 0, currentBytesPerSec = 0;
71+
if (input.size() > 0)
72+
currentBytesPerSec = input.size() / ((float)deltaT / 1000.0);
73+
else
74+
currentBytesPerSec = 0;
75+
76+
auto alpha = 0.25;
77+
bytesPerSec = (alpha * currentBytesPerSec) + ((1.0f - alpha) * bytesPerSec);
78+
79+
dataRatePlot->graph()->addData(appRunningClock.elapsed() / 1000.0, bytesPerSec / 1000.0);
80+
dataRatePlot->graph()->data().data()->removeBefore((appRunningClock.elapsed() / 1000.0) - 10.0);
81+
dataRatePlot->replot();
82+
}
83+
84+
void DataRateChart::chartDataRateRunAutoTrackSlot()
85+
{
86+
dataRatePlot->xAxis->setRange((appRunningClock.elapsed() / 1000.0) + (10.0f * 0.05),
87+
10.0f, Qt::AlignRight);
88+
89+
dataRatePlot->yAxis->rescale();
90+
dataRatePlot->yAxis->scaleRange(2);
91+
// ui->widgetDataRateChart->yAxis->setRangeLower(-2);
92+
}

dataratechart.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#ifndef DATARATECHART_H
2+
#define DATARATECHART_H
3+
4+
#include <QObject>
5+
#include <qcustomplot.h>
6+
7+
class DataRateChart : public QObject
8+
{
9+
Q_OBJECT
10+
public:
11+
explicit DataRateChart(QObject *parent = nullptr, QCustomPlot *plotWidget = nullptr);
12+
13+
void disableDataRateChart();
14+
void createDataRateChart();
15+
void clearDataRateChart(bool replot);
16+
void processDataRateChart(QString input);
17+
signals:
18+
19+
public slots:
20+
private slots:
21+
void chartDataRateRunAutoTrackSlot();
22+
private:
23+
QCustomPlot *dataRatePlot = nullptr;
24+
QTime appRunningClock;
25+
};
26+
27+
#endif // DATARATECHART_H

dialog.ui

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>Dialog</class>
4+
<widget class="QDialog" name="Dialog">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>400</width>
10+
<height>300</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Dialog</string>
15+
</property>
16+
<layout class="QGridLayout" name="gridLayout">
17+
<item row="0" column="0">
18+
<widget class="QSplitter" name="splitter_2">
19+
<property name="orientation">
20+
<enum>Qt::Horizontal</enum>
21+
</property>
22+
<widget class="QWidget" name="verticalLayoutWidget_2">
23+
<layout class="QVBoxLayout" name="verticalLayout_2">
24+
<item>
25+
<widget class="QTextEdit" name="textEdit"/>
26+
</item>
27+
</layout>
28+
</widget>
29+
<widget class="QSplitter" name="splitter">
30+
<property name="orientation">
31+
<enum>Qt::Vertical</enum>
32+
</property>
33+
<widget class="QTextBrowser" name="textBrowser"/>
34+
<widget class="QWidget" name="horizontalLayoutWidget">
35+
<layout class="QHBoxLayout" name="horizontalLayout_3">
36+
<item>
37+
<widget class="QTextEdit" name="textEdit_2"/>
38+
</item>
39+
</layout>
40+
</widget>
41+
</widget>
42+
</widget>
43+
</item>
44+
</layout>
45+
</widget>
46+
<resources/>
47+
<connections/>
48+
</ui>

filereader.cpp

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#include "filereader.h"
2+
3+
FileReader::FileReader(QObject *parent) : QObject(parent)
4+
{
5+
fileReadTimer.stop();
6+
}
7+
8+
void FileReader::readLineSendLine()
9+
{
10+
int progressPercent = lineReadIterator * 100 / readFileSplitLines.count() ;
11+
emit lineReady(&readFileSplitLines[lineReadIterator], &progressPercent);
12+
lineReadIterator++;
13+
14+
if (lineReadIterator >= readFileSplitLines.count())
15+
{
16+
emit fileReadFinished();
17+
18+
fileReadTimer.stop();
19+
lineReadIterator = 0;
20+
}
21+
}
22+
23+
bool FileReader::startRead(QFile *fileToRead)
24+
{
25+
if (fileToRead->open(QIODevice::ReadOnly))
26+
{
27+
QTextStream stream(fileToRead);
28+
QString allData = stream.readAll();
29+
fileToRead->close();
30+
31+
readFileSplitLines = allData.split(QRegExp("[\n\r]"), QString::SplitBehavior::SkipEmptyParts);
32+
}
33+
34+
lineReadIterator = 0;
35+
36+
fileReadTimer.start(readInterval);
37+
connect(&fileReadTimer, SIGNAL(timeout()), this, SLOT(readLineSendLine()));
38+
}
39+
40+
bool FileReader::readAllAtOnce(QFile *fileToRead)
41+
{
42+
if (fileToRead->open(QIODevice::ReadOnly))
43+
{
44+
QTextStream stream(fileToRead);
45+
QString allData = stream.readAll();
46+
fileToRead->close();
47+
48+
emit textReady(&allData);
49+
emit fileReadFinished();
50+
51+
return true;
52+
}
53+
return false;
54+
}
55+
56+
void FileReader::setReadInterval(int newVal)
57+
{
58+
readInterval = newVal;
59+
}
60+
61+
void FileReader::abortRead()
62+
{
63+
fileReadTimer.stop(); // ...
64+
}

0 commit comments

Comments
 (0)