diff --git a/Knossos.NET/Models/Mod.cs b/Knossos.NET/Models/Mod.cs
index 967759c7..b33f3d81 100644
--- a/Knossos.NET/Models/Mod.cs
+++ b/Knossos.NET/Models/Mod.cs
@@ -1024,5 +1024,68 @@ public static bool IsMetaUpdate(Mod modA, Mod modB)
}
return null;
}
+
+ ///
+ /// Check to see if a mod has a qtfred build
+ /// used mainly to see if we should create a qtfred button on the mod tiles
+ ///
+ public bool[] IsQtFredAvailable()
+ {
+ FsoBuild? fsoBuild = null;
+
+ /* Resolve Dependencies should be all valid at this point */
+ var dependencyList = GetModDependencyList(false,true);
+ if (dependencyList != null)
+ {
+ foreach (var dep in dependencyList)
+ {
+ var selectedMod = dep.SelectMod();
+ if (selectedMod == null)
+ {
+ /*
+ It has to be the engine dependency ... based on what shivanSPS commented elsewhere - Cyborg
+ */
+ if (fsoBuild == null && modSettings.customBuildId == null)
+ {
+ fsoBuild = dep.SelectBuild(true);
+ }
+ }
+ }
+ }
+
+ if (fsoBuild == null)
+ {
+ if (modSettings.customBuildExec == null)
+ {
+ fsoBuild = Knossos.GetInstalledBuildsList().FirstOrDefault(builds => builds.id == modSettings.customBuildId && builds.version == modSettings.customBuildVersion);
+ }
+ else
+ {
+ fsoBuild = new FsoBuild(modSettings.customBuildExec);
+ }
+ }
+
+ bool[] result = { false, false };
+
+ if (fsoBuild == null)
+ {
+ return result;
+ }
+
+ var exe = fsoBuild.GetExecutable(FsoExecType.QtFred);
+ var exe2 = fsoBuild.GetExecutable(FsoExecType.QtFredDebug);
+
+ if (exe != null)
+ {
+ result[0] = true;
+ }
+
+ if (exe != null)
+ {
+ result[1] = true;
+ }
+
+ return result;
+ }
}
}
diff --git a/Knossos.NET/ViewModels/CustomHomeViewModel.cs b/Knossos.NET/ViewModels/CustomHomeViewModel.cs
index ebc8dcd6..a1bf4204 100644
--- a/Knossos.NET/ViewModels/CustomHomeViewModel.cs
+++ b/Knossos.NET/ViewModels/CustomHomeViewModel.cs
@@ -86,6 +86,11 @@ private Mod? GetActiveInstalledModVersion
///
[ObservableProperty]
public ViewModelBase? taskVM;
+ [ObservableProperty]
+ internal bool isQtFredAvailable = false;
+ [ObservableProperty]
+ internal bool isQtFredDebugAvailable = false;
+
public CustomHomeViewModel()
{
@@ -523,5 +528,19 @@ internal void ChangeBasePath()
ShowBasePathSelector = false;
}
}
+
+ public void RefreshQtFredAvailability()
+ {
+ var bools = modVersions[ActiveVersionIndex].IsQtFredAvailable();
+
+ if (bools == null || bools.Length < 2){
+ IsQtFredAvailable = false;
+ IsQtFredDebugAvailable = false;
+ return;
+ }
+
+ IsQtFredAvailable = bools[0];
+ IsQtFredDebugAvailable = bools[1];
+ }
}
}
diff --git a/Knossos.NET/ViewModels/Templates/ModCardViewModel.cs b/Knossos.NET/ViewModels/Templates/ModCardViewModel.cs
index af330147..7bef91fc 100644
--- a/Knossos.NET/ViewModels/Templates/ModCardViewModel.cs
+++ b/Knossos.NET/ViewModels/Templates/ModCardViewModel.cs
@@ -80,6 +80,10 @@ public bool Visible
internal bool isCustomConfig = false;
[ObservableProperty]
internal bool cardVisible = true;
+ [ObservableProperty]
+ internal bool isQtFredAvailable = false;
+ [ObservableProperty]
+ internal bool isQtFredDebugAvailable = false;
private Bitmap? tileModBitmap;
/* Should only be used by the editor preview */
@@ -176,6 +180,8 @@ await Task.Run(() =>
});
}
}
+
+ RefreshQtFredAvailability();
});
}
@@ -201,6 +207,7 @@ public void SwitchModVersion(int newIndex)
LoadImage();
CheckDependencyActiveVersion();
RefreshSpecialIcons();
+ RefreshQtFredAvailability();
}
}
@@ -253,6 +260,20 @@ public void RefreshSpecialIcons()
IsCustomConfig = !modVersions[activeVersionIndex].modSettings.IsDefaultConfig();
}
+ public void RefreshQtFredAvailability()
+ {
+ var bools = modVersions[activeVersionIndex].IsQtFredAvailable();
+
+ if (bools == null || bools.Length < 2){
+ IsQtFredAvailable = false;
+ IsQtFredDebugAvailable = false;
+ return;
+ }
+
+ IsQtFredAvailable = bools[0];
+ IsQtFredDebugAvailable = bools[1];
+ }
+
/* Button Commands */
internal void ButtonCommand(object command)
{
diff --git a/Knossos.NET/Views/CustomHomeView.axaml b/Knossos.NET/Views/CustomHomeView.axaml
index 5c39e931..b98ef0e5 100644
--- a/Knossos.NET/Views/CustomHomeView.axaml
+++ b/Knossos.NET/Views/CustomHomeView.axaml
@@ -76,10 +76,10 @@
-
+
-
+
diff --git a/Knossos.NET/Views/Templates/ModCardView.axaml b/Knossos.NET/Views/Templates/ModCardView.axaml
index d1e288ed..5542fb96 100644
--- a/Knossos.NET/Views/Templates/ModCardView.axaml
+++ b/Knossos.NET/Views/Templates/ModCardView.axaml
@@ -57,8 +57,8 @@
-
-
+
+
@@ -69,7 +69,7 @@
-
+