From: mpv Date: Mon, 5 Jun 2006 10:40:47 +0000 (+0000) Subject: Porting to Windows X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5626d9df6bea3736c6382d19859bdc1838a0452a;p=modules%2Fgui.git Porting to Windows --- diff --git a/src/LightApp/LightApp_ModuleDlg.cxx b/src/LightApp/LightApp_ModuleDlg.cxx index 28b37d92f..b067b0e5d 100644 --- a/src/LightApp/LightApp_ModuleDlg.cxx +++ b/src/LightApp/LightApp_ModuleDlg.cxx @@ -16,201 +16,201 @@ // // See http://www.salome-platform.org/ // -// File : LightApp_ModuleDlg.cxx -// Author : Michael Zorin (mzn) -// Module : LightApp - -#include - -#include -#include -#include -#include -#include - -#ifndef WIN32 -using namespace std; -#endif - -/*!Default icon*/ -static const char* const default_icon[] = { -"48 48 17 1", -". c None", -"# c #161e4c", -"b c #1d3638", -"e c #2f585b", -"i c #345b5e", -"c c #386266", -"g c #3f7477", -"d c #4d8589", -"m c #519099", -"o c #6abbc1", -"a c #70c9d3", -"f c #79ddea", -"n c #7adff2", -"k c #7ce2f4", -"j c #993550", -"h c #d84b71", -"l c #ef537d", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................########.########.########......", -"...............#aaaaaa###aaaaaa###aaaaaa##......", -"..............#aaaaaa#b#aaaaaa#b#aaaaaa#c#......", -".............########b########b########cc#......", -".............#dddddd#b#dddddd#b#dddddd#cc#......", -"...........########d########d########d#cc#......", -"..........#aaaaaa###aaaaaa###aaaaaa##d#cc#......", -".........#aaaaaa#b#aaaaaa#b#aaaaaa#c#d#cc#......", -"........########b########e########cc#d#c#.......", -"........#dddddd#b#dddddd#e#ffffff#cc#d####......", -"......########d########d########f#cc###g##......", -".....#aaaaaa###aaaaaa###hhhhhh##f#cc#gg#c#......", -"....#aaaaaa#b#aaaaaa#i#hhhhhh#j#f#cc###cc#......", -"...########b########i########jj#f#c#gg#cc#......", -"...#kkkkkk#b#kkkkkk#i#llllll#jj#f####g#cc#......", -"...#kkkkkk#b#kkkkkk#i#llllll#jj###m##g#cc#......", -"...#knnkkk#b#kkkkkk#i#llllll#jj#mm#c#g#cc#......", -"...#knnkkk#b#kkkkkk#i#llllll#jj###cc#g#c#.......", -"...#kkkkkk#b#kkkkkk#i#llllll#j#dd#cc#g####......", -"...#kkkkkk###kkkkkk###llllll####d#cc###g##......", -"...########g########g########o##d#cc#gg#c#......", -"....#gggggg#b#gggggg#b#oooooo#c#d#cc###cc#......", -"...########b########b########cc#d#c#gg#cc#......", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#d####g#cc#......", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###g##g#cc#......", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#gg#c#g#cc#......", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###cc#g#c#.......", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#c#gg#cc#g##........", -"...#kkkkkk###kkkkkk###kkkkkk####g#cc###.........", -"...########g########g########g##g#cc#...........", -"....#gggggg#b#gggggg#b#gggggg#c#g#cc#...........", -"...########b########b########cc#g#c#............", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#g##.............", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###..............", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#................", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#................", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#c#.................", -"...#kkkkkk###kkkkkk###kkkkkk##..................", -"...########.########.########...................", -"................................................", -"................................................", -"................................................", -"................................................"}; - -//============================================================================================================================== -/*! - * LightApp_ModuleDlg::LightApp_ModuleDlg \n - * - * Constructor. - */ -//============================================================================================================================== -LightApp_ModuleDlg::LightApp_ModuleDlg ( QWidget * parent, const QString& component, const QPixmap icon ) - : QDialog ( parent, "ActivateModuleDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap defaultIcon( ( const char** ) default_icon ); - setCaption( tr( "CAPTION" ) ); - setSizeGripEnabled( TRUE ); - - QGridLayout* ActivateModuleDlgLayout = new QGridLayout( this ); - ActivateModuleDlgLayout->setMargin( 11 ); ActivateModuleDlgLayout->setSpacing( 6 ); - - // Module's name and icon - myComponentFrame = new QFrame( this, "myComponentFrame" ); - myComponentFrame->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ) ); - myComponentFrame->setMinimumHeight( 100 ); - myComponentFrame->setFrameStyle( QFrame::Box | QFrame::Sunken ); - - QGridLayout* myComponentFrameLayout = new QGridLayout( myComponentFrame ); - myComponentFrameLayout->setMargin( 11 ); myComponentFrameLayout->setSpacing( 6 ); - - // --> icon - myComponentIcon = new QLabel( myComponentFrame, "myComponentIcon" ); - myComponentIcon->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); - myComponentIcon->setPixmap( !icon.isNull() ? icon : defaultIcon ); - myComponentIcon->setScaledContents( false ); - myComponentIcon->setAlignment( AlignCenter ); - // --> name - myComponentLab = new QLabel( component, myComponentFrame, "myComponentLab" ); - QFont fnt = myComponentLab->font(); fnt.setBold( TRUE ); myComponentLab->setFont( fnt ); - myComponentLab->setAlignment( AlignCenter ); - - myComponentFrameLayout->addWidget( myComponentIcon, 0, 0 ); - myComponentFrameLayout->addWidget( myComponentLab, 0, 1 ); - - // Info - QVBoxLayout* infoLayout = new QVBoxLayout(); - infoLayout->setMargin( 0 ); infoLayout->setSpacing( 6 ); - - // --> top line - QFrame* myLine1 = new QFrame( this, "myLine1" ); - myLine1->setFrameStyle( QFrame::HLine | QFrame::Plain ); - // --> info label - myInfoLabel = new QLabel( tr ("ActivateComponent_DESCRIPTION"), this, "myInfoLabel" ); - myInfoLabel->setAlignment( AlignCenter ); - // --> bottom line - QFrame* myLine2 = new QFrame( this, "myLine2" ); - myLine2->setFrameStyle( QFrame::HLine | QFrame::Plain ); - - infoLayout->addStretch(); - infoLayout->addWidget( myLine1 ); - infoLayout->addWidget( myInfoLabel ); - infoLayout->addWidget( myLine2 ); - infoLayout->addStretch(); - - // Buttons - QHBoxLayout* btnLayout = new QHBoxLayout(); - btnLayout->setMargin( 0 ); btnLayout->setSpacing( 6 ); - - // --> New - myNewBtn = new QPushButton( tr( "NEW" ), this, "myNewBtn" ); - myNewBtn->setDefault( true ); myNewBtn->setAutoDefault( true ); - // --> Open - myOpenBtn = new QPushButton( tr( "OPEN" ), this, "myOpenBtn" ); - myOpenBtn->setAutoDefault( true ); - // --> Load - myLoadBtn = new QPushButton( tr( "LOAD" ), this, "myLoadBtn" ); - myLoadBtn->setAutoDefault( true ); - // --> Cancel - myCancelBtn = new QPushButton( tr( "CANCEL" ), this, "myCancelBtn" ); - myCancelBtn->setAutoDefault( true ); - - btnLayout->addWidget( myNewBtn ); - btnLayout->addWidget( myOpenBtn ); - btnLayout->addWidget( myLoadBtn ); - btnLayout->addStretch(); - btnLayout->addSpacing( 70 ); - btnLayout->addStretch(); - btnLayout->addWidget( myCancelBtn ); - - ActivateModuleDlgLayout->addWidget( myComponentFrame, 0, 0 ); - ActivateModuleDlgLayout->addLayout( infoLayout, 0, 1 ); - ActivateModuleDlgLayout->addMultiCellLayout( btnLayout, 1, 1, 0, 1 ); - - // signals and slots connections - connect( myNewBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) ); - connect( myOpenBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) ); - connect( myLoadBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) ); - connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) ); -} - -//============================================================================================================================== -/*! - * LightApp_ModuleDlg::onButtonClicked - * - * Buttons slot - */ -//============================================================================================================================== -void LightApp_ModuleDlg::onButtonClicked() -{ - QPushButton* btn = ( QPushButton* )sender(); - if ( btn == myNewBtn ) - done( 1 ); - if ( btn == myOpenBtn ) - done( 2 ); - if ( btn == myLoadBtn ) - done( 3 ); -} +// File : LightApp_ModuleDlg.cxx +// Author : Michael Zorin (mzn) +// Module : LightApp + +#include + +#include +#include +#include +#include +#include + +#ifndef WIN32 +using namespace std; +#endif + +/*!Default icon*/ +static const char* const default_icon[] = { +"48 48 17 1", +". c None", +"# c #161e4c", +"b c #1d3638", +"e c #2f585b", +"i c #345b5e", +"c c #386266", +"g c #3f7477", +"d c #4d8589", +"m c #519099", +"o c #6abbc1", +"a c #70c9d3", +"f c #79ddea", +"n c #7adff2", +"k c #7ce2f4", +"j c #993550", +"h c #d84b71", +"l c #ef537d", +"................................................", +"................................................", +"................................................", +"................................................", +"................................................", +"................########.########.########......", +"...............#aaaaaa###aaaaaa###aaaaaa##......", +"..............#aaaaaa#b#aaaaaa#b#aaaaaa#c#......", +".............########b########b########cc#......", +".............#dddddd#b#dddddd#b#dddddd#cc#......", +"...........########d########d########d#cc#......", +"..........#aaaaaa###aaaaaa###aaaaaa##d#cc#......", +".........#aaaaaa#b#aaaaaa#b#aaaaaa#c#d#cc#......", +"........########b########e########cc#d#c#.......", +"........#dddddd#b#dddddd#e#ffffff#cc#d####......", +"......########d########d########f#cc###g##......", +".....#aaaaaa###aaaaaa###hhhhhh##f#cc#gg#c#......", +"....#aaaaaa#b#aaaaaa#i#hhhhhh#j#f#cc###cc#......", +"...########b########i########jj#f#c#gg#cc#......", +"...#kkkkkk#b#kkkkkk#i#llllll#jj#f####g#cc#......", +"...#kkkkkk#b#kkkkkk#i#llllll#jj###m##g#cc#......", +"...#knnkkk#b#kkkkkk#i#llllll#jj#mm#c#g#cc#......", +"...#knnkkk#b#kkkkkk#i#llllll#jj###cc#g#c#.......", +"...#kkkkkk#b#kkkkkk#i#llllll#j#dd#cc#g####......", +"...#kkkkkk###kkkkkk###llllll####d#cc###g##......", +"...########g########g########o##d#cc#gg#c#......", +"....#gggggg#b#gggggg#b#oooooo#c#d#cc###cc#......", +"...########b########b########cc#d#c#gg#cc#......", +"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#d####g#cc#......", +"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###g##g#cc#......", +"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#gg#c#g#cc#......", +"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###cc#g#c#.......", +"...#kkkkkk#b#kkkkkk#b#kkkkkk#c#gg#cc#g##........", +"...#kkkkkk###kkkkkk###kkkkkk####g#cc###.........", +"...########g########g########g##g#cc#...........", +"....#gggggg#b#gggggg#b#gggggg#c#g#cc#...........", +"...########b########b########cc#g#c#............", +"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#g##.............", +"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###..............", +"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#................", +"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#................", +"...#kkkkkk#b#kkkkkk#b#kkkkkk#c#.................", +"...#kkkkkk###kkkkkk###kkkkkk##..................", +"...########.########.########...................", +"................................................", +"................................................", +"................................................", +"................................................"}; + +//============================================================================================================================== +/*! + * LightApp_ModuleDlg::LightApp_ModuleDlg \n + * + * Constructor. + */ +//============================================================================================================================== +LightApp_ModuleDlg::LightApp_ModuleDlg ( QWidget * parent, const QString& component, const QPixmap icon ) + : QDialog ( parent, "ActivateModuleDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + QPixmap defaultIcon( ( const char** ) default_icon ); + setCaption( tr( "CAPTION" ) ); + setSizeGripEnabled( TRUE ); + + QGridLayout* ActivateModuleDlgLayout = new QGridLayout( this ); + ActivateModuleDlgLayout->setMargin( 11 ); ActivateModuleDlgLayout->setSpacing( 6 ); + + // Module's name and icon + myComponentFrame = new QFrame( this, "myComponentFrame" ); + myComponentFrame->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ) ); + myComponentFrame->setMinimumHeight( 100 ); + myComponentFrame->setFrameStyle( QFrame::Box | QFrame::Sunken ); + + QGridLayout* myComponentFrameLayout = new QGridLayout( myComponentFrame ); + myComponentFrameLayout->setMargin( 11 ); myComponentFrameLayout->setSpacing( 6 ); + + // --> icon + myComponentIcon = new QLabel( myComponentFrame, "myComponentIcon" ); + myComponentIcon->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + myComponentIcon->setPixmap( !icon.isNull() ? icon : defaultIcon ); + myComponentIcon->setScaledContents( false ); + myComponentIcon->setAlignment( AlignCenter ); + // --> name + myComponentLab = new QLabel( component, myComponentFrame, "myComponentLab" ); + QFont fnt = myComponentLab->font(); fnt.setBold( TRUE ); myComponentLab->setFont( fnt ); + myComponentLab->setAlignment( AlignCenter ); + + myComponentFrameLayout->addWidget( myComponentIcon, 0, 0 ); + myComponentFrameLayout->addWidget( myComponentLab, 0, 1 ); + + // Info + QVBoxLayout* infoLayout = new QVBoxLayout(); + infoLayout->setMargin( 0 ); infoLayout->setSpacing( 6 ); + + // --> top line + QFrame* myLine1 = new QFrame( this, "myLine1" ); + myLine1->setFrameStyle( QFrame::HLine | QFrame::Plain ); + // --> info label + myInfoLabel = new QLabel( tr ("ActivateComponent_DESCRIPTION"), this, "myInfoLabel" ); + myInfoLabel->setAlignment( AlignCenter ); + // --> bottom line + QFrame* myLine2 = new QFrame( this, "myLine2" ); + myLine2->setFrameStyle( QFrame::HLine | QFrame::Plain ); + + infoLayout->addStretch(); + infoLayout->addWidget( myLine1 ); + infoLayout->addWidget( myInfoLabel ); + infoLayout->addWidget( myLine2 ); + infoLayout->addStretch(); + + // Buttons + QHBoxLayout* btnLayout = new QHBoxLayout(); + btnLayout->setMargin( 0 ); btnLayout->setSpacing( 6 ); + + // --> New + myNewBtn = new QPushButton( tr( "NEW" ), this, "myNewBtn" ); + myNewBtn->setDefault( true ); myNewBtn->setAutoDefault( true ); + // --> Open + myOpenBtn = new QPushButton( tr( "OPEN" ), this, "myOpenBtn" ); + myOpenBtn->setAutoDefault( true ); + // --> Load + myLoadBtn = new QPushButton( tr( "LOAD" ), this, "myLoadBtn" ); + myLoadBtn->setAutoDefault( true ); + // --> Cancel + myCancelBtn = new QPushButton( tr( "CANCEL" ), this, "myCancelBtn" ); + myCancelBtn->setAutoDefault( true ); + + btnLayout->addWidget( myNewBtn ); + btnLayout->addWidget( myOpenBtn ); + btnLayout->addWidget( myLoadBtn ); + btnLayout->addStretch(); + btnLayout->addSpacing( 70 ); + btnLayout->addStretch(); + btnLayout->addWidget( myCancelBtn ); + + ActivateModuleDlgLayout->addWidget( myComponentFrame, 0, 0 ); + ActivateModuleDlgLayout->addLayout( infoLayout, 0, 1 ); + ActivateModuleDlgLayout->addMultiCellLayout( btnLayout, 1, 1, 0, 1 ); + + // signals and slots connections + connect( myNewBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) ); + connect( myOpenBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) ); + connect( myLoadBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) ); + connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) ); +} + +//============================================================================================================================== +/*! + * LightApp_ModuleDlg::onButtonClicked + * + * Buttons slot + */ +//============================================================================================================================== +void LightApp_ModuleDlg::onButtonClicked() +{ + QPushButton* btn = ( QPushButton* )sender(); + if ( btn == myNewBtn ) + done( 1 ); + if ( btn == myOpenBtn ) + done( 2 ); + if ( btn == myLoadBtn ) + done( 3 ); +} diff --git a/src/LightApp/LightApp_OBSelector.cxx b/src/LightApp/LightApp_OBSelector.cxx index 22867b5f6..2006518e8 100644 --- a/src/LightApp/LightApp_OBSelector.cxx +++ b/src/LightApp/LightApp_OBSelector.cxx @@ -26,6 +26,8 @@ #include #include +#include + /*! Constructor */ diff --git a/src/Qtx/QtxWorkstack.cxx b/src/Qtx/QtxWorkstack.cxx index 5e01f08e8..195441d33 100644 --- a/src/Qtx/QtxWorkstack.cxx +++ b/src/Qtx/QtxWorkstack.cxx @@ -1186,7 +1186,7 @@ void QtxWorkstack::splitterInfo( QSplitter* split, QString& info ) const // cuts starting '(' symbol and ending '(' symbol void cutBrackets( QString& parameters ) { - if ( !parameters.isEmpty() && parameters[0] == '(' && parameters[parameters.length()-1] == ')' ) + if ( !parameters.isEmpty() && parameters.at(0) == '(' && parameters.at(parameters.length()-1) == ')' ) parameters = parameters.mid( 1, parameters.length()-2 ); } @@ -1212,7 +1212,7 @@ bool checkFormat( const QString& parameters ) { QString params( parameters ); // 1. begins and ends with brackets - bool ok = ( params[0] == '(' && params[params.length()-1] == ')' ); + bool ok = ( params.at(0) == '(' && params.at(params.length()-1) == ')' ); if ( !ok ) return ok; ::cutBrackets( params ); // 2. has splitter word