Compare commits

...

5 Commits

Author SHA1 Message Date
EinTim23 a62ffc41ad fixed placeholder text on password inputs 2025-01-12 16:28:11 +01:00
EinTim23 e8ac296f35 automatic release creation 2025-01-12 15:02:15 +01:00
EinTim23 a6c77e256f add automated mac os build 2025-01-12 14:02:56 +01:00
EinTim23 3e16670a70 add automated windows build 2025-01-12 13:22:02 +01:00
EinTim23 017b21dbeb automated linux build 2025-01-12 12:40:29 +01:00
8 changed files with 229 additions and 8 deletions

188
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,188 @@
name: Build and Package AppImage, Windows Executable, and macOS DMG
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
jobs:
build-linux:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Set up CMake
uses: lukka/get-cmake@latest
with:
cmakeVersion: '3.22.0'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
libssl-dev \
libx11-dev \
libxext-dev \
libxrandr-dev \
libxinerama-dev \
libxcursor-dev \
zlib1g-dev \
libglu1-mesa-dev \
libgtk-3-dev \
libwayland-dev \
fuse
sudo modprobe fuse
- name: Configure with CMake
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
- name: Build the project
run: cmake --build build --config Release
- name: Download linuxdeploy
run: |
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy-x86_64.AppImage
sudo mv linuxdeploy-x86_64.AppImage /usr/local/bin/linuxdeploy
- name: Create AppImage
run: |
cp -r build/PlayerLink linux/AppDir/usr/bin/
linuxdeploy --appdir=linux/AppDir --output appimage
- name: Upload AppImage artifact
uses: actions/upload-artifact@v4
with:
name: PlayerLink-AppImage
path: ./*.AppImage
build-windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Set up CMake
uses: lukka/get-cmake@latest
with:
cmakeVersion: '3.22.0'
- name: Configure with CMake
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
- name: Build the project
run: cmake --build build --config Release
- name: Upload Windows artifact
uses: actions/upload-artifact@v4
with:
name: PlayerLink-Windows-Executable
path: build/Release/*
build-macos:
runs-on: macos-15
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Set up CMake
uses: lukka/get-cmake@latest
with:
cmakeVersion: '3.22.0'
- name: Configure with CMake
run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
- name: Build the project
run: cmake --build build --config Release
- name: Create DMG package
run: |
mkdir -p dmg/PlayerLink
cp -r build/PlayerLink.app dmg/PlayerLink/
hdiutil create -volname "PlayerLink" -srcfolder dmg/PlayerLink -ov -format UDZO PlayerLink.dmg
- name: Upload macOS DMG artifact
uses: actions/upload-artifact@v4
with:
name: PlayerLink-macOS-DMG
path: PlayerLink.dmg
create-release:
needs: [build-linux, build-windows, build-macos]
runs-on: ubuntu-20.04
steps:
- name: Download AppImage artifact
uses: actions/download-artifact@v4
with:
name: PlayerLink-AppImage
path: ./release-assets
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: PlayerLink-Windows-Executable
path: ./release-assets
- name: Download macOS DMG artifact
uses: actions/download-artifact@v4
with:
name: PlayerLink-macOS-DMG
path: ./release-assets
- name: Create GitHub Release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
draft: false
prerelease: false
- name: Upload AppImage
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release-assets/*.AppImage
asset_name: PlayerLink.AppImage
asset_content_type: application/octet-stream
- name: Upload Windows Executable
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: path_to_your_windows_executable
asset_name: ./release-assets/*.exe
asset_content_type: application/octet-stream
- name: Upload macOS DMG
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release-assets/*.dmg
asset_name: PlayerLink.dmg
asset_content_type: application/octet-stream

8
.gitignore vendored
View File

@ -3,4 +3,10 @@ build/*
.cache/* .cache/*
src/rsrc.hpp src/rsrc.hpp
PlayerLink.exe PlayerLink.exe
.vscode/* .vscode/*
linux/AppDir/usr/share/doc/*
linux/AppDir/usr/lib/*
linux/AppDir/usr/bin/*
linux/AppDir/*
!linux/AppDir/usr
!.gitkeep

View File

View File

View File

@ -0,0 +1,6 @@
[Desktop Entry]
Name=PlayerLink
Exec=PlayerLink
Icon=PlayerLink
Type=Application
Categories=Utility;GTK;

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 KiB

View File

@ -11,7 +11,6 @@
#include <winrt/windows.storage.streams.h> #include <winrt/windows.storage.streams.h>
#include <chrono> #include <chrono>
#include <codecvt>
#include <filesystem> #include <filesystem>
#include "../backend.hpp" #include "../backend.hpp"

View File

@ -184,30 +184,37 @@ public:
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = 0, const wxValidator& validator = wxDefaultValidator, long style = 0, const wxValidator& validator = wxDefaultValidator,
const wxString& name = "textCtrl") const wxString& name = "textCtrl")
: wxTextCtrl(parent, id, value, pos, size, style, validator, name), placeholder(""), showPlaceholder(true) { : wxTextCtrl(parent, id, value, pos, size, style, validator, name),
placeholder(""),
showPlaceholder(true),
isPassword((style & wxTE_PASSWORD) != 0) {
Bind(wxEVT_SET_FOCUS, &wxTextCtrlWithPlaceholder::OnFocus, this); Bind(wxEVT_SET_FOCUS, &wxTextCtrlWithPlaceholder::OnFocus, this);
Bind(wxEVT_KILL_FOCUS, &wxTextCtrlWithPlaceholder::OnBlur, this); Bind(wxEVT_KILL_FOCUS, &wxTextCtrlWithPlaceholder::OnBlur, this);
} }
void SetPlaceholderText(const wxString& p) { void SetPlaceholderText(const wxString& p) {
placeholder = p; placeholder = p;
SetValue(placeholder); if (GetValue().IsEmpty() || showPlaceholder)
Refresh(); UpdatePlaceholder();
} }
protected: protected:
void OnFocus(wxFocusEvent& event) { void OnFocus(wxFocusEvent& event) {
if (GetValue() == placeholder) if (showPlaceholder && GetValue() == placeholder) {
Clear(); Clear();
if (isPassword)
SetStyleToPassword();
}
showPlaceholder = false; showPlaceholder = false;
event.Skip(); event.Skip();
} }
void OnBlur(wxFocusEvent& event) { void OnBlur(wxFocusEvent& event) {
if (GetValue().IsEmpty() || GetValue() == "") { if (GetValue().IsEmpty()) {
SetValue(placeholder);
showPlaceholder = true; showPlaceholder = true;
UpdatePlaceholder();
} }
event.Skip(); event.Skip();
} }
@ -215,6 +222,21 @@ protected:
private: private:
wxString placeholder; wxString placeholder;
bool showPlaceholder; bool showPlaceholder;
bool isPassword;
void UpdatePlaceholder() {
if (isPassword)
SetStyleToNormal();
SetValue(placeholder);
}
void SetStyleToPassword() {
SetWindowStyle(GetWindowStyle() | wxTE_PASSWORD);
}
void SetStyleToNormal() {
SetWindowStyle(GetWindowStyle() & ~wxTE_PASSWORD);
}
}; };
class PlayerLinkFrame : public wxFrame { class PlayerLinkFrame : public wxFrame {