Changeset View
Changeset View
Standalone View
Standalone View
host/settings.cpp
Show First 20 Lines • Show All 130 Lines • ▼ Show 20 Line(s) | 126 | } else if (event == QLatin1String("setEnvironment")) { | |||
---|---|---|---|---|---|
131 | qApp->setApplicationName(m_currentEnvironment.applicationName); | 131 | qApp->setApplicationName(m_currentEnvironment.applicationName); | ||
132 | qApp->setApplicationDisplayName(m_currentEnvironment.applicationDisplayName); | 132 | qApp->setApplicationDisplayName(m_currentEnvironment.applicationDisplayName); | ||
133 | qApp->setDesktopFileName(m_currentEnvironment.desktopFileName); | 133 | qApp->setDesktopFileName(m_currentEnvironment.desktopFileName); | ||
134 | qApp->setOrganizationDomain(m_currentEnvironment.organizationDomain); | 134 | qApp->setOrganizationDomain(m_currentEnvironment.organizationDomain); | ||
135 | qApp->setOrganizationName(m_currentEnvironment.organizationName); | 135 | qApp->setOrganizationName(m_currentEnvironment.organizationName); | ||
136 | } | 136 | } | ||
137 | } | 137 | } | ||
138 | 138 | | |||
139 | QJsonObject Settings::handleData(int serial, const QString &event, const QJsonObject &data) | ||||
140 | { | ||||
141 | Q_UNUSED(serial) | ||||
142 | Q_UNUSED(data) | ||||
143 | | ||||
144 | QJsonObject ret; | ||||
145 | | ||||
fvogt: Move that a scope up as `QJsonObject ret` and you save two lines of code (and more when more… | |||||
146 | if (event == QLatin1String("getSubsystemStatus")) { | ||||
147 | // should we add a PluginManager::knownSubsystems() that returns a QList<AbstractBrowserPlugin*>? | ||||
148 | const QStringList subsystems = PluginManager::self().knownPluginSubsystems(); | ||||
149 | for (const QString &subsystem : subsystems) { | ||||
150 | const AbstractBrowserPlugin *plugin = PluginManager::self().pluginForSubsystem(subsystem); | ||||
151 | QJsonObject details{ | ||||
152 | {QStringLiteral("version"), plugin->protocolVersion()}, | ||||
153 | {QStringLiteral("loaded"), plugin->isLoaded()} | ||||
154 | }; | ||||
155 | ret.insert(subsystem, details); | ||||
156 | } | ||||
157 | } | ||||
158 | | ||||
159 | return ret; | ||||
160 | } | ||||
161 | | ||||
139 | Settings::Environment Settings::environment() const | 162 | Settings::Environment Settings::environment() const | ||
140 | { | 163 | { | ||
141 | return m_environment; | 164 | return m_environment; | ||
142 | } | 165 | } | ||
143 | 166 | | |||
144 | QString Settings::environmentString() const | 167 | QString Settings::environmentString() const | ||
145 | { | 168 | { | ||
146 | return Settings::environmentNames.value(m_environment); | 169 | return Settings::environmentNames.value(m_environment); | ||
Show All 11 Lines |
Move that a scope up as QJsonObject ret and you save two lines of code (and more when more events get added)