]> ruin.nu Git - hbs.git/blobdiff - bs/ui/bsappbase.ui.h
started to work on the battle report.. almost there =)
[hbs.git] / bs / ui / bsappbase.ui.h
index 4d70a19dde91d1c83cf471d0f84e9f694de94417..2f30bb96b58054bf5e6125bae7154eff18602106 100644 (file)
@@ -1,10 +1,11 @@
 /****************************************************************************
-** 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()
@@ -52,9 +53,14 @@ void BSAppBase::editCut()
 
 }
 
-void BSAppBase::editCopy()
+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);
 }
 
 void BSAppBase::editPaste()
@@ -80,4 +86,83 @@ void BSAppBase::helpContents()
 void BSAppBase::helpAbout()
 {
 
-}
\ No newline at end of file
+}
+
+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
+       {
+               // user entered nothing or pressed Cancel
+       }
+}
+
+void BSAppBase::battleSimulate()
+{
+       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());
+               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);
+}