mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 12:55:31 +08:00
refs #198 , changed keyboardkey classes so they can be initialized either by read settings or default values
This commit is contained in:
@@ -27,7 +27,7 @@ namespace BlackGui
|
|||||||
//! \copydoc CListModelBase::data
|
//! \copydoc CListModelBase::data
|
||||||
QVariant data(const QModelIndex &modelIndex, int role = Qt::DisplayRole) const override;
|
QVariant data(const QModelIndex &modelIndex, int role = Qt::DisplayRole) const override;
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Hardware::CKeyboardKeyList::initAsHotkeyList
|
//! \copydoc CKeyboardKeyList::initAsHotkeyList(bool reset)
|
||||||
void initAsHotkeyList() { this->m_container.initAsHotkeyList(); }
|
void initAsHotkeyList() { this->m_container.initAsHotkeyList(); }
|
||||||
|
|
||||||
//! \copydoc QAbstractTableModel::setData
|
//! \copydoc QAbstractTableModel::setData
|
||||||
|
|||||||
@@ -22,6 +22,14 @@ namespace BlackMisc
|
|||||||
CSequence<CKeyboardKey>(baseClass)
|
CSequence<CKeyboardKey>(baseClass)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Contains this hotkey function?
|
||||||
|
*/
|
||||||
|
bool CKeyboardKeyList::containsFunction(CKeyboardKey::HotkeyFunction key)
|
||||||
|
{
|
||||||
|
return CSequence::contains(&CKeyboardKey::getFunction, key);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Register metadata
|
* Register metadata
|
||||||
*/
|
*/
|
||||||
@@ -35,14 +43,17 @@ namespace BlackMisc
|
|||||||
qDBusRegisterMetaType<CKeyboardKeyList>();
|
qDBusRegisterMetaType<CKeyboardKeyList>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeyboardKeyList::initAsHotkeyList()
|
/*
|
||||||
|
* Hotkey list
|
||||||
|
*/
|
||||||
|
void CKeyboardKeyList::initAsHotkeyList(bool reset)
|
||||||
{
|
{
|
||||||
this->clear();
|
if (reset) this->clear();
|
||||||
this->push_back(CKeyboardKey(CKeyboardKey::HotkeyPtt));
|
if (!this->containsFunction(CKeyboardKey::HotkeyPtt)) this->push_back(CKeyboardKey(CKeyboardKey::HotkeyPtt));
|
||||||
this->push_back(CKeyboardKey(CKeyboardKey::HotkeyOpacity50));
|
if (!this->containsFunction(CKeyboardKey::HotkeyOpacity50)) this->push_back(CKeyboardKey(CKeyboardKey::HotkeyOpacity50));
|
||||||
this->push_back(CKeyboardKey(CKeyboardKey::HotkeyOpacity100));
|
if (!this->containsFunction(CKeyboardKey::HotkeyOpacity100)) this->push_back(CKeyboardKey(CKeyboardKey::HotkeyOpacity100));
|
||||||
this->push_back(CKeyboardKey(CKeyboardKey::HotkeyToggleCom1));
|
if (!this->containsFunction(CKeyboardKey::HotkeyToggleCom1)) this->push_back(CKeyboardKey(CKeyboardKey::HotkeyToggleCom1));
|
||||||
this->push_back(CKeyboardKey(CKeyboardKey::HotkeyToggleCom2));
|
if (!this->containsFunction(CKeyboardKey::HotkeyToggleCom2)) this->push_back(CKeyboardKey(CKeyboardKey::HotkeyToggleCom2));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -37,11 +37,17 @@ namespace BlackMisc
|
|||||||
return QVariant::fromValue(*this);
|
return QVariant::fromValue(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \brief contains given hotkey function?
|
||||||
|
bool containsFunction(CKeyboardKey::HotkeyFunction key);
|
||||||
|
|
||||||
//! \brief Register metadata
|
//! \brief Register metadata
|
||||||
static void registerMetadata();
|
static void registerMetadata();
|
||||||
|
|
||||||
//! \brief Fill the list with hotkey
|
/*!
|
||||||
void initAsHotkeyList();
|
* \brief Fill the list with hotkeys
|
||||||
|
* \param reset true, list will be be reset, otherwise value will not be overridde
|
||||||
|
*/
|
||||||
|
void initAsHotkeyList(bool reset = true);
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace
|
} //namespace
|
||||||
|
|||||||
Reference in New Issue
Block a user