[keyboard] Tidy up the debugging output, add docs

This commit is contained in:
Adriaan de Groot 2020-10-28 16:40:43 +01:00
parent 14a76a386a
commit 9e141636c5
2 changed files with 13 additions and 6 deletions

View File

@ -91,6 +91,11 @@ private:
int m_defaultPC105 = -1; ///< The index of pc105, if there is one
};
/** @brief A list of keyboard layouts (arrangements of keycaps)
*
* Layouts can have a list of associated Variants, so this
* is slightly more complicated than the "regular" XKBListModel.
*/
class KeyboardLayoutModel : public QAbstractListModel
{
Q_OBJECT
@ -125,6 +130,12 @@ signals:
void currentIndexChanged( int index );
};
/** @brief A list of variants (xkb id and human-readable)
*
* The variants that are available depend on the Layout that is used,
* so the `setVariants()` function can be used to update the variants
* when the two models are related.
*/
class KeyboardVariantsModel : public XKBListModel
{
Q_OBJECT

View File

@ -106,29 +106,25 @@ KeyboardPage::KeyboardPage( Config* config, QWidget* parent )
void
KeyboardPage::layoutChangedByUser( const QModelIndex& current, const QModelIndex& previous )
{
cDebug() << "index ->" << current.row();
m_config->keyboardLayouts()->setCurrentIndex( current.row() );
cDebug() << Logger::SubEntry << "variants now" << m_config->keyboardVariants()->rowCount();
}
void
KeyboardPage::layoutChangedByConfig( int index )
{
cDebug() << "index ->" << index;
ui->layoutSelector->setCurrentIndex( m_config->keyboardLayouts()->index( index ) );
cDebug() << Logger::SubEntry << "variants now" << m_config->keyboardVariants()->rowCount();
}
void
KeyboardPage::variantChangedByUser( const QModelIndex& current, const QModelIndex& previous )
{
cDebug() << "index ->" << current.row();
m_config->keyboardVariants()->setCurrentIndex( current.row() );
}
void
KeyboardPage::variantChangedByConfig( int index )
{
cDebug() << "index ->" << index;
ui->variantSelector->setCurrentIndex( m_config->keyboardVariants()->index( index ) );
}
KeyboardPage::~KeyboardPage()