cosmetics

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24397 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2008-04-20 21:05:35 +00:00
parent 1e4f4fcd91
commit a657380659
14 changed files with 45 additions and 67 deletions

View File

@ -197,10 +197,10 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
// even if the language calls for RtL, don't do that
setLayoutDirection(Qt::LeftToRight);
LYXERR(Debug::GUI, "Successfully installed Qt translations for locale "
<< fromqstr(language_name));
<< language_name);
} else
LYXERR(Debug::GUI, "Could not find Qt translations for locale "
<< fromqstr(language_name));
<< language_name);
#ifdef Q_WS_MACX
// This allows to translate the strings that appear in the LyX menu.

View File

@ -197,7 +197,7 @@ QString QMacPasteboardMimeGraphics::convertorName()
QString QMacPasteboardMimeGraphics::flavorFor(QString const & mime)
{
LYXERR(Debug::ACTION, "flavorFor " << fromqstr(mime));
LYXERR(Debug::ACTION, "flavorFor " << mime);
if (mime == QLatin1String(pdf_mime_type))
return QLatin1String("com.adobe.pdf");
return QString();
@ -206,7 +206,7 @@ QString QMacPasteboardMimeGraphics::flavorFor(QString const & mime)
QString QMacPasteboardMimeGraphics::mimeFor(QString flav)
{
LYXERR(Debug::ACTION, "mimeFor " << fromqstr(flav));
LYXERR(Debug::ACTION, "mimeFor " << flav);
if (flav == QLatin1String("com.adobe.pdf"))
return QLatin1String(pdf_mime_type);
return QString();
@ -502,7 +502,7 @@ docstring const GuiClipboard::getAsText() const
// text data from other applications
QString const str = qApp->clipboard()->text(QClipboard::Clipboard)
.normalized(QString::NormalizationForm_C);
LYXERR(Debug::ACTION, "GuiClipboard::getAsText(): `" << fromqstr(str) << "'");
LYXERR(Debug::ACTION, "GuiClipboard::getAsText(): `" << str << "'");
if (str.isNull())
return docstring();
@ -568,7 +568,7 @@ bool GuiClipboard::hasGraphicsContents(Clipboard::GraphicsType type) const
QStringList const & formats = source->formats();
LYXERR(Debug::ACTION, "We found " << formats.size() << " formats");
for (int i = 0; i < formats.size(); ++i) {
LYXERR(Debug::ACTION, "Found format " << fromqstr(formats[i]));
LYXERR(Debug::ACTION, "Found format " << formats[i]);
}
// compute mime for type
@ -613,9 +613,8 @@ void GuiClipboard::on_dataChanged()
qApp->clipboard()->mimeData(QClipboard::Clipboard);
QStringList l = source->formats();
LYXERR(Debug::ACTION, "Qt Clipboard changed. We found the following mime types:");
for (int i = 0; i < l.count(); i++) {
LYXERR(Debug::ACTION, fromqstr(l.value(i)));
}
for (int i = 0; i < l.count(); i++)
LYXERR(Debug::ACTION, l.value(i));
text_clipboard_empty_ = qApp->clipboard()->
text(QClipboard::Clipboard).isEmpty();

View File

@ -1227,7 +1227,7 @@ void GuiDocument::browseLayout()
qt_("Local layout file"), filter, false,
label1, dir1);
if (!suffixIs(fromqstr(file), ".layout"))
if (!file.endsWith(".layout"))
return;
FileName layoutFile = makeAbsPath(fromqstr(file),

View File

@ -153,8 +153,7 @@ static bool isChosenFont(QFont & font, QString const & family)
QFont symbolFont(QString const & family, bool * ok)
{
LYXERR(Debug::FONT, "Looking for font family "
<< fromqstr(family) << " ... ");
LYXERR(Debug::FONT, "Looking for font family " << family << " ... ");
QString upper = family;
upper[0] = family[0].toUpper();
@ -168,7 +167,7 @@ QFont symbolFont(QString const & family, bool * ok)
return font;
}
LYXERR(Debug::FONT, "Trying " << fromqstr(upper) << " ... ");
LYXERR(Debug::FONT, "Trying " << upper << " ... ");
font.setFamily(upper);
if (isChosenFont(font, upper)) {
@ -180,7 +179,7 @@ QFont symbolFont(QString const & family, bool * ok)
// A simple setFamily() fails on Qt 2
QString const raw = rawName(family);
LYXERR(Debug::FONT, "Trying " << fromqstr(raw) << " ... ");
LYXERR(Debug::FONT, "Trying " << raw << " ... ");
font.setRawName(raw);
if (isChosenFont(font, family)) {
@ -206,9 +205,8 @@ FontLoader::FontLoader()
QString const font_file = fonts_dir + '/' + math_fonts[i] + ".ttf";
int fontID = QFontDatabase::addApplicationFont(font_file);
LYXERR(Debug::FONT, "Adding font " << fromqstr(font_file)
<< static_cast<const char *>
(fontID < 0 ? " FAIL" : " OK"));
LYXERR(Debug::FONT, "Adding font " << font_file
<< (fontID < 0 ? " FAIL" : " OK"));
}
for (int i1 = 0; i1 < NUM_FAMILIES; ++i1)
@ -306,8 +304,8 @@ GuiFontInfo::GuiFontInfo(FontInfo const & f)
break;
}
LYXERR(Debug::FONT, "Font '" << to_utf8(stateText(f))
<< "' matched by\n" << fromqstr(font.family()));
LYXERR(Debug::FONT, "Font '" << stateText(f)
<< "' matched by\n" << font.family());
// Is this an exact match?
if (font.exactMatch())

View File

@ -459,7 +459,7 @@ void GuiGraphics::updateContents()
break;
}
lyxerr << fromqstr(bufferFilepath());
lyxerr << bufferFilepath();
string const name =
igp.filename.outputFilename(fromqstr(bufferFilepath()));
filename->setText(toqstr(name));

View File

@ -27,7 +27,7 @@ namespace frontend {
GuiHyperlink::GuiHyperlink(GuiView & lv)
: GuiDialog(lv, "href", qt_("Hyperlink")),
params_(insetCode(fromqstr("href")))
params_(insetCode("href"))
{
setupUi(this);

View File

@ -138,20 +138,6 @@ int GuiIdListModel::findIDString(std::string const & idString)
return -1;
}
#if 0
// The following function is currently unused but is retained here in
// case it should at some point be useful.
QStringList GuiIdListModel::getIDStringList() const
{
QStringList qsl;
vector<OurData>::const_iterator it = userData_.begin();
vector<OurData>::const_iterator end = userData_.end();
for (; it != end; ++it)
qsl.append(it->idString.toString());
return qsl;
}
#endif
} // namespace frontend
} // namespace lyx

