/* -*- c++ -*-
 *
 * prefs.h
 *
 * Copyright (C) 2003 Petter Stokke <ummo@hellokitty.com>
 *
 * 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 __kmldonkey_prefs_h__
#define __kmldonkey_prefs_h__

#include <qwidget.h>
#include <qtabwidget.h>
#include <qvbox.h>
#include <qtooltip.h>
#include <kdialogbase.h>
#include <kcolorbutton.h>

#include "fontselector.h"
#include "listeditor.h"

#include "generalpage.h"
#include "listspage.h"
#include "searchpage.h"

class QCheckBox;
class KPushButton;
class KIntNumInput;
class KDoubleNumInput;
class KComboBox;

class ColorSelector : public QHBox
{
public:
    ColorSelector(QWidget* parent, const char* name, const QString caption, const QString tooltip);
    const QColor color();
    void setColor(const QColor &color);
private:
    KColorButton* button;
};

class KMLDonkeyPrefRenamerPage : public QVBox
{
    Q_OBJECT
public:
    KMLDonkeyPrefRenamerPage(QWidget *parent);

    QCheckBox *enableAutorenameCheckbox;
    AutoRenamerListEditor *renlisteditor;

public slots:
    void enableAutorename(bool);
};

class KMLDonkeyPrefColorPage : public QVBox
{
    Q_OBJECT
public:
    KMLDonkeyPrefColorPage(QWidget *parent = 0);

    QCheckBox *coloredListsCheckbox,
	      *availabilityShadingCheckbox;

    ColorSelector *colorServerNotConnected,
                  *colorServerBlacklisted,
                  *colorServerConnecting,
                  *colorServerConnected;

    ColorSelector *colorSearchFewSources,
                  *colorSearchManySources,
                  *colorSearchAlreadyDone;
    KIntNumInput *searchSourcesThresholdSlider,
	         *availabilityShadingSlider;

    //QCheckBox *colorDownloadCheckbox;
    ColorSelector *downloadingColorSelect,
                  *pausedColorSelect,
                  *lookingColorSelect,
                  *notavailableColorSelect,
                  *queuedColorSelect;

    ColorSelector *noSourcesColorSelect,
                  *fewSourcesColorSelect,
                  *manySourcesColorSelect,
                  *completeColorSelect;
    KIntNumInput* availabilityThresholdSlider;

    ColorSelector *colorSourceNotConnected,
                  *colorSourceBlacklisted,
                  *colorSourceConnecting,
                  *colorSourceQueued,
                  *colorSourceDownloading;

private:
    QGroupBox *grpServer, *grpSearch, *grpDown, *grpAvail, *grpSources;

public slots:
    void coloredLists(bool);
};

class KMLDonkeyPrefFontPage : public QFrame
{
public:
    KMLDonkeyPrefFontPage(QWidget *parent = 0);

    FontSelector *consoleFontSelect,
                 *listFontSelect;
};

class KMLDonkeyPreferences : public KDialogBase
{
    Q_OBJECT
public:
    KMLDonkeyPreferences(QWidget* parent = 0);

    KMLDonkeyPrefGeneralPage* generalPage;
    KMLDonkeyPrefListsPage* listsPage;
    KMLDonkeyPrefSearchPage* searchPage;
    KMLDonkeyPrefRenamerPage* renamerPage;
    KMLDonkeyPrefColorPage* colorPage;
    KMLDonkeyPrefFontPage* fontPage;

protected slots:
    void saveSize();
};

#endif // __kmldonkey_prefs_h__
