replace photoboothdialog code

photoboothwidget was created to integrate the dialog inside
the account creation wizard.
the widget is now reused as the core of the photobooth dialog
used in the profile configuration.

Change-Id: I794d7964195bc468452f2f1e63fe1b157baaab97
Reviewed-by: Anthony Léonard <anthony.leonard@savoirfairelinux.com>
diff --git a/photoboothdialog.cpp b/photoboothdialog.cpp
index 6a804f3..5ea8091 100644
--- a/photoboothdialog.cpp
+++ b/photoboothdialog.cpp
@@ -26,54 +26,18 @@
 
 PhotoBoothDialog::PhotoBoothDialog(QWidget* parent) :
     QDialog(parent),
-    fileName_(QStandardPaths::standardLocations(QStandardPaths::TempLocation).first()
-              + QStringLiteral("profile.png")),
     ui(new Ui::PhotoBoothDialog)
 {
     ui->setupUi(this);
-
-    Qt::WindowFlags flags = windowFlags();
-    flags = flags & (~Qt::WindowContextHelpButtonHint);
-    setWindowFlags(flags);
-
-    ui->videoFeed->setIsFullPreview(true);
-    ui->videoFeed->setPhotoMode(true);
-    Video::PreviewManager::instance().startPreview();
+    setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
+    connect(ui->Photobooth, &PhotoboothWidget::photoTaken, [this](QString fileName){
+        fileName_ = fileName;
+        accept();
+        }
+    );
 }
 
 PhotoBoothDialog::~PhotoBoothDialog()
 {
     delete ui;
 }
-
-void
-PhotoBoothDialog::closeEvent(QCloseEvent* event)
-{
-    Q_UNUSED(event)
-    Video::PreviewManager::instance().stopPreview();
-}
-
-void
-PhotoBoothDialog::on_importButton_clicked()
-{
-    fileName_ = QFileDialog::getOpenFileName(this, tr("Choose File"),
-                                            "",
-                                            tr("Files (*)"));
-    if (fileName_.isEmpty())
-        fileName_ = QStandardPaths::standardLocations(
-                    QStandardPaths::TempLocation).first()
-                + QStringLiteral("profile.png");
-    else {
-        Video::PreviewManager::instance().stopPreview();
-        accept();
-    }
-}
-
-void
-PhotoBoothDialog::on_takePhotoButton_clicked()
-{
-    auto photo = ui->videoFeed->takePhoto();
-    Video::PreviewManager::instance().stopPreview();
-    photo.save(fileName_);
-    accept();
-}