[qet] [4128] DXF to QET update csv import with file destination path

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 4128
Author:   rdsivd
Date:     2015-08-18 11:39:08 +0200 (Tue, 18 Aug 2015)
Log Message:
-----------
DXF to QET update csv import with file destination path

Modified Paths:
--------------
    branches/dxftoqet2/csv_create_elmt.cpp
    branches/dxftoqet2/csv_create_elmt.h
    branches/dxftoqet2/dxftoqet_mainwindow.cpp
    branches/dxftoqet2/dxftoqet_mainwindow.h
    branches/dxftoqet2/dxftoqet_mainwindow.ui
    branches/dxftoqet2/src/dxf/dxf_rect.cpp
    branches/dxftoqet2/src/dxf/dxf_rect.h
    branches/dxftoqet2/src/dxf_data.h

Modified: branches/dxftoqet2/csv_create_elmt.cpp
===================================================================
--- branches/dxftoqet2/csv_create_elmt.cpp	2015-08-18 07:34:40 UTC (rev 4127)
+++ branches/dxftoqet2/csv_create_elmt.cpp	2015-08-18 09:39:08 UTC (rev 4128)
@@ -28,6 +28,7 @@
 	Header_Line=DXF_main_base[0].csv_header-1;
 	Split_Line=DXF_main_base[0].csv_split;
 	Input_Lines=DXF_main_base[0].dxf_csv_line_count;
+	Header_background=DXF_main_base[0].csv_header_background;
 
 	Count_lines=Start_Line;
 
@@ -38,6 +39,39 @@
 
 		Create_ELMT.ELMT_definition_height="100";
 		Create_ELMT.ELMT_definition_width="500";
+
+		// calculate with and height
+
+		elmt_height=0;
+		elmt_width=0;
+
+		elmt_height=Row_height=DXF_main_base[0].csv_table_settings[1][1].toDouble()*Split_Line;
+		Create_ELMT.ELMT_definition_height=QString::number(elmt_height,'f',0);
+
+		for (Col_count=0;Col_count<20;Col_count++)
+		{
+
+			Col_width=DXF_main_base[0].csv_table_settings[0][Col_count].toDouble();
+			Row_height=DXF_main_base[0].csv_table_settings[1][Col_count].toDouble();
+			TXT_height=DXF_main_base[0].csv_table_settings[2][Col_count].toInt();
+			Col_use=DXF_main_base[0].csv_table_settings[3][Col_count].toInt();
+			TXT_rotate=DXF_main_base[0].csv_table_settings[4][Col_count].toInt();
+
+
+			if (Col_use==1)
+			{
+
+				elmt_width=elmt_width+Col_width;
+
+
+			}
+
+		}
+
+		Create_ELMT.ELMT_definition_width=QString::number(elmt_width,'f',0);
+
+
+
 		Create_ELMT.ELMT_definition_version="0.5";
 		Create_ELMT.ELMT_definition_hotspot_x="0";
 		Create_ELMT.ELMT_definition_hotspot_y="0";
@@ -221,6 +255,8 @@
 
 		// table fill
 
