- fix: app's title not update when editor closed
- fix: editor's modified status not correctly updated when using new file template
This commit is contained in:
parent
7a5b6b8efc
commit
9d829876b3
1
NEWS.md
1
NEWS.md
|
@ -12,6 +12,7 @@ Version 0.7.0
|
|||
- enhancement: autosave/load breakpoints
|
||||
- enhancement: autosave/load watches
|
||||
- implement: files view
|
||||
- fix: app's title not update when editor closed
|
||||
|
||||
Version 0.6.8
|
||||
- enhancement: add link to cppreference in the help menu
|
||||
|
|
|
@ -77,6 +77,7 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
|||
mSelectionWord(),
|
||||
mSaving(false)
|
||||
{
|
||||
mFilename.replace("/",QDir::separator());
|
||||
mUseCppSyntax = pSettings->editor().defaultFileCpp();
|
||||
if (mFilename.isEmpty()) {
|
||||
mFilename = tr("untitled")+QString("%1").arg(getNewFileNumber());
|
||||
|
@ -97,9 +98,6 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
|||
else
|
||||
mFileEncoding = mEncodingOption;
|
||||
highlighter=highlighterManager.getCppHighlighter();
|
||||
if (parentPageControl!=nullptr) {
|
||||
insertCodeSnippet(pMainWindow->codeSnippetManager()->newFileTemplate());
|
||||
}
|
||||
}
|
||||
|
||||
if (highlighter) {
|
||||
|
@ -152,8 +150,16 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
|||
connect(this, &QWidget::customContextMenuRequested,
|
||||
pMainWindow, &MainWindow::onEditorContextMenu);
|
||||
|
||||
resetBookmarks();
|
||||
resetBreakpoints();
|
||||
if (isNew && parentPageControl!=nullptr) {
|
||||
QString fileTemplate = pMainWindow->codeSnippetManager()->newFileTemplate();
|
||||
if (!fileTemplate.isEmpty()) {
|
||||
insertCodeSnippet(fileTemplate);
|
||||
}
|
||||
}
|
||||
if (!isNew && parentPageControl!=nullptr) {
|
||||
resetBookmarks();
|
||||
resetBreakpoints();
|
||||
}
|
||||
}
|
||||
|
||||
Editor::~Editor() {
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <QFileInfo>
|
||||
#include "settings.h"
|
||||
#include "project.h"
|
||||
#include "systemconsts.h"
|
||||
|
||||
EditorList::EditorList(QTabWidget* leftPageWidget,
|
||||
QTabWidget* rightPageWidget,
|
||||
|
@ -299,15 +300,18 @@ void EditorList::forceCloseEditor(Editor *editor)
|
|||
endUpdate();
|
||||
}
|
||||
|
||||
Editor* EditorList::getOpenedEditorByFilename(const QString &filename)
|
||||
Editor* EditorList::getOpenedEditorByFilename(QString filename)
|
||||
{
|
||||
if (filename.isEmpty())
|
||||
return nullptr;
|
||||
filename.replace("/",QDir::separator());
|
||||
QFileInfo fileInfo(filename);
|
||||
QString fullname = fileInfo.absoluteFilePath();
|
||||
fullname.replace("/",QDir::separator());
|
||||
for (int i=0;i<mLeftPageWidget->count();i++) {
|
||||
Editor* e = static_cast<Editor*>(mLeftPageWidget->widget(i));
|
||||
if (e->filename().compare(filename)==0 || e->filename().compare(fullname)==0) {
|
||||
if (e->filename().compare(filename, PATH_SENSITIVITY)==0 ||
|
||||
e->filename().compare(fullname, PATH_SENSITIVITY)==0) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
@ -320,10 +324,11 @@ Editor* EditorList::getOpenedEditorByFilename(const QString &filename)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Editor *EditorList::getEditorByFilename(const QString &filename)
|
||||
Editor *EditorList::getEditorByFilename(QString filename)
|
||||
{
|
||||
if (filename.isEmpty())
|
||||
return nullptr;
|
||||
filename.replace("/",QDir::separator());
|
||||
//check if an editor is already openned
|
||||
Editor* e=getOpenedEditorByFilename(filename);
|
||||
if (e!=nullptr)
|
||||
|
@ -333,6 +338,7 @@ Editor *EditorList::getEditorByFilename(const QString &filename)
|
|||
//Create a new editor
|
||||
QFileInfo fileInfo(filename);
|
||||
QString fullname = fileInfo.absoluteFilePath();
|
||||
fullname.replace("/",QDir::separator());
|
||||
if (fileInfo.exists())
|
||||
return newEditor(fullname,ENCODING_AUTO_DETECT,false,false);
|
||||
return nullptr;
|
||||
|
|
|
@ -35,9 +35,9 @@ public:
|
|||
|
||||
void forceCloseEditor(Editor* editor);
|
||||
|
||||
Editor* getOpenedEditorByFilename(const QString& filename);
|
||||
Editor* getOpenedEditorByFilename(QString filename);
|
||||
|
||||
Editor* getEditorByFilename(const QString& filename);
|
||||
Editor* getEditorByFilename(QString filename);
|
||||
|
||||
bool getContentFromOpenedEditor(const QString& filename, QStringList& buffer);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <QStringList>
|
||||
|
||||
#define DEVCPP_VERSION "0.6.9"
|
||||
#define DEVCPP_VERSION "0.7.0"
|
||||
|
||||
#define APP_SETTSINGS_FILENAME "redpandacpp.ini"
|
||||
#ifdef Q_OS_WIN
|
||||
|
|
|
@ -188,7 +188,6 @@ void BookmarkModel::removeBookmarkAt(int i)
|
|||
endRemoveRows();
|
||||
}
|
||||
|
||||
#ifdef QT_DEBUG
|
||||
bool BookmarkModel::isBookmarkExists(const QString &filename, int line)
|
||||
{
|
||||
foreach (const PBookmark& bookmark, mBookmarks) {
|
||||
|
@ -245,4 +244,4 @@ QVariant BookmarkModel::headerData(int section, Qt::Orientation orientation, int
|
|||
}
|
||||
return QVariant();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -33,9 +33,8 @@ public slots:
|
|||
void onFileDeleteLines(const QString& filename, int startLine, int count);
|
||||
void onFileInsertLines(const QString& filename, int startLine, int count);
|
||||
private:
|
||||
#ifdef QT_DEBUG
|
||||
bool isBookmarkExists(const QString&filename, int line);
|
||||
#endif
|
||||
|
||||
private:
|
||||
QList<PBookmark> mBookmarks;
|
||||
|
||||
|
|
Loading…
Reference in New Issue