Skip to content

Commit 82628a6

Browse files
authored
Merge pull request #7 from ILoveGameCoding/develop
Release CodeXP v1.1.0
2 parents e09bd48 + f92f9dd commit 82628a6

File tree

11 files changed

+334
-122
lines changed

11 files changed

+334
-122
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@
33
# CodeXP Changelog
44

55
## [Unreleased]
6+
7+
### Added
8+
9+
- Add CodeXP configuration in IDE setting
10+
- Add checkbox for show/hide completed challenges
11+
12+
## [1.0.0] - 2023-06-04
13+
614
### Added
15+
716
- Implement core logic of CodeXP
817
- Implement CodeXP Dashboard
918
- Define events to detect and add challenges for each event

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pluginGroup = com.github.ilovegamecoding.intellijcodexp
44
pluginName = intellij-codexp
55
pluginRepositoryUrl = https://github.com/ILoveGameCoding/intellij-codexp
66
# SemVer format -> https://semver.org
7-
pluginVersion = 1.0.0
7+
pluginVersion=1.1.0
88

99
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
1010
pluginSinceBuild = 221
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.github.ilovegamecoding.intellijcodexp.form.CodeXPConfigurationForm">
3+
<grid id="27dc6" binding="pMain" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
4+
<margin top="0" left="0" bottom="0" right="0"/>
5+
<constraints>
6+
<xy x="20" y="20" width="567" height="400"/>
7+
</constraints>
8+
<properties/>
9+
<border type="none"/>
10+
<children>
11+
<component id="b610" class="javax.swing.JLabel">
12+
<constraints>
13+
<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"/>
14+
</constraints>
15+
<properties>
16+
<font/>
17+
<text resource-bundle="messages/CodeXPBundle" key="TEXT_NOTIFICATION"/>
18+
</properties>
19+
</component>
20+
<component id="9ae23" class="javax.swing.JCheckBox" binding="cbShowLevelUpNotification">
21+
<constraints>
22+
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
23+
</constraints>
24+
<properties>
25+
<text resource-bundle="messages/CodeXPBundle" key="TEXT_SHOW_LEVEL_UP_NOTIFICATION"/>
26+
</properties>
27+
</component>
28+
<component id="629a5" class="javax.swing.JCheckBox" binding="cbShowCompleteChallengeNotification">
29+
<constraints>
30+
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
31+
</constraints>
32+
<properties>
33+
<text resource-bundle="messages/CodeXPBundle" key="TEXT_SHOW_COMPLETE_CHALLENGE_NOTIFICATION"/>
34+
</properties>
35+
</component>
36+
<vspacer id="43cd9">
37+
<constraints>
38+
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
39+
</constraints>
40+
</vspacer>
41+
</children>
42+
</grid>
43+
</form>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.github.ilovegamecoding.intellijcodexp.form;
2+
3+
import javax.swing.*;
4+
5+
public class CodeXPConfigurationForm {
6+
public JCheckBox cbShowCompleteChallengeNotification;
7+
public JCheckBox cbShowLevelUpNotification;
8+
public JCheckBox cbShowCompletedChallenges;
9+
public JPanel pMain;
10+
}

src/main/java/com/github/ilovegamecoding/intellijcodexp/form/CodeXPDashboard.form renamed to src/main/java/com/github/ilovegamecoding/intellijcodexp/form/CodeXPDashboardForm.form

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.github.ilovegamecoding.intellijcodexp.form.CodeXPDashboard">
2+
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.github.ilovegamecoding.intellijcodexp.form.CodeXPDashboardForm">
33
<grid id="27dc6" binding="pMain" layout-manager="GridLayoutManager" row-count="12" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
44
<margin top="0" left="0" bottom="0" right="0"/>
55
<constraints>
6-
<xy x="20" y="20" width="606" height="622"/>
6+
<xy x="20" y="20" width="606" height="649"/>
77
</constraints>
88
<properties/>
99
<border type="none"/>
@@ -395,7 +395,7 @@
395395
</component>
396396
</children>
397397
</grid>
398-
<grid id="906b2" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
398+
<grid id="906b2" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
399399
<margin top="16" left="8" bottom="0" right="0"/>
400400
<constraints>
401401
<grid row="9" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="true"/>
@@ -412,6 +412,14 @@
412412
<text resource-bundle="messages/CodeXPBundle" key="TEXT_COMPLETED_CHALLENGES"/>
413413
</properties>
414414
</component>
415+
<component id="65246" class="javax.swing.JCheckBox" binding="cbShowCompletedChallenges">
416+
<constraints>
417+
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
418+
</constraints>
419+
<properties>
420+
<text resource-bundle="messages/CodeXPBundle" key="TEXT_SHOW_COMPLETED_CHALLENGES"/>
421+
</properties>
422+
</component>
415423
</children>
416424
</grid>
417425
<vspacer id="9769b">

src/main/java/com/github/ilovegamecoding/intellijcodexp/form/CodeXPDashboard.java renamed to src/main/java/com/github/ilovegamecoding/intellijcodexp/form/CodeXPDashboardForm.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import javax.swing.*;
44

