wm: mastermind-qt

Download patch

ref: 6956319c5ed5b309a4793e49822049e1c9937531
parent: 4c114d13e643923c5c74a88aafaf882d63987464
author: mkf <mkf@hp.lan>
date: Thu Apr 27 06:43:06 EDT 2023

more minor fixes, change random() to rand()

--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -20,7 +20,7 @@
     /* it's technically legal, but
     we get a int that's shorter than n */
     do
-        num = random() % 10;
+        num = rand() % 10;
     while (num == 0);
 
     /* we have already generated one digit */
@@ -27,7 +27,7 @@
     while(n > 1)
     {
         num *= 10;
-        num += random() % 10;
+        num += rand() % 10;
         n--;
     }
     return num;
@@ -169,20 +169,6 @@
     /* you pressed cancel "by mistake" ? too bad! your fault. */
     return res;
 }
-void MainWindow::action_giveup()
-{
-    QMessageBox m;
-    QAbstractButton *y;
-    m.setText("B-but... are you really totally completely 100% sure about it?");
-    m.setIcon(QMessageBox::Question);
-    y = m.addButton("Yea", QMessageBox::AcceptRole);
-    m.addButton("Nay!", QMessageBox::RejectRole);
-    m.exec();
-    if(m.clickedButton() == y)
-    {
-            action_newgame();
-    }
-}
 
 // main window
 void MainWindow::action_guess()
@@ -201,7 +187,7 @@
 
        QMessageBox m;
        m.setWindowTitle("YOU WIN!");
-       m.setText("I am pleasedto assure you, that; you have managed to win.");
+       m.setText("I am pleased to assure you, that; you have managed to win.");
        m.setIcon(QMessageBox::Information);
        m.addButton("indeed", QMessageBox::AcceptRole);
        m.exec();
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -203,7 +203,6 @@
      <string>File</string>
     </property>
     <addaction name="actionNew_game"/>
-    <addaction name="actionGiveup"/>
     <addaction name="separator"/>
     <addaction name="actionQuit"/>
    </widget>
@@ -243,11 +242,6 @@
     <string>New game</string>
    </property>
   </action>
-  <action name="actionGiveup">
-   <property name="text">
-    <string>Giveup</string>
-   </property>
-  </action>
   <action name="actionQuit">
    <property name="text">
     <string>Quit</string>
@@ -382,22 +376,6 @@
    <signal>triggered()</signal>
    <receiver>MainWindow</receiver>
    <slot>action_newgame()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>-1</x>
-     <y>-1</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>247</x>
-     <y>187</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>actionGiveup</sender>
-   <signal>triggered()</signal>
-   <receiver>MainWindow</receiver>
-   <slot>action_giveup()</slot>
    <hints>
     <hint type="sourcelabel">
      <x>-1</x>