mirror of
https://gitee.com/nikolan/keil_development_assistant.git
synced 2025-01-26 05:52:53 +08:00
添加打包脚本
This commit is contained in:
parent
f9d3c7e0a0
commit
5ff51144ec
243
KDAv1.nsi
Normal file
243
KDAv1.nsi
Normal file
@ -0,0 +1,243 @@
|
||||
; Script generated by the HM NIS Edit Script Wizard.
|
||||
|
||||
; HM NIS Edit Wizard helper defines
|
||||
!define PRODUCT_NAME "KDA_v1.0"
|
||||
!define PRODUCT_VERSION "1.0"
|
||||
!define PRODUCT_PUBLISHER "һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ageek"
|
||||
!define PRODUCT_WEB_SITE "https://gitee.com/nikolan"
|
||||
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\KDA.exe"
|
||||
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
|
||||
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
|
||||
!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"
|
||||
|
||||
; MUI 1.67 compatible ------
|
||||
!include "MUI.nsh"
|
||||
|
||||
; MUI Settings
|
||||
!define MUI_ABORTWARNING
|
||||
!define MUI_ICON "KDA_Logo.ico"
|
||||
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
|
||||
|
||||
; Language Selection Dialog Settings
|
||||
!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
|
||||
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
|
||||
!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
|
||||
|
||||
; Welcome page
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
; License page
|
||||
!define MUI_LICENSEPAGE_CHECKBOX
|
||||
!insertmacro MUI_PAGE_LICENSE "GPLv2.txt"
|
||||
; Directory page
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
; Start menu page
|
||||
var ICONS_GROUP
|
||||
!define MUI_STARTMENUPAGE_NODISABLE
|
||||
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "KDA_v1.0"
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
|
||||
!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
|
||||
; Instfiles page
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!include "WordFunc.nsh"
|
||||
!define PATH_KEY "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" ;//path<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD>HKLM<EFBFBD>µ<EFBFBD>ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
Section -Post
|
||||
;<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>ϵͳԭ<EFBFBD>еĻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
|
||||
;<EFBFBD><EFBFBD>ԭ<EFBFBD>еĻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> D:\test Ŀ¼
|
||||
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$0;$INSTDIR"
|
||||
;ˢ<EFBFBD>»<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=500
|
||||
SectionEnd
|
||||
; Finish page
|
||||
!define MUI_FINISHPAGE_RUN "$INSTDIR\KDA.exe"
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
|
||||
; Uninstaller pages
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
; Language files
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
!insertmacro MUI_LANGUAGE "SimpChinese"
|
||||
|
||||
; MUI end ------
|
||||
|
||||
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
|
||||
OutFile "KDA_v1.0.exe"
|
||||
InstallDir "$PROGRAMFILES\KDA_v1.0"
|
||||
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
|
||||
ShowInstDetails show
|
||||
ShowUnInstDetails show
|
||||
|
||||
Function .onInit
|
||||
!insertmacro MUI_LANGDLL_DISPLAY
|
||||
FunctionEnd
|
||||
|
||||
Section "MainSection" SEC01
|
||||
SetOutPath "$INSTDIR"
|
||||
SetOverwrite try
|
||||
File "..\Winx64\D3Dcompiler_47.dll"
|
||||
SetOutPath "$INSTDIR\iconengines"
|
||||
File "..\Winx64\iconengines\qsvgicon.dll"
|
||||
SetOutPath "$INSTDIR\imageformats"
|
||||
File "..\Winx64\imageformats\qgif.dll"
|
||||
File "..\Winx64\imageformats\qicns.dll"
|
||||
File "..\Winx64\imageformats\qico.dll"
|
||||
File "..\Winx64\imageformats\qjpeg.dll"
|
||||
File "..\Winx64\imageformats\qsvg.dll"
|
||||
File "..\Winx64\imageformats\qtga.dll"
|
||||
File "..\Winx64\imageformats\qtiff.dll"
|
||||
File "..\Winx64\imageformats\qwbmp.dll"
|
||||
File "..\Winx64\imageformats\qwebp.dll"
|
||||
SetOutPath "$INSTDIR"
|
||||
File "..\Winx64\KDA.exe"
|
||||
File "..\Winx64\libEGL.dll"
|
||||
File "..\Winx64\libgcc_s_seh-1.dll"
|
||||
File "..\Winx64\libGLESV2.dll"
|
||||
File "..\Winx64\libstdc++-6.dll"
|
||||
File "..\Winx64\libwinpthread-1.dll"
|
||||
File "..\Winx64\opengl32sw.dll"
|
||||
SetOutPath "$INSTDIR\platforms"
|
||||
File "..\Winx64\platforms\qwindows.dll"
|
||||
SetOutPath "$INSTDIR"
|
||||
File "..\Winx64\Qt5Charts.dll"
|
||||
File "..\Winx64\Qt5Core.dll"
|
||||
File "..\Winx64\Qt5Gui.dll"
|
||||
File "..\Winx64\Qt5Svg.dll"
|
||||
File "..\Winx64\Qt5Widgets.dll"
|
||||
SetOutPath "$INSTDIR\styles"
|
||||
File "..\Winx64\styles\qwindowsvistastyle.dll"
|
||||
SetOutPath "$INSTDIR\translations"
|
||||
File "..\Winx64\translations\qt_ar.qm"
|
||||
File "..\Winx64\translations\qt_bg.qm"
|
||||
File "..\Winx64\translations\qt_ca.qm"
|
||||
File "..\Winx64\translations\qt_cs.qm"
|
||||
File "..\Winx64\translations\qt_da.qm"
|
||||
File "..\Winx64\translations\qt_de.qm"
|
||||
File "..\Winx64\translations\qt_en.qm"
|
||||
File "..\Winx64\translations\qt_es.qm"
|
||||
File "..\Winx64\translations\qt_fi.qm"
|
||||
File "..\Winx64\translations\qt_fr.qm"
|
||||
File "..\Winx64\translations\qt_gd.qm"
|
||||
File "..\Winx64\translations\qt_he.qm"
|
||||
File "..\Winx64\translations\qt_hu.qm"
|
||||
File "..\Winx64\translations\qt_it.qm"
|
||||
File "..\Winx64\translations\qt_ja.qm"
|
||||
File "..\Winx64\translations\qt_ko.qm"
|
||||
File "..\Winx64\translations\qt_lv.qm"
|
||||
File "..\Winx64\translations\qt_pl.qm"
|
||||
File "..\Winx64\translations\qt_ru.qm"
|
||||
File "..\Winx64\translations\qt_sk.qm"
|
||||
File "..\Winx64\translations\qt_uk.qm"
|
||||
File "..\Winx64\translations\qt_zh_TW.qm"
|
||||
|
||||
; Shortcuts
|
||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||
CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
|
||||
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\KDA_v1.0.lnk" "$INSTDIR\KDA.exe"
|
||||
CreateShortCut "$DESKTOP\KDA_v1.0.lnk" "$INSTDIR\KDA.exe"
|
||||
!insertmacro MUI_STARTMENU_WRITE_END
|
||||
SectionEnd
|
||||
|
||||
Section -AdditionalIcons
|
||||
SetOutPath $INSTDIR
|
||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
|
||||
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
|
||||
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe"
|
||||
!insertmacro MUI_STARTMENU_WRITE_END
|
||||
SectionEnd
|
||||
|
||||
Section -Post
|
||||
WriteUninstaller "$INSTDIR\uninst.exe"
|
||||
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\KDA.exe"
|
||||
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
|
||||
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
|
||||
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\KDA.exe"
|
||||
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
|
||||
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
|
||||
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
|
||||
SectionEnd
|
||||
|
||||
|
||||
Function un.onUninstSuccess
|
||||
HideWindow
|
||||
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) <20>ѳɹ<D1B3><C9B9>ش<EFBFBD><D8B4><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD><C6B3><EFBFBD>"
|
||||
FunctionEnd
|
||||
|
||||
Function un.onInit
|
||||
!insertmacro MUI_UNGETLANGUAGE
|
||||
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "<EFBFBD><EFBFBD>ȷʵҪ<EFBFBD><EFBFBD>ȫ<EFBFBD>Ƴ<EFBFBD> $(^Name) <20><><EFBFBD>估<EFBFBD><E4BCB0><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" IDYES +2
|
||||
Abort
|
||||
FunctionEnd
|
||||
|
||||
Section Uninstall
|
||||
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
|
||||
Delete "$INSTDIR\${PRODUCT_NAME}.url"
|
||||
Delete "$INSTDIR\uninst.exe"
|
||||
Delete "$INSTDIR\translations\qt_zh_TW.qm"
|
||||
Delete "$INSTDIR\translations\qt_uk.qm"
|
||||
Delete "$INSTDIR\translations\qt_sk.qm"
|
||||
Delete "$INSTDIR\translations\qt_ru.qm"
|
||||
Delete "$INSTDIR\translations\qt_pl.qm"
|
||||
Delete "$INSTDIR\translations\qt_lv.qm"
|
||||
Delete "$INSTDIR\translations\qt_ko.qm"
|
||||
Delete "$INSTDIR\translations\qt_ja.qm"
|
||||
Delete "$INSTDIR\translations\qt_it.qm"
|
||||
Delete "$INSTDIR\translations\qt_hu.qm"
|
||||
Delete "$INSTDIR\translations\qt_he.qm"
|
||||
Delete "$INSTDIR\translations\qt_gd.qm"
|
||||
Delete "$INSTDIR\translations\qt_fr.qm"
|
||||
Delete "$INSTDIR\translations\qt_fi.qm"
|
||||
Delete "$INSTDIR\translations\qt_es.qm"
|
||||
Delete "$INSTDIR\translations\qt_en.qm"
|
||||
Delete "$INSTDIR\translations\qt_de.qm"
|
||||
Delete "$INSTDIR\translations\qt_da.qm"
|
||||
Delete "$INSTDIR\translations\qt_cs.qm"
|
||||
Delete "$INSTDIR\translations\qt_ca.qm"
|
||||
Delete "$INSTDIR\translations\qt_bg.qm"
|
||||
Delete "$INSTDIR\translations\qt_ar.qm"
|
||||
Delete "$INSTDIR\styles\qwindowsvistastyle.dll"
|
||||
Delete "$INSTDIR\Qt5Widgets.dll"
|
||||
Delete "$INSTDIR\Qt5Svg.dll"
|
||||
Delete "$INSTDIR\Qt5Gui.dll"
|
||||
Delete "$INSTDIR\Qt5Core.dll"
|
||||
Delete "$INSTDIR\Qt5Charts.dll"
|
||||
Delete "$INSTDIR\platforms\qwindows.dll"
|
||||
Delete "$INSTDIR\opengl32sw.dll"
|
||||
Delete "$INSTDIR\libwinpthread-1.dll"
|
||||
Delete "$INSTDIR\libstdc++-6.dll"
|
||||
Delete "$INSTDIR\libGLESV2.dll"
|
||||
Delete "$INSTDIR\libgcc_s_seh-1.dll"
|
||||
Delete "$INSTDIR\libEGL.dll"
|
||||
Delete "$INSTDIR\KDA.exe"
|
||||
Delete "$INSTDIR\imageformats\qwebp.dll"
|
||||
Delete "$INSTDIR\imageformats\qwbmp.dll"
|
||||
Delete "$INSTDIR\imageformats\qtiff.dll"
|
||||
Delete "$INSTDIR\imageformats\qtga.dll"
|
||||
Delete "$INSTDIR\imageformats\qsvg.dll"
|
||||
Delete "$INSTDIR\imageformats\qjpeg.dll"
|
||||
Delete "$INSTDIR\imageformats\qico.dll"
|
||||
Delete "$INSTDIR\imageformats\qicns.dll"
|
||||
Delete "$INSTDIR\imageformats\qgif.dll"
|
||||
Delete "$INSTDIR\iconengines\qsvgicon.dll"
|
||||
Delete "$INSTDIR\D3Dcompiler_47.dll"
|
||||
|
||||
Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk"
|
||||
Delete "$SMPROGRAMS\$ICONS_GROUP\Website.lnk"
|
||||
Delete "$DESKTOP\KDA_v1.0.lnk"
|
||||
Delete "$SMPROGRAMS\$ICONS_GROUP\KDA_v1.0.lnk"
|
||||
|
||||
RMDir "$SMPROGRAMS\$ICONS_GROUP"
|
||||
RMDir "$INSTDIR\translations"
|
||||
RMDir "$INSTDIR\styles"
|
||||
RMDir "$INSTDIR\platforms"
|
||||
RMDir "$INSTDIR\imageformats"
|
||||
RMDir "$INSTDIR\iconengines"
|
||||
RMDir "$INSTDIR"
|
||||
|
||||
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
|
||||
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
|
||||
SetAutoClose true
|
||||
SectionEnd
|
@ -9,32 +9,32 @@ find_path::find_path()
|
||||
{
|
||||
|
||||
}
|
||||
QString find_path::find_file_path(const QString& dir_path,const QString& key_world)
|
||||
{
|
||||
QFileInfoList fileInfoList;
|
||||
QString file_path="";
|
||||
QDir dir(dir_path);
|
||||
foreach(QFileInfo info,dir.entryInfoList(QDir::NoDotAndDotDot | QDir::Dirs)){
|
||||
QString find_path::find_file_path(const QString& dir_path,const QString& key_world)
|
||||
{
|
||||
QFileInfoList fileInfoList;
|
||||
QString file_path="";
|
||||
QDir dir(dir_path);
|
||||
foreach(QFileInfo info,dir.entryInfoList(QDir::NoDotAndDotDot | QDir::Dirs)){
|
||||
|
||||
// qDebug()<<"dir:"<<info.filePath();
|
||||
// qDebug()<<"dir:"<<info.filePath();
|
||||
|
||||
file_path=find_file_path(info.filePath(),key_world);
|
||||
if(file_path!="")
|
||||
return file_path;
|
||||
file_path=find_file_path(info.filePath(),key_world);
|
||||
if(file_path!="")
|
||||
return file_path;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
foreach(QFileInfo info,dir.entryInfoList(QDir::Files)){
|
||||
fileInfoList.append(info);
|
||||
if(info.fileName().contains(key_world))
|
||||
{
|
||||
foreach(QFileInfo info,dir.entryInfoList(QDir::Files)){
|
||||
fileInfoList.append(info);
|
||||
if(info.fileName().contains(key_world))
|
||||
{
|
||||
|
||||
|
||||
file_path=info.path()+"/"+info.fileName();
|
||||
// qDebug()<<info.path()+"/"+info.fileName();
|
||||
return file_path;
|
||||
}
|
||||
file_path=info.path()+"/"+info.fileName();
|
||||
// qDebug()<<info.path()+"/"+info.fileName();
|
||||
return file_path;
|
||||
}
|
||||
|
||||
}
|
||||
return file_path;
|
||||
}
|
||||
}
|
||||
return file_path;
|
||||
}
|
||||
|
4
flatui.h
4
flatui.h
@ -25,9 +25,9 @@ class QScrollBar;
|
||||
|
||||
#ifdef quc
|
||||
class Q_DECL_EXPORT FlatUI
|
||||
#else
|
||||
#else
|
||||
class FlatUI
|
||||
#endif
|
||||
#endif
|
||||
|
||||
{
|
||||
public:
|
||||
|
38
main.cpp
38
main.cpp
@ -66,14 +66,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// Execute the cmd command and get the output
|
||||
// QString result = executeCmdCommand("cd ");
|
||||
// QString result = executeCmdCommand("cd ");
|
||||
|
||||
// Display the output
|
||||
// qDebug() << "Output:" << result;
|
||||
// qDebug() << "Output:" << result;
|
||||
|
||||
|
||||
for(int i=0;i<argc;i++)
|
||||
qDebug() <<argv[i];
|
||||
qDebug() <<argv[i];
|
||||
|
||||
if(argc==3)
|
||||
{
|
||||
@ -82,22 +82,22 @@ int main(int argc, char *argv[])
|
||||
map_path=gb2312ToQString(argv[2]);
|
||||
|
||||
project_path.replace("\"", "");
|
||||
map_path.replace("\"", "");
|
||||
map_path.replace("\"", "");
|
||||
|
||||
project_path.replace("“", "");
|
||||
project_path.replace("”", "");
|
||||
map_path.replace("“", "");
|
||||
map_path.replace("”", "");
|
||||
project_path.replace("“", "");
|
||||
project_path.replace("”", "");
|
||||
map_path.replace("“", "");
|
||||
map_path.replace("”", "");
|
||||
|
||||
}else if(argc==2)
|
||||
{
|
||||
project_path=map_path=gb2312ToQString(argv[1]);
|
||||
project_path.replace("\"", "");
|
||||
map_path.replace("\"", "");
|
||||
project_path.replace("“", "");
|
||||
project_path.replace("”", "");
|
||||
map_path.replace("“", "");
|
||||
map_path.replace("”", "");
|
||||
map_path.replace("\"", "");
|
||||
project_path.replace("“", "");
|
||||
project_path.replace("”", "");
|
||||
map_path.replace("“", "");
|
||||
map_path.replace("”", "");
|
||||
|
||||
}else
|
||||
|
||||
@ -109,14 +109,14 @@ int main(int argc, char *argv[])
|
||||
QApplication a(argc, argv);
|
||||
|
||||
|
||||
// only_run_by_file programController;
|
||||
// QObject::connect(&programController, &only_run_by_file::runFileDeleted, &a, &QCoreApplication::quit);
|
||||
// 注册程序退出的处理函数
|
||||
QObject::connect(&a, &QCoreApplication::aboutToQuit, onAppExit);
|
||||
// only_run_by_file programController;
|
||||
// QObject::connect(&programController, &only_run_by_file::runFileDeleted, &a, &QCoreApplication::quit);
|
||||
// 注册程序退出的处理函数
|
||||
QObject::connect(&a, &QCoreApplication::aboutToQuit, onAppExit);
|
||||
|
||||
MainWindow w;
|
||||
MainWindow w;
|
||||
|
||||
w.show();
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
585
mainwindow.cpp
585
mainwindow.cpp
@ -13,9 +13,9 @@
|
||||
void MainWindow::winow_on_top(bool is_top)
|
||||
{
|
||||
if(is_top)
|
||||
setWindowFlags(windowFlags()|Qt::WindowStaysOnTopHint);
|
||||
setWindowFlags(windowFlags()|Qt::WindowStaysOnTopHint);
|
||||
else
|
||||
setWindowFlags(windowFlags()&(~Qt::WindowStaysOnTopHint));
|
||||
setWindowFlags(windowFlags()&(~Qt::WindowStaysOnTopHint));
|
||||
}
|
||||
|
||||
|
||||
@ -25,15 +25,15 @@ MainWindow::MainWindow(QWidget *parent) : FramelessMainWindow(parent), ui(new Ui
|
||||
ui->setupUi(this);
|
||||
this->initForm();
|
||||
winow_on_top(true);
|
||||
// winow_on_top(false);
|
||||
// winow_on_top(false);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete cpu;
|
||||
delete map;
|
||||
delete ram_chart;
|
||||
delete flash_chart;
|
||||
delete cpu;
|
||||
delete map;
|
||||
delete ram_chart;
|
||||
delete flash_chart;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@ -55,22 +55,22 @@ void MainWindow::initForm()
|
||||
list << "#widgetMain{border:2px solid #BBBBBB;background:#FFFFFF;}";
|
||||
list << "#widgetMain{border-bottom-left-radius:8px;border-bottom-right-radius:8px;}";
|
||||
this->setStyleSheet(list.join(""));
|
||||
FlatUI::setScrollBarQss(ui->ram_scrollArea->verticalScrollBar(), 8, 120, 20, "#E5E5E5", "#D0D0D0", "#1ABC9C", "#E74C3C");
|
||||
FlatUI::setScrollBarQss(ui->flash_scrollArea->verticalScrollBar(), 8, 120, 20, "#E5E5E5", "#D0D0D0", "#1ABC9C", "#E74C3C");
|
||||
FlatUI::setScrollBarQss(ui->ram_scrollArea->verticalScrollBar(), 8, 120, 20, "#E5E5E5", "#D0D0D0", "#1ABC9C", "#E74C3C");
|
||||
FlatUI::setScrollBarQss(ui->flash_scrollArea->verticalScrollBar(), 8, 120, 20, "#E5E5E5", "#D0D0D0", "#1ABC9C", "#E74C3C");
|
||||
|
||||
FlatUI::setScrollBarQss(ui->ram_table->horizontalScrollBar(), 8, 120, 20, "#E5E5E5", "#D0D0D0", "#1ABC9C", "#E74C3C");
|
||||
FlatUI::setScrollBarQss(ui->ram_table->verticalScrollBar(), 8, 120, 20, "#E5E5E5", "#D0D0D0", "#1ABC9C", "#E74C3C");
|
||||
FlatUI::setScrollBarQss(ui->flash_table->horizontalScrollBar(), 8, 120, 20, "#E5E5E5","#D0D0D0", "#1ABC9C", "#E74C3C");
|
||||
FlatUI::setScrollBarQss(ui->flash_table->verticalScrollBar(), 8, 120, 20, "#E5E5E5", "#D0D0D0", "#1ABC9C", "#E74C3C");
|
||||
FlatUI::setScrollBarQss(ui->ram_table->horizontalScrollBar(), 8, 120, 20, "#E5E5E5", "#D0D0D0", "#1ABC9C", "#E74C3C");
|
||||
FlatUI::setScrollBarQss(ui->ram_table->verticalScrollBar(), 8, 120, 20, "#E5E5E5", "#D0D0D0", "#1ABC9C", "#E74C3C");
|
||||
FlatUI::setScrollBarQss(ui->flash_table->horizontalScrollBar(), 8, 120, 20, "#E5E5E5","#D0D0D0", "#1ABC9C", "#E74C3C");
|
||||
FlatUI::setScrollBarQss(ui->flash_table->verticalScrollBar(), 8, 120, 20, "#E5E5E5", "#D0D0D0", "#1ABC9C", "#E74C3C");
|
||||
|
||||
FlatUI::setProgressQss(ui->ram_used_bar, 20,12,16, "#747976", "#1ABC9C");//#FAEC9C",#FFF5E7
|
||||
FlatUI::setProgressQss(ui->flash_used_bar, 20,12,16, "#747976", "#1ABC9C");
|
||||
FlatUI::setProgressQss(ui->ram_used_bar, 20,12,16, "#747976", "#1ABC9C");//#FAEC9C",#FFF5E7
|
||||
FlatUI::setProgressQss(ui->flash_used_bar, 20,12,16, "#747976", "#1ABC9C");
|
||||
|
||||
main_window=this;
|
||||
main_window=this;
|
||||
|
||||
|
||||
//map_path="./";
|
||||
//project_path="./";
|
||||
//map_path="./";
|
||||
//project_path="./";
|
||||
|
||||
ui->map_path->setText(map_path);
|
||||
ui->project_path->setText(project_path);
|
||||
@ -87,71 +87,71 @@ void MainWindow::initForm()
|
||||
|
||||
|
||||
|
||||
//QChartView
|
||||
//QChartView
|
||||
|
||||
|
||||
ram_chart->addSeries(ram_pieseries);
|
||||
ram_chart->setTitle("文件内存分布饼图");
|
||||
ram_chart->legend()->hide();
|
||||
// Set the theme to one of the predefined themes
|
||||
ram_chart->setTheme(QChart::ChartThemeQt);
|
||||
ram_chart->setBackgroundBrush(QBrush(Qt::gray));
|
||||
ram_chart->addSeries(ram_pieseries);
|
||||
ram_chart->setTitle("文件内存分布饼图");
|
||||
ram_chart->legend()->hide();
|
||||
// Set the theme to one of the predefined themes
|
||||
ram_chart->setTheme(QChart::ChartThemeQt);
|
||||
ram_chart->setBackgroundBrush(QBrush(Qt::gray));
|
||||
|
||||
ram_chart->setTitleBrush(Qt::white);; // 数据集分类标题文字颜色
|
||||
flash_chart->addSeries(flash_pieseries);
|
||||
flash_chart->setTitle("文件flash分布饼图");
|
||||
flash_chart->legend()->hide();
|
||||
// Set the theme to one of the predefined themes
|
||||
flash_chart->setTheme(QChart::ChartThemeQt);
|
||||
flash_chart->setBackgroundBrush(QBrush(Qt::gray));
|
||||
flash_chart->setTitleBrush(Qt::white);
|
||||
ram_chart->setTitleBrush(Qt::white);; // 数据集分类标题文字颜色
|
||||
flash_chart->addSeries(flash_pieseries);
|
||||
flash_chart->setTitle("文件flash分布饼图");
|
||||
flash_chart->legend()->hide();
|
||||
// Set the theme to one of the predefined themes
|
||||
flash_chart->setTheme(QChart::ChartThemeQt);
|
||||
flash_chart->setBackgroundBrush(QBrush(Qt::gray));
|
||||
flash_chart->setTitleBrush(Qt::white);
|
||||
|
||||
ui->ram_chart_view->setChart(ram_chart);
|
||||
ui->ram_chart_view->setRubberBand(QChartView::RectangleRubberBand);
|
||||
ui->ram_chart_view->setChart(ram_chart);
|
||||
ui->ram_chart_view->setRubberBand(QChartView::RectangleRubberBand);
|
||||
|
||||
ui->flash_chart_view->setChart(flash_chart);
|
||||
ui->flash_chart_view->setRubberBand(QChartView::RectangleRubberBand);
|
||||
ui->flash_chart_view->setChart(flash_chart);
|
||||
ui->flash_chart_view->setRubberBand(QChartView::RectangleRubberBand);
|
||||
|
||||
|
||||
if(map_path.length()>1&&project_path.length()>1)
|
||||
{
|
||||
cpu= new parse_keil_project(ui->project_path->text());
|
||||
if(cpu->to_parse_keil_project(ui->project_path->text()))
|
||||
if(map_path.length()>1&&project_path.length()>1)
|
||||
{
|
||||
update_cpu_info();
|
||||
cpu= new parse_keil_project(ui->project_path->text());
|
||||
if(cpu->to_parse_keil_project(ui->project_path->text()))
|
||||
{
|
||||
update_cpu_info();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(cpu->getCpu_core_name()!="8051")
|
||||
{
|
||||
{
|
||||
|
||||
}else {
|
||||
}else {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if(cpu->getCpu_core_name()!="8051")
|
||||
{
|
||||
map= new parse_map_from_keil( ui->map_path->text(),cpu->IRAM.getBase_addr(),cpu->IRAM.getMax_size(),cpu->IROM.getBase_addr(),cpu->IROM.getMax_size());
|
||||
if(map->to_parse_map_from_keil(ui->map_path->text()))
|
||||
{
|
||||
map_calculate_size_by_address(map);
|
||||
update_map_info();
|
||||
}
|
||||
}else {
|
||||
if(cpu->getCpu_core_name()!="8051")
|
||||
{
|
||||
map= new parse_map_from_keil( ui->map_path->text(),cpu->IRAM.getBase_addr(),cpu->IRAM.getMax_size(),cpu->IROM.getBase_addr(),cpu->IROM.getMax_size());
|
||||
if(map->to_parse_map_from_keil(ui->map_path->text()))
|
||||
{
|
||||
map_calculate_size_by_address(map);
|
||||
update_map_info();
|
||||
}
|
||||
}else {
|
||||
|
||||
m51 =new parse_m51_from_keil(ui->map_path->text(),cpu->IRAM.getMax_size(),cpu->XRAM.getMax_size(),cpu->IROM.getMax_size());
|
||||
if(m51->to_parse_m51_from_keil(ui->map_path->text()))
|
||||
{
|
||||
update_m51_info();
|
||||
}
|
||||
m51 =new parse_m51_from_keil(ui->map_path->text(),cpu->IRAM.getMax_size(),cpu->XRAM.getMax_size(),cpu->IROM.getMax_size());
|
||||
if(m51->to_parse_m51_from_keil(ui->map_path->text()))
|
||||
{
|
||||
update_m51_info();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fflush(stdout);
|
||||
fflush(stdout);
|
||||
|
||||
}
|
||||
|
||||
@ -168,15 +168,15 @@ void MainWindow::map_calculate_size_by_address(parse_map_from_keil* map)
|
||||
|
||||
uint64_t recent_base=cpu->IRAM.getBase_addr()+cpu->IRAM.getMax_size();
|
||||
|
||||
for(auto recent_ram :map->ram_list)
|
||||
{
|
||||
if(recent_ram->getBase_addr()>ram->getBase_addr())
|
||||
{
|
||||
if(recent_ram->getBase_addr()-ram->getBase_addr()<recent_base-ram->getBase_addr())
|
||||
recent_base=recent_ram->getBase_addr();
|
||||
}
|
||||
for(auto recent_ram :map->ram_list)
|
||||
{
|
||||
if(recent_ram->getBase_addr()>ram->getBase_addr())
|
||||
{
|
||||
if(recent_ram->getBase_addr()-ram->getBase_addr()<recent_base-ram->getBase_addr())
|
||||
recent_base=recent_ram->getBase_addr();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ram->setMax_size(recent_base-ram->getBase_addr());
|
||||
}
|
||||
@ -187,17 +187,17 @@ void MainWindow::map_calculate_size_by_address(parse_map_from_keil* map)
|
||||
{
|
||||
|
||||
uint64_t recent_base=cpu->IROM.getBase_addr()+cpu->IROM.getMax_size();
|
||||
for(auto recent_flash :map->flash_list)
|
||||
{
|
||||
for(auto recent_flash :map->flash_list)
|
||||
{
|
||||
|
||||
if(recent_flash->getBase_addr()>flash->getBase_addr())
|
||||
{
|
||||
if(recent_flash->getBase_addr()>flash->getBase_addr())
|
||||
{
|
||||
|
||||
if(recent_flash->getBase_addr()-flash->getBase_addr()<recent_base-flash->getBase_addr())
|
||||
recent_base=recent_flash->getBase_addr();
|
||||
if(recent_flash->getBase_addr()-flash->getBase_addr()<recent_base-flash->getBase_addr())
|
||||
recent_base=recent_flash->getBase_addr();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
flash->setMax_size(recent_base-flash->getBase_addr());
|
||||
}
|
||||
}
|
||||
@ -207,16 +207,16 @@ void MainWindow::map_calculate_size_by_address(parse_map_from_keil* map)
|
||||
void MainWindow::on_btn_set_project_path_clicked()
|
||||
{
|
||||
//获取选择的目录路径
|
||||
QString selectedDir=QFileDialog::getExistingDirectory(this,"选择一个目录","./",QFileDialog::ShowDirsOnly);
|
||||
//若目录路径不为空
|
||||
if (!selectedDir.isEmpty())
|
||||
{
|
||||
//将路径中的斜杠替换为反斜杠
|
||||
selectedDir = selectedDir.replace(QRegExp("\\"), "/");
|
||||
//显示选择的目录路径
|
||||
ui->project_path->setText(selectedDir);
|
||||
ui->map_path->setText(selectedDir);
|
||||
}
|
||||
QString selectedDir=QFileDialog::getExistingDirectory(this,"选择一个目录","./",QFileDialog::ShowDirsOnly);
|
||||
//若目录路径不为空
|
||||
if (!selectedDir.isEmpty())
|
||||
{
|
||||
//将路径中的斜杠替换为反斜杠
|
||||
selectedDir = selectedDir.replace(QRegExp("\\"), "/");
|
||||
//显示选择的目录路径
|
||||
ui->project_path->setText(selectedDir);
|
||||
ui->map_path->setText(selectedDir);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -242,15 +242,15 @@ void MainWindow::set_bar_style(QProgressBar *bar,float per)
|
||||
void MainWindow::on_btn_set_map_path_clicked()
|
||||
{
|
||||
//获取选择的目录路径
|
||||
QString selectedDir=QFileDialog::getExistingDirectory(this,"选择一个目录","./",QFileDialog::ShowDirsOnly);
|
||||
//若目录路径不为空
|
||||
if (!selectedDir.isEmpty())
|
||||
{
|
||||
//将路径中的斜杠替换为反斜杠
|
||||
selectedDir = selectedDir.replace(QRegExp("\\"), "/");
|
||||
//显示选择的目录路径
|
||||
ui->map_path->setText(selectedDir);
|
||||
}
|
||||
QString selectedDir=QFileDialog::getExistingDirectory(this,"选择一个目录","./",QFileDialog::ShowDirsOnly);
|
||||
//若目录路径不为空
|
||||
if (!selectedDir.isEmpty())
|
||||
{
|
||||
//将路径中的斜杠替换为反斜杠
|
||||
selectedDir = selectedDir.replace(QRegExp("\\"), "/");
|
||||
//显示选择的目录路径
|
||||
ui->map_path->setText(selectedDir);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_update_info_clicked()
|
||||
@ -259,27 +259,27 @@ void MainWindow::on_update_info_clicked()
|
||||
|
||||
if(cpu!=nullptr)
|
||||
{
|
||||
delete cpu;
|
||||
cpu=nullptr;
|
||||
delete cpu;
|
||||
cpu=nullptr;
|
||||
}
|
||||
cpu= new parse_keil_project(ui->project_path->text());
|
||||
if(cpu->to_parse_keil_project(ui->project_path->text()))
|
||||
update_cpu_info();
|
||||
if(cpu->to_parse_keil_project(ui->project_path->text()))
|
||||
update_cpu_info();
|
||||
|
||||
if(cpu->getCpu_core_name()!="8051")
|
||||
{
|
||||
{
|
||||
|
||||
if(map!=nullptr)
|
||||
{
|
||||
delete map;
|
||||
map=nullptr;
|
||||
delete map;
|
||||
map=nullptr;
|
||||
}
|
||||
map= new parse_map_from_keil(ui->map_path->text(),cpu->IRAM.getBase_addr(),cpu->IRAM.getMax_size(),cpu->IROM.getBase_addr(),cpu->IROM.getMax_size());
|
||||
if(map->to_parse_map_from_keil(ui->map_path->text()))
|
||||
{
|
||||
map_calculate_size_by_address(map);
|
||||
map_calculate_size_by_address(map);
|
||||
|
||||
update_map_info();
|
||||
update_map_info();
|
||||
}
|
||||
}else {
|
||||
|
||||
@ -287,17 +287,17 @@ void MainWindow::on_update_info_clicked()
|
||||
|
||||
if(m51!=nullptr)
|
||||
{
|
||||
delete m51;
|
||||
m51=nullptr;
|
||||
delete m51;
|
||||
m51=nullptr;
|
||||
}
|
||||
m51 =new parse_m51_from_keil(ui->map_path->text(),cpu->IRAM.getMax_size(),cpu->XRAM.getMax_size(),cpu->IROM.getMax_size());
|
||||
|
||||
if(m51->to_parse_m51_from_keil(ui->map_path->text()))
|
||||
update_m51_info();
|
||||
if(m51->to_parse_m51_from_keil(ui->map_path->text()))
|
||||
update_m51_info();
|
||||
|
||||
}
|
||||
|
||||
fflush(stdout);
|
||||
fflush(stdout);
|
||||
|
||||
|
||||
}
|
||||
@ -307,22 +307,22 @@ void MainWindow::on_ram_table_itemSelectionChanged()
|
||||
QList<QTableWidgetItem*> selectedItems = ui->ram_table->selectedItems();
|
||||
|
||||
|
||||
// Reset all pie slices to not exploded (not highlighted)
|
||||
foreach (QPieSlice* slice, ram_pieseries->slices()) {
|
||||
slice->setExploded(false);
|
||||
slice->setLabelVisible(false);
|
||||
// Reset all pie slices to not exploded (not highlighted)
|
||||
foreach (QPieSlice* slice, ram_pieseries->slices()) {
|
||||
slice->setExploded(false);
|
||||
slice->setLabelVisible(false);
|
||||
|
||||
}
|
||||
foreach (QTableWidgetItem* item, selectedItems) {
|
||||
int row = item->row();
|
||||
// qDebug() << row;
|
||||
}
|
||||
foreach (QTableWidgetItem* item, selectedItems) {
|
||||
int row = item->row();
|
||||
// qDebug() << row;
|
||||
|
||||
QPieSlice *slice = ram_pieseries->slices().at(row);
|
||||
slice->setExploded();//突出这一块
|
||||
slice->setLabelVisible();//设置这一块可见数据
|
||||
slice->setLabelBrush(Qt::white);
|
||||
QPieSlice *slice = ram_pieseries->slices().at(row);
|
||||
slice->setExploded();//突出这一块
|
||||
slice->setLabelVisible();//设置这一块可见数据
|
||||
slice->setLabelBrush(Qt::white);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -331,23 +331,23 @@ void MainWindow::on_flash_table_itemSelectionChanged()
|
||||
QList<QTableWidgetItem*> selectedItems = ui->flash_table->selectedItems();
|
||||
|
||||
|
||||
// Reset all pie slices to not exploded (not highlighted)
|
||||
foreach (QPieSlice* slice, flash_pieseries->slices()) {
|
||||
slice->setExploded(false);
|
||||
slice->setLabelVisible(false);
|
||||
// Reset all pie slices to not exploded (not highlighted)
|
||||
foreach (QPieSlice* slice, flash_pieseries->slices()) {
|
||||
slice->setExploded(false);
|
||||
slice->setLabelVisible(false);
|
||||
|
||||
}
|
||||
foreach (QTableWidgetItem* item, selectedItems) {
|
||||
int row = item->row();
|
||||
// qDebug() << row;
|
||||
}
|
||||
foreach (QTableWidgetItem* item, selectedItems) {
|
||||
int row = item->row();
|
||||
// qDebug() << row;
|
||||
|
||||
QPieSlice *slice = flash_pieseries->slices().at(row);
|
||||
slice->setExploded();//突出这一块
|
||||
slice->setLabelVisible();//设置这一块可见数据
|
||||
slice->setLabelBrush(Qt::white);
|
||||
QPieSlice *slice = flash_pieseries->slices().at(row);
|
||||
slice->setExploded();//突出这一块
|
||||
slice->setLabelVisible();//设置这一块可见数据
|
||||
slice->setLabelBrush(Qt::white);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -390,28 +390,28 @@ void MainWindow::update_m51_info(void)
|
||||
uint16_t i;
|
||||
|
||||
|
||||
clearLayout(ui->ram_scrollAreaWidgetContents->layout());
|
||||
clearLayout(ui->ram_scrollAreaWidgetContents->layout());
|
||||
|
||||
// 移除并释放布局中的所有小部件
|
||||
|
||||
clearLayout(ui->flash_scrollAreaWidgetContents->layout());
|
||||
clearLayout(ui->flash_scrollAreaWidgetContents->layout());
|
||||
|
||||
// 移除并释放布局中的所有小部件
|
||||
for(uint64_t row_cnt=0;row_cnt<ui->ram_table->rowCount();row_cnt++)
|
||||
{
|
||||
for(uint64_t row_cnt=0;row_cnt<ui->ram_table->rowCount();row_cnt++)
|
||||
{
|
||||
|
||||
ui->ram_table->removeRow(row_cnt);
|
||||
}
|
||||
ui->ram_table->clear();
|
||||
ui->ram_table->removeRow(row_cnt);
|
||||
}
|
||||
ui->ram_table->clear();
|
||||
|
||||
ram_pieseries->clear();
|
||||
ram_pieseries->clear();
|
||||
|
||||
for(uint64_t row_cnt=0;row_cnt<ui->flash_table->rowCount();row_cnt++)
|
||||
{
|
||||
ui->flash_table->removeRow(row_cnt);
|
||||
}
|
||||
ui->flash_table->clear();
|
||||
flash_pieseries->clear();
|
||||
for(uint64_t row_cnt=0;row_cnt<ui->flash_table->rowCount();row_cnt++)
|
||||
{
|
||||
ui->flash_table->removeRow(row_cnt);
|
||||
}
|
||||
ui->flash_table->clear();
|
||||
flash_pieseries->clear();
|
||||
|
||||
for(i=0;i<m51->ram_list.size();i++)
|
||||
{
|
||||
@ -431,20 +431,20 @@ void MainWindow::update_m51_info(void)
|
||||
ui->ram_remain->setText(QString().sprintf("剩余:%.2f B",ram_all_max_size/10.0-ram_all_used_size/10.0));
|
||||
if(ram_all_max_size/10.0<=1024)
|
||||
{
|
||||
ui->ram_used->setText(QString().sprintf("占用:%.2f B / (%.2f B)",ram_all_used_size/10.0,ram_all_max_size/10.0));
|
||||
ui->ram_used->setText(QString().sprintf("占用:%.2f B / (%.2f B)",ram_all_used_size/10.0,ram_all_max_size/10.0));
|
||||
}else
|
||||
{
|
||||
ui->ram_used->setText(QString().sprintf("占用:%.2f B / (%.2f KB)",ram_all_used_size/1024.0,ram_all_max_size/10.0/1024.0));
|
||||
ui->ram_used->setText(QString().sprintf("占用:%.2f B / (%.2f KB)",ram_all_used_size/1024.0,ram_all_max_size/10.0/1024.0));
|
||||
}
|
||||
|
||||
set_bar_style(ui->ram_used_bar,ram_all_used_size/1.0/ram_all_max_size/1.0);
|
||||
set_bar_style(ui->ram_used_bar,ram_all_used_size/1.0/ram_all_max_size/1.0);
|
||||
|
||||
for(i=0;i<m51->flash_list.size();i++)
|
||||
{
|
||||
flash_all_used_size+=m51->flash_list.at(i)->getUsed_size();
|
||||
flash_all_max_size+=m51->flash_list.at(i)->getMax_size();
|
||||
if(flash_min_base_addr>m51->flash_list.at(0)->getBase_addr())
|
||||
flash_min_base_addr=m51->flash_list.at(i)->getBase_addr();
|
||||
flash_all_used_size+=m51->flash_list.at(i)->getUsed_size();
|
||||
flash_all_max_size+=m51->flash_list.at(i)->getMax_size();
|
||||
if(flash_min_base_addr>m51->flash_list.at(0)->getBase_addr())
|
||||
flash_min_base_addr=m51->flash_list.at(i)->getBase_addr();
|
||||
ui->flash_scrollAreaWidgetContents->layout()->addWidget(m51->flash_list.at(i));
|
||||
}
|
||||
|
||||
@ -454,17 +454,17 @@ set_bar_style(ui->ram_used_bar,ram_all_used_size/1.0/ram_all_max_size/1.0);
|
||||
ui->flash_remain->setText(QString().sprintf("剩余:%.2f B",flash_all_max_size/10.0-flash_all_used_size/10.0));
|
||||
if(flash_all_max_size/10.0<=1024)
|
||||
{
|
||||
ui->flash_used->setText(QString().sprintf("占用:%.2f B / (%.2f B)",flash_all_used_size/10.0,flash_all_max_size/10.0));
|
||||
ui->flash_used->setText(QString().sprintf("占用:%.2f B / (%.2f B)",flash_all_used_size/10.0,flash_all_max_size/10.0));
|
||||
}else
|
||||
{
|
||||
ui->flash_used->setText(QString().sprintf("占用:%.2f B / (%.2f KB)",flash_all_used_size/1024.0,flash_all_max_size/10.0/1024.0));
|
||||
ui->flash_used->setText(QString().sprintf("占用:%.2f B / (%.2f KB)",flash_all_used_size/1024.0,flash_all_max_size/10.0/1024.0));
|
||||
}
|
||||
set_bar_style(ui->flash_used_bar,ram_all_used_size/1.0/ram_all_max_size/1.0);
|
||||
set_bar_style(ui->flash_used_bar,ram_all_used_size/1.0/ram_all_max_size/1.0);
|
||||
|
||||
if(ui->ram_scrollArea->verticalScrollBar()!=nullptr)
|
||||
FlatUI::setScrollBarQss(ui->ram_scrollArea->verticalScrollBar(), 8, 120, 20, "##E5E5E5", "#D0D0D0", "#1ABC9C", "#E74C3C");
|
||||
if(ui->ram_scrollArea->verticalScrollBar()!=nullptr)
|
||||
FlatUI::setScrollBarQss(ui->flash_scrollArea->verticalScrollBar(), 8, 120, 20, "#E5E5E5", "#D0D0D0", "#1ABC9C", "#E74C3C");
|
||||
if(ui->ram_scrollArea->verticalScrollBar()!=nullptr)
|
||||
FlatUI::setScrollBarQss(ui->ram_scrollArea->verticalScrollBar(), 8, 120, 20, "##E5E5E5", "#D0D0D0", "#1ABC9C", "#E74C3C");
|
||||
if(ui->ram_scrollArea->verticalScrollBar()!=nullptr)
|
||||
FlatUI::setScrollBarQss(ui->flash_scrollArea->verticalScrollBar(), 8, 120, 20, "#E5E5E5", "#D0D0D0", "#1ABC9C", "#E74C3C");
|
||||
|
||||
|
||||
}
|
||||
@ -498,10 +498,10 @@ void MainWindow::setPieSliceStyle(QPieSlice* slice, qreal percentage, qreal maxP
|
||||
void MainWindow::update_map_info(void)
|
||||
{
|
||||
|
||||
if(map->ram_list.length()==0)
|
||||
return;
|
||||
if(map->flash_list.length()==0)
|
||||
return;
|
||||
if(map->ram_list.length()==0)
|
||||
return;
|
||||
if(map->flash_list.length()==0)
|
||||
return;
|
||||
uint64_t ram_all_max_size=0;
|
||||
uint64_t ram_all_used_size=0;
|
||||
uint64_t ram_min_base_addr=map->ram_list.at(0)->getBase_addr();
|
||||
@ -512,24 +512,24 @@ void MainWindow::update_map_info(void)
|
||||
uint16_t i;
|
||||
|
||||
|
||||
clearLayout(ui->ram_scrollAreaWidgetContents->layout());
|
||||
// // 移除并释放布局中的所有小部件
|
||||
clearLayout(ui->flash_scrollAreaWidgetContents->layout());
|
||||
// // 移除并释放布局中的所有小部件
|
||||
for(uint64_t row_cnt=0;row_cnt<ui->ram_table->rowCount();row_cnt++)
|
||||
{
|
||||
clearLayout(ui->ram_scrollAreaWidgetContents->layout());
|
||||
// // 移除并释放布局中的所有小部件
|
||||
clearLayout(ui->flash_scrollAreaWidgetContents->layout());
|
||||
// // 移除并释放布局中的所有小部件
|
||||
for(uint64_t row_cnt=0;row_cnt<ui->ram_table->rowCount();row_cnt++)
|
||||
{
|
||||
|
||||
ui->ram_table->removeRow(row_cnt);
|
||||
}
|
||||
ui->ram_table->clear();
|
||||
ram_pieseries->clear();
|
||||
ui->ram_table->removeRow(row_cnt);
|
||||
}
|
||||
ui->ram_table->clear();
|
||||
ram_pieseries->clear();
|
||||
|
||||
for(uint64_t row_cnt=0;row_cnt<ui->flash_table->rowCount();row_cnt++)
|
||||
{
|
||||
ui->flash_table->removeRow(row_cnt);
|
||||
}
|
||||
ui->flash_table->clear();
|
||||
flash_pieseries->clear();
|
||||
for(uint64_t row_cnt=0;row_cnt<ui->flash_table->rowCount();row_cnt++)
|
||||
{
|
||||
ui->flash_table->removeRow(row_cnt);
|
||||
}
|
||||
ui->flash_table->clear();
|
||||
flash_pieseries->clear();
|
||||
|
||||
|
||||
|
||||
@ -551,21 +551,21 @@ flash_pieseries->clear();
|
||||
ui->ram_remain->setText(QString().sprintf("剩余:%llu B",ram_all_max_size-ram_all_used_size));
|
||||
if(ram_all_max_size<=1024*1024)
|
||||
{
|
||||
ui->ram_used->setText(QString().sprintf("占用:%.2f KB / (%.2f KB)",ram_all_used_size/1024.0,ram_all_max_size/1024.0));
|
||||
ui->ram_used->setText(QString().sprintf("占用:%.2f KB / (%.2f KB)",ram_all_used_size/1024.0,ram_all_max_size/1024.0));
|
||||
}else
|
||||
{
|
||||
ui->ram_used->setText(QString().sprintf("占用:%.4f MB / (%.4f MB)",ram_all_used_size/1024.0/1024.0,ram_all_max_size/1024.0/1024.0));
|
||||
ui->ram_used->setText(QString().sprintf("占用:%.4f MB / (%.4f MB)",ram_all_used_size/1024.0/1024.0,ram_all_max_size/1024.0/1024.0));
|
||||
}
|
||||
|
||||
set_bar_style(ui->ram_used_bar,ram_all_used_size/1.0/ram_all_max_size/1.0);
|
||||
set_bar_style(ui->ram_used_bar,ram_all_used_size/1.0/ram_all_max_size/1.0);
|
||||
|
||||
|
||||
for(i=0;i<map->flash_list.size();i++)
|
||||
{
|
||||
flash_all_used_size+=map->flash_list.at(i)->getUsed_size();
|
||||
flash_all_max_size+=map->flash_list.at(i)->getMax_size();
|
||||
if(flash_min_base_addr>map->flash_list.at(0)->getBase_addr())
|
||||
flash_min_base_addr=map->flash_list.at(i)->getBase_addr();
|
||||
flash_all_used_size+=map->flash_list.at(i)->getUsed_size();
|
||||
flash_all_max_size+=map->flash_list.at(i)->getMax_size();
|
||||
if(flash_min_base_addr>map->flash_list.at(0)->getBase_addr())
|
||||
flash_min_base_addr=map->flash_list.at(i)->getBase_addr();
|
||||
ui->flash_scrollAreaWidgetContents->layout()->addWidget(map->flash_list.at(i));
|
||||
}
|
||||
|
||||
@ -575,10 +575,10 @@ set_bar_style(ui->ram_used_bar,ram_all_used_size/1.0/ram_all_max_size/1.0);
|
||||
ui->flash_remain->setText(QString().sprintf("剩余:%llu B",flash_all_max_size-flash_all_used_size));
|
||||
if(flash_all_max_size<=1024*1024)
|
||||
{
|
||||
ui->flash_used->setText(QString().sprintf("占用:%.2f KB / (%.2f KB)",flash_all_used_size/1024.0,flash_all_max_size/1024.0));
|
||||
ui->flash_used->setText(QString().sprintf("占用:%.2f KB / (%.2f KB)",flash_all_used_size/1024.0,flash_all_max_size/1024.0));
|
||||
}else
|
||||
{
|
||||
ui->flash_used->setText(QString().sprintf("占用:%.4f MB / (%.4f MB)",flash_all_used_size/1024.0/1024.0,flash_all_max_size/1024.0/1024.0));
|
||||
ui->flash_used->setText(QString().sprintf("占用:%.4f MB / (%.4f MB)",flash_all_used_size/1024.0/1024.0,flash_all_max_size/1024.0/1024.0));
|
||||
}
|
||||
|
||||
set_bar_style(ui->flash_used_bar,flash_all_used_size/1.0/flash_all_max_size/1.0);
|
||||
@ -586,36 +586,36 @@ set_bar_style(ui->ram_used_bar,ram_all_used_size/1.0/ram_all_max_size/1.0);
|
||||
|
||||
|
||||
|
||||
QList <image_item_t*> info_lsit= map->getInfo_list();
|
||||
uint64_t all_ram_size = map->getAll_ram_size();
|
||||
uint64_t all_flash_size =map->getAll_flash_size();
|
||||
QList <image_item_t*> info_lsit= map->getInfo_list();
|
||||
uint64_t all_ram_size = map->getAll_ram_size();
|
||||
uint64_t all_flash_size =map->getAll_flash_size();
|
||||
uint64_t ram_row=0;
|
||||
uint64_t flash_row=0;
|
||||
for(auto item:info_lsit)
|
||||
{
|
||||
if(item->RW_Data.toUInt()+item->ZI_Data.toUInt()!=0)
|
||||
{
|
||||
writeTableData(ram_table,ram_row,0,item->Object_Name);
|
||||
writeTableData(ram_table,ram_row,1,QString::number(item->RW_Data.toUInt()+item->ZI_Data.toUInt()));
|
||||
writeTableData(ram_table,ram_row,3,item->RW_Data);
|
||||
writeTableData(ram_table,ram_row,4,item->ZI_Data);
|
||||
all_ram_size+=item->RW_Data.toUInt()+item->ZI_Data.toUInt();
|
||||
ram_row++;
|
||||
}
|
||||
for(auto item:info_lsit)
|
||||
{
|
||||
if(item->RW_Data.toUInt()+item->ZI_Data.toUInt()!=0)
|
||||
{
|
||||
writeTableData(ram_table,ram_row,0,item->Object_Name);
|
||||
writeTableData(ram_table,ram_row,1,QString::number(item->RW_Data.toUInt()+item->ZI_Data.toUInt()));
|
||||
writeTableData(ram_table,ram_row,3,item->RW_Data);
|
||||
writeTableData(ram_table,ram_row,4,item->ZI_Data);
|
||||
all_ram_size+=item->RW_Data.toUInt()+item->ZI_Data.toUInt();
|
||||
ram_row++;
|
||||
}
|
||||
|
||||
if(item->Code.toUInt()+item->RO_Data.toUInt()+item->RW_Data.toUInt()!=0)
|
||||
{
|
||||
if(item->Code.toUInt()+item->RO_Data.toUInt()+item->RW_Data.toUInt()!=0)
|
||||
{
|
||||
|
||||
|
||||
writeTableData(flash_table,flash_row,0,item->Object_Name);
|
||||
writeTableData(flash_table,flash_row,1,QString::number(item->Code.toUInt()+item->RO_Data.toUInt()+item->RW_Data.toUInt()));
|
||||
writeTableData(flash_table,flash_row,3,item->Code);
|
||||
writeTableData(flash_table,flash_row,4,item->RO_Data);
|
||||
writeTableData(flash_table,flash_row,5,item->RW_Data);
|
||||
all_flash_size+=item->Code.toUInt()+item->RO_Data.toUInt()+item->RW_Data.toUInt();
|
||||
flash_row++;
|
||||
}
|
||||
}
|
||||
writeTableData(flash_table,flash_row,0,item->Object_Name);
|
||||
writeTableData(flash_table,flash_row,1,QString::number(item->Code.toUInt()+item->RO_Data.toUInt()+item->RW_Data.toUInt()));
|
||||
writeTableData(flash_table,flash_row,3,item->Code);
|
||||
writeTableData(flash_table,flash_row,4,item->RO_Data);
|
||||
writeTableData(flash_table,flash_row,5,item->RW_Data);
|
||||
all_flash_size+=item->Code.toUInt()+item->RO_Data.toUInt()+item->RW_Data.toUInt();
|
||||
flash_row++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -630,47 +630,47 @@ set_bar_style(ui->ram_used_bar,ram_all_used_size/1.0/ram_all_max_size/1.0);
|
||||
|
||||
|
||||
|
||||
for(uint64_t row_cnt=0;row_cnt<ui->ram_table->rowCount();row_cnt++)
|
||||
{
|
||||
writeTableData(ram_table,row_cnt,2,QString().sprintf("%05.2f%%",ui->ram_table->item(row_cnt,1)->text().toUInt()*100.0/all_ram_size/1.0));
|
||||
}
|
||||
for(uint64_t row_cnt=0;row_cnt<ui->ram_table->rowCount();row_cnt++)
|
||||
{
|
||||
writeTableData(ram_table,row_cnt,2,QString().sprintf("%05.2f%%",ui->ram_table->item(row_cnt,1)->text().toUInt()*100.0/all_ram_size/1.0));
|
||||
}
|
||||
|
||||
for(uint64_t row_cnt=0;row_cnt<ui->flash_table->rowCount();row_cnt++)
|
||||
{
|
||||
writeTableData(flash_table,row_cnt,2,QString().sprintf("%05.2f%%",ui->flash_table->item(row_cnt,1)->text().toUInt()*100.0/all_flash_size/1.0));
|
||||
}
|
||||
for(uint64_t row_cnt=0;row_cnt<ui->flash_table->rowCount();row_cnt++)
|
||||
{
|
||||
writeTableData(flash_table,row_cnt,2,QString().sprintf("%05.2f%%",ui->flash_table->item(row_cnt,1)->text().toUInt()*100.0/all_flash_size/1.0));
|
||||
}
|
||||
|
||||
ui->ram_table->sortByColumn(2,Qt::SortOrder::DescendingOrder);
|
||||
ui->flash_table->sortByColumn(2,Qt::SortOrder::DescendingOrder);
|
||||
ui->ram_table->sortByColumn(2,Qt::SortOrder::DescendingOrder);
|
||||
ui->flash_table->sortByColumn(2,Qt::SortOrder::DescendingOrder);
|
||||
|
||||
|
||||
|
||||
for(uint64_t row_cnt=0;row_cnt<ui->ram_table->rowCount();row_cnt++)
|
||||
{
|
||||
for(uint64_t row_cnt=0;row_cnt<ui->ram_table->rowCount();row_cnt++)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
QPieSlice *slice =ram_pieseries->append(ui->ram_table->item(row_cnt,0)->text()+":"+ui->ram_table->item(row_cnt,2)->text(),ui->ram_table->item(row_cnt,1)->text().toUInt());
|
||||
QPieSlice *slice =ram_pieseries->append(ui->ram_table->item(row_cnt,0)->text()+":"+ui->ram_table->item(row_cnt,2)->text(),ui->ram_table->item(row_cnt,1)->text().toUInt());
|
||||
|
||||
setPieSliceStyle(slice,ui->ram_table->item(row_cnt,2)->text().split("%")[0].toFloat(),ui->ram_table->item(0,2)->text().split("%")[0].toFloat());
|
||||
setPieSliceStyle(slice,ui->ram_table->item(row_cnt,2)->text().split("%")[0].toFloat(),ui->ram_table->item(0,2)->text().split("%")[0].toFloat());
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
for(uint64_t row_cnt=0;row_cnt<ui->flash_table->rowCount();row_cnt++)
|
||||
{
|
||||
QPieSlice *slice =flash_pieseries->append(ui->flash_table->item(row_cnt,0)->text()+":"+ui->flash_table->item(row_cnt,2)->text(),ui->flash_table->item(row_cnt,1)->text().toUInt());
|
||||
setPieSliceStyle(slice,ui->flash_table->item(row_cnt,2)->text().split("%")[0].toFloat(),ui->flash_table->item(0,2)->text().split("%")[0].toFloat());
|
||||
for(uint64_t row_cnt=0;row_cnt<ui->flash_table->rowCount();row_cnt++)
|
||||
{
|
||||
QPieSlice *slice =flash_pieseries->append(ui->flash_table->item(row_cnt,0)->text()+":"+ui->flash_table->item(row_cnt,2)->text(),ui->flash_table->item(row_cnt,1)->text().toUInt());
|
||||
setPieSliceStyle(slice,ui->flash_table->item(row_cnt,2)->text().split("%")[0].toFloat(),ui->flash_table->item(0,2)->text().split("%")[0].toFloat());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(ui->ram_scrollArea->verticalScrollBar()!=nullptr)
|
||||
FlatUI::setScrollBarQss(ui->ram_scrollArea->verticalScrollBar(), 8, 120, 20, "#E5E5E5", "#D0D0D0", "#1ABC9C", "#E74C3C");
|
||||
if(ui->ram_scrollArea->verticalScrollBar()!=nullptr)
|
||||
FlatUI::setScrollBarQss(ui->flash_scrollArea->verticalScrollBar(), 8, 120, 20, "#E5E5E5", "#D0D0D0", "#1ABC9C", "#E74C3C");
|
||||
if(ui->ram_scrollArea->verticalScrollBar()!=nullptr)
|
||||
FlatUI::setScrollBarQss(ui->ram_scrollArea->verticalScrollBar(), 8, 120, 20, "#E5E5E5", "#D0D0D0", "#1ABC9C", "#E74C3C");
|
||||
if(ui->ram_scrollArea->verticalScrollBar()!=nullptr)
|
||||
FlatUI::setScrollBarQss(ui->flash_scrollArea->verticalScrollBar(), 8, 120, 20, "#E5E5E5", "#D0D0D0", "#1ABC9C", "#E74C3C");
|
||||
|
||||
|
||||
}
|
||||
@ -685,69 +685,69 @@ set_bar_style(ui->ram_used_bar,ram_all_used_size/1.0/ram_all_max_size/1.0);
|
||||
|
||||
|
||||
QString MainWindow::readTableData(ui_table_t table,int row, int column)
|
||||
{
|
||||
QString data;
|
||||
QTableWidget* tableWidget ;
|
||||
if( table==ram_table)tableWidget=ui->ram_table;
|
||||
else tableWidget=ui->flash_table;
|
||||
{
|
||||
QString data;
|
||||
QTableWidget* tableWidget ;
|
||||
if( table==ram_table)tableWidget=ui->ram_table;
|
||||
else tableWidget=ui->flash_table;
|
||||
|
||||
if (row < tableWidget->rowCount() && column <tableWidget->columnCount()) {
|
||||
QTableWidgetItem *item =tableWidget->item(row, column);
|
||||
if (item) {
|
||||
data = item->text();
|
||||
// qDebug() << "Data at (" << row << ", " << column << "): " << data;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
if (row < tableWidget->rowCount() && column <tableWidget->columnCount()) {
|
||||
QTableWidgetItem *item =tableWidget->item(row, column);
|
||||
if (item) {
|
||||
data = item->text();
|
||||
// qDebug() << "Data at (" << row << ", " << column << "): " << data;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::writeTableData(ui_table_t table,int row, int column, const QString &data)
|
||||
{
|
||||
void MainWindow::writeTableData(ui_table_t table,int row, int column, const QString &data)
|
||||
{
|
||||
|
||||
|
||||
QTableWidget* tableWidget=nullptr;
|
||||
if (table == ram_table)
|
||||
{
|
||||
QTableWidget* tableWidget=nullptr;
|
||||
if (table == ram_table)
|
||||
{
|
||||
|
||||
tableWidget=ui->ram_table;
|
||||
tableWidget=ui->ram_table;
|
||||
|
||||
}
|
||||
else if (table == flash_table)
|
||||
{
|
||||
tableWidget = ui->flash_table;
|
||||
}
|
||||
else if (table == flash_table)
|
||||
{
|
||||
tableWidget = ui->flash_table;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "Invalid table specified.";
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "Invalid table specified.";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (row >= tableWidget->rowCount())
|
||||
{
|
||||
tableWidget->setRowCount(row + 1);
|
||||
}
|
||||
if (column >= tableWidget->columnCount())
|
||||
{
|
||||
tableWidget->setColumnCount(column + 1);
|
||||
}
|
||||
if (row >= tableWidget->rowCount())
|
||||
{
|
||||
tableWidget->setRowCount(row + 1);
|
||||
}
|
||||
if (column >= tableWidget->columnCount())
|
||||
{
|
||||
tableWidget->setColumnCount(column + 1);
|
||||
}
|
||||
|
||||
if (!tableWidget->item(row, column))
|
||||
{
|
||||
QTableWidgetItem *newItem = new QTableWidgetItem(data);
|
||||
tableWidget->setItem(row, column, newItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
tableWidget->item(row, column)->setText(data);
|
||||
}
|
||||
if (!tableWidget->item(row, column))
|
||||
{
|
||||
QTableWidgetItem *newItem = new QTableWidgetItem(data);
|
||||
tableWidget->setItem(row, column, newItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
tableWidget->item(row, column)->setText(data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -812,6 +812,11 @@ void MainWindow::on_btnMenu_Close_clicked()
|
||||
|
||||
void MainWindow::on_gitee_index_clicked()
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl("https://gitee.com/nikolan")); // Change the URL to the desired webpage
|
||||
QDesktopServices::openUrl(QUrl("https://gitee.com/nikolan"));
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::on_icon_clicked()
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl("https://gitee.com/nikolan/keil_development_assistant"));
|
||||
}
|
||||
|
31
mainwindow.h
31
mainwindow.h
@ -24,27 +24,27 @@ class MainWindow : public FramelessMainWindow
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
void winow_on_top(bool is_top);
|
||||
void winow_on_top(bool is_top);
|
||||
void setPieSliceStyle(QPieSlice* slice, qreal percentage, qreal maxPercentage);
|
||||
void set_bar_style(QProgressBar *bar,float per);
|
||||
void update_cpu_info(void);
|
||||
void update_map_info(void);
|
||||
void update_m51_info(void);
|
||||
QString readTableData(ui_table_t table,int row, int column);
|
||||
void writeTableData(ui_table_t table,int row, int column, const QString &data);
|
||||
void map_calculate_size_by_address(parse_map_from_keil* map);
|
||||
Ui::MainWindow *ui;
|
||||
void set_bar_style(QProgressBar *bar,float per);
|
||||
void update_cpu_info(void);
|
||||
void update_map_info(void);
|
||||
void update_m51_info(void);
|
||||
QString readTableData(ui_table_t table,int row, int column);
|
||||
void writeTableData(ui_table_t table,int row, int column, const QString &data);
|
||||
void map_calculate_size_by_address(parse_map_from_keil* map);
|
||||
Ui::MainWindow *ui;
|
||||
|
||||
QPieSeries *ram_pieseries=nullptr;
|
||||
QPieSeries *flash_pieseries=nullptr;
|
||||
QChart* ram_chart=nullptr;
|
||||
QChart* flash_chart=nullptr;
|
||||
QPieSeries *ram_pieseries=nullptr;
|
||||
QPieSeries *flash_pieseries=nullptr;
|
||||
QChart* ram_chart=nullptr;
|
||||
QChart* flash_chart=nullptr;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
void clearLayout(QLayout* layout);
|
||||
|
||||
void clearLayout(QLayout* layout);
|
||||
parse_keil_project* cpu=nullptr;
|
||||
parse_map_from_keil* map=nullptr;
|
||||
parse_m51_from_keil* m51=nullptr;
|
||||
@ -64,6 +64,7 @@ private slots:
|
||||
void on_ram_table_itemSelectionChanged();
|
||||
void on_flash_table_itemSelectionChanged();
|
||||
void on_gitee_index_clicked();
|
||||
void on_icon_clicked();
|
||||
};
|
||||
extern MainWindow* main_window;
|
||||
#endif // MAINWINDOW_H
|
||||
|
@ -460,7 +460,7 @@ color: rgb(255, 255, 255);
|
||||
</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="bulid_info">
|
||||
<attribute name="title">
|
||||
|
@ -22,7 +22,7 @@ only_run_by_file::only_run_by_file(QObject *parent) : QObject(parent),
|
||||
|
||||
|
||||
// 检测 run 文件是否存在的定时器
|
||||
timer = new QTimer(this);
|
||||
timer = new QTimer(this);
|
||||
connect(timer, &QTimer::timeout, this, &only_run_by_file::checkRunFile);
|
||||
timer->start(800); // 每 800 毫秒执行一次检测
|
||||
}
|
||||
@ -66,7 +66,7 @@ void only_run_by_file::checkRunFile()
|
||||
// 检测 run 文件是否存在
|
||||
if (!QFile::exists(runFileName)) {
|
||||
// 文件不存在,采集关闭操作并创建 close 文件
|
||||
deleteCloseFile();
|
||||
deleteCloseFile();
|
||||
// 创建 close 文件
|
||||
createCloseFile();
|
||||
emit runFileDeleted();
|
||||
@ -86,9 +86,9 @@ void only_run_by_file::checkCloseFile()
|
||||
// 发出信号,通知检测到 close 文件
|
||||
closeTimer->stop();
|
||||
// 如果 close 文件已经存在,则删除
|
||||
deleteCloseFile();
|
||||
// 创建 run 文件
|
||||
createRunFile();
|
||||
deleteCloseFile();
|
||||
// 创建 run 文件
|
||||
createRunFile();
|
||||
|
||||
|
||||
|
||||
@ -101,10 +101,10 @@ void only_run_by_file::checkCloseFile()
|
||||
{
|
||||
cnt=0;
|
||||
// 如果 close 文件已经存在,则删除
|
||||
deleteCloseFile();
|
||||
// 创建 run 文件
|
||||
createRunFile();
|
||||
emit closeFileDetected();
|
||||
deleteCloseFile();
|
||||
// 创建 run 文件
|
||||
createRunFile();
|
||||
emit closeFileDetected();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,14 +19,14 @@ private:
|
||||
void createRunFile();
|
||||
void deleteCloseFile();
|
||||
void deleteRunFile();
|
||||
QTimer* closeTimer;
|
||||
QTimer* timer ;
|
||||
QTimer* closeTimer;
|
||||
QTimer* timer ;
|
||||
signals:
|
||||
void runFileDeleted();
|
||||
void closeFileDetected();
|
||||
|
||||
public slots:
|
||||
void checkRunFile();
|
||||
void checkCloseFile();
|
||||
void checkCloseFile();
|
||||
};
|
||||
#endif // ONLY_RUN_BY_FILE_H
|
||||
|
@ -14,7 +14,7 @@
|
||||
QString parse_keil_project::find_project_path(const QString& dir_path)
|
||||
{
|
||||
|
||||
return find_path::find_file_path(dir_path,".uvproj");
|
||||
return find_path::find_file_path(dir_path,".uvproj");
|
||||
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ parse_keil_project::parse_keil_project(QString path)
|
||||
XRAM.setName("XRAM");
|
||||
IROM.setName("IROM");
|
||||
|
||||
// to_parse_keil_project(path);
|
||||
// to_parse_keil_project(path);
|
||||
|
||||
|
||||
|
||||
@ -41,20 +41,20 @@ bool parse_keil_project::to_parse_keil_project(QString path)
|
||||
|
||||
if(path.contains(".uvproj"))
|
||||
{
|
||||
parse_project_file(path);
|
||||
return true;
|
||||
parse_project_file(path);
|
||||
return true;
|
||||
}
|
||||
|
||||
file_path=find_project_path(project_path);
|
||||
qDebug()<<file_path;
|
||||
qDebug()<<file_path;
|
||||
if(file_path.length()<3)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
parse_project_file(file_path);
|
||||
return true;
|
||||
parse_project_file(file_path);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ bool parse_keil_project::parse_info_item_storage(const QString& info_item,use_pe
|
||||
|
||||
data_cnt==0;
|
||||
for(auto info:info_list)
|
||||
{
|
||||
{
|
||||
info.remove(QChar(','), Qt::CaseInsensitive);//去除","
|
||||
info.remove(QChar(')'), Qt::CaseInsensitive);//去除")"
|
||||
info.remove(QChar('x'), Qt::CaseInsensitive);//去除"0x"的'x'
|
||||
@ -154,49 +154,49 @@ bool parse_keil_project::parse_info_item_storage(const QString& info_item,use_pe
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
qDebug()<<QString().sprintf("%s base:%#x size:%.2f KB",storage.getName().toStdString().data(), storage.getBase_addr(),storage.getMax_size()/1024.0);
|
||||
qDebug()<<QString().sprintf("%s base:%#x size:%.2f KB",storage.getName().toStdString().data(), storage.getBase_addr(),storage.getMax_size()/1024.0);
|
||||
|
||||
}
|
||||
|
||||
bool parse_keil_project::parse_cpu_info(const QString& cpu_info)
|
||||
{
|
||||
|
||||
QStringList cpu_info_list = cpu_info.split(")");
|
||||
QStringList cpu_info_list = cpu_info.split(")");
|
||||
|
||||
|
||||
for(auto info_item:cpu_info_list)
|
||||
{
|
||||
// qDebug()<<info_item;
|
||||
if(info_item.contains("IRAM"))//包含"IRAM"字段
|
||||
{
|
||||
parse_info_item_storage(info_item,IRAM);
|
||||
}
|
||||
else if(info_item.contains("XRAM"))//包含"XRAM"字段
|
||||
{
|
||||
parse_info_item_storage(info_item,XRAM);
|
||||
}
|
||||
else if(info_item.contains("IROM"))
|
||||
{
|
||||
parse_info_item_storage(info_item,IROM);
|
||||
}
|
||||
else if(info_item.contains("CPUTYPE"))
|
||||
{
|
||||
parse_info_item_core_name(info_item);
|
||||
qDebug()<<"core:"<<cpu_core_name;
|
||||
}
|
||||
else if(info_item.contains("CLOCK"))
|
||||
{
|
||||
parse_info_item_max_clock(info_item);
|
||||
qDebug()<<"main_clock:"<<cpu_max_clock<<"MHz";
|
||||
}
|
||||
for(auto info_item:cpu_info_list)
|
||||
{
|
||||
// qDebug()<<info_item;
|
||||
if(info_item.contains("IRAM"))//包含"IRAM"字段
|
||||
{
|
||||
parse_info_item_storage(info_item,IRAM);
|
||||
}
|
||||
else if(info_item.contains("XRAM"))//包含"XRAM"字段
|
||||
{
|
||||
parse_info_item_storage(info_item,XRAM);
|
||||
}
|
||||
else if(info_item.contains("IROM"))
|
||||
{
|
||||
parse_info_item_storage(info_item,IROM);
|
||||
}
|
||||
else if(info_item.contains("CPUTYPE"))
|
||||
{
|
||||
parse_info_item_core_name(info_item);
|
||||
qDebug()<<"core:"<<cpu_core_name;
|
||||
}
|
||||
else if(info_item.contains("CLOCK"))
|
||||
{
|
||||
parse_info_item_max_clock(info_item);
|
||||
qDebug()<<"main_clock:"<<cpu_max_clock<<"MHz";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -206,55 +206,55 @@ bool parse_keil_project::parse_cpu_info(const QString& cpu_info)
|
||||
bool parse_keil_project::parse_project_file(QString path)
|
||||
{
|
||||
QFile file(path);
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
qDebug()<<"open fail"<<endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
QXmlStreamReader reader(&file);
|
||||
while(!reader.atEnd())
|
||||
{
|
||||
|
||||
if(reader.isStartElement())
|
||||
{
|
||||
qDebug()<<"open fail"<<endl;
|
||||
return 0;
|
||||
}
|
||||
// qDebug()<<"<"<<reader.name();
|
||||
|
||||
QXmlStreamReader reader(&file);
|
||||
while(!reader.atEnd())
|
||||
{
|
||||
if("Cpu"==reader.name())
|
||||
{
|
||||
|
||||
if(reader.isStartElement())
|
||||
{
|
||||
// qDebug()<<"<"<<reader.name();
|
||||
parse_cpu_info(reader.readElementText());
|
||||
|
||||
if("Cpu"==reader.name())
|
||||
{
|
||||
}else if("Device"==reader.name())
|
||||
{
|
||||
|
||||
parse_cpu_info(reader.readElementText());
|
||||
cpu_name=(reader.readElementText());
|
||||
|
||||
}else if("Device"==reader.name())
|
||||
{
|
||||
}else if("ToolsetName" ==reader.name())
|
||||
{
|
||||
|
||||
cpu_name=(reader.readElementText());
|
||||
if(reader.readElementText().contains("MCS-51"))
|
||||
cpu_core_name="8051";
|
||||
|
||||
}else if("ToolsetName" ==reader.name())
|
||||
{
|
||||
}
|
||||
|
||||
if(reader.readElementText().contains("MCS-51"))
|
||||
cpu_core_name="8051";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
if(reader.isEndElement())
|
||||
{
|
||||
// qDebug()<<">"<<reader.name();
|
||||
}
|
||||
|
||||
reader.readNext();
|
||||
|
||||
|
||||
}
|
||||
if (reader.hasError())
|
||||
if(reader.isEndElement())
|
||||
{
|
||||
qDebug()<<reader.errorString();
|
||||
// qDebug()<<">"<<reader.name();
|
||||
}
|
||||
|
||||
file.close();
|
||||
reader.readNext();
|
||||
|
||||
|
||||
}
|
||||
if (reader.hasError())
|
||||
{
|
||||
qDebug()<<reader.errorString();
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
}
|
||||
|
@ -37,12 +37,12 @@ public:
|
||||
private:
|
||||
QString project_path;
|
||||
// uint64_t iram_base;
|
||||
// uint64_t xram_base;
|
||||
// uint64_t irom_base;
|
||||
// uint64_t iram_size;
|
||||
// uint64_t xram_size;
|
||||
// uint64_t irom_size;
|
||||
QString cpu_name;
|
||||
// uint64_t xram_base;
|
||||
// uint64_t irom_base;
|
||||
// uint64_t iram_size;
|
||||
// uint64_t xram_size;
|
||||
// uint64_t irom_size;
|
||||
QString cpu_name;
|
||||
QString cpu_core_name;
|
||||
uint64_t cpu_max_clock;
|
||||
|
||||
|
@ -12,9 +12,9 @@ parse_m51_from_keil::parse_m51_from_keil(QString path,uint64_t iram_max_size,uin
|
||||
uint64_t irom_max_size)
|
||||
{
|
||||
|
||||
iram_max=iram_max_size;
|
||||
xram_max=xram_max_size;
|
||||
irom_max=irom_max_size;
|
||||
iram_max=iram_max_size;
|
||||
xram_max=xram_max_size;
|
||||
irom_max=irom_max_size;
|
||||
|
||||
|
||||
}
|
||||
@ -24,16 +24,16 @@ bool parse_m51_from_keil::to_parse_m51_from_keil(QString path)
|
||||
|
||||
|
||||
QString file_path=find_m51_path(path);
|
||||
qDebug()<<file_path;
|
||||
qDebug()<<file_path;
|
||||
if(file_path.length()>3){
|
||||
|
||||
parse_m51_file(file_path);
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
qDebug()<<"路径错误,请检测输入的工程路径!";
|
||||
|
||||
QMessageBox::critical(nullptr, "Error", "路径错误,请检测输入的工程路径!");
|
||||
QMessageBox::critical(nullptr, "Error", "路径错误,请检测输入的工程路径!");
|
||||
|
||||
|
||||
return false;
|
||||
@ -44,12 +44,12 @@ QString parse_m51_from_keil::find_m51_path(const QString &dir_path)
|
||||
{
|
||||
|
||||
|
||||
QString m51_file_path;
|
||||
m51_file_path=find_path::find_file_path(dir_path,".m51");
|
||||
if(m51_file_path.length()<3)
|
||||
m51_file_path=find_path::find_file_path(dir_path,".M51");
|
||||
QString m51_file_path;
|
||||
m51_file_path=find_path::find_file_path(dir_path,".m51");
|
||||
if(m51_file_path.length()<3)
|
||||
m51_file_path=find_path::find_file_path(dir_path,".M51");
|
||||
|
||||
return m51_file_path;
|
||||
return m51_file_path;
|
||||
}
|
||||
|
||||
bool parse_m51_from_keil::parse_m51_file(QString path)
|
||||
@ -61,126 +61,126 @@ bool parse_m51_from_keil::parse_m51_file(QString path)
|
||||
irom=new use_percentage_bar(nullptr);
|
||||
|
||||
|
||||
iram->setName("iram");
|
||||
iram->setStorage(mc8051);
|
||||
iram->setBase_addr(0);
|
||||
xram->setName("xram");
|
||||
xram->setStorage(mc8051);
|
||||
xram->setBase_addr(0);
|
||||
xram->setMax_size(0);
|
||||
iram->setName("iram");
|
||||
iram->setStorage(mc8051);
|
||||
iram->setBase_addr(0);
|
||||
xram->setName("xram");
|
||||
xram->setStorage(mc8051);
|
||||
xram->setBase_addr(0);
|
||||
xram->setMax_size(0);
|
||||
|
||||
irom->setName("irom");
|
||||
irom->setStorage(mc8051);
|
||||
irom->setBase_addr(0);
|
||||
irom->setName("irom");
|
||||
irom->setStorage(mc8051);
|
||||
irom->setBase_addr(0);
|
||||
|
||||
iram->setMax_size(iram_max*10.0);
|
||||
iram->setMax_size(iram_max*10.0);
|
||||
|
||||
xram->setMax_size(xram_max*10.0);
|
||||
xram->setMax_size(xram_max*10.0);
|
||||
|
||||
irom->setMax_size(irom_max*10.0);
|
||||
irom->setMax_size(irom_max*10.0);
|
||||
|
||||
|
||||
bool is_Image_component_sizes=false;
|
||||
bool is_Totals=false;
|
||||
|
||||
// info_list.clear();
|
||||
// info_list.clear();
|
||||
|
||||
for(auto ram:ram_list)
|
||||
{
|
||||
delete ram;
|
||||
}
|
||||
ram_list.clear();
|
||||
for(auto ram:ram_list)
|
||||
{
|
||||
delete ram;
|
||||
}
|
||||
ram_list.clear();
|
||||
|
||||
for(auto flash:flash_list)
|
||||
{
|
||||
delete flash;
|
||||
}
|
||||
for(auto flash:flash_list)
|
||||
{
|
||||
delete flash;
|
||||
}
|
||||
|
||||
flash_list.clear();
|
||||
flash_list.clear();
|
||||
|
||||
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
qDebug()<<"open fail"<<endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
while (!file.atEnd())
|
||||
{
|
||||
QByteArray line = file.readLine();
|
||||
QString str(line);
|
||||
|
||||
if(str.contains("Program Size"))
|
||||
{
|
||||
qDebug()<<"open fail"<<endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// qDebug() << str;
|
||||
// parse_excution_region_info(str);
|
||||
|
||||
while (!file.atEnd())
|
||||
{
|
||||
QByteArray line = file.readLine();
|
||||
QString str(line);
|
||||
QStringList str_list= str.split(" ");
|
||||
|
||||
if(str.contains("Program Size"))
|
||||
for(int i=0;i<str_list.length();i++)
|
||||
{
|
||||
|
||||
// qDebug() << str;
|
||||
// parse_excution_region_info(str);
|
||||
|
||||
QStringList str_list= str.split(" ");
|
||||
|
||||
for(int i=0;i<str_list.length();i++)
|
||||
{
|
||||
// qDebug() << str_list[i];
|
||||
if(str_list[i].contains("xdata"))
|
||||
{
|
||||
xram->setUsed_size((str_list[i].split("=")[1].toFloat())*10.0);
|
||||
xram->setRemain_size(xram->getMax_size()-xram->getUsed_size());
|
||||
}else if(str_list[i].contains("XDATA"))
|
||||
{
|
||||
xram->setUsed_size((str_list[i].split("=")[1].toFloat())*10.0);
|
||||
xram->setRemain_size(xram->getMax_size()-xram->getUsed_size());
|
||||
}else if(str_list[i].contains("data"))
|
||||
{
|
||||
// qDebug() << str_list[i];
|
||||
if(str_list[i].contains("xdata"))
|
||||
{
|
||||
xram->setUsed_size((str_list[i].split("=")[1].toFloat())*10.0);
|
||||
xram->setRemain_size(xram->getMax_size()-xram->getUsed_size());
|
||||
}else if(str_list[i].contains("XDATA"))
|
||||
{
|
||||
xram->setUsed_size((str_list[i].split("=")[1].toFloat())*10.0);
|
||||
xram->setRemain_size(xram->getMax_size()-xram->getUsed_size());
|
||||
}else if(str_list[i].contains("data"))
|
||||
{
|
||||
|
||||
|
||||
iram->setUsed_size((str_list[i].split("=")[1].toFloat())*10.0);
|
||||
iram->setRemain_size(iram->getMax_size()-iram->getUsed_size());
|
||||
}else if(str_list[i].contains("DATA"))
|
||||
{
|
||||
iram->setUsed_size((str_list[i].split("=")[1].toFloat())*10.0);
|
||||
iram->setRemain_size(iram->getMax_size()-iram->getUsed_size());
|
||||
}else if(str_list[i].contains("code"))
|
||||
{
|
||||
irom->setUsed_size((str_list[i].split("=")[1].toFloat())*10.0);
|
||||
irom->setRemain_size(irom->getMax_size()-irom->getUsed_size());
|
||||
}else if(str_list[i].contains("code"))
|
||||
{
|
||||
irom->setUsed_size((str_list[i].split("=")[1].toFloat())*10.0);
|
||||
irom->setRemain_size(irom->getMax_size()-irom->getUsed_size());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
iram->setUsed_size((str_list[i].split("=")[1].toFloat())*10.0);
|
||||
iram->setRemain_size(iram->getMax_size()-iram->getUsed_size());
|
||||
}else if(str_list[i].contains("DATA"))
|
||||
{
|
||||
iram->setUsed_size((str_list[i].split("=")[1].toFloat())*10.0);
|
||||
iram->setRemain_size(iram->getMax_size()-iram->getUsed_size());
|
||||
}else if(str_list[i].contains("code"))
|
||||
{
|
||||
irom->setUsed_size((str_list[i].split("=")[1].toFloat())*10.0);
|
||||
irom->setRemain_size(irom->getMax_size()-irom->getUsed_size());
|
||||
}else if(str_list[i].contains("code"))
|
||||
{
|
||||
irom->setUsed_size((str_list[i].split("=")[1].toFloat())*10.0);
|
||||
irom->setRemain_size(irom->getMax_size()-irom->getUsed_size());
|
||||
}
|
||||
|
||||
}
|
||||
// else if(str.contains("Image component sizes"))
|
||||
// {
|
||||
// is_Image_component_sizes=true;
|
||||
//// qDebug()<<str;
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
// else if(str.contains("Image component sizes"))
|
||||
// {
|
||||
// is_Image_component_sizes=true;
|
||||
//// qDebug()<<str;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
file.close();
|
||||
|
||||
|
||||
ram_list.append(iram);
|
||||
if(xram->getMax_size()>0)
|
||||
ram_list.append(iram);
|
||||
if(xram->getMax_size()>0)
|
||||
ram_list.append(xram);
|
||||
flash_list.append(irom);
|
||||
flash_list.append(irom);
|
||||
|
||||
qDebug()<<"ram:";
|
||||
for(auto ram:ram_list)
|
||||
{
|
||||
ram->print_bar_8051();
|
||||
}
|
||||
qDebug()<<"flash:";
|
||||
for(auto flash:flash_list)
|
||||
{
|
||||
flash->print_bar_8051();
|
||||
}
|
||||
qDebug()<<"ram:";
|
||||
for(auto ram:ram_list)
|
||||
{
|
||||
ram->print_bar_8051();
|
||||
}
|
||||
qDebug()<<"flash:";
|
||||
for(auto flash:flash_list)
|
||||
{
|
||||
flash->print_bar_8051();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ class parse_m51_from_keil
|
||||
{
|
||||
public:
|
||||
parse_m51_from_keil(QString path,uint64_t iram_max_size,uint64_t xram_max_size,
|
||||
uint64_t irom_max_size);
|
||||
uint64_t irom_max_size);
|
||||
|
||||
uint64_t all_ram_size=0;
|
||||
uint64_t all_flash_size=0;
|
||||
@ -17,16 +17,16 @@ public:
|
||||
uint64_t iram_max;
|
||||
uint64_t xram_max;
|
||||
uint64_t irom_max;
|
||||
use_percentage_bar* iram;
|
||||
use_percentage_bar* xram;
|
||||
use_percentage_bar* irom;
|
||||
use_percentage_bar* iram;
|
||||
use_percentage_bar* xram;
|
||||
use_percentage_bar* irom;
|
||||
QList<use_percentage_bar*>ram_list;
|
||||
QList<use_percentage_bar*>flash_list;
|
||||
|
||||
|
||||
bool to_parse_m51_from_keil(QString path);
|
||||
QString find_m51_path(const QString& dir_path);
|
||||
bool parse_m51_file(QString path);
|
||||
bool to_parse_m51_from_keil(QString path);
|
||||
QString find_m51_path(const QString& dir_path);
|
||||
bool parse_m51_file(QString path);
|
||||
};
|
||||
|
||||
#endif // PARSE_M51_FROM_KEIL_H
|
||||
|
@ -19,7 +19,7 @@ QString parse_map_from_keil::find_map_path(const QString& dir_path)
|
||||
QString map_file_path;
|
||||
map_file_path=find_path::find_file_path(dir_path,".map");
|
||||
if(map_file_path.length()<3)
|
||||
map_file_path=find_path::find_file_path(dir_path,".MAP");
|
||||
map_file_path=find_path::find_file_path(dir_path,".MAP");
|
||||
|
||||
return map_file_path;
|
||||
|
||||
@ -30,15 +30,15 @@ QString parse_map_from_keil::find_map_path(const QString& dir_path)
|
||||
bool parse_map_from_keil::parse_excution_region_info(QString info_string)
|
||||
{
|
||||
|
||||
// storage_type_t storage=ram;
|
||||
// storage_type_t storage=ram;
|
||||
use_percentage_bar* storage=new use_percentage_bar(nullptr);
|
||||
storage->setStorage(flash);
|
||||
for(auto keyword:ram_keyword)
|
||||
{
|
||||
if(info_string.contains(keyword))
|
||||
{
|
||||
// qDebug()<<info_string;
|
||||
storage->setStorage(ram);
|
||||
// qDebug()<<info_string;
|
||||
storage->setStorage(ram);
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ bool parse_map_from_keil::parse_excution_region_info(QString info_string)
|
||||
|
||||
|
||||
for(auto info :info_list)
|
||||
{
|
||||
{
|
||||
QStringList info_value;
|
||||
info.remove(QChar(','), Qt::CaseInsensitive);//去除","
|
||||
info.remove(QChar(' '), Qt::CaseInsensitive);//去除")"
|
||||
@ -64,13 +64,13 @@ bool parse_map_from_keil::parse_excution_region_info(QString info_string)
|
||||
{
|
||||
info_value =info.split(":");
|
||||
info_value[1].remove(QChar('x'), Qt::CaseInsensitive);//去除"x"
|
||||
storage->setBase_addr(info_value[1].toUInt(nullptr,16));
|
||||
// qDebug()<<info_value[1];
|
||||
storage->setBase_addr(info_value[1].toUInt(nullptr,16));
|
||||
// qDebug()<<info_value[1];
|
||||
|
||||
if(storage->getBase_addr()>iram_base&&storage->getBase_addr()<iram_base+iram_max_size)
|
||||
storage->setStorage(ram);
|
||||
else if(storage->getBase_addr()>irom_base&&storage->getBase_addr()<irom_base+irom_max_size)
|
||||
storage->setStorage(flash);
|
||||
if(storage->getBase_addr()>iram_base&&storage->getBase_addr()<iram_base+iram_max_size)
|
||||
storage->setStorage(ram);
|
||||
else if(storage->getBase_addr()>irom_base&&storage->getBase_addr()<irom_base+irom_max_size)
|
||||
storage->setStorage(flash);
|
||||
|
||||
}else if(info.contains("Size"))
|
||||
{
|
||||
@ -79,7 +79,7 @@ bool parse_map_from_keil::parse_excution_region_info(QString info_string)
|
||||
info_value[1].remove(QChar('x'), Qt::CaseInsensitive);//去除"x"
|
||||
|
||||
storage->setUsed_size(info_value[1].toUInt(nullptr,16));
|
||||
// qDebug()<<info_value[1];
|
||||
// qDebug()<<info_value[1];
|
||||
|
||||
|
||||
|
||||
@ -89,13 +89,13 @@ bool parse_map_from_keil::parse_excution_region_info(QString info_string)
|
||||
info_value =info.split(":");
|
||||
info_value[1].remove(QChar('x'), Qt::CaseInsensitive);//去除"x"
|
||||
storage->setMax_size(info_value[1].toUInt(nullptr,16));
|
||||
// qDebug()<<info_value[1];
|
||||
// qDebug()<<info_value[1];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -119,135 +119,135 @@ bool parse_map_from_keil::parse_map_file(QString path){
|
||||
{
|
||||
delete info;
|
||||
}
|
||||
info_list.clear();
|
||||
info_list.clear();
|
||||
|
||||
for(auto ram:ram_list)
|
||||
for(auto ram:ram_list)
|
||||
{
|
||||
delete ram;
|
||||
}
|
||||
ram_list.clear();
|
||||
|
||||
|
||||
for(auto flash:flash_list)
|
||||
{
|
||||
delete flash;
|
||||
}
|
||||
flash_list.clear();
|
||||
|
||||
|
||||
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
qDebug()<<"open fail"<<endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
while (!file.atEnd())
|
||||
{
|
||||
QByteArray line = file.readLine();
|
||||
QString str(line);
|
||||
|
||||
if(str.contains("Execution Region"))
|
||||
{
|
||||
delete ram;
|
||||
}
|
||||
ram_list.clear();
|
||||
|
||||
|
||||
for(auto flash:flash_list)
|
||||
// qDebug() << str;
|
||||
parse_excution_region_info(str);
|
||||
}else if(str.contains("Image component sizes"))
|
||||
{
|
||||
delete flash;
|
||||
}
|
||||
flash_list.clear();
|
||||
|
||||
|
||||
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
qDebug()<<"open fail"<<endl;
|
||||
return false;
|
||||
is_Image_component_sizes=true;
|
||||
// qDebug()<<str;
|
||||
}
|
||||
|
||||
while (!file.atEnd())
|
||||
if(is_Image_component_sizes)
|
||||
{
|
||||
if(str.contains("----"))
|
||||
{
|
||||
QByteArray line = file.readLine();
|
||||
QString str(line);
|
||||
|
||||
if(str.contains("Execution Region"))
|
||||
if(is_Totals)
|
||||
{
|
||||
|
||||
// qDebug() << str;
|
||||
parse_excution_region_info(str);
|
||||
}else if(str.contains("Image component sizes"))
|
||||
is_Totals=false;
|
||||
}else
|
||||
{
|
||||
is_Image_component_sizes=true;
|
||||
// qDebug()<<str;
|
||||
is_Totals=true;
|
||||
|
||||
}
|
||||
|
||||
if(is_Image_component_sizes)
|
||||
}
|
||||
else if(str.contains("=====")){
|
||||
is_Image_component_sizes=false;
|
||||
}else if(str==""||str.length()<10)
|
||||
{
|
||||
|
||||
}
|
||||
else {
|
||||
// 使用正则表达式提取数字和单词
|
||||
QRegExp rx("(\\d+|\\w+)");
|
||||
|
||||
// 将多个空格替换为逗号
|
||||
QString csv_row = str.trimmed().replace(QRegExp("\\s+"), ",");
|
||||
csv_row+="\n";
|
||||
// 输出修改后的数据
|
||||
// qDebug() << csv_row;
|
||||
|
||||
QStringList item_data= csv_row.split(",");
|
||||
|
||||
|
||||
if(item_data.length()<=8)
|
||||
{
|
||||
if(str.contains("----"))
|
||||
bool is_number=false;
|
||||
if(is_Totals)
|
||||
{
|
||||
if(is_Totals)
|
||||
if(item_data.length()>7&&item_data[7].contains("Totals"))
|
||||
{
|
||||
is_Totals=false;
|
||||
}else
|
||||
{
|
||||
is_Totals=true;
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
item_data[1].toUInt(&is_number);
|
||||
if(is_number)
|
||||
{
|
||||
|
||||
image_item_t* item=new image_item_t();
|
||||
item->Code=QString::number(item_data[0].toInt());//item_data[1].toUInt()(inc.data是包含在code内的)
|
||||
item->RO_Data=item_data[2];
|
||||
item->RW_Data=item_data[3];
|
||||
item->ZI_Data=item_data[4];
|
||||
item->Debug=item_data[5];
|
||||
item->Object_Name=item_data[6];
|
||||
|
||||
if(item->Object_Name.contains(".l"))
|
||||
continue;
|
||||
else if (item->Object_Name.contains("(")) {
|
||||
item->Object_Name=item->Object_Name=item_data[6]+item_data[7];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else if(str.contains("=====")){
|
||||
is_Image_component_sizes=false;
|
||||
}else if(str==""||str.length()<10)
|
||||
{
|
||||
info_list.append(item);
|
||||
|
||||
}
|
||||
else {
|
||||
// 使用正则表达式提取数字和单词
|
||||
QRegExp rx("(\\d+|\\w+)");
|
||||
|
||||
// 将多个空格替换为逗号
|
||||
QString csv_row = str.trimmed().replace(QRegExp("\\s+"), ",");
|
||||
csv_row+="\n";
|
||||
// 输出修改后的数据
|
||||
// qDebug() << csv_row;
|
||||
|
||||
QStringList item_data= csv_row.split(",");
|
||||
|
||||
|
||||
if(item_data.length()<=8)
|
||||
{
|
||||
bool is_number=false;
|
||||
if(is_Totals)
|
||||
{
|
||||
if(item_data.length()>7&&item_data[7].contains("Totals"))
|
||||
{
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
item_data[1].toUInt(&is_number);
|
||||
if(is_number)
|
||||
{
|
||||
|
||||
image_item_t* item=new image_item_t();
|
||||
item->Code=QString::number(item_data[0].toInt());//item_data[1].toUInt()(inc.data是包含在code内的)
|
||||
item->RO_Data=item_data[2];
|
||||
item->RW_Data=item_data[3];
|
||||
item->ZI_Data=item_data[4];
|
||||
item->Debug=item_data[5];
|
||||
item->Object_Name=item_data[6];
|
||||
|
||||
if(item->Object_Name.contains(".l"))
|
||||
continue;
|
||||
else if (item->Object_Name.contains("(")) {
|
||||
item->Object_Name=item->Object_Name=item_data[6]+item_data[7];
|
||||
|
||||
}
|
||||
|
||||
info_list.append(item);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
qDebug()<<"ram:";
|
||||
for(auto ram:ram_list)
|
||||
{
|
||||
ram->print_bar();
|
||||
}
|
||||
qDebug()<<"flash:";
|
||||
for(auto flash:flash_list)
|
||||
{
|
||||
flash->print_bar();
|
||||
}
|
||||
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
qDebug()<<"ram:";
|
||||
for(auto ram:ram_list)
|
||||
{
|
||||
ram->print_bar();
|
||||
}
|
||||
qDebug()<<"flash:";
|
||||
for(auto flash:flash_list)
|
||||
{
|
||||
flash->print_bar();
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
|
||||
}
|
||||
@ -293,8 +293,8 @@ bool parse_map_from_keil::to_parse_map_from_keil(QString path)
|
||||
|
||||
if(path.contains(".map")||path.contains(".MAP"))
|
||||
{
|
||||
parse_map_file(path);
|
||||
return true;
|
||||
parse_map_file(path);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -308,11 +308,11 @@ bool parse_map_from_keil::to_parse_map_from_keil(QString path)
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
qDebug()<<"路径错误,请检测输入的工程路径!";
|
||||
main_window->winow_on_top(false);
|
||||
QMessageBox::critical(nullptr, "Error", "路径错误,请检测输入的工程路径!");
|
||||
qDebug()<<"路径错误,请检测输入的工程路径!";
|
||||
main_window->winow_on_top(false);
|
||||
QMessageBox::critical(nullptr, "Error", "路径错误,请检测输入的工程路径!");
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -328,6 +328,6 @@ parse_map_from_keil::parse_map_from_keil(QString path, uint64_t to_iram_base,
|
||||
irom_base=to_irom_base;
|
||||
irom_max_size= to_irom_max_size;
|
||||
|
||||
//to_parse_map_from_keil(path);
|
||||
//to_parse_map_from_keil(path);
|
||||
|
||||
}
|
||||
|
@ -11,12 +11,12 @@ typedef struct {QString fn_name;QString file_name; uint64_t size;}map_item;
|
||||
|
||||
typedef struct image_item {
|
||||
|
||||
QString Code;
|
||||
QString RO_Data;
|
||||
QString RW_Data;
|
||||
QString ZI_Data;
|
||||
QString Debug;
|
||||
QString Object_Name;
|
||||
QString Code;
|
||||
QString RO_Data;
|
||||
QString RW_Data;
|
||||
QString ZI_Data;
|
||||
QString Debug;
|
||||
QString Object_Name;
|
||||
|
||||
}image_item_t;
|
||||
|
||||
@ -24,51 +24,51 @@ class parse_map_from_keil
|
||||
{
|
||||
|
||||
public:
|
||||
bool to_parse_map_from_keil(QString path);
|
||||
parse_map_from_keil(QString path,
|
||||
uint64_t to_iram_base,
|
||||
uint64_t to_iram_max_size,
|
||||
uint64_t to_irom_base,
|
||||
uint64_t to_irom_max_size
|
||||
);
|
||||
QString find_map_path(const QString& dir_path);
|
||||
bool parse_excution_region_info(QString info_string);
|
||||
bool parse_map_file(QString path);
|
||||
bool to_parse_map_from_keil(QString path);
|
||||
parse_map_from_keil(QString path,
|
||||
uint64_t to_iram_base,
|
||||
uint64_t to_iram_max_size,
|
||||
uint64_t to_irom_base,
|
||||
uint64_t to_irom_max_size
|
||||
);
|
||||
QString find_map_path(const QString& dir_path);
|
||||
bool parse_excution_region_info(QString info_string);
|
||||
bool parse_map_file(QString path);
|
||||
|
||||
|
||||
QList<use_percentage_bar*>ram_list;
|
||||
QList<use_percentage_bar*>flash_list;
|
||||
QList<use_percentage_bar*>ram_list;
|
||||
QList<use_percentage_bar*>flash_list;
|
||||
|
||||
|
||||
QString getMap_path() const;
|
||||
void setMap_path(const QString &value);
|
||||
QString getMap_path() const;
|
||||
void setMap_path(const QString &value);
|
||||
|
||||
QList<image_item_t*> getInfo_list() const;
|
||||
void setInfo_list(const QList<image_item_t*> &value);
|
||||
QList<image_item_t*> getInfo_list() const;
|
||||
void setInfo_list(const QList<image_item_t*> &value);
|
||||
|
||||
uint64_t getAll_ram_size() const;
|
||||
uint64_t getAll_ram_size() const;
|
||||
|
||||
uint64_t getAll_flash_size() const;
|
||||
uint64_t getAll_flash_size() const;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
uint64_t iram_base;
|
||||
uint64_t iram_max_size;
|
||||
uint64_t iram_base;
|
||||
uint64_t iram_max_size;
|
||||
|
||||
uint64_t irom_base;
|
||||
uint64_t irom_max_size;
|
||||
uint64_t irom_base;
|
||||
uint64_t irom_max_size;
|
||||
|
||||
|
||||
|
||||
uint64_t all_ram_size=0;
|
||||
uint64_t all_flash_size=0;
|
||||
//,"HEAP","STACK","heap","stack"
|
||||
QList<QString> ram_keyword={"ER$$","RW_","ER_RW","ER_ZI"};
|
||||
QList<QString> flash_keyword={"RO","FLASH","flash","ro","text","TEXT"};
|
||||
uint64_t all_ram_size=0;
|
||||
uint64_t all_flash_size=0;
|
||||
//,"HEAP","STACK","heap","stack"
|
||||
QList<QString> ram_keyword={"ER$$","RW_","ER_RW","ER_ZI"};
|
||||
QList<QString> flash_keyword={"RO","FLASH","flash","ro","text","TEXT"};
|
||||
|
||||
QString map_path;
|
||||
QList<image_item_t*> info_list;
|
||||
QString map_path;
|
||||
QList<image_item_t*> info_list;
|
||||
};
|
||||
|
||||
#endif // PARSE_MAP_FROM_KEIL_H
|
||||
|
@ -10,7 +10,7 @@ use_percentage_bar::use_percentage_bar(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
FlatUI::setProgressQss(ui->used_bar, 20,12,16, "#747976", "#1ABC9C");
|
||||
FlatUI::setProgressQss(ui->used_bar, 20,12,16, "#747976", "#1ABC9C");
|
||||
|
||||
}
|
||||
void use_percentage_bar::set_bar_style(QProgressBar *bar,float per)
|
||||
@ -37,22 +37,22 @@ use_percentage_bar::~use_percentage_bar()
|
||||
void use_percentage_bar::print_bar_8051(void)
|
||||
{
|
||||
|
||||
if(max_size==0)
|
||||
{
|
||||
qDebug()<<"erro:max=0";
|
||||
return;
|
||||
}
|
||||
if(max_size==0)
|
||||
{
|
||||
qDebug()<<"erro:max=0";
|
||||
return;
|
||||
}
|
||||
uint8_t i;
|
||||
QString bar_str;
|
||||
qDebug()<<name<<":0";//<<QString().sprintf("%#x",base_addr);
|
||||
|
||||
if(max_size/10.0<=1024)
|
||||
{
|
||||
bar_str+=QString().sprintf("%6.2f B %5s:|", max_size/10.0 , name.toStdString().data());
|
||||
bar_str+=QString().sprintf("%6.2f B %5s:|", max_size/10.0 , name.toStdString().data());
|
||||
}
|
||||
else
|
||||
{
|
||||
bar_str+=QString().sprintf("%6.2f KB %5s:|", max_size/10.0/1024.0 , name.toStdString().data());
|
||||
bar_str+=QString().sprintf("%6.2f KB %5s:|", max_size/10.0/1024.0 , name.toStdString().data());
|
||||
}
|
||||
|
||||
for (i = 0; i < 20; i++)
|
||||
@ -60,29 +60,29 @@ if(max_size==0)
|
||||
if (i < (uint8_t)((used_size / 1.0) / (max_size / 1.0) * 20))
|
||||
{
|
||||
|
||||
bar_str+=QString().sprintf("■");
|
||||
bar_str+=QString().sprintf("■");
|
||||
}
|
||||
else
|
||||
{
|
||||
bar_str+=QString().sprintf("_");
|
||||
bar_str+=QString().sprintf("_");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(max_size/10.0<=1024)
|
||||
{
|
||||
bar_str+=QString().sprintf("|%6.2f %% (%8.2f B / %8.2f B)", (used_size/10.0 / 1.0) / (max_size/10.0 / 1.0) * 100, used_size/10.0 , max_size/10.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
bar_str+=QString().sprintf("|%6.2f %% (%8.2f B / %8.2f KB)", (used_size/10.0 / 1.0) / (max_size/10.0 / 1.0) * 100, used_size/10.0 , max_size/10.0 / 1024.0f);
|
||||
}
|
||||
if(max_size/10.0<=1024)
|
||||
{
|
||||
bar_str+=QString().sprintf("|%6.2f %% (%8.2f B / %8.2f B)", (used_size/10.0 / 1.0) / (max_size/10.0 / 1.0) * 100, used_size/10.0 , max_size/10.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
bar_str+=QString().sprintf("|%6.2f %% (%8.2f B / %8.2f KB)", (used_size/10.0 / 1.0) / (max_size/10.0 / 1.0) * 100, used_size/10.0 , max_size/10.0 / 1024.0f);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bar_str+=QString().sprintf(" [%u B]", max_size/10.0 - used_size/10.0);
|
||||
qDebug()<< bar_str;
|
||||
bar_str+=QString().sprintf(" [%u B]", max_size/10.0 - used_size/10.0);
|
||||
qDebug()<< bar_str;
|
||||
|
||||
}
|
||||
void use_percentage_bar::print_bar(void)
|
||||
@ -105,29 +105,29 @@ void use_percentage_bar::print_bar(void)
|
||||
if (i < (uint8_t)((used_size / 1.0) / (max_size / 1.0) * 20))
|
||||
{
|
||||
|
||||
bar_str+=QString().sprintf("■");
|
||||
bar_str+=QString().sprintf("■");
|
||||
}
|
||||
else
|
||||
{
|
||||
bar_str+=QString().sprintf("_");
|
||||
bar_str+=QString().sprintf("_");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(max_size<=1024*1024)
|
||||
{
|
||||
bar_str+=QString().sprintf("|%6.2f %% (%8.2f KB / %8.2f KB)", (used_size / 1.0) / (max_size / 1.0) * 100, used_size / 1024.0f, max_size / 1024.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
bar_str+=QString().sprintf("|%6.2f %% (%8.4f MB / %8.4f MB)", (used_size / 1.0) / (max_size / 1.0) * 100, used_size / 1024.0f/1024.0f, max_size / 1024.0f/1024.0f);
|
||||
}
|
||||
if(max_size<=1024*1024)
|
||||
{
|
||||
bar_str+=QString().sprintf("|%6.2f %% (%8.2f KB / %8.2f KB)", (used_size / 1.0) / (max_size / 1.0) * 100, used_size / 1024.0f, max_size / 1024.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
bar_str+=QString().sprintf("|%6.2f %% (%8.4f MB / %8.4f MB)", (used_size / 1.0) / (max_size / 1.0) * 100, used_size / 1024.0f/1024.0f, max_size / 1024.0f/1024.0f);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bar_str+=QString().sprintf(" [%u B]", max_size - used_size);
|
||||
qDebug()<< bar_str;
|
||||
bar_str+=QString().sprintf(" [%u B]", max_size - used_size);
|
||||
qDebug()<< bar_str;
|
||||
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ void use_percentage_bar::setName(const QString &value)
|
||||
name = value;
|
||||
|
||||
|
||||
ui->name->setTitle(name);
|
||||
ui->name->setTitle(name);
|
||||
}
|
||||
|
||||
storage_type_t use_percentage_bar::getStorage() const
|
||||
@ -203,12 +203,12 @@ void use_percentage_bar::setUsed_size(const uint64_t &value)
|
||||
{
|
||||
if(max_size/10.0<=1024)
|
||||
{
|
||||
ui->used->setText(QString().sprintf("占用:%.2f B / (%.2f B)",used_size/10.0,max_size/10.0));
|
||||
ui->used->setText(QString().sprintf("占用:%.2f B / (%.2f B)",used_size/10.0,max_size/10.0));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->used->setText(QString().sprintf("占用:%.2f B / (%.2f KB)",used_size/10.0,max_size/10.0/1024.0));
|
||||
ui->used->setText(QString().sprintf("占用:%.2f B / (%.2f KB)",used_size/10.0,max_size/10.0/1024.0));
|
||||
|
||||
}
|
||||
setRemain_size(max_size-used_size);
|
||||
@ -216,17 +216,17 @@ void use_percentage_bar::setUsed_size(const uint64_t &value)
|
||||
{
|
||||
if(max_size<=1024*1024)
|
||||
{
|
||||
ui->used->setText(QString().sprintf("占用:%.2f KB / (%.2f KB)",used_size/1024.0,max_size/1024.0));
|
||||
ui->used->setText(QString().sprintf("占用:%.2f KB / (%.2f KB)",used_size/1024.0,max_size/1024.0));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->used->setText(QString().sprintf("占用:%.4f MB / (%.4f MB)",used_size/1024.0/1024.0,max_size/1024.0/1024.0));
|
||||
ui->used->setText(QString().sprintf("占用:%.4f MB / (%.4f MB)",used_size/1024.0/1024.0,max_size/1024.0/1024.0));
|
||||
|
||||
}
|
||||
setRemain_size(max_size-used_size);
|
||||
}
|
||||
set_bar_style(ui->used_bar,used_size/1.0/max_size/1.0);
|
||||
set_bar_style(ui->used_bar,used_size/1.0/max_size/1.0);
|
||||
|
||||
|
||||
}
|
||||
@ -254,11 +254,11 @@ void use_percentage_bar::setMax_size(const uint64_t &value)
|
||||
|
||||
if(max_size/10.0<=1024)
|
||||
{
|
||||
ui->used->setText(QString().sprintf("占用:%.2f B / (%.2f B)",used_size/10.0,max_size/10.0));
|
||||
ui->used->setText(QString().sprintf("占用:%.2f B / (%.2f B)",used_size/10.0,max_size/10.0));
|
||||
|
||||
}else
|
||||
{
|
||||
ui->used->setText(QString().sprintf("占用:%.2f B / (%.2f KB)",used_size/10.0,max_size/10.0/1024.0));
|
||||
ui->used->setText(QString().sprintf("占用:%.2f B / (%.2f KB)",used_size/10.0,max_size/10.0/1024.0));
|
||||
|
||||
}
|
||||
setRemain_size(max_size-used_size);
|
||||
@ -266,16 +266,16 @@ void use_percentage_bar::setMax_size(const uint64_t &value)
|
||||
{
|
||||
if(max_size<=1024*1024)
|
||||
{
|
||||
ui->used->setText(QString().sprintf("占用:%.2f KB / (%.2f KB)",used_size/1024.0,max_size/1024.0));
|
||||
ui->used->setText(QString().sprintf("占用:%.2f KB / (%.2f KB)",used_size/1024.0,max_size/1024.0));
|
||||
|
||||
}else
|
||||
{
|
||||
ui->used->setText(QString().sprintf("占用:%.4f MB / (%.4f MB)",used_size/1024.0/1024.0,max_size/1024.0/1024.0));
|
||||
ui->used->setText(QString().sprintf("占用:%.4f MB / (%.4f MB)",used_size/1024.0/1024.0,max_size/1024.0/1024.0));
|
||||
|
||||
}
|
||||
setRemain_size(max_size-used_size);
|
||||
}
|
||||
set_bar_style(ui->used_bar,used_size/1.0/max_size/1.0);
|
||||
set_bar_style(ui->used_bar,used_size/1.0/max_size/1.0);
|
||||
|
||||
|
||||
}
|
||||
@ -292,7 +292,7 @@ void use_percentage_bar::setRemain_size(const uint64_t &value)
|
||||
remain_size = value;
|
||||
if(storage==mc8051)
|
||||
{
|
||||
ui->remain->setText(QString().sprintf("剩余:%.2f B",remain_size/10.0));
|
||||
ui->remain->setText(QString().sprintf("剩余:%.2f B",remain_size/10.0));
|
||||
}else
|
||||
{
|
||||
ui->remain->setText(QString().sprintf("剩余:%llu B",remain_size));
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
|
||||
|
||||
void print_bar(void);
|
||||
void print_bar_8051(void);
|
||||
void print_bar_8051(void);
|
||||
|
||||
QString getName() const;
|
||||
void setName(const QString &value);
|
||||
@ -55,7 +55,7 @@ private:
|
||||
uint64_t used_size;
|
||||
uint64_t max_size;
|
||||
uint64_t remain_size;
|
||||
void set_bar_style(QProgressBar *bar,float per);
|
||||
void set_bar_style(QProgressBar *bar,float per);
|
||||
};
|
||||
|
||||
#endif // USE_PERCENTAGE_BAR_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user