11 #include "ui_installfsxterrainprobecomponent.h"
22 using namespace swift::misc::simulation;
23 using namespace swift::misc::simulation::fscommon;
27 CInstallFsxTerrainProbeComponent::CInstallFsxTerrainProbeComponent(QWidget *parent)
31 ui->le_Source->setText(CSwiftDirectories::shareTerrainProbeDirectory());
34 ui->comp_SimulatorSelector->setFsxP3DOnly();
35 ui->comp_SimulatorSelector->setValue(CSimulatorInfo::fsx());
37 connect(ui->pb_Copy, &QPushButton::released,
this, &CInstallFsxTerrainProbeComponent::copyProbe);
38 connect(ui->pb_DirectoryBrowser, &QPushButton::released,
this,
39 &CInstallFsxTerrainProbeComponent::selectSimObjectsDir);
41 &CInstallFsxTerrainProbeComponent::onSimulatorChanged);
43 QPointer<CInstallFsxTerrainProbeComponent> myself(
this);
45 if (!myself) {
return; }
46 this->onSimulatorChanged(ui->comp_SimulatorSelector->getValue());
52 void CInstallFsxTerrainProbeComponent::copyProbe()
54 using namespace std::chrono_literals;
55 if (ui->le_Target->text().isEmpty()) {
return; }
57 const int copied = CFsCommonUtil::copyFsxTerrainProbeFiles(ui->le_Target->text(), msgs);
63 void CInstallFsxTerrainProbeComponent::onSimulatorChanged(
const CSimulatorInfo &simulator)
71 if (!modelDirs.isEmpty() && !modelDirs.front().isEmpty()) { ui->le_Target->setText(modelDirs.front()); }
72 else { ui->le_Target->clear(); }
75 void CInstallFsxTerrainProbeComponent::selectSimObjectsDir()
77 const QString startDirectory = CFileUtils::fixWindowsUncPath(ui->le_Target->text());
78 const QString dir = CFileUtils::fixWindowsUncPath(
79 QFileDialog::getExistingDirectory(
this,
"SimObjects directory", startDirectory,
80 QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks));
81 ui->le_Target->setText(dir);
static COverlayMessagesWizardPage * nextOverlayMessageWizardPage(QWidget *widget, int maxLevels=10)
Find next COverlayMessagesWizardPage.
void showOverlayMessages(const swift::misc::CStatusMessageList &messages, bool appendOldMessages=false, std::chrono::milliseconds timeout=std::chrono::milliseconds(0))
Show multiple messages.
Using this class provides a QWizardPage with the overlay functionality already integrated.
Install the FSX/P3D terrain probe.
virtual ~CInstallFsxTerrainProbeComponent()
Destructors.
void changed(const swift::misc::simulation::CSimulatorInfo &simulator)
Value has been changed.
Status messages, e.g. from Core -> GUI.
Simple hardcoded info about the corresponding simulator.
bool isFsxP3DFamily() const
FSX family, i.e. FSX or P3D?
QStringList getModelDirectoriesOrDefault(const CSimulatorInfo &simulator) const
Model directory or default model path per simulator.
High level reusable GUI components.
Free functions in swift::misc.
auto singleShot(int msec, QObject *target, F &&task)
Starts a single-shot timer which will call a task in the thread of the given object when it times out...