Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

ViewModelDialog.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   SpikeStream Application                                               *
00003  *   Copyright (C) 2007 by David Gamez                                     *
00004  *   david@davidgamez.eu                                                   *
00005  *   Version 0.1                                                           *
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  *   This program is distributed in the hope that it will be useful,       *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU General Public License for more details.                          *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU General Public License     *
00018  *   along with this program; if not, write to the                         *
00019  *   Free Software Foundation, Inc.,                                       *
00020  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00021  ***************************************************************************/
00022 
00023 //SpikeStream includes
00024 #include "ViewModelDialog.h"
00025 #include "Debug.h"
00026 
00027 //Qt includes
00028 #include <qlayout.h>
00029 #include <qpushbutton.h>
00030 
00031 
00032 /*! Constructor. */
00033 ViewModelDialog::ViewModelDialog(QWidget* parent, QString* nwModelStr) : QDialog(parent) {
00034         //Store reference to network model string
00035         networkModelString = nwModelStr;
00036 
00037         //Create vertical layout to organise widget
00038         QVBoxLayout *mainVerticalBox = new QVBoxLayout(this, 5, 10, "vertical1");
00039 
00040 
00041         //Add text area to display model
00042         modelTextEdit = new QTextEdit(this);
00043         modelTextEdit->setTextFormat(Qt::PlainText);
00044         modelTextEdit->setText(*networkModelString);
00045         modelTextEdit->setReadOnly(true);
00046         mainVerticalBox->addWidget(modelTextEdit);
00047 
00048 
00049         //Set up ok and cancel buttons
00050         QHBoxLayout *buttonBox = new QHBoxLayout();
00051         QPushButton* okButton = new QPushButton("Ok", this, "okButton");
00052         QPushButton* cancelButton = new QPushButton("Cancel", this, "cancelButton");    
00053         buttonBox->addWidget(okButton);
00054         buttonBox->addWidget(cancelButton);
00055         mainVerticalBox->addLayout(buttonBox);
00056         
00057         connect (okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
00058         connect (cancelButton, SIGNAL(clicked()), this, SLOT(cancelButtonClicked()));
00059 
00060         //Set dialog size
00061         this->resize(600, 400);
00062 }
00063 
00064 
00065 /*! Destructor. */
00066 ViewModelDialog::~ViewModelDialog(){
00067         #ifdef MEMORY_DEBUG
00068                 cout<<"DESTROYING VIEW MODEL DIALOG"<<endl;
00069         #endif//MEMORY_DEBUG
00070 }
00071 
00072 
00073 //-----------------------------------------------------------------------------
00074 //----------------            PUBLIC METHODS            -----------------------
00075 //-----------------------------------------------------------------------------
00076 
00077 /*! Reloads the network model. */
00078 void ViewModelDialog::reloadText(){
00079         modelTextEdit->setText(*networkModelString);
00080 }
00081 
00082 
00083 //-----------------------------------------------------------------------------
00084 //----------------             PRIVATE SLOTS            -----------------------
00085 //-----------------------------------------------------------------------------
00086 
00087 /*! Hides the dialog when the cancel button is pressed. */
00088 void ViewModelDialog::cancelButtonClicked(){
00089         this->hide();
00090 }
00091 
00092 
00093 /*! Hides the dialog when the ok button is pressed. */
00094 void ViewModelDialog::okButtonClicked(){
00095         this->hide();
00096 }
00097 
00098 
00099 
00100 

Generated on Mon Sep 3 22:29:04 2007 for SpikeStream Application by  doxygen 1.4.4