diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 45700b0..1cff904 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,10 +26,10 @@ jobs: steps: - name: Fetch Sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Gradle Wrapper Validation - uses: gradle/wrapper-validation-action@v1.0.6 + uses: gradle/wrapper-validation-action@v1.1.0 # Run verifyPlugin and test Gradle tasks test: @@ -45,16 +45,16 @@ jobs: distribution: 'zulu' - name: Fetch Sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Gradle Dependencies Cache - uses: actions/cache@v3.3.1 + uses: actions/cache@v4.0.0 with: path: ~/.gradle/caches key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }} - name: Setup Gradle Wrapper Cache - uses: actions/cache@v3.3.1 + uses: actions/cache@v4.0.0 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@v3 + uses: actions/checkout@v4 - name: Setup Gradle Dependencies Cache - uses: actions/cache@v3.3.1 + uses: actions/cache@v4.0.0 with: path: ~/.gradle/caches key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }} - name: Setup Gradle Wrapper Cache - uses: actions/cache@v3.3.1 + uses: actions/cache@v4.0.0 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@v3.1.2 + uses: actions/upload-artifact@v4.2.0 with: name: plugin-artifact path: ./build/distributions/${{ needs.build.outputs.artifact }} @@ -136,16 +136,16 @@ jobs: distribution: 'zulu' - name: Fetch Sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Gradle Dependencies Cache - uses: actions/cache@v3.3.1 + uses: actions/cache@v4.0.0 with: path: ~/.gradle/caches key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }} - name: Setup Gradle Wrapper Cache - uses: actions/cache@v3.3.1 + uses: actions/cache@v4.0.0 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@v3.3.1 + uses: actions/cache@v4.0.0 with: path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides key: ${{ runner.os }}-plugin-verifier-${{ steps.properties.outputs.ideVersions }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6d0f534..f87e63a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,7 +21,7 @@ jobs: # distribution: 'zulu' # # - name: Fetch Sources -# uses: actions/checkout@v3 +# uses: actions/checkout@v4 # with: # ref: ${{ github.event.release.tag_name }} # @@ -43,16 +43,16 @@ jobs: distribution: 'zulu' - name: Fetch Sources - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Gradle Dependencies Cache - uses: actions/cache@v3.3.1 + uses: actions/cache@v4.0.0 with: path: ~/.gradle/caches key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }} - name: Setup Gradle Wrapper Cache - uses: actions/cache@v3.3.1 + uses: actions/cache@v4.0.0 with: path: ~/.gradle/wrapper key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} diff --git a/build.gradle.kts b/build.gradle.kts index 51d8e96..6861598 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,8 +5,8 @@ fun properties(key: String) = project.findProperty(key).toString() plugins { id("java") - id("org.jetbrains.intellij") version "1.14.0" - id("org.jetbrains.changelog") version "2.1.0" + id("org.jetbrains.intellij") version "1.17.0" + id("org.jetbrains.changelog") version "2.2.0" } version = properties("pluginVersion") @@ -18,16 +18,16 @@ repositories { } dependencies { - implementation("com.github.anas-elgarhy:alquran-cloud-api:0.4.4") - implementation("com.miglayout:miglayout-swing:11.1") + implementation("com.github.anas-elgarhy:alquran-cloud-api:0.4.5") + implementation("com.miglayout:miglayout-swing:11.2") // 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.28") - annotationProcessor("org.projectlombok:lombok:1.18.28") + compileOnly("org.projectlombok:lombok:1.18.30") + annotationProcessor("org.projectlombok:lombok:1.18.30") - testImplementation("org.projectlombok:lombok:1.18.28") - testAnnotationProcessor("org.projectlombok:lombok:1.18.28") + testImplementation("org.projectlombok:lombok:1.18.30") + testAnnotationProcessor("org.projectlombok:lombok:1.18.30") } java { sourceCompatibility = JavaVersion.VERSION_17 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 033e24c..7f93135 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 62f495d..a80b22c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index fcb6fca..1aa94a4 100755 --- a/gradlew +++ b/gradlew @@ -83,7 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +# 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 # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -144,7 +145,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=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +153,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=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -201,11 +202,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, 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. +# 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. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/screenshots/notifcation_0.0.1 b/screenshots/notification_0.0.1 similarity index 100% rename from screenshots/notifcation_0.0.1 rename to screenshots/notification_0.0.1 diff --git a/src/main/java/com/anas/intellij/plugins/ayah/dialogs/AyahDetailsDialog.form b/src/main/java/com/anas/intellij/plugins/ayah/dialogs/AyahDetailsDialog.form index ce5d260..8d28764 100644 --- a/src/main/java/com/anas/intellij/plugins/ayah/dialogs/AyahDetailsDialog.form +++ b/src/main/java/com/anas/intellij/plugins/ayah/dialogs/AyahDetailsDialog.form @@ -3,7 +3,7 @@ - + @@ -18,7 +18,7 @@ - + @@ -60,77 +60,25 @@ - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + @@ -159,7 +107,7 @@ - + @@ -189,25 +137,6 @@ - - - - - - - - - - - - - - - - - - - diff --git a/src/main/java/com/anas/intellij/plugins/ayah/dialogs/AyahDetailsDialog.java b/src/main/java/com/anas/intellij/plugins/ayah/dialogs/AyahDetailsDialog.java index c1d08f4..a0f8a1b 100644 --- a/src/main/java/com/anas/intellij/plugins/ayah/dialogs/AyahDetailsDialog.java +++ b/src/main/java/com/anas/intellij/plugins/ayah/dialogs/AyahDetailsDialog.java @@ -2,19 +2,15 @@ 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 com.anas.intellij.plugins.ayah.settings.userinterface.ReadableEdition; +import javazoom.jl.player.advanced.PlaybackEvent; 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 Anas Elgarhy @@ -32,9 +28,6 @@ public class AyahDetailsDialog extends JDialog implements PlayerListener { private JButton previousButton; private JButton nextButton; private JCheckBox autoPlayCheckBox; - private JTextArea tafseerTextArea; - private JComboBox tafseerAndTranslationComboBox; - private JComboBox editionComboBox; private boolean isPlaying; private AudioPlayer audioPlayer; private Ayah ayah; @@ -44,55 +37,21 @@ public class AyahDetailsDialog extends JDialog implements PlayerListener { setContentPane(contentPane); setModal(true); - setSize(520, 320); + setSize(500, 300); setResizable(false); setLocationRelativeTo(null); getRootPane().setDefaultButton(playButton); - try { - setupTheUI(); - } catch (final IOException e) { - e.printStackTrace(); - JOptionPane.showMessageDialog(this, "Error while loading the ayah details", - "Error", JOptionPane.ERROR_MESSAGE); - } + updateAhaDetails(); addListeners(); } - 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(); - final var editionComboBoxModel = new DefaultComboBoxModel(); - - 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 + private void updateAhaDetails() { 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() { @@ -133,24 +92,6 @@ 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 @@ -167,19 +108,6 @@ 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(); @@ -204,7 +132,7 @@ public class AyahDetailsDialog extends JDialog implements PlayerListener { try { ayah = Ayah.getAyah(ayhNumber, ayah.getEdition().getIdentifier()); - updateAyahDetails(); + updateAhaDetails(); return true; } catch (final IOException ex) { JOptionPane.showMessageDialog(this,