mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
refs #485, adjusted samples
This commit is contained in:
committed by
Mathew Sutcliffe
parent
3829aaeae8
commit
7a38afe8c3
@@ -7,13 +7,13 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include "sampleschangeobject.h"
|
||||
#include "samplesmetadata.h"
|
||||
#include "samplescontainer.h"
|
||||
#include "samplesjson.h"
|
||||
#include "samplesperformance.h"
|
||||
#include "samplesalgorithm.h"
|
||||
#include "blackcore/application.h"
|
||||
#include "blackmisc/registermetadata.h"
|
||||
#include "blackmisc/pq/pq.h"
|
||||
|
||||
@@ -22,21 +22,19 @@
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackSample;
|
||||
using namespace BlackCore;
|
||||
|
||||
//! main
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// I use QGuiApplication and not core application
|
||||
// I use CGuiApplication and not core application
|
||||
// otherwise no QPixmap metadata (metadata sample)
|
||||
QGuiApplication a(argc, argv);
|
||||
Q_UNUSED(a);
|
||||
QCoreApplication qa(argc, argv);
|
||||
CApplication a;
|
||||
|
||||
QTextStream qtout(stdout);
|
||||
QTextStream qtin(stdin);
|
||||
|
||||
BlackMisc::initResources();
|
||||
BlackMisc::registerMetadata();
|
||||
|
||||
do
|
||||
{
|
||||
qtout << "1 .. JSON" << endl;
|
||||
|
||||
@@ -7,7 +7,7 @@ TEMPLATE = app
|
||||
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
CONFIG += blackmisc
|
||||
CONFIG += blackmisc blackcore blackgui
|
||||
|
||||
DEPENDPATH += . $$SourceRoot/src/blackmisc
|
||||
INCLUDEPATH += . $$SourceRoot/src
|
||||
|
||||
@@ -20,10 +20,6 @@
|
||||
|
||||
namespace BlackSample
|
||||
{
|
||||
|
||||
/*
|
||||
* Samples
|
||||
*/
|
||||
int CSamplesAlgorithm::samples()
|
||||
{
|
||||
BlackMisc::CSequence<int> seq;
|
||||
|
||||
@@ -29,10 +29,6 @@ using namespace BlackMisc::Network;
|
||||
|
||||
namespace BlackSample
|
||||
{
|
||||
|
||||
/*
|
||||
* Samples
|
||||
*/
|
||||
int CSamplesChangeObject::samples()
|
||||
{
|
||||
// ATC station
|
||||
|
||||
@@ -24,10 +24,6 @@ using namespace BlackMisc::PhysicalQuantities;
|
||||
|
||||
namespace BlackSample
|
||||
{
|
||||
|
||||
/*
|
||||
* Samples
|
||||
*/
|
||||
int CSamplesPerformance::samplesMisc(QTextStream &out)
|
||||
{
|
||||
QTime timer;
|
||||
|
||||
@@ -13,34 +13,23 @@
|
||||
#include "samplesphysicalquantities.h"
|
||||
#include "samplesaviation.h"
|
||||
#include "samplesgeo.h"
|
||||
#include "blackcore/application.h"
|
||||
#include <QTextStream>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackSample;
|
||||
using namespace BlackCore;
|
||||
|
||||
//! main
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication(argc, argv);
|
||||
CApplication a;
|
||||
Q_UNUSED(a);
|
||||
|
||||
QTextStream out(stdout, QIODevice::WriteOnly);
|
||||
|
||||
BlackMisc::initResources();
|
||||
QFile file(":blackmisc/translations/blackmisc_i18n_de.qm");
|
||||
out << (file.exists() ? "Found translations in resources" : "No translations in resources") << endl;
|
||||
QTranslator translator;
|
||||
bool t = translator.load("blackmisc_i18n_de", ":blackmisc/translations/");
|
||||
out << (t ? "Translator loaded" : "Translator not loaded") << endl;
|
||||
|
||||
QCoreApplication a(argc, argv);
|
||||
out << "Use I18N version, y? n?";
|
||||
out.flush();
|
||||
int yn = getchar();
|
||||
t = (yn == 'y' || yn == 'Y');
|
||||
t = t ? a.installTranslator(&translator) : false;
|
||||
out << (t ? "Installed translator" : "No translator ");
|
||||
|
||||
CSamplesPhysicalQuantities::samples(out);
|
||||
CSamplesAviation::samples(out);
|
||||
CSamplesGeo::samples(out);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -7,8 +7,7 @@ TEMPLATE = app
|
||||
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
CONFIG += blackmisc
|
||||
CONFIG -= app_bundle
|
||||
CONFIG += blackmisc blackcore
|
||||
|
||||
DEPENDPATH += . $$SourceRoot/src/blackmisc
|
||||
INCLUDEPATH += . $$SourceRoot/src
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "samplesmodelmapping.h"
|
||||
#include "samplesvpilotrules.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QTextStream>
|
||||
#include <QDebug>
|
||||
#include <QTime>
|
||||
|
||||
@@ -28,10 +28,6 @@ using namespace BlackMisc::Simulation::FsCommon;
|
||||
|
||||
namespace BlackSample
|
||||
{
|
||||
|
||||
/*
|
||||
* Samples
|
||||
*/
|
||||
void CSamplesFsCommon::samples(QTextStream &streamOut, QTextStream &streamIn)
|
||||
{
|
||||
QString fsxDir = CSampleUtils::selectDirectory({"C:/Program Files (x86)/Microsoft Games/Microsoft Flight Simulator X/SimObjects",
|
||||
@@ -71,5 +67,4 @@ namespace BlackSample
|
||||
streamOut << "read entries from disk: " << entriesList.size() << " in " << time.restart() << "ms" << endl;
|
||||
tempFile.close();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "blackmisc/worker.h"
|
||||
#include "blackmisc/network/networkutils.h"
|
||||
#include <QMessageBox>
|
||||
#include <QApplication>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackCore;
|
||||
@@ -25,13 +26,13 @@ using namespace BlackGui;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
CGuiApplication a(argc, argv, "swift core");
|
||||
a.setWindowIcon(CIcons::swiftNova24());
|
||||
QApplication qa(argc, argv);
|
||||
CGuiApplication a("swift core", CIcons::swiftNova24());
|
||||
a.addWindowStateOption();
|
||||
a.addDBusAddressOption();
|
||||
a.addParserOption({{"r", "start"}, QCoreApplication::translate("main", "Start the server.")});
|
||||
a.addParserOption({{"c", "coreaudio"}, QCoreApplication::translate("main", "Audio in core.")});
|
||||
a.parse();
|
||||
if (!a.parse()) { return EXIT_FAILURE; }
|
||||
|
||||
const QString dBusAdress(a.getCmdDBusAddressValue());
|
||||
a.useContexts(a.isParserOptionSet("coreaudio") ?
|
||||
@@ -40,7 +41,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (!QSystemTrayIcon::isSystemTrayAvailable())
|
||||
{
|
||||
a.parserErrorMessage("I could not detect any system tray on this system.");
|
||||
a.errorMessage("I could not detect any system tray on this system.");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,9 @@ using namespace BlackGui;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
CGuiApplication a(argc, argv, "swift mapping tool");
|
||||
a.setWindowIcon(CIcons::swiftDatabase48());
|
||||
QApplication qa(argc, argv);
|
||||
CGuiApplication a("swift mapping tool", CIcons::swiftDatabase48());
|
||||
a.start();
|
||||
CSwiftData w;
|
||||
w.show();
|
||||
int r = a.exec();
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "blackgui/enableforframelesswindow.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QApplication>
|
||||
#include <QPushButton>
|
||||
#include <QProcessEnvironment>
|
||||
|
||||
@@ -21,8 +22,9 @@ using namespace BlackCore;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
CSwiftGuiStdApplication a(argc, argv);
|
||||
a.startCoreFacade();
|
||||
QApplication qa(argc, argv);
|
||||
CSwiftGuiStdApplication a;
|
||||
if (!a.start()) { return EXIT_FAILURE; }
|
||||
|
||||
// show window
|
||||
CEnableForFramelessWindow::WindowMode windowMode = a.getWindowMode();
|
||||
|
||||
@@ -14,16 +14,16 @@
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackCore;
|
||||
|
||||
CSwiftGuiStdApplication::CSwiftGuiStdApplication(int argc, char *argv[]) : CGuiApplication(argc, argv, "swift pilot client GUI")
|
||||
CSwiftGuiStdApplication::CSwiftGuiStdApplication() : CGuiApplication("swift pilot client GUI", CIcons::swift24())
|
||||
{
|
||||
this->setWindowIcon(CIcons::swift24());
|
||||
this->addParserOption(this->m_cmdFacadeMode);
|
||||
this->addWindowModeOption();
|
||||
this->addDBusAddressOption();
|
||||
}
|
||||
|
||||
void CSwiftGuiStdApplication::startCoreFacade()
|
||||
bool CSwiftGuiStdApplication::startHookIn()
|
||||
{
|
||||
Q_ASSERT_X(m_parsed, Q_FUNC_INFO, "Not yet parsed cmd line arguments");
|
||||
CoreModes::CoreMode coreMode = CoreModes::CoreInGuiProcess;
|
||||
const QString dBusAddress(this->getCmdDBusAddressValue());
|
||||
if (this->isParserOptionSet(this->m_cmdFacadeMode))
|
||||
@@ -47,9 +47,10 @@ void CSwiftGuiStdApplication::startCoreFacade()
|
||||
break;
|
||||
}
|
||||
this->useContexts(runtimeConfig);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CSwiftGuiStdApplication::parsingHookIn()
|
||||
bool CSwiftGuiStdApplication::parsingHookIn()
|
||||
{
|
||||
// Parse core relevant arguments
|
||||
const QString dBusAddress(this->getCmdDBusAddressValue());
|
||||
@@ -58,10 +59,11 @@ void CSwiftGuiStdApplication::parsingHookIn()
|
||||
// check if rechable
|
||||
if (!CDBusServer::isDBusAvailable(dBusAddress))
|
||||
{
|
||||
this->parserErrorMessage("DBus server at " + dBusAddress + " can not be reached");
|
||||
exit(EXIT_FAILURE);
|
||||
this->errorMessage("DBus server at " + dBusAddress + " can not be reached");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return CGuiApplication::parsingHookIn();
|
||||
}
|
||||
|
||||
CSwiftGuiStdApplication *instance()
|
||||
|
||||
@@ -25,17 +25,17 @@ class CSwiftGuiStdApplication : public BlackGui::CGuiApplication
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
CSwiftGuiStdApplication(int argc, char *argv[]);
|
||||
CSwiftGuiStdApplication();
|
||||
|
||||
//! Single instance
|
||||
CSwiftGuiStdApplication *instance();
|
||||
|
||||
//! Start facade by cmd arguments
|
||||
void startCoreFacade();
|
||||
|
||||
protected:
|
||||
//! Parsing of special CMD args
|
||||
virtual void parsingHookIn() override;
|
||||
virtual bool parsingHookIn() override;
|
||||
|
||||
//! Start facade by cmd arguments
|
||||
virtual bool startHookIn() override;
|
||||
|
||||
private:
|
||||
QCommandLineOption m_cmdFacadeMode
|
||||
|
||||
@@ -27,8 +27,8 @@ using namespace BlackCore;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
CGuiApplication a(argc, argv, "swift launcher");
|
||||
a.setWindowIcon(CIcons::swift24());
|
||||
QApplication qa(argc, argv);
|
||||
CGuiApplication a("swift launcher", CIcons::swift24());
|
||||
a.addParserOption({{"i", "installer"}, QCoreApplication::translate("main", "Installer setup."), "installer"});
|
||||
a.parse();
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
|
||||
connect(ui->tb_SwiftGui, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed);
|
||||
connect(ui->tb_Database, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed);
|
||||
connect(ui->tb_BackToMain, &QToolButton::pressed, this, &CSwiftLauncher::ps_showMainPage);
|
||||
connect(&CSetupReader::instance(), &CSetupReader::versionSynchronized, this, &CSwiftLauncher::ps_loadedSetup);
|
||||
// connect(&CSetupReader::instance(), &CSetupReader::updateInfoSynchronized, this, &CSwiftLauncher::ps_loadedSetup);
|
||||
|
||||
new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_L), this, SLOT(ps_showLogPage()));
|
||||
this->ui->le_DBusServerPort->setValidator(new QIntValidator(0, 65535, this));
|
||||
@@ -261,7 +261,8 @@ void CSwiftLauncher::ps_loadSetup()
|
||||
if (!this->ui->le_LatestVersion->text().isEmpty())
|
||||
{
|
||||
this->ui->le_LatestVersion->setText("");
|
||||
CSetupReader::instance().requestReload();
|
||||
CStatusMessage m(sApp->requestReloadOfSetupAndVersion());
|
||||
this->ps_appendLogMessage(m);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user