Debian Codegraph @

src/alcoholtool.cpp

raw symbols SCIP
1 /***************************************************************************
2 alcoholtool.cpp
3 -------------------
4 An Alcohol Percentage Calculator utility for QBrew
5 -------------------
6 Copyright 2004-2008, David Johnson <[email protected]>
7 Based on code Copyright 2004, Michal Palczewski <[email protected]>
8 Please see the header file for copyright and license information
9 ***************************************************************************/
10
11 #include <QLabel>
12
13 #include "recipe.h"
14 #include "resource.h"
15 #include "alcoholtool.h"
16
17 //////////////////////////////////////////////////////////////////////////////
18 // AbvcalcTool()
19 // ----------------
20 // Constructor
21
22 AlcoholTool::AlcoholTool(QWidget* parent)
23 : QDialog(parent)
24 {
25 setWindowTitle(Resource::TITLE + tr(" - Alcohol Tool"));
26
27 ui.setupUi(this);
28
29 // connections
30 connect(ui.og, SIGNAL(valueChanged(double)), this, SLOT(recalc()));
31 connect(ui.fg, SIGNAL(valueChanged(double)), this, SLOT(recalc()));
32
33 recalc();
34 }
35
36 //////////////////////////////////////////////////////////////////////////////
37 // recalc()
38 // --------
39 // the signal to calculate the Alcohol percentage
40
41 void AlcoholTool::recalc()
42 {
43 ui.abw->setText(QString::number(Recipe::ABW(ui.og->value(),
44 ui.fg->value()) * 100.0,
45 'f', 1) + "%");
46 ui.abv->setText(QString::number(Recipe::ABV(ui.og->value(),
47 ui.fg->value()) * 100.0,
48 'f', 1) + "%");
49 }