fix names v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sat, 01 Dec 2018 23:22:41 +0100
branchv_0
changeset 30 23354fc917f4
parent 29 0f9f7d6564cd
child 31 47fb4bb3db45
fix names
nbproject/configurations.xml
nbproject/project.xml
src/CMakeLists.txt
src/relpipe-out-chart.cpp
src/relpipe-out-gui.cpp
--- a/nbproject/configurations.xml	Thu Nov 29 22:30:12 2018 +0100
+++ b/nbproject/configurations.xml	Sat Dec 01 23:22:41 2018 +0100
@@ -47,40 +47,31 @@
       <itemPath>/usr/share/cmake-3.10/Modules/CMakeCXXCompilerABI.cpp</itemPath>
       <itemPath>/usr/share/cmake-3.10/Modules/CMakeCompilerABI.h</itemPath>
     </logicalFolder>
-    <logicalFolder name="relpipe-out-chart_autogen"
-                   displayName="relpipe-out-chart_autogen"
-                   projectFiles="true"
-                   root="build/Debug/src/relpipe-out-chart_autogen">
-      <logicalFolder name="EWIEGA46WW" displayName="EWIEGA46WW" projectFiles="true">
-        <itemPath>build/Debug/src/relpipe-out-chart_autogen/EWIEGA46WW/moc_QtRelationalReaderStringHadler.cpp</itemPath>
-        <itemPath>build/Debug/src/relpipe-out-chart_autogen/EWIEGA46WW/moc_RelpipeChartMainWindow.cpp</itemPath>
-        <itemPath>build/Debug/src/relpipe-out-chart_autogen/EWIEGA46WW/moc_RelpipeChartWidget.cpp</itemPath>
-        <itemPath>build/Debug/src/relpipe-out-chart_autogen/EWIEGA46WW/moc_RelpipeTableModel.cpp</itemPath>
-      </logicalFolder>
-      <logicalFolder name="include" displayName="include" projectFiles="true">
-        <itemPath>build/Debug/src/relpipe-out-chart_autogen/include/ui_RelpipeChartMainWindow.h</itemPath>
-      </logicalFolder>
-      <itemPath>build/Debug/src/relpipe-out-chart_autogen/mocs_compilation.cpp</itemPath>
-    </logicalFolder>
     <df root="." name="0">
-      <df name="build">
-        <df name="Debug">
-          <df name="src">
-            <df name="relpipe-out-gui_autogen">
-              <in>mocs_compilation.cpp</in>
-            </df>
-          </df>
-        </df>
-      </df>
       <df name="src">
         <in>RelpipeChartMainWindow.cpp</in>
         <in>RelpipeChartMainWindow.h</in>
         <in>RelpipeChartMainWindow.ui</in>
         <in>RelpipeChartWidget.h</in>
         <in>RelpipeTableModel.h</in>
-        <in>relpipe-out-chart.cpp</in>
+        <in>relpipe-out-gui.cpp</in>
       </df>
     </df>
+    <logicalFolder name="relpipe-out-gui_autogen"
+                   displayName="relpipe-out-gui_autogen"
+                   projectFiles="true"
+                   root="build/Debug/src/relpipe-out-gui_autogen">
+      <logicalFolder name="EWIEGA46WW" displayName="EWIEGA46WW" projectFiles="true">
+        <itemPath>build/Debug/src/relpipe-out-gui_autogen/EWIEGA46WW/moc_QtRelationalReaderStringHadler.cpp</itemPath>
+        <itemPath>build/Debug/src/relpipe-out-gui_autogen/EWIEGA46WW/moc_RelpipeChartMainWindow.cpp</itemPath>
+        <itemPath>build/Debug/src/relpipe-out-gui_autogen/EWIEGA46WW/moc_RelpipeChartWidget.cpp</itemPath>
+        <itemPath>build/Debug/src/relpipe-out-gui_autogen/EWIEGA46WW/moc_RelpipeTableModel.cpp</itemPath>
+      </logicalFolder>
+      <logicalFolder name="include" displayName="include" projectFiles="true">
+        <itemPath>build/Debug/src/relpipe-out-gui_autogen/include/ui_RelpipeChartMainWindow.h</itemPath>
+      </logicalFolder>
+      <itemPath>build/Debug/src/relpipe-out-gui_autogen/mocs_compilation.cpp</itemPath>
+    </logicalFolder>
     <logicalFolder name="ExternalFiles"
                    displayName="Important Files"
                    projectFiles="false"
