#ifndef MCSMAINWIDGET_H
#define MCSMAINWIDGET_H

#include <QWidget>

class QMainWindow;
namespace ads
{
class CDockManager;
class CDockWidget;
}
#include "ads_workbench.h"

namespace Ui {
class McsMainWidget;
}

class McsMainWidget : public QWidget
{
    Q_OBJECT

public:
    explicit McsMainWidget(ads::CDockManager* dockManager, QMainWindow *parent = 0);
    ~McsMainWidget();


  QObject* adsDataManager();

public slots:
  void updateDefaultFile(const QString&);

  void updateBusState(bool err, bool bc_run, bool mon_run);

  void updateComStatus(Ads1553Manager::com_sts_t);

  bool close();

  void cursorGoto(int x, int y, unsigned int flags);

signals:
  void adsDockCreated(ads::CDockWidget* w, const QString& groupName);
  void appMenuCreated(QMenu*);
  void appReady();

private slots:
  void on_actionMonitorStatus_triggered();
  //void on_actionGUI_Style_triggered();
  void on_actionDump_Ads_Action_triggered();
  void on_actionDump_Ads_Data_triggered();
  void postInit();
  void postInit2();

  //Menu Action
  void on_actionShow_monitor_triggered();
  void on_actionBusRun_triggered(bool);
  void on_actionBusMonitor_triggered(bool );
  void on_actionBusMonitor_changed();
  void on_actionBusOneFrame_triggered(bool checked);
  void on_actionBusStop_toggled(bool checked);

  void on_rawShowHex_stateChanged(int);
  void _onMessageListChanged();
  void _onRawMessageSlection_changed(int);

  void _onRunStatusChanged(Ads1553Manager::run_sts_t);


  void on_actionQT_Properties_triggered();

  void showConan();

  void on_actionLoad_triggered();
  void on_actionReload_default_triggered();
  void on_actionSave_triggered();
  void on_actionSave_As_triggered();

  void saveSettings();
  bool restoreSettings();

  void on_actionVCR_Rec_triggered(bool checked);

private:
    Ui::McsMainWidget *ui;

    class Private;
    Private& p_;

    void addDataWidget(QWidget*, int wnum);

    void closeEvent(QCloseEvent */*evn*/);
};


#if 0
class McsMainWidget : public QWidget
{
  Q_OBJECT
  Q_PROPERTY(QMenu* scriptMenu READ scriptMenu)
public:
  explicit McsMainWindow(QMainWindow* hostWin=0); //QWidget *parent = 0);
  ~McsMainWindow();

public slots:
  void setStyleByName(const QString& style_name);
  void showScriptDebugger();
  void evalScript();
  void loadScript();

  void includeScript(const QString& name);
  void importExtension(const QString& name);

  QMenu* scriptMenu() const
  {
    return mScriptMenu;
  }
  void updateDefaultFile(const QString&);

  void updateBusState(bool err, bool bc_run, bool mon_run);

  void updateComStatus(Ads1553Manager::com_sts_t);

  bool close();

  void cursorGoto(int x, int y, unsigned int flags);

private slots:
  void selectStyle();
  void on_actionMonitorStatus_triggered();
  //void on_actionGUI_Style_triggered();
  void on_actionDump_Ads_Action_triggered();
  void on_actionDump_Ads_Data_triggered();
  void postInit();
  void postInit2();

  //Menu Action
  void on_actionShow_monitor_triggered();
  void on_actionQT_Dump_Resources_triggered();
  void on_actionQT_Dump_Objects_triggered();

  void on_actionBusRun_triggered(bool);
  void on_actionBusMonitor_triggered(bool );
  void on_actionBusMonitor_changed();
  void on_actionBusOneFrame_triggered(bool checked);
  void on_actionBusStop_toggled(bool checked);

  void on_rawShowHex_stateChanged(int);
  void _onMessageListChanged();
  void _onRawMessageSlection_changed(int);

  void _onRunStatusChanged(Ads1553Manager::run_sts_t);


  void on_actionQT_Properties_triggered();

  void showConan();

  void on_actionLoad_triggered();
  void on_actionReload_default_triggered();
  void on_actionSave_triggered();
  void on_actionSave_As_triggered();

private:

private:
  Ui::McsMainWindow *ui;

  bool event(QEvent *evn);

  void closeEvent(QCloseEvent *evn);
  void keyPressEvent(QKeyEvent*);
  void keyReleaseEvent(QKeyEvent*);
  void mouseMoveEvent(QMouseEvent*);
  void mousePressEvent( QMouseEvent*);
  void mouseReleaseEvent( QMouseEvent*);
  void wheelEvent(QWheelEvent *);

  void saveSettings();
  bool restoreSettings();

  QMenu* mScriptMenu;

  class Private;
  Private& p_;

  void addDataWidget(QWidget*, int wnum);

  friend class Private;

};
#endif

#endif // MCSMAINWIDGET_H
