File indexing completed on 2024-10-13 03:43:39
0001 /* 0002 SPDX-FileCopyrightText: 2003 Ian Wadham <iandw.au@gmail.com> 0003 SPDX-FileCopyrightText: 2009 Ian Wadham <iandw.au@gmail.com> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef KGRDIALOG_QT_H 0009 #define KGRDIALOG_QT_H 0010 0011 #include <QDialog> 0012 #include <QList> 0013 #include <QLineEdit> 0014 #include <QListWidget> 0015 #include <QRadioButton> 0016 #include <QTextEdit> 0017 0018 0019 class QButtonGroup; 0020 class QLabel; 0021 0022 /** 0023 @author Ian Wadham and Marco Krüger 0024 */ 0025 0026 class KGrGameData; 0027 0028 /******************************************************************************* 0029 *************** DIALOG BOX TO CREATE/EDIT A LEVEL NAME AND HINT **************** 0030 *******************************************************************************/ 0031 0032 class KGrNHDialog : public QDialog 0033 { 0034 Q_OBJECT 0035 public: 0036 KGrNHDialog (const QString & levelName, const QString & levelHint, 0037 QWidget * parent = nullptr); 0038 ~KGrNHDialog() override; 0039 0040 const QString getName() {return (nhName->text());} 0041 const QString getHint() {return (mle->toPlainText());} 0042 0043 private: 0044 QLineEdit * nhName; 0045 QTextEdit * mle; 0046 }; 0047 0048 /******************************************************************************* 0049 ***************** DIALOG TO CREATE OR EDIT A GAME (COLLECTION) ***************** 0050 *******************************************************************************/ 0051 0052 class KGrECDialog : public QDialog 0053 { 0054 Q_OBJECT 0055 public: 0056 KGrECDialog (int action, int collnIndex, 0057 QList<KGrGameData *> & gameList, 0058 QWidget *parent = nullptr); 0059 ~KGrECDialog() override; 0060 0061 const QString getName() {return (ecName->text());} 0062 const QString getPrefix() {return (ecPrefix->text());} 0063 bool isTrad() {return (ecTradB->isChecked());} 0064 const QString getAboutText() {return (mle->toPlainText());} 0065 0066 private Q_SLOTS: 0067 void ecSetRules (const char rules); 0068 void ecSetKGr(); // Radio button slots. 0069 void ecSetTrad(); 0070 0071 private: 0072 QList<KGrGameData *> myGameList; // List of existing games. 0073 int defaultGame; 0074 0075 QLabel * nameL; 0076 QLineEdit * ecName; 0077 QLabel * prefixL; 0078 QLineEdit * ecPrefix; 0079 QButtonGroup * ecGrp; 0080 QRadioButton * ecKGrB; 0081 QRadioButton * ecTradB; 0082 QLabel * nLevL; 0083 0084 QLabel * mleL; 0085 QTextEdit * mle; 0086 }; 0087 0088 /******************************************************************************* 0089 *************** DIALOG TO SELECT A SAVED GAME TO BE RE-LOADED **************** 0090 *******************************************************************************/ 0091 0092 class QFile; 0093 0094 class KGrLGDialog : public QDialog 0095 { 0096 Q_OBJECT 0097 public: 0098 KGrLGDialog (QFile * savedGames, QList<KGrGameData *> & gameList, 0099 QWidget * parent); 0100 const QString getCurrentText() {return (lgList->currentItem()->text());} 0101 0102 private Q_SLOTS: 0103 void lgSelect (QListWidgetItem * item); 0104 0105 private: 0106 QListWidget * lgList; 0107 int lgHighlight; 0108 }; 0109 0110 #endif