~josharenson/+junk/white-session-chooser-gui

« back to all changes in this revision

Viewing changes to plugins/LightDM/SessionsModel.cpp

  • Committer: Josh Arenson
  • Date: 2016-06-15 15:58:18 UTC
  • mfrom: (1978.1.19 sessions-model)
  • Revision ID: joshua.arenson@canonical.com-20160615155818-4mw6is49p4bpzn2q
Merge prereq

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
    Q_FOREACH(const QUrl& searchDirectory, m_iconSearchDirectories)
53
53
    {
54
54
        // This is an established icon naming convention
 
55
        QString customIconUrl = searchDirectory.toString(QUrl::StripTrailingSlash) +
 
56
            "/custom_" + sessionName  + "_badge.png";
55
57
        QString iconUrl = searchDirectory.toString(QUrl::StripTrailingSlash) +
56
 
            "/" + sessionName.toLower()  + "_badge.png";
 
58
            "/" + sessionName  + "_badge.png";
 
59
 
 
60
        QFile customIconFile(customIconUrl);
57
61
        QFile iconFile(iconUrl);
58
 
        if (iconFile.exists()) {
 
62
        if (customIconFile.exists()) {
 
63
            return QUrl(customIconUrl);
 
64
        } else if (iconFile.exists()) {
59
65
            return QUrl(iconUrl);
 
66
        } else{
 
67
            // Search the legacy way
 
68
            QString path = searchDirectory.toString(QUrl::StripTrailingSlash) + "/";
 
69
            if (sessionName == "ubuntu" || sessionName == "ubuntu-2d") {
 
70
                path += "ubuntu_badge.png";
 
71
            } else if(
 
72
                        sessionName == "gnome-classic" ||
 
73
                        sessionName == "gnome-flashback-compiz" ||
 
74
                        sessionName == "gnome-flashback-metacity" ||
 
75
                        sessionName == "gnome-shell" ||
 
76
                        sessionName == "gnome-wayland" ||
 
77
                        sessionName == "gnome"
 
78
                    ){
 
79
                path += "gnome_badge.png";
 
80
            } else if (sessionName == "plasma") {
 
81
                path += "kde_badge.png";
 
82
            } else if (sessionName == "xterm") {
 
83
                path += "recovery_console_badge.png";
 
84
            } else if (sessionName == "remote-login") {
 
85
                path += "remote_login_help.png";
 
86
            }
 
87
 
 
88
            if (QFile(path).exists()) {
 
89
                return path;
 
90
            }
60
91
        }
61
92
    }
62
93