Skip to content

Commit

Permalink
Full code upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Mich committed Oct 5, 2019
1 parent 5e88638 commit b0d700e
Show file tree
Hide file tree
Showing 38 changed files with 43,300 additions and 0 deletions.
14 changes: 14 additions & 0 deletions 3dres.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<RCC>
<qresource prefix="/">
<file>presentation/3DOrientationV2.uia</file>
<file>presentation/presentations/3DOrientationV2.uip</file>
<file>presentation/materials/circle-stroke-01p.materialdef</file>
<file>presentation/materials/Material.materialdef</file>
<file>presentation/materials/Material2.materialdef</file>
<file>presentation/materials/Material4.materialdef</file>
<file>presentation/materials/Material5.materialdef</file>
<file>presentation/materials/Material32.materialdef</file>
<file>presentation/materials/materialCube1.materialdef</file>
<file>presentation/materials/materialCube2.materialdef</file>
</qresource>
</RCC>
13 changes: 13 additions & 0 deletions 3dres2.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<RCC>
<qresource prefix="/">
<file>presentation2/SampleProject.uia</file>
<file>presentation2/SampleProject.uip</file>
<file>presentation2/models/Speedometer/Speedometer.import</file>
<file>presentation2/maps/materials/shadow.png</file>
<file>presentation2/maps/materials/spherical_checker.png</file>
<file>presentation2/materials/simple_glass.material</file>
<file>presentation2/models/Speedometer/maps/Speed.png</file>
<file>presentation2/models/Speedometer/meshes/NeedleSpeed.mesh</file>
<file>presentation2/models/Speedometer/meshes/Speedometer.mesh</file>
</qresource>
</RCC>
15 changes: 15 additions & 0 deletions 3dview.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<RCC>
<qresource prefix="/">
<file>presentation/materials/circle-stroke-01p.materialdef</file>
<file>presentation/materials/Material.materialdef</file>
<file>presentation/materials/Material2.materialdef</file>
<file>presentation/materials/Material4.materialdef</file>
<file>presentation/materials/Material5.materialdef</file>
<file>presentation/materials/Material32.materialdef</file>
<file>presentation/materials/materialCube1.materialdef</file>
<file>presentation/materials/materialCube2.materialdef</file>
<file>presentation/maps/circle-stroke-01p.png</file>
<file>presentation/3DOrientationV2.uia</file>
<file>presentation/presentations/3DOrientationV2.uip</file>
</qresource>
</RCC>
Binary file added QtSM.ico
Binary file not shown.
92 changes: 92 additions & 0 deletions advancedgraphmenu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#include "advancedgraphmenu.h"
#include "ui_advancedgraphmenu.h"

AdvancedGraphMenu::AdvancedGraphMenu(QWidget *parent) :
QDialog(parent),
ui(new Ui::AdvancedGraphMenu)
{
ui->setupUi(this);

QObject::connect(ui->listWidgetLabels, SIGNAL(itemChanged(QListWidgetItem*)),
this, SLOT(highlightChecked(QListWidgetItem*)));
}

AdvancedGraphMenu::~AdvancedGraphMenu()
{
delete ui;
}

void AdvancedGraphMenu::createConnections()
{
for(int i = 0; i < ui->listWidgetLabels->count(); ++i)
{
ui->listWidgetLabels->item(i)->setFlags(ui->listWidgetLabels->item(i)->flags() | Qt::ItemIsUserCheckable);
}
}

void AdvancedGraphMenu::addLabelToList(QString label)
{
ui->listWidgetLabels->addItem(label);
ui->listWidgetLabels->item(ui->listWidgetLabels->count() - 1)->setFlags(ui->listWidgetLabels->item(ui->listWidgetLabels->count() - 1)->flags() | Qt::ItemIsUserCheckable);
ui->listWidgetLabels->item(ui->listWidgetLabels->count() - 1)->setCheckState(Qt::Unchecked);
}

void AdvancedGraphMenu::highlightChecked(QListWidgetItem* item)
{
qDebug() << item->text();
}

bool AdvancedGraphMenu::searchForItem(QString label)
{
for (auto i = 0; i < ui->listWidgetLabels->count(); ++i)
{
if (ui->listWidgetLabels->item(i)->text().compare(label) == 0)
return true;
}

return false;
}

