Example #1
0
void FontDescription::setTraits(FontTraits traits)
{
    setStyle(traits.style());
    setVariant(traits.variant());
    setWeight(traits.weight());
    setStretch(traits.stretch());
}
Example #2
0
QSplitterLayoutStruct *QSplitterPrivate::insertWidget(int index, QWidget *w)
{
    Q_Q(QSplitter);
    QSplitterLayoutStruct *sls = 0;
    int i;
    int last = list.count();
    for (i = 0; i < list.size(); ++i) {
        QSplitterLayoutStruct *s = list.at(i);
        if (s->widget == w) {
            sls = s;
            --last;
            break;
        }
    }
    if (index < 0 || index > last)
        index = last;

    if (sls) {
        list.move(i,index);
    } else {
        QSplitterHandle *newHandle = 0;
        sls = new QSplitterLayoutStruct;
        QString tmp = QLatin1String("qt_splithandle_");
        tmp += w->objectName();
        newHandle = q->createHandle();
        newHandle->setObjectName(tmp);
        sls->handle = newHandle;
        sls->widget = w;
        w->lower();
        list.insert(index,sls);

        if (newHandle && q->isVisible())
            newHandle->show(); // will trigger sending of post events

#ifdef QT3_SUPPORT
        if (compatMode) {
            int sf = getStretch(sls->widget);
            if (sf == 243)
                setStretch(sls->widget, 0);
            else if (sf == 0)
                setStretch(sls->widget, 1);
        }
#endif
    }
    return sls;
}
Example #3
0
void QSplitter::setResizeMode(QWidget *w, ResizeMode mode)
{
    /*
        Internal comment:

        This function tries to simulate the Qt 3.x ResizeMode
        behavior using QSizePolicy stretch factors. This isn't easy,
        because the default \l ResizeMode was \l Stretch, not \l
        KeepSize, whereas the default stetch factor is 0.

        So what we do is this: When the user calls setResizeMode()
        the first time, we iterate through all the child widgets and
        set their stretch factors to 1. Later on, if children are
        added (using addWidget()), their stretch factors are also set
        to 1.

        There is just one problem left: Often, setResizeMode() is
        called \e{before} addWidget(), because addWidget() is called
        from the event loop. In that case, we use a special value,
        243, instead of 0 to prevent 0 from being overwritten with 1
        in addWidget(). This is a wicked hack, but fortunately it
        only occurs as a result of calling a \c QT3_SUPPORT function.
    */

    Q_D(QSplitter);
    bool metWidget = false;
    if (!d->compatMode) {
        d->compatMode = true;
        for (int i = 0; i < d->list.size(); ++i) {
            QSplitterLayoutStruct *s = d->list.at(i);
            if (s->widget == w)
                metWidget = true;
            if (getStretch(s->widget) == 0)
                setStretch(s->widget, 1);
        }
    }
    int sf;
    if (mode == KeepSize)
        sf = metWidget ? 0 : 243;
    else
        sf = 1;
    setStretch(w, sf);
}
Example #4
0
ExceptionOr<Ref<FontFace>> FontFace::create(JSC::ExecState& state, Document& document, const String& family, JSC::JSValue source, const Descriptors& descriptors)
{
    auto result = adoptRef(*new FontFace(document.fontSelector()));

    bool dataRequiresAsynchronousLoading = true;

    auto setFamilyResult = result->setFamily(family);
    if (setFamilyResult.hasException())
        return setFamilyResult.releaseException();

    if (source.isString()) {
        auto value = FontFace::parseString(source.getString(&state), CSSPropertySrc);
        if (!is<CSSValueList>(value.get()))
            return Exception { SYNTAX_ERR };
        CSSFontFace::appendSources(result->backing(), downcast<CSSValueList>(*value), &document, false);
    } else if (auto arrayBufferView = toUnsharedArrayBufferView(source))
        dataRequiresAsynchronousLoading = populateFontFaceWithArrayBuffer(result->backing(), arrayBufferView.releaseNonNull());
    else if (auto arrayBuffer = toUnsharedArrayBuffer(source)) {
        auto arrayBufferView = JSC::Uint8Array::create(arrayBuffer, 0, arrayBuffer->byteLength());
        dataRequiresAsynchronousLoading = populateFontFaceWithArrayBuffer(result->backing(), arrayBufferView.releaseNonNull());
    }

    // These ternaries match the default strings inside the FontFaceDescriptors dictionary inside FontFace.idl.
    auto setStyleResult = result->setStyle(descriptors.style.isEmpty() ? ASCIILiteral("normal") : descriptors.style);
    if (setStyleResult.hasException())
        return setStyleResult.releaseException();
    auto setWeightResult = result->setWeight(descriptors.weight.isEmpty() ? ASCIILiteral("normal") : descriptors.weight);
    if (setWeightResult.hasException())
        return setWeightResult.releaseException();
    auto setStretchResult = result->setStretch(descriptors.stretch.isEmpty() ? ASCIILiteral("normal") : descriptors.stretch);
    if (setStretchResult.hasException())
        return setStretchResult.releaseException();
    auto setUnicodeRangeResult = result->setUnicodeRange(descriptors.unicodeRange.isEmpty() ? ASCIILiteral("U+0-10FFFF") : descriptors.unicodeRange);
    if (setUnicodeRangeResult.hasException())
        return setUnicodeRangeResult.releaseException();
    auto setVariantResult = result->setVariant(descriptors.variant.isEmpty() ? ASCIILiteral("normal") : descriptors.variant);
    if (setVariantResult.hasException())
        return setVariantResult.releaseException();
    auto setFeatureSettingsResult = result->setFeatureSettings(descriptors.featureSettings.isEmpty() ? ASCIILiteral("normal") : descriptors.featureSettings);
    if (setFeatureSettingsResult.hasException())
        return setFeatureSettingsResult.releaseException();

    if (!dataRequiresAsynchronousLoading) {
        result->backing().load();
        ASSERT(result->backing().status() == CSSFontFace::Status::Success);
    }

    return WTFMove(result);
}
Example #5
0
bool TimeSig::setProperty(P_ID propertyId, const QVariant& v)
      {
      switch (propertyId) {
            case P_ID::SHOW_COURTESY:
                  if (generated())
                        return false;
                  setShowCourtesySig(v.toBool());
                  break;
            case P_ID::NUMERATOR_STRING:
                  setNumeratorString(v.toString());
                  break;
            case P_ID::DENOMINATOR_STRING:
                  setDenominatorString(v.toString());
                  break;
            case P_ID::GROUPS:
                  setGroups(v.value<Groups>());
                  break;
            case P_ID::TIMESIG:
                  setSig(v.value<Fraction>());
                  break;
            case P_ID::TIMESIG_GLOBAL:
                  setGlobalSig(v.value<Fraction>());
                  break;
            case P_ID::TIMESIG_STRETCH:
                  setStretch(v.value<Fraction>());
                  break;
            case P_ID::TIMESIG_TYPE:
                  _timeSigType = (TimeSigType)(v.toInt());
                  break;
            case P_ID::SCALE:
                  _scale = v.toSizeF();
                  break;
            default:
                  if (!Element::setProperty(propertyId, v))
                        return false;
                  break;
            }
      score()->setLayoutAll();      // TODO
      setGenerated(false);
      return true;
      }
