From d40fea240cd6409a2cc42405df1e2dc9df89fed9 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 23 Nov 2015 10:49:17 +0300 Subject: [PATCH] Additional changes --- src/CAM/CAM_Module.cxx | 27 ++++++++ src/CAM/CAM_Module.h | 3 + src/DDS/CMakeLists.txt | 2 +- src/GLViewer/CMakeLists.txt | 2 +- src/GraphicsView/GraphicsView_Object.cxx | 14 ++--- src/Plot2d/Plot2d_PlotItems.cxx | 8 +-- src/Plot2d/Plot2d_ViewFrame.cxx | 24 +++---- src/Plot2d/Plot2d_ViewWindow.cxx | 5 -- src/Qtx/QtxAction.cxx | 62 +++++++++++++++++++ src/Qtx/QtxAction.h | 2 + src/Qtx/QtxActionMenuMgr.cxx | 2 +- src/Qtx/QtxActionToolMgr.cxx | 2 +- src/Qtx/QtxDialog.cxx | 2 + src/Qtx/QtxLogoMgr.cxx | 4 -- src/Qtx/QtxPopupMgr.cxx | 28 +++++++-- src/Qtx/QtxTranslator.cxx | 34 ++++++---- src/Qtx/QtxTranslator.h | 2 +- src/Qtx/QtxTreeView.cxx | 8 +-- src/Qtx/QtxWebBrowser.cxx | 4 -- .../SALOME_PYQT_PyModule.cxx | 6 +- src/STD/STD_MDIDesktop.cxx | 11 +--- src/SUIT/SUIT_ActionOperation.cxx | 8 +-- src/SUIT/SUIT_Application.cxx | 22 +++++++ src/SUIT/SUIT_Application.h | 5 ++ src/SUIT/SUIT_LicenseDlg.cxx | 4 -- src/SalomeApp/SalomeApp_Application.cxx | 24 ++++--- src/SalomeApp/SalomeApp_Engine_i.cxx | 26 +++++--- src/Session/SALOME_Session_Server.cxx | 17 ++--- src/Session/Session_ServerCheck.cxx | 60 +++++++++++------- src/Style/Style_Salome.cxx | 6 +- src/VTKViewer/CMakeLists.txt | 2 +- src/VTKViewer/VTKViewer_RenderWindow.cxx | 3 - 32 files changed, 283 insertions(+), 146 deletions(-) diff --git a/src/CAM/CAM_Module.cxx b/src/CAM/CAM_Module.cxx index 5ad1dad48..a2cd873f0 100755 --- a/src/CAM/CAM_Module.cxx +++ b/src/CAM/CAM_Module.cxx @@ -940,6 +940,33 @@ QAction* CAM_Module::createAction( const int id, const QString& text, const QIco const QString& menu, const QString& tip, const int key, QObject* parent, const bool toggle, QObject* reciever, const char* member, const QString& shortcutAction ) +{ + return createAction( id, text, icon, menu, tip, QKeySequence(key), parent, toggle, reciever, member, shortcutAction ); +} + +/*! + \brief Create new instance of QtxAction and register action with specified \a id. + + Resulting action ID may differ from the requested one. This can happen if + requested ID is already in use. + + If \a id < 0, the action ID is generated automatically. + + \param id required action ID + \param text tooltip text + \param icon action icon + \param menu menu text + \param tip status bar tip + \param key keyboard accelerator + \param parent parent object + \param toggle if \c true, the action will be toggled + \param reciever action activation signal receiver object + \param member action activation signal receiver slot +*/ +QAction* CAM_Module::createAction( const int id, const QString& text, const QIcon& icon, + const QString& menu, const QString& tip, const QKeySequence& key, + QObject* parent, const bool toggle, QObject* reciever, + const char* member, const QString& shortcutAction ) { QtxAction* a = new QtxAction( text, icon, menu, key, parent, toggle, shortcutAction ); a->setStatusTip( tip ); diff --git a/src/CAM/CAM_Module.h b/src/CAM/CAM_Module.h index 69c541505..a744f5186 100755 --- a/src/CAM/CAM_Module.h +++ b/src/CAM/CAM_Module.h @@ -99,6 +99,9 @@ public: virtual QAction* createAction( const int, const QString&, const QIcon&, const QString&, const QString&, const int, QObject* = 0, const bool = false, QObject* = 0, const char* = 0, const QString& = QString() ); + virtual QAction* createAction( const int, const QString&, const QIcon&, const QString&, + const QString&, const QKeySequence&, QObject* = 0, + const bool = false, QObject* = 0, const char* = 0, const QString& = QString() ); QtxActionGroup* createActionGroup( const int, const bool = true ); int createTool( const QString&, const QString& = QString() ); diff --git a/src/DDS/CMakeLists.txt b/src/DDS/CMakeLists.txt index fc89ac778..2ece4237c 100755 --- a/src/DDS/CMakeLists.txt +++ b/src/DDS/CMakeLists.txt @@ -60,4 +60,4 @@ ADD_LIBRARY(DDS ${DDS_SOURCES}) TARGET_LINK_LIBRARIES(DDS ${_link_LIBRARIES}) INSTALL(TARGETS DDS EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) -INSTALL(FILES ${DDS_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) \ No newline at end of file +INSTALL(FILES ${DDS_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) diff --git a/src/GLViewer/CMakeLists.txt b/src/GLViewer/CMakeLists.txt index 9fb0c2430..7cdc7825c 100755 --- a/src/GLViewer/CMakeLists.txt +++ b/src/GLViewer/CMakeLists.txt @@ -146,4 +146,4 @@ INSTALL(TARGETS GLViewer EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_ INSTALL(FILES ${GLViewer_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GUI_INSTALL_RES_DATA}") -INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA}) \ No newline at end of file +INSTALL(FILES ${_other_RESOURCES} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA}) diff --git a/src/GraphicsView/GraphicsView_Object.cxx b/src/GraphicsView/GraphicsView_Object.cxx index b18d44c27..13364db28 100644 --- a/src/GraphicsView/GraphicsView_Object.cxx +++ b/src/GraphicsView/GraphicsView_Object.cxx @@ -43,15 +43,15 @@ GraphicsView_Object::GraphicsView_Object( QGraphicsItem* theParent ) //======================================================================= GraphicsView_Object::~GraphicsView_Object() { - QList aList = childItems(); - for( QList::const_iterator aChild = aList.begin(); aChild != aList.end(); ++aChild ) + QListIterator aChildIter( childItems() ); + while( aChildIter.hasNext() ) { - if( *aChild ) + if( QGraphicsItem* aChild = aChildIter.next() ) { - removeFromGroup( *aChild ); - if( QGraphicsScene* aScene = (*aChild)->scene() ) - aScene->removeItem( *aChild ); - delete ( *aChild ); + removeFromGroup( aChild ); + if( QGraphicsScene* aScene = aChild->scene() ) + aScene->removeItem( aChild ); + delete ( aChild ); aChild = 0; } } diff --git a/src/Plot2d/Plot2d_PlotItems.cxx b/src/Plot2d/Plot2d_PlotItems.cxx index 2cea87800..2d585c08c 100644 --- a/src/Plot2d/Plot2d_PlotItems.cxx +++ b/src/Plot2d/Plot2d_PlotItems.cxx @@ -33,6 +33,8 @@ #include #include #include +#include + #include #include #include @@ -40,10 +42,6 @@ #include #include -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -#include -#endif - const int SPACING = 10; const int SYMBOL_SIZE = 13; @@ -406,7 +404,7 @@ void Plot2d_QwtPlotCurve::drawSeries( QPainter *painter, if(hasDeviationData()) { painter->save(); int lineW = deviationMarkerLineWidth(); - int tickSz = deviationMarkerTickSize() + qRound(double(lineW/2)); + int tickSz = deviationMarkerTickSize() + qRound(double(lineW)/2); double min, max, xi, yi; int xp, ytop, ybtm, tickl, tickr; QColor c = isSelected() ? Plot2d_Object::selectionColor() : deviationMarkerColor(); diff --git a/src/Plot2d/Plot2d_ViewFrame.cxx b/src/Plot2d/Plot2d_ViewFrame.cxx index c54abfba7..efa7311c7 100755 --- a/src/Plot2d/Plot2d_ViewFrame.cxx +++ b/src/Plot2d/Plot2d_ViewFrame.cxx @@ -58,11 +58,7 @@ #include #include #include -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) #include -#else -#include -#endif #include #include #include @@ -79,17 +75,11 @@ #include #include #include +#include +#include #include #include -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) -#include -#else -#include -#endif - -#include -#include #define DEFAULT_LINE_WIDTH 0 // (default) line width #define DEFAULT_MARKER_SIZE 9 // default marker size @@ -1650,10 +1640,10 @@ void Plot2d_ViewFrame::getFitRangeByMarkers(double& xMin, double& xMax, */ int Plot2d_ViewFrame::testOperation( const QMouseEvent& me ) { - int btn = me.buttons() | me.modifiers(); - const int zoomBtn = Qt::ControlModifier | Qt::LeftButton; - const int panBtn = Qt::ControlModifier | Qt::MidButton; - const int fitBtn = Qt::ControlModifier | Qt::RightButton; + int btn = (int)me.button() | (int)me.modifiers(); + const int zoomBtn = (int)Qt::ControlModifier | (int)Qt::LeftButton; + const int panBtn = (int)Qt::ControlModifier | (int)Qt::MidButton; + const int fitBtn = (int)Qt::ControlModifier | (int)Qt::RightButton; int op = NoOpId; if ( btn == zoomBtn ) { @@ -2691,7 +2681,7 @@ void Plot2d_ViewFrame::plotMousePressed( const QMouseEvent& me ) } } else { - int btn = me.buttons() | me.modifiers(); + int btn = (int)me.button() | (int)me.modifiers(); if (btn == Qt::RightButton) { QMouseEvent* aEvent = new QMouseEvent(QEvent::MouseButtonPress, me.pos(), me.button(), me.buttons(), me.modifiers() ); diff --git a/src/Plot2d/Plot2d_ViewWindow.cxx b/src/Plot2d/Plot2d_ViewWindow.cxx index e5d7e85e9..69e1310e1 100755 --- a/src/Plot2d/Plot2d_ViewWindow.cxx +++ b/src/Plot2d/Plot2d_ViewWindow.cxx @@ -46,13 +46,8 @@ #include #include #include -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) #include #include -#else -#include -#include -#endif #include diff --git a/src/Qtx/QtxAction.cxx b/src/Qtx/QtxAction.cxx index bca3d0538..4b449408e 100755 --- a/src/Qtx/QtxAction.cxx +++ b/src/Qtx/QtxAction.cxx @@ -116,6 +116,38 @@ QtxAction::QtxAction( const QString& text, const QIcon& icon, const QString& men QApplication::instance()->installEventFilter( this ); } +/*! + \brief Constructor. + + Creates an action owned by \a parent. Parameters \a text, + \a icon, \a menuText and \a accel specify the action's attributes. + Parameter \a toggle can be used to make the action checkable. + Parameter \a shortcutAction can be used to assign the shortcut from + preferences. This parameter value corresponds to shortcut action identifier + in shortcut preferences. + + \param text tooltip text + \param icon iconset + \param menuText menu text + \param accel shortcut key sequence + \param parent parent object + \param toggle if \c true the action will be a toggle action + \param shortcutAction shortcut action identifier +*/ +QtxAction::QtxAction( const QString& text, const QIcon& icon, const QString& menuText, + const QKeySequence& accel, QObject* parent, bool toggle, const QString& shortcutAction ) +: QWidgetAction( parent ) +{ + setIcon( icon ); + setText( menuText ); + setToolTip( text ); + setShortcut( accel ); + setCheckable( toggle ); + setShortcutActionName(shortcutAction); + + QApplication::instance()->installEventFilter( this ); +} + /*! \brief Constructor. @@ -146,6 +178,36 @@ QtxAction::QtxAction( const QString& text, const QString& menuText, QApplication::instance()->installEventFilter( this ); } +/*! + \brief Constructor. + + Creates an action owned by \a parent. Parameters \a text, + \a menuText and \a accel specify the action's attributes. + Parameter \a toggle can be used to make the action checkable. + Parameter \a shortcutAction can be used to assign the shortcut from + preferences. This parameter value corresponds to shortcut action identifier + in shortcut preferences. + + \param text tooltip text + \param menuText menu text + \param accel shortcut key sequence + \param parent parent object + \param toggle if \c true the action is a toggle action + \param shortcutAction shortcut action identifier +*/ +QtxAction::QtxAction( const QString& text, const QString& menuText, + const QKeySequence& accel, QObject* parent, bool toggle, const QString& shortcutAction ) +: QWidgetAction( parent ) +{ + setText( menuText ); + setToolTip( text ); + setShortcut( accel ); + setCheckable( toggle ); + setShortcutActionName(shortcutAction); + + QApplication::instance()->installEventFilter( this ); +} + /*! \brief Destructor. */ diff --git a/src/Qtx/QtxAction.h b/src/Qtx/QtxAction.h index 23a3a686e..9f39d75d8 100755 --- a/src/Qtx/QtxAction.h +++ b/src/Qtx/QtxAction.h @@ -45,7 +45,9 @@ class QTX_EXPORT QtxAction : public QWidgetAction public: QtxAction( QObject* = 0, bool = false, const QString& = QString() ); QtxAction( const QString&, const QString&, int, QObject*, bool = false, const QString& = QString() ); + QtxAction( const QString&, const QString&, const QKeySequence&, QObject*, bool = false, const QString& = QString() ); QtxAction( const QString&, const QIcon&, const QString&, int, QObject*, bool = false, const QString& = QString() ); + QtxAction( const QString&, const QIcon&, const QString&, const QKeySequence&, QObject*, bool = false, const QString& = QString() ); virtual ~QtxAction(); virtual bool eventFilter( QObject*, QEvent* ); diff --git a/src/Qtx/QtxActionMenuMgr.cxx b/src/Qtx/QtxActionMenuMgr.cxx index 8cdd79f69..9fd3a3f15 100644 --- a/src/Qtx/QtxActionMenuMgr.cxx +++ b/src/Qtx/QtxActionMenuMgr.cxx @@ -1290,7 +1290,7 @@ int QtxActionMenuMgr::MenuCreator::append( const QString& tag, const bool subMen QtxAction* newAct = new QtxAction( strValue( attr, tooltip ), set, strValue( attr, label ), - QKeySequence( strValue( attr, accel ) )[0], + QKeySequence( strValue( attr, accel ) ), myMgr ); newAct->setToolTip( strValue( attr, tooltip ) ); QString toggleact = strValue( attr, toggle ); diff --git a/src/Qtx/QtxActionToolMgr.cxx b/src/Qtx/QtxActionToolMgr.cxx index f9f629004..c24a5820a 100644 --- a/src/Qtx/QtxActionToolMgr.cxx +++ b/src/Qtx/QtxActionToolMgr.cxx @@ -858,7 +858,7 @@ int QtxActionToolMgr::ToolCreator::append( const QString& tag, const bool /*subM set = QIcon( pix ); QtxAction* newAct = new QtxAction( strValue( attr, tooltip ), set, strValue( attr, label ), - QKeySequence( strValue( attr, accel ) )[0], myMgr ); + QKeySequence( strValue( attr, accel ) ), myMgr ); QString toggleact = strValue( attr, toggle ); newAct->setCheckable( !toggleact.isEmpty() ); newAct->setChecked( toggleact.toLower() == "true" ); diff --git a/src/Qtx/QtxDialog.cxx b/src/Qtx/QtxDialog.cxx index 47a3a2867..00c20734a 100755 --- a/src/Qtx/QtxDialog.cxx +++ b/src/Qtx/QtxDialog.cxx @@ -1444,6 +1444,8 @@ void QtxDialog::emitSignal() QApplication::instance()->processEvents(); #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) QApplication::syncX(); +#else + QApplication::sync(); #endif int id = buttonId( (QAbstractButton*)mySender ); mySender = 0; diff --git a/src/Qtx/QtxLogoMgr.cxx b/src/Qtx/QtxLogoMgr.cxx index 0e83f7e92..d82d2db23 100644 --- a/src/Qtx/QtxLogoMgr.cxx +++ b/src/Qtx/QtxLogoMgr.cxx @@ -98,11 +98,7 @@ bool QtxLogoMgr::LogoBox::eventFilter( QObject* o, QEvent* e ) if ( o != menuBar() ) return false; -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - if ( e->type() == QEvent::MenubarUpdated || e->type() == QEvent::Resize ) -#else if ( e->type() == QEvent::Resize ) -#endif updateCorner(); if ( e->type() == QEvent::ChildAdded || e->type() == QEvent::ChildRemoved ) diff --git a/src/Qtx/QtxPopupMgr.cxx b/src/Qtx/QtxPopupMgr.cxx index fbeea8ffb..e1f40d40d 100644 --- a/src/Qtx/QtxPopupMgr.cxx +++ b/src/Qtx/QtxPopupMgr.cxx @@ -26,8 +26,12 @@ #include "QtxPopupMgr.h" #include "QtxAction.h" #include "QtxEvalExpr.h" +#include #include +#include +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + /*! \brief Used for comparing of two QVariant values. \param v1 first argument for comparison @@ -56,11 +60,7 @@ bool operator<( const QVariant& v1, const QVariant& v2 ) for ( ; anIt1 != aLast1 && anIt2 != aLast2; anIt1++, anIt2++ ) { if ( (*anIt1) != (*anIt2) ) -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - return (*anIt1)<(*anIt2); -#else - return (*anIt1)<=(*anIt2); -#endif + return (*anIt1) < (*anIt2); } return anIt1 == aLast1 && anIt2 != aLast2; } @@ -71,6 +71,22 @@ bool operator<( const QVariant& v1, const QVariant& v2 ) return t1 < t2; } +#else + +bool operator<( const QList& v1, const QList& v2 ) +{ + QList::const_iterator anIt1 = v1.begin(), aLast1 = v1.end(), + anIt2 = v2.begin(), aLast2 = v2.end(); + for ( ; anIt1 != aLast1 && anIt2 != aLast2; anIt1++, anIt2++ ) + { + if ( (*anIt1) != (*anIt2) ) + return (*anIt1) < (*anIt2); + } + return anIt1 == aLast1 && anIt2 != aLast2; +} + +#endif // QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + /*! \class QtxPopupMgr::PopupCreator \internal @@ -159,7 +175,7 @@ int QtxPopupMgr::PopupCreator::append( const QString& tag, const bool subMenu, QString actLabel = strValue( attr, label ); QtxAction* newAct = new QtxAction( strValue( attr, tooltip ), set, actLabel, - QKeySequence( strValue( attr, accel ) )[0], + QKeySequence( strValue( attr, accel ) ), myMgr ); newAct->setToolTip( strValue( attr, tooltip ) ); QString toggleact = strValue( attr, toggle ); diff --git a/src/Qtx/QtxTranslator.cxx b/src/Qtx/QtxTranslator.cxx index 683a3ce68..bde67e78f 100644 --- a/src/Qtx/QtxTranslator.cxx +++ b/src/Qtx/QtxTranslator.cxx @@ -63,27 +63,39 @@ QtxTranslator::~QtxTranslator() { } +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + /*! \brief Returns the translation for the key. \param context message context \param sourceText message source name - \param comment message comment (optional) + \param disambiguation message comment (optional) \return Translated text if found or \a sourceText otherwise */ -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) -QString QtxTranslator::translate( const char* context, const char* sourceText, const char* comment ) const +QString QtxTranslator::translate( const char* context, const char* sourceText, const char* disambiguation ) const { - QString res = QTranslator::translate( context, sourceText, comment ); - if( res.isNull() ) - res = QTranslator::translate( GLOBAL_CONTEXT, sourceText, comment ); + QString res = QTranslator::translate( context, sourceText, disambiguation ); + if ( res.isNull() ) + res = QTranslator::translate( GLOBAL_CONTEXT, sourceText, disambiguation ); return res; } + #else -QString QtxTranslator::translate( const char* context, const char* sourceText, const char* comment, int n ) const + +/*! + \brief Returns the translation for the key. + \param context message context + \param sourceText message source name + \param disambiguation message comment (optional) + \param n optional numeral to choose the appropriate form of translation + \return Translated text if found or \a sourceText otherwise +*/ +QString QtxTranslator::translate( const char* context, const char* sourceText, const char* disambiguation, int n ) const { - QString res = QTranslator::translate( context, sourceText, comment, n ); - if( res.isNull() ) - res = QTranslator::translate( GLOBAL_CONTEXT, sourceText, comment, n ); + QString res = QTranslator::translate( context, sourceText, disambiguation, n ); + if ( res.isNull() ) + res = QTranslator::translate( GLOBAL_CONTEXT, sourceText, disambiguation, n ); return res; } -#endif + +#endif // QT_VERSION < QT_VERSION_CHECK(5, 0, 0) diff --git a/src/Qtx/QtxTranslator.h b/src/Qtx/QtxTranslator.h index db6909ee2..cbe7e0456 100644 --- a/src/Qtx/QtxTranslator.h +++ b/src/Qtx/QtxTranslator.h @@ -35,7 +35,7 @@ public: #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) virtual QString translate( const char*, const char*, const char* = 0 ) const; #else - virtual QString translate( const char*, const char*, const char* = 0, int n = -1 ) const; + virtual QString translate( const char*, const char*, const char* = 0, int = -1 ) const; #endif }; diff --git a/src/Qtx/QtxTreeView.cxx b/src/Qtx/QtxTreeView.cxx index 094d64ee4..2709c362b 100644 --- a/src/Qtx/QtxTreeView.cxx +++ b/src/Qtx/QtxTreeView.cxx @@ -108,10 +108,10 @@ void QtxTreeView::Header::contextMenuEvent( QContextMenuEvent* e ) QIcon icon; if ( iconData.isValid() ) { #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - if ( qVariantCanConvert( iconData ) ) - icon = qVariantValue( iconData ); - else if ( qVariantCanConvert( iconData ) ) - icon = qVariantValue( iconData ); + if ( iconData.canConvert( QVariant::Icon ) ) + icon = iconData.value(); + else if ( iconData.canConvert( QVariant::Pixmap ) ) + icon = iconData.value(); #else if ( iconData.canConvert( QMetaType::QIcon ) ) icon = iconData.value(); diff --git a/src/Qtx/QtxWebBrowser.cxx b/src/Qtx/QtxWebBrowser.cxx index 1abd40bb2..146029464 100644 --- a/src/Qtx/QtxWebBrowser.cxx +++ b/src/Qtx/QtxWebBrowser.cxx @@ -43,11 +43,7 @@ #include #include #include -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) #include -#else -#include -#endif #include namespace diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_PyModule.cxx b/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_PyModule.cxx index 9c2d6d5e1..9141c339a 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_PyModule.cxx +++ b/src/SALOME_PYQT/SALOME_PYQT_GUILight/SALOME_PYQT_PyModule.cxx @@ -429,7 +429,7 @@ void PyModuleHelper::XmlHandler::createMenu( QDomNode& parentNode, icon, // icon label, // menu text tooltip, // status-bar text - QKeySequence( accel )[0], // keyboard accelerator + QKeySequence( accel ), // keyboard accelerator module(), // action owner toggle ); // toogled action myHelper->connectAction( action ); @@ -503,7 +503,7 @@ void PyModuleHelper::XmlHandler::createToolBar( QDomNode& parentNode ) icon, // icon label, // menu text tooltip, // status-bar text - QKeySequence( accel )[0], // keyboard accelerator + QKeySequence( accel ), // keyboard accelerator module(), // action owner toggle ); // toogled action myHelper->connectAction( action ); @@ -558,7 +558,7 @@ void PyModuleHelper::XmlHandler::insertPopupItems( QDomNode& parentNode, QMenu* icon, // icon label, // menu text tooltip, // status-bar text - QKeySequence( accel )[0], // keyboard accelerator + QKeySequence( accel ), // keyboard accelerator module(), // action owner toggle ); // toogled action myHelper->connectAction( action ); diff --git a/src/STD/STD_MDIDesktop.cxx b/src/STD/STD_MDIDesktop.cxx index 4dc02ba1f..3feae0641 100755 --- a/src/STD/STD_MDIDesktop.cxx +++ b/src/STD/STD_MDIDesktop.cxx @@ -32,6 +32,7 @@ #include #include +#include #include @@ -71,13 +72,7 @@ STD_MDIDesktop::~STD_MDIDesktop() */ SUIT_ViewWindow* STD_MDIDesktop::activeWindow() const { - SUIT_ViewWindow* wnd = 0; - - QWidget* wid = (QWidget*)myWorkspace->activeSubWindow(); - if ( wid && wid->inherits( "SUIT_ViewWindow" ) ) - wnd = (SUIT_ViewWindow*)wid; - - return wnd; + return qobject_cast( myWorkspace->activeSubWindow()->widget() ); } /*! @@ -90,7 +85,7 @@ QList STD_MDIDesktop::windows() const QList children = myWorkspace->subWindowList(); for ( QList::iterator it = children.begin(); it != children.end(); ++it ) { - SUIT_ViewWindow* vw = ::qobject_cast( (QWidget*)(*it) ); + SUIT_ViewWindow* vw = ::qobject_cast( (*it)->widget() ); if ( vw ) winList.append( vw ); } diff --git a/src/SUIT/SUIT_ActionOperation.cxx b/src/SUIT/SUIT_ActionOperation.cxx index fd9ab2e9c..cf3a9e964 100644 --- a/src/SUIT/SUIT_ActionOperation.cxx +++ b/src/SUIT/SUIT_ActionOperation.cxx @@ -54,19 +54,19 @@ QtxAction* SUIT_ActionOperation::action() const * Create new instance of QtxAction and set. */ void SUIT_ActionOperation::setAction( const QString& text, const QIcon& icon, - const QString& menuText, QKeySequence accel, + const QString& menuText, QKeySequence accel, QObject* parent, bool toggle ) { - setAction( new QtxAction( text, icon, menuText, accel[0], parent, toggle ) ); + setAction( new QtxAction( text, icon, menuText, accel, parent, toggle ) ); } /*!Set action. * Create new instance of QtxAction and set. */ void SUIT_ActionOperation::setAction( const QString& text, const QString& menuText, - QKeySequence accel, QObject* parent, bool toggle ) + QKeySequence accel, QObject* parent, bool toggle ) { - setAction( new QtxAction( text, menuText, accel[0], parent, toggle ) ); + setAction( new QtxAction( text, menuText, accel, parent, toggle ) ); } /*!Set action. diff --git a/src/SUIT/SUIT_Application.cxx b/src/SUIT/SUIT_Application.cxx index 811be3e9a..e978085bb 100755 --- a/src/SUIT/SUIT_Application.cxx +++ b/src/SUIT/SUIT_Application.cxx @@ -630,6 +630,28 @@ QAction* SUIT_Application::createAction( const int id, const QString& text, cons const QString& menu, const QString& tip, const int key, QObject* parent, const bool toggle, QObject* reciever, const char* member, const QString& shortcutAction ) +{ + return createAction( id, text, icon, menu, tip, QKeySequence(key), parent, toggle, reciever, member, shortcutAction ); +} + +/*! + Creates action and registers it both in menu manager and tool manager + \return new instance of action + \param id - proposed SUIT identificator + \param text - description + \param icon - icon for toolbar + \param menu - menu text + \param tip - tool tip + \param key - shortcut + \param parent - parent object + \param toggle - if it is TRUE the action will be a toggle action, otherwise it will be a command action + \param reciever - object that contains slot + \param member - slot to be called when action is activated +*/ +QAction* SUIT_Application::createAction( const int id, const QString& text, const QIcon& icon, + const QString& menu, const QString& tip, const QKeySequence& key, + QObject* parent, const bool toggle, QObject* reciever, + const char* member, const QString& shortcutAction ) { QtxAction* a = new QtxAction( text, icon, menu, key, parent, toggle, shortcutAction ); a->setStatusTip( tip ); diff --git a/src/SUIT/SUIT_Application.h b/src/SUIT/SUIT_Application.h index 542b160bb..1d80b8d0a 100755 --- a/src/SUIT/SUIT_Application.h +++ b/src/SUIT/SUIT_Application.h @@ -33,6 +33,7 @@ class QLabel; class QString; class QAction; class QWidget; +class QKeySequence; class SUIT_Desktop; class SUIT_ViewManager; @@ -174,6 +175,10 @@ protected: const QString&, const int, QObject* = 0, const bool = false, QObject* = 0, const char* = 0, const QString& = QString() ); + QAction* createAction( const int, const QString&, const QIcon&, const QString&, + const QString&, const QKeySequence&, QObject* = 0, + const bool = false, QObject* = 0, const char* = 0, + const QString& = QString() ); protected slots: virtual void onDesktopActivated(); diff --git a/src/SUIT/SUIT_LicenseDlg.cxx b/src/SUIT/SUIT_LicenseDlg.cxx index 550e9983b..e2c15f54e 100755 --- a/src/SUIT/SUIT_LicenseDlg.cxx +++ b/src/SUIT/SUIT_LicenseDlg.cxx @@ -25,11 +25,7 @@ #include #include #include -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) #include -#else -#include -#endif //#include #include #include diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index d67b2652a..acf361ef5 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -1294,14 +1294,24 @@ void SalomeApp_Application::moduleActionSelected( const int id ) /*!Gets CORBA::ORB_var*/ CORBA::ORB_var SalomeApp_Application::orb() { - ORB_INIT& init = *SINGLETON_::Instance(); - int size = qApp->arguments().size(); - char* argv[size]; - for ( int i = 0; i < size; ++i) - { - argv[i] = qApp->arguments()[i].toLatin1().data(); + static CORBA::ORB_var _orb; + + if ( CORBA::is_nil( _orb ) ) { + QStringList args = QApplication::arguments(); + int argc = args.size(); + std::vector args1(argc); + char** argv = new char*[argc]; + for ( int i = 0; i < argc; ++i ) { + args1[i] = args[i].toStdString(); + argv[i] = const_cast( args1[i].c_str() ); + } + + ORB_INIT& init = *SINGLETON_::Instance(); + _orb = init( argc, argv ); + + delete [] argv; } - static CORBA::ORB_var _orb = init( size, argv ); + return _orb; } diff --git a/src/SalomeApp/SalomeApp_Engine_i.cxx b/src/SalomeApp/SalomeApp_Engine_i.cxx index ee4b8c4b3..b26a8424c 100644 --- a/src/SalomeApp/SalomeApp_Engine_i.cxx +++ b/src/SalomeApp/SalomeApp_Engine_i.cxx @@ -302,16 +302,24 @@ char* SalomeApp_Engine_i::getVersion() */ CORBA::ORB_var SalomeApp_Engine_i::orb() { - ORB_INIT& init = *SINGLETON_::Instance(); - // TODO: using QApplication here looks ugly, think how to - // obtain the ORB reference in a nicer way... - int size = qApp->arguments().size(); - char* argv[size]; - for ( int i = 0; i < size; ++i) - { - argv[i] = qApp->arguments()[i].toLatin1().data(); + static CORBA::ORB_var _orb; + + if ( CORBA::is_nil( _orb ) ) { + QStringList args = QApplication::arguments(); + int argc = args.size(); + std::vector args1(argc); + char** argv = new char*[argc]; + for ( int i = 0; i < argc; ++i ) { + args1[i] = args[i].toStdString(); + argv[i] = const_cast( args1[i].c_str() ); + } + + ORB_INIT& init = *SINGLETON_::Instance(); + _orb = init( argc, argv ); + + delete [] argv; } - static CORBA::ORB_var _orb = init( size, argv ); + return _orb; } diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index 3da27bc8b..89560ca9a 100755 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -106,21 +106,13 @@ void MessageOutput( QtMsgType type, const QMessageLogContext &context, const QSt switch ( type ) { case QtDebugMsg: - //MESSAGE( "Debug: " << msg ); + //MESSAGE( "Debug: " << qPrintable(msg) ); break; case QtWarningMsg: -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - MESSAGE( "Warning: " << msg ); -#else - MESSAGE( "Warning: " << msg.toLatin1().data() ); -#endif + MESSAGE( "Warning: " << qPrintable(msg) ); break; case QtFatalMsg: -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - MESSAGE( "Fatal: " << msg ); -#else - MESSAGE( "Fatal: " << msg.toLatin1().data() ); -#endif + MESSAGE( "Fatal: " << qPrintable(msg) ); break; } } @@ -358,14 +350,15 @@ int main( int argc, char **argv ) qInstallMessageHandler( MessageOutput ); #endif +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) //Set a "native" graphic system in case if application runs on the remote host QString remote(getenv("REMOTEHOST")); QString client(getenv("SSH_CLIENT")); -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) if(remote.length() > 0 || client.length() > 0 ) { QApplication::setGraphicsSystem(QLatin1String("native")); } #endif + // add $QTDIR/plugins to the pluins search path for image plugins QString qtdir = qgetenv( "QT_ROOT_DIR" ); if ( qtdir.isEmpty() ) diff --git a/src/Session/Session_ServerCheck.cxx b/src/Session/Session_ServerCheck.cxx index 6ced17569..0b4a268fc 100644 --- a/src/Session/Session_ServerCheck.cxx +++ b/src/Session/Session_ServerCheck.cxx @@ -252,21 +252,27 @@ void Session_ServerCheck::run() // start check servers int current = 0; QString error; - int argc = QApplication::instance()->arguments().size(); - char* argv[argc]; - for ( int i = 0; i < argc; ++i) - { - argv[i] = QApplication::instance()->arguments()[i].toLatin1().data(); + + QStringList args = QApplication::arguments(); + int argc = args.size(); + std::vector args1(argc); + char** argv = new char*[argc]; + for ( int i = 0; i < argc; ++i ) { + args1[i] = args[i].toStdString(); + argv[i] = const_cast( args1[i].c_str() ); } + bool OK = true; + // 1. Check naming service - for ( int i = 0; i < myAttempts; i++ ) { + for ( int i = 0; (i < myAttempts) && OK; i++ ) { Locker locker( this ); setStep( current * myAttempts + i ); try { - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); + ORB_INIT& init = *SINGLETON_::Instance(); + CORBA::ORB_var orb = init( argc, argv ); CORBA::Object_var obj = orb->resolve_initial_references( "NameService" ); CosNaming::NamingContext_var _root_context = CosNaming::NamingContext::_narrow( obj ); if ( !CORBA::is_nil( _root_context ) ) { @@ -283,12 +289,13 @@ void Session_ServerCheck::run() if ( i == myAttempts-1 ) { setError( tr( "Unable to contact the naming service.\n" ) ); - return; + OK = false; + //return; } } // 2. Check registry server - for ( int i = 0; i < myAttempts ; i++ ) { + for ( int i = 0; (i < myAttempts) && OK ; i++ ) { Locker locker( this ); setStep( current * myAttempts + i ); @@ -331,12 +338,13 @@ void Session_ServerCheck::run() if ( i == myAttempts-1 ) { setError( tr( "Registry server is not found.\n%1" ).arg ( error ) ); - return; + OK = false; + //return; } } // 3. Check data server - for ( int i = 0; i < myAttempts ; i++ ) { + for ( int i = 0; (i < myAttempts) && OK ; i++ ) { Locker locker( this ); setStep( current * myAttempts + i ); @@ -379,12 +387,13 @@ void Session_ServerCheck::run() if ( i == myAttempts-1 ) { setError( tr( "Study server is not found.\n%1" ).arg ( error ) ); - return; + OK = false; + //return; } } // 4. Check module catalogue server - for ( int i = 0; i < myAttempts ; i++ ) { + for ( int i = 0; (i < myAttempts) && OK ; i++ ) { Locker locker( this ); setStep( current * myAttempts + i ); @@ -427,12 +436,13 @@ void Session_ServerCheck::run() if ( i == myAttempts-1 ) { setError( tr( "Module catalogue server is not found.\n%1" ).arg ( error ) ); - return; + OK = false; + //return; } } // 5. Check data server - for ( int i = 0; i < myAttempts ; i++ ) { + for ( int i = 0; (i < myAttempts) && OK ; i++ ) { Locker locker( this ); setStep( current * myAttempts + i ); @@ -475,13 +485,14 @@ void Session_ServerCheck::run() if ( i == myAttempts-1 ) { setError( tr( "Session server is not found.\n%1" ).arg ( error ) ); - return; + OK = false; + //return; } } // 6. Check C++ container if ( myCheckCppContainer ) { - for ( int i = 0; i < myAttempts ; i++ ) { + for ( int i = 0; (i < myAttempts) && OK ; i++ ) { Locker locker( this ); setStep( current * myAttempts + i ); @@ -525,14 +536,15 @@ void Session_ServerCheck::run() if ( i == myAttempts-1 ) { setError( tr( "C++ container is not found.\n%1" ).arg ( error ) ); - return; + OK = false; + //return; } } } // 7. Check Python container if ( myCheckPyContainer ) { - for ( int i = 0; i < myAttempts ; i++ ) { + for ( int i = 0; (i < myAttempts) && OK ; i++ ) { Locker locker( this ); setStep( current * myAttempts + i ); @@ -576,14 +588,15 @@ void Session_ServerCheck::run() if ( i == myAttempts-1 ) { setError( tr( "Python container is not found.\n%1" ).arg ( error ) ); - return; + OK = false; + //return; } } } // 8. Check supervision container if ( myCheckSVContainer ) { - for ( int i = 0; i < myAttempts ; i++ ) { + for ( int i = 0; (i < myAttempts) && OK ; i++ ) { Locker locker( this ); setStep( current * myAttempts + i ); @@ -627,8 +640,11 @@ void Session_ServerCheck::run() if ( i == myAttempts-1 ) { setError( tr( "Supervision container is not found.\n%1" ).arg ( error ) ); - return; + OK = false; + //return; } } } + + delete [] argv; } diff --git a/src/Style/Style_Salome.cxx b/src/Style/Style_Salome.cxx index 57d00a918..56d8c5de8 100644 --- a/src/Style/Style_Salome.cxx +++ b/src/Style/Style_Salome.cxx @@ -59,11 +59,7 @@ #include #include #include - -#include -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -#include -#endif +#include #define SHADOW 1 #define LINE_GR_MARGIN 10 diff --git a/src/VTKViewer/CMakeLists.txt b/src/VTKViewer/CMakeLists.txt index 47194846d..35f45a6d8 100755 --- a/src/VTKViewer/CMakeLists.txt +++ b/src/VTKViewer/CMakeLists.txt @@ -187,4 +187,4 @@ FILE(GLOB GUIVTI_DATA "${CMAKE_CURRENT_SOURCE_DIR}/resources/*.vti") INSTALL(FILES ${GUIVTI_DATA} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA}) FILE(GLOB GUITXT_DATA "${CMAKE_CURRENT_SOURCE_DIR}/resources/*.txt") -INSTALL(FILES ${GUITXT_DATA} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA}) \ No newline at end of file +INSTALL(FILES ${GUITXT_DATA} DESTINATION ${SALOME_GUI_INSTALL_RES_DATA}) diff --git a/src/VTKViewer/VTKViewer_RenderWindow.cxx b/src/VTKViewer/VTKViewer_RenderWindow.cxx index d4dd5f76e..611346f4d 100755 --- a/src/VTKViewer/VTKViewer_RenderWindow.cxx +++ b/src/VTKViewer/VTKViewer_RenderWindow.cxx @@ -34,9 +34,6 @@ #ifndef WIN32 #include #include -//#include -//#include -//#include #endif /*!Constructor. Create render window with parant \a parent and name \a name. -- 2.39.2