5-
public class CodeXPDashboard {
5+
public class CodeXPDashboardForm {
66
public JPanel pMain;
77
public JProgressBar pbCurrentLevelProgress;
88
public JLabel lblNextLevel;
@@ -16,4 +16,5 @@ public class CodeXPDashboard {
1616
public JPanel pEventStatistics;
1717
public JPanel pChallenges;
1818
public JLabel lblCompletedChallengesCount;
19+
public JCheckBox cbShowCompletedChallenges;
1920
}

src/main/kotlin/com/github/ilovegamecoding/intellijcodexp/services/CodeXPService.kt

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,12 @@ class CodeXPService : PersistentStateComponent<CodeXPService.CodeXPState>, CodeX
6868
/**
6969
* Challenges that have been completed.
7070
*/
71-
var completedChallenges: MutableList<CodeXPChallenge> = mutableListOf()
71+
var completedChallenges: MutableList<CodeXPChallenge> = mutableListOf(),
72+
73+
/**
74+
* Show completed challenges in the dashboard.
75+
*/
76+
var showCompletedChallenges: Boolean = true
7277
) {
7378
/**
7479
* Increment the event count for a specific event.
@@ -86,11 +91,31 @@ class CodeXPService : PersistentStateComponent<CodeXPService.CodeXPState>, CodeX
8691
}
8792
}
8893

94+
/**
95+
* The configuration of the CodeXP plugin
96+
*/
97+
data class CodeXPConfiguration(
98+
/**
99+
* Show a notification when the user levels up.
100+
*/
101+
var showLevelUpNotification: Boolean = true,
102+
103+
/**
104+
* Show a notification when the user completes a challenge.
105+
*/
106+
var showCompleteChallengeNotification: Boolean = true
107+
)
108+
89109
/**
90110
* The state of the CodeXP plugin
91111
*/
92112
private var codeXPState: CodeXPState = CodeXPState()
93113

114+
/**
115+
* The configuration of the CodeXP plugin
116+
*/
117+
var codeXPConfiguration: CodeXPConfiguration = CodeXPConfiguration()
118+
94119
/**
95120
* The message bus for the plugin
96121
*/
@@ -265,7 +290,9 @@ class CodeXPService : PersistentStateComponent<CodeXPService.CodeXPState>, CodeX
265290
if (challenge.progress >= challenge.goal) {
266291
codeXPState.xp += challenge.rewardXP
267292
replaceChallengeWithNew(challenge, event)
268-
CodeXPNotificationManager.notifyChallengeComplete(challenge)
293+
294+
if (codeXPConfiguration.showCompleteChallengeNotification)
295+
CodeXPNotificationManager.notifyChallengeComplete(challenge)
269296
}
270297
}
271298
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package com.github.ilovegamecoding.intellijcodexp.toolWindow
2+
3+
import com.github.ilovegamecoding.intellijcodexp.form.CodeXPConfigurationForm
4+
import com.github.ilovegamecoding.intellijcodexp.services.CodeXPService
5+
import com.intellij.openapi.application.ApplicationManager
6+
import com.intellij.openapi.options.Configurable
7+
import javax.swing.JComponent
8+
9+
/**
10+
* CodeXPConfigurable class
11+
*
12+
* CodeXPConfigurable is the class that is used to create the configuration window for the plugin.
13+
*/
14+
class CodeXPConfigurable : Configurable {
15+
/**
16+
* CodeXP configuration form.
17+
*/
18+
private var codeXPConfigurationForm: CodeXPConfigurationForm? = null
19+
20+
/**
21+
* CodeXP service.
22+
*/
23+
private val codeXPService = ApplicationManager.getApplication().getService(CodeXPService::class.java)
24+
25+
override fun createComponent(): JComponent? {
26+
// Create the configuration form and set the values to the current configuration.
27+
codeXPConfigurationForm = CodeXPConfigurationForm().also { form ->
28+
form.cbShowLevelUpNotification.isSelected = codeXPService.codeXPConfiguration.showLevelUpNotification
29+
form.cbShowCompleteChallengeNotification.isSelected =
30+
codeXPService.codeXPConfiguration.showCompleteChallengeNotification
31+
}
32+
return codeXPConfigurationForm!!.pMain
33+
}
34+
35+
override fun isModified(): Boolean {
36+
return codeXPConfigurationForm!!.cbShowLevelUpNotification.isSelected != codeXPService.codeXPConfiguration.showLevelUpNotification ||
37+
codeXPConfigurationForm!!.cbShowCompleteChallengeNotification.isSelected != codeXPService.codeXPConfiguration.showCompleteChallengeNotification
38+
}
39+
40+
override fun apply() {
41+
codeXPService.codeXPConfiguration.showLevelUpNotification =
42+
codeXPConfigurationForm!!.cbShowLevelUpNotification.isSelected
43+
codeXPService.codeXPConfiguration.showCompleteChallengeNotification =
44+
codeXPConfigurationForm!!.cbShowCompleteChallengeNotification.isSelected
45+
}
46+
47+
override fun getDisplayName(): String {
48+
return "CodeXP"
49+
}
50+
}

0 commit comments

Comments
 (0)