From: André Pönitz Date: Wed, 25 Apr 2007 16:39:21 +0000 (+0000) Subject: code cosmetics whitespace, unneeded lyx:: qualification, indentation, unneeded destru... X-Git-Tag: 1.6.10~10084 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=c6b932f4677029826468e65f63d8ed4660ef9296;p=lyx.git code cosmetics whitespace, unneeded lyx:: qualification, indentation, unneeded destructors and the like git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17994 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/Action.C b/src/frontends/qt4/Action.C index b0f244742a..b34d9543fb 100644 --- a/src/frontends/qt4/Action.C +++ b/src/frontends/qt4/Action.C @@ -24,13 +24,10 @@ #include -using lyx::docstring; - using std::string; using std::endl; namespace lyx { - namespace frontend { @@ -70,7 +67,7 @@ void Action::setAction(FuncRequest const & func) void Action::update() { - FuncStatus const status = lyx::getStatus(func_); + FuncStatus const status = getStatus(func_); if (status.onoff(true)) { setCheckable(true); diff --git a/src/frontends/qt4/Action.h b/src/frontends/qt4/Action.h index 03a3e0da8d..f40d7a3ee7 100644 --- a/src/frontends/qt4/Action.h +++ b/src/frontends/qt4/Action.h @@ -19,10 +19,6 @@ #include -//class FuncRequest; - -//class string; - namespace lyx { namespace frontend { @@ -33,15 +29,15 @@ class GuiView; * * Action can be used in LyX menubar and/or toolbars. */ -class Action: public QAction { +class Action : public QAction { Q_OBJECT public: - Action(GuiView & lyxView, lyx::docstring const & text, - FuncRequest const & func, lyx::docstring const & tooltip = lyx::docstring()); + Action(GuiView & lyxView, docstring const & text, + FuncRequest const & func, docstring const & tooltip = docstring()); - Action(GuiView & lyxView, std::string const & icon, lyx::docstring const & text, - FuncRequest const & func, lyx::docstring const & tooltip = lyx::docstring()); + Action(GuiView & lyxView, std::string const & icon, docstring const & text, + FuncRequest const & func, docstring const & tooltip = docstring()); void update(); diff --git a/src/frontends/qt4/Alert_pimpl.C b/src/frontends/qt4/Alert_pimpl.C index 95c6903408..0218c7c7e9 100644 --- a/src/frontends/qt4/Alert_pimpl.C +++ b/src/frontends/qt4/Alert_pimpl.C @@ -32,18 +32,16 @@ using std::pair; using std::make_pair; +using lyx::support::bformat; namespace lyx { -using lyx::support::bformat; -using lyx::docstring; - namespace { class MessageBox: public QMessageBox { public: - MessageBox(QWidget * parent = 0): QMessageBox(parent) + MessageBox(QWidget * parent = 0) : QMessageBox(parent) { setAttribute(Qt::WA_DeleteOnClose, true); setAttribute(Qt::WA_QuitOnClose, false); @@ -139,7 +137,7 @@ askForText_pimpl(docstring const & msg, docstring const & dflt) bool ok; QString text = QInputDialog::getText(qApp->focusWidget(), toqstr(title), - toqstr(lyx::char_type('&') + msg), + toqstr(char_type('&') + msg), QLineEdit::Normal, toqstr(dflt), &ok); diff --git a/src/frontends/qt4/BulletsModule.C b/src/frontends/qt4/BulletsModule.C index 5fdab63e59..7704b80261 100644 --- a/src/frontends/qt4/BulletsModule.C +++ b/src/frontends/qt4/BulletsModule.C @@ -22,7 +22,7 @@ namespace lyx { -using lyx::support::libFileSearch; +using support::libFileSearch; using std::string; @@ -30,9 +30,9 @@ BulletsModule::BulletsModule(QWidget * , char const * , Qt::WFlags) { setupUi(this); - for (int iter = 0; iter < 4; ++iter) { + for (int iter = 0; iter < 4; ++iter) bullets_[iter] = ITEMIZE_DEFAULTS[iter]; - } + current_font_ = -1; current_char_ = 0; @@ -50,17 +50,15 @@ BulletsModule::BulletsModule(QWidget * , char const * , Qt::WFlags) setupPanel(new QListWidget(bulletpaneSW), qt_("Dings 3"), "psnfss3"); setupPanel(new QListWidget(bulletpaneSW), qt_("Dings 4"), "psnfss4"); - connect(levelLW, SIGNAL(currentRowChanged(int)), this, SLOT(showLevel(int))); - connect(bulletpaneCO, SIGNAL(activated(int)), bulletpaneSW, SLOT(setCurrentIndex(int))); + connect(levelLW, SIGNAL(currentRowChanged(int)), + this, SLOT(showLevel(int))); + connect(bulletpaneCO, SIGNAL(activated(int)), bulletpaneSW, + SLOT(setCurrentIndex(int))); } -BulletsModule::~BulletsModule() -{ -} - - -void BulletsModule::setupPanel(QListWidget * lw, QString panelname, std::string fname) +void BulletsModule::setupPanel(QListWidget * lw, QString const & panelname, + std::string const & fname) { connect(lw, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(bulletSelected(QListWidgetItem *, QListWidgetItem*))); @@ -199,10 +197,7 @@ Bullet const & BulletsModule::getBullet(int level) const return bullets_[level]; } - } // namespace lyx #include "BulletsModule_moc.cpp" - - diff --git a/src/frontends/qt4/BulletsModule.h b/src/frontends/qt4/BulletsModule.h index 55b60881b6..d7e667ec09 100644 --- a/src/frontends/qt4/BulletsModule.h +++ b/src/frontends/qt4/BulletsModule.h @@ -25,11 +25,9 @@ namespace lyx { class BulletsModule : public QWidget, public Ui::BulletsUi { Q_OBJECT public: - + /// BulletsModule(QWidget * parent = 0, const char * name = 0, Qt::WFlags fl = 0); - ~BulletsModule(); - /// set a bullet void setBullet(int level, Bullet const & bullet); /// get bullet setting @@ -45,12 +43,13 @@ protected Q_SLOTS: void on_bulletsizeCO_activated(int level); void on_customCB_clicked(bool); void on_customLE_textEdited(const QString &); - void bulletSelected(QListWidgetItem *, QListWidgetItem*); + void bulletSelected(QListWidgetItem *, QListWidgetItem *); void showLevel(int); private: void selectItem(int font, int character, bool select); - void setupPanel(QListWidget * lw, QString panelname, std::string fname); + void setupPanel(QListWidget * lw, QString const & panelname, + std::string const & fname); /// store results boost::array bullets_; diff --git a/src/frontends/qt4/ColorCache.C b/src/frontends/qt4/ColorCache.C index 796f63e726..5dcac2b96b 100644 --- a/src/frontends/qt4/ColorCache.C +++ b/src/frontends/qt4/ColorCache.C @@ -24,11 +24,6 @@ const QColor grey80(0xcc, 0xcc, 0xcc); const QColor grey90(0xe5, 0xe5, 0xe5); const QColor none = Qt::black; - -ColorCache::ColorCache() -{ -} - QColor const & ColorCache::get(LColor_color col) const { lcolor_map::const_iterator cit = colormap.find(col); @@ -58,7 +53,7 @@ void ColorCache::clear() } -QColor const rgb2qcolor(lyx::RGBColor const & rgb) +QColor const rgb2qcolor(RGBColor const & rgb) { return QColor(rgb.r, rgb.g, rgb.b); } diff --git a/src/frontends/qt4/ColorCache.h b/src/frontends/qt4/ColorCache.h index 2a9b188fbb..0604061537 100644 --- a/src/frontends/qt4/ColorCache.h +++ b/src/frontends/qt4/ColorCache.h @@ -30,7 +30,7 @@ struct RGBColor; */ class ColorCache { public: - ColorCache(); + ColorCache() {} /// get the given color QColor const & get(LColor_color color) const; @@ -45,7 +45,7 @@ private: }; /// -QColor const rgb2qcolor(lyx::RGBColor const &); +QColor const rgb2qcolor(RGBColor const &); } // namespace lyx diff --git a/src/frontends/qt4/FileDialog_private.C b/src/frontends/qt4/FileDialog_private.C index 2dcb1bf46c..fefa83ad4c 100644 --- a/src/frontends/qt4/FileDialog_private.C +++ b/src/frontends/qt4/FileDialog_private.C @@ -22,36 +22,29 @@ #include using lyx::support::split; -using lyx::docstring; - using std::string; - -namespace { +namespace lyx { /// return the Qt form of the label -docstring const getLabel(docstring const & ucs4str) { +static docstring const getLabel(docstring const & ucs4str) { // FIXME UNICODE - string str = lyx::to_utf8(ucs4str); + string str = to_utf8(ucs4str); string label; string sc(split(str, label, '|')); if (sc.length() < 2) - return lyx::from_utf8(label); + return from_utf8(label); string::size_type pos = label.find(sc[1]); if (pos == string::npos) - return lyx::from_utf8(label); + return from_utf8(label); label.insert(pos, 1, '&'); - return lyx::from_utf8(label); + return from_utf8(label); } -} // namespace anon - - -namespace lyx { LyXFileDialog::LyXFileDialog(docstring const & t, docstring const & p, - lyx::support::FileFilterList const & filters, + support::FileFilterList const & filters, FileDialog::Button const & b1, FileDialog::Button const & b2) // FIXME replace that with theApp->gui()->currentView() diff --git a/src/frontends/qt4/FileDialog_private.h b/src/frontends/qt4/FileDialog_private.h index ff438dac94..e697b361f0 100644 --- a/src/frontends/qt4/FileDialog_private.h +++ b/src/frontends/qt4/FileDialog_private.h @@ -26,19 +26,19 @@ class LyXFileDialog : public QFileDialog { Q_OBJECT public: - LyXFileDialog(lyx::docstring const & title, - lyx::docstring const & path, - lyx::support::FileFilterList const & filters, + LyXFileDialog(docstring const & title, + docstring const & path, + support::FileFilterList const & filters, FileDialog::Button const & b1, FileDialog::Button const & b2); public Q_SLOTS: void buttonClicked(); private: QToolButton * b1_; - lyx::docstring b1_dir_; + docstring b1_dir_; QToolButton * b2_; - lyx::docstring b2_dir_; + docstring b2_dir_; }; } // namespace lyx diff --git a/src/frontends/qt4/GuiApplication.C b/src/frontends/qt4/GuiApplication.C index b0f149774e..88f412771e 100644 --- a/src/frontends/qt4/GuiApplication.C +++ b/src/frontends/qt4/GuiApplication.C @@ -136,6 +136,7 @@ GuiApplication::GuiApplication(int & argc, char ** argv) guiApp = this; } + Clipboard& GuiApplication::clipboard() { return clipboard_; @@ -248,7 +249,7 @@ void GuiApplication::syncEvents() bool GuiApplication::getRgbColor(LColor_color col, - lyx::RGBColor & rgbcol) + RGBColor & rgbcol) { QColor const & qcol = color_cache_.get(col); if (!qcol.isValid()) { diff --git a/src/frontends/qt4/GuiApplication.h b/src/frontends/qt4/GuiApplication.h index 6ddc40eaff..ab2f1583ef 100644 --- a/src/frontends/qt4/GuiApplication.h +++ b/src/frontends/qt4/GuiApplication.h @@ -63,7 +63,7 @@ public: virtual std::string const romanFontName(); virtual std::string const sansFontName(); virtual std::string const typewriterFontName(); - virtual bool getRgbColor(LColor_color col, lyx::RGBColor & rgbcol); + virtual bool getRgbColor(LColor_color col, RGBColor & rgbcol); virtual std::string const hexName(LColor_color col); virtual void updateColor(LColor_color col); virtual void registerSocketCallback( diff --git a/src/frontends/qt4/GuiClipboard.C b/src/frontends/qt4/GuiClipboard.C index e84c0162d7..03c1c2b40f 100644 --- a/src/frontends/qt4/GuiClipboard.C +++ b/src/frontends/qt4/GuiClipboard.C @@ -29,12 +29,7 @@ using lyx::support::externalLineEnding; using std::endl; using std::string; - -namespace { - -char const * const mime_type = "application/x-lyx"; - -} +static char const * const mime_type = "application/x-lyx"; namespace lyx { diff --git a/src/frontends/qt4/GuiFontLoader.C b/src/frontends/qt4/GuiFontLoader.C index 7f71631e76..2c473882fc 100644 --- a/src/frontends/qt4/GuiFontLoader.C +++ b/src/frontends/qt4/GuiFontLoader.C @@ -45,9 +45,6 @@ using std::string; namespace lyx { namespace frontend { -GuiFontLoader::~GuiFontLoader() { -} - namespace { struct symbol_font { diff --git a/src/frontends/qt4/GuiFontLoader.h b/src/frontends/qt4/GuiFontLoader.h index 71d10b26d2..e9b28d5813 100644 --- a/src/frontends/qt4/GuiFontLoader.h +++ b/src/frontends/qt4/GuiFontLoader.h @@ -40,14 +40,14 @@ public: /// Hold info about a particular font -class GuiFontLoader: public FontLoader +class GuiFontLoader : public FontLoader { public: /// GuiFontLoader(); /// Destructor - virtual ~GuiFontLoader(); + virtual ~GuiFontLoader() {} virtual void update(); virtual bool available(LyXFont const & f); diff --git a/src/frontends/qt4/GuiSelection.C b/src/frontends/qt4/GuiSelection.C index 2b7b941a89..16506d4718 100644 --- a/src/frontends/qt4/GuiSelection.C +++ b/src/frontends/qt4/GuiSelection.C @@ -71,7 +71,7 @@ docstring const GuiSelection::get() const void GuiSelection::put(docstring const & str) { - LYXERR(Debug::ACTION) << "GuiSelection::put: " << lyx::to_utf8(str) << endl; + LYXERR(Debug::ACTION) << "GuiSelection::put: " << to_utf8(str) << endl; qApp->clipboard()->setText(toqstr(externalLineEnding(str)), QClipboard::Selection); diff --git a/src/frontends/qt4/GuiSelection.h b/src/frontends/qt4/GuiSelection.h index 8ffed6d326..d1fa749a8d 100644 --- a/src/frontends/qt4/GuiSelection.h +++ b/src/frontends/qt4/GuiSelection.h @@ -22,7 +22,7 @@ namespace frontend { /** * The Qt4 version of the Selection. */ -class GuiSelection: public Selection +class GuiSelection : public Selection { public: virtual ~GuiSelection() {} diff --git a/src/frontends/qt4/GuiView.h b/src/frontends/qt4/GuiView.h index 7e87cc1d89..dd1c2ca76d 100644 --- a/src/frontends/qt4/GuiView.h +++ b/src/frontends/qt4/GuiView.h @@ -69,7 +69,7 @@ public: /// add toolbar, if newline==true, add a toolbar break before the toolbar Toolbars::ToolbarPtr makeToolbar(ToolbarInfo const & tbinfo, bool newline); virtual void updateStatusBar(); - virtual void message(lyx::docstring const & str); + virtual void message(docstring const & str); virtual void clearMessage(); virtual bool hasFocus() const; @@ -124,7 +124,7 @@ private: * @param t main window title * @param it iconified (short) title */ - virtual void setWindowTitle(lyx::docstring const & t, lyx::docstring const & it); + virtual void setWindowTitle(docstring const & t, docstring const & it); /// in order to catch Tab key press. bool event(QEvent * e); diff --git a/src/frontends/qt4/GuiWorkArea.C b/src/frontends/qt4/GuiWorkArea.C index 9db4e44aaa..a06303ab73 100644 --- a/src/frontends/qt4/GuiWorkArea.C +++ b/src/frontends/qt4/GuiWorkArea.C @@ -678,7 +678,7 @@ void GuiWorkArea::inputMethodEvent(QInputMethodEvent * e) rLength = 0; } - int const right_margin = lyx::rightMargin(); + int const right_margin = rightMargin(); Painter::preedit_style ps; // Most often there would be only one line: preedit_lines_ = 1; diff --git a/src/frontends/qt4/InsertTableWidget.C b/src/frontends/qt4/InsertTableWidget.C index ac34dac72e..0868c6353a 100644 --- a/src/frontends/qt4/InsertTableWidget.C +++ b/src/frontends/qt4/InsertTableWidget.C @@ -146,7 +146,7 @@ void InsertTableWidget::drawGrid(int const rows, int const cols, Qt::GlobalColor void InsertTableWidget::updateParent() { - bool status = lyx::getStatus(FuncRequest(LFUN_TABULAR_INSERT)).enabled(); + bool status = getStatus(FuncRequest(LFUN_TABULAR_INSERT)).enabled(); parentWidget()->setEnabled(status); } diff --git a/src/frontends/qt4/QBibtex.C b/src/frontends/qt4/QBibtex.C index 81fd9ab98c..61b428d592 100644 --- a/src/frontends/qt4/QBibtex.C +++ b/src/frontends/qt4/QBibtex.C @@ -369,7 +369,7 @@ void QBibtex::apply() controller().params()["options"] = "bibtotoc," + bibstyle; } else if (bibtotoc) { // bibtotoc and no style - controller().params()["options"] = lyx::from_ascii("bibtotoc"); + controller().params()["options"] = from_ascii("bibtotoc"); } else { // only style. An empty one is valid, because some // documentclasses have an own \bibliographystyle{} @@ -385,13 +385,13 @@ void QBibtex::apply() switch (btp) { case 0: - controller().params()["btprint"] = lyx::from_ascii("btPrintCited"); + controller().params()["btprint"] = from_ascii("btPrintCited"); break; case 1: - controller().params()["btprint"] = lyx::from_ascii("btPrintNotCited"); + controller().params()["btprint"] = from_ascii("btPrintNotCited"); break; case 2: - controller().params()["btprint"] = lyx::from_ascii("btPrintAll"); + controller().params()["btprint"] = from_ascii("btPrintAll"); break; } diff --git a/src/frontends/qt4/QBox.C b/src/frontends/qt4/QBox.C index b4916170ad..675554c637 100644 --- a/src/frontends/qt4/QBox.C +++ b/src/frontends/qt4/QBox.C @@ -60,13 +60,13 @@ QBoxDialog::QBoxDialog(QBox * form) connect(widthED, SIGNAL(textChanged(const QString &)), this, SLOT(change_adaptor())); - connect(widthUnitsLC, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)), + connect(widthUnitsLC, SIGNAL(selectionChanged(LyXLength::UNIT)), this, SLOT(change_adaptor())); connect(valignCO, SIGNAL(highlighted(const QString &)), this, SLOT(change_adaptor())); connect(heightED, SIGNAL(textChanged(const QString &)), this, SLOT(change_adaptor())); - connect(heightUnitsLC, SIGNAL(selectionChanged(lyx::LyXLength::UNIT) ), + connect(heightUnitsLC, SIGNAL(selectionChanged(LyXLength::UNIT) ), this, SLOT(change_adaptor())); connect(restorePB, SIGNAL(clicked()), this, SLOT(restoreClicked())); connect(typeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor())); diff --git a/src/frontends/qt4/QCitation.C b/src/frontends/qt4/QCitation.C index 512d00b296..9200704115 100644 --- a/src/frontends/qt4/QCitation.C +++ b/src/frontends/qt4/QCitation.C @@ -1,4 +1,4 @@ -/** +/* * \file QCitation.C * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. @@ -27,13 +27,11 @@ using std::vector; using std::string; -namespace { - template static QStringList to_qstring_list(vector const & v) { QStringList qlist; - for (size_t i=0; i != v.size(); ++i) { + for (size_t i = 0; i != v.size(); ++i) { if (v[i].empty()) continue; qlist.append(lyx::toqstr(v[i])); @@ -42,7 +40,7 @@ template static QStringList to_qstring_list(vector cons } -vector const to_string_vector(QStringList const & qlist) +static vector const to_string_vector(QStringList const & qlist) { vector v; for (int i = 0; i != qlist.size(); ++i) { @@ -53,8 +51,6 @@ vector const to_string_vector(QStringList const & qlist) return v; } -} - namespace lyx { namespace frontend { diff --git a/src/frontends/qt4/QDialogView.C b/src/frontends/qt4/QDialogView.C index 7e7a86191e..28fbd6a2ef 100644 --- a/src/frontends/qt4/QDialogView.C +++ b/src/frontends/qt4/QDialogView.C @@ -16,7 +16,6 @@ #include "controllers/ButtonController.h" -using lyx::docstring; namespace lyx { namespace frontend { diff --git a/src/frontends/qt4/QDocument.C b/src/frontends/qt4/QDocument.C index 1693adbf7b..39a1702665 100644 --- a/src/frontends/qt4/QDocument.C +++ b/src/frontends/qt4/QDocument.C @@ -433,7 +433,7 @@ QDocumentDialog::QDocumentDialog(QDocument * form) latexModule->classCO->addItem(toqstr(cit->description())); } else { docstring item = - bformat(_("Unavailable: %1$s"), lyx::from_utf8(cit->description())); + bformat(_("Unavailable: %1$s"), from_utf8(cit->description())); latexModule->classCO->addItem(toqstr(item)); } } @@ -667,7 +667,7 @@ void QDocumentDialog::classChanged() ControlDocument & cntrl = form_->controller(); BufferParams & params = cntrl.params(); - lyx::textclass_type const tc = latexModule->classCO->currentIndex(); + textclass_type const tc = latexModule->classCO->currentIndex(); if (form_->controller().loadTextclass(tc)) { params.textclass = tc; diff --git a/src/frontends/qt4/QErrorList.C b/src/frontends/qt4/QErrorList.C index 5bcbed209a..f5fe58d7d1 100644 --- a/src/frontends/qt4/QErrorList.C +++ b/src/frontends/qt4/QErrorList.C @@ -75,7 +75,7 @@ typedef QController > ErrorListBase; QErrorList::QErrorList(Dialog & parent) - : ErrorListBase(parent, lyx::docstring()) + : ErrorListBase(parent, docstring()) {} @@ -96,7 +96,7 @@ void QErrorList::select(QListWidgetItem * wi) void QErrorList::update_contents() { - setTitle(lyx::from_utf8(controller().name())); + setTitle(from_utf8(controller().name())); dialog_->errorsLW->clear(); dialog_->descriptionTB->setPlainText(QString()); diff --git a/src/frontends/qt4/QExternal.C b/src/frontends/qt4/QExternal.C index 6ff368b3e9..460d8802e3 100644 --- a/src/frontends/qt4/QExternal.C +++ b/src/frontends/qt4/QExternal.C @@ -69,38 +69,54 @@ QExternalDialog::QExternalDialog(QExternal * form) : form_(form) { setupUi(this); - connect(okPB, SIGNAL(clicked()), - form, SLOT(slotOK())); - connect(applyPB, SIGNAL(clicked()), - form, SLOT(slotApply())); - connect(closePB, SIGNAL(clicked()), - form, SLOT(slotClose())); - - connect( displayCB, SIGNAL( toggled(bool) ), showCO, SLOT( setEnabled(bool) ) ); - connect( displayCB, SIGNAL( toggled(bool) ), displayscaleED, SLOT( setEnabled(bool) ) ); - connect( showCO, SIGNAL( activated(const QString&) ), this, SLOT( change_adaptor() ) ); - connect( originCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) ); - connect( aspectratioCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) ); - connect( browsePB, SIGNAL( clicked() ), this, SLOT( browseClicked() ) ); - connect( editPB, SIGNAL( clicked() ), this, SLOT( editClicked() ) ); - connect( externalCO, SIGNAL( activated(const QString&) ), this, SLOT( templateChanged() ) ); - connect( extraED, SIGNAL( textChanged(const QString&) ), this, SLOT( extraChanged(const QString&) ) ); - connect( extraFormatCO, SIGNAL( activated(const QString&) ), this, SLOT( formatChanged(const QString&) ) ); - connect( widthUnitCO, SIGNAL( activated(int) ), this, SLOT( widthUnitChanged() ) ); - connect( heightUnitCO, SIGNAL( selectionChanged(lyx::LyXLength::UNIT) ), this, SLOT( change_adaptor() ) ); - connect( displayCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) ); - connect( displayscaleED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) ); - connect( angleED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) ); - connect( widthED, SIGNAL( textChanged(const QString&) ), this, SLOT( sizeChanged() ) ); - connect( heightED, SIGNAL( textChanged(const QString&) ), this, SLOT( sizeChanged() ) ); - connect( fileED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) ); - connect( clipCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) ); - connect( getbbPB, SIGNAL( clicked() ), this, SLOT( getbbClicked() ) ); - connect( xrED, SIGNAL( textChanged(const QString&) ), this, SLOT( bbChanged() ) ); - connect( ytED, SIGNAL( textChanged(const QString&) ), this, SLOT( bbChanged() ) ); - connect( xlED, SIGNAL( textChanged(const QString&) ), this, SLOT( bbChanged() ) ); - connect( ybED, SIGNAL( textChanged(const QString&) ), this, SLOT( bbChanged() ) ); - connect( draftCB, SIGNAL( clicked() ), this, SLOT( change_adaptor() ) ); + connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK())); + connect(applyPB, SIGNAL(clicked()), form, SLOT(slotApply())); + connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose())); + + connect(displayCB, SIGNAL(toggled(bool)), + showCO, SLOT(setEnabled(bool))); + connect(displayCB, SIGNAL(toggled(bool)), + displayscaleED, SLOT(setEnabled(bool))); + connect(showCO, SIGNAL(activated(const QString&)), + this, SLOT(change_adaptor())); + connect(originCO, SIGNAL(activated(int)), + this, SLOT(change_adaptor())); + connect(aspectratioCB, SIGNAL(stateChanged(int)), + this, SLOT(change_adaptor())); + connect(browsePB, SIGNAL(clicked()), + this, SLOT(browseClicked())); + connect(editPB, SIGNAL(clicked()), + this, SLOT(editClicked())); + connect(externalCO, SIGNAL(activated(const QString&)), + this, SLOT(templateChanged())); + connect(extraED, SIGNAL(textChanged(const QString&)), + this, SLOT(extraChanged(const QString&))); + connect(extraFormatCO, SIGNAL(activated(const QString&)), + this, SLOT(formatChanged(const QString&))); + connect(widthUnitCO, SIGNAL(activated(int)), + this, SLOT(widthUnitChanged())); + connect(heightUnitCO, SIGNAL(selectionChanged(LyXLength::UNIT)), + this, SLOT(change_adaptor())); + connect(displayCB, SIGNAL(stateChanged(int)), + this, SLOT(change_adaptor())); + connect(displayscaleED, SIGNAL(textChanged(const QString&)), + this, SLOT(change_adaptor())); + connect(angleED, SIGNAL(textChanged(const QString&)), + this, SLOT(change_adaptor())); + connect(widthED, SIGNAL(textChanged(const QString&)), + this, SLOT(sizeChanged())); + connect(heightED, SIGNAL(textChanged(const QString&)), + this, SLOT(sizeChanged())); + connect(fileED, SIGNAL(textChanged(const QString&)), + this, SLOT(change_adaptor())); + connect(clipCB, SIGNAL(stateChanged(int)), + this, SLOT(change_adaptor())); + connect(getbbPB, SIGNAL(clicked()), this, SLOT(getbbClicked())); + connect(xrED, SIGNAL(textChanged(const QString&)), this, SLOT(bbChanged())); + connect(ytED, SIGNAL(textChanged(const QString&)), this, SLOT(bbChanged())); + connect(xlED, SIGNAL(textChanged(const QString&)), this, SLOT(bbChanged())); + connect(ybED, SIGNAL(textChanged(const QString&)), this, SLOT(bbChanged())); + connect(draftCB, SIGNAL(clicked()), this, SLOT(change_adaptor())); QIntValidator * validator = new QIntValidator(displayscaleED); validator->setBottom(1); @@ -167,7 +183,7 @@ void QExternalDialog::browseClicked() { int const choice = externalCO->currentIndex(); docstring const template_name = - lyx::from_utf8(form_->controller().getTemplate(choice).lyxName); + from_utf8(form_->controller().getTemplate(choice).lyxName); docstring const str = form_->controller().browse(qstring_to_ucs4(fileED->text()), template_name); diff --git a/src/frontends/qt4/QGraphicsDialog.C b/src/frontends/qt4/QGraphicsDialog.C index b0939ec093..ba98ed817c 100644 --- a/src/frontends/qt4/QGraphicsDialog.C +++ b/src/frontends/qt4/QGraphicsDialog.C @@ -43,40 +43,40 @@ QGraphicsDialog::QGraphicsDialog(QGraphics * form) { setupUi(this); //main buttons - connect(okPB, SIGNAL( clicked() ), - form, SLOT( slotOK() ) ); - connect(applyPB, SIGNAL( clicked() ), - form, SLOT( slotApply() ) ); - connect(closePB, SIGNAL( clicked() ), - form, SLOT( slotClose() ) ); - connect(restorePB, SIGNAL( clicked() ), - form, SLOT( slotRestore() ) ); + connect(okPB, SIGNAL(clicked()), + form, SLOT(slotOK())); + connect(applyPB, SIGNAL(clicked()), + form, SLOT(slotApply())); + connect(closePB, SIGNAL(clicked()), + form, SLOT(slotClose())); + connect(restorePB, SIGNAL(clicked()), + form, SLOT(slotRestore())); //graphics pane - connect(filename, SIGNAL( textChanged(const QString&) ), - this, SLOT( change_adaptor() ) ); - connect(WidthCB, SIGNAL( clicked() ), - this, SLOT( change_adaptor() ) ); - connect(HeightCB, SIGNAL( clicked() ), - this, SLOT( change_adaptor() ) ); - connect(Width, SIGNAL( textChanged(const QString&) ), - this, SLOT( change_adaptor() ) ); - connect(Height, SIGNAL( textChanged(const QString&) ), - this, SLOT( change_adaptor() ) ); - connect(heightUnit, SIGNAL( selectionChanged(lyx::LyXLength::UNIT) ), - this, SLOT( change_adaptor() ) ); - connect(widthUnit, SIGNAL( selectionChanged(lyx::LyXLength::UNIT) ), - this, SLOT( change_adaptor() ) ); - connect(aspectratio, SIGNAL( stateChanged(int) ), - this, SLOT( change_adaptor() ) ); - connect(angle, SIGNAL( textChanged(const QString&) ), - this, SLOT( change_adaptor() ) ); - connect(origin, SIGNAL( activated(int) ), - this, SLOT( change_adaptor() ) ); - connect(scaleCB, SIGNAL( clicked() ), - this, SLOT(change_adaptor()) ); - connect(Scale, SIGNAL( textChanged(const QString&) ), - this, SLOT( change_adaptor() ) ); + connect(filename, SIGNAL(textChanged(const QString&)), + this, SLOT(change_adaptor())); + connect(WidthCB, SIGNAL( clicked()), + this, SLOT(change_adaptor())); + connect(HeightCB, SIGNAL( clicked()), + this, SLOT(change_adaptor())); + connect(Width, SIGNAL(textChanged(const QString&)), + this, SLOT(change_adaptor())); + connect(Height, SIGNAL(textChanged(const QString&)), + this, SLOT(change_adaptor())); + connect(heightUnit, SIGNAL(selectionChanged(LyXLength::UNIT)), + this, SLOT(change_adaptor())); + connect(widthUnit, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)), + this, SLOT(change_adaptor())); + connect(aspectratio, SIGNAL(stateChanged(int)), + this, SLOT(change_adaptor())); + connect(angle, SIGNAL(textChanged(const QString&)), + this, SLOT(change_adaptor())); + connect(origin, SIGNAL(activated(int)), + this, SLOT(change_adaptor())); + connect(scaleCB, SIGNAL(clicked()), + this, SLOT(change_adaptor())); + connect(Scale, SIGNAL(textChanged(const QString&)), + this, SLOT(change_adaptor())); filename->setValidator(new PathValidator(true, filename)); setFocusProxy(filename); @@ -90,26 +90,26 @@ QGraphicsDialog::QGraphicsDialog(QGraphics * form) angle->setValidator(new QDoubleValidator(-360, 360, 2, angle)); //clipping pane - connect(clip, SIGNAL( stateChanged(int) ), - this, SLOT( change_adaptor() ) ); - connect(lbY, SIGNAL( textChanged(const QString&) ), - this, SLOT( change_bb() ) ); - connect(lbYunit, SIGNAL( activated(int) ), - this, SLOT( change_bb() ) ); - connect(rtY, SIGNAL( textChanged(const QString&) ), - this, SLOT( change_bb() ) ); - connect(rtYunit, SIGNAL( activated(int) ), - this, SLOT( change_bb() ) ); - connect(lbX, SIGNAL( textChanged(const QString&) ), - this, SLOT( change_bb() ) ); - connect(lbXunit, SIGNAL( activated(int) ), - this, SLOT( change_bb() ) ); - connect(rtX, SIGNAL( textChanged(const QString&) ), - this, SLOT( change_bb() ) ); - connect(rtXunit, SIGNAL( activated(int) ), - this, SLOT( change_bb() ) ); - connect(getPB, SIGNAL( clicked() ), - this, SLOT( change_adaptor() ) ); + connect(clip, SIGNAL(stateChanged(int)), + this, SLOT(change_adaptor())); + connect(lbY, SIGNAL(textChanged(const QString&)), + this, SLOT(change_bb())); + connect(lbYunit, SIGNAL(activated(int)), + this, SLOT(change_bb())); + connect(rtY, SIGNAL(textChanged(const QString&)), + this, SLOT(change_bb())); + connect(rtYunit, SIGNAL(activated(int)), + this, SLOT(change_bb())); + connect(lbX, SIGNAL(textChanged(const QString&)), + this, SLOT(change_bb())); + connect(lbXunit, SIGNAL(activated(int)), + this, SLOT(change_bb())); + connect(rtX, SIGNAL(textChanged(const QString&)), + this, SLOT(change_bb())); + connect(rtXunit, SIGNAL(activated(int)), + this, SLOT(change_bb())); + connect(getPB, SIGNAL(clicked()), + this, SLOT(change_adaptor())); lbX->setValidator(new QDoubleValidator(lbX)); lbY->setValidator(new QDoubleValidator(lbY)); @@ -117,12 +117,12 @@ QGraphicsDialog::QGraphicsDialog(QGraphics * form) rtY->setValidator(new QDoubleValidator(rtY)); //extra options pane - connect(latexoptions, SIGNAL( textChanged(const QString&) ), - this, SLOT( change_adaptor() ) ); - connect(draftCB, SIGNAL( stateChanged(int) ), - this, SLOT( change_adaptor() ) ); - connect(unzipCB, SIGNAL( stateChanged(int) ), - this, SLOT( change_adaptor() ) ); + connect(latexoptions, SIGNAL(textChanged(const QString&)), + this, SLOT(change_adaptor())); + connect(draftCB, SIGNAL(stateChanged(int)), + this, SLOT(change_adaptor())); + connect(unzipCB, SIGNAL(stateChanged(int)), + this, SLOT(change_adaptor())); // FIXME: we should connect to clicked() when we move to Qt 4.2 because // the toggled(bool) signal is also trigged when we update the widgets // (rgh-4/07) this isn't as much or a problem as it was, because we're now @@ -130,16 +130,16 @@ QGraphicsDialog::QGraphicsDialog(QGraphics * form) // setChecked(). Note, too, that clicked() would get called whenever it // is clicked, even right clicked (I think), not just whenever it is // toggled. - connect(subfigure, SIGNAL( toggled(bool) ), - this, SLOT( change_adaptor() ) ); - connect(subcaption, SIGNAL( textChanged(const QString&) ), - this, SLOT( change_adaptor() ) ); - connect(displayGB, SIGNAL( toggled(bool) ), - this, SLOT( change_adaptor() ) ); - connect(showCB, SIGNAL( currentIndexChanged(int) ), - this, SLOT( change_adaptor() ) ); - connect(displayscale, SIGNAL( textChanged(const QString&) ), - this, SLOT( change_adaptor() ) ); + connect(subfigure, SIGNAL(toggled(bool)), + this, SLOT(change_adaptor())); + connect(subcaption, SIGNAL(textChanged(const QString&)), + this, SLOT(change_adaptor())); + connect(displayGB, SIGNAL(toggled(bool)), + this, SLOT(change_adaptor())); + connect(showCB, SIGNAL(currentIndexChanged(int)), + this, SLOT(change_adaptor())); + connect(displayscale, SIGNAL(textChanged(const QString&)), + this, SLOT(change_adaptor())); displayscale->setValidator(new QIntValidator(displayscale)); } diff --git a/src/frontends/qt4/QIndex.h b/src/frontends/qt4/QIndex.h index a49bdc5a3f..ea5e64f10e 100644 --- a/src/frontends/qt4/QIndex.h +++ b/src/frontends/qt4/QIndex.h @@ -38,6 +38,7 @@ private: QIndex * form_; }; + class ControlCommand; class QIndex : @@ -46,7 +47,7 @@ class QIndex : public: friend class QIndexDialog; - QIndex(Dialog &, lyx::docstring const & title, QString const & label); + QIndex(Dialog &, docstring const & title, QString const & label); protected: virtual bool isValid(); private: diff --git a/src/frontends/qt4/QLMenubar.C b/src/frontends/qt4/QLMenubar.C index 6cbaf522fc..95789bfd9b 100644 --- a/src/frontends/qt4/QLMenubar.C +++ b/src/frontends/qt4/QLMenubar.C @@ -32,13 +32,7 @@ using std::pair; using std::string; using std::endl; -namespace { - -} // namespace anon - namespace lyx { - - namespace frontend { // MacOSX specific stuff is at the end. @@ -48,17 +42,18 @@ QLMenubar::QLMenubar(LyXView * view, MenuBackend & mbe) { macxMenuBarInit(); - LYXERR(Debug::GUI) << "populating menu bar" << lyx::to_utf8(menubackend_.getMenubar().name()) << endl; + LYXERR(Debug::GUI) << "populating menu bar" << to_utf8(menubackend_.getMenubar().name()) << endl; if (menubackend_.getMenubar().size() == 0) { - LYXERR(Debug::GUI) << "\tERROR: empty menu bar" << lyx::to_utf8(menubackend_.getMenubar().name()) << endl; + LYXERR(Debug::GUI) << "\tERROR: empty menu bar" + << to_utf8(menubackend_.getMenubar().name()) << endl; return; // continue; } else { - LYXERR(Debug::GUI) << "menu bar entries " << menubackend_.getMenubar().size(); + LYXERR(Debug::GUI) << "menu bar entries " + << menubackend_.getMenubar().size(); } - // for (; m != end; ++m) { Menu menu; menubackend_.expand(menubackend_.getMenubar(), menu, owner_->buffer()); @@ -69,15 +64,18 @@ QLMenubar::QLMenubar(LyXView * view, MenuBackend & mbe) for (; m != end; ++m) { if (m->kind() != MenuItem::Submenu) { - LYXERR(Debug::GUI) << "\tERROR: not a submenu " << lyx::to_utf8(m->label()) << endl; + LYXERR(Debug::GUI) << "\tERROR: not a submenu " + << to_utf8(m->label()) << endl; continue; } - LYXERR(Debug::GUI) << "menu bar item " << lyx::to_utf8(m->label()) << " is a submenu named " << lyx::to_utf8(m->submenuname()) << endl; + LYXERR(Debug::GUI) << "menu bar item " << to_utf8(m->label()) + << " is a submenu named " << to_utf8(m->submenuname()) << endl; docstring name = m->submenuname(); if (!menubackend_.hasMenu(name)) { - LYXERR(Debug::GUI) << "\tERROR: " << lyx::to_utf8(name) << " submenu has no menu!" << endl; + LYXERR(Debug::GUI) << "\tERROR: " << to_utf8(name) + << " submenu has no menu!" << endl; continue; } @@ -89,7 +87,8 @@ QLMenubar::QLMenubar(LyXView * view, MenuBackend & mbe) pair I = name_map_.insert(make_pair(name, qMenu)); if (!I.second) { - LYXERR(Debug::GUI) << "\tERROR: " << lyx::to_utf8(name) << " submenu is already there!" << endl; + LYXERR(Debug::GUI) << "\tERROR: " << to_utf8(name) + << " submenu is already there!" << endl; } /* QObject::connect(qMenu, SIGNAL(aboutToShow()), this, SLOT(update())); diff --git a/src/frontends/qt4/QLMenubar.h b/src/frontends/qt4/QLMenubar.h index 28382c780a..cbcdab6b54 100644 --- a/src/frontends/qt4/QLMenubar.h +++ b/src/frontends/qt4/QLMenubar.h @@ -29,8 +29,6 @@ class Menu; class MenuItem; namespace lyx { - - namespace frontend { class GuiView; @@ -41,7 +39,7 @@ public: QLMenubar(LyXView *, MenuBackend &); /// opens a top-level submenu given its name - void openByName(lyx::docstring const &); + void openByName(docstring const &); /// return the owning view GuiView * view(); @@ -69,7 +67,7 @@ private: /// menu controller MenuBackend & menubackend_; - typedef std::map NameMap; + typedef std::map NameMap; /// name to menu for openByName NameMap name_map_; diff --git a/src/frontends/qt4/QLPainter.h b/src/frontends/qt4/QLPainter.h index 3050ea4946..5a5c72d814 100644 --- a/src/frontends/qt4/QLPainter.h +++ b/src/frontends/qt4/QLPainter.h @@ -90,11 +90,10 @@ public: /// draw a string at position x, y (y is the baseline) virtual int text(int x, int y, - lyx::docstring const & str, LyXFont const & f); + docstring const & str, LyXFont const & f); /// draw a char at position x, y (y is the baseline) - virtual int text(int x, int y, - lyx::char_type c, LyXFont const & f); + virtual int text(int x, int y, char_type c, LyXFont const & f); private: /// draw small caps text diff --git a/src/frontends/qt4/QLPopupMenu.C b/src/frontends/qt4/QLPopupMenu.C index c1b0782e48..f3b6d1f007 100644 --- a/src/frontends/qt4/QLPopupMenu.C +++ b/src/frontends/qt4/QLPopupMenu.C @@ -32,15 +32,10 @@ using std::string; using std::pair; using std::endl; -namespace { - -} // namespace anon namespace lyx { - namespace frontend { - QLPopupMenu::QLPopupMenu(QLMenubar * owner, MenuItem const & mi, bool topLevelMenu) : owner_(owner) @@ -54,11 +49,10 @@ QLPopupMenu::QLPopupMenu(QLMenubar * owner, } - void QLPopupMenu::update() { LYXERR(Debug::GUI) << BOOST_CURRENT_FUNCTION << endl; - LYXERR(Debug::GUI) << "\tTriggered menu: " << lyx::to_utf8(name_) << endl; + LYXERR(Debug::GUI) << "\tTriggered menu: " << to_utf8(name_) << endl; clear(); @@ -72,16 +66,18 @@ void QLPopupMenu::update() owner_->backend().expand(fromLyxMenu, topLevelMenu_, owner_->view()->buffer()); if (!owner_->backend().hasMenu(topLevelMenu_.name())) { - LYXERR(Debug::GUI) << "\tWARNING: menu seems empty" << lyx::to_utf8(topLevelMenu_.name()) << endl; + LYXERR(Debug::GUI) << "\tWARNING: menu seems empty" + << to_utf8(topLevelMenu_.name()) << endl; } populate(this, &topLevelMenu_); } void QLPopupMenu::populate(QMenu* qMenu, Menu * menu) { - LYXERR(Debug::GUI) << "populating menu " << lyx::to_utf8(menu->name()) ; + LYXERR(Debug::GUI) << "populating menu " << to_utf8(menu->name()) ; if (menu->size() == 0) { - LYXERR(Debug::GUI) << "\tERROR: empty menu " << lyx::to_utf8(menu->name()) << endl; + LYXERR(Debug::GUI) << "\tERROR: empty menu " + << to_utf8(menu->name()) << endl; return; } else { @@ -100,13 +96,15 @@ void QLPopupMenu::populate(QMenu* qMenu, Menu * menu) } else if (m->kind() == MenuItem::Submenu) { - LYXERR(Debug::GUI) << "** creating New Sub-Menu " << lyx::to_utf8(getLabel(*m)) << endl; + LYXERR(Debug::GUI) << "** creating New Sub-Menu " + << to_utf8(getLabel(*m)) << endl; QMenu * subMenu = qMenu->addMenu(toqstr(getLabel(*m))); populate(subMenu, m->submenu()); } else { // we have a MenuItem::Command - LYXERR(Debug::GUI) << "creating Menu Item " << lyx::to_utf8(m->label()) << endl; + LYXERR(Debug::GUI) << "creating Menu Item " + << to_utf8(m->label()) << endl; docstring label = getLabel(*m); addBinding(label, *m); @@ -118,12 +116,12 @@ void QLPopupMenu::populate(QMenu* qMenu, Menu * menu) } } + docstring const QLPopupMenu::getLabel(MenuItem const & mi) { docstring const shortcut = mi.shortcut(); docstring label = support::subst(mi.label(), - lyx::from_ascii("&"), - lyx::from_ascii("&&")); + from_ascii("&"), from_ascii("&&")); if (!shortcut.empty()) { docstring::size_type pos = label.find(shortcut); diff --git a/src/frontends/qt4/QLPopupMenu.h b/src/frontends/qt4/QLPopupMenu.h index c565990e16..f397e4cd11 100644 --- a/src/frontends/qt4/QLPopupMenu.h +++ b/src/frontends/qt4/QLPopupMenu.h @@ -43,14 +43,14 @@ private: QLMenubar * owner_; /// the name of this menu - lyx::docstring name_; + docstring name_; private: /// Get a Menu item label from the menu backend - lyx::docstring const getLabel(MenuItem const & mi); + docstring const getLabel(MenuItem const & mi); /// add binding keys a the menu item label. - void addBinding(lyx::docstring & label, MenuItem const & mi); + void addBinding(docstring & label, MenuItem const & mi); /// Top Level Menu Menu topLevelMenu_; diff --git a/src/frontends/qt4/QLToolbar.C b/src/frontends/qt4/QLToolbar.C index dc539912f5..756d6d0560 100644 --- a/src/frontends/qt4/QLToolbar.C +++ b/src/frontends/qt4/QLToolbar.C @@ -219,7 +219,7 @@ void QLToolbar::add(ToolbarItem const & item) ToolbarInfo::item_iterator it = tbinfo.items.begin(); ToolbarInfo::item_iterator const end = tbinfo.items.end(); for (; it != end; ++it) - if (!lyx::getStatus(it->func_).unknown()) { + if (!getStatus(it->func_).unknown()) { Action * action = new Action(owner_, getIcon(it->func_), it->label_, @@ -253,7 +253,7 @@ void QLToolbar::add(ToolbarItem const & item) ToolbarInfo::item_iterator it = tbinfo.items.begin(); ToolbarInfo::item_iterator const end = tbinfo.items.end(); for (; it != end; ++it) - if (!lyx::getStatus(it->func_).unknown()) { + if (!getStatus(it->func_).unknown()) { Action * action = new Action(owner_, getIcon(it->func_, false), it->label_, @@ -267,7 +267,7 @@ void QLToolbar::add(ToolbarItem const & item) break; } case ToolbarItem::COMMAND: { - if (lyx::getStatus(item.func_).unknown()) + if (getStatus(item.func_).unknown()) break; Action * action = new Action(owner_, diff --git a/src/frontends/qt4/QLog.C b/src/frontends/qt4/QLog.C index 11b51ba7eb..dcd519a53c 100644 --- a/src/frontends/qt4/QLog.C +++ b/src/frontends/qt4/QLog.C @@ -110,7 +110,7 @@ void LogHighlighter::highlightBlock(QString const & text) typedef QController > LogBase; QLog::QLog(Dialog & parent) - : LogBase(parent, lyx::docstring()) + : LogBase(parent, docstring()) {} diff --git a/src/frontends/qt4/QPrefs.C b/src/frontends/qt4/QPrefs.C index 23ff4e837c..a822f75ce4 100644 --- a/src/frontends/qt4/QPrefs.C +++ b/src/frontends/qt4/QPrefs.C @@ -1181,7 +1181,7 @@ class SamePrettyName { public: SamePrettyName(string const & n) : pretty_name_(n) {} - bool operator()(lyx::Format const & fmt) const { + bool operator()(Format const & fmt) const { return fmt.prettyname() == pretty_name_; } @@ -1192,8 +1192,8 @@ private: Format const * getFormat(std::string const & prettyname) { - Formats::const_iterator it = lyx::formats.begin(); - Formats::const_iterator const end = lyx::formats.end(); + Formats::const_iterator it = formats.begin(); + Formats::const_iterator const end = formats.end(); it = std::find_if(it, end, SamePrettyName(prettyname)); return it == end ? 0 : &*it; } @@ -1595,8 +1595,7 @@ PrefLanguage::PrefLanguage(QWidget * parent) defaultLanguageCO->clear(); // store the lang identifiers for later - std::vector const langs = - lyx::frontend::getLanguageData(false); + std::vector const langs = frontend::getLanguageData(false); lang_ = getSecond(langs); std::vector::const_iterator lit = langs.begin(); diff --git a/src/frontends/qt4/QRef.h b/src/frontends/qt4/QRef.h index 19c006db07..c175655afd 100644 --- a/src/frontends/qt4/QRef.h +++ b/src/frontends/qt4/QRef.h @@ -109,7 +109,7 @@ private: int restored_buffer_; /// the references - std::vector refs_; + std::vector refs_; }; } // namespace frontend diff --git a/src/frontends/qt4/QTabular.C b/src/frontends/qt4/QTabular.C index 21aa2c4e3d..8969ed98c3 100644 --- a/src/frontends/qt4/QTabular.C +++ b/src/frontends/qt4/QTabular.C @@ -56,17 +56,17 @@ QTabularDialog::QTabularDialog(QTabular * form) connect(topspaceED, SIGNAL(returnPressed()), this, SLOT(topspace_changed())); - connect(topspaceUnit, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)), + connect(topspaceUnit, SIGNAL(selectionChanged(LyXLength::UNIT)), this, SLOT(topspace_changed())); connect(topspaceCO, SIGNAL(activated(int)), this, SLOT(topspace_changed())); connect(bottomspaceED, SIGNAL(returnPressed()), this, SLOT(bottomspace_changed())); - connect(bottomspaceUnit, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)), + connect(bottomspaceUnit, SIGNAL(selectionChanged(LyXLength::UNIT)), this, SLOT(bottomspace_changed())); connect(bottomspaceCO, SIGNAL(activated(int)), this, SLOT(bottomspace_changed())); connect(interlinespaceED, SIGNAL(returnPressed()), this, SLOT(interlinespace_changed())); - connect(interlinespaceUnit, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)), + connect(interlinespaceUnit, SIGNAL(selectionChanged(LyXLength::UNIT)), this, SLOT(interlinespace_changed())); connect(interlinespaceCO, SIGNAL(activated(int)), this, SLOT(interlinespace_changed())); connect(booktabsRB, SIGNAL(clicked(bool)), this, SLOT(booktabsChanged(bool))); @@ -95,7 +95,7 @@ QTabularDialog::QTabularDialog(QTabular * form) connect(lastfooterNoContentsCB, SIGNAL(clicked()), this, SLOT(ltLastFooterEmpty_clicked())); connect(specialAlignmentED, SIGNAL(returnPressed()), this, SLOT(specialAlignment_changed())); connect(widthED, SIGNAL(returnPressed()), this, SLOT(width_changed())); - connect(widthUnit, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)), this, SLOT(width_changed())); + connect(widthUnit, SIGNAL(selectionChanged(LyXLength::UNIT)), this, SLOT(width_changed())); connect(closePB, SIGNAL(clicked()), this, SLOT(close_clicked())); connect(borders, SIGNAL(topSet(bool)), this, SLOT(topBorder_changed())); connect(borders, SIGNAL(bottomSet(bool)), this, SLOT(bottomBorder_changed())); diff --git a/src/frontends/qt4/QToc.C b/src/frontends/qt4/QToc.C index 7fa122c839..ea308c0fb0 100644 --- a/src/frontends/qt4/QToc.C +++ b/src/frontends/qt4/QToc.C @@ -99,9 +99,7 @@ void QToc::goTo(int type, QModelIndex const & index) TocIterator const it = toc_models_[type]->tocIterator(index); - LYXERR(Debug::GUI) - << "QToc::goTo " << lyx::to_utf8(it->str()) - << endl; + LYXERR(Debug::GUI) << "QToc::goTo " << to_utf8(it->str()) << endl; ControlToc::goTo(*it); } diff --git a/src/frontends/qt4/QVSpace.C b/src/frontends/qt4/QVSpace.C index e991aefe58..4d9ca14d14 100644 --- a/src/frontends/qt4/QVSpace.C +++ b/src/frontends/qt4/QVSpace.C @@ -69,7 +69,7 @@ QVSpaceDialog::QVSpaceDialog(QVSpace * form) this, SLOT(enableCustom(int))); connect(keepCB, SIGNAL(clicked()), this, SLOT(change_adaptor())); - connect(unitCO, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)), + connect(unitCO, SIGNAL(selectionChanged(LyXLength::UNIT)), this, SLOT(change_adaptor())); valueLE->setValidator(unsignedLengthValidator(valueLE)); diff --git a/src/frontends/qt4/Qt2BC.C b/src/frontends/qt4/Qt2BC.C index be3c9b722e..811ceecdb7 100644 --- a/src/frontends/qt4/Qt2BC.C +++ b/src/frontends/qt4/Qt2BC.C @@ -17,8 +17,6 @@ #include #include -using lyx::docstring; - namespace lyx { namespace frontend { @@ -37,16 +35,12 @@ void Qt2BC::setButtonEnabled(QPushButton * obj, bool enabled) const void Qt2BC::setWidgetEnabled(QWidget * obj, bool enabled) const { // yuck, rtti, but the user comes first - if (obj->inherits("QLineEdit")) { - QLineEdit * le(static_cast(obj)); + if (QLineEdit * le = qobject_cast(obj)) le->setReadOnly(!enabled); - } else { + else obj->setEnabled(enabled); - } - Qt::FocusPolicy const p = - (enabled) ? Qt::StrongFocus : Qt::NoFocus; - obj->setFocusPolicy(p); + obj->setFocusPolicy(enabled ? Qt::StrongFocus : Qt::NoFocus); } diff --git a/src/frontends/qt4/Qt2BC.h b/src/frontends/qt4/Qt2BC.h index e71a16a1cf..9ba55e2685 100644 --- a/src/frontends/qt4/Qt2BC.h +++ b/src/frontends/qt4/Qt2BC.h @@ -33,8 +33,8 @@ class Qt2BC : public GuiBC { public: /// Qt2BC(ButtonController const &, - lyx::docstring const & = _("Cancel"), - lyx::docstring const & = _("Close")); + docstring const & = _("Cancel"), + docstring const & = _("Close")); private: /// Updates the button sensitivity (enabled/disabled) void setButtonEnabled(QPushButton *, bool enabled) const; @@ -43,7 +43,7 @@ private: void setWidgetEnabled(QWidget *, bool enabled) const; /// Set the label on the button - void setButtonLabel(QPushButton *, lyx::docstring const & label) const; + void setButtonLabel(QPushButton *, docstring const & label) const; }; } // namespace frontend diff --git a/src/frontends/qt4/TocModel.C b/src/frontends/qt4/TocModel.C index 7dc4e56e53..8f923d89f4 100644 --- a/src/frontends/qt4/TocModel.C +++ b/src/frontends/qt4/TocModel.C @@ -110,7 +110,7 @@ void TocModel::populate(Toc const & toc) LYXERR(Debug::GUI) << "Toc: at depth " << iter->depth() - << ", added item " << lyx::to_utf8(iter->str()) + << ", added item " << to_utf8(iter->str()) << endl; populate(iter, end, top_level_item); diff --git a/src/frontends/qt4/panelstack.C b/src/frontends/qt4/panelstack.C index 9e0c77fe69..b0e5f46b18 100644 --- a/src/frontends/qt4/panelstack.C +++ b/src/frontends/qt4/panelstack.C @@ -58,11 +58,10 @@ PanelStack::PanelStack(QWidget * parent) void PanelStack::addCategory(docstring const & n, docstring const & parent) { - QTreeWidgetItem * item; + QTreeWidgetItem * item = 0; + QString const name = toqstr(n); - QString const name(toqstr(n)); - - LYXERR(Debug::GUI) << "addCategory n= " << lyx::to_utf8(n) << " parent= " << endl; + LYXERR(Debug::GUI) << "addCategory n= " << to_utf8(n) << " parent= " << endl; int depth = 1; diff --git a/src/frontends/qt4/panelstack.h b/src/frontends/qt4/panelstack.h index 8ea60c4b4e..ff8948683e 100644 --- a/src/frontends/qt4/panelstack.h +++ b/src/frontends/qt4/panelstack.h @@ -17,8 +17,6 @@ #include #include -#include - class QTreeWidget; class QTreeWidgetItem; @@ -35,23 +33,24 @@ public: PanelStack(QWidget * parent = 0); /// add a category with no associated panel - void addCategory(lyx::docstring const & name, - lyx::docstring const & parent = lyx::docstring()); + void addCategory(docstring const & name, + docstring const & parent = docstring()); /// add a widget panel with a given name, under the given parent - void addPanel(QWidget * panel, lyx::docstring const & name, - lyx::docstring const & parent = lyx::docstring()); + void addPanel(QWidget * panel, docstring const & name, + docstring const & parent = docstring()); /// set current panel by logical name - void setCurrentPanel(lyx::docstring const &); + void setCurrentPanel(docstring const &); virtual QSize sizeHint() const; + public Q_SLOTS: /// set current panel from an item - void switchPanel(QTreeWidgetItem * i, QTreeWidgetItem* previous=0); + void switchPanel(QTreeWidgetItem * it, QTreeWidgetItem * previous = 0); private: - typedef std::map PanelMap; + typedef std::map PanelMap; PanelMap panel_map_; diff --git a/src/frontends/qt4/qt_helpers.C b/src/frontends/qt4/qt_helpers.C index e1709a2c92..c1fd07035a 100644 --- a/src/frontends/qt4/qt_helpers.C +++ b/src/frontends/qt4/qt_helpers.C @@ -134,9 +134,11 @@ void setAutoTextCB(QCheckBox * checkBox, QLineEdit * lineEdit, LengthCombo * lengthCombo) { if (!checkBox->isChecked()) - lengthToWidgets(lineEdit, lengthCombo, "auto", lengthCombo->currentLengthItem()); + lengthToWidgets(lineEdit, lengthCombo, + "auto", lengthCombo->currentLengthItem()); else if (lineEdit->text() == "auto") - lengthToWidgets(lineEdit, lengthCombo, string(""), lengthCombo->currentLengthItem()); + lengthToWidgets(lineEdit, lengthCombo, string(), + lengthCombo->currentLengthItem()); } @@ -176,25 +178,25 @@ docstring const formatted(docstring const & text, int w) nxtpos2 < nxtpos1); docstring const line_plus_word = - line.empty() ? word : line + lyx::char_type(' ') + word; + line.empty() ? word : line + char_type(' ') + word; // FIXME: make w be size_t if (int(line_plus_word.length()) >= w) { - sout += line + lyx::char_type('\n'); + sout += line + char_type('\n'); if (newline) { - sout += word + lyx::char_type('\n'); + sout += word + char_type('\n'); line.erase(); } else { line = word; } } else if (newline) { - sout += line_plus_word + lyx::char_type('\n'); + sout += line_plus_word + char_type('\n'); line.erase(); } else { if (!line.empty()) - line += lyx::char_type(' '); + line += char_type(' '); line += word; } diff --git a/src/frontends/qt4/validators.C b/src/frontends/qt4/validators.C index 3020d2420c..e4cf2fe68e 100644 --- a/src/frontends/qt4/validators.C +++ b/src/frontends/qt4/validators.C @@ -32,8 +32,6 @@ #include using lyx::support::isStrDbl; -using lyx::docstring; - using std::string; @@ -141,9 +139,7 @@ PathValidator::PathValidator(bool acceptable_if_empty, {} -namespace { - -docstring const printable_list(docstring const & invalid_chars) +static docstring const printable_list(docstring const & invalid_chars) { docstring s; docstring::const_iterator const begin = invalid_chars.begin(); @@ -162,8 +158,6 @@ docstring const printable_list(docstring const & invalid_chars) return s; } -} // namespace anon - QValidator::State PathValidator::validate(QString & qtext, int &) const {