From 371b49f1d8f08022cbc985ee55760b2396171dd9 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 14 May 2007 13:53:33 +0000 Subject: [PATCH] Porting to Qt4 --- src/SUIT/SUIT_Operation.cxx | 16 ++-------------- src/SUIT/SUIT_Operation.h | 9 +++++---- src/SUIT/SUIT_OverrideCursor.cxx | 4 +++- src/SUIT/SUIT_OverrideCursor.h | 8 ++++---- src/SUIT/SUIT_PopupClient.cxx | 2 -- src/SUIT/SUIT_PopupClient.h | 6 +++--- src/SUIT/SUIT_ResourceMgr.cxx | 28 +++++++++++++++------------- 7 files changed, 32 insertions(+), 41 deletions(-) diff --git a/src/SUIT/SUIT_Operation.cxx b/src/SUIT/SUIT_Operation.cxx index 2df0b7d24..31ff40f8f 100755 --- a/src/SUIT/SUIT_Operation.cxx +++ b/src/SUIT/SUIT_Operation.cxx @@ -17,21 +17,9 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -/*! - SALOME SalomeApp - - Copyright (C) 2005 CEA/DEN, EDF R&D - - File : SUIT_Operation.h - Author : Unknown - Module : SALOME -*/ - #include "SUIT_Operation.h" #include "SUIT_Study.h" -#include "SUIT_Desktop.h" -#include "SUIT_MessageBox.h" #include "SUIT_Application.h" /*! @@ -46,9 +34,9 @@ SUIT_Operation::SUIT_Operation( SUIT_Application* app ) : QObject(), myApp( app ), +myFlags( Transaction ), myStudy( 0 ), -myState( Waiting ), -myFlags( Transaction ) +myState( Waiting ) { } diff --git a/src/SUIT/SUIT_Operation.h b/src/SUIT/SUIT_Operation.h index 3d15f058c..6a1785e2a 100755 --- a/src/SUIT/SUIT_Operation.h +++ b/src/SUIT/SUIT_Operation.h @@ -22,8 +22,8 @@ #include "SUIT.h" -#include -#include +#include +#include class SUIT_Study; class SUIT_Application; @@ -107,6 +107,8 @@ public: virtual QString operationName() const; + int execStatus() const; + signals: void started( SUIT_Operation* ); void aborted( SUIT_Operation* ); @@ -140,7 +142,6 @@ protected: virtual bool hasTransaction() const; virtual bool commitTransaction( const QString& = QString::null ); - int execStatus() const; void setExecStatus( const int ); void setState( const OperationState ); @@ -148,7 +149,7 @@ protected: void start( SUIT_Operation*, const bool = false ); private: - typedef QGuardedPtr StudyPtr; + typedef QPointer StudyPtr; private: SUIT_Application* myApp; //!< application for this operation diff --git a/src/SUIT/SUIT_OverrideCursor.cxx b/src/SUIT/SUIT_OverrideCursor.cxx index 0dab97a58..05d99e8cc 100755 --- a/src/SUIT/SUIT_OverrideCursor.cxx +++ b/src/SUIT/SUIT_OverrideCursor.cxx @@ -18,6 +18,8 @@ // #include "SUIT_OverrideCursor.h" +#include + /*!Constructor. Initialize wait cursor.*/ SUIT_OverrideCursor::SUIT_OverrideCursor() { @@ -61,7 +63,7 @@ void SUIT_OverrideCursor::resume() if ( isActive() ) return; - for ( QValueList::const_iterator it = myCursors.begin(); it != myCursors.end(); ++it ) + for ( QList::const_iterator it = myCursors.begin(); it != myCursors.end(); ++it ) QApplication::setOverrideCursor( *it ); myCursors.clear(); diff --git a/src/SUIT/SUIT_OverrideCursor.h b/src/SUIT/SUIT_OverrideCursor.h index ee89235d6..90e9dc7c4 100755 --- a/src/SUIT/SUIT_OverrideCursor.h +++ b/src/SUIT/SUIT_OverrideCursor.h @@ -19,11 +19,11 @@ #ifndef SUIT_OVERRIDECURSOR_H #define SUIT_OVERRIDECURSOR_H -#include -#include - #include "SUIT.h" +#include +#include + /*! \brief Class used for management cursors.*/ class SUIT_EXPORT SUIT_OverrideCursor { @@ -37,7 +37,7 @@ public: void resume(); private: - QValueList myCursors; + QList myCursors; }; #endif diff --git a/src/SUIT/SUIT_PopupClient.cxx b/src/SUIT/SUIT_PopupClient.cxx index fd2c40d9f..5104ca165 100644 --- a/src/SUIT/SUIT_PopupClient.cxx +++ b/src/SUIT/SUIT_PopupClient.cxx @@ -18,8 +18,6 @@ // #include "SUIT_PopupClient.h" -#include - /*! constructor. initialize mySignal.*/ SUIT_PopupClient::SUIT_PopupClient() : mySignal( 0 ) diff --git a/src/SUIT/SUIT_PopupClient.h b/src/SUIT/SUIT_PopupClient.h index f65bc9f12..42f7466b6 100644 --- a/src/SUIT/SUIT_PopupClient.h +++ b/src/SUIT/SUIT_PopupClient.h @@ -21,9 +21,9 @@ #include "SUIT.h" -#include +#include -class QPopupMenu; +class QMenu; class QContextMenuEvent; /*!\class SUIT_PopupClient @@ -42,7 +42,7 @@ public: bool disconnectPopupRequest( QObject* reciever, const char* slot ); virtual QString popupClientType() const = 0; - virtual void contextMenuPopup( QPopupMenu* ) {} + virtual void contextMenuPopup( QMenu* ) {} protected: void contextMenuRequest( QContextMenuEvent* e ); diff --git a/src/SUIT/SUIT_ResourceMgr.cxx b/src/SUIT/SUIT_ResourceMgr.cxx index b076babd3..086738e88 100755 --- a/src/SUIT/SUIT_ResourceMgr.cxx +++ b/src/SUIT/SUIT_ResourceMgr.cxx @@ -18,10 +18,14 @@ // #include "SUIT_ResourceMgr.h" -#include -#include -#include -#include +#include +#include +#include +#include + +#ifndef WIN32 +#include +#endif /*! Constructor @@ -66,9 +70,6 @@ QString SUIT_ResourceMgr::loadDoc( const QString& prefix, const QString& id ) co return path( docSection, prefix, id ); } -#ifndef WIN32 -#include -#endif /*! Returns the user file name for specified application */ @@ -76,13 +77,14 @@ QString SUIT_ResourceMgr::userFileName( const QString& appName, const bool for_l { QString pathName; + QStringList arguments = QApplication::arguments(); // Try config file, given in arguments - for (int i = 1; i < qApp->argc(); i++) { + for (int i = 1; i < arguments.count(); i++) { QRegExp rx ("--resources=(.+)"); - if ( rx.search( QString(qApp->argv()[i]) ) >= 0 && rx.capturedTexts().count() > 1 ) { - QString file = rx.capturedTexts()[1]; + if ( rx.indexIn( arguments[i] ) >= 0 && rx.numCaptures() > 1 ) { + QString file = rx.cap(1); QFileInfo fi (file); - pathName = fi.absFilePath(); + pathName = fi.absoluteFilePath(); } } @@ -110,7 +112,7 @@ QString SUIT_ResourceMgr::userFileName( const QString& appName, const bool for_l */ QString SUIT_ResourceMgr::findAppropriateUserFile( const QString& fname ) const { - QDir d( QFileInfo( fname ).dir( true ) ); + QDir d( QFileInfo( fname ).dir() ); d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); QStringList l = d.entryList(); QString appr_file; @@ -127,7 +129,7 @@ QString SUIT_ResourceMgr::findAppropriateUserFile( const QString& fname ) const if( appr < 0 || abs( id-id0 ) < abs( appr-id0 ) ) { appr = id; - appr_file = d.absFilePath( *anIt ); + appr_file = d.absoluteFilePath( *anIt ); } } return appr_file; -- 2.39.2