mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 19:05:31 +08:00
Ref T131, dialog to copy build files for XSwiftBus XPlane
This commit is contained in:
35
src/blackgui/copyxswiftbusdialog.cpp
Normal file
35
src/blackgui/copyxswiftbusdialog.cpp
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
/* Copyright (C) 2018
|
||||||
|
* swift project Community / Contributors
|
||||||
|
*
|
||||||
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||||
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||||
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||||
|
* contained in the LICENSE file.
|
||||||
|
*
|
||||||
|
* Class based on qLed: Copyright (C) 2010 by P. Sereno, http://www.sereno-online.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include "copyxswiftbusdialog.h"
|
||||||
|
#include "blackmisc/simulation/xplane/xplaneutil.h"
|
||||||
|
#include "blackmisc/directoryutils.h"
|
||||||
|
#include "blackconfig/buildconfig.h"
|
||||||
|
|
||||||
|
using namespace BlackConfig;
|
||||||
|
using namespace BlackMisc;
|
||||||
|
using namespace BlackMisc::Simulation::XPlane;
|
||||||
|
|
||||||
|
namespace BlackGui
|
||||||
|
{
|
||||||
|
int CCopyXSwiftBusDialog::displayDialogAndCopyBuildFiles(const QString &xplaneRootDir, QWidget *parent)
|
||||||
|
{
|
||||||
|
if (!CBuildConfig::isLocalDeveloperDebugBuild()) { return -1; }
|
||||||
|
if (!CXPlaneUtil::hasNewerXSwiftBusBuild(xplaneRootDir)) { return 0; }
|
||||||
|
const QMessageBox::StandardButton reply =
|
||||||
|
QMessageBox::question(parent, "Copy XSwiftBus",
|
||||||
|
QString("Copy XSwiftBus from build directory '%1' to plugin directory '%2'?").arg(CDirectoryUtils::getXSwiftBusBuildDirectory(), CXPlaneUtil::xswiftbusPluginDir(xplaneRootDir)),
|
||||||
|
QMessageBox::Yes | QMessageBox::No);
|
||||||
|
if (reply != QMessageBox::Yes) { return 0; }
|
||||||
|
return CXPlaneUtil::copyXSwiftBusBuildFiles(xplaneRootDir);
|
||||||
|
} // ns
|
||||||
|
}
|
||||||
31
src/blackgui/copyxswiftbusdialog.h
Normal file
31
src/blackgui/copyxswiftbusdialog.h
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/* Copyright (C) 2018
|
||||||
|
* swift project Community / Contributors
|
||||||
|
*
|
||||||
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||||
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||||
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||||
|
* contained in the LICENSE file.
|
||||||
|
*
|
||||||
|
* Class based on qLed: Copyright (C) 2010 by P. Sereno, http://www.sereno-online.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
//! \file
|
||||||
|
|
||||||
|
#ifndef BLACKGUI_COPYXSWIFTBUSDIALOG_H
|
||||||
|
#define BLACKGUI_COPYXSWIFTBUSDIALOG_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "blackgui/blackguiexport.h"
|
||||||
|
|
||||||
|
namespace BlackGui
|
||||||
|
{
|
||||||
|
//! Show dialog about to copy XSwiftBus build files
|
||||||
|
class BLACKGUI_EXPORT CCopyXSwiftBusDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Display a dialog to copy the latest XSwiftBus files
|
||||||
|
//! \remark only displayed in a local environment
|
||||||
|
static int displayDialogAndCopyBuildFiles(const QString &xplaneRootDir, QWidget *parent = nullptr);
|
||||||
|
};
|
||||||
|
} // ns
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user