menu and actions text normalization

Signed-off-by: Le Tan <tamlokveer@gmail.com>
This commit is contained in:
Le Tan 2016-12-13 21:41:17 +08:00
parent 5ff46d6237
commit e069305b23

View File

@ -122,25 +122,25 @@ QWidget *VMainWindow::setupDirectoryPanel()
void VMainWindow::initActions() void VMainWindow::initActions()
{ {
newRootDirAct = new QAction(QIcon(":/resources/icons/create_rootdir_tb.svg"), newRootDirAct = new QAction(QIcon(":/resources/icons/create_rootdir_tb.svg"),
tr("&New rood directory"), this); tr("New &Rood Directory"), this);
newRootDirAct->setStatusTip(tr("Create a new root directory")); newRootDirAct->setStatusTip(tr("Create a root directory in current notebook"));
connect(newRootDirAct, &QAction::triggered, connect(newRootDirAct, &QAction::triggered,
directoryTree, &VDirectoryTree::newRootDirectory); directoryTree, &VDirectoryTree::newRootDirectory);
newNoteAct = new QAction(QIcon(":/resources/icons/create_note_tb.svg"), newNoteAct = new QAction(QIcon(":/resources/icons/create_note_tb.svg"),
tr("&New note"), this); tr("New &Note"), this);
newNoteAct->setStatusTip(tr("Create a new note")); newNoteAct->setStatusTip(tr("Create a note in current directory"));
connect(newNoteAct, &QAction::triggered, connect(newNoteAct, &QAction::triggered,
fileList, &VFileList::newFile); fileList, &VFileList::newFile);
noteInfoAct = new QAction(QIcon(":/resources/icons/note_info_tb.svg"), noteInfoAct = new QAction(QIcon(":/resources/icons/note_info_tb.svg"),
tr("&Note info"), this); tr("Note &Info"), this);
noteInfoAct->setStatusTip(tr("Current note information")); noteInfoAct->setStatusTip(tr("View and edit info of current note"));
connect(noteInfoAct, &QAction::triggered, connect(noteInfoAct, &QAction::triggered,
this, &VMainWindow::curEditFileInfo); this, &VMainWindow::curEditFileInfo);
deleteNoteAct = new QAction(QIcon(":/resources/icons/delete_note_tb.svg"), deleteNoteAct = new QAction(QIcon(":/resources/icons/delete_note_tb.svg"),
tr("&Delete note"), this); tr("&Delete Note"), this);
deleteNoteAct->setStatusTip(tr("Delete current note")); deleteNoteAct->setStatusTip(tr("Delete current note"));
connect(deleteNoteAct, &QAction::triggered, connect(deleteNoteAct, &QAction::triggered,
this, &VMainWindow::deleteCurNote); this, &VMainWindow::deleteCurNote);
@ -151,17 +151,18 @@ void VMainWindow::initActions()
importNoteAct = new QAction(QIcon(":/resources/icons/import_note.svg"), importNoteAct = new QAction(QIcon(":/resources/icons/import_note.svg"),
tr("&Import Notes From Files"), this); tr("&Import Notes From Files"), this);
importNoteAct->setStatusTip(tr("Import notes into current directory from files")); importNoteAct->setStatusTip(tr("Import notes from files into current directory"));
connect(importNoteAct, &QAction::triggered, connect(importNoteAct, &QAction::triggered,
this, &VMainWindow::importNoteFromFile); this, &VMainWindow::importNoteFromFile);
converterAct = new QActionGroup(this); converterAct = new QActionGroup(this);
markedAct = new QAction(tr("Marked"), converterAct); markedAct = new QAction(tr("Marked"), converterAct);
markedAct->setStatusTip(tr("Use Marked to convert Markdown to HTML (Re-open current tabs to make it work)")); markedAct->setStatusTip(tr("Use Marked to convert Markdown to HTML (re-open current tabs to make it work)"));
markedAct->setCheckable(true); markedAct->setCheckable(true);
markedAct->setData(int(MarkdownConverterType::Marked)); markedAct->setData(int(MarkdownConverterType::Marked));
hoedownAct = new QAction(tr("Hoedown"), converterAct); hoedownAct = new QAction(tr("Hoedown"), converterAct);
hoedownAct->setStatusTip(tr("Use Hoedown to convert Markdown to HTML (Re-open current tabs to make it work)")); hoedownAct->setStatusTip(tr("Use Hoedown to convert Markdown to HTML (re-open current tabs to make it work)"));
hoedownAct->setCheckable(true); hoedownAct->setCheckable(true);
hoedownAct->setData(int(MarkdownConverterType::Hoedown)); hoedownAct->setData(int(MarkdownConverterType::Hoedown));
connect(converterAct, &QActionGroup::triggered, connect(converterAct, &QActionGroup::triggered,
@ -178,12 +179,12 @@ void VMainWindow::initActions()
m_insertImageAct = new QAction(QIcon(":/resources/icons/insert_image.svg"), m_insertImageAct = new QAction(QIcon(":/resources/icons/insert_image.svg"),
tr("Insert &Image"), this); tr("Insert &Image"), this);
m_insertImageAct->setStatusTip(tr("Insert an image from file")); m_insertImageAct->setStatusTip(tr("Insert an image from file in current note"));
connect(m_insertImageAct, &QAction::triggered, connect(m_insertImageAct, &QAction::triggered,
this, &VMainWindow::insertImage); this, &VMainWindow::insertImage);
expandTabAct = new QAction(tr("&Expand Tab"), this); expandTabAct = new QAction(tr("&Expand Tab"), this);
expandTabAct->setStatusTip(tr("Expand tab to spaces")); expandTabAct->setStatusTip(tr("Expand entered tab to spaces"));
expandTabAct->setCheckable(true); expandTabAct->setCheckable(true);
connect(expandTabAct, &QAction::triggered, connect(expandTabAct, &QAction::triggered,
this, &VMainWindow::changeExpandTab); this, &VMainWindow::changeExpandTab);
@ -222,7 +223,7 @@ void VMainWindow::initEditActions()
editArea, &VEditArea::editFile); editArea, &VEditArea::editFile);
discardExitAct = new QAction(QIcon(":/resources/icons/discard_exit.svg"), discardExitAct = new QAction(QIcon(":/resources/icons/discard_exit.svg"),
tr("Discard changes and exit"), this); tr("Discard Changes And Exit"), this);
discardExitAct->setStatusTip(tr("Discard changes and exit edit mode")); discardExitAct->setStatusTip(tr("Discard changes and exit edit mode"));
connect(discardExitAct, &QAction::triggered, connect(discardExitAct, &QAction::triggered,
editArea, &VEditArea::readFile); editArea, &VEditArea::readFile);
@ -231,15 +232,15 @@ void VMainWindow::initEditActions()
exitEditMenu->addAction(discardExitAct); exitEditMenu->addAction(discardExitAct);
saveExitAct = new QAction(QIcon(":/resources/icons/save_exit.svg"), saveExitAct = new QAction(QIcon(":/resources/icons/save_exit.svg"),
tr("Save changes and exit"), this); tr("Save Changes And Exit"), this);
saveExitAct->setStatusTip(tr("Save changes and exit edit mode")); saveExitAct->setStatusTip(tr("Save changes and exit edit mode"));
saveExitAct->setMenu(exitEditMenu); saveExitAct->setMenu(exitEditMenu);
connect(saveExitAct, &QAction::triggered, connect(saveExitAct, &QAction::triggered,
editArea, &VEditArea::saveAndReadFile); editArea, &VEditArea::saveAndReadFile);
saveNoteAct = new QAction(QIcon(":/resources/icons/save_note.svg"), saveNoteAct = new QAction(QIcon(":/resources/icons/save_note.svg"),
tr("&Save"), this); tr("Save"), this);
saveNoteAct->setStatusTip(tr("Save current note")); saveNoteAct->setStatusTip(tr("Save changes of current note"));
saveNoteAct->setShortcut(QKeySequence::Save); saveNoteAct->setShortcut(QKeySequence::Save);
connect(saveNoteAct, &QAction::triggered, connect(saveNoteAct, &QAction::triggered,
editArea, &VEditArea::saveFile); editArea, &VEditArea::saveFile);
@ -250,13 +251,13 @@ void VMainWindow::initViewActions()
{ {
onePanelViewAct = new QAction(QIcon(":/resources/icons/one_panel.svg"), onePanelViewAct = new QAction(QIcon(":/resources/icons/one_panel.svg"),
tr("&Single Panel"), this); tr("&Single Panel"), this);
onePanelViewAct->setStatusTip(tr("Display only the notes browser panel")); onePanelViewAct->setStatusTip(tr("Display only the note panel"));
connect(onePanelViewAct, &QAction::triggered, connect(onePanelViewAct, &QAction::triggered,
this, &VMainWindow::onePanelView); this, &VMainWindow::onePanelView);
twoPanelViewAct = new QAction(QIcon(":/resources/icons/two_panels.svg"), twoPanelViewAct = new QAction(QIcon(":/resources/icons/two_panels.svg"),
tr("&Two Panels"), this); tr("&Two Panels"), this);
twoPanelViewAct->setStatusTip(tr("Display the directory and notes browser panel")); twoPanelViewAct->setStatusTip(tr("Display both the directory and note panel"));
connect(twoPanelViewAct, &QAction::triggered, connect(twoPanelViewAct, &QAction::triggered,
this, &VMainWindow::twoPanelView); this, &VMainWindow::twoPanelView);
@ -265,8 +266,8 @@ void VMainWindow::initViewActions()
panelMenu->addAction(twoPanelViewAct); panelMenu->addAction(twoPanelViewAct);
expandViewAct = new QAction(QIcon(":/resources/icons/expand.svg"), expandViewAct = new QAction(QIcon(":/resources/icons/expand.svg"),
tr("&Expand"), this); tr("Expand"), this);
expandViewAct->setStatusTip(tr("Expand the editing area")); expandViewAct->setStatusTip(tr("Expand the edit area"));
expandViewAct->setCheckable(true); expandViewAct->setCheckable(true);
expandViewAct->setMenu(panelMenu); expandViewAct->setMenu(panelMenu);
connect(expandViewAct, &QAction::triggered, connect(expandViewAct, &QAction::triggered,
@ -323,7 +324,7 @@ void VMainWindow::initMenuBar()
} else { } else {
expandTabAct->setChecked(false); expandTabAct->setChecked(false);
} }
QMenu *tabStopWidthMenu = editMenu->addMenu(tr("Tab stop width")); QMenu *tabStopWidthMenu = editMenu->addMenu(tr("Tab Stop Width"));
tabStopWidthMenu->addAction(twoSpaceTabAct); tabStopWidthMenu->addAction(twoSpaceTabAct);
tabStopWidthMenu->addAction(fourSpaceTabAct); tabStopWidthMenu->addAction(fourSpaceTabAct);
tabStopWidthMenu->addAction(eightSpaceTabAct); tabStopWidthMenu->addAction(eightSpaceTabAct);
@ -339,7 +340,7 @@ void VMainWindow::initMenuBar()
eightSpaceTabAct->setChecked(true); eightSpaceTabAct->setChecked(true);
break; break;
default: default:
qWarning() << "error: unsupported tab stop width" << tabStopWidth << "in config"; qWarning() << "unsupported tab stop width" << tabStopWidth << "in config";
} }
initEditorBackgroundMenu(editMenu); initEditorBackgroundMenu(editMenu);
@ -473,10 +474,10 @@ void VMainWindow::initPredefinedColorPixmaps()
void VMainWindow::initRenderBackgroundMenu(QMenu *menu) void VMainWindow::initRenderBackgroundMenu(QMenu *menu)
{ {
QMenu *renderBgMenu = menu->addMenu(tr("&Rendering background")); QMenu *renderBgMenu = menu->addMenu(tr("&Rendering Background"));
const QString &curBgColor = vconfig.getCurRenderBackgroundColor(); const QString &curBgColor = vconfig.getCurRenderBackgroundColor();
QAction *tmpAct = new QAction(tr("System"), renderBackgroundAct); QAction *tmpAct = new QAction(tr("System"), renderBackgroundAct);
tmpAct->setStatusTip(tr("Use system's background color configuration for rendering")); tmpAct->setStatusTip(tr("Use system's background color configuration for markdown rendering"));
tmpAct->setCheckable(true); tmpAct->setCheckable(true);
tmpAct->setData("System"); tmpAct->setData("System");
if (curBgColor == "System") { if (curBgColor == "System") {
@ -487,7 +488,7 @@ void VMainWindow::initRenderBackgroundMenu(QMenu *menu)
const QVector<VColor> &bgColors = vconfig.getPredefinedColors(); const QVector<VColor> &bgColors = vconfig.getPredefinedColors();
for (int i = 0; i < bgColors.size(); ++i) { for (int i = 0; i < bgColors.size(); ++i) {
tmpAct = new QAction(bgColors[i].name, renderBackgroundAct); tmpAct = new QAction(bgColors[i].name, renderBackgroundAct);
tmpAct->setStatusTip(tr("Set background color for rendering")); tmpAct->setStatusTip(tr("Set as the background color for markdown rendering"));
tmpAct->setCheckable(true); tmpAct->setCheckable(true);
tmpAct->setData(bgColors[i].name); tmpAct->setData(bgColors[i].name);
tmpAct->setIcon(QIcon(predefinedColorPixmaps[i])); tmpAct->setIcon(QIcon(predefinedColorPixmaps[i]));
@ -515,7 +516,7 @@ void VMainWindow::initEditorBackgroundMenu(QMenu *menu)
const QVector<VColor> &bgColors = vconfig.getPredefinedColors(); const QVector<VColor> &bgColors = vconfig.getPredefinedColors();
for (int i = 0; i < bgColors.size(); ++i) { for (int i = 0; i < bgColors.size(); ++i) {
tmpAct = new QAction(bgColors[i].name, backgroundColorAct); tmpAct = new QAction(bgColors[i].name, backgroundColorAct);
tmpAct->setStatusTip(tr("Set background color for editor")); tmpAct->setStatusTip(tr("Set as the background color for editor"));
tmpAct->setCheckable(true); tmpAct->setCheckable(true);
tmpAct->setData(bgColors[i].name); tmpAct->setData(bgColors[i].name);
tmpAct->setIcon(QIcon(predefinedColorPixmaps[i])); tmpAct->setIcon(QIcon(predefinedColorPixmaps[i]));
@ -624,7 +625,7 @@ void VMainWindow::changeSplitterView(int nrPanel)
mainSplitter->widget(2)->show(); mainSplitter->widget(2)->show();
break; break;
default: default:
qWarning() << "error: invalid panel number" << nrPanel; qWarning() << "invalid panel number" << nrPanel;
} }
} }