OSDN Git Service

Added erase graph by hitting ENTER key.
authorENDO Michiaki <dinosaur@db3.so-net.ne.jp>
Wed, 11 Mar 2015 06:50:08 +0000 (15:50 +0900)
committerENDO Michiaki <dinosaur@db3.so-net.ne.jp>
Wed, 11 Mar 2015 06:50:08 +0000 (15:50 +0900)
KODS_GUI.pro.user
mainwindow.cpp
mainwindow.ui

index dba764c..c315fa7 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 3.1.2, 2015-03-05T16:34:19. -->
+<!-- Written by QtCreator 3.1.2, 2015-03-11T08:41:04. -->
 <qtcreator>
  <data>
   <variable>ProjectExplorer.Project.ActiveTarget</variable>
index d0e221e..8875127 100644 (file)
@@ -4,6 +4,7 @@
 #include "lidialog.h"
 #include "ui_mainwindow.h"
 #include <QtWidgets>
+#include <QWidget>
 #include <QDebug>
 #include <QLineEdit>
 #include <QFont>
@@ -13,6 +14,7 @@ MainWindow::MainWindow(QMainWindow *parent)
     : QMainWindow( parent )
 {
 
+
     hdir="/usr/local/KODS";   //For Linux, MacOSX
 
 //    hdir="/sdcard/KODS";     //For Android
@@ -22,6 +24,7 @@ MainWindow::MainWindow(QMainWindow *parent)
     setupUi(this);
 
     msgView->setFont(QFont("courier",9,QFont::Bold));
+    cmdLine->setFocus();
 
     proc = new QProcess(this);
     QObject::connect( proc, SIGNAL(readyReadStandardOutput()), this, SLOT(slot_appendView()) ); //display stdout
@@ -256,25 +259,35 @@ void MainWindow::slot_commandExec()
     cmd = cmdLine->text();
 
     QByteArray input(cmd.toLatin1()+"\n");
-    msgView->append(cmd);
 
+    msgView->append(cmd);
     proc->write(input);
+    delay();
+
+    if (input == "exit\n")
+    {
+        QApplication::quit();
+    }
 
-    if (input == "exit")
+    if (this->isActiveWindow())
+    {
+        cmdLine->releaseKeyboard();
+    }
+    else
     {
-        proc->write("EXIT\n");
+        cmdLine->grabKeyboard();
     }
 
-    if (cmd.trimmed().startsWith("lib"))
+    if (cmd.trimmed().startsWith("lib get"))
     {
         proc->write("LENSSAVE\n");
         proc->write("RTG ALL\n");
         delay();
         ReadFileToTable(hdir+"/LENSES/LENS.PRG");
-        qDebug() << input;
     }
 
     cmdLine->clear();
+
 }
 
 
@@ -889,8 +902,7 @@ 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)));
 
@@ -1214,7 +1226,6 @@ void MainWindow::ReadFileToTable(QString pathname)
                         qDebug()<<material;
                         qDebug()<<name;
             DataRead("OHARA.BIN",name,k);
-            qDebug()<<"Hello";
             table->setItem(k,2,new QTableWidgetItem(material));
             table->resizeColumnToContents(2);
             k++;
@@ -1256,6 +1267,7 @@ void MainWindow::slot_actionOpen()
 
         proc->write("\n");
         proc->write("VIE XZ\n");
+        cmdLine->grabKeyboard();
         return;
     }
 
@@ -1300,6 +1312,7 @@ void MainWindow::slot_actionImport_Zemax()
         delay();
         ReadFileToTable(hdir+"/LENSES/LENS.PRG");
         proc->write("VIE XZ\n");
+        cmdLine->grabKeyboard();
         return;
     }
 
@@ -1325,6 +1338,7 @@ void MainWindow::slot_actionImport_CODE_V()
         delay();
         ReadFileToTable(hdir+"/LENSES/LENS.PRG");
         proc->write("VIE XZ\n");
+        cmdLine->grabKeyboard();
         return;
     }
 
@@ -1461,12 +1475,14 @@ void MainWindow::slot_actionXZ()
 {
     proc->write("\n");
     proc->write("VIE XZ\n");
+    cmdLine->grabKeyboard();
 }
 
 void MainWindow::slot_actionOrtho()
 {
     proc->write("\n");
     proc->write("VIE ORTHO\n");
+    cmdLine->grabKeyboard();
 }
 
 void MainWindow::slot_focus()
