History log of /haiku/src/kits/tracker/Model.h
Revision Date Author Comments
# 26704b59 23-Apr-2023 John Scipione <jscipione@gmail.com>

Tracker: undo Model.h changes from previous commit

This changes more than just style, put enum values back.
In practice this makes no difference but the change was
unintentional so put it back like it was before.

Change-Id: I46c782c441d72e77a2897683f54ba7fcefbd5b63


# a63a6739 23-Apr-2023 John Scipione <jscipione@gmail.com>

Tracker: Whitespace, alphabetize style fixes

No functional change intended.

Change-Id: Ib47f6b04e372923a5d2a1774ce4e3f56d8b05792
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6370
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# abef198c 31-Dec-2021 Adrien Destugues <pulkomandy@pulkomandy.tk>

Tracker: fix logic to use custom icons.

Regression caused by refactorings in hrev55348.

The logic for deciding when to use a built-in tracker icon was changed
incorrectly to ignore attributes on directories, trash, etc (anything
but executable applications). So the built-in icon was always used.

This commit restores the previous logic.

Shoud fix #17320 and #17371

Change-Id: I51ba22db59a8b6dd2bd1121b56c753ed47224c57
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4841
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# 7f819534 05-Aug-2021 John Scipione <jscipione@gmail.com>

Tracker: Add thumbnail support

Define thumbnail attributes in Attributes.h:
Media:Thumbnail to store the thumbnail,
Media:Thumbnail:CreationTime to see if thumbs need to be regenerated.

Store 128x128 thumbnail in attribute, for icon sizes smaller than
128x128 down-scale the 128x128 thumbnail. Use B_FILTER_BITMAP_BILINEAR
to down-scale the image using the bilinear scaling algorithm which
creates nicer looking thumbnails than the default scaling algorithm.

Store thumbnails as WebP images which compress smaller than PNGs and
fit in the inode better at 128x128.

Check the file's modification time in GetFileIconFromAttr() and compare
it to the thumbnail creation time. If the file has not been modified
since the last time we generated thumbnails return the thumbnail from
the attribute, otherwise fetch a new thumbnail with GetThumbnailIcon().

Add "Generate image thumbnails" Tracker setting. Default is turned off
for now. To generate image thumbnails you must first turn this setting
on in Tracker Windows preferences.

Spawn a get_thumbnail() thread to generate thumbnails and retrieve them
later on from the window thread to fill out into the icon. This should
improve responsiveness of generating thumbnails from a folder with a
lot of images. The generator thread will write the thumbnail data to an
attribute if on writable BFS volume.

If not on writable BFS volume, the generator thread will send the data
back to the original thread through a port by calling write_port().

When the thread is finished creating the thumbnail it sends a message
back to the Tracker application thread to update the pose which
instructs the window thread to look for an thumbnail. It either finds a
thumbnail in an attribute, or picks up the thumbnail data that has been
sent through write_port() using read_port().

This works on both read-write and read-only BFS volumes but it still
depends on the presence of a BEOS:TYPE parameter to have been written
to the volume before it became read-only. Thumbnail generation does not
work on other read-only volumes for example an ISO-9660 CD, but it does
work on read-only BFS volumes for example the BeOS R5 CD.

Move BPrivate::CheckNodeIconHintPrivate() from BNodeInfo to Tracker
Model CheckNodeIconHint(). Create Model::CheckAppIconHint() and look
for a vector icon or mini and large icon in that method. Check that
the base type is directory, volume, trash, desktop, or if executable
call CheckAppIconHint().

Add 1 to temp_name to fix the following warning:
src/kits/tracker/FSUtils.cpp:2437:12: note: 'snprintf' output 3 or more
bytes (assuming 267) into a destination of size 266

Rename temp_name to tempName following our style guidelines. Use
strlcpy() and strlcat() instead of strcpy() to safely copy the string.
This fixes thumbnail generation on 64-bit Haiku.

Change-Id: I7f927a5a1f8cf65e4b1aa1e0eb55bbfae87fd969
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3163
Reviewed-by: John Scipione <jscipione@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# 707c912e 15-Dec-2018 Augustin Cavalier <waddlesplash@gmail.com>

