mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
GP-2858 - fixes to update the PR with theming concepts
This commit is contained in:
parent
0398f47f05
commit
1f70c3ffdc
3 changed files with 12 additions and 20 deletions
|
@ -4,9 +4,7 @@
|
||||||
icon.content.handler.archive.dt = closedBookBlue.png
|
icon.content.handler.archive.dt = closedBookBlue.png
|
||||||
icon.content.handler.program = program_obj.png
|
icon.content.handler.program = program_obj.png
|
||||||
|
|
||||||
icon.data.type.aiff = audio-volume-medium.png
|
icon.data.type.audio.player = audio-volume-medium.png
|
||||||
icon.data.type.au = audio-volume-medium.png
|
|
||||||
icon.data.type.wave = audio-volume-medium.png
|
|
||||||
|
|
||||||
[Dark Defaults]
|
[Dark Defaults]
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
|
|
@ -19,38 +19,32 @@ import java.awt.event.MouseEvent;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import javax.sound.sampled.AudioInputStream;
|
import javax.sound.sampled.*;
|
||||||
import javax.sound.sampled.AudioSystem;
|
|
||||||
import javax.sound.sampled.Clip;
|
|
||||||
import javax.sound.sampled.LineEvent;
|
|
||||||
import javax.sound.sampled.LineEvent.Type;
|
import javax.sound.sampled.LineEvent.Type;
|
||||||
import javax.sound.sampled.LineListener;
|
import javax.swing.Icon;
|
||||||
import javax.sound.sampled.LineUnavailableException;
|
|
||||||
import javax.sound.sampled.UnsupportedAudioFileException;
|
|
||||||
import javax.swing.ImageIcon;
|
|
||||||
|
|
||||||
|
import generic.theme.GIcon;
|
||||||
import ghidra.util.Msg;
|
import ghidra.util.Msg;
|
||||||
import resources.ResourceManager;
|
|
||||||
|
|
||||||
public class AudioPlayer implements Playable, LineListener {
|
public class AudioPlayer implements Playable, LineListener {
|
||||||
|
|
||||||
private static final ImageIcon AUDIO_ICON =
|
private static final Icon AUDIO_ICON = new GIcon("icon.data.type.audio.player");
|
||||||
ResourceManager.loadImage("images/audio-volume-medium.png");
|
|
||||||
|
|
||||||
private byte[] bytes;
|
private byte[] bytes;
|
||||||
|
|
||||||
public AudioPlayer(byte[] bytes) {
|
public AudioPlayer(byte[] bytes) {
|
||||||
this.bytes = bytes;
|
this.bytes = bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ImageIcon getImageIcon() {
|
public Icon getImageIcon() {
|
||||||
return AUDIO_ICON;
|
return AUDIO_ICON;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clicked(MouseEvent event) {
|
public void clicked(MouseEvent event) {
|
||||||
try (AudioInputStream stream = AudioSystem.getAudioInputStream(new ByteArrayInputStream(bytes))) {
|
try (AudioInputStream stream =
|
||||||
|
AudioSystem.getAudioInputStream(new ByteArrayInputStream(bytes))) {
|
||||||
Clip clip = AudioSystem.getClip();
|
Clip clip = AudioSystem.getClip();
|
||||||
clip.addLineListener(this);
|
clip.addLineListener(this);
|
||||||
clip.open(stream);
|
clip.open(stream);
|
||||||
|
@ -72,6 +66,6 @@ public class AudioPlayer implements Playable, LineListener {
|
||||||
if (event.getSource() instanceof Clip clip) {
|
if (event.getSource() instanceof Clip clip) {
|
||||||
clip.removeLineListener(this);
|
clip.removeLineListener(this);
|
||||||
clip.close();
|
clip.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue