]> git.lyx.org Git - lyx.git/commitdiff
cosmetics
authorAndré Pönitz <poenitz@gmx.net>
Fri, 28 Sep 2007 23:14:33 +0000 (23:14 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Fri, 28 Sep 2007 23:14:33 +0000 (23:14 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20573 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/Action.cpp
src/frontends/qt4/Action.h
src/frontends/qt4/GuiPopupMenu.cpp
src/frontends/qt4/GuiToolbar.cpp

index 26d9bd6ec301e7b9228a10f8327195ff473a8428..683f073165015a0ea67be11a53a89c38472838fe 100644 (file)
 
 #include "Action.h"
 
-#include "GuiView.h"
-#include "qt_helpers.h"
+#include "frontends/LyXView.h"
 
 #include "callback.h"
-#include "LyXFunc.h"
-#include "FuncStatus.h"
 #include "debug.h"
+#include "FuncRequest.h"
+#include "FuncStatus.h"
+#include "GuiView.h"
+#include "LyXFunc.h"
+#include "qt_helpers.h"
 
 #include "support/lstrings.h"
 
-#include <boost/bind.hpp>
-
-using std::string;
-using std::endl;
-
 namespace lyx {
 namespace frontend {
 
 
-Action::Action(GuiViewBase & lyxView, docstring const & text,
-               FuncRequest const & func, docstring const & tooltip)
+Action::Action(GuiViewBase & lyxView, QString const & icon,
+         QString const & text, FuncRequest const & func,
+         QString const & tooltip)
        : QAction(&lyxView), func_(func), lyxView_(lyxView)
 {
 #if QT_VERSION >= 0x040200
        // only Qt/Mac handles that
        setMenuRole(NoRole);
 #endif
-       setText(toqstr(text));
-       setToolTip(toqstr(tooltip));
-       setStatusTip(toqstr(tooltip));
+       setIcon(QPixmap(icon));
+       setText(text);
+       setToolTip(tooltip);
+       setStatusTip(tooltip);
        connect(this, SIGNAL(triggered()), this, SLOT(action()));
        update();
 }
 
-Action::Action(GuiViewBase & lyxView, string const & icon, docstring const & text,
-               FuncRequest const & func, docstring const & tooltip)
-               : QAction(&lyxView), func_(func), lyxView_(lyxView)
-{
-       setIcon(QPixmap(icon.c_str()));
-       setText(toqstr(text));
-       setToolTip(toqstr(tooltip));
-       setStatusTip(toqstr(tooltip));
-       connect(this, SIGNAL(triggered()), this, SLOT(action()));
-       update();
-}
-
-/*
-void Action::setAction(FuncRequest const & func)
-{
-       func_=func;
-}
-*/
 
 void Action::update()
 {
@@ -85,8 +66,8 @@ void Action::update()
 
 void Action::action()
 {
-//     LYXERR(Debug::ACTION) << "calling LyXFunc::dispatch: func_: " << func_ << endl;
-
+       //      LYXERR(Debug::ACTION) << "calling LyXFunc::dispatch: func_: "
+       //      "\n";
        lyxView_.dispatch(func_);
        triggered(this);
 }
index 79bf2b5ff07676e9d11f8952a6a1a6f29795d369..ecefbfe958d56e83f109ae324e7ce77c58edda95 100644 (file)
 #ifndef ACTION_H
 #define ACTION_H
 
-#include "frontends/LyXView.h"
-#include "FuncRequest.h"
-
-#include "support/docstring.h"
-
 #include <QAction>
 
 namespace lyx {
+
+class FuncRequest;
+
 namespace frontend {
 
 class GuiViewBase;
@@ -29,20 +27,16 @@ class GuiViewBase;
  *
  * Action can be used in LyX menubar and/or toolbars.
  */
-class Action : public QAction {
+class Action : public QAction
+{
        Q_OBJECT
-public:
-
-       Action(GuiViewBase & lyxView, docstring const & text,
-               FuncRequest const & func, docstring const & tooltip = docstring());
 
-       Action(GuiViewBase & lyxView, std::string const & icon, docstring const & text,
-               FuncRequest const & func, docstring const & tooltip = docstring());
+public:
+       Action(GuiViewBase & lyxView, QString const & icon, QString const & text,
+               FuncRequest const & func, QString const & tooltip);
 
        void update();
 
-//     void setAction(FuncRequest const & func);
-
 Q_SIGNALS:
        /// the current action is triggered
        void triggered(QAction *);
index b03110eeca6d5c1c4d324686d9b09a98049a7e4e..1c2c104fc36c1a18aad3739b9812e301a9e82568 100644 (file)
@@ -11,8 +11,6 @@
 
 #include <config.h>
 
-// Qt defines a macro 'signals' that clashes with a boost namespace.
-// All is well if the namespace is visible first.
 #include "GuiView.h"
 
 #include "Action.h"
@@ -35,8 +33,8 @@ using std::endl;
 namespace lyx {
 namespace frontend {
 
-GuiPopupMenu::GuiPopupMenu(GuiMenubar * owner,
-                                                MenuItem const & mi, bool topLevelMenu)
+GuiPopupMenu::GuiPopupMenu(GuiMenubar * owner, MenuItem const & mi,
+               bool topLevelMenu)
        : owner_(owner)
 {
        name_ = mi.submenuname();
@@ -74,15 +72,13 @@ void GuiPopupMenu::updateView()
 
 void GuiPopupMenu::populate(QMenu * qMenu, Menu * menu)
 {
-       LYXERR(Debug::GUI) << "populating menu " << to_utf8(menu->name()) ;
+       LYXERR(Debug::GUI) << "populating menu " << to_utf8(menu->name());
        if (menu->size() == 0) {
                LYXERR(Debug::GUI) << "\tERROR: empty menu "
                        << to_utf8(menu->name()) << endl;
                return;
        }
-       else {
-               LYXERR(Debug::GUI) << " *****  menu entries " << menu->size() << endl;
-       }
+       LYXERR(Debug::GUI) << " *****  menu entries " << menu->size() << endl;
 
        Menu::const_iterator m = menu->begin();
        Menu::const_iterator end = menu->end();
@@ -110,7 +106,7 @@ void GuiPopupMenu::populate(QMenu * qMenu, Menu * menu)
                        addBinding(label, *m);
 
                        Action * action = new Action(*(owner_->view()),
-                                                    label, m->func());
+                               QString(), toqstr(label), m->func(), QString());
                        qMenu->addAction(action);
                }
        }
index cd5c584229cbf0e495defbd3fdae77fda98fbd53..44bddb907091deb39195cb1d3f07a8230d20a8b7 100644 (file)
@@ -191,8 +191,9 @@ void GuiToolbar::focusCommandBuffer()
 
 Action * GuiToolbar::addItem(ToolbarItem const & item)
 {
-       Action * act = new Action(owner_, getIcon(item.func_, false),
-                                 item.label_, item.func_, item.label_);
+       Action * act = new Action(owner_,
+               getIcon(item.func_, false).c_str(),
+         toqstr(item.label_), item.func_, toqstr(item.label_));
        actions_.append(act);
        return act;
 }