Example #6
0
void StifKarp :: setFrequency( StkFloat frequency )
{
#if defined(_STK_DEBUG_)
  if ( frequency <= 0.0 ) {
    oStream_ << "StifKarp::setFrequency: parameter is less than or equal to zero!";
    handleError( StkError::WARNING ); return;
  }
#endif

  lastFrequency_ = frequency; 
  lastLength_ = Stk::sampleRate() / lastFrequency_;
  StkFloat delay = lastLength_ - 0.5;
  delayLine_.setDelay( delay );

  loopGain_ = baseLoopGain_ + (frequency * 0.000005);
  if (loopGain_ >= 1.0) loopGain_ = 0.99999;

  setStretch(stretching_);

  combDelay_.setDelay( 0.5 * pickupPosition_ * lastLength_ ); 
}
Example #7
0
void StifKarp :: setFrequency(StkFloat frequency)
{
  lastFrequency_ = frequency; 
  if ( frequency <= 0.0 ) {
    errorString_ << "StifKarp::setFrequency: parameter is less than or equal to zero!";
    handleError( StkError::WARNING );
    lastFrequency_ = 220.0;
  }

  lastLength_ = Stk::sampleRate() / lastFrequency_;
  StkFloat delay = lastLength_ - 0.5;
  if (delay <= 0.0)
    delay = 0.3;
  else if (delay > length_)
    delay = length_;
  delayLine_.setDelay( delay );

  loopGain_ = baseLoopGain_ + (frequency * 0.000005);
  if (loopGain_ >= 1.0) loopGain_ = 0.99999;

  setStretch(stretching_);

  combDelay_.setDelay( 0.5 * pickupPosition_ * lastLength_ ); 
}
KitOptionsPageWidget::KitOptionsPageWidget()
    : m_model(0), m_selectionModel(0), m_currentWidget(0)
{
    m_kitsView = new QTreeView(this);
    m_kitsView->setUniformRowHeights(true);
    m_kitsView->header()->setStretchLastSection(true);
    m_kitsView->setSizePolicy(m_kitsView->sizePolicy().horizontalPolicy(),
                              QSizePolicy::Ignored);

    m_addButton = new QPushButton(KitOptionsPage::tr("Add"), this);
    m_cloneButton = new QPushButton(KitOptionsPage::tr("Clone"), this);
    m_delButton = new QPushButton(KitOptionsPage::tr("Remove"), this);
    m_makeDefaultButton = new QPushButton(KitOptionsPage::tr("Make Default"), this);

    auto buttonLayout = new QVBoxLayout;
    buttonLayout->setSpacing(6);
    buttonLayout->setContentsMargins(0, 0, 0, 0);
    buttonLayout->addWidget(m_addButton);
    buttonLayout->addWidget(m_cloneButton);
    buttonLayout->addWidget(m_delButton);
    buttonLayout->addWidget(m_makeDefaultButton);
    buttonLayout->addStretch();

    auto horizontalLayout = new QHBoxLayout;
    horizontalLayout->addWidget(m_kitsView);
    horizontalLayout->addLayout(buttonLayout);

    auto verticalLayout = new QVBoxLayout(this);
    verticalLayout->setSizeConstraint(QLayout::SetMinimumSize);
    verticalLayout->addLayout(horizontalLayout);

    m_model = new Internal::KitModel(verticalLayout, this);
    connect(m_model, &Internal::KitModel::kitStateChanged,
            this, &KitOptionsPageWidget::updateState);
    verticalLayout->setStretch(0, 1);
    verticalLayout->setStretch(1, 0);

    m_kitsView->setModel(m_model);
    m_kitsView->header()->setSectionResizeMode(0, QHeaderView::Stretch);
    m_kitsView->expandAll();

    m_selectionModel = m_kitsView->selectionModel();
    connect(m_selectionModel, &QItemSelectionModel::selectionChanged,
            this, &KitOptionsPageWidget::kitSelectionChanged);
    connect(KitManager::instance(), &KitManager::kitAdded,
            this, &KitOptionsPageWidget::kitSelectionChanged);
    connect(KitManager::instance(), &KitManager::kitRemoved,
            this, &KitOptionsPageWidget::kitSelectionChanged);
    connect(KitManager::instance(), &KitManager::kitUpdated,
            this, &KitOptionsPageWidget::kitSelectionChanged);

    // Set up add menu:
    connect(m_addButton, &QAbstractButton::clicked,
            this, &KitOptionsPageWidget::addNewKit);
    connect(m_cloneButton, &QAbstractButton::clicked,
            this, &KitOptionsPageWidget::cloneKit);
    connect(m_delButton, &QAbstractButton::clicked,
            this, &KitOptionsPageWidget::removeKit);
    connect(m_makeDefaultButton, &QAbstractButton::clicked,
            this, &KitOptionsPageWidget::makeDefaultKit);

    updateState();
}
/// Constructor
/// @param parent :: Parent widget.
/// @param index :: Index of the spectrum which parameter is edited.
/// @param fixed :: Is the parameter fixed initially?
/// @param tie :: Parameter's current tie (or empty string).
LocalParameterEditor::LocalParameterEditor(QWidget *parent, int index, bool fixed, QString tie):
  QWidget(parent), m_index(index),m_fixed(fixed), m_tie(tie)
{
  auto layout = new QHBoxLayout(this);
  layout->setMargin(0);
  layout->setSpacing(0);
  layout->setContentsMargins(0,0,0,0);

  m_editor = new QLineEdit(parent);
  m_editor->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
  auto validator = new QDoubleValidator(this);
  validator->setDecimals(16);
  m_editor->setValidator(validator);
  m_editor->setToolTip("Edit local parameter value. Press F to fix/unfix it.");

  auto button = new QPushButton("&Set");
  button->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Expanding);

  this->setFocusPolicy(Qt::NoFocus);
  layout->addWidget(m_editor);
  layout->addWidget(button);
  layout->setStretch(0,1);
  layout->setStretch(1,0);
  this->setFocusProxy(m_editor);
  this->setFocusPolicy(Qt::StrongFocus);

  auto setMenu = new QMenu(this);

  QAction *action = new QAction("Set to all",this);
  action->setToolTip("Set all parameters to this value");
  connect(action,SIGNAL(activated()),this,SLOT(setAll()));
  setMenu->addAction(action);

  setMenu->addSeparator();
  m_fixAction = new QAction(m_fixed? "Unfix" : "Fix", this);
  m_fixAction->setToolTip("Fix value of this parameter");
  connect(m_fixAction,SIGNAL(activated()),this,SLOT(fixParameter()));
  setMenu->addAction(m_fixAction);

  action = new QAction("Fix all",this);
  action->setToolTip("Fix all parameters.");
  connect(action,SIGNAL(activated()),this,SLOT(fixAll()));
  setMenu->addAction(action);

  action = new QAction("Unfix all",this);
  action->setToolTip("Unfix all parameters.");
  connect(action,SIGNAL(activated()),this,SLOT(unfixAll()));
  setMenu->addAction(action);

  setMenu->addSeparator();
  action = new QAction("Set tie",this);
  action->setToolTip("Set a tie for this parameter.");
  connect(action,SIGNAL(activated()),this,SLOT(setTie()));
  setMenu->addAction(action);

  action = new QAction("Remove tie",this);
  action->setToolTip("Remove the tie for this parameter.");
  connect(action,SIGNAL(activated()),this,SLOT(removeTie()));
  setMenu->addAction(action);

  action = new QAction("Set tie to all",this);
  action->setToolTip("Set this tie for all parameters.");
  connect(action,SIGNAL(activated()),this,SLOT(setTieAll()));
  setMenu->addAction(action);

  action = new QAction("Remove all ties",this);
  action->setToolTip("Remove ties for all parameters.");
  connect(action,SIGNAL(activated()),this,SLOT(removeAllTies()));
  setMenu->addAction(action);

  button->setMenu(setMenu);

  m_editor->installEventFilter(this);
}
TimeLagSettingsDialog::TimeLagSettingsDialog(QWidget *parent, EcProject *ecProject, ConfigState* config) :
    QDialog(parent),
    ecProject_(ecProject),
    configState_(config)
{
    setWindowModality(Qt::WindowModal);
    setWindowTitle(tr("Time Lag Optimization Settings"));
    WidgetUtils::removeContextHelpButton(this);

    auto groupTitle = new QLabel;
    groupTitle->setText(tr("Configure smart time lag detection, "
                           "providing quality selection criteria and initial "
                           "time lag windows"));

    auto hrLabel = new QLabel;
    hrLabel->setObjectName(QStringLiteral("hrLabel"));

    existingRadio = new QRadioButton(tr("Time lag file available : "));
    existingRadio->setToolTip(tr("<b>Time lag file available:</b> If you have a satisfactory time lag assessment from a previous run and it applies to the current dataset, you can use it by providing the path to the file 'eddypro_timelag_opt_ID.txt' that was generated by EddyPro in the previous run and contains the results of the assessment. This will shorten program execution time and assure full comparability between the current and previous results."));

    nonExistingRadio = new QRadioButton(tr("Time lag file not available :"));
    nonExistingRadio->setToolTip(tr("<b>Time lag file not available:</b> Choose this option and provide the following information if you need to optimize time lags for your dataset. EddyPro will complete the time lag optimization first and then complete the raw data processing and flux computation procedures."));

    subsetCheckBox = new QCheckBox;
    subsetCheckBox->setProperty("subperiod", true);
    subsetCheckBox->setText(tr("Select a different period"));
    subsetCheckBox->setToolTip(tr("<b>Select a different period:</b> Select this option and set the corresponding dates, to identify the time period EddyPro will use for the Time lag optimization. This subperiod must fall within the time period defined by the available raw data."));

    startDateLabel = new ClickLabel(this);
    startDateLabel->setText(tr("Start :"));
    startDateLabel->setToolTip(tr("<b>Start:</b> Starting date of the time period to be used for time lag optimization. This time should not be shorter than about 1-2 months. As a general recommendation, select a time period during which the instrument setup did not undergo major modifications. Results obtained using a given time period (e.g., 2 months) can be used for processing a longer time period, in which major modifications did not occur in the setup. The stricter the threshold setup in this dialogue, the longer the period should be in order to get robust results."));
    startDateEdit = new QDateEdit;
    startDateEdit->setToolTip(startDateLabel->toolTip());
    startDateEdit->setCalendarPopup(true);
    WidgetUtils::customizeCalendar(startDateEdit->calendarWidget());

    startTimeEdit = new QTimeEdit;
    startTimeEdit->setDisplayFormat(QStringLiteral("hh:mm"));
    startTimeEdit->setAccelerated(true);

    lockedIcon = new QLabel;
    auto pixmap = QPixmap(QStringLiteral(":/icons/vlink-locked"));
#if defined(Q_OS_MAC)
    pixmap.setDevicePixelRatio(2.0);
#endif
    lockedIcon->setPixmap(pixmap);

    endDateLabel = new ClickLabel(this);
    endDateLabel->setText(tr("End :"));
    endDateLabel->setToolTip(tr("<b>End:</b> End date of the time period to be used for time lag optimization. This time should not be shorter than about 1-2 months As a general recommendation, select a time period during which the instrumental setup did not undergo major modifications. Results obtained using a given time period (e.g., 2 months) can be used for processing a longer time period, in which major modifications did not occur in the setup. The stricter the threshold setup in this dialogue, the longer the period should be in order to get robust results."));
    endDateEdit = new QDateEdit;
    endDateEdit->setToolTip(endDateLabel->toolTip());
    endDateEdit->setCalendarPopup(true);
    WidgetUtils::customizeCalendar(endDateEdit->calendarWidget());

    endTimeEdit = new QTimeEdit;
    endTimeEdit->setDisplayFormat(QStringLiteral("hh:mm"));
    endTimeEdit->setAccelerated(true);

    auto dateTimeContainer = new QGridLayout;
    dateTimeContainer->addWidget(startDateEdit, 0, 1);
    dateTimeContainer->addWidget(startTimeEdit, 0, 2);
    dateTimeContainer->addWidget(lockedIcon, 0, 0, 2, 1);
    dateTimeContainer->addWidget(endDateEdit, 1, 1);
    dateTimeContainer->addWidget(endTimeEdit, 1, 2);
    dateTimeContainer->setColumnStretch(1, 1);
    dateTimeContainer->setColumnStretch(2, 1);
    dateTimeContainer->setColumnStretch(3, 2);
    dateTimeContainer->setContentsMargins(0, 0, 0, 0);
    dateTimeContainer->setVerticalSpacing(3);

    fileBrowse = new FileBrowseWidget;
    fileBrowse->setToolTip(tr("<b>Load:</b> Load an existing time lag file"));
    fileBrowse->setDialogTitle(tr("Select the Time Lag Optimization File"));
    fileBrowse->setDialogWorkingDir(WidgetUtils::getSearchPathHint());
    fileBrowse->setDialogFilter(tr("All Files (*.*)"));

    auto existingFileLayout = new QHBoxLayout;
    existingFileLayout->addWidget(existingRadio);
    existingFileLayout->addWidget(fileBrowse);
    existingFileLayout->setStretch(2, 1);
    existingFileLayout->setContentsMargins(0, 0, 0, 0);
    existingFileLayout->setSpacing(0);

    radioGroup = new QButtonGroup(this);
    radioGroup->addButton(existingRadio, 0);
    radioGroup->addButton(nonExistingRadio, 1);

    h2oTitleLabel = WidgetUtils::createBlueLabel(this, tr("Water vapor time lag as a function of relative humidity"));

    pgRangeLabel = new ClickLabel(tr("Plausibility range around median value :"));
    pgRangeLabel->setToolTip(tr("<b>Plausibility range around median value:</b> The plausibility range is defined as the median time lag, %1 <i>n</i> times the MAD (median of the absolute deviations from the median time lag). Specify <i>n</i> here. The value of 1.5 was heuristically found to be optimal.").arg(Defs::PLUSMINUS));
    pgRangeSpin = new QDoubleSpinBox;
    pgRangeSpin->setDecimals(1);
    pgRangeSpin->setRange(0.1, 100.0);
    pgRangeSpin->setSingleStep(0.1);
    pgRangeSpin->setAccelerated(true);
    pgRangeSpin->setSuffix(tr("  [mad]"));
    pgRangeSpin->setToolTip(pgRangeLabel->toolTip());
    pgRangeLabel_2 = new QLabel(tr("(<tt>%1%2n%3mad</tt>, where you set <tt>n</tt>)").arg(Defs::MICRO, Defs::PLUSMINUS, Defs::MID_DOT));

    rhClassLabel = new ClickLabel(tr("Number of RH classes :"));
    rhClassLabel->setToolTip(tr("<b>Number of RH classes:</b> Select the number or relative humidity classes, to assess water vapor time lag as a function of RH. The whole range or RH variation (0-100%) will be evenly divided according to the selected number of classes. For example, selecting 10 classes causes EddyPro to assess water vapor time lags for the classes 0-10%, 10-20%,..., 90-100%. Selecting 1 class, the label <b><i>Do not sort in RH classes</i></b> appears and will cause EddyPro to treat water vapor exactly like other passive gases. This option is only suitable for open path systems, or closed path systems with short and heated sampling lines."));

    rhClassSpin = new QSpinBox;
    rhClassSpin->setRange(1, 20);
    rhClassSpin->setSingleStep(1);
    rhClassSpin->setAccelerated(true);
    rhClassSpin->setSpecialValueText(tr("Do not sort in RH classes"));
    rhClassSpin->setToolTip(rhClassLabel->toolTip());

    gasTitleLabel = WidgetUtils::createBlueLabel(this, tr("Passive gases"));

    co2MinFluxLabel = new ClickLabel(tr("Minimum (absolute) %1 flux :").arg(Defs::CO2_STRING));
    co2MinFluxLabel->setToolTip(tr("<b>Minimum (absolute) %1 flux:</b> %1 time lags corresponding to fluxes smaller (in module) than this value will not be considered in the time lag optimization. Selecting high-enough fluxes assures that well developed turbulent conditions are met and the correlation function is well characterized.").arg(Defs::CO2_STRING));
    co2MinFluxSpin = new QDoubleSpinBox;
    co2MinFluxSpin->setDecimals(3);
    co2MinFluxSpin->setRange(0.0, 100.0);
    co2MinFluxSpin->setSingleStep(0.001);
    co2MinFluxSpin->setAccelerated(true);
    co2MinFluxSpin->setSuffix(tr("  [%1]").arg(Defs::UMOL_M2S_STRING));
    co2MinFluxSpin->setToolTip(co2MinFluxLabel->toolTip());

    ch4MinFluxLabel = new ClickLabel(tr("Minimum (absolute) %1 flux :").arg(Defs::CH4_STRING));
    ch4MinFluxLabel->setToolTip(tr("<b>Minimum (absolute) %1 flux:</b> %1 time lags corresponding to fluxes smaller (in module) than this value will not be considered in the time lag optimization. Selecting high-enough fluxes assures that well developed turbulent conditions are met and the correlation function is well characterized.").arg(Defs::CH4_STRING));
    ch4MinFluxSpin = new QDoubleSpinBox;
    ch4MinFluxSpin->setDecimals(3);
    ch4MinFluxSpin->setRange(0.0, 100.0);
    ch4MinFluxSpin->setSingleStep(0.001);
    ch4MinFluxSpin->setAccelerated(true);
    ch4MinFluxSpin->setSuffix(tr("  [%1]").arg(Defs::UMOL_M2S_STRING));
    ch4MinFluxSpin->setToolTip(ch4MinFluxLabel->toolTip());

    gas4MinFluxLabel = new ClickLabel(tr("Minimum (absolute) %1 gas flux :").arg(Defs::GAS4_STRING));
    gas4MinFluxLabel->setToolTip(tr("<b>Minimum (absolute) %1 gas flux:</b> %1 gas time lags corresponding to fluxes smaller (in module) than this value will not be considered in the time lag optimization. Selecting high-enough fluxes assures that well developed turbulent conditions are met and the correlation function is well characterized.").arg(Defs::GAS4_STRING));
    gas4MinFluxSpin = new QDoubleSpinBox;
    gas4MinFluxSpin->setDecimals(3);
    gas4MinFluxSpin->setRange(0.0, 100.0);
    gas4MinFluxSpin->setSingleStep(0.001);
    gas4MinFluxSpin->setAccelerated(true);
    gas4MinFluxSpin->setSuffix(tr("  [%1]").arg(Defs::UMOL_M2S_STRING));
    gas4MinFluxSpin->setToolTip(gas4MinFluxLabel->toolTip());

    leMinFluxLabel = new ClickLabel(tr("Minimum latent heat flux :"));
    leMinFluxLabel->setToolTip(tr("<b>Minimum latent heat flux:</b> Minimum latent heat flux: H<sub>2</sub>O time lags corresponding to latent heat fluxes smaller than this value will not be considered in the time lag optimization. Selecting high-enough fluxes assures that well developed turbulent conditions are met and the correlation function is well characterized."));
    leMinFluxSpin = new QDoubleSpinBox;
    leMinFluxSpin->setDecimals(1);
    leMinFluxSpin->setRange(0.0, 1000.0);
    leMinFluxSpin->setSingleStep(0.1);
    leMinFluxSpin->setAccelerated(true);
    leMinFluxSpin->setSuffix(tr("  [%1]").arg(Defs::W_M2_STRING));
    leMinFluxSpin->setToolTip(leMinFluxLabel->toolTip());

    searchWindowLabel = WidgetUtils::createBlueLabel(this, tr("Time lag searching windows"));

    minLabel = WidgetUtils::createBlueLabel(this, tr("Minimum"));
    minLabel->setToolTip(tr("<b>Minimum:</b> Minimum time lag for each gas, for initializing the time lag optimization procedure. The searching window defined by Minimum and Maximum should be large enough to accommodate all possible time lags. Leave as <i>Not set</i> if in doubt, EddyPro will initialize it automatically."));

    maxLabel = WidgetUtils::createBlueLabel(this, tr("Maximum"));
    maxLabel->setToolTip(tr("<b>Maximum:</b> Maximum time lag for each gas, for initializing the time lag optimization procedure. The searching window defined by Minimum and Maximum should be large enough to accommodate all possible time lags. In particular, maximum time lags of water vapor in closed path systems can up to ten times higher than its nominal value, or even higher. Leave as <i>Not set</i> if in doubt, EddyPro will initialize it automatically."));

    co2Label = new ClickLabel(tr("%1 :").arg(Defs::CO2_STRING));

    minCo2TlSpin = new QDoubleSpinBox;
    minCo2TlSpin->setDecimals(1);
    minCo2TlSpin->setRange(-1000.1, 1000.0);
    minCo2TlSpin->setSingleStep(0.1);
    minCo2TlSpin->setSpecialValueText(tr("Detect automatically"));
    minCo2TlSpin->setAccelerated(true);
    minCo2TlSpin->setSuffix(tr("  [s]"));
    minCo2TlSpin->setToolTip(minLabel->toolTip());

    maxCo2TlSpin = new QDoubleSpinBox;
    maxCo2TlSpin->setDecimals(1);
    maxCo2TlSpin->setRange(-1000.1, 1000.0);
    maxCo2TlSpin->setSingleStep(0.1);
    maxCo2TlSpin->setSpecialValueText(tr("Detect automatically"));
    maxCo2TlSpin->setAccelerated(true);
    maxCo2TlSpin->setSuffix(tr("  [s]"));
    maxCo2TlSpin->setToolTip(maxLabel->toolTip());

    h2oLabel = new ClickLabel(tr("%1 :").arg(Defs::H2O_STRING));

    minH2oTlSpin = new QDoubleSpinBox;
    minH2oTlSpin->setDecimals(1);
    minH2oTlSpin->setRange(-1000.1, 1000.0);
    minH2oTlSpin->setSingleStep(0.1);
    minH2oTlSpin->setSpecialValueText(tr("Detect automatically"));
    minH2oTlSpin->setAccelerated(true);
    minH2oTlSpin->setSuffix(tr("  [s]"));
    minH2oTlSpin->setToolTip(minLabel->toolTip());

    maxH2oTlSpin = new QDoubleSpinBox;
    maxH2oTlSpin->setDecimals(1);
    maxH2oTlSpin->setRange(-1000.1, 1000.0);
    maxH2oTlSpin->setSingleStep(0.1);
    maxH2oTlSpin->setSpecialValueText(tr("Detect automatically"));
    maxH2oTlSpin->setAccelerated(true);
    maxH2oTlSpin->setSuffix(tr("  [s]"));
    maxH2oTlSpin->setToolTip(maxLabel->toolTip());

    ch4Label = new ClickLabel(tr("%1 :").arg(Defs::CH4_STRING));

    minCh4TlSpin = new QDoubleSpinBox;
    minCh4TlSpin->setDecimals(1);
    minCh4TlSpin->setRange(-1000.1, 1000.0);
    minCh4TlSpin->setSingleStep(0.1);
    minCh4TlSpin->setSpecialValueText(tr("Detect automatically"));
    minCh4TlSpin->setAccelerated(true);
    minCh4TlSpin->setSuffix(tr("  [s]"));
    minCh4TlSpin->setToolTip(minLabel->toolTip());

    maxCh4TlSpin = new QDoubleSpinBox;
    maxCh4TlSpin->setDecimals(1);
    maxCh4TlSpin->setRange(-1000.1, 1000.0);
    maxCh4TlSpin->setSingleStep(0.1);
    maxCh4TlSpin->setSpecialValueText(tr("Detect automatically"));
    maxCh4TlSpin->setAccelerated(true);
    maxCh4TlSpin->setSuffix(tr("  [s]"));
    maxCh4TlSpin->setToolTip(maxLabel->toolTip());

    gas4Label = new ClickLabel(tr("%1 gas :").arg(Defs::GAS4_STRING));

    minGas4TlSpin = new QDoubleSpinBox;
    minGas4TlSpin->setDecimals(1);
    minGas4TlSpin->setRange(-1000.1, 1000.0);
    minGas4TlSpin->setSingleStep(0.1);
    minGas4TlSpin->setSpecialValueText(tr("Detect automatically"));
    minGas4TlSpin->setAccelerated(true);
    minGas4TlSpin->setSuffix(tr("  [s]"));
    minGas4TlSpin->setToolTip(minLabel->toolTip());

    maxGas4TlSpin = new QDoubleSpinBox;
    maxGas4TlSpin->setDecimals(1);
    maxGas4TlSpin->setRange(-1000.1, 1000.0);
    maxGas4TlSpin->setSingleStep(0.1);
    maxGas4TlSpin->setSpecialValueText(tr("Detect automatically"));
    maxGas4TlSpin->setAccelerated(true);
    maxGas4TlSpin->setSuffix(tr("  [s]"));
    maxGas4TlSpin->setToolTip(maxLabel->toolTip());

    auto propertiesLayout = new QGridLayout;
    propertiesLayout->addLayout(existingFileLayout, 0, 0, 1, -1);
    propertiesLayout->addWidget(nonExistingRadio, 1, 0);
    propertiesLayout->addWidget(subsetCheckBox, 1, 1, 1, 1, Qt::AlignLeft);
    propertiesLayout->addWidget(startDateLabel, 1, 1, Qt::AlignRight);
    propertiesLayout->addLayout(dateTimeContainer, 1, 2, 2, 1);
    propertiesLayout->addWidget(endDateLabel, 2, 1, Qt::AlignRight);
    propertiesLayout->addWidget(pgRangeLabel, 3, 1, 1, 1, Qt::AlignRight);
    propertiesLayout->addWidget(pgRangeSpin, 3, 2);
    propertiesLayout->addWidget(pgRangeLabel_2, 3, 3);

    propertiesLayout->addWidget(h2oTitleLabel, 4, 0, 1, 2);

    propertiesLayout->addWidget(rhClassLabel, 5, 1, Qt::AlignRight);
    propertiesLayout->addWidget(rhClassSpin, 5, 2);
    propertiesLayout->addWidget(leMinFluxLabel, 6, 1, Qt::AlignRight);
    propertiesLayout->addWidget(leMinFluxSpin, 6, 2);

    propertiesLayout->addWidget(gasTitleLabel, 7, 0);

    propertiesLayout->addWidget(co2MinFluxLabel, 8, 1, Qt::AlignRight);
    propertiesLayout->addWidget(co2MinFluxSpin, 8, 2);
    propertiesLayout->addWidget(ch4MinFluxLabel, 9, 1, Qt::AlignRight);
    propertiesLayout->addWidget(ch4MinFluxSpin, 9, 2);
    propertiesLayout->addWidget(gas4MinFluxLabel, 10, 1, Qt::AlignRight);
    propertiesLayout->addWidget(gas4MinFluxSpin, 10, 2);

    propertiesLayout->addWidget(searchWindowLabel, 11, 0);
    propertiesLayout->addWidget(minLabel, 12, 1);
    propertiesLayout->addWidget(maxLabel, 12, 2);
    propertiesLayout->addWidget(co2Label, 13, 0, Qt::AlignRight);
    propertiesLayout->addWidget(minCo2TlSpin, 13, 1);
    propertiesLayout->addWidget(maxCo2TlSpin, 13, 2);
    propertiesLayout->addWidget(h2oLabel, 14, 0, Qt::AlignRight);
    propertiesLayout->addWidget(minH2oTlSpin, 14, 1);
    propertiesLayout->addWidget(maxH2oTlSpin, 14, 2);
    propertiesLayout->addWidget(ch4Label, 15, 0, Qt::AlignRight);
    propertiesLayout->addWidget(minCh4TlSpin, 15, 1);
    propertiesLayout->addWidget(maxCh4TlSpin, 15, 2);
    propertiesLayout->addWidget(gas4Label, 16, 0, Qt::AlignRight);
    propertiesLayout->addWidget(minGas4TlSpin, 16, 1);
    propertiesLayout->addWidget(maxGas4TlSpin, 16, 2);
    propertiesLayout->setVerticalSpacing(3);
    propertiesLayout->setRowMinimumHeight(2, 10);
    propertiesLayout->setContentsMargins(3, 3, 3, 3);

    auto propertiesFrame = new QWidget;
    propertiesFrame->setLayout(propertiesLayout);
    propertiesFrame->setMinimumWidth(propertiesFrame->sizeHint().width());

    auto okButton = WidgetUtils::createCommonButton(this, tr("Ok"));

    auto mainLayout = new QGridLayout(this);
    mainLayout->addWidget(groupTitle, 0, 0);
    mainLayout->addWidget(hrLabel, 1, 0);
    mainLayout->addWidget(propertiesFrame, 2, 0);
    mainLayout->addWidget(okButton, 3, 0, 1, 1, Qt::AlignCenter);
    mainLayout->setVerticalSpacing(10);
    mainLayout->setContentsMargins(30, 30, 30, 30);
    mainLayout->setSizeConstraint(QLayout::SetFixedSize);
    setLayout(mainLayout);

    connect(radioGroup, SIGNAL(buttonClicked(int)),
            this, SLOT(updateTlMode(int)));

    connect(radioGroup, SIGNAL(buttonClicked(int)),
            this, SLOT(radioClicked(int)));

    connect(fileBrowse, &FileBrowseWidget::pathChanged,
            this, &TimeLagSettingsDialog::updateFile);
    connect(fileBrowse, &FileBrowseWidget::pathSelected,
        this, &TimeLagSettingsDialog::testSelectedFile);

    connect(subsetCheckBox, &QCheckBox::toggled,
            this, &TimeLagSettingsDialog::updateSubsetSelection);

    connect(startDateLabel, &ClickLabel::clicked,
            this, &TimeLagSettingsDialog::onStartDateLabelClicked);
    connect(startDateEdit, &QDateEdit::dateChanged,
            this, &TimeLagSettingsDialog::updateStartDate);
    connect(startTimeEdit, &QTimeEdit::timeChanged,
            this, &TimeLagSettingsDialog::updateStartTime);

    connect(endDateLabel, &ClickLabel::clicked,
            this, &TimeLagSettingsDialog::onEndDateLabelClicked);
    connect(endDateEdit, &QDateEdit::dateChanged,
            this, &TimeLagSettingsDialog::updateEndDate);
    connect(endTimeEdit, &QTimeEdit::timeChanged,
            this, &TimeLagSettingsDialog::updateEndTime);

    connect(rhClassLabel, &ClickLabel::clicked,
            this, &TimeLagSettingsDialog::onRhClassClicked);
    connect(rhClassSpin, SIGNAL(valueChanged(int)),
            this, SLOT(updateRhClass(int)));

    connect(co2MinFluxLabel, &ClickLabel::clicked,
            this, &TimeLagSettingsDialog::onCo2MinFluxClicked);
    connect(co2MinFluxSpin, SIGNAL(valueChanged(double)),
            this, SLOT(updateCo2MinFlux(double)));

    connect(ch4MinFluxLabel, &ClickLabel::clicked,
            this, &TimeLagSettingsDialog::onCh4MinFluxClicked);
    connect(ch4MinFluxSpin, SIGNAL(valueChanged(double)),
            this, SLOT(updateCh4MinFlux(double)));

    connect(gas4MinFluxLabel, &ClickLabel::clicked,
            this, &TimeLagSettingsDialog::onGas4MinFluxClicked);
    connect(gas4MinFluxSpin, SIGNAL(valueChanged(double)),
            this, SLOT(updateGas4MinFlux(double)));

    connect(leMinFluxLabel, &ClickLabel::clicked,
            this, &TimeLagSettingsDialog::onLeMinFluxClicked);
    connect(leMinFluxSpin, SIGNAL(valueChanged(double)),
            this, SLOT(updateLeMinFlux(double)));

    connect(pgRangeLabel, &ClickLabel::clicked,
            this, &TimeLagSettingsDialog::onPgRangeLabelClicked);
    connect(pgRangeSpin, SIGNAL(valueChanged(double)),
            this, SLOT(updatePgRange(double)));

    connect(co2Label, &ClickLabel::clicked,
            this, &TimeLagSettingsDialog::onCo2LabelClicked);
    connect(minCo2TlSpin, SIGNAL(valueChanged(double)),
            this, SLOT(updateMinCo2Tl(double)));
    connect(maxCo2TlSpin, SIGNAL(valueChanged(double)),
            this, SLOT(updateMaxCo2Tl(double)));

    connect(h2oLabel, &ClickLabel::clicked,
            this, &TimeLagSettingsDialog::onH2oLabelClicked);
    connect(minH2oTlSpin, SIGNAL(valueChanged(double)),
            this, SLOT(updateMinH2oTl(double)));
    connect(maxH2oTlSpin, SIGNAL(valueChanged(double)),
            this, SLOT(updateMaxH2oTl(double)));

    connect(ch4Label, &ClickLabel::clicked,
            this, &TimeLagSettingsDialog::onCh4LabelClicked);
    connect(minCh4TlSpin, SIGNAL(valueChanged(double)),
            this, SLOT(updateMinCh4Tl(double)));
    connect(maxCh4TlSpin, SIGNAL(valueChanged(double)),
            this, SLOT(updateMaxCh4Tl(double)));

    connect(gas4Label, &ClickLabel::clicked,
            this, &TimeLagSettingsDialog::onGas4LabelClicked);
    connect(minGas4TlSpin, SIGNAL(valueChanged(double)),
            this, SLOT(updateMinGas4Tl(double)));
    connect(maxGas4TlSpin, SIGNAL(valueChanged(double)),
            this, SLOT(updateMaxGas4Tl(double)));

    connect(okButton, &QPushButton::clicked,
            this, &TimeLagSettingsDialog::close);

    // init
    forceEndDatePolicy();
    forceEndTimePolicy();
}