3#include <QtCore/QObject>
5#include <QtQmlIntegration/QtQmlIntegration>
44 int rowCount (
const QModelIndex & parent = QModelIndex())
const override;
45 int columnCount (
const QModelIndex &parent = QModelIndex())
const override;
46 QVariant
data (
const QModelIndex & index,
int role = Qt::DisplayRole)
const override;
47 QVariant
headerData (
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const override;
48 QHash<int, QByteArray>
roleNames(
void)
const override;
54 bool _isResetting()
const {
return _resetNestingCount > 0; }
56 int _tableViewColCount = 4;
57 QList<ColumnData> _tableData;
58 uint _resetNestingCount = 0;
68 Q_PROPERTY(QString
name MEMBER
name CONSTANT)
85 Q_PROPERTY(QString
name MEMBER
name CONSTANT)
103 Q_PROPERTY(QString
name MEMBER
name CONSTANT)
108 Q_PROPERTY(QString
units MEMBER
units CONSTANT)
130 Q_PROPERTY(QString searchText MEMBER _searchText NOTIFY searchTextChanged)
132 Q_PROPERTY(QObject* currentCategory READ currentCategory WRITE setCurrentCategory NOTIFY currentCategoryChanged)
133 Q_PROPERTY(QObject* currentGroup READ currentGroup WRITE setCurrentGroup NOTIFY currentGroupChanged)
134 Q_PROPERTY(QAbstractTableModel* parameters MEMBER _parameters NOTIFY parametersChanged)
135 Q_PROPERTY(
bool showModifiedOnly MEMBER _showModifiedOnly NOTIFY showModifiedOnlyChanged)
136 Q_PROPERTY(
bool showFavoritesOnly MEMBER _showFavoritesOnly NOTIFY showFavoritesOnlyChanged)
137 Q_PROPERTY(
bool hideReadOnly MEMBER _hideReadOnly NOTIFY hideReadOnlyChanged)
138 Q_PROPERTY(QStringList favoriteParameterNames READ favoriteParameterNames NOTIFY favoritesChanged)
141 Q_PROPERTY(
bool diffOtherVehicle READ diffOtherVehicle NOTIFY diffOtherVehicleChanged)
142 Q_PROPERTY(
bool diffMultipleComponents READ diffMultipleComponents NOTIFY diffMultipleComponentsChanged)
144 Q_PROPERTY(
int diffParsedCount READ diffParsedCount NOTIFY diffParsedCountChanged)
145 Q_PROPERTY(
int diffUnchangedCount READ diffUnchangedCount NOTIFY diffUnchangedCountChanged)
146 Q_PROPERTY(
int diffReadOnlyCount READ diffReadOnlyCount NOTIFY diffReadOnlyCountChanged)
147 Q_PROPERTY(
int diffNoVehicleCount READ diffNoVehicleCount NOTIFY diffNoVehicleCountChanged)
148 Q_PROPERTY(
int diffSendableCount READ diffSendableCount NOTIFY diffSendableCountChanged)
149 Q_PROPERTY(
int diffSelectedCount READ diffSelectedCount NOTIFY diffSelectedCountChanged)
150 Q_PROPERTY(QStringList diffMissingParams READ diffMissingParams NOTIFY diffMissingParamsChanged)
156 Q_INVOKABLE
void saveToFile (
const QString& filename);
157 Q_INVOKABLE
bool buildDiffFromFile (
const QString& filename);
158 Q_INVOKABLE
void clearDiff (
void);
159 Q_INVOKABLE
void sendDiff (
void);
160 Q_INVOKABLE
void refresh (
void);
161 Q_INVOKABLE
void resetAllToDefaults (
void);
162 Q_INVOKABLE
void resetAllToVehicleConfiguration (
void);
163 Q_INVOKABLE
void toggleFavorite (
const QString& paramName);
164 Q_INVOKABLE
bool isFavorite (
const QString& paramName)
const;
165 Q_INVOKABLE
void clearAllFavorites (
void);
180 QStringList favoriteParameterNames (
void)
const;
181 void setCurrentCategory (QObject* currentCategory);
182 void setCurrentGroup (QObject* currentGroup);
204 void _currentCategoryChanged(
void);
205 void _currentGroupChanged (
void);
206 void _searchTextChanged (
void);
207 void _hideReadOnlyChanged (
void);
208 void _buildLists (
void);
209 void _buildListsForComponent(
int compId);
210 void _factAdded (
int compId,
Fact* fact);
213 bool _shouldShow(
Fact *fact)
const;
214 void _performSearch();
215 void _loadFavorites();
216 void _saveFavorites();
217 void _updateDiffSelectedCount();
220 template <
typename T,
typename SignalFn>
221 void _setDiffProperty(T& member,
const T& value, SignalFn changedSignal);
228 bool _showModifiedOnly =
false;
229 bool _showFavoritesOnly =
false;
230 bool _hideReadOnly =
false;
231 bool _diffOtherVehicle =
false;
232 bool _diffMultipleComponents =
false;
233 int _diffParsedCount = 0;
234 int _diffUnchangedCount = 0;
235 int _diffReadOnlyCount = 0;
236 int _diffNoVehicleCount = 0;
237 int _diffSendableCount = 0;
238 int _diffSelectedCount = 0;
239 QStringList _diffMissingParams;
240 QSet<QString> _favoriteNames;
245 QAbstractTableModel* _parameters =
nullptr;
246 QMap<QString, ParameterEditorCategory*> _mapCategoryName2Category;
Used for handling missing Facts from C++ code.
A Fact is used to hold a single value within the system.
QMap< QString, ParameterEditorGroup * > mapGroupName2Group
QmlObjectListModel groups
ParameterEditorCategory(QObject *parent)
QmlObjectListModel * getGroups(void)
void diffMissingParamsChanged(const QStringList &diffMissingParams)
QStringList diffMissingParams(void) const
void showFavoritesOnlyChanged(void)
void parametersChanged(void)
int diffParsedCount(void) const
void currentGroupChanged(void)
int diffSendableCount(void) const
void diffSelectedCountChanged(int diffSelectedCount)
QmlObjectListModel * diffList(void)
QmlObjectListModel * categories(void)
void diffMultipleComponentsChanged(bool diffMultipleComponents)
QObject * currentCategory(void)
void diffParsedCountChanged(int diffParsedCount)
void diffReadOnlyCountChanged(int diffReadOnlyCount)
int diffReadOnlyCount(void) const
void diffNoVehicleCountChanged(int diffNoVehicleCount)
int diffSelectedCount(void) const
void diffUnchangedCountChanged(int diffUnchangedCount)
void searchTextChanged(QString searchText)
void currentCategoryChanged(void)
void diffOtherVehicleChanged(bool diffOtherVehicle)
void diffSendableCountChanged(int diffSendableCount)
void favoritesChanged(void)
int diffNoVehicleCount(void) const
bool diffMultipleComponents(void) const
bool diffOtherVehicle(void) const
void showModifiedOnlyChanged(void)
int diffUnchangedCount(void) const
QObject * currentGroup(void)
void hideReadOnlyChanged(void)
bool cannotSend
Param not on vehicle and file has no type info (MP format) - shown but never sent.
void loadChanged(bool load)
FactMetaData::ValueType_t valueType
ParameterEditorDiff(QObject *parent)
QAbstractTableModel * getFacts(void)
ParameterTableModel facts
QVector< QVariant > ColumnData
void insert(int row, Fact *fact)
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
QHash< int, QByteArray > roleNames(void) const override
~ParameterTableModel() override
void rowCountChanged(int count)
void endReset()
Supports nesting - only outermost call has effect.
void beginReset()
Supports nesting - only outermost call has effect.
Fact * factAt(int row) const