From: Niki Roo Date: Thu, 11 Apr 2019 05:33:27 +0000 (+0200) Subject: GUI: add search menu X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=99e1c5ecb58120aed9d3d0f3241f1f602e2b6931;p=fanfix-jexer.git GUI: add search menu --- diff --git a/src/be/nikiroo/fanfix/bundles/StringIdGui.java b/src/be/nikiroo/fanfix/bundles/StringIdGui.java index 8d3022e..0fb8385 100644 --- a/src/be/nikiroo/fanfix/bundles/StringIdGui.java +++ b/src/be/nikiroo/fanfix/bundles/StringIdGui.java @@ -119,6 +119,8 @@ public enum StringIdGui { MENU_EDIT_SET_COVER_FOR_SOURCE, // @Meta(def = "Set as cover for author", format = Format.STRING, description = "the edit/Set as cover for author menu button") MENU_EDIT_SET_COVER_FOR_AUTHOR, // + @Meta(def = "Search", format = Format.STRING, description = "the search menu to open the earch stories on one of the searchable websites") + MENU_SEARCH, @Meta(def = "View", format = Format.STRING, description = "the view menu") MENU_VIEW, // @Meta(def = "Word count", format = Format.STRING, description = "the view/word_count menu button, to show the word/image/story count as secondary info") diff --git a/src/be/nikiroo/fanfix/bundles/resources_gui.properties b/src/be/nikiroo/fanfix/bundles/resources_gui.properties index 5e49ceb..9840392 100644 --- a/src/be/nikiroo/fanfix/bundles/resources_gui.properties +++ b/src/be/nikiroo/fanfix/bundles/resources_gui.properties @@ -125,6 +125,9 @@ MENU_EDIT_SET_COVER_FOR_SOURCE = Set as cover for source # the edit/Set as cover for author menu button # (FORMAT: STRING) MENU_EDIT_SET_COVER_FOR_AUTHOR = Set as cover for author +# the search menu to open the earch stories on one of the searchable websites +# (FORMAT: STRING) +MENU_SEARCH = Search # the view menu (FORMAT: STRING) MENU_VIEW = View # the view/word_count menu button, to show the word/image/story count as secondary info diff --git a/src/be/nikiroo/fanfix/bundles/resources_gui_fr.properties b/src/be/nikiroo/fanfix/bundles/resources_gui_fr.properties index 6e14c98..453957c 100644 --- a/src/be/nikiroo/fanfix/bundles/resources_gui_fr.properties +++ b/src/be/nikiroo/fanfix/bundles/resources_gui_fr.properties @@ -125,6 +125,9 @@ MENU_EDIT_SET_COVER_FOR_SOURCE = Utiliser comme cover pour la source # the edit/Set as cover for author menu button # (FORMAT: STRING) MENU_EDIT_SET_COVER_FOR_AUTHOR = Utiliser comme cover pour l'auteur +# the search menu to open the earch stories on one of the searchable websites +# (FORMAT: STRING) +MENU_SEARCH = Recherche # the view menu (FORMAT: STRING) MENU_VIEW = Affichage # the view/word_count menu button, to show the word/image/story count as secondary info diff --git a/src/be/nikiroo/fanfix/reader/ui/GuiReaderFrame.java b/src/be/nikiroo/fanfix/reader/ui/GuiReaderFrame.java index e207023..36b8ab2 100644 --- a/src/be/nikiroo/fanfix/reader/ui/GuiReaderFrame.java +++ b/src/be/nikiroo/fanfix/reader/ui/GuiReaderFrame.java @@ -36,6 +36,8 @@ import be.nikiroo.fanfix.output.BasicOutput.OutputType; import be.nikiroo.fanfix.reader.BasicReader; import be.nikiroo.fanfix.reader.ui.GuiReaderMainPanel.FrameHelper; import be.nikiroo.fanfix.reader.ui.GuiReaderMainPanel.StoryRunnable; +import be.nikiroo.fanfix.searchable.BasicSearchable; +import be.nikiroo.fanfix.supported.SupportType; import be.nikiroo.utils.Progress; import be.nikiroo.utils.Version; import be.nikiroo.utils.ui.ConfigEditor; @@ -181,6 +183,23 @@ class GuiReaderFrame extends JFrame implements FrameHelper { bar.add(edit); + JMenu search = new JMenu(GuiReader.trans(StringIdGui.MENU_SEARCH)); + search.setMnemonic(KeyEvent.VK_H); + for (SupportType type : SupportType.values()) { + BasicSearchable searchable = BasicSearchable.getSearchable(type); + if (searchable != null) { + JMenuItem searchItem = new JMenuItem(type.getSourceName()); + searchItem.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + // TODO: open a search window + } + }); + search.add(searchItem); + } + } + bar.add(search); + JMenu view = new JMenu(GuiReader.trans(StringIdGui.MENU_VIEW)); view.setMnemonic(KeyEvent.VK_V); JMenuItem vauthors = new JMenuItem(