/***********************************************************************
**
**   task.h
**
**   This file is part of Cumulus.
**
************************************************************************
**
**   Copyright (c):  2002 by Heiner Lamprecht
**
**   This file is distributed under the terms of the General Public
**   Licence. See the file COPYING for more information.
**
**   $Id: taskdialog.h,v 1.1 2004/04/20 19:38:36 axel Exp $
**
***********************************************************************/

#ifndef TASK_H
#define TASK_H

#include <qlist.h>
#include <string.h>
#include <qlistview.h>
#include <qlineedit.h> 
#include <qdialog.h> 
#include <qlabel.h> 

#include "flighttask.h"
#include "wp.h"
#include "listviewfilter.h"

class TaskDialog : public QDialog
{
  Q_OBJECT

  public:
    /** */
    TaskDialog( QWidget* parent, const char* name, FlightTask* task=0 );
    /** */
    ~TaskDialog();

 protected:
    /** */
    virtual void accept();
    virtual void reject();

  signals:
    /** */
    void newTask( FlightTask* );
    /** */
    void editedTask( FlightTask* );

  private slots:
    /** */
    void slotAddWaypoint();
    /** */
    void slotRemoveWaypoint();
    /** */
    void slotMoveWaypointUp();
    /** */
    void slotMoveWaypointDown();
    /** */
    void slotInvertWaypoints();

  private:
    
    /** describes the current edit state of object */
    enum EditState { create, edit };

    /** */
    bool __readWaypointList(const QString& fileName);
    /** */
    void __showWPList();
    /** */
    void __showTask();
    /** */
    QListView* taskList;
    /** */
    QListView* waypointList;
    /** */
    QLineEdit* taskName;
    /** */
    ListViewFilter* filter;
    /** */
    QList<wayPoint> wpList;
    /** */
    QList<wayPoint> taskWPList;
    /** */
    FlightTask* planTask;
    /** Flag for indication of edit state */
    enum  EditState editState;
    /** Flag for indication of last selected item */
    int lastSelectedItem;
};

#endif // TASK_H
