forked from Ivasoft/DSView
update: remove QTextStream in pv/rule.cpp
This commit is contained in:
@@ -147,7 +147,7 @@ const std::vector<QString>& Annotation::annotations() const
|
||||
char sz_format_tmp_buf[50] = {0};
|
||||
QString src = rd_src.replace("{$}", "%s");
|
||||
const char *num_str = _status->m_resTable.format_numberic(resItem.str_number_hex, resItem.cur_display_format);
|
||||
sprintf(sz_format_tmp_buf, src.toLatin1().data(), num_str);
|
||||
sprintf(sz_format_tmp_buf, src.toUtf8().data(), num_str);
|
||||
resItem.cvt_lines.push_back(QString(sz_format_tmp_buf));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,11 +344,6 @@ bool DecoderStack::list_row_title(int row, QString &title)
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString DecoderStack::error_message()
|
||||
{
|
||||
return _error_message;
|
||||
}
|
||||
|
||||
void DecoderStack::clear()
|
||||
{
|
||||
init();
|
||||
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
|
||||
|
||||
bool list_row_title(int row, QString &title);
|
||||
QString error_message();
|
||||
|
||||
void clear();
|
||||
void init();
|
||||
uint64_t get_max_sample_count();
|
||||
@@ -149,6 +149,10 @@ public:
|
||||
int64_t get_mark_index();
|
||||
void frame_ended();
|
||||
|
||||
inline QString error_message(){
|
||||
return _error_message;
|
||||
}
|
||||
|
||||
private:
|
||||
void decode_data(const uint64_t decode_start, const uint64_t decode_end, srd_session *const session);
|
||||
void decode_proc();
|
||||
|
||||
@@ -124,7 +124,7 @@ ProtocolDock::ProtocolDock(QWidget *parent, view::View &view, SigSession *sessio
|
||||
if (repeatNammes != ""){
|
||||
QString err = "Any protocol have repeated id or name: ";
|
||||
err += repeatNammes;
|
||||
MsgBox::Show("error", err.toLatin1().data());
|
||||
MsgBox::Show("error", err.toUtf8().data());
|
||||
}
|
||||
|
||||
hori_layout->addWidget(_add_button);
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QPainter>
|
||||
#include <QTextStream>
|
||||
#include <QStyleOption>
|
||||
|
||||
|
||||
@@ -96,21 +95,22 @@ QString Ruler::format_freq(double period, unsigned precision)
|
||||
const int prefix = ceil((order - FirstSIPrefixPower) / 3.0f);
|
||||
const double multiplier = pow(10.0, max(-prefix * 3.0 - FirstSIPrefixPower, 0.0));
|
||||
|
||||
/*
|
||||
QString s;
|
||||
QTextStream ts(&s);
|
||||
ts.setRealNumberPrecision(precision);
|
||||
ts << fixed << 1 / (period * multiplier) <<
|
||||
FreqPrefixes[prefix] << "Hz";
|
||||
return s;
|
||||
|
||||
/*
|
||||
char buf[20] = {0};
|
||||
char format[10] = {0};
|
||||
sprintf(format, "%%.%df%%s", precision);
|
||||
QString prev = FreqPrefixes[prefix] + "Hz";
|
||||
sprintf(buf, format, 1 / (period * multiplier), prev.toLatin1().data());
|
||||
return QString(buf);
|
||||
*/
|
||||
|
||||
char buffer[20] = {0};
|
||||
char format[10] = {0};
|
||||
QString units = FreqPrefixes[prefix] + "Hz";
|
||||
sprintf(format, "%%.%df", (int)precision);
|
||||
sprintf(buffer, format, 1 / (period * multiplier));
|
||||
strcat(buffer, units.toUtf8().data());
|
||||
return QString(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,21 +119,24 @@ QString Ruler::format_time(double t, int prefix,
|
||||
{
|
||||
const double multiplier = pow(10.0, -prefix * 3 - FirstSIPrefixPower + 6.0);
|
||||
|
||||
/*
|
||||
QString s;
|
||||
QTextStream ts(&s);
|
||||
ts.setRealNumberPrecision(precision);
|
||||
ts << fixed << forcesign << (t * multiplier) / 1000000.0 <<
|
||||
SIPrefixes[prefix] << "s";
|
||||
return s;
|
||||
|
||||
/*
|
||||
char buf[20] = {0};
|
||||
char format[10] = {0};
|
||||
sprintf(format, "%%.%df%%s", precision);
|
||||
QString prev = SIPrefixes[prefix] + "s";
|
||||
sprintf(buf, format, (t * multiplier) / 1000000.0, prev.toLatin1().data());
|
||||
return QString(buf);
|
||||
*/
|
||||
|
||||
char buffer[20] = {0};
|
||||
char format[10] = {0};
|
||||
QString units = SIPrefixes[prefix] + "s";
|
||||
double v = (t * multiplier) / 1000000.0;
|
||||
buffer[0] = v >= 0 ? '+' : '-';
|
||||
sprintf(format, "%%.%df", (int)precision);
|
||||
sprintf(buffer + 1, format, v);
|
||||
strcat(buffer + 1, units.toUtf8().data());
|
||||
return QString(buffer);
|
||||
}
|
||||
|
||||
QString Ruler::format_time(double t)
|
||||
|
||||
@@ -210,20 +210,21 @@ QString SpectrumTrace::format_freq(double freq, unsigned precision)
|
||||
const int prefix = floor((order - FirstSIPrefixPower)/ 3.0f);
|
||||
const double divider = pow(10.0, max(prefix * 3.0 + FirstSIPrefixPower, 0.0));
|
||||
|
||||
/*
|
||||
QString s;
|
||||
QTextStream ts(&s);
|
||||
ts.setRealNumberPrecision(precision);
|
||||
ts << fixed << freq / divider << FreqPrefixes[prefix] << "Hz";
|
||||
return s;
|
||||
*/
|
||||
|
||||
/*
|
||||
char buf[20] = {0};
|
||||
char buffer[20] = {0};
|
||||
char format[10] = {0};
|
||||
sprintf(format, "%%.%df%%s", precision);
|
||||
QString prev = FreqPrefixes[prefix] + "Hz";
|
||||
sprintf(buf, format, freq / divider, prev.toLatin1().data());
|
||||
return QString(buf);
|
||||
*/
|
||||
QString units = FreqPrefixes[prefix] + "Hz";
|
||||
sprintf(format, "%%.%df", (int)precision);
|
||||
sprintf(buffer, format, freq / divider);
|
||||
strcat(buffer, units.toUtf8().data());
|
||||
return QString(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user