Skip to content

Commit

Permalink
API: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey committed Nov 30, 2024
1 parent 39b1ae1 commit b74c24d
Show file tree
Hide file tree
Showing 14 changed files with 341 additions and 433 deletions.
16 changes: 7 additions & 9 deletions custom-example/src/CustomPlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,13 @@ bool CustomFlyViewOptions::showInstrumentPanel(void) const
CustomOptions::CustomOptions(CustomPlugin *plugin, QObject *parent)
: QGCOptions(parent)
, _plugin(plugin)
, _flyViewOptions(new CustomFlyViewOptions(this, this))
{
Q_CHECK_PTR(_plugin);
}

QGCFlyViewOptions* CustomOptions::flyViewOptions(void)
QGCFlyViewOptions* CustomOptions::flyViewOptions(void) const
{
if (!_flyViewOptions) {
_flyViewOptions = new CustomFlyViewOptions(this, this);
}
return _flyViewOptions;
}

Expand Down Expand Up @@ -105,7 +103,7 @@ void CustomPlugin::_addSettingsEntry(const QString& title, const char* qmlFile,
this)));
}

QGCOptions* CustomPlugin::options()
QGCOptions* CustomPlugin::options() const
{
return _options;
}
Expand All @@ -120,7 +118,7 @@ QString CustomPlugin::brandImageOutdoor(void) const
return QStringLiteral("/custom/img/dronecode-black.svg");
}

bool CustomPlugin::overrideSettingsGroupVisibility(const QString &name)
bool CustomPlugin::overrideSettingsGroupVisibility(const QString &name) const
{
// We have set up our own specific brand imaging. Hide the brand image settings such that the end user
// can't change it.
Expand All @@ -131,7 +129,7 @@ bool CustomPlugin::overrideSettingsGroupVisibility(const QString &name)
}

// This allows you to override/hide QGC Application settings
bool CustomPlugin::adjustSettingMetaData(const QString& settingsGroup, FactMetaData& metaData)
bool CustomPlugin::adjustSettingMetaData(const QString& settingsGroup, FactMetaData& metaData) const
{
bool parentResult = QGCCorePlugin::adjustSettingMetaData(settingsGroup, metaData);

Expand All @@ -151,7 +149,7 @@ bool CustomPlugin::adjustSettingMetaData(const QString& settingsGroup, FactMetaD
}

// This modifies QGC colors palette to match possible custom corporate branding
void CustomPlugin::paletteOverride(const QString &colorName, QGCPalette::PaletteColorInfo_t& colorInfo)
void CustomPlugin::paletteOverride(const QString &colorName, QGCPalette::PaletteColorInfo_t& colorInfo) const
{
if (colorName == QStringLiteral("window")) {
colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#212529");
Expand Down Expand Up @@ -342,7 +340,7 @@ void CustomPlugin::paletteOverride(const QString &colorName, QGCPalette::Palette
}

// We override this so we can get access to QQmlApplicationEngine and use it to register our qml module
QQmlApplicationEngine* CustomPlugin::createQmlApplicationEngine(QObject* parent)
QQmlApplicationEngine* CustomPlugin::createQmlApplicationEngine(QObject* parent) const
{
QQmlApplicationEngine* qmlEngine = QGCCorePlugin::createQmlApplicationEngine(parent);
qmlEngine->addImportPath("qrc:/Custom/Widgets");
Expand Down
12 changes: 6 additions & 6 deletions custom-example/src/CustomPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class CustomOptions : public QGCOptions
// Overrides from QGCOptions
bool wifiReliableForCalibration (void) const final;
bool showFirmwareUpgrade (void) const final;
QGCFlyViewOptions* flyViewOptions(void) final;
QGCFlyViewOptions* flyViewOptions(void) const final;

private:
QGCCorePlugin *_plugin = nullptr;
Expand All @@ -59,13 +59,13 @@ class CustomPlugin : public QGCCorePlugin
static QGCCorePlugin *instance();

// Overrides from QGCCorePlugin
QGCOptions* options (void) final;
QGCOptions* options (void) const final;
QString brandImageIndoor (void) const final;
QString brandImageOutdoor (void) const final;
bool overrideSettingsGroupVisibility (const QString &name) final;
bool adjustSettingMetaData (const QString& settingsGroup, FactMetaData& metaData) final;
void paletteOverride (const QString &colorName, QGCPalette::PaletteColorInfo_t& colorInfo) final;
QQmlApplicationEngine* createQmlApplicationEngine (QObject* parent) final;
bool overrideSettingsGroupVisibility (const QString &name) const final;
bool adjustSettingMetaData (const QString& settingsGroup, FactMetaData& metaData) const final;
void paletteOverride (const QString &colorName, QGCPalette::PaletteColorInfo_t& colorInfo) const final;
QQmlApplicationEngine* createQmlApplicationEngine (QObject* parent) const final;

private slots:
void _advancedChanged(bool advanced);
Expand Down
7 changes: 3 additions & 4 deletions src/API/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml QmlIntegration)

qt_add_library(API STATIC
QGCCorePlugin.cc
QGCCorePlugin.h
QGCOptions.cc
QGCOptions.h
QGCSettings.cc
QGCSettings.h
QmlComponentInfo.cc
QmlComponentInfo.h
)
Expand All @@ -17,6 +15,7 @@ target_link_libraries(API
FactSystem
GStreamerReceiver
Joystick
MAVLink
QtMultimediaReceiver
Settings
Utilities
Expand All @@ -25,7 +24,7 @@ target_link_libraries(API
PUBLIC
Qt6::Core
Qt6::Gui
MAVLink
Qt6::QmlIntegration
QmlControls
)

Expand Down
Loading

0 comments on commit b74c24d

Please sign in to comment.