Skip to content

Commit

Permalink
Merge pull request #11 from Abogical/master
Browse files Browse the repository at this point in the history
Use icons of PS3 and X-Box controllers
  • Loading branch information
Grumbel committed Dec 23, 2015
2 parents 9773e2b + 83ba76a commit e89ae8f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,2 +1,3 @@
*~
/build/
jstest-gtk
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -12,7 +12,7 @@ You can find the latest version at:

* http://github.com/Grumbel/jstest-gtk/tree/master

Questions, comments and bug reporst can be given to:
Questions, comments and bug reports can be given to:

* Ingo Ruhnke <grumbel@gmx.de>

Expand Down
Binary file added data/PS3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 12 additions & 2 deletions src/joystick_list_widget.cpp
Expand Up @@ -123,11 +123,21 @@ JoystickListWidget::on_refresh()
for(std::vector<JoystickDescription>::const_iterator i = joysticks.begin(); i != joysticks.end(); ++i)
{
Gtk::ListStore::iterator it = device_list->append();
(*it)[DeviceListColumns::instance().icon] = Gdk::Pixbuf::create_from_file(Main::current()->get_data_directory() + "generic.png");

const Glib::ustring& name = i->name;
Glib::ustring icon_filename;
//Playstation icon for ps3 controller
if(name == "Sony PLAYSTATION(R)3 Controller") icon_filename = "PS3.png";
//Xbox icon for xbox controller
else if(name.find("X-Box") != Glib::ustring::npos) icon_filename = "xbox360_small.png";
//General icon for the rest
else icon_filename = "generic.png";

(*it)[DeviceListColumns::instance().icon] = Gdk::Pixbuf::create_from_file(Main::current()->get_data_directory() + icon_filename);
(*it)[DeviceListColumns::instance().path] = i->filename;

std::ostringstream out;
out << i->name << "\n"
out << name << "\n"
<< "Device: " << i->filename << "\n"
<< "Axes: " << i->axis_count << "\n"
<< "Buttons: " << i->button_count;
Expand Down

0 comments on commit e89ae8f

Please sign in to comment.