@@ -104,8 +95,6 @@
       </toolsSet>
       <flagsDictionary>
         <element flagsID="0" commonFlags="-fsanitize=address -fPIC -std=gnu++11"/>
-        <element flagsID="1"
-                 commonFlags="-mtune=generic -march=x86-64 -std=gnu++11 -fsanitize=address -fPIC -fstack-protector-strong"/>
       </flagsDictionary>
       <codeAssistance>
       </codeAssistance>
@@ -115,6 +104,27 @@
           <buildCommand>${MAKE} -f Makefile</buildCommand>
           <cleanCommand>${MAKE} -f Makefile clean</cleanCommand>
           <executablePath>build/Debug/src/relpipe-out-gui</executablePath>
+          <ccTool>
+            <incDir>
+              <pElem>build/Debug/src</pElem>
+              <pElem>src</pElem>
+              <pElem>build/Debug/src/relpipe-out-gui_autogen/include</pElem>
+              <pElem>../relpipe-lib-reader.cpp/include</pElem>
+              <pElem>../relpipe-lib-cli.cpp/include</pElem>
+              <pElem>/usr/include/x86_64-linux-gnu/qt5</pElem>
+              <pElem>/usr/include/x86_64-linux-gnu/qt5/QtWidgets</pElem>
+              <pElem>/usr/include/x86_64-linux-gnu/qt5/QtGui</pElem>
+              <pElem>/usr/include/x86_64-linux-gnu/qt5/QtCore</pElem>
+              <pElem>/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++</pElem>
+              <pElem>/usr/include/x86_64-linux-gnu/qt5/QtCharts</pElem>
+            </incDir>
+            <preprocessorList>
+              <Elem>QT_CHARTS_LIB</Elem>
+              <Elem>QT_CORE_LIB</Elem>
+              <Elem>QT_GUI_LIB</Elem>
+              <Elem>QT_WIDGETS_LIB</Elem>
+            </preprocessorList>
+          </ccTool>
         </makeTool>
         <preBuild>
           <preBuildCommandWorkingDir>build/Debug</preBuildCommandWorkingDir>
@@ -127,33 +137,26 @@
             tool="1"
             flavor2="11">
       </item>
-      <item path="build/Debug/src/relpipe-out-chart_autogen/EWIEGA46WW/moc_QtRelationalReaderStringHadler.cpp"
+      <item path="build/Debug/src/relpipe-out-gui_autogen/EWIEGA46WW/moc_QtRelationalReaderStringHadler.cpp"
             ex="true"
             tool="3"
             flavor2="0">
       </item>
-      <item path="build/Debug/src/relpipe-out-chart_autogen/EWIEGA46WW/moc_RelpipeChartMainWindow.cpp"
+      <item path="build/Debug/src/relpipe-out-gui_autogen/EWIEGA46WW/moc_RelpipeChartMainWindow.cpp"
             ex="true"
             tool="3"
             flavor2="0">
       </item>
-      <item path="build/Debug/src/relpipe-out-chart_autogen/EWIEGA46WW/moc_RelpipeChartWidget.cpp"
+      <item path="build/Debug/src/relpipe-out-gui_autogen/EWIEGA46WW/moc_RelpipeChartWidget.cpp"
             ex="true"
             tool="3"
             flavor2="0">
       </item>
-      <item path="build/Debug/src/relpipe-out-chart_autogen/EWIEGA46WW/moc_RelpipeTableModel.cpp"
+      <item path="build/Debug/src/relpipe-out-gui_autogen/EWIEGA46WW/moc_RelpipeTableModel.cpp"
             ex="true"
             tool="3"
             flavor2="0">
       </item>
-      <item path="build/Debug/src/relpipe-out-chart_autogen/mocs_compilation.cpp"
-            ex="false"
-            tool="1"
-            flavor2="8">
-        <ccTool flags="1">
-        </ccTool>
-      </item>
       <item path="build/Debug/src/relpipe-out-gui_autogen/mocs_compilation.cpp"
             ex="false"
             tool="1"
