00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "modeeditdlg.h"
00015 #include "ui_modeeditwidget.h"
00016
00017 #include <qlayout.h>
00018 #include <qlineedit.h>
00019 #include <qspinbox.h>
00020 #include <qpushbutton.h>
00021
00022 ModeEditDlg::ModeEditDlg( QString & _modeName, int & _zoom,
00023 QWidget * parent, const QString & title )
00024 : QDialog( parent, NULL , TRUE ), modeName( _modeName ),
00025 zoom ( _zoom )
00026 {
00027 uiWidget = new UI_ModeEditWidget( this );
00028 setCaption( title );
00029 QBoxLayout * l = new QVBoxLayout( this );
00030 l->addWidget( uiWidget );
00031 connect( uiWidget->buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
00032 connect( uiWidget->buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
00033
00034 int min = 1;
00035 int max = 1000;
00036
00037 uiWidget->spinBoxZoom->setRange( min, max );
00038
00039 uiWidget->lineEditName->setText( modeName );
00040 uiWidget->spinBoxZoom->setValue( zoom );
00041 }
00042
00043 void ModeEditDlg::accept()
00044 {
00045 QString nameGiven = uiWidget->lineEditName->text();
00046 if ( nameGiven.isEmpty() )
00047 { return;
00048 }
00049 else
00050 {
00051 zoom = uiWidget->spinBoxZoom->value();
00052 modeName = nameGiven;
00053 QDialog::accept();
00054 }
00055 }
00056
00057
00058 ModeEditDlg::~ModeEditDlg()
00059 {
00060 }