/***************************************************************************
*   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 JIGSAWSETTINGS_H
#define JIGSAWSETTINGS_H

#include <QWidget>
#include <KListWidget>

class QGridLayout;
class QCheckBox;
class QGroupBox;
class QLabel;
class QSpinBox;
class QSpacerItem;
class QPushButton;

class KConfigDialog;

/**
 *  The class has nearly the same functions as the KListWidget class. It has
 *  an additional Q_PROPERTY that is set and read using the KConfigManager.
 *  It is used to edit the list of images that are for the jigsaw feedback.
 *  The user can add an delete image files here.
 * 
 * @short the GUI to change some settings of the jigsaw use in the program
 * @author Kraschinski Arnold <arnold.kra67@gmx.de>
 * @version 2.00.00
 */
class MyListWidget : public KListWidget
{
    Q_OBJECT
    Q_PROPERTY (QStringList imagesList READ images WRITE setImages USER true)
public:
    explicit MyListWidget( QWidget* parent = 0 );
    
    /** get the list of the selected images from the MyListWidget.
     *
     * @return the list of the selected imaged
     */
    QStringList images();
    
    /** Send the list of the selected images to the MyListWidget
     *
     * @param list the list of the selected images
     */
    void setImages(QStringList imageList);
    
signals:
    /** The signal is necessary to intergrate the class into the standard KDE
     *  KConfigDialogue
     */
    void settingsChanged();
    void changed();

private:
    QStringList imageList;
};

/**
 * The class is a page for the Kverbos Config Dialogue. The user can change
 * the settings for the jigsaw here. He can choose if he wants to use the
 * jigsaw feedback, the number of tiles in the jigsaw and the images that 
 * are used.
 * 
 * @short the GUI to change some settings of the jigsaw use in the program
 * @author Kraschinski Arnold <arnold.kra67@gmx.de>
 * @version 2.00.00
 */
class JigsawSettings : public QWidget
{
Q_OBJECT
public:
    /** creates an object of this class 
     */
    explicit JigsawSettings(QWidget*parent);
    ~JigsawSettings();
    
    /** Create the GUI of the class 
     */
    void setupUi(QWidget *JigsawSettings);
    
    void retranslateUi(QWidget *JigsawSettings);
	
public slots:
    /** Delete the selected image file names from the MyListWidget */
    void slotDelete();
    
    /** Open a FileDialog. the user can select multiple image files and
     *  the files are added to the list of image file names. In the 
     *  MyListWidget.
     */
    void slotAdd();
	
private slots:

public:
    QGridLayout*        gridLayout;
    QCheckBox*          kcfg_showJigsaw;
    QGroupBox*          groupBoxJigsawSettings;
    QGridLayout*        gridLayout1;
    QLabel*             labelHorizontal;
    QSpinBox*           kcfg_horizontalParts;
    QSpacerItem*        spacerItem;
    QLabel*             labelVertical;
    QSpinBox*           kcfg_verticalParts;
    QSpacerItem*        spacerItem1;
    //KListWidget*       kcfg_imageList;
    MyListWidget*       kcfg_imageList;
    QPushButton*        pushButtonDelete;
    QSpacerItem*        spacerItem2;
    QPushButton*        pushButtonAdd;

private:
    KConfigDialog*      m_parent;
};

#endif // JIGSAWSETTINGS_H