void AdvancedGraphMenu::clearLabelList()
{
ui->listWidgetLabels->clear();
}

void AdvancedGraphMenu::removeLabelAt(int index)
{
ui->listWidgetLabels->takeItem(index);
}

void AdvancedGraphMenu::on_pushButtonApply_clicked()
{
QList<QString> labels;

for (auto i = 0; i < ui->listWidgetLabels->count(); ++i)
{
if (ui->listWidgetLabels->item(i)->checkState())
labels.append(ui->listWidgetLabels->item(i)->text());
}

emit readyToSyncLabelList(&labels);
}

void AdvancedGraphMenu::on_pushButtonCheckAll_clicked()
{
for (auto i = 0; i < ui->listWidgetLabels->count(); ++i)
{
ui->listWidgetLabels->item(i)->setCheckState(Qt::CheckState::Checked);
}
}

void AdvancedGraphMenu::on_pushButtonUncheckAll_clicked()
{
for (auto i = 0; i < ui->listWidgetLabels->count(); ++i)
{
ui->listWidgetLabels->item(i)->setCheckState(Qt::CheckState::Unchecked);
}
}

void AdvancedGraphMenu::on_pushButtonClear_clicked()
{
ui->listWidgetLabels->clear();
}
7 changes: 7 additions & 0 deletions config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef CONFIG_H
#define CONFIG_H

#define VERSION "1.9"
#define CHANGELOG_TEXT ""

#endif // CONFIG_H
92 changes: 92 additions & 0 deletions dataratechart.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#include "dataratechart.h"

DataRateChart::DataRateChart(QObject *parent, QCustomPlot *plotWidget) : QObject(parent)
{
dataRatePlot = plotWidget;
createDataRateChart();

appRunningClock.start();
}

void DataRateChart::disableDataRateChart()
{
dataRatePlot->clearGraphs();
dataRatePlot->xAxis->setVisible(false);
dataRatePlot->xAxis2->setVisible(false);
dataRatePlot->yAxis->setVisible(false);
dataRatePlot->yAxis2->setVisible(false);
dataRatePlot->replot();
}

void DataRateChart::createDataRateChart()
{
QSharedPointer<QCPAxisTickerTime> xTicker(new QCPAxisTickerTime);
QSharedPointer<QCPAxisTicker> yTicker(new QCPAxisTicker);
xTicker->setTimeFormat("%h:%m:%s:%z");
xTicker->setTickCount(5);
yTicker->setTickCount(3);
yTicker->setTickStepStrategy(QCPAxisTicker::TickStepStrategy::tssReadability);

dataRatePlot->xAxis->setTicker(xTicker);
dataRatePlot->yAxis->setTicker(yTicker);
dataRatePlot->xAxis->setTickLabels(false);
dataRatePlot->yAxis->setLabel("[ kB / s ]");
dataRatePlot->yAxis->setLabelPadding(5);
dataRatePlot->axisRect()->insetLayout()->setInsetAlignment(0, Qt::AlignBottom|Qt::AlignLeft);
dataRatePlot->axisRect()->setAutoMargins(QCP::msLeft);
dataRatePlot->axisRect()->setMargins(QMargins(0,0,0,0));
dataRatePlot->axisRect()->setupFullAxesBox(true);
dataRatePlot->legend->setVisible(false);
dataRatePlot->setContextMenuPolicy(Qt::ContextMenuPolicy::CustomContextMenu);

dataRatePlot->addGraph();
dataRatePlot->graph()->setName("dataRateBytesPerSec");
// ui->widgetChart->graph()->selectionDecorator()-> setPen(QPen(Qt::darkBlue, 1.0, Qt::PenStyle::SolidLine));

dataRatePlot->graph()->setLineStyle(QCPGraph::LineStyle::lsLine);
dataRatePlot->graph()->setScatterStyle(QCPScatterStyle::ScatterShape::ssNone);
dataRatePlot->graph()->setPen(QPen(Qt::GlobalColor::darkGreen));

connect(dataRatePlot, SIGNAL(beforeReplot()), this, SLOT(chartDataRateRunAutoTrackSlot()));

dataRatePlot->replot();
}