+		Header_background="none";
+
 		while(sw2==0)
 		{
 
@@ -355,6 +391,7 @@
 	db_rect.dxf_rect_width=Col_width;
 	db_rect.dxf_rect_x=Col_pos;
 	db_rect.dxf_rect_y=Row_pos;
+	db_rect.dxf_rect_filling=Header_background;
 
 	Result_rect2=db_rect.Create_RECTANG();
 
@@ -400,6 +437,7 @@
 	db_text1.QET_rotation=TXT_rotate;
 
 
+
 	db_txt_check2.TextToCheck=DXF_main_base[0].dxf_csv_split[Header_Line][Col_count-1];
 	db_text1.QET_text=db_txt_check2.Text_control();
 

Modified: branches/dxftoqet2/csv_create_elmt.h
===================================================================
--- branches/dxftoqet2/csv_create_elmt.h	2015-08-18 07:34:40 UTC (rev 4127)
+++ branches/dxftoqet2/csv_create_elmt.h	2015-08-18 09:39:08 UTC (rev 4128)
@@ -42,6 +42,10 @@
 	double Col_pos;
 	double Row_pos;
 
+	double elmt_height;
+	double elmt_width;
+
+
 	double Col_width;
 	double Row_height;
 	int Col_use;
@@ -54,6 +58,7 @@
 
 	QString Result_input;
 	QString Result_terminal;
+	QString Header_background;
 
 	// rectangle
 

Modified: branches/dxftoqet2/dxftoqet_mainwindow.cpp
===================================================================
--- branches/dxftoqet2/dxftoqet_mainwindow.cpp	2015-08-18 07:34:40 UTC (rev 4127)
+++ branches/dxftoqet2/dxftoqet_mainwindow.cpp	2015-08-18 09:39:08 UTC (rev 4128)
@@ -174,7 +174,11 @@
 		DXF_main_base[0].dxf_filepath = dialog.selectedFiles().first();
 		DXF_main_base[0].dxf_dir = dialog.directory().absolutePath();
 		DXF_main_base[0].dxf_openfile=DXF_main_base[0].dxf_filepath.split("/").last();
+		DXF_main_base[0].dxf_savepath=DXF_main_base[0].dxf_dir;
 
+		ui->dxf_file_path_save->setText(DXF_main_base[0].dxf_savepath);
+
+
 		FileType=DXF_main_base[0].dxf_openfile.split(".").last();
 		FileName=DXF_main_base[0].dxf_openfile.split(".").first();
 
@@ -296,7 +300,7 @@
 		for (csv_elmt_count=0;csv_elmt_count<DXF_main_base[0].csv_count_elmt;csv_elmt_count++)
 		{
 
-			QFile file(DXF_main_base[0].dxf_dir + "/" + DXF_main_base[0].dxf_openfile +"-"+QString::number(csv_elmt_count,'f',0)+ ".elmt");
+			QFile file(DXF_main_base[0].dxf_savepath + "/" + DXF_main_base[0].dxf_openfile +"-"+QString::number(csv_elmt_count,'f',0)+ ".elmt");
 
 			if (!file.open(QFile::WriteOnly | QFile::Text)) {
 				QMessageBox::warning(this, tr("Application"),
@@ -975,6 +979,22 @@
 	ui->CSV_start_at_line->setText("2");
 
 
+	ui->csv_header_bask_color->addItem("none");
+	ui->csv_header_bask_color->addItem("black");
+	ui->csv_header_bask_color->addItem("white");
+	ui->csv_header_bask_color->addItem("red");
+	ui->csv_header_bask_color->addItem("green");
+	ui->csv_header_bask_color->addItem("blue");
+	ui->csv_header_bask_color->addItem("gray");
+	ui->csv_header_bask_color->addItem("cyan");
+	ui->csv_header_bask_color->addItem("orange");
+	ui->csv_header_bask_color->addItem("purple");
+	ui->csv_header_bask_color->addItem("magenta");
+	ui->csv_header_bask_color->addItem("brun");
+	ui->csv_header_bask_color->addItem("yello");
+	ui->csv_header_bask_color->addItem("lightgray");
+
+
 	CSV_line_count=DXF_main_base[0].dxf_csv_line_count;
 
 	model = new QStandardItemModel(CSV_line_count,20,this);
@@ -998,7 +1018,7 @@
 
 	// laad lege settings in CSV_Tablesettings
 
-	model2 = new QStandardItemModel(5,21,this);
+	model2 = new QStandardItemModel(6,21,this);
 
 	ui->CSV_Tablesettings->setModel(model2);
 
@@ -1029,6 +1049,8 @@
 			index = model2->index(4,col,QModelIndex());
 			model2->setData(index,"0");
 
+			index = model2->index(5,col,QModelIndex());
+			model2->setData(index,"none");
 
 			ui->CSV_Tablesettings->show();
 
@@ -1054,7 +1076,31 @@
 	index = model2->index(4,0,QModelIndex());
 	model2->setData(index,"Text rotation");
 
+	index = model2->index(5,0,QModelIndex());
+	model2->setData(index,"Background color");
 
+
+
+	/*
+	 *         <rect height="10" x="-30" y="-40" style="line-style:normal;line-weight:normal;filling:black;color:black" width="20" antialias="false"/>
+		<rect height="10" x="-30" y="-20" style="line-style:normal;line-weight:normal;filling:red;color:black" width="20" antialias="false"/>
+		<rect height="10" x="0" y="-40" style="line-style:normal;line-weight:normal;filling:white;color:black" width="20" antialias="false"/>
+		<rect height="10" x="30" y="-40" style="line-style:normal;line-weight:normal;filling:green;color:black" width="21" antialias="false"/>
+		<rect height="10" x="0" y="-20" style="line-style:normal;line-weight:normal;filling:blue;color:black" width="20" antialias="false"/>
+		<rect height="10" x="30" y="-20" style="line-style:normal;line-weight:normal;filling:gray;color:black" width="21" antialias="false"/>
+		<rect height="10" x="-30" y="0" style="line-style:normal;line-weight:normal;filling:cyan;color:black" width="20" antialias="false"/>
+		<rect height="10" x="-30" y="20" style="line-style:normal;line-weight:normal;filling:orange;color:black" width="20" antialias="false"/>
+		<rect height="10" x="0" y="20" style="line-style:normal;line-weight:normal;filling:purple;color:black" width="20" antialias="false"/>
+		<rect height="10" x="30" y="0" style="line-style:normal;line-weight:normal;filling:magenta;color:black" width="20" antialias="false"/>
+		<rect height="10" x="30" y="20" style="line-style:normal;line-weight:normal;filling:fdiag;color:black" width="21" antialias="false"/>
+		<rect height="10" x="60" y="-40" style="line-style:normal;line-weight:normal;filling:brun;color:black" width="20" antialias="false"/>
+		<rect height="10" x="60" y="-20" style="line-style:normal;line-weight:normal;filling:yellow;color:black" width="20" antialias="false"/>
+		<rect height="10" x="60" y="0" style="line-style:normal;line-weight:normal;filling:lightgray;color:black" width="20" antialias="false"/>
+		<rect height="10" x="60" y="20" style="line-style:normal;line-weight:normal;filling:none;color:black" width="20" antialias="false"/>
+		*/
+
+
+
 	ui->CSV_Tablesettings->resizeColumnsToContents();
 
 	ui->CSV_Tablesettings->show();
@@ -1068,7 +1114,7 @@
 
 	csv_create_elmt NewCSV;
 
-	for (CSV_row=0; CSV_row<5;CSV_row++)
+	for (CSV_row=0; CSV_row<6;CSV_row++)
 	{
 
 		for(CSV_col=0;CSV_col<20;CSV_col++)
@@ -1086,6 +1132,8 @@
 
 		DXF_main_base[0].csv_split=ui->CSV_split_at_line->text().toInt();
 
+		DXF_main_base[0].csv_header_background=ui->csv_header_bask_color->currentText();
+
 	}
 
 	Result4=NewCSV.Make_ELMT();
@@ -1116,11 +1164,6 @@
 	}*/
 }
 
-
-
-
-
-
 void DXFtoQET_MainWindow::on_CSV_create_qet_clicked()
 {
 
@@ -1180,3 +1223,14 @@
 }
 
 
+
+void DXFtoQET_MainWindow::on_savepath_clicked()
+{
+	DXF_main_base[0].dxf_savepath = QFileDialog::getExistingDirectory(this, tr("Open Directory"),DXF_main_base[0].dxf_dir ,QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
+
+	ui->dxf_file_path_save->setText(DXF_main_base[0].dxf_savepath);
+
+
+
+
+}

Modified: branches/dxftoqet2/dxftoqet_mainwindow.h
===================================================================
--- branches/dxftoqet2/dxftoqet_mainwindow.h	2015-08-18 07:34:40 UTC (rev 4127)
+++ branches/dxftoqet2/dxftoqet_mainwindow.h	2015-08-18 09:39:08 UTC (rev 4128)
@@ -102,6 +102,8 @@
 
 
 
+	void on_savepath_clicked();
+
 	private:
 	Ui::DXFtoQET_MainWindow *ui;
 };

Modified: branches/dxftoqet2/dxftoqet_mainwindow.ui
===================================================================
--- branches/dxftoqet2/dxftoqet_mainwindow.ui	2015-08-18 07:34:40 UTC (rev 4127)
+++ branches/dxftoqet2/dxftoqet_mainwindow.ui	2015-08-18 09:39:08 UTC (rev 4128)
@@ -30,7 +30,7 @@
       <x>10</x>
       <y>11</y>
       <width>1191</width>
-      <height>873</height>
+      <height>901</height>
      </rect>
     </property>
     <layout class="QVBoxLayout" name="verticalLayout_9">
@@ -155,7 +155,7 @@
                <item>
                 <widget class="QLabel" name="dxf_line_counter_2">
                  <property name="text">
-                  <string>Processesing</string>
+                  <string>Open path</string>
                  </property>
                 </widget>
                </item>
@@ -185,6 +185,59 @@
               </layout>
              </item>
              <item>
+              <layout class="QHBoxLayout" name="horizontalLayout_10">
+               <item>
+                <widget class="QLabel" name="dxf_line_counter_3">
+                 <property name="text">
+                  <string>Save  path</string>
+                 </property>
+                </widget>
+               </item>
+               <item>
+                <spacer name="horizontalSpacer_11">
+                 <property name="orientation">
+                  <enum>Qt::Horizontal</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>40</width>
+                   <height>20</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
+               <item>
+                <widget class="QLineEdit" name="dxf_file_path_save">
+                 <property name="minimumSize">
+                  <size>
+                   <width>450</width>
+                   <height>0</height>
+                  </size>
+                 </property>
+                </widget>
+               </item>
+               <item>
+                <widget class="QPushButton" name="savepath">
+                 <property name="minimumSize">
+                  <size>
+                   <width>0</width>
+                   <height>0</height>
+                  </size>
+                 </property>
+                 <property name="maximumSize">
+                  <size>
+                   <width>20</width>
+                   <height>16777215</height>
+                  </size>
+                 </property>
+                 <property name="text">
+                  <string>...</string>
+                 </property>
+                </widget>
+               </item>
+              </layout>
+             </item>
+             <item>
               <spacer name="verticalSpacer_5">
                <property name="orientation">
                 <enum>Qt::Vertical</enum>
@@ -283,6 +336,9 @@
            </item>
            <item row="2" column="0">
             <widget class="QPushButton" name="CSV_create_qet">
+             <property name="enabled">
+              <bool>false</bool>
+             </property>
              <property name="maximumSize">
               <size>
                <width>300</width>
@@ -414,7 +470,7 @@
             <enum>QTabWidget::Rounded</enum>
            </property>
            <property name="currentIndex">
-            <number>3</number>
+            <number>4</number>
            </property>
            <widget class="QWidget" name="tab_ELMT">
             <property name="sizePolicy">
@@ -2344,6 +2400,22 @@
                    </widget>
                   </item>
                   <item>
+                   <widget class="QLabel" name="label_80">
+                    <property name="maximumSize">
+                     <size>
+                      <width>140</width>
+                      <height>16777215</height>
+                     </size>
+                    </property>
+                    <property name="text">
+                     <string>Header background</string>
+                    </property>
+                   </widget>
+                  </item>
+                  <item>
+                   <widget class="QComboBox" name="csv_header_bask_color"/>
+                  </item>
+                  <item>
                    <spacer name="horizontalSpacer_3">
                     <property name="orientation">
                      <enum>Qt::Horizontal</enum>
@@ -2392,7 +2464,7 @@
               <rect>
                <x>20</x>
                <y>410</y>
-               <width>691</width>
+               <width>781</width>
                <height>192</height>
               </rect>
              </property>

Modified: branches/dxftoqet2/src/dxf/dxf_rect.cpp
===================================================================
--- branches/dxftoqet2/src/dxf/dxf_rect.cpp	2015-08-18 07:34:40 UTC (rev 4127)
+++ branches/dxftoqet2/src/dxf/dxf_rect.cpp	2015-08-18 09:39:08 UTC (rev 4128)
@@ -19,7 +19,7 @@
 	db_rect_base.QET_antialias="false";
 	db_rect_base.QET_style="normal";
 	db_rect_base.QET_line_weight="thin";
-	db_rect_base.QET_filling="none";
+	db_rect_base.QET_filling=dxf_rect_filling;
 	db_rect_base.QET_color="black";
 
 	return db_rect_base.Create_rectangel();

Modified: branches/dxftoqet2/src/dxf/dxf_rect.h
===================================================================
--- branches/dxftoqet2/src/dxf/dxf_rect.h	2015-08-18 07:34:40 UTC (rev 4127)
+++ branches/dxftoqet2/src/dxf/dxf_rect.h	2015-08-18 09:39:08 UTC (rev 4128)
@@ -15,9 +15,11 @@
 	double dxf_rect_width;
 	double dxf_rect_height;
 
+	QString dxf_rect_filling;
 
 
 
+
 	QString Create_RECTANG();
 
 

Modified: branches/dxftoqet2/src/dxf_data.h
===================================================================
--- branches/dxftoqet2/src/dxf_data.h	2015-08-18 07:34:40 UTC (rev 4127)
+++ branches/dxftoqet2/src/dxf_data.h	2015-08-18 09:39:08 UTC (rev 4128)
@@ -518,13 +518,17 @@
 		QString dxf_filepath;
 		QString dxf_text_all;
 		QString dxf_filetype;
+		QString dxf_savepath;
 
+
 		QStringList dxf_input;
 
 		QString dxf_csv_split[10000][20];
 		int dxf_csv_line_count;
-		QString csv_table_settings[5][20];
+		QString csv_table_settings[6][20];
 		QString Elmt_list[500];
+		QString csv_header_background;
+
 		int csv_header;
 		int csv_start;
 		int csv_split;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/