From 3566f3441c24a4c80efccf2f176fa5b5d3e8dd4d Mon Sep 17 00:00:00 2001 From: srn Date: Tue, 12 Jul 2005 06:16:11 +0000 Subject: [PATCH] IPAL BugID9021, added a new dialog box for closing the active study --- src/STD/Makefile.in | 9 +++-- src/STD/STD_CloseDlg.cxx | 87 ++++++++++++++++++++++++++++++++++++++++ src/STD/STD_CloseDlg.h | 43 ++++++++++++++++++++ 3 files changed, 136 insertions(+), 3 deletions(-) create mode 100644 src/STD/STD_CloseDlg.cxx create mode 100644 src/STD/STD_CloseDlg.h diff --git a/src/STD/Makefile.in b/src/STD/Makefile.in index 878870e9a..01408775b 100755 --- a/src/STD/Makefile.in +++ b/src/STD/Makefile.in @@ -16,7 +16,8 @@ EXPORT_HEADERS= STD_Application.h \ STD.h \ STD_MDIDesktop.h \ STD_SDIDesktop.h \ - STD_TabDesktop.h + STD_TabDesktop.h \ + STD_CloseDlg.h # .po files to transform in .qm PO_FILES = STD_images.po \ @@ -28,12 +29,14 @@ LIB = libstd.la LIB_SRC= STD_Application.cxx \ STD_MDIDesktop.cxx \ STD_SDIDesktop.cxx \ - STD_TabDesktop.cxx + STD_TabDesktop.cxx \ + STD_CloseDlg.cxx LIB_MOC = STD_Application.h \ STD_MDIDesktop.h \ STD_SDIDesktop.h \ - STD_TabDesktop.h + STD_TabDesktop.h \ + STD_CloseDlg.h RESOURCES_FILES = \ config \ diff --git a/src/STD/STD_CloseDlg.cxx b/src/STD/STD_CloseDlg.cxx new file mode 100644 index 000000000..46d8d9f70 --- /dev/null +++ b/src/STD/STD_CloseDlg.cxx @@ -0,0 +1,87 @@ +#include "STD_CloseDlg.h" + +#include +#include +#include +#include +#include + +using namespace std; + +//================================================================================ +/*! Public - + * \brief creates a Close dialog box + * \param parent a parent widget + * \param modal bool argument, if true the dialog box is a modal dialog box + * \param f style flags + * + */ +//================================================================================ + +STD_CloseDlg::STD_CloseDlg ( QWidget * parent, bool modal, WFlags f ) + : QDialog ( parent, "", TRUE, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +{ + setSizeGripEnabled ( TRUE ) ; + setCaption( tr( "CLOSE_DLG_CAPTION" ) ); + + QVBoxLayout* m_vbL = new QVBoxLayout( this ); + m_vbL->setMargin( 11 ); m_vbL->setSpacing( 6 ); + + QLabel* m_lIcon = new QLabel (this, "m_lDescr"); + QPixmap pm = QMessageBox::standardIcon( QMessageBox::Warning ); + m_lIcon->setPixmap( pm ); + m_lIcon->setScaledContents( false ); + m_lIcon->setAlignment( Qt::AlignCenter ); + + QLabel* m_lDescr = new QLabel (this, "m_lDescr"); + m_lDescr->setText ( tr ("CLOSE_DLG_DESCRIPTION") ); + m_lDescr->setAlignment( Qt::AlignCenter ); + m_lDescr->setMinimumHeight( m_lDescr->sizeHint().height()*5 ); + m_lDescr->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); + + QHBoxLayout* m_hl1 = new QHBoxLayout(); + m_hl1->setMargin( 0 ); m_hl1->setSpacing( 6 ); + m_hl1->addWidget( m_lIcon ); + m_hl1->addWidget( m_lDescr ); + + m_pb1 = new QPushButton( tr ("CLOSE_DLG_SAVE_CLOSE"), this ); + m_pb2 = new QPushButton( tr ("CLOSE_DLG_CLOSE"), this ); + m_pb3 = new QPushButton( tr ("CLOSE_DLG_UNLOAD"), this ); + m_pb4 = new QPushButton( tr ("BUT_CANCEL"), this ); + + QGridLayout* m_hl2 = new QGridLayout(); + m_hl2->setMargin( 0 ); m_hl2->setSpacing( 6 ); + m_hl2->addWidget( m_pb1, 0, 0 ); + m_hl2->addWidget( m_pb2, 0, 1 ); + m_hl2->addWidget( m_pb3, 0, 2 ); + m_hl2->addColSpacing( 3, 10 ); + m_hl2->setColStretch( 3, 5 ); + m_hl2->addWidget( m_pb4, 0, 4 ); + + m_vbL->addLayout( m_hl1 ); + m_vbL->addLayout( m_hl2 ); + + connect( m_pb1, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) ); + connect( m_pb2, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) ); + connect( m_pb3, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) ); + connect( m_pb4, SIGNAL( clicked() ), this, SLOT( reject() ) ); +} + +//================================================================================ +/*! + * \brief reaction on clicked(pressed) button + * + * + */ +//================================================================================ + +void STD_CloseDlg::onButtonClicked() +{ + QPushButton* btn = ( QPushButton* )sender(); + if ( btn == m_pb1 ) + done( 1 ); + if ( btn == m_pb2 ) + done( 2 ); + if ( btn == m_pb3 ) + done( 3 ); +} diff --git a/src/STD/STD_CloseDlg.h b/src/STD/STD_CloseDlg.h new file mode 100644 index 000000000..ca978831b --- /dev/null +++ b/src/STD/STD_CloseDlg.h @@ -0,0 +1,43 @@ +#ifndef STD_CloseDlg_H +#define STD_CloseDlg_H + +#include + +/*! + * \brief + * + * + */ +class STD_CloseDlg: public QDialog +{ + Q_OBJECT + +public: + STD_CloseDlg ( QWidget * parent = 0, bool modal = FALSE, WFlags f = 0 ) ; + ~STD_CloseDlg ( ) { }; + +private slots: + void onButtonClicked(); + +private: + /*!\var m_pb1 + * \brief Private, stores a dialog button 1 + */ + QPushButton* m_pb1; + /*!\var m_pb2 + * \brief Private, stores a dialog button 2 + */ + QPushButton* m_pb2; + /*!\var m_pb3 + * \brief Private, stores a dialog button 3 + */ + QPushButton* m_pb3; + + /*!\var m_pb4 + * \brief Private, stores a dialog button 4 + */ + QPushButton* m_pb4; +}; + +#endif + -- 2.39.2