

#ifndef WINDOW_H
#define WINDOW_H
#include <iostream>
#include <QWidget>
#include "countdown.h"
#include "triviaapp.h"
#include "question.h"
#include "singlechoice.h"

QT_BEGIN_NAMESPACE
class QComboBox;
class InformationDialog;
class QDialogButtonBox;
class QGridLayout;
class QGroupBox;
class QLabel;
class QPushButton;
class QLineEdit;
class QSound;
class ConnectDialog;
class Server;
class Client;

QT_END_NAMESPACE

class Window : public QWidget
{
    Q_OBJECT

public:
    Window(QWidget *parent = 0);


private:

    bool isFirst;
    QString pregunta;  //
    QLineEdit *answerLine;
    size_t arraySize;  //

    Countdown *time;

    TriviaApp *trivia;
    Question *question;
    SingleChoice *single;
    ConnectDialog * connectDialog;
    Client * client;
    Server * server;
    bool multiplayer;
    bool host;
    InformationDialog * informationDialog;

    QPushButton *continueButton;
    QPushButton *closeButton;
    QPushButton *checkButton;




    QDialogButtonBox *buttonBox;
    void createButtonBox(); ///////////////////////////////

    QDialogButtonBox *singleChoiceOptions;
    void createSingleChoiceOptions();  /////////////////////

    QGroupBox *answerLineGroup;
    void createAnswerLineGroup();  ////////////////////////

    QGroupBox *questAnswGroup;
    void createQuestAnswGroup();

    QGroupBox *timeScoreBox;
    void createTimeScoreBox();  ////////////////////////////

    QLabel *resultLabel;

    QGroupBox *introGroupPage;
    void createIntroGroupPage();

    QGridLayout *mainLayout;

    void getSelectedOption();   //////////////////////////
    void waitingUser(int port);



signals:
    void singlePlayerSignal();
    void multiplayerSignal();
    void newUserSignal();
    void selectQuestion(int index);

public slots:

    void getQuestion();
    void showQuestion(int index);
    void checkAnswers();
    void showStadistics();
    void createConnectDialog();
    void joinServer();
    void createServer();
    void multiplayerSelected();
    void decideMode(int i);
    void startPressed();
    void newUser();


};

#endif
