mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
refactor: Remove broken xswiftbus auto-copy
This commit is contained in:
@@ -492,8 +492,6 @@ add_library(gui SHARED
|
||||
components/usercomponent.cpp
|
||||
components/usercomponent.h
|
||||
components/usercomponent.ui
|
||||
copyxswiftbusdialog.cpp
|
||||
copyxswiftbusdialog.h
|
||||
dockwidget.cpp
|
||||
dockwidget.h
|
||||
dockwidgetinfoarea.cpp
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
#include "copyxswiftbusdialog.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "config/buildconfig.h"
|
||||
#include "core/context/contextsimulator.h"
|
||||
#include "gui/guiapplication.h"
|
||||
#include "misc/simulation/xplane/xplaneutil.h"
|
||||
#include "misc/swiftdirectories.h"
|
||||
|
||||
using namespace swift::config;
|
||||
using namespace swift::misc;
|
||||
using namespace swift::misc::simulation::xplane;
|
||||
using namespace swift::core::context;
|
||||
|
||||
namespace swift::gui
|
||||
{
|
||||
int CCopyXSwiftBusDialog::displayDialogAndCopyBuildFiles(const QString &xplaneRootDir, bool checkLatestFile,
|
||||
QWidget *parent)
|
||||
{
|
||||
if (!sGui || sGui->isShuttingDown()) { return 0; }
|
||||
if (!CBuildConfig::isLocalDeveloperDebugBuild()) { return -1; }
|
||||
if (checkLatestFile && !CXPlaneUtil::hasNewerXSwiftBusBuild(xplaneRootDir)) { return 0; }
|
||||
if (!CXPlaneUtil::hasXSwiftBusBuildAndPluginDir(xplaneRootDir)) { return 0; }
|
||||
if (sGui && sGui->getIContextSimulator())
|
||||
{
|
||||
if (sGui->getIContextSimulator()->isSimulatorAvailable())
|
||||
{
|
||||
// do not show if already connected with another simulator
|
||||
if (!sGui->getIContextSimulator()->getSimulatorPluginInfo().getSimulatorInfo().isXPlane()) { return 0; }
|
||||
}
|
||||
}
|
||||
|
||||
const QMessageBox::StandardButton reply = QMessageBox::question(
|
||||
parent, "Copy xswiftbus",
|
||||
QStringLiteral("Copy xswiftbus from build directory '%1' to plugin directory '%2'?")
|
||||
.arg(CSwiftDirectories::getXSwiftBusBuildDirectory(), CXPlaneUtil::xswiftbusPluginDir(xplaneRootDir)),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (reply != QMessageBox::Yes) { return 0; }
|
||||
return CXPlaneUtil::copyXSwiftBusBuildFiles(xplaneRootDir);
|
||||
} // ns
|
||||
} // namespace swift::gui
|
||||
@@ -1,25 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef SWIFT_GUI_COPYXSWIFTBUSDIALOG_H
|
||||
#define SWIFT_GUI_COPYXSWIFTBUSDIALOG_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "gui/swiftguiexport.h"
|
||||
|
||||
namespace swift::gui
|
||||
{
|
||||
//! Show dialog about to copy xswiftbus build files
|
||||
class SWIFT_GUI_EXPORT CCopyXSwiftBusDialog
|
||||
{
|
||||
public:
|
||||
//! Display a dialog to copy the latest xswiftbus files
|
||||
//! \remark normally only displayed in a local environment
|
||||
static int displayDialogAndCopyBuildFiles(const QString &xplaneRootDir, bool checkLatestFile = true,
|
||||
QWidget *parent = nullptr);
|
||||
};
|
||||
} // namespace swift::gui
|
||||
#endif // SWIFT_GUI_COPYXSWIFTBUSDIALOG_H
|
||||
@@ -438,8 +438,6 @@ void SwiftGuiStd::verifyPrerequisites()
|
||||
if (msgs.size() > 1) { this->displayInOverlayWindow(msgs); }
|
||||
else { this->displayInOverlayWindow(msgs.front()); }
|
||||
}
|
||||
|
||||
this->copyXSwiftBusDialog(true);
|
||||
}
|
||||
|
||||
void SwiftGuiStd::onValidatedModelSet(const CSimulatorInfo &simulator, const CAircraftModelList &valid,
|
||||
|
||||
@@ -308,9 +308,6 @@ private:
|
||||
//! Ckeck if the DB data have been loaded
|
||||
void checkDbDataLoaded();
|
||||
|
||||
//! Copy the xswiftbus files from build directory
|
||||
void copyXSwiftBusDialog(bool checkFileTimestamp);
|
||||
|
||||
//! Auto publish diloag
|
||||
int autoPublishDialog();
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include "gui/components/autopublishdialog.h"
|
||||
#include "gui/components/maininfoareacomponent.h"
|
||||
#include "gui/components/settingscomponent.h"
|
||||
#include "gui/copyxswiftbusdialog.h"
|
||||
#include "gui/guiactionbind.h"
|
||||
#include "gui/guiapplication.h"
|
||||
#include "misc/aviation/altitude.h"
|
||||
@@ -97,17 +96,6 @@ void SwiftGuiStd::initMenus()
|
||||
sGui->addMenuHelp(*ui->menu_Help);
|
||||
ui->menu_InfoAreas->addActions(ui->comp_MainInfoArea->getInfoAreaSelectActions(true, ui->menu_InfoAreas));
|
||||
|
||||
if (CBuildConfig::isLocalDeveloperDebugBuild() && ui->menu_File && ui->menu_File->actions().size() > 5)
|
||||
{
|
||||
QAction *act = new QAction(CIcons::swift16(), "Copy xswiftbus dialog");
|
||||
ui->menu_File->insertAction(ui->menu_File->actions().at(5), act);
|
||||
// clang-format off
|
||||
bool c = connect(act, &QAction::triggered, this,
|
||||
[=] { this->copyXSwiftBusDialog(false); }, Qt::QueuedConnection);
|
||||
// clang-format on
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "connect failed");
|
||||
}
|
||||
|
||||
// for hotkeys
|
||||
const QString swift(CGuiActionBindHandler::pathSwiftPilotClient());
|
||||
static const CActionBind swiftRoot(swift, CIcons::Swift16); // inserts action for root folder
|
||||
@@ -117,23 +105,6 @@ void SwiftGuiStd::initMenus()
|
||||
m_menuHotkeyHandlers.append(CGuiActionBindHandler::bindMenu(ui->menu_Window, swift + "Window"));
|
||||
}
|
||||
|
||||
void SwiftGuiStd::copyXSwiftBusDialog(bool checkFileTimestamp)
|
||||
{
|
||||
const QString xPlaneRootDir = ui->comp_MainInfoArea->getSettingsComponent()
|
||||
->getSimulatorSettings(CSimulatorInfo::XPLANE)
|
||||
.getSimulatorDirectoryOrDefault();
|
||||
const bool xpDirExists = !xPlaneRootDir.isEmpty() && QDir().exists(xPlaneRootDir);
|
||||
if (!xpDirExists)
|
||||
{
|
||||
if (checkFileTimestamp) { return; }
|
||||
QMessageBox::warning(this, tr("Copy xswiftbus"), tr("XPlane directory does not exists!"), QMessageBox::Close);
|
||||
return;
|
||||
}
|
||||
|
||||
const int c = CCopyXSwiftBusDialog::displayDialogAndCopyBuildFiles(xPlaneRootDir, checkFileTimestamp, this);
|
||||
if (c > 0) { CLogMessage(this).info(u"Copied %1 files from build directory") << c; }
|
||||
}
|
||||
|
||||
int SwiftGuiStd::autoPublishDialog()
|
||||
{
|
||||
if (!m_autoPublishDialog) { m_autoPublishDialog.reset(new CAutoPublishDialog(this)); }
|
||||
|
||||
Reference in New Issue
Block a user