mirror of
https://github.com/elisspace/autopsy.git
synced 2026-09-06 02:24:30 +00:00
Merge branch 'macosx'
Conflicts: Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java Core/src/org/sleuthkit/autopsy/corecomponents/GstVideoPanel.java
This commit is contained in:
@@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.corecomponentinterfaces;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.openide.util.Lookup;
|
||||
@@ -71,17 +72,47 @@ public class CoreComponentControl {
|
||||
|
||||
/**
|
||||
* Closes all TopComponent windows that needed ({@link DataExplorer}, {@link DataResult}, and
|
||||
* {@link DataContent})
|
||||
* {@link DataContent}).
|
||||
*
|
||||
* Note: The DataContent Top Component must be closed before the Directory Tree
|
||||
* and Favorites Top Components. Otherwise a NullPointerException will be thrown
|
||||
* from JFXPanel.
|
||||
*/
|
||||
public static void closeCoreWindows() {
|
||||
WindowManager wm = WindowManager.getDefault();
|
||||
Set<? extends Mode> modes = wm.getModes();
|
||||
Iterator<? extends Mode> iter = wm.getModes().iterator();
|
||||
|
||||
TopComponent directoryTree = null;
|
||||
TopComponent favorites = null;
|
||||
String tcName = "";
|
||||
while (iter.hasNext()) {
|
||||
Mode mode = iter.next();
|
||||
for (TopComponent tc : mode.getTopComponents()) {
|
||||
tc.close();
|
||||
tcName = tc.getName();
|
||||
if (tcName == null) {
|
||||
logger.log(Level.INFO, "tcName was null");
|
||||
tcName = "";
|
||||
}
|
||||
switch (tcName) {
|
||||
case "Directory Tree":
|
||||
directoryTree = tc;
|
||||
break;
|
||||
case "Favorites":
|
||||
favorites = tc;
|
||||
break;
|
||||
default:
|
||||
tc.close();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (directoryTree != null) {
|
||||
directoryTree.close();
|
||||
}
|
||||
if (favorites != null) {
|
||||
favorites.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,8 +189,7 @@ public class DataContentPanel extends javax.swing.JPanel implements DataContent,
|
||||
// let the user decide if we should stay with the current viewer
|
||||
int tabIndex = keepCurrentViewer ? currTabIndex : preferredViewerIndex;
|
||||
|
||||
// set the tab to the one the user wants, then set that viewer's node.
|
||||
jTabbedPane1.setSelectedIndex(tabIndex);
|
||||
|
||||
UpdateWrapper dcv = viewers.get(tabIndex);
|
||||
// this is really only needed if no tabs were enabled
|
||||
if (jTabbedPane1.isEnabledAt(tabIndex) == false) {
|
||||
@@ -199,6 +198,9 @@ public class DataContentPanel extends javax.swing.JPanel implements DataContent,
|
||||
else {
|
||||
dcv.setNode(selectedNode);
|
||||
}
|
||||
|
||||
// set the tab to the one the user wants, then set that viewer's node.
|
||||
jTabbedPane1.setSelectedIndex(tabIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -128,19 +128,19 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
|
||||
return; //prevent from loading twice if setNode() called mult. times
|
||||
}
|
||||
|
||||
resetComponent();
|
||||
lastFile = file;
|
||||
|
||||
final Dimension dims = DataContentViewerMedia.this.getSize();
|
||||
|
||||
if (imagePanelInited && containsExt(file.getName(), IMAGES)) {
|
||||
imagePanel.showImageFx(file, dims);
|
||||
this.switchPanels(false);
|
||||
this.switchPanels(false);
|
||||
} else if (videoPanelInited
|
||||
&& (containsExt(file.getName(), VIDEOS) || containsExt(file.getName(), AUDIOS))) {
|
||||
videoPanel.setupVideo(file, dims);
|
||||
switchPanels(true);
|
||||
}
|
||||
lastFile = file;
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.SEVERE, "Exception while setting node", e);
|
||||
}
|
||||
@@ -182,8 +182,8 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
|
||||
|
||||
@Override
|
||||
public void resetComponent() {
|
||||
videoPanel.reset();
|
||||
// @@@ Seems like we should also reset the image viewer...
|
||||
// No need to reset the video panel. It resets itself when a node is
|
||||
// set.
|
||||
lastFile = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.4" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="0" green="0" red="0" type="rgb"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
@@ -11,35 +16,8 @@
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="videoPanel" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="videoPanel" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="videoPanel">
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
|
||||
</Form>
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.corecomponents;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
@@ -41,7 +40,6 @@ import javafx.scene.control.Label;
|
||||
import javafx.scene.control.Slider;
|
||||
import javafx.scene.control.Tooltip;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import static javafx.scene.layout.BorderPane.setAlignment;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.scene.layout.VBox;
|
||||
@@ -56,8 +54,8 @@ import static javafx.scene.media.MediaPlayer.Status.READY;
|
||||
import static javafx.scene.media.MediaPlayer.Status.STOPPED;
|
||||
import javafx.scene.media.MediaPlayerBuilder;
|
||||
import javafx.scene.media.MediaView;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.util.Duration;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.SwingWorker;
|
||||
@@ -97,29 +95,28 @@ public class FXVideoPanel extends MediaViewVideoPanel {
|
||||
public FXVideoPanel() {
|
||||
fxInited = Installer.isJavaFxInited();
|
||||
initComponents();
|
||||
customizeComponents();
|
||||
if (fxInited) {
|
||||
setupFx();
|
||||
}
|
||||
}
|
||||
|
||||
public JPanel getVideoPanel() {
|
||||
return videoPanel;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Component getVideoComponent() {
|
||||
return videoComponent;
|
||||
}
|
||||
|
||||
private void customizeComponents() {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
|
||||
private void setupFx() {
|
||||
Platform.runLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
videoPanel.removeAll();
|
||||
videoPanel.setLayout(new BoxLayout(videoPanel, BoxLayout.Y_AXIS));
|
||||
videoPanel.setVisible(true);
|
||||
videoComponent = new JFXPanel();
|
||||
mediaPane = new MediaPane();
|
||||
Scene fxScene = new Scene(mediaPane);
|
||||
videoComponent.setScene(fxScene);
|
||||
|
||||
Platform.runLater(new Runnable() {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setupFx();
|
||||
add(videoComponent);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -128,12 +125,21 @@ public class FXVideoPanel extends MediaViewVideoPanel {
|
||||
|
||||
|
||||
@Override
|
||||
synchronized void setupVideo(final AbstractFile file, final Dimension dims) {
|
||||
void setupVideo(final AbstractFile file, final Dimension dims) {
|
||||
if(file.equals(currentFile)) {
|
||||
return;
|
||||
}
|
||||
if (!Case.isCaseOpen()) {
|
||||
//handle in-between condition when case is being closed
|
||||
//and an image was previously selected
|
||||
return;
|
||||
}
|
||||
reset();
|
||||
currentFile = file;
|
||||
final boolean deleted = file.isDirNameFlagSet(TskData.TSK_FS_NAME_FLAG_ENUM.UNALLOC);
|
||||
if (deleted) {
|
||||
mediaPane.setInfoLabelText("Playback of deleted videos is not supported, use an external player.");
|
||||
videoPanel.removeAll();
|
||||
removeAll();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -148,24 +154,10 @@ public class FXVideoPanel extends MediaViewVideoPanel {
|
||||
|
||||
ExtractMedia em = new ExtractMedia(currentFile, getJFile(currentFile));
|
||||
em.execute();
|
||||
|
||||
mediaPane.setFit(dims);
|
||||
}
|
||||
|
||||
synchronized void setupFx() {
|
||||
if(!fxInited) {
|
||||
return;
|
||||
}
|
||||
videoComponent = new JFXPanel();
|
||||
mediaPane = new MediaPane();
|
||||
Scene fxScene = new Scene(mediaPane);
|
||||
videoComponent.setScene(fxScene);
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
videoPanel.add(videoComponent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@@ -205,32 +197,10 @@ public class FXVideoPanel extends MediaViewVideoPanel {
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
videoPanel = new javax.swing.JPanel();
|
||||
|
||||
javax.swing.GroupLayout videoPanelLayout = new javax.swing.GroupLayout(videoPanel);
|
||||
videoPanel.setLayout(videoPanelLayout);
|
||||
videoPanelLayout.setHorizontalGroup(
|
||||
videoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 400, Short.MAX_VALUE)
|
||||
);
|
||||
videoPanelLayout.setVerticalGroup(
|
||||
videoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 300, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(videoPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(videoPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
setBackground(new java.awt.Color(0, 0, 0));
|
||||
setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.LINE_AXIS));
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JPanel videoPanel;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
@Override
|
||||
@@ -339,8 +309,11 @@ public class FXVideoPanel extends MediaViewVideoPanel {
|
||||
/** The container for the media video output. **/
|
||||
private HBox mediaViewPane;
|
||||
|
||||
private VBox controlPanel;
|
||||
|
||||
private Slider progressSlider;
|
||||
private Button pauseButton;
|
||||
private Button stopButton;
|
||||
private Label progressLabel;
|
||||
private Label infoLabel;
|
||||
private int totalHours;
|
||||
@@ -348,14 +321,35 @@ public class FXVideoPanel extends MediaViewVideoPanel {
|
||||
private int totalSeconds;
|
||||
private String durationFormat = "%02d:%02d:%02d/%02d:%02d:%02d ";
|
||||
|
||||
/** The Listener for MediaPlayer.onReady(). **/
|
||||
private final MediaPane.ReadyListener READY_LISTENER = new MediaPane.ReadyListener();
|
||||
/** The EventHandler for MediaPlayer.onReady(). **/
|
||||
private final ReadyListener READY_LISTENER = new ReadyListener();
|
||||
|
||||
/** The Listener for MediaPlayer.onEndOfMedia(). **/
|
||||
private final MediaPane.EndOfMediaListener END_LISTENER = new MediaPane.EndOfMediaListener();
|
||||
/** The EventHandler for MediaPlayer.onEndOfMedia(). **/
|
||||
private final EndOfMediaListener END_LISTENER = new EndOfMediaListener();
|
||||
|
||||
/** The Listener for the CurrentTime property of the MediaPlayer. **/
|
||||
private final MediaPane.TimeListener TIME_LISTENER = new MediaPane.TimeListener();
|
||||
/** The EventHandler for the CurrentTime property of the MediaPlayer. **/
|
||||
private final TimeListener TIME_LISTENER = new TimeListener();
|
||||
|
||||
/** The EventHandler for MediaPlayer.onPause and MediaPlayer.onStop. **/
|
||||
private final NotPlayListener NOT_PLAY_LISTENER = new NotPlayListener();
|
||||
|
||||
/** The EventHandler for MediaPlayer.onPlay. **/
|
||||
private final PlayListener PLAY_LISTENER = new PlayListener();
|
||||
|
||||
private static final String PLAY_TEXT = "►";
|
||||
|
||||
private static final String PAUSE_TEXT = "||";
|
||||
|
||||
private static final String STOP_TEXT = "X";
|
||||
|
||||
/** CSS-formatted skin for pauseButton when showing PLAY_TEXT. **/
|
||||
private static final String PLAY_STYLE = "-fx-text-fill: green;";
|
||||
|
||||
/** CSS-formatted skin for pauseButton when showing PAUSE_TEXT. **/
|
||||
private static final String PAUSE_STYLE = "-fx-font-weight: bolder;";
|
||||
|
||||
/** CSS-formatted skin for stopButton. **/
|
||||
private static final String STOP_STYLE = "-fx-text-fill: red; -fx-font-weight: bold;";
|
||||
|
||||
public MediaPane() {
|
||||
// Video Display
|
||||
@@ -367,22 +361,27 @@ public class FXVideoPanel extends MediaViewVideoPanel {
|
||||
setCenter(mediaViewPane);
|
||||
|
||||
// Media Controls
|
||||
VBox controlPanel = new VBox();
|
||||
controlPanel = new VBox();
|
||||
mediaTools = new HBox();
|
||||
mediaTools.setAlignment(Pos.CENTER);
|
||||
mediaTools.setPadding(new Insets(5, 10, 5, 10));
|
||||
|
||||
pauseButton = new Button("►");
|
||||
pauseButton = new Button(PLAY_TEXT);
|
||||
pauseButton.setStyle(PLAY_STYLE);
|
||||
stopButton = new Button(STOP_TEXT);
|
||||
stopButton.setStyle(STOP_STYLE);
|
||||
mediaTools.getChildren().add(pauseButton);
|
||||
mediaTools.getChildren().add(new Label(" "));
|
||||
mediaTools.getChildren().add(new Label(" "));
|
||||
mediaTools.getChildren().add(stopButton);
|
||||
mediaTools.getChildren().add(new Label(" "));
|
||||
progressSlider = new Slider();
|
||||
HBox.setHgrow(progressSlider,Priority.ALWAYS);
|
||||
progressSlider.setMinWidth(50);
|
||||
progressSlider.setMaxWidth(Double.MAX_VALUE);
|
||||
mediaTools.getChildren().add(progressSlider);
|
||||
progressLabel = new Label();
|
||||
progressLabel.setPrefWidth(130);
|
||||
progressLabel.setMinWidth(50);
|
||||
progressLabel.setPrefWidth(135);
|
||||
progressLabel.setMinWidth(135);
|
||||
mediaTools.getChildren().add(progressLabel);
|
||||
|
||||
controlPanel.getChildren().add(mediaTools);
|
||||
@@ -391,19 +390,17 @@ public class FXVideoPanel extends MediaViewVideoPanel {
|
||||
controlPanel.getChildren().add(infoLabel);
|
||||
setBottom(controlPanel);
|
||||
setProgressActionListeners();
|
||||
disableControls(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the MediaPane for media playback.
|
||||
* Setup the MediaPane for media playback. Run on the JavaFx Thread.
|
||||
*
|
||||
*
|
||||
* @param mediaUri the URI of the media
|
||||
*/
|
||||
public void prepareMedia(String mediaUri) {
|
||||
disableControls(true);
|
||||
mediaPlayer = createMediaPlayer(mediaUri);
|
||||
mediaView.setMediaPlayer(mediaPlayer);
|
||||
disableControls(false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -412,13 +409,12 @@ public class FXVideoPanel extends MediaViewVideoPanel {
|
||||
*/
|
||||
public void reset() {
|
||||
if (mediaPlayer != null) {
|
||||
if (mediaPlayer.getStatus() == MediaPlayer.Status.PLAYING ) {
|
||||
if (mediaPlayer.getStatus() == Status.PLAYING) {
|
||||
mediaPlayer.stop();
|
||||
}
|
||||
mediaPlayer = null;
|
||||
}
|
||||
setInfoLabelText("");
|
||||
disableControls(true);
|
||||
resetProgress();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -427,6 +423,7 @@ public class FXVideoPanel extends MediaViewVideoPanel {
|
||||
* @param text
|
||||
*/
|
||||
public void setInfoLabelText(final String text) {
|
||||
logger.log(Level.INFO, "Setting Info Label Text: " + text);
|
||||
Platform.runLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -435,6 +432,23 @@ public class FXVideoPanel extends MediaViewVideoPanel {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the size of the MediaPane and it's components.
|
||||
*
|
||||
* @param dims the current dimensions of the DataContentViewer
|
||||
*/
|
||||
public void setFit(final Dimension dims) {
|
||||
Platform.runLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setPrefSize(dims.getWidth(), dims.getHeight());
|
||||
// Set the Video output to fit the size allocated for it. give an
|
||||
// extra few px to ensure the info label will be shown
|
||||
mediaView.setFitHeight(dims.getHeight() - controlPanel.getHeight());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the action listeners for the pause button and progress slider.
|
||||
*/
|
||||
@@ -447,31 +461,31 @@ public class FXVideoPanel extends MediaViewVideoPanel {
|
||||
switch (status) {
|
||||
// If playing, pause
|
||||
case PLAYING:
|
||||
pauseButton.setText("►");
|
||||
mediaPlayer.pause();
|
||||
break;
|
||||
// If ready, paused or stopped, continue playing
|
||||
case READY:
|
||||
case PAUSED:
|
||||
case STOPPED:
|
||||
pauseButton.setText("||");
|
||||
mediaPlayer.play();
|
||||
if(mediaPlayer.getStatus() == Status.PAUSED) {
|
||||
mediaPlayer.stop();
|
||||
setInfoLabelText("Playback error. File may be corrupted.");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
logger.log(Level.INFO, "MediaPlayer in unexpected state: " + status.toString());
|
||||
// If the MediaPlayer is in an unexpected state, stop playback.
|
||||
pauseButton.setText("►");
|
||||
mediaPlayer.pause();
|
||||
mediaPlayer.stop();
|
||||
setInfoLabelText("Playback error.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
stopButton.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent e) {
|
||||
mediaPlayer.stop();
|
||||
}
|
||||
});
|
||||
|
||||
progressSlider.valueProperty().addListener(new InvalidationListener() {
|
||||
@Override
|
||||
public void invalidated(Observable o) {
|
||||
@@ -483,19 +497,14 @@ public class FXVideoPanel extends MediaViewVideoPanel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle the availability of the progress slider and pause button.
|
||||
*
|
||||
* @param disable <code>true</code> to disable controls
|
||||
* <code>false</code> to enable controls
|
||||
* Reset the progress label and slider to zero.
|
||||
*/
|
||||
private void disableControls(final boolean disable) {
|
||||
Platform.runLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
pauseButton.setDisable(disable);
|
||||
progressSlider.setDisable(disable);
|
||||
}
|
||||
});
|
||||
private void resetProgress() {
|
||||
totalHours = 0;
|
||||
totalMinutes = 0;
|
||||
totalSeconds = 0;
|
||||
progressSlider.setValue(0.0);
|
||||
updateTime(Duration.ZERO);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -514,6 +523,9 @@ public class FXVideoPanel extends MediaViewVideoPanel {
|
||||
MediaPlayerBuilder mediaPlayerBuilder = MediaPlayerBuilder.create();
|
||||
mediaPlayerBuilder.media(media);
|
||||
mediaPlayerBuilder.onReady(READY_LISTENER);
|
||||
mediaPlayerBuilder.onPaused(NOT_PLAY_LISTENER);
|
||||
mediaPlayerBuilder.onStopped(NOT_PLAY_LISTENER);
|
||||
mediaPlayerBuilder.onPlaying(PLAY_LISTENER);
|
||||
mediaPlayerBuilder.onEndOfMedia(END_LISTENER);
|
||||
|
||||
MediaPlayer player = mediaPlayerBuilder.build();
|
||||
@@ -538,7 +550,7 @@ public class FXVideoPanel extends MediaViewVideoPanel {
|
||||
*/
|
||||
private void updateSlider(Duration currentTime) {
|
||||
if (progressSlider != null) {
|
||||
progressSlider.setDisable(duration.isUnknown());
|
||||
progressSlider.setDisable(currentTime.isUnknown());
|
||||
if (!progressSlider.isDisabled() && duration.greaterThan(Duration.ZERO)
|
||||
&& !progressSlider.isValueChanging()) {
|
||||
progressSlider.setValue(currentTime.divide(duration.toMillis()).toMillis() * 100.0);
|
||||
@@ -625,14 +637,14 @@ public class FXVideoPanel extends MediaViewVideoPanel {
|
||||
Duration beginning = mediaPlayer.getStartTime();
|
||||
mediaPlayer.stop();
|
||||
mediaPlayer.pause();
|
||||
pauseButton.setText("►");
|
||||
pauseButton.setText(PLAY_TEXT);
|
||||
updateSlider(beginning);
|
||||
updateTime(beginning);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Responds changes in the MediaPlayer currentTime property.
|
||||
* Responds to changes in the MediaPlayer currentTime property.
|
||||
*
|
||||
* Updates the progress slider and label with the current Time.
|
||||
*/
|
||||
@@ -643,6 +655,28 @@ public class FXVideoPanel extends MediaViewVideoPanel {
|
||||
updateTime(newValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggered when MediaPlayer State changes to PAUSED or Stopped.
|
||||
*/
|
||||
private class NotPlayListener implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
pauseButton.setText(PLAY_TEXT);
|
||||
pauseButton.setStyle(PLAY_STYLE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggered when MediaPlayer State changes to PLAYING.
|
||||
*/
|
||||
private class PlayListener implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
pauseButton.setText(PAUSE_TEXT);
|
||||
pauseButton.setStyle(PAUSE_STYLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -760,5 +794,4 @@ public class FXVideoPanel extends MediaViewVideoPanel {
|
||||
// return frames;
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -437,7 +437,7 @@ public class GstVideoPanel extends MediaViewVideoPanel {
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
videoPanel = new javax.swing.JPanel();
|
||||
@@ -562,6 +562,7 @@ public class GstVideoPanel extends MediaViewVideoPanel {
|
||||
private javax.swing.JSlider progressSlider;
|
||||
private javax.swing.JPanel videoPanel;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
private class VideoProgressWorker extends SwingWorker<Object, Object> {
|
||||
|
||||
private String durationFormat = "%02d:%02d:%02d/%02d:%02d:%02d ";
|
||||
@@ -769,4 +770,3 @@ public class GstVideoPanel extends MediaViewVideoPanel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javax.imageio.ImageIO;
|
||||
import org.openide.modules.ModuleInstall;
|
||||
import javax.swing.SwingUtilities;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.corelibs.ScalrWrapper;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
@@ -182,8 +182,13 @@ public class MediaViewImagePanel extends javax.swing.JPanel {
|
||||
|
||||
fxPanel.setScene(fxScene);
|
||||
|
||||
//show the panel after fully loaded
|
||||
fxPanel.setVisible(true);
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//show the panel after fully loaded
|
||||
fxPanel.setVisible(true);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -36,6 +36,10 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
||||
|
||||
/**
|
||||
* Loads a file that maps USB IDs to names of makes and models. Uses Linux USB info.
|
||||
* This should be renamed because it isn't extracting. It's just mapping IDs to names.
|
||||
*/
|
||||
public class ExtractUSB {
|
||||
private static final Logger logger = Logger.getLogger(ExtractUSB.class.getName());
|
||||
private HashMap<String, USBInfo> devices;
|
||||
@@ -43,7 +47,7 @@ public class ExtractUSB {
|
||||
|
||||
public ExtractUSB() {
|
||||
try {
|
||||
devices();
|
||||
loadDeviceMap();
|
||||
} catch (FileNotFoundException ex) {
|
||||
logger.log(Level.SEVERE, "Could not find file " + DataFile + ".", ex);
|
||||
devices = null;
|
||||
@@ -52,24 +56,39 @@ public class ExtractUSB {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Example inputs:
|
||||
* Vid_XXXX&Pid_XXXX
|
||||
* @param dev
|
||||
* @return
|
||||
*/
|
||||
public USBInfo get(String dev) {
|
||||
String[] dtokens = dev.split("[_&]");
|
||||
String mID = dtokens[1];
|
||||
String vID = dtokens[1];
|
||||
String pID;
|
||||
if (dtokens.length < 4 || dtokens[3].length() < 4) {
|
||||
pID = mID + "0000";
|
||||
pID = "0000";
|
||||
} else {
|
||||
pID = mID + dtokens[3];
|
||||
pID = dtokens[3];
|
||||
}
|
||||
if (!devices.containsKey(pID)) {
|
||||
String key = vID + pID;
|
||||
if (!devices.containsKey(key)) {
|
||||
return new USBInfo(null, null);
|
||||
} else {
|
||||
return devices.get(pID);
|
||||
return devices.get(key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void devices() throws FileNotFoundException, IOException {
|
||||
/**
|
||||
* Reads the USB file. Syntax of file:
|
||||
*
|
||||
* # vendor vendor_name
|
||||
* # device device_name <-- single tab
|
||||
* # interface interface_name <-- two tabs
|
||||
* @throws FileNotFoundException
|
||||
* @throws IOException
|
||||
*/
|
||||
private void loadDeviceMap() throws FileNotFoundException, IOException {
|
||||
devices = new HashMap<String, USBInfo>();
|
||||
PlatformUtil.extractResourceToUserConfigDir(this.getClass(), DataFile);
|
||||
try (Scanner dat = new Scanner(new FileInputStream(new java.io.File(PlatformUtil.getUserConfigDirectory() + File.separator + "USB_DATA.txt")))) {
|
||||
@@ -84,7 +103,11 @@ public class ExtractUSB {
|
||||
}
|
||||
String pID = vID + "0000";
|
||||
USBInfo info = new USBInfo(dvc, null);
|
||||
|
||||
// make an entry with just the vendor ID
|
||||
devices.put(pID, info);
|
||||
|
||||
// get the later lines that have specific products
|
||||
line = dat.nextLine();
|
||||
if (line.startsWith("\t")) {
|
||||
while (dat.hasNext() && line.startsWith("\t")) {
|
||||
@@ -95,7 +118,9 @@ public class ExtractUSB {
|
||||
for (int n = 2; n < tokens.length; n++) {
|
||||
device += tokens[n] + " ";
|
||||
}
|
||||
|
||||
info = new USBInfo(dvc, device);
|
||||
//make an entry where the key is both the vendor and product IDs concatenated
|
||||
devices.put(pID, info);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@
|
||||
|
||||
<target name="versioning-script" depends="check-release, versioning-script-if-release, versioning-script-if-not-release"/>
|
||||
|
||||
<target name="build-installer-dir" depends="getProps, versioning-script, build-zip" description="Builds Autopsy with branding and all dependencies" >
|
||||
<target name="build-installer-dir" depends="getProps, build-zip" description="Builds Autopsy with branding and all dependencies" >
|
||||
<unzip src="${nbdist.dir}/${app.name}-${app.version}.zip" dest="${nbdist.dir}/${app.name}-installer"/>
|
||||
</target>
|
||||
|
||||
|
||||
16
installer_autopsy/installer_autopsy.aip
Normal file → Executable file
16
installer_autopsy/installer_autopsy.aip
Normal file → Executable file
@@ -1,11 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<DOCUMENT Type="Advanced Installer" CreateVersion="9.0.1" version="10.2" Modules="simple" RootPath="." Language="en" Id="{84E12760-98AC-4ACA-B4DE-86E5B5603721}">
|
||||
<DOCUMENT Type="Advanced Installer" CreateVersion="9.0.1" version="10.3" Modules="simple" RootPath="." Language="en" Id="{84E12760-98AC-4ACA-B4DE-86E5B5603721}">
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.MsiPropsComponent">
|
||||
<ROW Property="AI_UPGRADE" Value="No"/>
|
||||
<ROW Property="ALLUSERS" Value="2"/>
|
||||
<ROW Property="ARPCOMMENTS" Value="This installer database contains the logic and data required to install [|ProductName]." ValueLocId="*"/>
|
||||
<ROW Property="ARPHELPLINK" Value="http://www.sleuthkit.org/support.php"/>
|
||||
<ROW Property="ARPPRODUCTICON" Value="autopsy.exe" Type="8"/>
|
||||
<ROW Property="ARPURLINFOABOUT" Value="http://sleuthkit.org/"/>
|
||||
<ROW Property="Manufacturer" Value="Sleuthkit" ValueLocId="*"/>
|
||||
<ROW Property="ARPURLINFOABOUT" Value="http://www.sleuthkit.org/"/>
|
||||
<ROW Property="Manufacturer" Value="The Sleuth Kit" ValueLocId="*"/>
|
||||
<ROW Property="ProductCode" Value="1033:{26962649-83B3-4A58-AB5C-155FD288635A} " Type="16"/>
|
||||
<ROW Property="ProductLanguage" Value="1033"/>
|
||||
<ROW Property="ProductName" Value="Autopsy" ValueLocId="*"/>
|
||||
@@ -79,15 +81,13 @@
|
||||
<ROW Dialog_="MaintenanceTypeDlg" Control_="RepairButton" Event="NewDialog" Argument="VerifyRepairDlg" Condition="AI_MAINT AND InstallMode = "Repair"" Ordering="601"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.MsiCustActComponent">
|
||||
<ROW Action="AI_DOWNGRADE" Type="19" Target="4010"/>
|
||||
<ROW Action="AI_InstallModeCheck" Type="1" Source="aicustact.dll" Target="UpdateInstallMode" WithoutSeq="true"/>
|
||||
<ROW Action="AI_PREPARE_UPGRADE" Type="65" Source="aicustact.dll" Target="PrepareUpgrade"/>
|
||||
<ROW Action="AI_RESTORE_LOCATION" Type="65" Source="aicustact.dll" Target="RestoreLocation"/>
|
||||
<ROW Action="AI_ResolveKnownFolders" Type="1" Source="aicustact.dll" Target="AI_ResolveKnownFolders"/>
|
||||
<ROW Action="AI_ResolveLocalizedCredentials" Type="1" Source="aicustact.dll" Target="GetLocalizedCredentials"/>
|
||||
<ROW Action="AI_SHOW_LOG" Type="65" Source="aicustact.dll" Target="LaunchLogFile" WithoutSeq="true"/>
|
||||
<ROW Action="AI_STORE_LOCATION" Type="51" Source="ARPINSTALLLOCATION" Target="[APPDIR]"/>
|
||||
<ROW Action="SET_APPDIR" Type="307" Source="APPDIR" Target="[ProgramFilesFolder][Manufacturer]\[ProductName]" MultiBuildTarget="DefaultBuild:[ProgramFilesFolder][ProductName]"/>
|
||||
<ROW Action="SET_APPDIR" Type="307" Source="APPDIR" Target="[ProgramFilesFolder][Manufacturer]\[ProductName]" MultiBuildTarget="DefaultBuild:[ProgramFilesFolder][ProductName]-[ProductVersion]"/>
|
||||
<ROW Action="SET_SHORTCUTDIR" Type="307" Source="SHORTCUTDIR" Target="[ProgramMenuFolder][ProductName]"/>
|
||||
<ROW Action="SET_TARGETDIR_TO_APPDIR" Type="51" Source="TARGETDIR" Target="[APPDIR]"/>
|
||||
</COMPONENT>
|
||||
@@ -95,15 +95,12 @@
|
||||
<ROW Name="autopsy.exe" SourcePath="..\dist\autopsy-installer\icon.ico" Index="0"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.MsiInstExSeqComponent">
|
||||
<ROW Action="AI_RESTORE_LOCATION" Condition="APPDIR=""" Sequence="749"/>
|
||||
<ROW Action="AI_STORE_LOCATION" Condition="(Not Installed) OR REINSTALL" Sequence="1501"/>
|
||||
<ROW Action="AI_PREPARE_UPGRADE" Condition="AI_UPGRADE="No" AND (Not Installed)" Sequence="1399"/>
|
||||
<ROW Action="AI_ResolveKnownFolders" Sequence="52"/>
|
||||
<ROW Action="AI_ResolveLocalizedCredentials" Sequence="51"/>
|
||||
<ROW Action="AI_DOWNGRADE" Condition="AI_NEWERPRODUCTFOUND AND (UILevel <> 5)" Sequence="201"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.MsiInstallUISequenceComponent">
|
||||
<ROW Action="AI_RESTORE_LOCATION" Condition="APPDIR=""" Sequence="749"/>
|
||||
<ROW Action="AI_ResolveKnownFolders" Sequence="52"/>
|
||||
<ROW Action="AI_ResolveLocalizedCredentials" Sequence="51"/>
|
||||
</COMPONENT>
|
||||
@@ -119,6 +116,5 @@
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.MsiUpgradeComponent">
|
||||
<ROW UpgradeCode="[|UpgradeCode]" VersionMax="[|ProductVersion]" Attributes="1025" ActionProperty="OLDPRODUCTS"/>
|
||||
<ROW UpgradeCode="[|UpgradeCode]" VersionMin="[|ProductVersion]" Attributes="2" ActionProperty="AI_NEWERPRODUCTFOUND"/>
|
||||
</COMPONENT>
|
||||
</DOCUMENT>
|
||||
|
||||
Reference in New Issue
Block a user