first push
This commit is contained in:
73
.gitignore
vendored
Normal file
73
.gitignore
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
# This file is used to ignore files which are generated
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
*~
|
||||
*.autosave
|
||||
*.a
|
||||
*.core
|
||||
*.moc
|
||||
*.o
|
||||
*.obj
|
||||
*.orig
|
||||
*.rej
|
||||
*.so
|
||||
*.so.*
|
||||
*_pch.h.cpp
|
||||
*_resource.rc
|
||||
*.qm
|
||||
.#*
|
||||
*.*#
|
||||
core
|
||||
!core/
|
||||
tags
|
||||
.DS_Store
|
||||
.directory
|
||||
*.debug
|
||||
Makefile*
|
||||
*.prl
|
||||
*.app
|
||||
moc_*.cpp
|
||||
ui_*.h
|
||||
qrc_*.cpp
|
||||
Thumbs.db
|
||||
*.res
|
||||
*.rc
|
||||
/.qmake.cache
|
||||
/.qmake.stash
|
||||
|
||||
# qtcreator generated files
|
||||
*.pro.user*
|
||||
|
||||
# xemacs temporary files
|
||||
*.flc
|
||||
|
||||
# Vim temporary files
|
||||
.*.swp
|
||||
|
||||
# Visual Studio generated files
|
||||
*.ib_pdb_index
|
||||
*.idb
|
||||
*.ilk
|
||||
*.pdb
|
||||
*.sln
|
||||
*.suo
|
||||
*.vcproj
|
||||
*vcproj.*.*.user
|
||||
*.ncb
|
||||
*.sdf
|
||||
*.opensdf
|
||||
*.vcxproj
|
||||
*vcxproj.*
|
||||
|
||||
# MinGW generated files
|
||||
*.Debug
|
||||
*.Release
|
||||
|
||||
# Python byte code
|
||||
*.pyc
|
||||
|
||||
# Binaries
|
||||
# --------
|
||||
*.dll
|
||||
*.exe
|
||||
|
||||
49
CMakeLists.txt
Normal file
49
CMakeLists.txt
Normal file
@@ -0,0 +1,49 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(FlashRadar LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(Qt5 COMPONENTS Widgets LinguistTools REQUIRED)
|
||||
find_package(PIP REQUIRED)
|
||||
|
||||
if(NOT DEFINED BUILD_NUMBER)
|
||||
set(BUILD_NUMBER 9999)
|
||||
endif()
|
||||
|
||||
set(COMPANY_NAME "НПП «ИТЭЛМА»")
|
||||
set_version(${PROJECT_NAME} MAJOR 1 MINOR 2 BUILD ${BUILD_NUMBER})
|
||||
set_deploy_property(${PROJECT_NAME}
|
||||
LABEL "${PROJECT_NAME}"
|
||||
COMPANY ${COMPANY_NAME}
|
||||
FULLNAME "su.itelma.flashradar"
|
||||
INFO "Flasher Radar")
|
||||
make_rc(${PROJECT_NAME} out_RC)
|
||||
|
||||
add_executable(${PROJECT_NAME}
|
||||
src/main.cpp
|
||||
src/mainwindow.cpp
|
||||
include/mainwindow.h
|
||||
mainwindow.ui
|
||||
)
|
||||
|
||||
target_link_libraries(FlashRadar PRIVATE Qt5::Widgets)
|
||||
|
||||
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
|
||||
|
||||
if(COMMAND qt_create_translation)
|
||||
qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
|
||||
else()
|
||||
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
|
||||
endif()
|
||||
|
||||
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
|
||||
deploy_target(${PROJECT_NAME} DEPLOY_DIR ${CMAKE_INSTALL_PREFIX}/bin DESTINATION ${CMAKE_INSTALL_PREFIX}/release)
|
||||
7
Config_File.cfg
Normal file
7
Config_File.cfg
Normal file
@@ -0,0 +1,7 @@
|
||||
can=PEAK
|
||||
serial.stm=COM11
|
||||
serial.radar=COM6
|
||||
FlashAwr.path=C:/ti/uniflash_6.2.0/deskdb/content/TICloudAgent/win/ccs_base/DebugServer/bin/DSLite.exe
|
||||
file.sbl=C:/ti/uniflash_6.2.0/deskdb/content/TICloudAgent/win/ccs_base/DebugServer/bin/DSLite.exe
|
||||
awrcanflasher.path=C:/flasher/awrcanflasher/awrcanflasher.exe
|
||||
file.firmware=C:/flasher/awrcanflasher/awrcanflasher.exe
|
||||
3
FlashAwr/qt.conf
Normal file
3
FlashAwr/qt.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
[Paths]
|
||||
Plugins = ./
|
||||
Translations = lang/
|
||||
27
FlashRadar_ru_RU.ts
Normal file
27
FlashRadar_ru_RU.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="FlashRadar_ru_RU">
|
||||
<context>
|
||||
<name>MainWindow</name>
|
||||
<message>
|
||||
<location filename="mainwindow.ui" line="14"/>
|
||||
<source>MainWindow</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.ui" line="41"/>
|
||||
<source>Левый</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.ui" line="61"/>
|
||||
<source>Правый</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.ui" line="98"/>
|
||||
<source>Прошить</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
28
include/mainwindow.h
Normal file
28
include/mainwindow.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class MainWindow; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
private slots:
|
||||
void on_pushButton_left_pressed();
|
||||
|
||||
void on_pushButton_right_pressed();
|
||||
|
||||
void on_pushButton_flash_pressed();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
119
mainwindow.ui
Normal file
119
mainwindow.ui
Normal file
@@ -0,0 +1,119 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>939</width>
|
||||
<height>653</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QSplitter" name="splitter_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QPushButton" name="pushButton_left">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>22</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="acceptDrops">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Левый</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="autoRepeat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_right">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>22</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Правый</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>22</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>24</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>22</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_flash">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>22</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Прошить</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>939</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
11
src/main.cpp
Normal file
11
src/main.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "../include/mainwindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
103
src/mainwindow.cpp
Normal file
103
src/mainwindow.cpp
Normal file
@@ -0,0 +1,103 @@
|
||||
#include "../include/mainwindow.h"
|
||||
#include "../ui_mainwindow.h"
|
||||
#include <iostream>
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
using namespace std;
|
||||
|
||||
QString can;
|
||||
QString serial_stm;
|
||||
QString serial_radar;
|
||||
QString FlashAwr;
|
||||
QString file_sbl;
|
||||
QString awrcanflasher;
|
||||
QString file_firemware;
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::MainWindow)
|
||||
{
|
||||
QString file_path = QCoreApplication::applicationDirPath() + "/Config_File.cfg";
|
||||
QFile file(file_path);
|
||||
file.open(QIODevice::OpenModeFlag::ReadOnly);
|
||||
if(!file.isOpen()) exit(-1);
|
||||
|
||||
for(int i = 0; i < 7; i ++){
|
||||
QString str = file.readLine();
|
||||
str.remove("\r\n");
|
||||
QStringList lst = str.split("=", QString::SkipEmptyParts);
|
||||
switch(i){
|
||||
case 0:
|
||||
can = lst[1];
|
||||
break;
|
||||
case 1:
|
||||
serial_stm = lst[1];
|
||||
break;
|
||||
case 2:
|
||||
serial_radar = lst[1];
|
||||
break;
|
||||
case 3:
|
||||
FlashAwr = lst[1];
|
||||
break;
|
||||
case 4:
|
||||
file_sbl = lst[1];
|
||||
break;
|
||||
case 5:
|
||||
awrcanflasher = lst[1];
|
||||
break;
|
||||
case 6:
|
||||
file_firemware = lst[1];
|
||||
break;
|
||||
default:
|
||||
exit(-2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ui->setupUi(this);
|
||||
ui->progressBar->setValue(0);
|
||||
ui->lineEdit->setAlignment(Qt::AlignmentFlag::AlignCenter);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_pushButton_left_pressed()
|
||||
{
|
||||
ui->pushButton_right->setStyleSheet("background-color: lightGray");
|
||||
ui->pushButton_left->setStyleSheet("background-color: lightGreen");
|
||||
ui->lineEdit->setText("Готов");
|
||||
ui->lineEdit->setStyleSheet("background-color: white");
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_right_pressed()
|
||||
{
|
||||
ui->pushButton_right->setStyleSheet("background-color: lightGreen");
|
||||
ui->pushButton_left->setStyleSheet("background-color: lightGray");
|
||||
ui->lineEdit->setText("Готов");
|
||||
ui->lineEdit->setStyleSheet("background-color: white");
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_flash_pressed()
|
||||
{
|
||||
|
||||
ui->pushButton_left->setDisabled(true);
|
||||
ui->pushButton_right->setDisabled(true);
|
||||
ui->pushButton_flash->setDisabled(true);
|
||||
|
||||
ui->lineEdit->setText("Идёт прошивка");
|
||||
ui->lineEdit->setStyleSheet("background-color: yellow");
|
||||
for(int i = 0; i <= 100; i++ ){
|
||||
ui->progressBar->setValue(i);
|
||||
qApp->processEvents();
|
||||
}
|
||||
ui->lineEdit->setText("Успешно");
|
||||
ui->lineEdit->setStyleSheet("background-color: lightGreen");
|
||||
|
||||
ui->pushButton_left->setDisabled(false);
|
||||
ui->pushButton_right->setDisabled(false);
|
||||
ui->pushButton_flash->setDisabled(false);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user