isis/src/qisis/objs/WarningWidget/WarningWidget.cpp
WarningWidget::WarningWidget(QStatusBar *pParent): QObject(pParent) {
    mSBar = pParent;

    QString sToolIconDir = FileName("$ISISROOT/appdata/images/icons").expanded();
    QString qsIconFile(sToolIconDir);

    // default Action - No warning
    mNoWarning = new QPushButton(mSBar);
    mNoWarning->setFixedSize(22, 22) ;
    mNoWarning->setFlat(true);
    mNoWarning->setIconSize(QSize(15, 15));
    mNoWarning->setIcon(QPixmap(qsIconFile + "/qview_NoWarning.png"));
    mNoWarning->setToolTip("No Warning");
    mNoWarning->setVisible(true);
    // Add Nowarning object to the layout of the active tool bar of the Tool
    mSBar->insertPermanentWidget(0, mNoWarning);

    mSBar->showMessage("Ready");
    mMsgStr = QString("Ready");

    // Warning is not set
    mbWarningFlag = false;

    // Dialog box displayed when the Warning Icon is clicked
    mDialog = new QDialog(mSBar);
    mDialog->setWindowTitle("Warning");
    mDialog->setSizeGripEnabled(true);
    mWindow = new QWidget(mDialog);
    mWindow->installEventFilter(this);//receive events directed to this object

    mTextEdit = new QTextEdit(mDialog);
    mTextEdit->setReadOnly(true);
    QFont font("Helvetica", 11);
    mTextEdit->setFont(font);

    // OK button for the dialog window
    QPushButton *okButton = new QPushButton("Ok", mDialog);
    okButton->setShortcut(Qt::Key_Enter);
    connect(okButton, SIGNAL(clicked()),  this, SLOT(resetWarning()));  //when clicked close dialog and display Nowarning icon

    QGridLayout *layout = new QGridLayout();
    layout->addWidget(mTextEdit, 0, 0, 1, 3);
    layout->addWidget(okButton, 1, 1, 1, 1);
    mDialog->setLayout(layout);

    // Warning object
    mWarning = new QPushButton(mSBar);
    mWarning->setFixedSize(22, 22) ;
    mWarning->setFlat(false);
    mWarning->setIconSize(QSize(15, 15));
    mWarning->setIcon(QPixmap(qsIconFile + "/qview_Warning.png"));
    mWarning->setToolTip("Warning");
    mWarning->setVisible(false);
    mSBar->insertPermanentWidget(0, mWarning);

    connect(mWarning, SIGNAL(clicked()), mDialog, SLOT(show())); // display the dialog window when this button is clicked
    mDialog->resize(800, 250);
    mTextEdit->setBaseSize(750, 200) ;
  }
/**
   * Warning widget constructor, initializes and creates the
   * Nowarning, Warning objects and objects associated with them
   *
   * @author sprasad (12/11/2009)
   *
   * @param parent - parent of this object
   */
Warning widget constructor, initializes and creates the
Nowarning, Warning objects and objects associated with them



@param parent - parent of this object
Warning widget constructor initializes and creates the Nowarning Warning objects and objects associated with them @param parent - parent of this object
WarningWidget::WarningWidget(QStatusBar *pParent): QObject(pParent) {
    mSBar = pParent;
    QString sToolIconDir = FileName("$ISISROOT/appdata/images/icons").expanded();
    QString qsIconFile(sToolIconDir);
    mNoWarning = new QPushButton(mSBar);
    mNoWarning->setFixedSize(22, 22) ;
    mNoWarning->setFlat(true);
    mNoWarning->setIconSize(QSize(15, 15));
    mNoWarning->setIcon(QPixmap(qsIconFile + "/qview_NoWarning.png"));
    mNoWarning->setToolTip("No Warning");
    mNoWarning->setVisible(true);
    mSBar->insertPermanentWidget(0, mNoWarning);
    mSBar->showMessage("Ready");
    mMsgStr = QString("Ready");
    mbWarningFlag = false;
    mDialog = new QDialog(mSBar);
    mDialog->setWindowTitle("Warning");
    mDialog->setSizeGripEnabled(true);
    mWindow = new QWidget(mDialog);
    mWindow->installEventFilter(this);
    mTextEdit = new QTextEdit(mDialog);
    mTextEdit->setReadOnly(true);
    QFont font("Helvetica", 11);
    mTextEdit->setFont(font);
    QPushButton *okButton = new QPushButton("Ok", mDialog);
    okButton->setShortcut(Qt::Key_Enter);
    connect(okButton, SIGNAL(clicked()),  this, SLOT(resetWarning()));  
    QGridLayout *layout = new QGridLayout();
    layout->addWidget(mTextEdit, 0, 0, 1, 3);
    layout->addWidget(okButton, 1, 1, 1, 1);
    mDialog->setLayout(layout);
    mWarning = new QPushButton(mSBar);
    mWarning->setFixedSize(22, 22) ;
    mWarning->setFlat(false);
    mWarning->setIconSize(QSize(15, 15));
    mWarning->setIcon(QPixmap(qsIconFile + "/qview_Warning.png"));
    mWarning->setToolTip("Warning");
    mWarning->setVisible(false);
    mSBar->insertPermanentWidget(0, mWarning);
    connect(mWarning, SIGNAL(clicked()), mDialog, SLOT(show())); 
    mDialog->resize(800, 250);
    mTextEdit->setBaseSize(750, 200) ;
  }
