Skip to content

Commit

Permalink
(chore) create windows binary
Browse files Browse the repository at this point in the history
  • Loading branch information
kounkou committed Nov 7, 2024
1 parent 82ac62e commit 4b9b12b
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 35 deletions.
35 changes: 34 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,33 @@ on:
pull_request:

jobs:
build-windows:
runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Qt5 on Windows
run: |
choco install qt5-default -y
$env:PATH += ";C:\Qt\5.15.2\mingw81_64\bin"
ls
- name: Set architecture for build
run: echo "Building for Windows x64 architecture"

- name: Build application
run: |
$env:PATH += ";C:\Qt\5.15.2\mingw81_64\bin"
.\build.bat windows-latest-x64-binary # Ensure your build.bat script exists and is configured for Windows
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: Hedgehog-windows-latest-x64-binary.exe
path: Hedgehog-windows-latest-x64-binary.exe

build-linux:
runs-on: ubuntu-latest

Expand Down Expand Up @@ -61,7 +88,7 @@ jobs:

release:
runs-on: ubuntu-latest
needs: [build-linux, build-macos]
needs: [build-linux, build-macos, build-windows]

steps:
- name: Checkout code
Expand All @@ -78,6 +105,12 @@ jobs:
with:
name: Hedgehog-macos-latest-arm64-binary
path: ./

- name: Download Windows x64 binary
uses: actions/download-artifact@v3
with:
name: Hedgehog-windows-latest-x64-binary.exe
path: ./

- name: Create Draft Release
id: create_release
Expand Down
4 changes: 2 additions & 2 deletions Hedgehog.pro
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ DESTDIR = ./build

CONFIG += c++11

QT += core gui qml widgets
QT += webengine
QT += core gui qml widgets quick
# QT += webengine

DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

Expand Down
36 changes: 36 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@echo off

REM Function to replace destination binary path in Makefile (Windows equivalent)
setlocal
set "file=Makefile.Release"
set "string_to_replace=\\Hedgehog"
set "replacement_string=/Hedgehog"

REM Run qmake and make
qmake
REM Use PowerShell to replace the string
powershell -Command "(Get-Content %file%) -replace '%string_to_replace%', '%replacement_string%' | Set-Content %file%"
echo Replaced "%string_to_replace%" with "%replacement_string%" in "%file%".

set "file=Makefile.Release"
set "string_to_replace=Hedgehog\\"
set "replacement_string=Hedgehog/"

REM Use PowerShell to replace the string
powershell -Command "(Get-Content %file%) -replace '%string_to_replace%', '%replacement_string%' | Set-Content %file%"
echo Replaced "%string_to_replace%" with "%replacement_string%" in "%file%".

REM Clean previous builds
if exist build rmdir /S /Q build
mkdir build

make

REM Copy the final binary
if "%~1"=="" (
copy "build\Hedgehog.exe" "Hedgehog.exe"
) else (
copy "build\Hedgehog.exe" "Hedgehog-%~1.exe"
)

endlocal
4 changes: 2 additions & 2 deletions logic/topological-sorting/topological-sorting.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var question = [
id: "Topological sort",
category: "Topo. Sort",
placeHolderCpp: `void dfs(int node, map<int, bool>& visited, stack<int>& stk, vector<int> graph[]) {\n ...\n}\n\nvoid topoSortGraph(int V, vector<int> adj[]) {\n ...\n}\n\n\n\n\n\n\n\n`,
placeHolderGo: `func dfs(node int, visited []bool, stack *[]int, graph [][]int) {\n ...\n}\n\nfunc topoSortGraph(V int, adj [][]int) {\n ...\n}\n\n\n\n\n\n\n`,
placeHolderGo: `func dfs(node int, visited []bool, stack *[]int, graph [][]int) {\n ...\n}\n\nvoid topoSortGraph(vector<int> nodes, vector<int> graph[]) {\n ...\n}\n\n\n\n\n\n\n`,
difficulty: "Hard",
question: "Topological Sort.",
answerImage: "",
Expand All @@ -18,7 +18,7 @@ var question = [
stk.push(node);
}
void topoSortGraph(vector<int> nodes, vector<int> graph[]) {
void topoSortGraph(int V, vector<int> nodes, vector<int> graph[]) {
map<int, bool> visited(V, false);
stack<int> stk;
Expand Down
56 changes: 28 additions & 28 deletions qml/LoginPage.qml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtWebView 1.1
import QtWebEngine 1.7
// import QtWebView 1.1
// import QtWebEngine 1.7

Rectangle {
id: categoryPage
Expand All @@ -15,35 +15,35 @@ Rectangle {
property string redirectUri: "urn:ietf:wg:oauth:2.0:oob"
property string authorizationUrl: "https://accounts.google.com/o/oauth2/v2/auth"

WebEngineView {
id: webView
anchors.fill: parent
// WebEngineView {
// id: webView
// anchors.fill: parent

// Step 1: Open Google's OAuth 2.0 login page
onUrlChanged: {
// Step 2: Detect redirect after successful login and extract authorization code
if (webView.url.indexOf(redirectUri) !== -1) {
var url = webView.url;
var authorizationCode = url.split("code=")[1];
if (authorizationCode) {
console.log("Authorization Code: " + authorizationCode);
// // Step 1: Open Google's OAuth 2.0 login page
// onUrlChanged: {
// // Step 2: Detect redirect after successful login and extract authorization code
// if (webView.url.indexOf(redirectUri) !== -1) {
// var url = webView.url;
// var authorizationCode = url.split("code=")[1];
// if (authorizationCode) {
// console.log("Authorization Code: " + authorizationCode);

// Step 3: Exchange authorization code for access token (via REST API call)
getAccessToken(authorizationCode);
}
}
}
// // Step 3: Exchange authorization code for access token (via REST API call)
// getAccessToken(authorizationCode);
// }
// }
// }

// Step 1: Load the Google login page with OAuth parameters
Component.onCompleted: {
var url = authorizationUrl +
"?client_id=" + clientId +
"&redirect_uri=" + redirectUri +
"&response_type=code" +
"&scope=https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email";
webView.url = url;
}
}
// // Step 1: Load the Google login page with OAuth parameters
// Component.onCompleted: {
// var url = authorizationUrl +
// "?client_id=" + clientId +
// "&redirect_uri=" + redirectUri +
// "&response_type=code" +
// "&scope=https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email";
// webView.url = url;
// }
// }

Button {
text: "Exit"
Expand Down
6 changes: 4 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#include <QGuiApplication>
#include <QIcon>
#include <QQmlApplicationEngine>
#include <QtWebEngine/QtWebEngine>
// #include <QtWebEngine/QtWebEngine>

#include <QQmlContext>

#include "includes/documenthandler.h"
#include "includes/highlighter.h"

int main(int argc, char *argv[]) {
QtWebEngine::initialize();
// QtWebEngine::initialize();

QGuiApplication app(argc, argv);

Expand Down

0 comments on commit 4b9b12b

Please sign in to comment.