View File

@ -53,7 +53,7 @@ Image::FormatList GuiImage::loadableFormats()
//LYXERR(Debug::GRAPHICS,
// "D:/msys/home/yns/src/lyx-devel/lib/images/banner.png mis of format: "
// << fromqstr(Pic.pictureFormat("D:/msys/.../banner.png")))
// << Pic.pictureFormat("D:/msys/.../banner.png"))
//if (Pic.pictureFormat("D:/msys/.../banner.png"))
// LYXERR(Debug::GRAPHICS, "pictureFormat not returned NULL\n"
// << "Supported formats are: " << Pic.inputFormats());

View File

@ -595,7 +595,7 @@ static char encode(string const & encoding, QString const & str)
return 0;
}
LYXERR(Debug::KEY, "Using codec " << fromqstr(codec->name()));
LYXERR(Debug::KEY, "Using codec " << codec->name());
if (!codec->canEncode(str)) {
LYXERR(Debug::KEY, "Oof. Can't encode the text !");
@ -616,7 +616,7 @@ void setKeySymbol(KeySymbol * sym, QKeyEvent * ev)
return;
}
LYXERR(Debug::KEY, "Getting key " << ev->key() << ", with text '"
<< fromqstr(ev->text()) << "'");
<< ev->text() << "'");
// This is unsafe because ev->text() is the unicode representation of the
// key, not the name of the key. For example, Ctrl-x and Alt-x produce
// different texts.

View File

@ -14,9 +14,6 @@
#include "EmptyTable.h"
#include "qt_helpers.h"
#include "support/gettext.h"
#include <sstream>
#include <QLineEdit>
#include <QPushButton>
@ -52,9 +49,9 @@ GuiMathMatrix::GuiMathMatrix(GuiView & lv)
this, SLOT(rowsChanged(int)));
connect(columnsSB, SIGNAL(valueChanged(int)),
this, SLOT(columnsChanged(int)) );
connect(valignCO, SIGNAL(highlighted(const QString&)),
connect(valignCO, SIGNAL(highlighted(QString)),
this, SLOT(change_adaptor()));
connect(halignED, SIGNAL(textChanged(const QString&)),
connect(halignED, SIGNAL(textChanged(QString)),
this, SLOT(change_adaptor()));
bc().setPolicy(ButtonPolicy::IgnorantPolicy);
@ -88,15 +85,11 @@ void GuiMathMatrix::slotOK()
{
char v_align_c[] = "tcb";
char const c = v_align_c[valignCO->currentIndex()];
string const sh = fromqstr(halignED->text());
int const nx = int(columnsSB->value());
int const ny = int(rowsSB->value());
ostringstream os;
os << nx << ' ' << ny << ' ' << c << ' ' << sh;
dispatchMatrix(os.str().c_str());
// close the dialog
QString const sh = halignED->text();
int const nx = columnsSB->value();
int const ny = rowsSB->value();
dispatchMatrix(fromqstr(
QString("%1 %2 %3 %4").arg(nx).arg(ny).arg(c).arg(sh)));
close();
}

View File

@ -180,6 +180,7 @@ QString browseDir(QString const & pathname,
} // namespace frontend
QString browseRelFile(QString const & filename, QString const & refpath,
QString const & title, QStringList const & filters, bool save,
QString const & label1, QString const & dir1,
@ -188,6 +189,7 @@ QString browseRelFile(QString const & filename, QString const & refpath,
QString const fname = toqstr(makeAbsPath(
fromqstr(filename), fromqstr(refpath)).absFilename());
QString const outname =
frontend::browseFile(fname, title, filters, save, label1, dir1, label2, dir2);
@ -201,6 +203,7 @@ QString browseRelFile(QString const & filename, QString const & refpath,
}
/////////////////////////////////////////////////////////////////////
//
// Helpers
@ -296,18 +299,18 @@ static void setComboxFont(QComboBox * cb, string const & family,
font.setStyleHint(QFont::TypeWriter);
font.setFamily(font_family);
} else {
lyxerr << "FAILED to find the default font: '"
<< foundry << "', '" << family << '\''<< endl;
LYXERR0("FAILED to find the default font: '"
<< foundry << "', '" << family << '\'');
return;
}
QFontInfo info(font);
string default_font_name, dummyfoundry;
parseFontName(info.family(), default_font_name, dummyfoundry);
lyxerr << "Apparent font is " << default_font_name << endl;
LYXERR0("Apparent font is " << default_font_name);
for (int i = 0; i < cb->count(); ++i) {
lyxerr << "Looking at " << fromqstr(cb->itemText(i)) << endl;
LYXERR0("Looking at " << cb->itemText(i));
if (compare_ascii_no_case(fromqstr(cb->itemText(i)),
default_font_name) == 0) {
cb->setCurrentIndex(i);
@ -315,11 +318,12 @@ static void setComboxFont(QComboBox * cb, string const & family,
}
}
lyxerr << "FAILED to find the font: '"
<< foundry << "', '" << family << '\'' <<endl;
LYXERR0("FAILED to find the font: '"
<< foundry << "', '" << family << '\'');
}
/////////////////////////////////////////////////////////////////////
//
// PrefPlaintext

View File

@ -71,7 +71,7 @@ docstring const GuiSelection::get() const
{
QString const str = qApp->clipboard()->text(QClipboard::Selection)
.normalized(QString::NormalizationForm_C);
LYXERR(Debug::ACTION, "GuiSelection::get: " << fromqstr(str));
LYXERR(Debug::ACTION, "GuiSelection::get: " << str);
if (str.isNull())
return docstring();

View File

@ -181,8 +181,8 @@ QString findPng(QString const & name)
png_name.replace('!', "negthinspace");
}
LYXERR(Debug::GUI, "findPng(" << fromqstr(name) << ")\n"
<< "Looking for math PNG called \"" << fromqstr(png_name) << '"');
LYXERR(Debug::GUI, "findPng(" << name << ")\n"
<< "Looking for math PNG called \"" << png_name << '"');
return png_name;
}
@ -683,8 +683,7 @@ void GuiLayoutBox::set(docstring const & layout)
QList<QStandardItem *> r = model_->findItems(name, Qt::MatchExactly, 1);
if (r.empty()) {
lyxerr << "Trying to select non existent layout type "
<< fromqstr(name) << endl;
LYXERR0("Trying to select non existent layout type " << name);
return;
}

View File

@ -852,8 +852,7 @@ void GuiWorkArea::keyPressEvent(QKeyEvent * ev)
}
#endif
LYXERR(Debug::KEY, " count: " << ev->count()
<< " text: " << fromqstr(ev->text())
LYXERR(Debug::KEY, " count: " << ev->count() << " text: " << ev->text()
<< " isAutoRepeat: " << ev->isAutoRepeat() << " key: " << ev->key());
KeySymbol sym;
@ -959,8 +958,8 @@ void GuiWorkArea::inputMethodEvent(QInputMethodEvent * e)
if (!commit_string.isEmpty()) {
LYXERR(Debug::KEY, "preeditString: " << fromqstr(e->preeditString())
<< " commitString: " << fromqstr(e->commitString()));
LYXERR(Debug::KEY, "preeditString: " << e->preeditString()
<< " commitString: " << e->commitString());
int key = 0;