From f93d5cdd9e7a2f4b7a40d4ca992cf048f92b7f37 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sun, 5 Mar 2023 08:56:11 +0800 Subject: [PATCH] - enhancement: Open offline gnu as/x86 assembly manual if exists. --- NEWS.md | 1 + RedPandaIDE/RedPandaIDE.pro | 9 ++++++--- RedPandaIDE/mainwindow.cpp | 26 +++++++++++++++++++++++--- RedPandaIDE/mainwindow.h | 5 ++++- 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/NEWS.md b/NEWS.md index 05836015..87aba894 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,7 @@ Red Panda C++ Version 2.17 - enhancement: Add "New Text File" in the File menu - enhancement: Add "address" in the memory view's mouse tip. - enhancement: Show mousetip for numbers in the GNU assembly file. + - enhancement: Open offline gnu as/x86 assembly manual if exists. Red Panda C++ Version 2.16 diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro index bd974ac9..609c1404 100644 --- a/RedPandaIDE/RedPandaIDE.pro +++ b/RedPandaIDE/RedPandaIDE.pro @@ -12,9 +12,12 @@ isEmpty(APP_VERSION) { } contains(QMAKE_HOST.arch, x86_64):{ - contains(QMAKE_HOST.arch, x86_64):{ - DEFINES += ARCH_X86_64=1 - } else : { + DEFINES += ARCH_X86_64=1 +} else: { + contains(QMAKE_HOST.arch, i386):{ + DEFINES += ARCH_X86=1 + } + contains(QMAKE_HOST.arch, i686):{ DEFINES += ARCH_X86=1 } } diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index adeae9a4..5f7c63ff 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -419,7 +419,7 @@ MainWindow::MainWindow(QWidget *parent) ui->actionIA_32_Assembly_Language_Reference_Manual->setVisible(true); ui->actionx86_Assembly_Language_Reference_Manual->setVisible(false); #elif defined(ARCH_X86_64) - ui->actionIA_32_Assembly_Language_Reference_Manual->setVisible(true); + ui->actionIA_32_Assembly_Language_Reference_Manual->setVisible(false); ui->actionx86_Assembly_Language_Reference_Manual->setVisible(true); #else ui->actionIA_32_Assembly_Language_Reference_Manual->setVisible(false); @@ -9610,20 +9610,40 @@ void MainWindow::on_actionNew_GAS_File_triggered() void MainWindow::on_actionGNU_Assembler_Manual_triggered() { + QFileInfo fileInfo{includeTrailingPathDelimiter(pSettings->dirs().appDir())+ + QString{"Using GNU Assembler.pdf"}}; + if (fileInfo.exists()) { + QDesktopServices::openUrl(QUrl::fromLocalFile(fileInfo.absoluteFilePath())); + return; + } QDesktopServices::openUrl(QUrl("https://sourceware.org/binutils/docs/as/index.html")); } +#ifdef ARCH_X86_64 void MainWindow::on_actionx86_Assembly_Language_Reference_Manual_triggered() { + QFileInfo fileInfo{includeTrailingPathDelimiter(pSettings->dirs().appDir())+ + QString{"x86 Assembly Language Reference Manual.pdf"}}; + if (fileInfo.exists()) { + QDesktopServices::openUrl(QUrl::fromLocalFile(fileInfo.absoluteFilePath())); + return; + } QDesktopServices::openUrl(QUrl("https://docs.oracle.com/cd/E53394_01/html/E54851/index.html")); } +#endif - +#ifdef ARCH_X86 void MainWindow::on_actionIA_32_Assembly_Language_Reference_Manual_triggered() { + QFileInfo fileInfo{includeTrailingPathDelimiter(pSettings->dirs().appDir())+ + QString{"IA-32 Assembly Language Reference Manual.pdf"}}; + if (fileInfo.exists()) { + QDesktopServices::openUrl(QUrl::fromLocalFile(fileInfo.absoluteFilePath())); + return; + } QDesktopServices::openUrl(QUrl("https://docs.oracle.com/cd/E19455-01/806-3773/index.html")); } - +#endif void MainWindow::on_actionAdd_Watchpoint_triggered() { diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h index 805b340b..94000476 100644 --- a/RedPandaIDE/mainwindow.h +++ b/RedPandaIDE/mainwindow.h @@ -794,9 +794,12 @@ private slots: void on_actionGNU_Assembler_Manual_triggered(); +#ifdef ARCH_X86_64 void on_actionx86_Assembly_Language_Reference_Manual_triggered(); - +#endif +#ifdef ARCH_X86 void on_actionIA_32_Assembly_Language_Reference_Manual_triggered(); +#endif void on_actionAdd_Watchpoint_triggered();