Skip to content
Snippets Groups Projects
Commit 4d6d491f authored by David Bühler's avatar David Bühler Committed by Remi Lazarini
Browse files

[Ivette] Help modal uses version and codename from the getConfig request.

parent 1d5cad7d
No related branches found
No related tags found
No related merge requests found
...@@ -26,11 +26,12 @@ import { Hbox } from 'dome/layout/boxes'; ...@@ -26,11 +26,12 @@ import { Hbox } from 'dome/layout/boxes';
import { shell } from 'electron'; import { shell } from 'electron';
import { Button } from 'dome/controls/buttons'; import { Button } from 'dome/controls/buttons';
import * as Server from 'frama-c/server';
import * as Dialogs from 'dome/dialogs';
import { getConfig } from 'frama-c/kernel/api/services';
import './style.css'; import './style.css';
import framacImage from './frama-c.png'; import framacImage from './frama-c.png';
import vNumber from '../../../VERSION?raw';
import vCodename from '../../../VERSION_CODENAME?raw';
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* --- Frama-C infos --- */ /* --- Frama-C infos --- */
...@@ -38,7 +39,6 @@ import vCodename from '../../../VERSION_CODENAME?raw'; ...@@ -38,7 +39,6 @@ import vCodename from '../../../VERSION_CODENAME?raw';
const synopsis = 'Frama-C is a suite of tools dedicated to the analysis of the\ const synopsis = 'Frama-C is a suite of tools dedicated to the analysis of the\
source code of software written in C.'; source code of software written in C.';
const version = `${vNumber} (${vCodename})`.replace(/[\r\n]/g, '');
const description = '\ const description = '\
Frama-C gathers several analysis techniques in a single collaborative\ Frama-C gathers several analysis techniques in a single collaborative\
framework, based on analyzers (called "plug-ins") that can build upon the\ framework, based on analyzers (called "plug-ins") that can build upon the\
...@@ -136,13 +136,17 @@ function FramaCLogo(): JSX.Element { ...@@ -136,13 +136,17 @@ function FramaCLogo(): JSX.Element {
); );
} }
export function getAbout(): JSX.Element { interface AboutProps {
version: string;
}
function AboutModal(props: AboutProps): JSX.Element {
return ( return (
<Modal className='modal-framac-infos' label='About Frama-C'> <Modal className='modal-framac-infos' label='About Frama-C'>
<> <>
<FramaCLogo /> <FramaCLogo />
<Hbox className='modal-framac-about'> <Hbox className='modal-framac-about'>
<pre>version: {version}</pre> <pre>version: {props.version}</pre>
<pre>{synopsis}</pre> <pre>{synopsis}</pre>
<Hbox> <Hbox>
<Button <Button
...@@ -167,7 +171,14 @@ export function getAbout(): JSX.Element { ...@@ -167,7 +171,14 @@ export function getAbout(): JSX.Element {
); );
} }
export function getCredits(): JSX.Element { export async function showAboutModal(): Promise<void> {
const config = await Server.send(getConfig, {});
const version = config.version_codename;
const modal = <AboutModal version = {version}/>;
Dialogs.showModal(modal);
}
function CreditsModal(): JSX.Element {
return ( return (
<Modal className='modal-framac-infos' label='Credits'> <Modal className='modal-framac-infos' label='Credits'>
<> <>
...@@ -176,9 +187,14 @@ export function getCredits(): JSX.Element { ...@@ -176,9 +187,14 @@ export function getCredits(): JSX.Element {
<pre style={{ fontSize: '1.2em' }}>Created by:</pre> <pre style={{ fontSize: '1.2em' }}>Created by:</pre>
</Hbox> </Hbox>
<div className='modal-framac-credits'> <div className='modal-framac-credits'>
{authors.map((author, i) => <div key={i} >{ author }</div>)} {authors.map((author, i) => <div key={i} >{author}</div>)}
</div> </div>
</> </>
</Modal> </Modal>
); );
} }
export function showCreditsModal(): void {
const modal = <CreditsModal/>;
Dialogs.showModal(modal);
}
...@@ -160,14 +160,14 @@ export function init(): void { ...@@ -160,14 +160,14 @@ export function init(): void {
menu: 'Help', menu: 'Help',
label: 'About', label: 'About',
id: 'help_about', id: 'help_about',
onClick: () => Dialogs.showModal(HelpMenu.getAbout()), onClick: HelpMenu.showAboutModal,
kind: 'normal', kind: 'normal',
}); });
Dome.addMenuItem({ Dome.addMenuItem({
menu: 'Help', menu: 'Help',
label: 'Credits', label: 'Credits',
id: 'help_credits', id: 'help_credits',
onClick: () => Dialogs.showModal(HelpMenu.getCredits()), onClick: HelpMenu.showCreditsModal,
kind: 'normal', kind: 'normal',
}); });
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment