Skip to content
Snippets Groups Projects
Commit 06f50abc authored by Tobias Ullerich's avatar Tobias Ullerich
Browse files

Fixed #123 - Start automatic playout log sessions

parent 99eddb9b
No related branches found
No related tags found
No related merge requests found
Showing
with 99 additions and 11 deletions
......@@ -38,6 +38,7 @@ public class PlayPadImpl implements PlayPad {
private List<WindowListener<IMainViewController>> mainViewListeners = new ArrayList<>();
private List<SettingsListener> settingsListeners = new ArrayList<>();
private List<PadListener> padListeners = new ArrayList<>();
private List<GlobalListener> globalListeners = new ArrayList<>();
private MainViewController mainViewController;
private Image stageIcon;
......@@ -98,6 +99,21 @@ public class PlayPadImpl implements PlayPad {
return padListeners;
}
@Override
public void addGlobalListener(GlobalListener globalListener) {
globalListeners.add(globalListener);
}
@Override
public void removeGlobalListener(GlobalListener globalListener) {
globalListeners.remove(globalListener);
}
@Override
public List<GlobalListener> getGlobalListeners() {
return globalListeners;
}
@Override
public IMainViewController getMainViewController() {
return mainViewController;
......@@ -150,6 +166,7 @@ public class PlayPadImpl implements PlayPad {
mainViewController = new MainViewController(e -> {
currentProject = project;
mainViewController.openProject(project);
globalListeners.forEach(l -> l.currentProjectDidChanged(project));
if (onLoaded != null) {
onLoaded.accept(e);
}
......@@ -160,9 +177,7 @@ public class PlayPadImpl implements PlayPad {
currentProject = project;
mainViewController.openProject(project);
if (onLoaded != null) {
onLoaded.accept(mainViewController);
}
globalListeners.forEach(l -> l.currentProjectDidChanged(project));
}
}
......
......@@ -3,6 +3,7 @@ package de.tobias.playpad;
import de.thecodelabs.logger.FileOutputOption;
import de.thecodelabs.logger.LogLevelFilter;
import de.thecodelabs.logger.Logger;
import de.thecodelabs.storage.proxy.SettingsProxy;
import de.thecodelabs.storage.settings.UserDefaults;
import de.thecodelabs.utils.application.App;
import de.thecodelabs.utils.application.ApplicationUtils;
......@@ -128,6 +129,7 @@ public class PlayPadMain extends Application {
ProfileReferenceManager.saveProfiles();
ProjectReferenceManager.saveProjects();
impl.getGlobalSettings().save();
SettingsProxy.saveAll();
} catch (Exception e) {
Logger.error(e);
}
......
......@@ -2,6 +2,7 @@ package de.tobias.playpad;
import de.thecodelabs.utils.ui.NVC;
import de.thecodelabs.versionizer.service.UpdateService;
import de.tobias.playpad.plugin.GlobalListener;
import de.tobias.playpad.plugin.PadListener;
import de.tobias.playpad.plugin.SettingsListener;
import de.tobias.playpad.plugin.WindowListener;
......@@ -74,6 +75,12 @@ public interface PlayPad {
*/
List<PadListener> getPadListener();
void addGlobalListener(GlobalListener globalListener);
void removeGlobalListener(GlobalListener globalListener);
List<GlobalListener> getGlobalListeners();
/**
* Gibt eine Refernz auf das Hauptfenster zurück.
*
......
package de.tobias.playpad.plugin;
import de.tobias.playpad.project.Project;
public interface GlobalListener {
void currentProjectDidChanged(Project newProject);
}
......@@ -20,6 +20,8 @@ public class PlayoutLogPlugin implements PlayPadPluginStub, PluginArtifact {
module = new Module(descriptor.getName(), descriptor.getArtifactId());
PlayPadPlugin.getInstance().addMainViewListener(new MainViewControllerListener());
PlayPadPlugin.getInstance().addGlobalListener(new ProjectListener());
PlayOutLogInitializer.init();
Logger.debug("Enable Playout Log Plugin");
......
package de.tobias.playpad.plugin.playout.storage;
import de.thecodelabs.storage.proxy.DefaultBoolean;
import de.thecodelabs.storage.proxy.Setter;
import de.thecodelabs.storage.proxy.Settings;
import de.thecodelabs.storage.settings.annotation.FilePath;
@FilePath("PlayOutLog.json")
public interface PlayoutLogSettings extends Settings {
@DefaultBoolean(false)
boolean autoStartLogging();
@Setter
void autoStartLogging(boolean value);
}
......@@ -2,6 +2,7 @@ package de.tobias.playpad.plugin.playout.viewcontroller;
import com.itextpdf.text.DocumentException;
import de.thecodelabs.logger.Logger;
import de.thecodelabs.storage.proxy.SettingsProxy;
import de.thecodelabs.utils.ui.NVC;
import de.thecodelabs.utils.ui.NVCStage;
import de.thecodelabs.utils.ui.icon.FontAwesomeType;
......@@ -12,12 +13,14 @@ import de.tobias.playpad.log.LogSeason;
import de.tobias.playpad.log.LogSeasons;
import de.tobias.playpad.plugin.playout.Strings;
import de.tobias.playpad.plugin.playout.export.PlayoutLogPdfExport;
import de.tobias.playpad.plugin.playout.storage.PlayoutLogSettings;
import de.tobias.playpad.project.Project;
import de.tobias.playpad.project.ProjectSettings;
import de.tobias.playpad.viewcontroller.main.MenuToolbarViewController;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ListView;
import javafx.scene.control.TextField;
import javafx.stage.FileChooser;
......@@ -43,6 +46,8 @@ public class PlayoutLogViewController extends NVC {
private Button deleteButton;
@FXML
private Button finishButton;
@FXML
private CheckBox autoStartCheckbox;
private FontIcon logIcon;
......@@ -70,6 +75,10 @@ public class PlayoutLogViewController extends NVC {
startButton.setText(Localization.getString(Strings.PLAYOUT_LOG_DIALOG_BUTTON_START));
nameTextField.setDisable(false);
}
autoStartCheckbox.setSelected(SettingsProxy.getSettings(PlayoutLogSettings.class).autoStartLogging());
autoStartCheckbox.selectedProperty().addListener((observable, oldValue, newValue) ->
SettingsProxy.getSettings(PlayoutLogSettings.class).autoStartLogging(newValue));
}
@Override
......@@ -77,8 +86,8 @@ public class PlayoutLogViewController extends NVC {
stage.getIcons().add(PlayPadPlugin.getInstance().getIcon());
stage.setTitle(Localization.getString(Strings.UI_DIALOG_PLAYOUT_LOG_TITLE));
stage.setMinWidth(375);
stage.setMinHeight(400);
stage.setMinWidth(450);
stage.setMinHeight(600);
stage.initModality(Modality.WINDOW_MODAL);
......
......@@ -2,6 +2,7 @@ UI.Dialog.PlayoutLog.Title=PlayoutLog
main.menuitem.log=Playout Log...
PlayoutLogDialog.Label.Headline=PlayOut Log
PlayoutLogDialog.Checkbox.AutoStart=Automatisch Starten bei Programmstart
PlayoutLogDialog.Button.Start=Starten
PlayoutLogDialog.Button.Stop=Stoppen
PlayoutLogDialog.Button.Export=Exportieren...
......
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" spacing="14.0"
xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Label styleClass="headline" text="%PlayoutLogDialog.Label.Headline"/>
<HBox spacing="14.0">
......@@ -20,7 +19,7 @@
<HBox maxWidth="1.7976931348623157E308" spacing="14.0" VBox.vgrow="ALWAYS">
<children>
<ListView fx:id="logList" maxWidth="1.7976931348623157E308" prefHeight="200.0" prefWidth="300.0"
HBox.hgrow="ALWAYS" styleClass="dark-list"/>
styleClass="dark-list" HBox.hgrow="ALWAYS"/>
<VBox maxWidth="1.7976931348623157E308" spacing="14.0" HBox.hgrow="ALWAYS">
<children>
<Button fx:id="exportButton" maxWidth="1.7976931348623157E308" mnemonicParsing="false"
......@@ -33,8 +32,10 @@
</VBox>
</children>
</HBox>
<HBox alignment="TOP_RIGHT">
<HBox alignment="CENTER_LEFT">
<children>
<CheckBox fx:id="autoStartCheckbox" maxWidth="1.7976931348623157E308" mnemonicParsing="false"
text="%PlayoutLogDialog.Checkbox.AutoStart" HBox.hgrow="ALWAYS"/>
<Button fx:id="finishButton" defaultButton="true" mnemonicParsing="false"
onAction="#finishButtonHandler" text="Fertig"/>
</children>
......
package de.tobias.playpad.plugin.playout
import java.text.SimpleDateFormat
import de.thecodelabs.logger.Logger
import de.thecodelabs.storage.proxy.SettingsProxy
import de.tobias.playpad.log.LogSeasons
import de.tobias.playpad.plugin.GlobalListener
import de.tobias.playpad.plugin.playout.storage.PlayoutLogSettings
import de.tobias.playpad.project.Project
class ProjectListener extends GlobalListener {
private val dateFormatter = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss")
override def currentProjectDidChanged(newProject: Project): Unit = {
val autoStart = SettingsProxy.getSettings(classOf[PlayoutLogSettings]).autoStartLogging()
if (autoStart) {
Logger.info("Start new PlayOutLog session")
val settings = newProject.getSettings
val logSeason = LogSeasons.createLogSeason(dateFormatter.format(System.currentTimeMillis), settings.getColumns, settings.getRows)
logSeason.createProjectSnapshot(newProject)
}
}
}
......@@ -18,8 +18,8 @@
<components.version>${project.version}</components.version>
<jlibs.version>2.0.6</jlibs.version>
<libPlugins.version>2.2.0</libPlugins.version>
<versionizer-api.version>1.1.0</versionizer-api.version>
<libPlugins.version>2.2.1</libPlugins.version>
<versionizer-api.version>1.1.1</versionizer-api.version>
<jlayer.version>1.0.1</jlayer.version>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment