improve Window Associations UI/UX

This commit is contained in:
thez3ro 2018-01-19 00:50:22 +01:00
parent 12a4b9aaa3
commit ba4ef52e9e
No known key found for this signature in database
GPG Key ID: F628F9E41DD7C073
2 changed files with 10 additions and 23 deletions

View File

@ -170,8 +170,7 @@ void EditEntryWidget::setupAutoType()
m_autoTypeDefaultSequenceGroup->addButton(m_autoTypeUi->inheritSequenceButton); m_autoTypeDefaultSequenceGroup->addButton(m_autoTypeUi->inheritSequenceButton);
m_autoTypeDefaultSequenceGroup->addButton(m_autoTypeUi->customSequenceButton); m_autoTypeDefaultSequenceGroup->addButton(m_autoTypeUi->customSequenceButton);
m_autoTypeWindowSequenceGroup->addButton(m_autoTypeUi->defaultWindowSequenceButton); //m_autoTypeWindowSequenceGroup->addButton(m_autoTypeUi->customWindowSequenceButton);
m_autoTypeWindowSequenceGroup->addButton(m_autoTypeUi->customWindowSequenceButton);
m_autoTypeAssocModel->setAutoTypeAssociations(m_autoTypeAssoc); m_autoTypeAssocModel->setAutoTypeAssociations(m_autoTypeAssoc);
m_autoTypeUi->assocView->setModel(m_autoTypeAssocModel); m_autoTypeUi->assocView->setModel(m_autoTypeAssocModel);
m_autoTypeUi->assocView->setColumnHidden(1, true); m_autoTypeUi->assocView->setColumnHidden(1, true);
@ -190,8 +189,6 @@ void EditEntryWidget::setupAutoType()
connect(m_autoTypeAssocModel, SIGNAL(modelReset()), SLOT(clearCurrentAssoc())); connect(m_autoTypeAssocModel, SIGNAL(modelReset()), SLOT(clearCurrentAssoc()));
connect(m_autoTypeUi->windowTitleCombo, SIGNAL(editTextChanged(QString)), connect(m_autoTypeUi->windowTitleCombo, SIGNAL(editTextChanged(QString)),
SLOT(applyCurrentAssoc())); SLOT(applyCurrentAssoc()));
connect(m_autoTypeUi->defaultWindowSequenceButton, SIGNAL(toggled(bool)),
SLOT(applyCurrentAssoc()));
connect(m_autoTypeUi->windowSequenceEdit, SIGNAL(textChanged(QString)), connect(m_autoTypeUi->windowSequenceEdit, SIGNAL(textChanged(QString)),
SLOT(applyCurrentAssoc())); SLOT(applyCurrentAssoc()));
} }
@ -644,7 +641,7 @@ void EditEntryWidget::setForms(const Entry* entry, bool restore)
} }
m_autoTypeUi->sequenceEdit->setText(entry->effectiveAutoTypeSequence()); m_autoTypeUi->sequenceEdit->setText(entry->effectiveAutoTypeSequence());
m_autoTypeUi->windowTitleCombo->lineEdit()->clear(); m_autoTypeUi->windowTitleCombo->lineEdit()->clear();
m_autoTypeUi->defaultWindowSequenceButton->setChecked(true); m_autoTypeUi->customWindowSequenceButton->setChecked(false);
m_autoTypeUi->windowSequenceEdit->setText(""); m_autoTypeUi->windowSequenceEdit->setText("");
m_autoTypeAssoc->copyDataFrom(entry->autoTypeAssociations()); m_autoTypeAssoc->copyDataFrom(entry->autoTypeAssociations());
m_autoTypeAssocModel->setEntry(entry); m_autoTypeAssocModel->setEntry(entry);
@ -998,7 +995,6 @@ void EditEntryWidget::updateAutoTypeEnabled()
m_autoTypeUi->windowTitleLabel->setEnabled(autoTypeEnabled && validIndex); m_autoTypeUi->windowTitleLabel->setEnabled(autoTypeEnabled && validIndex);
m_autoTypeUi->windowTitleCombo->setEnabled(autoTypeEnabled && validIndex); m_autoTypeUi->windowTitleCombo->setEnabled(autoTypeEnabled && validIndex);
m_autoTypeUi->defaultWindowSequenceButton->setEnabled(!m_history && autoTypeEnabled && validIndex);
m_autoTypeUi->customWindowSequenceButton->setEnabled(!m_history && autoTypeEnabled && validIndex); m_autoTypeUi->customWindowSequenceButton->setEnabled(!m_history && autoTypeEnabled && validIndex);
m_autoTypeUi->windowSequenceEdit->setEnabled(autoTypeEnabled && validIndex m_autoTypeUi->windowSequenceEdit->setEnabled(autoTypeEnabled && validIndex
&& m_autoTypeUi->customWindowSequenceButton->isChecked()); && m_autoTypeUi->customWindowSequenceButton->isChecked());
@ -1029,16 +1025,15 @@ void EditEntryWidget::loadCurrentAssoc(const QModelIndex& current)
AutoTypeAssociations::Association assoc = m_autoTypeAssoc->get(current.row()); AutoTypeAssociations::Association assoc = m_autoTypeAssoc->get(current.row());
m_autoTypeUi->windowTitleCombo->setEditText(assoc.window); m_autoTypeUi->windowTitleCombo->setEditText(assoc.window);
if (assoc.sequence.isEmpty()) { if (assoc.sequence.isEmpty()) {
m_autoTypeUi->defaultWindowSequenceButton->setChecked(true); m_autoTypeUi->customWindowSequenceButton->setChecked(false);
} m_autoTypeUi->windowSequenceEdit->setText(m_entry->effectiveAutoTypeSequence());
else { } else {
m_autoTypeUi->customWindowSequenceButton->setChecked(true); m_autoTypeUi->customWindowSequenceButton->setChecked(true);
m_autoTypeUi->windowSequenceEdit->setText(assoc.sequence);
} }
m_autoTypeUi->windowSequenceEdit->setText(assoc.sequence);
updateAutoTypeEnabled(); updateAutoTypeEnabled();
} } else {
else {
clearCurrentAssoc(); clearCurrentAssoc();
} }
} }
@ -1047,7 +1042,7 @@ void EditEntryWidget::clearCurrentAssoc()
{ {
m_autoTypeUi->windowTitleCombo->setEditText(""); m_autoTypeUi->windowTitleCombo->setEditText("");
m_autoTypeUi->defaultWindowSequenceButton->setChecked(true); m_autoTypeUi->customWindowSequenceButton->setChecked(false);
m_autoTypeUi->windowSequenceEdit->setText(""); m_autoTypeUi->windowSequenceEdit->setText("");
updateAutoTypeEnabled(); updateAutoTypeEnabled();

View File

@ -203,16 +203,9 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QRadioButton" name="defaultWindowSequenceButton"> <widget class="QCheckBox" name="customWindowSequenceButton">
<property name="text"> <property name="text">
<string>Use default se&amp;quence</string> <string>Use a specific sequence for this association:</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="customWindowSequenceButton">
<property name="text">
<string>Set custo&amp;m sequence:</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -277,7 +270,6 @@
<tabstop>sequenceEdit</tabstop> <tabstop>sequenceEdit</tabstop>
<tabstop>assocView</tabstop> <tabstop>assocView</tabstop>
<tabstop>windowTitleCombo</tabstop> <tabstop>windowTitleCombo</tabstop>
<tabstop>defaultWindowSequenceButton</tabstop>
<tabstop>customWindowSequenceButton</tabstop> <tabstop>customWindowSequenceButton</tabstop>
<tabstop>windowSequenceEdit</tabstop> <tabstop>windowSequenceEdit</tabstop>
<tabstop>assocAddButton</tabstop> <tabstop>assocAddButton</tabstop>