From 739f890e7485ff103ec16f8ba79718686f9f773d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Sat, 20 Sep 2008 12:07:18 +0000 Subject: [PATCH] cosmetics git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26464 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiDocument.cpp | 27 ++++++++++++++------------- src/frontends/qt4/GuiDocument.h | 8 ++++---- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index b8e56d73cf..4fc4c75c31 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -559,9 +559,9 @@ GuiDocument::GuiDocument(GuiView & lv) connect(textLayoutModule->bypassCB, SIGNAL(clicked()), this, SLOT(change_adaptor())); connect(textLayoutModule->bypassCB, SIGNAL(clicked()), - this, SLOT(set_listings_msg())); + this, SLOT(setListingsMessage())); connect(textLayoutModule->listingsED, SIGNAL(textChanged()), - this, SLOT(set_listings_msg())); + this, SLOT(setListingsMessage())); textLayoutModule->listingsTB->setPlainText( qt_("Input listings parameters on the right. Enter ? for a list of parameters.")); textLayoutModule->lspacingLE->setValidator(new QDoubleValidator( @@ -1023,40 +1023,41 @@ void GuiDocument::change_adaptor() } -docstring GuiDocument::validate_listings_params() +QString GuiDocument::validateListingsParameters() { // use a cache here to avoid repeated validation // of the same parameters - static string param_cache = string(); - static docstring msg_cache = docstring(); + static string param_cache; + static QString msg_cache; if (textLayoutModule->bypassCB->isChecked()) - return docstring(); + return QString(); string params = fromqstr(textLayoutModule->listingsED->toPlainText()); if (params != param_cache) { param_cache = params; - msg_cache = InsetListingsParams(params).validate(); + msg_cache = toqstr(InsetListingsParams(params).validate()); } return msg_cache; } -void GuiDocument::set_listings_msg() +void GuiDocument::setListingsMessage() { static bool isOK = true; - docstring msg = validate_listings_params(); - if (msg.empty()) { + QString msg = validateListingsParameters(); + if (msg.isEmpty()) { if (isOK) return; isOK = true; // listingsTB->setTextColor("black"); textLayoutModule->listingsTB->setPlainText( - qt_("Input listings parameters on the right. Enter ? for a list of parameters.")); + qt_("Input listings parameters on the right. " + "Enter ? for a list of parameters.")); } else { isOK = false; // listingsTB->setTextColor("red"); - textLayoutModule->listingsTB->setPlainText(toqstr(msg)); + textLayoutModule->listingsTB->setPlainText(msg); } } @@ -2178,7 +2179,7 @@ void GuiDocument::setLayoutComboByIDString(std::string const & idString) bool GuiDocument::isValid() { - return validate_listings_params().empty() + return validateListingsParameters().isEmpty() && (textLayoutModule->skipCO->currentIndex() != 3 || !textLayoutModule->skipLE->text().isEmpty()); } diff --git a/src/frontends/qt4/GuiDocument.h b/src/frontends/qt4/GuiDocument.h index 5ce411e3a8..47d854127d 100644 --- a/src/frontends/qt4/GuiDocument.h +++ b/src/frontends/qt4/GuiDocument.h @@ -111,13 +111,11 @@ public: void updatePagestyle(std::string const &, std::string const &); void showPreamble(); - /// validate listings parameters and return an error message, if any - docstring validate_listings_params(); private Q_SLOTS: void updateNumbering(); void change_adaptor(); - void set_listings_msg(); + void setListingsMessage(); void saveDefaultClicked(); void useDefaultsClicked(); void setLSpacing(int); @@ -137,6 +135,9 @@ private Q_SLOTS: void updateModuleInfo(); private: + /// validate listings parameters and return an error message, if any + QString validateListingsParameters(); + UiWidget *textLayoutModule; UiWidget *fontModule; UiWidget *pageLayoutModule; @@ -184,7 +185,6 @@ private: /// current buffer BufferId current_id_; -protected: /// return false if validate_listings_params returns error bool isValid();