#ifndef ButtonEditor_h
#define ButtonEditor_h

#include <QDialog>
#include "ui_ButtonEditor.h"

class OneButton;
class OneSample;
class AardMain;

// Implement dialog box for viewing and editing the samples for one button.
//
class ButtonEditor : public QDialog {

   Q_OBJECT

public:

   ButtonEditor(QAction * init_record_action,
                AardMain * parent = 0,
                Qt::WindowFlags f = 0);

   virtual
   ~ButtonEditor();

   void
   doEditButton(OneButton * the_button);

   void
   doNewSample();

   bool
   DrawDiffGraph() {
         return draw_diff_graph;
      }

   OneButton *
   CurrentButton() {
         return current_button;
      }

private slots:

   void
   doFinish(bool checked);

   void
   doZoomIn(bool checked);

   void
   doZoomOut(bool checked);

   void
   doDeleteSample(bool checked);

   void
   doRecordToggle(int state);

   void
   doRecordActionChanged(bool checked);

   void
   doDrawGraphs();

   void
   doGraphDiffChanged(int state);

   void
   doSend();

private:

   void
   DrawSample(unsigned int row_number, OneSample * sample);

   void
   ScheduleDrawGraphs();

   Ui::ButtonEditor ui;

   OneButton * current_button;

   QAction   * record_action;

   AardMain  * my_main;

   bool        first_paint;

   bool        must_draw_graphs;

   bool        draw_diff_graph;
};

#endif // ButtonEditor_h
