Wed, 20 Apr 2022 22:48:20 +0200
Implemented the last widgets on the first tab and added the needed functions for them such as scaling the recipe. This is the last part of the recipe editor, now ready for testing.
56 | 1 | /** |
2 | * ProfileStyles.cpp is part of bmsapp. | |
3 | * | |
4 | * bmsapp is free software: you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation, either version 3 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * bmsapp is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | */ | |
17 | #include "ProfileStyles.h" | |
18 | #include "EditProfileStyle.h" | |
76
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
19 | #include "MainWindow.h" |
56 | 20 | #include "config.h" |
21 | ||
22 | ||
76
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
23 | ProfileStyles::ProfileStyles(QWidget *parent) : QDialog(parent) |
56 | 24 | { |
25 | qDebug() << "ProfileStyles start"; | |
26 | ||
76
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
27 | gridLayout = new QGridLayout(this); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
28 | gridLayout->setObjectName(QString::fromUtf8("gridLayout")); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
29 | tableStyles = new QTableWidget(this); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
30 | tableStyles->setObjectName(QString::fromUtf8("tableStyles")); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
31 | tableStyles->setEnabled(true); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
32 | QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
33 | sizePolicy.setHorizontalStretch(0); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
34 | sizePolicy.setVerticalStretch(0); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
35 | tableStyles->setSizePolicy(sizePolicy); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
36 | tableStyles->setMinimumSize(QSize(1049, 0)); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
37 | gridLayout->addWidget(tableStyles, 0, 0, 1, 1); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
38 | |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
39 | groupBox = new QGroupBox(this); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
40 | groupBox->setObjectName(QString::fromUtf8("groupBox")); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
41 | groupBox->setEnabled(true); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
42 | groupBox->setFlat(false); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
43 | horizontalLayout = new QHBoxLayout(groupBox); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
44 | horizontalLayout->setSpacing(6); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
45 | horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
46 | horizontalLayout->setContentsMargins(0, 0, 0, 0); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
47 | |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
48 | quitButton = new QPushButton(groupBox); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
49 | quitButton->setObjectName(QString::fromUtf8("quitButton")); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
50 | quitButton->setMinimumSize(QSize(80, 24)); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
51 | quitButton->setText(tr("Quit")); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
52 | QIcon icon; |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
53 | icon.addFile(QString::fromUtf8(":icons/silk/door_out.png"), QSize(), QIcon::Normal, QIcon::Off); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
54 | quitButton->setIcon(icon); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
55 | horizontalLayout->addWidget(quitButton, 0, Qt::AlignLeft); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
56 | |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
57 | insertButton = new QPushButton(groupBox); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
58 | insertButton->setObjectName(QString::fromUtf8("insertButton")); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
59 | insertButton->setMinimumSize(QSize(80, 24)); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
60 | insertButton->setText(tr("New")); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
61 | QIcon icon3; |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
62 | icon3.addFile(QString::fromUtf8(":icons/silk/table_row_insert.png"), QSize(), QIcon::Normal, QIcon::Off); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
63 | insertButton->setIcon(icon3); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
64 | horizontalLayout->addWidget(insertButton, 0, Qt::AlignRight); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
65 | gridLayout->addWidget(groupBox, 1, 0, 1, 1); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
66 | |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
67 | connect(quitButton, SIGNAL(clicked()), parent, SLOT(fromProfileStyles())); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
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:
76
diff
changeset
|
69 | connect(this, SIGNAL(setStatus(QString)), parent, SLOT(statusMsg(QString))); |
56 | 70 | emit refreshTable(); |
71 | } | |
72 | ||
73 | ||
74 | void ProfileStyles::refreshTable() | |
75 | { | |
76 | QString w; | |
77 | QWidget* pWidget; | |
78 | QHBoxLayout* pLayout; | |
79 | ||
80 | qDebug() << "ProfileStyles reload"; | |
81 | ||
82 | QSqlQuery query("SELECT * FROM profile_styles ORDER BY style_guide,style_letter,name"); | |
83 | const QStringList labels({tr("Guide"), tr("Gr"), tr("Name"), tr("OG"), tr("OG"), tr("FG"), tr("FG"), | |
84 | tr("IBU"), tr("IBU"), tr("EBC"), tr("EBC"), tr("Co2"), tr("Co2"), tr("ABV"), tr("ABV"), tr("Edit")}); | |
85 | ||
76
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
86 | this->tableStyles->setColumnCount(16); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
87 | this->tableStyles->setColumnWidth(0, 100); /* Guide */ |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
88 | this->tableStyles->setColumnWidth(1, 25); /* Group */ |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
89 | this->tableStyles->setColumnWidth(2, 300); /* Name */ |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
90 | this->tableStyles->setColumnWidth(3, 50); /* OG */ |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
91 | this->tableStyles->setColumnWidth(4, 50); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
92 | this->tableStyles->setColumnWidth(5, 50); /* FG */ |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
93 | this->tableStyles->setColumnWidth(6, 50); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
94 | this->tableStyles->setColumnWidth(7, 40); /* IBU */ |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
95 | this->tableStyles->setColumnWidth(8, 40); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
96 | this->tableStyles->setColumnWidth(9, 40); /* EBC */ |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
97 | this->tableStyles->setColumnWidth(10, 40); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
98 | this->tableStyles->setColumnWidth(11, 40); /* Co2 */ |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
99 | this->tableStyles->setColumnWidth(12, 40); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
100 | this->tableStyles->setColumnWidth(13, 40); /* ABV */ |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
101 | this->tableStyles->setColumnWidth(14, 40); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
102 | this->tableStyles->setColumnWidth(15, 80); /* Edit button */ |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
103 | this->tableStyles->setRowCount(query.size()); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
104 | this->tableStyles->setHorizontalHeaderLabels(labels); |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
105 | this->tableStyles->verticalHeader()->hide(); |
56 | 106 | |
107 | QTableWidgetItem *rightitem = new QTableWidgetItem(); | |
108 | rightitem->setTextAlignment(Qt::AlignRight); | |
109 | ||
110 | query.first(); | |
111 | for (int ridx = 0 ; ridx < query.size() ; ridx++ ) { | |
76
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
112 | this->tableStyles->setItem(ridx, 0, new QTableWidgetItem(query.value(5).toString())); /* Guide */ |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
113 | this->tableStyles->setItem(ridx, 1, new QTableWidgetItem(query.value(4).toString())); /* Goup */ |
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
114 | this->tableStyles->setItem(ridx, 2, new QTableWidgetItem(query.value(1).toString())); /* Name */ |
56 | 115 | |
116 | w = QString("%1").arg(query.value(7).toDouble(), 4, 'f', 3, '0' ); /* OG */ | |
117 | QTableWidgetItem *item = new QTableWidgetItem(w); | |
118 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); | |
76
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
119 | this->tableStyles->setItem(ridx, 3, item); |
56 | 120 | |
121 | w = QString("%1").arg(query.value(8).toDouble(), 4, 'f', 3, '0' ); /* OG */ | |
122 | item = new QTableWidgetItem(w); | |
123 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); | |
76
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
124 | this->tableStyles->setItem(ridx, 4, item); |
56 | 125 | |
126 | w = QString("%1").arg(query.value(9).toDouble(), 4, 'f', 3, '0' ); /* FG */ | |
127 | item = new QTableWidgetItem(w); | |
128 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); | |
76
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
129 | this->tableStyles->setItem(ridx, 5, item); |
56 | 130 | |
131 | w = QString("%1").arg(query.value(10).toDouble(), 4, 'f', 3, '0' ); /* FG */ | |
132 | item = new QTableWidgetItem(w); | |
133 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); | |
76
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
134 | this->tableStyles->setItem(ridx, 6, item); |
56 | 135 | |
136 | w = QString("%1").arg(query.value(11).toDouble(), 1, 'f', 0, '0' ); /* IBU */ | |
137 | item = new QTableWidgetItem(w); | |
138 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); | |
76
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
139 | this->tableStyles->setItem(ridx, 7, item); |
56 | 140 | |
141 | w = QString("%1").arg(query.value(12).toDouble(), 1, 'f', 0, '0' ); /* IBU */ | |
142 | item = new QTableWidgetItem(w); | |
143 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); | |
76
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
144 | this->tableStyles->setItem(ridx, 8, item); |
56 | 145 | |
146 | w = QString("%1").arg(query.value(13).toDouble(), 1, 'f', 0, '0' ); /* EBC */ | |
147 | item = new QTableWidgetItem(w); | |
148 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); | |
76
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
149 | this->tableStyles->setItem(ridx, 9, item); |
56 | 150 | |
151 | w = QString("%1").arg(query.value(14).toDouble(), 1, 'f', 0, '0' ); /* EBC */ | |
152 | item = new QTableWidgetItem(w); | |
153 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); | |
76
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
154 | this->tableStyles->setItem(ridx, 10, item); |
56 | 155 | |
156 | w = QString("%1").arg(query.value(15).toDouble(), 2, 'f', 1, '0' ); /* Co2 */ | |
157 | item = new QTableWidgetItem(w); | |
158 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); | |
76
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
159 | this->tableStyles->setItem(ridx, 11, item); |
56 | 160 | |
161 | w = QString("%1").arg(query.value(16).toDouble(), 2, 'f', 1, '0' ); /* Co2 */ | |
162 | item = new QTableWidgetItem(w); | |
163 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); | |
76
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
164 | this->tableStyles->setItem(ridx, 12, item); |
56 | 165 | |
166 | w = QString("%1").arg(query.value(17).toDouble(), 2, 'f', 1, '0' ); /* ABV */ | |
167 | item = new QTableWidgetItem(w); | |
168 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); | |
76
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
169 | this->tableStyles->setItem(ridx, 13, item); |
56 | 170 | |
171 | w = QString("%1").arg(query.value(18).toDouble(), 2, 'f', 1, '0' ); /* ABV */ | |
172 | item = new QTableWidgetItem(w); | |
173 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); | |
76
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
174 | this->tableStyles->setItem(ridx, 14, item); |
56 | 175 | |
176 | /* Add the Edit button */ | |
177 | pWidget = new QWidget(); | |
178 | QPushButton* btn_edit = new QPushButton(); | |
179 | btn_edit->setObjectName(QString("%1").arg(query.value(0).toString())); /* Send record with the button */ | |
180 | btn_edit->setText(tr("Edit")); | |
181 | connect(btn_edit, SIGNAL(clicked()), this, SLOT(on_editButton_clicked())); | |
182 | pLayout = new QHBoxLayout(pWidget); | |
183 | pLayout->addWidget(btn_edit); | |
184 | pLayout->setContentsMargins(5, 0, 5, 0); | |
185 | pWidget->setLayout(pLayout); | |
76
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
186 | this->tableStyles->setCellWidget(ridx, 15, pWidget); |
56 | 187 | query.next(); |
188 | } | |
79
e726db72da3c
All inventory and profiles now show the items sizes in the statusbar.
Michiel Broek <mbroek@mbse.eu>
parents:
76
diff
changeset
|
189 | emit setStatus(QString(tr("Total items: %1")).arg(query.size())); |
56 | 190 | } |
191 | ||
192 | ||
76
93395c4d6c8d
Profile Styles now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
56
diff
changeset
|
193 | ProfileStyles::~ProfileStyles() {} |
56 | 194 | |
195 | ||
196 | void ProfileStyles::edit(int recno) | |
197 | { | |
198 | EditProfileStyle dialog(recno, this); | |
199 | /* Signal from editor if a refresh is needed */ | |
200 | connect(&dialog, SIGNAL(entry_changed()), this, SLOT(refreshTable())); | |
201 | dialog.setModal(true); | |
202 | dialog.exec(); | |
203 | } | |
204 | ||
205 | ||
206 | void ProfileStyles::on_editButton_clicked() | |
207 | { | |
208 | QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); | |
209 | int recno = pb->objectName().toInt(); | |
210 | edit(recno); | |
211 | } | |
212 | ||
213 | ||
214 | void ProfileStyles::on_insertButton_clicked() | |
215 | { | |
216 | edit(-1); | |
217 | } | |
218 | ||
219 |