diff --git a/src/blackgui/components/texteditdialog.cpp b/src/blackgui/components/texteditdialog.cpp index 0cc433dfb..1dfe58918 100644 --- a/src/blackgui/components/texteditdialog.cpp +++ b/src/blackgui/components/texteditdialog.cpp @@ -28,5 +28,10 @@ namespace BlackGui { return ui->te_TextEdit; } + + void CTextEditDialog::setReadOnly() + { + ui->te_TextEdit->setReadOnly(true); + } } // ns } // ns diff --git a/src/blackgui/components/texteditdialog.h b/src/blackgui/components/texteditdialog.h index 22b3aae7c..19a38ccb6 100644 --- a/src/blackgui/components/texteditdialog.h +++ b/src/blackgui/components/texteditdialog.h @@ -11,6 +11,8 @@ #ifndef BLACKGUI_COMPONENTS_TEXTEDITDIALOG_H #define BLACKGUI_COMPONENTS_TEXTEDITDIALOG_H +#include "blackgui/blackguiexport.h" + #include #include @@ -22,7 +24,7 @@ namespace BlackGui namespace Components { //! Text edit as dialog - class CTextEditDialog : public QDialog + class BLACKGUI_EXPORT CTextEditDialog : public QDialog { Q_OBJECT @@ -31,11 +33,14 @@ namespace BlackGui explicit CTextEditDialog(QWidget *parent = nullptr); //! Dtor - virtual ~CTextEditDialog(); + virtual ~CTextEditDialog() override; //! Access to text edit QTextEdit *textEdit() const; + //! Set read only + void setReadOnly(); + private: QScopedPointer ui; }; diff --git a/src/swiftlauncher/swiftlauncher.cpp b/src/swiftlauncher/swiftlauncher.cpp index bc93996d6..a5d583a91 100644 --- a/src/swiftlauncher/swiftlauncher.cpp +++ b/src/swiftlauncher/swiftlauncher.cpp @@ -8,19 +8,22 @@ #include "swiftlauncher.h" #include "ui_swiftlauncher.h" -#include "blackconfig/buildconfig.h" #include "blackgui/components/configurationwizard.h" +#include "blackgui/components/texteditdialog.h" #include "blackgui/guiapplication.h" #include "blackgui/stylesheetutility.h" #include "blackcore/context/contextapplicationproxy.h" #include "blackcore/vatsim/networkvatlib.h" #include "blackcore/setupreader.h" +#include "blackmisc/simulation/fscommon/fscommonutil.h" #include "blackmisc/network/networkutils.h" #include "blackmisc/dbusserver.h" #include "blackmisc/directoryutils.h" #include "blackmisc/icons.h" #include "blackmisc/logmessage.h" #include "blackmisc/loghandler.h" +#include "blackconfig/buildconfig.h" + #include #include #include @@ -43,6 +46,7 @@ using namespace BlackCore::Vatsim; using namespace BlackMisc; using namespace BlackMisc::Db; using namespace BlackMisc::Network; +using namespace BlackMisc::Simulation::FsCommon; CSwiftLauncher::CSwiftLauncher(QWidget *parent) : QDialog(parent, CEnableForFramelessWindow::modeToWindowFlags(CEnableForFramelessWindow::WindowNormal)), @@ -75,6 +79,8 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) : connect(ui->pb_Log, &QPushButton::released, this, &CSwiftLauncher::showLogPage, Qt::QueuedConnection); connect(ui->pb_Log, &QPushButton::released, this, &CSwiftLauncher::showLogPage, Qt::QueuedConnection); connect(ui->pb_LogDir, &QPushButton::released, sGui, &CGuiApplication::openStandardLogDirectory, Qt::QueuedConnection); + connect(ui->pb_FSXConfigDirs, &QPushButton::released, this, &CSwiftLauncher::showSimulatorConfigDirs, Qt::QueuedConnection); + connect(ui->pb_P3DConfigDirs, &QPushButton::released, this, &CSwiftLauncher::showSimulatorConfigDirs, Qt::QueuedConnection); const QShortcut *logPageShortCut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_L), this, SLOT(showLogPage())); Q_UNUSED(logPageShortCut); @@ -535,3 +541,37 @@ void CSwiftLauncher::popupExecutableArgs() { QMessageBox::information(this, "Command line", this->getCmdLine()); } + +void CSwiftLauncher::showSimulatorConfigDirs() +{ + if (!m_textEditDialog) + { + m_textEditDialog.reset(new CTextEditDialog(this)); + } + + const QObject *s = QObject::sender(); + QStringList dirs; + QString simDir; + QString simObjDir; + + if (s == ui->pb_P3DConfigDirs) + { + dirs = CFsCommonUtil::p3dSimObjectsDirPlusAddOnXmlSimObjectsPaths(); + simDir = CFsCommonUtil::p3dDir(); + simObjDir = CFsCommonUtil::p3dSimObjectsDir(); + } + else if (s == ui->pb_FSXConfigDirs) + { + dirs = CFsCommonUtil::fsxSimObjectsDirPlusAddOnXmlSimObjectsPaths(); + simDir = CFsCommonUtil::fsxDir(); + simObjDir = CFsCommonUtil::fsxSimObjectsDir(); + } + + const QString info = u"Sim.dir: " % simDir % "\n" % + u"Sim.objects: " % simObjDir % "\n" % + (dirs.isEmpty() ? "No dirs" : dirs.join("\n")); + + m_textEditDialog->setReadOnly(); + m_textEditDialog->textEdit()->setText(info); + m_textEditDialog->show(); +} diff --git a/src/swiftlauncher/swiftlauncher.h b/src/swiftlauncher/swiftlauncher.h index 890ebe84b..2fd7f9d92 100644 --- a/src/swiftlauncher/swiftlauncher.h +++ b/src/swiftlauncher/swiftlauncher.h @@ -25,7 +25,14 @@ #include namespace Ui { class CSwiftLauncher; } -namespace BlackGui { namespace Components { class CConfigurationWizard; }} +namespace BlackGui +{ + namespace Components + { + class CConfigurationWizard; + class CTextEditDialog; + } +} /*! * swift launcher tool @@ -86,6 +93,7 @@ private slots: private: QScopedPointer ui; QScopedPointer m_wizard; + QScopedPointer m_textEditDialog; BlackMisc::CData m_setup { this }; //!< setup, i.e. last user selection QString m_executable; @@ -189,6 +197,9 @@ private: //! Display a popup with the cmd line args void popupExecutableArgs(); + //! Show the FSX/P3D config simulator directories + void showSimulatorConfigDirs(); + //! Command line static QString toCmdLine(const QString &exe, const QStringList &exeArgs); }; diff --git a/src/swiftlauncher/swiftlauncher.ui b/src/swiftlauncher/swiftlauncher.ui index 7c7e39199..afcc13850 100644 --- a/src/swiftlauncher/swiftlauncher.ui +++ b/src/swiftlauncher/swiftlauncher.ui @@ -537,7 +537,7 @@ 3 - + Qt::Vertical @@ -550,18 +550,50 @@ - - - - log + + + + Log + + + + + log + + + + + + + log directory + + + + - - - - log directory + + + + P3D/FSX + + + + + P3D config dirs. + + + + + + + FSX config dirs. + + + +