From 56aaa1a41480726e63e29ee5ef7b432310bf0aa7 Mon Sep 17 00:00:00 2001 From: Benjamin Vedder Date: Wed, 6 Nov 2024 23:26:01 +0100 Subject: [PATCH] Loganalysis: Added .. directory and path label --- pages/pageloganalysis.cpp | 19 ++++++-- pages/pageloganalysis.ui | 97 ++++++++++++++++++++------------------- 2 files changed, 65 insertions(+), 51 deletions(-) mode change 100644 => 100755 pages/pageloganalysis.cpp diff --git a/pages/pageloganalysis.cpp b/pages/pageloganalysis.cpp old mode 100644 new mode 100755 index 4f562249..0817231c --- a/pages/pageloganalysis.cpp +++ b/pages/pageloganalysis.cpp @@ -1177,11 +1177,23 @@ void PageLogAnalysis::logListRefresh() { ui->logTable->setRowCount(0); QSettings set; - if (set.contains("pageloganalysis/lastdir")) { + if (set.contains("pageloganalysis/lastdir")) { QString dirPath = set.value("pageloganalysis/lastdir").toString(); + + while (dirPath.startsWith("/..")) { + dirPath.remove(0, 3); + } + set.setValue("pageloganalysis/lastdir", dirPath); + + ui->pathLabel->setText(dirPath); + QDir dir(dirPath); if (dir.exists()) { - for (QFileInfo d: dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot , QDir::Name)) { + foreach (QFileInfo d, dir.entryInfoList(QDir::Dirs | QDir::NoDot, QDir::Name)) { + if (d.fileName() == ".." && dirPath == "/") { + continue; + } + QTableWidgetItem *itName = new QTableWidgetItem(d.fileName()); itName->setData(Qt::UserRole, d.absoluteFilePath()); ui->logTable->setRowCount(ui->logTable->rowCount() + 1); @@ -1189,7 +1201,7 @@ void PageLogAnalysis::logListRefresh() ui->logTable->setItem(ui->logTable->rowCount() - 1, 1, new QTableWidgetItem("Folder")); } - for (QFileInfo f: dir.entryInfoList(QStringList() << "*.csv" << "*.Csv" << "*.CSV", + foreach (QFileInfo f, dir.entryInfoList(QStringList() << "*.csv" << "*.Csv" << "*.CSV", QDir::Files, QDir::Name)) { QTableWidgetItem *itName = new QTableWidgetItem(f.fileName()); itName->setData(Qt::UserRole, f.absoluteFilePath()); @@ -1224,7 +1236,6 @@ void PageLogAnalysis::addDataItem(QString name, bool hasScale, double scaleStep, auto nameItem = new QTableWidgetItem(name); ui->dataTable->setItem(currentRow, dataTableColName, nameItem); - ui->dataTable->setItem(currentRow, dataTableColValue, new QTableWidgetItem("")); if (hasScale) { diff --git a/pages/pageloganalysis.ui b/pages/pageloganalysis.ui index c21fa65a..a2dfd6ed 100644 --- a/pages/pageloganalysis.ui +++ b/pages/pageloganalysis.ui @@ -6,8 +6,8 @@ 0 0 - 1301 - 716 + 1200 + 717 @@ -24,27 +24,17 @@ No log opened - - - - - - Qt::Horizontal + + true - - - 40 - 20 - - - + - Qt::Vertical + Qt::Orientation::Vertical @@ -226,10 +216,10 @@ - Qt::Vertical + Qt::Orientation::Vertical - QSizePolicy::MinimumExpanding + QSizePolicy::Policy::MinimumExpanding @@ -276,7 +266,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -288,10 +278,10 @@ - QTabWidget::North + QTabWidget::TabPosition::North - QTabWidget::Triangular + QTabWidget::TabShape::Triangular 0 @@ -322,10 +312,10 @@ - QTabWidget::North + QTabWidget::TabPosition::North - QTabWidget::Triangular + QTabWidget::TabShape::Triangular 0 @@ -353,13 +343,13 @@ - QAbstractItemView::NoEditTriggers + QAbstractItemView::EditTrigger::NoEditTriggers - QAbstractItemView::ExtendedSelection + QAbstractItemView::SelectionMode::ExtendedSelection - QAbstractItemView::SelectRows + QAbstractItemView::SelectionBehavior::SelectRows true @@ -421,7 +411,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -513,13 +503,16 @@ - QAbstractItemView::NoEditTriggers + QAbstractItemView::EditTrigger::NoEditTriggers - QAbstractItemView::SingleSelection + QAbstractItemView::SelectionMode::SingleSelection - QAbstractItemView::SelectRows + QAbstractItemView::SelectionBehavior::SelectRows + + + false true @@ -536,6 +529,16 @@ + + + + + + + true + + + @@ -555,7 +558,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -608,7 +611,7 @@ - + @@ -626,7 +629,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -664,16 +667,16 @@ - QAbstractItemView::NoEditTriggers + QAbstractItemView::EditTrigger::NoEditTriggers true - QAbstractItemView::ExtendedSelection + QAbstractItemView::SelectionMode::ExtendedSelection - QAbstractItemView::SelectRows + QAbstractItemView::SelectionBehavior::SelectRows false @@ -730,16 +733,16 @@ - QAbstractItemView::NoEditTriggers + QAbstractItemView::EditTrigger::NoEditTriggers true - QAbstractItemView::NoSelection + QAbstractItemView::SelectionMode::NoSelection - QAbstractItemView::SelectRows + QAbstractItemView::SelectionBehavior::SelectRows true @@ -768,13 +771,13 @@ Export - + Image - + @@ -884,7 +887,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -902,7 +905,7 @@ All Data - + @@ -916,7 +919,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -932,10 +935,10 @@ - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Expanding + QSizePolicy::Policy::Expanding @@ -954,7 +957,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal