#include <qmenubar.h>
#include <qpopupmenu.h>
#include <qstatusbar.h>
-#include <qfiledialog.h>
#include <qapplication.h>
extern "C" CAF_EXPORT SUIT_Application* createApplication()
void CAF_Application::onHelpAbout()
{
SUIT_MessageBox::info1( desktop(), tr( "About" ), tr( "ABOUT_INFO" ), "&OK" );
-}
\ No newline at end of file
+}
#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>
delete [] imageBits;
- QString aFilter( "*.bmp\n*.png" );
+ SUIT_Application* app = getViewManager()->study()->application();
- QFileDialog aFileDlg( QDir::current().absPath(), aFilter, this );
- aFileDlg.setCaption( tr( "DUMP_VIEW_SAVE_FILE_DLG_CAPTION" ) );
- aFileDlg.setMode( QFileDialog::AnyFile );
+ QString aFileName = app->getFileName( false, QString::null, QString( "*.bmp;*.png" ), tr( "DUMP_VIEW_SAVE_FILE_DLG_CAPTION" ), 0 );
- 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" ) );
- }
+ if( aFileName.isEmpty() ) // cancelled
+ return;
- QString aSaveOp = "BMP";
- QString aTypedFileExt = QFileInfo( aFileName ).extension( false ).lower();
+ QString aSaveOp = SUIT_Tools::extension( aFileName ).upper();
- if( aFileExt == "*.bmp" )
- {
- if( aTypedFileExt.isEmpty() )
- aFileName += ".bmp";
- aSaveOp = "BMP";
+ if ( aSaveOp != "BMP" && aSaveOp != "PNG" ) {
+ SUIT_MessageBox::error1( this,
+ tr( "DUMP_VIEW_ERROR_DLG_CAPTION" ),
+ tr( "DUMP_VIEW_ERROR_UNSUPPORTED_FORMAT" ).arg( aSaveOp ),
+ tr( "BUT_OK" ) );
+ return;
}
- else if( aFileExt == "*.png" )
- if( aTypedFileExt.isEmpty() )
- aFileName += ".png";
- aSaveOp = "PNG";
if( !anImage.save( aFileName, aSaveOp ) )
{
msgstr "Change background..."
msgid "GLViewer_ViewFrame::DUMP_VIEW_SAVE_FILE_DLG_CAPTION"
-msgstr "Save Dump View in file"
+msgstr "Dump View"
msgid "GLViewer_ViewFrame::DUMP_VIEW_ERROR_DLG_CAPTION"
msgstr "Error"
msgid "GLViewer_ViewFrame::DUMP_VIEW_ERROR_DLG_TEXT"
-msgstr "Can't save Dump View in file"
+msgstr "Dump view operation failed."
+
+msgid "GLViewer_ViewFrame::DUMP_VIEW_ERROR_UNSUPPORTED_FORMAT"
+msgstr "Can't dump view. Unsupported image format: %1."
#include "SUIT_Tools.h"
#include "SUIT_ResourceMgr.h"
-#include "SUIT_FileDlg.h"
#include "SUIT_MessageBox.h"
#include <qptrlist.h>
#include <qcolor.h>
#include <qpainter.h>
#include <qapplication.h>
-
+#include <qdatetime.h>
const char* imageZoomCursor[] = {
"32 32 3 1",
QPixmap px = QPixmap::grabWindow(myViewPort->winId());
QApplication::restoreOverrideCursor();
- QString fileName = SUIT_FileDlg::getFileName(this,
- QString::null,
- tr("OCC_IMAGE_FILES"),
- tr("INF_APP_DUMP_VIEW"),
- false);
- if (!fileName.isNull()) {
+ SUIT_Application* app = getViewManager()->study()->application();
+
+ QString aFileName = app->getFileName( false, QString::null, tr("OCC_IMAGE_FILES"), tr("INF_APP_DUMP_VIEW"), 0 );
+
+ if ( !aFileName.isNull() ) {
QApplication::setOverrideCursor( Qt::waitCursor );
- QString fmt = SUIT_Tools::extension(fileName).upper();
+ QString fmt = SUIT_Tools::extension( aFileName ).upper();
if (fmt.isEmpty())
fmt = QString("BMP"); // default format
if (fmt == "JPG")
fmt = "JPEG";
- bool bOk = px.save(fileName, fmt.latin1());
+ bool bOk = px.save(aFileName, fmt.latin1());
QApplication::restoreOverrideCursor();
if (!bOk) {
SUIT_MessageBox::error1(this, tr("ERROR"), tr("ERR_DOC_CANT_SAVE_FILE"), tr("BUT_OK"));
#include "Plot2d_SetupViewDlg.h"
#include "SUIT_Tools.h"
-#include "SUIT_FileDlg.h"
#include "SUIT_Session.h"
#include "SUIT_MessageBox.h"
#include "SUIT_ResourceMgr.h"
+#include "SUIT_Application.h"
//#include "utilities.h"
QApplication::setOverrideCursor( Qt::waitCursor );
QPixmap px = QPixmap::grabWindow(winId());
QApplication::restoreOverrideCursor();
-
- QString fileName = SUIT_FileDlg::getFileName(this,
- QString::null,
- tr("OCC_IMAGE_FILES"),
- tr("INF_APP_DUMP_VIEW"),
- false);
- if ( !fileName.isNull() )
+
+ SUIT_Application* app = ((Plot2d_ViewWindow*)parent())->getViewManager()->study()->application();
+
+ QString aFileName = app->getFileName( false, QString::null, tr("PLOT2D_IMAGE_FILES"), tr("INF_APP_DUMP_VIEW"), 0 );
+
+ if ( !aFileName.isNull() )
{
QApplication::setOverrideCursor( Qt::waitCursor );
- QString fmt = SUIT_Tools::extension( fileName ).upper();
+ QString fmt = SUIT_Tools::extension( aFileName ).upper();
if (fmt.isEmpty())
fmt = QString("BMP"); // default format
if (fmt == "JPG")
fmt = "JPEG";
- bool bOk = px.save(fileName, fmt.latin1());
+ bool bOk = px.save(aFileName, fmt.latin1());
QApplication::restoreOverrideCursor();
if (!bOk) {
SUIT_MessageBox::error1(this, tr("ERROR"), tr("ERR_DOC_CANT_SAVE_FILE"), tr("BUT_OK"));
#msgid "INF_READY"
#msgstr "Ready"
-msgid "OCC_IMAGE_FILES"
+msgid "PLOT2D_IMAGE_FILES"
msgstr "Images Files (*.bmp *.png *.jpg *.jpeg)"
msgid "INF_APP_DUMP_VIEW"
#include "SUIT_Tools.h"
#include "SUIT_ResourceMgr.h"
-#include "SUIT_FileDlg.h"
#include "VTKViewer_Transform.h"
#include "VTKViewer_Utilities.h"
QPixmap px = QPixmap::grabWindow(myRenderWindow->winId());
QApplication::restoreOverrideCursor();
- QString fileName = SUIT_FileDlg::getFileName(this,
- QString::null,
- tr("VTK_IMAGE_FILES"),
- tr("INF_APP_DUMP_VIEW"),
- false);
- if (!fileName.isNull()) {
+ SUIT_Application* app = getViewManager()->study()->application();
+
+ QString aFileName = app->getFileName( false, QString::null, tr("VTK_IMAGE_FILES"), tr("INF_APP_DUMP_VIEW"), 0 );
+
+ if ( !aFileName.isNull() ) {
QApplication::setOverrideCursor( Qt::waitCursor );
- QString fmt = SUIT_Tools::extension( fileName ).upper();
+ QString fmt = SUIT_Tools::extension( aFileName ).upper();
if (fmt.isEmpty())
fmt = QString("BMP"); // default format
if (fmt == "JPG")
fmt = "JPEG";
- bool bOk = px.save(fileName, fmt.latin1());
+ bool bOk = px.save(aFileName, fmt.latin1());
QApplication::restoreOverrideCursor();
if (!bOk) {
SUIT_MessageBox::error1(this, tr("ERROR"), tr("ERR_DOC_CANT_SAVE_FILE"), tr("BUT_OK"));
#include "SUIT_Application.h"
#include "SUIT_Desktop.h"
-#include "SUIT_FileDlg.h"
#include "SUIT_MessageBox.h"
#include "SUIT_Tools.h"
#include "SUIT_Session.h"
#include <qstringlist.h>
#include <qregexp.h>
#include <qvalidator.h>
+#include <qfile.h>
#include <OSD_Process.hxx>
#include <OSD_Path.hxx>
{
QPushButton* send = (QPushButton*)sender();
- QWidget* aParent = SUIT_Session::session()->activeApplication()->desktop();
+ SUIT_Application* app = SUIT_Session::session()->activeApplication();
if ( send == myBrowseIdlBtn ) {
- QString file = myIdlEdit->text().stripWhiteSpace();
- file = SUIT_FileDlg::getFileName(aParent,
- file,
- tr("TOOLS_MEN_IMPORT_IDL"),
- tr("TOOLS_MEN_IMPORT"),
- true);
+ QString file = app->getFileName( true, myIdlEdit->text().stripWhiteSpace(), tr("TOOLS_MEN_IMPORT_IDL"), tr("TOOLS_MEN_IMPORT"), 0 );
if ( !file.isEmpty() ) {
myIdlEdit->setText(file);
}
}
else if ( send == myBrowseXmlBtn ) {
- QString file = SUIT_FileDlg::getFileName(aParent,
- myXmlEdit->text().stripWhiteSpace(),
- tr("TOOLS_MEN_EXPORT_XML"),
- tr("TOOLS_MEN_EXPORT"),
- false);
+ QString file = app->getFileName( false, myXmlEdit->text().stripWhiteSpace(), tr("TOOLS_MEN_EXPORT_XML"), tr("TOOLS_MEN_EXPORT"), 0 );
if ( !file.isEmpty() ) {
myXmlEdit->setText(file);
}
} else if ( send == myBrowsePngBtn ) {
- QString file = SUIT_FileDlg::getFileName(aParent,
- myXmlEdit->text().stripWhiteSpace(),
- tr("TOOLS_MEN_IMPORT_PNG"),
- tr("TOOLS_MEN_IMPORT"),
- true);
+ QString file = app->getFileName( true, myPngEdit->text().stripWhiteSpace(), tr("TOOLS_MEN_IMPORT_PNG"), tr("TOOLS_MEN_IMPORT"), 0 );
if ( !file.isEmpty() ) {
myPngEdit->setText(file);
#include "SUIT_Tools.h"
#include "SUIT_ResourceMgr.h"
-#include "SUIT_FileDlg.h"
#include <qapplication.h>
QApplication::setOverrideCursor( Qt::waitCursor );
QPixmap px = QPixmap::grabWindow(myRenderWindow->winId());
QApplication::restoreOverrideCursor();
-
- QString fileName = SUIT_FileDlg::getFileName(this,
- QString::null,
- tr("VTK_IMAGE_FILES"),
- tr("INF_APP_DUMP_VIEW"),
- false);
- if (!fileName.isNull()) {
+
+ SUIT_Application* app = getViewManager()->study()->application();
+
+ QString aFileName = app->getFileName( false, QString::null, tr("VTK_IMAGE_FILES"), tr("INF_APP_DUMP_VIEW"), 0 );
+
+ if ( !aFileName.isNull() ) {
QApplication::setOverrideCursor( Qt::waitCursor );
- QString fmt = SUIT_Tools::extension( fileName ).upper();
+ QString fmt = SUIT_Tools::extension( aFileName ).upper();
if (fmt.isEmpty())
fmt = QString("BMP"); // default format
if (fmt == "JPG")
fmt = "JPEG";
- bool bOk = px.save(fileName, fmt.latin1());
+ bool bOk = px.save(aFileName, fmt.latin1());
QApplication::restoreOverrideCursor();
if (!bOk) {
SUIT_MessageBox::error1(this, tr("ERROR"), tr("ERR_DOC_CANT_SAVE_FILE"), tr("BUT_OK"));