Commit e91fd94b authored by Stefan Gerlach's avatar Stefan Gerlach

[locale] fix generate equidistant values

parent 4dafee79
......@@ -193,7 +193,7 @@ AbstractColumn::ColumnMode ColumnPrivate::columnMode() const {
* initial value) is not supported.
*/
void ColumnPrivate::setColumnMode(AbstractColumn::ColumnMode mode) {
DEBUG("ColumnPrivate::setColumnMode() " << ENUM_TO_STRING(AbstractColumn, ColumnMode, m_column_mode)
DEBUG(Q_FUNC_INFO << ", " << ENUM_TO_STRING(AbstractColumn, ColumnMode, m_column_mode)
<< " -> " << ENUM_TO_STRING(AbstractColumn, ColumnMode, mode))
if (mode == m_column_mode) return;
......@@ -525,7 +525,6 @@ void ColumnPrivate::setColumnMode(AbstractColumn::ColumnMode mode) {
if (filter_is_temporary) delete filter;
emit m_owner->modeChanged(m_owner);
DEBUG("ColumnPrivate::setColumnMode() DONE");
}
/**
......@@ -535,7 +534,6 @@ void ColumnPrivate::setColumnMode(AbstractColumn::ColumnMode mode) {
*/
void ColumnPrivate::replaceModeData(AbstractColumn::ColumnMode mode, void* data,
AbstractSimpleFilter* in_filter, AbstractSimpleFilter* out_filter) {
DEBUG("ColumnPrivate::replaceModeData()");
emit m_owner->modeAboutToChange(m_owner);
// disconnect formatChanged()
switch (m_column_mode) {
......@@ -602,7 +600,6 @@ void ColumnPrivate::replaceModeData(AbstractColumn::ColumnMode mode, void* data,
* \brief Replace data pointer
*/
void ColumnPrivate::replaceData(void* data) {
DEBUG("ColumnPrivate::replaceData()")
emit m_owner->dataAboutToChange(m_owner);
m_data = data;
invalidate();
......@@ -618,11 +615,10 @@ void ColumnPrivate::replaceData(void* data) {
* Use a filter to convert a column to another type.
*/
bool ColumnPrivate::copy(const AbstractColumn* other) {
// DEBUG("ColumnPrivate::copy(other)");
if (other->columnMode() != columnMode()) return false;
// DEBUG(" mode = " << ENUM_TO_STRING(AbstractColumn, ColumnMode, columnMode()));
// DEBUG(Q_FUNC_INFO << ", mode = " << ENUM_TO_STRING(AbstractColumn, ColumnMode, columnMode()));
int num_rows = other->rowCount();
// DEBUG(" rows " << num_rows);
// DEBUG(Q_FUNC_INFO << ", rows " << num_rows);
emit m_owner->dataAboutToChange(m_owner);
resizeTo(num_rows);
......@@ -680,7 +676,6 @@ bool ColumnPrivate::copy(const AbstractColumn* other) {
* \param num_rows the number of rows to copy
*/
bool ColumnPrivate::copy(const AbstractColumn* source, int source_start, int dest_start, int num_rows) {
// DEBUG("ColumnPrivate::copy()");
if (source->columnMode() != m_column_mode) return false;
if (num_rows == 0) return true;
......
......@@ -57,8 +57,6 @@ AbstractColumn::ColumnMode AbstractFileFilter::columnMode(const QString& valueSt
if (isNan(valueString))
return AbstractColumn::ColumnMode::Numeric;
// const std::string stdValueString = valueString.toStdString();
// check if integer first
bool ok;
int intValue = locale.toInt(valueString, &ok);
......
......@@ -131,23 +131,19 @@ void EquidistantValuesDialog::typeChanged(int index) {
}
void EquidistantValuesDialog::checkValues() {
if (ui.leFrom->text().simplified().isEmpty()) {
if (ui.leFrom->text().simplified().isEmpty() || ui.leTo->text().simplified().isEmpty()) {
m_okButton->setEnabled(false);
return;
}
if (ui.leTo->text().simplified().isEmpty()) {
m_okButton->setEnabled(false);
return;
}
if (ui.cbType->currentIndex() == 0) {
if (ui.leNumber->text().simplified().isEmpty() || ui.leNumber->text().simplified().toInt() == 0) {
SET_NUMBER_LOCALE
if (ui.cbType->currentIndex() == 0) { // INT
if (ui.leNumber->text().simplified().isEmpty() || numberLocale.toInt(ui.leNumber->text().simplified()) == 0) {
m_okButton->setEnabled(false);
return;
}
} else {
if (ui.leIncrement->text().simplified().isEmpty() || qFuzzyIsNull(ui.leIncrement->text().simplified().toDouble())) {
} else { // DOUBLE
if (ui.leIncrement->text().simplified().isEmpty() || qFuzzyIsNull( numberLocale.toDouble(ui.leIncrement->text().simplified()) )) {
m_okButton->setEnabled(false);
return;
}
......
......@@ -116,7 +116,7 @@ RandomValuesDialog::RandomValuesDialog(Spreadsheet* s, QWidget* parent) : QDialo
//Gaussian distribution as default
this->distributionChanged(0);
resize( QSize(400,0).expandedTo(minimumSize()) );
resize( QSize(400, 0).expandedTo(minimumSize()) );
}
}
......@@ -404,7 +404,7 @@ void RandomValuesDialog::generate() {
const int index = ui.cbDistribution->currentIndex();
const nsl_sf_stats_distribution dist = (nsl_sf_stats_distribution)ui.cbDistribution->itemData(index).toInt();
DEBUG("random number distribution: " << nsl_sf_stats_distribution_name[dist]);
DEBUG(Q_FUNC_INFO << ", random number distribution: " << nsl_sf_stats_distribution_name[dist]);
const int rows = m_spreadsheet->rowCount();
QVector<double> data(rows);
......@@ -416,7 +416,7 @@ void RandomValuesDialog::generate() {
double mu{0.0}, sigma{1.0};
SET_DOUBLE_FROM_LE(mu, ui.leParameter1)
SET_DOUBLE_FROM_LE(sigma, ui.leParameter2)
DEBUG(" mu = " << mu << ", sigma = " << sigma);
DEBUG(Q_FUNC_INFO << ", mu = " << mu << ", sigma = " << sigma);
for (auto* col : m_columns) {
auto mode = col->columnMode();
if (mode == AbstractColumn::ColumnMode::Numeric) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment