-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add app menu with self-updating, feedback reporting, and modern about…
… dialog
- Loading branch information
Showing
35 changed files
with
219 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
SquotTrackedObjectMetadata { | ||
#objectClassName : #PackageInfo, | ||
#id : UUID [ '754834ba8adc4221ac3980e7f59502f9' ], | ||
#objectsReplacedByNames : true, | ||
#serializer : #SquotCypressCodeSerializer | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/BaselineOfSwaLint.package/BaselineOfSwaLint.class/instance/projectClass.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
projectClass | ||
|
||
^ (self environment classNamed: #MetacelloCypressBaselineProject) ifNil: [super projectClass] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/SwaLint-Core.package/SLDefaultDialog.class/instance/addModelItemsToWindowMenu..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
building | ||
addModelItemsToWindowMenu: menu | ||
|
||
menu addLine. | ||
SwaLint appMenu: menu. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/SwaLint-Core.package/SwaLint.class/class/appMenu..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
app - menu | ||
appMenu: menu | ||
|
||
menu | ||
"add: 'about' target: self action: #showAbout;" | ||
add: 'options' target: SLPreferenceBrowser action: #open; | ||
add: 'self-update...' target: self action: #doSelfUpdate; | ||
balloonTextForLastItem: ('download and install the latest updates for {1}' format: {self appName}); | ||
add: 'send feedback...' target: self action: #sendFeedback. | ||
|
||
^ menu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
app - accessing | ||
appName | ||
|
||
^ self swaLint |
4 changes: 4 additions & 0 deletions
4
packages/SwaLint-Core.package/SwaLint.class/class/basicSelfUpdateBranch..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
app - self-updating | ||
basicSelfUpdateBranch: aString | ||
|
||
SelfUpdateBranch := aString. |
8 changes: 8 additions & 0 deletions
8
packages/SwaLint-Core.package/SwaLint.class/class/defaultFeedbackText.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
app - feedback | ||
defaultFeedbackText | ||
|
||
^ '<br><br><i>Reported from {1} (VM: {2}), for version of {3} last updated at {4}.</i>' asTextFromHtml format: | ||
{SystemVersion current. | ||
([Smalltalk vm openSmalltalkVMBuildNumber] ifError: [nil]) ifNil: [Smalltalk platformSourceVersion]. | ||
self appName. | ||
self latestTimeStamp} |
11 changes: 11 additions & 0 deletions
11
packages/SwaLint-Core.package/SwaLint.class/class/defaultSelfUpdateBranch.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
app - self-updating | ||
defaultSelfUpdateBranch | ||
|
||
(self environment classNamed: #MCRepositoryGroup) ifNotNil: [:mcRepositoryGroupClass | | ||
| repoPrefix | | ||
repoPrefix := 'github://{1}/{2}' format: {self githubRepositoryParams first. self githubRepositoryParams second}. | ||
mcRepositoryGroupClass default repositories | ||
detect: [:repo | repo description beginsWith: repoPrefix] | ||
ifFound: [:repo | ^ repo projectVersion]]. | ||
|
||
^ 'main' |
7 changes: 7 additions & 0 deletions
7
packages/SwaLint-Core.package/SwaLint.class/class/doSelfUpdate.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
app - self-updating | ||
doSelfUpdate | ||
|
||
(Project uiManager confirm: ('Are you sure you would like to install the latest updates for {1}?' withCRs format: {self appName})) ifFalse: [^ false]. | ||
|
||
self selfUpdate. | ||
^ true |
7 changes: 7 additions & 0 deletions
7
packages/SwaLint-Core.package/SwaLint.class/class/githubNewIssueUrl.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
app - feedback | ||
githubNewIssueUrl | ||
|
||
^ self githubNewIssueUrlWithBody: '<!-- Your feedback goes here -->\' withCRs, (String streamContents: [:stream | | ||
(HtmlReadWriter on: stream) | ||
breakLines: false; | ||
nextPutText: self defaultFeedbackText]) |
8 changes: 8 additions & 0 deletions
8
packages/SwaLint-Core.package/SwaLint.class/class/githubNewIssueUrlWithBody..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
app - feedback | ||
githubNewIssueUrlWithBody: htmlString | ||
|
||
^ 'https://github.com/{1}/{2}/issues/new?{3}' format: { | ||
self githubRepositoryParams first. | ||
self githubRepositoryParams second. | ||
WebUtils encodeUrlEncodedForm: { | ||
'body' -> htmlString}} |
5 changes: 5 additions & 0 deletions
5
packages/SwaLint-Core.package/SwaLint.class/class/githubRepositoryParams.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
app - accessing | ||
githubRepositoryParams | ||
"{owner. name. directory}" | ||
|
||
^ {'hpi-swa-teaching'. 'SwaLint'. 'packages'} |
6 changes: 6 additions & 0 deletions
6
packages/SwaLint-Core.package/SwaLint.class/class/githubUrl.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
app - accessing | ||
githubUrl | ||
|
||
^ 'https://github.com/{1}/{2}' format: { | ||
self githubRepositoryParams first. | ||
self githubRepositoryParams second} |
9 changes: 9 additions & 0 deletions
9
packages/SwaLint-Core.package/SwaLint.class/class/latestTimeStamp.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
app - accessing | ||
latestTimeStamp | ||
|
||
| packages | | ||
packages := PackageInfo allPackages select: [:ea | '*SwaLint*' match: ea name]. | ||
^ CurrentReadOnlySourceFiles cacheDuring: | ||
[((packages gather: #methods) collect: | ||
[:method | [TimeStamp fromMethodTimeStamp: method timeStamp] ifError: [TimeStamp new]]) | ||
max] |
12 changes: 12 additions & 0 deletions
12
packages/SwaLint-Core.package/SwaLint.class/class/openUrl..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
app - feedback | ||
openUrl: urlString | ||
|
||
self flag: #moveUpstream. | ||
"Something similar but less convenient is also in TextURL >> #actOnClickFor:." | ||
WebBrowser defaultOrNil ifNotNil: [:browser | | ||
(Project uiManager | ||
confirm: ('Do you want to open this URL in a web browser?\\{1}' withCRs format: {urlString}) | ||
title: 'Open Web Page' translated) ifTrue: [browser openOnUrl: urlString]. | ||
^ self]. | ||
|
||
(urlString tdbAsTextWithAttribute: (TextURL new url: urlString)) editWithLabel: 'Requested URL'. |
38 changes: 21 additions & 17 deletions
38
packages/SwaLint-Core.package/SwaLint.class/class/projectDescription.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
accessing | ||
app - accessing | ||
projectDescription | ||
"Answer... read below..." | ||
|
||
^ ' | ||
', self swaLint, ' (v', self versionString, ') written by | ||
Christoph Neijenhuis, | ||
Johannes Dyck, | ||
Tobias Pape, | ||
Nico Rehwaldt and | ||
Arian Treffer, | ||
Jan-Tobias Matysik, | ||
Siegfried Horschig, | ||
Nico Aechtner, | ||
Toni Stachewicz, | ||
Niklas Hoffmann and | ||
Björn Daase. | ||
See http://swalint.netshed.de for more information.' | ||
^ ('{1} (v{2}) written by | ||
Christoph Neijenhuis, | ||
Johannes Dyck, | ||
Tobias Pape, | ||
Nico Rehwaldt, | ||
Arian Treffer, | ||
Jan-Tobias Matysik, | ||
Siegfried Horschig, | ||
Nico Aechtner, | ||
Toni Stachewicz, | ||
Niklas Hoffmann, | ||
Björn Daase, and | ||
Christoph Thiede. | ||
See <a href="{3}">{3}</a> for more information.' | ||
format: | ||
{self swaLint. | ||
self versionString. | ||
self githubUrl}) | ||
asTextFromHtml |
2 changes: 1 addition & 1 deletion
2
packages/SwaLint-Core.package/SwaLint.class/class/projectLogo.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
accessing | ||
app - accessing | ||
projectLogo | ||
"the SwaLint logo" | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
packages/SwaLint-Core.package/SwaLint.class/class/projectLogoContents.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
accessing | ||
app - accessing | ||
projectLogoContents | ||
"This is a base64 png" | ||
|
||
|
15 changes: 15 additions & 0 deletions
15
packages/SwaLint-Core.package/SwaLint.class/class/selfUpdate.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
app - self-updating | ||
selfUpdate | ||
"SwaLint selfUpdate" | ||
|
||
| squeakVersion | | ||
squeakVersion := SystemVersion current version. | ||
((Project uiManager | ||
confirm: ('It is recommended to install the latest updates for {1} first.' format: {squeakVersion}) | ||
title: ('Updating {1}' format: {self appName}) | ||
trueChoice: ('Yes, install latest {1} updates now' format: {'Squeak'}) | ||
falseChoice: ('Skip latest {1} updates (not recommended)' format: {'Squeak'})) | ||
ifNil: [^ self]) | ||
ifTrue: [MCMcmUpdater default doUpdate: true]. | ||
|
||
^ self selfUpdateFromMetacello |
7 changes: 7 additions & 0 deletions
7
packages/SwaLint-Core.package/SwaLint.class/class/selfUpdateBranch..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
app - self-updating | ||
selfUpdateBranch: aString | ||
|
||
self basicSelfUpdateBranch: aString. | ||
|
||
(Project uiManager confirm: 'Would you like to install updates now?' title: ('{1} self-update' format: {self appName})) | ||
ifTrue: [self selfUpdate]. |
12 changes: 12 additions & 0 deletions
12
packages/SwaLint-Core.package/SwaLint.class/class/selfUpdateBranch.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
app - self-updating | ||
selfUpdateBranch | ||
<slpreference: 'SwaLint self-update branch' | ||
type: #String | ||
categories: #(SwaLint) | ||
defaultValue: '' | ||
helpText: 'The branch used for installing updates for SwaLint from the GitHub repository.' | ||
projectLocal: false | ||
changeInformee: #SwaLint | ||
changeSelector: #refresh> | ||
|
||
^ SelfUpdateBranch ifNil: [self defaultSelfUpdateBranch] |
8 changes: 8 additions & 0 deletions
8
packages/SwaLint-Core.package/SwaLint.class/class/selfUpdateFromMetacello.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
app - self-updating | ||
selfUpdateFromMetacello | ||
|
||
Metacello new | ||
baseline: self appName; | ||
repository: self selfUpdateGitHubPath; | ||
get; | ||
load. |
7 changes: 7 additions & 0 deletions
7
packages/SwaLint-Core.package/SwaLint.class/class/selfUpdateGitHubPath.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
app - self-updating | ||
selfUpdateGitHubPath | ||
|
||
^ ('github://{1}/{2}:\{1\}/{3}' format: { | ||
self githubRepositoryParams first. | ||
self githubRepositoryParams second. | ||
self githubRepositoryParams third}) format: {self selfUpdateBranch} |
4 changes: 4 additions & 0 deletions
4
packages/SwaLint-Core.package/SwaLint.class/class/sendFeedback.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
app - feedback | ||
sendFeedback | ||
|
||
^ self sendFeedbackGitHub |
4 changes: 4 additions & 0 deletions
4
packages/SwaLint-Core.package/SwaLint.class/class/sendFeedbackGitHub.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
app - feedback | ||
sendFeedbackGitHub | ||
|
||
self openUrl: self githubNewIssueUrl |
7 changes: 7 additions & 0 deletions
7
packages/SwaLint-Core.package/SwaLint.class/class/showAbout.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
app - accessing | ||
showAbout | ||
|
||
| text | | ||
text := (Text string: Character startOfHeader asString attribute: self projectLogo asTextAnchor) | ||
, String cr , self projectDescription. | ||
^ text editWithLabel: ('About {1}' format: {self swaLint}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
accessing | ||
app - accessing | ||
swaLint | ||
|
||
^ 'SwaLint Code Critics' |
2 changes: 1 addition & 1 deletion
2
packages/SwaLint-Core.package/SwaLint.class/class/versionString.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
accessing | ||
app - accessing | ||
versionString | ||
|
||
^ '4.2.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
SquotTrackedObjectMetadata { | ||
#objectClassName : #PackageInfo, | ||
#id : UUID [ '3838eeacfc88474badc38b5e34dd6e39' ], | ||
#objectsReplacedByNames : true, | ||
#serializer : #SquotCypressCodeSerializer | ||
} |
4 changes: 1 addition & 3 deletions
4
packages/SwaLint-Preferences.package/SLPreferenceBrowser.class/instance/aboutSelected.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
initialization | ||
aboutSelected | ||
|
||
^ (PopUpMenu labels: ' OK ' translated) | ||
startUpWithCaption: (SwaLint projectDescription withNoLineLongerThan: 35) | ||
icon: (Smalltalk at: #SwaLint) projectLogo | ||
^ SwaLint showAbout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters