Skip to content

Commit

Permalink
update connections (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
ouwou committed Oct 18, 2023
1 parent ffb8d38 commit 5e244e5
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 18 deletions.
Binary file added res/res/crunchyroll.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/res/e1e96d89e192de1997f73730db26e94f.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/res/ebay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/res/instagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/res/paypal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/res/playstation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/res/riotgames.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/res/tiktok.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/res/twitter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 37 additions & 18 deletions src/windows/profile/userinfopane.cpp
Original file line number Diff line number Diff line change
@@ -1,30 +1,42 @@
#include "userinfopane.hpp"
#include <unordered_set>

static std::string GetConnectionURL(const ConnectionData &conn) {
if (conn.Type == "github") {
return "https://github.com/" + conn.Name;
} else if (conn.Type == "steam") {
return "https://steamcommunity.com/profiles/" + conn.ID;
} else if (conn.Type == "twitch") {
return "https://twitch.tv/" + conn.Name;
} else if (conn.Type == "twitter") {
return "https://twitter.com/i/user/" + conn.ID;
} else if (conn.Type == "spotify") {
return "https://open.spotify.com/user/" + conn.ID;
} else if (conn.Type == "reddit") {
return "https://reddit.com/u/" + conn.Name;
} else if (conn.Type == "youtube") {
return "https://www.youtube.com/channel/" + conn.ID;
} else if (conn.Type == "facebook") {
return "https://www.facebook.com/" + conn.ID;
} else if (conn.Type == "ebay") {
return "https://www.ebay.com/usr/" + conn.Name;
} else if (conn.Type == "instagram") {
return "https://www.instagram.com/" + conn.Name;
} else if (conn.Type == "tiktok") {
return "https://www.tiktok.com/@" + conn.Name;
}

return "";
}

ConnectionItem::ConnectionItem(const ConnectionData &conn)
: m_box(Gtk::ORIENTATION_HORIZONTAL)
, m_name(conn.Name) {
Glib::RefPtr<Gdk::Pixbuf> pixbuf;
try {
pixbuf = Gdk::Pixbuf::create_from_file(Abaddon::GetResPath("/" + conn.Type + ".png"), 32, 32);
} catch (const Glib::Exception &e) {}
std::string url;
if (conn.Type == "github")
url = "https://github.com/" + conn.Name;
else if (conn.Type == "steam")
url = "https://steamcommunity.com/profiles/" + conn.ID;
else if (conn.Type == "twitch")
url = "https://twitch.tv/" + conn.Name;
else if (conn.Type == "twitter")
url = "https://twitter.com/i/user/" + conn.ID;
else if (conn.Type == "spotify")
url = "https://open.spotify.com/user/" + conn.ID;
else if (conn.Type == "reddit")
url = "https://reddit.com/u/" + conn.Name;
else if (conn.Type == "youtube")
url = "https://www.youtube.com/channel/" + conn.ID;
else if (conn.Type == "facebook")
url = "https://www.facebook.com/" + conn.ID;
std::string url = GetConnectionURL(conn);
if (pixbuf) {
m_image = Gtk::manage(new Gtk::Image(pixbuf));
m_image->get_style_context()->add_class("profile-connection-image");
Expand Down Expand Up @@ -83,17 +95,24 @@ void ConnectionsContainer::SetConnections(const std::vector<ConnectionData> &con

static const std::unordered_set<std::string> supported_services = {
"battlenet",
"ebay",
"epicgames",
"facebook",
"github",
"instagram",
"leagueoflegends",
"paypal",
"playstation",
"reddit",
"riotgames",
"skype",
"spotify",
"steam",
"tiktok",
"twitch",
"twitter",
"xbox",
"youtube",
"facebook"
};

int i = 0;
Expand Down

0 comments on commit 5e244e5

Please sign in to comment.