1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QToolBar>
#include <QAction>
#include <QKeyEvent>
#include <QMap>
#include <QSettings>
#include <QMediaPlayer>
#include <QStatusBar>
#include <QLabel>
#include <QTranslator>
#include <QMovie>
#include "Collection.h"
namespace Ui {
class MainWindow;
}
enum TYPE_GAME {
TYPE_ABC,
TYPE_RAND,
TYPE_FOOD,
TYPE_ANIMALS,
TYPE_INSTRUMENT,
TYPE_TOYS
};
struct LETTER_INFO {
QString letter;
QString sound_letter;
QString speak_method;
QString espeak_params;
QString espeak_words;
};
class MainWindow : public QMainWindow {
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
private:
void initGUI();
void initToolBar();
void initLanguageAbc();
void refreshTranslate();
void loadAbcConfig(QString abcFilename);
bool loadAbcConfigJson(QString filename);
bool loadAbcConfigProperties(QString filename);
QString typeGameToString(TYPE_GAME type);
void setAbcLang(QString lang, QString filename);
void readLetterVariants();
void refreshViewer();
void setLetterAndText(QString letter, QString text);
void setPixmapViewer(QPixmap pixmap);
void setPixmapViewer(QString filename);
void normalPixmapViewer();
void updateletterToList(QString folder_lang, LETTER_INFO letter);
void playSoundLetter(QString letter, bool async=false);
bool isKeypressLetter(QString letter,QString key);
bool isExistSox();
bool isExistEspeak();
// for random type of game
int gameRandomGenerateNextIndex();
QString globalPathUserResources;
QStatusBar *statusbar;
QToolBar *toolBar;
QLabel *lblAbcPicture;
QMovie *moviePicture;
QLabel *lblAbcLetter;
QLabel *lblAbcText;
QLabel *blockForm;
QActionGroup *typeGameGroup;
QAction *accGameAbc;
QAction *accGameRand;
QAction *accGameAnimals;
QAction *accGameFood;
QAction *accGameInstrument;
QAction *accGameToys;
QAction *accAlphabetTable;
QAction *accSound;
QAction *accLang;
QAction *accTyping;
QAction *accHelp;
QAction *accInfo;
QAction *accExit;
TYPE_GAME typeGame;
int currentIndexLetter;
QString currentLanguageAbc;
QString currentFilenameAbc;
QMap<QString,QVector<QString>> listLetterVariants;
QSettings *confSettings;
bool soundStatus;
QMediaPlayer soundEffect;
bool blockButtonTyping;
bool gameAbcFinish;
// for random type of game
int gameRandomCurrentIndex;
QVector<LETTER_CONFIG> listLettersGameRand;
QString _speak_method;
QString _espeak_params;
QString _view_letters;
bool _disable_additional_keys;
QString _lastFormatLoaded;
QVector<LETTER_INFO> listLetters;
QStringList listTypes;
QMap<QString,Collection*> listCollections;
QTranslator translator;
QTranslator qtTranslator;
QMap<QWidget*,QMap<QString,QString>> listWidgetsRetranslateUi;
QMap<QAction*,QMap<QString,QString>> listActionsRetranslateUi;
private:
bool eventFilter(QObject *obj, QEvent *event);
protected:
virtual void keyPressEvent(QKeyEvent *event);
private slots:
void clickButtonGameAbc();
void clickButtonGameRand();
void clickButtonGameAnimals();
void clickButtonGameFood();
void clickButtonGameInstrument();
void clickButtonGameToys();
void clickButtonSound();
void clickButtonTyping();
void clickButtonAlphabetTable();
void clickButtonLang();
void clickButtonHelp();
void clickButtonInfo();
};
#endif // MAINWINDOW_H
|