/***************************************************************************
 *   Copyright (C) 2007 by Arnold Kraschinski                              *
 *   arnold.kra67@gmx.de                                                   *
 *                                                                         *
 *                                                                         *
 *   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 Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
 ***************************************************************************/


#ifndef KVERBOS_H_
#define KVERBOS_H_


#include <QWidget>

class QKeyEvent;
class QStackedLayout;
class ControlLine;
class QMenu;
class QLearning;
class KHelpMenu;

/**
 * This is the main widget of the program.
 *
 * @short main widget of the program
 * @author Kraschinski Arnold <arnold.kra67@gmx.de>
 * @version 2.00.00
 */
class Kverbos : public QWidget
{
    Q_OBJECT
public:
    /**
     * Default Constructor
     */
    Kverbos();

    /**
     * Default Destructor
     */
    ~Kverbos();
    
    /** The function opens the KVTML files that are in the
      * KVerbosSettings and looks for translations for the verbs.
      */
    void loadKVTMLFiles();
    
protected:
    /** Treat some key input here like F1 (Help) and Strg + Q (Quit)
      */
    virtual void keyPressEvent ( QKeyEvent * event );

private slots:
    /** Opens the dialogue to configure the program.
     */
    void slotConfig();

    /** Open the kverbos handbook
     */
    void slotHandbook();

    /** Show some information about Kverbos
     */
    void slotAboutApp();

    /** Show some information about KDE  
     */
    void slotAboutKDE();

    /** Go on in the process of the program. What exactly happens
     *  depends of the actual position in the process.
     */
    void slotNext();

    /** Go to the menu. This means an exercise will be aborted.
     */
    void slotMenu();
    
    /** The slot is called when the clock in the timerView is used as a timer and
      * the time has expired.
      */
    void slotTimerExpired();

    /** Leave the program.
     */
    void slotExit();

signals:
    /** the kverbos class can stop a running timer for example when the settings
      * dialog should be displayed */
    void signalStopTimer();
    /** the kverbos class can start a timer for example when the settings
      * dialog has been displayed. This is a restart of the timer, that means
      * The time is not resetted.
      */
    void signalStartTimer();

private:
    /** Tells what's going on in the program. Is the menu shown or the learning
      * widget? The mode can be MENU or LEARNING
      */
    int                 m_mode;
    QStackedLayout*     m_stackedLayout;
    QMenu*              m_menu;
    QLearning*          m_learning;
    ControlLine*        m_controlLine;

    /** help menu for displaying about box */
    KHelpMenu*          m_helpMenu;
    
public:
    static const int    MENU;
    static const int    LEARNING;
};

#endif // KVERBOS_H_
