1 /*
2  *   This file is part of Auralquiz
3  *   Copyright 2011-2017  JanKusanagi JRR <jancoding@gmx.com>
4  *
5  *   This program is free software; you can redistribute it and/or modify
6  *   it under the terms of the GNU General Public License as published by
7  *   the Free Software Foundation; either version 2 of the License, or
8  *   (at your option) any later version.
9  *
10  *   This program is distributed in the hope that it will be useful,
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *   GNU General Public License for more details.
14  *
15  *   You should have received a copy of the GNU General Public License
16  *   along with this program; if not, write to the
17  *   Free Software Foundation, Inc.,
18  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .
19  */
20 
21 #ifndef OPTIONSDIALOG_H
22 #define OPTIONSDIALOG_H
23 
24 #include <QWidget>
25 #include <QString>
26 #include <QHBoxLayout>
27 #include <QVBoxLayout>
28 #include <QLabel>
29 #include <QPushButton>
30 #include <QSpinBox>
31 #include <QSlider>
32 #include <QCheckBox>
33 #include <QStringList>
34 #include <QLineEdit>
35 #include <QGroupBox>
36 #include <QFileDialog>
37 #include <QSettings>
38 #include <QDesktopServices>
39 #include <QShowEvent>
40 #include <QCloseEvent>
41 #include <QAction>
42 
43 #include <QDebug>
44 
45 class OptionsDialog : public QWidget
46 {
47     Q_OBJECT
48 
49 public:
50     OptionsDialog(QWidget *parent = 0);
51     ~OptionsDialog();
52 
53 protected:
54     void showEvent(QShowEvent *);
55     void closeEvent(QCloseEvent *);
56 
57 public slots:
58     void selectMusicDirectory();
59     void setDifficultyEasier();
60     void setDifficultyHarder();
61     void updateDifficultyName(int newValue);
62     void saveOptions();
63     void saveAndReload();
64 
65     void showConfigMode();
66     void showPlayMode();
67 
68 signals:
69     void optionsChanged(bool startGame, QString directory, bool forceReload,
70                         int difficulty, int questions, int players,
71                         QStringList playerNameList, bool ownColors);
72 
73 private:
74     QVBoxLayout *mainLayout;
75     QHBoxLayout *topLayout;
76     QHBoxLayout *middleLayout;
77     QVBoxLayout *difficultyLayout;
78     QHBoxLayout *difficultyTopLayout;
79     QGridLayout *rightSideLayout;
80     QGridLayout *playerNamesLayout;
81     QHBoxLayout *bottomLayout;
82 
83     QLabel *musicFromLabel;
84     QLabel *currentMusicDirectoryLabel;
85     QPushButton *selectMusicDirectoryButton;
86     QPushButton *reloadMusicInfoButton;
87 
88     QPushButton *difficultyEasy;
89     QSlider *difficultyLevel;
90     QPushButton *difficultyHard;
91     QLabel *difficultyName;
92 
93     QLabel *numQuestionsLabel;
94     QSpinBox *numQuestions;
95     QLabel *numPlayersLabel;
96     QSpinBox *numPlayers;
97 
98     QStringList playerNames;
99 
100     QGroupBox *playerNamesGroup;
101     QLabel *player1Number;
102     QLabel *player2Number;
103     QLabel *player3Number;
104     QLabel *player4Number;
105     QLabel *player5Number;
106     QLabel *player6Number;
107     QLabel *player7Number;
108     QLabel *player8Number;
109     QLineEdit *player1Name;
110     QLineEdit *player2Name;
111     QLineEdit *player3Name;
112     QLineEdit *player4Name;
113     QLineEdit *player5Name;
114     QLineEdit *player6Name;
115     QLineEdit *player7Name;
116     QLineEdit *player8Name;
117 
118     QCheckBox *useOwnColors;
119 
120 
121     QPushButton *saveButton;
122     QPushButton *cancelButton;
123 
124     QAction *startAction;
125     QAction *closeAction;
126 
127     QString musicDirectory;
128     bool reload;
129 
130     bool playMode;
131 };
132 
133 
134 #endif // OPTIONSDIALOG_H
135