lib_LTLIBRARIES = libstd.la
-salomeinclude_HEADERS= \
- STD_Application.h \
- STD.h \
- STD_MDIDesktop.h \
- STD_SDIDesktop.h \
- STD_TabDesktop.h \
- STD_CloseDlg.h \
+#VSR: already migrated to Qt4 files
+salomeinclude_HEADERS= \
+ STD.h \
+ STD_Application.h \
+ STD_CloseDlg.h \
+ STD_MDIDesktop.h \
+ STD_SDIDesktop.h \
+ STD_TabDesktop.h
+
+#VSR: not yet migrated to Qt4 files
+# \
STD_LoadStudiesDlg.h
-dist_libstd_la_SOURCES=\
- STD_Application.cxx \
- STD_MDIDesktop.cxx \
- STD_SDIDesktop.cxx \
- STD_TabDesktop.cxx \
- STD_CloseDlg.cxx \
+#VSR: already migrated to Qt4 files
+dist_libstd_la_SOURCES= \
+ STD_Application.cxx \
+ STD_CloseDlg.cxx \
+ STD_MDIDesktop.cxx \
+ STD_SDIDesktop.cxx \
+ STD_TabDesktop.cxx
+
+#VSR: not yet migrated to Qt4 files
+# \
STD_LoadStudiesDlg.cxx
-MOC_FILES= \
- STD_Application_moc.cxx \
- STD_MDIDesktop_moc.cxx \
- STD_SDIDesktop_moc.cxx \
- STD_TabDesktop_moc.cxx \
- STD_CloseDlg_moc.cxx \
+#VSR: already migrated to Qt4 files
+MOC_FILES= \
+ STD_Application_moc.cxx \
+ STD_CloseDlg_moc.cxx \
+ STD_MDIDesktop_moc.cxx \
+ STD_SDIDesktop_moc.cxx \
+ STD_TabDesktop_moc.cxx
+
+#VSR: not yet migrated to Qt4 files
+# \
STD_LoadStudiesDlg_moc.cxx
+
nodist_libstd_la_SOURCES= $(MOC_FILES)
-dist_salomeres_DATA=\
- resources/config \
- resources/cut.png \
- resources/copy.png \
- resources/close.png \
- resources/cursor_rotate.png \
- resources/cursor_zoom.png \
- resources/help.png \
- resources/new.png \
- resources/open.png \
- resources/print.png \
- resources/paste.png \
- resources/redo.png \
- resources/reset.png \
- resources/save.png \
- resources/undo_arrow.png \
- resources/undo.png \
+dist_salomeres_DATA= \
+ resources/config \
+ resources/cut.png \
+ resources/copy.png \
+ resources/close.png \
+ resources/cursor_rotate.png \
+ resources/cursor_zoom.png \
+ resources/help.png \
+ resources/new.png \
+ resources/open.png \
+ resources/print.png \
+ resources/paste.png \
+ resources/redo.png \
+ resources/reset.png \
+ resources/save.png \
+ resources/undo_arrow.png \
+ resources/undo.png \
resources/std.ini
-nodist_salomeres_DATA=\
- STD_images.qm \
+nodist_salomeres_DATA= \
+ STD_images.qm \
STD_msg_en.qm
libstd_la_CPPFLAGS=$(QT_INCLUDES) -I$(srcdir)/../SUIT -I$(srcdir)/../Qtx
libstd_la_LDFLAGS=$(QT_MT_LIBS)
-libstd_la_LIBADD=../SUIT/libsuit.la
+libstd_la_LIBADD=../Qtx/libqtx.la ../SUIT/libsuit.la
#define STD_H
#if defined STD_EXPORTS
-#if defined WNT
+#if defined WIN32
#define STD_EXPORT __declspec( dllexport )
#else
#define STD_EXPORT
#endif
#else
-#if defined WNT
+#if defined WIN32
#define STD_EXPORT __declspec( dllimport )
#else
#define STD_EXPORT
#define true 1
#endif
-#if defined WNT
+#if defined WIN32
#pragma warning ( disable: 4251 )
#endif
--- /dev/null
+TEMPLATE = lib
+TARGET = std
+DESTDIR = ../../lib
+MOC_DIR = ../../moc
+OBJECTS_DIR = ../../obj/$$TARGET
+
+INCLUDEPATH += ../../include ../Qtx ../SUIT
+LIBS += -L../../lib -lqtx -lsuit
+
+CONFIG -= debug release debug_and_release
+CONFIG += qt thread debug dll shared
+
+win32:DEFINES += WIN32
+DEFINES += STD_EXPORTS
+
+HEADERS = STD.h
+HEADERS += STD_Application.h
+HEADERS += STD_CloseDlg.h
+HEADERS += STD_MDIDesktop.h
+HEADERS += STD_SDIDesktop.h
+HEADERS += STD_TabDesktop.h
+#SOURCES += STD_LoadStudiesDlg.h
+
+SOURCES = STD_Application.cxx
+SOURCES += STD_CloseDlg.cxx
+SOURCES += STD_MDIDesktop.cxx
+SOURCES += STD_SDIDesktop.cxx
+SOURCES += STD_TabDesktop.cxx
+#SOURCES += STD_LoadStudiesDlg.cxx
+
+TRANSLATIONS = resources/STD_images.ts \
+ resources/STD_msg_en.ts
+
+ICONS = resources/*.png
+
+includes.files = $$HEADERS
+includes.path = ../../include
+
+resources.files = $$ICONS resources/*.qm resources/*.xml resources/*.ini
+resources.path = ../../resources
+
+INSTALLS += includes resources
#include <SUIT_Tools.h>
#include <SUIT_Desktop.h>
#include <SUIT_Session.h>
-#include <SUIT_ViewModel.h>
-#include <SUIT_Operation.h>
+#include <SUIT_Study.h>
+//#include <SUIT_ViewModel.h>
+#include <SUIT_ViewManager.h>
+//#include <SUIT_Operation.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <QtxDockAction.h>
#include <QtxActionMenuMgr.h>
#include <QtxActionToolMgr.h>
-#include <QtxPopupMenu.h>
-#include <qmenubar.h>
-#include <qtoolbar.h>
-#include <qpopupmenu.h>
-#include <qstatusbar.h>
-#include <qfiledialog.h>
-#include <qapplication.h>
+#include <QMenu>
+#include <QFileDialog>
+#include <QApplication>
+#include <QCloseEvent>
+#include <QStatusBar>
#include <iostream>
/*!Constructor.*/
STD_Application::STD_Application()
: SUIT_Application(),
-myEditEnabled( true ),
-myActiveViewMgr( 0 )
+ myActiveViewMgr( 0 ),
+ myExitConfirm( true ),
+ myEditEnabled( true )
{
- STD_MDIDesktop* desk = new STD_MDIDesktop();
-
- setDesktop( desk );
+ setDesktop( new STD_MDIDesktop() );
}
/*!Destructor.*/
clearViewManagers();
}
+/*! \retval requirement of exit confirmation*/
+bool STD_Application::exitConfirmation() const
+{
+ return myExitConfirm;
+}
+
+/*! Set the requirement of exit confirmation*/
+void STD_Application::setExitConfirmation( const bool on )
+{
+ myExitConfirm = on;
+}
+
/*! \retval QString "StdApplication"*/
QString STD_Application::applicationName() const
{
savePreferences();
SUIT_Study* study = activeStudy();
- if ( study ){
+ if ( study )
+ {
+ beforeCloseDoc( study );
+
study->closeDocument();
setActiveStudy( 0 );
delete study;
+
+ afterCloseDoc();
}
setDesktop( 0 );
-
+
SUIT_Application::closeApplication();
}
createAction( FileNewId, tr( "TOT_DESK_FILE_NEW" ),
resMgr->loadPixmap( "STD", tr( "ICON_FILE_NEW" ) ),
tr( "MEN_DESK_FILE_NEW" ), tr( "PRP_DESK_FILE_NEW" ),
- CTRL+Key_N, desk, false, this, SLOT( onNewDoc() ) );
+ Qt::CTRL+Qt::Key_N, desk, false, this, SLOT( onNewDoc() ) );
createAction( FileOpenId, tr( "TOT_DESK_FILE_OPEN" ),
resMgr->loadPixmap( "STD", tr( "ICON_FILE_OPEN" ) ),
tr( "MEN_DESK_FILE_OPEN" ), tr( "PRP_DESK_FILE_OPEN" ),
- CTRL+Key_O, desk, false, this, SLOT( onOpenDoc() ) );
+ Qt::CTRL+Qt::Key_O, desk, false, this, SLOT( onOpenDoc() ) );
createAction( FileCloseId, tr( "TOT_DESK_FILE_CLOSE" ),
resMgr->loadPixmap( "STD", tr( "ICON_FILE_CLOSE" ) ),
tr( "MEN_DESK_FILE_CLOSE" ), tr( "PRP_DESK_FILE_CLOSE" ),
- CTRL+Key_W, desk, false, this, SLOT( onCloseDoc() ) );
+ Qt::CTRL+Qt::Key_W, desk, false, this, SLOT( onCloseDoc() ) );
- createAction( FileExitId, tr( "TOT_DESK_FILE_EXIT" ), QIconSet(),
+ createAction( FileExitId, tr( "TOT_DESK_FILE_EXIT" ), QIcon(),
tr( "MEN_DESK_FILE_EXIT" ), tr( "PRP_DESK_FILE_EXIT" ),
- CTRL+Key_Q, desk, false, this, SLOT( onExit() ) );
+ Qt::CTRL+Qt::Key_Q, desk, false, this, SLOT( onExit() ) );
createAction( FileSaveId, tr( "TOT_DESK_FILE_SAVE" ),
resMgr->loadPixmap( "STD", tr( "ICON_FILE_SAVE" ) ),
tr( "MEN_DESK_FILE_SAVE" ), tr( "PRP_DESK_FILE_SAVE" ),
- CTRL+Key_S, desk, false, this, SLOT( onSaveDoc() ) );
+ Qt::CTRL+Qt::Key_S, desk, false, this, SLOT( onSaveDoc() ) );
- createAction( FileSaveAsId, tr( "TOT_DESK_FILE_SAVEAS" ), QIconSet(),
+ createAction( FileSaveAsId, tr( "TOT_DESK_FILE_SAVEAS" ), QIcon(),
tr( "MEN_DESK_FILE_SAVEAS" ), tr( "PRP_DESK_FILE_SAVEAS" ),
- CTRL+Key_A, desk, false, this, SLOT( onSaveAsDoc() ) );
+ Qt::CTRL+Qt::Key_A, desk, false, this, SLOT( onSaveAsDoc() ) );
createAction( EditCopyId, tr( "TOT_DESK_EDIT_COPY" ),
resMgr->loadPixmap( "STD", tr( "ICON_EDIT_COPY" ) ),
tr( "MEN_DESK_EDIT_COPY" ), tr( "PRP_DESK_EDIT_COPY" ),
- CTRL+Key_C, desk, false, this, SLOT( onCopy() ) );
+ Qt::CTRL+Qt::Key_C, desk, false, this, SLOT( onCopy() ) );
createAction( EditPasteId, tr( "TOT_DESK_EDIT_PASTE" ),
resMgr->loadPixmap( "STD", tr( "ICON_EDIT_PASTE" ) ),
tr( "MEN_DESK_EDIT_PASTE" ), tr( "PRP_DESK_EDIT_PASTE" ),
- CTRL+Key_V, desk, false, this, SLOT( onPaste() ) );
+ Qt::CTRL+Qt::Key_V, desk, false, this, SLOT( onPaste() ) );
QAction* a = createAction( ViewStatusBarId, tr( "TOT_DESK_VIEW_STATUSBAR" ),
- QIconSet(), tr( "MEN_DESK_VIEW_STATUSBAR" ),
- tr( "PRP_DESK_VIEW_STATUSBAR" ), SHIFT+Key_S, desk, true );
- a->setOn( desk->statusBar()->isVisibleTo( desk ) );
+ QIcon(), tr( "MEN_DESK_VIEW_STATUSBAR" ),
+ tr( "PRP_DESK_VIEW_STATUSBAR" ), Qt::SHIFT+Qt::Key_S, desk, true );
+ a->setChecked( desk->statusBar()->isVisibleTo( desk ) );
connect( a, SIGNAL( toggled( bool ) ), this, SLOT( onViewStatusBar( bool ) ) );
- createAction( NewWindowId, tr( "TOT_DESK_NEWWINDOW" ), QIconSet(),
+ createAction( NewWindowId, tr( "TOT_DESK_NEWWINDOW" ), QIcon(),
tr( "MEN_DESK_NEWWINDOW" ), tr( "PRP_DESK_NEWWINDOW" ), 0, desk );
- createAction( HelpAboutId, tr( "TOT_DESK_HELP_ABOUT" ), QIconSet(),
+ createAction( HelpAboutId, tr( "TOT_DESK_HELP_ABOUT" ), QIcon(),
tr( "MEN_DESK_HELP_ABOUT" ), tr( "PRP_DESK_HELP_ABOUT" ),
- SHIFT+Key_A, desk, false, this, SLOT( onHelpAbout() ) );
+ Qt::SHIFT+Qt::Key_A, desk, false, this, SLOT( onHelpAbout() ) );
+
- QtxDockAction* da = new QtxDockAction( tr( "TOT_DOCK_WINDOWS" ), tr( "MEN_DOCK_WINDOWS" ), desk );
- registerAction( ViewWindowsId, da );
- da->setAutoPlace( false );
+ QtxDockAction* dwa = new QtxDockAction( tr( "TOT_DOCKWINDOWS" ), tr( "MEN_DOCKWINDOWS" ), desk );
+ dwa->setDockType( QtxDockAction::DockWidget );
+ registerAction( ViewWindowsId, dwa );
+
+ QtxDockAction* tba = new QtxDockAction( tr( "TOT_TOOLBARS" ), tr( "MEN_TOOLBARS" ), desk );
+ tba->setDockType( QtxDockAction::ToolBar );
+ registerAction( ViewToolBarsId, tba );
// Create menus
createMenu( EditPasteId, editMenu );
createMenu( separator(), editMenu );
+ createMenu( ViewToolBarsId, viewMenu, 0 );
createMenu( ViewWindowsId, viewMenu, 0 );
createMenu( separator(), viewMenu, -1, 10 );
createMenu( ViewStatusBarId, viewMenu, 10 );
/*!Opens new application*/
void STD_Application::onNewDoc()
{
- QApplication::setOverrideCursor( Qt::waitCursor );
+ onNewDoc( QString() );
+}
+/*!Opens new application*/
+bool STD_Application::onNewDoc( const QString& name )
+{
+ QApplication::setOverrideCursor( Qt::WaitCursor );
+
+ bool res = true;
if ( !activeStudy() )
{
createEmptyStudy();
- activeStudy()->createDocument();
- studyCreated( activeStudy() );
+ res = activeStudy()->createDocument( name );
+ if ( res )
+ studyCreated( activeStudy() );
+ else
+ {
+ delete activeStudy();
+ setActiveStudy( 0 );
+ }
}
else
{
SUIT_Application* aApp = startApplication( 0, 0 );
if ( aApp->inherits( "STD_Application" ) )
- ((STD_Application*)aApp)->onNewDoc();
+ res = ((STD_Application*)aApp)->onNewDoc( name );
else
{
aApp->createEmptyStudy();
- aApp->activeStudy()->createDocument();
+ res = aApp->activeStudy()->createDocument( name );
}
+ if ( !res )
+ aApp->closeApplication();
}
QApplication::restoreOverrideCursor();
+
+ return res;
}
/*!Put file name from file dialog to onOpenDoc(const QString&) function*/
/*! \retval true, if document was opened successful, else false.*/
bool STD_Application::onOpenDoc( const QString& aName )
{
- QApplication::setOverrideCursor( Qt::waitCursor );
+ QApplication::setOverrideCursor( Qt::WaitCursor );
bool res = true;
if ( !activeStudy() )
{
// if study exists - open in new desktop. Check: is the same file is opened?
SUIT_Session* aSession = SUIT_Session::session();
- QPtrList<SUIT_Application> aAppList = aSession->applications();
+ QList<SUIT_Application*> aAppList = aSession->applications();
bool isAlreadyOpen = false;
SUIT_Application* aApp = 0;
- for ( QPtrListIterator<SUIT_Application> it( aAppList ); it.current() && !isAlreadyOpen; ++it )
+ for ( QList<SUIT_Application*>::iterator it = aAppList.begin(); it != aAppList.end() && !isAlreadyOpen; ++it )
{
- aApp = it.current();
+ aApp = *it;
if ( aApp->activeStudy()->studyName() == aName )
isAlreadyOpen = true;
}
aApp->closeApplication();
}
else
- aApp->desktop()->setActiveWindow();
+ aApp->desktop()->activateWindow();
}
QApplication::restoreOverrideCursor();
{
// if study exists - load in new desktop. Check: is the same file is loaded?
SUIT_Session* aSession = SUIT_Session::session();
- QPtrList<SUIT_Application> aAppList = aSession->applications();
+ QList<SUIT_Application*> aAppList = aSession->applications();
bool isAlreadyOpen = false;
SUIT_Application* aApp = 0;
- for ( QPtrListIterator<SUIT_Application> it( aAppList ); it.current() && !isAlreadyOpen; ++it )
+ for ( QList<SUIT_Application*>::iterator it = aAppList.begin(); it != aAppList.end() && !isAlreadyOpen; ++it )
{
- aApp = it.current();
+ aApp = *it;
if ( aApp->activeStudy()->studyName() == aName )
isAlreadyOpen = true;
}
res = aApp->useStudy( aName );
}
else
- aApp->desktop()->setActiveWindow();
+ aApp->desktop()->activateWindow();
}
return res;
}
delete study;
int aNbStudies = 0;
- QPtrList<SUIT_Application> apps = SUIT_Session::session()->applications();
- for ( unsigned i = 0; i < apps.count(); i++ )
+ QList<SUIT_Application*> apps = SUIT_Session::session()->applications();
+ for ( int i = 0; i < apps.count(); i++ )
aNbStudies += apps.at( i )->getNbStudies();
// STV: aNbStudies - number of currently existing studies (exclude currently closed)
activeStudy()->abortAllOperations();
if ( activeStudy()->isModified() )
{
- QString sName = activeStudy()->studyName().stripWhiteSpace();
+ QString sName = activeStudy()->studyName().trimmed();
QString msg = sName.isEmpty() ? tr( "INF_DOC_MODIFIED" ) : tr ( "INF_DOCUMENT_MODIFIED" ).arg( sName );
//SRN: BugID: IPAL9021: Begin
{
putInfo( tr( "INF_DOC_SAVING" ) + activeStudy()->studyName() );
- QApplication::setOverrideCursor( Qt::waitCursor );
+ QApplication::setOverrideCursor( Qt::WaitCursor );
isOk = activeStudy()->saveDocument();
if ( aName.isNull() )
return false;
- QApplication::setOverrideCursor( Qt::waitCursor );
+ QApplication::setOverrideCursor( Qt::WaitCursor );
putInfo( tr( "INF_DOC_SAVING" ) + aName );
isOk = study->saveDocumentAs( aName );
/*!Closing session.*/
void STD_Application::onExit()
{
- int aAnswer = SUIT_MessageBox::info2( desktop(), tr( "INF_DESK_EXIT" ), tr( "QUE_DESK_EXIT" ),
- tr( "BUT_OK" ), tr( "BUT_CANCEL" ), 1, 2, 2 );
+ int aAnswer = 1;
+ if ( exitConfirmation() )
+ aAnswer = SUIT_MessageBox::info2( desktop(), tr( "INF_DESK_EXIT" ), tr( "QUE_DESK_EXIT" ),
+ tr( "BUT_OK" ), tr( "BUT_CANCEL" ), 1, 2, 2 );
if ( aAnswer == 1 )
SUIT_Session::session()->closeSession();
}
if ( activeStudy() )
{
- QString sName = SUIT_Tools::file( activeStudy()->studyName().stripWhiteSpace(), false );
+ QString sName = SUIT_Tools::file( activeStudy()->studyName().trimmed(), false );
if ( !sName.isEmpty() )
aTitle += QString( " - [%1]" ).arg( sName );
}
- desktop()->setCaption( aTitle );
+ desktop()->setWindowTitle( aTitle );
}
/*!Update commands status.*/
SUIT_ViewManager* STD_Application::viewManager( const QString& vmType ) const
{
SUIT_ViewManager* vm = 0;
- for ( QPtrListIterator<SUIT_ViewManager> it( myViewMgrs ); it.current() && !vm; ++it )
+ for ( QList<SUIT_ViewManager*>::const_iterator it = myViewMgrs.begin(); it != myViewMgrs.end() && !vm; ++it )
{
- if ( it.current()->getType() == vmType )
- vm = it.current();
+ if ( (*it)->getType() == vmType )
+ vm = *it;
}
return vm;
}
*/
void STD_Application::viewManagers( const QString& vmType, ViewManagerList& lst ) const
{
- for ( QPtrListIterator<SUIT_ViewManager> it( myViewMgrs ); it.current(); ++it )
- if ( it.current()->getType() == vmType )
- lst.append( it.current() );
+ for ( QList<SUIT_ViewManager*>::const_iterator it = myViewMgrs.begin(); it != myViewMgrs.end(); ++it )
+ {
+ if ( (*it)->getType() == vmType )
+ lst.append( *it );
+ }
}
/*!\param lst - output list of all view managers.*/
void STD_Application::viewManagers( ViewManagerList& lst ) const
{
- for ( QPtrListIterator<SUIT_ViewManager> it( myViewMgrs ); it.current(); ++it )
- lst.append( it.current() );
+ for ( QList<SUIT_ViewManager*>::const_iterator it = myViewMgrs.begin(); it != myViewMgrs.end(); ++it )
+ lst.append( *it );
}
/*!\retval ViewManagerList - const list of all view managers.*/
vm->disconnectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
disconnect( vm, SIGNAL( activated( SUIT_ViewManager* ) ),
this, SLOT( onViewManagerActivated( SUIT_ViewManager* ) ) );
- myViewMgrs.removeRef( vm );
+ myViewMgrs.removeAll( vm );
if ( myActiveViewMgr == vm )
myActiveViewMgr = 0;
ViewManagerList lst;
viewManagers( lst );
- for ( QPtrListIterator<SUIT_ViewManager> it( lst ); it.current(); ++it ) {
- QGuardedPtr<SUIT_ViewManager> vm = it.current();
+ for ( QList<SUIT_ViewManager*>::iterator it = lst.begin(); it != lst.end(); ++it )
+ {
+ QPointer<SUIT_ViewManager> vm = *it;
removeViewManager( vm );
delete vm;
}
/*!\retval TRUE, if view manager \a vm, already in view manager list (\a myViewMgrs).*/
bool STD_Application::containsViewManager( SUIT_ViewManager* vm ) const
{
- return myViewMgrs.contains( vm ) > 0;
+ return myViewMgrs.contains( vm );
}
/*!Private slot, sets active manager to \vm, if \vm in view managers list.*/
void STD_Application::createEmptyStudy()
{
SUIT_Application::createEmptyStudy();
-
- SUIT_ViewManager* vm = new SUIT_ViewManager( activeStudy(), desktop(), new SUIT_ViewModel() );
-
- addViewManager( vm );
}
/*!Sets active manager to \vm, if \vm in view managers list.*/
/*!Public slot. */
void STD_Application::onConnectPopupRequest( SUIT_PopupClient* client, QContextMenuEvent* e )
{
- QtxPopupMenu* popup = new QtxPopupMenu();
+ QMenu* popup = new QMenu();
// fill popup by own items
QString title;
contextMenuPopup( client->popupClientType(), popup, title );
- popup->setTitleText( title );
+ popup->setTitle( title );
- popup->insertSeparator();
+ popup->addSeparator();
// add items from popup client
client->contextMenuPopup( popup );
SUIT_Tools::simplifySeparators( popup );
- if ( popup->count() )
+ if ( !popup->actions().isEmpty() )
popup->exec( e->globalPos() );
delete popup;
}
-#include <qregexp.h>
-
/*!\retval QString - return file name from dialog.*/
QString STD_Application::getFileName( bool open, const QString& initial, const QString& filters,
const QString& caption, QWidget* parent )
if ( !parent )
parent = desktop();
if ( open )
- {
- return QFileDialog::getOpenFileName( initial, filters, parent, 0, caption );
- }
+ return QFileDialog::getOpenFileName( parent, caption, initial, filters );
else
{
QString aName;
while ( !isOk )
{
// It is preferrable to use OS-specific file dialog box here !!!
- aName = QFileDialog::getSaveFileName( anOldPath, filters, parent, 0, caption, &aUsedFilter );
+ aName = QFileDialog::getSaveFileName( parent, caption, anOldPath, filters, &aUsedFilter );
if ( aName.isNull() )
isOk = true;
else
{
- int aEnd = aUsedFilter.findRev( ')' );
- int aStart = aUsedFilter.findRev( '(', aEnd );
+ int aEnd = aUsedFilter.lastIndexOf( ')' );
+ int aStart = aUsedFilter.lastIndexOf( '(', aEnd );
QString wcStr = aUsedFilter.mid( aStart + 1, aEnd - aStart - 1 );
int idx = 0;
QStringList extList;
QRegExp rx( "[\b\\*]*\\.([\\w]+)" );
- while ( ( idx = rx.search( wcStr, idx ) ) != -1 )
+ while ( ( idx = rx.indexIn( wcStr, idx ) ) != -1 )
{
extList.append( rx.cap( 1 ) );
idx += rx.matchedLength();
}
- if ( !extList.isEmpty() && !extList.contains( QFileInfo( aName ).extension() ) )
+ if ( !extList.isEmpty() && !extList.contains( SUIT_Tools::extension( aName ) ) )
aName += QString( ".%1" ).arg( extList.first() );
if ( QFileInfo( aName ).exists() )
{
if ( !parent )
parent = desktop();
- return QFileDialog::getExistingDirectory( initial, parent, 0, caption, true );
+
+ return QFileDialog::getExistingDirectory( parent, caption, initial );
}
/*!
#include <SUIT_Application.h>
-#include <SUIT_Desktop.h>
-#include <SUIT_ViewManager.h>
+#include <QList>
-#include <qmap.h>
-#include <qptrlist.h>
+class QMenu;
+class QCloseEvent;
+class QContextMenuEvent;
class QToolBar;
class QtxAction;
-class QPopupMenu;
class SUIT_Operation;
class SUIT_ViewWindow;
class SUIT_ToolWindow;
+class SUIT_Desktop;
+class SUIT_ViewManager;
+class SUIT_PopupClient;
-typedef QPtrList<SUIT_ViewManager> ViewManagerList;
+typedef QList<SUIT_ViewManager*> ViewManagerList;
#if defined WIN32
#pragma warning( disable: 4251 )
{
Q_OBJECT
+public:
+ enum { FileNewId, FileOpenId, FileCloseId, FileSaveId, FileSaveAsId, FileExitId,
+ ViewWindowsId, ViewToolBarsId, ViewStatusBarId, NewWindowId,
+ EditCutId, EditCopyId, EditPasteId, HelpAboutId, UserID };
+
public:
STD_Application();
virtual ~STD_Application();
virtual void closeApplication();
- virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& ) {}
+ virtual void contextMenuPopup( const QString&, QMenu*, QString& ) {}
+
+ bool exitConfirmation() const;
+ void setExitConfirmation( const bool );
signals:
/*!emit that view manager added*/
public slots:
virtual void onNewDoc();
+ virtual bool onNewDoc( const QString& );
+
virtual void onCloseDoc( bool ask = true );
virtual void onSaveDoc();
virtual bool onSaveAsDoc();
MenuHelpId = 7
};
- enum { FileNewId, FileOpenId, FileCloseId,
- FileSaveId, FileSaveAsId, FileExitId,
- ViewStatusBarId, ViewWindowsId, NewWindowId,
- EditCutId, EditCopyId, EditPasteId,
- HelpAboutId,
- UserID
- };
-
protected:
virtual void createActions();
virtual void updateDesktopTitle();
SUIT_ViewManager* myActiveViewMgr;
private:
+ bool myExitConfirm;
bool myEditEnabled;
bool myClosePermanently;
};
//
#include "STD_CloseDlg.h"
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qpushbutton.h>
-#include <qmessagebox.h>
-#include <qhbuttongroup.h>
-
-#ifndef WNT
-using namespace std;
-#endif
+#include <QLabel>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QGridLayout>
+#include <QPushButton>
+#include <QMessageBox>
/*!
* \brief creates a Close dialog box
* \param f style flags
*/
-STD_CloseDlg::STD_CloseDlg( QWidget* parent, bool modal, WFlags f )
-: QDialog( parent, "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+STD_CloseDlg::STD_CloseDlg( QWidget* parent, bool modal )
+: QDialog( parent )
{
+ setModal( modal );
setSizeGripEnabled( true );
- setCaption( tr( "CLOSE_DLG_CAPTION" ) );
+ setWindowTitle( tr( "CLOSE_DLG_CAPTION" ) );
QVBoxLayout* m_vbL = new QVBoxLayout( this );
m_vbL->setMargin( 11 );
m_vbL->setSpacing( 6 );
- QLabel* m_lIcon = new QLabel( this, "m_lDescr" );
+ QLabel* m_lIcon = new QLabel( this );
QPixmap pm = QMessageBox::standardIcon( QMessageBox::Warning );
m_lIcon->setPixmap( pm );
m_lIcon->setScaledContents( false );
m_lIcon->setAlignment( Qt::AlignCenter );
- QLabel* m_lDescr = new QLabel (this, "m_lDescr");
+ QLabel* m_lDescr = new QLabel( this );
m_lDescr->setText ( tr ("CLOSE_DLG_DESCRIPTION") );
m_lDescr->setAlignment( Qt::AlignCenter );
m_lDescr->setMinimumHeight( m_lDescr->sizeHint().height()*5 );
m_hl2->addWidget( m_pb1, 0, 0 );
m_hl2->addWidget( m_pb2, 0, 1 );
m_hl2->addWidget( m_pb3, 0, 2 );
- m_hl2->addColSpacing( 3, 10 );
- m_hl2->setColStretch( 3, 5 );
+ m_hl2->setColumnMinimumWidth( 3, 10 );
+ m_hl2->setColumnStretch( 3, 5 );
m_hl2->addWidget( m_pb4, 0, 4 );
m_vbL->addLayout( m_hl1 );
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#ifndef STD_CloseDlg_H
-#define STD_CloseDlg_H
+#ifndef STD_CLOSEDLG_H
+#define STD_CLOSEDLG_H
-#include <qdialog.h>
+#include <QDialog>
+
+class QPushButton;
/*! \class QDialog
* \brief For more information see <a href="http://doc.trolltech.com">QT documentation</a>.
Q_OBJECT
public:
- STD_CloseDlg ( QWidget * parent = 0, bool modal = FALSE, WFlags f = 0 ) ;
- ~STD_CloseDlg ( ) { };
+ STD_CloseDlg( QWidget* = 0, bool = false );
+ virtual ~STD_CloseDlg() {};
private slots:
void onButtonClicked();
#include <SUIT_ViewWindow.h>
#include <SUIT_ResourceMgr.h>
-#include <QtxAction.h>
-#include <QtxActionMenuMgr.h>
-#include <QtxWorkspaceAction.h>
+//#include <QtxActionMenuMgr.h>
+//#include <QtxWorkspaceAction.h>
-#include <qvbox.h>
-#include <qmenubar.h>
-#include <qworkspace.h>
-#include <qobjectlist.h>
+#include <QFrame>
+#include <QVBoxLayout>
+#include <QWorkspace>
#include <stdarg.h>
/*!Constructor.*/
STD_MDIDesktop::STD_MDIDesktop()
: SUIT_Desktop(),
-myWorkspace( 0 ),
-myWorkspaceAction( 0 )
+myWorkspace( 0 )//,
+//myWorkspaceAction( 0 )
{
- QVBox* base = new QVBox( this );
+ QFrame* base = new QFrame( this );
+ QVBoxLayout* main = new QVBoxLayout( base );
+ main->setMargin( 0 );
base->setFrameStyle( QFrame::Panel | QFrame::Sunken );
setCentralWidget( base );
myWorkspace = new QWorkspace( base );
+ main->addWidget( myWorkspace );
connect( myWorkspace, SIGNAL( windowActivated( QWidget* ) ),
this, SLOT( onWindowActivated( QWidget* ) ) );
}
/*!\retval QPtrList<SUIT_ViewWindow> - return const active window list.*/
-QPtrList<SUIT_ViewWindow> STD_MDIDesktop::windows() const
+QList<SUIT_ViewWindow*> STD_MDIDesktop::windows() const
{
- QPtrList<SUIT_ViewWindow> winList;
+ QList<SUIT_ViewWindow*> winList;
QWidgetList children = myWorkspace->windowList();
- for ( QWidgetListIt it( children ); it.current(); ++it )
+ for ( QWidgetList::iterator it = children.begin(); it != children.end(); ++it )
{
- if ( it.current()->inherits( "SUIT_ViewWindow" ) )
- winList.append( (SUIT_ViewWindow*)it.current() );
+ SUIT_ViewWindow* vw = ::qobject_cast<SUIT_ViewWindow*>( *it );
+ if ( vw )
+ winList.append( vw );
}
return winList;
}
-/*!\retval QWidget - pointer to work space.*/
-QWidget* STD_MDIDesktop::parentArea() const
+/*! add the new widget into desktop.*/
+void STD_MDIDesktop::addWindow( QWidget* w )
{
- return workspace();
+ if ( !w || !workspace() )
+ return;
+
+ workspace()->addWindow( w );
}
/*!Call method perform for operation \a type.*/
-void STD_MDIDesktop::windowOperation( const int type )
+void STD_MDIDesktop::windowOperation( const int /*type*/ )
{
- myWorkspaceAction->perform( operationFlag( type ) );
+ //myWorkspaceAction->perform( operationFlag( type ) );
}
/*!Sets window operations by \a first ... parameters.*/
void STD_MDIDesktop::setWindowOperations( const int first, ... )
{
va_list ints;
- va_start( ints, first );
+ va_start( ints, first );
- QValueList<int> typeList;
-
- int cur = first;
- while ( cur )
- {
- typeList.append( cur );
- cur = va_arg( ints, int );
+ QList<int> typeList;
+
+ int cur = first;
+ while ( cur )
+ {
+ typeList.append( cur );
+ cur = va_arg( ints, int );
}
- setWindowOperations( typeList );
+ setWindowOperations( typeList );
}
/*!Sets window operations by variable \a opList - operation list.*/
-void STD_MDIDesktop::setWindowOperations( const QValueList<int>& opList )
+void STD_MDIDesktop::setWindowOperations( const QList<int>& opList )
{
int flags = 0;
- for ( QValueList<int>::const_iterator it = opList.begin(); it != opList.end(); ++it )
+ for ( QList<int>::const_iterator it = opList.begin(); it != opList.end(); ++it )
flags = flags | operationFlag( *it );
- myWorkspaceAction->setItems( flags );
+// myWorkspaceAction->setItems( flags );
}
/*!\retval QWorkspace pointer - work space.*/
/*!Create actions: cascade, Tile, Tile Horizontal, Tile Vertical*/
void STD_MDIDesktop::createActions()
{
+/*
if ( myWorkspaceAction )
return;
int winMenuId = mMgr->insert( tr( "MEN_DESK_WINDOW" ), -1, 100, MenuWindowId );
mMgr->insert( myWorkspaceAction, winMenuId, -1 );
mMgr->insert( QtxActionMenuMgr::separator(), winMenuId, -1 );
+*/
}
/*!Convert STD_MDIDesktop enumerations to QtxWorkspaceAction.*/
-int STD_MDIDesktop::operationFlag( const int type ) const
+int STD_MDIDesktop::operationFlag( const int /*type*/ ) const
{
int res = 0;
+/*
switch ( type )
{
case Cascade:
res = QtxWorkspaceAction::VTile;
break;
}
+*/
return res;
}
#include <SUIT_Desktop.h>
-class QtxAction;
-class QPopupMenu;
class QWorkspace;
-class QtxWorkspaceAction;
+//class QtxWorkspaceAction;
-#if defined WNT
+#if defined WIN32
#pragma warning( disable: 4251 )
#endif
{
Q_OBJECT
+ class Workspace;
+
public:
enum { MenuWindowId = 6 };
enum { Cascade, Tile, HTile, VTile };
virtual ~STD_MDIDesktop();
virtual SUIT_ViewWindow* activeWindow() const;
- virtual QPtrList<SUIT_ViewWindow> windows() const;
+ virtual QList<SUIT_ViewWindow*> windows() const;
void windowOperation( const int );
void setWindowOperations( const int, ... );
- void setWindowOperations( const QValueList<int>& );
+ void setWindowOperations( const QList<int>& );
QWorkspace* workspace() const;
protected:
void createActions();
- virtual QWidget* parentArea() const;
+ virtual void addWindow( QWidget* );
private:
int operationFlag( const int ) const;
private:
QWorkspace* myWorkspace;
- QtxWorkspaceAction* myWorkspaceAction;
+// QtxWorkspaceAction* myWorkspaceAction;
};
-#if defined WNT
+#if defined WIN32
#pragma warning( default: 4251 )
#endif
#include <SUIT_ViewWindow.h>
-#include <qvbox.h>
-#include <qmenubar.h>
-#include <qobjectlist.h>
+#include <QFrame>
+#include <QVBoxLayout>
/*!Constructor. Create instance of QVBox*/
STD_SDIDesktop::STD_SDIDesktop()
: SUIT_Desktop()
{
- myMainWidget = new QVBox( this );
+ myMainWidget = new QFrame( this );
myMainWidget->setFrameStyle( QFrame::Panel | QFrame::Sunken );
+
+ QVBoxLayout* main = new QVBoxLayout( myMainWidget );
+ main->setMargin( 0 );
setCentralWidget( myMainWidget );
}
/*!\retval SUIT_ViewWindow - return const active window.*/
SUIT_ViewWindow* STD_SDIDesktop::activeWindow() const
{
- const QObjectList* children = myMainWidget->children();
- if ( !children )
- return 0;
-
- QPtrList<SUIT_ViewWindow> winList;
- for ( QObjectListIt it( *children ); it.current(); ++it )
+ const QObjectList& lst = myMainWidget->children();
+ QList<SUIT_ViewWindow*> winList;
+ for ( QObjectList::const_iterator it = lst.begin(); it != lst.end(); ++it )
{
- if ( it.current()->inherits( "SUIT_ViewWindow" ) )
- winList.append( (SUIT_ViewWindow*)it.current() );
+ SUIT_ViewWindow* vw = ::qobject_cast<SUIT_ViewWindow*>( *it );
+ if ( vw )
+ winList.append( vw );
}
SUIT_ViewWindow* win = 0;
- for ( QPtrListIterator<SUIT_ViewWindow> itr( winList ); itr.current() && !win; ++itr )
+ for ( QList<SUIT_ViewWindow*>::iterator itr = winList.begin(); itr != winList.end() && !win; ++itr )
{
- if ( itr.current()->isActiveWindow() )
- win = itr.current();
+ if ( (*itr)->isActiveWindow() )
+ win = *itr;
}
if ( !win && !winList.isEmpty() )
- win = winList.getFirst();
+ win = winList.first();
return win;
}
/*!\retval QPtrList<SUIT_ViewWindow> - return const active window list.*/
-QPtrList<SUIT_ViewWindow> STD_SDIDesktop::windows() const
+QList<SUIT_ViewWindow*> STD_SDIDesktop::windows() const
{
- QPtrList<SUIT_ViewWindow> winList;
- winList.append( activeWindow() );
+ QList<SUIT_ViewWindow*> winList;
+ winList.append( activeWindow() );
return winList;
}
-/*!\retval QWidget - pointer to main window.*/
-QWidget* STD_SDIDesktop::parentArea() const
+/*! add new widget into desktop.*/
+void STD_SDIDesktop::addWindow( QWidget* w )
{
- return myMainWidget;
+ if ( !w || !centralWidget() || !centralWidget()->layout() )
+ return;
+
+ w->setParent( centralWidget() );
+ centralWidget()->layout()->addWidget( w );
}
#include <SUIT_Desktop.h>
-class QVBox;
+class QFrame;
class STD_EXPORT STD_SDIDesktop: public SUIT_Desktop
{
virtual ~STD_SDIDesktop();
virtual SUIT_ViewWindow* activeWindow() const;
- virtual QPtrList<SUIT_ViewWindow> windows() const;
+ virtual QList<SUIT_ViewWindow*> windows() const;
protected:
- virtual QWidget* parentArea() const;
+ virtual void addWindow( QWidget* );
private:
- QVBox* myMainWidget;
+ QFrame* myMainWidget;
};
#endif
#include <SUIT_ViewWindow.h>
#include <SUIT_ResourceMgr.h>
-#include <QtxAction.h>
#include <QtxWorkstack.h>
-#include <QtxActionMenuMgr.h>
-#include <QtxWorkstackAction.h>
+//#include <QtxActionMenuMgr.h>
+//#include <QtxWorkstackAction.h>
-#include <qvbox.h>
-#include <qmenubar.h>
-#include <qworkspace.h>
-#include <qobjectlist.h>
+#include <QFrame>
+#include <QVBoxLayout>
#include <stdarg.h>
/*!Constructor.Create new instances of QVBox and QtxWorkstack.*/
STD_TabDesktop::STD_TabDesktop()
: SUIT_Desktop(),
-myWorkstack( 0 ),
-myWorkstackAction( 0 )
+myWorkstack( 0 )//,
+//myWorkstackAction( 0 )
{
- QVBox* base = new QVBox( this );
+ QFrame* base = new QFrame( this );
base->setFrameStyle( QFrame::Panel | QFrame::Sunken );
+ QVBoxLayout* main = new QVBoxLayout( base );
+ main->setMargin( 0 );
+
setCentralWidget( base );
myWorkstack = new QtxWorkstack( base );
+ main->addWidget( myWorkstack );
// setting Expanding size policy for central workstack. If there are several widgets
// in central area of Desktop, other widgets will be added below the workstack (CATHARE, TRIPOLI modules).
// But the workstack must occupy as much space as possible -- set Expanding for it.
myWorkstack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
- myWorkstack->setAccel(QtxWorkstack::SplitVertical, SHIFT + Key_V);
- myWorkstack->setAccel(QtxWorkstack::SplitHorizontal, SHIFT + Key_H);
- myWorkstack->setAccel(QtxWorkstack::Close, SHIFT + Key_C);
+ myWorkstack->setAccel( QtxWorkstack::SplitVertical, Qt::SHIFT + Qt::Key_V );
+ myWorkstack->setAccel( QtxWorkstack::SplitHorizontal, Qt::SHIFT + Qt::Key_H );
+ myWorkstack->setAccel( QtxWorkstack::Close, Qt::SHIFT + Qt::Key_C );
connect( myWorkstack, SIGNAL( windowActivated( QWidget* ) ),
this, SLOT( onWindowActivated( QWidget* ) ) );
}
/*!\retval QPtrList<SUIT_ViewWindow> - return const active window list.*/
-QPtrList<SUIT_ViewWindow> STD_TabDesktop::windows() const
+QList<SUIT_ViewWindow*> STD_TabDesktop::windows() const
{
- QPtrList<SUIT_ViewWindow> winList;
+ QList<SUIT_ViewWindow*> winList;
QWidgetList children = myWorkstack->windowList();
- for ( QWidgetListIt it( children ); it.current(); ++it )
+ for ( QWidgetList::iterator it = children.begin(); it != children.end(); ++it )
{
- if ( it.current()->inherits( "SUIT_ViewWindow" ) )
- winList.append( (SUIT_ViewWindow*)it.current() );
+ if ( (*it)->inherits( "SUIT_ViewWindow" ) )
+ winList.append( (SUIT_ViewWindow*)*it );
}
return winList;
}
-/*!\retval QWidget pointer - QT work stack.*/
-QWidget* STD_TabDesktop::parentArea() const
+/*! insert new widget into desktop.*/
+void STD_TabDesktop::addWindow( QWidget* w )
{
- return workstack();
+ if ( !w || !workstack() )
+ return;
+
+ workstack()->addWindow( w );
}
/*!Call method perform for operation \a type.*/
-void STD_TabDesktop::windowOperation( const int type )
+void STD_TabDesktop::windowOperation( const int /*type*/ )
{
- myWorkstackAction->perform( operationFlag( type ) );
+// myWorkstackAction->perform( operationFlag( type ) );
}
/*!Sets window operations by \a first ... parameters.*/
va_list ints;
va_start( ints, first );
- QValueList<int> typeList;
+ QList<int> typeList;
int cur = first;
while ( cur )
}
/*!Sets window operations by variable \a opList - operation list.*/
-void STD_TabDesktop::setWindowOperations( const QValueList<int>& opList )
+void STD_TabDesktop::setWindowOperations( const QList<int>& opList )
{
int flags = 0;
- for ( QValueList<int>::const_iterator it = opList.begin(); it != opList.end(); ++it )
+ for ( QList<int>::const_iterator it = opList.begin(); it != opList.end(); ++it )
flags = flags | operationFlag( *it );
- myWorkstackAction->setItems( flags );
+// myWorkstackAction->setItems( flags );
}
/*!\retval QtxWorkstack pointer - QT work stack.*/
/*!Create actions for window.*/
void STD_TabDesktop::createActions()
{
+/*
if ( myWorkstackAction )
return;
int winMenuId = mMgr->insert( tr( "MEN_DESK_WINDOW" ), -1, 100, MenuWindowId );
mMgr->insert( myWorkstackAction, winMenuId, -1 );
mMgr->insert( QtxActionMenuMgr::separator(), winMenuId, -1 );
+*/
}
/*!Convert STD_TabDesktop enumerations to QtxWorkstackAction*/
-int STD_TabDesktop::operationFlag( const int type ) const
+int STD_TabDesktop::operationFlag( const int /*type*/ ) const
{
int res = 0;
+/*
switch ( type )
{
case VSplit:
res = QtxWorkstackAction::HSplit;
break;
}
+*/
return res;
}
#include <SUIT_Desktop.h>
-class QtxAction;
-class QPopupMenu;
-class QWorkspace;
class QtxWorkstack;
-class QtxWorkstackAction;
+//class QtxWorkstackAction;
-#if defined WNT
+#if defined WIN32
#pragma warning( disable: 4251 )
#endif
virtual ~STD_TabDesktop();
virtual SUIT_ViewWindow* activeWindow() const;
- virtual QPtrList<SUIT_ViewWindow> windows() const;
+ virtual QList<SUIT_ViewWindow*> windows() const;
void windowOperation( const int );
void setWindowOperations( const int, ... );
- void setWindowOperations( const QValueList<int>& );
+ void setWindowOperations( const QList<int>& );
QtxWorkstack* workstack() const;
protected:
void createActions();
- virtual QWidget* parentArea() const;
+ virtual void addWindow( QWidget* );
private:
int operationFlag( const int ) const;
private:
QtxWorkstack* myWorkstack;
- QtxWorkstackAction* myWorkstackAction;
+// QtxWorkstackAction* myWorkstackAction;
};
-#if defined WNT
+#if defined WIN32
#pragma warning( default: 4251 )
#endif