Skip to content

Commit

Permalink
overhauled pc app
Browse files Browse the repository at this point in the history
  • Loading branch information
hedihadi committed Apr 1, 2024
1 parent 1d0eb12 commit 19a6118
Show file tree
Hide file tree
Showing 72 changed files with 8,667 additions and 30 deletions.
5 changes: 5 additions & 0 deletions python_scripts/generate_exe.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//DON'T USE THIS, onefile causes the file to be considered a trojan by some anti-viruses.
pyinstaller task_manager.py --onefile

pyinstaller task_manager.py
pyinstaller get_process_icon.py
55 changes: 55 additions & 0 deletions python_scripts/get_process_icon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import base64
from io import BytesIO
import win32ui
import win32gui
import win32con
import win32api
from PIL import Image
from sys import argv
import socketio
import eventlet

sio = socketio.Server()
app = socketio.WSGIApp(sio)


@sio.on('get_process_icon')
def get_process_icon(sid, data):
try:
ico_x = win32api.GetSystemMetrics(win32con.SM_CXICON)
ico_y = win32api.GetSystemMetrics(win32con.SM_CYICON)
try:
large, small = win32gui.ExtractIconEx(data, 0)
except:
pass
if len(large) == 0 or len(small) == 0:
pass
win32gui.DestroyIcon(small[0])
hdc = win32ui.CreateDCFromHandle(win32gui.GetDC(0))
hbmp = win32ui.CreateBitmap()
hbmp.CreateCompatibleBitmap(hdc, ico_x, ico_x)
hdc = hdc.CreateCompatibleDC()
hdc.SelectObject(hbmp)
hdc.DrawIcon((0, 0), large[0])
bmpstr = hbmp.GetBitmapBits(True)
icon = Image.frombuffer(
'RGBA',
(ico_x, ico_y),
bmpstr, 'raw', 'BGRA', 0, 1
)
if (ico_x > 49):
icon = icon.resize((50, 50))
icon = icon.resize((50, 50))
buffered = BytesIO()
icon.save(buffered, format="PNG")
a = buffered.getvalue()
img_str = base64.b64encode(buffered.getvalue())
img_str = img_str.decode("utf-8")
sio.emit('process_icon', {"process": data, "icon": img_str})
except Exception as c:
sio.emit('process_icon', {"process": data, "icon": None})


