Compare commits
	
		
			7 Commits
		
	
	
		
			2e93b3e2f3
			...
			main
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| acc2245865 | |||
| 7c3ba17a36 | |||
| 17020fcab4 | |||
| 5901b5f4c9 | |||
| d41f72280a | |||
| 4814c6e7c2 | |||
| 773d00b335 | 
@@ -4,7 +4,7 @@
 | 
				
			|||||||
import PackageDescription
 | 
					import PackageDescription
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let package = Package(
 | 
					let package = Package(
 | 
				
			||||||
    name: "Adwaita Template",
 | 
					    name: "Poor Man's Calculator",
 | 
				
			||||||
    platforms: [
 | 
					    platforms: [
 | 
				
			||||||
        .macOS(.v13)
 | 
					        .macOS(.v13)
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
@@ -14,18 +14,32 @@ let package = Package(
 | 
				
			|||||||
    ],
 | 
					    ],
 | 
				
			||||||
    targets: [
 | 
					    targets: [
 | 
				
			||||||
        .executableTarget(
 | 
					        .executableTarget(
 | 
				
			||||||
            name: "AdwaitaTemplate",
 | 
					            name: "PMCalc",
 | 
				
			||||||
            dependencies: [
 | 
					            dependencies: [
 | 
				
			||||||
                .product(name: "Adwaita", package: "adwaita-swift"),
 | 
					                .product(name: "Adwaita", package: "adwaita-swift"),
 | 
				
			||||||
                .product(name: "Localized", package: "localized")
 | 
					                .product(name: "Localized", package: "localized"),
 | 
				
			||||||
 | 
					                "CMath"
 | 
				
			||||||
            ],
 | 
					            ],
 | 
				
			||||||
            path: "Sources",
 | 
					            path: "Sources/PMCalc",
 | 
				
			||||||
            resources: [
 | 
					            resources: [
 | 
				
			||||||
                .process("Localized.yml")
 | 
					                .process("Localized.yml")
 | 
				
			||||||
            ],
 | 
					            ],
 | 
				
			||||||
 | 
					            cSettings: [
 | 
				
			||||||
 | 
					                .headerSearchPath("Sources/CMath/include")
 | 
				
			||||||
 | 
					            ],
 | 
				
			||||||
 | 
					            linkerSettings: [
 | 
				
			||||||
 | 
					                .unsafeFlags([
 | 
				
			||||||
 | 
					                    "-L./Sources/CMath/lib/"
 | 
				
			||||||
 | 
					                ])
 | 
				
			||||||
 | 
					            ],
 | 
				
			||||||
            plugins: [
 | 
					            plugins: [
 | 
				
			||||||
                .plugin(name: "GenerateLocalized", package: "localized")
 | 
					                .plugin(name: "GenerateLocalized", package: "localized")
 | 
				
			||||||
            ]
 | 
					            ]
 | 
				
			||||||
 | 
					        ),
 | 
				
			||||||
 | 
					        .systemLibrary(
 | 
				
			||||||
 | 
					            name: "CMath",
 | 
				
			||||||
 | 
					            path: "Sources/CMath",
 | 
				
			||||||
 | 
					            providers: []
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
    swiftLanguageModes: [.v5]
 | 
					    swiftLanguageModes: [.v5]
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										61
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										61
									
								
								README.md
									
									
									
									
									
								
							@@ -1,62 +1,7 @@
 | 
				
			|||||||
<p align="center">
 | 
					<p align="center">
 | 
				
			||||||
  <img width="256" alt="Adwaita Template Icon" src="data/icons/io.github.AparokshaUI.AdwaitaTemplate.svg">
 | 
					  <h1 align="center">Bachelorproef | Fase 4</h1>
 | 
				
			||||||
  <h1 align="center">Adwaita Template</h1>
 | 
					 | 
				
			||||||
</p>
 | 
					</p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
_Adwaita Template_ is a template application for the [Adwaita for Swift package](https://adwaita-swift.aparoksha.dev/documentation/adwaita/).
 | 
					Deze repository bevat PMCalc, een simpele calculator-app, geschreven met [Adwaita for Swift](https://adwaita-swift.aparoksha.dev/documentation/adwaita/) en CMath.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Table of Contents
 | 
					Als GUI maakt deze applicatie gebruik van de Calculator-UI die gemaakt werd voor [Fase 2](https://repo.thealgorithm476.me/Bachelorproef/bap-poc-phase-2) van deze bachelerproef. Als domeinlogica wordt CMath gebruikt, dat werd ontwikkeld om interoperability tussen Swift en C te testen in [Fase 3](https://repo.thealgorithm476.me/Bachelorproef/bap-poc-phase-3).
 | 
				
			||||||
 | 
					 | 
				
			||||||
- [Installation](#Installation)
 | 
					 | 
				
			||||||
- [Usage](#Usage)
 | 
					 | 
				
			||||||
- [Thanks](#Thanks)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Installation
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Install the [GNOME Builder](https://flathub.org/apps/org.gnome.Builder) IDE.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
For designing an app icon, [App Icon Preview](https://flathub.org/apps/org.gnome.design.AppIconPreview) and [Inkscape](https://flathub.org/apps/org.inkscape.Inkscape) are recommended.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
> [!NOTE]
 | 
					 | 
				
			||||||
> You do not have to install any dependencies of Adwaita for Swift, including Swift, on your system.
 | 
					 | 
				
			||||||
> The Adwaita template runs in a [Flatpak](https://flatpak.org/).
 | 
					 | 
				
			||||||
> The GNOME Builder will automatically download dependencies from [Flathub](https://flathub.org).
 | 
					 | 
				
			||||||
> You can also use [Visual Studio Code](https://code.visualstudio.com/) with a Docker [dev container](https://code.visualstudio.com/docs/devcontainers/containers) hosting the Swift toolchain and Adwaita libraries.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Usage
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1. Open this project in the GNOME Builder. It will start downloading the dependencies.
 | 
					 | 
				
			||||||
    - GNOME Builder will start downloading dependencies when opened.
 | 
					 | 
				
			||||||
    - For Visual Studio Code, enable the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers), the [Swift extension](https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang) and the [CodeLLDB extension](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb) and reopen the project window with the dev container. It may take a couple minutes to build.
 | 
					 | 
				
			||||||
2. Build and run the application.
 | 
					 | 
				
			||||||
    - For GNOME Builder, use the "run" icon in the toolbar.
 | 
					 | 
				
			||||||
    - For Visual Studio Code, select the "run and debug" tab in the leftmost sidebar, and then tap the run icon next to "Debug AdwaitaTemplate".
 | 
					 | 
				
			||||||
3. Change the app's name and other information about the application in the following files (and file names):
 | 
					 | 
				
			||||||
    - `README.md`
 | 
					 | 
				
			||||||
    - `Package.swift`
 | 
					 | 
				
			||||||
    - `io.github.AparokshaUI.AdwaitaTemplate.json`
 | 
					 | 
				
			||||||
    - `Sources/AdwaitaTemplate.swift`
 | 
					 | 
				
			||||||
    - `data/io.github.AparokshaUI.AdwaitaTemplate.metainfo.xml`
 | 
					 | 
				
			||||||
    - `data/io.github.AparokshaUI.AdwaitaTemplate.desktop`
 | 
					 | 
				
			||||||
    - `data/icons/io.github.AparokshaUI.AdwaitaTemplate.Source.svg`
 | 
					 | 
				
			||||||
    - `data/icons/io.github.AparokshaUI.AdwaitaTemplate.svg`
 | 
					 | 
				
			||||||
    - `data/icons/io.github.AparokshaUI.AdwaitaTemplate-symbolic.svg`
 | 
					 | 
				
			||||||
4. Edit the code. Help is available [here](https://adwaita-swift.aparoksha.dev/), ask questions in the [forums](https://forums.aparoksha.dev/).
 | 
					 | 
				
			||||||
5. You can edit the app's icons using the previously installed tools according to [this](https://blogs.gnome.org/tbernard/2019/12/30/designing-an-icon-for-your-app/) tutorial.
 | 
					 | 
				
			||||||
6. In GNOME Builder, click on the dropdown next to the hammer and then on `Export`. Wait until the file manager appears, open the `.flatpak` file and install the app on your device!
 | 
					 | 
				
			||||||
7. If you want to publish your app, replace `debug` in the following build commands by `release`:
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
"swift build -c debug --static-swift-stdlib",
 | 
					 | 
				
			||||||
"install -Dm755 .build/debug/AdwaitaTemplate /app/bin/AdwaitaTemplate",
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Flatpak SPM Generator
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
If you want to e.g. publish your app on Flathub where no internet connection is allowed while running the build commands,
 | 
					 | 
				
			||||||
you can use [this tool](https://github.com/flatpak/flatpak-builder-tools/tree/master/spm) that lets you generate a Flatpak manifest JSON from a Swift package.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Thanks
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Dependencies
 | 
					 | 
				
			||||||
- [Adwaita for Swift](https://git.aparoksha.dev/aparoksha/adwaita-swift) licensed under the [MIT License](https://git.aparoksha.dev/aparoksha/adwaita-swift/src/branch/main/LICENSE.md)
 | 
					 | 
				
			||||||
- [Localized](https://git.aparoksha.dev/aparoksha/localized) licensed under the [MIT License](https://git.aparoksha.dev/aparoksha/localized/src/branch/main/LICENSE.md)
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										13
									
								
								Sources/CMath/include/add_nums.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								Sources/CMath/include/add_nums.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					//
 | 
				
			||||||
 | 
					//  add_nums.h
 | 
				
			||||||
 | 
					//  CMath
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//  Created by TheAlgorithm476 on 28/03/2025.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __ADD_NUMS_H
 | 
				
			||||||
 | 
					#define __ADD_NUMS_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					double add_nums(double a, double b);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif // __ADD_NUMS_H
 | 
				
			||||||
							
								
								
									
										13
									
								
								Sources/CMath/include/div_nums.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								Sources/CMath/include/div_nums.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					//
 | 
				
			||||||
 | 
					//  div_nums.h
 | 
				
			||||||
 | 
					//  CMath
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//  Created by TheAlgorithm476 on 28/03/2025.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __DIV_NUMS_H
 | 
				
			||||||
 | 
					#define __DIV_NUMS_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					double div_nums(double a, double b);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif // __DIV_NUMS_H
 | 
				
			||||||
							
								
								
									
										13
									
								
								Sources/CMath/include/mul_nums.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								Sources/CMath/include/mul_nums.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					//
 | 
				
			||||||
 | 
					//  mul_nums.h
 | 
				
			||||||
 | 
					//  CMath
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//  Created by TheAlgorithm476 on 28/03/2025.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __MUL_NUMS_H
 | 
				
			||||||
 | 
					#define __MUL_NUMS_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					double mul_nums(double a, double b);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif // __MUL_NUMS_H
 | 
				
			||||||
							
								
								
									
										17
									
								
								Sources/CMath/include/spc_nums.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								Sources/CMath/include/spc_nums.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					//
 | 
				
			||||||
 | 
					//  spc_nums.h
 | 
				
			||||||
 | 
					//  CMath
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//  Created by TheAlgorithm476 on 28/03/2025.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __SPC_NUMS_H
 | 
				
			||||||
 | 
					#define __SPC_NUMS_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define POOR_MANS_POW_GUESSES 12
 | 
				
			||||||
 | 
					#define NEWTONIAN_DIV_GUESSES 12
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					double pow(double x, double exp);
 | 
				
			||||||
 | 
					double sqrt(double x);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif // __SPC_NUMS_H
 | 
				
			||||||
							
								
								
									
										13
									
								
								Sources/CMath/include/sub_nums.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								Sources/CMath/include/sub_nums.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					//
 | 
				
			||||||
 | 
					//  sub_nums.h
 | 
				
			||||||
 | 
					//  CMath
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//  Created by TheAlgorithm476 on 28/03/2025.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __SUB_NUMS_H
 | 
				
			||||||
 | 
					#define __SUB_NUMS_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					double sub_nums(double a, double b);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif // __SUB_NUMS_H
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								Sources/CMath/lib/libcmath.so
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Sources/CMath/lib/libcmath.so
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										9
									
								
								Sources/CMath/module.modulemap
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								Sources/CMath/module.modulemap
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					module CMath {
 | 
				
			||||||
 | 
					    header "include/add_nums.h"
 | 
				
			||||||
 | 
					    header "include/sub_nums.h"
 | 
				
			||||||
 | 
					    header "include/mul_nums.h"
 | 
				
			||||||
 | 
					    header "include/div_nums.h"
 | 
				
			||||||
 | 
					    header "include/spc_nums.h"
 | 
				
			||||||
 | 
					    export *
 | 
				
			||||||
 | 
					    link "cmath"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										8
									
								
								Sources/PMCalc/Operator.swift
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Sources/PMCalc/Operator.swift
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					enum Operator {
 | 
				
			||||||
 | 
					    case add
 | 
				
			||||||
 | 
					    case sub
 | 
				
			||||||
 | 
					    case mul
 | 
				
			||||||
 | 
					    case div
 | 
				
			||||||
 | 
					    case pow
 | 
				
			||||||
 | 
					    case sqrt
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -2,89 +2,130 @@
 | 
				
			|||||||
// https://docs.swift.org/swift-book
 | 
					// https://docs.swift.org/swift-book
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import Adwaita
 | 
					import Adwaita
 | 
				
			||||||
 | 
					import CMath
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@main
 | 
					@main
 | 
				
			||||||
struct AdwaitaTemplate: App {
 | 
					struct PMCalc: App {
 | 
				
			||||||
    let app = AdwaitaApp(id: "io.github.AparokshaUI.AdwaitaTemplate")
 | 
					    let app = AdwaitaApp(id: "me.thealgorithm476.PMCalc.PMCalc")
 | 
				
			||||||
 | 
					    @State
 | 
				
			||||||
 | 
					    var vm = ViewModel()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var scene: Scene {
 | 
					    var scene: Scene {
 | 
				
			||||||
        Window(id: "main") { window in
 | 
					        Window(id: "main") { window in
 | 
				
			||||||
            VStack(spacing: 8) {
 | 
					            VStack(spacing: 8) {
 | 
				
			||||||
                Text("Calculations here...")
 | 
					                Text(vm.display)
 | 
				
			||||||
                    .selectable(false)
 | 
					                    .selectable(false)
 | 
				
			||||||
 | 
					                    .title2()
 | 
				
			||||||
 | 
					                    .halign(.end)
 | 
				
			||||||
                VStack(spacing: 8) {
 | 
					                VStack(spacing: 8) {
 | 
				
			||||||
                    HStack(spacing: 8) {
 | 
					                    HStack(spacing: 8) {
 | 
				
			||||||
                        Button("AC") {}
 | 
					                        Button("AC") {
 | 
				
			||||||
 | 
					                            vm.clear()
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                            .keyboardShortcut("c", app: app)
 | 
					                            .keyboardShortcut("c", app: app)
 | 
				
			||||||
                            .hexpand()
 | 
					                            .hexpand()
 | 
				
			||||||
                            .destructive()
 | 
					                            .destructive()
 | 
				
			||||||
                        Button("") {}
 | 
					                        Button("^") {
 | 
				
			||||||
 | 
					                            vm.operation(.pow)
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                            .hexpand()
 | 
					                            .hexpand()
 | 
				
			||||||
                            .flat()
 | 
					 | 
				
			||||||
                        Button("%") {}
 | 
					                        Button("%") {}
 | 
				
			||||||
                            .keyboardShortcut("percent", app: app)
 | 
					                            .keyboardShortcut("percent", app: app)
 | 
				
			||||||
                            .hexpand()
 | 
					                            .hexpand()
 | 
				
			||||||
                        Button("/") {}
 | 
					                        Button("/") {
 | 
				
			||||||
 | 
					                            vm.operation(.div)
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                            .keyboardShortcut("slash", app: app)
 | 
					                            .keyboardShortcut("slash", app: app)
 | 
				
			||||||
                            .hexpand()
 | 
					                            .hexpand()
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    .vexpand()
 | 
					                    .vexpand()
 | 
				
			||||||
                    HStack(spacing: 8) {
 | 
					                    HStack(spacing: 8) {
 | 
				
			||||||
                        Button("7") {}
 | 
					                        Button("7") {
 | 
				
			||||||
 | 
					                            vm.addNumber(7)
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                            .keyboardShortcut("7", app: app)
 | 
					                            .keyboardShortcut("7", app: app)
 | 
				
			||||||
                            .hexpand()
 | 
					                            .hexpand()
 | 
				
			||||||
                        Button("8") {}
 | 
					                        Button("8") {
 | 
				
			||||||
 | 
					                            vm.addNumber(8)
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                            .keyboardShortcut("8", app: app)
 | 
					                            .keyboardShortcut("8", app: app)
 | 
				
			||||||
                            .hexpand()
 | 
					                            .hexpand()
 | 
				
			||||||
                        Button("9") {}
 | 
					                        Button("9") {
 | 
				
			||||||
 | 
					                            vm.addNumber(9)
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                            .keyboardShortcut("9", app: app)
 | 
					                            .keyboardShortcut("9", app: app)
 | 
				
			||||||
                            .hexpand()
 | 
					                            .hexpand()
 | 
				
			||||||
                        Button("*") {}
 | 
					                        Button("*") {
 | 
				
			||||||
 | 
					                            vm.operation(.mul)
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                            .keyboardShortcut("asterisk", app: app)
 | 
					                            .keyboardShortcut("asterisk", app: app)
 | 
				
			||||||
                            .hexpand()
 | 
					                            .hexpand()
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    .vexpand()
 | 
					                    .vexpand()
 | 
				
			||||||
                    HStack(spacing: 8) {
 | 
					                    HStack(spacing: 8) {
 | 
				
			||||||
                        Button("4") {}
 | 
					                        Button("4") {
 | 
				
			||||||
 | 
					                            vm.addNumber(4)
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                            .keyboardShortcut("4", app: app)
 | 
					                            .keyboardShortcut("4", app: app)
 | 
				
			||||||
                            .hexpand()
 | 
					                            .hexpand()
 | 
				
			||||||
                        Button("5") {}
 | 
					                        Button("5") {
 | 
				
			||||||
 | 
					                            vm.addNumber(5)
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                            .keyboardShortcut("5", app: app)
 | 
					                            .keyboardShortcut("5", app: app)
 | 
				
			||||||
                            .hexpand()
 | 
					                            .hexpand()
 | 
				
			||||||
                        Button("6") {}
 | 
					                        Button("6") {
 | 
				
			||||||
 | 
					                            vm.addNumber(6)
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                            .keyboardShortcut("6", app: app)
 | 
					                            .keyboardShortcut("6", app: app)
 | 
				
			||||||
                            .hexpand()
 | 
					                            .hexpand()
 | 
				
			||||||
                        Button("-") {}
 | 
					                        Button("-") {
 | 
				
			||||||
 | 
					                            vm.operation(.sub)
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                            .keyboardShortcut("minus", app: app)
 | 
					                            .keyboardShortcut("minus", app: app)
 | 
				
			||||||
                            .hexpand()
 | 
					                            .hexpand()
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    .vexpand()
 | 
					                    .vexpand()
 | 
				
			||||||
                    HStack(spacing: 8) {
 | 
					                    HStack(spacing: 8) {
 | 
				
			||||||
                        Button("1") {}
 | 
					                        Button("1") {
 | 
				
			||||||
 | 
					                            vm.addNumber(1)
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                            .keyboardShortcut("1", app: app)
 | 
					                            .keyboardShortcut("1", app: app)
 | 
				
			||||||
                            .hexpand()
 | 
					                            .hexpand()
 | 
				
			||||||
                        Button("2") {}
 | 
					                        Button("2") {
 | 
				
			||||||
 | 
					                            vm.addNumber(2)
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                            .keyboardShortcut("2", app: app)
 | 
					                            .keyboardShortcut("2", app: app)
 | 
				
			||||||
                            .hexpand()
 | 
					                            .hexpand()
 | 
				
			||||||
                        Button("3") {}
 | 
					                        Button("3") {
 | 
				
			||||||
 | 
					                            vm.addNumber(3)
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                            .keyboardShortcut("3", app: app)
 | 
					                            .keyboardShortcut("3", app: app)
 | 
				
			||||||
                            .hexpand()
 | 
					                            .hexpand()
 | 
				
			||||||
                        Button("+") {}
 | 
					                        Button("+") {
 | 
				
			||||||
 | 
					                            vm.operation(.add)
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                            .keyboardShortcut("plus", app: app)
 | 
					                            .keyboardShortcut("plus", app: app)
 | 
				
			||||||
                            .hexpand()
 | 
					                            .hexpand()
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    .vexpand()
 | 
					                    .vexpand()
 | 
				
			||||||
                    HStack(spacing: 8) {
 | 
					                    HStack(spacing: 8) {
 | 
				
			||||||
                        Button("0") {}
 | 
					                        Button("0") {
 | 
				
			||||||
 | 
					                            vm.addNumber(0)
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                            .keyboardShortcut("0", app: app)
 | 
					                            .keyboardShortcut("0", app: app)
 | 
				
			||||||
                            .hexpand()
 | 
					                            .hexpand()
 | 
				
			||||||
                        Button("") {}
 | 
					                        Button("sq") {
 | 
				
			||||||
 | 
					                            vm.operation(.sqrt)
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                            .hexpand()
 | 
					                            .hexpand()
 | 
				
			||||||
                            .flat()
 | 
					                        Button(",") {
 | 
				
			||||||
                        Button(",") {}
 | 
					                            vm.addComma()
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                            .keyboardShortcut("comma", app: app)
 | 
					                            .keyboardShortcut("comma", app: app)
 | 
				
			||||||
                            .hexpand()
 | 
					                            .hexpand()
 | 
				
			||||||
                        Button("=") {}
 | 
					                        Button("=") {
 | 
				
			||||||
 | 
					                            vm.calculate()
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                            .keyboardShortcut("equal", app: app)
 | 
					                            .keyboardShortcut("equal", app: app)
 | 
				
			||||||
                            .hexpand()
 | 
					                            .hexpand()
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@@ -27,12 +27,11 @@ struct ToolbarView: View {
 | 
				
			|||||||
            .tooltip(Loc.mainMenu)
 | 
					            .tooltip(Loc.mainMenu)
 | 
				
			||||||
            .aboutDialog(
 | 
					            .aboutDialog(
 | 
				
			||||||
                visible: $about,
 | 
					                visible: $about,
 | 
				
			||||||
                app: "AdwaitaTemplate",
 | 
					                app: "PMCalc",
 | 
				
			||||||
                developer: "david-swift",
 | 
					                developer: "TheAlgorithm476",
 | 
				
			||||||
                version: "dev",
 | 
					                version: "1.0",
 | 
				
			||||||
                icon: .custom(name: "io.github.AparokshaUI.AdwaitaTemplate"),
 | 
					                icon: .custom(name: "me.thealgorithm476.PMCalc.PMCalc"),
 | 
				
			||||||
                website: .init(string: "https://git.aparoksha.dev/aparoksha/adwaita-template")!,
 | 
					                website: .init(string: "https://repo.thealgorithm476.me/Bachelorproef/bap-poc-phase-4")!
 | 
				
			||||||
                issues: .init(string: "https://git.aparoksha.dev/aparoksha/adwaita-template/issues")!
 | 
					 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
							
								
								
									
										73
									
								
								Sources/PMCalc/ViewModel.swift
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								Sources/PMCalc/ViewModel.swift
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,73 @@
 | 
				
			|||||||
 | 
					import Adwaita
 | 
				
			||||||
 | 
					import CMath
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct ViewModel {
 | 
				
			||||||
 | 
					    private var numberBuffer: String = ""
 | 
				
			||||||
 | 
					    private var number1: Double? = nil
 | 
				
			||||||
 | 
					    private var number2: Double? = nil
 | 
				
			||||||
 | 
					    private var op: Operator? = nil
 | 
				
			||||||
 | 
					    @State
 | 
				
			||||||
 | 
					    private(set) var display: String = ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    mutating func clear() {
 | 
				
			||||||
 | 
					        numberBuffer = ""
 | 
				
			||||||
 | 
					        number1 = nil
 | 
				
			||||||
 | 
					        number2 = nil
 | 
				
			||||||
 | 
					        op = nil
 | 
				
			||||||
 | 
					        display = ""
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    mutating func addComma() {
 | 
				
			||||||
 | 
					        guard !numberBuffer.isEmpty else { return }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        numberBuffer.append(",")
 | 
				
			||||||
 | 
					        display = numberBuffer
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    mutating func addNumber(_ number: UInt8) {
 | 
				
			||||||
 | 
					        if numberBuffer.isEmpty { display = "" } // Reset display after new number is added to cleared buffer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        numberBuffer.append(String(number))
 | 
				
			||||||
 | 
					        display = numberBuffer
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    mutating func operation(_ op: Operator) {
 | 
				
			||||||
 | 
					        guard !numberBuffer.isEmpty && number1 == nil else { return }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        self.op = op
 | 
				
			||||||
 | 
					        if number1 == nil { number1 = Double(numberBuffer) }
 | 
				
			||||||
 | 
					        else { number2 = Double(numberBuffer) }
 | 
				
			||||||
 | 
					        numberBuffer = ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if op == .sqrt {
 | 
				
			||||||
 | 
					            display = String(sqrt(number1!))
 | 
				
			||||||
 | 
					            number1 = nil
 | 
				
			||||||
 | 
					            self.op = nil
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    mutating func calculate() {
 | 
				
			||||||
 | 
					        number2 = Double(numberBuffer)
 | 
				
			||||||
 | 
					        numberBuffer = ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        var result: Double = 0.0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        switch op {
 | 
				
			||||||
 | 
					        case .add:
 | 
				
			||||||
 | 
					            result = add_nums(number1!, number2!)
 | 
				
			||||||
 | 
					        case .sub:
 | 
				
			||||||
 | 
					            result = sub_nums(number1!, number2!)
 | 
				
			||||||
 | 
					        case .mul:
 | 
				
			||||||
 | 
					            result = mul_nums(number1!, number2!)
 | 
				
			||||||
 | 
					        case .div:
 | 
				
			||||||
 | 
					            result = div_nums(number1!, number2!)
 | 
				
			||||||
 | 
					        case .pow:
 | 
				
			||||||
 | 
					            result = pow(number1!, number2!)
 | 
				
			||||||
 | 
					        case .sqrt, .none:
 | 
				
			||||||
 | 
					            // do nothing
 | 
				
			||||||
 | 
					            print("Attempting to apply Square Root to nothing!")
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        display = String(result)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
		 Before Width: | Height: | Size: 574 B After Width: | Height: | Size: 574 B  | 
| 
		 Before Width: | Height: | Size: 175 KiB After Width: | Height: | Size: 175 KiB  | 
| 
		 Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB  | 
@@ -1,11 +0,0 @@
 | 
				
			|||||||
[Desktop Entry]
 | 
					 | 
				
			||||||
Version=1.0
 | 
					 | 
				
			||||||
Type=Application
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Name=Adwaita Template
 | 
					 | 
				
			||||||
Comment=A template for creating GNOME apps with Swift
 | 
					 | 
				
			||||||
Categories=Development;GNOME;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Icon=io.github.AparokshaUI.AdwaitaTemplate
 | 
					 | 
				
			||||||
Exec=AdwaitaTemplate
 | 
					 | 
				
			||||||
Terminal=false
 | 
					 | 
				
			||||||
							
								
								
									
										11
									
								
								data/me.thealgorithm476.PMCalc.PMCalc.desktop
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								data/me.thealgorithm476.PMCalc.PMCalc.desktop
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					[Desktop Entry]
 | 
				
			||||||
 | 
					Version=1.0
 | 
				
			||||||
 | 
					Type=Application
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Name=Poor Man's Calculator
 | 
				
			||||||
 | 
					Comment=Simple Calculator written using Adwaita for Swift
 | 
				
			||||||
 | 
					Categories=Development;GNOME;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Icon=me.thealgorithm476.PMCalc.PMCalc
 | 
				
			||||||
 | 
					Exec=PMCalc
 | 
				
			||||||
 | 
					Terminal=false
 | 
				
			||||||
@@ -1,9 +1,9 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					<?xml version="1.0" encoding="UTF-8"?>
 | 
				
			||||||
<component type="desktop-application">
 | 
					<component type="desktop-application">
 | 
				
			||||||
  <id>io.github.AparokshaUI.AdwaitaTemplate</id>
 | 
					  <id>me.thealgorithm476.PMCalc.PMCalc</id>
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  <name>Adwaita Template</name>
 | 
					  <name>Poor Man's Calculator</name>
 | 
				
			||||||
  <summary>A template for creating GNOME apps with Swift</summary>
 | 
					  <summary>Simple Calculator written using Adwaita for Swift</summary>
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  <metadata_license>MIT</metadata_license>
 | 
					  <metadata_license>MIT</metadata_license>
 | 
				
			||||||
  <project_license>LGPL-3.0-or-later</project_license>
 | 
					  <project_license>LGPL-3.0-or-later</project_license>
 | 
				
			||||||
@@ -16,10 +16,10 @@
 | 
				
			|||||||
  
 | 
					  
 | 
				
			||||||
  <description>
 | 
					  <description>
 | 
				
			||||||
    <p>
 | 
					    <p>
 | 
				
			||||||
      This is a <em>long</em> description of this project. Yes - that is required!
 | 
					      Calculator written in Adwaita for Swift, using a custom Math library written in C.
 | 
				
			||||||
    </p>
 | 
					    </p>
 | 
				
			||||||
  </description>
 | 
					  </description>
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  <launchable type="desktop-id">io.github.AparokshaUI.AdwaitaTemplate.desktop</launchable>
 | 
					  <launchable type="desktop-id">me.thealgorithm476.PMCalc.PMCalc.desktop</launchable>
 | 
				
			||||||
</component>
 | 
					</component>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,12 +1,12 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "app-id": "io.github.AparokshaUI.AdwaitaTemplate",
 | 
					  "app-id": "me.thealgorithm476.PMCalc.PMCalc",
 | 
				
			||||||
  "runtime": "org.gnome.Platform",
 | 
					  "runtime": "org.gnome.Platform",
 | 
				
			||||||
  "runtime-version": "46",
 | 
					  "runtime-version": "46",
 | 
				
			||||||
  "sdk": "org.gnome.Sdk",
 | 
					  "sdk": "org.gnome.Sdk",
 | 
				
			||||||
  "sdk-extensions": [
 | 
					  "sdk-extensions": [
 | 
				
			||||||
    "org.freedesktop.Sdk.Extension.swift5"
 | 
					    "org.freedesktop.Sdk.Extension.swift5"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "command": "AdwaitaTemplate",
 | 
					  "command": "PMCalc",
 | 
				
			||||||
  "finish-args": [
 | 
					  "finish-args": [
 | 
				
			||||||
    "--share=ipc",
 | 
					    "--share=ipc",
 | 
				
			||||||
    "--socket=fallback-x11",
 | 
					    "--socket=fallback-x11",
 | 
				
			||||||
@@ -30,7 +30,7 @@
 | 
				
			|||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "modules": [
 | 
					  "modules": [
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      "name": "AdwaitaTemplate",
 | 
					      "name": "PMCalc",
 | 
				
			||||||
      "builddir": true,
 | 
					      "builddir": true,
 | 
				
			||||||
      "buildsystem": "simple",
 | 
					      "buildsystem": "simple",
 | 
				
			||||||
      "sources": [
 | 
					      "sources": [
 | 
				
			||||||
@@ -42,12 +42,12 @@
 | 
				
			|||||||
      "build-commands": [
 | 
					      "build-commands": [
 | 
				
			||||||
        "./setup-offline.sh",
 | 
					        "./setup-offline.sh",
 | 
				
			||||||
        "swift build -c release --static-swift-stdlib --skip-update",
 | 
					        "swift build -c release --static-swift-stdlib --skip-update",
 | 
				
			||||||
        "strip .build/release/AdwaitaTemplate",
 | 
					        "strip .build/release/PMCalc",
 | 
				
			||||||
        "install -Dm755 .build/release/AdwaitaTemplate /app/bin/AdwaitaTemplate",
 | 
					        "install -Dm755 .build/release/PMCalc /app/bin/PMCalc",
 | 
				
			||||||
        "install -Dm644 data/io.github.AparokshaUI.AdwaitaTemplate.metainfo.xml $DESTDIR/app/share/metainfo/io.github.AparokshaUI.AdwaitaTemplate.metainfo.xml",
 | 
					        "install -Dm644 data/me.thealgorithm476.PMCalc.PMCalc.metainfo.xml $DESTDIR/app/share/metainfo/me.thealgorithm476.PMCalc.PMCalc.metainfo.xml",
 | 
				
			||||||
        "install -Dm644 data/io.github.AparokshaUI.AdwaitaTemplate.desktop $DESTDIR/app/share/applications/io.github.AparokshaUI.AdwaitaTemplate.desktop",
 | 
					        "install -Dm644 data/me.thealgorithm476.PMCalc.PMCalc.desktop $DESTDIR/app/share/applications/me.thealgorithm476.PMCalc.PMCalc.desktop",
 | 
				
			||||||
        "install -Dm644 data/icons/io.github.AparokshaUI.AdwaitaTemplate.svg $DESTDIR/app/share/icons/hicolor/scalable/apps/io.github.AparokshaUI.AdwaitaTemplate.svg",
 | 
					        "install -Dm644 data/icons/me.thealgorithm476.PMCalc.PMCalc.svg $DESTDIR/app/share/icons/hicolor/scalable/apps/me.thealgorithm476.PMCalc.PMCalc.svg",
 | 
				
			||||||
        "install -Dm644 data/icons/io.github.AparokshaUI.AdwaitaTemplate-symbolic.svg $DESTDIR/app/share/icons/hicolor/symbolic/apps/io.github.AparokshaUI.AdwaitaTemplate-symbolic.svg"
 | 
					        "install -Dm644 data/icons/me.thealgorithm476.PMCalc.PMCalc-symbolic.svg $DESTDIR/app/share/icons/hicolor/symbolic/apps/me.thealgorithm476.PMCalc.PMCalc-symbolic.svg"
 | 
				
			||||||
      ]
 | 
					      ]
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  ]
 | 
					  ]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,53 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
  "app-id": "io.github.AparokshaUI.AdwaitaTemplate",
 | 
					 | 
				
			||||||
  "runtime": "org.gnome.Platform",
 | 
					 | 
				
			||||||
  "runtime-version": "48",
 | 
					 | 
				
			||||||
  "sdk": "org.gnome.Sdk",
 | 
					 | 
				
			||||||
  "sdk-extensions": [
 | 
					 | 
				
			||||||
    "org.freedesktop.Sdk.Extension.swift6"
 | 
					 | 
				
			||||||
  ],
 | 
					 | 
				
			||||||
  "command": "AdwaitaTemplate",
 | 
					 | 
				
			||||||
  "finish-args": [
 | 
					 | 
				
			||||||
    "--share=ipc",
 | 
					 | 
				
			||||||
    "--socket=fallback-x11",
 | 
					 | 
				
			||||||
    "--device=dri",
 | 
					 | 
				
			||||||
    "--socket=wayland"
 | 
					 | 
				
			||||||
  ],
 | 
					 | 
				
			||||||
  "build-options": {
 | 
					 | 
				
			||||||
    "append-path": "/usr/lib/sdk/swift6/bin",
 | 
					 | 
				
			||||||
    "prepend-ld-library-path": "/usr/lib/sdk/swift6/lib"
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  "cleanup": [
 | 
					 | 
				
			||||||
    "/include",
 | 
					 | 
				
			||||||
    "/lib/pkgconfig",
 | 
					 | 
				
			||||||
    "/man",
 | 
					 | 
				
			||||||
    "/share/doc",
 | 
					 | 
				
			||||||
    "/share/gtk-doc",
 | 
					 | 
				
			||||||
    "/share/man",
 | 
					 | 
				
			||||||
    "/share/pkgconfig",
 | 
					 | 
				
			||||||
    "*.la",
 | 
					 | 
				
			||||||
    "*.a"
 | 
					 | 
				
			||||||
  ],
 | 
					 | 
				
			||||||
  "modules": [
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      "name": "AdwaitaTemplate",
 | 
					 | 
				
			||||||
      "builddir": true,
 | 
					 | 
				
			||||||
      "buildsystem": "simple",
 | 
					 | 
				
			||||||
      "sources": [
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
          "type": "dir",
 | 
					 | 
				
			||||||
          "path": "."
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      ],
 | 
					 | 
				
			||||||
      "build-commands": [
 | 
					 | 
				
			||||||
        "swift build -c debug --static-swift-stdlib",
 | 
					 | 
				
			||||||
        "strip .build/debug/AdwaitaTemplate",
 | 
					 | 
				
			||||||
        "install -Dm755 .build/debug/AdwaitaTemplate /app/bin/AdwaitaTemplate",
 | 
					 | 
				
			||||||
        "install -Dm644 data/io.github.AparokshaUI.AdwaitaTemplate.metainfo.xml $DESTDIR/app/share/metainfo/io.github.AparokshaUI.AdwaitaTemplate.metainfo.xml",
 | 
					 | 
				
			||||||
        "install -Dm644 data/io.github.AparokshaUI.AdwaitaTemplate.desktop $DESTDIR/app/share/applications/io.github.AparokshaUI.AdwaitaTemplate.desktop",
 | 
					 | 
				
			||||||
        "install -Dm644 data/icons/io.github.AparokshaUI.AdwaitaTemplate.svg $DESTDIR/app/share/icons/hicolor/scalable/apps/io.github.AparokshaUI.AdwaitaTemplate.svg",
 | 
					 | 
				
			||||||
        "install -Dm644 data/icons/io.github.AparokshaUI.AdwaitaTemplate-symbolic.svg $DESTDIR/app/share/icons/hicolor/symbolic/apps/io.github.AparokshaUI.AdwaitaTemplate-symbolic.svg"
 | 
					 | 
				
			||||||
      ]
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  ]
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										54
									
								
								me.thealgorithm476.PMCalc.PMCalc.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								me.thealgorithm476.PMCalc.PMCalc.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,54 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					  "app-id": "me.thealgorithm476.PMCalc.PMCalc",
 | 
				
			||||||
 | 
					  "runtime": "org.gnome.Platform",
 | 
				
			||||||
 | 
					  "runtime-version": "48",
 | 
				
			||||||
 | 
					  "sdk": "org.gnome.Sdk",
 | 
				
			||||||
 | 
					  "sdk-extensions": [
 | 
				
			||||||
 | 
					    "org.freedesktop.Sdk.Extension.swift6"
 | 
				
			||||||
 | 
					  ],
 | 
				
			||||||
 | 
					  "command": "PMCalc",
 | 
				
			||||||
 | 
					  "finish-args": [
 | 
				
			||||||
 | 
					    "--share=ipc",
 | 
				
			||||||
 | 
					    "--socket=fallback-x11",
 | 
				
			||||||
 | 
					    "--device=dri",
 | 
				
			||||||
 | 
					    "--socket=wayland"
 | 
				
			||||||
 | 
					  ],
 | 
				
			||||||
 | 
					  "build-options": {
 | 
				
			||||||
 | 
					    "append-path": "/usr/lib/sdk/swift6/bin",
 | 
				
			||||||
 | 
					    "prepend-ld-library-path": "/usr/lib/sdk/swift6/lib"
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "cleanup": [
 | 
				
			||||||
 | 
					    "/include",
 | 
				
			||||||
 | 
					    "/lib/pkgconfig",
 | 
				
			||||||
 | 
					    "/man",
 | 
				
			||||||
 | 
					    "/share/doc",
 | 
				
			||||||
 | 
					    "/share/gtk-doc",
 | 
				
			||||||
 | 
					    "/share/man",
 | 
				
			||||||
 | 
					    "/share/pkgconfig",
 | 
				
			||||||
 | 
					    "*.la",
 | 
				
			||||||
 | 
					    "*.a"
 | 
				
			||||||
 | 
					  ],
 | 
				
			||||||
 | 
					  "modules": [
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      "name": "PMCalc",
 | 
				
			||||||
 | 
					      "builddir": true,
 | 
				
			||||||
 | 
					      "buildsystem": "simple",
 | 
				
			||||||
 | 
					      "sources": [
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          "type": "dir",
 | 
				
			||||||
 | 
					          "path": "."
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					      "build-commands": [
 | 
				
			||||||
 | 
					        "swift build -c debug --static-swift-stdlib",
 | 
				
			||||||
 | 
					        "strip .build/debug/PMCalc",
 | 
				
			||||||
 | 
					        "install -Dm755 .build/debug/PMCalc /app/bin/PMCalc",
 | 
				
			||||||
 | 
					        "install -Dm644 data/me.thealgorithm476.PMCalc.PMCalc.metainfo.xml $DESTDIR/app/share/metainfo/me.thealgorithm476.PMCalc.PMCalc.metainfo.xml",
 | 
				
			||||||
 | 
					        "install -Dm644 data/me.thealgorithm476.PMCalc.PMCalc.desktop $DESTDIR/app/share/applications/me.thealgorithm476.PMCalc.PMCalc.desktop",
 | 
				
			||||||
 | 
					        "install -Dm644 data/icons/me.thealgorithm476.PMCalc.PMCalc.svg $DESTDIR/app/share/icons/hicolor/scalable/apps/me.thealgorithm476.PMCalc.PMCalc.svg",
 | 
				
			||||||
 | 
					        "install -Dm644 data/icons/me.thealgorithm476.PMCalc.PMCalc-symbolic.svg $DESTDIR/app/share/icons/hicolor/symbolic/apps/me.thealgorithm476.PMCalc.PMCalc-symbolic.svg",
 | 
				
			||||||
 | 
					        "install -Dm644 Sources/CMath/lib/libcmath.so /app/lib/libcmath.so"
 | 
				
			||||||
 | 
					      ]
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  ]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user