#ifndef MainWindow_H
#define MainWindow_H

#include "ui_mainwindow.h"


#include <QMainWindow>
#include <QComboBox>
#include <QPushButton>
#include <QApplication>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow {
    Q_OBJECT

private:
    explicit MainWindow(QMainWindow *parent = 0);
    ~MainWindow();

public:
    static MainWindow* getInstance() {
        static MainWindow instance;
        return &instance;
    }

    bool eventFilter(QObject *obj, QEvent *event);
    void setState(QString state);
    void applyShadow(QWidget *obj, QString color, int blur, int offset_x, int offset_y);
    void myDialogBox(QString text, QString info, QString okText, QString cancelText, QString image,
                   QString okAnswer, QString cancelAnswer, int w, int h, bool textshadow, bool is_cancel);
    void addComboItem(QComboBox* combo, QString itemName, QIcon* icon);
    void saveLocale(int locale, QPushButton *button);

private slots:
    void minimize();
    void saveSkin();

    void on_mainButton_clicked();
    void on_optButton_clicked();
    void on_newsButton_clicked();
    void on_helpButton_clicked();
    void on_aboutButton_clicked();
    void on_minimizeButton_clicked();
    void on_closeButton_clicked();

    void on_checkFonts_stateChanged(int arg1);
    void on_checkTexts_stateChanged(int arg1);
    void on_checkSounds_stateChanged(int arg1);
    void on_checkMaps_stateChanged(int arg1);
    void on_checkScreens_stateChanged(int arg1);
    void on_checkVideos_stateChanged(int arg1);
    void on_checkMicro_stateChanged(int arg1);

    void on_lotropathButton_clicked();
    void on_okButton_clicked();
    void on_couponButton_clicked();
    void on_cancelButton_clicked();
    void on_enButton_clicked();
    void on_deButton_clicked();
    void on_frButton_clicked();
    void on_enterButton_clicked();
    void on_goCancel_clicked();
    void on_goOriginal_clicked();
    void on_goLocal_clicked();
    void on_repairButton_clicked();
    void on_designButton_clicked();

protected:
    void mouseMoveEvent( QMouseEvent* e );
    void mousePressEvent( QMouseEvent* e );
    void mouseReleaseEvent( QMouseEvent* e );
    void closeEvent( QCloseEvent * e );

public:
    void checkTab(QString tabname);

    void loadConfig();
    void loadNews();
    void loadHelp();
    void setAbout();

    void hideAll();

public:
    QMap <QString, QString> htmlColors;
    QString stylehtml;
    Ui::MainWindow *ui;

private:
    QString hint = "";
    QString exthint = "";
    int dx;
    int dy;
    QString state;
    QString app_folder;
};

#endif // MainWindow_H
