Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
ad5cde3b
Commit
ad5cde3b
authored
Feb 20, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated palette and control implementation
parent
b1a9d302
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
392 additions
and
237 deletions
+392
-237
qgroundcontrol.qrc
qgroundcontrol.qrc
+3
-2
SafetyComponent.cc
src/AutoPilotPlugins/PX4/SafetyComponent.cc
+1
-1
SafetyComponent.qml
src/AutoPilotPlugins/PX4/SafetyComponent.qml
+9
-9
Fact.cc
src/FactSystem/Fact.cc
+19
-3
QGCPalette.cc
src/QGCPalette.cc
+41
-31
QGCPalette.h
src/QGCPalette.h
+71
-37
QGCButton.qml
src/QmlControls/QGCButton.qml
+12
-3
QGCCheckBox.qml
src/QmlControls/QGCCheckBox.qml
+2
-2
QGCLabel.qml
src/QmlControls/QGCLabel.qml
+2
-2
QGCRadioButton.qml
src/QmlControls/QGCRadioButton.qml
+2
-2
QGCTextField.qml
src/QmlControls/QGCTextField.qml
+6
-10
QmlTest.qml
src/QmlControls/QmlTest.qml
+202
-116
QmlTestWidget.cc
src/QmlControls/QmlTestWidget.cc
+1
-1
SubMenuButton.qml
src/QmlControls/SubMenuButton.qml
+7
-5
qmldir
src/QmlControls/qmldir
+2
-1
FirmwareUpgrade.qml
src/VehicleSetup/FirmwareUpgrade.qml
+3
-3
SetupViewButtons.qml
src/VehicleSetup/SetupViewButtons.qml
+6
-6
VehicleSummary.qml
src/VehicleSetup/VehicleSummary.qml
+1
-1
test.qml
src/test.qml
+2
-2
No files found.
qgroundcontrol.qrc
View file @
ad5cde3b
...
...
@@ -247,11 +247,12 @@
<file alias="QGroundControl/FactControls/FactCheckBox.qml">src/FactSystem/FactControls/FactCheckBox.qml</file>
<file alias="QGroundControl/Controls/qmldir">src/QmlControls/qmldir</file>
<file alias="QGroundControl/Controls/S
etupButton.qml">src/QmlControls/Setup
Button.qml</file>
<file alias="QGroundControl/Controls/S
ubMenuButton.qml">src/QmlControls/SubMenu
Button.qml</file>
<file alias="QGroundControl/Controls/QGCButton.qml">src/QmlControls/QGCButton.qml</file>
<file alias="QGroundControl/Controls/QGCRadioButton.qml">src/QmlControls/QGCRadioButton.qml</file>
<file alias="QGroundControl/Controls/QGCCheckBox.qml">src/QmlControls/QGCCheckBox.qml</file>
<file alias="QGroundControl/Controls/QGCLabel.qml">src/QmlControls/QGCLabel.qml</file>
<file alias="QGroundControl/Controls/QGCTextField.qml">src/QmlControls/QGCTextField.qml</file>
<file alias="octo_x.png">files/images/px4/airframes/octo_x.png</file>
<file alias="px4fmu_2.x.png">files/images/px4/boards/px4fmu_2.x.png</file>
...
...
@@ -268,7 +269,7 @@
<file alias="FlightModesComponentSummary.qml">src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml</file>
<file alias="AirframeComponentSummary.qml">src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml</file>
<file alias="QGroundControl/Controls/s
etup
ButtonImage.png">files/Setup/cogwheels.png</file>
<file alias="QGroundControl/Controls/s
ubMenu
ButtonImage.png">files/Setup/cogwheels.png</file>
<file alias="QGroundControl/Controls/SensorsComponentIcon.png">src/AutoPilotPlugins/PX4/SensorsComponentIcon.png</file>
<file alias="QGroundControl/Controls/RadioComponentIcon.png">src/AutoPilotPlugins/PX4/RadioComponentIcon.png</file>
<file alias="QGroundControl/Controls/FlightModesComponentIcon.png">src/AutoPilotPlugins/PX4/FlightModesComponentIcon.png</file>
...
...
src/AutoPilotPlugins/PX4/SafetyComponent.cc
View file @
ad5cde3b
...
...
@@ -51,7 +51,7 @@ QString SafetyComponent::description(void) const
QString
SafetyComponent
::
iconResource
(
void
)
const
{
// FIXME: Need real icon
return
"s
etup
ButtonImage.png"
;
return
"s
ubMenu
ButtonImage.png"
;
}
bool
SafetyComponent
::
requiresSetup
(
void
)
const
...
...
src/AutoPilotPlugins/PX4/SafetyComponent.qml
View file @
ad5cde3b
...
...
@@ -7,7 +7,7 @@ import QGroundControl.FactControls 1.0
import
QGroundControl
.
Palette
1.0
Rectangle
{
QGCPalette
{
id
:
palette
;
colorGroup
:
QGCPalette
.
Activ
e
}
QGCPalette
{
id
:
palette
;
colorGroup
Enabled
:
tru
e
}
width
:
600
height
:
600
...
...
@@ -21,12 +21,12 @@ Rectangle {
//-- Return Home Triggers
Column
{
spacing
:
18
Label
{
text
:
"
Triggers For Return Home
"
;
color
:
palette
.
windowT
ext
;
font.pointSize
:
20
}
Label
{
text
:
"
Triggers For Return Home
"
;
color
:
palette
.
t
ext
;
font.pointSize
:
20
}
Row
{
Label
{
width
:
leftColWidth
text
:
"
RC Transmitter Signal Loss - Return Home After
"
color
:
palette
.
windowT
ext
color
:
palette
.
t
ext
anchors.baseline
:
rcLossField
.
baseline
}
FactTextField
{
...
...
@@ -56,12 +56,12 @@ Rectangle {
//-- Return Home Options
Column
{
spacing
:
18
Label
{
text
:
"
Return Home Options
"
;
color
:
palette
.
windowT
ext
;
font.pointSize
:
20
}
Label
{
text
:
"
Return Home Options
"
;
color
:
palette
.
t
ext
;
font.pointSize
:
20
}
Row
{
Label
{
width
:
leftColWidth
text
:
"
Climb to minimum altitude of
"
color
:
palette
.
windowT
ext
color
:
palette
.
t
ext
anchors.baseline
:
climbField
.
baseline
}
FactTextField
{
...
...
@@ -82,7 +82,7 @@ Rectangle {
}
style
:
CheckBoxStyle
{
label
:
Text
{
color
:
palette
.
windowT
ext
color
:
palette
.
t
ext
text
:
control
.
text
}
}
...
...
@@ -102,7 +102,7 @@ Rectangle {
Label
{
width
:
leftColWidth
;
text
:
"
When Home is reached, loiter at an altitude of
"
;
color
:
palette
.
windowT
ext
;
color
:
palette
.
t
ext
;
anchors.baseline
:
descendField
.
baseline
visible
:
homeLoiterCheckbox
.
checked
==
true
}
...
...
@@ -120,7 +120,7 @@ Rectangle {
font.pointSize
:
14
text
:
"
Warning: You have an advanced safety configuration set using the NAV_RCL_OBC parameter. The above settings may not apply.
"
;
visible
:
autopilot
.
parameters
[
"
NAV_RCL_OBC
"
].
value
!=
0
color
:
palette
.
windowT
ext
color
:
palette
.
t
ext
wrapMode
:
Text
.
Wrap
}
Text
{
...
...
@@ -128,7 +128,7 @@ Rectangle {
font.pointSize
:
14
text
:
"
Warning: You have an advanced safety configuration set using the NAV_DLL_OBC parameter. The above settings may not apply.
"
;
visible
:
autopilot
.
parameters
[
"
NAV_DLL_OBC
"
].
value
!=
0
color
:
palette
.
windowT
ext
color
:
palette
.
t
ext
wrapMode
:
Text
.
Wrap
}
}
...
...
src/FactSystem/Fact.cc
View file @
ad5cde3b
...
...
@@ -66,36 +66,52 @@ QString Fact::valueString(void) const
QVariant
Fact
::
defaultValue
(
void
)
{
Q_ASSERT
(
_metaData
);
return
_metaData
->
defaultValue
;
}
FactMetaData
::
ValueType_t
Fact
::
type
(
void
)
{
Q_ASSERT
(
_metaData
);
return
_metaData
->
type
;
}
QString
Fact
::
shortDescription
(
void
)
{
return
_metaData
->
shortDescription
;
if
(
_metaData
)
{
return
_metaData
->
shortDescription
;
}
else
{
return
QString
();
}
}
QString
Fact
::
longDescription
(
void
)
{
return
_metaData
->
longDescription
;
if
(
_metaData
)
{
return
_metaData
->
longDescription
;
}
else
{
return
QString
();
}
}
QString
Fact
::
units
(
void
)
{
return
_metaData
->
units
;
if
(
_metaData
)
{
return
_metaData
->
units
;
}
else
{
return
QString
();
}
}
QVariant
Fact
::
min
(
void
)
{
Q_ASSERT
(
_metaData
);
return
_metaData
->
min
;
}
QVariant
Fact
::
max
(
void
)
{
Q_ASSERT
(
_metaData
);
return
_metaData
->
max
;
}
...
...
src/QGCPalette.cc
View file @
ad5cde3b
...
...
@@ -33,59 +33,69 @@ QList<QGCPalette*> QGCPalette::_paletteObjects;
QGCPalette
::
Theme
QGCPalette
::
_theme
=
QGCPalette
::
Dark
;
QColor
QGCPalette
::
_alternateBase
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0xF6
,
0xF6
,
0xF6
),
QColor
(
0xF6
,
0xF6
,
0xF6
),
QColor
(
0xF6
,
0xF6
,
0xF6
)
},
{
QColor
(
2
,
2
,
2
),
QColor
(
2
,
2
,
2
),
QColor
(
2
,
2
,
2
)
}
QColor
QGCPalette
::
_window
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0xF6
,
0xF6
,
0xF6
),
QColor
(
0xF6
,
0xF6
,
0xF6
)
},
{
QColor
(
0x22
,
0x22
,
0x22
),
QColor
(
0x22
,
0x22
,
0x22
)
}
};
QColor
QGCPalette
::
_windowShade
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
255
,
235
,
211
),
QColor
(
255
,
235
,
211
)
},
{
QColor
(
51
,
51
,
51
),
QColor
(
51
,
51
,
51
)
}
};
QColor
QGCPalette
::
_windowShadeDark
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
216
,
216
,
216
),
QColor
(
216
,
216
,
216
)
},
{
QColor
(
40
,
40
,
40
),
QColor
(
40
,
40
,
40
)
}
};
QColor
QGCPalette
::
_
base
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0x
F6
,
0xF6
,
0xF6
),
QColor
(
0xF6
,
0xF6
,
0xF6
),
QColor
(
0xF6
,
0xF6
,
0xF6
)
},
{
QColor
(
2
,
2
,
2
),
QColor
(
2
,
2
,
2
),
QColor
(
2
,
2
,
2
)
}
QColor
QGCPalette
::
_
text
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0x
58
,
0x58
,
0x58
),
QColor
(
0
,
0
,
0
)
},
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
0xFF
,
0xFF
,
0xFF
)
}
};
QColor
QGCPalette
::
_button
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
0x1b
,
0x6f
,
0xad
)
,
QColor
(
0x1b
,
0x6f
,
0xad
)
},
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
0x1b
,
0x6f
,
0xad
),
QColor
(
0x1b
,
0x6f
,
0xad
)
},
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
0x1b
,
0x6f
,
0xad
)
},
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
98
,
98
,
100
)
},
};
QColor
QGCPalette
::
_buttonText
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0x2c
,
0x2c
,
0x2c
),
QColor
(
0xFF
,
0xFF
,
0xFF
)
,
QColor
(
0xFF
,
0xFF
,
0xFF
)
},
{
QColor
(
0x2c
,
0x2c
,
0x2c
),
QColor
(
0xFF
,
0xFF
,
0xFF
)
,
QColor
(
0xFF
,
0xFF
,
0xFF
)
},
{
QColor
(
0x2c
,
0x2c
,
0x2c
),
QColor
(
0xFF
,
0xFF
,
0xFF
)
},
{
QColor
(
0x2c
,
0x2c
,
0x2c
),
QColor
(
0xFF
,
0xFF
,
0xFF
)
},
};
QColor
QGCPalette
::
_
tex
t
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
0
,
0
,
0
),
QColor
(
0
,
0
,
0
)
},
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
0xFF
,
0xFF
,
0xFF
),
QColor
(
0xFF
,
0xFF
,
0xFF
)
}
QColor
QGCPalette
::
_
buttonHighligh
t
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
237
,
235
,
51
)
},
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
237
,
235
,
51
)
},
};
QColor
QGCPalette
::
_
window
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0x
F6
,
0xF6
,
0xF6
),
QColor
(
0xF6
,
0xF6
,
0xF6
),
QColor
(
0xF6
,
0xF6
,
0xF6
)
},
{
QColor
(
0x2
2
,
0x22
,
0x22
),
QColor
(
0x22
,
0x22
,
0x22
),
QColor
(
0x22
,
0x22
,
0x22
)
}
QColor
QGCPalette
::
_
buttonHighlightText
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0x
2c
,
0x2c
,
0x2c
),
QColor
(
0
,
0
,
0
)
},
{
QColor
(
0x2
c
,
0x2c
,
0x2c
),
QColor
(
0
,
0
,
0
)
},
};
QColor
QGCPalette
::
_
windowShade
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
255
,
235
,
211
),
QColor
(
255
,
235
,
211
),
QColor
(
255
,
235
,
211
)
},
{
QColor
(
51
,
51
,
51
),
QColor
(
51
,
51
,
51
),
QColor
(
51
,
51
,
51
)
}
QColor
QGCPalette
::
_
primaryButton
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
152
,
255
,
252
)
},
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
152
,
255
,
252
)
},
};
QColor
QGCPalette
::
_
windowShadeDark
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
216
,
216
,
216
),
QColor
(
216
,
216
,
216
),
QColor
(
216
,
216
,
216
)
},
{
QColor
(
40
,
40
,
40
),
QColor
(
40
,
40
,
40
),
QColor
(
40
,
40
,
40
)
}
QColor
QGCPalette
::
_
primaryButtonText
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0x2c
,
0x2c
,
0x2c
),
QColor
(
0
,
0
,
0
)
},
{
QColor
(
0x2c
,
0x2c
,
0x2c
),
QColor
(
0
,
0
,
0
)
},
};
QColor
QGCPalette
::
_
windowText
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
0
,
0
,
0
),
QColor
(
0
,
0
,
0
)
},
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
0xFF
,
0xFF
,
0xFF
),
QColor
(
0xFF
,
0xFF
,
0xFF
)
}
QColor
QGCPalette
::
_
textField
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
255
,
255
,
255
)
},
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
255
,
255
,
255
)
},
};
QColor
QGCPalette
::
_
buttonHighligh
t
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0x
58
,
0x58
,
0x58
),
QColor
(
238
,
227
,
51
),
QColor
(
238
,
227
,
51
)
},
{
QColor
(
0x
58
,
0x58
,
0x58
),
QColor
(
238
,
227
,
51
),
QColor
(
238
,
227
,
51
)
},
QColor
QGCPalette
::
_
textFieldTex
t
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0x
2c
,
0x2c
,
0x2c
),
QColor
(
0
,
0
,
0
)
},
{
QColor
(
0x
2c
,
0x2c
,
0x2c
),
QColor
(
0
,
0
,
0
)
},
};
QGCPalette
::
QGCPalette
(
QObject
*
parent
)
:
QObject
(
parent
),
_colorGroup
(
Activ
e
)
_colorGroup
Enabled
(
tru
e
)
{
// We have to keep track of all QGCPalette objects in the system so we can signal theme change to all of them
_paletteObjects
+=
this
;
...
...
@@ -98,9 +108,9 @@ QGCPalette::~QGCPalette()
Q_UNUSED
(
fSuccess
);
}
void
QGCPalette
::
setColorGroup
(
ColorGroup
colorGroup
)
void
QGCPalette
::
setColorGroup
Enabled
(
bool
enabled
)
{
_colorGroup
=
colorGroup
;
_colorGroup
Enabled
=
enabled
;
emit
paletteChanged
();
}
...
...
src/QGCPalette.h
View file @
ad5cde3b
...
...
@@ -39,34 +39,54 @@ class QGCPalette : public QObject
{
Q_OBJECT
Q_ENUMS
(
ColorGroup
)
Q_ENUMS
(
Theme
)
Q_PROPERTY
(
ColorGroup
colorGroup
READ
colorGroup
WRITE
setColorGroup
NOTIFY
paletteChanged
)
Q_PROPERTY
(
Theme
globalTheme
READ
globalTheme
WRITE
setGlobalTheme
NOTIFY
paletteChanged
)
Q_PROPERTY
(
bool
colorGroupEnabled
READ
colorGroupEnabled
WRITE
setColorGroupEnabled
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
alternateBase
READ
alternateBase
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
base
READ
base
NOTIFY
paletteChanged
)
/// Background color for windows
Q_PROPERTY
(
QColor
window
READ
window
NOTIFY
paletteChanged
)
/// Color for shaded areas within a window. The windowShade color should be a color somewhere between window and button.
Q_PROPERTY
(
QColor
windowShade
READ
windowShade
NOTIFY
paletteChanged
)
/// Color for darker shared areas within a window. The windowShadeDark color should be a color somewhere between window and windowShade.
Q_PROPERTY
(
QColor
windowShadeDark
READ
windowShadeDark
NOTIFY
paletteChanged
)
/// Standard text color for label text
Q_PROPERTY
(
QColor
text
READ
text
NOTIFY
paletteChanged
)
/// Background color for buttons
Q_PROPERTY
(
QColor
button
READ
button
NOTIFY
paletteChanged
)
/// Text color for buttons
Q_PROPERTY
(
QColor
buttonText
READ
buttonText
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
text
READ
text
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
window
READ
window
NOTIFY
paletteChanged
)
Q_PROPERTY
(
QColor
windowText
READ
windowText
NOTIFY
paletteChanged
)
///
The buttonHighlight color identifies the button background color when hovered or selected.
///
Background color for button in selected or hover state
Q_PROPERTY
(
QColor
buttonHighlight
READ
buttonHighlight
NOTIFY
paletteChanged
)
/// Text color for button in selected or hover state
Q_PROPERTY
(
QColor
buttonHighlightText
READ
buttonHighlightText
NOTIFY
paletteChanged
)
/// The windowShade color should be a color somewhere between window and button. It is used to shade window
/// areas.
Q_PROPERTY
(
QColor
windowShade
READ
windowShade
NOTIFY
paletteChanged
)
/// Background color for primary buttons. A primary button is the button which would be the
/// normal default button to press. For example in an Ok/Cancel situation where Ok would normally
/// be pressed, Ok is the primary button.
Q_PROPERTY
(
QColor
primaryButton
READ
primaryButton
NOTIFY
paletteChanged
)
/// The windowShadeDark color should be a color somewhere between window and windowShade. It is used to shade window
/// darker areas.
Q_PROPERTY
(
QColor
windowShadeDark
READ
windowShadeDark
NOTIFY
paletteChanged
)
/// Text color for buttons
Q_PROPERTY
(
QColor
primaryButtonText
READ
primaryButtonText
NOTIFY
paletteChanged
)
// Background color for TextFields
Q_PROPERTY
(
QColor
textField
READ
textField
NOTIFY
paletteChanged
)
// Text color for TextFields
Q_PROPERTY
(
QColor
textFieldText
READ
textFieldText
NOTIFY
paletteChanged
)
public:
enum
ColorGroup
{
Disabled
=
0
,
Active
,
Inactive
Enabled
};
enum
Theme
{
...
...
@@ -77,19 +97,25 @@ public:
QGCPalette
(
QObject
*
parent
=
NULL
);
~
QGCPalette
();
ColorGroup
colorGroup
(
void
)
const
{
return
_colorGroup
;
}
void
setColorGroup
(
ColorGroup
colorGroup
);
bool
colorGroupEnabled
(
void
)
const
{
return
_colorGroupEnabled
;
}
void
setColorGroupEnabled
(
bool
enabled
);
QColor
window
(
void
)
const
{
return
_window
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
QColor
windowShade
(
void
)
const
{
return
_windowShade
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
QColor
windowShadeDark
(
void
)
const
{
return
_windowShadeDark
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
QColor
text
(
void
)
const
{
return
_text
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
QColor
button
(
void
)
const
{
return
_button
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
QColor
buttonText
(
void
)
const
{
return
_buttonText
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
QColor
buttonHighlight
(
void
)
const
{
return
_buttonHighlight
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
QColor
buttonHighlightText
(
void
)
const
{
return
_buttonHighlightText
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
QColor
alternateBase
(
void
)
const
{
return
_alternateBase
[
_theme
][
_colorGroup
];
}
QColor
base
(
void
)
const
{
return
_base
[
_theme
][
_colorGroup
];
}
QColor
button
(
void
)
const
{
return
_button
[
_theme
][
_colorGroup
];
}
QColor
buttonText
(
void
)
const
{
return
_buttonText
[
_theme
][
_colorGroup
];
}
QColor
text
(
void
)
const
{
return
_text
[
_theme
][
_colorGroup
];
}
QColor
window
(
void
)
const
{
return
_window
[
_theme
][
_colorGroup
];
}
QColor
windowShade
(
void
)
const
{
return
_windowShade
[
_theme
][
_colorGroup
];
}
QColor
windowShadeDark
(
void
)
const
{
return
_windowShadeDark
[
_theme
][
_colorGroup
];
}
QColor
windowText
(
void
)
const
{
return
_windowText
[
_theme
][
_colorGroup
];
}
QColor
buttonHighlight
(
void
)
const
{
return
_buttonHighlight
[
_theme
][
_colorGroup
];
}
QColor
primaryButton
(
void
)
const
{
return
_primaryButton
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
QColor
primaryButtonText
(
void
)
const
{
return
_primaryButtonText
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
QColor
textField
(
void
)
const
{
return
_textField
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
QColor
textFieldText
(
void
)
const
{
return
_textFieldText
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
static
Theme
globalTheme
(
void
)
{
return
_theme
;
}
static
void
setGlobalTheme
(
Theme
newTheme
);
...
...
@@ -98,22 +124,30 @@ signals:
void
paletteChanged
(
void
);
private:
static
Theme
_theme
;
///< There is a single theme for all palettes
ColorGroup
_colorGroup
;
///< Currently selected ColorGroup
static
Theme
_theme
;
///< There is a single theme for all palettes
bool
_colorGroupEnabled
;
///< Currently selected ColorGroup. true: enabled, false: disabled
static
const
int
_cThemes
=
2
;
static
const
int
_cColorGroups
=
3
;
static
const
int
_cColorGroups
=
2
;
static
QColor
_alternateBase
[
_cThemes
][
_cColorGroups
];
static
QColor
_base
[
_cThemes
][
_cColorGroups
];
static
QColor
_button
[
_cThemes
][
_cColorGroups
];
static
QColor
_buttonText
[
_cThemes
][
_cColorGroups
];
static
QColor
_text
[
_cThemes
][
_cColorGroups
];
static
QColor
_window
[
_cThemes
][
_cColorGroups
];
static
QColor
_windowShade
[
_cThemes
][
_cColorGroups
];
static
QColor
_windowShadeDark
[
_cThemes
][
_cColorGroups
];
static
QColor
_windowText
[
_cThemes
][
_cColorGroups
];
static
QColor
_text
[
_cThemes
][
_cColorGroups
];
static
QColor
_button
[
_cThemes
][
_cColorGroups
];
static
QColor
_buttonText
[
_cThemes
][
_cColorGroups
];
static
QColor
_buttonHighlight
[
_cThemes
][
_cColorGroups
];
static
QColor
_buttonHighlightText
[
_cThemes
][
_cColorGroups
];
static
QColor
_primaryButton
[
_cThemes
][
_cColorGroups
];
static
QColor
_primaryButtonText
[
_cThemes
][
_cColorGroups
];
static
QColor
_primaryButtonHighlight
[
_cThemes
][
_cColorGroups
];
static
QColor
_primaryButtonHighlightText
[
_cThemes
][
_cColorGroups
];
static
QColor
_textField
[
_cThemes
][
_cColorGroups
];
static
QColor
_textFieldText
[
_cThemes
][
_cColorGroups
];
void
_themeChanged
(
void
);
...
...
src/QmlControls/QGCButton.qml
View file @
ad5cde3b
...
...
@@ -5,13 +5,20 @@ import QtQuick.Controls.Styles 1.2
import
QGroundControl
.
Palette
1.0
Button
{
property
var
__qgcPal
:
QGCPalette
{
colorGroup
:
enabled
?
QGCPalette
.
Active
:
QGCPalette
.
Disabled
}
// primary: true - this is the primary button for this group of buttons
property
bool
primary
:
false
property
var
__qgcPal
:
QGCPalette
{
colorGroupEnabled
:
enabled
}
property
bool
__showHighlight
:
pressed
|
hovered
|
checked
style
:
ButtonStyle
{
background
:
Rectangle
{
implicitWidth
:
100
implicitHeight
:
25
color
:
control
.
pressed
?
control
.
__qgcPal
.
buttonHighlight
:
control
.
__qgcPal
.
button
color
:
__showHighlight
?
control
.
__qgcPal
.
buttonHighlight
:
(
primary
?
control
.
__qgcPal
.
primaryButton
:
control
.
__qgcPal
.
button
)
}
label
:
Text
{
...
...
@@ -22,7 +29,9 @@ Button {
horizontalAlignment
:
TextEdit
.
AlignHCenter
text
:
control
.
text
color
:
control
.
__qgcPal
.
buttonText
color
:
__showHighlight
?
control
.
__qgcPal
.
buttonHighlightText
:
(
primary
?
control
.
__qgcPal
.
primaryButtonText
:
control
.
__qgcPal
.
buttonText
)
}
}
}
src/QmlControls/QGCCheckBox.qml
View file @
ad5cde3b
...
...
@@ -5,7 +5,7 @@ import QtQuick.Controls.Styles 1.2
import
QGroundControl
.
Palette
1.0
CheckBox
{
property
var
__qgcPal
:
QGCPalette
{
colorGroup
:
enabled
?
QGCPalette
.
Active
:
QGCPalette
.
Dis
abled
}
property
var
__qgcPal
:
QGCPalette
{
colorGroup
Enabled
:
en
abled
}
style
:
CheckBoxStyle
{
label
:
Item
{
...
...
@@ -28,7 +28,7 @@ CheckBox {
id
:
text
text
:
control
.
text
anchors.centerIn
:
parent
color
:
control
.
__qgcPal
.
windowT
ext
color
:
control
.
__qgcPal
.
t
ext
}
}
}
...
...
src/QmlControls/QGCLabel.qml
View file @
ad5cde3b
...
...
@@ -5,8 +5,8 @@ import QtQuick.Controls.Styles 1.2
import
QGroundControl
.
Palette
1.0
Text
{
property
var
__palette
:
QGCPalette
{
colorGroup
:
enabled
?
QGCPalette
.
Active
:
QGCPalette
.
Dis
abled
}
property
var
__palette
:
QGCPalette
{
colorGroup
Enabled
:
en
abled
}
property
bool
enabled
:
true
color
:
__palette
.
windowT
ext
color
:
__palette
.
t
ext
}
src/QmlControls/QGCRadioButton.qml
View file @
ad5cde3b
...
...
@@ -5,7 +5,7 @@ import QtQuick.Controls.Styles 1.2
import
QGroundControl
.
Palette
1.0
RadioButton
{
property
var
__qgcPal
:
QGCPalette
{
colorGroup
:
enabled
?
QGCPalette
.
Active
:
QGCPalette
.
Dis
abled
}
property
var
__qgcPal
:
QGCPalette
{
colorGroup
Enabled
:
en
abled
}
style
:
RadioButtonStyle
{
label
:
Item
{
...
...
@@ -28,7 +28,7 @@ RadioButton {
id
:
text
text
:
control
.
text
anchors.centerIn
:
parent
color
:
control
.
__qgcPal
.
windowT
ext
color
:
control
.
__qgcPal
.
t
ext
}
}
}
...
...
src/
FactSystem/FactControls/Fact
TextField.qml
→
src/
QmlControls/QGC
TextField.qml
View file @
ad5cde3b
...
...
@@ -2,21 +2,19 @@ import QtQuick 2.2
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.2
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
Palette
1.0
TextField
{
property
Fact
fact
:
Fact
{
value
:
0
}
property
bool
showUnits
:
false
property
string
unitsLabel
:
""
property
var
__qgc
pal
:
QGCPalette
{
colorGroup
:
QGCPalette
.
Activ
e
}
property
var
__qgc
Pal
:
QGCPalette
{
colorGroupEnabled
:
tru
e
}
text
:
fact
.
valueString
textColor
:
__qgcpal
.
text
textColor
:
__qgcPal
.
textFieldText
Label
{
id
:
unitsLabelWidthGenerator
text
:
parent
.
fact
.
units
text
:
unitsLabel
width
:
contentWidth
+
((
parent
.
__contentHeight
/
3
)
*
2
)
visible
:
false
}
...
...
@@ -35,7 +33,7 @@ TextField {
anchors.fill
:
parent
border.color
:
control
.
activeFocus
?
"
#47b
"
:
"
#999
"
color
:
__qgc
pal
.
base
color
:
__qgc
Pal
.
textField
}
Text
{
...
...
@@ -50,7 +48,7 @@ TextField {
x
:
parent
.
width
-
width
width
:
unitsLabelWidthGenerator
.
width
text
:
control
.
fact
.
units
text
:
control
.
unitsLabel
color
:
control
.
textColor
visible
:
control
.
showUnits
}
...
...
@@ -58,6 +56,4 @@ TextField {
padding.right
:
control
.
showUnits
?
unitsLabelWidthGenerator
.
width
:
control
.
__contentHeight
/
3
}
onEditingFinished
:
fact
.
value
=
text
}
src/QmlControls/QmlTest.qml
View file @
ad5cde3b
This diff is collapsed.
Click to expand it.
src/QmlControls/QmlTestWidget.cc
View file @
ad5cde3b
...
...
@@ -29,7 +29,7 @@
QmlTestWidget
::
QmlTestWidget
(
void
)
{
setAttribute
(
Qt
::
WA_DeleteOnClose
);
resize
(
5
00
,
500
);
resize
(
9
00
,
500
);
setVisible
(
true
);
setSource
(
QUrl
::
fromUserInput
(
"qrc:qml/QmlTest.qml"
));
}
src/QmlControls/S
etup
Button.qml
→
src/QmlControls/S
ubMenu
Button.qml
View file @
ad5cde3b
...
...
@@ -12,20 +12,22 @@ Button {
text
:
"
Button
"
property
bool
setupComplete
:
true
property
bool
setupIndicator
:
true
property
string
imageResource
:
"
s
etup
ButtonImage.png
"
property
string
imageResource
:
"
s
ubMenu
ButtonImage.png
"
style
:
ButtonStyle
{
id
:
buttonStyle
property
var
__qgcPal
:
QGCPalette
{
colorGroup
:
control
.
enabled
?
QGCPalette
.
Active
:
QGCPalette
.
Dis
abled
colorGroup
Enabled
:
control
.
en
abled
}
property
bool
__showHighlight
:
control
.
pressed
|
control
.
checked
background
:
Rectangle
{
id
:
innerRect
readonly
property
real
titleHeight
:
20
color
:
control
.
pressed
?
__qgcPal
.
buttonHighlight
:
(
control
.
checked
?
__qgcPal
.
buttonHighlight
:
__qgcPal
.
button
)
color
:
__showHighlight
?
__qgcPal
.
buttonHighlight
:
__qgcPal
.
button
Text
{
id
:
titleBar
...
...
@@ -38,7 +40,7 @@ Button {
text
:
control
.
text
font.pixelSize
:
12
color
:
__qgcPal
.
buttonText
color
:
__
showHighlight
?
__qgcPal
.
buttonHighlightText
:
__
qgcPal
.
buttonText
Rectangle
{
id
:
setupIndicator
...
...
@@ -76,7 +78,7 @@ Button {
ColorOverlay
{
anchors.fill
:
buttonImage
source
:
buttonImage
color
:
control
.
pressed
?
__qgcPal
.
buttonHighlight
:
(
control
.
checked
?
__qgcPal
.
buttonHighlight
:
__qgcPal
.
button
)
color
:
__showHighlight
?
__qgcPal
.
buttonHighlight
:
__qgcPal
.
button
}
}
}
...
...
src/QmlControls/qmldir
View file @
ad5cde3b
Module QGroundControl.Controls
S
etupButton 1.0 Setup
Button.qml
S
ubMenuButton 1.0 SubMenu
Button.qml
QGCLabel 1.0 QGCLabel.qml
QGCButton 1.0 QGCButton.qml
QGCRadioButton 1.0 QGCRadioButton.qml
QGCCheckBox 1.0 QGCCheckBox.qml
QGCTextField 1.0 QGCTextField.qml
src/VehicleSetup/FirmwareUpgrade.qml
View file @
ad5cde3b
...
...
@@ -11,7 +11,7 @@ Rectangle {
width
:
600
height
:
600
property
var
qgcPal
:
QGCPalette
{
colorGroup
:
QGCPalette
.
Activ
e
}
property
var
qgcPal
:
QGCPalette
{
colorGroup
Enabled
:
tru
e
}
property
FirmwareUpgradeController
controller
:
FirmwareUpgradeController
{
upgradeButton
:
upgradeButton
statusLog
:
statusTextArea
...
...
@@ -25,7 +25,7 @@ Rectangle {
Text
{
text
:
"
FIRMWARE UPDATE
"
color
:
qgcPal
.
windowT
ext
color
:
qgcPal
.
t
ext
font.pointSize
:
20
}
...
...
@@ -97,7 +97,7 @@ Rectangle {
readOnly
:
true
frameVisible
:
false
style
:
TextAreaStyle
{
textColor
:
qgcPal
.
windowT
ext
textColor
:
qgcPal
.
t
ext
backgroundColor
:
qgcPal
.
windowShade
}
}
...
...
src/VehicleSetup/SetupViewButtons.qml
View file @
ad5cde3b
...
...
@@ -10,7 +10,7 @@ import QGroundControl.Controls 1.0
Rectangle
{
id
:
topLevel
QGCPalette
{
id
:
palette
;
colorGroup
:
QGCPalette
.
Activ
e
}
QGCPalette
{
id
:
palette
;
colorGroup
Enabled
:
tru
e
}
color
:
palette
.
window
ExclusiveGroup
{
id
:
setupButtonGroup
}
...
...
@@ -21,7 +21,7 @@ Rectangle {
Column
{
anchors.fill
:
parent
S
etup
Button
{
S
ubMenu
Button
{
id
:
firmwareButton
;
objectName
:
"
firmwareButton
"
width
:
parent
.
width
text
:
"
FIRMWARE
"
...
...
@@ -39,7 +39,7 @@ Rectangle {
Column
{
anchors.fill
:
parent
S
etup
Button
{
S
ubMenu
Button
{
id
:
summaryButton
;
objectName
:
"
summaryButton
"
width
:
parent
.
width
text
:
"
SUMMARY
"
...
...
@@ -49,7 +49,7 @@ Rectangle {
onClicked
:
controller
.
summaryButtonClicked
()
}
S
etup
Button
{
S
ubMenu
Button
{
id
:
firmwareButton
;
objectName
:
"
firmwareButton
"
width
:
parent
.
width
text
:
"
FIRMWARE
"
...
...
@@ -62,7 +62,7 @@ Rectangle {
Repeater
{
model
:
autopilot
.
components
S
etup
Button
{
S
ubMenu
Button
{
width
:
parent
.
width
text
:
modelData
.
name
.
toUpperCase
()
imageResource
:
modelData
.
iconResource
...
...
@@ -72,7 +72,7 @@ Rectangle {
}
}
S
etup
Button
{
S
ubMenu
Button
{
width
:
parent
.
width
text
:
"
PARAMETERS
"
setupIndicator
:
false
...
...
src/VehicleSetup/VehicleSummary.qml
View file @
ad5cde3b
...
...
@@ -9,7 +9,7 @@ Rectangle {
width
:
600
height
:
400
property
var
qgcPal
:
QGCPalette
{
id
:
palette
;
colorGroup
:
QGCPalette
.
Activ
e
}
property
var
qgcPal
:
QGCPalette
{
id
:
palette
;
colorGroup
Enabled
:
tru
e
}
id
:
topLevel
objectName
:
"
topLevel
"
...
...
src/test.qml
View file @
ad5cde3b
...
...
@@ -7,10 +7,10 @@ import QGroundControl.Palette 1.0
Rectangle
{
QGCPalette
{
id
:
palette
;
colorGroup
:
enabled
?
QGCPalette
.
Active
:
QGCPalette
.
Dis
abled
}
QGCPalette
{
id
:
palette
;
colorGroup
Enabled
:
en
abled
}
width
:
100
height
:
100
color
:
"
#e43f3f
"
// palette.
windowT
ext
// palette.
t
ext
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment