- fix: project's icon setting is not correctly saved
- fix: project's type setting won't be saved - fix: If project's compiler set is not the same with the default compiler set, auto openned project's file will use wrong compiler set to do syntax check. - fix: open a project file through "File"->"Open" will not correctly connect it with the project internally
This commit is contained in:
parent
bab728e792
commit
0875d15d67
4
NEWS.md
4
NEWS.md
|
@ -17,6 +17,10 @@ Red Panda C++ Version 0.13.2
|
||||||
- fix: caret dispears when at '\t' under Windows 7
|
- fix: caret dispears when at '\t' under Windows 7
|
||||||
- enhancement: ctrl+up/down scrolls in the editor
|
- enhancement: ctrl+up/down scrolls in the editor
|
||||||
- enhancement: add "wrap around" option to find/replace
|
- enhancement: add "wrap around" option to find/replace
|
||||||
|
- fix: project's icon setting is not correctly saved
|
||||||
|
- fix: project's type setting won't be saved
|
||||||
|
- fix: If project's compiler set is not the same with the default compiler set, auto openned project's file will use wrong compiler set to do syntax check.
|
||||||
|
- fix: open a project file through "File"->"Open" will not correctly connect it with the project internally
|
||||||
|
|
||||||
Red Panda C++ Version 0.13.1
|
Red Panda C++ Version 0.13.1
|
||||||
- enhancement: suppoort localization info in project templates
|
- enhancement: suppoort localization info in project templates
|
||||||
|
|
|
@ -975,8 +975,9 @@ void MainWindow::openFile(const QString &filename, QTabWidget* page)
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
pSettings->history().removeFile(filename);
|
pSettings->history().removeFile(filename);
|
||||||
|
bool inProject = (mProject && mProject->isProjectUnit(filename));
|
||||||
editor = mEditorList->newEditor(filename,ENCODING_AUTO_DETECT,
|
editor = mEditorList->newEditor(filename,ENCODING_AUTO_DETECT,
|
||||||
false, false, page);
|
inProject, false, page);
|
||||||
editor->activate();
|
editor->activate();
|
||||||
this->updateForEncodingInfo();
|
this->updateForEncodingInfo();
|
||||||
} catch (FileError e) {
|
} catch (FileError e) {
|
||||||
|
@ -984,7 +985,7 @@ void MainWindow::openFile(const QString &filename, QTabWidget* page)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::openProject(const QString &filename)
|
void MainWindow::openProject(const QString &filename, bool openFiles)
|
||||||
{
|
{
|
||||||
if (!fileExists(filename)) {
|
if (!fileExists(filename)) {
|
||||||
return;
|
return;
|
||||||
|
@ -1029,13 +1030,12 @@ void MainWindow::openProject(const QString &filename)
|
||||||
// if not devData.ShowLeftPages then
|
// if not devData.ShowLeftPages then
|
||||||
// actProjectManager.Execute;
|
// actProjectManager.Execute;
|
||||||
//checkForDllProfiling();
|
//checkForDllProfiling();
|
||||||
updateAppTitle();
|
|
||||||
updateCompilerSet();
|
|
||||||
|
|
||||||
//parse the project
|
//parse the project
|
||||||
// UpdateClassBrowsing;
|
// UpdateClassBrowsing;
|
||||||
scanActiveProject(true);
|
scanActiveProject(true);
|
||||||
mProject->doAutoOpen();
|
if (openFiles)
|
||||||
|
mProject->doAutoOpen();
|
||||||
|
|
||||||
//update editor's inproject flag
|
//update editor's inproject flag
|
||||||
for (int i=0;i<mProject->units().count();i++) {
|
for (int i=0;i<mProject->units().count();i++) {
|
||||||
|
@ -1054,6 +1054,8 @@ void MainWindow::openProject(const QString &filename)
|
||||||
if (e) {
|
if (e) {
|
||||||
checkSyntaxInBack(e);
|
checkSyntaxInBack(e);
|
||||||
}
|
}
|
||||||
|
updateAppTitle();
|
||||||
|
updateCompilerSet();
|
||||||
updateClassBrowserForEditor(e);
|
updateClassBrowserForEditor(e);
|
||||||
}
|
}
|
||||||
updateForEncodingInfo();
|
updateForEncodingInfo();
|
||||||
|
@ -1985,8 +1987,12 @@ void MainWindow::loadLastOpens()
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Editor * focusedEditor = nullptr;
|
QString projectFilename = QString::fromLocal8Bit((lastOpenIni.GetValue("LastOpens", "Project","")));
|
||||||
int count = lastOpenIni.GetLongValue("LastOpens","Count",0);
|
int count = lastOpenIni.GetLongValue("LastOpens","Count",0);
|
||||||
|
if (fileExists(projectFilename)) {
|
||||||
|
openProject(projectFilename, false);
|
||||||
|
}
|
||||||
|
Editor * focusedEditor = nullptr;
|
||||||
for (int i=0;i<count;i++) {
|
for (int i=0;i<count;i++) {
|
||||||
QByteArray sectionName = QString("Editor_%1").arg(i).toLocal8Bit();
|
QByteArray sectionName = QString("Editor_%1").arg(i).toLocal8Bit();
|
||||||
QString editorFilename = QString::fromLocal8Bit(lastOpenIni.GetValue(sectionName,"FileName",""));
|
QString editorFilename = QString::fromLocal8Bit(lastOpenIni.GetValue(sectionName,"FileName",""));
|
||||||
|
@ -1999,7 +2005,8 @@ void MainWindow::loadLastOpens()
|
||||||
page = mEditorList->leftPageWidget();
|
page = mEditorList->leftPageWidget();
|
||||||
else
|
else
|
||||||
page = mEditorList->rightPageWidget();
|
page = mEditorList->rightPageWidget();
|
||||||
Editor * editor = mEditorList->newEditor(editorFilename,ENCODING_AUTO_DETECT,false,false,page);
|
bool inProject = (mProject && mProject->isProjectUnit(editorFilename));
|
||||||
|
Editor * editor = mEditorList->newEditor(editorFilename,ENCODING_AUTO_DETECT,inProject,false,page);
|
||||||
if (!editor)
|
if (!editor)
|
||||||
continue;
|
continue;
|
||||||
BufferCoord pos;
|
BufferCoord pos;
|
||||||
|
@ -2016,10 +2023,7 @@ void MainWindow::loadLastOpens()
|
||||||
focusedEditor = editor;
|
focusedEditor = editor;
|
||||||
pSettings->history().removeFile(editorFilename);
|
pSettings->history().removeFile(editorFilename);
|
||||||
}
|
}
|
||||||
QString projectFilename = QString::fromLocal8Bit((lastOpenIni.GetValue("LastOpens", "Project","")));
|
if (count>0) {
|
||||||
if (fileExists(projectFilename)) {
|
|
||||||
openProject(projectFilename);
|
|
||||||
} else {
|
|
||||||
updateEditorActions();
|
updateEditorActions();
|
||||||
updateForEncodingInfo();
|
updateForEncodingInfo();
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,7 +177,7 @@ public:
|
||||||
const PBookmarkModel &bookmarkModel() const;
|
const PBookmarkModel &bookmarkModel() const;
|
||||||
|
|
||||||
void openFile(const QString& filename, QTabWidget* page=nullptr);
|
void openFile(const QString& filename, QTabWidget* page=nullptr);
|
||||||
void openProject(const QString& filename);
|
void openProject(const QString& filename, bool openFiles = true);
|
||||||
void changeOptions(const QString& widgetName=QString(), const QString& groupName=QString());
|
void changeOptions(const QString& widgetName=QString(), const QString& groupName=QString());
|
||||||
|
|
||||||
bool openningFiles() const;
|
bool openningFiles() const;
|
||||||
|
|
|
@ -564,6 +564,15 @@ bool Project::saveUnits()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Project::isProjectUnit(const QString &filename)
|
||||||
|
{
|
||||||
|
foreach(const PProjectUnit& unit, mUnits) {
|
||||||
|
if (QString::compare(unit->fileName(),filename, PATH_SENSITIVITY)==0)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void Project::setCompilerOption(const QString &optionString, char value)
|
void Project::setCompilerOption(const QString &optionString, char value)
|
||||||
{
|
{
|
||||||
if (mOptions.compilerSet<0 || mOptions.compilerSet>=pSettings->compilerSets().size()) {
|
if (mOptions.compilerSet<0 || mOptions.compilerSet>=pSettings->compilerSets().size()) {
|
||||||
|
@ -1211,20 +1220,6 @@ void Project::createFolderNodes()
|
||||||
|
|
||||||
void Project::doAutoOpen()
|
void Project::doAutoOpen()
|
||||||
{
|
{
|
||||||
//todo:
|
|
||||||
// case devData.AutoOpen of
|
|
||||||
// 0: begin
|
|
||||||
// for i := 0 to pred(fUnits.Count) do
|
|
||||||
// OpenUnit(i); // Open all
|
|
||||||
// if fUnits.Count > 0 then
|
|
||||||
// fUnits[0].Editor.Activate; // Show first
|
|
||||||
// end;
|
|
||||||
// 1:
|
|
||||||
// if fUnits.Count > 0 then
|
|
||||||
// OpenUnit(0).Activate; // Open and show first
|
|
||||||
// 2:
|
|
||||||
// LoadLayout; // Open previous selection
|
|
||||||
// end;
|
|
||||||
loadLayout();
|
loadLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,6 +184,7 @@ public:
|
||||||
void saveUnitAs(int i, const QString& sFileName, bool syncEditor = true); // save single [UnitX]
|
void saveUnitAs(int i, const QString& sFileName, bool syncEditor = true); // save single [UnitX]
|
||||||
void saveUnitLayout(Editor* e, int index); // save single [UnitX] cursor positions
|
void saveUnitLayout(Editor* e, int index); // save single [UnitX] cursor positions
|
||||||
bool saveUnits();
|
bool saveUnits();
|
||||||
|
bool isProjectUnit(const QString& filename);
|
||||||
void setCompilerOption(const QString& optionString, char value);
|
void setCompilerOption(const QString& optionString, char value);
|
||||||
void sortUnitsByPriority();
|
void sortUnitsByPriority();
|
||||||
void sortUnitsByAlpha();
|
void sortUnitsByAlpha();
|
||||||
|
|
|
@ -42,7 +42,7 @@ ProjectGeneralWidget::~ProjectGeneralWidget()
|
||||||
void ProjectGeneralWidget::refreshIcon()
|
void ProjectGeneralWidget::refreshIcon()
|
||||||
{
|
{
|
||||||
QPixmap icon(mIconPath);
|
QPixmap icon(mIconPath);
|
||||||
ui->lblICon->setPixmap(icon);
|
ui->lbIcon->setPixmap(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectGeneralWidget::doLoad()
|
void ProjectGeneralWidget::doLoad()
|
||||||
|
@ -103,23 +103,25 @@ void ProjectGeneralWidget::doSave()
|
||||||
project->options().useGPP = ui->cbDefaultCpp->isChecked();
|
project->options().useGPP = ui->cbDefaultCpp->isChecked();
|
||||||
project->options().supportXPThemes = ui->cbSupportXPTheme->isChecked();
|
project->options().supportXPThemes = ui->cbSupportXPTheme->isChecked();
|
||||||
if (mIconPath.isEmpty()
|
if (mIconPath.isEmpty()
|
||||||
|| !ui->lblICon->pixmap() || ui->lblICon->pixmap()->isNull()) {
|
|| !ui->lbIcon->pixmap() || ui->lbIcon->pixmap()->isNull()) {
|
||||||
project->options().icon = "";
|
project->options().icon = "";
|
||||||
} else {
|
} else {
|
||||||
QString iconPath = changeFileExt(project->filename(),"ico");
|
QString iconPath = changeFileExt(project->filename(),"ico");
|
||||||
if (QFile(iconPath).exists()) {
|
if (iconPath!=mIconPath) {
|
||||||
if (!QFile::remove(iconPath)) {
|
if (QFile(iconPath).exists()) {
|
||||||
QMessageBox::critical(this,
|
if (!QFile::remove(iconPath)) {
|
||||||
tr("Can't remove old icon file"),
|
QMessageBox::critical(this,
|
||||||
tr("Can't remove old icon file '%1'")
|
tr("Can't remove old icon file"),
|
||||||
.arg(iconPath),
|
tr("Can't remove old icon file '%1'")
|
||||||
QMessageBox::Ok);
|
.arg(iconPath),
|
||||||
|
QMessageBox::Ok);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
QFile::copy(mIconPath, iconPath);
|
||||||
|
project->options().icon = iconPath;
|
||||||
|
mIconPath = iconPath;
|
||||||
|
refreshIcon();
|
||||||
}
|
}
|
||||||
QFile::copy(mIconPath, iconPath);
|
|
||||||
project->options().icon = iconPath;
|
|
||||||
mIconPath = iconPath;
|
|
||||||
refreshIcon();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
project->saveOptions();
|
project->saveOptions();
|
||||||
|
@ -130,7 +132,7 @@ void ProjectGeneralWidget::on_btnBrowse_clicked()
|
||||||
QString fileName = QFileDialog::getOpenFileName(this,
|
QString fileName = QFileDialog::getOpenFileName(this,
|
||||||
tr("Select icon file"),
|
tr("Select icon file"),
|
||||||
pSettings->dirs().appDir(),
|
pSettings->dirs().appDir(),
|
||||||
tr("Icon Files (*.ico)"));
|
tr("Image Files (*.ico *.png *.jpg)"));
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty()) {
|
||||||
mIconPath = fileName;
|
mIconPath = fileName;
|
||||||
QPixmap icon(mIconPath);
|
QPixmap icon(mIconPath);
|
||||||
|
@ -144,7 +146,7 @@ void ProjectGeneralWidget::on_btnBrowse_clicked()
|
||||||
void ProjectGeneralWidget::on_btnRemove_clicked()
|
void ProjectGeneralWidget::on_btnRemove_clicked()
|
||||||
{
|
{
|
||||||
mIconPath = "";
|
mIconPath = "";
|
||||||
ui->lblICon->setPixmap(QPixmap());
|
ui->lbIcon->setPixmap(QPixmap());
|
||||||
ui->btnRemove->setEnabled(!mIconPath.isEmpty());
|
ui->btnRemove->setEnabled(!mIconPath.isEmpty());
|
||||||
setSettingsChanged();
|
setSettingsChanged();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>685</width>
|
<width>687</width>
|
||||||
<height>639</height>
|
<height>639</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -114,7 +114,7 @@
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="lblICon">
|
<widget class="QLabel" name="lbIcon">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>128</width>
|
<width>128</width>
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <QListView>
|
#include <QListView>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
|
#include <QListWidget>
|
||||||
#include <QRadioButton>
|
#include <QRadioButton>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include "../widgets/coloredit.h"
|
#include "../widgets/coloredit.h"
|
||||||
|
@ -121,6 +122,9 @@ void SettingsWidget::connectInputs()
|
||||||
for (QAbstractItemView* p: findChildren<QAbstractItemView*>()) {
|
for (QAbstractItemView* p: findChildren<QAbstractItemView*>()) {
|
||||||
connectAbstractItemView(p);
|
connectAbstractItemView(p);
|
||||||
}
|
}
|
||||||
|
for (QListWidget* p:findChildren<QListWidget*>()) {
|
||||||
|
connect(p, QOverload<int>::of(&QListWidget::currentRowChanged) ,this, &SettingsWidget::setSettingsChanged);
|
||||||
|
}
|
||||||
for (QGroupBox* p: findChildren<QGroupBox*>()) {
|
for (QGroupBox* p: findChildren<QGroupBox*>()) {
|
||||||
connect(p, &QGroupBox::toggled,this, &SettingsWidget::setSettingsChanged);
|
connect(p, &QGroupBox::toggled,this, &SettingsWidget::setSettingsChanged);
|
||||||
}
|
}
|
||||||
|
@ -135,15 +139,32 @@ void SettingsWidget::disconnectInputs()
|
||||||
for (QCheckBox* p:findChildren<QCheckBox*>()) {
|
for (QCheckBox* p:findChildren<QCheckBox*>()) {
|
||||||
disconnect(p, &QCheckBox::stateChanged, this, &SettingsWidget::setSettingsChanged);
|
disconnect(p, &QCheckBox::stateChanged, this, &SettingsWidget::setSettingsChanged);
|
||||||
}
|
}
|
||||||
|
for (QRadioButton* p:findChildren<QRadioButton*>()) {
|
||||||
|
disconnect(p, &QRadioButton::toggled, this, &SettingsWidget::setSettingsChanged);
|
||||||
|
}
|
||||||
for (QPlainTextEdit* p:findChildren<QPlainTextEdit*>()) {
|
for (QPlainTextEdit* p:findChildren<QPlainTextEdit*>()) {
|
||||||
disconnect(p, &QPlainTextEdit::textChanged, this, &SettingsWidget::setSettingsChanged);
|
disconnect(p, &QPlainTextEdit::textChanged, this, &SettingsWidget::setSettingsChanged);
|
||||||
}
|
}
|
||||||
|
for (QSpinBox* p:findChildren<QSpinBox*>()) {
|
||||||
|
disconnect(p, QOverload<int>::of(&QSpinBox::valueChanged), this, &SettingsWidget::setSettingsChanged);
|
||||||
|
}
|
||||||
|
for (ColorEdit* p:findChildren<ColorEdit*>()) {
|
||||||
|
disconnect(p, &ColorEdit::colorChanged, this, &SettingsWidget::setSettingsChanged);
|
||||||
|
}
|
||||||
|
|
||||||
for (QComboBox* p: findChildren<QComboBox*>()) {
|
for (QComboBox* p: findChildren<QComboBox*>()) {
|
||||||
disconnect(p, QOverload<int>::of(&QComboBox::currentIndexChanged) ,this, &SettingsWidget::setSettingsChanged);
|
disconnect(p, QOverload<int>::of(&QComboBox::currentIndexChanged) ,this, &SettingsWidget::setSettingsChanged);
|
||||||
}
|
}
|
||||||
for (QAbstractItemView* p: findChildren<QAbstractItemView*>()) {
|
for (QAbstractItemView* p: findChildren<QAbstractItemView*>()) {
|
||||||
disconnectAbstractItemView(p);
|
disconnectAbstractItemView(p);
|
||||||
}
|
}
|
||||||
|
for (QListWidget* p:findChildren<QListWidget*>()) {
|
||||||
|
disconnect(p, QOverload<int>::of(&QListWidget::currentRowChanged) ,this, &SettingsWidget::setSettingsChanged);
|
||||||
|
}
|
||||||
|
for (QGroupBox* p: findChildren<QGroupBox*>()) {
|
||||||
|
disconnect(p, &QGroupBox::toggled,this, &SettingsWidget::setSettingsChanged);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &SettingsWidget::group()
|
const QString &SettingsWidget::group()
|
||||||
|
|
Loading…
Reference in New Issue