diff --git a/KDAv1.nsi b/KDAv1.nsi new file mode 100644 index 0000000..ee57981 --- /dev/null +++ b/KDAv1.nsi @@ -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 "一个极客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对应的HKLM下的注册表项 +Section -Post +;获取到系统原有的环境变量 +ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" +;在原有的环境变量里追加 D:\test 目录 +WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$0;$INSTDIR" +;刷新环境变量 +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) 已成功地从你的计算机移除。" +FunctionEnd + +Function un.onInit +!insertmacro MUI_UNGETLANGUAGE + MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "你确实要完全移除 $(^Name) ,其及所有的组件?" 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 \ No newline at end of file diff --git a/find_path.cpp b/find_path.cpp index 5eee05f..ce87f55 100644 --- a/find_path.cpp +++ b/find_path.cpp @@ -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:"<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()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()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()getBase_addr()) - recent_base=recent_flash->getBase_addr(); + if(recent_flash->getBase_addr()-flash->getBase_addr()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 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 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_cntram_table->rowCount();row_cnt++) - { + for(uint64_t row_cnt=0;row_cntram_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_cntflash_table->rowCount();row_cnt++) - { - ui->flash_table->removeRow(row_cnt); - } - ui->flash_table->clear(); - flash_pieseries->clear(); + for(uint64_t row_cnt=0;row_cntflash_table->rowCount();row_cnt++) + { + ui->flash_table->removeRow(row_cnt); + } + ui->flash_table->clear(); + flash_pieseries->clear(); for(i=0;iram_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;iflash_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_cntram_table->rowCount();row_cnt++) -{ + clearLayout(ui->ram_scrollAreaWidgetContents->layout()); + // // 绉婚櫎骞堕噴鏀惧竷灞涓殑鎵鏈夊皬閮ㄤ欢 + clearLayout(ui->flash_scrollAreaWidgetContents->layout()); + // // 绉婚櫎骞堕噴鏀惧竷灞涓殑鎵鏈夊皬閮ㄤ欢 + for(uint64_t row_cnt=0;row_cntram_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_cntflash_table->rowCount();row_cnt++) -{ - ui->flash_table->removeRow(row_cnt); -} - ui->flash_table->clear(); -flash_pieseries->clear(); + for(uint64_t row_cnt=0;row_cntflash_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;iflash_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 info_lsit= map->getInfo_list(); - uint64_t all_ram_size = map->getAll_ram_size(); - uint64_t all_flash_size =map->getAll_flash_size(); + QList 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_cntram_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_cntram_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_cntflash_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_cntflash_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_cntram_table->rowCount();row_cnt++) - { + for(uint64_t row_cnt=0;row_cntram_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_cntflash_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_cntflash_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 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 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")); +} diff --git a/mainwindow.h b/mainwindow.h index 222efa8..02bd105 100644 --- a/mainwindow.h +++ b/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 diff --git a/mainwindow.ui b/mainwindow.ui index d8e9b2d..8dc398e 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -460,7 +460,7 @@ color: rgb(255, 255, 255); - 0 + 3 diff --git a/only_run_by_file.cpp b/only_run_by_file.cpp index 6f0a790..ff2313a 100644 --- a/only_run_by_file.cpp +++ b/only_run_by_file.cpp @@ -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(); } } diff --git a/only_run_by_file.h b/only_run_by_file.h index 47989cc..6e866e3 100644 --- a/only_run_by_file.h +++ b/only_run_by_file.h @@ -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 diff --git a/parse_keil_project.cpp b/parse_keil_project.cpp index 702e38e..bc18730 100644 --- a/parse_keil_project.cpp +++ b/parse_keil_project.cpp @@ -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()<"<"<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"<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()<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(); + } } diff --git a/parse_m51_from_keil.h b/parse_m51_from_keil.h index 040ca56..b997291 100644 --- a/parse_m51_from_keil.h +++ b/parse_m51_from_keil.h @@ -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; QListram_list; QListflash_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 diff --git a/parse_map_from_keil.cpp b/parse_map_from_keil.cpp index be0dda6..e6eaa48 100644 --- a/parse_map_from_keil.cpp +++ b/parse_map_from_keil.cpp @@ -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()<setStorage(ram); + // qDebug()<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()<setBase_addr(info_value[1].toUInt(nullptr,16)); + // qDebug()<getBase_addr()>iram_base&&storage->getBase_addr()setStorage(ram); - else if(storage->getBase_addr()>irom_base&&storage->getBase_addr()setStorage(flash); + if(storage->getBase_addr()>iram_base&&storage->getBase_addr()setStorage(ram); + else if(storage->getBase_addr()>irom_base&&storage->getBase_addr()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()<setMax_size(info_value[1].toUInt(nullptr,16)); -// qDebug()<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 { - // 浣跨敤姝e垯琛ㄨ揪寮忔彁鍙栨暟瀛楀拰鍗曡瘝 - 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); } diff --git a/parse_map_from_keil.h b/parse_map_from_keil.h index 41da210..d0d6207 100644 --- a/parse_map_from_keil.h +++ b/parse_map_from_keil.h @@ -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); - QListram_list; - QListflash_list; + QListram_list; + QListflash_list; - QString getMap_path() const; - void setMap_path(const QString &value); + QString getMap_path() const; + void setMap_path(const QString &value); - QList getInfo_list() const; - void setInfo_list(const QList &value); + QList getInfo_list() const; + void setInfo_list(const QList &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 ram_keyword={"ER$$","RW_","ER_RW","ER_ZI"}; - QList 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 ram_keyword={"ER$$","RW_","ER_RW","ER_ZI"}; + QList flash_keyword={"RO","FLASH","flash","ro","text","TEXT"}; - QString map_path; - QList info_list; + QString map_path; + QList info_list; }; #endif // PARSE_MAP_FROM_KEIL_H diff --git a/use_percentage_bar.cpp b/use_percentage_bar.cpp index 3b2643b..9b70daa 100644 --- a/use_percentage_bar.cpp +++ b/use_percentage_bar.cpp @@ -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->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)); diff --git a/use_percentage_bar.h b/use_percentage_bar.h index 5c0241d..6fb0ddb 100644 --- a/use_percentage_bar.h +++ b/use_percentage_bar.h @@ -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