- done: debug for project

- add dll host project option widget
This commit is contained in:
royqh1979 2021-09-18 22:37:07 +08:00
parent 54c09f3a50
commit 85686acba7
8 changed files with 155 additions and 15 deletions

View File

@ -48,6 +48,7 @@ SOURCES += \
settingsdialog/projectcompileparamaterswidget.cpp \
settingsdialog/projectcompilerwidget.cpp \
settingsdialog/projectdirectorieswidget.cpp \
settingsdialog/projectdllhostwidget.cpp \
settingsdialog/projectfileswidget.cpp \
settingsdialog/projectgeneralwidget.cpp \
settingsdialog/projectmakefilewidget.cpp \
@ -143,6 +144,7 @@ HEADERS += \
settingsdialog/projectcompileparamaterswidget.h \
settingsdialog/projectcompilerwidget.h \
settingsdialog/projectdirectorieswidget.h \
settingsdialog/projectdllhostwidget.h \
settingsdialog/projectfileswidget.h \
settingsdialog/projectgeneralwidget.h \
settingsdialog/projectmakefilewidget.h \
@ -212,6 +214,7 @@ FORMS += \
settingsdialog/projectcompileparamaterswidget.ui \
settingsdialog/projectcompilerwidget.ui \
settingsdialog/projectdirectorieswidget.ui \
settingsdialog/projectdllhostwidget.ui \
settingsdialog/projectfileswidget.ui \
settingsdialog/projectgeneralwidget.ui \
settingsdialog/projectmakefilewidget.ui \

View File

@ -1422,7 +1422,7 @@ void DebugReader::run()
readed = mProcess->readAll();
buffer += readed;
if (getLastAnnotation(buffer) == AnnotationType::TPrompt) {
mOutput = buffer;
mOutput = QString::fromLocal8Bit(buffer);
processDebugOutput();
buffer.clear();
mCmdRunning = false;

View File

@ -1013,14 +1013,14 @@ void MainWindow::debug()
+tr("But it's missing."),
QMessageBox::Ok);
return;
} else if (!fileExists(mProject->options().hostApplication)) {
QMessageBox::critical(this,
tr("Host application not exists"),
tr("Host application file '%1' doesn't exist.")
.arg(mProject->options().hostApplication),
QMessageBox::Ok);
return;
}
} else if (!fileExists(mProject->options().hostApplication)) {
QMessageBox::critical(this,
tr("Host application not exists"),
tr("Host application file '%1' doesn't exist.")
.arg(mProject->options().hostApplication),
QMessageBox::Ok);
return;
}
// Reset UI, remove invalid breakpoints
prepareDebugger();
@ -1180,14 +1180,14 @@ void MainWindow::debug()
mDebugger->updateDebugInfo();
break;
case CompileTarget::Project:
//params := '';
params = "";
//if fCompiler.UseRunParams then
// params := params + ' ' + fProject.Options.CmdLineArgs;
//if fCompiler.UseInputFile then
// params := params + ' < "' + fCompiler.InputFile + '"';
//fDebugger.SendCommand('start', params);
//UpdateDebugInfo;
mDebugger->sendCommand("start",params);
mDebugger->updateDebugInfo();
break;
}
} else {
@ -1209,8 +1209,8 @@ void MainWindow::debug()
//if fCompiler.UseInputFile then
// params := params + ' < "' + fCompiler.InputFile + '"';
//fDebugger.SendCommand('run', params);
//UpdateDebugInfo;
mDebugger->sendCommand("run",params);
mDebugger->updateDebugInfo();
break;
}
}
@ -2468,12 +2468,12 @@ void MainWindow::on_tabMessages_tabBarClicked(int index)
}
}
void MainWindow::on_tabMessages_currentChanged(int index)
void MainWindow::on_tabMessages_currentChanged(int)
{
openCloseBottomPanel(true);
}
void MainWindow::on_tabMessages_tabBarDoubleClicked(int index)
void MainWindow::on_tabMessages_tabBarDoubleClicked(int )
{
}

View File

@ -613,6 +613,10 @@ bool Project::assignTemplate(const std::shared_ptr<ProjectTemplate> aTemplate)
}
mOptions = aTemplate->options();
mOptions.compilerSet = pSettings->compilerSets().defaultIndex();
if (pSettings->compilerSets().defaultSet()) {
mOptions.compilerOptions = pSettings->compilerSets().defaultSet()->iniOptions();
}
mOptions.icon = aTemplate->icon();
// Copy icon to project directory

View File

@ -0,0 +1,41 @@
#include "projectdllhostwidget.h"
#include "ui_projectdllhostwidget.h"
#include "../project.h"
#include "../mainwindow.h"
#include <QFileDialog>
ProjectDLLHostWidget::ProjectDLLHostWidget(const QString &name, const QString &group, QWidget *parent) :
SettingsWidget(name,group,parent),
ui(new Ui::ProjectDLLHostWidget)
{
ui->setupUi(this);
}
ProjectDLLHostWidget::~ProjectDLLHostWidget()
{
delete ui;
}
void ProjectDLLHostWidget::doLoad()
{
ui->txtHost->setText(pMainWindow->project()->options().hostApplication);
}
void ProjectDLLHostWidget::doSave()
{
pMainWindow->project()->options().hostApplication = ui->txtHost->text();
}
void ProjectDLLHostWidget::on_btnBrowse_triggered(QAction *arg1)
{
QString filename = QFileDialog::getOpenFileName(
this,
tr("Choose host application"),
pMainWindow->project()->directory(),
tr("All files (*.*)"));
if (!filename.isEmpty() && fileExists(filename)) {
ui->txtHost->setText(filename);
}
}

View File

@ -0,0 +1,30 @@
#ifndef PROJECTDLLHOSTWIDGET_H
#define PROJECTDLLHOSTWIDGET_H
#include <QWidget>
#include "settingswidget.h"
namespace Ui {
class ProjectDLLHostWidget;
}
class ProjectDLLHostWidget : public SettingsWidget
{
Q_OBJECT
public:
explicit ProjectDLLHostWidget(const QString& name, const QString& group, QWidget *parent = nullptr);
~ProjectDLLHostWidget();
private:
Ui::ProjectDLLHostWidget *ui;
// SettingsWidget interface
protected:
void doLoad() override;
void doSave() override;
private slots:
void on_btnBrowse_triggered(QAction *arg1);
};
#endif // PROJECTDLLHOSTWIDGET_H

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ProjectDLLHostWidget</class>
<widget class="QWidget" name="ProjectDLLHostWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="2">
<widget class="QToolButton" name="btnBrowse">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/images/newlook24/053-open.png</normaloff>:/icons/images/newlook24/053-open.png</iconset>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="txtHost"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Host application for DLL:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources>
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -25,6 +25,7 @@
#include "projectoutputwidget.h"
#include "projectmakefilewidget.h"
#include "projectversioninfowidget.h"
#include "projectdllhostwidget.h"
#include <QDebug>
#include <QMessageBox>
#include <QModelIndex>
@ -189,6 +190,10 @@ PSettingsDialog SettingsDialog::projectOptionDialog()
widget->init();
dialog->addWidget(widget);
widget = new ProjectDLLHostWidget(tr("DLL host"),tr("Project"));
widget->init();
dialog->addWidget(widget);
widget = new ProjectVersionInfoWidget(tr("Version info"),tr("Project"));
widget->init();
dialog->addWidget(widget);