Skip to content

Commit

Permalink
Merge pull request #55 from ChrisHal/improvements
Browse files Browse the repository at this point in the history
Improvement: user can now open Select Parameters dialog from export metadata dialog
  • Loading branch information
ChrisHal authored Dec 10, 2024
2 parents e957b26 + 2655c98 commit c270c8d
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 40 deletions.
8 changes: 5 additions & 3 deletions QtPMbrowser/DlgExportMetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@
#include "DlgExportMetadata.h"
#include "ui_DlgExportMetadata.h"

DlgExportMetadata::DlgExportMetadata(QWidget *parent)
: QDialog(parent), selection{ }, ui(new Ui::DlgExportMetadata())
DlgExportMetadata::DlgExportMetadata(PMbrowserWindow* parent)
: QDialog(parent), selection{}, ui(new Ui::DlgExportMetadata()), pmbrowserwindow{ parent }
{
QSettings settings;
ui->setupUi(this);
auto index = settings.value("DlgExportMetadata/selection", 3).toInt();
ui->comboBoxLevel->setCurrentIndex(index);
ui->checkBoxSystemLocale->setChecked(settings.value("DlgExportMetadata/nativeEncoding", 0).toInt());
QObject::connect(ui->pushButtonSlectParamters, &QPushButton::clicked,
pmbrowserwindow, &PMbrowserWindow::on_actionSelect_Parameters_triggered);
QObject::connect(ui->pushButtonCopy, &QPushButton::clicked, this, &DlgExportMetadata::copyToClipboard);
}

Expand All @@ -38,7 +40,7 @@ DlgExportMetadata::~DlgExportMetadata()
delete ui;
}

void DlgExportMetadata::accept(){
void DlgExportMetadata::accept() {
QSettings settings;
selection = ui->comboBoxLevel->currentIndex();
settings.setValue("DlgExportMetadata/selection", selection);
Expand Down
6 changes: 4 additions & 2 deletions QtPMbrowser/DlgExportMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#pragma once

#include <QDialog>
#include <pmbrowserwindow.h>

QT_BEGIN_NAMESPACE
namespace Ui { class DlgExportMetadata; }
Expand All @@ -33,7 +34,7 @@ public slots:
void copyToClipboard();

public:
DlgExportMetadata(QWidget* parent = nullptr);
DlgExportMetadata(PMbrowserWindow* parent);
~DlgExportMetadata();
int getSelection() {
return selection;
Expand All @@ -48,7 +49,8 @@ public slots:

private:
int selection;
Ui::DlgExportMetadata *ui;
Ui::DlgExportMetadata* ui;
PMbrowserWindow* pmbrowserwindow;
bool m_doCopy{ false };
bool m_nativeEncoding{ false };
};
75 changes: 41 additions & 34 deletions QtPMbrowser/DlgExportMetadata.ui
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,39 @@
<property name="windowTitle">
<string>Export metadata as table</string>
</property>
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,0,0,0" columnstretch="0,0,0,0">
<item row="1" column="0" colspan="3">
<widget class="QLabel" name="label">
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,0,0,0,0" columnstretch="0,0,0,0">
<item row="3" column="0" colspan="4">
<widget class="QComboBox" name="comboBoxLevel">
<item>
<property name="text">
<string>Group</string>
</property>
</item>
<item>
<property name="text">
<string>Series</string>
</property>
</item>
<item>
<property name="text">
<string>Sweep</string>
</property>
</item>
<item>
<property name="text">
<string>Trace</string>
</property>
</item>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QPushButton" name="pushButtonCopy">
<property name="text">
<string>One line per:</string>
<string>copy to clipboard</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="3">
<item row="7" column="1" colspan="3">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
Expand All @@ -34,7 +58,7 @@
</property>
</spacer>
</item>
<item row="7" column="1" colspan="3">
<item row="8" column="1" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
Expand All @@ -47,28 +71,11 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="4">
<widget class="QComboBox" name="comboBoxLevel">
<item>
<property name="text">
<string>Group</string>
</property>
</item>
<item>
<property name="text">
<string>Series</string>
</property>
</item>
<item>
<property name="text">
<string>Sweep</string>
</property>
</item>
<item>
<property name="text">
<string>Trace</string>
</property>
</item>
<item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="checkBoxSystemLocale">
<property name="text">
<string>use system default formatting</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="4">
Expand All @@ -84,17 +91,17 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QPushButton" name="pushButtonCopy">
<item row="2" column="0" colspan="4">
<widget class="QLabel" name="label">
<property name="text">
<string>copy to clipboard</string>
<string>One line per:</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QCheckBox" name="checkBoxSystemLocale">
<item row="1" column="0">
<widget class="QPushButton" name="pushButtonSlectParamters">
<property name="text">
<string>use system default formatting</string>
<string>Select Parameters...</string>
</property>
</widget>
</item>
Expand Down
4 changes: 3 additions & 1 deletion QtPMbrowser/pmbrowserwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,14 @@ private slots:
void prepareTreeContextMenu(const QPoint& pos);
void on_treePulse_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
void on_treePulse_itemDoubleClicked(QTreeWidgetItem* item, int column);
void on_actionSelect_Parameters_triggered();
void on_actionPrint_All_Params_triggered();
void on_menuGraph_aboutToShow();
void openHelp();
void openPreferences();

public slots:
void on_actionSelect_Parameters_triggered();

protected:
void dragEnterEvent(QDragEnterEvent* event) override;
void dropEvent(QDropEvent* event) override;
Expand Down
1 change: 1 addition & 0 deletions hekatoolslib/DatFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ void DatFile::InitFromStream(std::istream& infile)
nitems = std::min(nitems, 12); // make sure malformed files do not cause out of bounds read
for (int i = 0; i < nitems; ++i) {
auto& item = bh->BundleItems[i];
if (item.Length == 0) continue;
if (isSwapped) {
swapInPlace(item.Length);
swapInPlace(item.Start);
Expand Down

0 comments on commit c270c8d

Please sign in to comment.