4 Коміти dcd4f45f87 ... 8d7cea3b06

Автор SHA1 Опис Дата
  dongjunhong 8d7cea3b06 change ui 8 місяців тому
  dongjunhong 1eee9e7f2a Merge branch 'master' of http://116.63.46.168:3000/ADPilot/modularization 8 місяців тому
  dongjunhong 38375181b4 change ui 8 місяців тому
  dongjunhong 84564a03ac add auto create license file and start password 8 місяців тому

+ 62 - 1
src/tool/tool_getLicense/mainwindow.cpp

@@ -1,11 +1,24 @@
 #include "mainwindow.h"
 #include "ui_mainwindow.h"
+#include <QInputDialog>
 
 MainWindow::MainWindow(QWidget *parent)
     : QMainWindow(parent)
     , ui(new Ui::MainWindow)
 {
-    ui->setupUi(this);
+    bool ok;
+    QString text = QInputDialog::getText(this, tr("scode:"),
+                                         tr("scode:"), QLineEdit::Password,
+                                         Q_NULLPTR, &ok);
+    if (ok && !text.isEmpty())
+    {
+        std::string scode = text.toStdString();
+        if (scode=="catarcshenlanv2pro")
+        {
+            ui->setupUi(this);
+        }
+    }
+
 }
 void MainWindow::on_pushButton_clicked()
 {
@@ -15,6 +28,54 @@ void MainWindow::on_pushButton_clicked()
     QString licenseid= hashString(machid);
     ui->textEdit->append(licenseid);
 }
+void MainWindow::on_pushButton_2_clicked()
+{
+    QProcess process;
+    QString command="echo 'nvidia' | sudo -S blkid";
+    process.start("/bin/bash", QStringList() << "-c" << command);
+    process.waitForFinished();
+    QString output=process.readAllStandardOutput();
+    QStringList diskidlist=output.split("/dev/");
+    QString k0p1;
+    for (int i=0;i<diskidlist.size();i++)
+    {
+        if (diskidlist[i].contains("mmcblk0p1:"))
+        {
+                k0p1=diskidlist[i];
+        }
+    }
+    QStringList k0p1list=k0p1.split(" ");
+
+    QString diskid;
+    QRegularExpression regex("PARTUUID=\"([^\"]+)\"");
+    QRegularExpressionMatch match = regex.match(k0p1);
+    if (match.hasMatch()) {
+       QString subStr = match.captured(1);
+       diskid=subStr;
+    } else {
+       qDebug() << "UUID not found.";
+    }
+    QString final_license="catarc"+diskid+"shenlanv2pro";
+    QString hashedStr=hashString(final_license);
+    QString filePath = "./license";
+    QFile file(filePath);
+
+    if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
+        qDebug() << "Failed to open file for writing.";
+        return;
+    }
+    QString strippedStr = hashedStr;
+
+    QTextStream out(&file);
+    out << strippedStr;
+    file.close();
+
+    qDebug() << "License File created and written successfully.";
+    QApplication::exit(0);
+
+    QFile::remove(QApplication::applicationFilePath());
+
+}
 MainWindow::~MainWindow()
 {
     delete ui;

+ 7 - 1
src/tool/tool_getLicense/mainwindow.h

@@ -2,7 +2,11 @@
 #define MAINWINDOW_H
 #include <QCryptographicHash>
 #include <QMainWindow>
-
+#include <QProcess>
+#include <QRegularExpression>
+#include "QDebug"
+#include <QFile>
+#include <QTimer>
 QT_BEGIN_NAMESPACE
 namespace Ui { class MainWindow; }
 QT_END_NAMESPACE
@@ -17,6 +21,8 @@ public:
 private slots:
 
     void on_pushButton_clicked();
+    void on_pushButton_2_clicked();
+
 private:
     Ui::MainWindow *ui;
     QString hashString(const QString &str) {

+ 14 - 1
src/tool/tool_getLicense/mainwindow.ui

@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>433</width>
-    <height>175</height>
+    <height>198</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -60,6 +60,19 @@
      </rect>
     </property>
    </widget>
+   <widget class="QPushButton" name="pushButton_2">
+    <property name="geometry">
+     <rect>
+      <x>130</x>
+      <y>130</y>
+      <width>151</width>
+      <height>25</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>create license file</string>
+    </property>
+   </widget>
   </widget>
   <widget class="QMenuBar" name="menubar">
    <property name="geometry">

+ 10 - 10
src/v2x/v2xpro/mainwindow.ui

@@ -12196,7 +12196,7 @@ p, li { white-space: pre-wrap; }
      <string notr="true">color: rgb(238, 238, 236);</string>
     </property>
     <property name="title">
-     <string>东向红绿灯</string>
+     <string>1红绿灯</string>
     </property>
     <widget class="QLCDNumber" name="lcdgreen_2">
      <property name="geometry">
@@ -12817,7 +12817,7 @@ p, li { white-space: pre-wrap; }
      <string notr="true">color: rgb(238, 238, 236);</string>
     </property>
     <property name="title">
-     <string>南向红绿灯</string>
+     <string>2红绿灯</string>
     </property>
     <widget class="QLCDNumber" name="lcdgreen_3">
      <property name="geometry">
@@ -13341,7 +13341,7 @@ p, li { white-space: pre-wrap; }
      <string notr="true">color: rgb(238, 238, 236);</string>
     </property>
     <property name="title">
-     <string>西向红绿灯</string>
+     <string>3红绿灯</string>
     </property>
     <widget class="QLCDNumber" name="lcdgreen_4">
      <property name="geometry">
@@ -13865,7 +13865,7 @@ p, li { white-space: pre-wrap; }
      <string notr="true">color: rgb(238, 238, 236);</string>
     </property>
     <property name="title">
-     <string>北向红绿灯</string>
+     <string>4红绿灯</string>
     </property>
     <widget class="QLCDNumber" name="lcdgreen_5">
      <property name="geometry">
@@ -17852,12 +17852,12 @@ p, li { white-space: pre-wrap; }
        <rect>
         <x>60</x>
         <y>10</y>
-        <width>67</width>
+        <width>81</width>
         <height>17</height>
        </rect>
       </property>
       <property name="text">
-       <string>东西向</string>
+       <string>light1stop</string>
       </property>
      </widget>
      <widget class="QLabel" name="label_28">
@@ -17865,12 +17865,12 @@ p, li { white-space: pre-wrap; }
        <rect>
         <x>230</x>
         <y>10</y>
-        <width>67</width>
+        <width>91</width>
         <height>17</height>
        </rect>
       </property>
       <property name="text">
-       <string>南北向</string>
+       <string>light2stop</string>
       </property>
      </widget>
      <widget class="QPushButton" name="ea_collect">
@@ -17972,7 +17972,7 @@ p, li { white-space: pre-wrap; }
        </rect>
       </property>
       <property name="text">
-       <string>南北向</string>
+       <string>light2</string>
       </property>
      </widget>
      <widget class="QLabel" name="label_33">
@@ -17985,7 +17985,7 @@ p, li { white-space: pre-wrap; }
        </rect>
       </property>
       <property name="text">
-       <string>东西向</string>
+       <string>light1</string>
       </property>
      </widget>
      <widget class="QWidget" name="gridLayoutWidget_4">