mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-27 16:54:15 +01:00
OP-1879 remove openpilot hardcoding: reworked settings to use default app name
This commit is contained in:
parent
95d3de7351
commit
edc949a91b
@ -21,6 +21,7 @@ include(../libs/version_info/version_info.pri)
|
||||
LIBS *= -l$$qtLibraryName(ExtensionSystem) -l$$qtLibraryName(Aggregation)
|
||||
|
||||
DEFINES += PLUGIN_REL_PATH=\\\"$$relative_path($$GCS_PLUGIN_PATH, $$GCS_APP_PATH)\\\"
|
||||
DEFINES += GCS_NAME=\\\"$$GCS_APP_TARGET\\\"
|
||||
|
||||
win32 {
|
||||
RC_FILE = openpilotgcs.rc
|
||||
|
@ -111,13 +111,11 @@ typedef QMap<QString, QString> AppOptionValues;
|
||||
const int OptionIndent = 4;
|
||||
const int DescriptionIndent = 24;
|
||||
|
||||
const QLatin1String APP_NAME("OpenPilot GCS");
|
||||
const QLatin1String APP_NAME(GCS_NAME);
|
||||
const QLatin1String ORG_NAME("OpenPilot");
|
||||
|
||||
const QLatin1String CORE_PLUGIN_NAME("Core");
|
||||
|
||||
const QLatin1String SETTINGS_ORG_NAME("OpenPilot");
|
||||
const QLatin1String SETTINGS_APP_NAME("OpenPilotGCS_config");
|
||||
|
||||
const char *DEFAULT_CONFIG_FILENAME = "OpenPilotGCS.xml";
|
||||
|
||||
const char *fixedOptionsC = " [OPTION]... [FILE]...\n"
|
||||
@ -445,6 +443,10 @@ int main(int argc, char * *argv)
|
||||
// create application
|
||||
SharedTools::QtSingleApplication app(APP_NAME, argc, argv);
|
||||
|
||||
QCoreApplication::setApplicationName(APP_NAME);
|
||||
QCoreApplication::setOrganizationName(ORG_NAME);
|
||||
QSettings::setDefaultFormat(XmlConfig::XmlSettingsFormat);
|
||||
|
||||
// initialize the plugin manager
|
||||
ExtensionSystem::PluginManager pluginManager;
|
||||
pluginManager.setFileExtension(QLatin1String("pluginspec"));
|
||||
@ -473,8 +475,8 @@ int main(int argc, char * *argv)
|
||||
QString settingsPath = Utils::PathUtils().GetDataPath();
|
||||
qDebug() << "Loading system settings from" << settingsPath;
|
||||
QSettings::setPath(XmlConfig::XmlSettingsFormat, QSettings::SystemScope, settingsPath);
|
||||
qDebug() << "Loading user settings from" << SETTINGS_ORG_NAME << "/" << SETTINGS_APP_NAME;
|
||||
QSettings settings(XmlConfig::XmlSettingsFormat, QSettings::UserScope, SETTINGS_ORG_NAME, SETTINGS_APP_NAME);
|
||||
QSettings settings;
|
||||
qDebug() << "Loading user settings from" << settings.fileName();
|
||||
|
||||
// need to reset all user settings?
|
||||
if (appOptionValues.contains(RESET_OPTION)) {
|
||||
|
@ -102,12 +102,11 @@ MainWindow::MainWindow() :
|
||||
m_globalContext(QList<int>() << Constants::C_GLOBAL_ID),
|
||||
m_additionalContexts(m_globalContext),
|
||||
// keep this in sync with main() in app/main.cpp
|
||||
m_settings(new QSettings(XmlConfig::XmlSettingsFormat, QSettings::UserScope,
|
||||
QLatin1String("OpenPilot"), QLatin1String("OpenPilotGCS_config"), this)),
|
||||
m_settings(new QSettings(this)),
|
||||
m_globalSettings(new QSettings(XmlConfig::XmlSettingsFormat, QSettings::SystemScope,
|
||||
QLatin1String("OpenPilot"), QLatin1String("OpenPilotGCS_config"), this)),
|
||||
m_settings->organizationName(), m_settings->applicationName(), this)),
|
||||
m_settingsDatabase(new SettingsDatabase(QFileInfo(m_settings->fileName()).path(),
|
||||
QLatin1String("OpenPilotGCS_config"),
|
||||
QFileInfo(m_settings->fileName()).baseName(),
|
||||
this)),
|
||||
m_dontSaveSettings(false),
|
||||
m_actionManager(new ActionManagerPrivate(this)),
|
||||
@ -138,11 +137,6 @@ MainWindow::MainWindow() :
|
||||
#ifndef Q_WS_MAC
|
||||
qApp->setWindowIcon(QIcon(":/core/images/openpilot_logo_128.png"));
|
||||
#endif
|
||||
QCoreApplication::setApplicationName(QLatin1String("OpenPilotGCS"));
|
||||
QCoreApplication::setApplicationVersion(QLatin1String(Core::Constants::GCS_VERSION_LONG));
|
||||
QCoreApplication::setOrganizationName(QLatin1String("OpenPilot"));
|
||||
QCoreApplication::setOrganizationDomain(QLatin1String("openpilot.org"));
|
||||
QSettings::setDefaultFormat(XmlConfig::XmlSettingsFormat);
|
||||
qApp->setStyle(QStyleFactory::create("Fusion"));
|
||||
|
||||
setDockNestingEnabled(true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user