mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
use "real" resources
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21007 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4e9609f183
commit
33e397dff8
@ -13,19 +13,12 @@
|
||||
#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);
|
||||
@ -67,7 +60,7 @@ void BulletsModule::setupPanel(QListWidget * lw, QString const & panelname,
|
||||
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;
|
||||
|
@ -12,8 +12,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"
|
||||
@ -30,7 +28,6 @@
|
||||
|
||||
#include "support/lyxalgo.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "support/filetools.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QKeyEvent>
|
||||
@ -52,7 +49,6 @@ namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
using support::prefixIs;
|
||||
using support::libFileSearch;
|
||||
|
||||
|
||||
namespace {
|
||||
@ -98,8 +94,8 @@ GuiCommandBuffer::GuiCommandBuffer(GuiViewBase * view)
|
||||
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);
|
||||
|
@ -24,9 +24,6 @@
|
||||
#include "frontends/LyXView.h"
|
||||
|
||||
#include "support/FileFilterList.h"
|
||||
#include "support/convert.h"
|
||||
#include "support/FileName.h"
|
||||
#include "support/filetools.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
@ -35,8 +32,6 @@ namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
using support::FileFilterList;
|
||||
using support::FileName;
|
||||
using support::libFileSearch;
|
||||
|
||||
EmbeddedFilesWidget::EmbeddedFilesWidget
|
||||
(GuiEmbeddedFiles & controller)
|
||||
@ -44,17 +39,13 @@ EmbeddedFilesWidget::EmbeddedFilesWidget
|
||||
{
|
||||
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();
|
||||
}
|
||||
@ -248,7 +239,8 @@ void EmbeddedFilesWidget::on_enableCB_toggled(bool enable)
|
||||
|
||||
|
||||
|
||||
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);
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "qt_helpers.h"
|
||||
#include "InsertTableWidget.h"
|
||||
|
||||
#include "support/filetools.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "support/lyxalgo.h" // sorted
|
||||
|
||||
@ -43,20 +42,28 @@
|
||||
#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 {
|
||||
@ -152,8 +159,7 @@ string const find_png(string const & name)
|
||||
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
|
||||
@ -162,44 +168,41 @@ string const find_png(string const & name)
|
||||
/// 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;
|
||||
}
|
||||
|
||||
|
||||
@ -261,8 +264,7 @@ void GuiLayoutBox::updateContents()
|
||||
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
|
||||
@ -290,8 +292,7 @@ void GuiLayoutBox::selected(const QString & str)
|
||||
return;
|
||||
}
|
||||
}
|
||||
lyxerr << "ERROR (layoutSelected): layout not found!"
|
||||
<< endl;
|
||||
lyxerr << "ERROR (layoutSelected): layout not found!" << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -396,8 +397,7 @@ void GuiToolbar::add(ToolbarItem const & item)
|
||||
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)));
|
||||
|
||||
@ -476,7 +476,6 @@ void GuiToolbar::updateContents()
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
|
@ -50,8 +50,6 @@
|
||||
#include "ToolbarBackend.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <boost/current_function.hpp>
|
||||
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
#include <QCloseEvent>
|
||||
@ -74,8 +72,6 @@ using std::vector;
|
||||
|
||||
namespace lyx {
|
||||
|
||||
using support::FileName;
|
||||
using support::libFileSearch;
|
||||
using support::makeDisplayPath;
|
||||
|
||||
extern bool quitting;
|
||||
@ -192,11 +188,7 @@ struct GuiViewBase::GuiViewPrivate
|
||||
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()
|
||||
@ -229,9 +221,7 @@ GuiViewBase::GuiViewBase(int id)
|
||||
#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;
|
||||
|
@ -30,8 +30,6 @@
|
||||
#include "LyXRC.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "support/filetools.h" // LibFileSearch
|
||||
|
||||
#include "graphics/GraphicsImage.h"
|
||||
#include "graphics/GraphicsLoader.h"
|
||||
|
||||
@ -46,7 +44,6 @@
|
||||
#include <QTimer>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/current_function.hpp>
|
||||
|
||||
#ifdef Q_WS_X11
|
||||
#include <QX11Info>
|
||||
@ -288,8 +285,7 @@ void GuiWorkArea::mousePressEvent(QMouseEvent * e)
|
||||
{
|
||||
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;
|
||||
@ -693,9 +689,13 @@ QVariant GuiWorkArea::inputMethodQuery(Qt::InputMethodQuery query) const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// TabWorkArea implementation.
|
||||
//
|
||||
// TabWorkArea
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
TabWorkArea::TabWorkArea(QWidget * parent): QTabWidget(parent)
|
||||
{
|
||||
QPalette pal = palette();
|
||||
@ -705,13 +705,8 @@ TabWorkArea::TabWorkArea(QWidget * parent): QTabWidget(parent)
|
||||
|
||||
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"));
|
||||
|
@ -15,8 +15,6 @@
|
||||
|
||||
#include "GuiToc.h"
|
||||
#include "qt_helpers.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
@ -25,21 +23,12 @@
|
||||
#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)
|
||||
@ -50,16 +39,11 @@ 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);
|
||||
|
Loading…
Reference in New Issue
Block a user