/***************************************************************************
 *   Copyright (C) 2004-2010 by Giovanni Venturi                           *
 *   giovanni@ksniffer.org                                                 *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Steet, Fifth Floor, Boston, MA  02110-1301, USA.          *
 ***************************************************************************/

#ifndef CaptureDialog_H
#define CaptureDialog_H

#include <KDialog>

#include "NetworkDeviceList.h"

class QWidget;
class QComboBox;
class QLabel;
class QCheckBox;

class KSystemTrayIcon;

/**
 * The class for the Capture Dialog.
 *
 * @author Giovanni Venturi
 */
class CaptureDialog : public KDialog
{
  Q_OBJECT

  public:
    CaptureDialog(KSystemTrayIcon *tray, QWidget *parent = 0);
    ~CaptureDialog();

    /**
     * The interface the user selected to sniff. For example this can
     * be eth1, ppp0, etc. A special string is 'any', that means the
     * user wants to sniff all the available interfaces.
     *
     * @return the interface selected by the user
     */
    //QString selectedInterface() const { return m_strUsedInterface; };

  protected slots:
    /**
     * Execute this to close dialog accepting the selected interface to sniff
     */
    virtual void slotOk();

    /**
     * Execute this when Default button clicked
     */
    virtual void slotDefault();

    /**
     * Redetect network interfaces.
     */
    void slotRedetect();

    /**
     * Display IP address and Netmask for a specified Interface.
     * @param strInterface is the string containing the interface we
     * want to show the details about.
     */
    void setCurrentInterface( const QString & strInterface );

  private:
    /**
     * Keep the network devices
     */
    NetworkDeviceList m_netDevices;

    /**
     * Keep the used network interface (eth0, ppp0, tun0, ...)
     */
  //  QString m_strUsedInterface;

    /**
     * The combobox widget to keep the network interfaces
     */
    QComboBox* m_interface;

    /**
     * The label widget to specify the network interface IP address
     */
    QLabel* m_ipaddress;

    /**
     * The label widget to specify the network interface netmask
     */
    QLabel* m_netmask;

    /**
     * The label widget to specify the network interface MAC address
     */
    QLabel* m_macAddress;

    /**
     * Reference needed to let the Settings Dialog to show/hide the Tray
     * if you click on the "Advanced button/GUI"
     */
    KSystemTrayIcon *m_tray;
};

#endif
