src/EditProductTab13.cpp

Sat, 21 Jan 2023 14:27:10 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 21 Jan 2023 14:27:10 +0100
changeset 468
b21da6f583be
parent 467
c5f6f3f1b714
child 469
a022701d47f5
permissions
-rw-r--r--

The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.

464
1fed3ff9a64e Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /**
1fed3ff9a64e Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * EditProduct.cpp is part of bmsapp.
1fed3ff9a64e Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
1fed3ff9a64e Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * Tab 13, images and pictures.
1fed3ff9a64e Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
1fed3ff9a64e Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * bmsapp is free software: you can redistribute it and/or modify
1fed3ff9a64e Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
1fed3ff9a64e Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * the Free Software Foundation, either version 3 of the License, or
1fed3ff9a64e Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * (at your option) any later version.
1fed3ff9a64e Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 *
1fed3ff9a64e Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * bmsapp is distributed in the hope that it will be useful,
1fed3ff9a64e Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1fed3ff9a64e Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1fed3ff9a64e Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * GNU General Public License for more details.
1fed3ff9a64e Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 *
1fed3ff9a64e Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
1fed3ff9a64e Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1fed3ff9a64e Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 */
1fed3ff9a64e Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19
465
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
20 void EditProduct::images_Init()
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
21 {
467
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
22 qDebug() << "images_Init()";
465
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
23
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
24 // Start spinner
467
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
25
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
26 /*
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
27 * Clean old picture areas.
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
28 */
468
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
29 if (product->images_count < 0 && product->images_list.size()) {
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
30 qDebug() << " clean images_list";
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
31 ui->filmStrip->clear();
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
32 product->images_list.clear();
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
33 product->images_count = -1;
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
34 product->images_current = -1;
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
35 }
467
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
36
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
37 /*
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
38 * Load images data for this product uuid.
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
39 */
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
40 if (product->images_count < 0) {
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
41 QSqlQuery query;
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
42
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
43 qDebug() << " loading data";
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
44 query.prepare("SELECT * FROM products_pics WHERE uuid=:uuid");
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
45 query.bindValue(":uuid", product->uuid);
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
46 query.exec();
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
47
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
48 if (query.lastError().isValid()) {
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
49 qWarning() << "images_init()" << query.lastError();
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
50 QMessageBox::warning(this, tr("Database error"), tr("MySQL error: %1\n%2\n%3")
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
51 .arg(query.lastError().nativeErrorCode()).arg(query.lastError().driverText()).arg(query.lastError().databaseText()));
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
52 }
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
53 product->images_count = 0;
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
54
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
55 while (query.next()) {
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
56 Images i;
468
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
57 i.record = query.value("record").toInt();
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
58 i.uuid = query.value("uuid").toString();
467
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
59 i.pic_type = query.value("pic_type").toInt();
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
60 i.pic_data = query.value("pic_data").toByteArray();
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
61 i.pic_comment = query.value("pic_comment").toString();
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
62 i.filename = query.value("filename").toString();
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
63 i.timestamp = query.value("timestamp").toDateTime();
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
64 product->images_list.append(i);
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
65 product->images_count++;
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
66 }
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
67 qDebug() << " loaded" << product->images_count << product->images_list.size();
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
68 if (product->images_count < 1)
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
69 product->images_current = -1;
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
70 else
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
71 product->images_current = 0;
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
72 }
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
73
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
74 images_Thumbnails();
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
75 if (product->images_current >= 0) {
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
76 ui->filmStrip->setCurrentRow(product->images_current);
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
77 }
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
78 images_Main(product->images_current);
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
79
465
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
80 // If any, show picture 1
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
81 // Stop spinner
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
82 }
464
1fed3ff9a64e Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83
1fed3ff9a64e Show 0 if afterboil volume is invalid instead of the chiller volume. Added product tab 13. Here the images (beerlabels, brew pictures) for a product will be shown. Resized all product tabs. Added STA1 tickmark in the yeasts table.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84
467
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
85 /*
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
86 * Show thumbnails on the left.
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
87 */
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
88 void EditProduct::images_Thumbnails()
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
89 {
468
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
90 ui->filmStrip->clear();
467
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
91
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
92 for (int i = 0; i < product->images_list.size(); i++) {
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
93 QListWidgetItem* newItem = new QListWidgetItem();
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
94 QString text = QCoreApplication::translate("PicType", g_prod_pic_types[product->images_list.at(i).pic_type]);
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
95 newItem->setText(text);
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
96 newItem->setBackground(QColor(0x45,0x53,0x64));
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
97
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
98 QPixmap outPixmap = QPixmap();
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
99 outPixmap.loadFromData(product->images_list.at(i).pic_data);
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
100 qDebug() << " " << outPixmap.width() << "x" << outPixmap.height() << "size" << outPixmap.size() << product->images_list.at(i).filename;
468
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
101 qDebug() << " " << ui->filmStrip->iconSize();
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
102 if (outPixmap.width() > 240 || outPixmap.height() > 180)
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
103 newItem->setIcon(QIcon(outPixmap.scaled(240, 180, Qt::KeepAspectRatio, Qt::SmoothTransformation)));
467
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
104 else
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
105 newItem->setIcon(QIcon(outPixmap));
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
106
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
107 ui->filmStrip->addItem(newItem);
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
108 }
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
109 }
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
110
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
111
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
112 void EditProduct::images_Main(int id)
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
113 {
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
114 qDebug() << " Main(" << id << ")";
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
115
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
116 ui->prevImage->setEnabled((product->images_count > 0 && product->images_current > 0) ? true:false);
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
117 ui->nextImage->setEnabled((product->images_count > 0 && (product->images_current + 1) < product->images_count) ? true:false);
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
118 ui->downloadImage->setEnabled((product->images_count > 0) ? true:false);
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
119 ui->printImage->setEnabled((product->images_count > 0) ? true:false);
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
120 ui->delImage->setEnabled((product->images_count > 0) ? true:false);
468
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
121
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
122 if (product->images_count < 1) {
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
123 ui->image_filenameEdit->setText("");
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
124 ui->image_timestampEdit->setText("");
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
125 ui->image_commentEdit->setText("");
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
126 ui->image_typeEdit->setCurrentIndex(0);
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
127 //ui->currentImage->setPixmap();
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
128 return;
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
129 }
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
130
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
131 QPixmap outPixmap = QPixmap();
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
132 outPixmap.loadFromData(product->images_list.at(id).pic_data);
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
133 qDebug() << " " << outPixmap.width() << "x" << outPixmap.height() << "size" << outPixmap.size() << product->images_list.at(id).filename;
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
134 if (outPixmap.width() > ui->currentImage->width() || outPixmap.height() > ui->currentImage->height())
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
135 ui->currentImage->setPixmap(outPixmap.scaled(ui->currentImage->width(), ui->currentImage->height(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
136 else
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
137 ui->currentImage->setPixmap(outPixmap);
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
138
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
139 ui->image_filenameEdit->setText(product->images_list.at(id).filename);
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
140 ui->image_timestampEdit->setText(product->images_list.at(id).timestamp.toString(Qt::RFC2822Date));
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
141 ui->image_commentEdit->setText(product->images_list.at(id).pic_comment);
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
142 ui->image_typeEdit->setCurrentIndex(product->images_list.at(id).pic_type);
467
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
143 }
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
144
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
145
465
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
146 void EditProduct::addImage_clicked()
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
147 {
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
148 QString fileName;
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
149 QByteArray imageByteArray;
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
150 QSqlQuery query;
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
151 QSettings settings(QSettings::IniFormat, QSettings::UserScope, "mbse", "bmsapp");
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
152
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
153 QFileDialog dialog1(this, tr("Open File"));
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
154 dialog1.setDirectory(settings.value("paths/images").toString());
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
155 /* Only a few image formats are valid */
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
156 QStringList mimeTypeFilters ({ "image/bmp", "image/gif", "image/jpeg", "image/png", "image/svg+xml" });
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
157 dialog1.setMimeTypeFilters(mimeTypeFilters);
467
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
158 dialog1.setNameFilter("Images (*.bmp *.BMP *.gif *.GIF *.jpg *.JPG *.jpeg *.JPEG *.png *.PNG *.svg *.SVG)");
465
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
159 dialog1.setAcceptMode(QFileDialog::AcceptOpen);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
160 // dialog1.setOption(QFileDialog::DontUseNativeDialog);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
161 if (dialog1.exec() != QDialog::Accepted)
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
162 return;
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
163
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
164 /*
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
165 * Save our current path
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
166 */
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
167 settings.setValue("paths/images", dialog1.directory().absolutePath());
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
168
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
169 fileName = dialog1.selectedFiles().constFirst();
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
170 QImageReader reader(fileName);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
171 reader.setAutoTransform(true);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
172 const QImage newImage = reader.read();
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
173 if (newImage.isNull()) {
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
174 QMessageBox::information(this, QGuiApplication::applicationDisplayName(), tr("Cannot load %1: %2")
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
175 .arg(QDir::toNativeSeparators(fileName), reader.errorString()));
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
176 return;
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
177 }
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
178 qDebug() << "Image" << fileName << newImage.width() << newImage.height() << "size" << newImage.sizeInBytes();
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
179
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
180 QBuffer buffer(&imageByteArray);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
181 buffer.open(QIODevice::WriteOnly);
467
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
182 newImage.save(&buffer, "PNG"); /* Convert to lossless .png format. */
465
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
183
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
184 /*
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
185 * Now that we have selected a valid image, create a new dialog so
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
186 * we can add extra information for this image and a Save button.
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
187 */
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
188 QDialog* dialog = new QDialog(this);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
189 dialog->resize(500, 490);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
190 QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
191 buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
192 buttonBox->setGeometry(QRect(10, 440, 480, 32));
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
193 buttonBox->setLayoutDirection(Qt::LeftToRight);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
194 buttonBox->setOrientation(Qt::Horizontal);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
195 buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Save);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
196 buttonBox->setCenterButtons(true);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
197
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
198 QLabel *imageLabel = new QLabel(dialog);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
199 imageLabel->setObjectName(QString::fromUtf8("imageLabel"));
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
200 imageLabel->setGeometry(QRect(10, 10, 480, 320));
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
201 imageLabel->setAlignment(Qt::AlignCenter);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
202 imageLabel->setText(tr("Image here"));
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
203 QPixmap outPixmap = QPixmap();
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
204 outPixmap.loadFromData(imageByteArray);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
205 if (outPixmap.width() > 480 || outPixmap.height() > 320)
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
206 imageLabel->setPixmap(outPixmap.scaled(480, 320, Qt::KeepAspectRatio, Qt::SmoothTransformation));
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
207 else
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
208 imageLabel->setPixmap(outPixmap);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
209
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
210 QLabel *typeLabel = new QLabel(dialog);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
211 typeLabel->setObjectName(QString::fromUtf8("typeLabel"));
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
212 typeLabel->setText(tr("Image type:"));
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
213 typeLabel->setGeometry(QRect(10, 360, 141, 20));
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
214 typeLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
215
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
216 QComboBox *typeEdit = new QComboBox(dialog);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
217 typeEdit->setObjectName(QString::fromUtf8("typeEdit"));
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
218 typeEdit->setGeometry(QRect(160, 360, 161, 23));
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
219 for (int i = 0; i < 7; i++)
468
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
220 typeEdit->addItem(QCoreApplication::translate("PicType", g_prod_pic_types[i]));
465
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
221 typeEdit->setCurrentIndex(0);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
222
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
223 QLabel *commentLabel = new QLabel(dialog);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
224 commentLabel->setObjectName(QString::fromUtf8("commentLabel"));
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
225 commentLabel->setText(tr("Image comment:"));
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
226 commentLabel->setGeometry(QRect(10, 390, 141, 20));
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
227 commentLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
228
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
229 QLineEdit *commentEdit = new QLineEdit(dialog);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
230 commentEdit->setObjectName(QString::fromUtf8("commentEdit"));
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
231 commentEdit->setGeometry(QRect(160, 390, 320, 23));
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
232 commentEdit->setToolTip(tr("The comment for this image."));
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
233
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
234 connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
235 connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
236
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
237 dialog->setModal(true);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
238 dialog->exec();
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
239 if (dialog->result() == QDialog::Rejected) {
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
240 return;
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
241 }
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
242 disconnect(buttonBox, nullptr, nullptr, nullptr);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
243
466
68ef2cc3e8d2 Added fields for filename and timestamp.
Michiel Broek <mbroek@mbse.eu>
parents: 465
diff changeset
244 QFileInfo fi(fileName);
68ef2cc3e8d2 Added fields for filename and timestamp.
Michiel Broek <mbroek@mbse.eu>
parents: 465
diff changeset
245 query.prepare("INSERT INTO products_pics SET uuid=:uuid, pic_type=:pic_type, pic_data=:pic_data, "
68ef2cc3e8d2 Added fields for filename and timestamp.
Michiel Broek <mbroek@mbse.eu>
parents: 465
diff changeset
246 "pic_comment=:pic_comment, filename=:filename, timestamp=:timestamp");
465
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
247 query.bindValue(":uuid", product->uuid);
467
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
248 query.bindValue(":pic_type", typeEdit->currentIndex());
465
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
249 query.bindValue(":pic_data", imageByteArray);
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
250 query.bindValue(":pic_comment", commentEdit->text());
467
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
251 query.bindValue(":filename", fi.completeBaseName() + ".png"); /* The image is converted to .png */
466
68ef2cc3e8d2 Added fields for filename and timestamp.
Michiel Broek <mbroek@mbse.eu>
parents: 465
diff changeset
252 query.bindValue(":timestamp", fi.lastModified());
465
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
253
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
254 query.exec();
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
255 if (query.lastError().isValid()) {
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
256 qWarning() << "addImage_clicked()" << query.lastError();
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
257 QMessageBox::warning(this, tr("Database error"), tr("MySQL error: %1\n%2\n%3")
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
258 .arg(query.lastError().nativeErrorCode()).arg(query.lastError().driverText()).arg(query.lastError().databaseText()));
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
259 } else {
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
260 qDebug() << "new image Saved";
468
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
261 product->images_count = -1; // Force reload data
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
262 images_Init();
465
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
263 }
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
264 }
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
265
8fc909360552 In EditProduct added tab number 13. When entered, a signal is generated to init this tab so that we can defer loading. Added a AddImage button, we can select an image, give it a type and comment and store it is a separate table. The global settings file now has storage for paths (images, download and beerxml).
Michiel Broek <mbroek@mbse.eu>
parents: 464
diff changeset
266
467
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
267 void EditProduct::delImage_clicked()
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
268 {
468
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
269 qDebug() << "delImage_clicked()" << ui->filmStrip->currentRow();
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
270
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
271 int rc = QMessageBox::warning(this, tr("Delete image"), tr("Delete %1").arg(product->images_list.at(ui->filmStrip->currentRow()).filename),
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
272 QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
273 if (rc == QMessageBox::No)
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
274 return;
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
275
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
276 qDebug() << " delete record" << product->images_list.at(ui->filmStrip->currentRow()).record;
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
277
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
278 QSqlQuery query;
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
279 query.prepare("DELETE FROM products_pics WHERE record=:record");
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
280 query.bindValue(":record", product->images_list.at(ui->filmStrip->currentRow()).record);
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
281 query.exec();
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
282
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
283 if (query.lastError().isValid()) {
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
284 qWarning() << "delImage_clicked()" << query.lastError();
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
285 QMessageBox::warning(this, tr("Database error"), tr("MySQL error: %1\n%2\n%3")
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
286 .arg(query.lastError().nativeErrorCode()).arg(query.lastError().driverText()).arg(query.lastError().databaseText()));
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
287 }
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
288
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
289 product->images_count = -1; // Force reload data
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
290 images_Init();
467
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
291 }
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
292
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
293
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
294 void EditProduct::nextImage_clicked()
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
295 {
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
296 qDebug() << "nextImage_clicked()" << product->images_current << ui->filmStrip->currentRow();
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
297
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
298 if (product->images_count >= 0) {
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
299 if ((product->images_current + 1) < product->images_count) {
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
300 product->images_current++;
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
301 ui->filmStrip->setCurrentRow(product->images_current);
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
302 images_Main(product->images_current);
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
303 }
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
304 }
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
305 }
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
306
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
307
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
308 void EditProduct::prevImage_clicked()
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
309 {
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
310 qDebug() << "prevImage_clicked()" << product->images_current << ui->filmStrip->currentRow();
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
311
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
312 if (product->images_count >= 0) {
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
313 if (product->images_current > 0) {
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
314 product->images_current--;
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
315 ui->filmStrip->setCurrentRow(product->images_current);
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
316 images_Main(product->images_current);
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
317 }
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
318 }
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
319 }
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
320
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
321
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
322 void EditProduct::downloadImage_clicked()
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
323 {
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
324 qDebug() << "downloadImage_clicked()" << product->images_current << ui->filmStrip->currentRow();
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
325 }
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
326
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
327
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
328 void EditProduct::printImage_clicked()
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
329 {
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
330 qDebug() << "printImage_clicked()" << product->images_current << ui->filmStrip->currentRow();
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
331 }
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
332
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
333
468
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
334 void EditProduct::selectImage_clicked(QListWidgetItem *val)
467
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
335 {
468
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
336 qDebug() << "selectImage_clicked()" << ui->filmStrip->currentRow();
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
337
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
338 if (product->images_count > 0) {
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
339 product->images_current = ui->filmStrip->currentRow();
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
340 images_Main(product->images_current);
b21da6f583be The images tab now looks complete. Made the left side (thumbnails) a bit smaller. The right side of the screen now shows the current image and all data that belongs to that. After a new image is added, reload the images. Implemented delete image.
Michiel Broek <mbroek@mbse.eu>
parents: 467
diff changeset
341 }
467
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
342 }
c5f6f3f1b714 Added more buttons to the images tab. Load images from the database and display thumbnails added. Added support for jpeg files. Rename pictures in the database to .png. Added temporary images_list, images_count and images_current variables to the product record.
Michiel Broek <mbroek@mbse.eu>
parents: 466
diff changeset
343

mercurial