From d5a2e449830e37046aa367808a06c08d03d42d8a Mon Sep 17 00:00:00 2001 From: Xavier TOLZA Date: Fri, 28 Jun 2019 17:26:25 +0200 Subject: [PATCH 1/4] Added command line arguments to plots files --- FTSPlotMain.cpp | 40 ++++++++++++++++++++++++++++++++++++---- FTSPrep.h | 4 ++-- mainwindow.h | 2 +- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/FTSPlotMain.cpp b/FTSPlotMain.cpp index cb9bf5e..90c9088 100644 --- a/FTSPlotMain.cpp +++ b/FTSPlotMain.cpp @@ -19,26 +19,58 @@ #include #include #include "mainwindow.h" +#include "FTSPrep.h" #include #include #ifdef Q_WS_X11 + #include + #endif using namespace std; -int main ( int argc, char *argv[] ) -{ +bool isnt_config_file(char *filename) { + unsigned length = strlen(filename); + return strcmp(filename + (length - 4), ".cfg"); +} + +void preprocess(int argc, char *argv[]) { + FTSPrep ftsPrep; + + for (unsigned i = 1; i < argc; i++) { + if (isnt_config_file(argv[i])) { + QString str(argv[i]); + ftsPrep.setNewFile(str); + } + } + ftsPrep.run(); + +} + +int main(int argc, char *argv[]) { #ifdef Q_WS_X11 XInitThreads(); #endif - QApplication app ( argc, argv ); + QApplication app(argc, argv); + + MainWindow *mainwidget = new MainWindow(); - MainWindow* mainwidget = new MainWindow(); + if (argc) { + preprocess(argc, argv); + unsigned i; + for (i = 0; i < argc; i++) { + QString str(argv[i]); + if (isnt_config_file(argv[i])) { + str.append(".cfg"); + } + mainwidget->MySimpleViewWidget->addTimeSeries(str); + } + } mainwidget->show(); return app.exec(); diff --git a/FTSPrep.h b/FTSPrep.h index 9da70bf..8e87ead 100644 --- a/FTSPrep.h +++ b/FTSPrep.h @@ -49,6 +49,8 @@ class FTSPrep : public QThread void setProgressGranularity( quint64 gran = 2048 ); ResumeData getResumeData(); + void run(); + public slots: void stopforResume(); @@ -56,8 +58,6 @@ public slots: void QDTexception( QString msg ); void progressUpdate( int totalProgress, int level, int levelProgress ); -protected: - void run(); private: enum workstate {ready, busy}; diff --git a/mainwindow.h b/mainwindow.h index 6d3c40c..89b5e21 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -26,7 +26,7 @@ using namespace FTSPlot; -class MainWindow : public QMainWindow, private Ui::MainWindow +class MainWindow : public QMainWindow, public Ui::MainWindow { Q_OBJECT public: From c9a53fe3ff2a7050dc6b104d66ba1681a50bc8c3 Mon Sep 17 00:00:00 2001 From: Xavier TOLZA Date: Fri, 28 Jun 2019 17:27:48 +0200 Subject: [PATCH 2/4] added gitignore with some config for clion --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8b1aab2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea +cmake-build-debug \ No newline at end of file From 3ae2c6cc61403c6591e93a64a26716271fc6bb29 Mon Sep 17 00:00:00 2001 From: Xavier TOLZA Date: Fri, 28 Jun 2019 17:29:57 +0200 Subject: [PATCH 3/4] bugfix --- FTSPlotMain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FTSPlotMain.cpp b/FTSPlotMain.cpp index 90c9088..8158628 100644 --- a/FTSPlotMain.cpp +++ b/FTSPlotMain.cpp @@ -60,10 +60,10 @@ int main(int argc, char *argv[]) { MainWindow *mainwidget = new MainWindow(); - if (argc) { + if (argc > 1) { preprocess(argc, argv); unsigned i; - for (i = 0; i < argc; i++) { + for (i = 1; i < argc; i++) { QString str(argv[i]); if (isnt_config_file(argv[i])) { str.append(".cfg"); From aa24425d1f5daedb02f7d12831553617d78b88bb Mon Sep 17 00:00:00 2001 From: Xavier TOLZA Date: Fri, 28 Jun 2019 18:02:00 +0200 Subject: [PATCH 4/4] bugfixes --- .gitignore | 3 ++- FTSPlotMain.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 8b1aab2..5b2da3c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea -cmake-build-debug \ No newline at end of file +cmake-build-debug +build \ No newline at end of file diff --git a/FTSPlotMain.cpp b/FTSPlotMain.cpp index 8158628..c2ae22a 100644 --- a/FTSPlotMain.cpp +++ b/FTSPlotMain.cpp @@ -44,9 +44,9 @@ void preprocess(int argc, char *argv[]) { if (isnt_config_file(argv[i])) { QString str(argv[i]); ftsPrep.setNewFile(str); + ftsPrep.run(); } } - ftsPrep.run(); }