@@ -161,77 +164,18 @@
         <ccTool flags="0">
         </ccTool>
       </item>
-      <folder path="0">
-        <ccTool>
-          <incDir>
-            <pElem>build/Debug/src</pElem>
-            <pElem>src</pElem>
-            <pElem>build/Debug/src/relpipe-out-gui_autogen/include</pElem>
-            <pElem>../relpipe-lib-reader.cpp/include</pElem>
-            <pElem>../relpipe-lib-cli.cpp/include</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtWidgets</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtGui</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtCore</pElem>
-            <pElem>/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtCharts</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>QT_CHARTS_LIB</Elem>
-            <Elem>QT_CORE_LIB</Elem>
-            <Elem>QT_GUI_LIB</Elem>
-            <Elem>QT_WIDGETS_LIB</Elem>
-          </preprocessorList>
-        </ccTool>
-      </folder>
       <folder path="Modules">
         <ccTool>
           <incDir>
-            <pElem>build/Debug/src</pElem>
-            <pElem>src</pElem>
-            <pElem>build/Debug/src/relpipe-out-gui_autogen/include</pElem>
-            <pElem>../relpipe-lib-reader.cpp/include</pElem>
-            <pElem>../relpipe-lib-cli.cpp/include</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtWidgets</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtGui</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtCore</pElem>
-            <pElem>/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtCharts</pElem>
             <pElem>/usr/include</pElem>
           </incDir>
-          <preprocessorList>
-            <Elem>QT_CHARTS_LIB</Elem>
-            <Elem>QT_CORE_LIB</Elem>
-            <Elem>QT_GUI_LIB</Elem>
-            <Elem>QT_WIDGETS_LIB</Elem>
-          </preprocessorList>
-        </ccTool>
-      </folder>
-      <folder path="relpipe-out-chart_autogen">
-        <ccTool>
-          <incDir>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtCore</pElem>
-            <pElem>../relpipe-lib-reader.cpp/include/relpipe/reader/handlers</pElem>
-            <pElem>src</pElem>
-            <pElem>build/Debug/src/relpipe-out-chart_autogen/EWIEGA46WW</pElem>
-            <pElem>../relpipe-lib-reader.cpp/include/relpipe/reader</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtGui</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtWidgets</pElem>
-            <pElem>build/Debug/src/relpipe-out-chart_autogen/include</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5/QtCharts</pElem>
-            <pElem>build/Debug/src/relpipe-out-chart_autogen</pElem>
-            <pElem>/usr/include/x86_64-linux-gnu/qt5</pElem>
-            <pElem>../relpipe-lib-reader.cpp/include</pElem>
-            <pElem>build/Debug/src</pElem>
-          </incDir>
         </ccTool>
       </folder>
       <item path="src/RelpipeChartMainWindow.cpp" ex="false" tool="1" flavor2="8">
         <ccTool flags="0">
         </ccTool>
       </item>
-      <item path="src/relpipe-out-chart.cpp" ex="false" tool="1" flavor2="8">
+      <item path="src/relpipe-out-gui.cpp" ex="false" tool="1" flavor2="8">
         <ccTool flags="0">
         </ccTool>
       </item>
@@ -275,7 +219,7 @@
       </item>
       <item path="src/RelpipeTableModel.h" ex="false" tool="3" flavor2="0">
       </item>
-      <item path="src/relpipe-out-chart.cpp" ex="false" tool="1" flavor2="0">
+      <item path="src/relpipe-out-gui.cpp" ex="false" tool="1" flavor2="0">
       </item>
     </conf>
   </confs>
--- a/nbproject/project.xml	Thu Nov 29 22:30:12 2018 +0100
+++ b/nbproject/project.xml	Sat Dec 01 23:22:41 2018 +0100
@@ -42,7 +42,7 @@
     <type>org.netbeans.modules.cnd.makeproject</type>
     <configuration>
         <data xmlns="http://www.netbeans.org/ns/make-project/1">
-            <name>relpipe-out-chart.qt.cpp</name>
+            <name>relpipe-out-gui.qt.cpp</name>
             <c-extensions/>
             <cpp-extensions>cpp</cpp-extensions>
             <header-extensions>h</header-extensions>
