editor: added manual menu item

This commit is contained in:
Alex Andres 2024-02-26 14:51:43 +01:00
parent 15c27abfd4
commit 3923294b02
No known key found for this signature in database
GPG key ID: 340764C7851D7041
6 changed files with 31 additions and 8 deletions

View file

@ -25,6 +25,7 @@ import com.google.common.eventbus.Subscribe;
import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.nio.file.Path;
import java.text.MessageFormat;
import java.util.ArrayList;
@ -117,6 +118,7 @@ public class MenuPresenter extends Presenter<MenuView> {
view.bindFullscreen(context.fullscreenProperty());
view.setOnManual(this::showManual);
view.setOnOpenLog(this::showLog);
view.setOnOpenAbout(this::showAboutView);
}
@ -395,10 +397,18 @@ public class MenuPresenter extends Presenter<MenuView> {
eventBus.post(new ShowPresenterCommand<>(SettingsPresenter.class));
}
public void showManual() {
try {
Desktop.getDesktop().browse(URI.create("https://lect.stream/manual/de/index.html"));
}
catch (IOException e) {
handleException(e, "Open manual uri failed", "generic.error");
}
}
public void showLog() {
try {
Desktop.getDesktop().open(new File(
context.getDataLocator().getAppDataPath()));
Desktop.getDesktop().open(new File(context.getDataLocator().getAppDataPath()));
}
catch (IOException e) {
handleException(e, "Open log path failed", "generic.error");

View file

@ -86,6 +86,8 @@ public interface MenuView extends View {
* Info Menu
*/
void setOnManual(Action action);
void setOnOpenLog(Action action);
void setOnOpenAbout(Action action);

View file

@ -98,6 +98,9 @@ public class FxMenuView extends MenuBar implements MenuView {
@FXML
private CheckMenuItem fullscreenMenuItem;
@FXML
private MenuItem manualMenuItem;
@FXML
private MenuItem logMenuItem;
@ -262,6 +265,11 @@ public class FxMenuView extends MenuBar implements MenuView {
* Info Menu
*/
@Override
public void setOnManual(Action action) {
FxUtils.bindAction(manualMenuItem, action);
}
@Override
public void setOnOpenLog(Action action) {
FxUtils.bindAction(logMenuItem, action);

View file

@ -33,7 +33,8 @@
<CheckMenuItem fx:id="fullscreenMenuItem" accelerator="alt+enter" text="%menu.fullscreen" />
</Menu>
<Menu text="%menu.info">
<MenuItem fx:id="logMenuItem" text="%menu.log"/>
<MenuItem fx:id="aboutMenuItem" text="%menu.about"/>
<MenuItem fx:id="manualMenuItem" text="%menu.info.manual"/>
<MenuItem fx:id="logMenuItem" text="%menu.info.log"/>
<MenuItem fx:id="aboutMenuItem" text="%menu.info.about"/>
</Menu>
</fx:root>

View file

@ -16,5 +16,6 @@ menu.undo = R\u00fcckgangig
menu.redo = Wiederherstellen
menu.fullscreen = Vollbild
menu.options = Einstellungen
menu.log = Log
menu.about = \u00dcber
menu.info.manual = Benutzeranleitung
menu.info.log = Log
menu.info.about = \u00dcber

View file

@ -16,5 +16,6 @@ menu.undo = Undo
menu.redo = Redo
menu.fullscreen = Fullscreen
menu.options = Settings
menu.log = Log
menu.about = About
menu.info.manual = Manual
menu.info.log = Log
menu.info.about = About