[Kst] branches/work/kst/portto4/kst/src/libkstapp

Adam Treat treat at kde.org
Wed Mar 7 19:25:35 CET 2007


SVN commit 640351 by treat:

* More porting


 M  +1 -1      kstviewvectorsdialog.cpp  
 M  +1 -1      kstviewvectorsdialog.h  
 M  +6 -6      pluginmanager.cpp  
 M  +1 -1      vectorsavedialog.cpp  
 M  +51 -53    view2dplotwidget.cpp  
 M  +3 -3      viewlabelwidget.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/kstviewvectorsdialog.cpp #640350:640351
@@ -25,7 +25,7 @@
 #include "vectorselector.h"
 
 KstViewVectorsDialogI::KstViewVectorsDialogI(QWidget* parent, Qt::WindowFlags fl)
-: KstViewVectorsDialog(parent, fl) {
+: QDialog(parent, fl) {
   tableVectors = new KstVectorTable(this, "tableVectors");
   tableVectors->setNumRows(0);
   tableVectors->setNumCols(1);
--- branches/work/kst/portto4/kst/src/libkstapp/kstviewvectorsdialog.h #640350:640351
@@ -24,7 +24,7 @@
 
 #include "kstvectortable.h"
 
-class KstViewVectorsDialogI : public Ui::KstViewVectorsDialog {
+class KstViewVectorsDialogI : public QDialog, public Ui::KstViewVectorsDialog {
   Q_OBJECT
   public:
     KstViewVectorsDialogI(QWidget* parent = 0, Qt::WindowFlags fl = 0 );
--- branches/work/kst/portto4/kst/src/libkstapp/pluginmanager.cpp #640350:640351
@@ -167,16 +167,16 @@
   QMap<QString,Plugin::Data>::ConstIterator it;
 
   for (it = pluginList.begin(); it != pluginList.end(); ++it) {
-    QString path = pc->pluginNameList()[it.data()._name];
+    QString path = pc->pluginNameList()[it.value()._name];
     Q3ListViewItem *i = new Q3ListViewItem(_pluginList,
-                                         it.data()._readableName,
+                                         it.value()._readableName,
                                          QString::null,
-                                         it.data()._description,
+                                         it.value()._description,
                                          it.data()._version,
-                                         it.data()._author,
-                                         it.data()._name,
+                                         it.value()._author,
+                                         it.value()._name,
                                          path);
-    if (loadedPluginList.contains(it.data()._name)) {
+    if (loadedPluginList.contains(it.value()._name)) {
       i->setPixmap(COLUMN_LOADED, locate("data", "kst/pics/yes.png"));
       // Don't use no.png - it looks bad
     }
--- branches/work/kst/portto4/kst/src/libkstapp/vectorsavedialog.cpp #640350:640351
@@ -63,7 +63,7 @@
   KUrl url = KFileDialog::getSaveUrl(QString::null, QString::null, this, i18n("Save Vector As"));
   if (!url.isEmpty()) {
     bool interpolate = true;
-    switch (_multiOptions->currentItem()) {
+    switch (_multiOptions->currentIndex()) {
     case 0:
       interpolate = false;
     case 1: {
--- branches/work/kst/portto4/kst/src/libkstapp/view2dplotwidget.cpp #640350:640351
@@ -173,17 +173,17 @@
   FontComboBox->setFonts(qfd.families());
 
   for (unsigned i = 0; i < numMajorTickSpacings; i++) {
-    _xMajorTickSpacing->insertItem(i18n(MajorTickSpacings[i].label));
-    _yMajorTickSpacing->insertItem(i18n(MajorTickSpacings[i].label));
+    _xMajorTickSpacing->addItem(i18n(MajorTickSpacings[i].label));
+    _yMajorTickSpacing->addItem(i18n(MajorTickSpacings[i].label));
   }
 
   for (unsigned i = 0; i < numAxisInterpretations; i++) {
-    _comboBoxXInterpret->insertItem(i18n(AxisInterpretations[i].label));
-    _comboBoxYInterpret->insertItem(i18n(AxisInterpretations[i].label));
+    _comboBoxXInterpret->addItem(i18n(AxisInterpretations[i].label));
+    _comboBoxYInterpret->addItem(i18n(AxisInterpretations[i].label));
   }
   for (unsigned i = 0; i < numAxisDisplays; i++) {
-    _comboBoxXDisplay->insertItem(i18n(AxisDisplays[i].label));
-    _comboBoxYDisplay->insertItem(i18n(AxisDisplays[i].label));
+    _comboBoxXDisplay->addItem(i18n(AxisDisplays[i].label));
+    _comboBoxYDisplay->addItem(i18n(AxisDisplays[i].label));
   }
 
   _comboBoxXInterpret->setEnabled(false);
@@ -246,18 +246,17 @@
   _minorGridColor->setColor(defaultColor);
 
   /* set defaults */
-  plotColors->setBackground(KstSettings::globalSettings()->backgroundColor);
-  plotColors->setForeground(KstSettings::globalSettings()->foregroundColor);
+  plotColors->setColor(KstSettings::globalSettings()->backgroundColor);
 
-  _xMajorTickSpacing->setCurrentItem(1);
-  _yMajorTickSpacing->setCurrentItem(1);
+  _xMajorTickSpacing->setCurrentIndex(1);
+  _yMajorTickSpacing->setCurrentIndex(1);
 
   _yMarksInsidePlot->setChecked(true);
   _xMarksInsidePlot->setChecked(true);
 
-  _comboBoxTopLabelJustify->insertItem(i18n("Left"));
-  _comboBoxTopLabelJustify->insertItem(i18n("Right"));
-  _comboBoxTopLabelJustify->insertItem(i18n("Center"));
+  _comboBoxTopLabelJustify->addItem(i18n("Left"));
+  _comboBoxTopLabelJustify->addItem(i18n("Right"));
+  _comboBoxTopLabelJustify->addItem(i18n("Center"));
 
   // FIXME: should use kstsettings
   _axisPenWidth->setValue(0);
@@ -403,7 +402,7 @@
   QPainter pp(&ppix);
   QPen pen(QColor("black"), 0);
 
-  int currentItem = _comboMarkerLineStyle->currentItem();
+  int currentIndex = _comboMarkerLineStyle->currentIndex();
   _comboMarkerLineStyle->clear();
 
   for (int style = 0; style < (int)KSTLINESTYLE_MAXTYPE; style++) {
@@ -411,10 +410,10 @@
     pp.setPen(pen);
     pp.fillRect( pp.window(), QColor("white"));
     pp.drawLine(1,ppix.height()/2,ppix.width()-1, ppix.height()/2);
-    _comboMarkerLineStyle->insertItem(ppix);
+    _comboMarkerLineStyle->addItem(ppix);
   }
 
-  _comboMarkerLineStyle->setCurrentItem(currentItem);
+  _comboMarkerLineStyle->setCurrentIndex(currentIndex);
 }
 
 
@@ -449,11 +448,11 @@
     (*i)->readLock();
     QString n = (*i)->tagLabel();
     (*i)->unlock();
-    ScalarList->insertItem(n);
-    scalarSelectorX1->insertItem(n);
-    scalarSelectorX2->insertItem(n);
-    scalarSelectorY1->insertItem(n);
-    scalarSelectorY2->insertItem(n);
+    ScalarList->addItem(n);
+    scalarSelectorX1->addItem(n);
+    scalarSelectorX2->addItem(n);
+    scalarSelectorY1->addItem(n);
+    scalarSelectorY2->addItem(n);
   }
 }
 
@@ -476,7 +475,7 @@
   CurveCombo->clear();
   for (KstBaseCurveList::ConstIterator curves_iter = curves.begin(); curves_iter != curves.end(); ++curves_iter) {
     (*curves_iter)->readLock();
-    CurveCombo->insertItem((*curves_iter)->tagName());
+    CurveCombo->addItem((*curves_iter)->tagName());
     (*curves_iter)->unlock();
   }
 
@@ -496,7 +495,7 @@
     }
     for (int curveComboIndex = 0; curveComboIndex < CurveCombo->count(); curveComboIndex++) {
       if (CurveCombo->text(curveComboIndex) == plot->curveToMarkers()->tagName()) {
-        CurveCombo->setCurrentItem(curveComboIndex);
+        CurveCombo->setCurrentIndex(curveComboIndex);
         break;
       }
     }
@@ -648,10 +647,10 @@
 
   for (int i = 0; i < (int)numMajorTickSpacings; i++) {
     if (MajorTickSpacings[i].majorTickDensity <= plot->xMajorTicks()) {
-      _xMajorTickSpacing->setCurrentItem(i);
+      _xMajorTickSpacing->setCurrentIndex(i);
     }
     if (MajorTickSpacings[i].majorTickDensity <= plot->yMajorTicks()) {
-      _yMajorTickSpacing->setCurrentItem(i);
+      _yMajorTickSpacing->setCurrentIndex(i);
     }
 
   }
@@ -671,16 +670,16 @@
   FontComboBox->setCurrentFont(plot->topLabel()->fontName());
   switch (plot->topLabel()->justification()) {
   case KST_JUSTIFY_H_LEFT:
-    _comboBoxTopLabelJustify->setCurrentItem(0);
+    _comboBoxTopLabelJustify->setCurrentIndex(0);
     break;
   case KST_JUSTIFY_H_RIGHT:
-    _comboBoxTopLabelJustify->setCurrentItem(1);
+    _comboBoxTopLabelJustify->setCurrentIndex(1);
     break;
   case KST_JUSTIFY_H_CENTER:
-    _comboBoxTopLabelJustify->setCurrentItem(2);
+    _comboBoxTopLabelJustify->setCurrentIndex(2);
     break;
   default:
-    _comboBoxTopLabelJustify->setCurrentItem(0);
+    _comboBoxTopLabelJustify->setCurrentIndex(0);
     break;
   }
 
@@ -701,19 +700,19 @@
   if (xAxisInterpret) {
     for (unsigned i = 0; i < numAxisInterpretations; i++) {
       if (AxisInterpretations[i].type == xAxisInterpretation) {
-        _comboBoxXInterpret->setCurrentItem(i);
+        _comboBoxXInterpret->setCurrentIndex(i);
         break;
       }
     }
     for (unsigned i = 0; i < numAxisDisplays; i++) {
       if (AxisDisplays[i].type == xAxisDisplay) {
-        _comboBoxXDisplay->setCurrentItem(i);
+        _comboBoxXDisplay->setCurrentIndex(i);
         break;
       }
     }
   } else {
-    _comboBoxXInterpret->setCurrentItem(KstSettings::globalSettings()->xAxisInterpretation);
-    _comboBoxXDisplay->setCurrentItem(KstSettings::globalSettings()->xAxisDisplay);
+    _comboBoxXInterpret->setCurrentIndex(KstSettings::globalSettings()->xAxisInterpretation);
+    _comboBoxXDisplay->setCurrentIndex(KstSettings::globalSettings()->xAxisDisplay);
   }
 
   plot->getYAxisInterpretation(yAxisInterpret, yAxisInterpretation, yAxisDisplay);
@@ -725,20 +724,20 @@
   if (yAxisInterpret) {
     for (unsigned i = 0; i < numAxisInterpretations; i++) {
       if (AxisInterpretations[i].type == yAxisInterpretation) {
-        _comboBoxYInterpret->setCurrentItem(i);
+        _comboBoxYInterpret->setCurrentIndex(i);
         break;
       }
     }
     for (unsigned i = 0; i < numAxisDisplays; i++) {
       if (AxisDisplays[i].type == yAxisDisplay) {
-        _comboBoxYDisplay->setCurrentItem(i);
+        _comboBoxYDisplay->setCurrentIndex(i);
         break;
       }
     }
   } else {
     // FIXME: these should use kstsettings defaults
-    _comboBoxYInterpret->setCurrentItem(KstSettings::globalSettings()->xAxisInterpretation);
-    _comboBoxYDisplay->setCurrentItem(KstSettings::globalSettings()->xAxisDisplay);
+    _comboBoxYInterpret->setCurrentIndex(KstSettings::globalSettings()->xAxisInterpretation);
+    _comboBoxYDisplay->setCurrentIndex(KstSettings::globalSettings()->xAxisDisplay);
   }
 
   // initialize the legend settings for the current plot
@@ -750,8 +749,7 @@
     ShowLegend->setChecked(false);
   }
   // initialize the plot color widget
-  plotColors->setForeground(plot->foregroundColor());
-  plotColors->setBackground(plot->backgroundColor());
+  plotColors->setColor(plot->backgroundColor());
 
   _axisPenWidth->setValue(plot->axisPenWidth());
 
@@ -780,7 +778,7 @@
   _yReversed->setChecked(plot->yReversed());
 
   // update marker attributes
-  _comboMarkerLineStyle->setCurrentItem(plot->lineStyleMarkers());
+  _comboMarkerLineStyle->setCurrentIndex(plot->lineStyleMarkers());
   _spinBoxMarkerLineWidth->setValue(plot->lineWidthMarkers());
   _checkBoxDefaultMarkerColor->setChecked(plot->defaultColorMarker());
   _colorMarker->setColor(plot->colorMarkers());
@@ -801,7 +799,7 @@
   plot->xLabel()->setText(XAxisText->text());
   plot->yLabel()->setText(YAxisText->text());
   plot->topLabel()->setText(TopLabelText->text());
-  switch (_comboBoxTopLabelJustify->currentItem()) {
+  switch (_comboBoxTopLabelJustify->currentIndex()) {
   case 0:
     plot->topLabel()->setJustification(SET_KST_JUSTIFY(KST_JUSTIFY_H_LEFT, KST_JUSTIFY_V_NONE));
     break;
@@ -824,8 +822,8 @@
   for (uint i = 0; i < plots.size(); i++) {
     plotExtra = plots[i];
 
-    plotExtra->setForegroundColor(plotColors->foreground());
-    plotExtra->setBackgroundColor(plotColors->background());
+    plotExtra->setForegroundColor(plotColors->color());
+    plotExtra->setBackgroundColor(plotColors->color());
 
     // gridlines colors
     plotExtra->setGridLinesColor(_majorGridColor->color(),
@@ -845,7 +843,7 @@
 
     plotExtra->topLabel()->setFontName(FontComboBox->currentText());
     plotExtra->topLabel()->setFontSize(TopLabelFontSize->value());
-    switch (_comboBoxTopLabelJustify->currentItem()) {
+    switch (_comboBoxTopLabelJustify->currentIndex()) {
     case 0:
       plotExtra->topLabel()->setJustification(SET_KST_JUSTIFY(KST_JUSTIFY_H_LEFT, KST_JUSTIFY_V_NONE));
       break;
@@ -902,8 +900,8 @@
 
     if (_checkBoxXInterpret->isChecked()) {
       plotExtra->setXAxisInterpretation(true,
-                                        AxisInterpretations[_comboBoxXInterpret->currentItem()].type,
-                                        AxisDisplays[_comboBoxXDisplay->currentItem()].type);
+                                        AxisInterpretations[_comboBoxXInterpret->currentIndex()].type,
+                                        AxisDisplays[_comboBoxXDisplay->currentIndex()].type);
     } else {
       plotExtra->setXAxisInterpretation(false,
                                         AXIS_INTERP_CTIME,
@@ -918,7 +916,7 @@
 
     // major tick settings.
     plotExtra->setXMajorTicks(
-      MajorTickSpacings[_xMajorTickSpacing->currentItem()].majorTickDensity);
+      MajorTickSpacings[_xMajorTickSpacing->currentIndex()].majorTickDensity);
 
     // tick display
     plotExtra->setXTicksInPlot(_xMarksInsidePlot->isChecked() || _xMarksInsideAndOutsidePlot->isChecked());
@@ -964,8 +962,8 @@
 
     if (_checkBoxYInterpret->isChecked()) {
       plotExtra->setYAxisInterpretation(true,
-                                        AxisInterpretations[_comboBoxYInterpret->currentItem()].type,
-                                        AxisDisplays[_comboBoxYDisplay->currentItem()].type);
+                                        AxisInterpretations[_comboBoxYInterpret->currentIndex()].type,
+                                        AxisDisplays[_comboBoxYDisplay->currentIndex()].type);
     } else {
       plotExtra->setYAxisInterpretation(false,
                                         AXIS_INTERP_CTIME,
@@ -979,7 +977,7 @@
     }
     // major ticks
     plotExtra->setYMajorTicks(
-      MajorTickSpacings[_yMajorTickSpacing->currentItem()].majorTickDensity);
+      MajorTickSpacings[_yMajorTickSpacing->currentIndex()].majorTickDensity);
 
     // tick display
     plotExtra->setYTicksInPlot(_yMarksInsidePlot->isChecked() || _yMarksInsideAndOutsidePlot->isChecked());
@@ -1188,7 +1186,7 @@
       plotExtra->removeVectorToMarkers();
     }
 
-    plotExtra->setLineStyleMarkers(_comboMarkerLineStyle->currentItem());
+    plotExtra->setLineStyleMarkers(_comboMarkerLineStyle->currentIndex());
     plotExtra->setLineWidthMarkers(_spinBoxMarkerLineWidth->value());
     plotExtra->setColorMarkers(_colorMarker->color());
     plotExtra->setDefaultColorMarker(_checkBoxDefaultMarkerColor->isChecked());
@@ -1219,7 +1217,7 @@
   applyPlotMarkers(plot);
 
   //_title->setText(plot->tagName());
-  QString tag = _title->text().stripWhiteSpace();
+  QString tag = _title->text().simplified();
   if (tag.isEmpty()) {
     plot->setTagName(KstObjectTag(KST::suggestPlotName(), KstObjectTag::globalTagContext)); // FIXME: always global tag context?
   } else {
@@ -1256,7 +1254,7 @@
     static_cast<KstViewWindow*>(c)->view()->paint(KstPainter::P_PLOT);
   }
 
-  _plotName = _title->text().stripWhiteSpace();
+  _plotName = _title->text().simplified();
   update();
   emit docChanged();
   */
--- branches/work/kst/portto4/kst/src/libkstapp/viewlabelwidget.cpp #640350:640351
@@ -31,9 +31,9 @@
 void ViewLabelWidget::init() {
   connect(_scalars, SIGNAL(selectionChanged(const QString &)),
           this, SLOT(insertScalarInText(const QString &)));
-  _horizontal->insertItem(i18n("Left"));
-  _horizontal->insertItem(i18n("Right"));
-  _horizontal->insertItem(i18n("Center"));
+  _horizontal->addItem(i18n("Left"));
+  _horizontal->addItem(i18n("Right"));
+  _horizontal->addItem(i18n("Center"));
 
   connect(_strings, SIGNAL(selectionChanged(const QString &)),
           this, SLOT(insertStringInText(const QString &)));


More information about the Kst mailing list