#ifndef COMMAND_H
#define COMMAND_H

#include <QEvent>
#include <QVariant>

#define COMMAND_QUIT              1
#define COMMAND_CLOSE             2
#define COMMAND_CREATE            3
#define COMMAND_SET_URL           4
#define COMMAND_SET_HTML          5
#define COMMAND_RUN_JS            6
#define COMMAND_DEV_TOOLS         7
#define COMMAND_MOVE              8
#define COMMAND_RESIZE            9
#define COMMAND_CALL_JS          10
#define COMMAND_HIDE_WIN         11
#define COMMAND_SHOW_WIN         12
#define COMMAND_MAX_WIN          13
#define COMMAND_MIN_WIN          14
#define COMMAND_PRESENT_WIN      15
#define COMMAND_SHOW_NORMAL_WIN  16
#define COMMAND_WINDOW_STATUS    17
#define COMMAND_SET_TITLE        18
#define COMMAND_CHOOSE_DIR       19
#define COMMAND_FILE_OPEN        20
#define COMMAND_FILE_SAVE        21
#define COMMAND_SET_OU_TOKEN     22
#define COMMAND_NEW_CONTEXT      23
#define COMMAND_MESSAGE          24
#define COMMAND_SET_ICON         25
#define COMMAND_CREATE_TRAY      26
#define COMMAND_TRAY_SET_ICON    27
#define COMMAND_TRAY_SET_TOOLTIP 28
#define COMMAND_TRAY_SHOW_MESSAGE 29
#define COMMAND_TRAY_SET_MENU    30

class Command
{
public:
    int cmd;
    QVector<QVariant> args;
    QVariant result;
    bool done;
    bool js_result_ok;
public:
    Command(int _cmd);
};


class CommandEvent : public QEvent
{
private:
    Command *_cmd;

public:
    Command *cmd();

public:
    CommandEvent(Command *c);
};


const QEvent::Type COMMAND_EVENT = static_cast<QEvent::Type>(QEvent::User + 1);

#endif // COMMAND_H
