summaryrefslogtreecommitdiffhomepage
path: root/proto-ft/ftnoir_protocol_ft_dialog.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2021-08-21 14:15:43 +0200
committerStanislaw Halik <sthalik@misaki.pl>2021-08-21 14:15:43 +0200
commitdae6a98f826f78bda7511ba6de4c8b813353501e (patch)
tree7c531774f9d4b5865393190e8ae1527b86e63bd6 /proto-ft/ftnoir_protocol_ft_dialog.cpp
parentb615cc6d60beede9cb76b143007a7a1720846c5c (diff)
proto/freetrack: implement more dll location controls
Diffstat (limited to 'proto-ft/ftnoir_protocol_ft_dialog.cpp')
-rw-r--r--proto-ft/ftnoir_protocol_ft_dialog.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/proto-ft/ftnoir_protocol_ft_dialog.cpp b/proto-ft/ftnoir_protocol_ft_dialog.cpp
index 58077b87..9686ee92 100644
--- a/proto-ft/ftnoir_protocol_ft_dialog.cpp
+++ b/proto-ft/ftnoir_protocol_ft_dialog.cpp
@@ -22,7 +22,17 @@ FTControls::FTControls()
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel()));
connect(ui.bntLocateNPClient, SIGNAL(clicked()), this, SLOT(selectDLL()));
- tie_setting(s.intUsedInterface, ui.cbxSelectInterface);
+ const settings::enable_status cbx[] = {
+ settings::enable_both,
+ settings::enable_freetrack,
+ settings::enable_npclient,
+ };
+ tie_setting(s.used_interface, ui.cbxSelectInterface);
+ tie_setting(s.ephemeral_library_location, ui.ephemeral_registry_entry);
+ tie_setting(s.custom_location_pathname, ui.custom_location);
+ tie_setting(s.use_custom_location, ui.enable_custom_location);
+
+ connect(ui.set_custom_location, &QAbstractButton::clicked, this, &FTControls::set_custom_location);
}
void FTControls::doOK()
@@ -50,4 +60,16 @@ void FTControls::selectDLL()
node.setValue("Path", dllname.dir().path());
}
}
-
+void FTControls::set_custom_location()
+{
+ static const auto program_directory = OPENTRACK_BASE_PATH + OPENTRACK_LIBRARY_PATH;
+ auto previous_location = *s.custom_location_pathname;
+ if (!s.use_custom_location || previous_location.isEmpty() || !QDir{previous_location}.exists())
+ previous_location = program_directory;
+ auto dir = QFileDialog::getExistingDirectory(this, tr("Select library location"), previous_location);
+ if (dir.isEmpty() || !QDir{dir}.exists())
+ dir = QString{};
+ else
+ ui.enable_custom_location->setEnabled(true);
+ ui.custom_location->setText(dir);
+}