Commit 4c585dea authored by Melroy van den Berg's avatar Melroy van den Berg

Introduce a busy dialog. Give feedback to the user when a package is installing...

parent 7902d2fa
Pipeline #1753 passed with stages
in 3 minutes and 28 seconds
......@@ -73,11 +73,11 @@ public:
void OpenTaskManager();
void OpenRegistertyEditor();
void OpenNotepad();
void InstallD3DX9(const Glib::ustring& version);
void InstallDXVK(const Glib::ustring& version);
void InstallVisualCppPackage(const Glib::ustring& version);
void InstallDotNet(const Glib::ustring& version);
void InstallCoreFonts();
void InstallD3DX9(Gtk::Window& parent, const Glib::ustring& version);
void InstallDXVK(Gtk::Window& parent, const Glib::ustring& version);
void InstallVisualCppPackage(Gtk::Window& parent, const Glib::ustring& version);
void InstallDotNet(Gtk::Window& parent, const Glib::ustring& version);
void InstallCoreFonts(Gtk::Window& parent);
private:
Glib::Dispatcher finishedPackageInstall; /*!< Signal that Wine package install is completed */
// Synchronizes access to data members
......
......@@ -34,9 +34,17 @@ public:
explicit BusyDialog(Gtk::Window& parent);
virtual ~BusyDialog();
void show();
void close();
void SetMessage(const Glib::ustring& message);
protected:
Gtk::Label message_label;
Gtk::ProgressBar loading_bar;
private:
sigc::connection timer; /*!< Timer connection */
Gtk::Window& defaultParent;
virtual bool Pulsing();
};
......@@ -68,6 +68,7 @@ public:
void ShowErrorMessage(const Glib::ustring& message);
bool ShowConfirmDialog(const Glib::ustring& message);
void ShowBusyDialog(const Glib::ustring& message);
void ShowBusyDialog(Gtk::Window& parent, const Glib::ustring& message);
void CloseBusyDialog();
// Signal handlers
......
......@@ -35,11 +35,11 @@ class SettingsWindow : public Gtk::Window
{
public:
// Signals
sigc::signal<void, Glib::ustring&> directx9; /*!< Install d3dx9 for Direct3D 9 signal */
sigc::signal<void, Glib::ustring&> vulkan; /*!< Install DXVK for Direct3D 9/10/11 using Vulkan signal */
sigc::signal<void> corefonts; /*!< Install Core fonts signal */
sigc::signal<void, Glib::ustring&> visual_cpp_package; /*!< Install Visual C++ package signal */
sigc::signal<void, Glib::ustring&> dotnet; /*!< Install .NET signal */
sigc::signal<void, Gtk::Window&, Glib::ustring&> directx9; /*!< Install d3dx9 for Direct3D 9 signal */
sigc::signal<void, Gtk::Window&, Glib::ustring&> vulkan; /*!< Install DXVK for Direct3D 9/10/11 using Vulkan signal */
sigc::signal<void, Gtk::Window&> corefonts; /*!< Install Core fonts signal */
sigc::signal<void, Gtk::Window&, Glib::ustring&> visual_cpp_package; /*!< Install Visual C++ package signal */
sigc::signal<void, Gtk::Window&, Glib::ustring&> dotnet; /*!< Install .NET signal */
sigc::signal<void> uninstaller; /*!< Open Wine Uninstaller signal */
sigc::signal<void> notepad; /*!< Open Notepad editor signal */
sigc::signal<void> task_manager; /*!< Open Wine Task Manager signal */
......
......@@ -431,52 +431,67 @@ void BottleManager::OpenNotepad()
/**
* \brief Install D3DX9 (DirectX 9)
* \param[in] parent Parent GTK window were the request is coming from
* \param[in] version Version of additional DirectX 9 DLLs, eg. 26 (for default use: "")
*/
void BottleManager::InstallD3DX9(const Glib::ustring& version)
void BottleManager::InstallD3DX9(Gtk::Window& parent, const Glib::ustring& version)
{
if (isBottleNotNull()) {
// Before we execute the install, show busy dialog
mainWindow.ShowBusyDialog(parent, "Installing D3DX9 (OpenGL implementation of DirectX 9).");
Glib::ustring package = "d3dx9";
if (version != "") {
package += "_" + version;
}
Glib::ustring wine_prefix = activeBottle->wine_location();
Glib::ustring program = Helper::GetWinetricksLocation() + " " + package;
std::thread t(&Helper::RunProgram, wine_prefix, program, false, true);
// finishedPackageInstall signal is needed in order to close the busy dialog again
std::thread t(&Helper::RunProgramWithFinishCallback, wine_prefix, program, false, true, false, &finishedPackageInstall);
t.detach();
}
}
/**
* \brief Install DXVK (Vulkan based DirectX 9/10/11)
* Note: initially only Direct3D 10 & 11 was supported by DXVK.
* Note: initially only Direct3D 10 & 11 was supported by DXVK. But now also Direct3D 9.
* \param[in] parent Parent GTK window were the request is coming from
* \param[in] version Version of DXVK, eg. 151 (for default use: "latest")
*/
void BottleManager::InstallDXVK(const Glib::ustring& version)
void BottleManager::InstallDXVK(Gtk::Window& parent, const Glib::ustring& version)
{
if (isBottleNotNull()) {
// Before we execute the install, show busy dialog
mainWindow.ShowBusyDialog(parent, "Installing DXVK (Vulkan-based implementation of DirectX 9, 10 and 11).\n");
Glib::ustring package = "dxvk";
if (version != "latest") {
package += version;
}
Glib::ustring wine_prefix = activeBottle->wine_location();
Glib::ustring program = Helper::GetWinetricksLocation() + " " + package;
std::thread t(&Helper::RunProgram, wine_prefix, program, false, true);
// finishedPackageInstall signal is needed in order to close the busy dialog again
std::thread t(&Helper::RunProgramWithFinishCallback, wine_prefix, program, false, true, false, &finishedPackageInstall);
t.detach();
}
}
/**
* \brief Install MS Visual C++ Redistributable Package
* \param[in] parent Parent GTK window were the request is coming from
* \param[in] version Version of Visual C++, eg. 2010, 2013, 2015 (no default)
*/
void BottleManager::InstallVisualCppPackage(const Glib::ustring& version)
void BottleManager::InstallVisualCppPackage(Gtk::Window& parent, const Glib::ustring& version)
{
if (isBottleNotNull()) {
// Before we execute the install, show busy dialog
mainWindow.ShowBusyDialog(parent, "Installing Visual C++ package.");
Glib::ustring package = "vcrun" + version;
Glib::ustring wine_prefix = activeBottle->wine_location();
Glib::ustring program = Helper::GetWinetricksLocation() + " " + package;
std::thread t(&Helper::RunProgram, wine_prefix, program, false, true);
// finishedPackageInstall signal is needed in order to close the busy dialog again
std::thread t(&Helper::RunProgramWithFinishCallback, wine_prefix, program, false, true, false, &finishedPackageInstall);
t.detach();
}
}
......@@ -484,12 +499,16 @@ void BottleManager::InstallVisualCppPackage(const Glib::ustring& version)
/**
* \brief Install MS .NET (deinstall Mono first if needed)
* Idea: Install dotnet_verifier by default with it?
* \param[in] parent Parent GTK window were the request is coming from
* \param[in] version Version of .NET, eg. '35' for 3.5, '471' for 4.7.1 or '35sp1' for 3.5 SP1 (no default)
*/
void BottleManager::InstallDotNet(const Glib::ustring& version)
void BottleManager::InstallDotNet(Gtk::Window& parent, const Glib::ustring& version)
{
if (isBottleNotNull()) {
if (mainWindow.ShowConfirmDialog("Important note: Wine Mono & Gecko support is often sufficient enough.\n\nWine Mono will be *uninstalled* before native .NET will be installed.\n\nAre you sure you want to continue?")) {
// Before we execute the install, show busy dialog
mainWindow.ShowBusyDialog(parent, "Installing Native .NET redistributable packages. This may take a while.\n");
Glib::ustring program = "";
Glib::ustring deinstallCommand = this->GetDeinstallMonoCommand();
......@@ -503,7 +522,8 @@ void BottleManager::InstallDotNet(const Glib::ustring& version)
} else {
program = installCommand;
}
std::thread t(&Helper::RunProgram, wine_prefix, program, false, true);
// finishedPackageInstall signal is needed in order to close the busy dialog again
std::thread t(&Helper::RunProgramWithFinishCallback, wine_prefix, program, false, true, false, &finishedPackageInstall);
t.detach();
} else {
// Nothing, canceled
......@@ -512,16 +532,18 @@ void BottleManager::InstallDotNet(const Glib::ustring& version)
}
/**
* \brief Install core fonts (often enough)
* \brief Install core fonts (which is often enough)
* \param[in] parent Parent GTK window were the request is coming from
*/
void BottleManager::InstallCoreFonts()
void BottleManager::InstallCoreFonts(Gtk::Window& parent)
{
if (isBottleNotNull()) {
// Before we execute the install, show busy indicator
mainWindow.ShowBusyDialog("Installing Core fonts.");
// Before we execute the install, show busy dialog
mainWindow.ShowBusyDialog(parent, "Installing Core fonts.");
Glib::ustring wine_prefix = activeBottle->wine_location();
Glib::ustring program = Helper::GetWinetricksLocation() + " corefonts";
Glib::ustring program = Helper::GetWinetricksLocation() + " corefonts";
// finishedPackageInstall signal is needed in order to close the busy dialog again
std::thread t(&Helper::RunProgramWithFinishCallback, wine_prefix, program, false, true, false, &finishedPackageInstall);
t.detach();
}
......
......@@ -26,14 +26,21 @@
*/
BusyDialog::BusyDialog(Gtk::Window& parent)
: Gtk::Dialog("Busy, please wait until finished..."),
message_label("Jaja")
message_label("Jaja"),
defaultParent(parent)
{
set_transient_for(parent);
set_default_size(400, 120);
set_modal(true);
get_vbox()->pack_start(message_label);
set_deletable(false);
Gtk::Box* box = get_vbox();
loading_bar.set_pulse_step(0.3);
loading_bar.set_hexpand(true);
box->pack_start(message_label, true, false);
box->pack_start(loading_bar, true, false);
show_all_children();
}
......@@ -50,3 +57,34 @@ void BusyDialog::SetMessage(const Glib::ustring& message)
{
this->message_label.set_text(message + " Please wait...");
}
void BusyDialog::show()
{
if (!timer.empty() && timer.connected()) {
timer.disconnect();
}
int time_interval = 200;
timer = Glib::signal_timeout().connect(
sigc::mem_fun(*this, &BusyDialog::Pulsing),
time_interval);
Gtk::Dialog::show();
}
void BusyDialog::close()
{
// Reset default parent
set_transient_for(defaultParent);
// Stop pulsing timer
if (!timer.empty() && timer.connected()) {
timer.disconnect();
}
Gtk::Dialog::close();
}
bool BusyDialog::Pulsing()
{
loading_bar.pulse();
return true;
}
......@@ -195,14 +195,21 @@ bool MainWindow::ShowConfirmDialog(const Glib::ustring& message)
*/
void MainWindow::ShowBusyDialog(const Glib::ustring& message)
{
// TODO: Create some custom dialog...
// TODO: Add this object/class to the main window (header file), so we always has a reference to it
// TODO: This function should .show() it, and HideBusyDialog() method should hide this dialog.
// false = no markup
busyDialog.SetMessage(message);
busyDialog.show();
}
/**
* \brief Show busy indicator, with another parent
* \param[in] message - Given the user more information what is going on
*/
void MainWindow::ShowBusyDialog(Gtk::Window& parent, const Glib::ustring& message)
{
busyDialog.SetMessage(message);
busyDialog.set_transient_for(parent);
busyDialog.show();
}
/**
* \brief Close the busy dialog again
*/
......
......@@ -98,45 +98,42 @@ SettingsWindow::SettingsWindow(Gtk::Window& parent)
settings_grid.attach(fourth_row_label, 0, 7, 1, 1);
settings_grid.attach(fourth_toolbar, 0, 8, 1, 1);
// TODO: Inform the user to disable desktop effects of the compositor. And set CPU to performance.
// First row buttons, 1-button installs
Gtk::Image* d3dx9_image = Gtk::manage(new Gtk::Image());
d3dx9_image->set_from_icon_name("system-software-install", Gtk::IconSize(Gtk::ICON_SIZE_LARGE_TOOLBAR));
install_d3dx9_button.signal_clicked().connect(sigc::bind<Glib::ustring>(directx9, ""));
install_d3dx9_button.signal_clicked().connect(sigc::bind<Gtk::Window&, Glib::ustring>(directx9, *this, ""));
install_d3dx9_button.set_tooltip_text("Installs MS D3DX9: Ideal for DirectX 9 games, by using OpenGL");
install_d3dx9_button.set_icon_widget(*d3dx9_image);
first_toolbar.insert(install_d3dx9_button, 0);
Gtk::Image* vulkan_image = Gtk::manage(new Gtk::Image());
vulkan_image->set_from_icon_name("system-software-install", Gtk::IconSize(Gtk::ICON_SIZE_LARGE_TOOLBAR));
install_dxvk_button.signal_clicked().connect(sigc::bind<Glib::ustring>(vulkan, "latest"));
install_dxvk_button.signal_clicked().connect(sigc::bind<Gtk::Window&, Glib::ustring>(vulkan, *this, "latest"));
install_dxvk_button.set_tooltip_text("Installs DXVK: Ideal for DirectX 9/10/11 games, by using Vulkan");
install_dxvk_button.set_icon_widget(*vulkan_image);
first_toolbar.insert(install_dxvk_button, 1);
// TODO: esync wine build?
// Note: Gallium nine (using Mesa 3D) currently not supported, since it requires still a patched Wine version.
// TODO: Inform the user to disable desktop effects of the compositor. And set CPU to performance.
// Second row, additional packages
Gtk::Image* corefonts_image = Gtk::manage(new Gtk::Image());
corefonts_image->set_from_icon_name("font-x-generic", Gtk::IconSize(Gtk::ICON_SIZE_LARGE_TOOLBAR));
install_core_fonts_button.signal_clicked().connect(corefonts);
install_core_fonts_button.signal_clicked().connect(sigc::bind<Gtk::Window&>(corefonts, *this));
install_core_fonts_button.set_tooltip_text("Installs MS Core Fonts");
install_core_fonts_button.set_icon_widget(*corefonts_image);
second_toolbar.insert(install_core_fonts_button, 0);
Gtk::Image* visual_cpp_image = Gtk::manage(new Gtk::Image());
visual_cpp_image->set_from_icon_name("system-software-install", Gtk::IconSize(Gtk::ICON_SIZE_LARGE_TOOLBAR));
install_visual_cpp_button.signal_clicked().connect(sigc::bind<Glib::ustring>(visual_cpp_package, "2013"));
install_visual_cpp_button.signal_clicked().connect(sigc::bind<Gtk::Window&, Glib::ustring>(visual_cpp_package, *this, "2013"));
install_visual_cpp_button.set_tooltip_text("Installs Visual C++ 2013 package");
install_visual_cpp_button.set_icon_widget(*visual_cpp_image);
second_toolbar.insert(install_visual_cpp_button, 1);
// TODO: Create pop-up message that Mono will be uninstalled first
// since .NET and Mono will conflict. Only continue when user pressed 'Accept'.
Gtk::Image* dotnet_image = Gtk::manage(new Gtk::Image());
dotnet_image->set_from_icon_name("system-software-install", Gtk::IconSize(Gtk::ICON_SIZE_LARGE_TOOLBAR));
install_dotnet_button.signal_clicked().connect(sigc::bind<Glib::ustring>(dotnet, "452"));
install_dotnet_button.signal_clicked().connect(sigc::bind<Gtk::Window&, Glib::ustring>(dotnet, *this, "452"));
install_dotnet_button.set_tooltip_text("Installs .NET 4.0 and .NET 4.5.2");
install_dotnet_button.set_icon_widget(*dotnet_image);
second_toolbar.insert(install_dotnet_button, 2);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment