From 66d7fea6dff31089117fb1d1d7e78477d45c5e17 Mon Sep 17 00:00:00 2001 From: John Levon Date: Sat, 30 Nov 2002 02:09:16 +0000 Subject: [PATCH] Some string(widget->text()) fixes. Weirdness git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5752 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt2/ChangeLog | 4 ++++ src/frontends/qt2/QGraphics.C | 38 ++++++++++++++++------------------ src/frontends/qt2/QIndex.C | 2 +- src/frontends/qt2/QParagraph.C | 10 ++++----- src/frontends/qt2/QPrefs.C | 2 -- src/frontends/qt2/QRef.C | 4 ++-- src/frontends/qt2/QSendto.C | 2 +- 7 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index d7e5062227..2aa4689393 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,7 @@ +2002-11-30 John Levon + + * various: string(widget->text()) is not good. + 2002-11-28 John Levon * qt_helpers.C: fix build diff --git a/src/frontends/qt2/QGraphics.C b/src/frontends/qt2/QGraphics.C index 401d2daf25..ffd1b1035d 100644 --- a/src/frontends/qt2/QGraphics.C +++ b/src/frontends/qt2/QGraphics.C @@ -177,10 +177,10 @@ void QGraphics::update_contents() } else { // get the values from the inset LyXLength anyLength; - string const xl(token(igp.bb,' ',0)); - string const yl(token(igp.bb,' ',1)); - string const xr(token(igp.bb,' ',2)); - string const yr(token(igp.bb,' ',3)); + string const xl(token(igp.bb, ' ', 0)); + string const yl(token(igp.bb, ' ', 1)); + string const xr(token(igp.bb, ' ', 2)); + string const yr(token(igp.bb, ' ', 3)); if (isValidLength(xl, &anyLength)) { dialog_->lbX->setText(tostr(anyLength.value()).c_str()); string const unit(unit_name[anyLength.unit()]); @@ -299,16 +299,16 @@ void QGraphics::apply() { InsetGraphicsParams & igp = controller().params(); - igp.filename = dialog_->filename->text(); + igp.filename = dialog_->filename->text().latin1(); // the bb section igp.bb.erase(); if (controller().bbChanged) { string bb; - string lbX(dialog_->lbX->text()); - string lbY(dialog_->lbY->text()); - string rtX(dialog_->rtX->text()); - string rtY(dialog_->rtY->text()); + string lbX(dialog_->lbX->text().latin1()); + string lbY(dialog_->lbY->text().latin1()); + string rtX(dialog_->rtX->text().latin1()); + string rtY(dialog_->rtY->text().latin1()); int bb_sum = strToInt(lbX) + strToInt(lbY) + strToInt(rtX) + strToInt(rtX); @@ -336,7 +336,7 @@ void QGraphics::apply() igp.draft = dialog_->draftCB->isChecked(); igp.clip = dialog_->clip->isChecked(); igp.subcaption = dialog_->subfigure->isChecked(); - igp.subcaptionText = dialog_->subcaption->text(); + igp.subcaptionText = dialog_->subcaption->text().latin1(); switch (dialog_->showCB->currentItem()) { case 0: igp.display = grfx::DefaultDisplay; break; @@ -349,11 +349,11 @@ void QGraphics::apply() if (!dialog_->displayCB->isChecked()) igp.display = grfx::NoDisplay; - string value(dialog_->width->text()); + string value(dialog_->width->text().latin1()); if (dialog_->widthUnit->currentItem() > 0) { // width/height combination int const unitNo = getUnitNo(unit_name_gui, - string(dialog_->widthUnit->currentText())); + dialog_->widthUnit->currentText().latin1()); igp.width = LyXLength(value + unit_name_ltx[unitNo]); igp.scale = 0.0; } else { @@ -361,18 +361,18 @@ void QGraphics::apply() igp.scale = strToDbl(value); igp.width = LyXLength(); } - value = string(dialog_->height->text()); + value = dialog_->height->text().latin1(); int const unitNo = getUnitNo(unit_name_gui, - string(dialog_->heightUnit->currentText())); + dialog_->heightUnit->currentText().latin1()); igp.height = LyXLength(value + unit_name_ltx[unitNo]); igp.keepAspectRatio = dialog_->aspectratio->isChecked(); igp.noUnzip = dialog_->unzipCB->isChecked(); - igp.lyxscale = strToInt(string(dialog_->displayscale->text())); + igp.lyxscale = strToInt(dialog_->displayscale->text().latin1()); - igp.rotateAngle = strToDbl(string(dialog_->angle->text())); + igp.rotateAngle = strToDbl(dialog_->angle->text().latin1()); while (igp.rotateAngle < -360.0) igp.rotateAngle += 360.0; while (igp.rotateAngle > 360.0) @@ -384,13 +384,13 @@ void QGraphics::apply() QGraphics::origin_ltx[dialog_->origin->currentItem()]; // more latex options - igp.special = dialog_->latexoptions->text(); + igp.special = dialog_->latexoptions->text().latin1(); } void QGraphics::getBB() { - string const filename(dialog_->filename->text()); + string const filename(dialog_->filename->text().latin1()); if (!filename.empty()) { string const bb(controller().readBB(filename)); if (!bb.empty()) { @@ -412,7 +412,5 @@ void QGraphics::getBB() bool QGraphics::isValid() { - // FIXME: we need more here. - // why?? LaTeX needs a filename, the rest is user-specific (Herbert) return !string(dialog_->filename->text().latin1()).empty(); } diff --git a/src/frontends/qt2/QIndex.C b/src/frontends/qt2/QIndex.C index 17afb21597..1ea3871e8d 100644 --- a/src/frontends/qt2/QIndex.C +++ b/src/frontends/qt2/QIndex.C @@ -56,5 +56,5 @@ void QIndex::apply() bool QIndex::isValid() { - return !string(dialog_->keywordED->text()).empty(); + return !dialog_->keywordED->text().isEmpty(); } diff --git a/src/frontends/qt2/QParagraph.C b/src/frontends/qt2/QParagraph.C index bceb180cc3..b2450de392 100644 --- a/src/frontends/qt2/QParagraph.C +++ b/src/frontends/qt2/QParagraph.C @@ -141,8 +141,8 @@ void QParagraph::apply() VSpace const space_top = setVSpaceFromWidgets(dialog_->spacingAbove->currentItem(), - string(dialog_->valueAbove->text()), - string(dialog_->unitAbove->currentText()), + dialog_->valueAbove->text().latin1(), + dialog_->unitAbove->currentText().latin1(), dialog_->keepAbove->isChecked()); params.spaceTop(space_top); @@ -154,8 +154,8 @@ void QParagraph::apply() VSpace const space_bottom = setVSpaceFromWidgets(dialog_->spacingBelow->currentItem(), - string(dialog_->valueBelow->text()), - string(dialog_->unitBelow->currentText()), + dialog_->valueBelow->text().latin1(), + dialog_->unitBelow->currentText().latin1(), dialog_->keepBelow->isChecked()); params.spaceBottom(space_bottom); @@ -198,7 +198,7 @@ void QParagraph::apply() break; case 4: linespacing = Spacing::Other; - other = dialog_->linespacingValue->text(); + other = dialog_->linespacingValue->text().latin1(); break; } diff --git a/src/frontends/qt2/QPrefs.C b/src/frontends/qt2/QPrefs.C index 12eca43528..5287e5dfda 100644 --- a/src/frontends/qt2/QPrefs.C +++ b/src/frontends/qt2/QPrefs.C @@ -97,8 +97,6 @@ void QPrefs::apply() { LyXRC & rc(controller().rc()); - // do something ... - QPrefLanguageModule * langmod(dialog_->languageModule); // FIXME: remove rtl_support bool diff --git a/src/frontends/qt2/QRef.C b/src/frontends/qt2/QRef.C index 6870d6ffb5..f721851305 100644 --- a/src/frontends/qt2/QRef.C +++ b/src/frontends/qt2/QRef.C @@ -134,7 +134,7 @@ void QRef::setGotoRef() void QRef::gotoRef() { - string ref(dialog_->referenceED->text()); + string ref(dialog_->referenceED->text().latin1()); if (at_ref_) { // go back @@ -155,7 +155,7 @@ void QRef::redoRefs() // need this because Qt will send a highlight() here for // the first item inserted - string const tmp(dialog_->referenceED->text()); + string const tmp(dialog_->referenceED->text().latin1()); for (std::vector::const_iterator iter = refs_.begin(); iter != refs_.end(); ++iter) { diff --git a/src/frontends/qt2/QSendto.C b/src/frontends/qt2/QSendto.C index cc129cb0c5..9da6fc64f2 100644 --- a/src/frontends/qt2/QSendto.C +++ b/src/frontends/qt2/QSendto.C @@ -100,5 +100,5 @@ bool QSendto::isValid() return false; else return dialog_->formatLB->count() != 0 && - !string(dialog_->commandCO->currentText()).empty(); + !dialog_->commandCO->currentText().isEmpty(); }