From bda61a994cced2ce85e0df270cf0ed79bf0efada Mon Sep 17 00:00:00 2001 From: Le Tan Date: Wed, 6 Dec 2017 20:35:01 +0800 Subject: [PATCH] support overriding icon color in theme --- src/dialog/vfindreplacedialog.cpp | 4 +- src/dialog/vnewfiledialog.cpp | 5 +- src/resources/icons/add_attachment.svg | 2 +- src/resources/icons/add_snippet.svg | 2 +- src/resources/icons/add_style.svg | 2 +- src/resources/icons/apply_snippet.svg | 16 ++-- src/resources/icons/attachment.svg | 2 +- src/resources/icons/bold.svg | 2 +- src/resources/icons/close.svg | 2 +- src/resources/icons/close_note_tb.svg | 2 +- src/resources/icons/code_block.svg | 2 +- src/resources/icons/copy.svg | 4 +- src/resources/icons/create_note.svg | 2 +- src/resources/icons/create_note_tb.svg | 2 +- src/resources/icons/create_notebook.svg | 2 +- src/resources/icons/create_rootdir.svg | 2 +- src/resources/icons/create_rootdir_tb.svg | 2 +- src/resources/icons/create_subdir.svg | 4 +- src/resources/icons/cut.svg | 6 +- src/resources/icons/delete_attachment.svg | 2 +- src/resources/icons/delete_dir.svg | 2 +- src/resources/icons/delete_note.svg | 2 +- src/resources/icons/delete_notebook.svg | 2 +- src/resources/icons/delete_snippet.svg | 2 +- src/resources/icons/dir_info.svg | 4 +- src/resources/icons/dir_item.svg | 2 +- src/resources/icons/discard_exit.svg | 2 +- src/resources/icons/edit_note.svg | 6 +- src/resources/icons/editing.svg | 6 +- src/resources/icons/expand.svg | 8 +- src/resources/icons/find_replace.svg | 2 +- src/resources/icons/flash_page.svg | 8 +- src/resources/icons/heading.svg | 2 +- src/resources/icons/import_note.svg | 2 +- src/resources/icons/insert_image.svg | 4 +- src/resources/icons/link.svg | 6 +- src/resources/icons/locate_attachment.svg | 2 +- src/resources/icons/locate_note.svg | 2 +- src/resources/icons/locate_snippet.svg | 2 +- src/resources/icons/manage_template.svg | 2 +- src/resources/icons/move_tab_left.svg | 2 +- src/resources/icons/move_tab_right.svg | 2 +- src/resources/icons/note_info.svg | 4 +- src/resources/icons/note_info_tb.svg | 4 +- src/resources/icons/notebook_info.svg | 4 +- src/resources/icons/notebook_item.svg | 2 +- src/resources/icons/outline.svg | 14 +-- src/resources/icons/paste.svg | 4 +- src/resources/icons/print.svg | 8 +- src/resources/icons/reading.svg | 10 +-- src/resources/icons/recycle_bin.svg | 2 +- src/resources/icons/remove_split.svg | 2 +- src/resources/icons/save_exit.svg | 2 +- src/resources/icons/settings.svg | 2 +- src/resources/icons/snippet_info.svg | 4 +- src/resources/icons/snippets.svg | 16 ++-- src/resources/icons/split_window.svg | 2 +- src/resources/themes/v_white/v_white.palette | 35 +++++++- src/resources/themes/v_white/v_white.qss | 15 +++- src/src.pro | 6 +- src/utils/viconutils.cpp | 38 ++++++++ src/utils/viconutils.h | 92 ++++++++++++++++++++ src/vattachmentlist.cpp | 11 +-- src/vdirectorytree.cpp | 19 ++-- src/vedit.cpp | 7 +- src/veditwindow.cpp | 41 ++++----- src/vfilelist.cpp | 19 ++-- src/vmainwindow.cpp | 72 +++++++-------- src/vmdeditor.cpp | 5 +- src/vnotebookselector.cpp | 13 +-- src/vsnippetlist.cpp | 13 +-- src/vwebview.cpp | 3 +- 72 files changed, 398 insertions(+), 210 deletions(-) create mode 100644 src/utils/viconutils.cpp create mode 100644 src/utils/viconutils.h diff --git a/src/dialog/vfindreplacedialog.cpp b/src/dialog/vfindreplacedialog.cpp index b83672f8..0200390d 100644 --- a/src/dialog/vfindreplacedialog.cpp +++ b/src/dialog/vfindreplacedialog.cpp @@ -1,6 +1,8 @@ #include "vfindreplacedialog.h" #include +#include "utils/viconutils.h" + VFindReplaceDialog::VFindReplaceDialog(QWidget *p_parent) : QWidget(p_parent), m_options(0), m_replaceAvailable(true) { @@ -11,7 +13,7 @@ void VFindReplaceDialog::setupUI() { QLabel *titleLabel = new QLabel(tr("Find/Replace")); titleLabel->setProperty("TitleLabel", true); - m_closeBtn = new QPushButton(QIcon(":/resources/icons/close.svg"), ""); + m_closeBtn = new QPushButton(VIconUtils::titleIcon(":/resources/icons/close.svg"), ""); m_closeBtn->setProperty("TitleBtn", true); QHBoxLayout *titleLayout = new QHBoxLayout(); titleLayout->addWidget(titleLabel); diff --git a/src/dialog/vnewfiledialog.cpp b/src/dialog/vnewfiledialog.cpp index dd5486e1..5fc5e702 100644 --- a/src/dialog/vnewfiledialog.cpp +++ b/src/dialog/vnewfiledialog.cpp @@ -5,6 +5,7 @@ #include "vlineedit.h" #include "utils/vutils.h" #include "utils/vmetawordmanager.h" +#include "utils/viconutils.h" extern VConfigManager *g_config; @@ -56,8 +57,8 @@ void VNewFileDialog::setupUI(const QString &p_title, m_templateCB->setToolTip(tr("Choose a template (magic word supported)")); m_templateCB->setSizeAdjustPolicy(QComboBox::AdjustToContents); - QPushButton *templateBtn = new QPushButton(QIcon(":/resources/icons/manage_template.svg"), - ""); + QPushButton *templateBtn = new QPushButton(VIconUtils::buttonIcon(":/resources/icons/manage_template.svg"), + ""); templateBtn->setToolTip(tr("Manage Templates")); templateBtn->setProperty("FlatBtn", true); connect(templateBtn, &QPushButton::clicked, diff --git a/src/resources/icons/add_attachment.svg b/src/resources/icons/add_attachment.svg index c4b273c4..b9e8f00d 100644 --- a/src/resources/icons/add_attachment.svg +++ b/src/resources/icons/add_attachment.svg @@ -3,5 +3,5 @@ - + diff --git a/src/resources/icons/add_snippet.svg b/src/resources/icons/add_snippet.svg index c4b273c4..b9e8f00d 100644 --- a/src/resources/icons/add_snippet.svg +++ b/src/resources/icons/add_snippet.svg @@ -3,5 +3,5 @@ - + diff --git a/src/resources/icons/add_style.svg b/src/resources/icons/add_style.svg index 86bd5b44..689eeeed 100644 --- a/src/resources/icons/add_style.svg +++ b/src/resources/icons/add_style.svg @@ -3,5 +3,5 @@ - + diff --git a/src/resources/icons/apply_snippet.svg b/src/resources/icons/apply_snippet.svg index 1865c8bd..a1a3b6ef 100644 --- a/src/resources/icons/apply_snippet.svg +++ b/src/resources/icons/apply_snippet.svg @@ -4,13 +4,13 @@ - - - - - - - - + + + + + + + + diff --git a/src/resources/icons/attachment.svg b/src/resources/icons/attachment.svg index a5ffa065..8b7b4ed5 100644 --- a/src/resources/icons/attachment.svg +++ b/src/resources/icons/attachment.svg @@ -5,7 +5,7 @@ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve"> - B - \ No newline at end of file + diff --git a/src/resources/icons/close.svg b/src/resources/icons/close.svg index 2e111a9e..ce23b83e 100644 --- a/src/resources/icons/close.svg +++ b/src/resources/icons/close.svg @@ -3,7 +3,7 @@ - diff --git a/src/resources/icons/close_note_tb.svg b/src/resources/icons/close_note_tb.svg index 2e111a9e..ce23b83e 100644 --- a/src/resources/icons/close_note_tb.svg +++ b/src/resources/icons/close_note_tb.svg @@ -3,7 +3,7 @@ - diff --git a/src/resources/icons/code_block.svg b/src/resources/icons/code_block.svg index 82e44a14..2f8ce405 100644 --- a/src/resources/icons/code_block.svg +++ b/src/resources/icons/code_block.svg @@ -1,6 +1,6 @@ Layer 1 - # + # diff --git a/src/resources/icons/copy.svg b/src/resources/icons/copy.svg index 75b8c0ba..7ababcd8 100644 --- a/src/resources/icons/copy.svg +++ b/src/resources/icons/copy.svg @@ -4,8 +4,8 @@ - - + diff --git a/src/resources/icons/create_note.svg b/src/resources/icons/create_note.svg index 86bd5b44..689eeeed 100644 --- a/src/resources/icons/create_note.svg +++ b/src/resources/icons/create_note.svg @@ -3,5 +3,5 @@ - + diff --git a/src/resources/icons/create_note_tb.svg b/src/resources/icons/create_note_tb.svg index 4b810d0e..411ae214 100644 --- a/src/resources/icons/create_note_tb.svg +++ b/src/resources/icons/create_note_tb.svg @@ -3,7 +3,7 @@ - diff --git a/src/resources/icons/create_notebook.svg b/src/resources/icons/create_notebook.svg index 86bd5b44..689eeeed 100644 --- a/src/resources/icons/create_notebook.svg +++ b/src/resources/icons/create_notebook.svg @@ -3,5 +3,5 @@ - + diff --git a/src/resources/icons/create_rootdir.svg b/src/resources/icons/create_rootdir.svg index 86bd5b44..689eeeed 100644 --- a/src/resources/icons/create_rootdir.svg +++ b/src/resources/icons/create_rootdir.svg @@ -3,5 +3,5 @@ - + diff --git a/src/resources/icons/create_rootdir_tb.svg b/src/resources/icons/create_rootdir_tb.svg index fa77fea2..672e65f5 100644 --- a/src/resources/icons/create_rootdir_tb.svg +++ b/src/resources/icons/create_rootdir_tb.svg @@ -3,7 +3,7 @@ - diff --git a/src/resources/icons/create_subdir.svg b/src/resources/icons/create_subdir.svg index 76f13692..cde438a1 100644 --- a/src/resources/icons/create_subdir.svg +++ b/src/resources/icons/create_subdir.svg @@ -1,9 +1,9 @@ Layer 1 - + - + diff --git a/src/resources/icons/cut.svg b/src/resources/icons/cut.svg index 264e7c2b..58c392ed 100644 --- a/src/resources/icons/cut.svg +++ b/src/resources/icons/cut.svg @@ -4,16 +4,16 @@ - - - - diff --git a/src/resources/icons/delete_dir.svg b/src/resources/icons/delete_dir.svg index ec2afc25..366b12cc 100644 --- a/src/resources/icons/delete_dir.svg +++ b/src/resources/icons/delete_dir.svg @@ -3,7 +3,7 @@ - diff --git a/src/resources/icons/delete_note.svg b/src/resources/icons/delete_note.svg index ec2afc25..366b12cc 100644 --- a/src/resources/icons/delete_note.svg +++ b/src/resources/icons/delete_note.svg @@ -3,7 +3,7 @@ - diff --git a/src/resources/icons/delete_notebook.svg b/src/resources/icons/delete_notebook.svg index ec2afc25..366b12cc 100644 --- a/src/resources/icons/delete_notebook.svg +++ b/src/resources/icons/delete_notebook.svg @@ -3,7 +3,7 @@ - diff --git a/src/resources/icons/delete_snippet.svg b/src/resources/icons/delete_snippet.svg index 1631e74d..382a85ce 100644 --- a/src/resources/icons/delete_snippet.svg +++ b/src/resources/icons/delete_snippet.svg @@ -3,7 +3,7 @@ - diff --git a/src/resources/icons/dir_info.svg b/src/resources/icons/dir_info.svg index e70c4ced..a9ea538a 100644 --- a/src/resources/icons/dir_info.svg +++ b/src/resources/icons/dir_info.svg @@ -4,7 +4,7 @@ - - + + diff --git a/src/resources/icons/dir_item.svg b/src/resources/icons/dir_item.svg index fa77fea2..672e65f5 100644 --- a/src/resources/icons/dir_item.svg +++ b/src/resources/icons/dir_item.svg @@ -3,7 +3,7 @@ - diff --git a/src/resources/icons/discard_exit.svg b/src/resources/icons/discard_exit.svg index 686e46a6..7cc62972 100644 --- a/src/resources/icons/discard_exit.svg +++ b/src/resources/icons/discard_exit.svg @@ -3,7 +3,7 @@ - diff --git a/src/resources/icons/edit_note.svg b/src/resources/icons/edit_note.svg index 21eb048e..c4283b86 100644 --- a/src/resources/icons/edit_note.svg +++ b/src/resources/icons/edit_note.svg @@ -4,11 +4,11 @@ - + - + - diff --git a/src/resources/icons/editing.svg b/src/resources/icons/editing.svg index a0be3454..05fd34cc 100644 --- a/src/resources/icons/editing.svg +++ b/src/resources/icons/editing.svg @@ -5,9 +5,9 @@ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve"> - - + - + diff --git a/src/resources/icons/expand.svg b/src/resources/icons/expand.svg index 1cbcdf9d..53ed9a2f 100644 --- a/src/resources/icons/expand.svg +++ b/src/resources/icons/expand.svg @@ -4,9 +4,9 @@ - - - - + + + + diff --git a/src/resources/icons/find_replace.svg b/src/resources/icons/find_replace.svg index 9c51b980..c3f6bf6f 100644 --- a/src/resources/icons/find_replace.svg +++ b/src/resources/icons/find_replace.svg @@ -3,7 +3,7 @@ - diff --git a/src/resources/icons/flash_page.svg b/src/resources/icons/flash_page.svg index 8390f3ef..555ed2c3 100644 --- a/src/resources/icons/flash_page.svg +++ b/src/resources/icons/flash_page.svg @@ -4,14 +4,14 @@ - - - - + + + diff --git a/src/resources/icons/heading.svg b/src/resources/icons/heading.svg index b4273b87..d6c3f9d7 100644 --- a/src/resources/icons/heading.svg +++ b/src/resources/icons/heading.svg @@ -2,6 +2,6 @@ Layer 1 - H + H diff --git a/src/resources/icons/import_note.svg b/src/resources/icons/import_note.svg index 8c9d75b9..b7e13b74 100644 --- a/src/resources/icons/import_note.svg +++ b/src/resources/icons/import_note.svg @@ -4,7 +4,7 @@ - - - + diff --git a/src/resources/icons/link.svg b/src/resources/icons/link.svg index 97465186..81802452 100644 --- a/src/resources/icons/link.svg +++ b/src/resources/icons/link.svg @@ -4,11 +4,11 @@ - - + - diff --git a/src/resources/icons/locate_attachment.svg b/src/resources/icons/locate_attachment.svg index 19545aa6..ce387636 100644 --- a/src/resources/icons/locate_attachment.svg +++ b/src/resources/icons/locate_attachment.svg @@ -3,7 +3,7 @@ - diff --git a/src/resources/icons/locate_note.svg b/src/resources/icons/locate_note.svg index e2dd098c..45fe23e7 100644 --- a/src/resources/icons/locate_note.svg +++ b/src/resources/icons/locate_note.svg @@ -5,7 +5,7 @@ width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve"> - - diff --git a/src/resources/icons/manage_template.svg b/src/resources/icons/manage_template.svg index 19545aa6..ce387636 100644 --- a/src/resources/icons/manage_template.svg +++ b/src/resources/icons/manage_template.svg @@ -3,7 +3,7 @@ - diff --git a/src/resources/icons/move_tab_left.svg b/src/resources/icons/move_tab_left.svg index 37f3511b..e87c7333 100644 --- a/src/resources/icons/move_tab_left.svg +++ b/src/resources/icons/move_tab_left.svg @@ -3,7 +3,7 @@ - diff --git a/src/resources/icons/move_tab_right.svg b/src/resources/icons/move_tab_right.svg index 332708ba..403d203b 100644 --- a/src/resources/icons/move_tab_right.svg +++ b/src/resources/icons/move_tab_right.svg @@ -3,7 +3,7 @@ - diff --git a/src/resources/icons/note_info.svg b/src/resources/icons/note_info.svg index e70c4ced..a9ea538a 100644 --- a/src/resources/icons/note_info.svg +++ b/src/resources/icons/note_info.svg @@ -4,7 +4,7 @@ - - + + diff --git a/src/resources/icons/note_info_tb.svg b/src/resources/icons/note_info_tb.svg index e70c4ced..a9ea538a 100644 --- a/src/resources/icons/note_info_tb.svg +++ b/src/resources/icons/note_info_tb.svg @@ -4,7 +4,7 @@ - - + + diff --git a/src/resources/icons/notebook_info.svg b/src/resources/icons/notebook_info.svg index e70c4ced..a9ea538a 100644 --- a/src/resources/icons/notebook_info.svg +++ b/src/resources/icons/notebook_info.svg @@ -4,7 +4,7 @@ - - + + diff --git a/src/resources/icons/notebook_item.svg b/src/resources/icons/notebook_item.svg index 77fd4883..eff98dc8 100644 --- a/src/resources/icons/notebook_item.svg +++ b/src/resources/icons/notebook_item.svg @@ -3,7 +3,7 @@ - - + - + - + - + - - - + + + diff --git a/src/resources/icons/paste.svg b/src/resources/icons/paste.svg index 84bb8e29..80d8a17d 100644 --- a/src/resources/icons/paste.svg +++ b/src/resources/icons/paste.svg @@ -4,11 +4,11 @@ - - + diff --git a/src/resources/icons/print.svg b/src/resources/icons/print.svg index ff2f1c33..6d355bf7 100644 --- a/src/resources/icons/print.svg +++ b/src/resources/icons/print.svg @@ -4,11 +4,11 @@ - - - - + + + diff --git a/src/resources/icons/reading.svg b/src/resources/icons/reading.svg index ca798b03..04a767b2 100644 --- a/src/resources/icons/reading.svg +++ b/src/resources/icons/reading.svg @@ -4,11 +4,11 @@ - - - - - + + + + diff --git a/src/resources/icons/recycle_bin.svg b/src/resources/icons/recycle_bin.svg index 89b5feec..88730b7d 100644 --- a/src/resources/icons/recycle_bin.svg +++ b/src/resources/icons/recycle_bin.svg @@ -5,6 +5,6 @@ Layer 1 copy - + diff --git a/src/resources/icons/remove_split.svg b/src/resources/icons/remove_split.svg index 42be227f..fdc83bd6 100644 --- a/src/resources/icons/remove_split.svg +++ b/src/resources/icons/remove_split.svg @@ -3,7 +3,7 @@ - diff --git a/src/resources/icons/save_exit.svg b/src/resources/icons/save_exit.svg index 3f14a4de..357d3026 100644 --- a/src/resources/icons/save_exit.svg +++ b/src/resources/icons/save_exit.svg @@ -3,7 +3,7 @@ - diff --git a/src/resources/icons/settings.svg b/src/resources/icons/settings.svg index 49c969a9..913c2a7d 100644 --- a/src/resources/icons/settings.svg +++ b/src/resources/icons/settings.svg @@ -3,7 +3,7 @@ - - - + + diff --git a/src/resources/icons/snippets.svg b/src/resources/icons/snippets.svg index 05bab769..42d9b616 100644 --- a/src/resources/icons/snippets.svg +++ b/src/resources/icons/snippets.svg @@ -4,13 +4,13 @@ - - - - - - - - + + + + + + + + diff --git a/src/resources/icons/split_window.svg b/src/resources/icons/split_window.svg index c68272da..b778bb9f 100644 --- a/src/resources/icons/split_window.svg +++ b/src/resources/icons/split_window.svg @@ -3,7 +3,7 @@ - diff --git a/src/resources/themes/v_white/v_white.palette b/src/resources/themes/v_white/v_white.palette index 3d2daf3e..04df7827 100644 --- a/src/resources/themes/v_white/v_white.palette +++ b/src/resources/themes/v_white/v_white.palette @@ -16,7 +16,7 @@ title_fg=#000000 title_bg=#DADBDB hover_fg=#000000 -hover_bg=#DCDCDC +hover_bg=#BCBCBC selected_fg=#000000 selected_bg=#D3D3D3 @@ -43,6 +43,9 @@ content_bg=#FFFFFF selection_fg=#000000 selection_bg=#64b5f6 +danger_red=#C9302C +icon_fg=#222222 + [soft_defined] ; VAvatar. avatar_border_bg=@title_bg @@ -57,7 +60,12 @@ navigation_label_bg=#F4F4F4 ; Style of the bubble of VButtonWithWidget. bubble_fg=#FFFFFF -bubble_bg=#6C6C6C +bubble_bg=#616161 + +; Icons' foreground. +danger_icon_fg=@danger_red +item_icon_fg=@icon_fg +title_icon_fg=@icon_fg [widgets] ; Widget color attributes. @@ -79,6 +87,8 @@ menu_bg=@base_bg menu_fg=@base_fg menu_item_selected_bg=@selected_bg menu_separator_bg=@separator_bg +menu_icon_fg=@icon_fg +menu_icon_danger_fg=@danger_icon_fg ; Tooltip. tooltip_border=@border_bg @@ -89,6 +99,12 @@ tooltip_fg=@base_fg toolbar_bg=@main_bg toolbutton_hover_bg=@hover_bg toolbutton_pressed_bg=@pressed_bg +toolbutton_checked_bg=@selected_bg +toolbutton_icon_fg=@icon_fg +toolbutton_icon_danger_fg=@danger_icon_fg + +; Toolbox. +toolbox_icon_fg=@icon_fg ; Dockwidget. dockwidget_title_bg=@title_bg @@ -99,6 +115,7 @@ pushbutton_fg=@base_fg pushbutton_bg=transparent pushbutton_border=@border_bg pushbutton_pressed_bg=@pressed_bg +pushbutton_checked_bg=@selected_bg pushbutton_hover_bg=@hover_bg pushbutton_default_border=#424242 @@ -125,6 +142,9 @@ pushbutton_dangerbtn_hover_fg=#FFF pushbutton_dangerbtn_hover_bg=#C9302C pushbutton_dangerbtn_hover_border=#AC2925 +button_icon_fg=@icon_fg +button_icon_danger_fg=@danger_icon_fg + ; ComboBox. combobox_border=@border_bg combobox_fg=@content_fg @@ -135,6 +155,7 @@ combobox_view_selected_fg=@selected_fg combobox_view_item_hover_fg=@hover_fg combobox_view_item_hover_bg=@hover_bg combobox_focus_bg=@focus_bg +combobox_item_icon_fg=@item_icon_fg ; Label. label_fg=@base_fg @@ -165,7 +186,10 @@ tabbar_hover_bg=@hover_bg tabbar_hover_border=@border_bg tabbar_closebutton_hover_bg=@hover_bg -tabbar_clostbutton_focus_bg=@focus_bg +tabbar_closebutton_focus_bg=@focus_bg + +tabbar_icon_fg=@icon_fg +tabbar_icon_special_fg=@danger_red ; SelectorItem. selectoritem_border=@base_fg @@ -186,6 +210,7 @@ treeview_item_selected_avtive_fg=@active_fg treeview_item_selected_avtive_bg=@active_bg treeview_item_selected_inactive_fg=@inactive_fg treeview_item_selected_inactive_bg=@inactive_bg +treeview_item_icon_fg=@item_icon_fg ; ListView. listview_fg=@content_fg @@ -211,3 +236,7 @@ statusbar_bg=@main_bg scrollbar_bg=#EEEEEE scrollbar_handle_bg=#D0D0D0 scrollbar_addline_bg=#E0E0E0 + +; VEditWindow. +editwindow_corner_icon_fg=@icon_fg +editwindow_corner_icon_inactive_fg=#808080 diff --git a/src/resources/themes/v_white/v_white.qss b/src/resources/themes/v_white/v_white.qss index c4a05491..2436f25e 100644 --- a/src/resources/themes/v_white/v_white.qss +++ b/src/resources/themes/v_white/v_white.qss @@ -108,6 +108,10 @@ QToolButton::pressed { background: @toolbutton_pressed_bg; } +QToolButton::checked { + background: @toolbutton_checked_bg; +} + /* the subcontrols below are used only in the MenuButtonPopup mode */ QToolButton::menu-button { border: none; @@ -147,6 +151,10 @@ QPushButton:pressed { background-color: @pushbutton_pressed_bg; } +QPushButton:checked { + background-color: @pushbutton_checked_bg; +} + QPushButton:hover { background-color: @pushbutton_hover_bg; } @@ -496,7 +504,7 @@ QTabBar::close-button:hover { QTabBar::close-button:focus { image: url(close.svg); - background-color: @tabbar_clostbutton_focus_bg; + background-color: @tabbar_closebutton_focus_bg; } /* End QTabBar */ @@ -644,3 +652,8 @@ QStatusBar { QWidget[MainEditor="true"] { border: none; } + +QDialog { + color: @base_fg; + background: @base_bg; +} diff --git a/src/src.pro b/src/src.pro index 4b042f0b..49554fe3 100644 --- a/src/src.pro +++ b/src/src.pro @@ -100,7 +100,8 @@ SOURCES += main.cpp\ vinsertselector.cpp \ utils/vclipboardutils.cpp \ vpalette.cpp \ - vbuttonmenuitem.cpp + vbuttonmenuitem.cpp \ + utils/viconutils.cpp HEADERS += vmainwindow.h \ vdirectorytree.h \ @@ -187,7 +188,8 @@ HEADERS += vmainwindow.h \ vinsertselector.h \ utils/vclipboardutils.h \ vpalette.h \ - vbuttonmenuitem.h + vbuttonmenuitem.h \ + utils/viconutils.h RESOURCES += \ vnote.qrc \ diff --git a/src/utils/viconutils.cpp b/src/utils/viconutils.cpp new file mode 100644 index 00000000..30ce4122 --- /dev/null +++ b/src/utils/viconutils.cpp @@ -0,0 +1,38 @@ +#include "viconutils.h" + +#include +#include +#include +#include +#include + +#include "vutils.h" + +VIconUtils::VIconUtils() +{ + +} + +QIcon VIconUtils::icon(const QString &p_file, const QString &p_fg) +{ + QFileInfo fi(p_file); + bool isSvg = fi.suffix().toLower() == "svg"; + if (p_fg.isEmpty() || !isSvg) { + return QIcon(p_file); + } + + QString content = VUtils::readFileFromDisk(p_file); + Q_ASSERT(!content.isEmpty()); + // Must have a # to avoid fill="none". + QRegExp reg("(\\s|\")(fill|stroke)(:|(=\"))#[^#\"\\s]+"); + if (content.indexOf(reg) == -1) { + return QIcon(p_file); + } + + content.replace(reg, QString("\\1\\2\\3%1").arg(p_fg)); + QByteArray data = content.toLocal8Bit(); + QPixmap pixmap; + pixmap.loadFromData(data, "svg"); + + return QIcon(pixmap); +} diff --git a/src/utils/viconutils.h b/src/utils/viconutils.h new file mode 100644 index 00000000..b3cb3458 --- /dev/null +++ b/src/utils/viconutils.h @@ -0,0 +1,92 @@ +#ifndef VICONUTILS_H +#define VICONUTILS_H + +#include +#include + +#include "vpalette.h" + +extern VPalette *g_palette; + + +class VIconUtils +{ +public: + // Get an icon from @p_file file. May change the foreground of the icon. + static QIcon icon(const QString &p_file, const QString &p_fg = QString()); + + static QIcon toolButtonIcon(const QString &p_file) + { + return icon(p_file, g_palette->color("toolbutton_icon_fg")); + } + + static QIcon toolButtonDangerIcon(const QString &p_file) + { + return icon(p_file, g_palette->color("toolbutton_icon_danger_fg")); + } + + static QIcon menuIcon(const QString &p_file) + { + return icon(p_file, g_palette->color("menu_icon_fg")); + } + + static QIcon menuDangerIcon(const QString &p_file) + { + return icon(p_file, g_palette->color("menu_icon_danger_fg")); + } + + static QIcon toolBoxIcon(const QString &p_file) + { + return icon(p_file, g_palette->color("toolbox_icon_fg")); + } + + static QIcon comboBoxIcon(const QString &p_file) + { + return icon(p_file, g_palette->color("combobox_item_icon_fg")); + } + + static QIcon treeViewIcon(const QString &p_file) + { + return icon(p_file, g_palette->color("treeview_item_icon_fg")); + } + + static QIcon tabBarIcon(const QString &p_file) + { + return icon(p_file, g_palette->color("tabbar_icon_fg")); + } + + static QIcon tabBarSpecialIcon(const QString &p_file) + { + return icon(p_file, g_palette->color("tabbar_icon_special_fg")); + } + + static QIcon editWindowCornerIcon(const QString &p_file) + { + return icon(p_file, g_palette->color("editwindow_corner_icon_fg")); + } + + static QIcon editWindowCornerInactiveIcon(const QString &p_file) + { + return icon(p_file, g_palette->color("editwindow_corner_icon_inactive_fg")); + } + + static QIcon titleIcon(const QString &p_file) + { + return icon(p_file, g_palette->color("title_icon_fg")); + } + + static QIcon buttonIcon(const QString &p_file) + { + return icon(p_file, g_palette->color("button_icon_fg")); + } + + static QIcon buttonDangerIcon(const QString &p_file) + { + return icon(p_file, g_palette->color("button_icon_danger_fg")); + } + +private: + VIconUtils(); +}; + +#endif // VICONUTILS_H diff --git a/src/vattachmentlist.cpp b/src/vattachmentlist.cpp index a2936f4d..f314de0c 100644 --- a/src/vattachmentlist.cpp +++ b/src/vattachmentlist.cpp @@ -9,6 +9,7 @@ #include "dialog/vconfirmdeletiondialog.h" #include "dialog/vsortdialog.h" #include "utils/vimnavigationforwidget.h" +#include "utils/viconutils.h" extern VConfigManager *g_config; extern VMainWindow *g_mainWin; @@ -25,14 +26,14 @@ VAttachmentList::VAttachmentList(QWidget *p_parent) void VAttachmentList::setupUI() { - m_addBtn = new QPushButton(QIcon(":/resources/icons/add_attachment.svg"), ""); + m_addBtn = new QPushButton(VIconUtils::buttonIcon(":/resources/icons/add_attachment.svg"), ""); m_addBtn->setToolTip(tr("Add")); m_addBtn->setProperty("FlatBtn", true); m_addBtn->setDefault(true); connect(m_addBtn, &QPushButton::clicked, this, &VAttachmentList::addAttachment); - m_clearBtn = new QPushButton(QIcon(":/resources/icons/clear_attachment.svg"), ""); + m_clearBtn = new QPushButton(VIconUtils::buttonDangerIcon(":/resources/icons/clear_attachment.svg"), ""); m_clearBtn->setToolTip(tr("Clear")); m_clearBtn->setProperty("FlatBtn", true); connect(m_clearBtn, &QPushButton::clicked, @@ -76,7 +77,7 @@ void VAttachmentList::setupUI() } }); - m_locateBtn = new QPushButton(QIcon(":/resources/icons/locate_attachment.svg"), ""); + m_locateBtn = new QPushButton(VIconUtils::buttonIcon(":/resources/icons/locate_attachment.svg"), ""); m_locateBtn->setToolTip(tr("Open Folder")); m_locateBtn->setProperty("FlatBtn", true); connect(m_locateBtn, &QPushButton::clicked, @@ -124,14 +125,14 @@ void VAttachmentList::initActions() handleItemActivated(item); }); - m_deleteAct = new QAction(QIcon(":/resources/icons/delete_attachment.svg"), + m_deleteAct = new QAction(VIconUtils::menuDangerIcon(":/resources/icons/delete_attachment.svg"), tr("&Delete"), this); m_deleteAct->setToolTip(tr("Delete selected attachments")); connect(m_deleteAct, &QAction::triggered, this, &VAttachmentList::deleteSelectedItems); - m_sortAct = new QAction(QIcon(":/resources/icons/sort.svg"), + m_sortAct = new QAction(VIconUtils::menuIcon(":/resources/icons/sort.svg"), tr("&Sort"), this); m_sortAct->setToolTip(tr("Sort attachments manually")); diff --git a/src/vdirectorytree.cpp b/src/vdirectorytree.cpp index 63b30815..9cd47156 100644 --- a/src/vdirectorytree.cpp +++ b/src/vdirectorytree.cpp @@ -11,6 +11,7 @@ #include "vmainwindow.h" #include "dialog/vsortdialog.h" #include "utils/vimnavigationforwidget.h" +#include "utils/viconutils.h" extern VMainWindow *g_mainWin; @@ -76,43 +77,43 @@ void VDirectoryTree::initShortcuts() void VDirectoryTree::initActions() { - newRootDirAct = new QAction(QIcon(":/resources/icons/create_rootdir.svg"), + newRootDirAct = new QAction(VIconUtils::menuIcon(":/resources/icons/create_rootdir.svg"), tr("New &Root Folder"), this); newRootDirAct->setToolTip(tr("Create a root folder in current notebook")); connect(newRootDirAct, &QAction::triggered, this, &VDirectoryTree::newRootDirectory); - newSubDirAct = new QAction(QIcon(":/resources/icons/create_subdir.svg"), + newSubDirAct = new QAction(VIconUtils::menuIcon(":/resources/icons/create_subdir.svg"), tr("&New Subfolder"), this); newSubDirAct->setToolTip(tr("Create a subfolder")); connect(newSubDirAct, &QAction::triggered, this, &VDirectoryTree::newSubDirectory); - deleteDirAct = new QAction(QIcon(":/resources/icons/delete_dir.svg"), + deleteDirAct = new QAction(VIconUtils::menuDangerIcon(":/resources/icons/delete_dir.svg"), tr("&Delete"), this); deleteDirAct->setToolTip(tr("Delete selected folder")); connect(deleteDirAct, &QAction::triggered, this, &VDirectoryTree::deleteSelectedDirectory); - dirInfoAct = new QAction(QIcon(":/resources/icons/dir_info.svg"), + dirInfoAct = new QAction(VIconUtils::menuIcon(":/resources/icons/dir_info.svg"), tr("&Info\t%1").arg(VUtils::getShortcutText(c_infoShortcutSequence)), this); dirInfoAct->setToolTip(tr("View and edit current folder's information")); connect(dirInfoAct, &QAction::triggered, this, &VDirectoryTree::editDirectoryInfo); - copyAct = new QAction(QIcon(":/resources/icons/copy.svg"), + copyAct = new QAction(VIconUtils::menuIcon(":/resources/icons/copy.svg"), tr("&Copy\t%1").arg(VUtils::getShortcutText(c_copyShortcutSequence)), this); copyAct->setToolTip(tr("Copy selected folders")); connect(copyAct, &QAction::triggered, this, &VDirectoryTree::copySelectedDirectories); - cutAct = new QAction(QIcon(":/resources/icons/cut.svg"), + cutAct = new QAction(VIconUtils::menuIcon(":/resources/icons/cut.svg"), tr("C&ut\t%1").arg(VUtils::getShortcutText(c_cutShortcutSequence)), this); cutAct->setToolTip(tr("Cut selected folders")); connect(cutAct, &QAction::triggered, this, &VDirectoryTree::cutSelectedDirectories); - pasteAct = new QAction(QIcon(":/resources/icons/paste.svg"), + pasteAct = new QAction(VIconUtils::menuIcon(":/resources/icons/paste.svg"), tr("&Paste\t%1").arg(VUtils::getShortcutText(c_pasteShortcutSequence)), this); pasteAct->setToolTip(tr("Paste folders in this folder")); connect(pasteAct, &QAction::triggered, @@ -128,7 +129,7 @@ void VDirectoryTree::initActions() connect(m_reloadAct, &QAction::triggered, this, &VDirectoryTree::reloadFromDisk); - m_sortAct = new QAction(QIcon(":/resources/icons/sort.svg"), + m_sortAct = new QAction(VIconUtils::menuIcon(":/resources/icons/sort.svg"), tr("&Sort"), this); m_sortAct->setToolTip(tr("Sort folders in this folder/notebook manually")); @@ -173,7 +174,7 @@ void VDirectoryTree::fillTreeItem(QTreeWidgetItem *p_item, VDirectory *p_directo p_item->setText(col, name); p_item->setToolTip(col, name); p_item->setData(col, Qt::UserRole, QVariant::fromValue(p_directory)); - p_item->setIcon(col, QIcon(":/resources/icons/dir_item.svg")); + p_item->setIcon(col, VIconUtils::treeViewIcon(":/resources/icons/dir_item.svg")); } void VDirectoryTree::updateDirectoryTree() diff --git a/src/vedit.cpp b/src/vedit.cpp index fb89ceb8..341bf2ff 100644 --- a/src/vedit.cpp +++ b/src/vedit.cpp @@ -11,6 +11,7 @@ #include "veditoperations.h" #include "vedittab.h" #include "dialog/vinsertlinkdialog.h" +#include "utils/viconutils.h" extern VConfigManager *g_config; @@ -766,13 +767,13 @@ void VEdit::contextMenuEvent(QContextMenuEvent *p_event) VEditTab *editTab = dynamic_cast(parent()); V_ASSERT(editTab); if (editTab->isEditMode()) { - QAction *saveExitAct = new QAction(QIcon(":/resources/icons/save_exit.svg"), + QAction *saveExitAct = new QAction(VIconUtils::menuIcon(":/resources/icons/save_exit.svg"), tr("&Save Changes And Read"), this); saveExitAct->setToolTip(tr("Save changes and exit edit mode")); connect(saveExitAct, &QAction::triggered, this, &VEdit::handleSaveExitAct); - QAction *discardExitAct = new QAction(QIcon(":/resources/icons/discard_exit.svg"), + QAction *discardExitAct = new QAction(VIconUtils::menuIcon(":/resources/icons/discard_exit.svg"), tr("&Discard Changes And Read"), this); discardExitAct->setToolTip(tr("Discard changes and exit edit mode")); connect(discardExitAct, &QAction::triggered, @@ -785,7 +786,7 @@ void VEdit::contextMenuEvent(QContextMenuEvent *p_event) } } else if (m_file->isModifiable()) { // HTML. - QAction *editAct= new QAction(QIcon(":/resources/icons/edit_note.svg"), + QAction *editAct= new QAction(VIconUtils::menuIcon(":/resources/icons/edit_note.svg"), tr("&Edit"), this); editAct->setToolTip(tr("Edit current note")); connect(editAct, &QAction::triggered, diff --git a/src/veditwindow.cpp b/src/veditwindow.cpp index 8381625f..6f2b9402 100644 --- a/src/veditwindow.cpp +++ b/src/veditwindow.cpp @@ -11,6 +11,7 @@ #include "vhtmltab.h" #include "vfilelist.h" #include "vconfigmanager.h" +#include "utils/viconutils.h" extern VConfigManager *g_config; extern VMainWindow *g_mainWin; @@ -57,25 +58,25 @@ VEditWindow::VEditWindow(VEditArea *editArea, QWidget *parent) void VEditWindow::initTabActions() { - m_locateAct = new QAction(QIcon(":/resources/icons/locate_note.svg"), + m_locateAct = new QAction(VIconUtils::menuIcon(":/resources/icons/locate_note.svg"), tr("Locate To Folder"), this); m_locateAct->setToolTip(tr("Locate the folder of current note")); connect(m_locateAct, &QAction::triggered, this, &VEditWindow::handleLocateAct); - m_moveLeftAct = new QAction(QIcon(":/resources/icons/move_tab_left.svg"), + m_moveLeftAct = new QAction(VIconUtils::menuIcon(":/resources/icons/move_tab_left.svg"), tr("Move One Split Left"), this); m_moveLeftAct->setToolTip(tr("Move current tab to the split on the left")); connect(m_moveLeftAct, &QAction::triggered, this, &VEditWindow::handleMoveLeftAct); - m_moveRightAct = new QAction(QIcon(":/resources/icons/move_tab_right.svg"), + m_moveRightAct = new QAction(VIconUtils::menuIcon(":/resources/icons/move_tab_right.svg"), tr("Move One Split Right"), this); m_moveRightAct->setToolTip(tr("Move current tab to the split on the right")); connect(m_moveRightAct, &QAction::triggered, this, &VEditWindow::handleMoveRightAct); - m_closeTabAct = new QAction(QIcon(":/resources/icons/close.svg"), + m_closeTabAct = new QAction(VIconUtils::menuIcon(":/resources/icons/close.svg"), tr("Close Tab"), this); m_closeTabAct->setToolTip(tr("Close current note tab")); connect(m_closeTabAct, &QAction::triggered, @@ -125,7 +126,7 @@ void VEditWindow::initTabActions() } }); - m_noteInfoAct = new QAction(QIcon(":/resources/icons/note_info.svg"), + m_noteInfoAct = new QAction(VIconUtils::menuIcon(":/resources/icons/note_info.svg"), tr("Note Info"), this); m_noteInfoAct->setToolTip(tr("View and edit information of the note")); connect(m_noteInfoAct, &QAction::triggered, @@ -169,7 +170,7 @@ void VEditWindow::initTabActions() editor->reloadFromDisk(); }); - m_recycleBinAct = new QAction(QIcon(":/resources/icons/recycle_bin.svg"), + m_recycleBinAct = new QAction(VIconUtils::menuIcon(":/resources/icons/recycle_bin.svg"), tr("&Recycle Bin"), this); m_recycleBinAct->setToolTip(tr("Open the recycle bin of this note")); connect(m_recycleBinAct, &QAction::triggered, @@ -200,7 +201,7 @@ void VEditWindow::initTabActions() void VEditWindow::setupCornerWidget() { // Left button - leftBtn = new QPushButton(QIcon(":/resources/icons/corner_tablist.svg"), + leftBtn = new QPushButton(VIconUtils::editWindowCornerIcon(":/resources/icons/corner_tablist.svg"), "", this); leftBtn->setProperty("CornerBtn", true); leftBtn->setToolTip(tr("Opened Notes List")); @@ -212,7 +213,7 @@ void VEditWindow::setupCornerWidget() // Right button // Actions - splitAct = new QAction(QIcon(":/resources/icons/split_window.svg"), + splitAct = new QAction(VIconUtils::menuIcon(":/resources/icons/split_window.svg"), tr("Split"), this); splitAct->setToolTip(tr("Split current window vertically")); connect(splitAct, &QAction::triggered, @@ -220,13 +221,13 @@ void VEditWindow::setupCornerWidget() splitWindow(true); }); - removeSplitAct = new QAction(QIcon(":/resources/icons/remove_split.svg"), + removeSplitAct = new QAction(VIconUtils::menuIcon(":/resources/icons/remove_split.svg"), tr("Remove split"), this); removeSplitAct->setToolTip(tr("Remove current split window")); connect(removeSplitAct, &QAction::triggered, this, &VEditWindow::removeSplit); - rightBtn = new QPushButton(QIcon(":/resources/icons/corner_menu.svg"), + rightBtn = new QPushButton(VIconUtils::editWindowCornerIcon(":/resources/icons/corner_menu.svg"), "", this); rightBtn->setProperty("CornerBtn", true); rightBtn->setToolTip(tr("Menu")); @@ -522,16 +523,16 @@ void VEditWindow::updateTabInfo(int p_index) setTabText(p_index, generateTabText(p_index, editor)); setTabToolTip(p_index, generateTooltip(file)); - QString iconUrl; + QIcon icon; if (editMode) { - iconUrl = editor->isModified() ? ":/resources/icons/editing_modified.svg" - : ":/resources/icons/editing.svg"; + icon = editor->isModified() ? VIconUtils::tabBarSpecialIcon(":/resources/icons/editing_modified.svg") + : VIconUtils::tabBarIcon(":/resources/icons/editing.svg"); } else { - iconUrl = editor->isModified() ? ":/resources/icons/reading_modified.svg" - : ":/resources/icons/reading.svg"; + icon = editor->isModified() ? VIconUtils::tabBarSpecialIcon(":/resources/icons/reading_modified.svg") + : VIconUtils::tabBarIcon(":/resources/icons/reading.svg"); } - setTabIcon(p_index, QIcon(iconUrl)); + setTabIcon(p_index, icon); } void VEditWindow::updateAllTabsSequence() @@ -968,11 +969,11 @@ void VEditWindow::connectEditTab(const VEditTab *p_tab) void VEditWindow::setCurrentWindow(bool p_current) { if (p_current) { - rightBtn->setIcon(QIcon(":/resources/icons/corner_menu_cur.svg")); - leftBtn->setIcon(QIcon(":/resources/icons/corner_tablist_cur.svg")); + rightBtn->setIcon(VIconUtils::editWindowCornerIcon(":/resources/icons/corner_menu_cur.svg")); + leftBtn->setIcon(VIconUtils::editWindowCornerIcon(":/resources/icons/corner_tablist_cur.svg")); } else { - rightBtn->setIcon(QIcon(":/resources/icons/corner_menu.svg")); - leftBtn->setIcon(QIcon(":/resources/icons/corner_tablist.svg")); + rightBtn->setIcon(VIconUtils::editWindowCornerInactiveIcon(":/resources/icons/corner_menu.svg")); + leftBtn->setIcon(VIconUtils::editWindowCornerInactiveIcon(":/resources/icons/corner_tablist.svg")); } } diff --git a/src/vfilelist.cpp b/src/vfilelist.cpp index b2ac6b3b..c6355da5 100644 --- a/src/vfilelist.cpp +++ b/src/vfilelist.cpp @@ -16,6 +16,7 @@ #include "dialog/vsortdialog.h" #include "vmainwindow.h" #include "utils/vimnavigationforwidget.h" +#include "utils/viconutils.h" extern VConfigManager *g_config; extern VNote *g_vnote; @@ -86,7 +87,7 @@ void VFileList::initShortcuts() void VFileList::initActions() { - newFileAct = new QAction(QIcon(":/resources/icons/create_note.svg"), + newFileAct = new QAction(VIconUtils::menuIcon(":/resources/icons/create_note.svg"), tr("&New Note"), this); QString shortcutStr = VUtils::getShortcutText(g_config->getShortcutKeySequence("NewNote")); if (!shortcutStr.isEmpty()) { @@ -97,7 +98,7 @@ void VFileList::initActions() connect(newFileAct, SIGNAL(triggered(bool)), this, SLOT(newFile())); - m_openInReadAct = new QAction(QIcon(":/resources/icons/reading.svg"), + m_openInReadAct = new QAction(VIconUtils::menuIcon(":/resources/icons/reading.svg"), tr("&Open In Read Mode"), this); m_openInReadAct->setToolTip(tr("Open current note in read mode")); connect(m_openInReadAct, &QAction::triggered, @@ -108,7 +109,7 @@ void VFileList::initActions() } }); - m_openInEditAct = new QAction(QIcon(":/resources/icons/editing.svg"), + m_openInEditAct = new QAction(VIconUtils::menuIcon(":/resources/icons/editing.svg"), tr("Open In &Edit Mode"), this); m_openInEditAct->setToolTip(tr("Open current note in edit mode")); connect(m_openInEditAct, &QAction::triggered, @@ -119,31 +120,31 @@ void VFileList::initActions() } }); - deleteFileAct = new QAction(QIcon(":/resources/icons/delete_note.svg"), + deleteFileAct = new QAction(VIconUtils::menuDangerIcon(":/resources/icons/delete_note.svg"), tr("&Delete"), this); deleteFileAct->setToolTip(tr("Delete selected note")); connect(deleteFileAct, SIGNAL(triggered(bool)), this, SLOT(deleteSelectedFiles())); - fileInfoAct = new QAction(QIcon(":/resources/icons/note_info.svg"), + fileInfoAct = new QAction(VIconUtils::menuIcon(":/resources/icons/note_info.svg"), tr("&Info\t%1").arg(VUtils::getShortcutText(c_infoShortcutSequence)), this); fileInfoAct->setToolTip(tr("View and edit current note's information")); connect(fileInfoAct, SIGNAL(triggered(bool)), this, SLOT(fileInfo())); - copyAct = new QAction(QIcon(":/resources/icons/copy.svg"), + copyAct = new QAction(VIconUtils::menuIcon(":/resources/icons/copy.svg"), tr("&Copy\t%1").arg(VUtils::getShortcutText(c_copyShortcutSequence)), this); copyAct->setToolTip(tr("Copy selected notes")); connect(copyAct, &QAction::triggered, this, &VFileList::copySelectedFiles); - cutAct = new QAction(QIcon(":/resources/icons/cut.svg"), + cutAct = new QAction(VIconUtils::menuIcon(":/resources/icons/cut.svg"), tr("C&ut\t%1").arg(VUtils::getShortcutText(c_cutShortcutSequence)), this); cutAct->setToolTip(tr("Cut selected notes")); connect(cutAct, &QAction::triggered, this, &VFileList::cutSelectedFiles); - pasteAct = new QAction(QIcon(":/resources/icons/paste.svg"), + pasteAct = new QAction(VIconUtils::menuIcon(":/resources/icons/paste.svg"), tr("&Paste\t%1").arg(VUtils::getShortcutText(c_pasteShortcutSequence)), this); pasteAct->setToolTip(tr("Paste notes in current folder")); connect(pasteAct, &QAction::triggered, @@ -154,7 +155,7 @@ void VFileList::initActions() connect(m_openLocationAct, &QAction::triggered, this, &VFileList::openFileLocation); - m_sortAct = new QAction(QIcon(":/resources/icons/sort.svg"), + m_sortAct = new QAction(VIconUtils::menuIcon(":/resources/icons/sort.svg"), tr("&Sort"), this); m_sortAct->setToolTip(tr("Sort notes in this folder manually")); diff --git a/src/vmainwindow.cpp b/src/vmainwindow.cpp index 8f4aa0bb..8670a393 100644 --- a/src/vmainwindow.cpp +++ b/src/vmainwindow.cpp @@ -34,6 +34,7 @@ #include "vtoolbox.h" #include "vbuttonmenuitem.h" #include "vpalette.h" +#include "utils/viconutils.h" VMainWindow *g_mainWin; @@ -332,7 +333,7 @@ void VMainWindow::initViewToolBar(QSize p_iconSize) } m_viewActGroup = new QActionGroup(this); - QAction *onePanelViewAct = new QAction(QIcon(":/resources/icons/one_panel.svg"), + QAction *onePanelViewAct = new QAction(VIconUtils::menuIcon(":/resources/icons/one_panel.svg"), tr("&Single Panel"), m_viewActGroup); onePanelViewAct->setStatusTip(tr("Display only the notes list panel")); @@ -340,7 +341,7 @@ void VMainWindow::initViewToolBar(QSize p_iconSize) onePanelViewAct->setCheckable(true); onePanelViewAct->setData((int)PanelViewState::SinglePanel); - QAction *twoPanelViewAct = new QAction(QIcon(":/resources/icons/two_panels.svg"), + QAction *twoPanelViewAct = new QAction(VIconUtils::menuIcon(":/resources/icons/two_panels.svg"), tr("&Two Panels"), m_viewActGroup); twoPanelViewAct->setStatusTip(tr("Display both the folders and notes list panel")); @@ -348,7 +349,7 @@ void VMainWindow::initViewToolBar(QSize p_iconSize) twoPanelViewAct->setCheckable(true); twoPanelViewAct->setData((int)PanelViewState::TwoPanels); - QAction *compactViewAct = new QAction(QIcon(":/resources/icons/compact_mode.svg"), + QAction *compactViewAct = new QAction(VIconUtils::menuIcon(":/resources/icons/compact_mode.svg"), tr("&Compact Mode"), m_viewActGroup); compactViewAct->setStatusTip(tr("Integrate the folders and notes list panel in one column")); @@ -386,7 +387,7 @@ void VMainWindow::initViewToolBar(QSize p_iconSize) panelMenu->addAction(twoPanelViewAct); panelMenu->addAction(compactViewAct); - expandViewAct = new QAction(QIcon(":/resources/icons/expand.svg"), + expandViewAct = new QAction(VIconUtils::toolButtonIcon(":/resources/icons/expand.svg"), tr("Expand"), this); expandViewAct->setStatusTip(tr("Expand the edit area")); expandViewAct->setCheckable(true); @@ -422,7 +423,7 @@ void VMainWindow::initEditToolBar(QSize p_iconSize) m_editToolBar->addSeparator(); - m_headingSequenceAct = new QAction(QIcon(":/resources/icons/heading_sequence.svg"), + m_headingSequenceAct = new QAction(VIconUtils::toolButtonIcon(":/resources/icons/heading_sequence.svg"), tr("Heading Sequence"), this); m_headingSequenceAct->setStatusTip(tr("Enable heading sequence in current note in edit mode")); @@ -440,7 +441,7 @@ void VMainWindow::initEditToolBar(QSize p_iconSize) initHeadingButton(m_editToolBar); - QAction *boldAct = new QAction(QIcon(":/resources/icons/bold.svg"), + QAction *boldAct = new QAction(VIconUtils::toolButtonIcon(":/resources/icons/bold.svg"), tr("Bold\t%1").arg(VUtils::getShortcutText("Ctrl+B")), this); boldAct->setStatusTip(tr("Insert bold text or change selected text to bold")); @@ -453,7 +454,7 @@ void VMainWindow::initEditToolBar(QSize p_iconSize) m_editToolBar->addAction(boldAct); - QAction *italicAct = new QAction(QIcon(":/resources/icons/italic.svg"), + QAction *italicAct = new QAction(VIconUtils::toolButtonIcon(":/resources/icons/italic.svg"), tr("Italic\t%1").arg(VUtils::getShortcutText("Ctrl+I")), this); italicAct->setStatusTip(tr("Insert italic text or change selected text to italic")); @@ -466,7 +467,7 @@ void VMainWindow::initEditToolBar(QSize p_iconSize) m_editToolBar->addAction(italicAct); - QAction *strikethroughAct = new QAction(QIcon(":/resources/icons/strikethrough.svg"), + QAction *strikethroughAct = new QAction(VIconUtils::toolButtonIcon(":/resources/icons/strikethrough.svg"), tr("Strikethrough\t%1").arg(VUtils::getShortcutText("Ctrl+D")), this); strikethroughAct->setStatusTip(tr("Insert strikethrough text or change selected text to strikethroughed")); @@ -479,7 +480,7 @@ void VMainWindow::initEditToolBar(QSize p_iconSize) m_editToolBar->addAction(strikethroughAct); - QAction *inlineCodeAct = new QAction(QIcon(":/resources/icons/inline_code.svg"), + QAction *inlineCodeAct = new QAction(VIconUtils::toolButtonIcon(":/resources/icons/inline_code.svg"), tr("Inline Code\t%1").arg(VUtils::getShortcutText("Ctrl+K")), this); inlineCodeAct->setStatusTip(tr("Insert inline-code text or change selected text to inline-coded")); @@ -492,7 +493,7 @@ void VMainWindow::initEditToolBar(QSize p_iconSize) m_editToolBar->addAction(inlineCodeAct); - QAction *codeBlockAct = new QAction(QIcon(":/resources/icons/code_block.svg"), + QAction *codeBlockAct = new QAction(VIconUtils::toolButtonIcon(":/resources/icons/code_block.svg"), tr("Code Block\t%1").arg(VUtils::getShortcutText("Ctrl+M")), this); codeBlockAct->setStatusTip(tr("Insert fenced code block text or wrap selected text into a fenced code block")); @@ -508,7 +509,7 @@ void VMainWindow::initEditToolBar(QSize p_iconSize) m_editToolBar->addSeparator(); // Insert link. - QAction *insetLinkAct = new QAction(QIcon(":/resources/icons/link.svg"), + QAction *insetLinkAct = new QAction(VIconUtils::toolButtonIcon(":/resources/icons/link.svg"), tr("Insert Link\t%1").arg(VUtils::getShortcutText("Ctrl+L")), this); insetLinkAct->setStatusTip(tr("Insert a link")); @@ -522,7 +523,7 @@ void VMainWindow::initEditToolBar(QSize p_iconSize) m_editToolBar->addAction(insetLinkAct); // Insert image. - QAction *insertImageAct = new QAction(QIcon(":/resources/icons/insert_image.svg"), + QAction *insertImageAct = new QAction(VIconUtils::toolButtonIcon(":/resources/icons/insert_image.svg"), tr("Insert Image"), this); insertImageAct->setStatusTip(tr("Insert an image from file or URL")); @@ -555,7 +556,7 @@ void VMainWindow::initNoteToolBar(QSize p_iconSize) // Attachment. m_attachmentList = new VAttachmentList(this); - m_attachmentBtn = new VButtonWithWidget(QIcon(":/resources/icons/attachment.svg"), + m_attachmentBtn = new VButtonWithWidget(VIconUtils::toolButtonIcon(":/resources/icons/attachment.svg"), "", m_attachmentList, this); @@ -566,7 +567,7 @@ void VMainWindow::initNoteToolBar(QSize p_iconSize) m_attachmentBtn->setFocusPolicy(Qt::NoFocus); m_attachmentBtn->setEnabled(false); - QAction *flashPageAct = new QAction(QIcon(":/resources/icons/flash_page.svg"), + QAction *flashPageAct = new QAction(VIconUtils::toolButtonIcon(":/resources/icons/flash_page.svg"), tr("Flash Page"), this); flashPageAct->setStatusTip(tr("Open the Flash Page to edit")); @@ -589,13 +590,14 @@ void VMainWindow::initFileToolBar(QSize p_iconSize) fileToolBar->setIconSize(p_iconSize); } - newRootDirAct = new QAction(QIcon(":/resources/icons/create_rootdir_tb.svg"), - tr("New &Root Folder"), this); + newRootDirAct = new QAction(VIconUtils::toolButtonIcon(":/resources/icons/create_rootdir_tb.svg"), + tr("New &Root Folder"), + this); newRootDirAct->setStatusTip(tr("Create a root folder in current notebook")); connect(newRootDirAct, &QAction::triggered, directoryTree, &VDirectoryTree::newRootDirectory); - newNoteAct = new QAction(QIcon(":/resources/icons/create_note_tb.svg"), + newNoteAct = new QAction(VIconUtils::toolButtonIcon(":/resources/icons/create_note_tb.svg"), tr("New &Note"), this); newNoteAct->setStatusTip(tr("Create a note in current folder")); QString keySeq = g_config->getShortcutKeySequence("NewNote"); @@ -604,19 +606,19 @@ void VMainWindow::initFileToolBar(QSize p_iconSize) connect(newNoteAct, &QAction::triggered, m_fileList, &VFileList::newFile); - noteInfoAct = new QAction(QIcon(":/resources/icons/note_info_tb.svg"), + noteInfoAct = new QAction(VIconUtils::toolButtonIcon(":/resources/icons/note_info_tb.svg"), tr("Note &Info"), this); noteInfoAct->setStatusTip(tr("View and edit current note's information")); connect(noteInfoAct, &QAction::triggered, this, &VMainWindow::curEditFileInfo); - deleteNoteAct = new QAction(QIcon(":/resources/icons/delete_note_tb.svg"), + deleteNoteAct = new QAction(VIconUtils::toolButtonDangerIcon(":/resources/icons/delete_note_tb.svg"), tr("&Delete Note"), this); deleteNoteAct->setStatusTip(tr("Delete current note")); connect(deleteNoteAct, &QAction::triggered, this, &VMainWindow::deleteCurNote); - editNoteAct = new QAction(QIcon(":/resources/icons/edit_note.svg"), + editNoteAct = new QAction(VIconUtils::toolButtonIcon(":/resources/icons/edit_note.svg"), tr("&Edit"), this); editNoteAct->setStatusTip(tr("Edit current note")); keySeq = g_config->getShortcutKeySequence("EditNote"); @@ -625,7 +627,7 @@ void VMainWindow::initFileToolBar(QSize p_iconSize) connect(editNoteAct, &QAction::triggered, editArea, &VEditArea::editFile); - discardExitAct = new QAction(QIcon(":/resources/icons/discard_exit.svg"), + discardExitAct = new QAction(VIconUtils::menuIcon(":/resources/icons/discard_exit.svg"), tr("Discard Changes And Read"), this); discardExitAct->setStatusTip(tr("Discard changes and exit edit mode")); discardExitAct->setToolTip(tr("Discard Changes And Read")); @@ -636,7 +638,7 @@ void VMainWindow::initFileToolBar(QSize p_iconSize) exitEditMenu->setToolTipsVisible(true); exitEditMenu->addAction(discardExitAct); - saveExitAct = new QAction(QIcon(":/resources/icons/save_exit.svg"), + saveExitAct = new QAction(VIconUtils::toolButtonIcon(":/resources/icons/save_exit.svg"), tr("Save Changes And Read"), this); saveExitAct->setStatusTip(tr("Save changes and exit edit mode")); saveExitAct->setMenu(exitEditMenu); @@ -646,7 +648,7 @@ void VMainWindow::initFileToolBar(QSize p_iconSize) connect(saveExitAct, &QAction::triggered, editArea, &VEditArea::saveAndReadFile); - saveNoteAct = new QAction(QIcon(":/resources/icons/save_note.svg"), + saveNoteAct = new QAction(VIconUtils::toolButtonIcon(":/resources/icons/save_note.svg"), tr("Save"), this); saveNoteAct->setStatusTip(tr("Save changes to current note")); keySeq = g_config->getShortcutKeySequence("SaveNote"); @@ -911,7 +913,7 @@ void VMainWindow::initFileMenu() fileMenu->addAction(openAct); // Import notes from files. - m_importNoteAct = newAction(QIcon(":/resources/icons/import_note.svg"), + m_importNoteAct = newAction(VIconUtils::menuIcon(":/resources/icons/import_note.svg"), tr("&New Notes From Files"), this); m_importNoteAct->setToolTip(tr("Create notes from external files in current folder by copy")); connect(m_importNoteAct, &QAction::triggered, @@ -934,7 +936,7 @@ void VMainWindow::initFileMenu() fileMenu->addSeparator(); // Print. - m_printAct = new QAction(QIcon(":/resources/icons/print.svg"), + m_printAct = new QAction(VIconUtils::menuIcon(":/resources/icons/print.svg"), tr("&Print"), this); m_printAct->setToolTip(tr("Print current note")); connect(m_printAct, &QAction::triggered, @@ -945,7 +947,7 @@ void VMainWindow::initFileMenu() initThemeMenu(fileMenu); // Settings. - QAction *settingsAct = newAction(QIcon(":/resources/icons/settings.svg"), + QAction *settingsAct = newAction(VIconUtils::menuIcon(":/resources/icons/settings.svg"), tr("&Settings"), this); settingsAct->setToolTip(tr("View and change settings for VNote")); settingsAct->setMenuRole(QAction::PreferencesRole); @@ -1017,7 +1019,7 @@ void VMainWindow::initEditMenu() editMenu->setToolTipsVisible(true); // Find/Replace. - m_findReplaceAct = newAction(QIcon(":/resources/icons/find_replace.svg"), + m_findReplaceAct = newAction(VIconUtils::menuIcon(":/resources/icons/find_replace.svg"), tr("Find/Replace"), this); m_findReplaceAct->setToolTip(tr("Open Find/Replace dialog to search in current note")); QString keySeq = g_config->getShortcutKeySequence("Find"); @@ -1239,10 +1241,10 @@ void VMainWindow::initDockWindows() m_toolBox = new VToolBox(this); m_toolBox->addItem(outline, - QIcon(":/resources/icons/outline.svg"), + VIconUtils::toolBoxIcon(":/resources/icons/outline.svg"), tr("Outline")); m_toolBox->addItem(m_snippetList, - QIcon(":/resources/icons/snippets.svg"), + VIconUtils::toolBoxIcon(":/resources/icons/snippets.svg"), tr("Snippets")); toolDock->setWidget(m_toolBox); @@ -1562,7 +1564,7 @@ void VMainWindow::initRenderStyleMenu(QMenu *p_menu) connect(m_renderStyleActs, &QActionGroup::triggered, this, &VMainWindow::setRenderStyle); - QAction *addAct = newAction(QIcon(":/resources/icons/add_style.svg"), + QAction *addAct = newAction(VIconUtils::menuIcon(":/resources/icons/add_style.svg"), tr("&Add Style"), m_renderStyleActs); addAct->setToolTip(tr("Open the folder to add your custom CSS style files " @@ -1615,7 +1617,7 @@ void VMainWindow::initCodeBlockStyleMenu(QMenu *p_menu) connect(m_codeBlockStyleActs, &QActionGroup::triggered, this, &VMainWindow::setCodeBlockStyle); - QAction *addAct = newAction(QIcon(":/resources/icons/add_style.svg"), + QAction *addAct = newAction(VIconUtils::menuIcon(":/resources/icons/add_style.svg"), tr("&Add Style"), m_codeBlockStyleActs); addAct->setToolTip(tr("Open the folder to add your custom CSS style files " @@ -1762,7 +1764,7 @@ void VMainWindow::initEditorStyleMenu(QMenu *p_menu) connect(m_editorStyleActs, &QActionGroup::triggered, this, &VMainWindow::setEditorStyle); - QAction *addAct = newAction(QIcon(":/resources/icons/add_style.svg"), + QAction *addAct = newAction(VIconUtils::menuIcon(":/resources/icons/add_style.svg"), tr("&Add Style"), m_editorStyleActs); addAct->setToolTip(tr("Open the folder to add your custom MDHL style files")); addAct->setCheckable(true); @@ -2734,9 +2736,9 @@ void VMainWindow::openFlashPage() void VMainWindow::initHeadingButton(QToolBar *p_tb) { - m_headingBtn = new QPushButton(QIcon(":/resources/icons/heading.svg"), - "", - this); + m_headingBtn = new QPushButton(VIconUtils::toolButtonIcon(":/resources/icons/heading.svg"), + "", + this); m_headingBtn->setToolTip(tr("Headings")); m_headingBtn->setProperty("CornerBtn", true); m_headingBtn->setFocusPolicy(Qt::NoFocus); diff --git a/src/vmdeditor.cpp b/src/vmdeditor.cpp index e89aa05f..529babfb 100644 --- a/src/vmdeditor.cpp +++ b/src/vmdeditor.cpp @@ -18,6 +18,7 @@ #include "vorphanfile.h" #include "vnotefile.h" #include "vpreviewmanager.h" +#include "utils/viconutils.h" extern VConfigManager *g_config; @@ -264,7 +265,7 @@ void VMdEditor::contextMenuEvent(QContextMenuEvent *p_event) VEditTab *editTab = dynamic_cast(parent()); Q_ASSERT(editTab); if (editTab->isEditMode()) { - QAction *saveExitAct = new QAction(QIcon(":/resources/icons/save_exit.svg"), + QAction *saveExitAct = new QAction(VIconUtils::menuIcon(":/resources/icons/save_exit.svg"), tr("&Save Changes And Read"), menu); saveExitAct->setToolTip(tr("Save changes and exit edit mode")); @@ -273,7 +274,7 @@ void VMdEditor::contextMenuEvent(QContextMenuEvent *p_event) emit m_object->saveAndRead(); }); - QAction *discardExitAct = new QAction(QIcon(":/resources/icons/discard_exit.svg"), + QAction *discardExitAct = new QAction(VIconUtils::menuIcon(":/resources/icons/discard_exit.svg"), tr("&Discard Changes And Read"), menu); discardExitAct->setToolTip(tr("Discard changes and exit edit mode")); diff --git a/src/vnotebookselector.cpp b/src/vnotebookselector.cpp index 31800afb..d56275dc 100644 --- a/src/vnotebookselector.cpp +++ b/src/vnotebookselector.cpp @@ -22,6 +22,7 @@ #include "vnofocusitemdelegate.h" #include "vmainwindow.h" #include "utils/vimnavigationforwidget.h" +#include "utils/viconutils.h" extern VConfigManager *g_config; @@ -57,13 +58,13 @@ VNotebookSelector::VNotebookSelector(QWidget *p_parent) void VNotebookSelector::initActions() { - m_deleteNotebookAct = new QAction(QIcon(":/resources/icons/delete_notebook.svg"), + m_deleteNotebookAct = new QAction(VIconUtils::menuDangerIcon(":/resources/icons/delete_notebook.svg"), tr("&Delete"), this); m_deleteNotebookAct->setToolTip(tr("Delete current notebook")); connect(m_deleteNotebookAct, SIGNAL(triggered(bool)), this, SLOT(deleteNotebook())); - m_notebookInfoAct = new QAction(QIcon(":/resources/icons/notebook_info.svg"), + m_notebookInfoAct = new QAction(VIconUtils::menuIcon(":/resources/icons/notebook_info.svg"), tr("&Info"), this); m_notebookInfoAct->setToolTip(tr("View and edit current notebook's information")); connect(m_notebookInfoAct, SIGNAL(triggered(bool)), @@ -84,7 +85,7 @@ void VNotebookSelector::initActions() QDesktopServices::openUrl(url); }); - m_recycleBinAct = new QAction(QIcon(":/resources/icons/recycle_bin.svg"), + m_recycleBinAct = new QAction(VIconUtils::menuIcon(":/resources/icons/recycle_bin.svg"), tr("&Recycle Bin"), this); m_recycleBinAct->setToolTip(tr("Open the recycle bin of this notebook")); connect(m_recycleBinAct, &QAction::triggered, @@ -100,7 +101,7 @@ void VNotebookSelector::initActions() QDesktopServices::openUrl(url); }); - m_emptyRecycleBinAct = new QAction(QIcon(":/resources/icons/empty_recycle_bin.svg"), + m_emptyRecycleBinAct = new QAction(VIconUtils::menuDangerIcon(":/resources/icons/empty_recycle_bin.svg"), tr("&Empty Recycle Bin"), this); m_emptyRecycleBinAct->setToolTip(tr("Empty the recycle bin of this notebook")); connect(m_emptyRecycleBinAct, &QAction::triggered, @@ -216,7 +217,7 @@ int VNotebookSelector::itemIndexOfNotebook(const VNotebook *p_notebook) const void VNotebookSelector::insertAddNotebookItem() { QListWidgetItem *item = new QListWidgetItem(); - item->setIcon(QIcon(":/resources/icons/create_notebook.svg")); + item->setIcon(VIconUtils::comboBoxIcon(":/resources/icons/create_notebook.svg")); item->setText(tr("Add Notebook")); QFont font; font.setItalic(true); @@ -447,7 +448,7 @@ void VNotebookSelector::fillItem(QListWidgetItem *p_item, { p_item->setText(p_notebook->getName()); p_item->setToolTip(p_notebook->getName()); - p_item->setIcon(QIcon(":/resources/icons/notebook_item.svg")); + p_item->setIcon(VIconUtils::comboBoxIcon(":/resources/icons/notebook_item.svg")); p_item->setData(Qt::UserRole, (qulonglong)p_notebook); } diff --git a/src/vsnippetlist.cpp b/src/vsnippetlist.cpp index 33e62652..eacde8b2 100644 --- a/src/vsnippetlist.cpp +++ b/src/vsnippetlist.cpp @@ -9,6 +9,7 @@ #include "dialog/vsortdialog.h" #include "dialog/vconfirmdeletiondialog.h" #include "vmainwindow.h" +#include "utils/viconutils.h" extern VConfigManager *g_config; @@ -42,13 +43,13 @@ VSnippetList::VSnippetList(QWidget *p_parent) void VSnippetList::setupUI() { - m_addBtn = new QPushButton(QIcon(":/resources/icons/add_snippet.svg"), ""); + m_addBtn = new QPushButton(VIconUtils::buttonIcon(":/resources/icons/add_snippet.svg"), ""); m_addBtn->setToolTip(tr("New Snippet")); m_addBtn->setProperty("FlatBtn", true); connect(m_addBtn, &QPushButton::clicked, this, &VSnippetList::newSnippet); - m_locateBtn = new QPushButton(QIcon(":/resources/icons/locate_snippet.svg"), ""); + m_locateBtn = new QPushButton(VIconUtils::buttonIcon(":/resources/icons/locate_snippet.svg"), ""); m_locateBtn->setToolTip(tr("Open Folder")); m_locateBtn->setProperty("FlatBtn", true); connect(m_locateBtn, &QPushButton::clicked, @@ -86,7 +87,7 @@ void VSnippetList::setupUI() void VSnippetList::initActions() { - m_applyAct = new QAction(QIcon(":/resources/icons/apply_snippet.svg"), + m_applyAct = new QAction(VIconUtils::menuIcon(":/resources/icons/apply_snippet.svg"), tr("&Apply"), this); m_applyAct->setToolTip(tr("Insert this snippet in editor")); @@ -96,21 +97,21 @@ void VSnippetList::initActions() handleItemActivated(item); }); - m_infoAct = new QAction(QIcon(":/resources/icons/snippet_info.svg"), + m_infoAct = new QAction(VIconUtils::menuIcon(":/resources/icons/snippet_info.svg"), tr("&Info\t%1").arg(VUtils::getShortcutText(c_infoShortcutSequence)), this); m_infoAct->setToolTip(tr("View and edit snippet's information")); connect(m_infoAct, &QAction::triggered, this, &VSnippetList::snippetInfo); - m_deleteAct = new QAction(QIcon(":/resources/icons/delete_snippet.svg"), + m_deleteAct = new QAction(VIconUtils::menuDangerIcon(":/resources/icons/delete_snippet.svg"), tr("&Delete"), this); m_deleteAct->setToolTip(tr("Delete selected snippets")); connect(m_deleteAct, &QAction::triggered, this, &VSnippetList::deleteSelectedItems); - m_sortAct = new QAction(QIcon(":/resources/icons/sort.svg"), + m_sortAct = new QAction(VIconUtils::menuIcon(":/resources/icons/sort.svg"), tr("&Sort"), this); m_sortAct->setToolTip(tr("Sort snippets manually")); diff --git a/src/vwebview.cpp b/src/vwebview.cpp index ba58e771..0152207d 100644 --- a/src/vwebview.cpp +++ b/src/vwebview.cpp @@ -12,6 +12,7 @@ #include #include "vfile.h" #include "utils/vclipboardutils.h" +#include "utils/viconutils.h" // We set the property of the clipboard to mark that the URL copied in the // clipboard has been altered. @@ -73,7 +74,7 @@ void VWebView::contextMenuEvent(QContextMenuEvent *p_event) const QList actions = menu->actions(); if (!hasSelection() && m_file && m_file->isModifiable()) { - QAction *editAct= new QAction(QIcon(":/resources/icons/edit_note.svg"), + QAction *editAct= new QAction(VIconUtils::menuIcon(":/resources/icons/edit_note.svg"), tr("&Edit"), menu); editAct->setToolTip(tr("Edit current note")); connect(editAct, &QAction::triggered,