Skip to content

Commit

Permalink
Loganalysis: Added .. directory and path label
Browse files Browse the repository at this point in the history
  • Loading branch information
vedderb committed Nov 6, 2024
1 parent 25795e5 commit 56aaa1a
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 51 deletions.
19 changes: 15 additions & 4 deletions pages/pageloganalysis.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -1177,19 +1177,31 @@ 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);
ui->logTable->setItem(ui->logTable->rowCount() - 1, 0, itName);
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());
Expand Down Expand Up @@ -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) {
Expand Down
97 changes: 50 additions & 47 deletions pages/pageloganalysis.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1301</width>
<height>716</height>
<width>1200</width>
<height>717</height>
</rect>
</property>
<property name="windowTitle">
Expand All @@ -24,27 +24,17 @@
<property name="text">
<string>No log opened</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QSplitter" name="mapSplitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<widget class="QWidget" name="layoutWidget">
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="1,0">
Expand Down Expand Up @@ -226,10 +216,10 @@
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
<enum>QSizePolicy::Policy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand Down Expand Up @@ -276,7 +266,7 @@
</widget>
<widget class="QSplitter" name="statSplitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<widget class="QCustomPlot" name="plot" native="true">
<property name="sizePolicy">
Expand All @@ -288,10 +278,10 @@
</widget>
<widget class="QTabWidget" name="tabWidget">
<property name="tabPosition">
<enum>QTabWidget::North</enum>
<enum>QTabWidget::TabPosition::North</enum>
</property>
<property name="tabShape">
<enum>QTabWidget::Triangular</enum>
<enum>QTabWidget::TabShape::Triangular</enum>
</property>
<property name="currentIndex">
<number>0</number>
Expand Down Expand Up @@ -322,10 +312,10 @@
<item>
<widget class="QTabWidget" name="browseTabWidget">
<property name="tabPosition">
<enum>QTabWidget::North</enum>
<enum>QTabWidget::TabPosition::North</enum>
</property>
<property name="tabShape">
<enum>QTabWidget::Triangular</enum>
<enum>QTabWidget::TabShape::Triangular</enum>
</property>
<property name="currentIndex">
<number>0</number>
Expand Down Expand Up @@ -353,13 +343,13 @@
<item>
<widget class="QTableWidget" name="vescLogTable">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
<set>QAbstractItemView::EditTrigger::NoEditTriggers</set>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
<enum>QAbstractItemView::SelectionMode::ExtendedSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
<enum>QAbstractItemView::SelectionBehavior::SelectRows</enum>
</property>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
Expand Down Expand Up @@ -421,7 +411,7 @@
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand Down Expand Up @@ -513,13 +503,16 @@
<item>
<widget class="QTableWidget" name="logTable">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
<set>QAbstractItemView::EditTrigger::NoEditTriggers</set>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
<enum>QAbstractItemView::SelectionMode::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
<enum>QAbstractItemView::SelectionBehavior::SelectRows</enum>
</property>
<property name="sortingEnabled">
<bool>false</bool>
</property>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
Expand All @@ -536,6 +529,16 @@
</column>
</widget>
</item>
<item>
<widget class="QLabel" name="pathLabel">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
Expand All @@ -555,7 +558,7 @@
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand Down Expand Up @@ -608,7 +611,7 @@
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<layout class="QVBoxLayout" name="verticalLayout_13">
<layout class="QVBoxLayout" name="verticalLayout_13" stretch="0,1">
<item>
<widget class="QPushButton" name="openCurrentButton">
<property name="toolTip">
Expand All @@ -626,7 +629,7 @@
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand Down Expand Up @@ -664,16 +667,16 @@
<item>
<widget class="QTableWidget" name="dataTable">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
<set>QAbstractItemView::EditTrigger::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
<enum>QAbstractItemView::SelectionMode::ExtendedSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
<enum>QAbstractItemView::SelectionBehavior::SelectRows</enum>
</property>
<attribute name="horizontalHeaderStretchLastSection">
<bool>false</bool>
Expand Down Expand Up @@ -730,16 +733,16 @@
<item>
<widget class="QTableWidget" name="statTable">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
<set>QAbstractItemView::EditTrigger::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
<enum>QAbstractItemView::SelectionMode::NoSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
<enum>QAbstractItemView::SelectionBehavior::SelectRows</enum>
</property>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
Expand Down Expand Up @@ -768,13 +771,13 @@
<attribute name="title">
<string>Export</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<layout class="QHBoxLayout" name="horizontalLayout_7" stretch="0,0,1">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Image</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_14">
<layout class="QVBoxLayout" name="verticalLayout_14" stretch="0,0,0,1">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
Expand Down Expand Up @@ -884,7 +887,7 @@
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand All @@ -902,7 +905,7 @@
<property name="title">
<string>All Data</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_15">
<layout class="QVBoxLayout" name="verticalLayout_15" stretch="0,1">
<item>
<widget class="QPushButton" name="saveCsvButton">
<property name="toolTip">
Expand All @@ -916,7 +919,7 @@
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand All @@ -932,10 +935,10 @@
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
<enum>QSizePolicy::Policy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand All @@ -954,7 +957,7 @@
<item>
<widget class="SuperSlider" name="spanSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
Expand Down

0 comments on commit 56aaa1a

Please sign in to comment.