Skip to content

Comments

Different approach for storing the icon size and url relation#56

Merged
ximion merged 1 commit intoximion:masterfrom
aleixpol:master
Jul 28, 2016
Merged

Different approach for storing the icon size and url relation#56
ximion merged 1 commit intoximion:masterfrom
aleixpol:master

Conversation

@aleixpol
Copy link
Collaborator

This way we can return it as a block so that the client can actually
introspect which icons are available.

The code I'm referring to looks like this:

{
    QIcon ret;

    const auto icons = m_appdata.iconUrls();
    if (icons.isEmpty())
        return m_appdata.name();
    else {
        for (auto it = icons.constBegin(), itEnd = icons.constEnd(); it!=itEnd; ++it) {
            if (it->isLocalFile())
                ret.addFile(it->toLocalFile(), it.key());
        }
    }
    return ret;
}

This way we can return it as a block so that the client can actually
introspect which icons are available.
@ximion
Copy link
Owner

ximion commented Jul 28, 2016

Looks good to me, but I wonder if this solution is ideal for the future... Libas has an own AsIcon class, but mainly because it doesn't have a QUrl (because plain C and GLib).
Anyway, it's definitely a useful improvement for the present!

@ximion ximion merged commit 0e20902 into ximion:master Jul 28, 2016
@aleixpol
Copy link
Collaborator Author

TBH, what worries me the most at the moment is the ::isLocalFile, will have to look into how to do it when it's not local. Still not a problem as of today.

Thanks!

@ximion
Copy link
Owner

ximion commented Jul 28, 2016

The thing I thought about the most was stock icons, which are no URLs at all.... :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants