#include "GLViewer_ViewPort2d.h"
#include <SUIT_Desktop.h>
+#include <SUIT_Application.h>
#include <SUIT_Session.h>
#include <SUIT_ToolButton.h>
#include <SUIT_ResourceMgr.h>
+#include <SUIT_Tools.h>
#include <QtxAction.h>
#include <SUIT_MessageBox.h>
#include <qcolor.h>
-#include <qfiledialog.h>
#include <qimage.h>
#include <qlayout.h>
#include <qstring.h>
aAction = new QtxAction(tr("MNU_DUMP_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_DUMP" ) ),
tr( "MNU_DUMP_VIEW" ), 0, this);
aAction->setStatusTip(tr("DSC_DUMP_VIEW"));
- connect(aAction, SIGNAL(activated()), this, SLOT(onViewDump()));
+ connect(aAction, SIGNAL(activated()), this, SLOT(onDumpView()));
myActionsMap[ DumpId ] = aAction;
// FitAll
{
}
-void GLViewer_ViewFrame::onViewDump()
+QImage GLViewer_ViewFrame::dumpView()
{
GLViewer_Widget* aWidget = ((GLViewer_ViewPort2d*)myVP)->getGLWidget();
int width, height;
}
delete [] imageBits;
-
- QString aFilter( "*.bmp\n*.png" );
-
- QFileDialog aFileDlg( QDir::current().absPath(), aFilter, this );
- aFileDlg.setCaption( tr( "DUMP_VIEW_SAVE_FILE_DLG_CAPTION" ) );
- aFileDlg.setMode( QFileDialog::AnyFile );
-
- if( !aFileDlg.exec() )
- return;
-
- QString aFileName = aFileDlg.selectedFile();
- QString aFileExt = aFileDlg.selectedFilter();
-
- if( aFileName.isEmpty() )
- {
- SUIT_MessageBox::error1( this,
- tr( "DUMP_VIEW_ERROR_DLG_CAPTION" ),
- tr( "DUMP_VIEW_ERROR_DLG_TEXT" ),
- tr( "BUT_OK" ) );
- }
-
- QString aSaveOp = "BMP";
- QString aTypedFileExt = QFileInfo( aFileName ).extension( false ).lower();
-
- if( aFileExt == "*.bmp" )
- {
- if( aTypedFileExt.isEmpty() )
- aFileName += ".bmp";
- aSaveOp = "BMP";
- }
- else if( aFileExt == "*.png" )
- if( aTypedFileExt.isEmpty() )
- aFileName += ".png";
- aSaveOp = "PNG";
-
- if( !anImage.save( aFileName, aSaveOp ) )
- {
- SUIT_MessageBox::error1( this,
- tr( "DUMP_VIEW_ERROR_DLG_CAPTION" ),
- tr( "DUMP_VIEW_ERROR_DLG_TEXT" ),
- tr( "BUT_OK" ) );
- }
+ return anImage;
}
void GLViewer_ViewFrame::onViewPan()
break;
}
}
+