~kst-plot/kst/debian-xenial

« back to all changes in this revision

Viewing changes to src/libkstapp/commandlineparser.cpp

  • Committer: Steven Benton
  • Date: 2012-11-04 22:45:35 UTC
  • mfrom: (1.2.10)
  • Revision ID: stevebenton@rogers.com-20121104224535-mnnvrp4mhvuz0h2p
* New upstream release.
* Non-maintainer upload.
* Remove patches that have been resolved upstream:
  - desktop-entry-contains-encoding-key.diff
  - desktop-entry-lacks-main-category.diff
    - upstream uses Education category rather than Graphics
  - fix-qreal-vs-double-for-arm.diff
* kst package Replaces and Conflicts with kst2 -- for old PPA users only

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
 *                                                                         *
11
11
 ***************************************************************************/
12
12
 
13
 
#include "config.h"
 
13
#include <config.h>
14
14
 
15
15
#include "commandlineparser.h"
16
16
#include "datasource.h"
134
134
 
135
135
static void printUsage(const QString &t)
136
136
{
137
 
  printText(QString(usageMessage), QString(usageDetailsMessage), "\n" + t);
 
137
  printText(QString(usageMessage), QString(usageDetailsMessage), '\n' + t);
138
138
}
139
139
 
140
140
 
199
199
 
200
200
bool CommandLineParser::_setStringArg(QString &arg, QString Message) {
201
201
  bool ok = true;
202
 
 
203
202
  if (_arguments.count()> 0) {
204
203
    arg = _arguments.takeFirst();
205
204
  } else {
268
267
    curve->setYVector(yv);
269
268
    curve->setXError(0);
270
269
    curve->setXMinusError(0);
271
 
    curve->setYMinusError(0);
272
270
    curve->setColor(ColorSequence::self().next());
273
271
    curve->setHasPoints(_usePoints);
274
272
    curve->setHasLines(_useLines);
275
273
    curve->setHasBars(_useBargraph);
276
 
    curve->setLineWidth(1); //FIXME: use defaults
 
274
    curve->setLineWidth(_dialogDefaults->value("curves/lineWidth",0).toInt());
277
275
    //curve->setPointType(ptype++ % KSTPOINT_MAXTYPE);
278
276
 
279
277
    if (ev) {
280
278
      curve->setYError(ev);
 
279
      curve->setYMinusError(ev);
281
280
    } else {
282
281
      curve->setYError(0);
 
282
      curve->setYMinusError(0);
283
283
    }
284
284
 
285
285
    curve->writeLock();
362
362
  bool new_fileList=true;
363
363
  bool dataPlotted = false;
364
364
 
 
365
#ifndef KST_NO_PRINTER
365
366
  // set paper settings to match defaults.
366
367
  _paperSize = QPrinter::PaperSize(_dialogDefaults->value("print/paperSize", QPrinter::Letter).toInt());
367
368
  if (_dialogDefaults->value("print/landscape",true).toBool()) {
369
370
  } else {
370
371
    _landscape = false;
371
372
  }
 
373
#endif
372
374
 
373
375
  while (*ok) {
374
376
    if (_arguments.count() < 1) {
380
382
      printUsage(QString());
381
383
      *ok = false;
382
384
    } else if (arg == "--version" || arg == "-version") {
383
 
      printText(QString("Kst ") + KSTVERSION + " Revision " + SVN_REVISION);
 
385
 
 
386
      printText(QString("Kst ") + KSTVERSION
 
387
#ifdef SVN_REVISION
 
388
+ " Revision " + SVN_REVISION
 
389
#endif
 
390
);
 
391
 
384
392
      *ok = false;
385
393
    } else if (arg == "-f") {
386
394
      *ok = _setIntArg(&_startFrame, i18n("Usage: -f <startframe>\n"), true);
447
455
 
448
456
        DataVectorPtr ev;
449
457
        if (!_errorField.isEmpty()) {
450
 
          DataVectorPtr ev = createOrFindDataVector(_errorField, ds);
 
458
          ev = createOrFindDataVector(_errorField, ds);
451
459
          if (!_overrideStyle) {
452
460
            _useBargraph=false;
453
461
            _useLines = false;
515
523
      QString field;
516
524
      *ok = _setStringArg(field,i18n("Usage: -h <fieldname>\n"));
517
525
 
518
 
      if (!*ok) {
 
526
      if (*ok) {
519
527
        for ( int i_file=0; i_file<_fileNames.size(); i_file++ ) {
520
528
          QString file = _fileNames.at ( i_file );
521
529
          QFileInfo info ( file );
584
592
      *ok = _setStringArg(_document->objectStore()->override.fileName, i18n("Usage: -F <datafile>\n"));
585
593
    } else if (arg == "--png") {
586
594
      *ok = _setStringArg(_pngFile, i18n("Usage: --png <filename>\n"));
 
595
#ifndef KST_NO_PRINTER
587
596
    } else if (arg == "--print") {
588
597
      *ok = _setStringArg(_printFile, i18n("Usage: --print <filename>\n"));
589
598
    } else if (arg == "--landscape") {
594
603
      _paperSize = QPrinter::A4;
595
604
    } else if (arg == "--letter") {
596
605
      _paperSize = QPrinter::Letter;
 
606
#endif
597
607
    } else { // arg is not an option... must be a file
598
608
      if (new_fileList) { // if the file list has been used, clear it.
 
609
        if (dataPlotted) {
 
610
          _document->updateRecentDataFiles(_fileNames);
 
611
        }
599
612
        _fileNames.clear();
600
613
        new_fileList = false;
601
614
      }
642
655
      }
643
656
    }
644
657
  }
 
658
  if (dataPlotted) {
 
659
    _document->updateRecentDataFiles(_fileNames);
 
660
  }
645
661
 
 
662
#ifndef KST_NO_PRINTER
646
663
  // set defaults to match what has been set.
647
664
  _dialogDefaults->setValue("print/landscape", _landscape);
648
665
  _dialogDefaults->setValue("print/paperSize", int(_paperSize));
 
666
#endif
649
667
 
650
668
  if (_plotItem) {
651
669
    _plotItem->view()->resetPlotFontSizes();