mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-09 20:05:51 +00:00
massive changes inside
* use pass by ref instead of by value if possible * use reference in interation over collections * fix no tag inserting
This commit is contained in:
@ -31,7 +31,7 @@
|
||||
template <class T> class ExtItemAggregator : public AbstractExtItemAggregator
|
||||
{
|
||||
public:
|
||||
explicit ExtItemAggregator(QWidget *parent, const QString type)
|
||||
explicit ExtItemAggregator(QWidget *parent, const QString &type)
|
||||
: AbstractExtItemAggregator(parent, type)
|
||||
{
|
||||
qSetMessagePattern(AWDebug::LOG_FORMAT);
|
||||
@ -66,16 +66,16 @@ public:
|
||||
// HACK as soon as per one widget instance we have two objects each of
|
||||
// them will try to control socket, whereas actually only one of them
|
||||
// should be owner of the socket
|
||||
for (auto item : m_items)
|
||||
for (auto &item : m_items)
|
||||
item->initSocket();
|
||||
}
|
||||
|
||||
T *itemByTag(const QString _tag, const QString _type) const
|
||||
T *itemByTag(const QString &_tag, const QString &_type) const
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Tag" << _tag << "with used type" << _type;
|
||||
|
||||
T *found = nullptr;
|
||||
for (auto item : m_items) {
|
||||
for (auto &item : m_items) {
|
||||
if (item->tag(_type) != _tag)
|
||||
continue;
|
||||
found = static_cast<T *>(item);
|
||||
@ -92,7 +92,7 @@ public:
|
||||
qCDebug(LOG_LIB) << "Number" << _number;
|
||||
|
||||
T *found = nullptr;
|
||||
for (auto item : m_items) {
|
||||
for (auto &item : m_items) {
|
||||
if (item->number() != _number)
|
||||
continue;
|
||||
found = static_cast<T *>(item);
|
||||
@ -129,9 +129,9 @@ private:
|
||||
QStandardPaths::LocateDirectory);
|
||||
QStringList names;
|
||||
QList<AbstractExtItem *> items;
|
||||
for (auto dir : dirs) {
|
||||
for (auto &dir : dirs) {
|
||||
QStringList files = QDir(dir).entryList(QDir::Files, QDir::Name);
|
||||
for (auto file : files) {
|
||||
for (auto &file : files) {
|
||||
if ((!file.endsWith(QString(".desktop")))
|
||||
|| (names.contains(file)))
|
||||
continue;
|
||||
@ -156,7 +156,7 @@ private:
|
||||
m_activeItems.clear();
|
||||
|
||||
m_items = getItems();
|
||||
for (auto item : m_items) {
|
||||
for (auto &item : m_items) {
|
||||
if (!item->isActive())
|
||||
continue;
|
||||
m_activeItems.append(static_cast<T *>(item));
|
||||
|
Reference in New Issue
Block a user