Skip to content

Commit

Permalink
Merge pull request #2 from msdacsystems/dev
Browse files Browse the repository at this point in the history
Rename ah2 files to ahk
  • Loading branch information
msdacsys-admin authored Feb 15, 2024
2 parents 38192db + 1591a15 commit b44c94a
Show file tree
Hide file tree
Showing 25 changed files with 357 additions and 345 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ For developer-related changes, view the changes [here](https://github.com/msdacs

### Latest

*Changes for* update **v0.3.2** (2022-07-18)
- Added placeholder for search bar
- Changed version detection for case-sensitive names

*Changes for* update **v0.3.1** (2022-07-18)
- Auto-updater testing

Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,31 @@
[![](https://img.shields.io/sourceforge/dt/hymnalbrowser-lite?color=008dc9&label=SourceForge)](https://sourceforge.net/projects/hymnalbrowser-lite)

## What is Hymnal Browser?

Hymnal Browser makes it easier for users to present a hymn by just typing its number or searching a keyword.
![](res/mainmenu.png)


## Features

- Browse through 474 Hymns based on SDA Philippine Hymnal
- Supports English and Tagalog hymns

## Usage

1. Open **Hymnal Browser Lite**
2. Type the number or the title of the hymn
3. Click <Kbd>Launch</Kbd> or press <Kbd>Enter</Kbd> to launch the presentation.

## [Download Hymnal Browser Lite](https://sourceforge.net/projects/hymnalbrowser-lite/files/latest/download)

## Screenshots

![](res/screenshot.png)

## Support

- [Email](mailto:msdacsystems@gmail.com)
- [Changelog](CHANGELOG.md)
- [Documentation](DOCUMENTATION.md)

Hymnal Browser Lite © 2023 MSDAC Systems
Hymnal Browser Lite © 2024 MSDAC Systems
4 changes: 4 additions & 0 deletions compiler.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@REM Run this file to compile automatically

Ahk2Exe.exe /in "main.ahk" /compress 1
Start "" "Hymnal Browser Lite.exe"
80 changes: 40 additions & 40 deletions Hymnal Browser Lite.ah2 → main.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- Code ruler is 90 units
- Variable naming has type-value in which the type of the variable should precede
the actual name of the variable (e.g: TYPE_NAME_NAME -> DIR_DOCS_PROGRAM)
The rest of documentation can be found in DOCUMENTATION.md
-------------------------------------------------------------------------------------
Expand All @@ -22,7 +22,7 @@
Authors:
Ken Verdadero - @verdaderoken, Github
Reynald Ycong - @4raiven, Github
Written in AutoHotKey v2 Beta 4
Orig. 2022-04-22 prototype
Expand All @@ -31,51 +31,51 @@
Rev 3. 2022-06-10 updated to AHKv2 Beta 4
*/

__VERSION := "0.3.1.2"
__VERSION := "0.3.2.1"

/* AHK Settings */
#SingleInstance Force
#SingleInstance Force
#MaxThreads 100
SetTitleMatchMode("RegEx")
A_MaxHotkeysPerInterval := 5000
TraySetIcon(A_IconFile)
TraySetIcon("res/app_icon.ico")
/* External libraries */
#Include ..\lib\ext\Basic.ah2
#Include ..\lib\ext\GUIx.ah2
#Include ..\lib\ext\Maps.ah2
#Include ..\lib\ext\Misc.ah2
#Include ..\lib\ext\Object.ah2
#Include ..\lib\ext\Path.ah2
#Include ..\lib\ext\Types.ah2
#Include ..\lib\ext\Window.ah2
#Include ..\lib\Env.ah2
#Include ..\lib\7Zip.ah2
#Include ..\lib\KConfig.ah2
#Include ..\lib\KLogger.ah2
#Include ..\lib\GitHub.ah2
#Include %A_MyDocuments%\AutoHotkey\Lib\ext\Basic.ah2
#Include %A_MyDocuments%\AutoHotkey\Lib\ext\GUIx.ah2
#Include %A_MyDocuments%\AutoHotkey\Lib\ext\Maps.ah2
#Include %A_MyDocuments%\AutoHotkey\Lib\ext\Misc.ah2
#Include %A_MyDocuments%\AutoHotkey\Lib\ext\Object.ah2
#Include %A_MyDocuments%\AutoHotkey\Lib\ext\Path.ah2
#Include %A_MyDocuments%\AutoHotkey\Lib\ext\Types.ah2
#Include %A_MyDocuments%\AutoHotkey\Lib\ext\Window.ah2
#Include %A_MyDocuments%\AutoHotkey\Lib\Env.ah2
#Include %A_MyDocuments%\AutoHotkey\Lib\7Zip.ah2
#Include %A_MyDocuments%\AutoHotkey\Lib\KConfig.ah2
#Include %A_MyDocuments%\AutoHotkey\Lib\KLogger.ah2
#Include %A_MyDocuments%\AutoHotkey\Lib\GitHub.ah2
/* External classes */
#Include src\system\system.ah2
#Include src\system\errors.ah2
#Include src\system\fileManagement.ah2
#Include src\system\background.ah2
#Include src\system\events.ah2
#Include src\system\updater.ah2
#Include src\software.ah2
#Include src\ui.ah2
#Include src\config.ah2
#Include src\hymnal.ah2
#Include src\launcher.ah2
#Include src\session.ah2
#Include src/system\system.ahk
#Include src/system\errors.ahk
#Include src/system\fileManagement.ahk
#Include src/system\background.ahk
#Include src/system\events.ahk
#Include src/system\updater.ahk
#Include src/software.ahk
#Include src/ui.ahk
#Include src/config.ahk
#Include src/hymnal.ahk
#Include src/launcher.ahk
#Include src/session.ahk
/* Interface classes */
#Include src\interface\mainmenu.ah2
#Include src\interface\searchbar.ah2
#Include src\interface\buttons.ah2
#Include src\interface\completer.ah2
#Include src\interface\contextMenu.ah2
#Include src\interface\settings.ah2
#Include src/interface\mainmenu.ahk
#Include src/interface\searchbar.ahk
#Include src/interface\buttons.ahk
#Include src/interface\completer.ahk
#Include src/interface\contextMenu.ahk
#Include src/interface\settings.ahk
/* System Props */
;@Ahk2Exe-ExeName Hymnal Browser Lite
Expand All @@ -85,11 +85,11 @@ TraySetIcon(A_IconFile)
;@Ahk2Exe-SetOrigFilename Hymnal Browser Lite
;@Ahk2Exe-SetProductName Hymnal Browser Lite
;@Ahk2Exe-SetCompanyName MSDAC Systems
;@Ahk2Exe-SetCopyright (c) 2022 MSDAC Systems`, Verdadero`, Ycong
;@Ahk2Exe-SetLegalTrademarks (c) 2022 MSDAC Systems
;@Ahk2Exe-SetCopyright (c) 2024 MSDAC Systems`, Verdadero`, Ycong
;@Ahk2Exe-SetLegalTrademarks (c) 2024 MSDAC Systems
;@Ahk2Exe-SetMainIcon res/app_icon.ico
;@Ahk2Exe-SetFileVersion 0.3.1.2
;@Ahk2Exe-SetFileVersion 0.3.2.1
;@Ahk2Exe-SetLanguage 0x3409
;@Ahk2Exe-SetVersion 0.3.1.2
;@Ahk2Exe-SetVersion 0.3.2.1
System.Exec()
64 changes: 32 additions & 32 deletions src/config.ah2 → src/config.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@
Manages the configuration settings for Hymnal Browser Lite
(c) 2022 MSDAC Systems
Ken Verdadero, Reynald Ycong
Author: Ken Verdadero
Written 2022-06-04
*/

class Config {
/*
Configuration will be aliased to "CF" when referencing from other classes.
(i.e: CF.TEMP_MAX_RECENT)

The configuration will load the defaults first to the instance
before loading the custom settings specified in Software.FILE_CONFIG.
This is to prevent unexpected property errors.

All properties that has prefix of '__' in their names will be considered
as private properties, these will not be included in dumping configurations.

Improvements:
- Place the generatedDefaults config to A_Temp before moving to ProgramData
TODO: Place the generatedDefaults config to A_Temp before moving to ProgramData
in case the parent directories are also absent.
*/
static FILE := Software.FILE_CONFIG
static HEAD_TEXT := Format(
"{1} Configuration`nThis file was generated automatically."
"`n`n{2}`nLast updated: {3}",
Software.PARENT_NAME, Software.VERSION_STRING, Time.GetCurrentTime()
)
"{1} Configuration`nThis file was generated automatically."
"`n`n{2}`nLast updated: {3}",
Software.PARENT_NAME, Software.VERSION_STRING, Time.GetCurrentTime()
)

__New() {
if !FileExist(Config.FILE) {
Expand All @@ -40,7 +40,7 @@ class Config {
this.Load() ;; Loads the custom configuration; Conflicting keys will override the default.
}
}

Load() {
/*
Reads and loads from external configuration file.
Expand All @@ -58,39 +58,39 @@ class Config {
_LOG.Error("Config: There was an error loading the configuration", true)
return
}

this.ApplyData(this.__CFG)
_LOG.Info("Config: Successfully loaded configuration", true)
}

GetDefaults(includeHidden:=false, hiddenOnly:=false) {
GetDefaults(includeHidden := false, hiddenOnly := false) {
/*
Returns default configuration.

This method contains all the keys and values to be inserted when:
(1) the configuration was missing
(2) the configuration was corrupted (i.e, there's missing pairs)

The HID object contatins the configuration that system needs
The HID object contains the configuration that system needs
but not necessarily should be present in the configuration file.
This is useful for keys like VERBOSE_LOG as it's considered as an advanced
setting.

Configuration generator (Config.GenerateDefaults) should not include
the hidden keys, but they should be still defined in the system.

Maintainer could add default values using object structure.
This object will be converted to a configuration-readable file.

Objects are treated as a section.
Properties of an object are treated as pairs of keys and values.
Nested objects [sections] are not allowed.

See KConfig documentation for more info.
*/
DEF := Object()
HID := Object() ;; Hidden configuration that will not be present when generated. Still needed by the system

HID.TME_QUERY := 1 ;; Time delay before a hymn query is considered a count

HID.MAIN := Object()
Expand All @@ -113,14 +113,14 @@ class Config {
DEF.LAUNCH.FOCUS_BACK := false ;; Focus back to the main window after launching a presentation
DEF.LAUNCH.TYPE := 0 ;; Presenter type; 1 - Open, 2 - Open in Slideshow

DEF := (includeHidden ? ObjectMerge(DEF, HID):DEF)
return (hiddenOnly ? HID:DEF)
DEF := (includeHidden ? ObjectMerge(DEF, HID) : DEF)
return (hiddenOnly ? HID : DEF)
}

LoadDefaults(includeHidden:=false) => this.ApplyData(this.GetDefaults(includeHidden)) ;; Applies the default configuration to the base instance
LoadDefaults(includeHidden := false) => this.ApplyData(this.GetDefaults(includeHidden)) ;; Applies the default configuration to the base instance

ApplyData(configObject) {
/*
/*
Inherits configObject to config instance.
Keeps default keys that is absent in config.
*/
Expand All @@ -131,38 +131,38 @@ class Config {
if TypeMatch(val, "Object") { ;; Since object's properties will be fully replaced, we need to retain props that might be absent in the new data
C_CFG := this.GetDefaults(true) ;; Copy of default configuration
DEF := C_CFG.GetOwnPropDesc(name).Value ;; Retrieve default CFG.Object.Object value
this.DefineProp(name, {value: ObjectMerge(DEF, val)}) ;; ! Merged object will be defined; e.g: In case ALWAYS_ON_TOP is removed from CFG, the default will still be present.
this.DefineProp(name, { value: ObjectMerge(DEF, val) }) ;; ! Merged object will be defined; e.g: In case ALWAYS_ON_TOP is removed from CFG, the default will still be present.
continue
}
this.DefineProp(name, {value: val}) ;; Transfer the loaded configuration data to the instance's properties
this.DefineProp(name, { value: val }) ;; Transfer the loaded configuration data to the instance's properties
}
this.__CFG := configObject
this.__CFG := configObject ;; Backup of the original data
}

GenerateDefaults(autoReload:=true) {
GenerateDefaults(autoReload := true) {
/* Generates a configuration file based on the default values */
if KConfig.Dump(this.GetDefaults(), Config.FILE, Config.HEAD_TEXT) {
_LOG.Warn(
"Config: Required folders does not exists, "
"Config: Required folders does not exists, "
"invoking system to resolve", true)
System.VerifyDirectories(true)
this.GenerateDefaults()
} else {
_LOG.Info("Config: Configuration was generated successfully.", true)
(autoReload ? this.LoadDefaults(true):0)
(autoReload ? this.LoadDefaults(true) : 0)
}
}
Dump() {
/*
Dumps the updated configuration to file.
Dumps the updated configuration to file.
*/
F_CFG := Object() ;; Filtered configuration
for name, val in this.OwnProps() {
if SubStr(name, 1, 2) == '__' { ;; Ignore all entries that prefixes '__' since they are considered as private properties
continue
}
F_CFG.DefineProp(name, {value: val})
F_CFG.DefineProp(name, { value: val })
}
F_CFG := ObjectSub(F_CFG, this.GetDefaults(, true)) ;; ! Needs review
KConfig.Dump(F_CFG, Config.FILE, Config.HEAD_TEXT)
Expand Down
Loading

0 comments on commit b44c94a

Please sign in to comment.