Files
pilotclient/src/swiftlauncher/main.cpp
Klaus Basan 8f4c4a249c [5.14.1] UI adjustments
* OS native check of screen resolution (Qt free, experimental)
* changed rounding
* use string for scale factor so we can use fractions as 2/3
* utility functions to clean numbers, parse fractions

It looks like:

* my WIN10 scaling is 250%
* obviously swift rounds that to 3 (device ratio)
* now using FLOOR policy down-rounding to 2
* rational: scaling up (scale factor) is better as down-scaling as the factors would be clearer
* 2->3 1.5, but 3->2 means 0.66667
2020-06-12 18:42:30 +01:00

55 lines
2.0 KiB
C++

/* Copyright (C) 2013
* 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. 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.
*/
#include "swiftlauncher.h"
#include "blackgui/guiapplication.h"
#include "blackcore/registermetadata.h"
#include "blackcore/db/databasereaderconfig.h"
#include "blackmisc/directoryutils.h"
#include "blackmisc/logmessage.h"
#include "blackmisc/icons.h"
#include <QtGlobal>
#include <QProcess>
#include <QApplication>
#include <QMessageBox>
#include <QPushButton>
#include <QCommandLineParser>
using namespace BlackGui;
using namespace BlackMisc;
using namespace BlackCore;
using namespace BlackCore::Db;
int main(int argc, char *argv[])
{
//! [SwiftApplicationDemo]
CGuiApplication::highDpiScreenSupport(CGuiApplication::scaleFactor(argc, argv));
QApplication qa(argc, argv); // needed
Q_UNUSED(qa)
CGuiApplication a(CApplicationInfo::swiftLauncher(), CApplicationInfo::Laucher, CIcons::swiftLauncher1024());
a.addVatlibOptions(); // so it can be passed (hand over) to started applications
a.addParserOption({{"i", "installer"}, QCoreApplication::translate("main", "Installer setup.")});
if (!a.parseAndSynchronizeSetup()) { return EXIT_FAILURE; }
a.useWebDataServices(BlackCore::CWebReaderFlags::AllSwiftDbReaders, CDatabaseReaderConfigList::forLauncher());
if (!a.start())
{
a.gracefulShutdown();
return EXIT_FAILURE;
}
//! [SwiftApplicationDemo]
// Dialog to decide external or internal core
CSwiftLauncher launcher;
CGuiApplication::registerAsRunning(); // needed because launcher's exec is called (normally application exec)
if (launcher.exec() == QDialog::Rejected) { return EXIT_SUCCESS; }
launcher.close();
const bool s = launcher.startDetached();
return s ? EXIT_SUCCESS : EXIT_FAILURE;
}