1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-23 08:15:17 +03:00

Merge branch 'next' of https://github.com/opentx/opentx into bsongis/spare_values_in_telemetry_and_functions

This commit is contained in:
Andre Bernet 2014-02-27 20:09:31 +01:00
commit 572a9ed3ba
284 changed files with 5398 additions and 4396 deletions

View file

@ -2,6 +2,7 @@
#include "appdata.h"
#include "helpers.h"
#include "simulatordialog.h"
#include "flashinterface.h"
QString getPhaseName(int val, char * phasename)
{
@ -642,6 +643,7 @@ void populateCSWCB(QComboBox *b, int value)
int order[] = {
LS_FN_OFF,
LS_FN_VEQUAL, // added at the end to avoid everything renumbered
LS_FN_VALMOSTEQUAL, // added at the end to avoid everything renumbered
LS_FN_VPOS,
LS_FN_VNEG,
// LS_FN_RANGE,
@ -694,6 +696,14 @@ QString image2qstring(QImage image)
return ImageStr;
}
// TODO KKERNEN 20140222
// I am sure that this code has had some kind of function, but now it only seems to cause
// problems. I think it is an attempt to open an image file from a double byte string which
// is first converted to a single byte string. Only used in burndialog.cpp
// It doesn't work for me in 2.0. I do not know why. I doubt it has ever worked for files or
// file paths containing non-english characters.
// Code can be removed ,when 2.0 is tested.
QImage qstring2image(QString imagestr)
{
bool ok;
@ -938,3 +948,48 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx)
QObject::tr("Simulator for this firmware is not yet available"));
}
}
QPixmap makePixMap( QImage image, QString firmwareType )
{
if (firmwareType.contains( "taranis" )) {
image = image.convertToFormat(QImage::Format_RGB32);
QRgb col;
int gray;
for (int i = 0; i < image.width(); ++i) {
for (int j = 0; j < image.height(); ++j) {
col = image.pixel(i, j);
gray = qGray(col);
image.setPixel(i, j, qRgb(gray, gray, gray));
}
}
image = image.scaled(SPLASHX9D_WIDTH, SPLASHX9D_HEIGHT);
}
else {
image = image.scaled(SPLASH_WIDTH, SPLASH_HEIGHT).convertToFormat(QImage::Format_Mono);
}
return(QPixmap::fromImage(image));
}
int getRadioType(QString firmwareType)
{
if (firmwareType.contains( "taranis" )) return 6;
if (firmwareType.contains( "sky9x" )) return 5;
if (firmwareType.contains( "gruvin9x")) return 4;
if (firmwareType.contains( "9xr128" )) return 3;
if (firmwareType.contains( "9xr" )) return 2;
if (firmwareType.contains( "9x128" )) return 1;
return 0; // 9x
}
QString getDefaultFwType( int radioType )
{
switch (radioType){
case 6: return "opentx-taranis-en";
case 5: return "opentx-sky9x-en";
case 4: return "opentx-gruvin9x-en";
case 3: return "opentx-9xr128-en";
case 2: return "opentx-9xr-en";
case 1: return "opentx-9x128-en";
default: return "opentx-9x-en";
}
}