Summary: | allow to load a data file directly from the command line | ||
---|---|---|---|
Product: | [Applications] kst | Reporter: | Nicolas Brisset <nicolas.brisset> |
Component: | general | Assignee: | kst |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | 1.x | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Solaris | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Nicolas Brisset
2005-07-22 12:33:53 UTC
There are problems with doing this, as if we suppress the error message if we don't have a valid kst file and also attempt to open the file in the data wizard then the user who actually does have an invalid kst file will be confused. The better option would probably be to add another command line setting that would take a datafile name to be loaded directly into the data wizard. Something like: kst -w mydata.cdf This is only slightly more to type with a much clearer intent. Something like that would be OK :-) Actually it's even worse than Andrew says, because Kst will think that all files passed to it and don't look like .kst files are ASCII files, basically. At best we could add a new command-line option. You are right, so let's go for a new command line switch (-w for wizard ?) :-) SVN commit 440041 by arwalker: BUG:109460 Allow user to specify data file to be loaded into data wizard on the command line. M +1 -0 datawizard.ui M +5 -0 datawizard.ui.h M +16 -0 kst.cpp M +1 -0 kst.h M +11 -1 main.cpp --- trunk/extragear/graphics/kst/kst/datawizard.ui #440040:440041 @@ -1397,6 +1397,7 @@ <variable access="private">QGuardedPtr<QWidget> _configWidget;</variable> </variables> <slots> + <slot access="public">setInput( const QString & input )</slot> <slot access="private">init()</slot> <slot access="private">xChanged()</slot> <slot access="private">sourceChanged( const QString & txt )</slot> --- trunk/extragear/graphics/kst/kst/datawizard.ui.h #440040:440041 @@ -56,6 +56,11 @@ } +void DataWizard::setInput(const QString &input) { + _url->setURL(input); +} + + void DataWizard::plotColsChanged() { _reGrid->setChecked(true); } --- trunk/extragear/graphics/kst/kst/kst.cpp #440040:440041 @@ -2000,6 +2000,22 @@ } } + +void KstApp::showDataWizardWithFile(const QString &input) { + DataWizard *dw = new DataWizard(this, "DataWizard"); + dw->setInput(input); + dw->exec(); + if (dw->result() == QDialog::Accepted) { + delete dw; // leave this here - releases references + forceUpdate(); + doc->setModified(); + updateDialogs(); + } else { + delete dw; + } +} + + void KstApp::registerDocChange() { kdDebug() << "register doc changed" << endl; forceUpdate(); --- trunk/extragear/graphics/kst/kst/kst.h #440040:440041 @@ -323,6 +323,7 @@ void showExtensionManager(); /** creates the data wizard */ + void showDataWizardWithFile(const QString &input); void showDataWizard(); //show the quickstart dialog, but only if specified so in the KstSettings --- trunk/extragear/graphics/kst/kst/main.cpp #440040:440041 @@ -69,6 +69,7 @@ { "m <NC>", I18N_NOOP("Separate plots arranged in <NC> columns"),0}, { "d", I18N_NOOP("Display as points rather than curves"),0}, { "g", I18N_NOOP("Provide a legend box"),0}, + { "w <file>", I18N_NOOP("Display the data wizard"),"<none>"}, { "print <file>", I18N_NOOP("Print to file and exit"),"<none>"}, { "png <file>", I18N_NOOP("Save as a png file and exit"),"<none>"}, { "nq", I18N_NOOP("Bypass the quickstart dialog"), 0}, @@ -373,12 +374,14 @@ QCStringList::Iterator hs_string; QCStringList::Iterator eq_i; bool showQuickStart = false; + bool showDataWizard = false; bool nOK; int n_y = 0; KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); CheckForCMDErrors(args); + QString wizardfile = args->getOption("w"); QString printfile = args->getOption("print"); QString pngfile = args->getOption("png"); bool print_and_exit = false; @@ -718,7 +721,11 @@ if (args->isSet("nq")) { showQuickStart = false; } - + if (args->isSet("w")) { + showDataWizard = true; + showQuickStart = false; + } + if (printfile != "<none>") { kst->forceUpdate(); kst->immediatePrintToFile(printfile); @@ -740,6 +747,9 @@ if (showQuickStart) { kst->showQuickStartDialog(); } + if (showDataWizard) { + kst->showDataWizardWithFile(wizardfile); + } for (size_t i=0; i<strErrors.size(); i++) { KstDebug::self()->log(strErrors[i], KstDebug::Warning); } |