src/Utils.h

Wed, 06 Apr 2022 20:26:47 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 06 Apr 2022 20:26:47 +0200
changeset 110
224be4d9f8eb
parent 102
b017001850df
child 125
2e79e0975e58
permissions
-rw-r--r--

Fermentables are loaded in the main recipe record in a QList. The refresh table function does the sorting, on added moment (mash first), amount and finally color of the malt. Removed the old hidden table columns. Do all manipulation on the recipe record with QList arrays. The ferment_amount_changed() slot is complete. The whole recipe editor is going in the right direction.

#ifndef _UTILS_H
#define	_UTILS_H

#include <QString>
#include <QColor>


/**
 * @namespace Utils
 *
 * @brief Global math functions.
 */
namespace Utils {

    double lintner_to_kolbach(double lintner);
    double kolbach_to_lintner(double kolbach);
    double ebc_to_srm(double ebc);
    double srm_to_ebc(double srm);
    double get_kt(int ebc);
    double plato_to_sg(double plato);
    double sg_to_plato(double sg);
    double brix_to_sg(double brix);
    double sg_to_brix(double sg);
    double brix_to_fg(double o_plato, double refracto);
    double calc_svg(double og, double fg);
    double estimate_sg(double sugars, double batch_size);
    double estimate_fg(double psugar, double pcara, double wgratio, double mashtime, double mashtemp, double svg, double og);
    double kw_to_srm(int colormethod, double c);
    double kw_to_ebc(int colormethod, double c);
    double abvol(double og, double fg);
    QString hours_to_string(int hours);

    /**
     * @brief Map SRM color to RGB and return as QColor.
     * @param srm The srm value.
     * @return QColor
     */
    QColor srm_to_color(int srm);

    /**
     * @brief Map EBC color to RGB and return as QColor.
     * @param ebc The ebc value.
     * @return QColor
     */
    QColor ebc_to_color(int ebc);

    /**
     * @brief Map SRM color to a QString for stylesheets.
     * @param srm The srm value.
     * @return A QString with stylesheet colors.
     */
    QString srm_to_style(int ebc);

    /**
     * @brief Map EBC color to a QString for stylesheets.
     * @param ebc The ebc value.
     * @return A QString with stylesheet colors.
     */
    QString ebc_to_style(int srm);

//    double my_brix_correction = 1.04;
}

#endif

mercurial