Merge branch 'master' of github.com:royqh1979/RedPanda-CPP
# Conflicts: # NEWS.md # RedPandaIDE/version.h
This commit is contained in:
commit
f8591c2138
22
NEWS.md
22
NEWS.md
|
@ -1,5 +1,25 @@
|
|||
Version 0.10.2 For Dev-C++ 7 Beta
|
||||
- fix: select by mouse can't correctly set mouse's column position
|
||||
- fix: dragging out of the editor and back will cause error
|
||||
- fix: dragging text from lines in the front to lines back will cause error
|
||||
- fix: dragging text onto itself should do nothing
|
||||
- fix:license info in the about dialog should be readonly
|
||||
- enhancement: change project name in the project view
|
||||
|
||||
Version 0.10.1 For Dev-C++ 7 Beta
|
||||
- fix: can't correctly expand watch expression that has spaces in it
|
||||
- fix: can't correctly display stl containers in watch
|
||||
- fix: the last line in the debug console is not correctly displayed
|
||||
- enhancement: scroll while dragging text in the editor
|
||||
- fix: dragging out of the editor shouldn't reset the caret back
|
||||
|
||||
Version 0.10.0 For Dev-C++ 7 Beta
|
||||
- enhancement: use gdb/mi interface to communicate with gdb debug session
|
||||
- enhancement: better display of watch vars
|
||||
- fix: project's modified flag not cleared after saved
|
||||
|
||||
Version 0.9.4 For Dev-C++ 7 Beta
|
||||
- fix: code format indent settings not correctly saved
|
||||
- fix: code formatter's "indent type" option not correctly saved
|
||||
|
||||
Version 0.9.3 For Dev-C++ 7 Beta
|
||||
- fix: the count in the title of issues view isn't correct
|
||||
|
|
|
@ -25,6 +25,7 @@ SOURCES += \
|
|||
compiler/ojproblemcasesrunner.cpp \
|
||||
compiler/projectcompiler.cpp \
|
||||
compiler/runner.cpp \
|
||||
gdbmiresultparser.cpp \
|
||||
platform.cpp \
|
||||
compiler/compiler.cpp \
|
||||
compiler/compilermanager.cpp \
|
||||
|
@ -134,7 +135,8 @@ SOURCES += \
|
|||
widgets/qconsole.cpp \
|
||||
widgets/qpatchedcombobox.cpp \
|
||||
widgets/searchdialog.cpp \
|
||||
widgets/searchresultview.cpp
|
||||
widgets/searchresultview.cpp \
|
||||
widgets/signalmessagedialog.cpp
|
||||
|
||||
HEADERS += \
|
||||
ConvertUTF.h \
|
||||
|
@ -154,6 +156,7 @@ HEADERS += \
|
|||
compiler/runner.h \
|
||||
compiler/stdincompiler.h \
|
||||
cpprefacter.h \
|
||||
gdbmiresultparser.h \
|
||||
parser/cppparser.h \
|
||||
parser/cpppreprocessor.h \
|
||||
parser/cpptokenizer.h \
|
||||
|
@ -258,7 +261,8 @@ HEADERS += \
|
|||
widgets/qconsole.h \
|
||||
widgets/qpatchedcombobox.h \
|
||||
widgets/searchdialog.h \
|
||||
widgets/searchresultview.h
|
||||
widgets/searchresultview.h \
|
||||
widgets/signalmessagedialog.h
|
||||
|
||||
FORMS += \
|
||||
settingsdialog/compilerautolinkwidget.ui \
|
||||
|
@ -303,7 +307,8 @@ FORMS += \
|
|||
widgets/filepropertiesdialog.ui \
|
||||
widgets/newprojectdialog.ui \
|
||||
widgets/ojproblempropertywidget.ui \
|
||||
widgets/searchdialog.ui
|
||||
widgets/searchdialog.ui \
|
||||
widgets/signalmessagedialog.ui
|
||||
|
||||
TRANSLATIONS += \
|
||||
RedPandaIDE_zh_CN.ts
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -49,8 +49,6 @@ public:
|
|||
const QString &newFileTemplate() const;
|
||||
void setNewFileTemplate(const QString &newNewFileTemplate);
|
||||
|
||||
signals:
|
||||
|
||||
private:
|
||||
void loadSnippets();
|
||||
void saveSnippets();
|
||||
|
|
|
@ -93,7 +93,7 @@ void ExecutableRunner::run()
|
|||
process.start();
|
||||
process.waitForStarted(5000);
|
||||
if (process.state()==QProcess::Running && redirectInput()) {
|
||||
process.write(ReadFileToByteArray(redirectInputFilename()));
|
||||
process.write(readFileToByteArray(redirectInputFilename()));
|
||||
process.closeWriteChannel();
|
||||
}
|
||||
while (true) {
|
||||
|
|
|
@ -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);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -13,37 +13,16 @@
|
|||
#include <QSemaphore>
|
||||
#include <QThread>
|
||||
#include <memory>
|
||||
#include "gdbmiresultparser.h"
|
||||
|
||||
enum class DebugCommandSource {
|
||||
Console,
|
||||
Other
|
||||
};
|
||||
|
||||
enum class AnnotationType {
|
||||
TPrePrompt, TPrompt, TPostPrompt,
|
||||
TSource,
|
||||
TDisplayBegin, TDisplayEnd,
|
||||
TDisplayExpression,
|
||||
TFrameSourceFile, TFrameSourceBegin, TFrameSourceLine, TFrameFunctionName, TFrameWhere,
|
||||
TFrameArgs,
|
||||
TFrameBegin, TFrameEnd,
|
||||
TErrorBegin, TErrorEnd,
|
||||
TArrayBegin, TArrayEnd,
|
||||
TElt, TEltRep, TEltRepEnd,
|
||||
TExit,
|
||||
TSignal, TSignalName, TSignalNameEnd, TSignalString, TSignalStringEnd,
|
||||
TValueHistoryValue, TValueHistoryBegin, TValueHistoryEnd,
|
||||
TArgBegin, TArgEnd, TArgValue, TArgNameEnd,
|
||||
TFieldBegin, TFieldEnd, TFieldValue, TFieldNameEnd,
|
||||
TInfoReg, TInfoAsm,
|
||||
TUnknown, TEOF,
|
||||
TLocal, TParam, TMemory
|
||||
};
|
||||
|
||||
struct DebugCommand{
|
||||
QString command;
|
||||
QString params;
|
||||
bool updateWatch;
|
||||
bool showInConsole;
|
||||
DebugCommandSource source;
|
||||
};
|
||||
|
||||
|
@ -52,14 +31,19 @@ struct WatchVar;
|
|||
using PWatchVar = std::shared_ptr<WatchVar>;
|
||||
struct WatchVar {
|
||||
QString name;
|
||||
QString expression;
|
||||
bool hasMore;
|
||||
QString value;
|
||||
QString fullName;
|
||||
int gdbIndex;
|
||||
QString type;
|
||||
int numChild;
|
||||
QList<PWatchVar> children;
|
||||
WatchVar * parent; //use raw point to prevent circular-reference
|
||||
};
|
||||
|
||||
struct Breakpoint {
|
||||
int number; // breakpoint number
|
||||
QString type; // type of the breakpoint
|
||||
QString catch_type;
|
||||
int line;
|
||||
QString filename;
|
||||
QString condition;
|
||||
|
@ -71,19 +55,13 @@ using PBreakpoint = std::shared_ptr<Breakpoint>;
|
|||
struct Trace {
|
||||
QString funcname;
|
||||
QString filename;
|
||||
QString address;
|
||||
int line;
|
||||
int level;
|
||||
};
|
||||
|
||||
using PTrace = std::shared_ptr<Trace>;
|
||||
|
||||
struct Register {
|
||||
QString name;
|
||||
QString hexValue;
|
||||
QString decValue;
|
||||
};
|
||||
|
||||
using PRegister = std::shared_ptr<Register>;
|
||||
|
||||
class RegisterModel: public QAbstractTableModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -92,10 +70,12 @@ public:
|
|||
int columnCount(const QModelIndex &parent) const override;
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
void update(const QList<PRegister>& regs);
|
||||
void updateNames(const QStringList& regNames);
|
||||
void updateValues(const QHash<int,QString> registerValues);
|
||||
void clear();
|
||||
private:
|
||||
QList<PRegister> mRegisters;
|
||||
QStringList mRegisterNames;
|
||||
QHash<int,QString> mRegisterValues;
|
||||
};
|
||||
|
||||
class BreakpointModel: public QAbstractTableModel {
|
||||
|
@ -116,6 +96,8 @@ public:
|
|||
void save(const QString& filename);
|
||||
void load(const QString& filename);
|
||||
public slots:
|
||||
void updateBreakpointNumber(const QString& filename, int line, int number);
|
||||
void invalidateAllBreakpointNumbers(); // call this when gdb is stopped
|
||||
void onFileDeleteLines(const QString& filename, int startLine, int count);
|
||||
void onFileInsertLines(const QString& filename, int startLine, int count);
|
||||
private:
|
||||
|
@ -149,29 +131,51 @@ public:
|
|||
QModelIndex index(int row, int column,
|
||||
const QModelIndex &parent = QModelIndex()) const override;
|
||||
QModelIndex parent(const QModelIndex &index) const override;
|
||||
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
void fetchMore(const QModelIndex &parent) override;
|
||||
bool canFetchMore(const QModelIndex &parent) const override;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
bool hasChildren(const QModelIndex &parent) const override;
|
||||
void addWatchVar(PWatchVar watchVar);
|
||||
void removeWatchVar(const QString& name);
|
||||
void removeWatchVar(int gdbIndex);
|
||||
void removeWatchVar(const QString& expression);
|
||||
void removeWatchVar(const QModelIndex& index);
|
||||
void clear();
|
||||
const QList<PWatchVar>& watchVars();
|
||||
PWatchVar findWatchVar(const QString& name);
|
||||
PWatchVar findWatchVar(int gdbIndex);
|
||||
PWatchVar findWatchVar(const QModelIndex& index);
|
||||
PWatchVar findWatchVar(const QString& expr);
|
||||
void resetAllVarInfos();
|
||||
void clearAllVarInfos();
|
||||
void beginUpdate();
|
||||
void endUpdate();
|
||||
void notifyUpdated(PWatchVar var);
|
||||
void save(const QString& filename);
|
||||
void load(const QString& filename);
|
||||
public slots:
|
||||
void updateVarInfo(const QString& expression,
|
||||
const QString& name,
|
||||
int numChild,
|
||||
const QString& value,
|
||||
const QString& type,
|
||||
bool hasMore);
|
||||
void prepareVarChildren(const QString& parentName, int numChild, bool hasMore);
|
||||
void addVarChild(const QString& parentName, const QString& name,
|
||||
const QString& exp, int numChild,
|
||||
const QString& value, const QString& type,
|
||||
bool hasMore);
|
||||
void updateVarValue(const QString& name, const QString& val,
|
||||
const QString& inScope, bool typeChanged,
|
||||
const QString& newType, int newNumChildren,
|
||||
bool hasMore);
|
||||
signals:
|
||||
void fetchChildren(const QString& name);
|
||||
private:
|
||||
QModelIndex index(PWatchVar var) const;
|
||||
QModelIndex index(WatchVar* pVar) const;
|
||||
private:
|
||||
QList<PWatchVar> mWatchVars;
|
||||
QHash<QString,PWatchVar> mVarIndex;
|
||||
int mUpdateCount;
|
||||
|
||||
// QAbstractItemModel interface
|
||||
public:
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
};
|
||||
|
||||
|
||||
|
@ -188,10 +192,9 @@ public:
|
|||
// Play/pause
|
||||
bool start();
|
||||
void sendCommand(const QString& command, const QString& params,
|
||||
bool updateWatch = true,
|
||||
bool showInConsole = false,
|
||||
DebugCommandSource source = DebugCommandSource::Other);
|
||||
bool commandRunning();
|
||||
bool inferiorRunning();
|
||||
|
||||
//breakpoints
|
||||
void addBreakpoint(int line, const Editor* editor);
|
||||
|
@ -208,27 +211,14 @@ public:
|
|||
void sendAllBreakpointsToDebugger();
|
||||
|
||||
//watch vars
|
||||
void addWatchVar(const QString& namein);
|
||||
// void removeWatchVar(nodein: TTreeNode); overload;
|
||||
void renameWatchVar(const QString& oldname, const QString& newname);
|
||||
void addWatchVar(const QString& expression);
|
||||
void modifyWatchVarExpression(const QString& oldExpr, const QString& newExpr);
|
||||
|
||||
void refreshWatchVars();
|
||||
void removeWatchVars(bool deleteparent);
|
||||
void removeWatchVar(const QModelIndex& index);
|
||||
void invalidateAllVars();
|
||||
void sendAllWatchvarsToDebugger();
|
||||
void invalidateWatchVar(const QString& name);
|
||||
void invalidateWatchVar(PWatchVar var);
|
||||
PWatchVar findWatchVar(const QString& name);
|
||||
void sendAllWatchVarsToDebugger();
|
||||
PWatchVar findWatchVar(const QString& expression);
|
||||
// void notifyWatchVarUpdated(PWatchVar var);
|
||||
void notifyBeforeProcessWatchVar();
|
||||
void notifyAfterProcessWatchVar();
|
||||
|
||||
|
||||
void updateDebugInfo();
|
||||
|
||||
bool useUTF8() const;
|
||||
void setUseUTF8(bool useUTF8);
|
||||
|
||||
BacktraceModel* backtraceModel();
|
||||
BreakpointModel* breakpointModel();
|
||||
|
@ -257,14 +247,19 @@ private:
|
|||
|
||||
private slots:
|
||||
void syncFinishedParsing();
|
||||
void updateMemory(const QStringList& value);
|
||||
void updateEval(const QString& value);
|
||||
void updateDisassembly(const QString& file, const QString& func,const QStringList& value);
|
||||
void onChangeDebugConsoleLastline(const QString& text);
|
||||
void clearUpReader();
|
||||
|
||||
void updateRegisterNames(const QStringList& registerNames);
|
||||
void updateRegisterValues(const QHash<int,QString>& values);
|
||||
void refreshWatchVars();
|
||||
void fetchVarChildren(const QString& varName);
|
||||
private:
|
||||
bool mExecuting;
|
||||
bool mCommandChanged;
|
||||
BreakpointModel *mBreakpointModel;
|
||||
bool mUseUTF8;
|
||||
BacktraceModel *mBacktraceModel;
|
||||
WatchModel *mWatchModel;
|
||||
RegisterModel *mRegisterModel;
|
||||
|
@ -277,102 +272,145 @@ class DebugReader : public QThread
|
|||
Q_OBJECT
|
||||
public:
|
||||
explicit DebugReader(Debugger* debugger, QObject *parent = nullptr);
|
||||
void postCommand(const QString &Command, const QString &Params,
|
||||
bool UpdateWatch, bool ShowInConsole, DebugCommandSource Source);
|
||||
void postCommand(const QString &Command, const QString &Params, DebugCommandSource Source);
|
||||
void registerInferiorStoppedCommand(const QString &Command, const QString &Params);
|
||||
QString debuggerPath() const;
|
||||
void setDebuggerPath(const QString &debuggerPath);
|
||||
void stopDebug();
|
||||
|
||||
bool commandRunning();
|
||||
void waitStart();
|
||||
|
||||
bool invalidateAllVars() const;
|
||||
void setInvalidateAllVars(bool invalidateAllVars);
|
||||
bool inferiorPaused() const;
|
||||
|
||||
bool processExited() const;
|
||||
|
||||
bool signalReceived() const;
|
||||
|
||||
const QStringList &consoleOutput() const;
|
||||
|
||||
int breakPointLine() const;
|
||||
|
||||
const QString &breakPointFile() const;
|
||||
|
||||
const PDebugCommand ¤tCmd() const;
|
||||
|
||||
bool updateCPUInfo() const;
|
||||
|
||||
bool updateLocals() const;
|
||||
|
||||
const QStringList &localsValue() const;
|
||||
|
||||
bool evalReady() const;
|
||||
|
||||
const QString &evalValue() const;
|
||||
|
||||
bool updateMemory() const;
|
||||
|
||||
const QStringList &memoryValue() const;
|
||||
|
||||
bool receivedSFWarning() const;
|
||||
|
||||
const QStringList &fullOutput() const;
|
||||
|
||||
bool inferiorRunning() const;
|
||||
|
||||
const QString &signalName() const;
|
||||
|
||||
const QString &signalMeaning() const;
|
||||
|
||||
signals:
|
||||
void parseStarted();
|
||||
void invalidateAllVars();
|
||||
void parseFinished();
|
||||
void writeToDebugFailed();
|
||||
void pauseWatchUpdate();
|
||||
void updateWatch();
|
||||
void processError(QProcess::ProcessError error);
|
||||
void changeDebugConsoleLastLine(const QString& text);
|
||||
void cmdStarted();
|
||||
void cmdFinished();
|
||||
|
||||
void breakpointInfoGetted(const QString& filename, int line, int number);
|
||||
void inferiorContinued();
|
||||
void inferiorStopped(const QString& filename, int line, bool setFocus);
|
||||
void localsUpdated(const QStringList& localsValue);
|
||||
void evalUpdated(const QString& value);
|
||||
void memoryUpdated(const QStringList& memoryValues);
|
||||
void disassemblyUpdate(const QString& filename, const QString& funcName, const QStringList& result);
|
||||
void registerNamesUpdated(const QStringList& registerNames);
|
||||
void registerValuesUpdated(const QHash<int,QString>& values);
|
||||
void varCreated(const QString& expression,
|
||||
const QString& name,
|
||||
int numChild,
|
||||
const QString& value,
|
||||
const QString& type,
|
||||
bool hasMore);
|
||||
void prepareVarChildren(const QString& parentName,int numChild, bool hasMore);
|
||||
void addVarChild(const QString& parentName, const QString& name,
|
||||
const QString& exp, int numChild,
|
||||
const QString& value, const QString& type,
|
||||
bool hasMore);
|
||||
void varValueUpdated(const QString& name, const QString& val,
|
||||
const QString& inScope, bool typeChanged,
|
||||
const QString& newType, int newNumChildren,
|
||||
bool hasMore);
|
||||
private:
|
||||
void clearCmdQueue();
|
||||
bool findAnnotation(AnnotationType annotation);
|
||||
AnnotationType getAnnotation(const QString& s);
|
||||
AnnotationType getLastAnnotation(const QByteArray& text);
|
||||
AnnotationType getNextAnnotation();
|
||||
QString getNextFilledLine();
|
||||
QString getNextLine();
|
||||
QString getNextWord();
|
||||
QString getRemainingLine();
|
||||
void handleDisassembly();
|
||||
void handleDisplay();
|
||||
void handleError();
|
||||
void handleExit();
|
||||
void handleFrames();
|
||||
void handleLocalOutput();
|
||||
void handleLocals();
|
||||
void handleMemory();
|
||||
void handleParams();
|
||||
void handleRegisters();
|
||||
void handleSignal();
|
||||
void handleSource();
|
||||
void handleValueHistoryValue();
|
||||
AnnotationType peekNextAnnotation();
|
||||
void processDebugOutput();
|
||||
QString processEvalOutput();
|
||||
void processWatchOutput(PWatchVar WatchVar);
|
||||
|
||||
void runNextCmd();
|
||||
void skipSpaces();
|
||||
void skipToAnnotation();
|
||||
QStringList tokenize(const QString& s);
|
||||
|
||||
bool outputTerminated(const QByteArray& text);
|
||||
void handleBreakpoint(const GDBMIResultParser::ParseObject& breakpoint);
|
||||
void handleStack(const QList<GDBMIResultParser::ParseValue> & stack);
|
||||
void handleLocalVariables(const QList<GDBMIResultParser::ParseValue> & variables);
|
||||
void handleEvaluation(const QString& value);
|
||||
void handleMemory(const QList<GDBMIResultParser::ParseValue> & rows);
|
||||
void handleRegisterNames(const QList<GDBMIResultParser::ParseValue> & names);
|
||||
void handleRegisterValue(const QList<GDBMIResultParser::ParseValue> & values);
|
||||
void handleCreateVar(const GDBMIResultParser::ParseObject& multiVars);
|
||||
void handleListVarChildren(const GDBMIResultParser::ParseObject& multiVars);
|
||||
void handleUpdateVarValue(const QList<GDBMIResultParser::ParseValue> &changes);
|
||||
void processConsoleOutput(const QByteArray& line);
|
||||
void processResult(const QByteArray& result);
|
||||
void processExecAsyncRecord(const QByteArray& line);
|
||||
void processError(const QByteArray& errorLine);
|
||||
void processResultRecord(const QByteArray& line);
|
||||
void processDebugOutput(const QByteArray& debugOutput);
|
||||
void runInferiorStoppedHook();
|
||||
QByteArray removeToken(const QByteArray& line);
|
||||
private:
|
||||
Debugger *mDebugger;
|
||||
QString mDebuggerPath;
|
||||
QRecursiveMutex mCmdQueueMutex;
|
||||
QSemaphore mStartSemaphore;
|
||||
QQueue<PDebugCommand> mCmdQueue;
|
||||
int mUpdateCount;
|
||||
bool mInvalidateAllVars;
|
||||
|
||||
//fOnInvalidateAllVars: TInvalidateAllVarsEvent;
|
||||
bool mCmdRunning;
|
||||
PDebugCommand mCurrentCmd;
|
||||
QList<PRegister> mRegisters;
|
||||
QStringList mDisassembly;
|
||||
|
||||
QProcess* mProcess;
|
||||
|
||||
//fWatchView: TTreeView;
|
||||
int mIndex;
|
||||
int mBreakPointLine;
|
||||
QString mBreakPointFile;
|
||||
QString mOutput;
|
||||
QString mEvalValue;
|
||||
QStringList mMemoryValue;
|
||||
QStringList mLocalsValue;
|
||||
QString mSignal;
|
||||
bool mUseUTF8;
|
||||
|
||||
// attempt to cut down on Synchronize calls
|
||||
bool dobacktraceready;
|
||||
bool dodisassemblerready;
|
||||
bool doregistersready;
|
||||
bool doevalready;
|
||||
bool doprocessexited;
|
||||
bool doupdatecpuwindow;
|
||||
bool doupdateexecution;
|
||||
bool doreceivedsignal;
|
||||
bool doreceivedsfwarning;
|
||||
bool doupdatememoryview;
|
||||
bool doupdatelocal;
|
||||
QString mSignalName;
|
||||
QString mSignalMeaning;
|
||||
|
||||
//
|
||||
QList<PDebugCommand> mInferiorStoppedHookCommands;
|
||||
bool mInferiorRunning;
|
||||
bool mProcessExited;
|
||||
|
||||
bool mSignalReceived;
|
||||
bool mUpdateCPUInfo;
|
||||
bool mReceivedSFWarning;
|
||||
|
||||
int mCurrentLine;
|
||||
int mCurrentAddress;
|
||||
QString mCurrentFunc;
|
||||
QString mCurrentFile;
|
||||
QStringList mConsoleOutput;
|
||||
QStringList mFullOutput;
|
||||
bool mStop;
|
||||
friend class Debugger;
|
||||
// QThread interface
|
||||
protected:
|
||||
void run() override;
|
||||
|
|
|
@ -604,12 +604,12 @@ void Editor::keyPressEvent(QKeyEvent *event)
|
|||
insertString.append(QString(" * ")+USER_CODE_IN_INSERT_POS);
|
||||
insertString.append(" */");
|
||||
}
|
||||
insertCodeSnippet(LinesToText(insertString));
|
||||
insertCodeSnippet(linesToText(insertString));
|
||||
} else if (highlighter()
|
||||
&& caretY()>=2
|
||||
&& highlighter()->isLastLineCommentNotFinished(
|
||||
lines()->ranges(caretY()-2).state)) {
|
||||
s=TrimLeft(lineText());
|
||||
s=trimLeft(lineText());
|
||||
if (s.startsWith("* ")) {
|
||||
handled = true;
|
||||
int right = lines()->getString(caretY()-1).length()-caretX();
|
||||
|
@ -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;
|
||||
|
@ -2142,7 +2142,7 @@ void Editor::insertCodeSnippet(const QString &code)
|
|||
auto action = finally([this]{
|
||||
endUpdate();
|
||||
});
|
||||
QStringList sl = TextToLines(parseMacros(code));
|
||||
QStringList sl = textToLines(parseMacros(code));
|
||||
int lastI=0;
|
||||
int spaceCount = GetLeftSpacing(
|
||||
leftSpaces(lineText()),true).length();
|
||||
|
@ -2196,7 +2196,7 @@ void Editor::insertCodeSnippet(const QString &code)
|
|||
}
|
||||
|
||||
BufferCoord cursorPos = caretXY();
|
||||
QString s = LinesToText(newSl);
|
||||
QString s = linesToText(newSl);
|
||||
// if EndsStr(#13#10,s) then
|
||||
// Delete(s,Length(s)-1,2)
|
||||
// else if EndsStr(#10, s) then
|
||||
|
@ -2826,7 +2826,7 @@ void Editor::showDebugHint(const QString &s, int line)
|
|||
connect(pMainWindow->debugger(), &Debugger::evalValueReady,
|
||||
this, &Editor::onTipEvalValueReady);
|
||||
mCurrentDebugTipWord = s;
|
||||
pMainWindow->debugger()->sendCommand("print",s,false);
|
||||
pMainWindow->debugger()->sendCommand("-data-evaluate-expression",s);
|
||||
}
|
||||
|
||||
QString Editor::getErrorHint(const PSyntaxIssue& issue)
|
||||
|
|
|
@ -0,0 +1,470 @@
|
|||
#include "gdbmiresultparser.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QList>
|
||||
#include <QDebug>
|
||||
|
||||
GDBMIResultParser::GDBMIResultParser()
|
||||
{
|
||||
mResultTypes.insert("-break-insert",GDBMIResultType::Breakpoint);
|
||||
//mResultTypes.insert("BreakpointTable",GDBMIResultType::BreakpointTable);
|
||||
mResultTypes.insert("-stack-list-frames",GDBMIResultType::FrameStack);
|
||||
mResultTypes.insert("-stack-list-variables", GDBMIResultType::LocalVariables);
|
||||
//mResultTypes.insert("frame",GDBMIResultType::Frame);
|
||||
mResultTypes.insert("-data-disassemble",GDBMIResultType::Disassembly);
|
||||
mResultTypes.insert("-data-evaluate-expression",GDBMIResultType::Evaluation);
|
||||
// mResultTypes.insert("register-names",GDBMIResultType::RegisterNames);
|
||||
// mResultTypes.insert("register-values",GDBMIResultType::RegisterValues);
|
||||
mResultTypes.insert("-data-read-memory",GDBMIResultType::Memory);
|
||||
mResultTypes.insert("-data-list-register-names",GDBMIResultType::RegisterNames);
|
||||
mResultTypes.insert("-data-list-register-values",GDBMIResultType::RegisterValues);
|
||||
mResultTypes.insert("-var-create",GDBMIResultType::CreateVar);
|
||||
mResultTypes.insert("-var-list-children",GDBMIResultType::ListVarChildren);
|
||||
mResultTypes.insert("-var-update",GDBMIResultType::UpdateVarValue);
|
||||
}
|
||||
|
||||
bool GDBMIResultParser::parse(const QByteArray &record, const QString& command, GDBMIResultType &type, ParseObject& multiValues)
|
||||
{
|
||||
const char* p = record.data();
|
||||
bool result = parseMultiValues(p,multiValues);
|
||||
if (!result)
|
||||
return false;
|
||||
// if (*p!=0)
|
||||
// return false;
|
||||
if (!mResultTypes.contains(command))
|
||||
return false;
|
||||
type = mResultTypes[command];
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GDBMIResultParser::parseAsyncResult(const QByteArray &record, QByteArray &result, ParseObject &multiValue)
|
||||
{
|
||||
const char* p =record.data();
|
||||
if (*p!='*')
|
||||
return false;
|
||||
p++;
|
||||
const char* start=p;
|
||||
while (*p && *p!=',')
|
||||
p++;
|
||||
result = QByteArray(start,p-start);
|
||||
if (*p==0)
|
||||
return true;
|
||||
p++;
|
||||
return parseMultiValues(p,multiValue);
|
||||
}
|
||||
|
||||
bool GDBMIResultParser::parseMultiValues(const char* p, ParseObject &multiValue)
|
||||
{
|
||||
while (*p) {
|
||||
QByteArray propName;
|
||||
ParseValue propValue;
|
||||
bool result = parseNameAndValue(p,propName,propValue);
|
||||
if (result) {
|
||||
multiValue[propName]=propValue;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
skipSpaces(p);
|
||||
if (*p==0)
|
||||
break;
|
||||
if (*p!=',')
|
||||
return false;
|
||||
p++; //skip ','
|
||||
skipSpaces(p);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GDBMIResultParser::parseNameAndValue(const char *&p, QByteArray &name, ParseValue &value)
|
||||
{
|
||||
skipSpaces(p);
|
||||
const char* nameStart =p;
|
||||
while (*p!=0 && isNameChar(*p)) {
|
||||
p++;
|
||||
}
|
||||
if (*p==0)
|
||||
return false;
|
||||
name = QByteArray(nameStart,p-nameStart);
|
||||
skipSpaces(p);
|
||||
if (*p!='=')
|
||||
return false;
|
||||
p++;
|
||||
return parseValue(p,value);
|
||||
}
|
||||
|
||||
bool GDBMIResultParser::parseValue(const char *&p, ParseValue &value)
|
||||
{
|
||||
skipSpaces(p);
|
||||
bool result;
|
||||
switch (*p) {
|
||||
case '{': {
|
||||
ParseObject obj;
|
||||
result = parseObject(p,obj);
|
||||
value = obj;
|
||||
break;
|
||||
}
|
||||
case '[': {
|
||||
QList<ParseValue> array;
|
||||
result = parseArray(p,array);
|
||||
value = array;
|
||||
break;
|
||||
}
|
||||
case '"': {
|
||||
QByteArray s;
|
||||
result = parseStringValue(p,s);
|
||||
value = s;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
if (!result)
|
||||
return false;
|
||||
skipSpaces(p);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GDBMIResultParser::parseStringValue(const char *&p, QByteArray& stringValue)
|
||||
{
|
||||
if (*p!='"')
|
||||
return false;
|
||||
p++;
|
||||
stringValue.clear();
|
||||
while (*p!=0) {
|
||||
if (*p == '"') {
|
||||
break;
|
||||
} else if (*p=='\\' && *(p+1)!=0) {
|
||||
p++;
|
||||
switch (*p) {
|
||||
case '\'':
|
||||
stringValue+=0x27;
|
||||
p++;
|
||||
break;
|
||||
case '"':
|
||||
stringValue+=0x22;
|
||||
p++;
|
||||
break;
|
||||
case '?':
|
||||
stringValue+=0x3f;
|
||||
p++;
|
||||
break;
|
||||
case '\\':
|
||||
stringValue+=0x5c;
|
||||
p++;
|
||||
break;
|
||||
case 'a':
|
||||
stringValue+=0x07;
|
||||
p++;
|
||||
break;
|
||||
case 'b':
|
||||
stringValue+=0x08;
|
||||
p++;
|
||||
break;
|
||||
case 'f':
|
||||
stringValue+=0x0c;
|
||||
p++;
|
||||
break;
|
||||
case 'n':
|
||||
stringValue+=0x0a;
|
||||
p++;
|
||||
break;
|
||||
case 'r':
|
||||
stringValue+=0x0d;
|
||||
p++;
|
||||
break;
|
||||
case 't':
|
||||
stringValue+=0x09;
|
||||
p++;
|
||||
break;
|
||||
case 'v':
|
||||
stringValue+=0x0b;
|
||||
p++;
|
||||
break;
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
{
|
||||
int i=0;
|
||||
for (i=0;i<3;i++) {
|
||||
if (*(p+i)<'0' || *(p+i)>'7')
|
||||
break;
|
||||
}
|
||||
QByteArray numStr(p,i);
|
||||
bool ok;
|
||||
unsigned char ch = numStr.toInt(&ok,8);
|
||||
stringValue+=ch;
|
||||
p+=i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
stringValue+=*p;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
if (*p=='"') {
|
||||
p++; //skip '"'
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GDBMIResultParser::parseObject(const char *&p, ParseObject &obj)
|
||||
{
|
||||
if (*p!='{')
|
||||
return false;
|
||||
p++;
|
||||
|
||||
if (*p!='}') {
|
||||
while (*p!=0) {
|
||||
QByteArray propName;
|
||||
ParseValue propValue;
|
||||
bool result = parseNameAndValue(p,propName,propValue);
|
||||
if (result) {
|
||||
obj[propName]=propValue;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
skipSpaces(p);
|
||||
if (*p=='}')
|
||||
break;
|
||||
if (*p!=',') {
|
||||
return false;
|
||||
}
|
||||
p++; //skip ','
|
||||
skipSpaces(p);
|
||||
}
|
||||
}
|
||||
if (*p=='}') {
|
||||
p++; //skip '}'
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GDBMIResultParser::parseArray(const char *&p, QList<GDBMIResultParser::ParseValue> &array)
|
||||
{
|
||||
if (*p!='[')
|
||||
return false;
|
||||
p++;
|
||||
if (*p!=']') {
|
||||
while (*p!=0) {
|
||||
skipSpaces(p);
|
||||
if (*p=='{' || *p=='"' || *p=='[') {
|
||||
ParseValue val;
|
||||
bool result = parseValue(p,val);
|
||||
if (result) {
|
||||
array.append(val);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
QByteArray name;
|
||||
ParseValue val;
|
||||
bool result = parseNameAndValue(p,name,val);
|
||||
if (result) {
|
||||
array.append(val);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
skipSpaces(p);
|
||||
if (*p==']')
|
||||
break;
|
||||
if (*p!=',')
|
||||
return false;
|
||||
p++; //skip ','
|
||||
skipSpaces(p);
|
||||
}
|
||||
}
|
||||
if (*p==']') {
|
||||
p++; //skip ']'
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GDBMIResultParser::isNameChar(char ch)
|
||||
{
|
||||
if (ch=='-')
|
||||
return true;
|
||||
if (ch=='_')
|
||||
return true;
|
||||
if (ch>='a' && ch<='z')
|
||||
return true;
|
||||
if (ch>='A' && ch<='Z')
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GDBMIResultParser::isSpaceChar(char ch)
|
||||
{
|
||||
switch(ch) {
|
||||
case ' ':
|
||||
case '\t':
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void GDBMIResultParser::skipSpaces(const char *&p)
|
||||
{
|
||||
while (*p!=0 && isSpaceChar(*p))
|
||||
p++;
|
||||
}
|
||||
|
||||
const QByteArray &GDBMIResultParser::ParseValue::value() const
|
||||
{
|
||||
return mValue;
|
||||
}
|
||||
|
||||
const QList<::GDBMIResultParser::ParseValue> &GDBMIResultParser::ParseValue::array() const
|
||||
{
|
||||
return mArray;
|
||||
}
|
||||
|
||||
const GDBMIResultParser::ParseObject &GDBMIResultParser::ParseValue::object() const
|
||||
{
|
||||
return mObject;
|
||||
}
|
||||
|
||||
int GDBMIResultParser::ParseValue::intValue(int defaultValue) const
|
||||
{
|
||||
Q_ASSERT(mType == ParseValueType::Value);
|
||||
bool ok;
|
||||
int value = QString(mValue).toInt(&ok);
|
||||
if (ok)
|
||||
return value;
|
||||
else
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
int GDBMIResultParser::ParseValue::hexValue(int defaultValue) const
|
||||
{
|
||||
Q_ASSERT(mType == ParseValueType::Value);
|
||||
bool ok;
|
||||
int value = QString(mValue).toInt(&ok,16);
|
||||
if (ok)
|
||||
return value;
|
||||
else
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
QString GDBMIResultParser::ParseValue::pathValue() const
|
||||
{
|
||||
Q_ASSERT(mType == ParseValueType::Value);
|
||||
return QFileInfo(QString::fromLocal8Bit(mValue)).absoluteFilePath();
|
||||
}
|
||||
|
||||
GDBMIResultParser::ParseValueType GDBMIResultParser::ParseValue::type() const
|
||||
{
|
||||
return mType;
|
||||
}
|
||||
|
||||
bool GDBMIResultParser::ParseValue::isValid() const
|
||||
{
|
||||
return mType!=ParseValueType::NotAssigned;
|
||||
}
|
||||
|
||||
GDBMIResultParser::ParseValue::ParseValue():
|
||||
mType(ParseValueType::NotAssigned) {
|
||||
|
||||
}
|
||||
|
||||
GDBMIResultParser::ParseValue::ParseValue(const QByteArray &value):
|
||||
mValue(value),
|
||||
mType(ParseValueType::Value)
|
||||
{
|
||||
}
|
||||
|
||||
GDBMIResultParser::ParseValue::ParseValue(const ParseObject &object):
|
||||
mObject(object),
|
||||
mType(ParseValueType::Object)
|
||||
{
|
||||
}
|
||||
|
||||
GDBMIResultParser::ParseValue::ParseValue(const QList<ParseValue> &array):
|
||||
mArray(array),
|
||||
mType(ParseValueType::Array)
|
||||
{
|
||||
}
|
||||
|
||||
GDBMIResultParser::ParseValue::ParseValue(const ParseValue &value):
|
||||
mValue(value.mValue),
|
||||
mArray(value.mArray),
|
||||
mObject(value.mObject),
|
||||
mType(value.mType)
|
||||
{
|
||||
}
|
||||
|
||||
GDBMIResultParser::ParseValue &GDBMIResultParser::ParseValue::operator=(const GDBMIResultParser::ParseValue &value)
|
||||
{
|
||||
mType = value.mType;
|
||||
mValue = value.mValue;
|
||||
mArray = value.mArray;
|
||||
mObject = value.mObject;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GDBMIResultParser::ParseValue &GDBMIResultParser::ParseValue::operator=(const QByteArray &value)
|
||||
{
|
||||
Q_ASSERT(mType == ParseValueType::NotAssigned);
|
||||
mType = ParseValueType::Value;
|
||||
mValue = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GDBMIResultParser::ParseValue &GDBMIResultParser::ParseValue::operator=(const ParseObject& object)
|
||||
{
|
||||
Q_ASSERT(mType == ParseValueType::NotAssigned);
|
||||
mType = ParseValueType::Object;
|
||||
mObject = object;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GDBMIResultParser::ParseValue &GDBMIResultParser::ParseValue::operator=(const QList<ParseValue>& array)
|
||||
{
|
||||
Q_ASSERT(mType == ParseValueType::NotAssigned);
|
||||
mType = ParseValueType::Array;
|
||||
mArray = array;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
GDBMIResultParser::ParseObject::ParseObject()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
GDBMIResultParser::ParseObject::ParseObject(const ParseObject &object):
|
||||
mProps(object.mProps)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
GDBMIResultParser::ParseValue GDBMIResultParser::ParseObject::operator[](const QByteArray &name) const
|
||||
{
|
||||
if (mProps.contains(name)) {
|
||||
ParseValue value(mProps[name]);
|
||||
return value;
|
||||
}
|
||||
return ParseValue();
|
||||
}
|
||||
|
||||
GDBMIResultParser::ParseObject &GDBMIResultParser::ParseObject::operator=(const ParseObject &object)
|
||||
{
|
||||
mProps = object.mProps;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GDBMIResultParser::ParseValue &GDBMIResultParser::ParseObject::operator[](const QByteArray &name) {
|
||||
if (!mProps.contains(name))
|
||||
mProps[name]=ParseValue();
|
||||
return mProps[name];
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
#ifndef GDBMIRESULTPARSER_H
|
||||
#define GDBMIRESULTPARSER_H
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
#include <memory>
|
||||
|
||||
|
||||
enum class GDBMIResultType {
|
||||
Breakpoint,
|
||||
BreakpointTable,
|
||||
FrameStack,
|
||||
LocalVariables,
|
||||
Locals,
|
||||
Frame,
|
||||
Disassembly,
|
||||
Evaluation,
|
||||
RegisterNames,
|
||||
RegisterValues,
|
||||
Memory,
|
||||
CreateVar,
|
||||
ListVarChildren,
|
||||
UpdateVarValue
|
||||
};
|
||||
|
||||
|
||||
class GDBMIResultParser
|
||||
{
|
||||
public:
|
||||
enum class ParseValueType {
|
||||
Value,
|
||||
Object,
|
||||
Array,
|
||||
NotAssigned
|
||||
};
|
||||
|
||||
class ParseValue;
|
||||
|
||||
class ParseObject {
|
||||
public:
|
||||
explicit ParseObject();
|
||||
ParseObject(const ParseObject& object);
|
||||
ParseValue operator[](const QByteArray& name) const;
|
||||
ParseValue& operator[](const QByteArray& name);
|
||||
ParseObject& operator=(const ParseObject& object);
|
||||
private:
|
||||
QHash<QByteArray, ParseValue> mProps;
|
||||
};
|
||||
|
||||
class ParseValue {
|
||||
public:
|
||||
explicit ParseValue();
|
||||
explicit ParseValue(const QByteArray& value);
|
||||
explicit ParseValue(const ParseObject &object);
|
||||
explicit ParseValue(const QList<ParseValue>& array);
|
||||
ParseValue(const ParseValue& value);
|
||||
const QByteArray &value() const;
|
||||
const QList<ParseValue> &array() const;
|
||||
const ParseObject &object() const;
|
||||
int intValue(int defaultValue=-1) const;
|
||||
int hexValue(int defaultValue=-1) const;
|
||||
|
||||
QString pathValue() const;
|
||||
ParseValueType type() const;
|
||||
bool isValid() const;
|
||||
ParseValue& operator=(const QByteArray& value);
|
||||
ParseValue& operator=(const ParseObject& object);
|
||||
ParseValue& operator=(const QList<ParseValue>& array);
|
||||
ParseValue& operator=(const ParseValue& value);
|
||||
private:
|
||||
QByteArray mValue;
|
||||
QList<ParseValue> mArray;
|
||||
ParseObject mObject;
|
||||
ParseValueType mType;
|
||||
};
|
||||
|
||||
using PParseValue = std::shared_ptr<ParseValue>;
|
||||
|
||||
public:
|
||||
GDBMIResultParser();
|
||||
bool parse(const QByteArray& record, const QString& command, GDBMIResultType& type, ParseObject& multiValues);
|
||||
bool parseAsyncResult(const QByteArray& record, QByteArray& result, ParseObject& multiValue);
|
||||
private:
|
||||
bool parseMultiValues(const char*p, ParseObject& multiValue);
|
||||
bool parseNameAndValue(const char *&p,QByteArray& name, ParseValue& value);
|
||||
bool parseValue(const char* &p, ParseValue& value);
|
||||
bool parseStringValue(const char*&p, QByteArray& stringValue);
|
||||
bool parseObject(const char*&p, ParseObject& obj);
|
||||
bool parseArray(const char*&p, QList<ParseValue>& array);
|
||||
void skipSpaces(const char* &p);
|
||||
bool isNameChar(char ch);
|
||||
bool isSpaceChar(char ch);
|
||||
private:
|
||||
QHash<QString, GDBMIResultType> mResultTypes;
|
||||
};
|
||||
|
||||
#endif // GDBMIRESULTPARSER_H
|
|
@ -489,5 +489,6 @@
|
|||
<file>images/editor/bookmark.png</file>
|
||||
<file>images/newlook24/091-openproblemanswer.png</file>
|
||||
<file>images/newlook24/092-runallproblemcases.png</file>
|
||||
<file>images/newlook24/093-pause.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -23,7 +23,6 @@ public:
|
|||
const PIcon &bookmark() const;
|
||||
|
||||
const PIcon &folder() const;
|
||||
signals:
|
||||
private:
|
||||
PIcon mSyntaxError;
|
||||
PIcon mSyntaxWarning;
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
|
@ -103,6 +103,7 @@ int main(int argc, char *argv[])
|
|||
qRegisterMetaType<PCompileIssue>("PCompileIssue");
|
||||
qRegisterMetaType<PCompileIssue>("PCompileIssue&");
|
||||
qRegisterMetaType<QVector<int>>("QVector<int>");
|
||||
qRegisterMetaType<QHash<int,QString>>("QHash<int,QString>");
|
||||
|
||||
initParser();
|
||||
|
||||
|
|
|
@ -49,6 +49,14 @@
|
|||
|
||||
#include <widgets/searchdialog.h>
|
||||
|
||||
static int findTabIndex(QTabWidget* tabWidget , QWidget* w) {
|
||||
for (int i=0;i<tabWidget->count();i++) {
|
||||
if (w==tabWidget->widget(i))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
MainWindow* pMainWindow;
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
|
@ -733,6 +741,8 @@ void MainWindow::updateAppTitle()
|
|||
|
||||
void MainWindow::addDebugOutput(const QString &text)
|
||||
{
|
||||
if (!pSettings->debugger().enableDebugConsole())
|
||||
return;
|
||||
if (text.isEmpty()) {
|
||||
ui->debugConsole->addLine("");
|
||||
} else {
|
||||
|
@ -1056,6 +1066,18 @@ void MainWindow::updateDebuggerSettings()
|
|||
ui->debugConsole->setFont(font);
|
||||
ui->txtMemoryView->setFont(font);
|
||||
ui->txtLocals->setFont(font);
|
||||
|
||||
int idx = findTabIndex(ui->debugViews,ui->tabDebugConsole);
|
||||
if (idx>=0) {
|
||||
if (!pSettings->debugger().enableDebugConsole()) {
|
||||
ui->debugViews->removeTab(idx);
|
||||
}
|
||||
} else {
|
||||
if (pSettings->debugger().enableDebugConsole()) {
|
||||
ui->debugViews->insertTab(0, ui->tabDebugConsole, tr("Debug Console"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::checkSyntaxInBack(Editor *e)
|
||||
|
@ -1323,12 +1345,12 @@ void MainWindow::debug()
|
|||
if (!mDebugger->start())
|
||||
return;
|
||||
filePath.replace('\\','/');
|
||||
mDebugger->sendCommand("file", '"' + filePath + '"');
|
||||
mDebugger->sendCommand("-file-exec-and-symbols", '"' + filePath + '"');
|
||||
|
||||
if (mProject->options().type == ProjectType::DynamicLib) {
|
||||
QString host =mProject->options().hostApplication;
|
||||
host.replace('\\','/');
|
||||
mDebugger->sendCommand("exec-file", '"' + host + '"');
|
||||
mDebugger->sendCommand("-file-exec-file", '"' + host + '"');
|
||||
}
|
||||
|
||||
includeOrSkipDirs(mProject->options().includes,
|
||||
|
@ -1398,10 +1420,9 @@ void MainWindow::debug()
|
|||
|
||||
prepareDebugger();
|
||||
|
||||
mDebugger->setUseUTF8(e->fileEncoding() == ENCODING_UTF8 || e->fileEncoding() == ENCODING_UTF8_BOM);
|
||||
if (!mDebugger->start())
|
||||
return;
|
||||
mDebugger->sendCommand("file", QString("\"%1\"").arg(debugFile.filePath().replace('\\','/')));
|
||||
mDebugger->sendCommand("-file-exec-and-symbols", QString("\"%1\"").arg(debugFile.filePath().replace('\\','/')));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1425,48 +1446,39 @@ void MainWindow::debug()
|
|||
includeOrSkipDirs(compilerSet->defaultCppIncludeDirs(),true);
|
||||
}
|
||||
|
||||
// Add breakpoints and watch vars
|
||||
// for i := 0 to fDebugger.WatchVarList.Count - 1 do
|
||||
// fDebugger.AddWatchVar(i);
|
||||
mDebugger->sendAllWatchvarsToDebugger();
|
||||
mDebugger->sendAllBreakpointsToDebugger();
|
||||
|
||||
// Run the debugger
|
||||
mDebugger->sendCommand("set", "width 0"); // don't wrap output, very annoying
|
||||
mDebugger->sendCommand("set", "new-console on");
|
||||
mDebugger->sendCommand("set", "confirm off");
|
||||
mDebugger->sendCommand("set", "print repeats 0"); // don't repeat elements
|
||||
mDebugger->sendCommand("set", "print elements 0"); // don't limit elements
|
||||
mDebugger->sendCommand("cd", excludeTrailingPathDelimiter(debugFile.path())); // restore working directory
|
||||
mDebugger->sendCommand("-enable-pretty-printing","");
|
||||
mDebugger->sendCommand("-data-list-register-names","");
|
||||
mDebugger->sendCommand("-gdb-set", "width 0"); // don't wrap output, very annoying
|
||||
mDebugger->sendCommand("-gdb-set", "new-console on");
|
||||
mDebugger->sendCommand("-gdb-set", "confirm off");
|
||||
mDebugger->sendCommand("-gdb-set", "print repeats 0"); // don't repeat elements
|
||||
mDebugger->sendCommand("-gdb-set", "print elements 0"); // don't limit elements
|
||||
mDebugger->sendCommand("-environment-cd", excludeTrailingPathDelimiter(debugFile.path())); // restore working directory
|
||||
if (!debugInferiorhasBreakpoint()) {
|
||||
QString params;
|
||||
switch(getCompileTarget()) {
|
||||
case CompileTarget::None:
|
||||
return;
|
||||
case CompileTarget::File:
|
||||
mDebugger->sendCommand("start",params);
|
||||
mDebugger->updateDebugInfo();
|
||||
mDebugger->sendCommand("-exec-run", "--start");
|
||||
break;
|
||||
case CompileTarget::Project:
|
||||
params = "";
|
||||
mDebugger->sendCommand("start",params);
|
||||
mDebugger->updateDebugInfo();
|
||||
mDebugger->sendCommand("-exec-run", "--start");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
QString params;
|
||||
switch(getCompileTarget()) {
|
||||
case CompileTarget::None:
|
||||
return;
|
||||
case CompileTarget::File:
|
||||
mDebugger->sendCommand("run",params);
|
||||
mDebugger->updateDebugInfo();
|
||||
mDebugger->sendCommand("-exec-run","");
|
||||
break;
|
||||
case CompileTarget::Project:
|
||||
mDebugger->sendCommand("run",params);
|
||||
mDebugger->updateDebugInfo();
|
||||
mDebugger->sendCommand("-exec-run","");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -1481,6 +1493,15 @@ void MainWindow::showSearchPanel(bool showReplace)
|
|||
ui->tabMessages->setCurrentWidget(ui->tabSearch);
|
||||
}
|
||||
|
||||
void MainWindow::showCPUInfoDialog()
|
||||
{
|
||||
if (mCPUDialog==nullptr) {
|
||||
mCPUDialog = new CPUDialog(this);
|
||||
connect(mCPUDialog, &CPUDialog::closed, this, &MainWindow::cleanUpCPUDialog);
|
||||
}
|
||||
mCPUDialog->show();
|
||||
}
|
||||
|
||||
void MainWindow::openCloseBottomPanel(bool open)
|
||||
{
|
||||
// if Assigned(fReportToolWindow) then
|
||||
|
@ -1553,7 +1574,7 @@ void MainWindow::prepareDebugger()
|
|||
|
||||
// Clear logs
|
||||
ui->debugConsole->clear();
|
||||
if (!pSettings->debugger().showCommandLog()) {
|
||||
if (pSettings->debugger().enableDebugConsole()) {
|
||||
ui->debugConsole->addLine("(gdb) ");
|
||||
}
|
||||
ui->txtEvalOutput->clear();
|
||||
|
@ -1661,7 +1682,7 @@ void MainWindow::includeOrSkipDirs(const QStringList &dirs, bool skip)
|
|||
.arg(dirName,"*.*"));
|
||||
} else {
|
||||
mDebugger->sendCommand(
|
||||
"dir",
|
||||
"-environment-directory",
|
||||
QString("\"%1\"").arg(dirName));
|
||||
}
|
||||
}
|
||||
|
@ -1924,13 +1945,13 @@ void MainWindow::buildContextMenus()
|
|||
ui->debugConsole->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(ui->debugConsole,&QWidget::customContextMenuRequested,
|
||||
this, &MainWindow::onDebugConsoleContextMenu);
|
||||
mDebugConsole_ShowCommandLog = createActionFor(
|
||||
tr("Show debug logs in the debug console"),
|
||||
mDebugConsole_ShowDetailLog = createActionFor(
|
||||
tr("Show detail debug logs"),
|
||||
ui->debugConsole);
|
||||
mDebugConsole_ShowCommandLog->setCheckable(true);
|
||||
connect(mDebugConsole_ShowCommandLog, &QAction::toggled,
|
||||
mDebugConsole_ShowDetailLog->setCheckable(true);
|
||||
connect(mDebugConsole_ShowDetailLog, &QAction::toggled,
|
||||
[this]() {
|
||||
pSettings->debugger().setShowCommandLog(mDebugConsole_ShowCommandLog->isChecked());
|
||||
pSettings->debugger().setShowDetailLog(mDebugConsole_ShowDetailLog->isChecked());
|
||||
pSettings->debugger().save();
|
||||
});
|
||||
mDebugConsole_Copy=createActionFor(
|
||||
|
@ -2612,16 +2633,16 @@ void MainWindow::onDebugConsoleContextMenu(const QPoint &pos)
|
|||
{
|
||||
QMenu menu(this);
|
||||
|
||||
bool oldBlock = mDebugConsole_ShowCommandLog->blockSignals(true);
|
||||
mDebugConsole_ShowCommandLog->setChecked(pSettings->debugger().showCommandLog());
|
||||
mDebugConsole_ShowCommandLog->blockSignals(oldBlock);
|
||||
bool oldBlock = mDebugConsole_ShowDetailLog->blockSignals(true);
|
||||
mDebugConsole_ShowDetailLog->setChecked(pSettings->debugger().showDetailLog());
|
||||
mDebugConsole_ShowDetailLog->blockSignals(oldBlock);
|
||||
|
||||
menu.addAction(mDebugConsole_Copy);
|
||||
menu.addAction(mDebugConsole_Paste);
|
||||
menu.addAction(mDebugConsole_SelectAll);
|
||||
menu.addAction(mDebugConsole_Clear);
|
||||
menu.addSeparator();
|
||||
menu.addAction(mDebugConsole_ShowCommandLog);
|
||||
menu.addAction(mDebugConsole_ShowDetailLog);
|
||||
menu.exec(ui->debugConsole->mapToGlobal(pos));
|
||||
}
|
||||
|
||||
|
@ -2898,7 +2919,7 @@ void MainWindow::onShowInsertCodeSnippetMenu()
|
|||
|
||||
}
|
||||
|
||||
void MainWindow::onEditorContextMenu(const QPoint &pos)
|
||||
void MainWindow::onEditorContextMenu(const QPoint& pos)
|
||||
{
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
if (!editor)
|
||||
|
@ -2967,12 +2988,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);
|
||||
}
|
||||
|
@ -3020,13 +3041,13 @@ void MainWindow::disableDebugActions()
|
|||
|
||||
void MainWindow::enableDebugActions()
|
||||
{
|
||||
ui->actionStep_Into->setEnabled(true);
|
||||
ui->actionStep_Over->setEnabled(true);
|
||||
ui->actionStep_Out->setEnabled(true);
|
||||
ui->actionRun_To_Cursor->setEnabled(true);
|
||||
ui->actionContinue->setEnabled(true);
|
||||
ui->cbEvaluate->setEnabled(true);
|
||||
ui->cbMemoryAddress->setEnabled(true);
|
||||
ui->actionStep_Into->setEnabled(!mDebugger->inferiorRunning());
|
||||
ui->actionStep_Over->setEnabled(!mDebugger->inferiorRunning());
|
||||
ui->actionStep_Out->setEnabled(!mDebugger->inferiorRunning());
|
||||
ui->actionRun_To_Cursor->setEnabled(!mDebugger->inferiorRunning());
|
||||
ui->actionContinue->setEnabled(!mDebugger->inferiorRunning());
|
||||
ui->cbEvaluate->setEnabled(!mDebugger->inferiorRunning());
|
||||
ui->cbMemoryAddress->setEnabled(!mDebugger->inferiorRunning());
|
||||
}
|
||||
|
||||
void MainWindow::onTodoParseStarted(const QString&)
|
||||
|
@ -3034,7 +3055,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);
|
||||
}
|
||||
|
@ -3488,7 +3509,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);
|
||||
|
@ -3629,12 +3650,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);
|
||||
|
@ -3669,7 +3690,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) {
|
||||
|
@ -3698,10 +3719,10 @@ 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);
|
||||
mDebugger->sendCommand(command,"", DebugCommandSource::Console);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3979,10 +4000,7 @@ void MainWindow::on_actionStep_Over_triggered()
|
|||
{
|
||||
if (mDebugger->executing()) {
|
||||
//WatchView.Items.BeginUpdate();
|
||||
mDebugger->invalidateAllVars();
|
||||
mDebugger->sendCommand("next", "");
|
||||
mDebugger->updateDebugInfo();
|
||||
mDebugger->refreshWatchVars();
|
||||
mDebugger->sendCommand("-exec-next", "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3990,10 +4008,7 @@ void MainWindow::on_actionStep_Into_triggered()
|
|||
{
|
||||
if (mDebugger->executing()) {
|
||||
//WatchView.Items.BeginUpdate();
|
||||
mDebugger->invalidateAllVars();
|
||||
mDebugger->sendCommand("step", "");
|
||||
mDebugger->updateDebugInfo();
|
||||
mDebugger->refreshWatchVars();
|
||||
mDebugger->sendCommand("-exec-step", "");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4002,10 +4017,7 @@ void MainWindow::on_actionStep_Out_triggered()
|
|||
{
|
||||
if (mDebugger->executing()) {
|
||||
//WatchView.Items.BeginUpdate();
|
||||
mDebugger->invalidateAllVars();
|
||||
mDebugger->sendCommand("finish", "");
|
||||
mDebugger->updateDebugInfo();
|
||||
mDebugger->refreshWatchVars();
|
||||
mDebugger->sendCommand("-exec-finish", "");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4016,11 +4028,9 @@ void MainWindow::on_actionRun_To_Cursor_triggered()
|
|||
Editor *e=mEditorList->getEditor();
|
||||
if (e!=nullptr) {
|
||||
//WatchView.Items.BeginUpdate();
|
||||
mDebugger->invalidateAllVars();
|
||||
mDebugger->sendCommand("tbreak", QString(" %1").arg(e->caretY()));
|
||||
mDebugger->sendCommand("continue", "");
|
||||
mDebugger->updateDebugInfo();
|
||||
mDebugger->refreshWatchVars();
|
||||
mDebugger->sendCommand("-exec-until", QString("\"%1\":%2")
|
||||
.arg(e->filename())
|
||||
.arg(e->caretY()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4030,10 +4040,7 @@ void MainWindow::on_actionContinue_triggered()
|
|||
{
|
||||
if (mDebugger->executing()) {
|
||||
//WatchView.Items.BeginUpdate();
|
||||
mDebugger->invalidateAllVars();
|
||||
mDebugger->sendCommand("continue", "");
|
||||
mDebugger->updateDebugInfo();
|
||||
mDebugger->refreshWatchVars();
|
||||
mDebugger->sendCommand("-exec-continue", "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4064,11 +4071,7 @@ void MainWindow::on_actionAdd_Watch_triggered()
|
|||
|
||||
void MainWindow::on_actionView_CPU_Window_triggered()
|
||||
{
|
||||
if (mCPUDialog==nullptr) {
|
||||
mCPUDialog = new CPUDialog(this);
|
||||
connect(mCPUDialog, &CPUDialog::closed, this, &MainWindow::cleanUpCPUDialog);
|
||||
}
|
||||
mCPUDialog->show();
|
||||
showCPUInfoDialog();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionExit_triggered()
|
||||
|
@ -4082,7 +4085,7 @@ void MainWindow::onDebugEvaluateInput()
|
|||
if (!s.isEmpty()) {
|
||||
connect(mDebugger, &Debugger::evalValueReady,
|
||||
this, &MainWindow::onEvalValueReady);
|
||||
mDebugger->sendCommand("print",s,false);
|
||||
mDebugger->sendCommand("-data-evaluate-expression",s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4092,7 +4095,7 @@ void MainWindow::onDebugMemoryAddressInput()
|
|||
if (!s.isEmpty()) {
|
||||
connect(mDebugger, &Debugger::memoryExamineReady,
|
||||
this, &MainWindow::onMemoryExamineReady);
|
||||
mDebugger->sendCommand("x/64bx",s,false);
|
||||
mDebugger->sendCommand("-data-read-memory",QString("%1 x 1 8 8 ").arg(s));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4140,14 +4143,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) {
|
||||
|
@ -4159,7 +4162,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) {
|
||||
|
@ -4864,14 +4867,6 @@ void MainWindow::updateEditorHideTime(QTabWidget* tabWidget) {
|
|||
}
|
||||
}
|
||||
|
||||
static int findTabIndex(QTabWidget* tabWidget , QWidget* w) {
|
||||
for (int i=0;i<tabWidget->count();i++) {
|
||||
if (w==tabWidget->widget(i))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void MainWindow::showHideInfosTab(QWidget *widget, bool show)
|
||||
{
|
||||
int idx = findTabIndex(ui->tabInfos,widget);
|
||||
|
@ -5166,8 +5161,8 @@ void MainWindow::updateProblemCaseOutput(POJProblemCase problemCase)
|
|||
ui->txtProblemCaseOutput->clear();
|
||||
ui->txtProblemCaseOutput->setText(problemCase->output);
|
||||
if (problemCase->testState == ProblemCaseTestState::Failed) {
|
||||
QStringList output = TextToLines(problemCase->output);
|
||||
QStringList expected = TextToLines(problemCase->expected);
|
||||
QStringList output = textToLines(problemCase->output);
|
||||
QStringList expected = textToLines(problemCase->expected);
|
||||
for (int i=0;i<output.count();i++) {
|
||||
if (i>=expected.count() || output[i]!=expected[i]) {
|
||||
QTextBlock block = ui->txtProblemCaseOutput->document()->findBlockByLineNumber(i);
|
||||
|
@ -5747,7 +5742,6 @@ void MainWindow::on_actionDelete_to_EOL_triggered()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionDelete_to_BOL_triggered()
|
||||
{
|
||||
Editor *e=mEditorList->getEditor();
|
||||
|
@ -5755,4 +5749,3 @@ void MainWindow::on_actionDelete_to_BOL_triggered()
|
|||
e->deleteToBOL();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -95,13 +95,13 @@ public:
|
|||
void runExecutable(RunType runType = RunType::Normal);
|
||||
void debug();
|
||||
void showSearchPanel(bool showReplace = false);
|
||||
void showCPUInfoDialog();
|
||||
|
||||
void applySettings();
|
||||
void applyUISettings();
|
||||
QFileSystemWatcher* fileSystemWatcher();
|
||||
|
||||
void removeActiveBreakpoints();
|
||||
void setActiveBreakpoint(QString FileName, int Line, bool setFocus=true);
|
||||
void updateAppTitle();
|
||||
void addDebugOutput(const QString& text);
|
||||
void changeDebugOutputLastline(const QString& text);
|
||||
|
@ -193,6 +193,7 @@ public slots:
|
|||
void onTodoParseStarted(const QString& filename);
|
||||
void onTodoParsing(const QString& filename, int lineNo, int ch, const QString& line);
|
||||
void onTodoParseFinished();
|
||||
void setActiveBreakpoint(QString FileName, int Line, bool setFocus);
|
||||
|
||||
private:
|
||||
void prepareProjectForCompile();
|
||||
|
@ -632,7 +633,7 @@ private:
|
|||
QWidget * mFilesViewToolbar;
|
||||
|
||||
//action for debug console
|
||||
QAction * mDebugConsole_ShowCommandLog;
|
||||
QAction * mDebugConsole_ShowDetailLog;
|
||||
QAction * mDebugConsole_Clear;
|
||||
QAction * mDebugConsole_Copy;
|
||||
QAction * mDebugConsole_Paste;
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
<enum>QTabWidget::West</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="usesScrollButtons">
|
||||
<bool>true</bool>
|
||||
|
@ -174,7 +174,7 @@
|
|||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="headerDefaultSectionSize">
|
||||
<number>50</number>
|
||||
<number>100</number>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -506,7 +506,7 @@
|
|||
<enum>QTabWidget::South</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
|
|
|
@ -680,7 +680,7 @@ void CppPreprocessor::openInclude(const QString &fileName, QStringList bufferedT
|
|||
if (!bufferedText.isEmpty()) {
|
||||
parsedFile->buffer = bufferedText;
|
||||
} else {
|
||||
parsedFile->buffer = ReadFileToLines(fileName);
|
||||
parsedFile->buffer = readFileToLines(fileName);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -74,9 +74,6 @@ public:
|
|||
const QList<QString> &includePathList() const;
|
||||
|
||||
const QList<QString> &projectIncludePathList() const;
|
||||
|
||||
signals:
|
||||
|
||||
private:
|
||||
void preprocessBuffer();
|
||||
void skipToEndOfPreprocessor();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -10,8 +10,8 @@ bool ProblemCaseValidator::validate(POJProblemCase problemCase)
|
|||
{
|
||||
if (!problemCase)
|
||||
return false;
|
||||
QStringList output = TextToLines(problemCase->output);
|
||||
QStringList expected = TextToLines(problemCase->expected);
|
||||
QStringList output = textToLines(problemCase->output);
|
||||
QStringList expected = textToLines(problemCase->expected);
|
||||
if (output.count()!=expected.count())
|
||||
return false;
|
||||
for (int i=0;i<output.count();i++) {
|
||||
|
|
|
@ -107,9 +107,10 @@ bool Project::modified() const
|
|||
|
||||
// Otherwise, check all units
|
||||
foreach (const PProjectUnit& unit, mUnits){
|
||||
if (unit->modified())
|
||||
if (unit->modified()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -184,10 +185,7 @@ void Project::setFileName(QString value)
|
|||
|
||||
void Project::setModified(bool value)
|
||||
{
|
||||
QFile file(mFilename);
|
||||
// only mark modified if *not* read-only
|
||||
if (!file.exists()
|
||||
|| (file.exists() && file.isWritable())) {
|
||||
if (mModified!=value) {
|
||||
mModified=value;
|
||||
emit modifyChanged(mModified);
|
||||
}
|
||||
|
@ -1032,7 +1030,7 @@ void Project::buildPrivateResource(bool forceSave)
|
|||
|
||||
rcFile = QDir(directory()).absoluteFilePath(rcFile);
|
||||
if (contents.count() > 3) {
|
||||
StringsToFile(contents,rcFile);
|
||||
stringsToFile(contents,rcFile);
|
||||
mOptions.privateResource = extractRelativePath(directory(), rcFile);
|
||||
} else {
|
||||
if (fileExists(rcFile))
|
||||
|
@ -1073,7 +1071,7 @@ void Project::buildPrivateResource(bool forceSave)
|
|||
content.append(" </dependentAssembly>");
|
||||
content.append("</dependency>");
|
||||
content.append("</assembly>");
|
||||
StringsToFile(content,executable() + ".Manifest");
|
||||
stringsToFile(content,executable() + ".Manifest");
|
||||
} else if (fileExists(executable() + ".Manifest"))
|
||||
QFile::remove(executable() + ".Manifest");
|
||||
|
||||
|
@ -1119,7 +1117,7 @@ void Project::buildPrivateResource(bool forceSave)
|
|||
.arg(mOptions.versionInfo.productVersion));
|
||||
contents.append("");
|
||||
contents.append("#endif /*" + def + "*/");
|
||||
StringsToFile(contents,hFile);
|
||||
stringsToFile(contents,hFile);
|
||||
}
|
||||
|
||||
void Project::checkProjectFileForUpdate(SimpleIni &ini)
|
||||
|
@ -1599,6 +1597,7 @@ void Project::setName(const QString &newName)
|
|||
if (newName != mName) {
|
||||
mName = newName;
|
||||
mNode->text = newName;
|
||||
setModified(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1772,7 +1771,7 @@ bool ProjectUnit::save()
|
|||
if (!mEditor && !fileExists(mFileName)) {
|
||||
// file is neither open, nor saved
|
||||
QStringList temp;
|
||||
StringsToFile(temp,mFileName);
|
||||
stringsToFile(temp,mFileName);
|
||||
} else if (mEditor && mEditor->modified()) {
|
||||
result = mEditor->save();
|
||||
}
|
||||
|
@ -1885,7 +1884,7 @@ Qt::ItemFlags ProjectModel::flags(const QModelIndex &index) const
|
|||
if (!p)
|
||||
return Qt::NoItemFlags;
|
||||
if (p==mProject->node().get())
|
||||
return Qt::ItemIsEnabled | Qt::ItemIsDropEnabled;
|
||||
return Qt::ItemIsEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEditable;
|
||||
Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
|
||||
if (p->unitIndex<0) {
|
||||
flags.setFlag(Qt::ItemIsDropEnabled);
|
||||
|
@ -1903,8 +1902,13 @@ bool ProjectModel::setData(const QModelIndex &index, const QVariant &value, int
|
|||
if (!node)
|
||||
return false;
|
||||
if (role == Qt::EditRole) {
|
||||
if (node == mProject->node())
|
||||
if (node == mProject->node()) {
|
||||
QString newName = value.toString().trimmed();
|
||||
if (newName.isEmpty())
|
||||
return false;
|
||||
mProject->setName(newName);
|
||||
return true;
|
||||
}
|
||||
int idx = node->unitIndex;
|
||||
if (idx >= 0) {
|
||||
//change unit name
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
#define PROJECT_H
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QObject>
|
||||
#include <QSettings>
|
||||
#include <memory>
|
||||
#include "projectoptions.h"
|
||||
#include "utils.h"
|
||||
|
|
|
@ -54,8 +54,6 @@ private:
|
|||
QString mIcon; // icon in project form
|
||||
PSimpleIni mIni;
|
||||
int mVersion;
|
||||
signals:
|
||||
|
||||
};
|
||||
using PProjectTemplate = std::shared_ptr<ProjectTemplate>;
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent)
|
|||
| eoHideShowScrollbars ;
|
||||
|
||||
mScrollTimer = new QTimer(this);
|
||||
mScrollTimer->setInterval(100);
|
||||
//mScrollTimer->setInterval(100);
|
||||
connect(mScrollTimer, &QTimer::timeout,this, &SynEdit::onScrollTimeout);
|
||||
|
||||
mScrollHintColor = QColorConstants::Yellow;
|
||||
|
@ -666,9 +666,9 @@ DisplayCoord SynEdit::pixelsToNearestRowColumn(int aX, int aY) const
|
|||
// don't return a partially visible last line
|
||||
if (aY >= mLinesInWindow * mTextHeight) {
|
||||
aY = mLinesInWindow * mTextHeight - 1;
|
||||
}
|
||||
if (aY < 0)
|
||||
aY = 0;
|
||||
}
|
||||
return {
|
||||
std::max(1, (int)(leftChar() + round(f))),
|
||||
std::max(1, mTopLine + (aY / mTextHeight))
|
||||
|
@ -1763,6 +1763,52 @@ void SynEdit::doToggleComment()
|
|||
doComment();
|
||||
}
|
||||
|
||||
void SynEdit::doMouseScroll(bool isDragging)
|
||||
{
|
||||
QPoint iMousePos;
|
||||
DisplayCoord C;
|
||||
int X, Y;
|
||||
|
||||
iMousePos = QCursor::pos();
|
||||
iMousePos = mapFromGlobal(iMousePos);
|
||||
C = pixelsToRowColumn(iMousePos.x(), iMousePos.y());
|
||||
C.Row = minMax(C.Row, 1, displayLineCount());
|
||||
if (mScrollDeltaX != 0) {
|
||||
setLeftChar(leftChar() + mScrollDeltaX);
|
||||
X = leftChar();
|
||||
if (mScrollDeltaX > 0) // scrolling right?
|
||||
X+=charsInWindow();
|
||||
C.Column = X;
|
||||
}
|
||||
if (mScrollDeltaY != 0) {
|
||||
if (QApplication::queryKeyboardModifiers().testFlag(Qt::ShiftModifier))
|
||||
setTopLine(mTopLine + mScrollDeltaY * mLinesInWindow);
|
||||
else
|
||||
setTopLine(mTopLine + mScrollDeltaY);
|
||||
Y = mTopLine;
|
||||
if (mScrollDeltaY > 0) // scrolling down?
|
||||
Y+=mLinesInWindow - 1;
|
||||
C.Row = minMax(Y, 1, displayLineCount());
|
||||
}
|
||||
BufferCoord vCaret = displayToBufferPos(C);
|
||||
if ((caretX() != vCaret.Char) || (caretY() != vCaret.Line)) {
|
||||
// changes to line / column in one go
|
||||
incPaintLock();
|
||||
auto action = finally([this]{
|
||||
decPaintLock();
|
||||
});
|
||||
internalSetCaretXY(vCaret);
|
||||
|
||||
// if MouseCapture is True we're changing selection. otherwise we're dragging
|
||||
if (isDragging) {
|
||||
setBlockBegin(mDragSelBeginSave);
|
||||
setBlockEnd(mDragSelEndSave);
|
||||
} else
|
||||
setBlockEnd(caretXY());
|
||||
}
|
||||
computeScroll(iMousePos.x(), iMousePos.y(),isDragging);
|
||||
}
|
||||
|
||||
void SynEdit::doDeleteLastChar()
|
||||
{
|
||||
if (mReadOnly)
|
||||
|
@ -1819,7 +1865,7 @@ void SynEdit::doDeleteLastChar()
|
|||
mLines->deleteAt(mCaretY);
|
||||
doLinesDeleted(mCaretY+1, 1);
|
||||
if (mOptions.testFlag(eoTrimTrailingSpaces))
|
||||
Temp = TrimRight(Temp);
|
||||
Temp = trimRight(Temp);
|
||||
setLineText(lineText() + Temp);
|
||||
helper = lineBreak(); //"/r/n"
|
||||
}
|
||||
|
@ -2153,7 +2199,7 @@ void SynEdit::insertLine(bool moveCaret)
|
|||
rightLineText,mOptions.testFlag(eoAutoIndent)
|
||||
&& notInComment);
|
||||
if (mOptions.testFlag(eoAutoIndent)) {
|
||||
rightLineText=TrimLeft(rightLineText);
|
||||
rightLineText=trimLeft(rightLineText);
|
||||
}
|
||||
QString indentSpacesForRightLineText = GetLeftSpacing(indentSpaces,true);
|
||||
mLines->insert(mCaretY, indentSpacesForRightLineText+rightLineText);
|
||||
|
@ -2480,17 +2526,25 @@ void SynEdit::computeCaret(int X, int Y)
|
|||
setInternalDisplayXY(vCaretNearestPos);
|
||||
}
|
||||
|
||||
void SynEdit::computeScroll(int X, int Y)
|
||||
void SynEdit::computeScroll(int X, int Y, bool isDragging)
|
||||
{
|
||||
if (!isDragging) {
|
||||
Qt::MouseButtons buttons = qApp->mouseButtons();
|
||||
if (!buttons.testFlag(Qt::LeftButton))
|
||||
return;
|
||||
}
|
||||
QRect iScrollBounds; // relative to the client area
|
||||
// don't scroll if dragging text from other control
|
||||
// if (not MouseCapture) and (not Dragging) then begin
|
||||
// fScrollTimer.Enabled := False;
|
||||
// Exit;
|
||||
// end;
|
||||
|
||||
iScrollBounds = QRect(mGutterWidth+this->frameWidth(), this->frameWidth(), mCharsInWindow * mCharWidth,
|
||||
mLinesInWindow * mTextHeight);
|
||||
int dispX=2,dispY = 2;
|
||||
if (isDragging) {
|
||||
dispX = mCharWidth / 2 -1;
|
||||
dispY = mTextHeight/ 2 -1;
|
||||
}
|
||||
int left = mGutterWidth+frameWidth()+dispX;
|
||||
int top = frameWidth()+dispY;
|
||||
iScrollBounds = QRect(left,
|
||||
top,
|
||||
clientWidth()-left-dispX,
|
||||
clientHeight()-top-dispY);
|
||||
|
||||
if (X < iScrollBounds.left())
|
||||
mScrollDeltaX = (X - iScrollBounds.left()) / mCharWidth - 1;
|
||||
|
@ -2499,6 +2553,10 @@ void SynEdit::computeScroll(int X, int Y)
|
|||
else
|
||||
mScrollDeltaX = 0;
|
||||
|
||||
if (isDragging && (X<0 || X>clientRect().width())) {
|
||||
mScrollDeltaX = 0;
|
||||
}
|
||||
|
||||
if (Y < iScrollBounds.top())
|
||||
mScrollDeltaY = (Y - iScrollBounds.top()) / mTextHeight - 1;
|
||||
else if (Y >= iScrollBounds.bottom())
|
||||
|
@ -2506,8 +2564,17 @@ void SynEdit::computeScroll(int X, int Y)
|
|||
else
|
||||
mScrollDeltaY = 0;
|
||||
|
||||
if (mScrollDeltaX!=0 || mScrollDeltaY!=0)
|
||||
mScrollTimer->start();
|
||||
if (isDragging && (Y<0 || Y>clientRect().height())) {
|
||||
mScrollDeltaY = 0;
|
||||
}
|
||||
|
||||
if (mScrollDeltaX!=0 || mScrollDeltaY!=0) {
|
||||
if (isDragging) {
|
||||
mScrollTimer->singleShot(100,this,&SynEdit::onDraggingScrollTimeout);
|
||||
} else {
|
||||
mScrollTimer->singleShot(100,this,&SynEdit::onScrollTimeout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SynEdit::doBlockIndent()
|
||||
|
@ -2670,7 +2737,7 @@ void SynEdit::doAddChar(QChar AChar)
|
|||
if (line.length() < oldCaretX) {
|
||||
int indentSpaces = calcIndentSpaces(oldCaretY,line+":", true);
|
||||
if (indentSpaces != leftSpaces(line)) {
|
||||
QString newLine = GetLeftSpacing(indentSpaces,true) + TrimLeft(line);
|
||||
QString newLine = GetLeftSpacing(indentSpaces,true) + trimLeft(line);
|
||||
int i = newLine.length();
|
||||
mLines->putString(oldCaretY-1,newLine);
|
||||
internalSetCaretXY(BufferCoord{i+1,oldCaretY});
|
||||
|
@ -2841,11 +2908,6 @@ void SynEdit::decPaintLock()
|
|||
}
|
||||
}
|
||||
|
||||
bool SynEdit::mouseCapture()
|
||||
{
|
||||
return hasMouseTracking();
|
||||
}
|
||||
|
||||
int SynEdit::clientWidth()
|
||||
{
|
||||
return viewport()->size().width();
|
||||
|
@ -4965,7 +5027,7 @@ void SynEdit::doLinesInserted(int firstLine, int count)
|
|||
void SynEdit::properSetLine(int ALine, const QString &ALineText, bool notify)
|
||||
{
|
||||
if (mOptions.testFlag(eoTrimTrailingSpaces)) {
|
||||
mLines->putString(ALine,TrimRight(ALineText),notify);
|
||||
mLines->putString(ALine,trimRight(ALineText),notify);
|
||||
} else {
|
||||
mLines->putString(ALine,ALineText,notify);
|
||||
}
|
||||
|
@ -5077,7 +5139,7 @@ int SynEdit::insertTextByNormalMode(const QString &Value)
|
|||
int startLine = mCaretY;
|
||||
sLeftSide = lineText().mid(0, mCaretX - 1);
|
||||
if (mCaretX - 1 > sLeftSide.length()) {
|
||||
if (StringIsBlank(sLeftSide))
|
||||
if (stringIsBlank(sLeftSide))
|
||||
sLeftSide = GetLeftSpacing(displayX() - 1, true);
|
||||
else
|
||||
sLeftSide += QString(mCaretX - 1 - sLeftSide.length(),' ');
|
||||
|
@ -5093,7 +5155,7 @@ int SynEdit::insertTextByNormalMode(const QString &Value)
|
|||
Start = 0;
|
||||
P = GetEOL(Value,Start);
|
||||
if (P<Value.length()) {
|
||||
QString s = TrimLeft(Value.mid(0, P - Start));
|
||||
QString s = trimLeft(Value.mid(0, P - Start));
|
||||
if (sLeftSide.isEmpty()) {
|
||||
sLeftSide = GetLeftSpacing(calcIndentSpaces(caretY,s,true),true);
|
||||
}
|
||||
|
@ -5126,7 +5188,7 @@ int SynEdit::insertTextByNormalMode(const QString &Value)
|
|||
Str += sRightSide;
|
||||
if (mOptions.testFlag(eoAutoIndent)) {
|
||||
int indentSpaces = calcIndentSpaces(caretY,Str,true);
|
||||
Str = GetLeftSpacing(indentSpaces,true)+TrimLeft(Str);
|
||||
Str = GetLeftSpacing(indentSpaces,true)+trimLeft(Str);
|
||||
}
|
||||
}
|
||||
properSetLine(caretY - 1, Str,false);
|
||||
|
@ -5948,7 +6010,7 @@ void SynEdit::mousePressEvent(QMouseEvent *event)
|
|||
// setBlockBegin(TmpBegin);
|
||||
// setBlockEnd(TmpEnd);
|
||||
|
||||
setMouseTracking(true);
|
||||
//setMouseTracking(true);
|
||||
//if mousedown occurred in selected block begin drag operation
|
||||
mStateFlags.setFlag(SynStateFlag::sfWaitForDragging,false);
|
||||
if (bWasSel && mOptions.testFlag(eoDragDropEditing) && (X >= mGutterWidth + 2)
|
||||
|
@ -5985,10 +6047,10 @@ void SynEdit::mouseReleaseEvent(QMouseEvent *event)
|
|||
processGutterClick(event);
|
||||
}
|
||||
|
||||
mScrollTimer->stop();
|
||||
//mScrollTimer->stop();
|
||||
// if ((button = ) and (Shift = [ssRight]) and Assigned(PopupMenu) then
|
||||
// exit;
|
||||
setMouseTracking(false);
|
||||
//setMouseTracking(false);
|
||||
|
||||
if (mStateFlags.testFlag(SynStateFlag::sfWaitForDragging) &&
|
||||
!mStateFlags.testFlag(SynStateFlag::sfDblClicked)) {
|
||||
|
@ -6008,9 +6070,6 @@ void SynEdit::mouseMoveEvent(QMouseEvent *event)
|
|||
Qt::MouseButtons buttons = event->buttons();
|
||||
int X=event->pos().x();
|
||||
int Y=event->pos().y();
|
||||
// if (!hasMouseTracking())
|
||||
// return;
|
||||
|
||||
if ((mStateFlags.testFlag(SynStateFlag::sfWaitForDragging))) {
|
||||
if ( ( event->pos() - mMouseDownPos).manhattanLength()>=QApplication::startDragDistance()) {
|
||||
mStateFlags.setFlag(SynStateFlag::sfWaitForDragging,false);
|
||||
|
@ -6024,10 +6083,9 @@ void SynEdit::mouseMoveEvent(QMouseEvent *event)
|
|||
//drag->setPixmap(iconPixmap);
|
||||
//BeginDrag(false);
|
||||
}
|
||||
// } else if ((buttons == Qt::LeftButton) && (X > mGutterWidth)) {
|
||||
} else if ((buttons == Qt::LeftButton)) {
|
||||
// should we begin scrolling?
|
||||
computeScroll(X, Y);
|
||||
computeScroll(X, Y,false);
|
||||
DisplayCoord P = pixelsToNearestRowColumn(X, Y);
|
||||
P.Row = minMax(P.Row, 1, displayLineCount());
|
||||
if (mScrollDeltaX != 0)
|
||||
|
@ -6144,20 +6202,61 @@ void SynEdit::dragEnterEvent(QDragEnterEvent *event)
|
|||
|
||||
void SynEdit::dropEvent(QDropEvent *event)
|
||||
{
|
||||
mUndoList->BeginBlock();
|
||||
auto action = finally([this] {
|
||||
mUndoList->EndBlock();
|
||||
});
|
||||
if (event->proposedAction() == Qt::DropAction::MoveAction) {
|
||||
setBlockBegin(mDragSelBeginSave);
|
||||
setBlockEnd(mDragSelEndSave);
|
||||
setSelText("");
|
||||
}
|
||||
//mScrollTimer->stop();
|
||||
|
||||
BufferCoord coord = displayToBufferPos(pixelsToNearestRowColumn(event->pos().x(),
|
||||
event->pos().y()));
|
||||
setCaretXY(coord);
|
||||
if (coord>=mDragSelBeginSave && coord<=mDragSelEndSave) {
|
||||
//do nothing if drag onto itself
|
||||
} else if (event->proposedAction() == Qt::DropAction::CopyAction) {
|
||||
//just copy it
|
||||
setSelText(event->mimeData()->text());
|
||||
} else if (event->proposedAction() == Qt::DropAction::MoveAction) {
|
||||
int topLine = mTopLine;
|
||||
int leftChar = mLeftChar;
|
||||
mUndoList->BeginBlock();
|
||||
if (coord < mDragSelBeginSave ) {
|
||||
//delete old
|
||||
setBlockBegin(mDragSelBeginSave);
|
||||
setBlockEnd(mDragSelEndSave);
|
||||
setSelText("");
|
||||
//paste to new position
|
||||
setTopLine(topLine);
|
||||
setLeftChar(leftChar);
|
||||
setCaretXY(coord);
|
||||
setSelText(event->mimeData()->text());
|
||||
} else {
|
||||
//paste to new position
|
||||
setTopLine(topLine);
|
||||
setLeftChar(leftChar);
|
||||
setCaretXY(coord);
|
||||
setSelText(event->mimeData()->text());
|
||||
//delete old
|
||||
setBlockBegin(mDragSelBeginSave);
|
||||
setBlockEnd(mDragSelEndSave);
|
||||
setSelText("");
|
||||
//set caret to right pos
|
||||
if (mDragSelBeginSave.Line == mDragSelEndSave.Line) {
|
||||
if (coord.Line == mDragSelEndSave.Line) {
|
||||
coord.Char -= mDragSelEndSave.Char-mDragSelBeginSave.Char;
|
||||
}
|
||||
} else {
|
||||
if (coord.Line == mDragSelEndSave.Line) {
|
||||
coord.Char -= mDragSelEndSave.Char-1;
|
||||
} else {
|
||||
coord.Line -= mDragSelEndSave.Line-mDragSelBeginSave.Line;
|
||||
topLine -= mDragSelEndSave.Line-mDragSelBeginSave.Line;
|
||||
}
|
||||
}
|
||||
setTopLine(topLine);
|
||||
setLeftChar(leftChar);
|
||||
setCaretXY(coord);
|
||||
}
|
||||
mUndoList->EndBlock();
|
||||
}
|
||||
event->acceptProposedAction();
|
||||
|
||||
}
|
||||
|
||||
void SynEdit::dragMoveEvent(QDragMoveEvent *event)
|
||||
|
@ -6167,9 +6266,13 @@ void SynEdit::dragMoveEvent(QDragMoveEvent *event)
|
|||
} else {
|
||||
event->setDropAction(Qt::MoveAction);
|
||||
}
|
||||
// should we begin scrolling?
|
||||
computeScroll(event->pos().x(),
|
||||
event->pos().y(),true);
|
||||
|
||||
BufferCoord coord = displayToBufferPos(pixelsToNearestRowColumn(event->pos().x(),
|
||||
event->pos().y()));
|
||||
setCaretXY(coord);
|
||||
internalSetCaretXY(coord);
|
||||
setBlockBegin(mDragSelBeginSave);
|
||||
setBlockEnd(mDragSelEndSave);
|
||||
showCaret();
|
||||
|
@ -6177,10 +6280,10 @@ void SynEdit::dragMoveEvent(QDragMoveEvent *event)
|
|||
|
||||
void SynEdit::dragLeaveEvent(QDragLeaveEvent *)
|
||||
{
|
||||
setCaretXY(mDragCaretSave);
|
||||
setBlockBegin(mDragSelBeginSave);
|
||||
setBlockEnd(mDragSelEndSave);
|
||||
showCaret();
|
||||
// setCaretXY(mDragCaretSave);
|
||||
// setBlockBegin(mDragSelBeginSave);
|
||||
// setBlockEnd(mDragSelEndSave);
|
||||
// showCaret();
|
||||
}
|
||||
|
||||
int SynEdit::maxScrollHeight() const
|
||||
|
@ -6556,43 +6659,10 @@ void SynEdit::onGutterChanged()
|
|||
|
||||
void SynEdit::onScrollTimeout()
|
||||
{
|
||||
QPoint iMousePos;
|
||||
DisplayCoord C;
|
||||
int X, Y;
|
||||
|
||||
iMousePos = QCursor::pos();
|
||||
iMousePos = mapFromGlobal(iMousePos);
|
||||
C = pixelsToRowColumn(iMousePos.x(), iMousePos.y());
|
||||
C.Row = minMax(C.Row, 1, displayLineCount());
|
||||
if (mScrollDeltaX != 0) {
|
||||
setLeftChar(leftChar() + mScrollDeltaX);
|
||||
X = leftChar();
|
||||
if (mScrollDeltaX > 0) // scrolling right?
|
||||
X+=charsInWindow();
|
||||
C.Column = X;
|
||||
}
|
||||
if (mScrollDeltaY != 0) {
|
||||
if (QApplication::queryKeyboardModifiers().testFlag(Qt::ShiftModifier))
|
||||
setTopLine(mTopLine + mScrollDeltaY * mLinesInWindow);
|
||||
else
|
||||
setTopLine(mTopLine + mScrollDeltaY);
|
||||
Y = mTopLine;
|
||||
if (mScrollDeltaY > 0) // scrolling down?
|
||||
Y+=mLinesInWindow - 1;
|
||||
C.Row = minMax(Y, 1, displayLineCount());
|
||||
}
|
||||
BufferCoord vCaret = displayToBufferPos(C);
|
||||
if ((caretX() != vCaret.Char) || (caretY() != vCaret.Line)) {
|
||||
// changes to line / column in one go
|
||||
incPaintLock();
|
||||
auto action = finally([this]{
|
||||
decPaintLock();
|
||||
});
|
||||
internalSetCaretXY(vCaret);
|
||||
|
||||
// if MouseCapture is True we're changing selection. otherwise we're dragging
|
||||
// if (mouseCapture())
|
||||
setBlockEnd(caretXY());
|
||||
}
|
||||
computeScroll(iMousePos.x(), iMousePos.y());
|
||||
doMouseScroll(false);
|
||||
}
|
||||
|
||||
void SynEdit::onDraggingScrollTimeout()
|
||||
{
|
||||
doMouseScroll(true);
|
||||
}
|
||||
|
|
|
@ -432,11 +432,10 @@ protected:
|
|||
private:
|
||||
void clearAreaList(SynEditingAreaList areaList);
|
||||
void computeCaret(int X, int Y);
|
||||
void computeScroll(int X, int Y);
|
||||
void computeScroll(int X, int Y, bool isDragging);
|
||||
|
||||
void incPaintLock();
|
||||
void decPaintLock();
|
||||
bool mouseCapture();
|
||||
int clientWidth();
|
||||
int clientHeight();
|
||||
int clientTop();
|
||||
|
@ -562,6 +561,7 @@ private:
|
|||
void doComment();
|
||||
void doUncomment();
|
||||
void doToggleComment();
|
||||
void doMouseScroll(bool isDragging);
|
||||
|
||||
|
||||
private slots:
|
||||
|
@ -575,6 +575,7 @@ private slots:
|
|||
void onLinesPutted(int index, int count);
|
||||
void onRedoAdded();
|
||||
void onScrollTimeout();
|
||||
void onDraggingScrollTimeout();
|
||||
void onUndoAdded();
|
||||
void onSizeOrFontChanged(bool bFont);
|
||||
void onChanged();
|
||||
|
@ -701,6 +702,7 @@ private:
|
|||
BufferCoord mDragCaretSave;
|
||||
BufferCoord mDragSelBeginSave;
|
||||
BufferCoord mDragSelEndSave;
|
||||
bool mDragging;
|
||||
|
||||
friend class SynEditTextPainter;
|
||||
|
||||
|
|
|
@ -493,7 +493,7 @@ void SynEditStringList::insertText(int Index, const QString &NewText)
|
|||
}
|
||||
if (NewText.isEmpty())
|
||||
return;
|
||||
QStringList lines = TextToLines(NewText);
|
||||
QStringList lines = textToLines(NewText);
|
||||
insertStrings(Index,lines);
|
||||
}
|
||||
|
||||
|
@ -540,14 +540,14 @@ void SynEditStringList::loadFromFile(const QString& filename, const QByteArray&
|
|||
allAscii = isTextAllAscii(line);
|
||||
}
|
||||
if (allAscii) {
|
||||
addItem(TrimRight(QString::fromLatin1(line)));
|
||||
addItem(trimRight(QString::fromLatin1(line)));
|
||||
} else {
|
||||
QString newLine = codec->toUnicode(line.constData(),line.length(),&state);
|
||||
if (state.invalidChars>0) {
|
||||
needReread = true;
|
||||
break;
|
||||
}
|
||||
addItem(TrimRight(newLine));
|
||||
addItem(trimRight(newLine));
|
||||
}
|
||||
if (file.atEnd()){
|
||||
break;
|
||||
|
@ -580,7 +580,7 @@ void SynEditStringList::loadFromFile(const QString& filename, const QByteArray&
|
|||
QString line;
|
||||
internalClear();
|
||||
while (textStream.readLineInto(&line)) {
|
||||
addItem(TrimRight(line));
|
||||
addItem(trimRight(line));
|
||||
}
|
||||
emit inserted(0,mList.count());
|
||||
}
|
||||
|
|
|
@ -239,3 +239,32 @@ bool BufferCoord::operator==(const BufferCoord &coord)
|
|||
{
|
||||
return coord.Char == Char && coord.Line == Line;
|
||||
}
|
||||
|
||||
bool BufferCoord::operator>=(const BufferCoord &coord)
|
||||
{
|
||||
return (Line > coord.Line)
|
||||
|| (Line == coord.Line && Char >= coord.Char);
|
||||
}
|
||||
|
||||
bool BufferCoord::operator>(const BufferCoord &coord)
|
||||
{
|
||||
return (Line > coord.Line)
|
||||
|| (Line == coord.Line && Char > coord.Char);
|
||||
}
|
||||
|
||||
bool BufferCoord::operator<(const BufferCoord &coord)
|
||||
{
|
||||
return (Line < coord.Line)
|
||||
|| (Line == coord.Line && Char < coord.Char);
|
||||
}
|
||||
|
||||
bool BufferCoord::operator<=(const BufferCoord &coord)
|
||||
{
|
||||
return (Line < coord.Line)
|
||||
|| (Line == coord.Line && Char <= coord.Char);
|
||||
}
|
||||
|
||||
bool BufferCoord::operator!=(const BufferCoord &coord)
|
||||
{
|
||||
return coord.Char != Char || coord.Line != Line;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,11 @@ struct BufferCoord {
|
|||
int Char;
|
||||
int Line;
|
||||
bool operator==(const BufferCoord& coord);
|
||||
bool operator>=(const BufferCoord& coord);
|
||||
bool operator>(const BufferCoord& coord);
|
||||
bool operator<(const BufferCoord& coord);
|
||||
bool operator<=(const BufferCoord& coord);
|
||||
bool operator!=(const BufferCoord& coord);
|
||||
};
|
||||
|
||||
class SynEdit;
|
||||
|
|
|
@ -2924,24 +2924,24 @@ Settings::Debugger::Debugger(Settings *settings):_Base(settings, SETTING_DEBUGGE
|
|||
|
||||
}
|
||||
|
||||
bool Settings::Debugger::showCommandLog() const
|
||||
bool Settings::Debugger::enableDebugConsole() const
|
||||
{
|
||||
return mShowCommandLog;
|
||||
return mEnableDebugConsole;
|
||||
}
|
||||
|
||||
void Settings::Debugger::setShowCommandLog(bool showCommandLog)
|
||||
void Settings::Debugger::setEnableDebugConsole(bool showCommandLog)
|
||||
{
|
||||
mShowCommandLog = showCommandLog;
|
||||
mEnableDebugConsole = showCommandLog;
|
||||
}
|
||||
|
||||
bool Settings::Debugger::showAnnotations() const
|
||||
bool Settings::Debugger::showDetailLog() const
|
||||
{
|
||||
return mShowAnnotations;
|
||||
return mShowDetailLog;
|
||||
}
|
||||
|
||||
void Settings::Debugger::setShowAnnotations(bool showAnnotations)
|
||||
void Settings::Debugger::setShowDetailLog(bool showAnnotations)
|
||||
{
|
||||
mShowAnnotations = showAnnotations;
|
||||
mShowDetailLog = showAnnotations;
|
||||
}
|
||||
|
||||
QString Settings::Debugger::fontName() const
|
||||
|
@ -3004,6 +3004,16 @@ void Settings::Debugger::setAutosaveWatches(bool newAutosaveWatches)
|
|||
mAutosaveWatches = newAutosaveWatches;
|
||||
}
|
||||
|
||||
bool Settings::Debugger::openCPUInfoWhenSignaled() const
|
||||
{
|
||||
return mOpenCPUInfoWhenSignaled;
|
||||
}
|
||||
|
||||
void Settings::Debugger::setOpenCPUInfoWhenSignaled(bool newOpenCPUInfoWhenSignaled)
|
||||
{
|
||||
mOpenCPUInfoWhenSignaled = newOpenCPUInfoWhenSignaled;
|
||||
}
|
||||
|
||||
bool Settings::Debugger::autosaveBreakpoints() const
|
||||
{
|
||||
return mAutosaveBreakpoints;
|
||||
|
@ -3046,8 +3056,8 @@ void Settings::Debugger::setOnlyShowMono(bool onlyShowMono)
|
|||
|
||||
void Settings::Debugger::doSave()
|
||||
{
|
||||
saveValue("show_command_log", mShowCommandLog);
|
||||
saveValue("show_annotations", mShowAnnotations);
|
||||
saveValue("enable_debug_console", mEnableDebugConsole);
|
||||
saveValue("show_detail_log", mShowDetailLog);
|
||||
saveValue("font_name",mFontName);
|
||||
saveValue("only_show_mono",mOnlyShowMono);
|
||||
saveValue("font_size",mFontSize);
|
||||
|
@ -3058,13 +3068,14 @@ void Settings::Debugger::doSave()
|
|||
saveValue("skip_custom_lib", mSkipCustomLibraries);
|
||||
saveValue("autosave_breakpoints",mAutosaveBreakpoints);
|
||||
saveValue("autosave_watches",mAutosaveWatches);
|
||||
saveValue("open_cpu_info_when_signaled",mOpenCPUInfoWhenSignaled);
|
||||
|
||||
}
|
||||
|
||||
void Settings::Debugger::doLoad()
|
||||
{
|
||||
mShowCommandLog = boolValue("show_command_log",true);
|
||||
mShowAnnotations = boolValue("show_annotations",false);
|
||||
mEnableDebugConsole = boolValue("enable_debug_console",true);
|
||||
mShowDetailLog = boolValue("show_detail_log",false);
|
||||
mFontName = stringValue("font_name","Consolas");
|
||||
mOnlyShowMono = boolValue("only_show_mono",true);
|
||||
mFontSize = intValue("font_size",12);
|
||||
|
@ -3075,6 +3086,7 @@ void Settings::Debugger::doLoad()
|
|||
mSkipCustomLibraries = boolValue("skip_custom_lib",false);
|
||||
mAutosaveBreakpoints = boolValue("autosave_breakpoints",true);
|
||||
mAutosaveWatches = boolValue("autosave_watches",true);
|
||||
mOpenCPUInfoWhenSignaled = boolValue("open_cpu_info_when_signaled",true);
|
||||
}
|
||||
|
||||
Settings::History::History(Settings *settings):_Base(settings, SETTING_HISTORY)
|
||||
|
|
|
@ -930,11 +930,11 @@ public:
|
|||
class Debugger: public _Base {
|
||||
public:
|
||||
explicit Debugger(Settings* settings);
|
||||
bool showCommandLog() const;
|
||||
void setShowCommandLog(bool showCommandLog);
|
||||
bool enableDebugConsole() const;
|
||||
void setEnableDebugConsole(bool showCommandLog);
|
||||
|
||||
bool showAnnotations() const;
|
||||
void setShowAnnotations(bool showAnnotations);
|
||||
bool showDetailLog() const;
|
||||
void setShowDetailLog(bool showAnnotations);
|
||||
|
||||
bool onlyShowMono() const;
|
||||
void setOnlyShowMono(bool onlyShowMono);
|
||||
|
@ -964,9 +964,12 @@ public:
|
|||
bool autosaveWatches() const;
|
||||
void setAutosaveWatches(bool newAutosaveWatches);
|
||||
|
||||
bool openCPUInfoWhenSignaled() const;
|
||||
void setOpenCPUInfoWhenSignaled(bool newOpenCPUInfoWhenSignaled);
|
||||
|
||||
private:
|
||||
bool mShowCommandLog;
|
||||
bool mShowAnnotations;
|
||||
bool mEnableDebugConsole;
|
||||
bool mShowDetailLog;
|
||||
QString mFontName;
|
||||
bool mOnlyShowMono;
|
||||
int mFontSize;
|
||||
|
@ -977,6 +980,7 @@ public:
|
|||
bool mSkipCustomLibraries;
|
||||
bool mAutosaveBreakpoints;
|
||||
bool mAutosaveWatches;
|
||||
bool mOpenCPUInfoWhenSignaled;
|
||||
|
||||
// _Base interface
|
||||
protected:
|
||||
|
|
|
@ -20,13 +20,14 @@ void DebugGeneralWidget::doLoad()
|
|||
ui->chkOnlyMono->setChecked(pSettings->debugger().onlyShowMono());
|
||||
ui->cbFont->setCurrentFont(QFont(pSettings->debugger().fontName()));
|
||||
ui->sbFontSize->setValue(pSettings->debugger().fontSize());
|
||||
ui->chkShowLog->setChecked(pSettings->debugger().showCommandLog());
|
||||
ui->chkShowFullAnnotation->setChecked(pSettings->debugger().showAnnotations());
|
||||
ui->grpEnableDebugConsole->setChecked(pSettings->debugger().enableDebugConsole());
|
||||
ui->chkShowDetailLog->setChecked(pSettings->debugger().showDetailLog());
|
||||
if (pSettings->debugger().useIntelStyle()) {
|
||||
ui->rbIntel->setChecked(true);
|
||||
} else {
|
||||
ui->rbATT->setChecked(true);
|
||||
}
|
||||
ui->chkShowCPUWhenSignaled->setChecked(pSettings->debugger().openCPUInfoWhenSignaled());
|
||||
ui->chkBlendMode->setChecked(pSettings->debugger().blendMode());
|
||||
ui->chkSkipSystemLib->setChecked(pSettings->debugger().skipSystemLibraries());
|
||||
ui->chkSkipProjectLib->setChecked(pSettings->debugger().skipProjectLibraries());
|
||||
|
@ -40,8 +41,9 @@ void DebugGeneralWidget::doSave()
|
|||
pSettings->debugger().setOnlyShowMono(ui->chkOnlyMono->isChecked());
|
||||
pSettings->debugger().setFontName(ui->cbFont->currentFont().family());
|
||||
pSettings->debugger().setFontSize(ui->sbFontSize->value());
|
||||
pSettings->debugger().setShowCommandLog(ui->chkShowLog->isChecked());
|
||||
pSettings->debugger().setShowAnnotations(ui->chkShowFullAnnotation->isChecked());
|
||||
pSettings->debugger().setEnableDebugConsole(ui->grpEnableDebugConsole->isChecked());
|
||||
pSettings->debugger().setShowDetailLog(ui->chkShowDetailLog->isChecked());
|
||||
pSettings->debugger().setOpenCPUInfoWhenSignaled(ui->chkShowCPUWhenSignaled);
|
||||
pSettings->debugger().setUseIntelStyle(ui->rbIntel->isChecked());
|
||||
pSettings->debugger().setBlendMode(ui->chkBlendMode->isChecked());
|
||||
pSettings->debugger().setSkipSystemLibraries(ui->chkSkipSystemLib->isChecked());
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>677</width>
|
||||
<width>704</width>
|
||||
<height>563</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -36,7 +36,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<widget class="QGroupBox" name="grpEnableDebugConsole">
|
||||
<property name="title">
|
||||
<string>Debug Console</string>
|
||||
</property>
|
||||
|
@ -143,16 +143,9 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkShowLog">
|
||||
<widget class="QCheckBox" name="chkShowDetailLog">
|
||||
<property name="text">
|
||||
<string>Show debug logs in the debug console</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkShowFullAnnotation">
|
||||
<property name="text">
|
||||
<string>Show full gdb annotations</string>
|
||||
<string>Show detail debug logs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -182,6 +175,13 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkShowCPUWhenSignaled">
|
||||
<property name="text">
|
||||
<string>Show CPU Window when signal received</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include "../settings.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
#include <windows.h>
|
||||
|
||||
EnvironmentFileAssociationWidget::EnvironmentFileAssociationWidget(const QString& name, const QString& group, QWidget *parent) :
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -86,7 +86,6 @@ class ThemeManager : public QObject
|
|||
public:
|
||||
explicit ThemeManager(QObject *parent = nullptr);
|
||||
PAppTheme theme(const QString& themeName);
|
||||
signals:
|
||||
};
|
||||
|
||||
#endif // THEMEMANAGER_H
|
||||
|
|
|
@ -64,7 +64,6 @@ public:
|
|||
void parseFile(const QString& filename);
|
||||
bool parsing() const;
|
||||
|
||||
signals:
|
||||
private:
|
||||
TodoThread* mThread;
|
||||
QRecursiveMutex mMutex;
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include <QFileInfo>
|
||||
#include <QProcess>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QSettings>
|
||||
#include <QString>
|
||||
#include <QTextCodec>
|
||||
#include <QtGlobal>
|
||||
|
@ -292,25 +291,25 @@ QString toLocalPath(const QString &filename)
|
|||
return newPath;
|
||||
}
|
||||
|
||||
QStringList TextToLines(const QString &text)
|
||||
QStringList textToLines(const QString &text)
|
||||
{
|
||||
QTextStream stream(&((QString&)text),QIODevice::ReadOnly);
|
||||
return ReadStreamToLines(&stream);
|
||||
return readStreamToLines(&stream);
|
||||
}
|
||||
|
||||
QStringList ReadFileToLines(const QString& fileName, QTextCodec* codec)
|
||||
QStringList readFileToLines(const QString& fileName, QTextCodec* codec)
|
||||
{
|
||||
QFile file(fileName);
|
||||
if (file.open(QFile::ReadOnly)) {
|
||||
QTextStream stream(&file);
|
||||
stream.setCodec(codec);
|
||||
stream.setAutoDetectUnicode(false);
|
||||
return ReadStreamToLines(&stream);
|
||||
return readStreamToLines(&stream);
|
||||
}
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
QStringList ReadStreamToLines(QTextStream *stream)
|
||||
QStringList readStreamToLines(QTextStream *stream)
|
||||
{
|
||||
QStringList list;
|
||||
QString s;
|
||||
|
@ -320,7 +319,7 @@ QStringList ReadStreamToLines(QTextStream *stream)
|
|||
return list;
|
||||
}
|
||||
|
||||
void ReadStreamToLines(QTextStream *stream,
|
||||
void readStreamToLines(QTextStream *stream,
|
||||
LineProcessFunc lineFunc)
|
||||
{
|
||||
QString s;
|
||||
|
@ -329,20 +328,20 @@ void ReadStreamToLines(QTextStream *stream,
|
|||
}
|
||||
}
|
||||
|
||||
void TextToLines(const QString &text, LineProcessFunc lineFunc)
|
||||
void textToLines(const QString &text, LineProcessFunc lineFunc)
|
||||
{
|
||||
QTextStream stream(&((QString&)text),QIODevice::ReadOnly);
|
||||
ReadStreamToLines(&stream,lineFunc);
|
||||
readStreamToLines(&stream,lineFunc);
|
||||
}
|
||||
|
||||
void ReadFileToLines(const QString &fileName, QTextCodec *codec, LineProcessFunc lineFunc)
|
||||
void readFileToLines(const QString &fileName, QTextCodec *codec, LineProcessFunc lineFunc)
|
||||
{
|
||||
QFile file(fileName);
|
||||
if (file.open(QFile::ReadOnly)) {
|
||||
QTextStream stream(&file);
|
||||
stream.setCodec(codec);
|
||||
stream.setAutoDetectUnicode(false);
|
||||
ReadStreamToLines(&stream, lineFunc);
|
||||
readStreamToLines(&stream, lineFunc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -402,7 +401,7 @@ void inflateRect(QRect &rect, int dx, int dy)
|
|||
rect.setBottom(rect.bottom()+dy);
|
||||
}
|
||||
|
||||
QString TrimRight(const QString &s)
|
||||
QString trimRight(const QString &s)
|
||||
{
|
||||
if (s.isEmpty())
|
||||
return s;
|
||||
|
@ -418,7 +417,7 @@ QString TrimRight(const QString &s)
|
|||
}
|
||||
}
|
||||
|
||||
bool StringIsBlank(const QString &s)
|
||||
bool stringIsBlank(const QString &s)
|
||||
{
|
||||
for (QChar ch:s) {
|
||||
if (ch != ' ' && ch != '\t')
|
||||
|
@ -427,7 +426,7 @@ bool StringIsBlank(const QString &s)
|
|||
return true;
|
||||
}
|
||||
|
||||
QString TrimLeft(const QString &s)
|
||||
QString trimLeft(const QString &s)
|
||||
{
|
||||
if (s.isEmpty())
|
||||
return s;
|
||||
|
@ -503,7 +502,7 @@ QString changeFileExt(const QString& filename, QString ext)
|
|||
}
|
||||
}
|
||||
|
||||
QStringList ReadFileToLines(const QString &fileName)
|
||||
QStringList readFileToLines(const QString &fileName)
|
||||
{
|
||||
QFile file(fileName);
|
||||
if (file.size()<=0)
|
||||
|
@ -540,7 +539,7 @@ QStringList ReadFileToLines(const QString &fileName)
|
|||
return result;
|
||||
}
|
||||
|
||||
void StringsToFile(const QStringList &list, const QString &fileName)
|
||||
void stringsToFile(const QStringList &list, const QString &fileName)
|
||||
{
|
||||
QFile file(fileName);
|
||||
if (file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
|
||||
|
@ -749,7 +748,7 @@ QString fromByteArray(const QByteArray &s)
|
|||
return QString::fromLocal8Bit(s);
|
||||
}
|
||||
|
||||
QString LinesToText(const QStringList &lines)
|
||||
QString linesToText(const QStringList &lines)
|
||||
{
|
||||
return lines.join("\n");
|
||||
}
|
||||
|
@ -832,7 +831,7 @@ void executeFile(const QString &fileName, const QString ¶ms, const QString &
|
|||
);
|
||||
}
|
||||
|
||||
void StringToFile(const QString &str, const QString &fileName)
|
||||
void stringToFile(const QString &str, const QString &fileName)
|
||||
{
|
||||
QFile file(fileName);
|
||||
if (file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
|
||||
|
@ -847,7 +846,7 @@ bool removeFile(const QString &filename)
|
|||
return file.remove();
|
||||
}
|
||||
|
||||
QByteArray ReadFileToByteArray(const QString &fileName)
|
||||
QByteArray readFileToByteArray(const QString &fileName)
|
||||
{
|
||||
QFile file(fileName);
|
||||
if (file.open(QFile::ReadOnly)) {
|
||||
|
@ -894,3 +893,40 @@ bool readRegistry(HKEY key,const QByteArray& subKey, const QByteArray& name, QSt
|
|||
delete [] buffer;
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<QByteArray> splitByteArrayToLines(const QByteArray &content)
|
||||
{
|
||||
QList<QByteArray> lines;
|
||||
const char* p =content.constData();
|
||||
const char* end = p+content.length();
|
||||
const char* lineStart = p;
|
||||
QByteArray line;
|
||||
while (p<=end) {
|
||||
char ch=*p;
|
||||
switch(ch) {
|
||||
case '\r':
|
||||
line = QByteArray(lineStart, p-lineStart);
|
||||
lines.append(line);
|
||||
p++;
|
||||
if (*p=='\n')
|
||||
p++;
|
||||
lineStart = p;
|
||||
break;
|
||||
case '\n':
|
||||
line = QByteArray(lineStart, p-lineStart);
|
||||
lines.append(line);
|
||||
p++;
|
||||
lineStart = p;
|
||||
break;
|
||||
default:
|
||||
p++;
|
||||
}
|
||||
}
|
||||
if (lineStart>end) {
|
||||
lines.append("");
|
||||
} else {
|
||||
line = QByteArray(lineStart, end-lineStart+1);
|
||||
lines.append(line);
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
|
|
@ -143,28 +143,30 @@ bool programHasConsole(const QString& filename);
|
|||
QString toLocalPath(const QString& filename);
|
||||
using LineProcessFunc = std::function<void(const QString&)>;
|
||||
|
||||
QStringList ReadStreamToLines(QTextStream* stream);
|
||||
void ReadStreamToLines(QTextStream* stream, LineProcessFunc lineFunc);
|
||||
QStringList readStreamToLines(QTextStream* stream);
|
||||
void readStreamToLines(QTextStream* stream, LineProcessFunc lineFunc);
|
||||
|
||||
QStringList TextToLines(const QString& text);
|
||||
void TextToLines(const QString& text, LineProcessFunc lineFunc);
|
||||
QString LinesToText(const QStringList& lines);
|
||||
QStringList textToLines(const QString& text);
|
||||
void textToLines(const QString& text, LineProcessFunc lineFunc);
|
||||
QString linesToText(const QStringList& lines);
|
||||
|
||||
QList<QByteArray> splitByteArrayToLines(const QByteArray& content);
|
||||
|
||||
QString parseMacros(const QString& s);
|
||||
|
||||
QStringList ReadFileToLines(const QString& fileName, QTextCodec* codec);
|
||||
QStringList ReadFileToLines(const QString& fileName);
|
||||
QByteArray ReadFileToByteArray(const QString& fileName);
|
||||
void ReadFileToLines(const QString& fileName, QTextCodec* codec, LineProcessFunc lineFunc);
|
||||
void StringsToFile(const QStringList& list, const QString& fileName);
|
||||
void StringToFile(const QString& str, const QString& fileName);
|
||||
QStringList readFileToLines(const QString& fileName, QTextCodec* codec);
|
||||
QStringList readFileToLines(const QString& fileName);
|
||||
QByteArray readFileToByteArray(const QString& fileName);
|
||||
void readFileToLines(const QString& fileName, QTextCodec* codec, LineProcessFunc lineFunc);
|
||||
void stringsToFile(const QStringList& list, const QString& fileName);
|
||||
void stringToFile(const QString& str, const QString& fileName);
|
||||
|
||||
void decodeKey(int combinedKey, int& key, Qt::KeyboardModifiers& modifiers);
|
||||
void inflateRect(QRect& rect, int delta);
|
||||
void inflateRect(QRect& rect, int dx, int dy);
|
||||
QString TrimRight(const QString& s);
|
||||
QString TrimLeft(const QString& s);
|
||||
bool StringIsBlank(const QString& s);
|
||||
QString trimRight(const QString& s);
|
||||
QString trimLeft(const QString& s);
|
||||
bool stringIsBlank(const QString& s);
|
||||
int compareFileModifiedTime(const QString& filename1, const QString& filename2);
|
||||
QByteArray getHTTPBody(const QByteArray& content);
|
||||
bool haveGoodContrast(const QColor& c1, const QColor &c2);
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
#define VERSION_H
|
||||
#include <QObject>
|
||||
|
||||
#define DEVCPP_VERSION "beta.0.9.4"
|
||||
#define DEVCPP_VERSION "beta.0.10.2"
|
||||
|
||||
#endif // VERSION_H
|
||||
|
|
|
@ -54,6 +54,9 @@
|
|||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="plainText">
|
||||
<string> This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -57,7 +57,7 @@ void CPUDialog::updateInfo()
|
|||
if (pMainWindow->debugger()->executing()) {
|
||||
// Load the registers..
|
||||
sendSyntaxCommand();
|
||||
pMainWindow->debugger()->sendCommand("info", "registers");
|
||||
pMainWindow->debugger()->sendCommand("-data-list-register-values", "N");
|
||||
if (ui->chkBlendMode->isChecked())
|
||||
pMainWindow->debugger()->sendCommand("disas", "/s");
|
||||
else
|
||||
|
@ -65,14 +65,12 @@ void CPUDialog::updateInfo()
|
|||
}
|
||||
}
|
||||
|
||||
void CPUDialog::setDisassembly(const QStringList &lines)
|
||||
void CPUDialog::setDisassembly(const QString& file, const QString& funcName,const QStringList& lines)
|
||||
{
|
||||
if (lines.size()>0) {
|
||||
ui->txtFunctionName->setText(lines[0]);
|
||||
}
|
||||
ui->txtFunctionName->setText(QString("%1:%2").arg(file, funcName));
|
||||
int activeLine = -1;
|
||||
ui->txtCode->lines()->clear();
|
||||
for (int i=1;i<lines.size();i++) {
|
||||
for (int i=0;i<lines.size();i++) {
|
||||
QString line = lines[i];
|
||||
if (line.startsWith("=>")) {
|
||||
activeLine = i;
|
||||
|
@ -80,16 +78,16 @@ void CPUDialog::setDisassembly(const QStringList &lines)
|
|||
ui->txtCode->lines()->add(line);
|
||||
}
|
||||
if (activeLine!=-1)
|
||||
ui->txtCode->setCaretXY(BufferCoord{1,activeLine});
|
||||
ui->txtCode->setCaretXYCentered(true,BufferCoord{1,activeLine});
|
||||
}
|
||||
|
||||
void CPUDialog::sendSyntaxCommand()
|
||||
{
|
||||
// Set disassembly flavor
|
||||
if (ui->rdIntel->isChecked()) {
|
||||
pMainWindow->debugger()->sendCommand("set disassembly-flavor", "intel");
|
||||
pMainWindow->debugger()->sendCommand("-gdb-set", "disassembly-flavor intel");
|
||||
} else {
|
||||
pMainWindow->debugger()->sendCommand("set disassembly-flavor", "att");
|
||||
pMainWindow->debugger()->sendCommand("-gdb-set", "disassembly-flavor att");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,8 @@ public:
|
|||
explicit CPUDialog(QWidget *parent = nullptr);
|
||||
~CPUDialog();
|
||||
void updateInfo();
|
||||
void setDisassembly(const QStringList& lines);
|
||||
public slots:
|
||||
void setDisassembly(const QString& file, const QString& funcName,const QStringList& lines);
|
||||
signals:
|
||||
void closed();
|
||||
private:
|
||||
|
|
|
@ -37,7 +37,6 @@ public:
|
|||
const QString &functionFullName() const;
|
||||
void setFunctioFullName(const QString &newFunctioFullName);
|
||||
|
||||
signals:
|
||||
private:
|
||||
QStringList splitArgs(QString args);
|
||||
private:
|
||||
|
|
|
@ -43,7 +43,7 @@ QConsole::QConsole(QWidget *parent):
|
|||
mBlinkStatus = 0;
|
||||
//enable input method
|
||||
setAttribute(Qt::WA_InputMethodEnabled);
|
||||
setMouseTracking(false);
|
||||
// setMouseTracking(false);
|
||||
recalcCharExtent();
|
||||
mScrollTimer = new QTimer(this);
|
||||
mScrollTimer->setInterval(100);
|
||||
|
@ -147,7 +147,7 @@ void QConsole::addLine(const QString &line)
|
|||
|
||||
void QConsole::addText(const QString &text)
|
||||
{
|
||||
QStringList lst = TextToLines(text);
|
||||
QStringList lst = textToLines(text);
|
||||
for (const QString& line:lst) {
|
||||
addLine(line);
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ void QConsole::setTopRow(int value)
|
|||
|
||||
int QConsole::maxScrollHeight()
|
||||
{
|
||||
return std::max(mContents.rows()-mRowsInWindow,1);
|
||||
return std::max(mContents.rows()-mRowsInWindow+1,1);
|
||||
}
|
||||
|
||||
void QConsole::updateScrollbars()
|
||||
|
@ -504,7 +504,7 @@ void QConsole::mousePressEvent(QMouseEvent *event)
|
|||
//fKbdHandler.ExecuteMouseDown(Self, Button, Shift, X, Y);
|
||||
|
||||
if (button == Qt::LeftButton) {
|
||||
setMouseTracking(true);
|
||||
// setMouseTracking(true);
|
||||
RowColumn mousePosRC = pixelsToNearestRowColumn(X,Y);
|
||||
LineChar mousePos = mContents.rowColumnToLineChar(mousePosRC);
|
||||
//I couldn't track down why, but sometimes (and definitely not all the time)
|
||||
|
@ -522,7 +522,7 @@ void QConsole::mouseReleaseEvent(QMouseEvent *event)
|
|||
{
|
||||
QAbstractScrollArea::mouseReleaseEvent(event);
|
||||
mScrollTimer->stop();
|
||||
setMouseTracking(false);
|
||||
// setMouseTracking(false);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
#include "signalmessagedialog.h"
|
||||
#include "ui_signalmessagedialog.h"
|
||||
|
||||
SignalMessageDialog::SignalMessageDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::SignalMessageDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
SignalMessageDialog::~SignalMessageDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SignalMessageDialog::setMessage(const QString &message)
|
||||
{
|
||||
ui->lblMessage->setText(message);
|
||||
}
|
||||
|
||||
bool SignalMessageDialog::openCPUInfo()
|
||||
{
|
||||
return ui->chkOpenCPUInfo->isChecked();
|
||||
}
|
||||
|
||||
void SignalMessageDialog::setOpenCPUInfo(bool value)
|
||||
{
|
||||
ui->chkOpenCPUInfo->setChecked(value);
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef SIGNALMESSAGEDIALOG_H
|
||||
#define SIGNALMESSAGEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class SignalMessageDialog;
|
||||
}
|
||||
|
||||
class SignalMessageDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SignalMessageDialog(QWidget *parent = nullptr);
|
||||
~SignalMessageDialog();
|
||||
void setMessage(const QString& message);
|
||||
bool openCPUInfo();
|
||||
void setOpenCPUInfo(bool value);
|
||||
|
||||
private:
|
||||
Ui::SignalMessageDialog *ui;
|
||||
};
|
||||
|
||||
#endif // SIGNALMESSAGEDIALOG_H
|
|
@ -0,0 +1,90 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SignalMessageDialog</class>
|
||||
<widget class="QDialog" name="SignalMessageDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>240</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Signal Received</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblMessage">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkOpenCPUInfo">
|
||||
<property name="text">
|
||||
<string>Open CPU Info Dialog</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>SignalMessageDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>SignalMessageDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Loading…
Reference in New Issue