e ()
{(! edit- gt; text (). isEmpty ())
{= edit- gt; text (); PNSignal ();
} QMessageBox :: warning (this, Увага! raquo ;, Ви не ввели ім'я! );
}
:: ~ PutName ()
{
}
Файл Selectionships.h
# ifndef SELECTIONSHIPS_H
# define SELECTIONSHIPS_H
# include lt; QtGui gt;
SelectionShips: public QWidget
{_ OBJECT: ();
~ SelectionShips ();
* fourBtn; * threeBtn; * twoBtn; * oneBtn;
* start;
* fourEdit; * threeEdit; * twoEdit; * oneEdit;
* layout;
linkage ();
};
# endif//SELECTIONSHIPS_H
Файл Selectionships.cpp
# include selectionships.h
:: SelectionShips ()
{= new QPushButton (tr ( 4 палуби ));=new QPushButton (tr ( 3 палуби ));=new QPushButton (tr ( 2 палуби )) ;=new QPushButton (tr ( 1 палуба ));=new QPushButton (tr ( Старт ));=new QLineEdit ();=new QLineEdit ();=new QLineEdit ();=new QLineEdit ( );=new QGridLayout ();
();
}
SelectionShips :: linkage ()
{ gt; setText ( 1 ); gt; setFixedWidth (30); gt; setReadOnly (true);
gt; setText ( 2 ); gt; setFixedWidth (30); gt; setReadOnly (true);
gt; setText ( 3 ); gt; setFixedWidth (30); gt; setReadOnly (true);
gt; setText ( 4 ); gt; setFixedWidth (30); gt; setReadOnly (true);
gt;setFixedWidth(90);gt;setFixedWidth(90);gt;setFixedWidth(90);gt;setFixedWidth(90);gt;setFixedWidth(50);
gt; addWidget (fourBtn, 1, 0, Qt :: AlignLeft); gt; addWidget (fourEdit, 1, 1); gt; addWidget (threeBtn, 2, 0, Qt :: AlignLeft) ; gt; addWidget (threeEdit, 2, 1); gt; addWidget (twoBtn, 3, 0, Qt :: AlignLeft); gt; addWidget (twoEdit, 3, 1); gt; addWidget (oneBtn, 4, 0, Qt :: AlignLeft); gt; addWidget (oneEdit, 4, 1); gt; addWidget (start, 5, 0, Qt :: AlignRight);
gt; setLayout (layout);
}
:: ~ SelectionShips ()
{
}
Файл selectmode.h
# ifndef SELECTMODE_H
# define SELECTMODE_H
# include lt; QDialog gt;
# include lt; QtGui gt;
SelectMode: public QDialog
{_ OBJECT: ();
~ SelectMode ();
* label; * man; * computer; * button; * layout;
: SMSignal (); slots: newGame ();
: output ();
};
# endif//SELECTMODE_H
Файл selectmode.cpp
# include selectmode.h
:: SelectMode ()
{= new QLabel ( Виберіть режим гри );=new QRadioButton (tr ( Гра з людиною ));=new QRadioButton (tr ( Гра з комп'ютером )) ;=new QPushButton (tr ( OK ));=new QVBoxLayout; (); :: connect (button, SIGNAL (clicked ()), this, SLOT (newGame ()));
}
SelectMode :: output ()
{gt;addWidget(label);gt;addWidget(man);gt;addWidget(computer);gt;addWidget(button);(layout);
}
SelectMode :: newGame ()
{(man- gt; isChecked () || computer- gt; isChecked ())
{SMSignal (); gt; close ();
} :: warning (NULL, Warring raquo ;, tr ( Ви не обрали режим гри! ));
}
:: ~ SelectMode ()
{
}
Файл ships.h
# ifndef SHIPS_H
# define SHIPS_H
# include lt; QObject gt;
Ships: public QObject
{: ();
~ Ships ();
amountDeck; ** location;
void checkKilled (int array [10] [10]);
};
# endif//SHIPS_H
Файл ships.cpp
# include shi...