diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index ea07df0..f5a48bc 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -34,7 +34,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Setup Pages - uses: actions/configure-pages@v3 + uses: actions/configure-pages@v4 - name: Upload artifact uses: actions/upload-pages-artifact@v2 with: @@ -42,4 +42,4 @@ jobs: path: './mvn-site' - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v2 + uses: actions/deploy-pages@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7d5d314 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,31 @@ +name: Java CI +on: + push: + release: + types: [published] + +jobs: + build: + runs-on: self-hosted + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'zulu' + cache: maven + - name: Build with Maven + run: mvn -B package --file pom.xml + - name: Extract Maven project version + run: echo ::set-output name=version::$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) + id: project + - name: Show extracted Maven project version + run: echo ${{ steps.project.outputs.version }} + - name: Upload to Release + if: github.event_name == 'release' + uses: JasonEtco/upload-to-release@master + with: + args: target/DanceInterpreter-${{ steps.project.outputs.version }}-full.jar application/java-archive + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/pom.xml b/pom.xml index 4af074a..4dfad7e 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ de.klassenserver7b danceinterpreter - 3.0.0 + 3.5.0 DanceInterpreter Tool to present a playlist for ballroom dancing @@ -169,7 +169,7 @@ org.apache.httpcomponents.client5 httpclient5 - 5.2.3 + 5.3 org.slf4j diff --git a/src/main/java/de/klassenserver7b/danceinterpreter/graphics/ConfigWindow.java b/src/main/java/de/klassenserver7b/danceinterpreter/graphics/ConfigWindow.java index fcab1d3..8ef4a19 100755 --- a/src/main/java/de/klassenserver7b/danceinterpreter/graphics/ConfigWindow.java +++ b/src/main/java/de/klassenserver7b/danceinterpreter/graphics/ConfigWindow.java @@ -27,6 +27,7 @@ import org.slf4j.LoggerFactory; import de.klassenserver7b.danceinterpreter.Main; +import de.klassenserver7b.danceinterpreter.graphics.listener.CustomKeyListener; import de.klassenserver7b.danceinterpreter.graphics.listener.FileDropListener; import de.klassenserver7b.danceinterpreter.songprocessing.SongData; import de.klassenserver7b.danceinterpreter.songprocessing.dataprovider.PlaylistSongDataProvider; @@ -36,8 +37,8 @@ public class ConfigWindow { - private JFrame mainframe; - private JPanel mainpanel; + private JFrame mainFrame; + private JPanel mainPanel; private Long time; private boolean playlistview; private boolean imgenabled; @@ -57,43 +58,43 @@ public ConfigWindow() { this.log = LoggerFactory.getLogger(this.getClass()); this.time = 0L; - this.mainframe = new JFrame(); - this.mainpanel = new JPanel(); + this.mainFrame = new JFrame(); + this.mainPanel = new JPanel(); this.playlistview = false; this.imgenabled = false; - this.dropTarget = new DropTarget(this.mainframe, new FileDropListener()); + this.dropTarget = new DropTarget(this.mainFrame, new FileDropListener()); - this.mainframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + this.mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); File file = new File("./icon.png"); try { BufferedImage bufferedImage = ImageIO.read(file); - this.mainframe.setIconImage(bufferedImage); + this.mainFrame.setIconImage(bufferedImage); } catch (IOException e) { this.log.error("No Icon Found!"); } - this.mainframe.setTitle("DI - Config"); + this.mainFrame.setTitle("DI - Config"); - this.mainframe.setBounds(10, 10, 500, 281); + this.mainFrame.setBounds(10, 10, 1280, 720); MenuGenerator mgen = new MenuGenerator(this); - this.mainframe.setJMenuBar(mgen.getMenuBar()); + this.mainFrame.setJMenuBar(mgen.getMenuBar()); JLabel img = new JLabel(); // Image image; // image = ImageIO.read(new File(imgpath)); - // ImageIcon icon = new ImageIcon(image.getScaledInstance(mainframe.getWidth(), - // mainframe.getHeight(), 0)); + // ImageIcon icon = new ImageIcon(image.getScaledInstance(mainFrame.getWidth(), + // mainFrame.getHeight(), 0)); img = new JLabel(new ImageIcon(this.imgpath)); // img.setIcon(icon); - this.mainpanel.add(img); - this.mainframe.addComponentListener(new ComponentAdapter() { + this.mainPanel.add(img); + this.mainFrame.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent componentEvent) { @@ -113,31 +114,32 @@ public void componentResized(ComponentEvent componentEvent) { } }); - this.mainframe.add(this.mainpanel); - this.mainframe.setVisible(true); + this.mainFrame.add(this.mainPanel); + this.mainFrame.setVisible(true); } public void updateWindow() { - this.mainpanel.removeAll(); - this.mainpanel.paintImmediately(0, 0, this.mainframe.getWidth(), this.mainframe.getHeight()); + this.mainPanel.removeAll(); + this.mainPanel.paintImmediately(0, 0, this.mainFrame.getWidth(), this.mainFrame.getHeight()); if (!this.playlistview && this.imgenabled) { JLabel img = new JLabel(); img = new JLabel(new ImageIcon(this.imgpath)); - this.mainpanel.add(img); + this.mainPanel.add(img); } - this.mainpanel.paintComponents(this.mainframe.getGraphics()); - this.mainframe.setVisible(true); + this.mainPanel.paintComponents(this.mainFrame.getGraphics()); + this.mainFrame.setVisible(true); } public void updateWindow(List l) { - this.mainpanel.removeAll(); - //mainpanel.paintImmediately(0, 0, mainframe.getWidth(), mainframe.getHeight()); + this.mainPanel.removeAll(); + // mainPanel.paintImmediately(0, 0, mainFrame.getWidth(), + // mainFrame.getHeight()); if (!this.playlistview) { JLabel img = new JLabel(); @@ -146,7 +148,8 @@ public void updateWindow(List l) { try { image = ImageIO.read(new File("./pics/splash_small.jpg")); - ImageIcon icon = new ImageIcon(image.getScaledInstance(this.mainframe.getWidth(), this.mainframe.getHeight(), 0)); + ImageIcon icon = new ImageIcon( + image.getScaledInstance(this.mainFrame.getWidth(), this.mainFrame.getHeight(), 0)); img.setIcon(icon); @@ -154,16 +157,20 @@ public void updateWindow(List l) { e.printStackTrace(); } - this.mainpanel.add(img); + this.mainPanel.add(img); } else { for (JLabel label : l) { - this.mainpanel.add(label); + this.mainPanel.add(label); } } - this.mainpanel.paintComponents(this.mainframe.getGraphics()); - this.mainframe.repaint(); - this.mainframe.setVisible(true); + this.mainPanel.paintComponents(this.mainFrame.getGraphics()); + this.mainFrame.repaint(); + this.mainFrame.setVisible(true); + } + + public void initKeyListeners(CustomKeyListener keylis) { + this.mainFrame.addKeyListener(keylis); } public List loadPlaylistView() { @@ -210,13 +217,13 @@ public List loadPlaylistView() { } public void close() { - this.mainframe.removeAll(); - this.mainframe.setEnabled(false); - this.mainframe.setVisible(false); + this.mainFrame.removeAll(); + this.mainFrame.setEnabled(false); + this.mainFrame.setVisible(false); - this.mainframe.dispose(); + this.mainFrame.dispose(); - this.mainframe = null; + this.mainFrame = null; } public boolean isPlaylistview() { @@ -236,11 +243,11 @@ public void setImgenabled(boolean imgenabled) { } public JFrame getMainframe() { - return this.mainframe; + return this.mainFrame; } public JPanel getMainpanel() { - return this.mainpanel; + return this.mainPanel; } class ClickListener implements MouseListener { diff --git a/src/main/java/de/klassenserver7b/danceinterpreter/graphics/SongWindowServer.java b/src/main/java/de/klassenserver7b/danceinterpreter/graphics/SongWindowServer.java index 05dc8c6..36d5024 100755 --- a/src/main/java/de/klassenserver7b/danceinterpreter/graphics/SongWindowServer.java +++ b/src/main/java/de/klassenserver7b/danceinterpreter/graphics/SongWindowServer.java @@ -19,6 +19,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import de.klassenserver7b.danceinterpreter.Main; import de.klassenserver7b.danceinterpreter.graphics.listener.ArrowSpaceKeyListener; import de.klassenserver7b.danceinterpreter.graphics.listener.CustomKeyListener; import de.klassenserver7b.danceinterpreter.graphics.listener.FullscreenListener; @@ -83,6 +84,8 @@ protected void initFrame() { this.mainFrame.setBounds(screenBounds); this.mainFrame.setLayout(null); + this.mainFrame.setAutoRequestFocus(true); + this.mainFrame.getContentPane().setBackground(Color.BLACK); CustomKeyListener keylis = new CustomKeyListener(); @@ -103,6 +106,8 @@ public void componentResized(ComponentEvent e) { SongWindowServer.this.registeredWindows.get(SongWindowServer.this.selectedWindow).refresh(); } }); + + Main.Instance.getConfigWindow().initKeyListeners(keylis); } /** @@ -218,4 +223,11 @@ public void setSettingsOverride(SongWindowSpecs settingsOverride) { provideData(this.currentData); } + /** + * @return the mainFrame + */ + public JFrame getMainFrame() { + return this.mainFrame; + } + }