void DataRateChart::clearDataRateChart(bool replot)
{
if (dataRatePlot->graphCount() > 0)
dataRatePlot->graph()->data().data()->clear();

if (replot)
dataRatePlot->replot();
}

void DataRateChart::processDataRateChart(QString input)
{
static unsigned long long lastTime = 0;
unsigned long long deltaT = appRunningClock.elapsed() - lastTime;
lastTime = appRunningClock.elapsed();

static float bytesPerSec = 0, currentBytesPerSec = 0;
if (input.size() > 0)
currentBytesPerSec = input.size() / ((float)deltaT / 1000.0);
else
currentBytesPerSec = 0;

auto alpha = 0.25;
bytesPerSec = (alpha * currentBytesPerSec) + ((1.0f - alpha) * bytesPerSec);

dataRatePlot->graph()->addData(appRunningClock.elapsed() / 1000.0, bytesPerSec / 1000.0);
dataRatePlot->graph()->data().data()->removeBefore((appRunningClock.elapsed() / 1000.0) - 10.0);
dataRatePlot->replot();
}

void DataRateChart::chartDataRateRunAutoTrackSlot()
{
dataRatePlot->xAxis->setRange((appRunningClock.elapsed() / 1000.0) + (10.0f * 0.05),
10.0f, Qt::AlignRight);

dataRatePlot->yAxis->rescale();
dataRatePlot->yAxis->scaleRange(2);
// ui->widgetDataRateChart->yAxis->setRangeLower(-2);
}
27 changes: 27 additions & 0 deletions dataratechart.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef DATARATECHART_H
#define DATARATECHART_H

#include <QObject>
#include <qcustomplot.h>

class DataRateChart : public QObject
{
Q_OBJECT
public:
explicit DataRateChart(QObject *parent = nullptr, QCustomPlot *plotWidget = nullptr);

void disableDataRateChart();
void createDataRateChart();
void clearDataRateChart(bool replot);
void processDataRateChart(QString input);
signals:

public slots:
private slots:
void chartDataRateRunAutoTrackSlot();
private:
QCustomPlot *dataRatePlot = nullptr;
QTime appRunningClock;
};

#endif // DATARATECHART_H
48 changes: 48 additions & 0 deletions dialog.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QSplitter" name="splitter_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QWidget" name="verticalLayoutWidget_2">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTextEdit" name="textEdit"/>
</item>
</layout>
</widget>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QTextBrowser" name="textBrowser"/>
<widget class="QWidget" name="horizontalLayoutWidget">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QTextEdit" name="textEdit_2"/>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
64 changes: 64 additions & 0 deletions filereader.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#include "filereader.h"

FileReader::FileReader(QObject *parent) : QObject(parent)
{
fileReadTimer.stop();
}

void FileReader::readLineSendLine()
{
int progressPercent = lineReadIterator * 100 / readFileSplitLines.count() ;
emit lineReady(&readFileSplitLines[lineReadIterator], &progressPercent);
lineReadIterator++;

if (lineReadIterator >= readFileSplitLines.count())
{
emit fileReadFinished();

fileReadTimer.stop();
lineReadIterator = 0;
}
}

bool FileReader::startRead(QFile *fileToRead)
{
if (fileToRead->open(QIODevice::ReadOnly))
{
QTextStream stream(fileToRead);
QString allData = stream.readAll();
fileToRead->close();

readFileSplitLines = allData.split(QRegExp("[\n\r]"), QString::SplitBehavior::SkipEmptyParts);
}

lineReadIterator = 0;

fileReadTimer.start(readInterval);
connect(&fileReadTimer, SIGNAL(timeout()), this, SLOT(readLineSendLine()));
}

bool FileReader::readAllAtOnce(QFile *fileToRead)
{
if (fileToRead->open(QIODevice::ReadOnly))
{
QTextStream stream(fileToRead);
QString allData = stream.readAll();
fileToRead->close();

emit textReady(&allData);
emit fileReadFinished();

return true;
}
return false;
}

void FileReader::setReadInterval(int newVal)
{
readInterval = newVal;
}

void FileReader::abortRead()
{
fileReadTimer.stop(); // ...
}
Loading

0 comments on commit b0d700e

Please sign in to comment.