forked from Ivasoft/DSView
Translate some texts, dso channel header, calibration dialog, fft dialog
This commit is contained in:
@@ -20,11 +20,12 @@
|
||||
*/
|
||||
|
||||
#include "spectrumstack.h"
|
||||
|
||||
#include <math.h>
|
||||
#include "dsosnapshot.h"
|
||||
#include "../sigsession.h"
|
||||
#include "../view/dsosignal.h"
|
||||
#include <math.h>
|
||||
#include "../ui/langresource.h"
|
||||
|
||||
|
||||
#define PI 3.1415
|
||||
|
||||
@@ -34,22 +35,6 @@ using namespace std;
|
||||
namespace pv {
|
||||
namespace data {
|
||||
|
||||
const QString SpectrumStack::windows_support[5] = {
|
||||
QT_TR_NOOP("Rectangle"),
|
||||
QT_TR_NOOP("Hann"),
|
||||
QT_TR_NOOP("Hamming"),
|
||||
QT_TR_NOOP("Blackman"),
|
||||
QT_TR_NOOP("Flat_top")
|
||||
};
|
||||
|
||||
const uint64_t SpectrumStack::length_support[5] = {
|
||||
1024,
|
||||
2048,
|
||||
4096,
|
||||
8192,
|
||||
16384,
|
||||
};
|
||||
|
||||
SpectrumStack::SpectrumStack(pv::SigSession *session, int index) :
|
||||
_session(session),
|
||||
_index(index),
|
||||
@@ -58,6 +43,7 @@ SpectrumStack::SpectrumStack(pv::SigSession *session, int index) :
|
||||
_spectrum_state(Init),
|
||||
_fft_plan(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
SpectrumStack::~SpectrumStack()
|
||||
@@ -127,26 +113,6 @@ void SpectrumStack::set_sample_interval(int interval)
|
||||
_sample_interval = interval;
|
||||
}
|
||||
|
||||
const std::vector<QString> SpectrumStack::get_windows_support()
|
||||
{
|
||||
std::vector<QString> windows;
|
||||
for (size_t i = 0; i < sizeof(windows_support)/sizeof(windows_support[0]); i++)
|
||||
{
|
||||
windows.push_back(windows_support[i]);
|
||||
}
|
||||
return windows;
|
||||
}
|
||||
|
||||
const std::vector<uint64_t> SpectrumStack::get_length_support()
|
||||
{
|
||||
std::vector<uint64_t> length;
|
||||
for (size_t i = 0; i < sizeof(length_support)/sizeof(length_support[0]); i++)
|
||||
{
|
||||
length.push_back(length_support[i]);
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
const std::vector<double> SpectrumStack::get_fft_spectrum()
|
||||
{
|
||||
std::vector<double> empty;
|
||||
|
||||
@@ -49,10 +49,6 @@ class SpectrumStack : public QObject, public SignalData
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
static const QString windows_support[5];
|
||||
static const uint64_t length_support[5];
|
||||
|
||||
public:
|
||||
enum spectrum_state {
|
||||
Init,
|
||||
@@ -72,10 +68,7 @@ public:
|
||||
void set_sample_num(uint64_t num);
|
||||
|
||||
int get_windows_index();
|
||||
void set_windows_index(int index);
|
||||
|
||||
const std::vector<QString> get_windows_support();
|
||||
const std::vector<uint64_t> get_length_support();
|
||||
void set_windows_index(int index);
|
||||
|
||||
bool dc_ignored();
|
||||
void set_dc_ignore(bool ignore);
|
||||
@@ -88,9 +81,7 @@ public:
|
||||
|
||||
void calc_fft();
|
||||
|
||||
double window(uint64_t i, int type);
|
||||
|
||||
signals:
|
||||
double window(uint64_t i, int type);
|
||||
|
||||
private:
|
||||
pv::SigSession *_session;
|
||||
|
||||
@@ -43,9 +43,13 @@ using namespace std;
|
||||
namespace pv {
|
||||
namespace dialogs {
|
||||
|
||||
const QString Calibration::VGAIN = QT_TR_NOOP(" VGAIN");
|
||||
const QString Calibration::VOFF = QT_TR_NOOP(" VOFF");
|
||||
const QString Calibration::VCOMB = QT_TR_NOOP(" VCOMB");
|
||||
namespace
|
||||
{
|
||||
QString VGAIN = "VGAIN";
|
||||
QString VOFF = "VOFF";
|
||||
QString VCOMB = "VCOMB";
|
||||
QString CHANNEL_LABEL = "Channel";
|
||||
}
|
||||
|
||||
Calibration::Calibration(QWidget *parent) :
|
||||
DSDialog(parent)
|
||||
@@ -56,11 +60,12 @@ Calibration::Calibration(QWidget *parent) :
|
||||
_exit_btn = NULL;
|
||||
_flayout = NULL;
|
||||
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
Qt::WindowFlags flags = windowFlags();
|
||||
this->setWindowFlags(flags | Qt::Tool);
|
||||
#endif
|
||||
this->setFixedSize(400, 250);
|
||||
this->setFixedSize(450, 300);
|
||||
this->setWindowOpacity(0.7);
|
||||
this->setModal(false);
|
||||
|
||||
@@ -144,6 +149,8 @@ void Calibration::update_device_info()
|
||||
}
|
||||
_label_list.clear();
|
||||
|
||||
_flayout->setSpacing(15);
|
||||
|
||||
for (const GSList *l = _device_agent->get_channels(); l; l = l->next) {
|
||||
sr_channel *const probe = (sr_channel*)l->data;
|
||||
assert(probe);
|
||||
@@ -159,8 +166,11 @@ void Calibration::update_device_info()
|
||||
gain_slider->setRange(-vgain_range/2, vgain_range/2);
|
||||
gain_slider->setValue(vgain - vgain_default);
|
||||
gain_slider->setObjectName(VGAIN+probe->index);
|
||||
QString gain_string = L_S(STR_PAGE_DLG, S_ID(IDS_DLG_CHANNEL), "Channel") + QString::number(probe->index) + VGAIN;
|
||||
QString gain_string = CHANNEL_LABEL + QString::number(probe->index) + VGAIN;
|
||||
QLabel *gain_label = new QLabel(gain_string, this);
|
||||
ui::adjust_label_size(gain_label, ui::ADJUST_HEIGHT);
|
||||
gain_slider->setFixedHeight(gain_label->size().height());
|
||||
gain_label->setAlignment(Qt::AlignVCenter);
|
||||
_flayout->addRow(gain_label, gain_slider);
|
||||
_slider_list.push_back(gain_slider);
|
||||
_label_list.push_back(gain_label);
|
||||
@@ -180,8 +190,11 @@ void Calibration::update_device_info()
|
||||
off_slider->setRange(0, voff_range);
|
||||
off_slider->setValue(voff);
|
||||
off_slider->setObjectName(VOFF+probe->index);
|
||||
QString off_string = L_S(STR_PAGE_DLG, S_ID(IDS_DLG_CHANNEL), "Channel") + QString::number(probe->index) + VOFF;
|
||||
QString off_string = CHANNEL_LABEL + QString::number(probe->index) + VOFF;
|
||||
QLabel *off_label = new QLabel(off_string, this);
|
||||
ui::adjust_label_size(off_label, ui::ADJUST_HEIGHT);
|
||||
off_slider->setFixedHeight(off_label->size().height());
|
||||
off_label->setAlignment(Qt::AlignVCenter);
|
||||
_flayout->addRow(off_label, off_slider);
|
||||
_slider_list.push_back(off_slider);
|
||||
_label_list.push_back(off_label);
|
||||
@@ -197,8 +210,11 @@ void Calibration::update_device_info()
|
||||
comp_slider->setRange(-127, 127);
|
||||
comp_slider->setValue(comb_comp);
|
||||
comp_slider->setObjectName(VCOMB+probe->index);
|
||||
QString comp_string = L_S(STR_PAGE_DLG, S_ID(IDS_DLG_CHANNEL), "Channel") + QString::number(probe->index) + VCOMB;
|
||||
QString comp_string = CHANNEL_LABEL + QString::number(probe->index) + VCOMB;
|
||||
QLabel *comp_label = new QLabel(comp_string, this);
|
||||
ui::adjust_label_size(comp_label, ui::ADJUST_HEIGHT);
|
||||
comp_slider->setFixedHeight(comp_label->size().height());
|
||||
comp_label->setAlignment(Qt::AlignVCenter);
|
||||
_flayout->addRow(comp_label, comp_slider);
|
||||
_slider_list.push_back(comp_slider);
|
||||
_label_list.push_back(comp_label);
|
||||
@@ -209,6 +225,10 @@ void Calibration::update_device_info()
|
||||
connect(off_slider, SIGNAL(valueChanged(int)), this, SLOT(set_value(int)));
|
||||
}
|
||||
|
||||
QWidget *spaceLine = new QWidget();
|
||||
spaceLine->setFixedHeight(10);
|
||||
_flayout->addRow(spaceLine);
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -297,10 +317,6 @@ void Calibration::on_abort()
|
||||
Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint);
|
||||
dlg.setCancelButton(NULL);
|
||||
|
||||
QFutureWatcher<void> watcher;
|
||||
connect(&watcher,SIGNAL(finished()),&dlg,SLOT(cancel()));
|
||||
watcher.setFuture(future);
|
||||
|
||||
dlg.exec();
|
||||
this->show();
|
||||
}
|
||||
@@ -347,9 +363,23 @@ void Calibration::on_reset()
|
||||
}
|
||||
}
|
||||
|
||||
void Calibration::updateLangText()
|
||||
{
|
||||
QString sp = " ";
|
||||
VGAIN = sp + L_S(STR_PAGE_DLG, S_ID(IDS_CALIB_VGAIN), "VGAIN");
|
||||
VOFF = sp + L_S(STR_PAGE_DLG, S_ID(IDS_CALIB_VOFF), "VOFF");
|
||||
VCOMB = sp + L_S(STR_PAGE_DLG, S_ID(IDS_CALIB_VCOMB), "VCOMB");
|
||||
CHANNEL_LABEL = L_S(STR_PAGE_DLG, S_ID(IDS_DLG_CHANNEL), "Channel");
|
||||
}
|
||||
|
||||
void Calibration::UpdateLanguage()
|
||||
{
|
||||
updateLangText();
|
||||
retranslateUi();
|
||||
|
||||
if (this->isVisible()){
|
||||
update_device_info();
|
||||
}
|
||||
}
|
||||
|
||||
void Calibration::UpdateTheme()
|
||||
|
||||
@@ -43,11 +43,6 @@ class Calibration : public DSDialog, public IUiWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
static const QString VGAIN;
|
||||
static const QString VOFF;
|
||||
static const QString VCOMB;
|
||||
|
||||
public:
|
||||
Calibration(QWidget *parent);
|
||||
~Calibration();
|
||||
@@ -66,6 +61,8 @@ private:
|
||||
void UpdateTheme() override;
|
||||
void UpdateFont() override;
|
||||
|
||||
void updateLangText();
|
||||
|
||||
private slots:
|
||||
void set_value(int value);
|
||||
void on_save();
|
||||
|
||||
@@ -93,22 +93,25 @@ FftOptions::FftOptions(QWidget *parent, SigSession *session) :
|
||||
for(auto t : _session->get_spectrum_traces()) {
|
||||
view::SpectrumTrace *spectrumTraces = NULL;
|
||||
if ((spectrumTraces = dynamic_cast<view::SpectrumTrace*>(t))) {
|
||||
windows = spectrumTraces->get_spectrum_stack()->get_windows_support();
|
||||
length = spectrumTraces->get_spectrum_stack()->get_length_support();
|
||||
windows = spectrumTraces->get_windows_support();
|
||||
length = spectrumTraces->get_length_support();
|
||||
view_modes = spectrumTraces->get_view_modes_support();
|
||||
dbv_ranges = spectrumTraces->get_dbv_ranges();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
assert(windows.size() > 0);
|
||||
assert(length.size() > 0);
|
||||
assert(view_modes.size() > 0);
|
||||
assert(dbv_ranges.size() > 0);
|
||||
|
||||
for (unsigned int i = 0; i < windows.size(); i++)
|
||||
{
|
||||
_window_combobox->addItem(windows[i],
|
||||
QVariant::fromValue(i));
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < length.size(); i++)
|
||||
{
|
||||
if (length[i] < _sample_limit)
|
||||
@@ -117,6 +120,7 @@ FftOptions::FftOptions(QWidget *parent, SigSession *session) :
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
assert(_len_combobox->count() > 0);
|
||||
_len_combobox->setCurrentIndex(_len_combobox->count()-1);
|
||||
|
||||
|
||||
@@ -1378,20 +1378,21 @@ namespace pv
|
||||
|
||||
if (language == LAN_CN)
|
||||
{
|
||||
// _qtTrans.load(":/qt_" + QString::number(language));
|
||||
//qApp->installTranslator(&_qtTrans);
|
||||
//_myTrans.load(":/my_" + QString::number(language));
|
||||
// qApp->installTranslator(&_myTrans);
|
||||
_qtTrans.load(":/qt_" + QString::number(language));
|
||||
qApp->installTranslator(&_qtTrans);
|
||||
_myTrans.load(":/my_" + QString::number(language));
|
||||
qApp->installTranslator(&_myTrans);
|
||||
}
|
||||
else if (language == LAN_EN)
|
||||
{
|
||||
// qApp->removeTranslator(&_qtTrans);
|
||||
// qApp->removeTranslator(&_myTrans);
|
||||
qApp->removeTranslator(&_qtTrans);
|
||||
qApp->removeTranslator(&_myTrans);
|
||||
}
|
||||
|
||||
retranslateUi();
|
||||
|
||||
UiManager::Instance()->Update(UI_UPDATE_ACTION_LANG);
|
||||
_session->update_lang_text();
|
||||
}
|
||||
|
||||
void MainWindow::switchTheme(QString style)
|
||||
@@ -2096,7 +2097,7 @@ namespace pv
|
||||
break;
|
||||
|
||||
case DSV_MSG_FONT_OPTIONS_CHANGED:
|
||||
UiManager::Instance()->Update(UI_UPDATE_ACTION_FONT);
|
||||
UiManager::Instance()->Update(UI_UPDATE_ACTION_FONT);
|
||||
break;
|
||||
case DSV_MSG_DATA_POOL_CHANGED:
|
||||
_view->check_measure();
|
||||
|
||||
@@ -2549,4 +2549,11 @@ namespace pv
|
||||
}
|
||||
}
|
||||
|
||||
void SigSession::update_lang_text()
|
||||
{
|
||||
for (auto trace : _spectrum_traces){
|
||||
trace->update_lang_text();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace pv
|
||||
|
||||
@@ -447,6 +447,8 @@ public:
|
||||
return _view_data->get_dso()->data_is_out_off_range();
|
||||
}
|
||||
|
||||
void update_lang_text();
|
||||
|
||||
private:
|
||||
void set_cur_samplelimits(uint64_t samplelimits);
|
||||
void set_cur_snap_samplerate(uint64_t samplerate);
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <QRadioButton>
|
||||
#include <QCheckBox>
|
||||
#include <QDebug>
|
||||
#include <QFontMetrics>
|
||||
|
||||
#include "../config/appconfig.h"
|
||||
#include "../ui/xtoolbutton.h"
|
||||
@@ -147,4 +148,27 @@ namespace ui
|
||||
}
|
||||
}
|
||||
|
||||
QSize measure_string(QFont font, QString str)
|
||||
{
|
||||
QFontMetrics fm(font);
|
||||
QRect rc = fm.boundingRect(str);
|
||||
return rc.size();
|
||||
}
|
||||
|
||||
void adjust_label_size(QLabel *ctrl, AdjustSizeAction action)
|
||||
{
|
||||
QSize sz = measure_string(ctrl->font(), ctrl->text());
|
||||
|
||||
if (action == ADJUST_WIDTH){
|
||||
ctrl->setFixedWidth(sz.width() + 5);
|
||||
}
|
||||
else if (action == ADJUST_HEIGHT){
|
||||
ctrl->setFixedHeight(sz.height() + 5);
|
||||
}
|
||||
else{
|
||||
ctrl->setFixedHeight(sz.height() + 5);
|
||||
ctrl->setFixedWidth(sz.width() + 5);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
@@ -23,6 +23,8 @@
|
||||
#define _UI_FN_H
|
||||
|
||||
#include <QFont>
|
||||
#include <QSize>
|
||||
#include <QLabel>
|
||||
|
||||
struct FontParam;
|
||||
|
||||
@@ -31,12 +33,24 @@ class QWidget;
|
||||
|
||||
namespace ui
|
||||
{
|
||||
|
||||
enum AdjustSizeAction
|
||||
{
|
||||
ADJUST_WIDTH = 0,
|
||||
ADJUST_HEIGHT = 1,
|
||||
ADJUST_ALL = 2,
|
||||
};
|
||||
|
||||
void set_font_param(QFont &font, struct FontParam ¶m);
|
||||
|
||||
void set_toolbar_font(QToolBar *bar, QFont font);
|
||||
|
||||
void set_form_font(QWidget *wid, QFont font);
|
||||
|
||||
QSize measure_string(QFont font, QString str);
|
||||
|
||||
void adjust_label_size(QLabel *ctrl, AdjustSizeAction action);
|
||||
|
||||
} // namespace ui
|
||||
|
||||
#endif
|
||||
@@ -51,9 +51,9 @@ void UiManager::AddWindow(IUiWindow *w)
|
||||
m_widgets.push_back(w);
|
||||
|
||||
//Init the ui.
|
||||
w->UpdateFont();
|
||||
w->UpdateLanguage();
|
||||
w->UpdateTheme();
|
||||
w->UpdateFont();
|
||||
}
|
||||
|
||||
void UiManager::RemoveWindow(IUiWindow *w)
|
||||
|
||||
@@ -111,8 +111,6 @@ const QColor DecodeTrace::OutlineColours[16] = {
|
||||
QColor(0x6B, 0x23, 0x37)
|
||||
};
|
||||
|
||||
const QString DecodeTrace::RegionStart = QT_TR_NOOP("Start");
|
||||
const QString DecodeTrace::RegionEnd = QT_TR_NOOP("End ");
|
||||
|
||||
DecodeTrace::DecodeTrace(pv::SigSession *session,
|
||||
pv::data::DecoderStack *decoder_stack, int index) :
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "../sigsession.h"
|
||||
#include "../log.h"
|
||||
#include "../appcontrol.h"
|
||||
#include "../ui/langresource.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -1086,34 +1087,34 @@ void DsoSignal::paint_type_options(QPainter &p, int right, const QPoint pt, QCol
|
||||
QFontMetrics fm(p.font());
|
||||
const QRectF valueRect = QRectF(chEn_rect.left(), vDial_rect.top()-fm.height()-10, right, fm.height());
|
||||
p.drawText(valueRect, Qt::AlignCenter, pText);
|
||||
|
||||
QString strings[6];
|
||||
strings[0] = L_S(STR_PAGE_DLG, S_ID(IDS_DSO_CTR_EN), "EN");
|
||||
strings[1] = L_S(STR_PAGE_DLG, S_ID(IDS_DSO_CTR_DIS), "DIS");
|
||||
strings[2] = L_S(STR_PAGE_DLG, S_ID(IDS_DSO_CTR_GND), "GND");
|
||||
strings[3] = L_S(STR_PAGE_DLG, S_ID(IDS_DSO_CTR_DC), "DC");
|
||||
strings[4] = L_S(STR_PAGE_DLG, S_ID(IDS_DSO_CTR_AC), "AC");
|
||||
strings[5] = L_S(STR_PAGE_DLG, S_ID(IDS_DSO_CTR_AUTO), "AUTO");
|
||||
|
||||
const char *strings[6] = {
|
||||
QT_TR_NOOP("EN"),
|
||||
QT_TR_NOOP("DIS"),
|
||||
QT_TR_NOOP("GND"),
|
||||
QT_TR_NOOP("DC"),
|
||||
QT_TR_NOOP("AC"),
|
||||
QT_TR_NOOP("AUTO"),
|
||||
};
|
||||
p.setPen(Qt::transparent);
|
||||
p.setBrush(chEn_rect.contains(pt) ? _colour.darker() : _colour);
|
||||
p.drawRect(chEn_rect);
|
||||
p.setPen(Qt::white);
|
||||
p.drawText(chEn_rect, Qt::AlignCenter | Qt::AlignVCenter, enabled() ? tr(strings[0]) : tr(strings[1]));
|
||||
p.drawText(chEn_rect, Qt::AlignCenter | Qt::AlignVCenter, enabled() ? strings[0] : strings[1]);
|
||||
|
||||
p.setPen(Qt::transparent);
|
||||
p.setBrush(enabled() ? (acdc_rect.contains(pt) ? _colour.darker() : _colour) : foreBack);
|
||||
p.drawRect(acdc_rect);
|
||||
p.setPen(Qt::white);
|
||||
p.drawText(acdc_rect, Qt::AlignCenter | Qt::AlignVCenter, (_acCoupling == SR_GND_COUPLING) ? tr(strings[2]):
|
||||
(_acCoupling == SR_DC_COUPLING) ? tr(strings[3]) : tr(strings[4]));
|
||||
p.drawText(acdc_rect, Qt::AlignCenter | Qt::AlignVCenter, (_acCoupling == SR_GND_COUPLING) ? strings[2]:
|
||||
(_acCoupling == SR_DC_COUPLING) ? strings[3] : strings[4]);
|
||||
|
||||
if (session->get_device()->is_hardware()) {
|
||||
p.setPen(Qt::transparent);
|
||||
p.setBrush(enabled() ? (auto_rect.contains(pt) ? _colour.darker() : _colour) : foreBack);
|
||||
p.drawRect(auto_rect);
|
||||
p.setPen(Qt::white);
|
||||
p.drawText(auto_rect, Qt::AlignCenter | Qt::AlignVCenter, tr(strings[5]));
|
||||
p.drawText(auto_rect, Qt::AlignCenter | Qt::AlignVCenter, strings[5]);
|
||||
}
|
||||
|
||||
// paint the probe factor selector
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "../view/viewport.h"
|
||||
#include "../data/spectrumstack.h"
|
||||
#include "../dsvdef.h"
|
||||
#include "../ui/langresource.h"
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
@@ -40,16 +41,27 @@ using namespace std;
|
||||
namespace pv {
|
||||
namespace view {
|
||||
|
||||
namespace
|
||||
{
|
||||
QString FFT_ViewMode[2];
|
||||
QString windows_support[5];
|
||||
|
||||
static const uint64_t length_support[5] = {
|
||||
1024,
|
||||
2048,
|
||||
4096,
|
||||
8192,
|
||||
16384,
|
||||
};
|
||||
}
|
||||
|
||||
const int SpectrumTrace::UpMargin = 0;
|
||||
const int SpectrumTrace::DownMargin = 0;
|
||||
const int SpectrumTrace::RightMargin = 30;
|
||||
const QString SpectrumTrace::FFT_ViewMode[2] = {
|
||||
"Linear RMS",
|
||||
"DBV RMS"
|
||||
};
|
||||
|
||||
const QString SpectrumTrace::FreqPrefixes[9] =
|
||||
{"", "", "", "", "K", "M", "G", "T", "P"};
|
||||
|
||||
const int SpectrumTrace::FirstSIPrefixPower = -9;
|
||||
const int SpectrumTrace::LastSIPrefixPower = 15;
|
||||
const int SpectrumTrace::Pricision = 2;
|
||||
@@ -70,8 +82,7 @@ const double SpectrumTrace::VerticalRate = 1.0 / 2000.0;
|
||||
SpectrumTrace::SpectrumTrace(pv::SigSession *session,
|
||||
pv::data::SpectrumStack *spectrum_stack, int index) :
|
||||
Trace("FFT("+QString::number(index)+")", index, SR_CHANNEL_FFT),
|
||||
_session(session),
|
||||
_spectrum_stack(spectrum_stack),
|
||||
_session(session),
|
||||
_enable(false),
|
||||
_view_mode(0),
|
||||
_hover_en(false),
|
||||
@@ -85,6 +96,10 @@ SpectrumTrace::SpectrumTrace(pv::SigSession *session,
|
||||
_colour = s->get_colour();
|
||||
}
|
||||
}
|
||||
|
||||
_spectrum_stack = spectrum_stack;
|
||||
|
||||
update_lang_text();
|
||||
}
|
||||
|
||||
SpectrumTrace::~SpectrumTrace()
|
||||
@@ -495,5 +510,37 @@ QRect SpectrumTrace::get_view_rect()
|
||||
_viewport->height() - UpMargin - DownMargin);
|
||||
}
|
||||
|
||||
const std::vector<QString> SpectrumTrace::get_windows_support()
|
||||
{
|
||||
std::vector<QString> list;
|
||||
for (size_t i = 0; i < sizeof(windows_support)/sizeof(windows_support[0]); i++)
|
||||
{
|
||||
list.push_back(windows_support[i]);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
const std::vector<uint64_t> SpectrumTrace::get_length_support()
|
||||
{
|
||||
std::vector<uint64_t> list;
|
||||
for (size_t i = 0; i < sizeof(length_support)/sizeof(length_support[0]); i++)
|
||||
{
|
||||
list.push_back(length_support[i]);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
void SpectrumTrace::update_lang_text()
|
||||
{
|
||||
windows_support[0] = L_S(STR_PAGE_DLG, S_ID(IDS_FFT_WINDOW_RECTANGLE), "Rectangle");
|
||||
windows_support[1] = L_S(STR_PAGE_DLG, S_ID(IDS_FFT_WINDOW_HANN), "Hann");
|
||||
windows_support[2] = L_S(STR_PAGE_DLG, S_ID(IDS_FFT_WINDOW_HAMMING), "Hamming");
|
||||
windows_support[3] = L_S(STR_PAGE_DLG, S_ID(IDS_FFT_WINDOW_BLACKMAN), "Blackman");
|
||||
windows_support[4] = L_S(STR_PAGE_DLG, S_ID(IDS_FFT_WINDOW_FLATTOP), "Flat_top");
|
||||
|
||||
FFT_ViewMode[0] = L_S(STR_PAGE_DLG, S_ID(IDS_FFT_MODE_LINEARRSM), "Linear RMS");
|
||||
FFT_ViewMode[1] = "DBV RMS";
|
||||
}
|
||||
|
||||
} // namespace view
|
||||
} // namespace pv
|
||||
|
||||
@@ -49,8 +49,7 @@ class SpectrumTrace : public Trace
|
||||
private:
|
||||
static const int UpMargin;
|
||||
static const int DownMargin;
|
||||
static const int RightMargin;
|
||||
static const QString FFT_ViewMode[2];
|
||||
static const int RightMargin;
|
||||
|
||||
static const QString FreqPrefixes[9];
|
||||
static const int FirstSIPrefixPower;
|
||||
@@ -124,6 +123,10 @@ public:
|
||||
|
||||
QRect get_view_rect();
|
||||
|
||||
void update_lang_text();
|
||||
const std::vector<QString> get_windows_support();
|
||||
const std::vector<uint64_t> get_length_support();
|
||||
|
||||
protected:
|
||||
void paint_type_options(QPainter &p, int right, const QPoint pt, QColor fore);
|
||||
|
||||
|
||||
@@ -730,5 +730,65 @@
|
||||
{
|
||||
"id": "IDS_DLG_END_CURSOR",
|
||||
"text": "结束"
|
||||
},
|
||||
{
|
||||
"id": "IDS_DSO_CTR_EN",
|
||||
"text": "启用"
|
||||
},
|
||||
{
|
||||
"id": "IDS_DSO_CTR_DIS",
|
||||
"text": "禁用"
|
||||
},
|
||||
{
|
||||
"id": "IDS_DSO_CTR_GND",
|
||||
"text": "接地"
|
||||
},
|
||||
{
|
||||
"id": "IDS_DSO_CTR_DC",
|
||||
"text": "直流"
|
||||
},
|
||||
{
|
||||
"id": "IDS_DSO_CTR_AC",
|
||||
"text": "交流"
|
||||
},
|
||||
{
|
||||
"id": "IDS_DSO_CTR_AUTO",
|
||||
"text": "自动"
|
||||
},
|
||||
{
|
||||
"id": "IDS_CALIB_VGAIN",
|
||||
"text": "增益"
|
||||
},
|
||||
{
|
||||
"id": "IDS_CALIB_VOFF",
|
||||
"text": "偏置"
|
||||
},
|
||||
{
|
||||
"id": "IDS_CALIB_VCOMB",
|
||||
"text": "交织"
|
||||
},
|
||||
{
|
||||
"id": "IDS_FFT_WINDOW_RECTANGLE",
|
||||
"text": "矩形"
|
||||
},
|
||||
{
|
||||
"id": "IDS_FFT_WINDOW_HANN",
|
||||
"text": "汉宁"
|
||||
},
|
||||
{
|
||||
"id": "IDS_FFT_WINDOW_HAMMING",
|
||||
"text": "汉明"
|
||||
},
|
||||
{
|
||||
"id": "IDS_FFT_WINDOW_BLACKMAN",
|
||||
"text": "布莱克曼"
|
||||
},
|
||||
{
|
||||
"id": "IDS_FFT_WINDOW_FLATTOP",
|
||||
"text": "平顶"
|
||||
},
|
||||
{
|
||||
"id": "IDS_FFT_MODE_LINEARRSM",
|
||||
"text": "线性 RMS"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -730,5 +730,65 @@
|
||||
{
|
||||
"id": "IDS_DLG_END_CURSOR",
|
||||
"text": "End"
|
||||
},
|
||||
{
|
||||
"id": "IDS_DSO_CTR_EN",
|
||||
"text": "EN"
|
||||
},
|
||||
{
|
||||
"id": "IDS_DSO_CTR_DIS",
|
||||
"text": "DIS"
|
||||
},
|
||||
{
|
||||
"id": "IDS_DSO_CTR_GND",
|
||||
"text": "GND"
|
||||
},
|
||||
{
|
||||
"id": "IDS_DSO_CTR_DC",
|
||||
"text": "DC"
|
||||
},
|
||||
{
|
||||
"id": "IDS_DSO_CTR_AC",
|
||||
"text": "AC"
|
||||
},
|
||||
{
|
||||
"id": "IDS_DSO_CTR_AUTO",
|
||||
"text": "AUTO"
|
||||
},
|
||||
{
|
||||
"id": "IDS_CALIB_VGAIN",
|
||||
"text": "VGAIN"
|
||||
},
|
||||
{
|
||||
"id": "IDS_CALIB_VOFF",
|
||||
"text": "VOFF"
|
||||
},
|
||||
{
|
||||
"id": "IDS_CALIB_VCOMB",
|
||||
"text": "VCOMB"
|
||||
},
|
||||
{
|
||||
"id": "IDS_FFT_WINDOW_RECTANGLE",
|
||||
"text": "Rectangle"
|
||||
},
|
||||
{
|
||||
"id": "IDS_FFT_WINDOW_HANN",
|
||||
"text": "Hann"
|
||||
},
|
||||
{
|
||||
"id": "IDS_FFT_WINDOW_HAMMING",
|
||||
"text": "Hamming"
|
||||
},
|
||||
{
|
||||
"id": "IDS_FFT_WINDOW_BLACKMAN",
|
||||
"text": "Blackman"
|
||||
},
|
||||
{
|
||||
"id": "IDS_FFT_WINDOW_FLATTOP",
|
||||
"text": "Flat_top"
|
||||
},
|
||||
{
|
||||
"id": "IDS_FFT_MODE_LINEARRSM",
|
||||
"text": "Linear RMS"
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user