mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
GCS-Changes uploader device pictures from SVG to some very
nice looking PNGs. TODO-PNG for PIPX
This commit is contained in:
parent
3e44389fa8
commit
a1593968f1
@ -31,7 +31,6 @@ deviceWidget::deviceWidget(QWidget *parent) :
|
||||
{
|
||||
myDevice = new Ui_deviceWidget();
|
||||
myDevice->setupUi(this);
|
||||
devicePic = NULL; // Initialize pointer to null
|
||||
|
||||
// Initialization of the Device icon display
|
||||
myDevice->verticalGroupBox_loaded->setVisible(false);
|
||||
@ -54,18 +53,14 @@ void deviceWidget::showEvent(QShowEvent *event)
|
||||
Q_UNUSED(event)
|
||||
// Thit fitInView method should only be called now, once the
|
||||
// widget is shown, otherwise it cannot compute its values and
|
||||
// the result is usually a ahrsbargraph that is way too small.
|
||||
if (devicePic)
|
||||
{
|
||||
myDevice->gVDevice->fitInView(devicePic,Qt::KeepAspectRatio);
|
||||
}
|
||||
// the result is usually a ahrsbargraph that is way too small
|
||||
myDevice->gVDevice->fitInView(devicePic.rect(),Qt::KeepAspectRatio);
|
||||
}
|
||||
|
||||
void deviceWidget::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
if (devicePic)
|
||||
myDevice->gVDevice->fitInView(devicePic, Qt::KeepAspectRatio);
|
||||
myDevice->gVDevice->fitInView(devicePic.rect(), Qt::KeepAspectRatio);
|
||||
}
|
||||
|
||||
|
||||
@ -92,31 +87,28 @@ void deviceWidget::populate()
|
||||
myDevice->lblDevName->setText(deviceDescriptorStruct::idToBoardName(id));
|
||||
myDevice->lblHWRev->setText(QString(tr("HW Revision: "))+QString::number(id & 0x00FF, 16));
|
||||
|
||||
devicePic = new QGraphicsSvgItem();
|
||||
devicePic->setSharedRenderer(new QSvgRenderer());
|
||||
switch (id) {
|
||||
case 0x0101:
|
||||
devicePic->renderer()->load(QString(":/uploader/images/deviceID-0101.svg"));
|
||||
break;
|
||||
case 0x0301:
|
||||
devicePic->renderer()->load(QString(":/uploader/images/deviceID-0301.svg"));
|
||||
break;
|
||||
case 0x0401:
|
||||
devicePic->renderer()->load(QString(":/uploader/images/deviceID-0401.svg"));
|
||||
break;
|
||||
case 0x0402:
|
||||
devicePic->renderer()->load(QString(":/uploader/images/deviceID-0402.svg"));
|
||||
devicePic.load("");//TODO
|
||||
break;
|
||||
case 0x0201:
|
||||
devicePic->renderer()->load(QString(":/uploader/images/deviceID-0201.svg"));
|
||||
devicePic.load("");//TODO
|
||||
break;
|
||||
case 0x0301:
|
||||
devicePic.load("");//TODO
|
||||
break;
|
||||
case 0x0401:
|
||||
devicePic.load(":/uploader/images/gcs-board-cc.png");
|
||||
break;
|
||||
case 0x0402:
|
||||
devicePic.load(":/uploader/images/gcs-board-cc3d.png");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
devicePic->setElementId("device");
|
||||
myDevice->gVDevice->scene()->addItem(devicePic);
|
||||
myDevice->gVDevice->setSceneRect(devicePic->boundingRect());
|
||||
myDevice->gVDevice->fitInView(devicePic,Qt::KeepAspectRatio);
|
||||
myDevice->gVDevice->scene()->addPixmap(devicePic);
|
||||
myDevice->gVDevice->setSceneRect(devicePic.rect());
|
||||
myDevice->gVDevice->fitInView(devicePic.rect(),Qt::KeepAspectRatio);
|
||||
|
||||
bool r = m_dfu->devices[deviceID].Readable;
|
||||
bool w = m_dfu->devices[deviceID].Writable;
|
||||
|
@ -64,7 +64,7 @@ private:
|
||||
DFUObject *m_dfu;
|
||||
QByteArray downloadedFirmware;
|
||||
QString filename;
|
||||
QGraphicsSvgItem *devicePic;
|
||||
QPixmap devicePic;
|
||||
QByteArray descriptionArray;
|
||||
void status(QString str, StatusIcon ic);
|
||||
bool populateBoardStructuredDescription(QByteArray arr);
|
||||
|
@ -32,15 +32,10 @@ runningDeviceWidget::runningDeviceWidget(QWidget *parent) :
|
||||
{
|
||||
myDevice = new Ui_runningDeviceWidget();
|
||||
myDevice->setupUi(this);
|
||||
devicePic = NULL; // Initialize pointer to null
|
||||
|
||||
// Initialization of the Device icon display
|
||||
myDevice->devicePicture->setScene(new QGraphicsScene(this));
|
||||
|
||||
/*
|
||||
QPixmap pix = QPixmap(QString(":uploader/images/view-refresh.svg"));
|
||||
myDevice->statusIcon->setPixmap(pix);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -50,15 +45,13 @@ void runningDeviceWidget::showEvent(QShowEvent *event)
|
||||
// Thit fitInView method should only be called now, once the
|
||||
// widget is shown, otherwise it cannot compute its values and
|
||||
// the result is usually a ahrsbargraph that is way too small.
|
||||
if (devicePic)
|
||||
myDevice->devicePicture->fitInView(devicePic,Qt::KeepAspectRatio);
|
||||
myDevice->devicePicture->fitInView(devicePic.rect(),Qt::KeepAspectRatio);
|
||||
}
|
||||
|
||||
void runningDeviceWidget::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
if (devicePic)
|
||||
myDevice->devicePicture->fitInView(devicePic, Qt::KeepAspectRatio);
|
||||
myDevice->devicePicture->fitInView(devicePic.rect(), Qt::KeepAspectRatio);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -79,31 +72,29 @@ void runningDeviceWidget::populate()
|
||||
// DeviceID tells us what sort of HW we have detected:
|
||||
// display a nice icon:
|
||||
myDevice->devicePicture->scene()->clear();
|
||||
if (devicePic)
|
||||
delete devicePic;
|
||||
devicePic = new QGraphicsSvgItem();
|
||||
devicePic->setSharedRenderer(new QSvgRenderer());
|
||||
|
||||
switch (id) {
|
||||
case 0x0101:
|
||||
devicePic->renderer()->load(QString(":/uploader/images/deviceID-0101.svg"));
|
||||
break;
|
||||
case 0x0301:
|
||||
devicePic->renderer()->load(QString(":/uploader/images/deviceID-0301.svg"));
|
||||
break;
|
||||
case 0x0401:
|
||||
devicePic->renderer()->load(QString(":/uploader/images/deviceID-0401.svg"));
|
||||
devicePic.load("");//TODO
|
||||
break;
|
||||
case 0x0201:
|
||||
devicePic->renderer()->load(QString(":/uploader/images/deviceID-0201.svg"));
|
||||
devicePic.load("");//TODO
|
||||
break;
|
||||
case 0x0301:
|
||||
devicePic.load("");//TODO
|
||||
break;
|
||||
case 0x0401:
|
||||
devicePic.load(":/uploader/images/gcs-board-cc.png");
|
||||
break;
|
||||
case 0x0402:
|
||||
devicePic.load(":/uploader/images/gcs-board-cc3d.png");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
devicePic->setElementId("device");
|
||||
myDevice->devicePicture->scene()->addItem(devicePic);
|
||||
myDevice->devicePicture->setSceneRect(devicePic->boundingRect());
|
||||
myDevice->devicePicture->fitInView(devicePic,Qt::KeepAspectRatio);
|
||||
myDevice->devicePicture->scene()->addPixmap(devicePic);
|
||||
myDevice->devicePicture->setSceneRect(devicePic.rect());
|
||||
myDevice->devicePicture->fitInView(devicePic.rect(),Qt::KeepAspectRatio);
|
||||
|
||||
QString serial = utilMngr->getBoardCPUSerial().toHex();
|
||||
myDevice->CPUSerial->setText(serial);
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
private:
|
||||
Ui_runningDeviceWidget *myDevice;
|
||||
int deviceID;
|
||||
QGraphicsSvgItem *devicePic;
|
||||
QPixmap devicePic;
|
||||
//void status(QString str, StatusIcon ic);
|
||||
|
||||
|
||||
|
@ -13,5 +13,7 @@
|
||||
<file>images/warning.svg</file>
|
||||
<file>images/error.svg</file>
|
||||
<file>images/deviceID-0402.svg</file>
|
||||
<file>images/gcs-board-cc.png</file>
|
||||
<file>images/gcs-board-cc3d.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Loading…
x
Reference in New Issue
Block a user