Browse Source

commit

QGC4.4
Don Gagne 10 years ago
parent
commit
eb676850ab
  1. 7
      src/QGCQmlWidgetHolder.cpp
  2. 3
      src/QGCQmlWidgetHolder.h
  3. 8
      src/ui/toolbar/MainToolBar.cc
  4. 7
      src/ui/toolbar/MainToolBar.h
  5. 20
      src/ui/toolbar/MainToolBar.qml

7
src/QGCQmlWidgetHolder.cpp

@ -30,7 +30,7 @@ QGCQmlWidgetHolder::QGCQmlWidgetHolder(QWidget *parent) :
QWidget(parent) QWidget(parent)
{ {
_ui.setupUi(this); _ui.setupUi(this);
_ui.qmlWidget->setResizeMode(QQuickWidget::SizeRootObjectToView); setResizeMode(QQuickWidget::SizeRootObjectToView);
} }
QGCQmlWidgetHolder::~QGCQmlWidgetHolder() QGCQmlWidgetHolder::~QGCQmlWidgetHolder()
@ -62,3 +62,8 @@ QQuickItem* QGCQmlWidgetHolder::getRootObject(void)
{ {
return _ui.qmlWidget->rootObject(); return _ui.qmlWidget->rootObject();
} }
void QGCQmlWidgetHolder::setResizeMode(QQuickWidget::ResizeMode resizeMode)
{
_ui.qmlWidget->setResizeMode(resizeMode);
}

3
src/QGCQmlWidgetHolder.h

@ -61,6 +61,9 @@ public:
void setContextPropertyObject(const QString& name, QObject* object); void setContextPropertyObject(const QString& name, QObject* object);
/// Sets the resize mode for the QQuickWidget container
void setResizeMode(QQuickWidget::ResizeMode resizeMode);
private: private:
Ui::QGCQmlWidgetHolder _ui; Ui::QGCQmlWidgetHolder _ui;
}; };

8
src/ui/toolbar/MainToolBar.cc

@ -92,6 +92,8 @@ MainToolBar::MainToolBar(QWidget* parent)
SLOT(_telemetryChanged(LinkInterface*, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned))); SLOT(_telemetryChanged(LinkInterface*, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned)));
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(_setActiveUAS(UASInterface*))); connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(_setActiveUAS(UASInterface*)));
connect(UASManager::instance(), SIGNAL(UASDeleted(UASInterface*)), this, SLOT(_forgetUAS(UASInterface*))); connect(UASManager::instance(), SIGNAL(UASDeleted(UASInterface*)), this, SLOT(_forgetUAS(UASInterface*)));
connect(this, &MainToolBar::heightChanged, this, &MainToolBar::_heightChanged);
} }
MainToolBar::~MainToolBar() MainToolBar::~MainToolBar()
@ -396,3 +398,9 @@ void MainToolBar::_setProgressBarValue(float value)
_progressBarValue = value; _progressBarValue = value;
emit progressBarValueChanged(value); emit progressBarValueChanged(value);
} }
void MainToolBar::_heightChanged(double height)
{
setMinimumHeight(height);
setMaximumHeight(height);
}

7
src/ui/toolbar/MainToolBar.h

