Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opt:favorite icon adjustment,allow more situation #2178

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ set(QSINGLEAPP_SOURCE_FILES
thirdparty/qtsingleapplication/src/qtsingleapplication.h
)

qt_add_executable(${GOLDENDICT})
qt_add_executable(${GOLDENDICT}
src/ui/favoritemanager.cc
src/ui/favoritemanager.hh)

target_sources(${GOLDENDICT} PRIVATE
icons/flags.qrc
Expand Down
140 changes: 140 additions & 0 deletions icons/star_blue_other.svg
Copy link
Collaborator

@shenlebantongying shenlebantongying Feb 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not gonna to lie. This is not good.

It is hard to guess what this means without knowing the concept of "this folder" and "other folder". Even after knowing what it is, there is no good representation of the concept.

Also, Red is often associated with warnings. This would also be frustrating without knowing what this is (like the red dot notification in phone apps).

The original GD's "existing in this or other folder" concept is not that useful.

Let's just don't bring major confusion.

Copy link
Owner Author

@xiaoyifang xiaoyifang Feb 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, Red is often associated with warnings

maybe change the style , blue?

users can learn :-)

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
181 changes: 181 additions & 0 deletions icons/star_other.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
<file>icons/sources.png</file>
<file>icons/star.svg</file>
<file>icons/star_blue.svg</file>
<file>icons/star_other.svg</file>
<file>icons/star_blue_other.svg</file>
<file>icons/system-search.svg</file>
<file>icons/windows-list.svg</file>
<file>icons/wizard.svg</file>
Expand Down
3 changes: 2 additions & 1 deletion src/common/globalbroadcaster.hh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public:
QString translateLineText{};
//hold the dictionary id;
QSet< QString > collapsedDicts;
QMap< QString, QSet< QString > > folderFavoritesMap;
//key hold the headword, value holds the folders.
QMap< QString, QSet< QString > > wordFavoriteFolderMap;
QMap< unsigned, QString > groupFolderMap;
PronounceEngine pronounce_engine;
QString getAbbrName( QString const & text );
Expand Down
31 changes: 31 additions & 0 deletions src/ui/favoritemanager.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// Created by xiaoyifang on 2025/2/21.
//

#include "favoritemanager.hh"
#include "globalbroadcaster.hh"
FavoriteType FavoriteManager::determineFavoriteType( const QString & word, unsigned groupId )
{
QString folder = GlobalBroadcaster::instance()->groupFolderMap[ groupId ];
return determineFavoriteType( word, folder );
}

FavoriteType FavoriteManager::determineFavoriteType( const QString & word, const QString & folder )
{
if ( !GlobalBroadcaster::instance()->wordFavoriteFolderMap.contains( word ) ) {
return FavoriteType::EMPTY;
}
if ( folder.isEmpty() ) {
return FavoriteType::FULL;
}

if ( GlobalBroadcaster::instance()->wordFavoriteFolderMap[ word ].contains( folder ) ) {
if ( GlobalBroadcaster::instance()->wordFavoriteFolderMap[ word ].size() == 1 ) {
return FavoriteType::FULL;
}
else {
return FavoriteType::FULL_OTHER;
}
}
return FavoriteType::EMPTY_OTHER;
}
Loading
Loading