/****************************************************************************
-** ui.h extension file, included from the uic-generated form implementation.
-**
-** If you wish to add, delete or rename slots use Qt Designer which will
-** update this file, preserving your code. Create an init() slot in place of
-** a constructor, and a destroy() slot in place of a destructor.
-*****************************************************************************/
+ ** ui.h extension file, included from the uic-generated form implementation.
+ **
+ ** If you wish to add, delete or rename slots use Qt Designer which will
+ ** update this file, preserving your code. Create an init() slot in place of
+ ** a constructor, and a destroy() slot in place of a destructor.
+ *****************************************************************************/
+
-
void BSAppBase::fileNew()
{
void BSAppBase::init()
{
- conf = new BSConf();
- doc = new BSDoc();
- view = new BSView(this,doc);
- connect(this, SIGNAL(ticksChanged(int, int) ), view, SLOT(slotTickChanged(int, int)));
- connect(this, SIGNAL(resultModeChanged(int) ), view, SLOT(slotResultModeChanged(int)));
- setCentralWidget(view);
+ conf = new BSConf();
+ doc = new BSDoc();
+ view = new BSView(this,doc);
+ connect(this, SIGNAL(ticksChanged(int, int) ), view, SLOT(slotTickChanged(int, int)));
+ connect(this, SIGNAL(resultModeChanged(int) ), view, SLOT(slotResultModeChanged(int)));
+ setCentralWidget(view);
}
void BSAppBase::editPaste()
void BSAppBase::battleNew()
{
- bool ok = FALSE;
- QString text = QInputDialog::getText(
- tr( "Harvalen's Battlesystem" ),
- tr( "Please enter the name of the battle (for example coords)" ),
- QLineEdit::Normal, QString::null, &ok, this );
- if ( ok && !text.isEmpty() )
- doc->newBattle(text);
- else
+ bool ok = FALSE;
+ QString text = QInputDialog::getText(
+ tr( "Harvalen's Battlesystem" ),
+ tr( "Please enter the name of the battle (for example coords)" ),
+ QLineEdit::Normal, QString::null, &ok, this );
+ if ( ok && !text.isEmpty() )
+ doc->newBattle(text);
+ else
{
- // user entered nothing or pressed Cancel
+ // user entered nothing or pressed Cancel
}
}
void BSAppBase::battleSimulate()
{
- QApplication::setOverrideCursor( Qt::WaitCursor );
-
- doc->runBattleSimulation();
- QApplication::restoreOverrideCursor();
+ QApplication::setOverrideCursor( Qt::WaitCursor );
+
+ doc->runBattleSimulation();
+ view->slotGenerateReport();
+ QApplication::restoreOverrideCursor();
}
void BSAppBase::oneTickCheck_toggled( bool b)
{
- if(b)
- {
- maxTickSpin->setMinValue(0);
- minTickSpin->setDisabled(true);
- minTickSpin->setMaxValue(99);
- emit ticksChanged( maxTickSpin->value() - 1, maxTickSpin->value());
- }
- else
- {
- minTickSpin->setEnabled(true);
- minTickSpin->setMaxValue( maxTickSpin->value());
- if (minTickSpin->value() < maxTickSpin->value())
- maxTickSpin->setMinValue( minTickSpin->value());
+ if(b)
+ {
+ maxTickSpin->setMinValue(0);
+ minTickSpin->setDisabled(true);
+ minTickSpin->setMaxValue(99);
+ emit ticksChanged( maxTickSpin->value() - 1, maxTickSpin->value());
+ }
else
{
- maxTickSpin->setMinValue( maxTickSpin->value());
- minTickSpin->setValue(maxTickSpin->value());
+ minTickSpin->setEnabled(true);
+ minTickSpin->setMaxValue( maxTickSpin->value());
+ if (minTickSpin->value() < maxTickSpin->value())
+ maxTickSpin->setMinValue( minTickSpin->value());
+ else
+ {
+ maxTickSpin->setMinValue( maxTickSpin->value());
+ minTickSpin->setValue(maxTickSpin->value());
+ }
+ emit ticksChanged( minTickSpin->value(), maxTickSpin->value());
}
- emit ticksChanged( minTickSpin->value(), maxTickSpin->value());
- }
}
void BSAppBase::minTickSpin_valueChanged( int i )
{
- if ( !oneTickCheck->isChecked())
- maxTickSpin->setMinValue(i);
+ if ( !oneTickCheck->isChecked())
+ maxTickSpin->setMinValue(i);
}
void BSAppBase::maxTickSpin_valueChanged( int i )
{
- if ( !oneTickCheck->isChecked())
- minTickSpin->setMaxValue(i);
+ if ( !oneTickCheck->isChecked())
+ minTickSpin->setMaxValue(i);
}
void BSAppBase::slotTicksChanged( int i )
{
- if ( oneTickCheck->isChecked())
- {
- maxTickSpin->setValue(i);
- //minTickSpin->setValue(i-1);
- emit ticksChanged( maxTickSpin->value() - 1, maxTickSpin->value());
- return;
- }
- emit ticksChanged( minTickSpin->value(), maxTickSpin->value());
+ if ( oneTickCheck->isChecked())
+ {
+ maxTickSpin->setValue(i);
+ //minTickSpin->setValue(i-1);
+ emit ticksChanged( maxTickSpin->value() - 1, maxTickSpin->value());
+ return;
+ }
+ emit ticksChanged( minTickSpin->value(), maxTickSpin->value());
}
void BSAppBase::resultModeCombo_activated( int i )
{
- emit resultModeChanged(i);
+ emit resultModeChanged(i);
}