Reinserts original comments
This commit is contained in:
112 files changed
+7113
-5131
No files matched your search
@@ -22,10 +22,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
m_files.clear();
|
||||
|
||||
|
||||
|
||||
|
||||
//m_logfile.~QString();
|
||||
//delete m_logfileList;
|
||||
// m_logZeiten.~QString();
|
||||
//delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::changeEvent(QEvent *e)
|
||||
@@ -43,10 +43,10 @@ void MainWindow::changeEvent(QEvent *e)
|
||||
|
||||
void MainWindow::init()
|
||||
{
|
||||
|
||||
//Connect Signals & Slots
|
||||
connect(ui->pushButtonOrdnerFinden, &QPushButton::clicked, this, &MainWindow::slot_findFolder);
|
||||
connect(ui->pushButtonAnalysieren, &QPushButton::clicked, this, &MainWindow::slot_analysieren);
|
||||
|
||||
//m_logfileList = new QList<LogfileInfo>();
|
||||
ui->progressBar->setValue(0);
|
||||
ui->labelResult->setText(QString());
|
||||
QIntValidator intVal;
|
||||
@@ -57,9 +57,16 @@ void MainWindow::init()
|
||||
|
||||
void MainWindow::slot_findFolder()
|
||||
{
|
||||
|
||||
|
||||
|
||||
//hier liegt der fehler???, der erst beim zweiten mal ausführen des Dateibrowsers in erscheinung tritt
|
||||
/*QFileDialog dial(this);
|
||||
dial.setFileMode(QFileDialog::Directory);
|
||||
dial.setViewMode(QFileDialog::List);
|
||||
QStringList files;
|
||||
if (dial.exec())
|
||||
files = dial.selectedFiles();
|
||||
QString name = files.at(0);
|
||||
//testblabla
|
||||
*/
|
||||
QString name = QFileDialog::getExistingDirectory(this, tr("Choose folder"), QDir::homePath(), QFileDialog::DontResolveSymlinks);
|
||||
ui->lineEditOrdner->setText(name);
|
||||
ui->labelResult->setText(QString());
|
||||
@@ -74,7 +81,7 @@ void MainWindow::slot_analysieren()
|
||||
ISSI = QLatin1String("1");
|
||||
m_logfileList.clear();
|
||||
|
||||
|
||||
//alle DAteien in dem Ordner finden
|
||||
QDir folder(ui->lineEditOrdner->text());
|
||||
m_files = folder.entryList();
|
||||
folder.~QDir();
|
||||
@@ -83,7 +90,7 @@ void MainWindow::slot_analysieren()
|
||||
const QString issitext = ISSI + QLatin1String("-1");
|
||||
for (int i = 0; i < m_files.count(); i++)
|
||||
{
|
||||
|
||||
//Dateinamen entfernen, die keine Payload-Logs sind
|
||||
QString name = m_files[i];
|
||||
if (name.contains(paytext))
|
||||
{
|
||||
@@ -136,7 +143,7 @@ void MainWindow::readFiles()
|
||||
QFile file(filename);
|
||||
if (file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
|
||||
//Datei auslesen
|
||||
QByteArray ar = file.read(150);
|
||||
file.close();
|
||||
if (ar.size() > 36)
|
||||
@@ -144,21 +151,21 @@ void MainWindow::readFiles()
|
||||
QString issi = getISSI(ar);
|
||||
QByteArray bytes = ar;
|
||||
|
||||
|
||||
//Laufende Nummer
|
||||
bytes.remove(0, 34);
|
||||
bytes.remove(2, 150);
|
||||
uint nr = bytes[0] & 255;
|
||||
nr *= 256;
|
||||
nr += bytes[1] & 255;
|
||||
|
||||
|
||||
//BytesNr 34+35
|
||||
//Sendezeit
|
||||
bytes = ar;
|
||||
bytes.remove(0, 30);
|
||||
bytes.remove(4, 150);
|
||||
|
||||
const QByteArray test = bytes.toHex();
|
||||
qint64 zeit = test.toLongLong(nullptr, 16);
|
||||
|
||||
//Byte 30-33
|
||||
const QDateTime timeStart(QDateTime::fromMSecsSinceEpoch(zeit * 1000));
|
||||
|
||||
writeToLogfile(issi, timeStart, getTimestamp(m_files[j]), m_files[j], nr);
|
||||
@@ -172,7 +179,7 @@ void MainWindow::readFiles()
|
||||
val *= (j + 1);
|
||||
val += 20;
|
||||
ui->progressBar->setValue(int(val));
|
||||
|
||||
// ui->progressBar->repaint();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -273,7 +280,7 @@ QDateTime MainWindow::getTimestamp(const QString &filename) const
|
||||
|
||||
QString MainWindow::getISSI(QByteArray ar)
|
||||
{
|
||||
|
||||
//wird nur für die "2-timestamp"-Dateien verwendet
|
||||
ar.remove(0, 5);
|
||||
ar.remove(4, 200);
|
||||
QByteArray issi = ar.toHex();
|
||||
@@ -310,7 +317,7 @@ QString MainWindow::getISSI(QByteArray ar)
|
||||
int MainWindow::auswerten()
|
||||
{
|
||||
|
||||
|
||||
//Logfile vorbereiten
|
||||
QFile f(m_logfile);
|
||||
if (!f.open(QIODevice::Append | QIODevice::Text))
|
||||
return -1;
|
||||
@@ -319,7 +326,7 @@ int MainWindow::auswerten()
|
||||
issis.reserve(100);
|
||||
for (int i = 0; i < m_logfileList.count(); i++)
|
||||
{
|
||||
|
||||
//Unterschiedliche Issis finden
|
||||
issis += m_logfileList.at(i).issi;
|
||||
}
|
||||
ui->progressBar->setValue(94);
|
||||
@@ -329,7 +336,7 @@ int MainWindow::auswerten()
|
||||
int i = 0;
|
||||
for (const QString &issi : std::as_const(issis))
|
||||
{
|
||||
|
||||
//für jede Issi die Nummern in timestampMap einlesen --> geordnet nach Zeitstempel
|
||||
numList.clear();
|
||||
for (int j = 0; j < m_logfileList.count(); j++)
|
||||
{
|
||||
@@ -344,7 +351,7 @@ int MainWindow::auswerten()
|
||||
f.write(text);
|
||||
|
||||
fehlcount += fehlendeNumsEintragen(numList, f);
|
||||
|
||||
// delete numList;
|
||||
|
||||
double val = 5;
|
||||
val /= issis.count();
|
||||
@@ -360,7 +367,7 @@ int MainWindow::auswerten()
|
||||
|
||||
int MainWindow::fehlendeNumsEintragen(const QVector<uint> &numList, QFile &f)
|
||||
{
|
||||
|
||||
//schreibt die fehlenden Nummern in das Logfile und die GUI
|
||||
QVector<uint> fehlendeNums = getFehlendeNums(numList);
|
||||
QByteArray text = QByteArray::number(fehlendeNums.count());
|
||||
text += " lost messages\n";
|
||||
@@ -370,7 +377,7 @@ int MainWindow::fehlendeNumsEintragen(const QVector<uint> &numList, QFile &f)
|
||||
text += QByteArray::number(fehlendeNums.at(j));
|
||||
text += ", ";
|
||||
}
|
||||
|
||||
// delete fehlendeNums;
|
||||
text += ")\n";
|
||||
|
||||
f.write(text);
|
||||
@@ -380,13 +387,13 @@ int MainWindow::fehlendeNumsEintragen(const QVector<uint> &numList, QFile &f)
|
||||
|
||||
QVector<uint> MainWindow::getFehlendeNums(const QVector<uint> &numsDurchgang)
|
||||
{
|
||||
|
||||
//ermittelt die fehlenden Nummern pro Durchgang
|
||||
uint count = numsDurchgang.count();
|
||||
uint maxnum = 0;
|
||||
uint minnum = 999999;
|
||||
for (uint k = 0; k < count; k++)
|
||||
{
|
||||
|
||||
//höchste und niedrigste Num finden
|
||||
if (numsDurchgang.at(k) > maxnum)
|
||||
maxnum = numsDurchgang.at(k);
|
||||
if (numsDurchgang.at(k) < minnum)
|
||||
@@ -396,7 +403,7 @@ QVector<uint> MainWindow::getFehlendeNums(const QVector<uint> &numsDurchgang)
|
||||
QVector<uint> fehlendeNum;
|
||||
for (uint z = minnum; z <= maxnum; z++)
|
||||
{
|
||||
|
||||
//liste nach fehlenden werten durchsuchen
|
||||
bool vorhanden = false;
|
||||
for (uint j = 0; j < count; j++)
|
||||
{
|
||||
@@ -425,5 +432,5 @@ void MainWindow::writeLogZeiten(const QDateTime &beginn, const QDateTime &end, c
|
||||
file.write(msg.toUtf8());
|
||||
file.close();
|
||||
|
||||
|
||||
//delete end;
|
||||
}
|
||||
Reference in new issue
Block a user