| 1 |
/* ============================================================ |
| 2 |
* |
| 3 |
* This file is a part of digiKam project |
| 4 |
* https://www.digikam.org |
| 5 |
* |
| 6 |
* Date : 2024-10-08 |
| 7 |
* Description : confirmation of changing the face recognition model |
| 8 |
* |
| 9 |
* SPDX-FileCopyrightText: 2009-2026 by Gilles Caulier <caulier dot gilles at gmail dot com> |
| 10 |
* SPDX-FileCopyrightText: 2024-2025 by Michael Miller <michael underscore miller at msn dot com> |
| 11 |
* |
| 12 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 13 |
* |
| 14 |
* ============================================================ */ |
| 15 |
|
| 16 |
#include "facetrainingupgradedlg.h" |
| 17 |
|
| 18 |
// Qt includes |
| 19 |
|
| 20 |
#include <QGridLayout> |
| 21 |
#include <QPushButton> |
| 22 |
#include <QLabel> |
| 23 |
|
| 24 |
// KDE includes |
| 25 |
|
| 26 |
#include <klocalizedstring.h> |
| 27 |
#include <ksharedconfig.h> |
| 28 |
#include <kconfiggroup.h> |
| 29 |
|
| 30 |
// Local includes |
| 31 |
|
| 32 |
#include "digikam_debug.h" |
| 33 |
#include "digikam_globals_p.h" |
| 34 |
#include "facescansettings.h" |
| 35 |
|
| 36 |
namespace Digikam |
| 37 |
{ |
| 38 |
|
| 39 |
class Q_DECL_HIDDEN FaceTrainingUpgradeDlg::Private |
| 40 |
{ |
| 41 |
public: |
| 42 |
|
| 43 |
Private() = default; |
| 44 |
|
| 45 |
public: |
| 46 |
|
| 47 |
QWidget* page = nullptr; |
| 48 |
QVBoxLayout* verticalLayout = nullptr; |
| 49 |
QGridLayout* layoutGrid = nullptr; |
| 50 |
QLabel* message = nullptr; |
| 51 |
QLabel* icon = nullptr; |
| 52 |
|
| 53 |
QPushButton* startButton = nullptr; |
| 54 |
QPushButton* cancelButton = nullptr; |
| 55 |
}; |
| 56 |
|
| 57 |
FaceTrainingUpgradeDlg::FaceTrainingUpgradeDlg(QWidget* const parent) |
| 58 |
: QDialog(parent), |
| 59 |
d (new Private) |
| 60 |
{ |
| 61 |
setModal(true); |
| 62 |
setWindowTitle(i18nc("@title:window", "Facial Recognition Database")); |
| 63 |
|
| 64 |
QString messageString = i18nc("@info", |
| 65 |
"Your face recognition database is outdated and requires retraining. " |
| 66 |
"This process might take anywhere from a few seconds to several minutes. " |
| 67 |
"Facial recognition will not be reliable until retraining is finished. " |
| 68 |
"Retraining will run in the background and you can continue to use digiKam. " |
| 69 |
"\n\nDo you want to retrain your database now?"); |
| 70 |
|
| 71 |
d->page = new QWidget(this); |
| 72 |
d->verticalLayout = new QVBoxLayout(d->page); |
| 73 |
d->layoutGrid = new QGridLayout(this); |
| 74 |
|
| 75 |
d->icon = new QLabel(this); |
| 76 |
d->icon->setPixmap(QIcon::fromTheme(QLatin1String("edit-image-face-show")).pixmap(QSize(64, 64))); |
| 77 |
|
| 78 |
d->message = new QLabel(messageString, this); |
| 79 |
d->message->setWordWrap(true); |
| 80 |
|
| 81 |
d->startButton = new QPushButton(QIcon::fromTheme(QLatin1String("dialog-ok-apply")), i18n("OK"), this); |
| 82 |
d->startButton->setToolTip(i18nc("@action:button", "Begin")); |
| 83 |
d->startButton->setDefault(true); |
| 84 |
|
| 85 |
d->cancelButton = new QPushButton(QIcon::fromTheme(QLatin1String("dialog-cancel")), i18n("Cancel"), this); |
| 86 |
d->cancelButton->setToolTip(i18nc("@action:button", "Cancel")); |
| 87 |
|
| 88 |
d->layoutGrid->addWidget(d->icon, 1, 0, 2, 2); |
| 89 |
d->layoutGrid->addWidget(d->message, 0, 2, 10, 10); |
| 90 |
d->layoutGrid->addWidget(d->startButton, 11, 2, 1, 3); |
| 91 |
d->layoutGrid->addWidget(d->cancelButton, 11, 8, 1, 3); |
| 92 |
d->verticalLayout->addStretch(); |
| 93 |
|
| 94 |
connect(d->startButton, SIGNAL(clicked()), |
| 95 |
this, SLOT(slotStart())); |
| 96 |
|
| 97 |
connect(d->cancelButton, SIGNAL(clicked()), |
| 98 |
this, SLOT(slotCancel())); |
| 99 |
} |
| 100 |
|
| 101 |
FaceTrainingUpgradeDlg::~FaceTrainingUpgradeDlg() |
| 102 |
{ |
| 103 |
delete d; |
| 104 |
} |
| 105 |
|
| 106 |
void FaceTrainingUpgradeDlg::slotStart() |
| 107 |
{ |
| 108 |
accept(); |
| 109 |
} |
| 110 |
|
| 111 |
void FaceTrainingUpgradeDlg::slotCancel() |
| 112 |
{ |
| 113 |
reject(); |
| 114 |
} |
| 115 |
|
| 116 |
} // namespace Digikam |
| 117 |
|
| 118 |
#include "moc_facetrainingupgradedlg.cpp" |