Issue #854 fixed

This commit is contained in:
bsongis
2014-03-25 17:31:18 +01:00
parent b05c3e3476
commit 1fd305b5b7
2 changed files with 27 additions and 35 deletions
+11 -18
View File
@@ -28,10 +28,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model):
// The label // The label
QLabel * label = new QLabel(this); QLabel * label = new QLabel(this);
label->setProperty("index", i); label->setProperty("index", i);
if (i < 9) label->setText(tr("L%1").arg(i+1));
label->setText(tr("LS%1").arg(i+1));
else
label->setText(tr("LS%1").arg(QChar('A'+i-9)));
label->setContextMenuPolicy(Qt::CustomContextMenu); label->setContextMenuPolicy(Qt::CustomContextMenu);
label->setMouseTracking(true); label->setMouseTracking(true);
connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(csw_customContextMenuRequested(QPoint))); connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(csw_customContextMenuRequested(QPoint)));
@@ -333,12 +330,11 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
lock = false; lock = false;
} }
void LogicalSwitchesPanel::update() void LogicalSwitchesPanel::updateLine(int i)
{ {
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
lock = true; lock = true;
populateCSWCB(csw[i], model.customSw[i].func); populateCSWCB(csw[i], model.customSw[i].func);
lock = false; lock = true;
setSwitchWidgetVisibility(i); setSwitchWidgetVisibility(i);
lock = true; lock = true;
populateAndSwitchCB(cswitchAnd[i], RawSwitch(model.customSw[i].andsw)); populateAndSwitchCB(cswitchAnd[i], RawSwitch(model.customSw[i].andsw));
@@ -347,6 +343,12 @@ void LogicalSwitchesPanel::update()
cswitchDelay[i]->setValue(model.customSw[i].delay/10.0); cswitchDelay[i]->setValue(model.customSw[i].delay/10.0);
} }
lock = false; lock = false;
}
void LogicalSwitchesPanel::update()
{
for (int i=0; i<GetEepromInterface()->getCapability(LogicalSwitches); i++) {
updateLine(i);
} }
} }
@@ -356,11 +358,10 @@ void LogicalSwitchesPanel::cswPaste()
const QMimeData *mimeData = clipboard->mimeData(); const QMimeData *mimeData = clipboard->mimeData();
if (mimeData->hasFormat("application/x-companion-csw")) { if (mimeData->hasFormat("application/x-companion-csw")) {
QByteArray cswData = mimeData->data("application/x-companion-csw"); QByteArray cswData = mimeData->data("application/x-companion-csw");
LogicalSwitchData *csw = &model.customSw[selectedSwitch]; LogicalSwitchData *csw = &model.customSw[selectedSwitch];
memcpy(csw, cswData.mid(0, sizeof(LogicalSwitchData)).constData(), sizeof(LogicalSwitchData)); memcpy(csw, cswData.mid(0, sizeof(LogicalSwitchData)).constData(), sizeof(LogicalSwitchData));
emit modified(); emit modified();
updateSelectedSwitch(); updateLine(selectedSwitch);
} }
} }
@@ -368,7 +369,7 @@ void LogicalSwitchesPanel::cswDelete()
{ {
model.customSw[selectedSwitch].clear(); model.customSw[selectedSwitch].clear();
emit modified(); emit modified();
updateSelectedSwitch(); updateLine(selectedSwitch);
} }
void LogicalSwitchesPanel::cswCopy() void LogicalSwitchesPanel::cswCopy()
@@ -380,14 +381,6 @@ void LogicalSwitchesPanel::cswCopy()
QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard); QApplication::clipboard()->setMimeData(mimeData,QClipboard::Clipboard);
} }
void LogicalSwitchesPanel::updateSelectedSwitch()
{
lock = true;
populateCSWCB(csw[selectedSwitch], model.customSw[selectedSwitch].func);
setSwitchWidgetVisibility(selectedSwitch);
lock = false;
}
void LogicalSwitchesPanel::cswCut() void LogicalSwitchesPanel::cswCut()
{ {
cswCopy(); cswCopy();
+1 -2
View File
@@ -41,8 +41,7 @@ class LogicalSwitchesPanel : public ModelPanel
void setSwitchWidgetVisibility(int i); void setSwitchWidgetVisibility(int i);
int selectedSwitch; int selectedSwitch;
void updateSelectedSwitch(); void updateLine(int index);
void updateV2(int index);
void updateTimerParam(QDoubleSpinBox *sb, int timer, bool allowZero=false); void updateTimerParam(QDoubleSpinBox *sb, int timer, bool allowZero=false);
}; };