OSDN Git Service

Fixed lib get and import table display bug
[kods/KODS_GUI.git] / mainwindow.cpp
index 35e80ed..d0e221e 100644 (file)
@@ -265,6 +265,15 @@ void MainWindow::slot_commandExec()
         proc->write("EXIT\n");
     }
 
+    if (cmd.trimmed().startsWith("lib"))
+    {
+        proc->write("LENSSAVE\n");
+        proc->write("RTG ALL\n");
+        delay();
+        ReadFileToTable(hdir+"/LENSES/LENS.PRG");
+        qDebug() << input;
+    }
+
     cmdLine->clear();
 }
 
@@ -880,6 +889,8 @@ void MainWindow::DataRead(QString BinName, QString name, int k){
 
     qDebug() << nD;
     qDebug() << Abbe;
+    qDebug() << lC;
+    qDebug() << lD;
     table->setItem(k,3,new QTableWidgetItem(QString::number(nD)));
     table->setItem(k,4,new QTableWidgetItem(QString::number(Abbe)));
 
@@ -1286,7 +1297,7 @@ void MainWindow::slot_actionImport_Zemax()
         proc->write("ZMX2PRG "+filename.toUtf8()+"\n");
         proc->write("LENSSAVE\n");
         proc->write("RTG ALL\n");
-
+        delay();
         ReadFileToTable(hdir+"/LENSES/LENS.PRG");
         proc->write("VIE XZ\n");
         return;
@@ -1309,8 +1320,9 @@ void MainWindow::slot_actionImport_CODE_V()
     if (filename!=""){
         proc->write("\n");
         proc->write("CV2PRG "+filename.toUtf8()+"\n");
-        proc->write("RTG ALL\n");
         proc->write("LENSSAVE\n");
+        proc->write("RTG ALL\n");
+        delay();
         ReadFileToTable(hdir+"/LENSES/LENS.PRG");
         proc->write("VIE XZ\n");
         return;
@@ -1773,3 +1785,10 @@ bool MainWindow::eventFilter(QObject* object, QEvent* event)
         return QWidget::eventFilter(object, event);
 }
 
+void MainWindow::delay()  //Code from StackOverFlow
+{
+    QTime dieTime= QTime::currentTime().addMSecs(100);
+    while( QTime::currentTime() < dieTime )
+    QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
+}
+