@@ -1487,6 +1503,7 @@ void MainWindow::slot_focus()
     proc->write("EOS\n");
     proc->write("RTG ALL\n");
     proc->write("VIE\n");
+    cmdLine->grabKeyboard();
 
 }
 
@@ -1497,30 +1514,35 @@ void MainWindow::slot_actionXZ_YZ_Transverce_Aberrations()
 {
     proc->write("\n");
     proc->write("FANS\n");
+    cmdLine->grabKeyboard();
 }
 
 void MainWindow::slot_actionDistortion()
 {
     proc->write("\n");
     proc->write("DIST\nPLTDIST\n");
+    cmdLine->grabKeyboard();
 }
 
 void MainWindow::slot_actionField_Curvature()
 {
     proc->write("\n");
     proc->write("FLDCV\nPLTFLDCV\n");
+    cmdLine->grabKeyboard();
 }
 
 void MainWindow::slot_actionAstigmatism()
 {
     proc->write("\n");
     proc->write("AST\nPLTAST\n");
+    cmdLine->grabKeyboard();
 }
 
 void MainWindow::slot_actionPltchrsh()
 {
     proc->write("\n");
     proc->write("CHRSHIFT\nPLTCHRSH\n");
+    cmdLine->grabKeyboard();
 }
 
 
@@ -1528,50 +1550,59 @@ void MainWindow::slot_actionGeometical()
 {
     proc->write("\n");
     proc->write("GOTF\nPLTGOTF\n");
+    cmdLine->grabKeyboard();
 }
 
 void MainWindow::slot_actionGeometical_Leica()
 {
     proc->write("\n");
     proc->write("GOTF\nPLTGOTF LEICA\n");
+    cmdLine->grabKeyboard();
 }
 
 void MainWindow::slot_actionDiffraction()
 {
     proc->write("\n");
     proc->write("DOTF\nPLTDOTF\n");
+    cmdLine->grabKeyboard();
 }
 
 void MainWindow::slot_actionDiffraction_Leica()
 {
     proc->write("\n");
     proc->write("DOTF\nPLTDOTF LEICA\n");
+    cmdLine->grabKeyboard();
 }
 
 void MainWindow::slot_actionSpot_Diagram()
 {
     proc->write("\n");
     proc->write("SPD\nPLTSPD\n");
+    cmdLine->grabKeyboard();
 }
 
 void MainWindow::slot_actionWavefront_Phase()
 {
     proc->write("\n");
     proc->write("CAPFN\nPLOT CAPFNOPD\n");
+    cmdLine->grabKeyboard();
 }
 
 void MainWindow::slot_actionWavefront_Intensity()
 {
     proc->write("\n");
     proc->write("CAPFN\nPLOT CAPFNAPD\n");
+    cmdLine->grabKeyboard();
 }
 
 void MainWindow::slot_actionPoint_Spread_Function()
 {
     proc->write("\n");
     proc->write("PSF\n");
+    cmdLine->grabKeyboard();
 }
 
+// Input table value
 
 void MainWindow::slot_action_value_entered()
 {
@@ -1743,10 +1774,10 @@ void MainWindow::slot_actionRay_input_angle()
     proc->write("\n");
     proc->write("U L\n");
     proc->write("SCY FANG "+dialog4->inputangle.toLatin1()+"\n");
-    qDebug()<< dialog4->inputangle.toLatin1();
     proc->write("EOS\n");
 
     proc->write("VIE\n");
+    cmdLine->grabKeyboard();
 
     }
 }
@@ -1787,7 +1818,7 @@ bool MainWindow::eventFilter(QObject* object, QEvent* event)
 
 void MainWindow::delay()  //Code from StackOverFlow
 {
-    QTime dieTime= QTime::currentTime().addMSecs(100);
+    QTime dieTime= QTime::currentTime().addMSecs(500);
     while( QTime::currentTime() < dieTime )
     QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
 }
index 1d9357e..55b3c52 100644 (file)
           <family>Takao Pゴシック</family>
          </font>
         </property>
+        <property name="focusPolicy">
+         <enum>Qt::NoFocus</enum>
+        </property>
         <property name="readOnly">
          <bool>true</bool>
         </property>