-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathexport.cpp
More file actions
147 lines (130 loc) · 4.08 KB
/
Copy pathexport.cpp
File metadata and controls
147 lines (130 loc) · 4.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#include "export.h"
#include "ui_export.h"
#include "style.h"
#include "filedialog.h"
Export::Export(QWidget *parent) :
QDialog(parent),
ui(new Ui::Export)
{
ui->setupUi(this);
QString style;
style = "QDialog{background-color: #2F2F2F}";
style += Style::pushButton();
setStyleSheet(style);
style = Style::groupBox();
ui->groupBox->setStyleSheet(style);
QString path = Settings::setIniFile();
m_settings = new QSettings(path, QSettings::IniFormat);
m_settings->beginGroup("Export");
m_lastExportPath = m_settings->value("lastExportPath", "").toString();
QRect rect = m_settings->value("geometry", 0).toRect();
if(rect.x() != 0) {
this->setGeometry(rect);
}
m_settings->endGroup();
if (m_lastExportPath.isEmpty()) {
m_settings->beginGroup("MainWindow");
m_lastExportPath = m_settings->value("lastSavePath", "").toString();
m_settings->endGroup();
}
}
Export::~Export()
{
m_settings->beginGroup("Export");
m_settings->setValue("lastExportPath", m_lastExportPath);
m_settings->setValue("geometry", this->geometry());
m_settings->endGroup();
delete ui;
}
void Export::setMeasurements(Measurements * _measurements, quint32 number, bool _applyCable, QString _description)
{
m_measurements = _measurements;
m_measureNumber = number;
m_bApplyCable = _applyCable;
m_description = _description;
}
void Export::on_csvBtn_clicked()
{
if(m_measurements != NULL)
{
if(m_lastExportPath.indexOf('.') >= 0)
{
m_lastExportPath.remove(m_lastExportPath.indexOf('.'),4);
m_lastExportPath.append(".csv");
}
QString path = FileDialog::getSaveFileName(this, "Export", m_lastExportPath, "Comma Separated Values (*.csv)");
if(!path.isEmpty())
{
m_lastExportPath = path;
m_measurements->exportData(path, 0, m_measureNumber, m_bApplyCable);
}
}
}
void Export::on_nwlBtn_clicked()
{
if(m_measurements != NULL)
{
if(m_lastExportPath.indexOf('.') >= 0)
{
m_lastExportPath.remove(m_lastExportPath.indexOf('.'),4);
m_lastExportPath.append(".nwl");
}
QString path = FileDialog::getSaveFileName(this, "Export", m_lastExportPath, "APAK-EL (*.nwl)");
if(!path.isEmpty())
{
m_lastExportPath = path;
m_measurements->exportData(path, 0, m_measureNumber, m_bApplyCable);
}
}
}
void Export::on_zRiBtn_clicked()
{
if(m_measurements != NULL)
{
if(m_lastExportPath.indexOf('.') >= 0)
{
m_lastExportPath.remove(m_lastExportPath.indexOf('.'),4);
m_lastExportPath.append(".s1p");
}
QString path = FileDialog::getSaveFileName(this, "Export", m_lastExportPath, "Touchstone (*.s1p)");
if(!path.isEmpty())
{
m_lastExportPath = path;
m_measurements->exportData(path, 0, m_measureNumber, m_bApplyCable, m_description);
}
}
}
void Export::on_sRiBtn_clicked()
{
if(m_measurements != NULL)
{
if(m_lastExportPath.indexOf('.') >= 0)
{
m_lastExportPath.remove(m_lastExportPath.indexOf('.'),4);
m_lastExportPath.append(".s1p");
}
QString path = FileDialog::getSaveFileName(this, "Export", m_lastExportPath, "Touchstone (*.s1p)");
if(!path.isEmpty())
{
m_lastExportPath = path;
m_measurements->exportData(path, 1, m_measureNumber, m_bApplyCable, m_description);
}
}
}
void Export::on_sMaBtn_clicked()
{
if(m_measurements != NULL)
{
if(m_lastExportPath.indexOf('.') >= 0)
{
m_lastExportPath.remove(m_lastExportPath.indexOf('.'),4);
m_lastExportPath.append(".s1p");
}
QString path = FileDialog::getSaveFileName(this, "Export", m_lastExportPath, "Touchstone (*.s1p)");
if(!path.isEmpty())
{
m_lastExportPath = path;
m_measurements->exportData(path, 2, m_measureNumber, m_bApplyCable, m_description);
}
}
}