mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 21:40:19 +00:00
more of that...
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23517 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e8f16a9bcb
commit
56dec68703
@ -31,9 +31,9 @@ GuiPopupMenu::GuiPopupMenu(GuiView * owner, MenuItem const & mi,
|
|||||||
bool topLevelMenu)
|
bool topLevelMenu)
|
||||||
: QMenu(owner), owner_(owner)
|
: QMenu(owner), owner_(owner)
|
||||||
{
|
{
|
||||||
name_ = mi.submenuname();
|
name_ = toqstr(mi.submenuname());
|
||||||
|
|
||||||
setTitle(toqstr(getLabel(mi)));
|
setTitle(label(mi));
|
||||||
|
|
||||||
if (topLevelMenu)
|
if (topLevelMenu)
|
||||||
connect(this, SIGNAL(aboutToShow()), this, SLOT(updateView()));
|
connect(this, SIGNAL(aboutToShow()), this, SLOT(updateView()));
|
||||||
@ -43,18 +43,18 @@ GuiPopupMenu::GuiPopupMenu(GuiView * owner, MenuItem const & mi,
|
|||||||
void GuiPopupMenu::updateView()
|
void GuiPopupMenu::updateView()
|
||||||
{
|
{
|
||||||
LYXERR(Debug::GUI, "GuiPopupMenu::updateView()"
|
LYXERR(Debug::GUI, "GuiPopupMenu::updateView()"
|
||||||
<< "\tTriggered menu: " << to_utf8(name_));
|
<< "\tTriggered menu: " << fromqstr(name_));
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
if (name_.empty())
|
if (name_.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Here, We make sure that theLyXFunc points to the correct LyXView.
|
// Here, We make sure that theLyXFunc points to the correct LyXView.
|
||||||
theLyXFunc().setLyXView(owner_);
|
theLyXFunc().setLyXView(owner_);
|
||||||
|
|
||||||
MenuBackend const & menubackend = guiApp->menuBackend();
|
MenuBackend const & menubackend = guiApp->menuBackend();
|
||||||
Menu const & fromLyxMenu = menubackend.getMenu(name_);
|
Menu const & fromLyxMenu = menubackend.getMenu(qstring_to_ucs4(name_));
|
||||||
menubackend.expand(fromLyxMenu, topLevelMenu_, owner_->buffer());
|
menubackend.expand(fromLyxMenu, topLevelMenu_, owner_->buffer());
|
||||||
|
|
||||||
if (!menubackend.hasMenu(topLevelMenu_.name())) {
|
if (!menubackend.hasMenu(topLevelMenu_.name())) {
|
||||||
@ -87,8 +87,8 @@ void GuiPopupMenu::populate(QMenu * qMenu, Menu * menu)
|
|||||||
} else if (m->kind() == MenuItem::Submenu) {
|
} else if (m->kind() == MenuItem::Submenu) {
|
||||||
|
|
||||||
LYXERR(Debug::GUI, "** creating New Sub-Menu "
|
LYXERR(Debug::GUI, "** creating New Sub-Menu "
|
||||||
<< to_utf8(getLabel(*m)));
|
<< fromqstr(label(*m)));
|
||||||
QMenu * subMenu = qMenu->addMenu(toqstr(getLabel(*m)));
|
QMenu * subMenu = qMenu->addMenu(label(*m));
|
||||||
populate(subMenu, m->submenu());
|
populate(subMenu, m->submenu());
|
||||||
|
|
||||||
} else { // we have a MenuItem::Command
|
} else { // we have a MenuItem::Command
|
||||||
@ -96,17 +96,15 @@ void GuiPopupMenu::populate(QMenu * qMenu, Menu * menu)
|
|||||||
LYXERR(Debug::GUI, "creating Menu Item "
|
LYXERR(Debug::GUI, "creating Menu Item "
|
||||||
<< to_utf8(m->label()));
|
<< to_utf8(m->label()));
|
||||||
|
|
||||||
docstring const label = getLabel(*m);
|
|
||||||
|
|
||||||
Action * action = new Action(*(owner_),
|
Action * action = new Action(*(owner_),
|
||||||
QIcon(), toqstr(label), m->func(), QString());
|
QIcon(), label(*m), m->func(), QString());
|
||||||
qMenu->addAction(action);
|
qMenu->addAction(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
docstring const GuiPopupMenu::getLabel(MenuItem const & mi)
|
QString GuiPopupMenu::label(MenuItem const & mi) const
|
||||||
{
|
{
|
||||||
docstring label = support::subst(mi.label(),
|
docstring label = support::subst(mi.label(),
|
||||||
from_ascii("&"), from_ascii("&&"));
|
from_ascii("&"), from_ascii("&&"));
|
||||||
@ -122,7 +120,7 @@ docstring const GuiPopupMenu::getLabel(MenuItem const & mi)
|
|||||||
if (!binding.empty())
|
if (!binding.empty())
|
||||||
label += '\t' + binding;
|
label += '\t' + binding;
|
||||||
|
|
||||||
return label;
|
return toqstr(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,11 +12,10 @@
|
|||||||
#ifndef GUIPOPUPMENU_H
|
#ifndef GUIPOPUPMENU_H
|
||||||
#define GUIPOPUPMENU_H
|
#define GUIPOPUPMENU_H
|
||||||
|
|
||||||
#include <QMenu>
|
|
||||||
|
|
||||||
#include "FuncRequest.h"
|
|
||||||
#include "MenuBackend.h"
|
#include "MenuBackend.h"
|
||||||
|
|
||||||
|
#include <QMenu>
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
@ -33,7 +32,7 @@ public:
|
|||||||
|
|
||||||
/// populates the menu or one of its submenu
|
/// populates the menu or one of its submenu
|
||||||
/// This is used as a recursive function
|
/// This is used as a recursive function
|
||||||
void populate(QMenu* qMenu, Menu * menu);
|
void populate(QMenu * qMenu, Menu * menu);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
/// populate the toplevel menu and all children
|
/// populate the toplevel menu and all children
|
||||||
@ -41,12 +40,12 @@ public Q_SLOTS:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
/// Get a Menu item label from the menu backend
|
/// Get a Menu item label from the menu backend
|
||||||
docstring const getLabel(MenuItem const & mi);
|
QString label(MenuItem const & mi) const;
|
||||||
|
|
||||||
/// our owning view
|
/// our owning view
|
||||||
GuiView * owner_;
|
GuiView * owner_;
|
||||||
/// the name of this menu
|
/// the name of this menu
|
||||||
docstring name_;
|
QString name_;
|
||||||
/// Top Level Menu
|
/// Top Level Menu
|
||||||
Menu topLevelMenu_;
|
Menu topLevelMenu_;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user