Skip to content

Commit

Permalink
Impelement a new configure environment variable window
Browse files Browse the repository at this point in the history
  • Loading branch information
melroy89 committed Aug 23, 2024
1 parent 0aac1a3 commit 88c9f28
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 30 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ set(HEADERS
include/preferences_window.h
include/bottle_edit_window.h
include/bottle_clone_window.h
include/bottle_configure_env_var_window.h
include/bottle_configure_window.h
include/busy_dialog.h
include/bottle_manager.h
Expand All @@ -100,6 +101,7 @@ set(SOURCES
src/preferences_window.cc
src/bottle_edit_window.cc
src/bottle_clone_window.cc
src/bottle_configure_env_var_window.cc
src/bottle_configure_window.cc
src/busy_dialog.cc
src/bottle_manager.cc
Expand Down
45 changes: 24 additions & 21 deletions include/bottle_edit_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class BottleEditWindow : public Gtk::Window
{
public:
// Signals
sigc::signal<void> configure_environment_variables; /*!< configure environment variables signal */
sigc::signal<void, UpdateBottleStruct&> update_bottle; /*!< save button clicked signal */
sigc::signal<void> remove_bottle; /*!< remove button clicked signal */

Expand All @@ -69,27 +70,29 @@ class BottleEditWindow : public Gtk::Window
Gtk::Box hbox_buttons; /*!< box for buttons */
Gtk::Grid edit_grid; /*!< grid layout for form */

Gtk::Label header_edit_label; /*!< header edit label */
Gtk::Label name_label; /*!< name label */
Gtk::Label folder_name_label; /*!< folder name label */
Gtk::Label windows_version_label; /*!< windows version label */
Gtk::Label audio_driver_label; /*!< audio driver label */
Gtk::Label virtual_desktop_resolution_label; /*!< virtual desktop resolution label */
Gtk::Label log_level_label; /*!< log level label */
Gtk::Label description_label; /*!< description label */
Gtk::Entry name_entry; /*!< name input field */
Gtk::Entry folder_name_entry; /*!< folder name input field */
Gtk::Entry virtual_desktop_resolution_entry; /*!< virtual desktop resolution input field */
Gtk::ComboBoxText windows_version_combobox; /*!< windows version combobox */
Gtk::ComboBoxText audio_driver_combobox; /*!< audio driver combobox */
Gtk::CheckButton virtual_desktop_check; /*!< virtual desktop checkbox */
Gtk::CheckButton enable_logging_check; /**!< debug logging checkbox */
Gtk::ComboBoxText log_level_combobox; /*!< log level combobox */
Gtk::ScrolledWindow description_scrolled_window; /*!< description scrolled window */
Gtk::TextView description_text_view; /*!< description text view */
Gtk::Button save_button; /*!< save button */
Gtk::Button cancel_button; /*!< cancel button */
Gtk::Button delete_button; /*!< delete button */
Gtk::Label header_edit_label; /*!< header edit label */
Gtk::Label name_label; /*!< name label */
Gtk::Label folder_name_label; /*!< folder name label */
Gtk::Label windows_version_label; /*!< windows version label */
Gtk::Label audio_driver_label; /*!< audio driver label */
Gtk::Label virtual_desktop_resolution_label; /*!< virtual desktop resolution label */
Gtk::Label log_level_label; /*!< log level label */
Gtk::Label description_label; /*!< description label */
Gtk::Label environment_variables_label; /*!< environment variables label */
Gtk::Entry name_entry; /*!< name input field */
Gtk::Entry folder_name_entry; /*!< folder name input field */
Gtk::Entry virtual_desktop_resolution_entry; /*!< virtual desktop resolution input field */
Gtk::ComboBoxText windows_version_combobox; /*!< windows version combobox */
Gtk::ComboBoxText audio_driver_combobox; /*!< audio driver combobox */
Gtk::CheckButton virtual_desktop_check; /*!< virtual desktop checkbox */
Gtk::CheckButton enable_logging_check; /**!< debug logging checkbox */
Gtk::ComboBoxText log_level_combobox; /*!< log level combobox */
Gtk::ScrolledWindow description_scrolled_window; /*!< description scrolled window */
Gtk::TextView description_text_view; /*!< description text view */
Gtk::Button configure_environment_variables_button; /*!< configure environment variables button */
Gtk::Button save_button; /*!< save button */
Gtk::Button cancel_button; /*!< cancel button */
Gtk::Button delete_button; /*!< delete button */

// Busy dialog
BusyDialog busy_dialog; /*!< Busy dialog, when the user should wait until install is finished */
Expand Down
3 changes: 3 additions & 0 deletions include/signal_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class PreferencesWindow;
class AboutDialog;
class BottleEditWindow;
class BottleCloneWindow;
class BottleConfigureEnvVarWindow;
class BottleConfigureWindow;
class AddAppWindow;
class RemoveAppWindow;
Expand All @@ -53,6 +54,7 @@ class SignalController : public Gtk::Window
AboutDialog& about_dialog,
BottleEditWindow& edit_window,
BottleCloneWindow& clone_window,
BottleConfigureEnvVarWindow& configure_env_var_window,
BottleConfigureWindow& configure_window,
AddAppWindow& add_app_window,
RemoveAppWindow& remove_app_window);
Expand Down Expand Up @@ -99,6 +101,7 @@ class SignalController : public Gtk::Window
AboutDialog& about_dialog_;
BottleEditWindow& edit_window_;
BottleCloneWindow& clone_window_;
BottleConfigureEnvVarWindow& configure_env_var_window_;
BottleConfigureWindow& configure_window_;
AddAppWindow& add_app_window_;
RemoveAppWindow& remove_app_window_;
Expand Down
19 changes: 13 additions & 6 deletions src/bottle_edit_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,18 @@ BottleEditWindow::BottleEditWindow(Gtk::Window& parent)
virtual_desktop_resolution_label("Window Resolution:"),
log_level_label("Log Level:"),
description_label("Description:"),
environment_variables_label("Environment Variables:"),
virtual_desktop_check("Enable Virtual Desktop Window"),
enable_logging_check("Enable debug logging"),
configure_environment_variables_button("Configure Environment Variables"),
save_button("Save"),
cancel_button("Cancel"),
delete_button("Delete Machine"),
busy_dialog(*this),
active_bottle_(nullptr)
{
set_transient_for(parent);
set_default_size(500, 500);
set_default_size(540, 540);
set_modal(true);

edit_grid.set_margin_top(5);
Expand All @@ -72,12 +74,16 @@ BottleEditWindow::BottleEditWindow(Gtk::Window& parent)
audio_driver_label.set_halign(Gtk::Align::ALIGN_END);
virtual_desktop_resolution_label.set_halign(Gtk::Align::ALIGN_END);
log_level_label.set_halign(Gtk::Align::ALIGN_END);
environment_variables_label.set_halign(Gtk::Align::ALIGN_END);
description_label.set_halign(Gtk::Align::ALIGN_START);
name_label.set_tooltip_text("Change the machine name");
folder_name_label.set_tooltip_text("Change the folder. NOTE: This break your shortcuts!");
windows_version_label.set_tooltip_text("Change the Windows version");
audio_driver_label.set_tooltip_text("Change the audio driver");
virtual_desktop_resolution_label.set_tooltip_text("Set the emulated desktop resolution");
log_level_label.set_tooltip_text("Change the Wine debug messages for logging");
environment_variables_label.set_tooltip_text("Set one or more environment variables");
description_label.set_tooltip_text("Add an additional description text to your machine");

// Fill-in Audio drivers in combobox
for (int i = BottleTypes::AudioDriverStart; i < BottleTypes::AudioDriverEnd; i++)
Expand All @@ -88,7 +94,6 @@ BottleEditWindow::BottleEditWindow(Gtk::Window& parent)
virtual_desktop_resolution_entry.set_text("1024x768");
enable_logging_check.set_active(false);

description_label.set_halign(Gtk::Align::ALIGN_START);
log_level_combobox.append("0", "Off");
log_level_combobox.append("1", "Error + Fixme (Default)");
log_level_combobox.append("2", "Only Errors (Could improve performance)");
Expand All @@ -109,7 +114,6 @@ BottleEditWindow::BottleEditWindow(Gtk::Window& parent)
virtual_desktop_check.set_tooltip_text("Enable emulate virtual desktop resolution");
enable_logging_check.set_tooltip_text("Enable output logging to disk");
folder_name_entry.set_tooltip_text("Important: This will break your shortcuts! Consider changing the name instead, see above.");
description_label.set_tooltip_text("Add an additional description text to your machine");

description_scrolled_window.add(description_text_view);
description_scrolled_window.set_hexpand(true);
Expand All @@ -129,9 +133,11 @@ BottleEditWindow::BottleEditWindow(Gtk::Window& parent)
edit_grid.attach(enable_logging_check, 0, 6, 2);
edit_grid.attach(log_level_label, 0, 7);
edit_grid.attach(log_level_combobox, 1, 7);
edit_grid.attach(*Gtk::manage(new Gtk::Separator(Gtk::ORIENTATION_HORIZONTAL)), 0, 8, 2);
edit_grid.attach(description_label, 0, 9, 2);
edit_grid.attach(description_scrolled_window, 0, 10, 2);
edit_grid.attach(environment_variables_label, 0, 8);
edit_grid.attach(configure_environment_variables_button, 1, 8);
edit_grid.attach(*Gtk::manage(new Gtk::Separator(Gtk::ORIENTATION_HORIZONTAL)), 0, 9, 2);
edit_grid.attach(description_label, 0, 10, 2);
edit_grid.attach(description_scrolled_window, 0, 11, 2);

hbox_buttons.pack_start(delete_button, false, false, 4);
hbox_buttons.pack_end(save_button, false, false, 4);
Expand All @@ -147,6 +153,7 @@ BottleEditWindow::BottleEditWindow(Gtk::Window& parent)
log_level_sensitive(false);

// Signals
configure_environment_variables_button.signal_clicked().connect(configure_environment_variables);
delete_button.signal_clicked().connect(remove_bottle);
virtual_desktop_check.signal_toggled().connect(sigc::mem_fun(*this, &BottleEditWindow::on_virtual_desktop_toggle));
enable_logging_check.signal_toggled().connect(sigc::mem_fun(*this, &BottleEditWindow::on_debug_logging_toggle));
Expand Down
6 changes: 4 additions & 2 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "about_dialog.h"
#include "add_app_window.h"
#include "bottle_clone_window.h"
#include "bottle_configure_env_var_window.h"
#include "bottle_configure_window.h"
#include "bottle_edit_window.h"
#include "bottle_manager.h"
Expand Down Expand Up @@ -78,11 +79,12 @@ static MainWindow& setupApplication()
static AboutDialog about_dialog(main_window);
static BottleEditWindow edit_window(main_window);
static BottleCloneWindow clone_window(main_window);
static BottleConfigureEnvVarWindow settings_env_var_window(edit_window);
static BottleConfigureWindow settings_window(main_window);
static AddAppWindow add_app_window(main_window);
static RemoveAppWindow remove_app_window(main_window);
static SignalController signal_controller(manager, menu, preferences_window, about_dialog, edit_window, clone_window, settings_window,
add_app_window, remove_app_window);
static SignalController signal_controller(manager, menu, preferences_window, about_dialog, edit_window, clone_window, settings_env_var_window,
settings_window, add_app_window, remove_app_window);

signal_controller.set_main_window(&main_window);
// Do all the signal connections of the life-time of the app
Expand Down
7 changes: 6 additions & 1 deletion src/signal_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "about_dialog.h"
#include "add_app_window.h"
#include "bottle_clone_window.h"
#include "bottle_configure_env_var_window.h"
#include "bottle_configure_window.h"
#include "bottle_edit_window.h"
#include "bottle_manager.h"
Expand All @@ -42,6 +43,7 @@ SignalController::SignalController(BottleManager& manager,
AboutDialog& about_dialog,
BottleEditWindow& edit_window,
BottleCloneWindow& clone_window,
BottleConfigureEnvVarWindow& configure_env_var_window,
BottleConfigureWindow& configure_window,
AddAppWindow& add_app_window,
RemoveAppWindow& remove_app_window)
Expand All @@ -52,6 +54,7 @@ SignalController::SignalController(BottleManager& manager,
about_dialog_(about_dialog),
edit_window_(edit_window),
clone_window_(clone_window),
configure_env_var_window_(configure_env_var_window),
configure_window_(configure_window),
add_app_window_(add_app_window),
remove_app_window_(remove_app_window),
Expand Down Expand Up @@ -111,12 +114,14 @@ void SignalController::dispatch_signals()
main_window_->active_bottle.connect(sigc::mem_fun(manager_, &BottleManager::set_active_bottle));
main_window_->active_bottle.connect(sigc::mem_fun(edit_window_, &BottleEditWindow::set_active_bottle));
main_window_->active_bottle.connect(sigc::mem_fun(clone_window_, &BottleCloneWindow::set_active_bottle));
main_window_->active_bottle.connect(sigc::mem_fun(configure_env_var_window_, &BottleConfigureEnvVarWindow::set_active_bottle));
main_window_->active_bottle.connect(sigc::mem_fun(configure_window_, &BottleConfigureWindow::set_active_bottle));
main_window_->active_bottle.connect(sigc::mem_fun(add_app_window_, &AddAppWindow::set_active_bottle));
main_window_->active_bottle.connect(sigc::mem_fun(remove_app_window_, &RemoveAppWindow::set_active_bottle));
// Distribute the reset bottle signal from the manager
manager_.reset_active_bottle.connect(sigc::mem_fun(edit_window_, &BottleEditWindow::reset_active_bottle));
manager_.reset_active_bottle.connect(sigc::mem_fun(clone_window_, &BottleCloneWindow::reset_active_bottle));
manager_.reset_active_bottle.connect(sigc::mem_fun(configure_env_var_window_, &BottleConfigureEnvVarWindow::reset_active_bottle));
manager_.reset_active_bottle.connect(sigc::mem_fun(configure_window_, &BottleConfigureWindow::reset_active_bottle));
manager_.reset_active_bottle.connect(sigc::mem_fun(add_app_window_, &AddAppWindow::reset_active_bottle));
manager_.reset_active_bottle.connect(sigc::mem_fun(remove_app_window_, &RemoveAppWindow::reset_active_bottle));
Expand Down Expand Up @@ -146,6 +151,7 @@ void SignalController::dispatch_signals()
main_window_->show_remove_app_window.connect(sigc::mem_fun(remove_app_window_, &RemoveAppWindow::show));

// Edit Window
edit_window_.configure_environment_variables.connect(sigc::mem_fun(configure_env_var_window_, &BottleConfigureEnvVarWindow::show));
edit_window_.update_bottle.connect(sigc::mem_fun(this, &SignalController::on_update_bottle));
edit_window_.remove_bottle.connect(sigc::mem_fun(manager_, &BottleManager::delete_bottle));

Expand All @@ -172,7 +178,6 @@ void SignalController::dispatch_signals()
configure_window_.directx9.connect(sigc::mem_fun(manager_, &BottleManager::install_d3dx9));
configure_window_.dxvk.connect(sigc::mem_fun(manager_, &BottleManager::install_dxvk));
configure_window_.vkd3d.connect(sigc::mem_fun(manager_, &BottleManager::install_vkd3d));

// Settings additional package buttons
configure_window_.liberation_fonts.connect(sigc::mem_fun(manager_, &BottleManager::install_liberation));
configure_window_.corefonts.connect(sigc::mem_fun(manager_, &BottleManager::install_core_fonts));
Expand Down

0 comments on commit 88c9f28

Please sign in to comment.