App Preferences dialog tabs fully functional, except for adding profiles.
Splash Editor fully functional. Improved handling of image formats remain. Merged branch 'origin/next'
This commit is contained in:
@@ -7,19 +7,128 @@
|
||||
#include "splashlibrary.h"
|
||||
#include "flashinterface.h"
|
||||
|
||||
//*** Side Class ***
|
||||
|
||||
Side::Side(){
|
||||
imageLabel = 0;
|
||||
fileNameEdit = 0;
|
||||
saveButton = 0;
|
||||
source=new Source;
|
||||
*source = UNDEFINED;
|
||||
saveToFileName = new QString("");
|
||||
source = new Source(UNDEFINED);
|
||||
}
|
||||
|
||||
void Side::copyImage( Side side ){
|
||||
if ((*source!=UNDEFINED) && (*side.source!=UNDEFINED))
|
||||
void Side::copyImage( Side side )
|
||||
{
|
||||
if ((*source!=UNDEFINED) && (*side.source!=UNDEFINED))
|
||||
imageLabel->setPixmap(*side.imageLabel->pixmap());
|
||||
}
|
||||
|
||||
bool Side::displayImage( QString fileName, Source pictSource )
|
||||
{
|
||||
QImage image;
|
||||
|
||||
if (fileName.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if (pictSource == FW ){
|
||||
FlashInterface flash(fileName);
|
||||
if (!flash.hasSplash())
|
||||
return false;
|
||||
else
|
||||
image = flash.getSplash();
|
||||
}
|
||||
else {
|
||||
image.load(fileName);
|
||||
}
|
||||
if (image.isNull()) {
|
||||
return false;
|
||||
}
|
||||
if (imageLabel->width()==424) {
|
||||
image=image.convertToFormat(QImage::Format_RGB32);
|
||||
QRgb col;
|
||||
int gray;
|
||||
int width = image.width();
|
||||
int height = image.height();
|
||||
for (int i = 0; i < width; ++i) {
|
||||
for (int j = 0; j < height; ++j) {
|
||||
col = image.pixel(i, j);
|
||||
gray = qGray(col);
|
||||
image.setPixel(i, j, qRgb(gray, gray, gray));
|
||||
}
|
||||
}
|
||||
imageLabel->setPixmap(QPixmap::fromImage(image.scaled(imageLabel->width()/2, imageLabel->height()/2)));
|
||||
}
|
||||
else {
|
||||
imageLabel->setPixmap(QPixmap::fromImage(image.scaled(imageLabel->width()/2, imageLabel->height()/2).convertToFormat(QImage::Format_Mono)));
|
||||
}
|
||||
switch (pictSource){
|
||||
case FW:
|
||||
fileNameEdit->setText(QObject::tr("FW: %1").arg(fileName));
|
||||
*saveToFileName = fileName;
|
||||
*source=FW;
|
||||
break;
|
||||
case PICT:
|
||||
fileNameEdit->setText(QObject::tr("Pict: %1").arg(fileName));
|
||||
*saveToFileName = fileName;
|
||||
*source=PICT;
|
||||
break;
|
||||
case PROFILE:
|
||||
fileNameEdit->setText(QObject::tr("Profile image"));
|
||||
*saveToFileName = fileName;
|
||||
*source=PROFILE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
saveButton->setEnabled(true);
|
||||
libraryButton->setEnabled(true);
|
||||
invertButton->setEnabled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Side::refreshImage()
|
||||
{
|
||||
return displayImage( *saveToFileName, *source );
|
||||
}
|
||||
|
||||
bool Side::saveImage()
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
if (*source == FW )
|
||||
{
|
||||
FlashInterface flash(*saveToFileName);
|
||||
if (!flash.hasSplash()) {
|
||||
return false;
|
||||
}
|
||||
QImage image = imageLabel->pixmap()->toImage().scaled(flash.getSplashWidth(), flash.getSplashHeight());
|
||||
if (flash.setSplash(image) && (flash.saveFlash(*saveToFileName) > 0)) {
|
||||
settings.setValue("lastFlashDir", QFileInfo(*saveToFileName).dir().absolutePath());
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*source == PICT) {
|
||||
QImage image = imageLabel->pixmap()->toImage().scaled(imageLabel->width()/2, imageLabel->height()/2).convertToFormat(QImage::Format_Indexed8);
|
||||
if (image.save(*saveToFileName)) {
|
||||
settings.setValue("lastImagesDir", QFileInfo(*saveToFileName).dir().absolutePath());
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*source == PROFILE) {
|
||||
QImage image = imageLabel->pixmap()->toImage().scaled(imageLabel->width()/2, imageLabel->height()/2).convertToFormat(QImage::Format_Indexed8);
|
||||
if (!image.save(*saveToFileName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//*** customizeSplashDialog Class ***
|
||||
|
||||
customizeSplashDialog::customizeSplashDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::customizeSplashDialog)
|
||||
@@ -39,6 +148,7 @@ customizeSplashDialog::customizeSplashDialog(QWidget *parent) :
|
||||
left.invertButton = ui->leftInvertButton;
|
||||
right.invertButton = ui->rightInvertButton;
|
||||
|
||||
loadProfile(left);
|
||||
resize(0,0);
|
||||
}
|
||||
|
||||
@@ -62,25 +172,10 @@ void customizeSplashDialog::loadFirmware(Side side)
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), settings.value("lastFlashDir").toString(), FLASH_FILES_FILTER);
|
||||
if (!fileName.isEmpty()) {
|
||||
QFile file(fileName);
|
||||
if (fileName.isEmpty() || !file.exists())
|
||||
return;
|
||||
|
||||
FlashInterface flash(fileName);
|
||||
if (!flash.hasSplash()) {
|
||||
QMessageBox::information(this, tr("Error"), tr("Could not find bitmap to replace in file"));
|
||||
return;
|
||||
}
|
||||
|
||||
side.saveButton->setEnabled(true);
|
||||
side.imageLabel->setPixmap(QPixmap::fromImage(flash.getSplash()));
|
||||
side.imageLabel->setFixedSize(flash.getSplashWidth()*2,flash.getSplashHeight()*2);
|
||||
side.fileNameEdit->setText(fileName);
|
||||
if (!side.displayImage( fileName, FW ))
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load embedded FW image from %1.").arg(fileName));
|
||||
else
|
||||
settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath());
|
||||
*side.source=FW;
|
||||
side.saveButton->setEnabled(true);
|
||||
side.libraryButton->setEnabled(true);
|
||||
side.invertButton->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,46 +191,25 @@ void customizeSplashDialog::loadPicture(Side side)
|
||||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
tr("Open Image to load"), settings.value("lastImagesDir").toString(), tr("Images (%1)").arg(supportedImageFormats));
|
||||
|
||||
if (fileName.isEmpty()){
|
||||
return;
|
||||
if (!fileName.isEmpty()) {
|
||||
if (!side.displayImage( fileName, PICT ))
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load the image file %1.").arg(fileName));
|
||||
else
|
||||
settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath());
|
||||
}
|
||||
QImage image(fileName);
|
||||
if (image.isNull()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
|
||||
return;
|
||||
}
|
||||
if (side.imageLabel->width()==424) {
|
||||
image=image.convertToFormat(QImage::Format_RGB32);
|
||||
QRgb col;
|
||||
int gray;
|
||||
int width = image.width();
|
||||
int height = image.height();
|
||||
for (int i = 0; i < width; ++i)
|
||||
{
|
||||
for (int j = 0; j < height; ++j)
|
||||
{
|
||||
col = image.pixel(i, j);
|
||||
gray = qGray(col);
|
||||
image.setPixel(i, j, qRgb(gray, gray, gray));
|
||||
}
|
||||
}
|
||||
side.imageLabel->setPixmap(QPixmap::fromImage(image.scaled(side.imageLabel->width()/2, side.imageLabel->height()/2)));
|
||||
} else {
|
||||
side.imageLabel->setPixmap(QPixmap::fromImage(image.scaled(side.imageLabel->width()/2, side.imageLabel->height()/2).convertToFormat(QImage::Format_Mono)));
|
||||
}
|
||||
|
||||
settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath());
|
||||
side.fileNameEdit->setText(fileName);
|
||||
*side.source=PICT;
|
||||
side.saveButton->setEnabled(true);
|
||||
side.libraryButton->setEnabled(true);
|
||||
side.invertButton->setEnabled(true);
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_leftLoadProfileButton_clicked() {loadProfile(left);}
|
||||
void customizeSplashDialog::on_rightLoadProfileButton_clicked() {loadProfile(right);}
|
||||
void customizeSplashDialog::loadProfile(Side side)
|
||||
{
|
||||
QSettings settings;
|
||||
QString fileName=settings.value("SplashFileName","").toString();
|
||||
|
||||
if (!fileName.isEmpty()) {
|
||||
if (!side.displayImage( fileName, PROFILE ))
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load the profile image %1.").arg(fileName));
|
||||
}
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_leftLibraryButton_clicked(){libraryButton_clicked(left);}
|
||||
@@ -143,67 +217,26 @@ void customizeSplashDialog::on_rightLibraryButton_clicked(){libraryButton_clicke
|
||||
void customizeSplashDialog::libraryButton_clicked( Side side )
|
||||
{
|
||||
QString fileName;
|
||||
|
||||
splashLibrary *ld = new splashLibrary(this,&fileName);
|
||||
ld->exec();
|
||||
if (!fileName.isEmpty()) {
|
||||
QImage image(fileName);
|
||||
if (image.isNull()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName));
|
||||
return;
|
||||
}
|
||||
if (side.imageLabel->width()==424) {
|
||||
image=image.convertToFormat(QImage::Format_RGB32);
|
||||
QRgb col;
|
||||
int gray;
|
||||
int width = image.width();
|
||||
int height = image.height();
|
||||
for (int i = 0; i < width; ++i)
|
||||
{
|
||||
for (int j = 0; j < height; ++j)
|
||||
{
|
||||
col = image.pixel(i, j);
|
||||
gray = qGray(col);
|
||||
image.setPixel(i, j, qRgb(gray, gray, gray));
|
||||
}
|
||||
}
|
||||
side.imageLabel->setPixmap(QPixmap::fromImage(image.scaled(side.imageLabel->width()/2, side.imageLabel->height()/2)));
|
||||
} else {
|
||||
side.imageLabel->setPixmap(QPixmap::fromImage(image.scaled(side.imageLabel->width()/2, side.imageLabel->height()/2).convertToFormat(QImage::Format_Mono)));
|
||||
}
|
||||
if (!side.displayImage( fileName, UNDEFINED ))
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load the library image %1.").arg(fileName));
|
||||
}
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_leftSaveButton_clicked(){saveButton_clicked(left);}
|
||||
void customizeSplashDialog::on_rightSaveButton_clicked(){saveButton_clicked(right);}
|
||||
void customizeSplashDialog::saveButton_clicked(Side side)
|
||||
void customizeSplashDialog::saveButton_clicked( Side side )
|
||||
{
|
||||
QSettings settings;
|
||||
QString fileName = side.fileNameEdit->text();
|
||||
|
||||
if (*side.source == FW)
|
||||
{
|
||||
FlashInterface flash(fileName);
|
||||
if (!flash.hasSplash()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not store image in firmware file %1").arg(fileName));
|
||||
return;
|
||||
}
|
||||
QImage image = side.imageLabel->pixmap()->toImage().scaled(flash.getSplashWidth(), flash.getSplashHeight());
|
||||
if (flash.setSplash(image) && (flash.saveFlash(fileName) > 0))
|
||||
settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath());
|
||||
else
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not store image in firmware file %1").arg(fileName));
|
||||
}
|
||||
else if (*side.source == PICT)
|
||||
{
|
||||
if (!fileName.isEmpty()) {
|
||||
QImage image = side.imageLabel->pixmap()->toImage().scaled(side.imageLabel->width()/2, side.imageLabel->height()/2).convertToFormat(QImage::Format_Indexed8);
|
||||
if (image.save(fileName))
|
||||
settings.setValue("lastImagesDir", QFileInfo(fileName).dir().absolutePath());
|
||||
else
|
||||
QMessageBox::critical(this, tr("Error"), tr("The image file %1 could not be stored").arg(fileName));
|
||||
if (side.saveImage()){
|
||||
QMessageBox::information(this, tr("File Saved"), tr("The image was saved to the file %1").arg(*side.saveToFileName));
|
||||
if ( !side.refreshImage()){
|
||||
QMessageBox::critical(this, tr("Image Refresh Error"), tr("Failed to refresh image from file %1").arg(*side.saveToFileName));
|
||||
}
|
||||
}
|
||||
else
|
||||
QMessageBox::critical(this, tr("File Save Error"), tr("Failed to write image to %1").arg(*side.saveToFileName));
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_leftInvertButton_clicked(){invertButton_clicked(left);}
|
||||
|
||||
@@ -17,6 +17,9 @@ class Side
|
||||
public:
|
||||
Side();
|
||||
void copyImage( Side );
|
||||
bool displayImage( QString fileName, Source source );
|
||||
bool saveImage();
|
||||
bool refreshImage();
|
||||
|
||||
QLabel *imageLabel;
|
||||
QLineEdit *fileNameEdit;
|
||||
@@ -24,6 +27,9 @@ public:
|
||||
QPushButton *invertButton;
|
||||
QToolButton *libraryButton;
|
||||
|
||||
QString *saveToFileName;
|
||||
|
||||
private:
|
||||
Source *source;
|
||||
};
|
||||
|
||||
|
||||
@@ -254,6 +254,16 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QPushButton" name="leftLoadProfileButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load Profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="leftLoadFwButton">
|
||||
<property name="text">
|
||||
@@ -268,16 +278,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="leftLoadProfileButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load Profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
@@ -550,6 +550,16 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QPushButton" name="rightLoadProfileButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load Profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="rightLoadFwButton">
|
||||
<property name="enabled">
|
||||
@@ -567,16 +577,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="rightLoadProfileButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load Profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
@@ -625,12 +625,17 @@
|
||||
<tabstops>
|
||||
<tabstop>leftFileNameEdit</tabstop>
|
||||
<tabstop>leftInvertButton</tabstop>
|
||||
<tabstop>leftLibraryButton</tabstop>
|
||||
<tabstop>leftLoadProfileButton</tabstop>
|
||||
<tabstop>leftLoadFwButton</tabstop>
|
||||
<tabstop>leftLoadPictButton</tabstop>
|
||||
<tabstop>leftSaveButton</tabstop>
|
||||
<tabstop>copyLeftToRightButton</tabstop>
|
||||
<tabstop>copyRightToLeftButton</tabstop>
|
||||
<tabstop>rightFileNameEdit</tabstop>
|
||||
<tabstop>rightInvertButton</tabstop>
|
||||
<tabstop>rightLibraryButton</tabstop>
|
||||
<tabstop>rightLoadProfileButton</tabstop>
|
||||
<tabstop>rightLoadFwButton</tabstop>
|
||||
<tabstop>rightLoadPictButton</tabstop>
|
||||
<tabstop>rightSaveButton</tabstop>
|
||||
|
||||
@@ -883,8 +883,12 @@ class ModelData {
|
||||
SwashRingData swashRingData;
|
||||
unsigned int thrTraceSrc;
|
||||
int8_t traineron; // 0 disable trainer, 1 allow trainer
|
||||
unsigned int modelId;
|
||||
unsigned int modelId;
|
||||
unsigned int switchWarningStates;
|
||||
unsigned int nSwToWarn;
|
||||
unsigned int nPotsToWarn;
|
||||
int potPosition[C9X_NUM_POTS];
|
||||
bool displayText;
|
||||
// TODO structure
|
||||
char gvars_names[C9X_MAX_GVARS][6+1];
|
||||
bool gvars_popups[C9X_MAX_GVARS];
|
||||
@@ -1030,6 +1034,7 @@ enum Capability {
|
||||
CSFunc,
|
||||
LCDWidth,
|
||||
GetThrSwitch,
|
||||
HasDisplayText,
|
||||
VirtualInputs,
|
||||
LuaInputs,
|
||||
LimitsPer1000,
|
||||
|
||||
@@ -24,13 +24,13 @@
|
||||
#define MAX_CURVES(board, version) (IS_ARM(board) ? ((IS_TARANIS(board) && version >= 216) ? 32 : 16) : O9X_MAX_CURVES)
|
||||
#define MAX_GVARS(board, version) ((IS_ARM(board) && version >= 216) ? 9 : 5)
|
||||
|
||||
#define IS_RELEASE_21_MARCH_2013(board, version) (version >= 214 || (!IS_ARM(board) && version >= 213))
|
||||
#define IS_RELEASE_23_MARCH_2013(board, version) (version >= 214 || (board==BOARD_STOCK && version >= 213))
|
||||
#define IS_AFTER_RELEASE_21_MARCH_2013(board, version) (version >= 214 || (!IS_ARM(board) && version >= 213))
|
||||
#define IS_AFTER_RELEASE_23_MARCH_2013(board, version) (version >= 214 || (board==BOARD_STOCK && version >= 213))
|
||||
|
||||
inline int switchIndex(int i, BoardEnum board, unsigned int version)
|
||||
{
|
||||
bool release21March2013 = IS_RELEASE_21_MARCH_2013(board, version);
|
||||
if (!IS_TARANIS(board) && release21March2013)
|
||||
bool afterrelease21March2013 = IS_AFTER_RELEASE_21_MARCH_2013(board, version);
|
||||
if (!IS_TARANIS(board) && afterrelease21March2013)
|
||||
return (i<=3 ? i+3 : (i<=6 ? i-3 : i));
|
||||
else
|
||||
return i;
|
||||
@@ -153,7 +153,7 @@ class SourcesConversionTable: public ConversionTable {
|
||||
public:
|
||||
SourcesConversionTable(BoardEnum board, unsigned int version, unsigned int variant, unsigned long flags=0)
|
||||
{
|
||||
bool release21March2013 = IS_RELEASE_21_MARCH_2013(board, version);
|
||||
bool afterrelease21March2013 = IS_AFTER_RELEASE_21_MARCH_2013(board, version);
|
||||
|
||||
int val=0;
|
||||
|
||||
@@ -177,19 +177,19 @@ class SourcesConversionTable: public ConversionTable {
|
||||
for (int i=0; i<MAX_ROTARY_ENCODERS(board); i++)
|
||||
addConversion(RawSource(SOURCE_TYPE_ROTARY_ENCODER, 0), val++);
|
||||
|
||||
if (!release21March2013) {
|
||||
if (!afterrelease21March2013) {
|
||||
for (int i=0; i<NUM_STICKS; i++)
|
||||
addConversion(RawSource(SOURCE_TYPE_TRIM, i), val++);
|
||||
}
|
||||
|
||||
addConversion(RawSource(SOURCE_TYPE_MAX), val++);
|
||||
|
||||
if (release21March2013) {
|
||||
if (afterrelease21March2013) {
|
||||
for (int i=0; i<3; i++)
|
||||
addConversion(RawSource(SOURCE_TYPE_CYC, i), val++);
|
||||
}
|
||||
|
||||
if (release21March2013) {
|
||||
if (afterrelease21March2013) {
|
||||
for (int i=0; i<NUM_STICKS; i++)
|
||||
addConversion(RawSource(SOURCE_TYPE_TRIM, i), val++);
|
||||
}
|
||||
@@ -197,7 +197,7 @@ class SourcesConversionTable: public ConversionTable {
|
||||
addConversion(RawSource(SOURCE_TYPE_SWITCH, 0), val++);
|
||||
|
||||
if (!(flags & FLAG_NOSWITCHES)) {
|
||||
if (release21March2013) {
|
||||
if (afterrelease21March2013) {
|
||||
for (int i=1; i<MAX_SWITCHES(board); i++)
|
||||
addConversion(RawSource(SOURCE_TYPE_SWITCH, i), val++);
|
||||
}
|
||||
@@ -213,7 +213,7 @@ class SourcesConversionTable: public ConversionTable {
|
||||
addConversion(RawSource(SOURCE_TYPE_CUSTOM_SWITCH, i), val++);
|
||||
}
|
||||
|
||||
if (!release21March2013) {
|
||||
if (!afterrelease21March2013) {
|
||||
for (int i=0; i<3; i++)
|
||||
addConversion(RawSource(SOURCE_TYPE_CYC, i), val++);
|
||||
}
|
||||
@@ -225,14 +225,14 @@ class SourcesConversionTable: public ConversionTable {
|
||||
addConversion(RawSource(SOURCE_TYPE_CH, i), val++);
|
||||
|
||||
if (!(flags & FLAG_NOTELEMETRY)) {
|
||||
if (release21March2013) {
|
||||
if (afterrelease21March2013) {
|
||||
if ((board != BOARD_STOCK && (board!=BOARD_M128 || version<215)) || (variant & GVARS_VARIANT)) {
|
||||
for (int i=0; i<MAX_GVARS(board, version); i++)
|
||||
addConversion(RawSource(SOURCE_TYPE_GVAR, i), val++);
|
||||
}
|
||||
}
|
||||
|
||||
if (release21March2013)
|
||||
if (afterrelease21March2013)
|
||||
addConversion(RawSource(SOURCE_TYPE_TELEMETRY, 0), val++);
|
||||
|
||||
for (int i=1; i<TELEMETRY_SOURCE_ACC; i++)
|
||||
@@ -690,7 +690,7 @@ class MixField: public TransformedField {
|
||||
internalField.Append(new ZCharField<6>(mix.name));
|
||||
}
|
||||
}
|
||||
else if (IS_DBLRAM(board, version) && IS_RELEASE_23_MARCH_2013(board, version)) {
|
||||
else if (IS_DBLRAM(board, version) && IS_AFTER_RELEASE_23_MARCH_2013(board, version)) {
|
||||
internalField.Append(new UnsignedField<4>(_destCh));
|
||||
internalField.Append(new BoolField<1>(_curveMode));
|
||||
internalField.Append(new BoolField<1>(mix.noExpo));
|
||||
@@ -849,7 +849,7 @@ class ExpoField: public TransformedField {
|
||||
}
|
||||
internalField.Append(new SignedField<8>(_curveParam));
|
||||
}
|
||||
else if (IS_DBLRAM(board, version) && IS_RELEASE_23_MARCH_2013(board, version)) {
|
||||
else if (IS_DBLRAM(board, version) && IS_AFTER_RELEASE_23_MARCH_2013(board, version)) {
|
||||
internalField.Append(new UnsignedField<2>(expo.mode));
|
||||
internalField.Append(new UnsignedField<2>(expo.chn));
|
||||
internalField.Append(new BoolField<1>(_curveMode));
|
||||
@@ -1051,9 +1051,9 @@ class LogicalSwitchesFunctionsTable: public ConversionTable {
|
||||
LogicalSwitchesFunctionsTable(BoardEnum board, unsigned int version)
|
||||
{
|
||||
int val=0;
|
||||
bool release21March2013 = IS_RELEASE_21_MARCH_2013(board, version);
|
||||
bool afterrelease21March2013 = IS_AFTER_RELEASE_21_MARCH_2013(board, version);
|
||||
addConversion(LS_FN_OFF, val++);
|
||||
if (release21March2013)
|
||||
if (afterrelease21March2013)
|
||||
addConversion(LS_FN_VEQUAL, val++);
|
||||
addConversion(LS_FN_VPOS, val++);
|
||||
addConversion(LS_FN_VNEG, val++);
|
||||
@@ -1065,11 +1065,11 @@ class LogicalSwitchesFunctionsTable: public ConversionTable {
|
||||
addConversion(LS_FN_XOR, val++);
|
||||
if (IS_ARM(board) && version >= 216) addConversion(LS_FN_STAY, val++);
|
||||
addConversion(LS_FN_EQUAL, val++);
|
||||
if (!release21March2013)
|
||||
if (!afterrelease21March2013)
|
||||
addConversion(LS_FN_NEQUAL, val++);
|
||||
addConversion(LS_FN_GREATER, val++);
|
||||
addConversion(LS_FN_LESS, val++);
|
||||
if (!release21March2013) {
|
||||
if (!afterrelease21March2013) {
|
||||
addConversion(LS_FN_EGREATER, val++);
|
||||
addConversion(LS_FN_ELESS, val++);
|
||||
}
|
||||
@@ -1371,20 +1371,17 @@ class SwitchesWarningField: public TransformedField {
|
||||
|
||||
virtual void beforeExport()
|
||||
{
|
||||
bool release21March2013 = IS_RELEASE_21_MARCH_2013(board, version);
|
||||
if (release21March2013) {
|
||||
_sw = (sw & 0xC1) + ((sw & 0x30) >> 3) + ((sw & 0x0E) << 2);
|
||||
}
|
||||
else {
|
||||
_sw = sw;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void afterImport()
|
||||
{
|
||||
bool release21March2013 = IS_RELEASE_21_MARCH_2013(board, version);
|
||||
if (release21March2013) {
|
||||
sw = (_sw & 0xC1) + ((_sw & 0x38) >> 2) + ((_sw & 0x06) << 3);
|
||||
bool afterrelease21March2013 = IS_AFTER_RELEASE_21_MARCH_2013(board, version);
|
||||
if (afterrelease21March2013 && version < 216) {
|
||||
sw = _sw >> 1;
|
||||
}
|
||||
else if (!afterrelease21March2013) {
|
||||
sw = ((_sw & 0x30) >> 4) + ((_sw & 0x0E) << 1) + ((_sw & 0xC0) >> 1);
|
||||
}
|
||||
else {
|
||||
sw = _sw;
|
||||
@@ -1784,8 +1781,8 @@ class FrskyScreenField: public DataField {
|
||||
{
|
||||
_screen = screen;
|
||||
|
||||
bool release21March2013 = IS_RELEASE_21_MARCH_2013(board, version);
|
||||
if (!release21March2013) {
|
||||
bool afterrelease21March2013 = IS_AFTER_RELEASE_21_MARCH_2013(board, version);
|
||||
if (!afterrelease21March2013) {
|
||||
for (int i=0; i<4; i++) {
|
||||
if (_screen.body.bars[i].source > 0)
|
||||
_screen.body.bars[i].source--;
|
||||
@@ -1809,12 +1806,12 @@ class FrskyScreenField: public DataField {
|
||||
{
|
||||
_screen = screen;
|
||||
|
||||
bool release21March2013 = IS_RELEASE_21_MARCH_2013(board, version);
|
||||
bool afterrelease21March2013 = IS_AFTER_RELEASE_21_MARCH_2013(board, version);
|
||||
|
||||
// NOTA: screen.type should have been imported first!
|
||||
if (screen.type == 0) {
|
||||
numbers.ImportBits(input);
|
||||
if (!release21March2013) {
|
||||
if (!afterrelease21March2013) {
|
||||
int columns=(IS_TARANIS(board) ? 3:2);
|
||||
for (int i=0; i<4; i++) {
|
||||
for (int j=0; j<columns;j++) {
|
||||
@@ -1826,7 +1823,7 @@ class FrskyScreenField: public DataField {
|
||||
}
|
||||
else {
|
||||
bars.ImportBits(input);
|
||||
if (!release21March2013) {
|
||||
if (!afterrelease21March2013) {
|
||||
for (int i=0; i<4; i++) {
|
||||
if (_screen.body.bars[i].source > 0)
|
||||
_screen.body.bars[i].source++;
|
||||
@@ -2016,9 +2013,9 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
|
||||
else
|
||||
internalField.Append(new ZCharField<10>(modelData.name));
|
||||
|
||||
bool release21March2013 = IS_RELEASE_21_MARCH_2013(board, version);
|
||||
bool afterrelease21March2013 = IS_AFTER_RELEASE_21_MARCH_2013(board, version);
|
||||
|
||||
if (release21March2013)
|
||||
if (afterrelease21March2013)
|
||||
internalField.Append(new UnsignedField<8>(modelData.modelId));
|
||||
|
||||
if (IS_TARANIS(board) && version >= 215) {
|
||||
@@ -2035,7 +2032,7 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
|
||||
internalField.Append(new SpareBitsField<4>());
|
||||
internalField.Append(new SignedField<16>(modelData.timers[i].pvalue));
|
||||
}
|
||||
else if (release21March2013) {
|
||||
else if (afterrelease21March2013) {
|
||||
internalField.Append(new UnsignedField<12>(modelData.timers[i].val));
|
||||
internalField.Append(new BoolField<1>((bool &)modelData.timers[i].countdownBeep));
|
||||
internalField.Append(new BoolField<1>(modelData.timers[i].minuteBeep));
|
||||
@@ -2077,7 +2074,7 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
|
||||
internalField.Append(new BoolField<1>(modelData.disableThrottleWarning));
|
||||
|
||||
if (IS_TARANIS(board) || (IS_ARM(board) && version >= 216))
|
||||
internalField.Append(new SpareBitsField<1>());
|
||||
internalField.Append(new BoolField<1>(modelData.displayText));
|
||||
else
|
||||
internalField.Append(new BoolField<1>(modelData.moduleData[0].ppmPulsePol));
|
||||
|
||||
@@ -2119,15 +2116,19 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
|
||||
|
||||
internalField.Append(new UnsignedField<8>(modelData.thrTraceSrc));
|
||||
|
||||
if (!release21March2013) {
|
||||
if (!afterrelease21March2013) {
|
||||
internalField.Append(new UnsignedField<8>(modelData.modelId));
|
||||
}
|
||||
|
||||
if (IS_TARANIS(board))
|
||||
internalField.Append(new UnsignedField<16>(modelData.switchWarningStates));
|
||||
internalField.Append(new SwitchesWarningField<16>(modelData.switchWarningStates, board, version));
|
||||
else
|
||||
internalField.Append(new SwitchesWarningField<8>(modelData.switchWarningStates, board, version));
|
||||
|
||||
if (version >= 216) {
|
||||
internalField.Append(new UnsignedField<8>(modelData.nSwToWarn));
|
||||
}
|
||||
|
||||
if ((board == BOARD_STOCK || (board == BOARD_M128 && version >= 215)) && (variant & GVARS_VARIANT)) {
|
||||
for (int i=0; i<MAX_GVARS(board, version); i++) {
|
||||
// on M64 GVARS are common to all phases, and there is no name
|
||||
@@ -2178,6 +2179,13 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
|
||||
}
|
||||
}
|
||||
|
||||
if (board==BOARD_SKY9X && version >= 216) {
|
||||
internalField.Append(new UnsignedField<8>(modelData.nPotsToWarn));
|
||||
for (int i=0; i < GetEepromInterface()->getCapability(Pots); i++) {
|
||||
internalField.Append(new SignedField<8>(modelData.potPosition[i]));
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_TARANIS(board)) {
|
||||
for (int i=0; i<MAX_CURVES(board, version); i++) {
|
||||
internalField.Append(new ZCharField<6>(modelData.curves[i].name));
|
||||
@@ -2189,6 +2197,10 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
|
||||
internalField.Append(new SpareBitsField<720>());
|
||||
for (int i=0; i<32; i++)
|
||||
internalField.Append(new ZCharField<4>(modelData.inputNames[i]));
|
||||
internalField.Append(new UnsignedField<8>(modelData.nPotsToWarn));
|
||||
for (int i=0; i < GetEepromInterface()->getCapability(Pots); i++) {
|
||||
internalField.Append(new SignedField<8>(modelData.potPosition[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -671,6 +671,7 @@ int Open9xInterface::getCapability(const Capability capability)
|
||||
return (IS_TARANIS(board) ? 212 : 128) ;
|
||||
case GetThrSwitch:
|
||||
return (IS_TARANIS(board) ? DSW_SF1 : DSW_THR) ;
|
||||
case HasDisplayText:
|
||||
case VirtualInputs:
|
||||
return IS_TARANIS(board) ? 32 : 0;
|
||||
case LuaInputs:
|
||||
|
||||
@@ -1829,6 +1829,9 @@ void MainWindow::createActions()
|
||||
connect(profileActs[i], SIGNAL(triggered()), this, SLOT(loadProfile()));
|
||||
}
|
||||
updateProfilesActions();
|
||||
createProfileAct = new QAction(tr("New Profile"), this);
|
||||
createProfileAct->setStatusTip(tr("Create a new Radio Setting Profile"));
|
||||
connect(createProfileAct, SIGNAL(triggered()), this, SLOT(createProfile()));
|
||||
|
||||
classicThemeAct = new QAction(tr("Classic"), this);
|
||||
classicThemeAct->setStatusTip(tr("The multicolor classical Companion icon theme"));
|
||||
@@ -1913,7 +1916,6 @@ void MainWindow::createMenus()
|
||||
|
||||
{
|
||||
QMenu *recentFileMenu=new QMenu(tr("Recent Files"));
|
||||
QMenu *profilesMenu=new QMenu(tr("Firmware Profiles"));
|
||||
QMenu *languageMenu=new QMenu(tr("Set Menu Language"));
|
||||
QMenu *themeMenu=new QMenu(tr("Set Icon Theme"));
|
||||
QMenu *iconThemeSizeMenu=new QMenu(tr("Set Icon Size"));
|
||||
@@ -1935,11 +1937,7 @@ void MainWindow::createMenus()
|
||||
fileMenu->addAction(compareAct);
|
||||
fileMenu->addSeparator();
|
||||
fileMenu->addAction(fwPreferencesAct);
|
||||
fileMenu->addMenu(profilesMenu);
|
||||
|
||||
profilesMenu->setIcon(CompanionIcon("profiles.png"));
|
||||
for (int i=0; i<MAX_PROFILES; ++i)
|
||||
profilesMenu->addAction(profileActs[i]);
|
||||
fileMenu->addMenu(createProfilesMenu());
|
||||
fileMenu->addAction(exitAct);
|
||||
|
||||
editMenu = menuBar()->addMenu(tr("&Edit"));
|
||||
@@ -2016,9 +2014,11 @@ QMenu *MainWindow::createRecentFileMenu()
|
||||
|
||||
QMenu *MainWindow::createProfilesMenu()
|
||||
{
|
||||
QMenu *profilesMenu = new QMenu(this);
|
||||
QMenu *profilesMenu=new QMenu(tr("Radio Settings Profiles"));
|
||||
for ( int i = 0; i < MAX_PROFILES; ++i)
|
||||
profilesMenu->addAction(profileActs[i]);
|
||||
profilesMenu->addAction(createProfileAct);
|
||||
profilesMenu->setIcon(CompanionIcon("profiles.png"));
|
||||
return profilesMenu;
|
||||
}
|
||||
|
||||
@@ -2199,9 +2199,11 @@ void MainWindow::updateProfilesActions()
|
||||
}
|
||||
settings.endGroup();
|
||||
}
|
||||
// separatorAct->setVisible(numRecentFiles > 0);
|
||||
}
|
||||
|
||||
void MainWindow::createProfile()
|
||||
{
|
||||
}
|
||||
|
||||
QString MainWindow::strippedName(const QString &fullFileName)
|
||||
{
|
||||
|
||||
@@ -150,6 +150,7 @@ private slots:
|
||||
void appPreferences();
|
||||
void fwPreferences();
|
||||
void updateMenus();
|
||||
void createProfile();
|
||||
MdiChild *createMdiChild();
|
||||
void setActiveSubWindow(QWidget *window);
|
||||
QMenu * createRecentFileMenu();
|
||||
@@ -252,6 +253,7 @@ private:
|
||||
QAction *logsAct;
|
||||
QAction *recentFileActs[MAX_RECENT];
|
||||
QAction *profileActs[MAX_PROFILES];
|
||||
QAction *createProfileAct;
|
||||
QAction *classicThemeAct;
|
||||
QAction *monoThemeAct;
|
||||
QAction *monoBlueThemeAct;
|
||||
|
||||
@@ -392,6 +392,10 @@ Setup::Setup(QWidget *parent, ModelData & model):
|
||||
ui->modelImage_label->hide();
|
||||
ui->imagePreview->hide();
|
||||
}
|
||||
|
||||
if (!GetEepromInterface()->getCapability(HasDisplayText)) {
|
||||
ui->displayText->hide();
|
||||
}
|
||||
|
||||
// Beep Center checkboxes
|
||||
int analogs = 4 + GetEepromInterface()->getCapability(Pots);
|
||||
@@ -403,14 +407,12 @@ Setup::Setup(QWidget *parent, ModelData & model):
|
||||
connect(checkbox, SIGNAL(toggled(bool)), this, SLOT(onBeepCenterToggled(bool)));
|
||||
centerBeepCheckboxes << checkbox;
|
||||
}
|
||||
ui->switchesStartupLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, analogs+GetEepromInterface()->getCapability(RotaryEncoders));
|
||||
|
||||
// Startup switches warnings
|
||||
ui->switchesStartupWarning->setProperty("index", 0);
|
||||
connect(ui->switchesStartupWarning, SIGNAL(currentIndexChanged(int)), this, SLOT(startupSwitchEdited(int)));
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(Switches)-1; i++) {
|
||||
QLabel * label = new QLabel();
|
||||
QSlider * slider = new QSlider();
|
||||
QLabel * label = new QLabel(this);
|
||||
QSlider * slider = new QSlider(this);
|
||||
QCheckBox * cb = new QCheckBox(this);
|
||||
slider->setProperty("index", i+1);
|
||||
slider->setOrientation(Qt::Vertical);
|
||||
slider->setMinimum(0);
|
||||
@@ -429,13 +431,35 @@ Setup::Setup(QWidget *parent, ModelData & model):
|
||||
label->setText(switches9X[i]);
|
||||
slider->setMaximum(i==0 ? 2 : 1);
|
||||
}
|
||||
cb->setProperty("index", i+1);
|
||||
ui->switchesStartupLayout->addWidget(label, 0, i+1);
|
||||
ui->switchesStartupLayout->setAlignment(label, Qt::AlignCenter);
|
||||
ui->switchesStartupLayout->addWidget(slider, 1, i+1);
|
||||
ui->switchesStartupLayout->setAlignment(slider, Qt::AlignCenter);
|
||||
ui->switchesStartupLayout->addWidget(cb, 2, i+1);
|
||||
ui->switchesStartupLayout->setAlignment(cb, Qt::AlignCenter);
|
||||
connect(slider, SIGNAL(valueChanged(int)), this, SLOT(startupSwitchEdited(int)));
|
||||
connect(cb, SIGNAL(toggled(bool)), this, SLOT(startupSwitchToggled(bool)));
|
||||
startupSwitchesSliders << slider;
|
||||
startupSwitchesCheckboxes << cb;
|
||||
}
|
||||
ui->switchesStartupLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, GetEepromInterface()->getCapability(Switches));
|
||||
|
||||
// Pot warnings
|
||||
if(IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(Pots); i++) {
|
||||
QCheckBox * cb = new QCheckBox(this);
|
||||
cb->setProperty("index", i+1);
|
||||
cb->setText(AnalogString(i+4));
|
||||
ui->potWarningLayout->addWidget(cb, 0, i+1);
|
||||
connect(cb, SIGNAL(toggled(bool)), this, SLOT(potWarningToggled(bool)));
|
||||
potWarningCheckboxes << cb;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ui->label_potWarning->hide();
|
||||
ui->potWarningMode->hide();
|
||||
}
|
||||
lock = false;
|
||||
}
|
||||
|
||||
@@ -533,9 +557,14 @@ void Setup::update()
|
||||
ui->throttleTrim->setChecked(model.thrTrim);
|
||||
ui->extendedLimits->setChecked(model.extendedLimits);
|
||||
ui->extendedTrims->setChecked(model.extendedTrims);
|
||||
ui->displayText->setChecked(model.displayText);
|
||||
|
||||
updateBeepCenter();
|
||||
updateStartupSwitches();
|
||||
|
||||
if(IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
updatePotWarnings();
|
||||
}
|
||||
|
||||
for (int i=0; i<C9X_MAX_TIMERS; i++)
|
||||
timers[i]->update();
|
||||
@@ -557,13 +586,13 @@ void Setup::updateStartupSwitches()
|
||||
lock = true;
|
||||
|
||||
unsigned int switchStates = model.switchWarningStates;
|
||||
bool enabled = !(switchStates & 0x01);
|
||||
ui->switchesStartupWarning->setCurrentIndex(switchStates & 0x01);
|
||||
switchStates >>= 1;
|
||||
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(Switches)-1; i++) {
|
||||
QSlider * slider = startupSwitchesSliders[i];
|
||||
QCheckBox * cb = startupSwitchesCheckboxes[i];
|
||||
bool enabled = !(model.nSwToWarn & (1 << i));
|
||||
slider->setEnabled(enabled);
|
||||
cb->setChecked(enabled);
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
slider->setValue(i==5 ? (switchStates & 0x3)/2 : switchStates & 0x3);
|
||||
switchStates >>= 2;
|
||||
@@ -584,36 +613,31 @@ void Setup::startupSwitchEdited(int value)
|
||||
unsigned int mask;
|
||||
int index = sender()->property("index").toInt();
|
||||
|
||||
if (index == 0) {
|
||||
mask = 0x01;
|
||||
}
|
||||
else if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
if (index == 6)
|
||||
mask = 0x02 << (index*2 - 1);
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
if (index == 6) {
|
||||
shift = (index - 1) * 2;
|
||||
mask = 0x02 << shift;
|
||||
shift++;
|
||||
}
|
||||
else {
|
||||
shift = index*2 - 1;
|
||||
shift = (index - 1) * 2;
|
||||
mask = 0x03 << shift;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (index == 1) {
|
||||
shift = 1;
|
||||
mask = 0x03 << shift;
|
||||
mask = 0x03;
|
||||
}
|
||||
else {
|
||||
mask = 0x01 << (index+1);
|
||||
shift = index;
|
||||
mask = 0x01 << shift;
|
||||
}
|
||||
}
|
||||
|
||||
model.switchWarningStates &= ~mask;
|
||||
|
||||
if (value) {
|
||||
if (shift == 0) {
|
||||
model.switchWarningStates |= mask;
|
||||
}
|
||||
else {
|
||||
model.switchWarningStates |= (value << shift);
|
||||
}
|
||||
model.switchWarningStates |= (value << shift);
|
||||
}
|
||||
|
||||
updateStartupSwitches();
|
||||
@@ -621,6 +645,72 @@ void Setup::startupSwitchEdited(int value)
|
||||
}
|
||||
}
|
||||
|
||||
void Setup::startupSwitchToggled(bool checked)
|
||||
{
|
||||
if (!lock) {
|
||||
int index = sender()->property("index").toInt()-1;
|
||||
|
||||
if (checked)
|
||||
model.nSwToWarn &= ~(1 << index);
|
||||
else
|
||||
model.nSwToWarn |= (1 << index);
|
||||
|
||||
updateStartupSwitches();
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void Setup::updatePotWarnings()
|
||||
{
|
||||
lock = true;
|
||||
int mode = model.nPotsToWarn >> 6;
|
||||
ui->potWarningMode->setCurrentIndex(mode);
|
||||
|
||||
if (mode == 0)
|
||||
model.nPotsToWarn = 0x3F;
|
||||
|
||||
for (int i=0; i<potWarningCheckboxes.size(); i++) {
|
||||
bool enabled = !(model.nPotsToWarn & (1 << i));
|
||||
|
||||
potWarningCheckboxes[i]->setChecked(enabled);
|
||||
potWarningCheckboxes[i]->setDisabled(mode == 0);
|
||||
}
|
||||
lock = false;
|
||||
}
|
||||
|
||||
void Setup::potWarningToggled(bool checked)
|
||||
{
|
||||
if (!lock) {
|
||||
int index = sender()->property("index").toInt()-1;
|
||||
|
||||
if(checked)
|
||||
model.nPotsToWarn &= ~(1 << index);
|
||||
else
|
||||
model.nPotsToWarn |= (1 << index);
|
||||
|
||||
updatePotWarnings();
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void Setup::on_potWarningMode_currentIndexChanged(int index)
|
||||
{
|
||||
if (!lock) {
|
||||
int mask = 0xC0;
|
||||
model.nPotsToWarn = model.nPotsToWarn & ~mask;
|
||||
model.nPotsToWarn = model.nPotsToWarn | ((index << 6) & mask);
|
||||
|
||||
updatePotWarnings();
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void Setup::on_displayText_toggled(bool checked)
|
||||
{
|
||||
model.displayText = checked;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void Setup::on_throttleTrim_toggled(bool checked)
|
||||
{
|
||||
model.thrTrim = checked;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <QCheckBox>
|
||||
#include <QSlider>
|
||||
#include <QSpinBox>
|
||||
#include <QLabel>
|
||||
|
||||
namespace Ui {
|
||||
class Setup;
|
||||
@@ -82,19 +83,26 @@ class Setup : public ModelPanel
|
||||
void on_extendedTrims_toggled(bool checked);
|
||||
void on_throttleWarning_toggled(bool checked);
|
||||
void on_throttleReverse_toggled(bool checked);
|
||||
void on_displayText_toggled(bool checked);
|
||||
void on_image_currentIndexChanged(int index);
|
||||
void on_trimIncrement_currentIndexChanged(int index);
|
||||
void onBeepCenterToggled(bool checked);
|
||||
void startupSwitchEdited(int value);
|
||||
void startupSwitchToggled(bool checked);
|
||||
void potWarningToggled(bool checked);
|
||||
void on_potWarningMode_currentIndexChanged(int index);
|
||||
void onChildModified();
|
||||
|
||||
private:
|
||||
Ui::Setup *ui;
|
||||
QVector<QSlider *> startupSwitchesSliders;
|
||||
QVector<QCheckBox *> startupSwitchesCheckboxes;
|
||||
QVector<QCheckBox *> potWarningCheckboxes;
|
||||
QVector<QCheckBox *> centerBeepCheckboxes;
|
||||
ModulePanel * modules[C9X_NUM_MODULES+1];
|
||||
TimerPanel * timers[C9X_MAX_TIMERS];
|
||||
void updateStartupSwitches();
|
||||
void updatePotWarnings();
|
||||
void updateBeepCenter();
|
||||
};
|
||||
|
||||
|
||||
+156
-130
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>782</width>
|
||||
<height>334</height>
|
||||
<width>787</width>
|
||||
<height>727</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -16,134 +16,6 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Model Name</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_timer2">
|
||||
<property name="text">
|
||||
<string>Timer2</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Timer1</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_ttrace">
|
||||
<property name="text">
|
||||
<string>Throttle Source</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="swwarn_label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Switch startup Warning</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Center beep</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<layout class="QGridLayout" name="centerBeepLayout"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Trim Increment</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<layout class="QGridLayout" name="switchesStartupLayout" rowstretch="0,0" columnstretch="0">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QComboBox" name="switchesStartupWarning">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ON</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>OFF</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="switchesStartupWarning_Label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Check</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QGridLayout" name="gridLayout_37" columnstretch="0,0,0,0,0,0">
|
||||
<item row="0" column="3">
|
||||
@@ -231,6 +103,85 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Model Name</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_timer2">
|
||||
<property name="text">
|
||||
<string>Timer2</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Timer1</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_ttrace">
|
||||
<property name="text">
|
||||
<string>Throttle Source</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="swwarn_label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Switch Warnings</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Center beep</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<layout class="QGridLayout" name="centerBeepLayout"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Trim Increment</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
@@ -288,6 +239,29 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="displayText">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Display Checklist</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
@@ -353,6 +327,58 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<layout class="QGridLayout" name="switchesStartupLayout" rowstretch="0" columnstretch="0">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_potWarning">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Pot Warnings</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<layout class="QGridLayout" name="potWarningLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="potWarningMode">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>OFF</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Manual</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Auto</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
Reference in New Issue
Block a user