Skip to content

Commit

Permalink
Joining mix slots with mix slots - AntiMicroX#93
Browse files Browse the repository at this point in the history
  • Loading branch information
juliagoda committed Mar 20, 2020
1 parent 175ee7e commit 722b596
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 6 deletions.
34 changes: 33 additions & 1 deletion src/advancebuttondialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ AdvanceButtonDialog::AdvanceButtonDialog(JoyButton *button, QWidget *parent) :

while (iter.hasNext())
{

JoyButtonSlot *buttonslot = iter.next();
qDebug() << "slot string for grab btn is: " << buttonslot->getSlotString();
SimpleKeyGrabberButton *existingCode = new SimpleKeyGrabberButton(this);
existingCode->setText(buttonslot->getSlotString());

Expand Down Expand Up @@ -121,6 +123,27 @@ AdvanceButtonDialog::AdvanceButtonDialog(JoyButton *button, QWidget *parent) :

break;

// JoyMix
case 15:

qDebug() << "text data for joy mix is: " << buttonslot->getTextData();
qDebug() << "slot string for joy mix is: " << buttonslot->getSlotString();
qDebug() << "amount of mini slots: " << buttonslot->getMixSlots()->count();

if (!buttonslot->getTextData().isEmpty())
{
existingCode->setValues(buttonslot->getTextData(), buttonslot->getMixSlots(), JoyButtonSlot::JoySlotInputAction::JoyMix);
existingCode->setToolTip(buttonslot->getTextData());

// try again
if (existingCode->text() == tr("[NO KEY]"))
existingCode->setText(buttonslot->getSlotString());

qDebug() << "Existing code for Joy Mix: " << existingCode->text();
}

break;

default:

existingCode->setValue(buttonslot->getSlotCode(),
Expand Down Expand Up @@ -556,7 +579,16 @@ void AdvanceButtonDialog::joinSlot()

QListWidgetItem* it = new QListWidgetItem(*item);
SimpleKeyGrabberButton* firstGrabBtn = it->data(Qt::UserRole).value<SimpleKeyGrabberButton*>();
joinedBtnSlots->append(firstGrabBtn->getValue());

if (firstGrabBtn->getValue()->getMixSlots()->count() > 0)
{
joinedBtnSlots->append(*firstGrabBtn->getValue()->getMixSlots());
}
else
{
joinedBtnSlots->append(firstGrabBtn->getValue());
}

text += firstGrabBtn->getValue()->getSlotString();
}

Expand Down
8 changes: 4 additions & 4 deletions src/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,8 @@ QString keycodeToKeyString(int keycode, int alias)

Q_UNUSED(alias)

qDebug() << "keycode is: " << keycode;

if (keycode <= 0)
{
newkey = "[NO KEY]";
Expand Down Expand Up @@ -651,10 +653,8 @@ QString keycodeToKeyString(int keycode, int alias)
tempstring[numchars] = '\0';
newkey = QString::fromUtf8(tempstring);


qDebug() << "NEWKEY:" << newkey << endl;
qDebug() << "NEWKEY LEGNTH:" << numchars << endl;

qDebug() << "NEWKEY:" << newkey << endl;
qDebug() << "NEWKEY LEGNTH:" << numchars << endl;
}
else
{
Expand Down
4 changes: 4 additions & 0 deletions src/joybutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1589,11 +1589,14 @@ QString JoyButton::getName(bool forceFullFormat, bool displayNames)
qInstallMessageHandler(MessageHandler::myMessageOutput);

QString newlabel = getPartialName(forceFullFormat, displayNames);
qDebug() << "partial name is: " << newlabel;
newlabel.append(": ");

qDebug() << "actionName is " << actionName;
if (!actionName.isEmpty() && displayNames) newlabel.append(actionName);
else newlabel.append(getCalculatedActiveZoneSummary());

qDebug() << "name in getName(bool forceFullFormat, bool displayNames) is now: " << newlabel;
return newlabel;
}

Expand Down Expand Up @@ -1696,6 +1699,7 @@ void JoyButton::buildActiveZoneSummaryString()
qInstallMessageHandler(MessageHandler::myMessageOutput);

lockForWritedString(activeZoneString, getActiveZoneSummary());
qDebug() << "activeZoneString after getActiveZoneSummary() is: " << activeZoneString;
emit activeZoneChanged();
}

Expand Down
5 changes: 4 additions & 1 deletion src/joybuttonslot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,9 @@ QString JoyButtonSlot::getSlotString()

QString newlabel = QString();

if (deviceCode >= 0)
qDebug() << "deviceCode in getSlotString() is: " << deviceCode << " for mode: " << m_mode;

if (deviceCode >= 0 || m_mode == JoyButtonSlot::JoyMix)
{
switch(m_mode)
{
Expand Down Expand Up @@ -448,6 +450,7 @@ QString JoyButtonSlot::getSlotString()
{
if (!m_textData.isEmpty())
{
qDebug() << "append label for Joy mix: " << m_textData;
newlabel.append(tr("%1").arg(m_textData));
}
else
Expand Down
1 change: 1 addition & 0 deletions src/keyboard/virtualkeypushbutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ QString VirtualKeyPushButton::setDisplayString(QString xcodestring)
qInstallMessageHandler(MessageHandler::myMessageOutput);

QString temp = QString();

if (knownAliases.contains(xcodestring))
{
temp = knownAliases.value(xcodestring);
Expand Down
2 changes: 2 additions & 0 deletions src/simplekeygrabberbutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ bool SimpleKeyGrabberButton::eventFilter(QObject *obj, QEvent *event)
controlcode = tempcode;
bool valueUpdated = false;

qDebug() << "slot string for simple key grab button is: " << buttonslot.getSlotString();

if ((keyEve->modifiers() & Qt::ControlModifier) && (keyEve->key() == Qt::Key_X))
{
controlcode = 0;
Expand Down

0 comments on commit 722b596

Please sign in to comment.