Commit 68462431 authored by dheideman's avatar dheideman Committed by Jacob Walser

Add user-selectable brand image capability

parent 6e388c70
......@@ -143,6 +143,27 @@
"type": "string",
"defaultValue": ""
},
{
"name": "UserBrandImageIndoor",
"shortDescription": "User-selected brand image",
"longDescription": "Location in file system of user-selected brand image (indoor)",
"type": "string",
"defaultValue": ""
},
{
"name": "UserBrandImageOutdoor",
"shortDescription": "User-selected brand image",
"longDescription": "Location in file system of user-selected brand image (outdoor)",
"type": "string",
"defaultValue": ""
},
{
"name": "UserBrandImageLinked",
"shortDescription": "Link indoor/outdoor brand images",
"longDescription": "Boolean option to use same image for indoor and outdoor brand images",
"type": "bool",
"defaultValue": true
},
{
"name": "MapboxToken",
"shortDescription": "Access token to Mapbox maps",
......
......@@ -32,6 +32,9 @@ const char* AppSettings::appFontPointSizeName = "BaseDev
const char* AppSettings::indoorPaletteName = "StyleIsDark";
const char* AppSettings::showLargeCompassName = "ShowLargeCompass";
const char* AppSettings::savePathName = "SavePath";
const char* AppSettings::userBrandImageIndoorName = "UserBrandImageIndoor";
const char* AppSettings::userBrandImageOutdoorName = "UserBrandImageOutdoor";
const char* AppSettings::userBrandImageLinkedName = "UserBrandImageLinked";
const char* AppSettings::autoLoadMissionsName = "AutoLoadMissions";
const char* AppSettings::mapboxTokenName = "MapboxToken";
const char* AppSettings::esriTokenName = "EsriToken";
......@@ -71,6 +74,9 @@ AppSettings::AppSettings(QObject* parent)
, _indoorPaletteFact(NULL)
, _showLargeCompassFact(NULL)
, _savePathFact(NULL)
, _userBrandImageIndoorFact(NULL)
, _userBrandImageOutdoorFact(NULL)
, _userBrandImageLinkedFact(NULL)
, _autoLoadMissionsFact(NULL)
, _mapboxTokenFact(NULL)
, _esriTokenFact(NULL)
......@@ -331,6 +337,33 @@ QString AppSettings::videoSavePath(void)
return fullPath;
}
Fact* AppSettings::userBrandImageIndoor(void)
{
if (!_userBrandImageIndoorFact) {
_userBrandImageIndoorFact = _createSettingsFact(userBrandImageIndoorName);
}
return _userBrandImageIndoorFact;
}
Fact* AppSettings::userBrandImageOutdoor(void)
{
if (!_userBrandImageOutdoorFact) {
_userBrandImageOutdoorFact = _createSettingsFact(userBrandImageOutdoorName);
}
return _userBrandImageOutdoorFact;
}
Fact* AppSettings::userBrandImageLinked(void)
{
if (!_userBrandImageLinkedFact) {
_userBrandImageLinkedFact = _createSettingsFact(userBrandImageLinkedName);
}
return _userBrandImageLinkedFact;
}
Fact* AppSettings::autoLoadMissions(void)
{
if (!_autoLoadMissionsFact) {
......
......@@ -36,6 +36,9 @@ public:
Q_PROPERTY(Fact* indoorPalette READ indoorPalette CONSTANT)
Q_PROPERTY(Fact* showLargeCompass READ showLargeCompass CONSTANT)
Q_PROPERTY(Fact* savePath READ savePath CONSTANT)
Q_PROPERTY(Fact* userBrandImageIndoor READ userBrandImageIndoor CONSTANT)
Q_PROPERTY(Fact* userBrandImageOutdoor READ userBrandImageOutdoor CONSTANT)
Q_PROPERTY(Fact* userBrandImageLinked READ userBrandImageLinked CONSTANT)
Q_PROPERTY(Fact* autoLoadMissions READ autoLoadMissions CONSTANT)
Q_PROPERTY(Fact* mapboxToken READ mapboxToken CONSTANT)
Q_PROPERTY(Fact* esriToken READ esriToken CONSTANT)
......@@ -71,6 +74,9 @@ public:
Fact* indoorPalette (void);
Fact* showLargeCompass (void);
Fact* savePath (void);
Fact* userBrandImageIndoor (void);
Fact* userBrandImageOutdoor (void);
Fact* userBrandImageLinked (void);
Fact* autoLoadMissions (void);
Fact* mapboxToken (void);
Fact* esriToken (void);
......@@ -103,6 +109,9 @@ public:
static const char* indoorPaletteName;
static const char* showLargeCompassName;
static const char* savePathName;
static const char* userBrandImageIndoorName;
static const char* userBrandImageOutdoorName;
static const char* userBrandImageLinkedName;
static const char* autoLoadMissionsName;
static const char* mapboxTokenName;
static const char* esriTokenName;
......@@ -150,6 +159,9 @@ private:
SettingsFact* _indoorPaletteFact;
SettingsFact* _showLargeCompassFact;
SettingsFact* _savePathFact;
SettingsFact* _userBrandImageIndoorFact;
SettingsFact* _userBrandImageOutdoorFact;
SettingsFact* _userBrandImageLinkedFact;
SettingsFact* _autoLoadMissionsFact;
SettingsFact* _mapboxTokenFact;
SettingsFact* _esriTokenFact;
......
......@@ -34,6 +34,9 @@ QGCView {
property Fact _percentRemainingAnnounce: QGroundControl.settingsManager.appSettings.batteryPercentRemainingAnnounce
property Fact _savePath: QGroundControl.settingsManager.appSettings.savePath
property Fact _userBrandImageIndoor: QGroundControl.settingsManager.appSettings.userBrandImageIndoor
property Fact _userBrandImageOutdoor: QGroundControl.settingsManager.appSettings.userBrandImageOutdoor
property Fact _userBrandImageLinked: QGroundControl.settingsManager.appSettings.userBrandImageLinked
property Fact _appFontPointSize: QGroundControl.settingsManager.appSettings.appFontPointSize
property real _labelWidth: ScreenTools.defaultFontPixelWidth * 15
property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 30
......@@ -656,6 +659,130 @@ QGCView {
}
}
//-----------------------------------------------------------------
//-- Custom Brand Image
Item {
width: _qgcView.width * 0.8
height: userBrandImageLabel.height
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
visible: !ScreenTools.isMobile
QGCLabel {
id: userBrandImageLabel
text: qsTr("Brand Image")
font.family: ScreenTools.demiboldFontFamily
}
}
Rectangle {
height: userBrandImageCol.height + (ScreenTools.defaultFontPixelHeight * 2)
width: _qgcView.width * 0.8
color: qgcPal.windowShade
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter
visible: !ScreenTools.isMobile
Column {
id: userBrandImageCol
spacing: ScreenTools.defaultFontPixelWidth
anchors.centerIn: parent
Row {
spacing: ScreenTools.defaultFontPixelWidth
visible: _userBrandImageIndoor.visible
QGCLabel {
anchors.baseline: userBrandImageIndoorBrowse.baseline
width: _labelWidth*1.5
text: qsTr("Indoor Brand Image Path:")
}
QGCTextField {
anchors.baseline: userBrandImageIndoorBrowse.baseline
readOnly: true
width: _editFieldWidth
text: QGroundControl.settingsManager.appSettings.userBrandImageIndoor.valueString.replace("file:///","")
}
QGCButton {
id: userBrandImageIndoorBrowse
text: "Browse"
onClicked: userBrandImageIndoorBrowseDialog.openForLoad()
QGCFileDialog {
id: userBrandImageIndoorBrowseDialog
qgcView: _qgcView
title: qsTr("Choose custom brand image file:")
folder: _userBrandImageIndoor.rawValue.replace("file:///","")
selectExisting: true
selectFolder: false
onAcceptedForLoad: {
_userBrandImageIndoor.rawValue = "file:///" + file
if(_userBrandImageLinked.value) {
_userBrandImageOutdoor.rawValue = _userBrandImageIndoor.rawValue
}
}
}
}
}
Row {
spacing: ScreenTools.defaultFontPixelWidth
visible: _userBrandImageOutdoor.visible
enabled: !_userBrandImageLinked.value
QGCLabel {
anchors.baseline: userBrandImageOutdoorBrowse.baseline
width: _labelWidth*1.5
text: qsTr("Outdoor Brand Image Path:")
}
QGCTextField {
anchors.baseline: userBrandImageOutdoorBrowse.baseline
readOnly: true
width: _editFieldWidth
text: QGroundControl.settingsManager.appSettings.userBrandImageOutdoor.valueString.replace("file:///","")
}
QGCButton {
id: userBrandImageOutdoorBrowse
text: "Browse"
onClicked: userBrandImageOutdoorBrowseDialog.openForLoad()
QGCFileDialog {
id: userBrandImageOutdoorBrowseDialog
qgcView: _qgcView
title: qsTr("Choose custom brand image file:")
folder: _userBrandImageOutdoor.rawValue.replace("file:///","")
selectExisting: true
selectFolder: false
onAcceptedForLoad: _userBrandImageOutdoor.rawValue = "file:///" + file
}
}
}
Row {
spacing: ScreenTools.defaultFontPixelWidth
visible: _userBrandImageIndoor.visible
FactCheckBox {
text: qsTr("Link Brand Images")
width: _labelWidth*1.5
visible: _userBrandImageLinked.visible
fact: _userBrandImageLinked
onClicked: {
if(_userBrandImageLinked.value) {
_userBrandImageOutdoor.rawValue = _userBrandImageIndoor.rawValue
}
}
}
QGCButton {
id: userBrandImageReset
text: "Reset Default Brand Image"
onClicked: {
_userBrandImageIndoor.rawValue = ""
_userBrandImageOutdoor.rawValue = ""
}
}
}
}
}
QGCLabel {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("%1 Version: %2").arg(QGroundControl.appName).arg(QGroundControl.qgcVersion)
......
......@@ -95,8 +95,12 @@ Item {
property bool _outdoorPalette: qgcPal.globalTheme === QGCPalette.Light
property bool _corePluginBranding: QGroundControl.corePlugin.brandImageIndoor.length != 0
property string _brandImageIndoor: _corePluginBranding ? QGroundControl.corePlugin.brandImageIndoor : (_activeVehicle ? _activeVehicle.brandImageIndoor : "")
property string _brandImageOutdoor: _corePluginBranding ? QGroundControl.corePlugin.brandImageOutdoor : (_activeVehicle ? _activeVehicle.brandImageOutdoor : "")
property string _userBrandImageIndoor: QGroundControl.settingsManager.appSettings.userBrandImageIndoor.value
property string _userBrandImageOutdoor: QGroundControl.settingsManager.appSettings.userBrandImageOutdoor.value
property bool _userBrandingIndoor: _userBrandImageIndoor.length != 0
property bool _userBrandingOutdoor: _userBrandImageOutdoor.length != 0
property string _brandImageIndoor: _userBrandingIndoor ? _userBrandImageIndoor : (_corePluginBranding ? QGroundControl.corePlugin.brandImageIndoor : (_activeVehicle ? _activeVehicle.brandImageIndoor : "") )
property string _brandImageOutdoor: _userBrandingOutdoor ? _userBrandImageOutdoor : (_corePluginBranding ? QGroundControl.corePlugin.brandImageOutdoor : (_activeVehicle ? _activeVehicle.brandImageOutdoor : "") )
}
Row {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment