From a65738065959c266cd07df02994478b4fa10f6f1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Sun, 20 Apr 2008 21:05:35 +0000 Subject: [PATCH] cosmetics git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24397 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiApplication.cpp | 4 ++-- src/frontends/qt4/GuiClipboard.cpp | 13 ++++++------- src/frontends/qt4/GuiDocument.cpp | 2 +- src/frontends/qt4/GuiFontLoader.cpp | 16 +++++++--------- src/frontends/qt4/GuiGraphics.cpp | 2 +- src/frontends/qt4/GuiHyperlink.cpp | 2 +- src/frontends/qt4/GuiIdListModel.cpp | 14 -------------- src/frontends/qt4/GuiImage.cpp | 2 +- src/frontends/qt4/GuiKeySymbol.cpp | 4 ++-- src/frontends/qt4/GuiMathMatrix.cpp | 21 +++++++-------------- src/frontends/qt4/GuiPrefs.cpp | 16 ++++++++++------ src/frontends/qt4/GuiSelection.cpp | 2 +- src/frontends/qt4/GuiToolbar.cpp | 7 +++---- src/frontends/qt4/GuiWorkArea.cpp | 7 +++---- 14 files changed, 45 insertions(+), 67 deletions(-) diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index e25211b0b6..c0664b0d7b 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -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. diff --git a/src/frontends/qt4/GuiClipboard.cpp b/src/frontends/qt4/GuiClipboard.cpp index 3c7798870e..6ef84f5cf0 100644 --- a/src/frontends/qt4/GuiClipboard.cpp +++ b/src/frontends/qt4/GuiClipboard.cpp @@ -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(); diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index 4eedfbabef..bfedf55bf0 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -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), diff --git a/src/frontends/qt4/GuiFontLoader.cpp b/src/frontends/qt4/GuiFontLoader.cpp index 9e4a9ca36f..bad0ebe287 100644 --- a/src/frontends/qt4/GuiFontLoader.cpp +++ b/src/frontends/qt4/GuiFontLoader.cpp @@ -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 - (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()) diff --git a/src/frontends/qt4/GuiGraphics.cpp b/src/frontends/qt4/GuiGraphics.cpp index 1eff038b7d..069ee24f06 100644 --- a/src/frontends/qt4/GuiGraphics.cpp +++ b/src/frontends/qt4/GuiGraphics.cpp @@ -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)); diff --git a/src/frontends/qt4/GuiHyperlink.cpp b/src/frontends/qt4/GuiHyperlink.cpp index e195ef378d..488321973a 100644 --- a/src/frontends/qt4/GuiHyperlink.cpp +++ b/src/frontends/qt4/GuiHyperlink.cpp @@ -27,7 +27,7 @@ namespace frontend { GuiHyperlink::GuiHyperlink(GuiView & lv) : GuiDialog(lv, "href", qt_("Hyperlink")), - params_(insetCode(fromqstr("href"))) + params_(insetCode("href")) { setupUi(this); diff --git a/src/frontends/qt4/GuiIdListModel.cpp b/src/frontends/qt4/GuiIdListModel.cpp index 17cab6b20a..929d5d3241 100644 --- a/src/frontends/qt4/GuiIdListModel.cpp +++ b/src/frontends/qt4/GuiIdListModel.cpp @@ -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::const_iterator it = userData_.begin(); - vector::const_iterator end = userData_.end(); - for (; it != end; ++it) - qsl.append(it->idString.toString()); - return qsl; -} -#endif } // namespace frontend } // namespace lyx diff --git a/src/frontends/qt4/GuiImage.cpp b/src/frontends/qt4/GuiImage.cpp index 75c78a6ee8..a308429147 100644 --- a/src/frontends/qt4/GuiImage.cpp +++ b/src/frontends/qt4/GuiImage.cpp @@ -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()); diff --git a/src/frontends/qt4/GuiKeySymbol.cpp b/src/frontends/qt4/GuiKeySymbol.cpp index 9a26c12537..045bcaccaa 100644 --- a/src/frontends/qt4/GuiKeySymbol.cpp +++ b/src/frontends/qt4/GuiKeySymbol.cpp @@ -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. diff --git a/src/frontends/qt4/GuiMathMatrix.cpp b/src/frontends/qt4/GuiMathMatrix.cpp index b7dae78b48..3b0ace1428 100644 --- a/src/frontends/qt4/GuiMathMatrix.cpp +++ b/src/frontends/qt4/GuiMathMatrix.cpp @@ -14,9 +14,6 @@ #include "EmptyTable.h" #include "qt_helpers.h" -#include "support/gettext.h" - -#include #include #include @@ -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(); } diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 3e0a3db042..6f9d8d07e6 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -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 << '\'' <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(); diff --git a/src/frontends/qt4/GuiToolbar.cpp b/src/frontends/qt4/GuiToolbar.cpp index 9f99c0b737..a9bff84678 100644 --- a/src/frontends/qt4/GuiToolbar.cpp +++ b/src/frontends/qt4/GuiToolbar.cpp @@ -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 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; } diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index 79277e7ff1..9bed56018f 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -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; -- 2.39.2