WarningWidget :: WarningWidget ( QStatusBar * pParent ) : QObject ( pParent ) { mSBar = pParent ; QString sToolIconDir = FileName ( " " ) . expanded ( ) ; QString qsIconFile ( sToolIconDir ) ; mNoWarning = new QPushButton ( mSBar ) ; mNoWarning -> setFixedSize ( 22 , 22 ) ; mNoWarning -> setFlat ( true ) ; mNoWarning -> setIconSize ( QSize ( 15 , 15 ) ) ; mNoWarning -> setIcon ( QPixmap ( qsIconFile + " " ) ) ; mNoWarning -> setToolTip ( " " ) ; mNoWarning -> setVisible ( true ) ; mSBar -> insertPermanentWidget ( 0 , mNoWarning ) ; mSBar -> showMessage ( " " ) ; mMsgStr = QString ( " " ) ; mbWarningFlag = false ; mDialog = new QDialog ( mSBar ) ; mDialog -> setWindowTitle ( " " ) ; mDialog -> setSizeGripEnabled ( true ) ; mWindow = new QWidget ( mDialog ) ; mWindow -> installEventFilter ( this ) ; mTextEdit = new QTextEdit ( mDialog ) ; mTextEdit -> setReadOnly ( true ) ; QFont font ( " " , 11 ) ; mTextEdit -> setFont ( font ) ; QPushButton * okButton = new QPushButton ( " " , mDialog ) ; okButton -> setShortcut ( Qt :: Key_Enter ) ; connect ( okButton , SIGNAL ( clicked ( ) ) , this , SLOT ( resetWarning ( ) ) ) ; QGridLayout * layout = new QGridLayout ( ) ; layout -> addWidget ( mTextEdit , 0 , 0 , 1 , 3 ) ; layout -> addWidget ( okButton , 1 , 1 , 1 , 1 ) ; mDialog -> setLayout ( layout ) ; mWarning = new QPushButton ( mSBar ) ; mWarning -> setFixedSize ( 22 , 22 ) ; mWarning -> setFlat ( false ) ; mWarning -> setIconSize ( QSize ( 15 , 15 ) ) ; mWarning -> setIcon ( QPixmap ( qsIconFile + " " ) ) ; mWarning -> setToolTip ( " " ) ; mWarning -> setVisible ( false ) ; mSBar -> insertPermanentWidget ( 0 , mWarning ) ; connect ( mWarning , SIGNAL ( clicked ( ) ) , mDialog , SLOT ( show ( ) ) ) ; mDialog -> resize ( 800 , 250 ) ; mTextEdit -> setBaseSize ( 750 , 200 ) ; }
Warning widget constructor, initializes and creates the
 Nowarning, Warning objects and objects associated with them
Warning widget constructor initializes and creates the Nowarning Warning objects and objects associated with them
// default Action - No warning // Add Nowarning object to the layout of the active tool bar of the Tool // Warning is not set // Dialog box displayed when the Warning Icon is clicked //receive events directed to this object // OK button for the dialog window //when clicked close dialog and display Nowarning icon // Warning object // display the dialog window when this button is clicked