--- a/src/CMakeLists.txt	Thu Nov 29 22:30:12 2018 +0100
+++ b/src/CMakeLists.txt	Sat Dec 01 23:22:41 2018 +0100
@@ -42,7 +42,7 @@
 	RelpipeTableModel.h
 	RelpipeChartMainWindow.ui
 	RelpipeChartMainWindow.cpp
-	relpipe-out-chart.cpp
+	relpipe-out-gui.cpp
 )
 
 # Link libraries:
--- a/src/relpipe-out-chart.cpp	Thu Nov 29 22:30:12 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/**
- * Relational pipes
- * Copyright © 2018 František Kučera (Frantovo.cz, GlobalCode.info)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include <sys/prctl.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <iostream>
-
-#include <QApplication>
-#include <QThread>
-
-#include <relpipe/cli/CLI.h>
-#include <relpipe/cli/RelpipeCLIException.h>
-#include <relpipe/reader/Factory.h>
-#include <relpipe/reader/RelationalReader.h>
-#include <relpipe/reader/RelpipeReaderException.h>
-
-#include "RelpipeChartMainWindow.h"
-#include "QtRelationalReaderStringHadler.h"
-
-using namespace relpipe::cli;
-using namespace relpipe::reader;
-
-// signal/slot parameters must be declared here and registered with qRegisterMetaType()
-
-Q_DECLARE_METATYPE(string_t)
-Q_DECLARE_METATYPE(std::vector<AttributeMetadata>)
-
-class RelationalReaderThread : public QThread {
-private:
-	std::shared_ptr<RelationalReader> reader;
-public:
-
-	// TODO: better background thread; lambda?
-
-	RelationalReaderThread(std::shared_ptr<RelationalReader> reader) :
-	reader(reader) {
-		setTerminationEnabled(true);
-	}
-
-	void run() {
-		try {
-			reader->process();
-		} catch (RelpipeReaderException& e) {
-			// TODO: handle exception, show error dialog
-			std::wcerr << L"RelpipeReaderException: " << e.getMessge() << std::endl;
-		}
-	}
-};
-
-int main(int argc, char**argv) {
-	CLI cli(argc, argv);
-	// TODO: argument name collisions? Filter arguments? Use prefix for Qt? Qt: -title, -style, -geometry
-	QApplication app(argc, argv);
-
-	std::shared_ptr<RelationalReader> reader(Factory::create(std::cin));
-	int resultCode = CLI::EXIT_CODE_UNEXPECTED_ERROR;
-
-	RelpipeChartMainWindow window;
-	window.show();
-
-	RelationalReaderThread t(reader);
-
-	// Proxy that passes calls from the background thread to the GUI thread using signal-slot mechanism:
-	QtRelationalReaderStringHadler handler(&t); // &t instead of handler.moveToThread(&t); // QObject::moveToThread: Cannot move objects with a parent
-
-	// see Q_DECLARE_METATYPE above
-	qRegisterMetaType<string_t>();
-	qRegisterMetaType<std::vector < AttributeMetadata >> ();
-
-	QObject::connect(&handler, &QtRelationalReaderStringHadler::startRelationReceived, &window, &RelpipeChartMainWindow::startRelation, Qt::ConnectionType::QueuedConnection);
-	QObject::connect(&handler, &QtRelationalReaderStringHadler::attributeReceived, &window, &RelpipeChartMainWindow::attribute, Qt::ConnectionType::QueuedConnection);
-	QObject::connect(&handler, &QtRelationalReaderStringHadler::endOfPipeReceived, &window, &RelpipeChartMainWindow::endOfPipe, Qt::ConnectionType::QueuedConnection);
-
-	reader->addHandler(&handler);
-
-	// Start background thread
-	t.start();
-
-	int qtResultCode = app.exec();
-
-	if (qtResultCode == 0) {
-		resultCode = CLI::EXIT_CODE_SUCCESS;
-	} else {
-		// TODO: report and log Qt errors if any
-	}
-
-	if (t.isRunning()) {
-		std::wcerr << L"Background RelationalReader thread is still running → terminate()" << std::endl;
-		t.terminate();
-		std::wcerr << L"Background RelationalReader thread was terminated → wait()" << std::endl;
-		t.wait();
-		std::wcerr << L"Background RelationalReader thread wait() finished" << std::endl;
-	}
-
-	return resultCode;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/relpipe-out-gui.cpp	Sat Dec 01 23:22:41 2018 +0100
@@ -0,0 +1,111 @@
+/**
+ * Relational pipes
+ * Copyright © 2018 František Kučera (Frantovo.cz, GlobalCode.info)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include <sys/prctl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <iostream>
+
+#include <QApplication>
+#include <QThread>
+
+#include <relpipe/cli/CLI.h>
+#include <relpipe/cli/RelpipeCLIException.h>
+#include <relpipe/reader/Factory.h>
+#include <relpipe/reader/RelationalReader.h>
+#include <relpipe/reader/RelpipeReaderException.h>
+
+#include "RelpipeChartMainWindow.h"
+#include "QtRelationalReaderStringHadler.h"
+
+using namespace relpipe::cli;
+using namespace relpipe::reader;
+
+// signal/slot parameters must be declared here and registered with qRegisterMetaType()
+
+Q_DECLARE_METATYPE(string_t)
+Q_DECLARE_METATYPE(std::vector<AttributeMetadata>)
+
+class RelationalReaderThread : public QThread {
+private:
+	std::shared_ptr<RelationalReader> reader;
+public:
+
+	// TODO: better background thread; lambda?
+
+	RelationalReaderThread(std::shared_ptr<RelationalReader> reader) :
+	reader(reader) {
+		setTerminationEnabled(true);
+	}
+
+	void run() {
+		try {
+			reader->process();
+		} catch (RelpipeReaderException& e) {
+			// TODO: handle exception, show error dialog
+			std::wcerr << L"RelpipeReaderException: " << e.getMessge() << std::endl;
+		}
+	}
+};
+
+int main(int argc, char**argv) {
+	CLI cli(argc, argv);
+	// TODO: argument name collisions? Filter arguments? Use prefix for Qt? Qt: -title, -style, -geometry
+	QApplication app(argc, argv);
+
+	std::shared_ptr<RelationalReader> reader(Factory::create(std::cin));
+	int resultCode = CLI::EXIT_CODE_UNEXPECTED_ERROR;
+
+	RelpipeChartMainWindow window;
+	window.show();
+
+	RelationalReaderThread t(reader);
+
+	// Proxy that passes calls from the background thread to the GUI thread using signal-slot mechanism:
+	QtRelationalReaderStringHadler handler(&t); // &t instead of handler.moveToThread(&t); // QObject::moveToThread: Cannot move objects with a parent
+
+	// see Q_DECLARE_METATYPE above
+	qRegisterMetaType<string_t>();
+	qRegisterMetaType<std::vector < AttributeMetadata >> ();
+
+	QObject::connect(&handler, &QtRelationalReaderStringHadler::startRelationReceived, &window, &RelpipeChartMainWindow::startRelation, Qt::ConnectionType::QueuedConnection);
+	QObject::connect(&handler, &QtRelationalReaderStringHadler::attributeReceived, &window, &RelpipeChartMainWindow::attribute, Qt::ConnectionType::QueuedConnection);
+	QObject::connect(&handler, &QtRelationalReaderStringHadler::endOfPipeReceived, &window, &RelpipeChartMainWindow::endOfPipe, Qt::ConnectionType::QueuedConnection);
+
+	reader->addHandler(&handler);
+
+	// Start background thread
+	t.start();
+
+	int qtResultCode = app.exec();
+
+	if (qtResultCode == 0) {
+		resultCode = CLI::EXIT_CODE_SUCCESS;
+	} else {
+		// TODO: report and log Qt errors if any
+	}
+
+	if (t.isRunning()) {
+		std::wcerr << L"Background RelationalReader thread is still running → terminate()" << std::endl;
+		t.terminate();
+		std::wcerr << L"Background RelationalReader thread was terminated → wait()" << std::endl;
+		t.wait();
+		std::wcerr << L"Background RelationalReader thread wait() finished" << std::endl;
+	}
+
+	return resultCode;
+}