KiCad PCB EDA Suite
Loading...
Searching...
No Matches
model_preview_manager_windows_classifier.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-3.0.html
19 */
20
22
23
24namespace
25{
26bool Uncertain( MODEL_PREVIEW_OBSERVATION aValue )
27{
29}
30
31bool Damaged( MODEL_PREVIEW_OBSERVATION aValue )
32{
34}
35} // namespace
36
37
39{
41 status.bundledVersion = aSnapshot.bundledVersion;
42 status.registeredVersion = aSnapshot.registeredVersion;
43 status.requirementId = aSnapshot.requirementId;
44
45 if( !aSnapshot.bundledPresent )
46 {
50 status.detail = wxS( "The bundled Windows preview handler is missing." );
51 return status;
52 }
53
54 if( Uncertain( aSnapshot.module ) || Uncertain( aSnapshot.associations ) || Uncertain( aSnapshot.surrogate )
55 || Uncertain( aSnapshot.classMetadata ) || Uncertain( aSnapshot.previewList ) )
56 {
60 status.detail = wxS( "Windows preview registration could not be read." );
61 return status;
62 }
63
64 if( aSnapshot.foreignOwner || ( aSnapshot.module == MODEL_PREVIEW_OBSERVATION::PRESENT && !aSnapshot.sameModule ) )
65 {
69 status.detail = wxS( "A different Windows preview handler owns this registration." );
70 return status;
71 }
72
73 if( aSnapshot.module == MODEL_PREVIEW_OBSERVATION::MISSING )
74 {
78 status.detail = wxS( "Windows model previews are not registered for this user." );
79 status.canRepairRegistration = true;
80 return status;
81 }
82
83 if( aSnapshot.registeredVersion != aSnapshot.bundledVersion )
84 {
88 status.detail = wxS( "The registered Windows preview handler version does not match this KiCad installation." );
89 status.canRepairRegistration = true;
90 return status;
91 }
92
93 if( aSnapshot.module == MODEL_PREVIEW_OBSERVATION::MALFORMED || Damaged( aSnapshot.associations )
94 || Damaged( aSnapshot.surrogate ) || Damaged( aSnapshot.classMetadata ) || Damaged( aSnapshot.previewList ) )
95 {
99 status.detail = wxS( "Windows model preview registration is incomplete." );
100 status.canRepairRegistration = true;
101 return status;
102 }
103
106 status.detail = wxS( "Windows model previews are registered." );
107 return status;
108}
MODEL_PREVIEW_STATUS ClassifyWindowsModelPreviewStatus(const WINDOWS_MODEL_PREVIEW_SNAPSHOT &aSnapshot)
MODEL_PREVIEW_ENABLEMENT_STATE enablement
MODEL_PREVIEW_GUIDANCE guidance
MODEL_PREVIEW_COMPONENT_STATE component