work save

This commit is contained in:
Roy Qu 2021-11-24 10:07:35 +08:00
parent 9fd06a9837
commit fdfa7c779f
17 changed files with 57 additions and 129 deletions

View File

@ -49,8 +49,6 @@ public:
const QString &newFileTemplate() const;
void setNewFileTemplate(const QString &newNewFileTemplate);
signals:
private:
void loadSnippets();
void saveSnippets();

View File

@ -19,7 +19,6 @@ public:
bool findOccurence(const QString& statementFullname, SearchFileScope scope);
void renameSymbol(Editor* editor, const BufferCoord& pos, const QString& word, const QString& newWord);
signals:
private:
void doFindOccurenceInEditor(PStatement statement, Editor* editor, const PCppParser& parser);
void doFindOccurenceInProject(PStatement statement, std::shared_ptr<Project> project, const PCppParser& parser);

View File

@ -63,12 +63,16 @@ bool Debugger::start()
connect(mReader, &QThread::finished,this,&Debugger::clearUpReader);
connect(mReader, &DebugReader::parseFinished,this,&Debugger::syncFinishedParsing,Qt::BlockingQueuedConnection);
connect(mReader, &DebugReader::changeDebugConsoleLastLine,this,&Debugger::onChangeDebugConsoleLastline);
connect(this, &Debugger::localsReady,pMainWindow,&MainWindow::onLocalsReady);
connect(mReader, &DebugReader::cmdStarted,pMainWindow, &MainWindow::disableDebugActions);
connect(mReader, &DebugReader::cmdFinished,pMainWindow, &MainWindow::enableDebugActions);
connect(mReader, &DebugReader::breakpointInfoGetted, mBreakpointModel,
&BreakpointModel::updateBreakpointNumber);
connect(mReader, &DebugReader::localsUpdated, pMainWindow,
&MainWindow::onLocalsReady);
connect(mReader, &DebugReader::memoryUpdated,[this](const QStringList memory) {
emit memoryExamineReady(memory);
});
mReader->start();
mReader->waitStart();
@ -439,7 +443,7 @@ void Debugger::syncFinishedParsing()
bool spawnedcpuform = false;
// GDB determined that the source code is more recent than the executable. Ask the user if he wants to rebuild.
if (mReader->doreceivedsfwarning) {
if (mReader->receivedSFWarning()) {
if (QMessageBox::question(pMainWindow,
tr("Compile"),
tr("Source file is more recent than executable.")+"<BR /><BR />" + tr("Recompile?"),
@ -458,20 +462,6 @@ void Debugger::syncFinishedParsing()
return;
}
// An evaluation variable has been processed. Forward the results
if (mReader->evalReady()) {
//pMainWindow->updateDebugEval(mReader->mEvalValue);
emit evalValueReady(mReader->evalValue());
}
if (mReader->updateMemory()) {
emit memoryExamineReady(mReader->memoryValue());
}
if (mReader->updateLocals()) {
emit localsReady(mReader->localsValue());
}
// show command output
if (pSettings->debugger().showCommandLog() ||
(mReader->mCurrentCmd && mReader->mCurrentCmd->showInConsole)) {
@ -567,7 +557,7 @@ void Debugger::syncFinishedParsing()
}
}
void Debugger::onChangeDebugConsoleLastline(const QString &text)
void Debugger::onChangeDebugConsoleLastline(const QString& text)
{
//pMainWindow->changeDebugOutputLastline(text);
pMainWindow->addDebugOutput(text);
@ -1143,11 +1133,12 @@ void DebugReader::processExecAsyncRecord(const QByteArray &line)
if (!parser.parseAsyncResult(line,result,multiValues))
return;
if (result == "running") {
mInferiorPaused = false;
mInferiorRunning = true;
emit inferiorContinued();
return;
}
if (result == "*stopped") {
mInferiorPaused = true;
mInferiorRunning = false;
QByteArray reason = multiValues["reason"].value();
if (reason == "exited") {
//inferior exited, gdb should terminate too
@ -1159,10 +1150,14 @@ void DebugReader::processExecAsyncRecord(const QByteArray &line)
mProcessExited = true;
return;
}
mUpdateExecution = true;
if (reason == "exited-signalled") {
//inferior exited, gdb should terminate too
mProcessExited = true;
mSignalReceived = true;
return;
}
mUpdateCPUInfo = true;
mBreakPointFile = multiValues["fullname"].pathValue();
mBreakPointLine = multiValues["line"].intValue();
emit inferiorStopped(multiValues["fullname"].pathValue(), multiValues["line"].intValue());
if (reason == "signal-received") {
mSignalReceived = true;
}
@ -1222,6 +1217,7 @@ void DebugReader::processDebugOutput(const QByteArray& debugOutput)
mUpdateCPUInfo = false;
mUpdateLocals = false;
mEvalReady = false;
mReceivedSFWarning = false;
dodisassemblerready = false;
doregistersready = false;
@ -1260,62 +1256,6 @@ void DebugReader::processDebugOutput(const QByteArray& debugOutput)
}
}
// Global checks
if (mOutput.indexOf("warning: Source file is more recent than executable.") >= 0)
doreceivedsfwarning = true;
mIndex = 0;
AnnotationType nextAnnotation;
do {
nextAnnotation = getNextAnnotation();
switch(nextAnnotation) {
case AnnotationType::TValueHistoryValue:
handleValueHistoryValue();
break;
case AnnotationType::TSignal:
handleSignal();
break;
case AnnotationType::TExit:
handleExit();
break;
case AnnotationType::TFrameBegin:
handleFrames();
break;
case AnnotationType::TInfoAsm:
handleDisassembly();
break;
case AnnotationType::TInfoReg:
handleRegisters();
break;
case AnnotationType::TLocal:
handleLocals();
break;
case AnnotationType::TParam:
handleParams();
break;
case AnnotationType::TMemory:
handleMemory();
break;
case AnnotationType::TErrorBegin:
handleError();
break;
case AnnotationType::TDisplayBegin:
handleDisplay();
break;
case AnnotationType::TSource:
handleSource();
break;
default:
break;
}
} while (nextAnnotation != AnnotationType::TEOF);
// Only update once per update at most
//finally
//WatchView.Items.EndUpdate;
//end;
emit parseFinished();
}
@ -1685,23 +1625,23 @@ void DebugReader::handleStack(const QList<GDBMIResultParser::ParseValue> & stack
void DebugReader::handleLocalVariables(const QList<GDBMIResultParser::ParseValue> &variables)
{
mUpdateLocals=true;
QStringList locals;
foreach (const GDBMIResultParser::ParseValue& varValue, variables) {
GDBMIResultParser::ParseObject varObject = varValue.object();
mLocalsValue.append(QString("%1 = %2")
locals.append(QString("%1 = %2")
.arg(varObject["name"].value(),varObject["value"].value()));
}
emit localsUpdated(locals);
}
void DebugReader::handleEvaluation(const QString &value)
{
mEvalReady = true;
mEvalValue = value;
emit evalUpdated(value);
}
void DebugReader::handleMemory(const QList<GDBMIResultParser::ParseValue> &rows)
{
mUpdateMemory = true;
QStringList memory;
foreach (const GDBMIResultParser::ParseValue& row, rows) {
GDBMIResultParser::ParseObject rowObject = row.object();
QList<GDBMIResultParser::ParseValue> data = rowObject["data"].array();
@ -1709,9 +1649,10 @@ void DebugReader::handleMemory(const QList<GDBMIResultParser::ParseValue> &rows)
foreach (const GDBMIResultParser::ParseValue& val, data) {
values.append(val.value());
}
mLocalsValue.append(QString("%1 %2")
memory.append(QString("%1 %2")
.arg(rowObject["addr"].value(),values.join(" ")));
}
emit memoryUpdated(memory);
}
QByteArray DebugReader::removeToken(const QByteArray &line)
@ -1729,6 +1670,11 @@ QByteArray DebugReader::removeToken(const QByteArray &line)
return line;
}
bool DebugReader::receivedSFWarning() const
{
return mReceivedSFWarning;
}
const QStringList &DebugReader::memoryValue() const
{
return mMemoryValue;
@ -1842,7 +1788,7 @@ bool DebugReader::waitStart()
void DebugReader::run()
{
mStop = false;
mInferiorPaused = false;
mInferiorRunning = false;
mProcessExited = false;
bool errorOccurred = false;
QString cmd = mDebuggerPath;
@ -2098,7 +2044,7 @@ void BreakpointModel::load(const QString &filename)
}
}
void BreakpointModel::updateBreakpointNumber(const QString &filename, int line, int number)
void BreakpointModel::updateBreakpointNumber(const QString& filename, int line, int number)
{
foreach (PBreakpoint bp, mList) {
if (bp->filename == filename && bp->line == line) {
@ -2108,7 +2054,7 @@ void BreakpointModel::updateBreakpointNumber(const QString &filename, int line,
}
}
void BreakpointModel::onFileDeleteLines(const QString &filename, int startLine, int count)
void BreakpointModel::onFileDeleteLines(const QString& filename, int startLine, int count)
{
for (int i = mList.count()-1;i>=0;i--){
PBreakpoint breakpoint = mList[i];
@ -2124,7 +2070,7 @@ void BreakpointModel::onFileDeleteLines(const QString &filename, int startLine,
}
}
void BreakpointModel::onFileInsertLines(const QString &filename, int startLine, int count)
void BreakpointModel::onFileInsertLines(const QString& filename, int startLine, int count)
{
for (int i = mList.count()-1;i>=0;i--){
PBreakpoint breakpoint = mList[i];

View File

@ -309,6 +309,8 @@ public:
const QStringList &memoryValue() const;
bool receivedSFWarning() const;
signals:
void parseStarted();
void invalidateAllVars();
@ -322,6 +324,11 @@ signals:
void cmdFinished();
void breakpointInfoGetted(const QString& filename, int line, int number);
void inferiorContinued();
void inferiorStopped(const QString& filename, int line);
void localsUpdated(const QStringList& localsValue);
void evalUpdated(const QString& value);
void memoryUpdated(const QStringList& memoryValues);
private:
void clearCmdQueue();
bool outputTerminated(QByteArray& text);
@ -374,7 +381,6 @@ private:
QProcess* mProcess;
//fWatchView: TTreeView;
int mIndex;
QString mSignal;
bool mUseUTF8;
@ -390,22 +396,18 @@ private:
bool doupdatememoryview;
//
bool mInferiorPaused;
bool mInferiorRunning;
bool mProcessExited;
bool mUpdateExecution;
bool mSignalReceived;
bool mUpdateCPUInfo;
bool mUpdateLocals;
bool mEvalReady;
bool mUpdateMemory;
bool mReceivedSFWarning;
QStringList mConsoleOutput;
int mBreakPointLine;
QString mBreakPointFile;
QStringList mLocalsValue;
QString mEvalValue;
QStringList mMemoryValue;
bool mStop;
// QThread interface

View File

@ -1513,7 +1513,7 @@ void Editor::onGutterClicked(Qt::MouseButton button, int , int , int line)
mGutterClickedLine = line;
}
void Editor::onTipEvalValueReady(const QString &value)
void Editor::onTipEvalValueReady(const QString& value)
{
if (mCurrentWord == mCurrentDebugTipWord) {
QString newValue;

View File

@ -23,7 +23,6 @@ public:
const PIcon &bookmark() const;
const PIcon &folder() const;
signals:
private:
PIcon mSyntaxError;
PIcon mSyntaxWarning;

View File

@ -2895,7 +2895,7 @@ void MainWindow::onShowInsertCodeSnippetMenu()
}
void MainWindow::onEditorContextMenu(const QPoint &pos)
void MainWindow::onEditorContextMenu(const QPoint& pos)
{
Editor * editor = mEditorList->getEditor();
if (!editor)
@ -2964,12 +2964,12 @@ void MainWindow::onEditorContextMenu(const QPoint &pos)
menu.exec(editor->viewport()->mapToGlobal(pos));
}
void MainWindow::onEditorRightTabContextMenu(const QPoint &pos)
void MainWindow::onEditorRightTabContextMenu(const QPoint& pos)
{
onEditorTabContextMenu(ui->EditorTabsRight,pos);
}
void MainWindow::onEditorLeftTabContextMenu(const QPoint &pos)
void MainWindow::onEditorLeftTabContextMenu(const QPoint& pos)
{
onEditorTabContextMenu(ui->EditorTabsLeft,pos);
}
@ -3031,7 +3031,7 @@ void MainWindow::onTodoParseStarted(const QString&)
mTodoModel.clear();
}
void MainWindow::onTodoParsing(const QString &filename, int lineNo, int ch, const QString &line)
void MainWindow::onTodoParsing(const QString& filename, int lineNo, int ch, const QString& line)
{
mTodoModel.addItem(filename,lineNo,ch,line);
}
@ -3485,7 +3485,7 @@ void MainWindow::onCompilerSetChanged(int index)
pSettings->compilerSets().saveDefaultIndex();
}
void MainWindow::onCompileLog(const QString &msg)
void MainWindow::onCompileLog(const QString& msg)
{
ui->txtCompilerOutput->appendPlainText(msg);
ui->txtCompilerOutput->moveCursor(QTextCursor::End);
@ -3626,12 +3626,12 @@ void MainWindow::onCompileFinished(bool isCheckSyntax)
updateAppTitle();
}
void MainWindow::onCompileErrorOccured(const QString &reason)
void MainWindow::onCompileErrorOccured(const QString& reason)
{
QMessageBox::critical(this,tr("Compile Failed"),reason);
}
void MainWindow::onRunErrorOccured(const QString &reason)
void MainWindow::onRunErrorOccured(const QString& reason)
{
mCompilerManager->stopRun();
QMessageBox::critical(this,tr("Run Failed"),reason);
@ -3666,7 +3666,7 @@ void MainWindow::onOJProblemCaseStarted(const QString& id,int current, int total
}
}
void MainWindow::onOJProblemCaseFinished(const QString &id, int current, int total)
void MainWindow::onOJProblemCaseFinished(const QString& id, int current, int total)
{
int row = mOJProblemModel.getCaseIndexById(id);
if (row>=0) {
@ -3695,7 +3695,7 @@ void MainWindow::cleanUpCPUDialog()
ptr->deleteLater();
}
void MainWindow::onDebugCommandInput(const QString &command)
void MainWindow::onDebugCommandInput(const QString& command)
{
if (mDebugger->executing()) {
mDebugger->sendCommand(command,"",true,true);
@ -4137,14 +4137,14 @@ void MainWindow::onEndParsing(int total, int)
}
}
void MainWindow::onEvalValueReady(const QString &value)
void MainWindow::onEvalValueReady(const QString& value)
{
updateDebugEval(value);
disconnect(mDebugger, &Debugger::evalValueReady,
this, &MainWindow::onEvalValueReady);
}
void MainWindow::onMemoryExamineReady(const QStringList &value)
void MainWindow::onMemoryExamineReady(const QStringList& value)
{
ui->txtMemoryView->clear();
foreach (QString s, value) {
@ -4156,7 +4156,7 @@ void MainWindow::onMemoryExamineReady(const QStringList &value)
this, &MainWindow::onMemoryExamineReady);
}
void MainWindow::onLocalsReady(const QStringList &value)
void MainWindow::onLocalsReady(const QStringList& value)
{
ui->txtLocals->clear();
foreach (QString s, value) {

View File

@ -74,9 +74,6 @@ public:
const QList<QString> &includePathList() const;
const QList<QString> &projectIncludePathList() const;
signals:
private:
void preprocessBuffer();
void skipToEndOfPreprocessor();

View File

@ -21,7 +21,6 @@ public:
const TokenList& tokens();
PToken operator[](int i);
int tokenCount();
signals:
private:
void addToken(const QString& sText, int iLine);
void advance();

View File

@ -22,8 +22,6 @@ public:
#ifdef QT_DEBUG
void dumpAll(const QString& logFile);
#endif
signals:
private:
void addMember(StatementMap& map, const PStatement& statement);
int deleteMember(StatementMap& map, const PStatement& statement);

View File

@ -54,8 +54,6 @@ private:
QString mIcon; // icon in project form
PSimpleIni mIni;
int mVersion;
signals:
};
using PProjectTemplate = std::shared_ptr<ProjectTemplate>;

View File

@ -26,8 +26,6 @@ public:
void setShortcuts(QList<PEnvironmentShortcut> shortcuts);
void applyTo(QList<QAction*> actions);
void applyTo(QAction* action);
signals:
private:
private:
QMap<QString,PEnvironmentShortcut> mShortcuts;

View File

@ -22,7 +22,6 @@ public:
void reset();
PSymbolUsage findUsage(const QString& fullName) const;
void updateUsage(const QString& symbol, int count);
signals:
private:
QHash<QString, PSymbolUsage> mUsages;
};

View File

@ -86,7 +86,6 @@ class ThemeManager : public QObject
public:
explicit ThemeManager(QObject *parent = nullptr);
PAppTheme theme(const QString& themeName);
signals:
};
#endif // THEMEMANAGER_H

View File

@ -64,7 +64,6 @@ public:
void parseFile(const QString& filename);
bool parsing() const;
signals:
private:
TodoThread* mThread;
QRecursiveMutex mMutex;

View File

@ -24,8 +24,6 @@ public:
const QList<PToolItem> &tools() const;
PToolItem findTool(const QString& title);
void setTools(const QList<PToolItem> &newTools);
signals:
private:
QList<PToolItem> mTools;
};

View File

@ -37,7 +37,6 @@ public:
const QString &functionFullName() const;
void setFunctioFullName(const QString &newFunctioFullName);
signals:
private:
QStringList splitArgs(QString args);
private: