]> git.lyx.org Git - features.git/commitdiff
Some string(widget->text()) fixes. Weirdness
authorJohn Levon <levon@movementarian.org>
Sat, 30 Nov 2002 02:09:16 +0000 (02:09 +0000)
committerJohn Levon <levon@movementarian.org>
Sat, 30 Nov 2002 02:09:16 +0000 (02:09 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5752 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/ChangeLog
src/frontends/qt2/QGraphics.C
src/frontends/qt2/QIndex.C
src/frontends/qt2/QParagraph.C
src/frontends/qt2/QPrefs.C
src/frontends/qt2/QRef.C
src/frontends/qt2/QSendto.C

index d7e50622271c7aa5b5a991c8bf347d72c2641fb7..2aa4689393d7758f2d5c516989f1f63f4777e527 100644 (file)
@@ -1,3 +1,7 @@
+2002-11-30  John Levon  <levon@movementarian.org>
+
+       * various: string(widget->text()) is not good.
 2002-11-28  John Levon  <levon@movementarian.org>
 
        * qt_helpers.C: fix build
index 401d2daf25b244bc6c4ae436f9679c13634443a9..ffd1b1035d9907234a8cdd64336c6f535b43125d 100644 (file)
@@ -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();
 }
index 17afb215973e1ee9c7346a9174ce67d16fe114c3..1ea3871e8dda7439b995e76426bbfa18eaf5dcc2 100644 (file)
@@ -56,5 +56,5 @@ void QIndex::apply()
 
 bool QIndex::isValid()
 {
-       return !string(dialog_->keywordED->text()).empty();
+       return !dialog_->keywordED->text().isEmpty();
 }
index bceb180cc3721e93f07f29b55651b10b1db9be4f..b2450de39262639fd58a058d345dc516aa8104b1 100644 (file)
@@ -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;
        }
 
index 12eca4352886535a89a66c9a979b37071c01b421..5287e5dfda4ee3e2ae95f2944214d9f05e1b103b 100644 (file)
@@ -97,8 +97,6 @@ void QPrefs::apply()
 {
        LyXRC & rc(controller().rc());
 
-       // do something ...
-
        QPrefLanguageModule * langmod(dialog_->languageModule);
 
        // FIXME: remove rtl_support bool
index 6870d6ffb5eb6492bcca686c28d4bf77afc946f2..f7218513054e72bf9ce505036c626c51c7d7bea7 100644 (file)
@@ -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<string>::const_iterator iter = refs_.begin();
                iter != refs_.end(); ++iter) {
index cc129cb0c5cec821318cbf84048f1b681b80ea02..9da6fc64f2827a5c261db38b3341312fe8398144 100644 (file)
@@ -100,5 +100,5 @@ bool QSendto::isValid()
                return false;
 
        else return dialog_->formatLB->count() != 0 &&
-               !string(dialog_->commandCO->currentText()).empty();
+               !dialog_->commandCO->currentText().isEmpty();
 }