Fri, 08 Jul 2022 13:24:45 +0200
Removed old experiment to calculate flameout and whirlpool ibu's. Changed Tinseth calculation to use a time window so you can select the ibu contribution during a specified time. Added ibu_method Tinset++. Added calculation extensions for Tinseth++, this calculates the flameout and whirlpool effects on all hops. During cooling is to be done.
49
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /** |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | * ProfileMashs.cpp is part of bmsapp. |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * bmsapp is free software: you can redistribute it and/or modify |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * it under the terms of the GNU General Public License as published by |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * the Free Software Foundation, either version 3 of the License, or |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * (at your option) any later version. |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * bmsapp is distributed in the hope that it will be useful, |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * GNU General Public License for more details. |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * You should have received a copy of the GNU General Public License |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | */ |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | #include "ProfileMashs.h" |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | #include "EditProfileMash.h" |
75
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
19 | #include "MainWindow.h" |
49
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | #include "config.h" |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | |
75
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
23 | ProfileMashs::ProfileMashs(QWidget *parent) : QDialog(parent) |
49
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | { |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | qDebug() << "ProfileMashs start"; |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | |
75
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
27 | gridLayout = new QGridLayout(this); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
28 | gridLayout->setObjectName(QString::fromUtf8("gridLayout")); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
29 | tableMashs = new QTableWidget(this); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
30 | tableMashs->setObjectName(QString::fromUtf8("tableMashs")); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
31 | tableMashs->setEnabled(true); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
32 | QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
33 | sizePolicy.setHorizontalStretch(0); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
34 | sizePolicy.setVerticalStretch(0); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
35 | tableMashs->setSizePolicy(sizePolicy); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
36 | tableMashs->setMinimumSize(QSize(1104, 0)); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
37 | gridLayout->addWidget(tableMashs, 0, 0, 1, 1); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
38 | |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
39 | groupBox = new QGroupBox(this); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
40 | groupBox->setObjectName(QString::fromUtf8("groupBox")); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
41 | groupBox->setEnabled(true); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
42 | groupBox->setFlat(false); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
43 | horizontalLayout = new QHBoxLayout(groupBox); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
44 | horizontalLayout->setSpacing(6); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
45 | horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
46 | horizontalLayout->setContentsMargins(0, 0, 0, 0); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
47 | |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
48 | quitButton = new QPushButton(groupBox); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
49 | quitButton->setObjectName(QString::fromUtf8("quitButton")); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
50 | quitButton->setMinimumSize(QSize(80, 24)); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
51 | quitButton->setText(tr("Quit")); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
52 | QIcon icon; |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
53 | icon.addFile(QString::fromUtf8(":icons/silk/door_out.png"), QSize(), QIcon::Normal, QIcon::Off); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
54 | quitButton->setIcon(icon); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
55 | horizontalLayout->addWidget(quitButton, 0, Qt::AlignLeft); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
56 | |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
57 | insertButton = new QPushButton(groupBox); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
58 | insertButton->setObjectName(QString::fromUtf8("insertButton")); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
59 | insertButton->setMinimumSize(QSize(80, 24)); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
60 | insertButton->setText(tr("New")); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
61 | QIcon icon3; |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
62 | icon3.addFile(QString::fromUtf8(":icons/silk/table_row_insert.png"), QSize(), QIcon::Normal, QIcon::Off); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
63 | insertButton->setIcon(icon3); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
64 | horizontalLayout->addWidget(insertButton, 0, Qt::AlignRight); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
65 | gridLayout->addWidget(groupBox, 1, 0, 1, 1); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
66 | |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
67 | connect(quitButton, SIGNAL(clicked()), parent, SLOT(fromProfileMashs())); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
68 | connect(insertButton, SIGNAL(clicked()), this, SLOT(on_insertButton_clicked())); |
79
e726db72da3c
All inventory and profiles now show the items sizes in the statusbar.
Michiel Broek <mbroek@mbse.eu>
parents:
75
diff
changeset
|
69 | connect(this, SIGNAL(setStatus(QString)), parent, SLOT(statusMsg(QString))); |
49
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
70 | emit refreshTable(); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
71 | } |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
72 | |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
73 | |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
74 | void ProfileMashs::refreshTable() |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
75 | { |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
76 | QString w; |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
77 | QWidget* pWidget; |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
78 | QHBoxLayout* pLayout; |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
79 | |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
80 | qDebug() << "ProfileMashs reload"; |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
81 | |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
82 | QSqlQuery query("SELECT * FROM profile_mash ORDER BY name"); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
83 | const QStringList labels({tr("Name"), tr("Notes"), tr("Steps"), tr("Edit")}); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
84 | |
75
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
85 | this->tableMashs->setColumnCount(4); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
86 | this->tableMashs->setColumnWidth(0, 250); /* Name */ |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
87 | this->tableMashs->setColumnWidth(1, 675); /* Notes */ |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
88 | this->tableMashs->setColumnWidth(2, 75); /* Steps */ |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
89 | this->tableMashs->setColumnWidth(3, 80); /* Edit button */ |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
90 | this->tableMashs->setRowCount(query.size()); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
91 | this->tableMashs->setHorizontalHeaderLabels(labels); |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
92 | this->tableMashs->verticalHeader()->hide(); |
49
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
93 | |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
94 | QTableWidgetItem *rightitem = new QTableWidgetItem(); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
95 | rightitem->setTextAlignment(Qt::AlignRight); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
96 | |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
97 | query.first(); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
98 | for (int ridx = 0 ; ridx < query.size() ; ridx++ ) { |
75
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
99 | this->tableMashs->setItem(ridx, 0, new QTableWidgetItem(query.value(1).toString())); /* Name */ |
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
100 | this->tableMashs->setItem(ridx, 1, new QTableWidgetItem(query.value(2).toString())); /* Notes */ |
49
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
101 | |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
102 | QJsonParseError parseError; |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
103 | const auto& json = query.value(3).toString(); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
104 | |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
105 | if (!json.trimmed().isEmpty()) { |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
106 | const auto& formattedJson = QString("%1").arg(json); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
107 | const auto& doc = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
108 | |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
109 | if (parseError.error != QJsonParseError::NoError) |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
110 | qDebug() << "Parse error: " << parseError.errorString() << "at" << parseError.offset ; |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
111 | |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
112 | w = QString("%1").arg(doc.array().size()); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
113 | QTableWidgetItem *item = new QTableWidgetItem(w); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
114 | item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
75
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
115 | this->tableMashs->setItem(ridx, 2, item); |
49
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
116 | } |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
117 | |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
118 | /* Add the Edit button */ |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
119 | pWidget = new QWidget(); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
120 | QPushButton* btn_edit = new QPushButton(); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
121 | btn_edit->setObjectName(QString("%1").arg(query.value(0).toString())); /* Send record with the button */ |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
122 | btn_edit->setText(tr("Edit")); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
123 | connect(btn_edit, SIGNAL(clicked()), this, SLOT(on_editButton_clicked())); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
124 | pLayout = new QHBoxLayout(pWidget); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
125 | pLayout->addWidget(btn_edit); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
126 | pLayout->setContentsMargins(5, 0, 5, 0); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
127 | pWidget->setLayout(pLayout); |
75
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
128 | this->tableMashs->setCellWidget(ridx, 3, pWidget); |
49
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
129 | query.next(); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
130 | } |
79
e726db72da3c
All inventory and profiles now show the items sizes in the statusbar.
Michiel Broek <mbroek@mbse.eu>
parents:
75
diff
changeset
|
131 | emit setStatus(QString(tr("Total items: %1")).arg(query.size())); |
49
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
132 | } |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
133 | |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
134 | |
75
5f953abbd73c
Profile Mashs now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
49
diff
changeset
|
135 | ProfileMashs::~ProfileMashs() {} |
49
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
136 | |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
137 | |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
138 | void ProfileMashs::edit(int recno) |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
139 | { |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
140 | EditProfileMash dialog(recno, this); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
141 | /* Signal from editor if a refresh is needed */ |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
142 | connect(&dialog, SIGNAL(entry_changed()), this, SLOT(refreshTable())); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
143 | dialog.setModal(true); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
144 | dialog.exec(); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
145 | } |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
146 | |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
147 | |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
148 | void ProfileMashs::on_editButton_clicked() |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
149 | { |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
150 | QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
151 | int recno = pb->objectName().toInt(); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
152 | edit(recno); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
153 | } |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
154 | |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
155 | |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
156 | void ProfileMashs::on_insertButton_clicked() |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
157 | { |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
158 | edit(-1); |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
159 | } |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
160 | |
29cf6e350063
Added Mash profiles table and the first part of the Mash profile editor. Edit and write must be written.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
161 |