2016-02-12 04:37:13 +00:00
/*
* OpenClonk , http : //www.openclonk.org
*
* Copyright ( c ) 2001 - 2009 , RedWolf Design GmbH , http : //www.clonk.de/
* Copyright ( c ) 2013 , The OpenClonk Team and contributors
*
* Distributed under the terms of the ISC license ; see accompanying file
* " COPYING " for details .
*
* " Clonk " is a registered trademark of Matthes Bender , used with permission .
* See accompanying file " TRADEMARK " for details .
*
* To redistribute this file separately , substitute the full license texts
* for the above references .
*/
/* Proplist table view */
# ifndef INC_C4ConsoleQtPropListViewer
# define INC_C4ConsoleQtPropListViewer
# ifdef WITH_QT_EDITOR
2016-04-03 19:06:32 +00:00
# include "C4Include.h" // needed for automoc
# include "editor/C4ConsoleGUI.h" // for glew.h
# include "editor/C4ConsoleQt.h"
2016-04-25 20:17:10 +00:00
# include "editor/C4ConsoleQtShapes.h"
2016-04-04 23:34:02 +00:00
# include "script/C4Value.h"
2016-04-04 03:46:58 +00:00
2016-04-25 20:17:10 +00:00
class C4ConsoleQtPropListModel ;
struct C4ConsoleQtPropListModelProperty ;
2016-04-04 03:46:58 +00:00
// Path to a property, like e.g. Object(123).foo.bar[456].baz
// Used to allow proper synchronization of property setting
class C4PropertyPath
{
// TODO: For now just storing the path. May want to keep the path info later to allow validation/updating of values
2016-07-23 05:40:51 +00:00
StdCopyStrBuf get_path , argument , set_path ;
2016-07-04 01:16:07 +00:00
StdCopyStrBuf root ;
2016-04-04 03:46:58 +00:00
2016-04-09 18:20:31 +00:00
public :
2016-04-04 03:46:58 +00:00
enum PathType
{
PPT_Root = 0 ,
PPT_Property = 1 ,
PPT_Index = 2 ,
PPT_SetFunction = 3 ,
2016-05-23 23:22:05 +00:00
PPT_GlobalSetFunction = 4 ,
2016-07-21 04:20:44 +00:00
PPT_RootSetFunction = 5 ,
2016-07-23 05:40:51 +00:00
} get_path_type , set_path_type ;
2016-10-14 14:49:14 +00:00
2016-04-04 03:46:58 +00:00
public :
C4PropertyPath ( ) { }
2016-05-23 23:22:05 +00:00
C4PropertyPath ( C4PropList * target ) ;
C4PropertyPath ( C4Effect * fx , C4Object * target_obj ) ;
2016-07-23 05:40:51 +00:00
C4PropertyPath ( const char * path ) : get_path ( path ) , root ( path ) , get_path_type ( PPT_Root ) , set_path_type ( PPT_Root ) { }
2016-04-04 03:46:58 +00:00
C4PropertyPath ( const C4PropertyPath & parent , int32_t elem_index ) ;
2016-07-23 05:40:51 +00:00
C4PropertyPath ( const C4PropertyPath & parent , const char * child_property ) ;
void SetSetPath ( const C4PropertyPath & parent , const char * child_property , PathType path_type ) ;
void Clear ( ) { get_path . Clear ( ) ; set_path . Clear ( ) ; }
const char * GetGetPath ( ) const { return get_path . getData ( ) ; }
const char * GetSetPath ( ) const { return set_path ? set_path . getData ( ) : get_path . getData ( ) ; }
2016-07-04 01:16:07 +00:00
const char * GetRoot ( ) const { return root . getData ( ) ; } // Parent-most path (usually the object)
2016-07-23 05:40:51 +00:00
bool IsEmpty ( ) const { return get_path . getLength ( ) < = 0 ; }
2016-04-04 03:46:58 +00:00
2016-06-03 05:20:43 +00:00
C4Value ResolveValue ( ) const ;
2016-10-14 14:49:14 +00:00
C4Value ResolveRoot ( ) const ;
2016-04-04 03:46:58 +00:00
void SetProperty ( const char * set_string ) const ;
2016-08-27 05:12:08 +00:00
void SetProperty ( const C4Value & to_val , const C4PropListStatic * ignore_reference_parent = nullptr ) const ;
2016-06-03 05:20:43 +00:00
void DoCall ( const char * call_string ) const ; // Perform a script call where %s is replaced by the current path
2016-07-18 23:24:53 +00:00
2016-07-23 05:40:51 +00:00
bool operator = = ( const C4PropertyPath & v ) const { return get_path = = v . get_path ; }
2016-04-04 03:46:58 +00:00
} ;
class C4PropertyDelegate : public QObject
{
Q_OBJECT
protected :
const class C4PropertyDelegateFactory * factory ;
2016-07-18 23:24:53 +00:00
C4Value creation_props ;
2016-07-06 03:27:55 +00:00
C4RefCntPointer < C4String > set_function , async_get_function , name ;
2016-07-21 04:20:44 +00:00
C4PropertyPath : : PathType set_function_type ;
2016-04-04 03:46:58 +00:00
public :
2016-04-17 02:02:24 +00:00
C4PropertyDelegate ( const class C4PropertyDelegateFactory * factory , C4PropList * props ) ;
2016-04-04 03:46:58 +00:00
virtual ~ C4PropertyDelegate ( ) { }
2016-06-03 05:20:43 +00:00
virtual void SetEditorData ( QWidget * editor , const C4Value & val , const C4PropertyPath & property_path ) const { } ;
2016-07-18 23:24:53 +00:00
virtual void SetModelData ( QObject * editor , const C4PropertyPath & property_path , class C4ConsoleQtShape * prop_shape ) const { } ;
2016-07-30 06:37:33 +00:00
virtual QWidget * CreateEditor ( const class C4PropertyDelegateFactory * parent_delegate , QWidget * parent , const QStyleOptionViewItem & option , bool by_selection , bool is_child ) const = 0 ;
2016-04-04 03:46:58 +00:00
virtual void UpdateEditorGeometry ( QWidget * editor , const QStyleOptionViewItem & option ) const ;
2016-05-28 13:30:54 +00:00
virtual bool GetPropertyValue ( const C4Value & container , C4String * key , int32_t index , C4Value * out_val ) const ;
virtual bool GetPropertyValueBase ( const C4Value & container , C4String * key , int32_t index , C4Value * out_val ) const ;
2016-07-30 18:50:07 +00:00
virtual QString GetDisplayString ( const C4Value & val , class C4Object * obj , bool short_names ) const ;
2016-04-17 02:02:24 +00:00
virtual QColor GetDisplayTextColor ( const C4Value & val , class C4Object * obj ) const ;
virtual QColor GetDisplayBackgroundColor ( const C4Value & val , class C4Object * obj ) const ;
2016-04-25 20:17:10 +00:00
const char * GetSetFunction ( ) const { return set_function . Get ( ) ? set_function - > GetCStr ( ) : nullptr ; } // get name of setter function for this property
2016-07-18 23:24:53 +00:00
virtual const class C4PropertyDelegateShape * GetShapeDelegate ( C4Value & val , C4PropertyPath * shape_path ) const { return nullptr ; }
virtual const class C4PropertyDelegateShape * GetDirectShapeDelegate ( ) const { return nullptr ; }
2016-04-25 20:17:10 +00:00
virtual bool HasCustomPaint ( ) const { return false ; }
2016-07-18 23:24:53 +00:00
virtual bool Paint ( QPainter * painter , const QStyleOptionViewItem & option , const C4Value & val ) const { return false ; }
2016-10-14 14:49:14 +00:00
virtual C4PropertyPath GetPathForProperty ( struct C4ConsoleQtPropListModelProperty * editor_prop ) const ;
2016-07-21 04:20:44 +00:00
C4PropertyPath GetPathForProperty ( const C4PropertyPath & parent_path , const char * default_subpath ) const ;
2016-07-06 03:27:55 +00:00
C4String * GetNameStr ( ) const { return name . Get ( ) ; }
2016-07-18 23:24:53 +00:00
const C4Value & GetCreationProps ( ) const { return creation_props ; }
2016-08-19 20:12:53 +00:00
virtual bool IsPasteValid ( const C4Value & val ) const = 0 ;
2016-04-09 18:20:31 +00:00
2016-04-04 03:46:58 +00:00
signals :
void EditorValueChangedSignal ( QWidget * editor ) const ;
void EditingDoneSignal ( QWidget * editor ) const ;
} ;
class C4PropertyDelegateInt : public C4PropertyDelegate
{
2016-04-09 18:20:31 +00:00
private :
int32_t min , max , step ;
2016-04-04 03:46:58 +00:00
public :
2016-04-17 02:02:24 +00:00
C4PropertyDelegateInt ( const class C4PropertyDelegateFactory * factory , C4PropList * props ) ;
2016-04-04 03:46:58 +00:00
2016-05-25 03:06:00 +00:00
void SetEditorData ( QWidget * editor , const C4Value & val , const C4PropertyPath & property_path ) const override ;
2016-07-18 23:24:53 +00:00
void SetModelData ( QObject * editor , const C4PropertyPath & property_path , class C4ConsoleQtShape * prop_shape ) const override ;
2016-07-30 06:37:33 +00:00
QWidget * CreateEditor ( const class C4PropertyDelegateFactory * parent_delegate , QWidget * parent , const QStyleOptionViewItem & option , bool by_selection , bool is_child ) const override ;
2016-08-19 20:12:53 +00:00
bool IsPasteValid ( const C4Value & val ) const override ;
2016-06-16 04:40:25 +00:00
} ;
class C4PropertyDelegateStringEditor : public QLineEdit
{
public :
C4PropertyDelegateStringEditor ( QWidget * parent ) : QLineEdit ( parent ) , commit_pending ( false ) { }
bool commit_pending ;
} ;
class C4PropertyDelegateString : public C4PropertyDelegate
{
public :
typedef C4PropertyDelegateStringEditor Editor ;
C4PropertyDelegateString ( const class C4PropertyDelegateFactory * factory , C4PropList * props ) ;
void SetEditorData ( QWidget * editor , const C4Value & val , const C4PropertyPath & property_path ) const override ;
2016-07-18 23:24:53 +00:00
void SetModelData ( QObject * editor , const C4PropertyPath & property_path , class C4ConsoleQtShape * prop_shape ) const override ;
2016-07-30 06:37:33 +00:00
QWidget * CreateEditor ( const class C4PropertyDelegateFactory * parent_delegate , QWidget * parent , const QStyleOptionViewItem & option , bool by_selection , bool is_child ) const override ;
2016-07-30 18:50:07 +00:00
QString GetDisplayString ( const C4Value & v , C4Object * obj , bool short_names ) const override ;
2016-08-19 20:12:53 +00:00
bool IsPasteValid ( const C4Value & val ) const override ;
2016-04-04 03:46:58 +00:00
} ;
2016-04-17 02:02:24 +00:00
// Editor: Text displaying value plus a button that opens an extended editor
class C4PropertyDelegateLabelAndButtonWidget : public QWidget
{
Q_OBJECT
public :
QHBoxLayout * layout ;
QLabel * label ;
QPushButton * button ;
C4Value last_value ;
2016-06-03 05:20:43 +00:00
C4PropertyPath property_path ;
bool button_pending ;
2016-04-17 02:02:24 +00:00
C4PropertyDelegateLabelAndButtonWidget ( QWidget * parent ) ;
} ;
2016-06-03 05:20:43 +00:00
class C4PropertyDelegateDescendPath : public C4PropertyDelegate
{
2016-06-06 05:54:05 +00:00
protected :
2016-06-03 05:20:43 +00:00
C4Value info_proplist ;
bool edit_on_selection ;
2016-07-06 04:56:08 +00:00
C4RefCntPointer < C4String > descend_path ;
2016-06-03 05:20:43 +00:00
public :
typedef C4PropertyDelegateLabelAndButtonWidget Editor ;
C4PropertyDelegateDescendPath ( const class C4PropertyDelegateFactory * factory , C4PropList * props ) ;
void SetEditorData ( QWidget * aeditor , const C4Value & val , const C4PropertyPath & property_path ) const override ;
2016-07-30 06:37:33 +00:00
QWidget * CreateEditor ( const class C4PropertyDelegateFactory * parent_delegate , QWidget * parent , const QStyleOptionViewItem & option , bool by_selection , bool is_child ) const override ;
2016-06-06 05:54:05 +00:00
} ;
class C4PropertyDelegateArray : public C4PropertyDelegateDescendPath
{
private :
int32_t max_array_display ;
mutable C4PropertyDelegate * element_delegate ; // lazy eval
2016-08-19 20:12:53 +00:00
void ResolveElementDelegate ( ) const ;
2016-06-06 05:54:05 +00:00
public :
C4PropertyDelegateArray ( const class C4PropertyDelegateFactory * factory , C4PropList * props ) ;
2016-07-30 18:50:07 +00:00
QString GetDisplayString ( const C4Value & v , C4Object * obj , bool short_names ) const override ;
2016-08-19 20:12:53 +00:00
bool IsPasteValid ( const C4Value & val ) const override ;
2016-06-06 05:54:05 +00:00
} ;
class C4PropertyDelegatePropList : public C4PropertyDelegateDescendPath
{
private :
C4RefCntPointer < C4String > display_string ;
public :
C4PropertyDelegatePropList ( const class C4PropertyDelegateFactory * factory , C4PropList * props ) ;
2016-07-30 18:50:07 +00:00
QString GetDisplayString ( const C4Value & v , C4Object * obj , bool short_names ) const override ;
2016-08-19 20:12:53 +00:00
bool IsPasteValid ( const C4Value & val ) const override ;
2016-06-03 05:20:43 +00:00
} ;
2016-10-14 14:49:14 +00:00
class C4PropertyDelegateEffectEditor : public QWidget
{
Q_OBJECT
public :
QHBoxLayout * layout ;
QPushButton * remove_button , * edit_button ;
C4PropertyPath property_path ;
C4PropertyDelegateEffectEditor ( QWidget * parent ) ;
} ;
class C4PropertyDelegateEffect : public C4PropertyDelegate
{
public :
typedef C4PropertyDelegateEffectEditor Editor ;
C4PropertyDelegateEffect ( const class C4PropertyDelegateFactory * factory , C4PropList * props ) ;
void SetEditorData ( QWidget * aeditor , const C4Value & val , const C4PropertyPath & property_path ) const override ;
QWidget * CreateEditor ( const class C4PropertyDelegateFactory * parent_delegate , QWidget * parent , const QStyleOptionViewItem & option , bool by_selection , bool is_child ) const override ;
QString GetDisplayString ( const C4Value & v , C4Object * obj , bool short_names ) const override ;
bool IsPasteValid ( const C4Value & val ) const override { return false ; }
bool GetPropertyValue ( const C4Value & container , C4String * key , int32_t index , C4Value * out_val ) const override ;
C4PropertyPath GetPathForProperty ( C4ConsoleQtPropListModelProperty * editor_prop ) const override ;
} ;
2016-04-17 02:02:24 +00:00
class C4PropertyDelegateColor : public C4PropertyDelegate
{
2016-09-04 02:03:47 +00:00
private :
uint32_t alpha_mask ;
2016-10-15 22:26:03 +00:00
2016-04-17 02:02:24 +00:00
public :
typedef C4PropertyDelegateLabelAndButtonWidget Editor ;
C4PropertyDelegateColor ( const class C4PropertyDelegateFactory * factory , C4PropList * props ) ;
2016-05-25 03:06:00 +00:00
void SetEditorData ( QWidget * editor , const C4Value & val , const C4PropertyPath & property_path ) const override ;
2016-07-18 23:24:53 +00:00
void SetModelData ( QObject * editor , const C4PropertyPath & property_path , class C4ConsoleQtShape * prop_shape ) const override ;
2016-07-30 06:37:33 +00:00
QWidget * CreateEditor ( const class C4PropertyDelegateFactory * parent_delegate , QWidget * parent , const QStyleOptionViewItem & option , bool by_selection , bool is_child ) const override ;
2016-07-30 18:50:07 +00:00
QString GetDisplayString ( const C4Value & v , C4Object * obj , bool short_names ) const override ;
2016-04-17 02:02:24 +00:00
QColor GetDisplayTextColor ( const C4Value & val , class C4Object * obj ) const override ;
QColor GetDisplayBackgroundColor ( const C4Value & val , class C4Object * obj ) const override ;
2016-08-19 20:12:53 +00:00
bool IsPasteValid ( const C4Value & val ) const override ;
2016-10-15 22:26:03 +00:00
private :
void OpenColorDialogue ( Editor * editor ) const ;
2016-04-17 02:02:24 +00:00
} ;
2016-07-25 05:05:15 +00:00
// Display delegate for deep combo box. Handles the help tooltip showing.
2016-07-28 02:35:11 +00:00
class C4StyledItemDelegateWithButton : public QStyledItemDelegate
2016-07-25 05:05:15 +00:00
{
Q_OBJECT
public :
2016-07-28 02:35:11 +00:00
enum ButtonType
{
BT_Help ,
BT_PlaySound ,
} button_type ;
2016-07-25 05:05:15 +00:00
2016-07-28 02:35:11 +00:00
C4StyledItemDelegateWithButton ( ButtonType bt ) : button_type ( bt ) { }
public :
2016-07-25 05:05:15 +00:00
bool editorEvent ( QEvent * event , QAbstractItemModel * model , const QStyleOptionViewItem & option , const QModelIndex & index ) override ;
2016-07-28 02:35:11 +00:00
protected :
2016-07-25 05:05:15 +00:00
void paint ( QPainter * painter , const QStyleOptionViewItem & option , const QModelIndex & index ) const override ;
} ;
2016-06-15 04:15:08 +00:00
// A combo box that can select from a model with nested elements
// On click, descend into child elements
class C4DeepQComboBox : public QComboBox
{
Q_OBJECT
2016-10-16 05:12:21 +00:00
bool editable , manual_text_edited ;
QString last_edited_text ;
2016-07-28 02:35:11 +00:00
bool is_next_close_blocked ;
2016-06-16 04:09:53 +00:00
int last_popup_height ;
2016-07-28 02:35:11 +00:00
std : : unique_ptr < C4StyledItemDelegateWithButton > item_delegate ;
2016-07-25 05:05:15 +00:00
QSize default_icon_size ;
2016-06-15 04:15:08 +00:00
public :
2016-06-16 20:15:15 +00:00
enum
{
OptionIndexRole = Qt : : UserRole + 1 ,
ObjectHighlightRole = Qt : : UserRole + 2 ,
2016-07-28 04:24:28 +00:00
ValueStringRole = Qt : : UserRole + 3 ,
2016-08-27 20:46:38 +00:00
PriorityNameSortRole = Qt : : UserRole + 4 ,
2016-06-16 20:15:15 +00:00
} ;
2016-07-28 04:24:28 +00:00
C4DeepQComboBox ( QWidget * parent , C4StyledItemDelegateWithButton : : ButtonType button_type , bool editable ) ;
2016-06-15 04:15:08 +00:00
void showPopup ( ) override ;
void hidePopup ( ) override ;
void setCurrentModelIndex ( QModelIndex new_index ) ;
2016-06-20 23:48:02 +00:00
int32_t GetCurrentSelectionIndex ( ) ;
2016-07-28 02:35:11 +00:00
void BlockNextCloseEvent ( ) { is_next_close_blocked = true ; } ; // after item selection on a "play" button, the combo dropdown should stay open
2016-06-20 23:48:02 +00:00
2016-07-30 06:37:33 +00:00
public slots :
void doShowPopup ( ) { showPopup ( ) ; }
2016-06-20 23:48:02 +00:00
signals :
void NewItemSelected ( int32_t new_item ) ;
2016-10-16 05:12:21 +00:00
void TextChanged ( const QString & new_text ) ;
2016-06-15 04:15:08 +00:00
protected :
// event filter for view: Catch mouse clicks to descend into children
bool eventFilter ( QObject * obj , QEvent * event ) override ;
} ;
2016-04-04 03:46:58 +00:00
// Widget holder class
class C4PropertyDelegateEnumEditor : public QWidget
{
Q_OBJECT
public :
2016-10-16 05:12:21 +00:00
enum { INDEX_Custom_Value = - 1 } ;
2016-04-04 03:46:58 +00:00
C4Value last_val ;
2016-07-18 23:24:53 +00:00
C4Value last_parameter_val ; // Resolved parameter of last_val - assigned for shape parameters only
2016-10-16 05:12:21 +00:00
int32_t last_selection_index ; // Index of selection in model or INDEX_Custom_Value for custom value that does not resolve to an existing entry in editable enum
2016-05-25 03:06:00 +00:00
C4PropertyPath last_get_path ;
2016-06-15 04:15:08 +00:00
C4DeepQComboBox * option_box ;
2016-04-04 03:46:58 +00:00
QHBoxLayout * layout ;
QWidget * parameter_widget ;
2016-07-30 06:37:33 +00:00
bool updating , option_changed , dropdown_pending ;
2016-07-18 23:24:53 +00:00
const C4PropertyDelegate * paint_parameter_delegate ; // Delegate to draw over the parameter_widget if it's an empty transparent QWidget (for shape delegates)
2016-04-04 03:46:58 +00:00
2016-04-04 23:34:02 +00:00
C4PropertyDelegateEnumEditor ( QWidget * parent )
2016-07-30 06:37:33 +00:00
: QWidget ( parent ) , last_selection_index ( - 1 ) , option_box ( nullptr ) , layout ( nullptr ) , parameter_widget ( nullptr ) ,
updating ( false ) , option_changed ( false ) , dropdown_pending ( false ) , paint_parameter_delegate ( nullptr ) { }
2016-07-18 23:24:53 +00:00
void paintEvent ( QPaintEvent * ) override ;
2016-04-04 03:46:58 +00:00
} ;
class C4PropertyDelegateEnum : public C4PropertyDelegate
{
Q_OBJECT
public :
typedef C4PropertyDelegateEnumEditor Editor ; // qmake doesn't like nested classes
2016-04-09 18:20:31 +00:00
class Option
2016-04-04 03:46:58 +00:00
{
2016-04-09 18:20:31 +00:00
public :
2016-04-04 03:46:58 +00:00
C4RefCntPointer < C4String > name ; // Display name in Editor enum dropdown box
2016-07-30 18:50:07 +00:00
C4RefCntPointer < C4String > short_name ; // Shortened name displayed as sub-delegate
2016-07-25 05:05:15 +00:00
C4RefCntPointer < C4String > help ; // Tooltip text
2016-06-15 04:15:08 +00:00
C4RefCntPointer < C4String > group ; // Grouping in enum dropdown box; nested groups separated by '/'
2016-04-04 03:46:58 +00:00
C4RefCntPointer < C4String > option_key ;
C4RefCntPointer < C4String > value_key ;
2016-07-28 02:35:11 +00:00
C4RefCntPointer < C4String > sound_name ; // Assigned for options that have a play button
2016-04-04 03:46:58 +00:00
C4V_Type type ; // Assume this option is set when value is of given type
2016-08-27 05:12:08 +00:00
C4Value props ; // Stored pointer to proplist defining this option
2016-04-04 03:46:58 +00:00
C4Value value ; // Value to set if this entry is selected
2016-07-04 01:16:07 +00:00
C4Value value_function ; // Function to be called to set value
2016-04-04 03:46:58 +00:00
mutable C4PropertyDelegate * adelegate ; // Delegate to display if this entry is selected (pointer owned by C4PropertyDelegateFactory)
C4Value adelegate_val ; // Value to resolve adelegate from
// How the currently selected option is identified from the value
enum StorageType {
StorageNone = 0 , // Invalid option
StorageByType = 1 , // Use type to identify this enum
StorageByValue = 2 , // This option sets a constant value
StorageByKey = 3 , // Assume value is a proplist; identify option by field option_key
} storage_type ;
2016-08-27 20:46:38 +00:00
int32_t priority ; // Custom sort order
2016-04-04 03:46:58 +00:00
2016-11-02 23:58:02 +00:00
Option ( ) : type ( C4V_Any ) , adelegate ( nullptr ) , storage_type ( StorageNone ) , priority ( 0 ) { }
2016-04-04 03:46:58 +00:00
} ;
2016-06-15 04:15:08 +00:00
2016-07-28 02:35:11 +00:00
protected :
virtual C4StyledItemDelegateWithButton : : ButtonType GetOptionComboBoxButtonType ( ) const { return C4StyledItemDelegateWithButton : : BT_Help ; }
2016-04-04 03:46:58 +00:00
private :
std : : vector < Option > options ;
2016-10-16 05:12:21 +00:00
Option default_option ;
2016-07-28 04:24:28 +00:00
bool allow_editing ;
2016-08-27 20:46:38 +00:00
bool sorted ;
2016-04-09 18:20:31 +00:00
2016-07-30 18:13:23 +00:00
protected :
C4RefCntPointer < C4String > empty_name ; // Override for name of empty option
2016-04-09 18:20:31 +00:00
protected :
2016-06-16 18:59:04 +00:00
void ClearOptions ( ) ;
2016-04-09 18:20:31 +00:00
void ReserveOptions ( int32_t num ) ;
2016-06-15 04:15:08 +00:00
QStandardItemModel * CreateOptionModel ( ) const ;
2016-04-04 03:46:58 +00:00
public :
2016-11-02 23:58:02 +00:00
C4PropertyDelegateEnum ( const class C4PropertyDelegateFactory * factory , C4PropList * props , const C4ValueArray * poptions = nullptr ) ;
2016-04-04 03:46:58 +00:00
2016-11-02 23:58:02 +00:00
void AddTypeOption ( C4String * name , C4V_Type type , const C4Value & val , C4PropertyDelegate * adelegate = nullptr ) ;
2016-07-28 02:35:11 +00:00
void AddConstOption ( C4String * name , const C4Value & val , C4String * group = nullptr , C4String * sound_name = nullptr ) ;
2016-04-04 03:46:58 +00:00
2016-05-25 03:06:00 +00:00
void SetEditorData ( QWidget * editor , const C4Value & val , const C4PropertyPath & property_path ) const override ;
2016-07-18 23:24:53 +00:00
void SetModelData ( QObject * editor , const C4PropertyPath & property_path , class C4ConsoleQtShape * prop_shape ) const override ;
2016-07-30 06:37:33 +00:00
QWidget * CreateEditor ( const class C4PropertyDelegateFactory * parent_delegate , QWidget * parent , const QStyleOptionViewItem & option , bool by_selection , bool is_child ) const override ;
2016-07-30 18:50:07 +00:00
QString GetDisplayString ( const C4Value & val , class C4Object * obj , bool short_names ) const override ;
2016-07-18 23:24:53 +00:00
const class C4PropertyDelegateShape * GetShapeDelegate ( C4Value & val , C4PropertyPath * shape_path ) const override ; // Forward to parameter of selected option
bool HasCustomPaint ( ) const override { return true ; }
bool Paint ( QPainter * painter , const QStyleOptionViewItem & option , const C4Value & val ) const override ;
2016-08-19 20:12:53 +00:00
bool IsPasteValid ( const C4Value & val ) const override ;
2016-04-04 03:46:58 +00:00
private :
2016-06-15 04:15:08 +00:00
QModelIndex GetModelIndexByID ( QStandardItemModel * model , QStandardItem * parent_item , int32_t id , const QModelIndex & parent ) const ;
2016-04-04 03:46:58 +00:00
int32_t GetOptionByValue ( const C4Value & val ) const ;
2016-06-03 05:20:43 +00:00
void UpdateEditorParameter ( C4PropertyDelegateEnum : : Editor * editor , bool by_selection ) const ;
2016-04-25 20:17:10 +00:00
void EnsureOptionDelegateResolved ( const Option & option ) const ;
2016-10-16 05:12:21 +00:00
void SetOptionValue ( const C4PropertyPath & use_path , const C4PropertyDelegateEnum : : Option & option , const C4Value & option_value ) const ;
void UpdateOptionIndex ( Editor * editor , int idx , const QString * custom_text ) const ;
2016-04-04 03:46:58 +00:00
} ;
2016-04-09 18:20:31 +00:00
// Select a definition
class C4PropertyDelegateDef : public C4PropertyDelegateEnum
{
2016-08-19 20:12:53 +00:00
private :
C4RefCntPointer < C4String > filter_property ;
2016-04-09 18:20:31 +00:00
public :
2016-04-17 02:02:24 +00:00
C4PropertyDelegateDef ( const C4PropertyDelegateFactory * factory , C4PropList * props ) ;
2016-08-19 20:12:53 +00:00
bool IsPasteValid ( const C4Value & val ) const override ;
2016-06-16 01:57:59 +00:00
private :
void AddDefinitions ( class C4ConsoleQtDefinitionListModel * def_list_model , QModelIndex parent , C4String * group ) ;
2016-04-17 02:02:24 +00:00
} ;
2016-06-16 18:59:04 +00:00
// Select an object
class C4PropertyDelegateObject : public C4PropertyDelegateEnum
{
private :
C4RefCntPointer < C4String > filter ;
size_t max_nearby_objects ; // maximum number of objects shown in "nearby" list
C4RefCntPointer < C4String > GetObjectEntryString ( C4Object * obj ) const ;
void UpdateObjectList ( ) ;
public :
C4PropertyDelegateObject ( const C4PropertyDelegateFactory * factory , C4PropList * props ) ;
2016-07-30 06:37:33 +00:00
QWidget * CreateEditor ( const class C4PropertyDelegateFactory * parent_delegate , QWidget * parent , const QStyleOptionViewItem & option , bool by_selection , bool is_child ) const override ;
2016-07-30 18:50:07 +00:00
QString GetDisplayString ( const C4Value & v , class C4Object * obj , bool short_names ) const override ;
2016-08-19 20:12:53 +00:00
bool IsPasteValid ( const C4Value & val ) const override ;
2016-06-16 18:59:04 +00:00
} ;
2016-07-28 02:35:11 +00:00
// Select a sound
class C4PropertyDelegateSound : public C4PropertyDelegateEnum
{
public :
C4PropertyDelegateSound ( const C4PropertyDelegateFactory * factory , C4PropList * props ) ;
2016-10-16 05:15:38 +00:00
QString GetDisplayString ( const C4Value & v , class C4Object * obj , bool short_names ) const override ;
2016-08-19 20:12:53 +00:00
bool IsPasteValid ( const C4Value & val ) const override ;
2016-07-28 02:35:11 +00:00
protected :
C4StyledItemDelegateWithButton : : ButtonType GetOptionComboBoxButtonType ( ) const override { return C4StyledItemDelegateWithButton : : BT_PlaySound ; }
} ;
2016-04-17 02:02:24 +00:00
// true or false
class C4PropertyDelegateBool : public C4PropertyDelegateEnum
{
public :
C4PropertyDelegateBool ( const class C4PropertyDelegateFactory * factory , C4PropList * props ) ;
2016-05-28 13:30:54 +00:00
bool GetPropertyValue ( const C4Value & container , C4String * key , int32_t index , C4Value * out_val ) const override ;
2016-08-19 20:12:53 +00:00
bool IsPasteValid ( const C4Value & val ) const override ;
2016-04-17 02:02:24 +00:00
} ;
// true or false depending on whether effect is present
class C4PropertyDelegateHasEffect : public C4PropertyDelegateBool
{
private :
C4RefCntPointer < C4String > effect ;
public :
C4PropertyDelegateHasEffect ( const class C4PropertyDelegateFactory * factory , C4PropList * props ) ;
2016-05-28 13:30:54 +00:00
bool GetPropertyValue ( const C4Value & container , C4String * key , int32_t index , C4Value * out_val ) const override ;
2016-04-09 18:20:31 +00:00
} ;
2016-04-04 23:34:02 +00:00
// C4Value setting using an enum
class C4PropertyDelegateC4ValueEnum : public C4PropertyDelegateEnum
2016-04-04 03:46:58 +00:00
{
public :
2016-04-17 02:02:24 +00:00
C4PropertyDelegateC4ValueEnum ( const C4PropertyDelegateFactory * factory , C4PropList * props ) ;
2016-08-19 20:12:53 +00:00
bool IsPasteValid ( const C4Value & val ) const override { return true ; }
2016-04-04 23:34:02 +00:00
} ;
2016-06-03 05:20:43 +00:00
class C4PropertyDelegateC4ValueInputEditor : public QWidget // TODO: Merge with C4PropertyDelegateLabelAndButtonWidget
2016-04-04 23:34:02 +00:00
{
Q_OBJECT
public :
QHBoxLayout * layout ;
QLineEdit * edit ;
QPushButton * extended_button ;
bool commit_pending ;
2016-05-25 03:06:00 +00:00
C4PropertyPath property_path ;
2016-04-04 23:34:02 +00:00
2016-05-25 03:06:00 +00:00
C4PropertyDelegateC4ValueInputEditor ( QWidget * parent ) ;
2016-04-04 23:34:02 +00:00
} ;
// C4Value setting using an input box
class C4PropertyDelegateC4ValueInput : public C4PropertyDelegate
{
public :
typedef C4PropertyDelegateC4ValueInputEditor Editor ;
2016-04-17 02:02:24 +00:00
C4PropertyDelegateC4ValueInput ( const C4PropertyDelegateFactory * factory , C4PropList * props ) : C4PropertyDelegate ( factory , props ) { }
2016-04-04 23:34:02 +00:00
2016-05-25 03:06:00 +00:00
void SetEditorData ( QWidget * editor , const C4Value & val , const C4PropertyPath & property_path ) const override ;
2016-07-18 23:24:53 +00:00
void SetModelData ( QObject * editor , const C4PropertyPath & property_path , class C4ConsoleQtShape * prop_shape ) const override ;
2016-07-30 06:37:33 +00:00
QWidget * CreateEditor ( const class C4PropertyDelegateFactory * parent_delegate , QWidget * parent , const QStyleOptionViewItem & option , bool by_selection , bool is_child ) const override ;
2016-08-19 20:12:53 +00:00
bool IsPasteValid ( const C4Value & val ) const override { return true ; }
2016-04-04 03:46:58 +00:00
} ;
2016-04-25 20:17:10 +00:00
// areas shown in viewport
class C4PropertyDelegateShape : public C4PropertyDelegate
{
uint32_t clr ;
2016-08-19 20:12:53 +00:00
virtual void DoPaint ( QPainter * painter , const QRect & inner_rect ) const = 0 ;
2016-04-25 20:17:10 +00:00
public :
C4PropertyDelegateShape ( const class C4PropertyDelegateFactory * factory , C4PropList * props ) ;
2016-05-25 03:06:00 +00:00
void SetEditorData ( QWidget * editor , const C4Value & val , const C4PropertyPath & property_path ) const override { } // TODO maybe implement update?
2016-07-18 23:24:53 +00:00
void SetModelData ( QObject * editor , const C4PropertyPath & property_path , class C4ConsoleQtShape * prop_shape ) const override ;
2016-07-30 06:37:33 +00:00
QWidget * CreateEditor ( const class C4PropertyDelegateFactory * parent_delegate , QWidget * parent , const QStyleOptionViewItem & option , bool by_selection , bool is_child ) const override { return nullptr ; }
2016-07-18 23:24:53 +00:00
const C4PropertyDelegateShape * GetShapeDelegate ( C4Value & val , C4PropertyPath * shape_path ) const override { return this ; }
const C4PropertyDelegateShape * GetDirectShapeDelegate ( ) const override { return this ; }
2016-04-25 20:17:10 +00:00
bool HasCustomPaint ( ) const override { return true ; }
2016-07-18 23:24:53 +00:00
bool Paint ( QPainter * painter , const QStyleOptionViewItem & option , const C4Value & val ) const override ;
2016-07-30 18:50:07 +00:00
QString GetDisplayString ( const C4Value & v , class C4Object * obj , bool short_names ) const override { return QString ( ) ; }
2016-04-25 20:17:10 +00:00
} ;
2016-08-19 20:12:53 +00:00
class C4PropertyDelegateRect : public C4PropertyDelegateShape
{
C4RefCntPointer < C4String > storage ;
void DoPaint ( QPainter * painter , const QRect & inner_rect ) const override ;
public :
C4PropertyDelegateRect ( const class C4PropertyDelegateFactory * factory , C4PropList * props ) ;
bool IsPasteValid ( const C4Value & val ) const override ;
} ;
class C4PropertyDelegateCircle : public C4PropertyDelegateShape
{
bool can_move_center ;
void DoPaint ( QPainter * painter , const QRect & inner_rect ) const override ;
public :
C4PropertyDelegateCircle ( const class C4PropertyDelegateFactory * factory , C4PropList * props ) ;
bool IsPasteValid ( const C4Value & val ) const override ;
} ;
class C4PropertyDelegatePoint : public C4PropertyDelegateShape
{
void DoPaint ( QPainter * painter , const QRect & inner_rect ) const override ;
public :
C4PropertyDelegatePoint ( const class C4PropertyDelegateFactory * factory , C4PropList * props ) ;
bool IsPasteValid ( const C4Value & val ) const override ;
} ;
2016-11-02 13:24:14 +00:00
class C4PropertyDelegateGraph : public C4PropertyDelegateShape
{
C4RefCntPointer < C4String > storage ;
void DoPaint ( QPainter * painter , const QRect & inner_rect ) const override ;
protected :
bool IsVertexPasteValid ( const C4Value & val ) const ;
bool IsEdgePasteValid ( const C4Value & val ) const ;
public :
C4PropertyDelegateGraph ( const class C4PropertyDelegateFactory * factory , C4PropList * props ) ;
bool IsPasteValid ( const C4Value & val ) const override ;
} ;
class C4PropertyDelegatePolyline : public C4PropertyDelegateGraph
{
void DoPaint ( QPainter * painter , const QRect & inner_rect ) const override ;
public :
C4PropertyDelegatePolyline ( const class C4PropertyDelegateFactory * factory , C4PropList * props ) ;
bool IsPasteValid ( const C4Value & val ) const override ;
} ;
class C4PropertyDelegatePolygon : public C4PropertyDelegateGraph
{
void DoPaint ( QPainter * painter , const QRect & inner_rect ) const override ;
public :
C4PropertyDelegatePolygon ( const class C4PropertyDelegateFactory * factory , C4PropList * props ) ;
bool IsPasteValid ( const C4Value & val ) const override ;
} ;
2016-04-04 03:46:58 +00:00
class C4PropertyDelegateFactory : public QStyledItemDelegate
{
Q_OBJECT
2016-06-08 04:37:48 +00:00
mutable std : : map < C4PropList * , std : : unique_ptr < C4PropertyDelegate > > delegates ;
2016-10-14 14:49:14 +00:00
mutable C4PropertyDelegateEffect effect_delegate ;
2016-05-23 23:22:05 +00:00
mutable QWidget * current_editor ;
2016-06-06 05:54:05 +00:00
mutable C4PropertyDelegate * current_editor_delegate ;
2016-06-03 05:20:43 +00:00
mutable C4Value last_edited_value ;
2016-05-25 03:06:00 +00:00
class C4ConsoleQtPropListModel * property_model ;
2016-06-16 01:57:59 +00:00
class C4ConsoleQtDefinitionListModel * def_list_model ;
2016-04-04 03:46:58 +00:00
2016-06-08 04:37:48 +00:00
C4PropertyDelegate * CreateDelegateByPropList ( C4PropList * props ) const ;
2016-04-04 03:46:58 +00:00
C4PropertyDelegate * GetDelegateByIndex ( const QModelIndex & index ) const ;
public :
2016-10-14 14:49:14 +00:00
C4PropertyDelegateFactory ( ) ;
2016-04-04 03:46:58 +00:00
~ C4PropertyDelegateFactory ( ) { }
C4PropertyDelegate * GetDelegateByValue ( const C4Value & val ) const ;
2016-10-14 14:49:14 +00:00
C4PropertyDelegateEffect * GetEffectDelegate ( ) const { return & effect_delegate ; }
2016-04-04 03:46:58 +00:00
void ClearDelegates ( ) ;
2016-04-25 20:17:10 +00:00
void SetPropertyData ( const C4PropertyDelegate * d , QObject * editor , C4ConsoleQtPropListModelProperty * editor_prop ) const ;
2016-05-25 03:06:00 +00:00
void SetPropertyModel ( class C4ConsoleQtPropListModel * new_property_model ) { property_model = new_property_model ; }
2016-06-16 01:57:59 +00:00
void SetDefinitionListModel ( class C4ConsoleQtDefinitionListModel * new_def_list_model ) { def_list_model = new_def_list_model ; }
class C4ConsoleQtDefinitionListModel * GetDefinitionListModel ( ) const { return def_list_model ; }
2016-05-25 03:06:00 +00:00
class C4ConsoleQtPropListModel * GetPropertyModel ( ) const { return property_model ; }
2016-06-03 05:20:43 +00:00
void OnPropListChanged ( ) ;
2016-06-06 05:54:05 +00:00
bool CheckCurrentEditor ( C4PropertyDelegate * d , QWidget * editor ) const ;
2016-04-04 03:46:58 +00:00
private :
void EditorValueChanged ( QWidget * editor ) ;
void EditingDone ( QWidget * editor ) ;
2016-08-19 20:12:53 +00:00
void CopyToClipboard ( const QModelIndex & index ) ;
bool PasteFromClipboard ( const QModelIndex & index , bool check_only ) ;
2016-04-04 03:46:58 +00:00
protected :
2016-04-25 20:17:10 +00:00
// Model callbacks forwarded to actual delegates
2016-04-04 03:46:58 +00:00
void setEditorData ( QWidget * editor , const QModelIndex & index ) const override ;
void setModelData ( QWidget * editor , QAbstractItemModel * model , const QModelIndex & index ) const override ;
QWidget * createEditor ( QWidget * parent , const QStyleOptionViewItem & option , const QModelIndex & index ) const override ;
2016-05-23 23:22:05 +00:00
void destroyEditor ( QWidget * editor , const QModelIndex & index ) const override ;
2016-04-04 03:46:58 +00:00
void updateEditorGeometry ( QWidget * editor , const QStyleOptionViewItem & option , const QModelIndex & index ) const override ;
2016-04-09 18:20:31 +00:00
QSize sizeHint ( const QStyleOptionViewItem & option , const QModelIndex & index ) const override ;
2016-04-25 20:17:10 +00:00
void paint ( QPainter * painter , const QStyleOptionViewItem & option , const QModelIndex & index ) const override ;
2016-08-19 20:12:53 +00:00
bool editorEvent ( QEvent * event , QAbstractItemModel * model , const QStyleOptionViewItem & option , const QModelIndex & index ) ;
2016-04-25 20:17:10 +00:00
} ;
2016-07-25 05:05:15 +00:00
// Delegate for the name column of the property window
// For now, just use the default + help button
2016-07-28 02:35:11 +00:00
class C4PropertyNameDelegate : public C4StyledItemDelegateWithButton
2016-07-25 03:00:24 +00:00
{
Q_OBJECT
class C4ConsoleQtPropListModel * property_model ;
public :
2016-07-28 02:35:11 +00:00
C4PropertyNameDelegate ( ) : C4StyledItemDelegateWithButton ( C4StyledItemDelegateWithButton : : BT_Help ) , property_model ( nullptr ) { }
2016-07-25 03:00:24 +00:00
void SetPropertyModel ( class C4ConsoleQtPropListModel * new_property_model ) { property_model = new_property_model ; }
} ;
2016-04-25 20:17:10 +00:00
// One property in the prop list model view
struct C4ConsoleQtPropListModelProperty
{
C4PropertyPath property_path ;
2016-05-28 13:30:54 +00:00
C4Value parent_value ;
2016-04-25 20:17:10 +00:00
C4RefCntPointer < C4String > display_name ;
2016-07-25 03:00:24 +00:00
C4RefCntPointer < C4String > help_text ;
2016-04-25 20:17:10 +00:00
C4RefCntPointer < C4String > key ;
C4Value delegate_info ;
C4PropertyDelegate * delegate ;
bool about_to_edit ;
2016-08-02 05:06:24 +00:00
int32_t priority ;
2016-04-25 20:17:10 +00:00
// Parent group index
int32_t group_idx ;
// Each property may be connected to one shape shown in the viewport for editing
C4ConsoleQtShapeHolder shape ;
const C4PropertyDelegate * shape_delegate ;
2016-07-18 23:24:53 +00:00
C4PropertyPath shape_property_path ;
2016-04-25 20:17:10 +00:00
2016-08-02 05:06:24 +00:00
C4ConsoleQtPropListModelProperty ( ) : delegate ( nullptr ) , about_to_edit ( false ) , priority ( 0 ) , group_idx ( - 1 ) , shape_delegate ( nullptr ) { }
2016-04-04 03:46:58 +00:00
} ;
2016-02-12 04:37:13 +00:00
// Prop list view implemented as a model view
2016-04-04 03:46:58 +00:00
class C4ConsoleQtPropListModel : public QAbstractItemModel
2016-02-12 04:37:13 +00:00
{
Q_OBJECT
2016-04-04 03:46:58 +00:00
public :
2016-04-25 20:17:10 +00:00
typedef C4ConsoleQtPropListModelProperty Property ;
2016-04-17 02:02:24 +00:00
struct PropertyGroup
{
QString name ;
std : : vector < Property > props ;
2016-04-04 03:46:58 +00:00
} ;
2016-05-25 03:06:00 +00:00
struct TargetStackEntry // elements of the path for setting child properties
{
C4PropertyPath path ;
// TODO: Would be nice to store only path without values and info_proplist. However, info_proplist is hard to resolve when traversing up
// So just keep the value for now and hope that proplists do not change during selection
C4Value value , info_proplist ;
2016-07-13 21:18:08 +00:00
TargetStackEntry ( const C4PropertyPath & path , const C4Value & value , const C4Value & info_proplist )
: path ( path ) , value ( value ) , info_proplist ( info_proplist ) { }
2016-05-25 03:06:00 +00:00
} ;
2016-06-08 04:37:48 +00:00
struct EditedPath // Information about how to find currently edited element (to restore after model update)
{
C4PropertyPath target_path ;
int32_t major_index , minor_index ;
} ;
2016-04-04 03:46:58 +00:00
private :
2016-05-28 13:30:54 +00:00
C4Value target_value ; // Target value for which properties are listed (either proplist or array)
2016-05-25 03:06:00 +00:00
C4Value base_proplist ; // Parent-most value, i.e. object or effect selected in editor through
C4Value info_proplist ; // Proplist from which available properties are derived. May differ from target_proplist in child proplists.
C4PropertyPath target_path ; // script path to target proplist to set values
std : : list < TargetStackEntry > target_path_stack ; // stack of target paths descended into by setting child properties
2016-04-17 02:02:24 +00:00
std : : vector < PropertyGroup > property_groups ;
2016-08-02 05:06:24 +00:00
QFont header_font , important_property_font ;
2016-04-17 02:02:24 +00:00
C4PropertyDelegateFactory * delegate_factory ;
2016-06-03 05:20:43 +00:00
QItemSelectionModel * selection_model ;
2016-06-08 04:37:48 +00:00
bool layout_valid ; // set to false when property numbers change
2016-02-12 04:37:13 +00:00
public :
2016-04-17 02:02:24 +00:00
C4ConsoleQtPropListModel ( C4PropertyDelegateFactory * delegate_factory ) ;
2016-02-12 04:37:13 +00:00
~ C4ConsoleQtPropListModel ( ) ;
2016-06-03 05:20:43 +00:00
void SetSelectionModel ( QItemSelectionModel * m ) { selection_model = m ; }
2016-08-19 20:12:53 +00:00
QItemSelectionModel * GetSelectionModel ( ) const { return selection_model ; }
2016-06-03 05:20:43 +00:00
2016-07-30 05:05:12 +00:00
bool AddPropertyGroup ( C4PropList * add_proplist , int32_t group_index , QString name , C4PropList * ignore_overridden , C4Object * base_object , C4String * default_selection , int32_t * default_selection_index ) ;
2016-10-14 14:49:14 +00:00
bool AddEffectGroup ( int32_t group_index , C4Object * base_object ) ;
2016-05-25 03:06:00 +00:00
void SetBasePropList ( C4PropList * new_proplist ) ; // Clear stack and select new proplist
2016-07-13 21:18:08 +00:00
void DescendPath ( const C4Value & new_value , C4PropList * new_info_proplist , const C4PropertyPath & new_path ) ; // Add proplist to stack
2016-05-25 03:06:00 +00:00
void AscendPath ( ) ; // go back one element in target path stack
2016-06-03 05:20:43 +00:00
void UpdateValue ( bool select_default ) ;
2016-05-28 13:30:54 +00:00
private :
2016-06-03 05:20:43 +00:00
int32_t UpdateValuePropList ( C4PropList * target_proplist , int32_t * default_selection_group , int32_t * default_selection_index ) ;
int32_t UpdateValueArray ( C4ValueArray * target_array , int32_t * default_selection_group , int32_t * default_selection_index ) ;
signals :
void ProplistChanged ( int32_t major_sel , int32_t minor_sel ) const ;
private slots :
void UpdateSelection ( int32_t major_sel , int32_t minor_sel ) const ;
2016-05-28 13:30:54 +00:00
public :
class C4PropList * GetTargetPropList ( ) const { return target_value . getPropList ( ) ; }
class C4ValueArray * GetTargetArray ( ) const { return target_value . getArray ( ) ; }
2016-05-25 03:06:00 +00:00
class C4PropList * GetBasePropList ( ) const { return base_proplist . getPropList ( ) ; }
int32_t GetTargetPathStackSize ( ) const { return target_path_stack . size ( ) ; }
2016-07-23 05:40:51 +00:00
const char * GetTargetPathText ( ) const { return target_path . GetGetPath ( ) ; }
2016-10-10 20:27:43 +00:00
QString GetTargetPathHelp ( ) const ;
2016-07-28 02:35:11 +00:00
const char * GetTargetPathName ( ) const ;
2016-06-06 05:54:05 +00:00
bool IsArray ( ) const { return ! ! target_value . getArray ( ) ; }
void AddArrayElement ( ) ;
void RemoveArrayElement ( ) ;
bool IsTargetReadonly ( ) const ;
2016-07-06 02:53:41 +00:00
C4ConsoleQtPropListModel : : Property * GetPropByIndex ( const QModelIndex & index ) const ;
2016-02-12 04:37:13 +00:00
2016-04-09 18:20:31 +00:00
public :
2016-06-03 05:20:43 +00:00
int rowCount ( const QModelIndex & parent = QModelIndex ( ) ) const override ;
int columnCount ( const QModelIndex & parent = QModelIndex ( ) ) const override ;
QVariant headerData ( int section , Qt : : Orientation orientation , int role = Qt : : DisplayRole ) const override ;
QVariant data ( const QModelIndex & index , int role = Qt : : DisplayRole ) const override ;
2016-04-04 03:46:58 +00:00
QModelIndex index ( int row , int column , const QModelIndex & parent ) const override ;
QModelIndex parent ( const QModelIndex & index ) const override ;
Qt : : ItemFlags flags ( const QModelIndex & index ) const override ;
2016-06-03 05:20:43 +00:00
Qt : : DropActions supportedDropActions ( ) const override ;
bool dropMimeData ( const QMimeData * data , Qt : : DropAction action , int row , int column , const QModelIndex & parent ) override ;
QStringList mimeTypes ( ) const override ;
QMimeData * mimeData ( const QModelIndexList & indexes ) const override ;
2016-02-12 04:37:13 +00:00
} ;
# endif // WITH_QT_EDITOR
# endif // INC_C4ConsoleQtPropListViewer