Add default file icon for .tsx files

One easy suggestion that can be added in the next patch version :stuck_out_tongue:

icon-for-tilesets

I personally made a custom icon for myself and assigned it on my system:

Generally, I just wanted to see faster tilesets between other text-based files in the asset folder or other tilemaps (if you chose to open .tsx with Tiled - then maps and tilesets have the same icons).

So that’s my suggestion :slight_smile:

p.s.
Here is the solution for setting custom icons per file type in Windows 10:
https://docs.microsoft.com/en-us/windows/win32/shell/how-to-assign-a-custom-icon-to-a-file-type

And an example in the context of the samples directory from tiled:

Thanks a lot for the links and the alternative icons for tileset files!

I think it would be a nice if these custom icons could be associated with the files regardless of whether Tiled was installed using the MSI installer or just extracted from a .zip. I found out it’s possible to set these values through QSettings (though not system-wide since it would need privileges, but I think per user would be enough).

If I understood that right, the following code should work for this:

#include "Shlobj.h"

QSettings reg("HKEY_CURRENT_USER\\SOFTWARE\\Classes", QSettings::NativeFormat);
reg.setValue(".tmx/DefaultIcon", "C:\\Path\\To\\tmx_icon.ico");
reg.setValue(".tsx/DefaultIcon", "C:\\Path\\To\\tsx_icon.ico");

SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);

This would then need to be connected to some checkbox in the preferences that sets/removes this entry from the registry.

Then I’m just a little undecided whether Tiled should do this by default or wait for the user to enable it. In the past I’ve noticed a lot of applications asking on startup, but I’d rather avoid that. Maybe a nice solution would be to display a kind of banner on the startup screen for it (similar to “make this your default browser”). And of course when it detects that it is being run from a different directory, this key will need to get updated.

I’m glad you like the idea for tileset icons and it’s good that Qt have this option.
So maybe the most not intrusive way for now could be a checkbox or button in Tiled settings, which will execute the registry set on click.

Also less things to tick, check on installation better, and also maybe other users will prefer the “classic” way and same icon for both types since both are opened with Tiled on double click.