Tracker: Remove "launch broken link" cruft.

As the comment says, this was a pre-R5 (!) hack for Be's CIFS driver.


# 7ef62fb6 27-Feb-2015 John Scipione <jscipione@gmail.com>

Tracker: Style fixes

* Style fixes to QueryContainerWindow.h
* Style fixes to ContainerWindow
* Style fixes to Model
* Style fixes to Tracker
* Style fixes to PoseView
- Most of the changes come from unindenting the code


# 8dd0b0ae 14-Jul-2014 John Scipione <jscipione@gmail.com>

Tracker: style fixes to Model


# d7e68211 04-Jul-2014 John Scipione <jscipione@gmail.com>

Tracker: miscellaneous style fixes


# c8d910f7 20-Jun-2014 John Scipione <jscipione@gmail.com>

Tracker: style fixes to Model class


# 1c29b26e 29-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add virtual directory feature to Tracker

Similar to stored queries, files of the virtual directory type behave
like directories -- i.e. they open in a list-mode Tracker window and
show up as an item with submenu in navigation menus. The file itself is
a plain text file in driver settings format. It can have an arbitrary
number of "directory" entries, which specify the paths of (actual)
directories for which the virtual directory provides a merged view. The
view will not show duplicate entries. For non-directory entries the
first one encountered (according to the order the directory paths are
specified in the file) will be shown. A subdirectory entry will again
behave like a virtual directory.

The support in Tracker isn't perfect yet. I'm afraid major refactoring
would be necessary to get it there.

The virtual directory file type uses a differently colored version of
the folder icon. Alternatives welcome.


# d6c852ec 19-Aug-2012 Ryan Leavengood <leavengood@gmail.com>

Actually cache something when CacheLocalizedName is called.

Before its name was a lie, since nothing was cached.

Another boolean was added because getting the localized name could fail, and we
don't want to pointlessly try again, so relying on fHasLocalizedName won't work
for that.

Since in my tests this was getting called up to 4 times per application when
opening the Deskbar Application menu, this caching should speed that up a bit,
at least when this file name translation feature is turned on.


# a51764c5 27-Jul-2012 John Scipione <jscipione@gmail.com>

WIP: Yet more style fixes, mostly 80 char violations.


# b05aa8b5 27-Jul-2012 John Scipione <jscipione@gmail.com>

Style changes in Tracker, no functional change.

Manual whitespace cleanup
Change instances of const char * to const char*
Convert /* */ C style comments to // C++ style comments


# ee6a2e55 27-Mar-2011 Jonas Sundström <jonas@kirilla.com>

* Extend the Model class with a method bool HasLocalizedName().
* Disallow renaming of entries with localized names for now - this is meant to be temporary - and so far only in Tracker's Info window. Renames do not result in a change, visually, as the localized name hides the real name, and results in a bad user experience. One could possibly allow renames of the localized name, writing it back to the catalog. I've experimented with using BCatalogAddOn::SetString() but haven't been able to make it stick yet.
* Disallow renaming Trash in Tracker's Info window via Command-E.
* Adjust the argument order of BLocaleRoster::GetLocalizedFileName().
* Add a BLocaleRoster::GetLocalizedFileName() variant to look up another app's name given its signature and unlocalized, canonical name.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41126 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ed7ee7a4 11-Mar-2011 Jonas Sundström <jonas@kirilla.com>

Localization support for filesystem entries in Tracker and Deskbar (leaf menu). (It appears to work, but is likely incomplete and quite possibly incorrect.) Fix issue with RosterData::Refresh() resulting in a B_LOCALE_CHANGED broadcast, and Deskbar looping. Add a global boolean gLocalizedNamePreferred to avoid calling BLocaleRoster::Default()->IsFilesystemTranslationPreferred() too often from Model instances. Following Tracker code style in libtracker, so as to not mix in too much clean-up.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40922 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1bddf9ca 12-Sep-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Missing <Debug.h> include.
* Automatic whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38616 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 89af0548 17-Jan-2010 Rene Gollent <anevilyak@gmail.com>

