From bdd117e1611032abfdb15bd515ae654ad671dd11 Mon Sep 17 00:00:00 2001 From: Kjell Morgenstern Date: Fri, 1 Dec 2023 19:18:30 +0100 Subject: [PATCH] Added rough infrastructure for sending board dimensions on upload. --- src/dialogs/fabuploaddialog.cpp | 25 ++++++++++++++++++++++++- src/dialogs/fabuploaddialog.h | 5 +++-- src/dialogs/fabuploadprogress.cpp | 9 ++++++++- src/dialogs/fabuploadprogress.h | 25 ++++++++++++++++++++++++- src/mainwindow/mainwindow_menu.cpp | 5 ++++- 5 files changed, 63 insertions(+), 6 deletions(-) diff --git a/src/dialogs/fabuploaddialog.cpp b/src/dialogs/fabuploaddialog.cpp index bfeaad22e..e071ff2f0 100644 --- a/src/dialogs/fabuploaddialog.cpp +++ b/src/dialogs/fabuploaddialog.cpp @@ -1,3 +1,23 @@ +/******************************************************************* + +Part of the Fritzing project - http://fritzing.org +Copyright (c) 2023 Fritzing GmbH + +Fritzing is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Fritzing is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Fritzing. If not, see . + +********************************************************************/ + #include "fabuploaddialog.h" #include "networkhelper.h" #include "qstyle.h" @@ -12,6 +32,9 @@ FabUploadDialog::FabUploadDialog(QNetworkAccessManager *manager, QString filename, + double width, + double height, + int boardCount, QWidget *parent) : QDialog(parent), ui(new Ui::FabUploadDialog), @@ -21,7 +44,7 @@ FabUploadDialog::FabUploadDialog(QNetworkAccessManager *manager, ui->setupUi(this); setWindowFlags(Qt::Dialog | windowFlags()); ui->stackedWidget->setCurrentIndex(0); - ui->upload->init(manager, filename); + ui->upload->init(manager, filename, width, height, boardCount); ui->uploadButton_2->setEnabled(false); requestFabInfo(); diff --git a/src/dialogs/fabuploaddialog.h b/src/dialogs/fabuploaddialog.h index aeb7209c3..dedf650fe 100644 --- a/src/dialogs/fabuploaddialog.h +++ b/src/dialogs/fabuploaddialog.h @@ -16,8 +16,9 @@ class FabUploadDialog : public QDialog public: explicit FabUploadDialog(QNetworkAccessManager* manager, QString filename, -// double area, -// double boardCount, + double width, + double height, + int boardCount, QWidget *parent = nullptr); ~FabUploadDialog(); diff --git a/src/dialogs/fabuploadprogress.cpp b/src/dialogs/fabuploadprogress.cpp index c9111ce0e..5e3d4c09b 100644 --- a/src/dialogs/fabuploadprogress.cpp +++ b/src/dialogs/fabuploadprogress.cpp @@ -40,10 +40,14 @@ FabUploadProgress::FabUploadProgress(QWidget *parent) : QWidget(parent) { } -void FabUploadProgress::init(QNetworkAccessManager *manager, QString filename) +void FabUploadProgress::init(QNetworkAccessManager *manager, QString filename, + double width, double height, int boardCount) { mManager = manager; mFilepath = filename; + mWidth = width; + mHeight = height; + mBoardCount = boardCount; } void FabUploadProgress::doUpload() @@ -55,6 +59,9 @@ void FabUploadProgress::doUpload() QUrlQuery query; QString fritzingVersion = Version::versionString(); query.addQueryItem("fritzing_version", fritzingVersion); + query.addQueryItem("width", QString::number(mWidth)); + query.addQueryItem("height", QString::number(mHeight)); + query.addQueryItem("board_count", QString::number(mBoardCount)); settings.beginGroup("sketches"); QVariant settingValue = settings.value(mFilepath); diff --git a/src/dialogs/fabuploadprogress.h b/src/dialogs/fabuploadprogress.h index d2134860b..8b39803b5 100644 --- a/src/dialogs/fabuploadprogress.h +++ b/src/dialogs/fabuploadprogress.h @@ -1,3 +1,23 @@ +/******************************************************************* + +Part of the Fritzing project - http://fritzing.org +Copyright (c) 2023 Fritzing GmbH + +Fritzing is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +Fritzing is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Fritzing. If not, see . + +********************************************************************/ + #ifndef FABUPLOADPROGRESS_H #define FABUPLOADPROGRESS_H @@ -9,7 +29,7 @@ class FabUploadProgress : public QWidget Q_OBJECT public: explicit FabUploadProgress(QWidget *parent = nullptr); - void init(QNetworkAccessManager *manager, QString filename); + void init(QNetworkAccessManager *manager, QString filename, double width, double height, int boardCount); public Q_SLOTS: void doUpload(); @@ -32,6 +52,9 @@ private Q_SLOTS: QNetworkAccessManager *mManager; QString mFilepath; QString mRedirect_url; + double mWidth; + double mHeight; + int mBoardCount; void uploadMultipart(const QUrl &url, const QString &file_path); void checkProcessingStatus(QUrl url); diff --git a/src/mainwindow/mainwindow_menu.cpp b/src/mainwindow/mainwindow_menu.cpp index aa3247dda..ab427acec 100644 --- a/src/mainwindow/mainwindow_menu.cpp +++ b/src/mainwindow/mainwindow_menu.cpp @@ -4473,7 +4473,10 @@ void MainWindow::orderFab() } // upload auto* manager = new QNetworkAccessManager(); - FabUploadDialog upload(manager, m_fwFilename, this); + int boardCount; + double width, height; + // m_pcbGraphicsView->calcBoardDimensions(boardCount, width, height); + FabUploadDialog upload(manager, m_fwFilename, width, height, boardCount, this); upload.exec(); delete manager; } else {