@ -69,6 +69,7 @@ public:
Q_INVOKABLE void onDisconnect(QString conf); Q_INVOKABLE void onDisconnect(QString conf);
Q_INVOKABLE void onEnterMessageArea(int x, int y); Q_INVOKABLE void onEnterMessageArea(int x, int y);
Q_PROPERTY(double height MEMBER _toolbarHeight NOTIFY heightChanged)
Q_PROPERTY(ViewType_t currentView MEMBER _currentView NOTIFY currentViewChanged) Q_PROPERTY(ViewType_t currentView MEMBER _currentView NOTIFY currentViewChanged)
Q_PROPERTY(QStringList configList MEMBER _linkConfigurations NOTIFY configListChanged) Q_PROPERTY(QStringList configList MEMBER _linkConfigurations NOTIFY configListChanged)
Q_PROPERTY(int connectionCount READ connectionCount NOTIFY connectionCountChanged) Q_PROPERTY(int connectionCount READ connectionCount NOTIFY connectionCountChanged)
@ -104,6 +105,10 @@ signals:
void remoteRSSIChanged (int value); void remoteRSSIChanged (int value);
void telemetryRRSSIChanged (int value); void telemetryRRSSIChanged (int value);
void telemetryLRSSIChanged (int value); void telemetryLRSSIChanged (int value);
void heightChanged (double height);
/// Shows a non-modal message below the toolbar
void showMessage(const QString& message);
private slots: private slots:
void _forgetUAS (UASInterface* uas); void _forgetUAS (UASInterface* uas);
@ -115,6 +120,7 @@ private slots:
void _setProgressBarValue (float value); void _setProgressBarValue (float value);
void _remoteControlRSSIChanged (uint8_t rssi); void _remoteControlRSSIChanged (uint8_t rssi);
void _telemetryChanged (LinkInterface* link, unsigned rxerrors, unsigned fixed, unsigned rssi, unsigned remrssi, unsigned txbuf, unsigned noise, unsigned remnoise); void _telemetryChanged (LinkInterface* link, unsigned rxerrors, unsigned fixed, unsigned rssi, unsigned remrssi, unsigned txbuf, unsigned noise, unsigned remnoise);
void _heightChanged (double height);
private: private:
void _updateConnection (LinkInterface *disconnectedLink = NULL); void _updateConnection (LinkInterface *disconnectedLink = NULL);
@ -137,6 +143,7 @@ private:
double _remoteRSSIstore; double _remoteRSSIstore;
int _telemetryRRSSI; int _telemetryRRSSI;
int _telemetryLRSSI; int _telemetryLRSSI;
double _toolbarHeight;
UASMessageViewRollDown* _rollDownMessages; UASMessageViewRollDown* _rollDownMessages;
}; };

20
src/ui/toolbar/MainToolBar.qml

@ -43,14 +43,15 @@ Rectangle {
property var qgcPal: QGCPalette { id: palette; colorGroupEnabled: true } property var qgcPal: QGCPalette { id: palette; colorGroupEnabled: true }
readonly property real toolBarHeight: ScreenTools.defaultFontPixelHeight * 3
property int cellSpacerSize: ScreenTools.isMobile ? getProportionalDimmension(6) : getProportionalDimmension(4) property int cellSpacerSize: ScreenTools.isMobile ? getProportionalDimmension(6) : getProportionalDimmension(4)
property int cellHeight: getProportionalDimmension(30) readonly property int cellHeight: getProportionalDimmension(30)
property var colorBlue: "#1a6eaa" readonly property var colorBlue: "#1a6eaa"
property var colorGreen: "#329147" readonly property var colorGreen: "#329147"
property var colorRed: "#942324" readonly property var colorRed: "#942324"
property var colorOrange: "#a76f26" readonly property var colorOrange: "#a76f26"
property var colorWhite: "#f0f0f0" readonly property var colorWhite: "#f0f0f0"
property var colorOrangeText: (qgcPal.globalTheme === QGCPalette.Light) ? "#b75711" : "#ea8225" property var colorOrangeText: (qgcPal.globalTheme === QGCPalette.Light) ? "#b75711" : "#ea8225"
property var colorRedText: (qgcPal.globalTheme === QGCPalette.Light) ? "#ee1112" : "#ef2526" property var colorRedText: (qgcPal.globalTheme === QGCPalette.Light) ? "#ee1112" : "#ef2526"
@ -59,8 +60,13 @@ Rectangle {
color: qgcPal.windowShade color: qgcPal.windowShade
Connections {
target: mainToolBar
onShowMessage: mainToolBar.height = 100
}
function getProportionalDimmension(val) { function getProportionalDimmension(val) {
return toolBarHolder.height * val / 40 return toolBarHeight * val / 40
} }
function getMessageColor() { function getMessageColor() {

Loading…
Cancel
Save