Employ a similar naming abstraction for the desktop as has been done for Trash to allow that name to be localized visually later (same on-disk location though).
SlowContextPopup also needed to be adjusted to account for trash's new location.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35137 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d9626569 17-Jan-2010 Rene Gollent <anevilyak@gmail.com>

Model: Add accessor for Trash node property and cleanup spacing between inlines.
Rest: Use the IsTrash() accessor on Model where possible in place of the more expensive FSIsTrashDir() check.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35132 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6abd81fc 17-Jan-2010 Rene Gollent <anevilyak@gmail.com>

Add a special node type for the Trash analogous to the one used for the root dir. This allows the model to return an arbitrary name not directly tied to the on-disk name for the Trash directory, which a) makes it localizable in the future, and b) means it's not tied to the on-disk name, which removes the requirement that the Trash dir name be uppercase on disk.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35126 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 01dffd8e 14-Jan-2010 Rene Gollent <anevilyak@gmail.com>

More Tracker refactoring:
* relocated Trash dirs to volume roots by modifying find_directory() to report the trash location as volume/Trash.
* FSUtils no longer creates /home/Desktop on every volume.
* TrashWatcher now keeps icons in sync on all volumes.
* Simplified FSGetDeskDir since it no longer has to worry about getting the desk directory on any volume other than the root.
* Relocated trash context menu logic to BContainerWindow so it can also be used at the volume roots.
* DesktopPoseView now creates a virtual Trash pose representing the trash contents as before.
* Corrected typo: Model::WriteAttrKillForegin() -> Model::WriteAttrKillForeign().

Closes ticket #5245.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35085 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 02be5353 22-May-2005 Axel Dörfler <axeld@pinc-software.de>

Added libtracker.so to the repository and the build.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12772 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7ef62fb6c2485f91ba49b0cde5e73e62687375e9 27-Feb-2015 John Scipione <jscipione@gmail.com>

Tracker: Style fixes

* Style fixes to QueryContainerWindow.h
* Style fixes to ContainerWindow
* Style fixes to Model
* Style fixes to Tracker
* Style fixes to PoseView
- Most of the changes come from unindenting the code


# 8dd0b0aeac1b8f1f7427c7c494a0bb0e636eb195 14-Jul-2014 John Scipione <jscipione@gmail.com>

Tracker: style fixes to Model


# d7e682113776632e5c04a6558eca0c5650a164e4 04-Jul-2014 John Scipione <jscipione@gmail.com>

Tracker: miscellaneous style fixes


# c8d910f76bd462ca86b9acc0259b30fde2d7ad32 20-Jun-2014 John Scipione <jscipione@gmail.com>

Tracker: style fixes to Model class


# 1c29b26e7c7eb94ee125315eca5a94265f613420 29-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add virtual directory feature to Tracker

Similar to stored queries, files of the virtual directory type behave
like directories -- i.e. they open in a list-mode Tracker window and
show up as an item with submenu in navigation menus. The file itself is
a plain text file in driver settings format. It can have an arbitrary
number of "directory" entries, which specify the paths of (actual)
directories for which the virtual directory provides a merged view. The
view will not show duplicate entries. For non-directory entries the
first one encountered (according to the order the directory paths are
specified in the file) will be shown. A subdirectory entry will again
behave like a virtual directory.

The support in Tracker isn't perfect yet. I'm afraid major refactoring
would be necessary to get it there.

The virtual directory file type uses a differently colored version of
the folder icon. Alternatives welcome.


# d6c852ec49df1af8400a62ab7a2eb950b50f1de0 19-Aug-2012 Ryan Leavengood <leavengood@gmail.com>

Actually cache something when CacheLocalizedName is called.

Before its name was a lie, since nothing was cached.

Another boolean was added because getting the localized name could fail, and we
don't want to pointlessly try again, so relying on fHasLocalizedName won't work
for that.

Since in my tests this was getting called up to 4 times per application when
opening the Deskbar Application menu, this caching should speed that up a bit,
at least when this file name translation feature is turned on.


# a51764c53eecd8ca5f6312b92d8baccda89d5b1d 27-Jul-2012 John Scipione <jscipione@gmail.com>

WIP: Yet more style fixes, mostly 80 char violations.


