+/*
+ Copyright (C) 2023 Grok Image Compression Inc.
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
#pragma once
-static std::vector<std::string> get_gpu_names(std::string binary, std::string filename)
+static std::vector<std::string> get_gpu_names(boost::filesystem::path binary, boost::filesystem::path filename)
{
// Execute the GPU listing program and redirect its output to a file
- if (std::system((binary + " > " + filename).c_str()) < 0) {
+ if (std::system((binary.string() + " > " + filename.string()).c_str()) < 0) {
return {};
}
std::vector<std::string> gpu_names;
- std::ifstream file(filename);
+ std::ifstream file(filename.c_str());
if (file.is_open())
{
std::string line;
}
void update(void) {
auto cfg = Config::instance();
- auto lister_binary = cfg->gpu_binary_location() + "/" + "gpu_lister";
- auto lister_file = cfg->gpu_binary_location () + "/" + "gpus.txt";
+ auto lister_binary = cfg->gpu_binary_location() / "gpu_lister";
+ auto lister_file = cfg->gpu_binary_location () / "gpus.txt";
if (boost::filesystem::exists(lister_binary)) {
auto gpu_names = get_gpu_names(lister_binary, lister_file);
}
private:
- void OnComboBox([[maybe_unused]] wxCommandEvent& event) {
+ void OnComboBox(wxCommandEvent&)
+ {
selection = comboBox->GetSelection();
if (selection != wxNOT_FOUND)
Config::instance ()->set_selected_gpu(selection);
{
auto config = Config::instance ();
- _enable_gpu = new CheckBox (_panel, _("Enable GPU Acceleration"));
+ _enable_gpu = new CheckBox(_panel, _("Enable GPU acceleration"));
_panel->GetSizer()->Add (_enable_gpu, 0, wxALL | wxEXPAND, _border);
wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
table->AddGrowableCol (1, 1);
_panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border);
- add_label_to_sizer (table, _panel, _("Acceleration Binary Folder"), true, 0, wxLEFT | wxLEFT | wxALIGN_CENTRE_VERTICAL);
+ add_label_to_sizer(table, _panel, _("Acceleration binary folder"), true, 0, wxLEFT | wxLEFT | wxALIGN_CENTRE_VERTICAL);
_binary_location = new wxDirPickerCtrl (_panel, wxDD_DIR_MUST_EXIST);
table->Add (_binary_location, 1, wxEXPAND);
- add_label_to_sizer (table, _panel, _("GPU Selection"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
+ add_label_to_sizer(table, _panel, _("GPU selection"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
_gpu_list_control = new GpuList(_panel);
table->Add (_gpu_list_control, 1, wxEXPAND);
- add_label_to_sizer (table, _panel, _("License Server"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
+ add_label_to_sizer(table, _panel, _("License server"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
_server = new wxTextCtrl (_panel, wxID_ANY);
table->Add (_server, 1, wxEXPAND | wxALL);
auto config = Config::instance ();
checked_set (_enable_gpu, config->enable_gpu());
- _binary_location->SetPath(config->gpu_binary_location ());
+ _binary_location->SetPath(std_to_wx(config->gpu_binary_location().string()));
_gpu_list_control->update();
_gpu_list_control->setSelection(config->selected_gpu());
checked_set (_server, config->gpu_license_server());