X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=bs%2Fui%2Fbsappbase.ui.h;h=305a4cabf25fa09d254db056f4a30d7c07c20bf6;hb=6ab17155b82923f4263f1c536133e657970239a4;hp=e7257447f284070aea24529ba78c00b8e8f2ed8f;hpb=e07f49323a1936c90605d06f6f63e4c39b4c4aca;p=hbs.git diff --git a/bs/ui/bsappbase.ui.h b/bs/ui/bsappbase.ui.h index e725744..305a4ca 100644 --- a/bs/ui/bsappbase.ui.h +++ b/bs/ui/bsappbase.ui.h @@ -1,12 +1,12 @@ /**************************************************************************** -** 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() { @@ -55,9 +55,12 @@ void BSAppBase::editCut() void BSAppBase::init() { - doc = new BSDoc(); - view = new BSView(this,doc); - 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() @@ -87,15 +90,78 @@ void BSAppBase::helpAbout() 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 } -} \ No newline at end of file +} + +void BSAppBase::battleSimulate() +{ + QApplication::setOverrideCursor( Qt::WaitCursor ); + + doc->runBattleSimulation(); + 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()); + else + { + maxTickSpin->setMinValue( maxTickSpin->value()); + minTickSpin->setValue(maxTickSpin->value()); + } + emit ticksChanged( minTickSpin->value(), maxTickSpin->value()); + } +} + +void BSAppBase::minTickSpin_valueChanged( int i ) +{ + if ( !oneTickCheck->isChecked()) + maxTickSpin->setMinValue(i); +} + +void BSAppBase::maxTickSpin_valueChanged( int 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()); +} + + + +void BSAppBase::resultModeCombo_activated( int i ) +{ + emit resultModeChanged(i); +}