- fix: Wrong compiler settings if xcode is not installed in mac os.

- enhancement: Name for new files will not be different from files openned.
This commit is contained in:
Roy Qu 2023-08-11 17:09:30 +08:00
parent 12f4b3ee9c
commit 496421e97d
5 changed files with 48 additions and 22 deletions

View File

@ -25,6 +25,7 @@ Red Panda C++ Version 2.24
- change: Remove option "clear all symbols when current editor is hidden".
- fix: When opening multiple files, only the active file should be parsed.
- fix: Wrong compiler settings if xcode is not installed in mac os.
- enhancement: Name for new files will not be different from files openned.
Red Panda C++ Version 2.23

View File

@ -315,24 +315,43 @@ void EditorList::applyColorSchemes(const QString& name)
}
}
bool EditorList::isFileOpened(const QString &name)
bool EditorList::isFileOpened(const QString &fullfilepath) const
{
QFileInfo fileInfo(name);
QFileInfo fileInfo(fullfilepath);
QString filename = fileInfo.absoluteFilePath();
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(name)==0)
if (e->filename().compare(filename)==0 || e->filename().compare(fullfilepath)==0)
return true;
}
for (int i=0;i<mRightPageWidget->count();i++) {
Editor* e = static_cast<Editor*>(mRightPageWidget->widget(i));
if (e->filename().compare(filename)==0 || e->filename().compare(name)==0)
if (e->filename().compare(filename)==0 || e->filename().compare(fullfilepath)==0)
return true;
}
return false;
}
int EditorList::pageCount()
bool EditorList::hasFilename(const QString &filename) const
{
for (int i=0;i<mLeftPageWidget->count();i++) {
Editor* e = static_cast<Editor*>(mLeftPageWidget->widget(i));
QFileInfo fileInfo(e->filename());
QString name = fileInfo.fileName();
if (name.compare(filename, PATH_SENSITIVITY)==0 )
return true;
}
for (int i=0;i<mRightPageWidget->count();i++) {
Editor* e = static_cast<Editor*>(mRightPageWidget->widget(i));
QFileInfo fileInfo(e->filename());
QString name = fileInfo.fileName();
if (name.compare(filename, PATH_SENSITIVITY)==0 )
return true;
}
return false;
}
int EditorList::pageCount() const
{
return mLeftPageWidget->count()+mRightPageWidget->count();
}
@ -416,7 +435,7 @@ void EditorList::forceCloseEditor(Editor *editor)
emit editorClosed();
}
Editor* EditorList::getOpenedEditorByFilename(QString filename)
Editor* EditorList::getOpenedEditorByFilename(QString filename) const
{
if (filename.isEmpty())
return nullptr;
@ -439,7 +458,7 @@ Editor* EditorList::getOpenedEditorByFilename(QString filename)
return nullptr;
}
bool EditorList::getContentFromOpenedEditor(const QString &filename, QStringList &buffer)
bool EditorList::getContentFromOpenedEditor(const QString &filename, QStringList &buffer) const
{
if (pMainWindow->isQuitting())
return false;
@ -450,7 +469,7 @@ bool EditorList::getContentFromOpenedEditor(const QString &filename, QStringList
return true;
}
void EditorList::getVisibleEditors(Editor *&left, Editor *&right)
void EditorList::getVisibleEditors(Editor *&left, Editor *&right) const
{
switch(mLayout) {
case LayoutShowType::lstLeft:

View File

@ -60,19 +60,20 @@ public:
void forceCloseEditor(Editor* editor);
Editor* getOpenedEditorByFilename(QString filename);
Editor* getOpenedEditorByFilename(QString filename) const;
bool getContentFromOpenedEditor(const QString& filename, QStringList& buffer);
bool getContentFromOpenedEditor(const QString& filename, QStringList& buffer) const;
void getVisibleEditors(Editor*& left, Editor*& right);
void getVisibleEditors(Editor*& left, Editor*& right) const;
void updateLayout();
void beginUpdate();
void endUpdate();
void applySettings();
void applyColorSchemes(const QString& name);
bool isFileOpened(const QString& name);
int pageCount();
bool isFileOpened(const QString& fullfilepath) const;
bool hasFilename(const QString& filename) const;
int pageCount() const;
void selectNextPage();
void selectPreviousPage();

View File

@ -3362,14 +3362,19 @@ void MainWindow::updateTools()
void MainWindow::newEditor(const QString& suffix)
{
try {
QString filename=QString("untitled%1").arg(getNewFileNumber());
if (suffix.isEmpty()) {
if (pSettings->editor().defaultFileCpp())
filename+=".cpp";
else
filename+=".c";
} else
filename+= "." + suffix;
QString filename;
do {
filename = QString("untitled%1").arg(getNewFileNumber());
if (suffix.isEmpty()) {
if (pSettings->editor().defaultFileCpp())
filename+=".cpp";
else
filename+=".c";
} else
filename+= "." + suffix;
} while(mEditorList->hasFilename(filename));
Editor * editor=mEditorList->newEditor(filename,
pSettings->editor().defaultEncoding(),
nullptr,true);

View File

@ -4385,7 +4385,7 @@ void Settings::CodeCompletion::doLoad()
mHideSymbolsStartsWithUnderLine = boolValue("hide_symbols_start_with_underline", false);
bool shouldShare= true;
bool doClear = false;
// bool doClear = false;
//#ifdef Q_OS_WIN
// MEMORYSTATUSEX statex;