#include "BulletsModule.h"
#include "qt_helpers.h"
-#include "support/filetools.h"
-
#include <QPixmap>
#include <QPainter>
-#include <boost/assert.hpp>
namespace lyx {
-using support::libFileSearch;
-
-using std::string;
-
BulletsModule::BulletsModule(QWidget * , char const * , Qt::WFlags)
{
setupUi(this);
bulletpaneCO->addItem(panelname);
// get pixmap with bullets
- QPixmap pixmap = QPixmap(toqstr(libFileSearch("images", fname, "png").absFilename()));
+ QPixmap pixmap(":/images/" + toqstr(fname) + ".png");
int const w = pixmap.width() / 6;
int const h = pixmap.height() / 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 "GuiCommandBuffer.h"
#include "support/lyxalgo.h"
#include "support/lstrings.h"
-#include "support/filetools.h"
#include <QHBoxLayout>
#include <QKeyEvent>
namespace frontend {
using support::prefixIs;
-using support::libFileSearch;
namespace {
transform(lyxaction.func_begin(), lyxaction.func_end(),
back_inserter(commands_), firster());
- QPixmap qpup(toqstr(libFileSearch("images", "up", "png").absFilename()));
- QPixmap qpdown(toqstr(libFileSearch("images", "down", "png").absFilename()));
+ QPixmap qpup(":/images/up.png");
+ QPixmap qpdown(":/images/down.png");
QVBoxLayout * top = new QVBoxLayout(this);
QHBoxLayout * layout = new QHBoxLayout(0);
#include "frontends/LyXView.h"
#include "support/FileFilterList.h"
-#include "support/convert.h"
-#include "support/FileName.h"
-#include "support/filetools.h"
using std::string;
namespace frontend {
using support::FileFilterList;
-using support::FileName;
-using support::libFileSearch;
EmbeddedFilesWidget::EmbeddedFilesWidget
(GuiEmbeddedFiles & controller)
{
setupUi(this);
setWindowTitle("LyX: " + qt_("Embedded Files"));
- // Temporary icons.
- FileName icon_path = libFileSearch("images", "tabular-feature_set-all-lines.png");
- selectPB->setIcon(QIcon(toqstr(icon_path.absFilename())));
- icon_path = libFileSearch("images", "tabular-feature_unset-all-lines.png");
- unselectPB->setIcon(QIcon(toqstr(icon_path.absFilename())));
- icon_path = libFileSearch("images", "file-open.png");
- addPB->setIcon(QIcon(toqstr(icon_path.absFilename())));
- icon_path = libFileSearch("images", "depth-decrement.png");
- extractPB->setIcon(QIcon(toqstr(icon_path.absFilename())));
- icon_path = libFileSearch("images", "depth-increment.png");
- updatePB->setIcon(QIcon(toqstr(icon_path.absFilename())));
+
+ // FIXME: Temporary icons.
+ selectPB->setIcon(QIcon(":/images/tabular-feature_set-all-lines.png"));
+ unselectPB->setIcon(QIcon(":/images/tabular-feature_unset-all-lines.png"));
+ addPB->setIcon(QIcon(":/images/file-open.png"));
+ extractPB->setIcon(QIcon(":/images/depth-decrement.png"));
+ updatePB->setIcon(QIcon(":/images/depth-increment.png"));
updateView();
}
-GuiEmbeddedFiles::GuiEmbeddedFiles(GuiViewBase & parent, Qt::DockWidgetArea area, Qt::WindowFlags flags)
+GuiEmbeddedFiles::GuiEmbeddedFiles(GuiViewBase & parent,
+ Qt::DockWidgetArea area, Qt::WindowFlags flags)
: DockView(parent, "embedded", area, flags)
{
widget_ = new EmbeddedFilesWidget(*this);
#include "qt_helpers.h"
#include "InsertTableWidget.h"
-#include "support/filetools.h"
#include "support/lstrings.h"
#include "support/lyxalgo.h" // sorted
#include <QAction>
#include <QPixmap>
+
+static void initializeResources()
+{
+ extern void qInitResources();
+ static bool initialized = false;
+ if (!initialized) {
+ qInitResources();
+ initialized = true;
+ }
+}
+
+
namespace lyx {
+namespace frontend {
using std::string;
using std::endl;
-using support::FileName;
-using support::libFileSearch;
using support::subst;
using support::compare;
-namespace frontend {
-
-
namespace {
struct PngMap {
LYXERR(Debug::GUI) << "find_png(" << name << ")\n"
<< "Looking for math PNG called \""
<< png_name << '"' << std::endl;
-
- return libFileSearch("images/math/", png_name, "png").absFilename();
+ return png_name;
}
} // namespace anon
/// return a icon for the given action
static QIcon getIcon(FuncRequest const & f, bool unknown)
{
- string fullname;
+ initializeResources();
+ QPixmap pm;
+ string name1;
+ string name2;
switch (f.action) {
case LFUN_MATH_INSERT:
if (!f.argument().empty())
- fullname = find_png(to_utf8(f.argument()).substr(1));
+ name1 = "math/" + find_png(to_utf8(f.argument()).substr(1));
break;
case LFUN_MATH_DELIM:
case LFUN_MATH_BIGDELIM:
- fullname = find_png(to_utf8(f.argument()));
+ name1 = find_png(to_utf8(f.argument()));
break;
default:
- string const name = lyxaction.getActionName(f.action);
- string png_name = name;
+ name2 = lyxaction.getActionName(f.action);
+ name1 = name2;
if (!f.argument().empty())
- png_name = subst(name + ' ' + to_utf8(f.argument()), ' ', '_');
-
- fullname = libFileSearch("images", png_name, "png").absFilename();
-
- if (fullname.empty()) {
- // try without the argument
- fullname = libFileSearch("images", name, "png").absFilename();
- }
+ name1 = subst(name2 + ' ' + to_utf8(f.argument()), ' ', '_');
}
- if (!fullname.empty()) {
- LYXERR(Debug::GUI) << "Full icon name is `"
- << fullname << '\'' << endl;
- return QIcon(toqstr(fullname));
- }
+ if (pm.load(":/images/" + toqstr(name1) + ".png"))
+ return pm;
+
+ if (pm.load(":/images/" + toqstr(name2) + ".png"))
+ return pm;
LYXERR(Debug::GUI) << "Cannot find icon for command \""
<< lyxaction.getActionName(f.action)
<< '(' << to_utf8(f.argument()) << ")\"" << endl;
if (unknown)
- return QIcon(toqstr(libFileSearch("images", "unknown", "png").absFilename()));
- return QIcon();
+ pm.load(":/images/unknown.png");
+
+ return pm;
}
TextClass::const_iterator const end = tc.end();
for (; it != end; ++it) {
// ignore obsolete entries
- if ((*it)->obsoleted_by().empty())
- addItem(toqstr(translateIfPossible((*it)->name())));
+ addItem(toqstr(translateIfPossible((*it)->name())));
}
// needed to recalculate size hint
return;
}
}
- lyxerr << "ERROR (layoutSelected): layout not found!"
- << endl;
+ lyxerr << "ERROR (layoutSelected): layout not found!" << endl;
}
tb->setToolTip(qt_(to_ascii(item.label_)));
tb->setStatusTip(qt_(to_ascii(item.label_)));
tb->setText(qt_(to_ascii(item.label_)));
- FileName icon_path = libFileSearch("images/math", item.name_, "png");
- tb->setIcon(QIcon(toqstr(icon_path.absFilename())));
+ tb->setIcon(QPixmap(":images/math/" + toqstr(item.name_) + ".png"));
connect(this, SIGNAL(iconSizeChanged(QSize)),
tb, SLOT(setIconSize(QSize)));
}
-
} // namespace frontend
} // namespace lyx
#include "ToolbarBackend.h"
#include "version.h"
-#include <boost/current_function.hpp>
-
#include <QAction>
#include <QApplication>
#include <QCloseEvent>
namespace lyx {
-using support::FileName;
-using support::libFileSearch;
using support::makeDisplayPath;
extern bool quitting;
LYXERR(Debug::GUI) << "show banner: " << lyxrc.show_banner << endl;
/// The text to be written on top of the pixmap
QString const text = lyx_version ? QString(lyx_version) : qt_("unknown version");
- FileName const file = support::libFileSearch("images", "banner", "png");
- if (file.empty())
- return;
-
- bg_widget_ = new BackgroundWidget(toqstr(file.absFilename()), text);
+ bg_widget_ = new BackgroundWidget(":/images/banner.png", text);
}
void setBackground()
#ifndef Q_WS_MACX
// assign an icon to main form. We do not do it under Qt/Mac,
// since the icon is provided in the application bundle.
- FileName const iconname = libFileSearch("images", "lyx", "png");
- if (!iconname.empty())
- setWindowIcon(QPixmap(toqstr(iconname.absFilename())));
+ setWindowIcon(QPixmap(":/images/lyx.png"));
#endif
d.tab_widget_ = new TabWorkArea;
#include "LyXRC.h"
#include "version.h"
-#include "support/filetools.h" // LibFileSearch
-
#include "graphics/GraphicsImage.h"
#include "graphics/GraphicsLoader.h"
#include <QTimer>
#include <boost/bind.hpp>
-#include <boost/current_function.hpp>
#ifdef Q_WS_X11
#include <QX11Info>
{
if (dc_event_.active && dc_event_ == *e) {
dc_event_.active = false;
- FuncRequest cmd(LFUN_MOUSE_TRIPLE,
- e->x(), e->y(),
+ FuncRequest cmd(LFUN_MOUSE_TRIPLE, e->x(), e->y(),
q_button_state(e->button()));
dispatch(cmd);
return;
}
}
+
////////////////////////////////////////////////////////////////////
-// TabWorkArea implementation.
+//
+// TabWorkArea
+//
////////////////////////////////////////////////////////////////////
+
TabWorkArea::TabWorkArea(QWidget * parent): QTabWidget(parent)
{
QPalette pal = palette();
QToolButton * closeTabButton = new QToolButton(this);
closeTabButton->setPalette(pal);
- FileName const file = support::libFileSearch("images", "closetab", "png");
- if (!file.empty()) {
- QPixmap pm(toqstr(file.absFilename()));
- closeTabButton->setIcon(QIcon(pm));
- } else {
- closeTabButton->setText("Close");
- }
+ closeTabButton->setIcon(QIcon(":/images/closetab.png"));
+ closeTabButton->setText("Close");
closeTabButton->setAutoRaise(true);
closeTabButton->setCursor(Qt::ArrowCursor);
closeTabButton->setToolTip(tr("Close tab"));
#include "GuiToc.h"
#include "qt_helpers.h"
-#include "support/filetools.h"
-#include "support/lstrings.h"
#include "debug.h"
#include <QTreeWidgetItem>
#include <vector>
-#include <string>
-#include <stack>
using std::endl;
-using std::pair;
-using std::stack;
using std::vector;
-using std::string;
namespace lyx {
-
-using support::FileName;
-using support::libFileSearch;
-
namespace frontend {
TocWidget::TocWidget(GuiToc & form, QWidget * parent)
connect(&form_, SIGNAL(modelReset()), SLOT(updateGui()));
- FileName icon_path = libFileSearch("images", "promote.png");
- moveOutTB->setIcon(QIcon(toqstr(icon_path.absFilename())));
- icon_path = libFileSearch("images", "demote.png");
- moveInTB->setIcon(QIcon(toqstr(icon_path.absFilename())));
- icon_path = libFileSearch("images", "up.png");
- moveUpTB->setIcon(QIcon(toqstr(icon_path.absFilename())));
- icon_path = libFileSearch("images", "down.png");
- moveDownTB->setIcon(QIcon(toqstr(icon_path.absFilename())));
- icon_path = libFileSearch("images", "reload.png");
- updateTB->setIcon(QIcon(toqstr(icon_path.absFilename())));
+ moveOutTB->setIcon(QIcon(":/images/promote.png"));
+ moveInTB->setIcon(QIcon(":/images/demote.png"));
+ moveUpTB->setIcon(QIcon(":/images/up.png"));
+ moveDownTB->setIcon(QIcon(":/images/down.png"));
+ updateTB->setIcon(QIcon(":/images/reload.png"));
// avoid flickering
tocTV->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);