Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Melroy van den Berg
WineGUI
Commits
a70fe2a7
Commit
a70fe2a7
authored
Jan 21, 2020
by
Melroy van den Berg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working winecfg & winetricks
parent
da849ba3
Pipeline
#1743
passed with stages
in 3 minutes and 4 seconds
Changes
7
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
86 additions
and
77 deletions
+86
-77
include/bottle_manager.h
include/bottle_manager.h
+3
-0
include/edit_window.h
include/edit_window.h
+2
-6
include/helper.h
include/helper.h
+3
-2
src/bottle_manager.cc
src/bottle_manager.cc
+31
-4
src/edit_window.cc
src/edit_window.cc
+1
-40
src/helper.cc
src/helper.cc
+43
-20
src/signal_dispatcher.cc
src/signal_dispatcher.cc
+3
-5
No files found.
include/bottle_manager.h
View file @
a70fe2a7
...
...
@@ -60,11 +60,14 @@ public:
void
SetActiveBottle
(
BottleItem
*
bottle
);
const
Glib
::
ustring
&
GetErrorMessage
();
// Signal handlers
void
RunProgram
(
string
filename
,
bool
is_msi_file
);
void
OpenDriveC
();
void
Reboot
();
void
Update
();
void
KillProcesses
();
void
OpenWinecfg
();
void
OpenWinetricks
();
private:
// Synchronizes access to data members
mutable
std
::
mutex
m_Mutex
;
...
...
include/edit_window.h
View file @
a70fe2a7
...
...
@@ -44,13 +44,9 @@ protected:
// Child widgets
Gtk
::
Grid
settings_grid
;
Gtk
::
Label
first_row_label
;
Gtk
::
Label
second_row_label
;
Gtk
::
Toolbar
first_toolbar
;
Gtk
::
Toolbar
second_toolbar
;
Gtk
::
Label
label
;
// Buttons first row
Gtk
::
ToolButton
edit_button
;
/*!< edit button */
Gtk
::
ToolButton
save_button
;
/*!< save button */
Gtk
::
ToolButton
delete_button
;
/*!< delete button */
// Buttons second row
...
...
include/helper.h
View file @
a70fe2a7
...
...
@@ -46,7 +46,8 @@ public:
static
Helper
&
getInstance
();
static
std
::
map
<
string
,
unsigned
long
>
GetBottlesPaths
(
const
string
&
dir_path
);
static
void
RunProgram
(
string
prefix_path
,
string
program
,
bool
is_msi_file
);
static
void
RunProgramUnderWine
(
string
prefix_path
,
string
program
,
bool
enable_tracing
,
bool
is_msi_file
);
static
void
RunProgramWithPrefix
(
string
prefix_path
,
string
program
,
bool
enable_tracing
,
bool
give_error
);
static
string
GetWineVersion
();
static
void
CreateWineBottle
(
const
string
prefix_path
,
BottleTypes
::
Bit
bit
);
static
void
RemoveWineBottle
(
const
string
prefix_path
);
...
...
@@ -77,7 +78,7 @@ private:
Helper
&
operator
=
(
const
Helper
&
)
=
delete
;
static
string
Exec
(
const
char
*
cmd
);
static
void
Wine
Exec
(
const
char
*
cmd
,
bool
enableTracing
=
false
);
static
void
Exec
Tracing
(
const
char
*
cmd
,
bool
enableTracing
);
static
int
CloseFile
(
std
::
FILE
*
file
);
static
string
GetRegValue
(
const
string
&
filename
,
const
string
&
keyName
,
const
string
&
valueName
);
static
string
GetRegMetaData
(
const
string
&
filename
,
const
string
&
metaValueName
);
...
...
src/bottle_manager.cc
View file @
a70fe2a7
...
...
@@ -44,6 +44,8 @@ BottleManager::BottleManager(MainWindow& mainWindow):
// TODO: Make it configurable via settings
std
::
vector
<
std
::
string
>
dirs
{
Glib
::
get_home_dir
(),
".winegui"
,
"prefixes"
};
BOTTLE_LOCATION
=
Glib
::
build_path
(
G_DIR_SEPARATOR_S
,
dirs
);
// TODO: Enable/disable tracing for the RunProgram commands (and make it configurable)
}
/**
...
...
@@ -298,7 +300,7 @@ void BottleManager::RunProgram(string filename, bool is_msi_file = false)
{
if
(
isBottleNotNull
())
{
Glib
::
ustring
wine_prefix
=
activeBottle
->
wine_location
();
std
::
thread
t
(
&
Helper
::
RunProgram
,
wine_prefix
,
filename
,
is_msi_file
);
std
::
thread
t
(
&
Helper
::
RunProgram
UnderWine
,
wine_prefix
,
filename
,
false
,
is_msi_file
);
t
.
detach
();
}
}
...
...
@@ -324,7 +326,7 @@ void BottleManager::Reboot()
{
if
(
isBottleNotNull
())
{
Glib
::
ustring
wine_prefix
=
activeBottle
->
wine_location
();
std
::
thread
t
(
&
Helper
::
RunProgram
,
wine_prefix
,
"wineboot -r"
,
false
);
std
::
thread
t
(
&
Helper
::
RunProgram
UnderWine
,
wine_prefix
,
"wineboot -r"
,
false
,
false
);
t
.
detach
();
}
}
...
...
@@ -336,7 +338,7 @@ void BottleManager::Update()
{
if
(
isBottleNotNull
())
{
Glib
::
ustring
wine_prefix
=
activeBottle
->
wine_location
();
std
::
thread
t
(
&
Helper
::
RunProgram
,
wine_prefix
,
"wineboot -u"
,
false
);
std
::
thread
t
(
&
Helper
::
RunProgram
UnderWine
,
wine_prefix
,
"wineboot -u"
,
false
,
false
);
t
.
detach
();
}
}
...
...
@@ -348,7 +350,32 @@ void BottleManager::KillProcesses()
{
if
(
isBottleNotNull
())
{
Glib
::
ustring
wine_prefix
=
activeBottle
->
wine_location
();
std
::
thread
t
(
&
Helper
::
RunProgram
,
wine_prefix
,
"wineboot -k"
,
false
);
std
::
thread
t
(
&
Helper
::
RunProgramUnderWine
,
wine_prefix
,
"wineboot -k"
,
false
,
false
);
t
.
detach
();
}
}
/**
* \brief Open Winecfg tool (expected to be installed)
*/
void
BottleManager
::
OpenWinecfg
()
{
if
(
isBottleNotNull
())
{
Glib
::
ustring
wine_prefix
=
activeBottle
->
wine_location
();
std
::
thread
t
(
&
Helper
::
RunProgramWithPrefix
,
wine_prefix
,
"winecfg"
,
false
,
true
);
t
.
detach
();
}
}
/**
* \brief Open Winetricks tool in GUI mode
*/
void
BottleManager
::
OpenWinetricks
()
{
if
(
isBottleNotNull
())
{
Glib
::
ustring
wine_prefix
=
activeBottle
->
wine_location
();
string
program
=
Helper
::
GetWinetricksLocation
()
+
" --gui"
;
std
::
thread
t
(
&
Helper
::
RunProgramWithPrefix
,
wine_prefix
,
program
,
false
,
false
);
t
.
detach
();
}
}
...
...
src/edit_window.cc
View file @
a70fe2a7
...
...
@@ -27,7 +27,7 @@
*/
EditWindow
::
EditWindow
(
Gtk
::
Window
&
parent
)
:
edit
_button
(
"
Edit Configuration
"
),
save
_button
(
"
Save
"
),
delete_button
(
"Delete Machine"
),
wine_config_button
(
"WineCfg"
),
activeBottle
(
nullptr
)
...
...
@@ -36,45 +36,6 @@ EditWindow::EditWindow(Gtk::Window& parent)
set_default_size
(
750
,
540
);
set_modal
(
true
);
add
(
settings_grid
);
settings_grid
.
set_margin_top
(
5
);
settings_grid
.
set_margin_end
(
5
);
settings_grid
.
set_margin_bottom
(
8
);
settings_grid
.
set_margin_start
(
8
);
settings_grid
.
set_column_spacing
(
8
);
settings_grid
.
set_row_spacing
(
12
);
first_row_label
.
set_text
(
"WineGUI Settings"
);
first_row_label
.
set_xalign
(
0
);
second_row_label
.
set_text
(
"Other Tools Settings"
);
second_row_label
.
set_xalign
(
0
);
first_toolbar
.
set_toolbar_style
(
Gtk
::
ToolbarStyle
::
TOOLBAR_BOTH
);
first_toolbar
.
set_halign
(
Gtk
::
ALIGN_CENTER
);
first_toolbar
.
set_hexpand
(
true
);
second_toolbar
.
set_toolbar_style
(
Gtk
::
ToolbarStyle
::
TOOLBAR_BOTH
);
second_toolbar
.
set_halign
(
Gtk
::
ALIGN_CENTER
);
second_toolbar
.
set_hexpand
(
true
);
settings_grid
.
attach
(
first_row_label
,
0
,
0
,
1
,
1
);
settings_grid
.
attach
(
first_toolbar
,
0
,
1
,
1
,
1
);
settings_grid
.
attach
(
second_row_label
,
0
,
2
,
1
,
1
);
settings_grid
.
attach
(
second_toolbar
,
0
,
3
,
1
,
1
);
// First row with buttons
Gtk
::
Image
*
edit_image
=
Gtk
::
manage
(
new
Gtk
::
Image
());
edit_image
->
set_from_icon_name
(
"document-edit"
,
Gtk
::
IconSize
(
Gtk
::
ICON_SIZE_LARGE_TOOLBAR
));
edit_button
.
set_icon_widget
(
*
edit_image
);
first_toolbar
.
insert
(
edit_button
,
0
);
Gtk
::
Image
*
delete_image
=
Gtk
::
manage
(
new
Gtk
::
Image
());
delete_image
->
set_from_icon_name
(
"edit-delete"
,
Gtk
::
IconSize
(
Gtk
::
ICON_SIZE_LARGE_TOOLBAR
));
delete_button
.
set_icon_widget
(
*
delete_image
);
delete_button
.
set_border_width
(
2
);
first_toolbar
.
insert
(
delete_button
,
1
);
// Second row with buttons
second_toolbar
.
insert
(
wine_config_button
,
0
);
show_all_children
();
}
...
...
src/helper.cc
View file @
a70fe2a7
...
...
@@ -129,19 +129,45 @@ std::map<std::string, unsigned long> Helper::GetBottlesPaths(const string& dir_p
}
/**
* \brief Run program under Wine (run in thread, and dettach it)
* \param[in] prefix_path - The path to
create a Wine
bottle
from
* \brief Run
a Windows
program under Wine (run in thread, and dettach it)
* \param[in] prefix_path - The path to bottle
wine
* \param[in] program - Program/executable that will be executed
* \param[in] is_msi_file - Is the program a MSI installer, let's instal it (default false)
* \param[in] enable_tracing - Enable debugging tracing to file
* \param[in] is_msi_file - Is the program a MSI installer, let's instal it
*/
void
Helper
::
RunProgram
(
string
prefix_path
,
string
program
,
bool
is_msi_file
)
void
Helper
::
RunProgram
UnderWine
(
string
prefix_path
,
string
program
,
bool
enable_tracing
,
bool
is_msi_file
)
{
string
msi
=
""
;
if
(
is_msi_file
)
{
msi
=
" msiexec /i"
;
}
// Execute the command and show the user a message when exit code is non-zero
WineExec
((
"WINEPREFIX=
\"
"
+
prefix_path
+
"
\"
"
+
msi
+
" "
+
WINE_EXECUTABLE
+
" "
+
program
).
c_str
());
ExecTracing
((
"WINEPREFIX=
\"
"
+
prefix_path
+
"
\"
"
+
msi
+
" "
+
WINE_EXECUTABLE
+
" "
+
program
).
c_str
(),
enable_tracing
);
}
/**
* \brief Run any program with only setting the WINEPREFIX env variable.
* \param[in] prefix_path - The path to wine bottle
* \param[in] program - Program that gets executed (ideally full path)
* \param[in] enable_tracing - Enable debugging tracing to file (give_error should be true as well!)
* \param[in] give_error - Inform user when application exit with non-zero exit code
*/
void
Helper
::
RunProgramWithPrefix
(
string
prefix_path
,
string
program
,
bool
enable_tracing
,
bool
give_error
)
{
bool
execTracing
=
false
;
if
(
enable_tracing
)
{
execTracing
=
true
;
}
if
(
!
give_error
)
{
execTracing
=
false
;
}
if
(
execTracing
)
{
// Execute the command and show the user a message when exit code is non-zero
ExecTracing
((
"WINEPREFIX=
\"
"
+
prefix_path
+
"
\"
"
+
program
).
c_str
(),
enable_tracing
);
}
else
{
// No tracing and no error message when exit code is non-zero
Exec
((
"WINEPREFIX=
\"
"
+
prefix_path
+
"
\"
"
+
program
).
c_str
());
}
}
/**
...
...
@@ -594,17 +620,6 @@ string Helper::GetWinetricksVersion()
return
version
;
}
/**
* \brief Show the Winetricks userinterface
*/
void
Helper
::
ShowWinetricksGUI
(
const
string
prefix_path
)
{
if
(
FileExists
(
WINETRICKS_EXECUTABLE
))
{
Exec
((
"WINEPREFIX=
\"
"
+
prefix_path
+
"
\"
"
+
WINETRICKS_EXECUTABLE
+
" --gui"
).
c_str
());
}
}
/**
* \brief Set Windows OS version by using Winetricks
*/
...
...
@@ -718,7 +733,14 @@ void Helper::SetAudioDriver(const string prefix_path, BottleTypes::AudioDriver a
*/
string
Helper
::
GetWinetricksLocation
()
{
return
WINETRICKS_EXECUTABLE
;
string
path
=
""
;
if
(
FileExists
(
WINETRICKS_EXECUTABLE
))
{
path
=
WINETRICKS_EXECUTABLE
;
}
else
{
g_warning
(
"Could not find winetricks executable!"
);
}
return
path
;
}
/****************************************************************************
...
...
@@ -747,12 +769,13 @@ string Helper::Exec(const char* cmd) {
}
/**
* \brief Execute command on terminal. Return output.
* \brief Execute command on terminal, give user an error went something went wrong.
* Also write output to log (if debugging is enabled).
* \param[in] cmd The command to be executed
* \param[in] enableTracing Enable debugging tracing to log file
* \param[in] enableTracing Enable debugging tracing to log file
(default false)
* \return Terminal stdout
*/
void
Helper
::
Wine
Exec
(
const
char
*
cmd
,
bool
enableTracing
)
{
void
Helper
::
Exec
Tracing
(
const
char
*
cmd
,
bool
enableTracing
)
{
// Max 128 characters
std
::
array
<
char
,
128
>
buffer
;
string
result
=
""
;
...
...
src/signal_dispatcher.cc
View file @
a70fe2a7
...
...
@@ -93,9 +93,6 @@ void SignalDispatcher::DispatchSignals()
menu
.
menu_settings_machine
.
connect
(
sigc
::
mem_fun
(
settingsWindow
,
&
SettingsWindow
::
Show
));
menu
.
menu_remove_machine
.
connect
(
sigc
::
mem_fun
(
manager
,
&
BottleManager
::
DeleteBottle
));
// signal_show_edit_window.connect(sigc::mem_fun(editWindow, &EditWindow::Show));
// signal_show_settings_window.connect(sigc::mem_fun(settingsWindow, &SettingsWindow::Show));
// Distribute the active bottle signal
mainWindow
->
activeBottle
.
connect
(
sigc
::
mem_fun
(
manager
,
&
BottleManager
::
SetActiveBottle
));
mainWindow
->
activeBottle
.
connect
(
sigc
::
mem_fun
(
editWindow
,
&
EditWindow
::
SetActiveBottle
));
...
...
@@ -129,8 +126,9 @@ void SignalDispatcher::DispatchSignals()
helper
.
failureOnExec
.
connect
(
sigc
::
mem_fun
(
*
mainWindow
,
&
MainWindow
::
on_exec_failure
));
// Settings buttons
// settingsWindow.directx.connect()
// settingsWindow.winetricks.connect()
//settingsWindow.directx.connect()
settingsWindow
.
winetricks
.
connect
(
sigc
::
mem_fun
(
manager
,
&
BottleManager
::
OpenWinetricks
));
settingsWindow
.
winecfg
.
connect
(
sigc
::
mem_fun
(
manager
,
&
BottleManager
::
OpenWinecfg
));
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment