2 #include "ui_config_zcm.h"
10 : QWidget(parent), ui(new
Ui::
ConfigZCM), _prefix(prefix)
15 auto libs = settings.value(
_prefix +
"::manual_libs", {}).toStringList();
16 for (
auto const&
lib : libs)
18 ui->listWidgetLibs->addItem(
lib);
21 bool is_manual = settings.value(
_prefix +
"::is_manual",
false).toBool();
22 ui->radioManualLibrary->setChecked(is_manual);
30 for (
int row = 0; row <
ui->listWidgetLibs->count(); row++)
32 libs <<
ui->listWidgetLibs->item(row)->text();
34 settings.setValue(
_prefix +
"::manual_libs", libs);
35 settings.setValue(
_prefix +
"::is_manual",
ui->radioManualLibrary->isChecked());
41 if (
ui->radioEnvironmentLibrary->isChecked())
43 return getenv(
"PJ_ZCMTYPES_LIB_PATH");
48 for (
int row = 0; row <
ui->listWidgetLibs->count(); row++)
50 libs <<
ui->listWidgetLibs->item(row)->text();
52 return libs.join(
":");
60 ui->radioManualLibrary->setChecked(
false);
68 ui->radioEnvironmentLibrary->setChecked(
false);
70 ui->manualWidget->setEnabled(checked);
76 auto dir = settings.value(
_prefix +
"::load_dir", QDir::currentPath()).toString();
77 auto files = QFileDialog::getOpenFileNames(
this,
"Zcm libraries", dir,
"*.so *.dll");
78 for (
auto filename : files)
80 if (
ui->listWidgetLibs->findItems(filename, Qt::MatchExactly).empty())
82 ui->listWidgetLibs->addItem(filename);
85 ui->listWidgetLibs->sortItems();
88 settings.setValue(
_prefix +
"::load_dir",
89 QFileInfo(files.front()).dir().absolutePath());
95 auto items =
ui->listWidgetLibs->selectedItems();
96 for (
auto item : items)
98 ui->listWidgetLibs->removeItemWidget(item);