- fix: file path seperator used in the app is not unified, and cause errors somtimes.
This commit is contained in:
parent
d7cbd855ff
commit
c3be38b9b6
1
NEWS.md
1
NEWS.md
|
@ -2,6 +2,7 @@ Version 0.7.2
|
|||
- fix: rainbow parenthesis stop functioning when change editor's general options
|
||||
- fix: issue count not correctly displayed when syntax check/compile finished
|
||||
- fix: function declaration's parameters not correctly parsed, if it have a definition which have different parameter names
|
||||
- fix: file path seperator used in the app is not unified, and cause errors somtimes.
|
||||
|
||||
Version 0.7.1
|
||||
- fix: can't add bookmark at a breakpoint line
|
||||
|
|
|
@ -1860,7 +1860,7 @@ void BreakpointModel::load(const QString &filename)
|
|||
QJsonValue value = array[i];
|
||||
QJsonObject obj=value.toObject();
|
||||
PBreakpoint breakpoint = std::make_shared<Breakpoint>();
|
||||
breakpoint->filename = obj["filename"].toString();
|
||||
breakpoint->filename = QFileInfo(obj["filename"].toString()).absoluteFilePath();
|
||||
breakpoint->line = obj["line"].toInt();
|
||||
breakpoint->condition = obj["condition"].toString();
|
||||
breakpoint->enabled = obj["enabled"].toBool();
|
||||
|
|
|
@ -61,7 +61,7 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
|||
QTabWidget* parentPageControl):
|
||||
SynEdit(parent),
|
||||
mEncodingOption(encoding),
|
||||
mFilename(filename),
|
||||
mFilename(QFileInfo(filename).absoluteFilePath()),
|
||||
mParentPageControl(parentPageControl),
|
||||
mInProject(inProject),
|
||||
mIsNew(isNew),
|
||||
|
@ -77,7 +77,6 @@ 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());
|
||||
|
@ -173,10 +172,11 @@ Editor::~Editor() {
|
|||
this->setParent(nullptr);
|
||||
}
|
||||
|
||||
void Editor::loadFile(const QString& filename) {
|
||||
void Editor::loadFile(QString filename) {
|
||||
if (filename.isEmpty()) {
|
||||
this->lines()->loadFromFile(mFilename,mEncodingOption,mFileEncoding);
|
||||
} else {
|
||||
filename = QFileInfo(filename).absoluteFilePath();
|
||||
this->lines()->loadFromFile(filename,mEncodingOption,mFileEncoding);
|
||||
}
|
||||
//this->setModified(false);
|
||||
|
@ -202,7 +202,7 @@ void Editor::loadFile(const QString& filename) {
|
|||
mLastIdCharPressed = 0;
|
||||
}
|
||||
|
||||
void Editor::saveFile(const QString &filename) {
|
||||
void Editor::saveFile(QString filename) {
|
||||
QFile file(filename);
|
||||
this->lines()->saveToFile(file,mEncodingOption,mFileEncoding);
|
||||
pMainWindow->updateForEncodingInfo();
|
||||
|
|
|
@ -116,8 +116,8 @@ public:
|
|||
bool inProject() const noexcept;
|
||||
bool isNew() const noexcept;
|
||||
|
||||
void loadFile(const QString& filename = "");
|
||||
void saveFile(const QString& filename);
|
||||
void loadFile(QString filename = "");
|
||||
void saveFile(QString filename);
|
||||
void convertToEncoding(const QByteArray& encoding);
|
||||
bool save(bool force=false, bool reparse=true);
|
||||
bool saveAs(const QString& name="", bool fromProject = false);
|
||||
|
|
|
@ -304,10 +304,8 @@ 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, PATH_SENSITIVITY)==0 ||
|
||||
|
@ -328,7 +326,6 @@ 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)
|
||||
|
@ -338,7 +335,6 @@ Editor *EditorList::getEditorByFilename(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;
|
||||
|
|
|
@ -541,10 +541,7 @@ void MainWindow::removeActiveBreakpoints()
|
|||
void MainWindow::setActiveBreakpoint(QString FileName, int Line, bool setFocus)
|
||||
{
|
||||
removeActiveBreakpoints();
|
||||
|
||||
|
||||
// Then active the current line in the current file
|
||||
FileName.replace('/',QDir::separator());
|
||||
Editor *e = mEditorList->getEditorByFilename(FileName);
|
||||
if (e!=nullptr) {
|
||||
e->setActiveBreakpointFocus(Line,setFocus);
|
||||
|
@ -1616,6 +1613,7 @@ void MainWindow::loadLastOpens()
|
|||
QString editorFilename = QString::fromLocal8Bit(lastOpenIni.GetValue(sectionName,"FileName",""));
|
||||
if (!fileExists(editorFilename))
|
||||
continue;
|
||||
editorFilename = QFileInfo(editorFilename).absoluteFilePath();
|
||||
bool onLeft = lastOpenIni.GetBoolValue(sectionName,"OnLeft",true);
|
||||
QTabWidget* page;
|
||||
if (onLeft)
|
||||
|
|
|
@ -3003,10 +3003,20 @@ void Settings::History::doSave()
|
|||
saveValue("opened_projects", mOpenedProjects);
|
||||
}
|
||||
|
||||
static QStringList filterValidPathes(const QStringList& files) {
|
||||
QStringList lst;
|
||||
foreach (const QString& filePath, files) {
|
||||
if (fileExists(filePath)) {
|
||||
lst.append(QFileInfo(filePath).absoluteFilePath());
|
||||
}
|
||||
}
|
||||
return lst;
|
||||
}
|
||||
|
||||
void Settings::History::doLoad()
|
||||
{
|
||||
mOpenedFiles = stringListValue("opened_files");
|
||||
mOpenedProjects =stringListValue("opened_projects");
|
||||
mOpenedFiles = filterValidPathes(stringListValue("opened_files"));
|
||||
mOpenedProjects = filterValidPathes(stringListValue("opened_projects"));
|
||||
}
|
||||
|
||||
Settings::CodeCompletion::CodeCompletion(Settings *settings):_Base(settings, SETTING_CODE_COMPLETION)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <QStringList>
|
||||
|
||||
#define DEVCPP_VERSION "0.7.0"
|
||||
#define DEVCPP_VERSION "0.7.2"
|
||||
|
||||
#define APP_SETTSINGS_FILENAME "redpandacpp.ini"
|
||||
#ifdef Q_OS_WIN
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "../systemconsts.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
|
@ -142,7 +143,7 @@ void BookmarkModel::load(const QString& filename)
|
|||
for (int i=0;i<array.count();i++) {
|
||||
QJsonValue value = array[i];
|
||||
QJsonObject obj=value.toObject();
|
||||
addBookmark(obj["filename"].toString(),
|
||||
addBookmark( QFileInfo(obj["filename"].toString()).absoluteFilePath(),
|
||||
obj["line"].toInt(),
|
||||
obj["description"].toString());
|
||||
|
||||
|
|
Loading…
Reference in New Issue