Compare commits

..

1 commit

Author SHA1 Message Date
renovate[bot]
0a5e9e4b50
Update plugin org.jetbrains.intellij to v1.14.2 2023-06-26 18:50:04 +00:00
9 changed files with 201 additions and 63 deletions

View file

@ -26,10 +26,10 @@ jobs:
steps:
- name: Fetch Sources
uses: actions/checkout@v4
uses: actions/checkout@v3
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1.1.0
uses: gradle/wrapper-validation-action@v1.0.6
# Run verifyPlugin and test Gradle tasks
test:
@ -45,16 +45,16 @@ jobs:
distribution: 'zulu'
- name: Fetch Sources
uses: actions/checkout@v4
uses: actions/checkout@v3
- name: Setup Gradle Dependencies Cache
uses: actions/cache@v4.0.0
uses: actions/cache@v3.3.1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }}
- name: Setup Gradle Wrapper Cache
uses: actions/cache@v4.0.0
uses: actions/cache@v3.3.1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
@ -84,16 +84,16 @@ jobs:
distribution: 'zulu'
- name: Fetch Sources
uses: actions/checkout@v4
uses: actions/checkout@v3
- name: Setup Gradle Dependencies Cache
uses: actions/cache@v4.0.0
uses: actions/cache@v3.3.1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }}
- name: Setup Gradle Wrapper Cache
uses: actions/cache@v4.0.0
uses: actions/cache@v3.3.1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
@ -116,7 +116,7 @@ jobs:
# Upload plugin artifact to make it available in the next jobs
- name: Upload artifact
uses: actions/upload-artifact@v4.2.0
uses: actions/upload-artifact@v3.1.2
with:
name: plugin-artifact
path: ./build/distributions/${{ needs.build.outputs.artifact }}
@ -136,16 +136,16 @@ jobs:
distribution: 'zulu'
- name: Fetch Sources
uses: actions/checkout@v4
uses: actions/checkout@v3
- name: Setup Gradle Dependencies Cache
uses: actions/cache@v4.0.0
uses: actions/cache@v3.3.1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }}
- name: Setup Gradle Wrapper Cache
uses: actions/cache@v4.0.0
uses: actions/cache@v3.3.1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
@ -163,7 +163,7 @@ jobs:
# Cache Plugin Verifier IDEs
- name: Setup Plugin Verifier IDEs Cache
uses: actions/cache@v4.0.0
uses: actions/cache@v3.3.1
with:
path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides
key: ${{ runner.os }}-plugin-verifier-${{ steps.properties.outputs.ideVersions }}

View file

@ -21,7 +21,7 @@ jobs:
# distribution: 'zulu'
#
# - name: Fetch Sources
# uses: actions/checkout@v4
# uses: actions/checkout@v3
# with:
# ref: ${{ github.event.release.tag_name }}
#
@ -43,16 +43,16 @@ jobs:
distribution: 'zulu'
- name: Fetch Sources
uses: actions/checkout@v4
uses: actions/checkout@v3
- name: Setup Gradle Dependencies Cache
uses: actions/cache@v4.0.0
uses: actions/cache@v3.3.1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }}
- name: Setup Gradle Wrapper Cache
uses: actions/cache@v4.0.0
uses: actions/cache@v3.3.1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}

View file

