mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 21:56:43 +08:00
Launcher tools, display FSX/P3D config dirs
This commit is contained in:
committed by
Mat Sutcliffe
parent
737aabb745
commit
a5663914c5
@@ -28,5 +28,10 @@ namespace BlackGui
|
||||
{
|
||||
return ui->te_TextEdit;
|
||||
}
|
||||
|
||||
void CTextEditDialog::setReadOnly()
|
||||
{
|
||||
ui->te_TextEdit->setReadOnly(true);
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#ifndef BLACKGUI_COMPONENTS_TEXTEDITDIALOG_H
|
||||
#define BLACKGUI_COMPONENTS_TEXTEDITDIALOG_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QScopedPointer>
|
||||
|
||||
@@ -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::CTextEditDialog> ui;
|
||||
};
|
||||
|
||||
@@ -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 <QMessageBox>
|
||||
#include <QPixmap>
|
||||
#include <QBitmap>
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -25,7 +25,14 @@
|
||||
#include <QNetworkReply>
|
||||
|
||||
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::CSwiftLauncher> ui;
|
||||
QScopedPointer<BlackGui::Components::CConfigurationWizard> m_wizard;
|
||||
QScopedPointer<BlackGui::Components::CTextEditDialog> m_textEditDialog;
|
||||
BlackMisc::CData<BlackCore::Data::TLauncherSetup> 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);
|
||||
};
|
||||
|
||||
@@ -537,7 +537,7 @@
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="3" column="0">
|
||||
<item row="4" column="0">
|
||||
<spacer name="vs_Tools">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -550,18 +550,50 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="pb_Log">
|
||||
<property name="text">
|
||||
<string>log</string>
|
||||
<item row="3" column="0">
|
||||
<widget class="QGroupBox" name="gb_Log">
|
||||
<property name="title">
|
||||
<string>Log</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_Log">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_Log">
|
||||
<property name="text">
|
||||
<string>log</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_LogDir">
|
||||
<property name="text">
|
||||
<string>log directory</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="pb_LogDir">
|
||||
<property name="text">
|
||||
<string>log directory</string>
|
||||
<item row="3" column="1">
|
||||
<widget class="QGroupBox" name="gb_P3dFsx">
|
||||
<property name="title">
|
||||
<string>P3D/FSX</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_P3DConfigDirs">
|
||||
<property name="text">
|
||||
<string>P3D config dirs.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_FSXConfigDirs">
|
||||
<property name="text">
|
||||
<string>FSX config dirs.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
Reference in New Issue
Block a user