diff --git a/src/blackgui/copyxswiftbusdialog.cpp b/src/blackgui/copyxswiftbusdialog.cpp new file mode 100644 index 000000000..b230dece0 --- /dev/null +++ b/src/blackgui/copyxswiftbusdialog.cpp @@ -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 +#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 +} diff --git a/src/blackgui/copyxswiftbusdialog.h b/src/blackgui/copyxswiftbusdialog.h new file mode 100644 index 000000000..817c3cb3c --- /dev/null +++ b/src/blackgui/copyxswiftbusdialog.h @@ -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 +#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