Fix minor compiler warning in mdichild.cpp, and some cleanup in eeprominterface.cpp.
This commit is contained in:
@@ -1055,17 +1055,17 @@ bool GeneralSettings::switchPositionAllowedTaranis(int index) const
|
|||||||
if (index == 0)
|
if (index == 0)
|
||||||
return true;
|
return true;
|
||||||
SwitchInfo info = switchInfoFromSwitchPositionTaranis(abs(index));
|
SwitchInfo info = switchInfoFromSwitchPositionTaranis(abs(index));
|
||||||
if (index < 0 && switchConfig[info.index] != GeneralSettings::SWITCH_3POS)
|
if (index < 0 && switchConfig[info.index] != SWITCH_3POS)
|
||||||
return false;
|
return false;
|
||||||
else if (info.position == 1)
|
else if (info.position == 1)
|
||||||
return switchConfig[info.index] == GeneralSettings::SWITCH_3POS;
|
return switchConfig[info.index] == SWITCH_3POS;
|
||||||
else
|
else
|
||||||
return switchConfig[info.index] != GeneralSettings::SWITCH_NONE;
|
return switchConfig[info.index] != SWITCH_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GeneralSettings::switchSourceAllowedTaranis(int index) const
|
bool GeneralSettings::switchSourceAllowedTaranis(int index) const
|
||||||
{
|
{
|
||||||
return switchConfig[index] != GeneralSettings::SWITCH_NONE;
|
return switchConfig[index] != SWITCH_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GeneralSettings::isPotAvailable(int index) const
|
bool GeneralSettings::isPotAvailable(int index) const
|
||||||
|
|||||||
+15
-15
@@ -58,7 +58,7 @@ MdiChild::MdiChild(MainWindow * parent):
|
|||||||
connect(ui->modelsList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(openModelEditWindow()));
|
connect(ui->modelsList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(openModelEditWindow()));
|
||||||
connect(ui->modelsList, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showModelsListContextMenu(const QPoint &)));
|
connect(ui->modelsList, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showModelsListContextMenu(const QPoint &)));
|
||||||
// connect(ui->modelsList, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(onCurrentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
|
// connect(ui->modelsList, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(onCurrentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
|
||||||
|
|
||||||
ui->modelsList->setContextMenuPolicy(Qt::CustomContextMenu);
|
ui->modelsList->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
ui->modelsList->setSelectionBehavior(QAbstractItemView::SelectRows);
|
ui->modelsList->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
ui->modelsList->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
ui->modelsList->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
@@ -66,7 +66,7 @@ MdiChild::MdiChild(MainWindow * parent):
|
|||||||
// ui->modelsList->setAcceptDrops(true);
|
// ui->modelsList->setAcceptDrops(true);
|
||||||
// ui->modelsList->setDragDropOverwriteMode(true);
|
// ui->modelsList->setDragDropOverwriteMode(true);
|
||||||
// ui->modelsList->setDropIndicatorShown(true);
|
// ui->modelsList->setDropIndicatorShown(true);
|
||||||
|
|
||||||
if (!(isMaximized() || isMinimized())) {
|
if (!(isMaximized() || isMinimized())) {
|
||||||
adjustSize();
|
adjustSize();
|
||||||
}
|
}
|
||||||
@@ -148,7 +148,7 @@ void MdiChild::showModelsListContextMenu(const QPoint & pos)
|
|||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
contextMenu.exec(globalPos);
|
contextMenu.exec(globalPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,10 +190,10 @@ void MdiChild::copy()
|
|||||||
{
|
{
|
||||||
QByteArray gmData;
|
QByteArray gmData;
|
||||||
doCopy(&gmData);
|
doCopy(&gmData);
|
||||||
|
|
||||||
QMimeData * mimeData = new QMimeData;
|
QMimeData * mimeData = new QMimeData;
|
||||||
mimeData->setData("application/x-companion", gmData);
|
mimeData->setData("application/x-companion", gmData);
|
||||||
|
|
||||||
QClipboard * clipboard = QApplication::clipboard();
|
QClipboard * clipboard = QApplication::clipboard();
|
||||||
clipboard->setMimeData(mimeData, QClipboard::Clipboard);
|
clipboard->setMimeData(mimeData, QClipboard::Clipboard);
|
||||||
}
|
}
|
||||||
@@ -220,7 +220,7 @@ void MdiChild::doPaste(QByteArray * gmData, int index)
|
|||||||
char * gData = gmData->data();
|
char * gData = gmData->data();
|
||||||
bool modified = false;
|
bool modified = false;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
|
||||||
while (size < gmData->size()) {
|
while (size < gmData->size()) {
|
||||||
char c = *gData++;
|
char c = *gData++;
|
||||||
size++;
|
size++;
|
||||||
@@ -358,7 +358,7 @@ void MdiChild::categoryDelete()
|
|||||||
if (categoryIndex < 0 || categoryIndex >= (int)radioData.categories.size()) {
|
if (categoryIndex < 0 || categoryIndex >= (int)radioData.categories.size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i=0; i<radioData.models.size(); i++) {
|
for (unsigned i=0; i<radioData.models.size(); i++) {
|
||||||
ModelData & model = radioData.models[i];
|
ModelData & model = radioData.models[i];
|
||||||
if (model.used && model.category == categoryIndex) {
|
if (model.used && model.category == categoryIndex) {
|
||||||
@@ -368,7 +368,7 @@ void MdiChild::categoryDelete()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
radioData.categories.erase(radioData.categories.begin() + categoryIndex);
|
radioData.categories.erase(radioData.categories.begin() + categoryIndex);
|
||||||
for (unsigned i=0; i<radioData.models.size(); i++) {
|
for (unsigned i=0; i<radioData.models.size(); i++) {
|
||||||
ModelData & model = radioData.models[i];
|
ModelData & model = radioData.models[i];
|
||||||
@@ -376,7 +376,7 @@ void MdiChild::categoryDelete()
|
|||||||
model.category--;
|
model.category--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setModified();
|
setModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,11 +401,11 @@ void MdiChild::modelAdd()
|
|||||||
if (categoryIndex < 0 || categoryIndex >= (int)radioData.categories.size()) {
|
if (categoryIndex < 0 || categoryIndex >= (int)radioData.categories.size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelData model;
|
ModelData model;
|
||||||
model.category = categoryIndex;
|
model.category = categoryIndex;
|
||||||
model.used = true;
|
model.used = true;
|
||||||
sprintf(model.filename, "model%lu.bin", radioData.models.size()+1);
|
sprintf(model.filename, "model%lu.bin", (long unsigned)radioData.models.size()+1);
|
||||||
strcpy(model.name, tr("New model").toStdString().c_str());
|
strcpy(model.name, tr("New model").toStdString().c_str());
|
||||||
radioData.models.push_back(model);
|
radioData.models.push_back(model);
|
||||||
radioData.setCurrentModel(radioData.models.size() - 1);
|
radioData.setCurrentModel(radioData.models.size() - 1);
|
||||||
@@ -539,11 +539,11 @@ bool MdiChild::saveFile(const QString & filename, bool setCurrent)
|
|||||||
if (IS_SKY9X(board)) {
|
if (IS_SKY9X(board)) {
|
||||||
path.replace(".eepe", ".bin");
|
path.replace(".eepe", ".bin");
|
||||||
}
|
}
|
||||||
|
|
||||||
radioData.fixModelFilenames();
|
radioData.fixModelFilenames();
|
||||||
Storage storage(path);
|
Storage storage(path);
|
||||||
bool result = storage.write(radioData);
|
bool result = storage.write(radioData);
|
||||||
|
|
||||||
if (result && setCurrent) {
|
if (result && setCurrent) {
|
||||||
setCurrentFile(path);
|
setCurrentFile(path);
|
||||||
}
|
}
|
||||||
@@ -688,7 +688,7 @@ bool MdiChild::loadBackup()
|
|||||||
QMessageBox::critical(this, tr("Error"), tr("Unable to find file %1!").arg(fileName));
|
QMessageBox::critical(this, tr("Error"), tr("Unable to find file %1!").arg(fileName));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO int index = getCurrentRow();
|
// TODO int index = getCurrentRow();
|
||||||
|
|
||||||
int eeprom_size = file.size();
|
int eeprom_size = file.size();
|
||||||
@@ -711,7 +711,7 @@ bool MdiChild::loadBackup()
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
std::bitset<NUM_ERRORS> errorsEeprom((unsigned long long)LoadBackup(radioData, (uint8_t *)eeprom.data(), eeprom_size, index));
|
std::bitset<NUM_ERRORS> errorsEeprom((unsigned long long)LoadBackup(radioData, (uint8_t *)eeprom.data(), eeprom_size, index));
|
||||||
if (!errorsEeprom.test(ALL_OK)) {
|
if (!errorsEeprom.test(ALL_OK)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user