void GLESettings::writeAll() { // Store the application settings settingStore->setValue("application/position", position()); settingStore->setValue("application/size", size()); settingStore->setValue("application/mainstate", mainWindowState()); settingStore->setValue("application/drawingsize", drawingAreaSize()); settingStore->setValue("application/storeSize", storeSize()); settingStore->setValue("application/storeDirectory", storeDirectory()); settingStore->setValue("application/saveOnPreview", saveOnPreview()); settingStore->setValue("application/autoScaleOnOpen", autoScaleOnOpen()); settingStore->setValue("application/libGSLocation", getLibGSLocation()); settingStore->setValue("application/editorLocation", editorLocation()); settingStore->setValue("application/resolution", dpi()); settingStore->setValue("application/monitorOpenFile", monitorOpenFile()); settingStore->setValue("application/monitorAutoReload", monitorAutoReloadFile()); settingStore->setValue("application/askAboutKeepingObjects", askAboutObjects()); settingStore->setValue("application/splitterSizes", splitterPosition()); settingStore->setValue("application/consoleAutoShowSize", getConsoleWindowAutoShowSize()); settingStore->setValue("application/emulateGLEVersion", getEmulateGLEVersion()); settingStore->setValue("application/exportFormat", getExportFormat()); settingStore->setValue("application/exportPageSize", getExportPageSize()); settingStore->setValue("application/previewPageSize", getPreviewPageSize()); settingStore->setValue("application/openExportedFigure", isOpenExportedFigure()); settingStore->setValue("application/exportGrayScale", isExportGrayScale()); settingStore->setValue("application/exportTransparent", isExportTransparent()); settingStore->setValue("application/exportBitmapResolution", getExportBitmapResolution()); settingStore->setValue("application/exportVectorResolution", getExportVectorResolution()); settingStore->setValue("application/renderUsingCairo", isRenderUsingCairo()); if (storeDirectory()) settingStore->setValue("application/workingDirectory", pwd()); // Store the server settings settingStore->setValue("server/portNumber", port()); settingStore->setValue("server/autoStart", autoStartServer()); // Store the drawing settings settingStore->setValue("drawing/gridX", grid().x()); settingStore->setValue("drawing/gridY", grid().y()); settingStore->setValue("drawing/equalGrid", equalGrid()); settingStore->setValue("drawing/polarSnapStartAngle", polarSnapStartAngle()); settingStore->setValue("drawing/polarSnapIncAngle", polarSnapIncAngle()); settingStore->setValue("drawing/osnapOnStart", osnapOnStart()); settingStore->setValue("drawing/orthoSnapOnStart", orthoSnapOnStart()); settingStore->setValue("drawing/polarSnapOnStart", polarSnapOnStart()); settingStore->setValue("drawing/polarTrackOnStart", polarSnapOnStart()); settingStore->setValue("drawing/gridSnapOnStart", gridSnapOnStart()); }
void MainWindow2::exportImage() { QSettings settings( PENCIL2D, PENCIL2D ); // Get the camera layer Layer *cameraLayer = mEditor->layers()->currentLayer(); if (cameraLayer->type() != Layer::CAMERA) { QMessageBox::warning( this, tr( "Error" ), tr( "You must select a Camera Layer to export an image." ), QMessageBox::Ok, QMessageBox::Ok ); return;// false; } // Options auto dialog = new ExportImageSeqDialog( this ); OnScopeExit( dialog->deleteLater() ); dialog->setExportSize( mScribbleArea->getViewRect().toRect().size() ); dialog->exec(); QSize exportSize = dialog->getExportSize(); QString exportFormat = dialog->getExportFormat(); bool useTranparency = dialog->getTransparency(); if ( dialog->result() == QDialog::Rejected ) { return; // false; } // Path QString initPath = settings.value( "lastExportPath", QDir::homePath() + "/untitled.png" ).toString(); QFileInfo info( initPath ); initPath = info.path() + "/" + info.baseName() + "." + exportFormat.toLower(); QString filePath = QFileDialog::getSaveFileName( this, tr( "Save Image" ), initPath); if ( filePath.isEmpty() ) { qDebug() << "empty file"; return;// false; } settings.setValue( "lastExportPath", QVariant( filePath ) ); // Export QTransform view = RectMapTransform( mScribbleArea->getViewRect(), QRectF( QPointF( 0, 0 ), exportSize ) ); // view = mScribbleArea->getView() * view; int projectLength = mEditor->layers()->projectLength(); if ( !mEditor->object()->exportIm( mEditor->currentFrame(), projectLength, view, exportSize, filePath, exportFormat, true, useTranparency ) ) { QMessageBox::warning( this, tr( "Warning" ), tr( "Unable to export image." ), QMessageBox::Ok, QMessageBox::Ok ); return;// false; } return; // true; }