mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
- ITF14/DPLEIT/DPIDENT: ignore option_2
(check digit options)
- GUI: scalewindow: fix cropping resolution on initial setup (`spnResolution` max 1000 -> 254000) and bound X-dim to <= 10 in `set_maxima()` - GUI: mainwindow: bound X-dim as above and clamp `m_xdimdpVars` members on initial load from INI - GUI: undo `QString::mid()` -> `QString::midRef()` from clazy & explicitly include "QObject" in "qzint.h" (not Qt6 compatible)
This commit is contained in:
@ -67,7 +67,7 @@ DataWindow::DataWindow(const QString &input, bool isEscaped, int seg_no) : Valid
|
||||
lastPosn = match.capturedEnd(0);
|
||||
}
|
||||
}
|
||||
out += input.midRef(lastPosn);
|
||||
out += input.mid(lastPosn);
|
||||
txtDataInput->setPlainText(out);
|
||||
statusBarData->showMessage(tr("Converted LFs"), tempMessageTimeout);
|
||||
} else {
|
||||
|
@ -140,7 +140,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
<number>25400</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
|
@ -89,19 +89,19 @@ static QColor str_to_qcolor(const QString &str)
|
||||
int comma1 = str.indexOf(',');
|
||||
int comma2 = str.indexOf(',', comma1 + 1);
|
||||
int comma3 = str.indexOf(',', comma2 + 1);
|
||||
int black = 100 - str.midRef(comma3 + 1).toInt();
|
||||
int val = 100 - str.midRef(0, comma1).toInt();
|
||||
int black = 100 - str.mid(comma3 + 1).toInt();
|
||||
int val = 100 - str.mid(0, comma1).toInt();
|
||||
r = (int) roundf((0xFF * val * black) / 10000.0f);
|
||||
val = 100 - str.midRef(comma1 + 1, comma2 - comma1 - 1).toInt();
|
||||
val = 100 - str.mid(comma1 + 1, comma2 - comma1 - 1).toInt();
|
||||
g = (int) roundf((0xFF * val * black) / 10000.0f);
|
||||
val = 100 - str.midRef(comma2 + 1, comma3 - comma2 - 1).toInt();
|
||||
val = 100 - str.mid(comma2 + 1, comma3 - comma2 - 1).toInt();
|
||||
b = (int) roundf((0xFF * val * black) / 10000.0f);
|
||||
a = 0xFF;
|
||||
} else {
|
||||
r = str.midRef(0, 2).toInt(nullptr, 16);
|
||||
g = str.midRef(2, 2).toInt(nullptr, 16);
|
||||
b = str.midRef(4, 2).toInt(nullptr, 16);
|
||||
a = str.length() == 8 ? str.midRef(6, 2).toInt(nullptr, 16) : 0xFF;
|
||||
r = str.mid(0, 2).toInt(nullptr, 16);
|
||||
g = str.mid(2, 2).toInt(nullptr, 16);
|
||||
b = str.mid(4, 2).toInt(nullptr, 16);
|
||||
a = str.length() == 8 ? str.mid(6, 2).toInt(nullptr, 16) : 0xFF;
|
||||
}
|
||||
color.setRgb(r, g, b, a);
|
||||
return color;
|
||||
@ -546,12 +546,15 @@ void MainWindow::load_settings(QSettings &settings)
|
||||
chkDotty->setChecked(settings.value(QSL("studio/appearance/chk_dotty"), 0).toInt() ? true : false);
|
||||
spnDotSize->setValue(settings.value(QSL("studio/appearance/dot_size"), 4.0 / 5.0).toFloat());
|
||||
// These are "system-wide"
|
||||
m_xdimdpVars.resolution_units = settings.value(QSL("studio/xdimdpvars/resolution_units"), 0).toInt();
|
||||
m_xdimdpVars.resolution_units = std::max(std::min(settings.value(QSL("studio/xdimdpvars/resolution_units"),
|
||||
0).toInt(), 1), 0);
|
||||
const int defaultResolution = m_xdimdpVars.resolution_units == 1 ? 300 : 12; // 300dpi or 12dpmm
|
||||
m_xdimdpVars.resolution = settings.value(QSL("studio/xdimdpvars/resolution"), defaultResolution).toInt();
|
||||
const int maxRes = m_xdimdpVars.resolution_units == 1 ? 25400 : 1000;
|
||||
m_xdimdpVars.resolution = std::max(std::min(settings.value(QSL("studio/xdimdpvars/resolution"),
|
||||
defaultResolution).toInt(), maxRes), 1);
|
||||
m_xdimdpVars.filetype = std::max(std::min(settings.value(QSL("studio/xdimdpvars/filetype"), 0).toInt(), 1), 0);
|
||||
m_xdimdpVars.filetype_maxicode
|
||||
= std::max(std::min(settings.value(QSL("studio/xdimdpvars/filetype_maxicode"), 0).toInt(), 2), 0);
|
||||
m_xdimdpVars.filetype_maxicode = std::max(std::min(settings.value(QSL("studio/xdimdpvars/filetype_maxicode"),
|
||||
0).toInt(), 2), 0);
|
||||
}
|
||||
|
||||
QString MainWindow::get_zint_version(void)
|
||||
@ -1424,7 +1427,7 @@ void MainWindow::size_msg_ui_set()
|
||||
struct Zint::QZintXdimDpVars *vars = m_scaleWindow ? &m_scaleWindow->m_vars : &m_xdimdpVars;
|
||||
if (vars->x_dim == 0.0) {
|
||||
vars->x_dim_units = 0;
|
||||
vars->x_dim = m_bc.bc.getXdimDpFromScale(scale, get_dpmm(vars), getFileType(vars));
|
||||
vars->x_dim = std::min(m_bc.bc.getXdimDpFromScale(scale, get_dpmm(vars), getFileType(vars)), 10.0f);
|
||||
} else {
|
||||
// Scale trumps stored X-dimension
|
||||
double x_dim_mm = vars->x_dim_units == 1 ? vars->x_dim * 25.4 : vars->x_dim;
|
||||
|
@ -150,7 +150,7 @@ void ScaleWindow::size_msg_ui_set()
|
||||
|
||||
void ScaleWindow::unset_scale()
|
||||
{
|
||||
m_vars.x_dim = m_bc->bc.getXdimDpFromScale(m_originalScale, get_dpmm(), getFileType());
|
||||
m_vars.x_dim = std::min(m_bc->bc.getXdimDpFromScale(m_originalScale, get_dpmm(), getFileType()), 10.0f);
|
||||
m_vars.set = 0;
|
||||
|
||||
if (cmbXdimUnits->currentIndex() == 1) { // Inches
|
||||
@ -252,7 +252,7 @@ const char *ScaleWindow::getFileType() const
|
||||
|
||||
void ScaleWindow::set_maxima()
|
||||
{
|
||||
float maxXdim = m_bc->bc.getXdimDpFromScale(200.0f, get_dpmm(), getFileType());
|
||||
float maxXdim = std::min(m_bc->bc.getXdimDpFromScale(200.0f, get_dpmm(), getFileType()), 10.0f);
|
||||
if (cmbXdimUnits->currentIndex() == 1) { // Inches
|
||||
spnXdim->setMaximum(maxXdim / 25.4);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user