Skip to content

Commit

Permalink
qt-cpp: Show an info message when Scan for Qt Kits is run
Browse files Browse the repository at this point in the history
The current implementation does not show any message when the
`Scan for Qt Kits` is run. This patch adds an info message to inform
the user about found kits.

Change-Id: I4557d5461cd709cb31b88ae49d07b398b3d9a06e
Reviewed-by: Marcus Tillmanns <[email protected]>
  • Loading branch information
OrkunTokdemir committed Sep 16, 2024
1 parent 20da2f1 commit aa397c6
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions qt-cpp/src/kit-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@ export class KitManager {
const newQtInstallations = currentQtInsRoot
? await findQtKits(currentQtInsRoot)
: [];
if (currentQtInsRoot) {
KitManager.showQtInstallationsMessage(
currentQtInsRoot,
newQtInstallations
);
}
project
? await this.updateQtKits(
currentQtInsRoot,
Expand All @@ -219,21 +225,28 @@ export class KitManager {
}
}

private static showQtInstallationsMessage(
qtInsRoot: string,
qtInstallations: string[]
) {
if (qtInstallations.length === 0) {
const warningMessage = `Cannot find a Qt installation in "${qtInsRoot}".`;
void vscode.window.showWarningMessage(warningMessage);
logger.info(warningMessage);
} else {
const infoMessage = `Found ${qtInstallations.length} Qt installation(s) in "${qtInsRoot}".`;
void vscode.window.showInformationMessage(infoMessage);
logger.info(infoMessage);
}
}

public async onQtInstallationRootChanged(
qtInsRoot: string,
workspaceFolder?: vscode.WorkspaceFolder
) {
const qtInstallations = await findQtKits(qtInsRoot);
if (qtInsRoot) {
if (qtInstallations.length === 0) {
const warningMessage = `Cannot find a Qt installation in "${qtInsRoot}".`;
void vscode.window.showWarningMessage(warningMessage);
logger.info(warningMessage);
} else {
const infoMessage = `Found ${qtInstallations.length} Qt installation(s) in "${qtInsRoot}".`;
void vscode.window.showInformationMessage(infoMessage);
logger.info(infoMessage);
}
KitManager.showQtInstallationsMessage(qtInsRoot, qtInstallations);
}
await this.updateQtKits(qtInsRoot, qtInstallations, workspaceFolder);
}
Expand Down

0 comments on commit aa397c6

Please sign in to comment.