summaryrefslogtreecommitdiffhomepage
path: root/proto-ft/ftnoir_protocol_ft_dialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'proto-ft/ftnoir_protocol_ft_dialog.cpp')
-rw-r--r--proto-ft/ftnoir_protocol_ft_dialog.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/proto-ft/ftnoir_protocol_ft_dialog.cpp b/proto-ft/ftnoir_protocol_ft_dialog.cpp
index df2878ec..90ff059a 100644
--- a/proto-ft/ftnoir_protocol_ft_dialog.cpp
+++ b/proto-ft/ftnoir_protocol_ft_dialog.cpp
@@ -8,11 +8,11 @@
* purpose with or without fee is hereby granted, provided that the above *
* copyright notice and this permission notice appear in all copies. *
*/
-#include "ftnoir_protocol_ft.h"
-#include "compat/library-path.hpp"
+#include "compat/library-path.hpp"
+#include "ftnoir_protocol_ft.h"
+#include <QDebug>
#include <QFileDialog>
-#include <QFileInfo>
FTControls::FTControls()
{
@@ -22,11 +22,12 @@ FTControls::FTControls()
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel()));
connect(ui.bntLocateNPClient, SIGNAL(clicked()), this, SLOT(selectDLL()));
- ui.cbxSelectInterface->addItem("Enable both");
- ui.cbxSelectInterface->addItem("Use FreeTrack, hide TrackIR");
- ui.cbxSelectInterface->addItem("Use TrackIR, hide FreeTrack");
+ 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);
- tie_setting(s.intUsedInterface, ui.cbxSelectInterface);
+ connect(ui.set_custom_location, &QAbstractButton::clicked, this, &FTControls::set_custom_location);
}
void FTControls::doOK()
@@ -54,4 +55,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);
+}