/***************************************************************************
*   Copyright (C) 2002 by Jakob Simon-Gaarde                              *
*   jsgaarde@tdcspace.dk                                                  *
*   Copyright (C) 2002-2003 by Alexander Dymo                             *
*   cloudtemple@mksat.net                                                 *
*   Copyright (C) 2003 by Thomas Hasart                                   *
*   thasart@gmx.de                                                        *
*   Copyright (C) 2006 by Andreas Pakulat                                 *
*   apaku@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.                                   *
*                                                                         *
***************************************************************************/

#ifndef PROJECTCONFIGURATIONDLG_H
#define PROJECTCONFIGURATIONDLG_H

#include "projectconfigurationdlgbase.h"
//#include "trollprojectwidget.h"
#include <tdeversion.h>
#include <tqlistview.h>
#include <tdelistview.h>
#include <tqmap.h>

class QMakeScopeItem;
class TDEListViewItem;
class qProjectItem;
class ProjectConfigurationDlg;
class TrollProjectWidget;

class InsideCheckListItem : public TQCheckListItem
{
public:
    InsideCheckListItem( TQListView *parent, QMakeScopeItem *item, ProjectConfigurationDlg *config );

    InsideCheckListItem( TQListView *parent, TQListViewItem *after, QMakeScopeItem *item, ProjectConfigurationDlg *config );
    QMakeScopeItem *prjItem;
    ProjectConfigurationDlg *m_config;

protected:
    virtual void stateChange ( bool state );
};

class CustomVarListItem : public TDEListViewItem
{
    public:
        CustomVarListItem( TQListView*, unsigned int, TQMap<TQString, TQString> );
        TQString key(int column, bool ascending) const;
    private:
        unsigned int m_key;
};

class ProjectConfigurationDlg : public ProjectConfigurationDlgBase
{
public:
    ProjectConfigurationDlg( TQListView *_prjList, TrollProjectWidget* _prjWidget, TQWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
    ~ProjectConfigurationDlg();
    void updateControls();
    void updateSubproject( QMakeScopeItem* _item );
    QMakeScopeItem* currentProjectItem() { return myProjectItem; }

public slots:
    //  virtual void           radioLibrarytoggled(bool);
    virtual void updateProjectConfiguration();

    virtual void buildorderMoveUpClicked();
    virtual void buildorderMoveDownClicked();

    virtual void insideIncMoveUpClicked();
    virtual void insideIncMoveDownClicked();
    virtual void outsideIncMoveUpClicked();
    virtual void outsideIncMoveDownClicked();
    virtual void outsideIncAddClicked();
    virtual void outsideIncRemoveClicked();
    virtual void outsideIncEditClicked();

    virtual void insideLibMoveUpClicked();
    virtual void insideLibMoveDownClicked();
    virtual void outsideLibMoveUpClicked();
    virtual void outsideLibMoveDownClicked();
    virtual void outsideLibAddClicked();
    virtual void outsideLibRemoveClicked();
    virtual void outsideLibEditClicked();

    virtual void outsideLibDirMoveUpClicked();
    virtual void outsideLibDirMoveDownClicked();
    virtual void outsideLibDirAddClicked();
    virtual void outsideLibDirRemoveClicked();
    virtual void outsideLibDirEditClicked();

    virtual void extAdd_button_clicked();
    virtual void extEdit_button_clicked();
    virtual void extMoveDown_button_clicked();
    virtual void extMoveUp_button_clicked();
    virtual void extRemove_button_clicked();
    virtual void intMoveDown_button_clicked();
    virtual void intMoveUp_button_clicked();

    virtual void addCustomValueClicked();
    virtual void removeCustomValueClicked();
    virtual void upCustomValueClicked();
    virtual void downCustomValueClicked();

    virtual void newCustomVariableActive();

    virtual void groupLibrariesChanged( int );
    virtual void groupRequirementsChanged( int );
    virtual void groupTemplateChanged( int );
    virtual void targetInstallChanged( bool );
    virtual void accept();
    virtual void reject();
    virtual void apply();
    virtual void activateApply( int );
    virtual void activateApply( const TQString& );


    void updateIncludeControl();
    void updateLibControls();
    void updateBuildOrderControl();
    void updateDependenciesControl();
    virtual void activateApply(TQListViewItem*);
    virtual void customVarChanged();

protected:
    TQListView *prjList;
    QMakeScopeItem *myProjectItem;
    TQPtrList <QMakeScopeItem> getAllProjects();
    TrollProjectWidget* prjWidget;
    void getAllSubProjects( QMakeScopeItem *item, TQPtrList<QMakeScopeItem> *itemList );

private:
    void removeSharedLibDeps();
    void removeStaticLibDeps();
    void addSharedLibDeps();
    void addStaticLibDeps();
    void removeAppDeps();
    void addAppDeps();
};

#endif
