src/EditProductExport.cpp

changeset 243
84dc3c1c2d02
parent 240
52efe638e79a
child 246
9e420bea7c38
--- a/src/EditProductExport.cpp	Tue May 31 09:14:28 2022 +0200
+++ b/src/EditProductExport.cpp	Tue May 31 11:42:26 2022 +0200
@@ -262,27 +262,87 @@
 }
 
 
-void EditProduct::printProduct()
-{
-    PrinterDialog(PR_PRODUCT, -1, this);
-}
-
-
-void EditProduct::printChecklist()
-{
-    PrinterDialog(PR_CHECKLIST, -1, this);
-}
-
-
 void EditProduct::on_exportButton_clicked()
 {
-    exportBeerXML();
+    QDialog* dialog = new QDialog(this);
+    dialog->setWindowTitle(tr("Export choices"));
+    dialog->setObjectName(QString::fromUtf8("Dialog"));
+    dialog->resize(400, 179);
+    QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog);
+    buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
+    buttonBox->setGeometry(QRect(280, 20, 81, 61));
+    buttonBox->setOrientation(Qt::Vertical);
+    buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
+
+    QRadioButton *beerxmlButton = new QRadioButton(dialog);
+    beerxmlButton->setObjectName(QString::fromUtf8("beerxmlButton"));
+    beerxmlButton->setGeometry(QRect(50, 20, 171, 21));
+    beerxmlButton->setText(tr("Export to beerXML"));
+/*    QRadioButton *copy_productButton = new QRadioButton(dialog);
+    copy_productButton->setObjectName(QString::fromUtf8("copy_productButton"));
+    copy_productButton->setGeometry(QRect(50, 50, 171, 21));
+    copy_productButton->setText(tr("Copy to product"));
+    QRadioButton *splitButton = new QRadioButton(dialog);
+    splitButton->setObjectName(QString::fromUtf8("splitButton"));
+    splitButton->setGeometry(QRect(50, 110, 171, 21));
+    splitButton->setText(tr("Split this batch"));
+    QRadioButton *copy_recipeButton = new QRadioButton(dialog);
+    copy_recipeButton->setObjectName(QString::fromUtf8("copy_recipeButton"));
+    copy_recipeButton->setGeometry(QRect(50, 80, 171, 21));
+    copy_recipeButton->setText(tr("Copy to recipe"));
+    QRadioButton *toforumButton = new QRadioButton(dialog);
+    toforumButton->setObjectName(QString::fromUtf8("toforumButton"));
+    toforumButton->setGeometry(QRect(50, 140, 171, 21));
+    toforumButton->setText(tr("Export to forum")); */
+
+    QObject::connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
+    QObject::connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
+
+    dialog->setModal(true);
+    dialog->exec();
+    if (dialog->result() == QDialog::Accepted) {
+        if (beerxmlButton->isChecked())
+	    exportBeerXML();
+    }
+
+    disconnect(buttonBox, nullptr, nullptr, nullptr);
 }
 
 
 void EditProduct::on_printButton_clicked()
 {
-    printChecklist();
+    QDialog* dialog = new QDialog(this);
+    dialog->setWindowTitle(tr("Printer report"));
+    dialog->setObjectName(QString::fromUtf8("Dialog"));
+    dialog->resize(400, 101);
+    QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog);
+    buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
+    buttonBox->setGeometry(QRect(280, 20, 81, 61));
+    buttonBox->setOrientation(Qt::Vertical);
+    buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
+
+    QRadioButton *recipeButton = new QRadioButton(dialog);
+    recipeButton->setObjectName(QString::fromUtf8("recipeButton"));
+    recipeButton->setGeometry(QRect(50, 20, 171, 21));
+    recipeButton->setText(tr("Print recipe"));
+    QRadioButton *checklistButton = new QRadioButton(dialog);
+    checklistButton->setObjectName(QString::fromUtf8("checklistButton"));
+    checklistButton->setGeometry(QRect(50, 50, 171, 21));
+    checklistButton->setText(tr("Print checklist"));
+
+    QObject::connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
+    QObject::connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
+
+    dialog->setModal(true);
+    dialog->exec();
+    if (dialog->result() == QDialog::Accepted) {
+	if (checklistButton->isChecked())
+	    PrinterDialog(PR_CHECKLIST, -1, this);
+	if (recipeButton->isChecked())
+	    PrinterDialog(PR_PRODUCT, -1, this);
+    }
+
+    disconnect(buttonBox, nullptr, nullptr, nullptr);
 }
 
 

mercurial