From aa65d61ac3ba1846dd1ce50344aff91de0971b3a Mon Sep 17 00:00:00 2001 From: stv Date: Mon, 9 Jul 2007 12:45:13 +0000 Subject: [PATCH] *** empty log message *** --- src/LogWindow/LogWindow.cxx | 208 +++-- src/LogWindow/LogWindow.h | 93 +-- src/STD/STD_Application.cxx | 160 ++-- src/STD/STD_Application.h | 22 +- src/STD/resources/STD_images.ts | 36 +- src/STD/resources/STD_msg_en.ts | 38 +- src/SUIT/SUIT_Accel.cxx | 18 +- src/SUIT/SUIT_Accel.h | 25 +- src/SUIT/SUIT_ActionOperation.cxx | 18 +- src/SUIT/SUIT_ActionOperation.h | 5 +- src/SUIT/SUIT_Application.cxx | 14 +- src/SUIT/SUIT_Application.h | 10 +- src/SUIT/SUIT_DataObject.cxx | 5 +- src/SUIT/SUIT_DataObject.h | 14 +- src/SUIT/SUIT_DataObjectKey.cxx | 2 +- src/SUIT/SUIT_DataOwner.cxx | 15 +- src/SUIT/SUIT_DataOwner.h | 9 +- src/SUIT/SUIT_Desktop.cxx | 10 +- src/SUIT/SUIT_ExceptionHandler.cxx | 4 +- src/SUIT/SUIT_FileDlg.cxx | 51 +- src/SUIT/SUIT_FileDlg.h | 2 +- src/SUIT/SUIT_FileValidator.cxx | 56 +- src/SUIT/SUIT_FileValidator.h | 3 +- src/SUIT/SUIT_MessageBox.cxx | 1148 +++++++++++++++++++++------- src/SUIT/SUIT_MessageBox.h | 177 +++-- src/SUIT/SUIT_Operation.cxx | 16 +- src/SUIT/SUIT_Operation.h | 4 +- src/SUIT/SUIT_OverrideCursor.cxx | 2 + src/SUIT/SUIT_OverrideCursor.h | 5 +- src/SUIT/SUIT_PopupClient.cxx | 2 - src/SUIT/SUIT_PopupClient.h | 2 +- src/SUIT/SUIT_PreferenceMgr.cxx | 162 ++++ src/SUIT/SUIT_PreferenceMgr.h | 62 ++ src/SUIT/SUIT_ResourceMgr.cxx | 33 +- src/SUIT/SUIT_SelectionMgr.cxx | 8 +- src/SUIT/SUIT_SelectionMgr.h | 9 +- src/SUIT/SUIT_Selector.cxx | 4 +- src/SUIT/SUIT_Selector.h | 7 +- src/SUIT/SUIT_Session.cxx | 38 +- src/SUIT/SUIT_Session.h | 16 +- src/SUIT/SUIT_Study.cxx | 14 +- src/SUIT/SUIT_Study.h | 8 +- src/SUIT/SUIT_ToolButton.cxx | 42 +- src/SUIT/SUIT_ToolButton.h | 7 +- src/SUIT/SUIT_Tools.cxx | 2 +- src/SUIT/SUIT_Tools.h | 7 +- src/SUIT/SUIT_TreeSync.h | 53 +- src/SUIT/SUIT_ViewManager.cxx | 23 +- src/SUIT/SUIT_ViewManager.h | 18 +- src/SUIT/SUIT_ViewModel.cxx | 18 + src/SUIT/SUIT_ViewModel.h | 17 +- src/SUIT/SUIT_ViewWindow.cxx | 12 +- src/SUIT/SUIT_ViewWindow.h | 4 +- src/SUIT/resources/SUIT_msg_en.ts | 29 +- 54 files changed, 1840 insertions(+), 927 deletions(-) create mode 100644 src/SUIT/SUIT_PreferenceMgr.cxx create mode 100644 src/SUIT/SUIT_PreferenceMgr.h diff --git a/src/LogWindow/LogWindow.cxx b/src/LogWindow/LogWindow.cxx index 3570c6ed6..fb6ef862d 100755 --- a/src/LogWindow/LogWindow.cxx +++ b/src/LogWindow/LogWindow.cxx @@ -18,28 +18,35 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : LogWindow.cxx +// Author : Vadim SANDLER, Open CASCADE S.A. (vadim.sandler@opencascade.com) +// Module : SALOME #include "LogWindow.h" -#include -#include -#include - -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#include -#include #include #include +#include +#include #define DEFAULT_SEPARATOR "***" /*! - Converts rich text to plain text + \brief Convert rich text to plain text. + \internal + \param richText rich text string + \return converted plain text string */ static QString plainText( const QString& richText ) { @@ -61,12 +68,27 @@ static QString plainText( const QString& richText ) } /*! - Default constructor + \class LogWindow + \brief Widget, displaying log messages. + + The log messages window provides operations like: + - show messages + - display timestamps at the message beginning + - color messages according to their purposes (e.g., errors/warning) + - clear log output + - copy messages to clipvoard + - save message log to to the text file +*/ + +/*! + \brief Constructor. + + Creates new messages log window widget. + \param parent parent widget */ LogWindow::LogWindow( QWidget* parent ) : QFrame( parent ), -SUIT_PopupClient(), -myOpFlags( All ) + SUIT_PopupClient() { SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); @@ -92,14 +114,17 @@ myOpFlags( All ) } /*! - Destructor + \brief Destructor. + + Does nothing for the moment. */ LogWindow::~LogWindow() { } /*! - Returnss the banner (title of message log) + \brief Get current banner (message log window header text). + \return string representing the current banner */ QString LogWindow::banner() const { @@ -107,7 +132,8 @@ QString LogWindow::banner() const } /*! - Returnss the separator (line printing between messages) + \brief Get current separator (text which is printed between messages). + \return string representing the current separator */ QString LogWindow::separator() const { @@ -115,8 +141,8 @@ QString LogWindow::separator() const } /*! - Sets banner (title of message log) - \param banner - new title + \brief Set current banner (message log window header text). + \param banner new banner */ void LogWindow::setBanner( const QString& banner ) { @@ -126,8 +152,8 @@ void LogWindow::setBanner( const QString& banner ) } /*! - Set separator (line printing between messages) - \param separator - new separator + Set current separator (text which is printed between messages). + \param separator new separator */ void LogWindow::setSeparator( const QString& separator ) { @@ -137,7 +163,13 @@ void LogWindow::setSeparator( const QString& separator ) } /*! - Custom event handler + \brief Custom event handler. + + Process context popup menu request event. + + \param o object + \param e event + \return True if the event is processed and further processing should be stopped */ bool LogWindow::eventFilter( QObject* o, QEvent* e ) { @@ -150,9 +182,9 @@ bool LogWindow::eventFilter( QObject* o, QEvent* e ) } /*! - Puts message to log window - \param message - text of message - \flags - bit flags which defines view of printed message + \brief Put new message to the log window. + \param message text of the message + \param flags ORed flags which define how the message should be printed */ void LogWindow::putMessage( const QString& message, const int flags ) { @@ -160,10 +192,10 @@ void LogWindow::putMessage( const QString& message, const int flags ) } /*! - Puts message to log window - \param message - text of message - \color - text color of printed message - \flags - bit flags which defines view of printed message + \brief Put new message to the log window. + \param message text of the message + \param color text color of the message + \param flags ORed flags which define how the message should be printed */ void LogWindow::putMessage( const QString& message, const QColor& color, const int flags ) { @@ -208,8 +240,8 @@ void LogWindow::putMessage( const QString& message, const QColor& color, const i } /*! - Clears message log - \param clearHistory - if it is true, then also history is cleared + \brief Clear message log. + \param clearHistory if True, clear also the messages history */ void LogWindow::clear( bool clearHistory ) { @@ -227,8 +259,9 @@ void LogWindow::clear( bool clearHistory ) } /*! - Saves log to file - \param fileName - name of file + \brief Save messages log to the file. + \param fileName name of the file + \return \c true on success and \c false on error */ bool LogWindow::saveLog( const QString& fileName ) { @@ -244,7 +277,7 @@ bool LogWindow::saveLog( const QString& fileName ) stream << QTime::currentTime().toString( "hh:mm:ss" ) << endl; stream << "*****************************************" << endl; - for ( int i = 0; i < (int)myHistory.count(); i++ ) + for ( int i = 0; i < myHistory.count(); i++ ) stream << myHistory[ i ] << endl; file.close(); @@ -252,50 +285,46 @@ bool LogWindow::saveLog( const QString& fileName ) } /*! - Creates actions + \brief Create context popup menu actions. */ void LogWindow::createActions() { - QAction* a = new QAction( tr( "&Copy" ), this ); - a->setStatusTip( tr( "&Copy" ) ); + QAction* a = new QAction( tr( "EDIT_COPY_CMD" ), this ); + a->setStatusTip( tr( "EDIT_COPY_CMD" ) ); connect( a, SIGNAL( triggered( bool ) ), SLOT( onCopy() ) ); myActions.insert( CopyId, a ); - a = new QAction( tr( "Clea&r" ), this ); - a->setStatusTip( tr( "Clea&r" ) ); + a = new QAction( tr( "EDIT_CLEAR_CMD" ), this ); + a->setStatusTip( tr( "EDIT_CLEAR_CMD" ) ); connect( a, SIGNAL( triggered( bool ) ), SLOT( onClear() ) ); myActions.insert( ClearId, a ); - a = new QAction( tr( "Select &All" ), this ); - a->setStatusTip( tr( "Select &All" ) ); + a = new QAction( tr( "EDIT_SELECTALL_CMD" ), this ); + a->setStatusTip( tr( "EDIT_SELECTALL_CMD" ) ); connect( a, SIGNAL( triggered( bool ) ), SLOT( onSelectAll() ) ); myActions.insert( SelectAllId, a ); - a = new QAction( tr( "&Save log to file..." ), this ); - a->setStatusTip( tr( "&Save log to file..." ) ); + a = new QAction( tr( "EDIT_SAVETOFILE_CMD" ), this ); + a->setStatusTip( tr( "EDIT_SAVETOFILE_CMD" ) ); connect( a, SIGNAL( triggered( bool ) ), SLOT( onSaveToFile() ) ); myActions.insert( SaveToFileId, a ); } /*! - Redefined virtual method for popup filling + \brief Create the context popup menu. + + Fill in the popup menu with the commands. + + \param menu context popup menu */ void LogWindow::contextMenuPopup( QMenu* popup ) { - if ( myOpFlags & CopyId ) - popup->addAction( myActions[ CopyId ] ); - if ( myOpFlags & ClearId ) - popup->addAction( myActions[ ClearId ] ); - + popup->addAction( myActions[ CopyId ] ); + popup->addAction( myActions[ ClearId ] ); popup->addSeparator(); - - if ( myOpFlags & SelectAllId ) - popup->addAction( myActions[ SelectAllId ] ); - + popup->addAction( myActions[ SelectAllId ] ); popup->addSeparator(); - - if ( myOpFlags & SaveToFileId ) - popup->addAction( myActions[ SaveToFileId ] ); + popup->addAction( myActions[ SaveToFileId ] ); Qtx::simplifySeparators( popup ); @@ -303,25 +332,20 @@ void LogWindow::contextMenuPopup( QMenu* popup ) } /*! - Updates enable status of actions + \brief Update menu actions. + + Update context popup menu action state. */ void LogWindow::updateActions() { -/* - int paraFrom, paraTo, indexFrom, indexTo; - myView->getSelection( ¶From, &indexFrom, ¶To, &indexTo ); - bool allSelected = myView->hasSelectedText() && - !paraFrom && paraTo == myView->paragraphs() - 1 && - !indexFrom && indexTo == myView->paragraphLength( paraTo ); - myActions[ CopyId ]->setEnabled( ( myOpFlags & CopyId )&& myView->hasSelectedText() ); - myActions[ ClearId ]->setEnabled( ( myOpFlags & ClearId ) && myView->document()->blockCount() > myBannerSize ); - myActions[ SelectAllId ]->setEnabled( ( myOpFlags & SelectAllId ) && !allSelected ); - myActions[ SaveToFileId ]->setEnabled( ( myOpFlags & SaveToFileId ) && myHistory.count() > 0 ); -*/ + myActions[CopyId]->setEnabled( myView->textCursor().hasSelection() ); + myActions[ ClearId ]->setEnabled( myView->document()->blockCount() > myBannerSize ); + myActions[SelectAllId]->setEnabled( !myView->document()->isEmpty() ); + myActions[ SaveToFileId ]->setEnabled( myHistory.count() > 0 ); } /*! - SLOT: called if user click "Save" in popup + \brief Called when user selects "Save To File" command in the popup menu. */ void LogWindow::onSaveToFile() { @@ -341,11 +365,11 @@ void LogWindow::onSaveToFile() QApplication::restoreOverrideCursor(); if ( !bOk ) - SUIT_MessageBox::error1( this, tr( "Error" ), tr( "Can't save file" ), tr( "OK" ) ); + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "ERR_CANT_SAVE_FILE" ) ); } /*! - SLOT: called if user click "Select all" in popup + \brief Called when user selects "Select all" command in the popup menu. */ void LogWindow::onSelectAll() { @@ -354,7 +378,7 @@ void LogWindow::onSelectAll() } /*! - SLOT: called if user click "Clear" in popup + \brief Called when user click "Clear" command in the popup menu. */ void LogWindow::onClear() { @@ -362,7 +386,7 @@ void LogWindow::onClear() } /*! - SLOT: called if user click "Copy" in popup + \brief Called when user click "Copy" command in the popup menu. */ void LogWindow::onCopy() { @@ -370,7 +394,39 @@ void LogWindow::onCopy() myView->copy(); } -void LogWindow::setOperationsFlags( int flags ) +/*! + \brief Set actions to be visible in the context popup menu. + + Actions, which IDs are set in \a flags parameter, will be shown in the + context popup menu. Other actions will not be shown. + + \param flags ORed together actions flags +*/ +void LogWindow::setMenuActions( const int flags ) { - myOpFlags = flags; + myActions[CopyId]->setVisible( flags & CopyId ); + myActions[ClearId]->setVisible( flags & ClearId ); + myActions[SelectAllId]->setVisible( flags & SelectAllId ); + myActions[SaveToFileId]->setVisible( flags & SaveToFileId ); } + +/*! + \brief Get menu actions which are currently visible in the context popup menu. + \return ORed together actions flags + \sa setMenuActions() +*/ +int LogWindow::menuActions() const +{ + int ret = 0; + ret = ret | ( myActions[CopyId]->isVisible() ? CopyId : 0 ); + ret = ret | ( myActions[ClearId]->isVisible() ? ClearId : 0 ); + ret = ret | ( myActions[SelectAllId]->isVisible() ? SelectAllId : 0 ); + ret = ret | ( myActions[SaveToFileId]->isVisible() ? SaveToFileId : 0 ); + return ret; +} + +/*! + \fn virtual QString LogWindow::popupClientType() const; + \brief Get popup client symbolic name, used in popup menu management system. + \return symbolic name +*/ diff --git a/src/LogWindow/LogWindow.h b/src/LogWindow/LogWindow.h index 3c8b71c11..b1816f8c8 100755 --- a/src/LogWindow/LogWindow.h +++ b/src/LogWindow/LogWindow.h @@ -20,32 +20,27 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // File : LogWindow.h -// Author : -// Module : KERNEL +// Author : Vadim SANDLER, Open CASCADE S.A. (vadim.sandler@opencascade.com) +// Module : SALOME -#ifndef LogWindow_HeaderFile -#define LogWindow_HeaderFile +#ifndef LOGWINDOW_H +#define LOGWINDOW_H -#if defined LOGWINDOW_EXPORTS #if defined WIN32 -#define LOGWINDOW_EXPORT __declspec( dllexport ) +# if defined LOGWINDOW_EXPORTS +# define LOGWINDOW_EXPORT __declspec( dllexport ) +# else +# define LOGWINDOW_EXPORT __declspec( dllimport ) +# endif #else -#define LOGWINDOW_EXPORT -#endif -#else -#if defined WIN32 -#define LOGWINDOW_EXPORT __declspec( dllimport ) -#else -#define LOGWINDOW_EXPORT -#endif +# define LOGWINDOW_EXPORT #endif #include -#include -#include - -#include +#include +#include +#include #ifdef WIN32 #pragma warning( disable:4251 ) @@ -54,34 +49,30 @@ class QAction; class QTextEdit; -/*! - \class LogWindow - Widget, showing logs message. Allows to show, to clear, to copy messages and to save then to file -*/ class LOGWINDOW_EXPORT LogWindow : public QFrame, public SUIT_PopupClient { Q_OBJECT public: - //! popup operation flags + //! Context popup menu actions flags enum { - CopyId = 0x01, - ClearId = 0x02, - SelectAllId = 0x04, - SaveToFileId = 0x08, - All = CopyId | ClearId | SelectAllId | SaveToFileId, + CopyId = 0x01, //!< "Copy" menu action + ClearId = 0x02, //!< "Clear" menu action + SelectAllId = 0x04, //!< "Select All" menu action + SaveToFileId = 0x08, //!< "Save To File" menu action + All = CopyId | ClearId | SelectAllId | SaveToFileId //!< all menu actions }; - //! display messages flags + //! Display messages flags enum { - DisplayNormal = 0x00, - DisplayDate = 0x01, - DisplayTime = 0x02, - DisplaySeparator = 0x04, - DisplayNoColor = 0x08, - DisplayDateTime = DisplayDate | DisplayTime + DisplayNormal = 0x00, //!< do not display extra data + DisplayDate = 0x01, //!< display message date + DisplayTime = 0x02, //!< display message time + DisplaySeparator = 0x04, //!< display separator between messages + DisplayNoColor = 0x08, //!< display colored message + DisplayDateTime = DisplayDate | DisplayTime //!< display date & time }; public: @@ -91,21 +82,22 @@ public: virtual QString popupClientType() const { return QString( "LogWindow" ); } virtual void contextMenuPopup( QMenu* ); - virtual bool eventFilter( QObject* o, QEvent* e ); + virtual bool eventFilter( QObject*, QEvent* ); QString banner() const; QString separator() const; - void setBanner( const QString& banner ); - void setSeparator( const QString& separator ); + void setBanner( const QString& ); + void setSeparator( const QString& ); - void putMessage( const QString& message, const int = DisplayNormal ); - virtual void putMessage( const QString& message, const QColor&, const int = DisplayNormal ); - void clear( const bool clearHistory = false ); + void putMessage( const QString&, const int = DisplayNormal ); + virtual void putMessage( const QString&, const QColor&, const int = DisplayNormal ); + void clear( const bool = false ); - bool saveLog( const QString& fileName ); + bool saveLog( const QString& ); - void setOperationsFlags( int flags ); + void setMenuActions( const int ); + int menuActions() const; protected slots: void onSaveToFile(); @@ -118,17 +110,16 @@ private: void updateActions(); private: - QTextEdit* myView; - QString myBanner; - QStringList myHistory; - QString mySeparator; - int myBannerSize; - QMap myActions; - int myOpFlags; + QTextEdit* myView; //!< internal view window + QString myBanner; //!< current banner + QStringList myHistory; //!< messages history + QString mySeparator; //!< current separator + int myBannerSize; //!< current banner's size + QMap myActions; //!< popup menu actions }; #ifdef WIN32 #pragma warning( default:4251 ) #endif -#endif +#endif // LOGWINDOW_H diff --git a/src/STD/STD_Application.cxx b/src/STD/STD_Application.cxx index d64c3ae5f..46522f56e 100755 --- a/src/STD/STD_Application.cxx +++ b/src/STD/STD_Application.cxx @@ -20,29 +20,23 @@ #include "STD_MDIDesktop.h" -#include "STD_CloseDlg.h" - #include +#include #include #include -#include -#include #include +#include #include #include #include #include -#include -#include -#include -#include -#include -#include -#include - -#include +#include +#include +#include +#include +#include /*!Create and return new instance of STD_Application*/ extern "C" STD_EXPORT SUIT_Application* createApplication() @@ -53,10 +47,9 @@ extern "C" STD_EXPORT SUIT_Application* createApplication() /*!Constructor.*/ STD_Application::STD_Application() : SUIT_Application(), -myExitConfirm( true ), -myEditEnabled( true ), -myActiveViewMgr( 0 ) - + myActiveViewMgr( 0 ), + myExitConfirm( true ), + myEditEnabled( true ) { setDesktop( new STD_MDIDesktop() ); } @@ -134,7 +127,8 @@ void STD_Application::onDesktopClosing( SUIT_Desktop*, QCloseEvent* e ) return; } - if ( !isPossibleToClose() ) + bool closePermanently; + if ( !isPossibleToClose( closePermanently ) ) { e->ignore(); return; @@ -224,11 +218,11 @@ void STD_Application::createActions() createMenu( FileNewId, fileMenu, 0 ); createMenu( FileOpenId, fileMenu, 0 ); - createMenu( FileCloseId, fileMenu, 0 ); - createMenu( separator(), fileMenu, -1, 0 ); - createMenu( FileSaveId, fileMenu, 0 ); - createMenu( FileSaveAsId, fileMenu, 0 ); - createMenu( separator(), fileMenu, -1, 0 ); + createMenu( FileCloseId, fileMenu, 5 ); + createMenu( separator(), fileMenu, -1, 5 ); + createMenu( FileSaveId, fileMenu, 5 ); + createMenu( FileSaveAsId, fileMenu, 5 ); + createMenu( separator(), fileMenu, -1, 5 ); createMenu( separator(), fileMenu ); createMenu( FileExitId, fileMenu ); @@ -403,7 +397,9 @@ void STD_Application::afterCloseDoc() /*!Close document, if it's possible.*/ void STD_Application::onCloseDoc( bool ask ) { - if ( ask && !isPossibleToClose() ) + bool closePermanently = true; + + if ( ask && !isPossibleToClose( closePermanently ) ) return; SUIT_Study* study = activeStudy(); @@ -411,7 +407,7 @@ void STD_Application::onCloseDoc( bool ask ) beforeCloseDoc( study ); if ( study ) - study->closeDocument(myClosePermanently); + study->closeDocument( closePermanently ); clearViewManagers(); @@ -420,11 +416,9 @@ void STD_Application::onCloseDoc( bool ask ) int aNbStudies = 0; QList apps = SUIT_Session::session()->applications(); - for ( unsigned i = 0; i < apps.count(); i++ ) + for ( int i = 0; i < apps.count(); i++ ) aNbStudies += apps.at( i )->getNbStudies(); - // STV: aNbStudies - number of currently existing studies (exclude currently closed) - // STV: aNbStudies should be compared with 0. if ( aNbStudies ) { savePreferences(); @@ -445,42 +439,56 @@ void STD_Application::onCloseDoc( bool ask ) /*!Check the application on closing. * \retval true if possible, else false */ -bool STD_Application::isPossibleToClose() +bool STD_Application::isPossibleToClose( bool& closePermanently ) { - myClosePermanently = true; //SRN: BugID: IPAL9021 if ( activeStudy() ) { activeStudy()->abortAllOperations(); if ( activeStudy()->isModified() ) { QString sName = activeStudy()->studyName().trimmed(); - QString msg = sName.isEmpty() ? tr( "INF_DOC_MODIFIED" ) : tr ( "INF_DOCUMENT_MODIFIED" ).arg( sName ); - - //SRN: BugID: IPAL9021: Begin - STD_CloseDlg dlg(desktop()); - switch( dlg.exec() ) - { - case 1: - if ( activeStudy()->isSaved() ) - onSaveDoc(); - else if ( !onSaveAsDoc() ) - return false; - break; - case 2: - break; - case 3: - myClosePermanently = false; - break; - case 4: - default: - return false; - } - //SRN: BugID: IPAL9021: End + return closeAction( closeChoice( sName ), closePermanently ); } } return true; } +int STD_Application::closeChoice( const QString& docName ) +{ + int answer = SUIT_MessageBox::question( desktop(), tr( "CLOSE_STUDY" ), tr( "CLOSE_QUESTION" ).arg( docName ), + SUIT_MessageBox::Save | SUIT_MessageBox::Discard | SUIT_MessageBox::Cancel, + SUIT_MessageBox::Save ); + + int res = CloseCancel; + if ( answer == SUIT_MessageBox::Save ) + res = CloseSave; + else if ( answer == SUIT_MessageBox::Discard ) + res = CloseDiscard; + + return res; +} + +bool STD_Application::closeAction( const int choice, bool& closePermanently ) +{ + bool res = true; + switch( choice ) + { + case CloseSave: + if ( activeStudy()->isSaved() ) + onSaveDoc(); + else if ( !onSaveAsDoc() ) + res = false; + break; + case CloseDiscard: + break; + case CloseCancel: + default: + res = false; + } + + return res; +} + /*!Save document if all ok, else error message.*/ void STD_Application::onSaveDoc() { @@ -502,10 +510,8 @@ void STD_Application::onSaveDoc() { putInfo( "" ); // displaying a message box as SUIT_Validator in case file can't be written (the most frequent case) - SUIT_MessageBox::error1( desktop(), - tr( "ERR_ERROR" ), - tr( "ERR_PERMISSION_DENIED" ).arg( activeStudy()->studyName() ), - tr( "BUT_OK" ) ); + SUIT_MessageBox::critical( desktop(), tr( "ERR_ERROR" ), + tr( "ERR_PERMISSION_DENIED" ).arg( activeStudy()->studyName() ) ); } else putInfo( tr( "INF_DOC_SAVED" ).arg( "" ) ); @@ -541,9 +547,7 @@ bool STD_Application::onSaveAsDoc() QApplication::restoreOverrideCursor(); if ( !isOk ) - SUIT_MessageBox::error1( desktop(), tr( "ERROR" ), - tr( "INF_DOC_SAVING_FAILS" ).arg( aName ), - tr( "BUT_OK" ) ); + SUIT_MessageBox::critical( desktop(), tr( "ERROR" ), tr( "INF_DOC_SAVING_FAILS" ).arg( aName ) ); } studySaved( activeStudy() ); @@ -556,9 +560,9 @@ void STD_Application::onExit() { 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 ) + aAnswer = SUIT_MessageBox::question( desktop(), tr( "INF_DESK_EXIT" ), tr( "QUE_DESK_EXIT" ), + SUIT_MessageBox::Ok | SUIT_MessageBox::Cancel, SUIT_MessageBox::Cancel ); + if ( aAnswer == SUIT_MessageBox::Ok ) SUIT_Session::session()->closeSession(); } @@ -757,7 +761,7 @@ void STD_Application::onViewStatusBar( bool on ) /*!Call SUIT_MessageBox::info1(...) with about information.*/ void STD_Application::onHelpAbout() { - SUIT_MessageBox::info1( desktop(), tr( "About" ), tr( "ABOUT_INFO" ), "&OK" ); + SUIT_MessageBox::information( desktop(), tr( "About" ), tr( "ABOUT_INFO" ) ); } /*!Create empty study. \n @@ -822,9 +826,9 @@ QString STD_Application::getFileName( bool open, const QString& initial, const Q isOk = true; else { - int aEnd = aUsedFilter.lastIndexOf( ')' ); - int aStart = aUsedFilter.lastIndexOf( '(', aEnd ); - QString wcStr = aUsedFilter.mid( aStart + 1, aEnd - aStart - 1 ); + int aEnd = aUsedFilter.lastIndexOf( ')' ); + int aStart = aUsedFilter.lastIndexOf( '(', aEnd ); + QString wcStr = aUsedFilter.mid( aStart + 1, aEnd - aStart - 1 ); int idx = 0; QStringList extList; @@ -838,23 +842,23 @@ QString STD_Application::getFileName( bool open, const QString& initial, const Q if ( !extList.isEmpty() && !extList.contains( SUIT_Tools::extension( aName ) ) ) aName += QString( ".%1" ).arg( extList.first() ); - if ( QFileInfo( aName ).exists() ) + if ( QFileInfo( aName ).exists() ) { - int aAnswer = SUIT_MessageBox::warn3( desktop(), tr( "TIT_FILE_SAVEAS" ), - tr( "MSG_FILE_EXISTS" ).arg( aName ), - tr( "BUT_YES" ), tr( "BUT_NO" ), tr( "BUT_CANCEL" ), 1, 2, 3, 1 ); - if ( aAnswer == 3 ) + int aAnswer = SUIT_MessageBox::question( desktop(), tr( "TIT_FILE_SAVEAS" ), + tr( "MSG_FILE_EXISTS" ).arg( aName ), + SUIT_MessageBox::Yes | SUIT_MessageBox::No | SUIT_MessageBox::Cancel, SUIT_MessageBox::Yes ); + if ( aAnswer == SUIT_MessageBox::Cancel ) { // cancelled aName = QString::null; - isOk = true; + isOk = true; } - else if ( aAnswer == 2 ) // not save to this file - anOldPath = aName; // not to return to the same initial dir at each "while" step - else // overwrite the existing file - isOk = true; + else if ( aAnswer == SUIT_MessageBox::No ) // not save to this file + anOldPath = aName; // not to return to the same initial dir at each "while" step + else // overwrite the existing file + isOk = true; } - else - isOk = true; + else + isOk = true; } } return aName; diff --git a/src/STD/STD_Application.h b/src/STD/STD_Application.h index 9830a0845..3ff6d57bc 100755 --- a/src/STD/STD_Application.h +++ b/src/STD/STD_Application.h @@ -23,18 +23,20 @@ #include -#include -#include - -#include -#include +#include class QMenu; +class QCloseEvent; +class QContextMenuEvent; + class QToolBar; class QtxAction; class SUIT_Operation; class SUIT_ViewWindow; class SUIT_ToolWindow; +class SUIT_Desktop; +class SUIT_ViewManager; +class SUIT_PopupClient; typedef QList ViewManagerList; @@ -51,13 +53,15 @@ public: ViewWindowsId, ViewToolBarsId, ViewStatusBarId, NewWindowId, EditCutId, EditCopyId, EditPasteId, HelpAboutId, UserID }; + enum { CloseSave, CloseDiscard, CloseCancel }; + public: STD_Application(); virtual ~STD_Application(); virtual QString applicationName() const; - virtual bool isPossibleToClose(); + virtual bool isPossibleToClose( bool& ); virtual bool useFile( const QString& ); virtual void createEmptyStudy(); @@ -80,7 +84,7 @@ public: virtual QString getFileFilter() const { return QString::null; } virtual QString getFileName( bool open, const QString& initial, const QString& filters, - const QString& caption, QWidget* parent ); + const QString& caption, QWidget* parent ); QString getDirectory( const QString& initial, const QString& caption, QWidget* parent ); virtual void start(); @@ -154,6 +158,9 @@ protected: virtual void setActiveViewManager( SUIT_ViewManager* ); + virtual bool closeAction( const int, bool& ); + virtual int closeChoice( const QString& ); + private: ViewManagerList myViewMgrs; SUIT_ViewManager* myActiveViewMgr; @@ -161,7 +168,6 @@ private: private: bool myExitConfirm; bool myEditEnabled; - bool myClosePermanently; }; #if defined WIN32 diff --git a/src/STD/resources/STD_images.ts b/src/STD/resources/STD_images.ts index c7b4d3fd1..90fe0caa3 100644 --- a/src/STD/resources/STD_images.ts +++ b/src/STD/resources/STD_images.ts @@ -1,106 +1,96 @@ - - + - @default + @default - ICON_FILE_NEW new.png - ICON_DESK_WINDOW_TILE tile.png - ICON_PRINT print.png - ICON_RESET reset.png - ICON_HELP help.png - ICON_EDIT_CUT cut.png - ICON_DESK_WINDOW_CASCADE cascade.png - ICON_EDIT_COPY copy.png - ICON_APP_DEFAULTICON default.png - ICON_FILE_SAVE save.png - ICON_FILE_OPEN open.png - ICON_DESK_WINDOW_HSPLIT htile.png - ICON_APP_EDIT_REDO redo.png - ICON_APP_EDIT_UNDO undo.png - ICON_DESK_WINDOW_VSPLIT vtile.png - ICON_DESK_DEFAULTICON default.png - ICON_DESK_WINDOW_HTILE htile.png - ICON_DESK_WINDOW_VTILE vtile.png - ICON_EDIT_PASTE paste.png - ICON_FILE_CLOSE close.png + + SUIT_ViewPort + + ICON_CURSOR_ZOOM + cursor_zoom.png + + + ICON_CURSOR_ROTATE + cursor_rotate.png + + diff --git a/src/STD/resources/STD_msg_en.ts b/src/STD/resources/STD_msg_en.ts index 245c4c391..83316ceae 100644 --- a/src/STD/resources/STD_msg_en.ts +++ b/src/STD/resources/STD_msg_en.ts @@ -1,6 +1,6 @@ - @default + @default TOT_DESK_EDIT_CUT Cut @@ -79,10 +79,6 @@ You are trying to save this document under an unknown type ( %1 ) - - CLOSE_DLG_UNLOAD - &Unload - TOT_DESK_NEWWINDOW Create new Window @@ -196,10 +192,6 @@ Directory with this name exist on disc. Try to use another name ERR_DESK_NOAPP No applications registered - - CLOSE_DLG_CLOSE - C&lose w/o saving - INF_DESK_DOC_CREATE Create a new document @@ -266,8 +258,8 @@ Do you want to reload it ? Load Study - CLOSE_DLG_CAPTION - Close active study + CLOSE_STUDY + Close study PRP_DESK_HELP_SEARCH @@ -285,10 +277,6 @@ Do you want to reload it ? INF_CANCELLED Cancelled - - CLOSE_DLG_SAVE_CLOSE - &Save&&Close - PRP_DESK_WINDOW_VSPLIT Splits the active window on two vertical parts @@ -382,8 +370,8 @@ Do you want to overwrite it ? Open document - CLOSE_DLG_DESCRIPTION - Do you want to close or only unload the study + CLOSE_QUESTION + Document %1 modified. Do you want to save or discard the modification and close the document? PRP_DESK_FILE_EXIT @@ -454,20 +442,12 @@ Do you want to save changes? Study %1 saved - TOT_DOCKWINDOWS - Show / hide dockable windows - - - MEN_DOCKWINDOWS - Windows - - - TOT_TOOLBARS - Show / hide toolbars + TOT_DOCK_WINDOWS + Show / hide dockable windows and toolbars - MEN_TOOLBARS - Toolbars + MEN_DOCK_WINDOWS + Windows and Toolbars ABOUT_INFO diff --git a/src/SUIT/SUIT_Accel.cxx b/src/SUIT/SUIT_Accel.cxx index 9e92904b5..28dd85e9e 100644 --- a/src/SUIT/SUIT_Accel.cxx +++ b/src/SUIT/SUIT_Accel.cxx @@ -20,12 +20,18 @@ #include "SUIT_Accel.h" -#include "SUIT_ViewModel.h" #include "SUIT_ViewWindow.h" #include "SUIT_ViewManager.h" +#include "SUIT_ViewModel.h" + +#include +#include +#include -#include -#include +/*! + \class SUIT_Accel + \brief Manager of keyboard accelerator bindings. +*/ SUIT_Accel* SUIT_Accel::myself = 0; @@ -99,7 +105,11 @@ int getKey( QKeyEvent* keyEvent ) return key; } -/*! getAccelKey() : returns key pressed if 1) event was KeyPress 2) pressed key is a registered accelerator */ +/*! + Returns key pressed if + -# event was KeyPress + -# pressed key is a registered accelerator +*/ int SUIT_Accel::getAccelKey( QEvent *event ) { if ( event && event->type() == QEvent::KeyPress ) { diff --git a/src/SUIT/SUIT_Accel.h b/src/SUIT/SUIT_Accel.h index 968e0776a..ed7dd4671 100644 --- a/src/SUIT/SUIT_Accel.h +++ b/src/SUIT/SUIT_Accel.h @@ -23,14 +23,10 @@ #include "SUIT.h" -#include -#include -#include +#include +#include +#include -/*! - \class SUIT_Accel - Manager of keyboard accelerator bindings -*/ class SUIT_EXPORT SUIT_Accel: public QObject { Q_OBJECT @@ -63,15 +59,16 @@ protected: private: SUIT_Accel(); - int getAccelKey( QEvent* ); // returns key pressed if 1) event was KeyPress - // 2) pressed key is a registered accelerator + int getAccelKey( QEvent* ); - typedef QMap IdActionMap; // key - to - action_id map - typedef QMap ViewerTypeIdActionMap; // viewer_type - to - IdActionMap - ViewerTypeIdActionMap myMap; + typedef QMap IdActionMap; //!< maps key to action id + typedef QMap + ViewerTypeIdActionMap; //!< maps viewer type to IdActionMap + ViewerTypeIdActionMap myMap; //!< viewer actions map - QMap myOptMap; // key - to - map, used for optimazation. all registered keys (accelerators) - // are stored in this map. + //! Maps key to flag map, used for optimization. + //! All registered keys (accelerators) are stored in this map. + QMap myOptMap; static SUIT_Accel* myself; }; diff --git a/src/SUIT/SUIT_ActionOperation.cxx b/src/SUIT/SUIT_ActionOperation.cxx index 5c7b4711b..85d96b221 100644 --- a/src/SUIT/SUIT_ActionOperation.cxx +++ b/src/SUIT/SUIT_ActionOperation.cxx @@ -53,7 +53,7 @@ void SUIT_ActionOperation::setAction( const QString& text, const QIcon& icon, const QString& menuText, QKeySequence accel, QObject* parent, bool toggle ) { - setAction( new QtxAction( text, icon, menuText, accel, parent, 0, toggle ) ); + setAction( new QtxAction( text, icon, menuText, accel, parent, toggle ) ); } /*!Set action. @@ -62,7 +62,7 @@ void SUIT_ActionOperation::setAction( const QString& text, const QIcon& icon, void SUIT_ActionOperation::setAction( const QString& text, const QString& menuText, QKeySequence accel, QObject* parent, bool toggle ) { - setAction( new QtxAction( text, menuText, accel, parent, 0, toggle ) ); + setAction( new QtxAction( text, menuText, accel, parent, toggle ) ); } /*!Set action. @@ -87,18 +87,8 @@ bool SUIT_ActionOperation::addTo( QWidget* wid ) if ( !action() ) return false; - return action()->addTo( wid ); -} - -/*! Add action to widget \a wid. - *\retval TRUE - successful, FALSE - not successful. - */ -bool SUIT_ActionOperation::addTo( QWidget* wid, int idx ) -{ - if ( !action() ) - return false; - - return action()->addTo( wid, idx ); + wid->addAction( action() ); + return true; } /*! Set status tip for action. diff --git a/src/SUIT/SUIT_ActionOperation.h b/src/SUIT/SUIT_ActionOperation.h index e70d24501..12ba0ebf7 100644 --- a/src/SUIT/SUIT_ActionOperation.h +++ b/src/SUIT/SUIT_ActionOperation.h @@ -16,15 +16,17 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef SUIT_ACTIONOPERATION_H #define SUIT_ACTIONOPERATION_H #include "SUIT_Operation.h" +#include + class QIcon; class QString; class QWidget; -class QKeySequence; class QtxAction; @@ -49,7 +51,6 @@ public: virtual void setAction( QtxAction* theAction ); bool addTo( QWidget* theWidget ); - bool addTo( QWidget* theWidget, int thePos ); void setStatusTip( const QString& theTip ); //@} diff --git a/src/SUIT/SUIT_Application.cxx b/src/SUIT/SUIT_Application.cxx index 5e19c40cc..a5e545230 100755 --- a/src/SUIT/SUIT_Application.cxx +++ b/src/SUIT/SUIT_Application.cxx @@ -18,14 +18,14 @@ // #include "SUIT_Application.h" +#include "SUIT_Study.h" #include "SUIT_Session.h" #include "SUIT_Desktop.h" #include "SUIT_ResourceMgr.h" -#include - -#include -#include +#include +#include +#include #include #include @@ -67,7 +67,7 @@ SUIT_Desktop* SUIT_Application::desktop() \return FALSE if application can not be closed (because of non saved data for example). This method called by SUIT_Session whin closing of application was requested. */ -bool SUIT_Application::isPossibleToClose() +bool SUIT_Application::isPossibleToClose( bool& closePermanently ) { return true; } @@ -130,7 +130,7 @@ bool SUIT_Application::useFile( const QString& theFileName ) Opens other study into active Study. If Study is empty - creates it. \param theName - name of study */ -bool SUIT_Application::useStudy( const QString& theName ) +bool SUIT_Application::useStudy( const QString& /*theName*/ ) { return false; } @@ -575,7 +575,7 @@ 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 ) { - QtxAction* a = new QtxAction( text, icon, menu, key, parent, 0, toggle ); + QtxAction* a = new QtxAction( text, icon, menu, key, parent, toggle ); a->setStatusTip( tip ); if ( reciever && member ) diff --git a/src/SUIT/SUIT_Application.h b/src/SUIT/SUIT_Application.h index 6a0c5e978..710d3b2d5 100755 --- a/src/SUIT/SUIT_Application.h +++ b/src/SUIT/SUIT_Application.h @@ -20,18 +20,20 @@ #define SUIT_APPLICATION_H #include "SUIT.h" -#include "SUIT_Study.h" -#include -#include +#include +#include class QIcon; class QLabel; class QString; class QAction; +class QWidget; + class SUIT_Desktop; class SUIT_ViewModel; class SUIT_ResourceMgr; +class SUIT_Study; #ifdef WIN32 #pragma warning ( disable:4251 ) @@ -62,7 +64,7 @@ public: /*! Returns FALSE if application can not be closed (because of non saved data for example). This method called by SUIT_Session whin closing of application was requested. */ - virtual bool isPossibleToClose(); + virtual bool isPossibleToClose( bool& ); /*! Performs some finalization of life cycle of this application. For instance, the application can force its documents(s) to close. */ diff --git a/src/SUIT/SUIT_DataObject.cxx b/src/SUIT/SUIT_DataObject.cxx index 9f36eda10..186dbe195 100755 --- a/src/SUIT/SUIT_DataObject.cxx +++ b/src/SUIT/SUIT_DataObject.cxx @@ -16,6 +16,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include "SUIT_DataObject.h" #include "SUIT_DataObjectKey.h" @@ -26,9 +27,9 @@ SUIT_DataObject::SUIT_DataObject( SUIT_DataObject* p ) : myParent( 0 ), -mySignal( 0 ), myOpen( false ), myCheck( false ), +mySignal( 0 ), myAutoDel( true ) { setParent( p ); @@ -493,7 +494,7 @@ SUIT_DataObjectKey* SUIT_DataObject::key() const void SUIT_DataObject::dump( const int indent ) const { QString strIndent = QString().fill( ' ', indent ); // indentation string - printf( "%s%s\n", strIndent.toLatin1(), name().toLatin1() ); + printf( "%s%s\n", strIndent.toLatin1().data(), name().toLatin1().data() ); for ( DataObjectList::const_iterator it = myChildren.begin(); it != myChildren.end(); ++it ) (*it)->dump( indent + 2 ); } diff --git a/src/SUIT/SUIT_DataObject.h b/src/SUIT/SUIT_DataObject.h index ad704e536..1f479192c 100755 --- a/src/SUIT/SUIT_DataObject.h +++ b/src/SUIT/SUIT_DataObject.h @@ -16,17 +16,17 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef SUIT_DATAOBJECT_H #define SUIT_DATAOBJECT_H -#include -#include -#include - -#include - #include "SUIT.h" +#include +#include +#include +#include + class SUIT_DataObject; class SUIT_DataObjectKey; @@ -108,10 +108,10 @@ public: void dump( const int indent = 2 ) const; // dump to cout private: + SUIT_DataObject* myParent; bool myOpen; bool myCheck; Signal* mySignal; - SUIT_DataObject* myParent; bool myAutoDel; DataObjectList myChildren; diff --git a/src/SUIT/SUIT_DataObjectKey.cxx b/src/SUIT/SUIT_DataObjectKey.cxx index aeb7a3127..d209c9320 100755 --- a/src/SUIT/SUIT_DataObjectKey.cxx +++ b/src/SUIT/SUIT_DataObjectKey.cxx @@ -18,7 +18,7 @@ // #include "SUIT_DataObjectKey.h" -#include +#include #ifndef WIN32 #include diff --git a/src/SUIT/SUIT_DataOwner.cxx b/src/SUIT/SUIT_DataOwner.cxx index 285388e45..dd4431d73 100755 --- a/src/SUIT/SUIT_DataOwner.cxx +++ b/src/SUIT/SUIT_DataOwner.cxx @@ -40,7 +40,7 @@ SUIT_DataOwner::~SUIT_DataOwner() bool operator==( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 ) { if ( !p1.isNull() && !p2.isNull() ) - return (p1->isEqual( *p2 ) && p2->isEqual( *p1 )); + return (p1->keyString() == p2->keyString()); return p1.isNull() && p2.isNull(); } @@ -55,22 +55,13 @@ bool operator<( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 ) else if ( p2.isNull() ) return false; - //bug with acrossentry of DataOwner and DataSubOwner - const _typeinfo& ti1 = typeid( *(p1.operator->()) ); - const _typeinfo& ti2 = typeid( *(p2.operator->()) ); - - int res = strcmp( ti1.name(), ti2.name() ); - - if ( !res ) - return p1->isLess( *p2 ); - - return res; + return (p1->keyString() < p2->keyString()); } /*! \class SUIT_DataOwnerPtrList implements value list with unique items (uniqueness is - provided by operator==()) + provided by operator==() and operator<()) */ /*! diff --git a/src/SUIT/SUIT_DataOwner.h b/src/SUIT/SUIT_DataOwner.h index 9f6dd9049..976e5b45f 100755 --- a/src/SUIT/SUIT_DataOwner.h +++ b/src/SUIT/SUIT_DataOwner.h @@ -21,8 +21,9 @@ #include "SUIT_SmartPtr.h" -#include -#include +#include +#include +#include #ifdef WIN32 #pragma warning( disable:4251 ) @@ -40,9 +41,7 @@ class SUIT_EXPORT SUIT_DataOwner : public RefCount public: SUIT_DataOwner();//!< constructor virtual ~SUIT_DataOwner();//!< destructor - //! compare function - virtual bool isEqual( const SUIT_DataOwner& ) const = 0; - virtual bool isLess( const SUIT_DataOwner& ) const = 0; + virtual QString keyString() const = 0;//!< used for comparison }; /*! \typedef SUIT_DataOwnerPtr diff --git a/src/SUIT/SUIT_Desktop.cxx b/src/SUIT/SUIT_Desktop.cxx index 8c52c17fd..e16680033 100755 --- a/src/SUIT/SUIT_Desktop.cxx +++ b/src/SUIT/SUIT_Desktop.cxx @@ -42,7 +42,7 @@ public: QObject* object() const { return myObj; } private: - QPointer myObj; + QObject* myObj; }; /*! @@ -101,7 +101,7 @@ void SUIT_Desktop::closeEvent( QCloseEvent* e ) void SUIT_Desktop::childEvent( QChildEvent* e ) { if ( e->type() == QEvent::ChildAdded && e->child()->isWidgetType() ) - QApplication::postEvent( this, new ReparentEvent( QEvent::Type( Reparent ), e->child() ) ); + QApplication::postEvent( this, new QChildEvent( QEvent::Type( Reparent ), e->child() ) ); else QtxMainWindow::childEvent( e ); } @@ -111,10 +111,10 @@ void SUIT_Desktop::customEvent( QEvent* e ) if ( (int)e->type() != Reparent ) return; - ReparentEvent* re = (ReparentEvent*)e; - if ( re->object() && re->object()->inherits( "SUIT_ViewWindow" ) ) + QChildEvent* re = (QChildEvent*)e; + if ( re->child()->inherits( "SUIT_ViewWindow" ) ) { - QWidget* wid = (QWidget*)re->object(); + QWidget* wid = (QWidget*)re->child(); bool invis = wid->testAttribute( Qt::WA_WState_ExplicitShowHide ) && wid->testAttribute( Qt::WA_WState_Hidden ); diff --git a/src/SUIT/SUIT_ExceptionHandler.cxx b/src/SUIT/SUIT_ExceptionHandler.cxx index f22b13cb8..861fdcf2c 100755 --- a/src/SUIT/SUIT_ExceptionHandler.cxx +++ b/src/SUIT/SUIT_ExceptionHandler.cxx @@ -20,7 +20,7 @@ #include "SUIT_MessageBox.h" -#include +#include /*!\class SUIT_ExceptionHandler * Show exception message on error handler. @@ -53,5 +53,5 @@ void SUIT_ExceptionHandler::showMessage( const QString& title, const QString& ms while ( QApplication::overrideCursor() ) QApplication::restoreOverrideCursor(); - SUIT_MessageBox::error1( 0, title, msg, "OK" ); + SUIT_MessageBox::critical( 0, title, msg ); } diff --git a/src/SUIT/SUIT_FileDlg.cxx b/src/SUIT/SUIT_FileDlg.cxx index 40fb501e3..8dc7fd64c 100755 --- a/src/SUIT/SUIT_FileDlg.cxx +++ b/src/SUIT/SUIT_FileDlg.cxx @@ -66,20 +66,18 @@ #include "SUIT_Tools.h" #include "SUIT_Session.h" -#include "SUIT_Desktop.h" #include "SUIT_MessageBox.h" #include "SUIT_ResourceMgr.h" #include "SUIT_FileValidator.h" -#include -#include - -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #define MIN_COMBO_SIZE 100 @@ -93,11 +91,11 @@ QString SUIT_FileDlg::myLastVisitedPath; /*! Constructor */ SUIT_FileDlg::SUIT_FileDlg( QWidget* parent, bool open, bool showQuickDir, bool modal ) : QFileDialog( parent ), +myOpen( open ), myValidator( 0 ), -myQuickCombo( 0 ), -myQuickButton( 0 ), myQuickLab( 0 ), -myOpen( open )//, +myQuickCombo( 0 ), +myQuickButton( 0 )//, //myAccepted( false ) { setModal( modal ); @@ -145,7 +143,7 @@ myOpen( open )//, QStringList dirList = dirs.split( ';' ); if ( dirList.count() > 0 ) { - for ( unsigned i = 0; i < dirList.count(); i++ ) + for ( int i = 0; i < dirList.count(); i++ ) myQuickCombo->addItem( dirList[i] ); } else @@ -341,14 +339,8 @@ void SUIT_FileDlg::addExtension() if ( anExt != "." && !IGNORE_NON_MATCHING_EXTENSION ) return; - // get selected file filter -#if QT_VERSION < 0x030000 - QRegExp r( QString::fromLatin1("(?[a-zA-Z0-9.*? +;#|]*)?$") ); - int len, index = r.match( selectedFilter().stripWhiteSpace(), 0, &len ); -#else QRegExp r( QString::fromLatin1("\\(?[a-zA-Z0-9.*? +;#|]*\\)?$") ); int index = r.indexIn( selectedFilter().trimmed() ); -#endif if ( index >= 0 ) { // Create wildcard regular expression basing on selected filter @@ -356,11 +348,7 @@ void SUIT_FileDlg::addExtension() // Due to transformations from the filter list (*.txt *.*xx *.c++ SUIT*.* ) we // will have the pattern (\.txt|\..*xx|\.c\+\+|\..*) (as we validate extension only, // we remove everything except extension mask from the pattern -#if QT_VERSION < 0x030000 - QString wildcard = selectedFilter().mid( index, len ).trimmed(); -#else QString wildcard = selectedFilter().mid( index, r.matchedLength() ).trimmed(); -#endif // replace '|' and ';' separators by space symbol and also brackets if there are some wildcard.replace( QRegExp( "[\\|;|(|)]" )," " ); @@ -435,13 +423,10 @@ void SUIT_FileDlg::quickDir(const QString& dirPath) if ( !QDir(aPath).exists() ) { aPath = QDir::homePath(); - SUIT_MessageBox::error1(this, - tr("ERR_ERROR"), - tr("ERR_DIR_NOT_EXIST").arg(dirPath), - tr("BUT_OK")); + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "ERR_DIR_NOT_EXIST" ).arg( dirPath ) ); } else - processPath(aPath); + processPath( aPath ); } /*! Called when user presses "Add" button - adds current directory to quick directory @@ -463,7 +448,7 @@ void SUIT_FileDlg::addQuickDir() bool emptyAndHome = false; if ( dirList.count() > 0 ) { - for ( unsigned i = 0; i < dirList.count(); i++ ) + for ( int i = 0; i < dirList.count(); i++ ) { QDir aDir( dirList[i] ); if ( aDir.canonicalPath().isNull() && dirList[i] == dir.absolutePath() || @@ -508,7 +493,7 @@ QString SUIT_FileDlg::getFileName( QWidget* parent, const QString& initial, cons QString filename = fd->selectedFile(); delete fd; - qApp->processEvents(); + QApplication::processEvents(); return filename; } @@ -534,7 +519,7 @@ QStringList SUIT_FileDlg::getOpenFileNames( QWidget* parent, const QString& init QStringList filenames = fd->selectedFiles(); delete fd; - qApp->processEvents(); + QApplication::processEvents(); return filenames; } @@ -558,6 +543,6 @@ QString SUIT_FileDlg::getExistingDirectory( QWidget* parent, const QString& init QString dirname = fd->selectedFile(); delete fd; - qApp->processEvents(); + QApplication::processEvents(); return dirname; } diff --git a/src/SUIT/SUIT_FileDlg.h b/src/SUIT/SUIT_FileDlg.h index 33404d346..c2d7e4c44 100755 --- a/src/SUIT/SUIT_FileDlg.h +++ b/src/SUIT/SUIT_FileDlg.h @@ -21,7 +21,7 @@ #include "SUIT.h" -#include +#include class QLabel; class QComboBox; diff --git a/src/SUIT/SUIT_FileValidator.cxx b/src/SUIT/SUIT_FileValidator.cxx index 604840ea4..0adb0b331 100755 --- a/src/SUIT/SUIT_FileValidator.cxx +++ b/src/SUIT/SUIT_FileValidator.cxx @@ -17,11 +17,11 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "SUIT_FileValidator.h" + #include "SUIT_MessageBox.h" -#include "SUIT_Session.h" -#include -#include +#include +#include /*! constructor */ SUIT_FileValidator::SUIT_FileValidator(QWidget* parent) : @@ -32,18 +32,16 @@ myParent(parent) /*! returns false if can't open file */ bool SUIT_FileValidator::canOpen( const QString& file ) { - if ( !QFile::exists( file ) ) { - SUIT_MessageBox::error1( myParent, - QObject::tr( "ERR_ERROR" ), - QObject::tr( "ERR_FILE_NOT_EXIST" ).arg( file ), - QObject::tr( "BUT_OK" ) ); + if ( !QFile::exists( file ) ) + { + SUIT_MessageBox::critical( myParent, QObject::tr( "ERR_ERROR" ), + QObject::tr( "ERR_FILE_NOT_EXIST" ).arg( file ) ); return false; - } - if ( !QFileInfo( file ).isReadable() ) { - SUIT_MessageBox::error1( myParent, - QObject::tr( "ERR_ERROR" ), - QObject::tr( "ERR_PERMISSION_DENIED" ).arg( file ), - QObject::tr( "BUT_OK" ) ); + } + if ( !QFileInfo( file ).isReadable() ) + { + SUIT_MessageBox::critical( myParent, QObject::tr( "ERR_ERROR" ), + QObject::tr( "ERR_PERMISSION_DENIED" ).arg( file ) ); return false; } return true; @@ -52,24 +50,21 @@ bool SUIT_FileValidator::canOpen( const QString& file ) /*! returns false if can't save file */ bool SUIT_FileValidator::canSave( const QString& file ) { - if ( QFile::exists( file ) ) { + if ( QFile::exists( file ) ) + { // if file exists - raise warning... - if ( SUIT_MessageBox::warn2( myParent, - QObject::tr( "WRN_WARNING" ), - QObject::tr( "QUE_DOC_FILEEXISTS" ).arg( file ), - QObject::tr( "BUT_YES" ), - QObject::tr( "BUT_NO" ), - SUIT_YES, - SUIT_NO, - SUIT_NO ) == SUIT_NO ) { + if ( SUIT_MessageBox::question( myParent, QObject::tr( "WRN_WARNING" ), + QObject::tr( "QUE_DOC_FILEEXISTS" ).arg( file ), + SUIT_MessageBox::Yes | SUIT_MessageBox::No, + SUIT_MessageBox::No ) != SUIT_MessageBox::Yes ) + { return false; } // ... and if user wants to overwrite file, check it for writeability - if ( !QFileInfo( file ).isWritable() ) { - SUIT_MessageBox::error1( myParent, - QObject::tr( "ERR_ERROR" ), - QObject::tr( "ERR_PERMISSION_DENIED" ).arg( file ), - QObject::tr( "BUT_OK" ) ); + if ( !QFileInfo( file ).isWritable() ) + { + SUIT_MessageBox::critical( myParent, QObject::tr( "ERR_ERROR" ), + QObject::tr( "ERR_PERMISSION_DENIED" ).arg( file ) ); return false; } } @@ -79,9 +74,8 @@ bool SUIT_FileValidator::canSave( const QString& file ) QFile qf( file ); if ( !qf.open( QFile::WriteOnly ) ) { - SUIT_MessageBox::error1( myParent, QObject::tr( "ERR_ERROR" ), - QObject::tr( "ERR_PERMISSION_DENIED" ).arg( file ), - QObject::tr( "BUT_OK" ) ); + SUIT_MessageBox::critical( myParent, QObject::tr( "ERR_ERROR" ), + QObject::tr( "ERR_PERMISSION_DENIED" ).arg( file ) ); return false; } else diff --git a/src/SUIT/SUIT_FileValidator.h b/src/SUIT/SUIT_FileValidator.h index 56849cc38..9142c381d 100755 --- a/src/SUIT/SUIT_FileValidator.h +++ b/src/SUIT/SUIT_FileValidator.h @@ -23,7 +23,8 @@ #include "SUIT.h" -#include +class QWidget; +class QString; /*! \class SUIT_FileValidator diff --git a/src/SUIT/SUIT_MessageBox.cxx b/src/SUIT/SUIT_MessageBox.cxx index f64274fa0..52f8874c0 100755 --- a/src/SUIT/SUIT_MessageBox.cxx +++ b/src/SUIT/SUIT_MessageBox.cxx @@ -17,332 +17,968 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +#include "SUIT_MessageBox.h" + +#include "SUIT_OverrideCursor.h" + +#include +#include +#include +#include + +#include + /*! - \class: SUIT_MessageBox - Message dialog box for SUIT-based application - Module: SUIT - Created: UI team, 02.10.00 + \class SUIT_MessageBox + \brief Message dialog box for SUIT-based application + + The class provides a modal dialog with a short message, an icon, + and buttons laid out depending on the current style. + + Message boxes are used to provide informative messages and to ask + simple questions. + + The easiest way to pop up a message box is to call one of the static + functions information(), question(), critical(), and warning(). + + The class provides the static functions to show message boxes with + standard buttons (like \c Ok, \c Cancel, \c Apply, \c Close, \c Yes, + \c No, \c Abort, \c Retry, etc). These methods accept ORed buttons + flags as one of the parameters. The buttons layouting type and order + is system-dependant and defined by the current style. In addition, + these methods allow to define default button (where input focus is + set by default and which is clicked when user presses \c Enter key). + + Another set of static functions allows to show message boxes with + up to four user-defined buttons. It is possible to define default + and escape buttons using additional parameters. + + And finally, the last group of static functions allow displaying + the message boxes with an arbitrary number of buttons. + + For example: + \code + // show question message box with two standard buttons + int result = SUIT_MessageBox::question(desktop(), "Error", + "File already exists? Overwrite?", + SUIT_MessageBox::Yes | SUIT_MessageBox::No, + SUIT_MessageBox::No ); + if ( result == SUIT_MessageBox::Yes ) + overwriteFileFunction(); + + // show critical message box with user-defined buttons + // default is second button and escape is third button + int result = SUIT_MessageBox::critical(desktop(), "Hazard!", + "The situation is critical! What to do?", + "Hide", "Run Away", "Stand still", 1, 2); + switch ( result ) + { + case 0: + hideMyself(); break; + case 1: + runAwayFromHere(); break; + case 2: + sitDownAndPray(); break; + default: + break; + } + + // show message box with 6 buttons + // both default and escape buttons are set to first button ("Zero") + int result = SUIT_MessageBox::information(desktop(), "Question", + "Select your favourite number", + 0, 0, + "Zero", "One", "Two", "Three", "Four", "Five"); + useMyFavouriteNumberSomewhere( result ); + \endcode */ -#include "SUIT_MessageBox.h" -#include "SUIT_OverrideCursor.h" +/*! + \brief Constructor. + \param parent parent widget +*/ +SUIT_MessageBox::SUIT_MessageBox( QWidget* parent ) +: QMessageBox( parent ) +{ +} -#include -#include +/*! + \brief Constructor. + \param icon message box icon (QMessageBox::Icon) + \param title message box title + \param text message box text + \param buttons ORed message box standard buttons (QMessageBox::StandardButton) + \param parent parent widget + \param f window flags +*/ +SUIT_MessageBox::SUIT_MessageBox( Icon icon, const QString& title, const QString& text, + StandardButtons buttons, QWidget* parent, Qt::WindowFlags f ) +: QMessageBox( icon, title, text, buttons, parent, f ) +{ +} /*! - Shows info message box with one button [ static ] + \brief Destructor. */ -int SUIT_MessageBox::info1( QWidget* parent, const QString& caption, - const QString& text, const QString& textButton0 ) +SUIT_MessageBox::~SUIT_MessageBox() { - SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::ArrowCursor ); - int ret = QMessageBox::information( parent, caption, text, textButton0, - QString::null, QString::null, 0, 0 ); - qApp->processEvents(); - return ret; } /*! - Shows warning message box with one button [ static ] + \brief Get the standard button text. + \param btn standard button id + \return button text */ -int SUIT_MessageBox::warn1( QWidget* parent, - const QString& caption, - const QString& text, - const QString& textButton0 ) +QString SUIT_MessageBox::buttonText( StandardButton btn ) const { - SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::ArrowCursor ); - int ret = QMessageBox::warning( parent, caption, text, textButton0, - QString::null, QString::null, 0, 0 ); - qApp->processEvents(); - return ret; + QString res; + QAbstractButton* b = button( btn ); + if ( b ) + res = b->text(); + return res; } /*! - Shows error message box with one button [ static ] + \brief Set the standard button text. + \param btn standard button id + \param text new button text */ -int SUIT_MessageBox::error1( QWidget* parent, - const QString& caption, - const QString& text, - const QString& textButton0 ) +void SUIT_MessageBox::setButtonText( StandardButton btn, const QString& text ) { - SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::ArrowCursor ); - int ret = QMessageBox::critical( parent, caption, text, textButton0, - QString::null, QString::null, 0, 0 ); - qApp->processEvents(); - return ret; + QAbstractButton* b = button( btn ); + if ( b ) + b->setText( text ); } /*! - Shows question message box with one button [ static ] + \brief Show critical message box with specified standard buttons. + \param parent parent widget + \param title message box title + \param text message box text + \param buttons ORed message box buttons (QMessageBox::StandardButton) + \param defaultButton default button (QMessageBox::StandardButton) + \return button id clicked by the user (QMessageBox::StandardButton) */ -int SUIT_MessageBox::question1( QWidget* parent, - const QString& caption, - const QString& text, - const QString& textButton0 ) +SUIT_MessageBox::StandardButton SUIT_MessageBox::critical( QWidget* parent, const QString& title, const QString& text, + StandardButtons buttons, StandardButton defaultButton ) { SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::ArrowCursor ); - int ret = QMessageBox::question( parent, caption, text, textButton0, - QString::null, QString::null, 0, 0 ); - qApp->processEvents(); - return ret; + return QMessageBox::critical( parent, title, text, buttons, defaultButton ); } /*! - Shows info message box with two buttons. - Returns id of the pressed button or -1 if escaped [ static ] + \brief Show warning message box with specified standard buttons. + \param parent parent widget + \param title message box title + \param text message box text + \param buttons ORed message box buttons (QMessageBox::StandardButton) + \param defaultButton default button (QMessageBox::StandardButton) + \return button id clicked by the user (QMessageBox::StandardButton) */ -int SUIT_MessageBox::info2( QWidget* parent, - const QString& caption, - const QString& text, - const QString& textButton0, - const QString& textButton1, - int idButton0, int idButton1, int idDefault ) +SUIT_MessageBox::StandardButton SUIT_MessageBox::warning( QWidget* parent, const QString& title, const QString& text, + SUIT_MessageBox::StandardButtons buttons, StandardButton defaultButton ) { SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::ArrowCursor ); - if ( idDefault == idButton0 ) - idDefault = 0; - else if ( idDefault == idButton1 ) - idDefault = 1; - else - idDefault = 0; - - int ret = QMessageBox::information( parent, caption, text, textButton0, - textButton1, QString::null, idDefault ); - qApp->processEvents(); - return ( ret == 0 ? idButton0 : idButton1 ); + return QMessageBox::warning( parent, title, text, buttons, defaultButton ); } /*! - Shows warning message box with two buttons. - Returns id of the pressed button or -1 if escaped [ static ] + \brief Show information message box with specified standard buttons. + \param parent parent widget + \param title message box title + \param text message box text + \param buttons ORed message box buttons (QMessageBox::StandardButton) + \param defaultButton default button (QMessageBox::StandardButton) + \return button id clicked by the user (QMessageBox::StandardButton) */ -int SUIT_MessageBox::warn2( QWidget* parent, - const QString& caption, - const QString& text, - const QString& textButton0, - const QString& textButton1, - int idButton0, int idButton1, int idDefault ) +SUIT_MessageBox::StandardButton SUIT_MessageBox::information( QWidget* parent, const QString& title, const QString& text, + StandardButtons buttons, StandardButton defaultButton ) { SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::ArrowCursor ); - - if ( idDefault == idButton0 ) - idDefault = 0; - else if ( idDefault == idButton1 ) - idDefault = 1; - else - idDefault = 0; - - int ret = QMessageBox::warning( parent, caption, text, textButton0, - textButton1, QString::null, idDefault ); - qApp->processEvents(); - return ( ret == 0 ? idButton0 : idButton1 ); + return QMessageBox::information( parent, title, text, buttons, defaultButton ); } /*! - Shows error message box with two buttons - Returns id of the pressed button or -1 if escaped [ static ] + \brief Show question message box with specified standard buttons. + \param parent parent widget + \param title message box title + \param text message box text + \param buttons ORed message box buttons (QMessageBox::StandardButton) + \param defaultButton default button (QMessageBox::StandardButton) + \return button id clicked by the user (QMessageBox::StandardButton) */ -int SUIT_MessageBox::error2( QWidget* parent, - const QString& caption, - const QString& text, - const QString& textButton0, - const QString& textButton1, - int idButton0, int idButton1, int idDefault ) +SUIT_MessageBox::StandardButton SUIT_MessageBox::question( QWidget* parent, const QString& title, const QString& text, + StandardButtons buttons, StandardButton defaultButton ) { SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::ArrowCursor ); - - if ( idDefault == idButton0 ) - idDefault = 0; - else if ( idDefault == idButton1 ) - idDefault = 1; - else - idDefault = 0; - - int ret = QMessageBox::critical( parent, caption, text, textButton0, - textButton1, QString::null, idDefault ); - qApp->processEvents(); - return ( ret == 0 ? idButton0 : idButton1 ); + return QMessageBox::question( parent, title, text, buttons, defaultButton ); } /*! - Shows question message box with two buttons - Returns id of the pressed button or -1 if escaped [ static ] + \brief Show critical message box with one custom button. + + Specified button becomes "default" button and "escape" button, i.e. + pressing \c Return or \c Enter and \c Escape keys is equivalent to clicking + this button. + + \param parent parent widget + \param title message box title + \param text message box text + \param button button text + \return button id clicked by the user (QMessageBox::StandardButton) */ -int SUIT_MessageBox::question2( QWidget* parent, - const QString& caption, - const QString& text, - const QString& textButton0, - const QString& textButton1, - int idButton0, int idButton1, int idDefault ) +int SUIT_MessageBox::critical( QWidget* parent, const QString& title, const QString& text, + const QString& button ) { - SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::ArrowCursor ); - - if ( idDefault == idButton0 ) - idDefault = 0; - else if ( idDefault == idButton1 ) - idDefault = 1; - else - idDefault = 0; + ButtonInfos lst; + lst.append( ButtonInfo( 0, button ) ); + return messageBox( SUIT_MessageBox::Critical, parent, title, text, lst ); +} + +/*! + \brief Show warning message box with one custom button. - int ret = QMessageBox::question( parent, caption, text, textButton0, - textButton1, QString::null, idDefault ); - qApp->processEvents(); - return ( ret == 0 ? idButton0 : idButton1 ); + Specified button becomes "default" button and "escape" button, i.e. + pressing \c Return or \c Enter and \c Escape keys is equivalent to clicking + this button. + + \param parent parent widget + \param title message box title + \param text message box text + \param button button text + \return button id clicked by the user (QMessageBox::StandardButton) +*/ +int SUIT_MessageBox::warning( QWidget* parent, const QString& title, const QString& text, + const QString& button ) +{ + ButtonInfos lst; + lst.append( ButtonInfo( 0, button ) ); + return messageBox( SUIT_MessageBox::Warning, parent, title, text, lst ); } /*! - Shows info message box with three buttons. - Returns id of the pressed button or -1 if escaped [ static ] + \brief Show information message box with one custom button. + + Specified button becomes "default" button and "escape" button, i.e. + pressing \c Return or \c Enter and \c Escape keys is equivalent to clicking + this button. + + \param parent parent widget + \param title message box title + \param text message box text + \param button button text + \return button id clicked by the user (QMessageBox::StandardButton) */ -int SUIT_MessageBox::info3( QWidget* parent, - const QString& caption, - const QString& text, - const QString& textButton0, - const QString& textButton1, - const QString& textButton2, - int idButton0, int idButton1, - int idButton2, int idDefault ) +int SUIT_MessageBox::information( QWidget* parent, const QString& title, const QString& text, + const QString& button ) { - SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::ArrowCursor ); - - if ( idDefault == idButton0 ) - idDefault = 0; - else if ( idDefault == idButton1 ) - idDefault = 1; - else if ( idDefault == idButton2 ) - idDefault = 2; - else - idDefault = 0; - - int ret = QMessageBox::information( parent, caption, text, textButton0, - textButton1, textButton2, idDefault ); - qApp->processEvents(); - switch ( ret ) - { - case 0: - return idButton0; - case 1: - return idButton1; - case 2: - return idButton2; - } - return -1; + ButtonInfos lst; + lst.append( ButtonInfo( 0, button ) ); + return messageBox( SUIT_MessageBox::Information, parent, title, text, lst ); +} + +/*! + \brief Show question message box with one custom button. + + \warning This function does not make a lot of sense because it provides + message box with only one button, i.e. it is impossible to give several + answers for the question (at least 'yes'/'no'). + This function is implemented only for completeness. + + Specified button becomes "default" button and "escape" button, i.e. + pressing \c Return or \c Enter and \c Escape keys is equivalent to clicking + this button. + + \param parent parent widget + \param title message box title + \param text message box text + \param button button text + \return button id clicked by the user (QMessageBox::StandardButton) +*/ +int SUIT_MessageBox::question( QWidget* parent, const QString& title, const QString& text, + const QString& button ) +{ + ButtonInfos lst; + lst.append( ButtonInfo( 0, button ) ); + return messageBox( SUIT_MessageBox::Question, parent, title, text, lst ); } /*! - Shows warning message box with three buttons. - Returns id of the pressed button or -1 if escaped [ static ] + \brief Show critical message box with two custom buttons. + + Parameters \a button1 and \a button2 specify the buttons text. + The function returns clicked button id. The identifiers for the buttons + are assigned automatically. The first button is identified as 0, the + second one as 1. + + The \a defaultButton parameter allows to specify the button which is assigned + for the \c Return or \c Enter key. Similarly, \a escapeButton parameter + allows specifing the button which is assigned for \c Escape key. + If these parameters are not specified (-1 by default), the first button + is set as default button and the second one is defined as escape button. + + \param parent parent widget + \param title message box title + \param text message box text + \param button1 first button text + \param button2 second button text + \param defaultButton default button + \param escapeButton escape button + \return button used button id */ -int SUIT_MessageBox::warn3( QWidget* parent, - const QString& caption, - const QString& text, - const QString& textButton0, - const QString& textButton1, - const QString& textButton2, - int idButton0, int idButton1, - int idButton2, int idDefault ) +int SUIT_MessageBox::critical( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, + const int defaultButton, const int escapeButton ) { - SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::ArrowCursor ); - - if ( idDefault == idButton0 ) - idDefault = 0; - else if ( idDefault == idButton1 ) - idDefault = 1; - else if ( idDefault == idButton2 ) - idDefault = 2; - else - idDefault = 0; + ButtonInfos lst; + int id = 0; + lst.append( ButtonInfo( id++, button1 ) ); + lst.append( ButtonInfo( id++, button2 ) ); + return messageBox( SUIT_MessageBox::Critical, parent, title, text, lst, + defaultButton, escapeButton ); +} + +/*! + \brief Show warning message box with two custom buttons. + + Parameters \a button1 and \a button2 specify the buttons text. + The function returns clicked button id. The identifiers for the buttons + are assigned automatically. The first button is identified as 0, the + second one as 1. + + The \a defaultButton parameter allows to specify the button which is assigned + for the \c Return or \c Enter key. Similarly, \a escapeButton parameter + allows specifing the button which is assigned for \c Escape key. + If these parameters are not specified (-1 by default), the first button + is set as default button and the second one is defined as escape button. + + \param parent parent widget + \param title message box title + \param text message box text + \param button1 first button text + \param button2 second button text + \param defaultButton default button + \param escapeButton escape button + \return button used button id +*/ +int SUIT_MessageBox::warning( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, + const int defaultButton, const int escapeButton ) +{ + ButtonInfos lst; + int id = 0; + lst.append( ButtonInfo( id++, button1 ) ); + lst.append( ButtonInfo( id++, button2 ) ); + return messageBox( SUIT_MessageBox::Warning, parent, title, text, lst, + defaultButton, escapeButton ); +} + +/*! + \brief Show information message box with two custom buttons. + + Parameters \a button1 and \a button2 specify the buttons text. + The function returns clicked button id. The identifiers for the buttons + are assigned automatically. The first button is identified as 0, the + second one as 1. + + The \a defaultButton parameter allows to specify the button which is assigned + for the \c Return or \c Enter key. Similarly, \a escapeButton parameter + allows specifing the button which is assigned for \c Escape key. + If these parameters are not specified (-1 by default), the first button + is set as default button and the second one is defined as escape button. + + \param parent parent widget + \param title message box title + \param text message box text + \param button1 first button text + \param button2 second button text + \param defaultButton default button + \param escapeButton escape button + \return button used button id +*/ +int SUIT_MessageBox::information( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, + const int defaultButton, const int escapeButton ) +{ + ButtonInfos lst; + int id = 0; + lst.append( ButtonInfo( id++, button1 ) ); + lst.append( ButtonInfo( id++, button2 ) ); + return messageBox( SUIT_MessageBox::Information, parent, title, text, lst, + defaultButton, escapeButton ); +} + +/*! + \brief Show question message box with two custom buttons. + + Parameters \a button1 and \a button2 specify the buttons text. + The function returns clicked button id. The identifiers for the buttons + are assigned automatically. The first button is identified as 0, the + second one as 1. + + The \a defaultButton parameter allows to specify the button which is assigned + for the \c Return or \c Enter key. Similarly, \a escapeButton parameter + allows specifing the button which is assigned for \c Escape key. + If these parameters are not specified (-1 by default), the first button + is set as default button and the second one is defined as escape button. + + \param parent parent widget + \param title message box title + \param text message box text + \param button1 first button text + \param button2 second button text + \param defaultButton default button + \param escapeButton escape button + \return button used button id +*/ +int SUIT_MessageBox::question( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, + const int defaultButton, const int escapeButton ) +{ + ButtonInfos lst; + int id = 0; + lst.append( ButtonInfo( id++, button1 ) ); + lst.append( ButtonInfo( id++, button2 ) ); + return messageBox( SUIT_MessageBox::Question, parent, title, text, lst, + defaultButton, escapeButton ); +} + +/*! + \brief Show critical message box with three custom buttons. + + Parameters \a button1, \a button2 and \a button3 specify the buttons text. + The function returns clicked button id. The identifiers for the buttons + are assigned automatically. The first button is identified as 0, the + second one as 1, etc. + + The \a defaultButton parameter allows to specify the button which is assigned + for the \c Return or \c Enter key. Similarly, \a escapeButton parameter + allows specifing the button which is assigned for \c Escape key. + If these parameters are not specified (-1 by default), the first button + is set as default button and the last one is defined as escape button. + + \param parent parent widget + \param title message box title + \param text message box text + \param button1 first button text + \param button2 second button text + \param button3 third button text + \param defaultButton default button + \param escapeButton escape button + \return button used button id +*/ +int SUIT_MessageBox::critical( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, + const QString& button3, + const int defaultButton, const int escapeButton ) +{ + ButtonInfos lst; + int id = 0; + lst.append( ButtonInfo( id++, button1 ) ); + lst.append( ButtonInfo( id++, button2 ) ); + lst.append( ButtonInfo( id++, button3 ) ); + return messageBox( SUIT_MessageBox::Critical, parent, title, text, lst, + defaultButton, escapeButton ); +} + +/*! + \brief Show warning message box with three custom buttons. + + Parameters \a button1, \a button2 and \a button3 specify the buttons text. + The function returns clicked button id. The identifiers for the buttons + are assigned automatically. The first button is identified as 0, the + second one as 1, etc. + + The \a defaultButton parameter allows to specify the button which is assigned + for the \c Return or \c Enter key. Similarly, \a escapeButton parameter + allows specifing the button which is assigned for \c Escape key. + If these parameters are not specified (-1 by default), the first button + is set as default button and the last one is defined as escape button. + + \param parent parent widget + \param title message box title + \param text message box text + \param button1 first button text + \param button2 second button text + \param button3 third button text + \param defaultButton default button + \param escapeButton escape button + \return button used button id +*/ +int SUIT_MessageBox::warning( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, + const QString& button3, + const int defaultButton, const int escapeButton ) +{ + ButtonInfos lst; + int id = 0; + lst.append( ButtonInfo( id++, button1 ) ); + lst.append( ButtonInfo( id++, button2 ) ); + lst.append( ButtonInfo( id++, button3 ) ); + return messageBox( SUIT_MessageBox::Warning, parent, title, text, lst, + defaultButton, escapeButton ); +} + +/*! + \brief Show information message box with three custom buttons. + + Parameters \a button1, \a button2 and \a button3 specify the buttons text. + The function returns clicked button id. The identifiers for the buttons + are assigned automatically. The first button is identified as 0, the + second one as 1, etc. + + The \a defaultButton parameter allows to specify the button which is assigned + for the \c Return or \c Enter key. Similarly, \a escapeButton parameter + allows specifing the button which is assigned for \c Escape key. + If these parameters are not specified (-1 by default), the first button + is set as default button and the last one is defined as escape button. + + \param parent parent widget + \param title message box title + \param text message box text + \param button1 first button text + \param button2 second button text + \param button3 third button text + \param defaultButton default button + \param escapeButton escape button + \return button used button id +*/ +int SUIT_MessageBox::information( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, + const QString& button3, + const int defaultButton, const int escapeButton ) +{ + ButtonInfos lst; + int id = 0; + lst.append( ButtonInfo( id++, button1 ) ); + lst.append( ButtonInfo( id++, button2 ) ); + lst.append( ButtonInfo( id++, button3 ) ); + return messageBox( SUIT_MessageBox::Information, parent, title, text, lst, + defaultButton, escapeButton ); +} + +/*! + \brief Show question message box with three custom buttons. + + Parameters \a button1, \a button2 and \a button3 specify the buttons text. + The function returns clicked button id. The identifiers for the buttons + are assigned automatically. The first button is identified as 0, the + second one as 1, etc. + + The \a defaultButton parameter allows to specify the button which is assigned + for the \c Return or \c Enter key. Similarly, \a escapeButton parameter + allows specifing the button which is assigned for \c Escape key. + If these parameters are not specified (-1 by default), the first button + is set as default button and the last one is defined as escape button. + + \param parent parent widget + \param title message box title + \param text message box text + \param button1 first button text + \param button2 second button text + \param button3 third button text + \param defaultButton default button + \param escapeButton escape button + \return button used button id +*/ +int SUIT_MessageBox::question( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, + const QString& button3, + const int defaultButton, const int escapeButton ) +{ + ButtonInfos lst; + int id = 0; + lst.append( ButtonInfo( id++, button1 ) ); + lst.append( ButtonInfo( id++, button2 ) ); + lst.append( ButtonInfo( id++, button3 ) ); + return messageBox( SUIT_MessageBox::Question, parent, title, text, lst, + defaultButton, escapeButton ); +} + +/*! + \brief Show critical message box with four custom buttons. + + Parameters \a button1, \a button2, \a button3 and \a button4 specify + the buttons text. + The function returns clicked button id. The identifiers for the buttons + are assigned automatically. The first button is identified as 0, the + second one as 1, etc. + + The \a defaultButton parameter allows to specify the button which is assigned + for the \c Return or \c Enter key. Similarly, \a escapeButton parameter + allows specifing the button which is assigned for \c Escape key. + If these parameters are not specified (-1 by default), the first button + is set as default button and the last one is defined as escape button. + + \param parent parent widget + \param title message box title + \param text message box text + \param button1 first button text + \param button2 second button text + \param button3 third button text + \param button4 fourth button text + \param defaultButton default button + \param escapeButton escape button + \return button used button id +*/ +int SUIT_MessageBox::critical( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, + const QString& button3, const QString& button4, + const int defaultButton, const int escapeButton ) +{ + ButtonInfos lst; + int id = 0; + lst.append( ButtonInfo( id++, button1 ) ); + lst.append( ButtonInfo( id++, button2 ) ); + lst.append( ButtonInfo( id++, button3 ) ); + lst.append( ButtonInfo( id++, button4 ) ); + return messageBox( SUIT_MessageBox::Critical, parent, title, text, lst, + defaultButton, escapeButton ); +} + +/*! + \brief Show warning message box with four custom buttons. + + Parameters \a button1, \a button2, \a button3 and \a button4 specify + the buttons text. + The function returns clicked button id. The identifiers for the buttons + are assigned automatically. The first button is identified as 0, the + second one as 1, etc. + + The \a defaultButton parameter allows to specify the button which is assigned + for the \c Return or \c Enter key. Similarly, \a escapeButton parameter + allows specifing the button which is assigned for \c Escape key. + If these parameters are not specified (-1 by default), the first button + is set as default button and the last one is defined as escape button. + + \param parent parent widget + \param title message box title + \param text message box text + \param button1 first button text + \param button2 second button text + \param button3 third button text + \param button4 fourth button text + \param defaultButton default button + \param escapeButton escape button + \return button used button id +*/ +int SUIT_MessageBox::warning( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, + const QString& button3, const QString& button4, + const int defaultButton, const int escapeButton ) +{ + ButtonInfos lst; + int id = 0; + lst.append( ButtonInfo( id++, button1 ) ); + lst.append( ButtonInfo( id++, button2 ) ); + lst.append( ButtonInfo( id++, button3 ) ); + lst.append( ButtonInfo( id++, button4 ) ); + return messageBox( SUIT_MessageBox::Warning, parent, title, text, lst, + defaultButton, escapeButton ); +} + +/*! + \brief Show information message box with four custom buttons. + + Parameters \a button1, \a button2, \a button3 and \a button4 specify + the buttons text. + The function returns clicked button id. The identifiers for the buttons + are assigned automatically. The first button is identified as 0, the + second one as 1, etc. + + The \a defaultButton parameter allows to specify the button which is assigned + for the \c Return or \c Enter key. Similarly, \a escapeButton parameter + allows specifing the button which is assigned for \c Escape key. + If these parameters are not specified (-1 by default), the first button + is set as default button and the last one is defined as escape button. + + \param parent parent widget + \param title message box title + \param text message box text + \param button1 first button text + \param button2 second button text + \param button3 third button text + \param button4 fourth button text + \param defaultButton default button + \param escapeButton escape button + \return button used button id +*/ +int SUIT_MessageBox::information( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, + const QString& button3, const QString& button4, + const int defaultButton, const int escapeButton ) +{ + ButtonInfos lst; + int id = 0; + lst.append( ButtonInfo( id++, button1 ) ); + lst.append( ButtonInfo( id++, button2 ) ); + lst.append( ButtonInfo( id++, button3 ) ); + lst.append( ButtonInfo( id++, button4 ) ); + return messageBox( SUIT_MessageBox::Information, parent, title, text, lst, + defaultButton, escapeButton ); +} + +/*! + \brief Show question message box with four custom buttons. + + Parameters \a button1, \a button2, \a button3 and \a button4 specify + the buttons text. + The function returns clicked button id. The identifiers for the buttons + are assigned automatically. The first button is identified as 0, the + second one as 1, etc. + + The \a defaultButton parameter allows to specify the button which is assigned + for the \c Return or \c Enter key. Similarly, \a escapeButton parameter + allows specifing the button which is assigned for \c Escape key. + If these parameters are not specified (-1 by default), the first button + is set as default button and the last one is defined as escape button. + + \param parent parent widget + \param title message box title + \param text message box text + \param button1 first button text + \param button2 second button text + \param button3 third button text + \param button4 fourth button text + \param defaultButton default button + \param escapeButton escape button + \return button used button id +*/ +int SUIT_MessageBox::question( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, + const QString& button3, const QString& button4, + const int defaultButton, const int escapeButton ) +{ + ButtonInfos lst; + int id = 0; + lst.append( ButtonInfo( id++, button1 ) ); + lst.append( ButtonInfo( id++, button2 ) ); + lst.append( ButtonInfo( id++, button3 ) ); + lst.append( ButtonInfo( id++, button4 ) ); + return messageBox( SUIT_MessageBox::Question, parent, title, text, lst, + defaultButton, escapeButton ); +} + +/*! + \brief Show critical message box with arbitrary number of user-specified + buttons. + + The function accepts arbitrary number of parameters. Each parameter starting + from \a btn should be of type const char* to specify the button text. + After the last button parameter and additional 0 (zero) value should be + specified. - int ret = QMessageBox::warning( parent, caption, text, textButton0, - textButton1, textButton2, idDefault ); - qApp->processEvents(); - switch ( ret ) - { - case 0: - return idButton0; - case 1: - return idButton1; - case 2: - return idButton2; - } - return -1; + The function returns clicked button id. The identifiers for the buttons + are assigned automatically. The first button is identified as 0, the + second one as 1, etc. + + The \a defaultButton parameter allows to specify the button which is assigned + for the \c Return or \c Enter key. Similarly, \a escapeButton parameter + allows specifing the button which is assigned for \c Escape key. + If these parameters are not specified (-1 by default), the first button + is set as default button and the last one is defined as escape button. + + \param parent parent widget + \param title message box title + \param text message box text + \param defaultButton default button + \param escapeButton escape button + \param btn first button text + \return button used button id +*/ +int SUIT_MessageBox::critical( QWidget* parent, const QString& title, const QString& text, + const int defaultButton, const int escapeButton, + char* btn, ... ) +{ + va_list args; + va_start( args, btn ); + return messageBox( SUIT_MessageBox::Critical, parent, title, text, + messageList( btn, args ), + defaultButton, escapeButton ); } /*! - Shows error message box with three buttons. - Returns id of the pressed button or -1 if escaped [ static ] + \brief Show warning message box with arbitrary number of user-specified + buttons. + + The function accepts arbitrary number of parameters. Each parameter starting + from \a btn should be of type const char* to specify the button text. + After the last button parameter and additional 0 (zero) value should be + specified. + + The function returns clicked button id. The identifiers for the buttons + are assigned automatically. The first button is identified as 0, the + second one as 1, etc. + + The \a defaultButton parameter allows to specify the button which is assigned + for the \c Return or \c Enter key. Similarly, \a escapeButton parameter + allows specifing the button which is assigned for \c Escape key. + If these parameters are not specified (-1 by default), the first button + is set as default button and the last one is defined as escape button. + + \param parent parent widget + \param title message box title + \param text message box text + \param defaultButton default button + \param escapeButton escape button + \param btn first button text + \return button used button id */ -int SUIT_MessageBox::error3( QWidget* parent, - const QString& caption, - const QString& text, - const QString& textButton0, - const QString& textButton1, - const QString& textButton2, - int idButton0, int idButton1, - int idButton2, int idDefault ) +int SUIT_MessageBox::warning( QWidget* parent, const QString& title, const QString& text, + const int defaultButton, const int escapeButton, + char* btn, ... ) { - SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::ArrowCursor ); + va_list args; + va_start( args, btn ); + return messageBox( SUIT_MessageBox::Warning, parent, title, text, + messageList( btn, args ), + defaultButton, escapeButton ); +} + +/*! + \brief Show information message box with arbitrary number of user-specified + buttons. + + The function accepts arbitrary number of parameters. Each parameter starting + from \a btn should be of type const char* to specify the button text. + After the last button parameter and additional 0 (zero) value should be + specified. - if ( idDefault == idButton0 ) - idDefault = 0; - else if ( idDefault == idButton1 ) - idDefault = 1; - else if ( idDefault == idButton2 ) - idDefault = 2; - else - idDefault = 0; + The function returns clicked button id. The identifiers for the buttons + are assigned automatically. The first button is identified as 0, the + second one as 1, etc. + + The \a defaultButton parameter allows to specify the button which is assigned + for the \c Return or \c Enter key. Similarly, \a escapeButton parameter + allows specifing the button which is assigned for \c Escape key. + If these parameters are not specified (-1 by default), the first button + is set as default button and the last one is defined as escape button. + + \param parent parent widget + \param title message box title + \param text message box text + \param defaultButton default button + \param escapeButton escape button + \param btn first button text + \return button used button id +*/ +int SUIT_MessageBox::information( QWidget* parent, const QString& title, const QString& text, + const int defaultButton, const int escapeButton, + char* btn, ... ) +{ + va_list args; + va_start( args, btn ); + return messageBox( SUIT_MessageBox::Information, parent, title, text, + messageList( btn, args ), + defaultButton, escapeButton ); +} + +/*! + \brief Show question message box with arbitrary number of user-specified + buttons. + + The function accepts arbitrary number of parameters. Each parameter starting + from \a btn should be of type const char* to specify the button text. + After the last button parameter and additional 0 (zero) value should be + specified. - int ret = QMessageBox::critical( parent, caption, text, textButton0, - textButton1, textButton2, idDefault ); - qApp->processEvents(); - switch ( ret ) - { - case 0: - return idButton0; - case 1: - return idButton1; - case 2: - return idButton2; - } - return -1; + The function returns clicked button id. The identifiers for the buttons + are assigned automatically. The first button is identified as 0, the + second one as 1, etc. + + The \a defaultButton parameter allows to specify the button which is assigned + for the \c Return or \c Enter key. Similarly, \a escapeButton parameter + allows specifing the button which is assigned for \c Escape key. + If these parameters are not specified (-1 by default), the first button + is set as default button and the last one is defined as escape button. + + \param parent parent widget + \param title message box title + \param text message box text + \param defaultButton default button + \param escapeButton escape button + \param btn first button text + \return button used button id +*/ +int SUIT_MessageBox::question( QWidget* parent, const QString& title, const QString& text, + const int defaultButton, const int escapeButton, + char* btn, ... ) +{ + va_list args; + va_start( args, btn ); + return messageBox( SUIT_MessageBox::Question, parent, title, text, + messageList( btn, args ), + defaultButton, escapeButton ); +} + +/*! + \brief Parse arbitrary arguments list. + + The last parameter in a sequence should be 0 (zero) value. + + \param txt first argument which starts arbitrary sequence + \param args arguments list from the stack + \return list of buttons infos +*/ +SUIT_MessageBox::ButtonInfos SUIT_MessageBox::messageList( char* txt, va_list& args ) +{ + int i = 0; + ButtonInfos lst; + char* cur = txt; + while ( cur ) + { + lst.append( ButtonInfo( i++, cur ) ); + cur = va_arg( args, char* ); + } + + va_end( args ); + + return lst; } /*! - Shows question message box with three buttons. - Returns id of the pressed button or -1 if escaped [ static ] + \brief Create and show the message box. + \param icon icon type + \param parent parent widget + \param title message box title + \param text message box text + \param lst list of buttons infos + \param defaultButton default button + \param escapeButton escape button + \return button used button id */ -int SUIT_MessageBox::question3( QWidget* parent, - const QString& caption, - const QString& text, - const QString& textButton0, - const QString& textButton1, - const QString& textButton2, - int idButton0, int idButton1, - int idButton2, int idDefault ) +int SUIT_MessageBox::messageBox( Icon icon, QWidget* parent, + const QString& title, const QString& text, + const ButtonInfos& lst, + const int defaultButton, + const int escapeButton ) { + SUIT_MessageBox msgBox( icon, title, text, NoButton, parent ); + + QMap bm; + for ( int i = 0; i < lst.count(); i++ ) + { + int btn = lst[i].id(); + QString txt = lst[i].text(); + ButtonRole role = lst[i].role(); + + QPushButton* pb = msgBox.addButton( txt, role ); + bm.insert( pb, btn ); + + if ( defaultButton == -1 && i == 0 || btn == defaultButton ) + msgBox.setDefaultButton( pb ); + if ( escapeButton == -1 && i == lst.count() - 1 || btn == escapeButton ) + msgBox.setEscapeButton( pb ); + } + SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::ArrowCursor ); - - if ( idDefault == idButton0 ) - idDefault = 0; - else if ( idDefault == idButton1 ) - idDefault = 1; - else if ( idDefault == idButton2 ) - idDefault = 2; - else - idDefault = 0; - - int ret = QMessageBox::question( parent, caption, text, textButton0, - textButton1, textButton2, idDefault ); - qApp->processEvents(); - switch ( ret ) - { - case 0: - return idButton0; - case 1: - return idButton1; - case 2: - return idButton2; - } - return -1; + + int res = msgBox.exec(); + if ( res != -1 ) + res = bm[msgBox.clickedButton()]; + + QApplication::processEvents(); + + return res; } + diff --git a/src/SUIT/SUIT_MessageBox.h b/src/SUIT/SUIT_MessageBox.h index 69b07aa39..d9d24133c 100755 --- a/src/SUIT/SUIT_MessageBox.h +++ b/src/SUIT/SUIT_MessageBox.h @@ -22,70 +22,129 @@ #include "SUIT.h" -#include -#include +#include +#include +#include -#define SUIT_OK 1 -#define SUIT_CANCEL 2 -#define SUIT_YES 3 -#define SUIT_NO 4 -#define SUIT_HELP 5 - -/*! - \class SUIT_MessageBox - \brief Message dialog box for SUIT-based application -*/ -class SUIT_EXPORT SUIT_MessageBox +class SUIT_EXPORT SUIT_MessageBox : public QMessageBox { public: - - /** @name One button message boxes.*/ - //@{ - static int info1 ( QWidget* parent, const QString& caption, const QString& text, - const QString& textButton0 ); - static int warn1 ( QWidget* parent, const QString& caption, const QString& text, - const QString& textButton0 ); - static int error1 ( QWidget* parent, const QString& caption, const QString& text, - const QString& textButton0 ); - static int question1 ( QWidget* parent, const QString& caption, const QString& text, - const QString& textButton0 ); - //@} + // construction/destruction + SUIT_MessageBox( QWidget* = 0 ); + SUIT_MessageBox( Icon, const QString&, const QString&, StandardButtons buttons = NoButton, + QWidget* = 0, Qt::WindowFlags = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint ); + ~SUIT_MessageBox(); + + // customize the standard buttons text + QString buttonText( StandardButton ) const; + void setButtonText( StandardButton, const QString& ); + + // message box with standard buttons + static StandardButton critical( QWidget* parent, const QString& title, const QString& text, + StandardButtons buttons = Ok, StandardButton defaultButton = NoButton ); + static StandardButton warning( QWidget* parent, const QString& title, const QString& text, + StandardButtons buttons = Ok, StandardButton defaultButton = NoButton ); + static StandardButton information( QWidget* parent, const QString& title, const QString& text, + StandardButtons buttons = Ok, StandardButton defaultButton = NoButton ); + static StandardButton question( QWidget* parent, const QString& title, const QString& text, + StandardButtons buttons = Ok, StandardButton defaultButton = NoButton ); + + // message boxes with one custom button + static int critical( QWidget* parent, const QString& title, const QString& text, + const QString& button ); + static int warning( QWidget* parent, const QString& title, const QString& text, + const QString& button ); + static int information( QWidget* parent, const QString& title, const QString& text, + const QString& button ); + static int question( QWidget* parent, const QString& title, const QString& text, + const QString& button ); + + // message boxes with two custom buttons + static int critical( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, + const int defaultButton = -1, const int escapeButton = -1 ); + static int warning( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, + const int defaultButton = -1, const int escapeButton = -1 ); + static int information( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, + const int defaultButton = -1, const int escapeButton = -1 ); + static int question( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, + const int defaultButton = -1, const int escapeButton = -1 ); + + // message boxes with three custom buttons + static int critical( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, const QString& button3, + const int defaultButton = -1, const int escapeButton = -1 ); + static int warning( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, const QString& button3, + const int defaultButton = -1, const int escapeButton = -1 ); + static int information( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, const QString& button3, + const int defaultButton = -1, const int escapeButton = -1 ); + static int question( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, const QString& button3, + const int defaultButton = -1, const int escapeButton = -1 ); + + // message boxes with four custom buttons + static int critical( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, + const QString& button3, const QString& button4, + const int defaultButton = -1, const int escapeButton = -1 ); + static int warning( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, + const QString& button3, const QString& button4, + const int defaultButton = -1, const int escapeButton = -1 ); + static int information( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, + const QString& button3, const QString& button4, + const int defaultButton = -1, const int escapeButton = -1 ); + static int question( QWidget* parent, const QString& title, const QString& text, + const QString& button1, const QString& button2, + const QString& button3, const QString& button4, + const int defaultButton = -1, const int escapeButton = -1 ); + + // message boxes with arbitrary number of buttons + static int critical( QWidget* parent, const QString& title, const QString& text, + const int defaultButton, const int escapeButton, + char*, ... ); + static int warning( QWidget* parent, const QString& title, const QString& text, + const int defaultButton, const int escapeButton, + char*, ... ); + static int information( QWidget* parent, const QString& title, const QString& text, + const int defaultButton, const int escapeButton, + char*, ... ); + static int question( QWidget* parent, const QString& title, const QString& text, + const int defaultButton, const int escapeButton, + char*, ... ); + +private: + class ButtonInfo + { + public: + ButtonInfo( const int id, + const QString& text, + const ButtonRole role = ActionRole ) + : myId( id ), myText( text ), myRole( role ) {} + int id() const { return myId; } + QString text() const { return myText; } + ButtonRole role() const { return myRole; } + private: + int myId; //!< button id + QString myText; //!< button text + ButtonRole myRole; //!< button role + }; - /** @name Two buttons message boxes.*/ - //@{ - static int info2 ( QWidget* parent, const QString& caption, const QString& text, - const QString& textButton0, const QString& textButton1, - int idButton0, int idButton1, int idDefault ); - static int warn2 ( QWidget* parent, const QString& caption, const QString& text, - const QString& textButton0, const QString& textButton1, - int idButton0, int idButton1, int idDefault ); - static int error2 ( QWidget* parent, const QString& caption, const QString& text, - const QString& textButton0, const QString& textButton1, - int idButton0, int idButton1, int idDefault ); - static int question2 ( QWidget* parent, const QString& caption, const QString& text, - const QString& textButton0, const QString& textButton1, - int idButton0, int idButton1, int idDefault ); - //@} + typedef QList ButtonInfos; - /** @name Three buttons message boxes.*/ - //@{ - static int info3 ( QWidget* parent, const QString& caption, const QString& text, - const QString& textButton0, const QString& textButton1, - const QString& textButton2, int idButton0, int idButton1, - int idButton2, int idDefault ); - static int warn3 ( QWidget* parent, const QString& caption, const QString& text, - const QString& textButton0, const QString& textButton1, - const QString& textButton2, int idButton0, int idButton1, - int idButton2, int idDefault ); - static int error3 ( QWidget* parent, const QString& caption, const QString& text, - const QString& textButton0, const QString& textButton1, - const QString& textButton2, int idButton0, int idButton1, - int idButton2, int idDefault ); - static int question3 ( QWidget* parent, const QString& caption, const QString& text, - const QString& textButton0, const QString& textButton1, - const QString& textButton2, int idButton0, int idButton1, - int idButton2, int idDefault ); - //@} +private: + static int messageBox( SUIT_MessageBox::Icon icon, QWidget* parent, + const QString& title, const QString& text, + const ButtonInfos& lst, + const int defaultButton = -1, + const int escapeButton = -1 ); + static ButtonInfos messageList( char*, va_list& ); }; #endif 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 810c0a920..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; diff --git a/src/SUIT/SUIT_OverrideCursor.cxx b/src/SUIT/SUIT_OverrideCursor.cxx index 1b609e439..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() { diff --git a/src/SUIT/SUIT_OverrideCursor.h b/src/SUIT/SUIT_OverrideCursor.h index f353e526c..90e9dc7c4 100755 --- a/src/SUIT/SUIT_OverrideCursor.h +++ b/src/SUIT/SUIT_OverrideCursor.h @@ -21,9 +21,8 @@ #include "SUIT.h" -#include -#include -#include +#include +#include /*! \brief Class used for management cursors.*/ class SUIT_EXPORT SUIT_OverrideCursor diff --git a/src/SUIT/SUIT_PopupClient.cxx b/src/SUIT/SUIT_PopupClient.cxx index 492b31d79..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 532bbc7ac..42f7466b6 100644 --- a/src/SUIT/SUIT_PopupClient.h +++ b/src/SUIT/SUIT_PopupClient.h @@ -21,7 +21,7 @@ #include "SUIT.h" -#include +#include class QMenu; class QContextMenuEvent; diff --git a/src/SUIT/SUIT_PreferenceMgr.cxx b/src/SUIT/SUIT_PreferenceMgr.cxx new file mode 100644 index 000000000..ada123161 --- /dev/null +++ b/src/SUIT/SUIT_PreferenceMgr.cxx @@ -0,0 +1,162 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: SUIT_PreferenceMgr.cxx +// Author: Sergey TELKOV + +#include "SUIT_PreferenceMgr.h" + +SUIT_PreferenceMgr::SUIT_PreferenceMgr( QtxResourceMgr* resMgr, QWidget* parent ) +: QtxPagePrefMgr( resMgr, parent ), +myRoot( 0 ) +{ +} + +SUIT_PreferenceMgr::~SUIT_PreferenceMgr() +{ +} + +QIcon SUIT_PreferenceMgr::itemIcon( const int id ) const +{ + const QtxPreferenceItem* item = 0; + if ( id == -1 ) + item = this; + else + item = findItem( id, true ); + return item ? item->icon() : QIcon(); +} + +void SUIT_PreferenceMgr::setItemIcon( const int id, const QIcon& ico ) +{ + QtxPreferenceItem* item = id == -1 ? this : findItem( id, true ); + if ( item ) + item->setIcon( ico ); +} + +QVariant SUIT_PreferenceMgr::itemProperty( const QString& prop, const int id ) const +{ + const QtxPreferenceItem* item = 0; + if ( id == -1 ) + item = this; + else + item = findItem( id, true ); + return item ? item->option( prop ) : QVariant(); +} + +void SUIT_PreferenceMgr::setItemProperty( const QString& prop, const QVariant& val, const int id ) +{ + QtxPreferenceItem* item = id == -1 ? this : findItem( id, true ); + if ( item ) + item->setOption( prop, val ); +} + +int SUIT_PreferenceMgr::addItem( const QString& title, const int pId, + const SUIT_PreferenceMgr::PrefItemType type, + const QString& sect, const QString& param ) +{ + QtxPreferenceItem* item = findItem( title, true ); + if ( item ) + return item->id(); + + QtxPreferenceItem* parent = 0; + if ( pId == -1 ) + { + if ( !myRoot ) + myRoot = new QtxPagePrefListItem( QString( "root" ), this ); + parent = myRoot; + } + else + parent = findItem( pId, true ); + + if ( !parent ) + return -1; + + switch( type ) + { + case Auto: + switch ( parent->depth() ) + { + case 1: + item = new QtxPagePrefTabsItem( title, parent, sect, param ); + break; + case 2: + item = new QtxPagePrefFrameItem( title, parent, sect, param ); + break; + case 3: + item = new QtxPagePrefGroupItem( title, parent, sect, param ); + break; + } + break; + case Space: + item = new QtxPagePrefSpaceItem( parent ); + break; + case Bool: + item = new QtxPagePrefCheckItem( title, parent, sect, param ); + break; + case Color: + item = new QtxPagePrefColorItem( title, parent, sect, param ); + break; + case String: + item = new QtxPagePrefEditItem( QtxPagePrefEditItem::String, title, parent, sect, param ); + break; + case Selector: + item = new QtxPagePrefSelectItem( title, parent, sect, param ); + break; + case DblSpin: + item = new QtxPagePrefSpinItem( QtxPagePrefSpinItem::Double, title, parent, sect, param ); + break; + case IntSpin: + item = new QtxPagePrefSpinItem( QtxPagePrefSpinItem::Integer, title, parent, sect, param ); + break; + case Double: + item = new QtxPagePrefEditItem( QtxPagePrefEditItem::Double, title, parent, sect, param ); + break; + case Integer: + item = new QtxPagePrefEditItem( QtxPagePrefEditItem::Integer, title, parent, sect, param ); + break; + case GroupBox: + item = new QtxPagePrefGroupItem( title, parent, sect, param ); + break; + case Font: + item = new QtxPagePrefFontItem( title, parent, sect, param ); + break; + case File: + item = new QtxPagePrefPathItem( Qtx::PT_OpenFile, title, parent, sect, param ); + break; + case DirList: + item = new QtxPagePrefPathListItem( Qtx::PT_Directory, title, parent, sect, param ); + break; + } + + return item ? item->id() : -1; +} + +QVariant SUIT_PreferenceMgr::optionValue( const QString& name ) const +{ + QVariant val = QtxPagePrefMgr::optionValue( name ); + if ( !val.isValid() && myRoot ) + val = myRoot->option( name ); + return val; +} + +void SUIT_PreferenceMgr::setOptionValue( const QString& name, const QVariant& val ) +{ + QtxPagePrefMgr::setOptionValue( name, val ); + if ( myRoot ) + myRoot->setOption( name, val ); +} diff --git a/src/SUIT/SUIT_PreferenceMgr.h b/src/SUIT/SUIT_PreferenceMgr.h new file mode 100644 index 000000000..787604000 --- /dev/null +++ b/src/SUIT/SUIT_PreferenceMgr.h @@ -0,0 +1,62 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: SUIT_PreferenceMgr.h +// Author: Sergey TELKOV + +#ifndef SUIT_PREFERENCEMGR_H +#define SUIT_PREFERENCEMGR_H + +// This class is obsoleted. +// It was created for backward compatibility with ResourceEdit from Salome version 3.x.x + +#include "SUIT.h" + +#include "QtxPagePrefMgr.h" + +class SUIT_EXPORT SUIT_PreferenceMgr : public QtxPagePrefMgr +{ + Q_OBJECT + +public: + typedef enum { Auto, Space, Bool, Color, String, Selector, + DblSpin, IntSpin, Double, Integer, + GroupBox, Font, DirList, File } PrefItemType; + +public: + SUIT_PreferenceMgr( QtxResourceMgr*, QWidget* = 0 ); + virtual ~SUIT_PreferenceMgr(); + + QIcon itemIcon( const int ) const; + void setItemIcon( const int, const QIcon& ); + + QVariant itemProperty( const QString&, const int = -1 ) const; + void setItemProperty( const QString&, const QVariant&, const int = -1 ); + + int addItem( const QString&, const int pId = -1, const PrefItemType = Auto, + const QString& = QString(), const QString& = QString() ); + +protected: + virtual QVariant optionValue( const QString& ) const; + virtual void setOptionValue( const QString&, const QVariant& ); + +private: + QtxPreferenceItem* myRoot; +}; + +#endif diff --git a/src/SUIT/SUIT_ResourceMgr.cxx b/src/SUIT/SUIT_ResourceMgr.cxx index cdd4a9cc5..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 +#ifndef WIN32 +#include +#endif /*! Constructor @@ -71,15 +75,32 @@ QString SUIT_ResourceMgr::loadDoc( const QString& prefix, const QString& id ) co */ QString SUIT_ResourceMgr::userFileName( const QString& appName, const bool for_load ) const { - QString pathName = QtxResourceMgr::userFileName( appName ); + QString pathName; + + QStringList arguments = QApplication::arguments(); + // Try config file, given in arguments + for (int i = 1; i < arguments.count(); i++) { + QRegExp rx ("--resources=(.+)"); + if ( rx.indexIn( arguments[i] ) >= 0 && rx.numCaptures() > 1 ) { + QString file = rx.cap(1); + QFileInfo fi (file); + pathName = fi.absoluteFilePath(); + } + } + + if (!pathName.isEmpty()) + return pathName; + + // QtxResourceMgr::userFileName() + '.' + version() + pathName = QtxResourceMgr::userFileName( appName ); if ( !version().isEmpty() ) pathName += QString( "." ) + version(); - if( !QFileInfo( pathName ).exists() && for_load ) + if ( !QFileInfo( pathName ).exists() && for_load ) { QString newName = findAppropriateUserFile( pathName ); - if( !newName.isEmpty() ) + if ( !newName.isEmpty() ) pathName = newName; } diff --git a/src/SUIT/SUIT_SelectionMgr.cxx b/src/SUIT/SUIT_SelectionMgr.cxx index 19a1ff200..21d02eadc 100755 --- a/src/SUIT/SUIT_SelectionMgr.cxx +++ b/src/SUIT/SUIT_SelectionMgr.cxx @@ -18,6 +18,9 @@ // #include "SUIT_SelectionMgr.h" +#include "SUIT_Selector.h" +#include "SUIT_SelectionFilter.h" + /*!\class SUIT_SelectionMgr * Provide selection manager. Manipulate by selection filters, modes, data owners. */ @@ -25,8 +28,8 @@ /*!constructor. initialize myIterations and myIsSelChangeEnabled.*/ SUIT_SelectionMgr::SUIT_SelectionMgr( const bool Feedback, QObject* p ) : QObject( p ), -myAutoDelFilter( false ), myIterations( Feedback ? 1 : 0 ), +myAutoDelFilter( false ), myIsSelChangeEnabled( true ) { } @@ -145,9 +148,8 @@ void SUIT_SelectionMgr::selectionChanged( SUIT_Selector* sel ) { for ( SelectorList::iterator it = mySelectors.begin(); it != mySelectors.end(); ++it ) { - SUIT_Selector* aSel = *it; if ( *it != sel ) - (*it)->setSelected( newOwners ); + (*it)->setSelected( newOwners ); } } myIsSelChangeEnabled = true; diff --git a/src/SUIT/SUIT_SelectionMgr.h b/src/SUIT/SUIT_SelectionMgr.h index 57d45c84e..7f3082737 100755 --- a/src/SUIT/SUIT_SelectionMgr.h +++ b/src/SUIT/SUIT_SelectionMgr.h @@ -19,12 +19,13 @@ #ifndef SUIT_SELECTIONMGR_H #define SUIT_SELECTIONMGR_H -#include "SUIT_Selector.h" #include "SUIT_DataOwner.h" -#include "SUIT_SelectionFilter.h" -#include -#include +#include +#include + +class SUIT_Selector; +class SUIT_SelectionFilter; #ifdef WIN32 #pragma warning ( disable : 4251 ) diff --git a/src/SUIT/SUIT_Selector.cxx b/src/SUIT/SUIT_Selector.cxx index 2afe73c47..368d8c641 100755 --- a/src/SUIT/SUIT_Selector.cxx +++ b/src/SUIT/SUIT_Selector.cxx @@ -20,7 +20,9 @@ #include "SUIT_SelectionMgr.h" -/*!\class SUIT_Selector::Detroyer +#include + +/*!\class SUIT_Selector::Destroyer Class provide the watching for qobject parent class of the selector. */ diff --git a/src/SUIT/SUIT_Selector.h b/src/SUIT/SUIT_Selector.h index 954fa449b..46de6fa52 100755 --- a/src/SUIT/SUIT_Selector.h +++ b/src/SUIT/SUIT_Selector.h @@ -21,8 +21,9 @@ #include "SUIT.h" -#include -#include +#include + +class QObject; class SUIT_SelectionMgr; class SUIT_DataOwnerPtrList; @@ -65,8 +66,8 @@ protected: virtual void setSelection( const SUIT_DataOwnerPtrList& ) = 0; private: - bool myBlock; SUIT_SelectionMgr* mySelMgr; + bool myBlock; bool myEnabled; bool myAutoBlock; Destroyer* myDestroyer; diff --git a/src/SUIT/SUIT_Session.cxx b/src/SUIT/SUIT_Session.cxx index 9f74f1a1a..891c20b8f 100755 --- a/src/SUIT/SUIT_Session.cxx +++ b/src/SUIT/SUIT_Session.cxx @@ -18,18 +18,15 @@ // #include "SUIT_Session.h" +#include "SUIT_Study.h" #include "SUIT_Tools.h" -#include "SUIT_Desktop.h" #include "SUIT_MessageBox.h" -#include "SUIT_ViewWindow.h" -#include "SUIT_ViewManager.h" #include "SUIT_ExceptionHandler.h" +#include "SUIT_ResourceMgr.h" -#include -#include -#include +#include -#ifdef Q_OS_WIN32 +#ifdef WIN32 #include #else #include @@ -42,8 +39,8 @@ SUIT_Session* SUIT_Session::mySession = 0; SUIT_Session::SUIT_Session() : QObject(), myResMgr( 0 ), -myHandler( 0 ), myActiveApp( 0 ), +myHandler( 0 ), myExitStatus( FROM_GUI ) { SUIT_ASSERT( !mySession ) @@ -77,7 +74,7 @@ SUIT_Session* SUIT_Session::session() Starts new application using "createApplication" function of loaded DLL. */ -SUIT_Application* SUIT_Session::startApplication( const QString& name, int args, char** argv ) +SUIT_Application* SUIT_Session::startApplication( const QString& name, int /*args*/, char** /*argv*/ ) { AppLib libHandle = 0; @@ -91,8 +88,8 @@ SUIT_Application* SUIT_Session::startApplication( const QString& name, int args, if ( !libHandle ) { - SUIT_MessageBox::warn1( 0, tr( "Error" ), - tr( "Can not load application library \"%1\": %2").arg( lib ).arg( lastError() ), tr( "Ok" ) ); + SUIT_MessageBox::warning( 0, tr( "Error" ), + tr( "Can not load application library \"%1\": %2").arg( lib ).arg( lastError() ) ); return 0; } @@ -101,7 +98,7 @@ SUIT_Application* SUIT_Session::startApplication( const QString& name, int args, APP_CREATE_FUNC crtInst = 0; -#ifdef Q_OS_WIN32 +#ifdef WIN32 crtInst = (APP_CREATE_FUNC)::GetProcAddress( (HINSTANCE)libHandle, APP_CREATE_NAME ); #else crtInst = (APP_CREATE_FUNC)dlsym( libHandle, APP_CREATE_NAME ); @@ -109,8 +106,8 @@ SUIT_Application* SUIT_Session::startApplication( const QString& name, int args, if ( !crtInst ) { - SUIT_MessageBox::warn1( 0, tr( "Error" ), - tr( "Can not find function \"%1\": %2" ).arg( APP_CREATE_NAME ).arg( lastError() ), tr( "Ok" ) ); + SUIT_MessageBox::warning( 0, tr( "Error" ), + tr( "Can not find function \"%1\": %2" ).arg( APP_CREATE_NAME ).arg( lastError() ) ); return 0; } @@ -125,7 +122,7 @@ SUIT_Application* SUIT_Session::startApplication( const QString& name, int args, SUIT_Application* anApp = crtInst(); if ( !anApp ) { - SUIT_MessageBox::warn1( 0, tr( "Error" ), tr( "Can not create application \"%1\": %2").arg( appName ).arg( lastError() ), tr( "Ok" ) ); + SUIT_MessageBox::warning( 0, tr( "Error" ), tr( "Can not create application \"%1\": %2").arg( appName ).arg( lastError() ) ); return 0; } @@ -136,7 +133,7 @@ SUIT_Application* SUIT_Session::startApplication( const QString& name, int args, if ( !myHandler ) { APP_GET_HANDLER_FUNC crtHndlr = 0; -#ifdef Q_OS_WIN32 +#ifdef WIN32 crtHndlr = (APP_GET_HANDLER_FUNC)::GetProcAddress( (HINSTANCE)libHandle, APP_GET_HANDLER_NAME ); #else crtHndlr = (APP_GET_HANDLER_FUNC)dlsym( libHandle, APP_GET_HANDLER_NAME ); @@ -246,7 +243,8 @@ void SUIT_Session::closeSession( int mode ) for ( AppList::const_iterator it = apps.begin(); it != apps.end(); ++it ) { SUIT_Application* app = *it; - if ( mode == ASK && !app->isPossibleToClose() ) + bool closePermanently; + if ( mode == ASK && !app->isPossibleToClose( closePermanently ) ) return; else if ( mode == SAVE ) { @@ -274,7 +272,7 @@ SUIT_ExceptionHandler* SUIT_Session::handler() const QString SUIT_Session::lastError() const { QString str; -#ifdef Q_OS_WIN32 +#ifdef WIN32 LPVOID lpMsgBuf; ::FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 0, ::GetLastError(), 0, (LPTSTR)&lpMsgBuf, 0, 0 ); @@ -300,7 +298,7 @@ SUIT_Session::AppLib SUIT_Session::loadLibrary( const QString& name, QString& li AppLib lib = 0; QByteArray bid = libFile.toLatin1(); -#ifdef Q_OS_WIN32 +#ifdef WIN32 #ifdef UNICODE LPTSTR str = (LPTSTR)libFile.utf16(); #else @@ -316,7 +314,7 @@ SUIT_Session::AppLib SUIT_Session::loadLibrary( const QString& name, QString& li /*! \retval Return file name by application name.*/ QString SUIT_Session::applicationName( const QString& str ) const { -#ifdef Q_OS_WIN32 +#ifdef WIN32 return SUIT_Tools::file( str, false ); #else QString fileName = SUIT_Tools::file( str, false ); diff --git a/src/SUIT/SUIT_Session.h b/src/SUIT/SUIT_Session.h index e9aa75029..f62d697c1 100755 --- a/src/SUIT/SUIT_Session.h +++ b/src/SUIT/SUIT_Session.h @@ -21,13 +21,15 @@ #include "SUIT.h" -#include "SUIT_Application.h" -#include "SUIT_ResourceMgr.h" +#include -#include -#include -#include -#include +#include +#include +#include + +#ifdef WIN32 +#include +#endif #ifdef WIN32 #define LIB_HANDLE HINSTANCE @@ -46,7 +48,7 @@ class SUIT_ExceptionHandler; by static function "createApplication" in external library. The Library must be loaded with \n loadLibrary method and after that application can be started. */ -class SUIT_EXPORT SUIT_Session: public QObject +class SUIT_EXPORT SUIT_Session : public QObject { Q_OBJECT diff --git a/src/SUIT/SUIT_Study.cxx b/src/SUIT/SUIT_Study.cxx index 2115e1005..8fc4f71ce 100755 --- a/src/SUIT/SUIT_Study.cxx +++ b/src/SUIT/SUIT_Study.cxx @@ -32,9 +32,9 @@ SUIT_Study::SUIT_Study( SUIT_Application* app ) : QObject(), myApp( app ), +myName( "" ), myIsSaved( false ), myIsModified( false ), -myName( "" ), myBlockChangeState( false ) { static int _id = 0; @@ -110,7 +110,7 @@ bool SUIT_Study::isModified() const /*! *Close document. NOT IMPLEMENTED. */ -void SUIT_Study::closeDocument(bool permanently) +void SUIT_Study::closeDocument(bool /*permanently*/) { } @@ -271,11 +271,11 @@ bool SUIT_Study::start( SUIT_Operation* theOp, const bool toCheck ) if ( toCheck ) { - while( SUIT_Operation* anOp = blockingOperation( theOp ) ) + while ( SUIT_Operation* anOp = blockingOperation( theOp ) ) { - int anAnsw = SUIT_MessageBox::warn2( application()->desktop(), - tr( "OPERATION_LAUNCH" ), tr( "PREVIOUS_NOT_FINISHED" ), - tr( "CONTINUE" ), tr( "CANCEL" ), 0, 1, 1 ); + int anAnsw = SUIT_MessageBox::question( application()->desktop(), + tr( "OPERATION_LAUNCH" ), tr( "PREVIOUS_NOT_FINISHED" ), + tr( "CONTINUE" ), tr( "CANCEL" ) ); if ( anAnsw == 1 ) return false; @@ -522,6 +522,6 @@ int SUIT_Study::storeState() /*! * \brief Restores the study state */ -void SUIT_Study::restoreState(int savePoint) +void SUIT_Study::restoreState(int /*savePoint*/) { } diff --git a/src/SUIT/SUIT_Study.h b/src/SUIT/SUIT_Study.h index aab1f4c22..6ebf2bcad 100755 --- a/src/SUIT/SUIT_Study.h +++ b/src/SUIT/SUIT_Study.h @@ -21,14 +21,12 @@ #include "SUIT.h" -#include "SUIT_Operation.h" +#include +#include -#include -#include - -class QDialog; class SUIT_DataObject; class SUIT_Application; +class SUIT_Operation; #ifdef WIN32 #pragma warning( disable:4251 ) diff --git a/src/SUIT/SUIT_ToolButton.cxx b/src/SUIT/SUIT_ToolButton.cxx index cc3c852fb..161d1952d 100755 --- a/src/SUIT/SUIT_ToolButton.cxx +++ b/src/SUIT/SUIT_ToolButton.cxx @@ -19,11 +19,10 @@ #include "SUIT_ToolButton.h" -#include -#include +#include /*!Constructor.*/ -SUIT_ToolButton::SUIT_ToolButton( QWidget *parent, const char *name, +SUIT_ToolButton::SUIT_ToolButton( QWidget *parent, const char* /*name*/, bool changeItemAfterClick ) : QToolButton( parent ), myChangeItemAfterClick( changeItemAfterClick ) @@ -34,14 +33,13 @@ myChangeItemAfterClick( changeItemAfterClick ) /*!Initialize tool buttons.*/ void SUIT_ToolButton::initialize() { -// mySignal = NULL; myPopup = new QMenu( this ); setMenu( myPopup ); - connect( myPopup, SIGNAL( activated( int ) ), SLOT( OnSelectAction( int ) ) ); + connect( myPopup, SIGNAL( triggered( QAction* ) ), SLOT( OnSelectAction( QAction* ) ) ); } /*!drawButton is redefined to draw DownArrow*/ -void SUIT_ToolButton::drawButton( QPainter * p ) +void SUIT_ToolButton::drawButton( QPainter * /*p*/ ) { /* QToolButton::drawButton( p ); @@ -64,8 +62,9 @@ void SUIT_ToolButton::AddAction( QAction* theAction ) aIsFirst = true; setIcon( theAction->icon() ); setText( theAction->text() ); + myPopup->setActiveAction( theAction ); } - myPopup->addAction( theAction ); + myPopup->addAction( theAction ); } /*! Sets myPopup item with theIndex as current*/ @@ -76,36 +75,31 @@ void SUIT_ToolButton::SetItem( int theIndex ) { setIcon( a->icon() ); setText( a->text() ); + myPopup->setActiveAction( a ); } } /*!Public SLOT. - * On select action (icon and text set with id = \a theItemID) + * On select action (icon and text set from action = \a theAction) */ -void SUIT_ToolButton::OnSelectAction( int theItemID ) +void SUIT_ToolButton::OnSelectAction( QAction* theAction ) { -/* - if ( myChangeItemAfterClick ) + if ( theAction && myChangeItemAfterClick ) { // Protection against unexpected null pointers returned - if ( myPopup->iconSet(theItemID) ) - setPixmap(myPopup->iconSet(theItemID)->pixmap()); - setTextLabel(myPopup->text(theItemID)); - QMenuItem* aItem = myPopup->findItem(theItemID); - if (aItem != NULL) - { - mySignal = aItem->signal(); - } + QIcon anIcon = theAction->icon(); + if ( !anIcon.isNull() ) + setIcon(anIcon); + setText(theAction->text()); + myPopup->setActiveAction( theAction ); } -*/ } /*!On mouse release event.*/ void SUIT_ToolButton::mouseReleaseEvent( QMouseEvent* theEvent ) { QToolButton::mouseReleaseEvent( theEvent ); -/* - if ( mySignal ) - mySignal->activate(); -*/ + QAction* anAction = myPopup->activeAction(); + if ( anAction ) + anAction->activate( QAction::Trigger ); } diff --git a/src/SUIT/SUIT_ToolButton.h b/src/SUIT/SUIT_ToolButton.h index d4b0365bb..0acd98e74 100755 --- a/src/SUIT/SUIT_ToolButton.h +++ b/src/SUIT/SUIT_ToolButton.h @@ -21,9 +21,9 @@ #include "SUIT.h" -#include -#include +#include +class QAction; class QPixmap; class QToolBar; @@ -47,7 +47,7 @@ public: void SetItem(int theIndex); public slots: - void OnSelectAction(int theItemID); + void OnSelectAction( QAction* theAction ); protected: void mouseReleaseEvent (QMouseEvent * theEvent); @@ -56,7 +56,6 @@ private: void initialize(); QMenu* myPopup; -// QSignal* mySignal; bool myChangeItemAfterClick; }; diff --git a/src/SUIT/SUIT_Tools.cxx b/src/SUIT/SUIT_Tools.cxx index 11086a0d9..31d997b4e 100755 --- a/src/SUIT/SUIT_Tools.cxx +++ b/src/SUIT/SUIT_Tools.cxx @@ -18,7 +18,7 @@ // #include "SUIT_Tools.h" -#include +#include #include #include diff --git a/src/SUIT/SUIT_Tools.h b/src/SUIT/SUIT_Tools.h index 53ebfe11d..811571ddf 100755 --- a/src/SUIT/SUIT_Tools.h +++ b/src/SUIT/SUIT_Tools.h @@ -23,10 +23,9 @@ #include -#include -#include - -#include +#include +#include +#include /*! \class SUIT_Tools diff --git a/src/SUIT/SUIT_TreeSync.h b/src/SUIT/SUIT_TreeSync.h index 602a8913b..929255b36 100644 --- a/src/SUIT/SUIT_TreeSync.h +++ b/src/SUIT/SUIT_TreeSync.h @@ -20,8 +20,7 @@ #ifndef SUIT_TREE_SYNC_HEADER #define SUIT_TREE_SYNC_HEADER -#include -#include +#include /*! \struct DiffItem @@ -54,7 +53,7 @@ TrgItem synchronize( const SrcItem&, const TrgItem&, const TreeData& ); */ template void diffSiblings( const SrcItem&, const TrgItem&, - QValueList < DiffItem < SrcItem,TrgItem > >&, + QList < DiffItem < SrcItem,TrgItem > >&, const TreeData& ); /*! @@ -67,10 +66,10 @@ TrgItem createSubTree( const SrcItem&, const TrgItem&, const TrgItem&, const boo \brief find equal element in list */ template -const typename QValueList::const_iterator findEqual( const QValueList& l, - const typename QValueList::const_iterator& first, - const SrcItem& it, - const TreeData& td ); +const typename QList::const_iterator findEqual( const QList& l, + const typename QList::const_iterator& first, + const SrcItem& it, + const TreeData& td ); @@ -94,8 +93,8 @@ const typename QValueList::const_iterator findEqual( const QValueList void updateItem( const TrgItem& ) const - updates TrgItem without recreation
  • void deleteItemWithChildren( const TrgItem& ) const - deletes TrgItem with all children -
  • void children( const SrcItem&, QValueList& ) const - fills list with children -
  • void children( const TrgItem&, QValueList& ) const - fills list with children +
  • void children( const SrcItem&, QList& ) const - fills list with children +
  • void children( const TrgItem&, QList& ) const - fills list with children
  • SrcItem parent( const SrcItem& ) const - return parent SrcItem
  • TrgItem parent( const TrgItem& ) const - return parent SrcItem @@ -106,13 +105,13 @@ TrgItem synchronize( const SrcItem& r1, const TrgItem& r2, const TreeData& td ) if( td.isEqual( r1, r2 ) ) { // update items themselves - td.updateItem( r2 ); + td.updateItem( r1, r2 ); // iterate 'siblings' (direct children) - QValueList< DiffItem< SrcItem, TrgItem > > d; + QList< DiffItem< SrcItem, TrgItem > > d; diffSiblings( r1, r2, d, td ); - typename QValueList< DiffItem< SrcItem, TrgItem > >::const_iterator anIt = d.begin(), aLast = d.end(); + typename QList< DiffItem< SrcItem, TrgItem > >::const_iterator anIt = d.begin(), aLast = d.end(); TrgItem lastItem = td.nullTrg(); // TrgItem tail = td.nullTrg(); for( ; anIt!=aLast; anIt++ ) @@ -135,7 +134,7 @@ TrgItem synchronize( const SrcItem& r1, const TrgItem& r2, const TreeData& td ) else { //to update - td.updateItem( item.myTrg ); + td.updateItem( item.mySrc, item.myTrg ); synchronize( item.mySrc, item.myTrg, td ); lastItem = item.myTrg; } @@ -162,12 +161,12 @@ TrgItem synchronize( const SrcItem& r1, const TrgItem& r2, const TreeData& td ) \param td - tree data object (provides auxiliary methods) */ template -const typename QValueList::const_iterator findEqual( const QValueList& l, - const typename QValueList::const_iterator& first, - const SrcItem& it, - const TreeData& td ) +const typename QList::const_iterator findEqual( const QList& l, + const typename QList::const_iterator& first, + const SrcItem& it, + const TreeData& td ) { - typename QValueList::const_iterator cur = first, last = l.end(); + typename QList::const_iterator cur = first, last = l.end(); for( ; cur!=last; cur++ ) if( td.isEqual( it, *cur ) ) return cur; @@ -183,28 +182,28 @@ const typename QValueList::const_iterator findEqual( const QValueList void diffSiblings( const SrcItem& src, const TrgItem& trg, - QValueList < DiffItem < SrcItem,TrgItem > >& d, + QList < DiffItem < SrcItem,TrgItem > >& d, const TreeData& td ) { //if( src==td.nullSrc() || trg==td.nullTrg() ) // return; - QValueList src_ch; - QValueList trg_ch; + QList src_ch; + QList trg_ch; td.children( src, src_ch ); td.children( trg, trg_ch ); - typename QValueList::const_iterator src_it = src_ch.begin(), src_last = src_ch.end(); - typename QValueList::const_iterator cur = trg_ch.begin(), trg_last = trg_ch.end(); + typename QList::const_iterator src_it = src_ch.begin(), src_last = src_ch.end(); + typename QList::const_iterator cur = trg_ch.begin(), trg_last = trg_ch.end(); for( ; src_it!=src_last; src_it++ ) { - typename QValueList::const_iterator f = + typename QList::const_iterator f = findEqual( trg_ch, cur, *src_it, td ); if( f!=trg_last ) //is found { //mark all items before found as "to be deleted" - for( typename QValueList::const_iterator it = cur; it!=f; it++ ) + for( typename QList::const_iterator it = cur; it!=f; it++ ) { DiffItem ndiff; ndiff.mySrc = td.nullSrc(); @@ -256,9 +255,9 @@ TrgItem createSubTree( const SrcItem& src, const TrgItem& parent, if( nitem==td.nullTrg() ) return nitem; - QValueList ch; + QList ch; td.children( src, ch ); - typename QValueList::const_iterator anIt = ch.begin(), aLast = ch.end(); + typename QList::const_iterator anIt = ch.begin(), aLast = ch.end(); for( ; anIt!=aLast; anIt++ ) createSubTree( *anIt, nitem, td.nullTrg(), false, td ); diff --git a/src/SUIT/SUIT_ViewManager.cxx b/src/SUIT/SUIT_ViewManager.cxx index ddf151310..61db632b6 100755 --- a/src/SUIT/SUIT_ViewManager.cxx +++ b/src/SUIT/SUIT_ViewManager.cxx @@ -20,15 +20,12 @@ #include "SUIT_Desktop.h" #include "SUIT_ViewModel.h" +#include #include "SUIT_Study.h" -#include -#include -#include - -#include -#include -#include +#include +#include +#include #ifdef WIN32 #include @@ -89,14 +86,14 @@ void SUIT_ViewManager::setTitle( const QString& theTitle ) return; myTitle = theTitle; - for ( int i = 0; i < (int)myViews.count(); i++ ) + for ( int i = 0; i < myViews.count(); i++ ) setViewName( myViews[i] ); } void SUIT_ViewManager::setIcon( const QPixmap& theIcon ) { myIcon = theIcon; - for ( int i = 0; i < (int)myViews.count(); i++ ) + for ( int i = 0; i < myViews.count(); i++ ) myViews[i]->setWindowIcon( QIcon( myIcon ) ); } @@ -284,7 +281,7 @@ void SUIT_ViewManager::removeView( SUIT_ViewWindow* theView ) */ void SUIT_ViewManager::setDestructiveClose( const bool on ) { - for ( int i = 0; i < (int)myViews.count(); i++ ) + for ( int i = 0; i < myViews.count(); i++ ) myViews[i]->setDestructiveClose( on ); } @@ -294,7 +291,7 @@ void SUIT_ViewManager::setDestructiveClose( const bool on ) bool SUIT_ViewManager::isVisible() const { bool res = false; - for ( int i = 0; i < (int)myViews.count() && !res; i++ ) + for ( int i = 0; i < myViews.count() && !res; i++ ) res = myViews[i]->isVisibleTo( myViews[i]->parentWidget() ); return res; } @@ -304,7 +301,7 @@ bool SUIT_ViewManager::isVisible() const */ void SUIT_ViewManager::setShown( const bool on ) { - for ( int i = 0; i < (int)myViews.count(); i++ ) + for ( int i = 0; i < myViews.count(); i++ ) myViews.at( i )->setShown( on ); } @@ -334,7 +331,7 @@ void SUIT_ViewManager::onWindowActivated(SUIT_ViewWindow* view) */ void SUIT_ViewManager::closeAllViews() { - for ( int i = 0; i < (int)myViews.size(); i++ ) + for ( int i = 0; i < myViews.size(); i++ ) delete myViews[i]; myViews.clear(); } diff --git a/src/SUIT/SUIT_ViewManager.h b/src/SUIT/SUIT_ViewManager.h index 0cb1c05a2..cc6735d07 100755 --- a/src/SUIT/SUIT_ViewManager.h +++ b/src/SUIT/SUIT_ViewManager.h @@ -20,19 +20,23 @@ #define SUIT_VIEWMANAGER_H #include "SUIT.h" -#include "SUIT_ViewWindow.h" + #include "SUIT_PopupClient.h" -#include -#include -#include -#include +#include +#include +#include +#include + +class QMenu; +class QMouseEvent; +class QWheelEvent; +class QKeyEvent; class SUIT_Study; class SUIT_Desktop; class SUIT_ViewModel; - -class QMenu; +class SUIT_ViewWindow; #ifdef WIN32 #pragma warning( disable:4251 ) diff --git a/src/SUIT/SUIT_ViewModel.cxx b/src/SUIT/SUIT_ViewModel.cxx index cba2af9fc..3ecd9eeae 100755 --- a/src/SUIT/SUIT_ViewModel.cxx +++ b/src/SUIT/SUIT_ViewModel.cxx @@ -21,6 +21,8 @@ #include "SUIT_ViewModel.h" +#include + SUIT_ViewModel::StatesMap SUIT_ViewModel::myStateMap; SUIT_ViewModel::ButtonsMap SUIT_ViewModel::myButtonMap; @@ -61,6 +63,22 @@ SUIT_ViewWindow* SUIT_ViewModel::createView(SUIT_Desktop* theDesktop) return new SUIT_ViewWindow(theDesktop); } +/*!Set view manager. + \param theViewManager view manager + */ +void SUIT_ViewModel::setViewManager(SUIT_ViewManager* theViewManager) +{ + myViewManager = theViewManager; +} + +/*!Get view manager. + \return view manager + */ +SUIT_ViewManager* SUIT_ViewModel::getViewManager() const +{ + return myViewManager; +} + /*! Sets hot button *\param theOper - hot operation *\param theState - adding state to state map operations. diff --git a/src/SUIT/SUIT_ViewModel.h b/src/SUIT/SUIT_ViewModel.h index c25642c63..8126a7913 100755 --- a/src/SUIT/SUIT_ViewModel.h +++ b/src/SUIT/SUIT_ViewModel.h @@ -20,14 +20,15 @@ #define SUIT_VIEWMODEL_H #include "SUIT.h" -#include "SUIT_Desktop.h" -#include "SUIT_ViewWindow.h" -#include "SUIT_ViewManager.h" -#include -#include +#include +#include -#include +class QMenu; + +class SUIT_Desktop; +class SUIT_ViewWindow; +class SUIT_ViewManager; #ifdef WIN32 #pragma warning( disable:4251 ) @@ -52,8 +53,8 @@ public: virtual SUIT_ViewWindow* createView( SUIT_Desktop* theDesktop ); - virtual void setViewManager(SUIT_ViewManager* theViewManager) { myViewManager = theViewManager; } - SUIT_ViewManager* getViewManager() const { return myViewManager; } + virtual void setViewManager(SUIT_ViewManager* theViewManager); + SUIT_ViewManager* getViewManager() const; virtual QString getType() const { return "SUIT_ViewModel"; } diff --git a/src/SUIT/SUIT_ViewWindow.cxx b/src/SUIT/SUIT_ViewWindow.cxx index 41c59322b..7ab233d84 100755 --- a/src/SUIT/SUIT_ViewWindow.cxx +++ b/src/SUIT/SUIT_ViewWindow.cxx @@ -28,10 +28,10 @@ #include "SUIT_Application.h" #include "SUIT_ViewManager.h" -#include -#include -#include -#include +#include +#include +#include +#include /*!\class SUIT_ViewWindow * Class provide view window. @@ -177,7 +177,7 @@ bool SUIT_ViewWindow::event( QEvent* e ) bOk = true; // cancelled } if ( !bOk ) - SUIT_MessageBox::error1( this, tr( "ERROR" ), tr( "ERR_CANT_DUMP_VIEW" ), tr( "BUT_OK" ) ); + SUIT_MessageBox::critical( this, tr( "ERROR" ), tr( "ERR_CANT_DUMP_VIEW" ) ); return true; } @@ -210,6 +210,6 @@ QString SUIT_ViewWindow::getVisualParameters() Sets visual parameters of window by its string representation \param parameters - string with visual parameters */ -void SUIT_ViewWindow::setVisualParameters( const QString& parameters ) +void SUIT_ViewWindow::setVisualParameters( const QString& /*parameters*/ ) { } diff --git a/src/SUIT/SUIT_ViewWindow.h b/src/SUIT/SUIT_ViewWindow.h index 8381c0a61..e5aaa5bc1 100755 --- a/src/SUIT/SUIT_ViewWindow.h +++ b/src/SUIT/SUIT_ViewWindow.h @@ -24,9 +24,9 @@ #include "SUIT.h" -#include +#include +#include -class QImage; class SUIT_Desktop; class SUIT_ViewManager; diff --git a/src/SUIT/resources/SUIT_msg_en.ts b/src/SUIT/resources/SUIT_msg_en.ts index ac28fa7ae..6b44e7f24 100644 --- a/src/SUIT/resources/SUIT_msg_en.ts +++ b/src/SUIT/resources/SUIT_msg_en.ts @@ -1,126 +1,101 @@ - - + @default - MEN_DESK_WINDOW &Window - ERR_CANT_DUMP_VIEW Can't dump view contents to the file. - TLT_IMAGE_FILES Images Files (*.bmp *.png *.jpg *.jpeg) - MEN_DESK_WINDOW_CASCADE &Cascade - PRP_DESK_WINDOW_CASCADE Arranges the windows as overlapping tiles - ERR_DIR_NOT_EXIST The directory "%1" does not exist! - LAB_QUICK_PATH Quick path: - CONTINUE Continue - CANCEL Cancel - ERR_FILE_NOT_EXIST The file "%1" does not exist! - PRP_DESK_WINDOW_ACTIVATE Activates this window - ERR_PERMISSION_DENIED Can't save file "%1". Permission denied. - ERR_ERROR Error - QUE_FILE_EXISTS The file "%1" already exists. Do you want to overwrite it? - WRN_WARNING Warning - TLT_DUMP_VIEW Dump View to File - INF_DESK_DOC_OPEN Open File - INF_DESK_DOC_SAVE Save File - PRP_DESK_WINDOW_TILE Arranges the windows as nonoverlapping tiles - BUT_ADD_PATH Add path - MEN_DESK_WINDOW_VTILE Tile &Vertically - INF_DIRECTORIES_FILTER Directories - PRP_DESK_WINDOW_VTILE Arranges the windows as nonoverlapping vertical tiles - MEN_DESK_WINDOW_TILE &Tile @@ -128,12 +103,10 @@ Do you want to overwrite it? SUIT_Study - OPERATION_LAUNCH Operation launch - PREVIOUS_NOT_FINISHED Previous operation is not finished and will be aborted -- 2.39.2