# b05aa8b5b16e5b4f420a35c37805c6387df98737 27-Jul-2012 John Scipione <jscipione@gmail.com>

Style changes in Tracker, no functional change.

Manual whitespace cleanup
Change instances of const char * to const char*
Convert /* */ C style comments to // C++ style comments


# ee6a2e5589a8ff169bb64870650b8f194aa9da14 27-Mar-2011 Jonas Sundström <jonas@kirilla.com>

* Extend the Model class with a method bool HasLocalizedName().
* Disallow renaming of entries with localized names for now - this is meant to be temporary - and so far only in Tracker's Info window. Renames do not result in a change, visually, as the localized name hides the real name, and results in a bad user experience. One could possibly allow renames of the localized name, writing it back to the catalog. I've experimented with using BCatalogAddOn::SetString() but haven't been able to make it stick yet.
* Disallow renaming Trash in Tracker's Info window via Command-E.
* Adjust the argument order of BLocaleRoster::GetLocalizedFileName().
* Add a BLocaleRoster::GetLocalizedFileName() variant to look up another app's name given its signature and unlocalized, canonical name.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41126 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ed7ee7a43256baac60e2345f42fc28897cf5585e 11-Mar-2011 Jonas Sundström <jonas@kirilla.com>

Localization support for filesystem entries in Tracker and Deskbar (leaf menu). (It appears to work, but is likely incomplete and quite possibly incorrect.) Fix issue with RosterData::Refresh() resulting in a B_LOCALE_CHANGED broadcast, and Deskbar looping. Add a global boolean gLocalizedNamePreferred to avoid calling BLocaleRoster::Default()->IsFilesystemTranslationPreferred() too often from Model instances. Following Tracker code style in libtracker, so as to not mix in too much clean-up.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40922 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1bddf9cad18c0c78e8f139087dce09361a84650f 12-Sep-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Missing <Debug.h> include.
* Automatic whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38616 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 89af054816a9b1fbaabe8297da758015bf417d4d 17-Jan-2010 Rene Gollent <anevilyak@gmail.com>

Employ a similar naming abstraction for the desktop as has been done for Trash to allow that name to be localized visually later (same on-disk location though).
SlowContextPopup also needed to be adjusted to account for trash's new location.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35137 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d9626569fb4d59f261c05cbe3a7d7e57e6bff9a5 17-Jan-2010 Rene Gollent <anevilyak@gmail.com>

Model: Add accessor for Trash node property and cleanup spacing between inlines.
Rest: Use the IsTrash() accessor on Model where possible in place of the more expensive FSIsTrashDir() check.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35132 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6abd81fcf093254a00ea9e80e0571f6fa416f9ee 17-Jan-2010 Rene Gollent <anevilyak@gmail.com>

Add a special node type for the Trash analogous to the one used for the root dir. This allows the model to return an arbitrary name not directly tied to the on-disk name for the Trash directory, which a) makes it localizable in the future, and b) means it's not tied to the on-disk name, which removes the requirement that the Trash dir name be uppercase on disk.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35126 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 01dffd8edd94699ac1e6f2cc4322555f2171da14 14-Jan-2010 Rene Gollent <anevilyak@gmail.com>

More Tracker refactoring:
* relocated Trash dirs to volume roots by modifying find_directory() to report the trash location as volume/Trash.
* FSUtils no longer creates /home/Desktop on every volume.
* TrashWatcher now keeps icons in sync on all volumes.
* Simplified FSGetDeskDir since it no longer has to worry about getting the desk directory on any volume other than the root.
* Relocated trash context menu logic to BContainerWindow so it can also be used at the volume roots.
* DesktopPoseView now creates a virtual Trash pose representing the trash contents as before.
* Corrected typo: Model::WriteAttrKillForegin() -> Model::WriteAttrKillForeign().

Closes ticket #5245.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35085 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 02be5353fd41ea40007a382e13f007eaf6b5a3a0 22-May-2005 Axel Dörfler <axeld@pinc-software.de>

Added libtracker.so to the repository and the build.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12772 a95241bf-73f2-0310-859d-f6bbb57e9c96