if __name__ == '__main__':
# Run the SocketIO server using eventlet
eventlet.wsgi.server(eventlet.listen(('0.0.0.0', 6511)), app)
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class BuyPremiumWidget extends ConsumerWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"3-days trial, cancel anytime!",
"3-days trial!",
style: Theme.of(context).textTheme.labelMedium,
),
Text(
Expand Down Expand Up @@ -163,7 +163,7 @@ class BuyPremiumWidget extends ConsumerWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"7-days trial, cancel anytime!",
"7-days trial!",
style: Theme.of(context).textTheme.labelMedium,
),
Text(
Expand All @@ -180,7 +180,12 @@ class BuyPremiumWidget extends ConsumerWidget {
),
),
)),
SizedBox(height: 9.h),
SizedBox(height: 2.h),
Text(
"Subscriptions will automatically renew unless canceled within 3 days before the end of the current period. you can cancel anytime through your Google Play Store settings.",
style: Theme.of(context).textTheme.labelSmall,
),
SizedBox(height: 2.h),
const RestorePurchasesButton(),
],
),
Expand All @@ -207,7 +212,7 @@ class BenefitsWidget extends ConsumerWidget {
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3),
children: const [
BenefitCard(text: "Remove Ads"),
BenefitCard(text: "better charts (coming soon)"),
// BenefitCard(text: "better charts (coming soon)"),
BenefitCard(text: "Support the Developer"),
],
),
Expand Down
28 changes: 3 additions & 25 deletions zal_app/lib/Screens/SettingsScreen/settings_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class SettingsScreen extends ConsumerWidget {
title: "Use Celcius",
subtitle: "switch between Celcius and Fahreneit",
value: settings?['useCelcius'] ?? true,
onChanged: (value) => ref.read(settingsProvider.notifier).updateSettings('useCelcius',value),
onChanged: (value) => ref.read(settingsProvider.notifier).updateSettings('useCelcius', value),
icon: const Icon(FontAwesomeIcons.temperatureHalf),
),
],
Expand All @@ -45,43 +45,21 @@ class SettingsScreen extends ConsumerWidget {
subtitle:
"your data will be used to see how the App\nbehaves on different PC Specs,this is \nextremely helpful to me, please leave it ON.",
value: settings?['sendAnalaytics'] ?? true,
onChanged: (value) => ref.read(settingsProvider.notifier).updateSettings('sendAnalaytics',value),
onChanged: (value) => ref.read(settingsProvider.notifier).updateSettings('sendAnalaytics', value),
icon: const Icon(FontAwesomeIcons.paintRoller),
),
SwitchSettingUi(
title: "Personalized Ads",
subtitle: "",
value: settings?['personalizedAds'] ?? true,
onChanged: (value) => ref.read(settingsProvider.notifier).updateSettings('personalizedAds',value),
onChanged: (value) => ref.read(settingsProvider.notifier).updateSettings('personalizedAds', value),
icon: const Icon(FontAwesomeIcons.paintRoller),
),
],
),
ref.watch(computerDataProvider).valueOrNull == null
? Container()
: SectionSettingUi(children: [
Text("Select your primary GPU", style: Theme.of(context).textTheme.titleLarge),
StaggeredGridview(
children: ref.watch(computerDataProvider).valueOrNull!.availableGpus!.map((e) {
final gpu = e;
return GestureDetector(
onTap: () {
ref.read(settingsProvider.notifier).updateSettings('primaryGpuName',gpu);
},
child: Card(
color: (settings?['primaryGpuName'] ?? "") == gpu ? Theme.of(context).primaryColor : Theme.of(context).cardColor,
elevation: 5,
shadowColor: Colors.transparent,
child: Center(
child: Text(
gpu,
maxLines: 2,
style: Theme.of(context).textTheme.titleLarge!.copyWith(color: Theme.of(context).cardColor),
),
),
),
);
}).toList()),
Align(
alignment: Alignment.centerRight,
child: TextButton.icon(
Expand Down
2 changes: 1 addition & 1 deletion zal_app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.7.1+21
version: 1.7.2+23

environment:
sdk: ">=3.2.0 <4.0.0"
Expand Down
63 changes: 63 additions & 0 deletions zal_program/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
11 changes: 11 additions & 0 deletions zal_program/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@


Copyright 2023 Hedi Hadi

MIT License with Additional Restrictions

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to privately modify and use the Software, but not to distribute the Software or use it for commercial purposes.

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 change: 1 addition & 0 deletions zal_program/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Zal
30 changes: 30 additions & 0 deletions zal_program/Zal.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33829.357
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zal", "Zal\Zal.csproj", "{ABE23427-C720-41C8-92BD-DF87181FF3D0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2DB0CF01-2D3A-4CA1-A291-E2A3161EE683}"
ProjectSection(SolutionItems) = preProject
LICENSE.md = LICENSE.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{ABE23427-C720-41C8-92BD-DF87181FF3D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ABE23427-C720-41C8-92BD-DF87181FF3D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ABE23427-C720-41C8-92BD-DF87181FF3D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ABE23427-C720-41C8-92BD-DF87181FF3D0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5C8A664D-D750-4BDF-B4D1-46D658B0CE96}
EndGlobalSection
EndGlobal
21 changes: 21 additions & 0 deletions zal_program/Zal/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="Zal.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<Zal.Settings>
<setting name="primaryNetwork" serializeAs="String">
<value>0</value>
</setting>
<setting name="gpu" serializeAs="String">
<value>0</value>
</setting>
<setting name="runOnStartup" serializeAs="String">
<value>True</value>
</setting>
</Zal.Settings>
</userSettings>
</configuration>
22 changes: 22 additions & 0 deletions zal_program/Zal/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Application x:Class="Zal.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Zal"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
StartupUri="MainWindow.xaml">

<Application.Resources>

<ResourceDictionary>
<Style TargetType="{x:Type Window}">
<Setter Property="FontFamily" Value="Roboto" />
</Style>
<ResourceDictionary.MergedDictionaries>
<materialDesign:BundledTheme BaseTheme="Dark" PrimaryColor="DeepPurple" SecondaryColor="Lime" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
<ResourceDictionary Source="CustomTheme.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>

</Application>
56 changes: 56 additions & 0 deletions zal_program/Zal/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using Firebase.Auth.Providers;
using Firebase.Auth.Repository;
using Firebase.Auth.UI;
using System.Threading;
using System.Windows;

namespace Zal
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private static Mutex _mutex = null;
protected override void OnStartup(StartupEventArgs e)
{
const string appName = "Zal";
bool createdNew;

_mutex = new Mutex(true, appName, out createdNew);

if (!createdNew)
{
//app is already running! Exiting the application
Application.Current.Shutdown();
}

base.OnStartup(e);
}
public App()
{

FirebaseUI.Initialize(new FirebaseUIConfig
{
ApiKey = "AIzaSyDSj8N7DH3jtMOAa4hd7ytqMq2H_8iprmc",
AuthDomain = "zal1-353509.firebaseapp.com",
Providers = new FirebaseAuthProvider[]
{
new GoogleProvider(),

new EmailProvider()
},
PrivacyPolicyUrl = "https://github.com/step-up-labs/firebase-authentication-dotnet",
TermsOfServiceUrl = "https://github.com/step-up-labs/firebase-database-dotnet",
IsAnonymousAllowed = false,
AutoUpgradeAnonymousUsers = true,
UserRepository = new FileUserRepository("FirebaseSample"),
// Func called when upgrade of anonymous user fails because the user already exists
// You should grab any data created under your anonymous user, sign in with the pending credential
// and copy the existing data to the new user
// see details here: https://github.com/firebase/firebaseui-web#upgrading-anonymous-users
AnonymousUpgradeConflict = conflict => conflict.SignInWithPendingCredentialAsync(true)
});
}
}
}
10 changes: 10 additions & 0 deletions zal_program/Zal/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
Loading

0 comments on commit 19a6118

Please sign in to comment.