From 8e5151002bb1470bc3de4b830e74e602001e70fa Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 8 Jan 2020 12:49:56 +0100 Subject: [PATCH] Gui: set image creation method in settings dialog --- src/Gui/CommandView.cpp | 8 + src/Gui/DlgSettingsImage.ui | 403 +++++++++++++++++++------------- src/Gui/DlgSettingsImageImp.cpp | 31 +++ src/Gui/DlgSettingsImageImp.h | 3 + 4 files changed, 279 insertions(+), 166 deletions(-) diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index 40559b69dd..f4cf6106bb 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -1730,6 +1730,10 @@ void StdViewScreenShot::activated(int iMsg) QString ext = QString::fromLatin1(hExt->GetASCII("OffscreenImageFormat").c_str()); int backtype = hExt->GetInt("OffscreenImageBackground",0); + Base::Reference methodGrp = App::GetApplication().GetParameterGroupByPath + ("User parameter:BaseApp/Preferences/View"); + QByteArray method = methodGrp->GetASCII("SavePicture").c_str(); + QStringList filter; QString selFilter; for (QStringList::Iterator it = formats.begin(); it != formats.end(); ++it) { @@ -1752,6 +1756,7 @@ void StdViewScreenShot::activated(int iMsg) SbVec2s sz = vp.getWindowSize(); opt->setImageSize((int)sz[0], (int)sz[1]); opt->setBackgroundType(backtype); + opt->setMethod(method); fd.setOptionsWidget(FileOptionsDialog::ExtensionRight, opt); fd.setConfirmOverwrite(true); @@ -1783,6 +1788,9 @@ void StdViewScreenShot::activated(int iMsg) hExt->SetASCII("OffscreenImageFormat", (const char*)format.toLatin1()); + method = opt->method(); + methodGrp->SetASCII("SavePicture", method.constData()); + // which background chosen const char* background; switch(opt->backgroundType()){ diff --git a/src/Gui/DlgSettingsImage.ui b/src/Gui/DlgSettingsImage.ui index 575fb71de4..d47dd263bd 100644 --- a/src/Gui/DlgSettingsImage.ui +++ b/src/Gui/DlgSettingsImage.ui @@ -1,68 +1,142 @@ - - - - + + Gui::Dialog::DlgSettingsImage - - + + 0 0 - 440 - 519 + 459 + 552 - + Image settings - - + + 9 - + + 9 + + + 9 + + + 9 + + 6 - - - - Image properties + + + + false - - + + Image comment + + + 9 - + + 9 + + + 9 + + + 9 + + 6 - - - + + + + Insert MIBA + + + true + + + + + + + false + + + + + + + Insert comment + + + + + + + Add watermark + + + + + + + + + + Image properties + + + + 9 + + + 9 + + + 9 + + + 9 + + + 6 + + + + Back&ground: - + comboBackground - - + + - + Current - + White - + Black - + Transparent @@ -71,32 +145,50 @@ - - - + + + Image dimensions - - + + 9 - + + 9 + + + 9 + + + 9 + + 6 - - - + + + 0 - + + 0 + + + 0 + + + 0 + + 6 - + - + Qt::Horizontal - + 40 20 @@ -104,175 +196,175 @@ - - - - 32767 - - + + + 1 + + 32767 + - - - - 32767 - - + + + 1 + + 32767 + - - - + + + Pixel - - - + + + &Width: - + spinWidth - - + + - + Current screen - + Icon 32 x 32 - + Icon 64 x 64 - + Icon 128 x 128 - + CGA 320 x 200 - + QVGA 320 x 240 - + VGA 640 x 480 - + NTSC 720 x 480 - + PAL 768 x 578 - + SVGA 800 x 600 - + XGA 1024 x 768 - + HD720 1280 x 720 - + SXGA 1280 x 1024 - + SXGA+ 1400 x 1050 - + UXGA 1600 x 1200 - + HD1080 1920 x 1080 - + WUXGA 1920 x 1200 - + QXGA 2048 x 1538 - + WQXGA 2560 x 1600 - + QSXGA 2560 x 2048 - + QUXGA 3200 × 2400 - + HUXGA 6400 × 4800 - + !!! 10000 x 10000 - - - + + + Standard sizes: - + - + Qt::Horizontal - + 40 20 @@ -280,19 +372,19 @@ - - - + + + Pixel - + - + Qt::Horizontal - + 40 20 @@ -300,69 +392,78 @@ - - - + + + &Height: - + spinHeight - - - - 0 - - + + + 6 + + 0 + + + 0 + + + 0 + + + 0 + - - + + Aspect ratio: - - + + &Screen - + Alt+S - - + + &4:3 - + Alt+4 - - + + 1&6:9 - + Alt+6 - - + + &1:1 - + Alt+1 @@ -372,58 +473,28 @@ - - - - false + + + + Method - - Image comment - - - - 9 - - - 6 - - - - - Insert MIBA - - - true + + + + + Creation method: - - - - false - - - - - - - Insert comment - - - - - - - Add watermark - - + + - + standardSizeBox spinWidth @@ -445,11 +516,11 @@ textEditComment setEnabled(bool) - + 35 262 - + 39 316 diff --git a/src/Gui/DlgSettingsImageImp.cpp b/src/Gui/DlgSettingsImageImp.cpp index 752fef12e7..72cb461fc7 100644 --- a/src/Gui/DlgSettingsImageImp.cpp +++ b/src/Gui/DlgSettingsImageImp.cpp @@ -46,6 +46,14 @@ DlgSettingsImageImp::DlgSettingsImageImp( QWidget* parent ) _width = width(); _height = height(); _fRatio = (float)_width/(float)_height; + + comboMethod->addItem(tr("Offscreen (New)"), QByteArray("QtOffscreenRenderer")); + comboMethod->addItem(tr("Offscreen (Old)"), QByteArray("CoinOffscreenRenderer")); + comboMethod->addItem(tr("Framebuffer (custom)"), QByteArray("FramebufferObject")); + comboMethod->addItem(tr("Framebuffer (as is)"), QByteArray("GrabFramebuffer")); +#if QT_VERSION < 0x050000 + comboMethod->addItem(tr("Pixel buffer"), QByteArray("PixelBuffer")); +#endif } /** @@ -221,4 +229,27 @@ void DlgSettingsImageImp::on_standardSizeBox_activated(int index) } } +void DlgSettingsImageImp::setMethod(const QByteArray& m) +{ + int index = comboMethod->findData(m); + if (index >= 0) + comboMethod->setCurrentIndex(index); +} + +QByteArray DlgSettingsImageImp::method() const +{ + return comboMethod->currentData().toByteArray(); +} + +void DlgSettingsImageImp::on_comboMethod_activated(int index) +{ + QByteArray data = comboMethod->itemData(index).toByteArray(); + if (data == QByteArray("GrabFramebuffer")) { + groupBoxProp->setEnabled(false); + } + else { + groupBoxProp->setEnabled(true); + } +} + #include "moc_DlgSettingsImageImp.cpp" diff --git a/src/Gui/DlgSettingsImageImp.h b/src/Gui/DlgSettingsImageImp.h index 8ba8dd3eb9..19df913daf 100644 --- a/src/Gui/DlgSettingsImageImp.h +++ b/src/Gui/DlgSettingsImageImp.h @@ -55,6 +55,8 @@ public: /** @name Image meta information */ //@{ + void setMethod(const QByteArray&); + QByteArray method() const; QString comment() const; int backgroundType() const; void setBackgroundType( int ); @@ -70,6 +72,7 @@ protected Q_SLOTS: void on_buttonRatio16x9_clicked(); void on_buttonRatio1x1_clicked(); void on_standardSizeBox_activated(int); + void on_comboMethod_activated(int); protected: // helper to force an aspect ratio