mirror of https://github.com/mgba-emu/mgba.git
Qt: Use && in some places that coverity recommends
This commit is contained in:
parent
3133105fc9
commit
0815443aeb
|
@ -12,7 +12,7 @@ Action::Action(QObject* parent)
|
|||
{
|
||||
}
|
||||
|
||||
Action::Action(Function function, const QString& name, const QString& visibleName, QObject* parent)
|
||||
Action::Action(Function&& function, const QString& name, const QString& visibleName, QObject* parent)
|
||||
: QObject(parent)
|
||||
, m_function(function)
|
||||
, m_name(name)
|
||||
|
@ -20,7 +20,7 @@ Action::Action(Function function, const QString& name, const QString& visibleNam
|
|||
{
|
||||
}
|
||||
|
||||
Action::Action(Action::BooleanFunction function, const QString& name, const QString& visibleName, QObject* parent)
|
||||
Action::Action(Action::BooleanFunction&& function, const QString& name, const QString& visibleName, QObject* parent)
|
||||
: QObject(parent)
|
||||
, m_booleanFunction(function)
|
||||
, m_name(name)
|
||||
|
|
|
@ -24,8 +24,8 @@ public:
|
|||
QUIT,
|
||||
};
|
||||
|
||||
Action(Function, const QString& name, const QString& visibleName, QObject* parent = nullptr);
|
||||
Action(BooleanFunction, const QString& name, const QString& visibleName, QObject* parent = nullptr);
|
||||
Action(Function&&, const QString& name, const QString& visibleName, QObject* parent = nullptr);
|
||||
Action(BooleanFunction&&, const QString& name, const QString& visibleName, QObject* parent = nullptr);
|
||||
Action(const QString& name, const QString& visibleName, QObject* parent = nullptr);
|
||||
|
||||
Action(QObject* parent = nullptr);
|
||||
|
|
|
@ -141,8 +141,8 @@ std::shared_ptr<Action> ActionMapper::addAction(const Action& act, const QString
|
|||
return getAction(name);
|
||||
}
|
||||
|
||||
std::shared_ptr<Action> ActionMapper::addAction(const QString& visibleName, const QString& name, Action::Function action, const QString& menu, const QKeySequence& shortcut) {
|
||||
return addAction(Action(action, name, visibleName), name, menu, shortcut);
|
||||
std::shared_ptr<Action> ActionMapper::addAction(const QString& visibleName, const QString& name, Action::Function&& action, const QString& menu, const QKeySequence& shortcut) {
|
||||
return addAction(Action(std::move(action), name, visibleName), name, menu, shortcut);
|
||||
}
|
||||
|
||||
std::shared_ptr<Action> ActionMapper::addAction(const QString& visibleName, ConfigOption* option, const QVariant& variant, const QString& menu) {
|
||||
|
@ -151,8 +151,8 @@ std::shared_ptr<Action> ActionMapper::addAction(const QString& visibleName, Conf
|
|||
}, option->name(), visibleName), QString("%1.%2").arg(option->name()).arg(variant.toString()), menu, {});
|
||||
}
|
||||
|
||||
std::shared_ptr<Action> ActionMapper::addBooleanAction(const QString& visibleName, const QString& name, Action::BooleanFunction action, const QString& menu, const QKeySequence& shortcut) {
|
||||
return addAction(Action(action, name, visibleName), name, menu, shortcut);
|
||||
std::shared_ptr<Action> ActionMapper::addBooleanAction(const QString& visibleName, const QString& name, Action::BooleanFunction&& action, const QString& menu, const QKeySequence& shortcut) {
|
||||
return addAction(Action(std::move(action), name, visibleName), name, menu, shortcut);
|
||||
}
|
||||
|
||||
std::shared_ptr<Action> ActionMapper::addBooleanAction(const QString& visibleName, ConfigOption* option, const QString& menu) {
|
||||
|
@ -161,15 +161,15 @@ std::shared_ptr<Action> ActionMapper::addBooleanAction(const QString& visibleNam
|
|||
}, option->name(), visibleName), option->name(), menu, {});
|
||||
}
|
||||
|
||||
std::shared_ptr<Action> ActionMapper::addHeldAction(const QString& visibleName, const QString& name, Action::BooleanFunction action, const QString& menu, const QKeySequence& shortcut) {
|
||||
std::shared_ptr<Action> ActionMapper::addHeldAction(const QString& visibleName, const QString& name, Action::BooleanFunction&& action, const QString& menu, const QKeySequence& shortcut) {
|
||||
m_hiddenActions.insert(name);
|
||||
m_heldActions.insert(name);
|
||||
return addBooleanAction(visibleName, name, action, menu, shortcut);
|
||||
return addBooleanAction(visibleName, name, std::move(action), menu, shortcut);
|
||||
}
|
||||
|
||||
std::shared_ptr<Action> ActionMapper::addHiddenAction(const QString& visibleName, const QString& name, Action::Function action, const QString& menu, const QKeySequence& shortcut) {
|
||||
std::shared_ptr<Action> ActionMapper::addHiddenAction(const QString& visibleName, const QString& name, Action::Function&& action, const QString& menu, const QKeySequence& shortcut) {
|
||||
m_hiddenActions.insert(name);
|
||||
return addAction(visibleName, name, action, menu, shortcut);
|
||||
return addAction(visibleName, name, std::move(action), menu, shortcut);
|
||||
}
|
||||
|
||||
QStringList ActionMapper::menuItems(const QString& menu) const {
|
||||
|
|
|
@ -34,16 +34,16 @@ public:
|
|||
|
||||
void addSeparator(const QString& menu);
|
||||
|
||||
std::shared_ptr<Action> addAction(const QString& visibleName, const QString& name, Action::Function action, const QString& menu = {}, const QKeySequence& = {});
|
||||
std::shared_ptr<Action> addAction(const QString& visibleName, const QString& name, Action::Function&& action, const QString& menu = {}, const QKeySequence& = {});
|
||||
template<typename T, typename V> std::shared_ptr<Action> addAction(const QString& visibleName, const QString& name, T* obj, V (T::*method)(), const QString& menu = {}, const QKeySequence& = {});
|
||||
std::shared_ptr<Action> addAction(const QString& visibleName, ConfigOption* option, const QVariant& variant, const QString& menu = {});
|
||||
|
||||
std::shared_ptr<Action> addBooleanAction(const QString& visibleName, const QString& name, Action::BooleanFunction action, const QString& menu = {}, const QKeySequence& = {});
|
||||
std::shared_ptr<Action> addBooleanAction(const QString& visibleName, const QString& name, Action::BooleanFunction&& action, const QString& menu = {}, const QKeySequence& = {});
|
||||
std::shared_ptr<Action> addBooleanAction(const QString& visibleName, ConfigOption* option, const QString& menu = {});
|
||||
|
||||
std::shared_ptr<Action> addHeldAction(const QString& visibleName, const QString& name, Action::BooleanFunction action, const QString& menu = {}, const QKeySequence& = {});
|
||||
std::shared_ptr<Action> addHeldAction(const QString& visibleName, const QString& name, Action::BooleanFunction&& action, const QString& menu = {}, const QKeySequence& = {});
|
||||
|
||||
std::shared_ptr<Action> addHiddenAction(const QString& visibleName, const QString& name, Action::Function action, const QString& menu = {}, const QKeySequence& = {});
|
||||
std::shared_ptr<Action> addHiddenAction(const QString& visibleName, const QString& name, Action::Function&& action, const QString& menu = {}, const QKeySequence& = {});
|
||||
template<typename T, typename V> std::shared_ptr<Action> addHiddenAction(const QString& visibleName, const QString& name, T* obj, V (T::*method)(), const QString& menu = {}, const QKeySequence& = {});
|
||||
|
||||
bool isHeld(const QString& name) const { return m_heldActions.contains(name); }
|
||||
|
|
Loading…
Reference in New Issue