2007-11-02 18:55:57 +03:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
|
|
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
|
|
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
|
|
|
|
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
PURPOSE. See the above copyright notices for more information.
|
|
|
|
|
|
|
|
=========================================================================*/
|
2007-11-02 18:50:17 +03:00
|
|
|
|
|
|
|
#ifndef QCMakeCacheView_h
|
|
|
|
#define QCMakeCacheView_h
|
|
|
|
|
2007-11-03 19:50:02 +03:00
|
|
|
#include "QCMake.h"
|
2007-11-02 18:50:17 +03:00
|
|
|
#include <QTableView>
|
|
|
|
#include <QAbstractTableModel>
|
2007-11-03 17:30:52 +03:00
|
|
|
#include <QCheckBox>
|
2007-11-02 18:50:17 +03:00
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QItemDelegate>
|
2007-11-06 03:26:18 +03:00
|
|
|
#include <QSortFilterProxyModel>
|
2007-11-02 18:50:17 +03:00
|
|
|
|
|
|
|
class QCMakeCacheModel;
|
2007-11-08 18:17:37 +03:00
|
|
|
class QToolButton;
|
2007-11-02 18:50:17 +03:00
|
|
|
|
|
|
|
|
|
|
|
/// Qt view class for cache properties
|
|
|
|
class QCMakeCacheView : public QTableView
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
QCMakeCacheView(QWidget* p);
|
|
|
|
|
|
|
|
QCMakeCacheModel* cacheModel() const;
|
2007-11-06 03:26:18 +03:00
|
|
|
bool showAdvanced() const;
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void setShowAdvanced(bool);
|
|
|
|
void setSearchFilter(const QString&);
|
2007-11-02 18:50:17 +03:00
|
|
|
|
|
|
|
protected:
|
2007-11-03 17:30:52 +03:00
|
|
|
QModelIndex moveCursor(CursorAction, Qt::KeyboardModifiers);
|
|
|
|
void showEvent(QShowEvent* e);
|
|
|
|
bool Init;
|
2007-11-06 03:26:18 +03:00
|
|
|
QCMakeCacheModel* CacheModel;
|
|
|
|
QSortFilterProxyModel* AdvancedFilter;
|
|
|
|
QSortFilterProxyModel* SearchFilter;
|
2007-11-02 18:50:17 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/// Qt model class for cache properties
|
|
|
|
class QCMakeCacheModel : public QAbstractTableModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
QCMakeCacheModel(QObject* parent);
|
|
|
|
~QCMakeCacheModel();
|
|
|
|
|
|
|
|
enum { HelpRole = Qt::UserRole, TypeRole, AdvancedRole };
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void setProperties(const QCMakeCachePropertyList& props);
|
2007-11-05 21:20:54 +03:00
|
|
|
void clear();
|
2007-11-07 18:09:02 +03:00
|
|
|
void setEditEnabled(bool);
|
2007-11-08 18:17:37 +03:00
|
|
|
bool removeRows(int row, int count, const QModelIndex& idx = QModelIndex());
|
2007-11-13 07:54:49 +03:00
|
|
|
bool insertRows(int row, int num, const QModelIndex&);
|
2007-11-02 18:50:17 +03:00
|
|
|
|
|
|
|
public:
|
2007-11-03 17:30:52 +03:00
|
|
|
// satisfy [pure] virtuals
|
2007-11-13 07:54:49 +03:00
|
|
|
int columnCount (const QModelIndex& parent) const;
|
|
|
|
QVariant data (const QModelIndex& index, int role = Qt::DisplayRole) const;
|
|
|
|
QModelIndex parent (const QModelIndex& index) const;
|
|
|
|
int rowCount (const QModelIndex& parent = QModelIndex()) const;
|
|
|
|
QVariant headerData (int section, Qt::Orientation orient, int role) const;
|
|
|
|
Qt::ItemFlags flags (const QModelIndex& index) const;
|
|
|
|
bool setData (const QModelIndex& index, const QVariant& value, int role);
|
|
|
|
QModelIndex buddy (const QModelIndex& index) const;
|
2007-11-02 18:50:17 +03:00
|
|
|
|
2007-11-03 17:30:52 +03:00
|
|
|
// get the properties
|
2007-11-02 18:50:17 +03:00
|
|
|
QCMakeCachePropertyList properties() const;
|
2007-11-07 18:09:02 +03:00
|
|
|
|
|
|
|
// editing enabled
|
|
|
|
bool editEnabled() const;
|
2007-11-02 18:50:17 +03:00
|
|
|
|
2007-11-09 23:18:49 +03:00
|
|
|
int newCount() const;
|
|
|
|
|
2007-11-02 18:50:17 +03:00
|
|
|
protected:
|
|
|
|
QCMakeCachePropertyList Properties;
|
2007-11-04 02:48:59 +03:00
|
|
|
int NewCount;
|
2007-11-07 18:09:02 +03:00
|
|
|
bool EditEnabled;
|
2007-11-02 18:50:17 +03:00
|
|
|
};
|
|
|
|
|
2007-11-05 21:20:54 +03:00
|
|
|
/// Qt delegate class for interaction (or other customization)
|
|
|
|
/// with cache properties
|
2007-11-02 18:50:17 +03:00
|
|
|
class QCMakeCacheModelDelegate : public QItemDelegate
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
QCMakeCacheModelDelegate(QObject* p);
|
2007-11-03 17:30:52 +03:00
|
|
|
/// create our own editors for cache properties
|
2007-11-05 21:20:54 +03:00
|
|
|
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option,
|
|
|
|
const QModelIndex& index ) const;
|
2007-11-13 08:17:10 +03:00
|
|
|
bool editorEvent (QEvent* event, QAbstractItemModel* model,
|
|
|
|
const QStyleOptionViewItem& option, const QModelIndex& index);
|
2007-11-02 18:50:17 +03:00
|
|
|
};
|
|
|
|
|
2007-11-03 17:30:52 +03:00
|
|
|
/// Editor widget for editing paths or file paths
|
2007-11-13 07:54:49 +03:00
|
|
|
class QCMakeCacheFileEditor : public QLineEdit
|
2007-11-02 18:50:17 +03:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2007-11-13 07:54:49 +03:00
|
|
|
QCMakeCacheFileEditor(QWidget* p);
|
2007-11-02 18:50:17 +03:00
|
|
|
protected slots:
|
2007-11-13 07:54:49 +03:00
|
|
|
virtual void chooseFile() = 0;
|
2007-11-02 18:50:17 +03:00
|
|
|
protected:
|
2007-11-08 18:17:37 +03:00
|
|
|
void resizeEvent(QResizeEvent* e);
|
|
|
|
QToolButton* ToolButton;
|
2007-11-02 18:50:17 +03:00
|
|
|
};
|
|
|
|
|
2007-11-13 07:54:49 +03:00
|
|
|
class QCMakeCachePathEditor : public QCMakeCacheFileEditor
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
QCMakeCachePathEditor(QWidget* p = NULL);
|
|
|
|
void chooseFile();
|
|
|
|
};
|
|
|
|
|
|
|
|
class QCMakeCacheFilePathEditor : public QCMakeCacheFileEditor
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
QCMakeCacheFilePathEditor(QWidget* p = NULL);
|
|
|
|
void chooseFile();
|
|
|
|
};
|
|
|
|
|
2007-11-02 18:50:17 +03:00
|
|
|
#endif
|
|
|
|
|