@ -5,8 +5,8 @@ fun properties(key: String) = project.findProperty(key).toString()
plugins {
id("java")
id("org.jetbrains.intellij") version "1.17.2"
id("org.jetbrains.changelog") version "2.2.0"
id("org.jetbrains.intellij") version "1.14.2"
id("org.jetbrains.changelog") version "2.1.0"
}
version = properties("pluginVersion")
@ -18,16 +18,16 @@ repositories {
}
dependencies {
implementation("com.github.anas-elgarhy:alquran-cloud-api:0.4.5")
implementation("com.miglayout:miglayout-swing:11.2")
implementation("com.github.anas-elgarhy:alquran-cloud-api:0.4.4")
implementation("com.miglayout:miglayout-swing:11.1")
// implementation("com.github.goxr3plus:java-stream-player:10.0.2")
implementation("com.googlecode.soundlibs:jlayer:1.0.1.4")
compileOnly("org.projectlombok:lombok:1.18.30")
annotationProcessor("org.projectlombok:lombok:1.18.30")
compileOnly("org.projectlombok:lombok:1.18.28")
annotationProcessor("org.projectlombok:lombok:1.18.28")
testImplementation("org.projectlombok:lombok:1.18.30")
testAnnotationProcessor("org.projectlombok:lombok:1.18.30")
testImplementation("org.projectlombok:lombok:1.18.28")
testAnnotationProcessor("org.projectlombok:lombok:1.18.28")
}
java {
sourceCompatibility = JavaVersion.VERSION_17

Binary file not shown.

View file

@ -1,7 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

22
gradlew vendored
View file

@ -83,8 +83,7 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@ -131,13 +130,10 @@ location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
@ -145,7 +141,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@ -153,7 +149,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@ -202,11 +198,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \

View file

@ -3,7 +3,7 @@
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="2" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/>
<constraints>
<xy x="48" y="54" width="577" height="355"/>
<xy x="48" y="54" width="836" height="472"/>
</constraints>
<properties>
<maximumSize width="500" height="300"/>
@ -18,7 +18,7 @@
<properties/>
<border type="none"/>
<children>
<grid id="9538f" layout-manager="GridLayoutManager" row-count="2" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="9538f" layout-manager="GridLayoutManager" row-count="3" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="6" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@ -60,18 +60,59 @@
</component>
</children>
</grid>
<component id="69418" class="javax.swing.JButton" binding="previousButton">
<grid id="e3ffd" layout-manager="GridBagLayout">
<constraints>
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="4" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="true"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="c14dc" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="1.0"/>
</constraints>
<properties>
<text value="Previous"/>
<toolTipText value="Previous Aah"/>
<text value="Tafseer/Translation"/>
<verifyInputWhenFocusTarget value="false"/>
</properties>
</component>
<component id="1bfe0" class="javax.swing.JComboBox" binding="tafseerAndTranslationComboBox">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
<gridbag weightx="1.0" weighty="1.0"/>
</constraints>
<properties/>
</component>
<component id="82c3f" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="1.0"/>
</constraints>
<properties>
<text value="Edition"/>
</properties>
</component>
<component id="3ac9d" class="javax.swing.JComboBox" binding="editionComboBox">
<constraints>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
<gridbag weightx="1.0" weighty="1.0"/>
</constraints>
<properties/>
</component>
</children>
</grid>
<grid id="d5ada" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="1" col-span="4" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="b465c" class="javax.swing.JButton" binding="nextButton" default-binding="true">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<hideActionText value="true"/>
@ -79,6 +120,17 @@
<toolTipText value="Nexit ayah"/>
</properties>
</component>
<component id="69418" class="javax.swing.JButton" binding="previousButton">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Previous"/>
<toolTipText value="Previous Aah"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
<component id="893ab" class="javax.swing.JCheckBox" binding="autoPlayCheckBox" default-binding="true">
@ -107,7 +159,7 @@
</component>
</children>
</grid>
<grid id="e3588" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="e3588" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@ -137,6 +189,25 @@
</component>
</children>
</scrollpane>
<scrollpane id="6058b">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="db36" class="javax.swing.JTextArea" binding="tafseerTextArea">
<constraints/>
<properties>
<editable value="false"/>
<focusable value="false"/>
<lineWrap value="true"/>
<preferredSize width="549" height="18"/>
<wrapStyleWord value="true"/>
</properties>
</component>
</children>
</scrollpane>
</children>
</grid>
</children>

View file

@ -2,15 +2,19 @@ package com.anas.intellij.plugins.ayah.dialogs;
import com.anas.alqurancloudapi.Ayah;
import com.anas.alqurancloudapi.consts.Constants;
import com.anas.alqurancloudapi.edition.Edition;
import com.anas.alqurancloudapi.edition.EditionFormat;
import com.anas.intellij.plugins.ayah.audio.AudioPlayer;
import com.anas.intellij.plugins.ayah.audio.PlayerListener;
import javazoom.jl.player.advanced.PlaybackEvent;
import com.anas.intellij.plugins.ayah.settings.userinterface.ReadableEdition;
import javax.swing.*;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import java.util.Arrays;
import java.util.Objects;
/**
* @author <a href="https://github.com/anas-elgarhy">Anas Elgarhy</a>
@ -28,6 +32,9 @@ public class AyahDetailsDialog extends JDialog implements PlayerListener {
private JButton previousButton;
private JButton nextButton;
private JCheckBox autoPlayCheckBox;
private JTextArea tafseerTextArea;
private JComboBox<ReadableEdition> tafseerAndTranslationComboBox;
private JComboBox<ReadableEdition> editionComboBox;
private boolean isPlaying;
private AudioPlayer audioPlayer;
private Ayah ayah;
@ -37,21 +44,55 @@ public class AyahDetailsDialog extends JDialog implements PlayerListener {
setContentPane(contentPane);
setModal(true);
setSize(500, 300);
setSize(520, 320);
setResizable(false);
setLocationRelativeTo(null);
getRootPane().setDefaultButton(playButton);
updateAhaDetails();
try {
setupTheUI();
} catch (final IOException e) {
e.printStackTrace();
JOptionPane.showMessageDialog(this, "Error while loading the ayah details",
"Error", JOptionPane.ERROR_MESSAGE);
}
addListeners();
}
private void updateAhaDetails() {
private void setupTheUI() throws IOException {
previousButton.setEnabled(ayah.getNumber() != 1 && ayah.getSurah().getNumber() != 1);
nextButton.setEnabled(ayah.getNumber() != Constants.AYAHS_COUNT && ayah.getSurah().getNumber() != Constants.SURAS_COUNT);
final var tafserAndTranslationComboBoxModel = new DefaultComboBoxModel<ReadableEdition>();
final var editionComboBoxModel = new DefaultComboBoxModel<ReadableEdition>();
Arrays.stream(Edition.getEditions()).forEach(edition -> {
if (edition.getFormat() == EditionFormat.AUDIO) {
editionComboBoxModel.addElement(new ReadableEdition(edition));
} else {
tafserAndTranslationComboBoxModel.addElement(new ReadableEdition(edition));
}
});
tafseerAndTranslationComboBox.setModel(tafserAndTranslationComboBoxModel);
editionComboBox.setModel(editionComboBoxModel);
// Set the default selected item for the editionComboBox
editionComboBoxModel.setSelectedItem(new ReadableEdition(ayah.getEdition()));
// Set the actual information about the ayah in the UI
updateAyahDetails();
}
private void updateAyahDetails() {
// Update the ayah details
ayahTextArea.setText(ayah.getText());
surahNameLabel.setText(ayah.getSurah().getName());
numberOfAyahInSuarhLabel.setText("آية رقم: " + ayah.getNumberInSurah());
ayahRevelationType.setText(ayah.getSurah().getRevelationType().getArabicName());
// Update the tafseer or translation
updateTheTauseerTextArea();
}
private void addListeners() {
@ -92,6 +133,24 @@ public class AyahDetailsDialog extends JDialog implements PlayerListener {
}
});
tafseerAndTranslationComboBox.addActionListener(e -> {
updateTheTauseerTextArea();
});
editionComboBox.addActionListener(e -> {
final var selectedEdition = ((ReadableEdition) Objects.requireNonNull(
editionComboBox.getSelectedItem())).getEdition();
try {
ayah = Ayah.getAyah(ayah.getNumber(), selectedEdition);
updateAyahDetails();
} catch (final IOException ioException) {
ioException.printStackTrace();
JOptionPane.showMessageDialog(this,
"Error while loading the ayah - check your internet connection",
"Error", JOptionPane.ERROR_MESSAGE);
}
});
buttonCancel.addActionListener(l -> close());
// call onCancel() when cross is clicked
@ -108,6 +167,19 @@ public class AyahDetailsDialog extends JDialog implements PlayerListener {
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
}
private void updateTheTauseerTextArea() {
final var selectedEdition = ((ReadableEdition) Objects.requireNonNull(
tafseerAndTranslationComboBox.getSelectedItem())).getEdition();
try {
tafseerTextArea.setText(Ayah.getAyah(ayah.getNumber(), selectedEdition).getText());
} catch (final IOException ioException) {
ioException.printStackTrace();
JOptionPane.showMessageDialog(this,
"Error while loading the tafseer - check your internet connection",
"Error", JOptionPane.ERROR_MESSAGE);
}
}
private void close() {
if (audioPlayer != null) {
audioPlayer.stop();
@ -132,7 +204,7 @@ public class AyahDetailsDialog extends JDialog implements PlayerListener {
try {
ayah = Ayah.getAyah(ayhNumber,
ayah.getEdition().getIdentifier());
updateAhaDetails();
updateAyahDetails();
return true;
} catch (final IOException ex) {
JOptionPane.showMessageDialog(this,