Skip to content

Commit

Permalink
🔖 Merge dev into main (v0.1.2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vysp3r authored Nov 2, 2022
2 parents b93e389 + dc28490 commit 01fc479
Show file tree
Hide file tree
Showing 13 changed files with 312 additions and 240 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

- - - -

ProtonPlus is a simple Proton version manager that make it easy to install and manage Proton versions. It works with Steam, Lutris and will soon have support for custom locations. It was made in Vala with GTK4 and Libadwaita using GNOME Builder. <b>This project is still in its early phase, so please keep that in mind before using it.</b>
ProtonPlus is a simple Proton version manager that make it easy to install and manage Proton versions. It works with Steam, Lutris, Heroic Games Launcher and Bottles. It was made in Vala with GTK4 and Libadwaita using GNOME Builder. <b>This project is still in its early phase, so please keep that in mind before using it.</b>

If you have any questions about ProtonPlus or want to share information with us, please go to one of the following places:

Expand Down
2 changes: 1 addition & 1 deletion com.vysp3r.ProtonPlus.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"app-id" : "com.vysp3r.ProtonPlus",
"runtime" : "org.gnome.Platform",
"runtime-version" : "42",
"runtime-version" : "43",
"sdk" : "org.gnome.Sdk",
"command" : "protonplus",
"finish-args" : [
Expand Down
43 changes: 32 additions & 11 deletions src/application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,49 @@ namespace ProtonPlus {
}

private void on_about_action () {
string[] authors = { "Charles \"Vysp3r\" Malouin" };
string[] thanks = { "GNOME Team", "Lahey" };
string[] devs = { "Charles Malouin (Vysp3r) https://github.com/Vysp3r" };
string[] designers = { "Charles Malouin (Vysp3r) https://github.com/Vysp3r" };
string[] thanks = {
"GNOME Project https://www.gnome.org/",
"ProtonUp-Qt Project https://davidotek.github.io/protonup-qt/",
"LUG Helper Project https://github.com/starcitizen-lug/lug-helper",
"Lahey"
};

Gtk.AboutDialog aboutDialog = new Gtk.AboutDialog ();
Gtk.Image logo = new Gtk.Image.from_resource ("/com/vysp3r/ProtonPlus/ProtonPlus.png");
var aboutDialog = new Adw.AboutWindow ();

aboutDialog.set_logo (logo.get_paintable());
aboutDialog.set_program_name ("ProtonPlus");
aboutDialog.set_version ("v0.1.0");
aboutDialog.set_application_name ("ProtonPlus");
aboutDialog.set_application_icon ("com.vysp3r.ProtonPlus");
aboutDialog.set_version ("v0.1.2");
aboutDialog.set_comments ("A simple compatibility tool manager ");
aboutDialog.set_website_label ("Github");
aboutDialog.set_website ("https://github.com/Vysp3r/ProtonPlus");
aboutDialog.add_link ("Github", "https://github.com/Vysp3r/ProtonPlus");
aboutDialog.set_release_notes ("<ul>
<li>📝 Update README.md</li>
<li>🐛 Fix Preferences window default size</li>
<li>💄 Move main window to Libadwaita</li>dep
<li>💄 Move about window to Libadwaita</li>
<li>⚰️ Remove dead code</li>
<li>💄 Update main window components to Libadwaita</li>
<li>⚰️ Remove dead code</li>
<li>💄 Add an effect when extracting a tool</li>
<li>🐛 Fix label not showing up</li>
<li>🐛 Fix wrong label showing up</li>
<li>💄 Update preferences window to Libadwaita</li>
<li>⬆️ Update the runtime version</li>
<li>💬 Update the release notes</li>
</ul>");
aboutDialog.set_issue_url ("https://github.com/Vysp3r/ProtonPlus/issues/new/choose");
aboutDialog.set_copyright ("© 2022 Vysp3r");
aboutDialog.set_license_type (Gtk.License.GPL_3_0);
aboutDialog.set_authors (authors);
aboutDialog.set_developers (devs);
aboutDialog.set_designers (designers);
aboutDialog.add_credit_section ("Special thanks to", thanks);

aboutDialog.show ();
}

private void on_preferences_action () {
new ProtonPlus.Windows.Preferences (this);
new ProtonPlus.Windows.Preferences ();
}
}
}
29 changes: 0 additions & 29 deletions src/gtk/help-overlay.ui

This file was deleted.

5 changes: 4 additions & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ protonplus_sources = [
'widgets/protoncb.vala',
'widgets/protonrow.vala',

'views/games.vala',
'views/tools.vala',

'windows/home.vala',
'windows/home_custom_directory.vala',
'windows/home_info.vala',
Expand All @@ -30,7 +33,7 @@ protonplus_sources = [
#add_project_arguments(['--vapidir', vapi_dir], language: 'vala')

protonplus_deps = [
dependency('libadwaita-1', version: '>= 1.0'),
dependency('libadwaita-1', version: '>= 1.2'),
dependency('json-glib-1.0'),
dependency('libsoup-3.0'),
dependency('libarchive'),
Expand Down
14 changes: 6 additions & 8 deletions src/models/location.vala
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,18 @@ namespace ProtonPlus.Models {
this.Launcher = launcher;
}

public static Gtk.ListStore GetModel () {
Gtk.ListStore model = new Gtk.ListStore (2, typeof (string), typeof (Location));
Gtk.TreeIter iter;
public static GLib.ListStore GetStore () {
var store = new GLib.ListStore (typeof (ProtonPlus.Models.Location));

foreach (var item in GetInstallLocations ()) {
var dir = Posix.opendir (item.InstallDirectory);
foreach (var location in GetInstallLocations ()) {
var dir = Posix.opendir (location.InstallDirectory);

if (dir != null) {
model.append (out iter);
model.set (iter, 0, item.Label, 1, item, -1);
store.append (location);
}
}

return model;
return store;
}

public static GLib.List<Location> GetInstallLocations () {
Expand Down
12 changes: 5 additions & 7 deletions src/models/preference.vala
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ namespace ProtonPlus.Models {
}
}

public static Gtk.ListStore GetStyleModel () {
Gtk.ListStore model = new Gtk.ListStore (2, typeof (string), typeof (Style));
Gtk.TreeIter iter;
public static GLib.ListStore GetStyleStore () {
var model = new GLib.ListStore (typeof (ProtonPlus.Models.Preference.Style));

foreach (var item in GetStyles ()) {
model.append (out iter);
model.set (iter, 0, item.Label, 1, item, -1);
foreach (var style in GetStyles ()) {
model.append (style);
}

return model;
Expand All @@ -58,4 +56,4 @@ namespace ProtonPlus.Models {
return preferences;
}
}
}
}
3 changes: 1 addition & 2 deletions src/protonplus.gresource.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/com/vysp3r/ProtonPlus">
<file>gtk/help-overlay.ui</file>
<file>app.css</file>
<file>ProtonPlus.png</file>
</gresource>
</gresources>
</gresources>
15 changes: 15 additions & 0 deletions src/views/games.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace ProtonPlus.Views {
public class Games {
public static Gtk.Box GetBox () {
var boxMain = new Gtk.Box (Gtk.Orientation.VERTICAL, 15);
boxMain.set_margin_bottom(15);
boxMain.set_margin_end(15);
boxMain.set_margin_start(15);
boxMain.set_margin_top(15);

boxMain.append (new Gtk.Label("WIP"));

return boxMain;
}
}
}
151 changes: 151 additions & 0 deletions src/views/tools.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
namespace ProtonPlus.Views {
public class Tools {
// Widgets
Gtk.ApplicationWindow window;
Gtk.Box boxMain;
Adw.ComboRow crInstallLocation;
Gtk.ListBox listInstalledTools;

// Values
ProtonPlus.Models.Location currentLocation;

public Tools (Gtk.ApplicationWindow window) {
this.window = window;
}

public Gtk.Box GetBox () {
// Get the box child from the window
boxMain = new Gtk.Box(Gtk.Orientation.VERTICAL, 15);
boxMain.set_margin_bottom(15);
boxMain.set_margin_end(15);
boxMain.set_margin_start(15);
boxMain.set_margin_top(15);

// Create a factory
var factoryInstallLocation = new Gtk.SignalListItemFactory ();
factoryInstallLocation.setup.connect (factoryInstallLocation_Setup);
factoryInstallLocation.bind.connect (factoryInstallLocation_Bind);

// Create a comborow
crInstallLocation = new Adw.ComboRow ();
crInstallLocation.notify.connect (crInstallLocation_Notify);
crInstallLocation.set_title ("Install location");
crInstallLocation.set_model (ProtonPlus.Models.Location.GetStore ());
crInstallLocation.set_factory (factoryInstallLocation);

// Create a group with crInstallLocation in it
var groupInstallLocation = new Adw.PreferencesGroup ();
groupInstallLocation.add(crInstallLocation);

// Add groupInstallLocation to boxMain
boxMain.append (groupInstallLocation);

// Create a button
var btnAdd = new Gtk.Button ();
btnAdd.set_icon_name ("tab-new-symbolic");
btnAdd.add_css_class ("flat");
btnAdd.add_css_class ("bold");
btnAdd.clicked.connect (btnAdd_Clicked);

// Create an ActionRow with a label and a button
var rowInstalledTools = new Adw.ActionRow ();
rowInstalledTools.set_title ("Installed compatibility tools");
rowInstalledTools.add_suffix (btnAdd);

// Create a group with rowInstalledTools in it
var groupInstalledTools = new Adw.PreferencesGroup ();
groupInstalledTools.add (rowInstalledTools);

// Add groupInstalledTools to boxMain
boxMain.append (groupInstalledTools);

// Create a listbox
listInstalledTools = new Gtk.ListBox ();
listInstalledTools.set_vexpand (true);
listInstalledTools.add_css_class ("boxed-list");

// Add listInstalledTools to boxMain
boxMain.append (listInstalledTools);

// Load the default values
crInstallLocation.notify_property ("selected");

// Show the window
return boxMain;
}

// Events
public void crInstallLocation_Notify (GLib.ParamSpec param) {
if(param.get_name () == "selected"){
currentLocation = (ProtonPlus.Models.Location) crInstallLocation.get_selected_item ();
var releases = ProtonPlus.Models.CompatibilityTool.Installed (currentLocation);
var model = ProtonPlus.Models.CompatibilityTool.Release.GetModel (releases);
listInstalledTools.bind_model (model, (item) => {
var release = (ProtonPlus.Models.CompatibilityTool.Release) item;

var row = new Adw.ActionRow ();
row.set_title (release.Label);

var btnInfo = new Gtk.Button ();
btnInfo.set_icon_name ("dialog-information-symbolic");
btnInfo.add_css_class ("flat");
btnInfo.clicked.connect (() => btnInfo_Clicked (release));
row.add_suffix (btnInfo);

var btnDelete = new Gtk.Button ();
btnDelete.add_css_class ("flat");
btnDelete.set_icon_name ("user-trash-symbolic");
btnDelete.clicked.connect (() => btnDelete_Clicked (release));
row.add_suffix (btnDelete);

return row;
});
}
}

void btnAdd_Clicked () {
var dialogAddVersion = new ProtonPlus.Windows.Selector (window, currentLocation);
dialogAddVersion.response.connect ((response_id) => {
if (response_id == Gtk.ResponseType.APPLY) crInstallLocation.notify_property ("selected");
if (response_id == Gtk.ResponseType.CANCEL) dialogAddVersion.close ();
});
}

void btnInfo_Clicked (ProtonPlus.Models.CompatibilityTool.Release release) {
var dialogShowVersion = new ProtonPlus.Windows.HomeInfo (window, release, currentLocation);
dialogShowVersion.response.connect ((response_id) => {
dialogShowVersion.close ();
});
}

void btnDelete_Clicked (ProtonPlus.Models.CompatibilityTool.Release release) {
var dialogDeleteSelected = new Gtk.MessageDialog (window, Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, "Are you sure you want to remove the selected version?");
dialogDeleteSelected.response.connect ((response_id) => {
if (response_id == -8) {
Posix.system ("rm -rf " + currentLocation.InstallDirectory + "/" + release.Label);
crInstallLocation.notify_property ("selected");
}

dialogDeleteSelected.close ();
});
dialogDeleteSelected.show ();
}

void factoryInstallLocation_Bind (Gtk.SignalListItemFactory factory, Gtk.ListItem list_item) {
var string_holder = list_item.get_item () as ProtonPlus.Models.Location;

var title = list_item.get_data<Gtk.Label>("title");
title.set_label (string_holder.Label);
}

void factoryInstallLocation_Setup (Gtk.SignalListItemFactory factory, Gtk.ListItem list_item) {
var title = new Gtk.Label ("");

var box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 10);
box.append (title);

list_item.set_data ("title", title);
list_item.set_child (box);
}
}
}
Loading

0 comments on commit 01fc479

Please sign in to comment.