Differential D1047 Diff 2606 languages/plugins/custom-definesandincludes/kcm_widget/projectpathsmodel.cpp
Changeset View
Changeset View
Standalone View
Standalone View
languages/plugins/custom-definesandincludes/kcm_widget/projectpathsmodel.cpp
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | 39 | { | |||
---|---|---|---|---|---|
59 | } | 59 | } | ||
60 | case FullUrlDataRole: | 60 | case FullUrlDataRole: | ||
61 | return QVariant::fromValue(QUrl::fromUserInput( sanitizePath( pathConfig.path, true, false ) )); | 61 | return QVariant::fromValue(QUrl::fromUserInput( sanitizePath( pathConfig.path, true, false ) )); | ||
62 | break; | 62 | break; | ||
63 | case CompilerDataRole: | 63 | case CompilerDataRole: | ||
64 | return QVariant::fromValue(pathConfig.compiler); | 64 | return QVariant::fromValue(pathConfig.compiler); | ||
65 | break; | 65 | break; | ||
66 | case ParserArgumentsRole: | 66 | case ParserArgumentsRole: | ||
67 | return pathConfig.parserArguments; | 67 | return QVariant::fromValue(pathConfig.parserArguments); | ||
68 | break; | 68 | break; | ||
69 | default: | 69 | default: | ||
70 | break; | 70 | break; | ||
71 | } | 71 | } | ||
72 | return QVariant(); | 72 | return QVariant(); | ||
73 | } | 73 | } | ||
74 | 74 | | |||
75 | int ProjectPathsModel::rowCount( const QModelIndex& parent ) const | 75 | int ProjectPathsModel::rowCount( const QModelIndex& parent ) const | ||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | 115 | case Qt::DisplayRole: | |||
117 | break; | 117 | break; | ||
118 | case FullUrlDataRole: | 118 | case FullUrlDataRole: | ||
119 | pathConfig.path = sanitizeUrl( value.value<QUrl>() ); | 119 | pathConfig.path = sanitizeUrl( value.value<QUrl>() ); | ||
120 | break; | 120 | break; | ||
121 | case CompilerDataRole: | 121 | case CompilerDataRole: | ||
122 | pathConfig.compiler = value.value<CompilerPointer>(); | 122 | pathConfig.compiler = value.value<CompilerPointer>(); | ||
123 | break; | 123 | break; | ||
124 | case ParserArgumentsRole: | 124 | case ParserArgumentsRole: | ||
125 | pathConfig.parserArguments = value.toString(); | 125 | pathConfig.parserArguments = value.value<ParserArguments>(); | ||
126 | break; | 126 | break; | ||
127 | default: | 127 | default: | ||
128 | return false; | 128 | return false; | ||
129 | break; | 129 | break; | ||
130 | } | 130 | } | ||
131 | emit dataChanged( index, index ); | 131 | emit dataChanged( index, index ); | ||
132 | return true; | 132 | return true; | ||
133 | } | 133 | } | ||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 187 | { | |||
191 | 191 | | |||
192 | beginInsertRows( QModelIndex(), rowCount(), rowCount() ); | 192 | beginInsertRows( QModelIndex(), rowCount(), rowCount() ); | ||
193 | addPathInternal( sanitizeUrl(url), false ); | 193 | addPathInternal( sanitizeUrl(url), false ); | ||
194 | endInsertRows(); | 194 | endInsertRows(); | ||
195 | } | 195 | } | ||
196 | 196 | | |||
197 | void ProjectPathsModel::addPathInternal( const ConfigEntry& config, bool prepend ) | 197 | void ProjectPathsModel::addPathInternal( const ConfigEntry& config, bool prepend ) | ||
198 | { | 198 | { | ||
199 | Q_ASSERT(!config.parserArguments.isEmpty()); | 199 | Q_ASSERT(!config.parserArguments.cppArguments.isEmpty()); | ||
200 | Q_ASSERT(!config.parserArguments.cArguments.isEmpty()); | ||||
200 | 201 | | |||
201 | // Do not allow duplicates | 202 | // Do not allow duplicates | ||
202 | foreach( const ConfigEntry& existingConfig, projectPaths ) { | 203 | foreach( const ConfigEntry& existingConfig, projectPaths ) { | ||
203 | if( config.path == existingConfig.path ) { | 204 | if( config.path == existingConfig.path ) { | ||
204 | return; | 205 | return; | ||
205 | } | 206 | } | ||
206 | } | 207 | } | ||
207 | if( prepend ) { | 208 | if( prepend ) { | ||
Show All 31 Lines |