/***************************************************************************
 *   Copyright (C) 2007-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 GUI_OPTIONTAB_H
#define GUI_OPTIONTAB_H

/**
 * This class manage the GUI option of KSniffer
 *
 * @author Giovanni Venturi <giovanni@ksniffer.org>
 *
 */

#include <KConfig>

#include "ui_GuiOptionTab.h"

class KSystemTrayIcon;
class CaptureOptions;

class GuiOptionTab : public QWidget
{
  Q_OBJECT

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

/*    void getShowAfterOptions( CaptureOptions *options );

    void getOptions( CaptureOptions *options );*/
    void readSettings();
    bool saveSettings();

    /**
     * Used to restore tray settings in the "tray view" when user click
     * on Cancel button to avoid changes
     */
    void restoreTray();

  private slots:
    void checkWarning();
    void adjustTray(int state);

  private:
    Ui::GuiOptionTab ui;
    KConfigGroup m_config;
    KSystemTrayIcon *m_tray;

    /**
     * you need to store the original value because user can also
     * want to avoid setting changes when click on Cancel button
     */
    Qt::CheckState m_trayState;
};

#endif  // GUI_OPTIONTAB_H
