- fix: "ok" button should be disabled when no template selected in new project dialog
- enhancement: auto add parentheis when complete function like MARCOs
This commit is contained in:
parent
021880b746
commit
d45c0b87b3
2
NEWS.md
2
NEWS.md
|
@ -23,6 +23,8 @@ Red Panda C++ Version 1.0.0
|
||||||
- fix: error when insert text in column mode
|
- fix: error when insert text in column mode
|
||||||
- fix: error when delete contents in column mode on lines that has wide-chars
|
- fix: error when delete contents in column mode on lines that has wide-chars
|
||||||
- fix: error when create folder in files view
|
- fix: error when create folder in files view
|
||||||
|
- fix: "ok" button should be disabled when no template selected in new project dialog
|
||||||
|
- enhancement: auto add parentheis when complete function like MARCOs
|
||||||
|
|
||||||
Red Panda C++ Version 0.14.5
|
Red Panda C++ Version 0.14.5
|
||||||
- fix: the "gnu c++ 20" option in compiler set options is wrong
|
- fix: the "gnu c++ 20" option in compiler set options is wrong
|
||||||
|
|
|
@ -430,6 +430,7 @@ RESOURCES += \
|
||||||
codes.qrc \
|
codes.qrc \
|
||||||
defaultconfigs.qrc \
|
defaultconfigs.qrc \
|
||||||
icons.qrc \
|
icons.qrc \
|
||||||
|
projecttemplates.qrc \
|
||||||
translations.qrc
|
translations.qrc
|
||||||
|
|
||||||
RC_ICONS = images/devcpp.ico images/associations/c.ico images/associations/cpp.ico images/associations/dev.ico images/associations/c.ico images/associations/cpp.ico images/associations/h.ico images/associations/hpp.ico
|
RC_ICONS = images/devcpp.ico images/associations/c.ico images/associations/cpp.ico images/associations/dev.ico images/associations/c.ico images/associations/cpp.ico images/associations/h.ico images/associations/hpp.ico
|
||||||
|
|
|
@ -319,7 +319,8 @@ bool Editor::saveAs(const QString &name, bool fromProject){
|
||||||
if (mInProject && pMainWindow->project() && !fromProject) {
|
if (mInProject && pMainWindow->project() && !fromProject) {
|
||||||
int unitIndex = pMainWindow->project()->indexInUnits(mFilename);
|
int unitIndex = pMainWindow->project()->indexInUnits(mFilename);
|
||||||
if (unitIndex>=0) {
|
if (unitIndex>=0) {
|
||||||
pMainWindow->project()->saveUnitAs(unitIndex,newName,false);
|
pMainWindow->project()->units()[unitIndex]->setEditor(nullptr);
|
||||||
|
mInProject = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,6 +339,9 @@ bool Editor::saveAs(const QString &name, bool fromProject){
|
||||||
exception.reason());
|
exception.reason());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (pMainWindow->project() && !fromProject) {
|
||||||
|
pMainWindow->project()->associateEditor(this);
|
||||||
|
}
|
||||||
pMainWindow->fileSystemWatcher()->addPath(mFilename);
|
pMainWindow->fileSystemWatcher()->addPath(mFilename);
|
||||||
switch(getFileType(mFilename)) {
|
switch(getFileType(mFilename)) {
|
||||||
case FileType::CppSource:
|
case FileType::CppSource:
|
||||||
|
@ -3020,7 +3024,10 @@ void Editor::completionInsert(bool appendFunc)
|
||||||
if (appendFunc) {
|
if (appendFunc) {
|
||||||
if (statement->kind == StatementKind::skFunction
|
if (statement->kind == StatementKind::skFunction
|
||||||
|| statement->kind == StatementKind::skConstructor
|
|| statement->kind == StatementKind::skConstructor
|
||||||
|| statement->kind == StatementKind::skDestructor) {
|
|| statement->kind == StatementKind::skDestructor
|
||||||
|
||
|
||||||
|
(statement->kind == StatementKind::skPreprocessor
|
||||||
|
&& !statement->args.isEmpty())) {
|
||||||
if ((p.Char >= lineText().length()) // it's the last char on line
|
if ((p.Char >= lineText().length()) // it's the last char on line
|
||||||
|| (lineText().at(p.Char-1) != '(')) { // it don't have '(' after it
|
|| (lineText().at(p.Char-1) != '(')) { // it don't have '(' after it
|
||||||
if (statement->fullName!="std::endl")
|
if (statement->fullName!="std::endl")
|
||||||
|
|
|
@ -696,7 +696,7 @@ bool Project::assignTemplate(const std::shared_ptr<ProjectTemplate> aTemplate, b
|
||||||
|
|
||||||
// Copy icon to project directory
|
// Copy icon to project directory
|
||||||
if (!mOptions.icon.isEmpty()) {
|
if (!mOptions.icon.isEmpty()) {
|
||||||
QString originIcon = QDir(pSettings->dirs().templateDir()).absoluteFilePath(mOptions.icon);
|
QString originIcon = QFileInfo(aTemplate->fileName()).absoluteDir().absoluteFilePath(mOptions.icon);
|
||||||
if (fileExists(originIcon)) {
|
if (fileExists(originIcon)) {
|
||||||
QString destIcon = changeFileExt(mFilename,ICON_EXT);
|
QString destIcon = changeFileExt(mFilename,ICON_EXT);
|
||||||
QFile::copy(originIcon,destIcon);
|
QFile::copy(originIcon,destIcon);
|
||||||
|
|
|
@ -81,10 +81,12 @@ void ProjectTemplate::readTemplateFile(const QString &fileName)
|
||||||
{
|
{
|
||||||
if (mIni)
|
if (mIni)
|
||||||
mIni=nullptr;
|
mIni=nullptr;
|
||||||
if (QFile(fileName).exists()) {
|
QFile file(fileName);
|
||||||
|
if (file.open(QFile::ReadOnly)) {
|
||||||
mFileName = fileName;
|
mFileName = fileName;
|
||||||
mIni = std::make_shared<SimpleIni>();
|
mIni = std::make_shared<SimpleIni>();
|
||||||
if (mIni->LoadFile(mFileName.toLocal8Bit()) != SI_OK) {
|
QByteArray data = file.readAll();
|
||||||
|
if (mIni->LoadData(data.toStdString()) != SI_OK) {
|
||||||
QMessageBox::critical(pMainWindow,
|
QMessageBox::critical(pMainWindow,
|
||||||
tr("Read failed."),
|
tr("Read failed."),
|
||||||
tr("Can't read template file '%1'.").arg(fileName),
|
tr("Can't read template file '%1'.").arg(fileName),
|
||||||
|
@ -93,8 +95,8 @@ void ProjectTemplate::readTemplateFile(const QString &fileName)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::critical(pMainWindow,
|
QMessageBox::critical(pMainWindow,
|
||||||
tr("Template not exist"),
|
tr("Can't Open Template"),
|
||||||
tr("Template file '%1' doesn't exist.").arg(fileName),
|
tr("Can't open template file '%1' for read.").arg(fileName),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<RCC>
|
||||||
|
<qresource prefix="/templates">
|
||||||
|
<file alias="empty.template">resources/templates/empty.template</file>
|
||||||
|
<file alias="empty.ico">resources/templates/empty.ico</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
@ -2,15 +2,15 @@
|
||||||
ver=2
|
ver=2
|
||||||
Name=Empty Project
|
Name=Empty Project
|
||||||
Name[zh_CN]=空项目
|
Name[zh_CN]=空项目
|
||||||
Icon=Empty.ico
|
Icon=empty.ico
|
||||||
Description=An empty project
|
Description=An empty project
|
||||||
Description[zh_CN]=一个空项目
|
Description[zh_CN]=一个空项目
|
||||||
Category=Basic
|
Category=Basic
|
||||||
Category[zh_CN]=基础
|
Category[zh_CN]=基础
|
||||||
|
|
||||||
[Unit0]
|
[Unit0]
|
||||||
CName=
|
CName=main.c
|
||||||
CppName=
|
CppName=main.cpp
|
||||||
|
|
||||||
[Project]
|
[Project]
|
||||||
UnitCount=1
|
UnitCount=1
|
|
@ -60,6 +60,7 @@ NewProjectDialog::NewProjectDialog(QWidget *parent) :
|
||||||
&QLineEdit::textChanged,
|
&QLineEdit::textChanged,
|
||||||
this,
|
this,
|
||||||
&NewProjectDialog::updateProjectLocation);
|
&NewProjectDialog::updateProjectLocation);
|
||||||
|
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
NewProjectDialog::~NewProjectDialog()
|
NewProjectDialog::~NewProjectDialog()
|
||||||
|
@ -117,6 +118,7 @@ void NewProjectDialog::addTemplate(const QString &filename)
|
||||||
|
|
||||||
void NewProjectDialog::readTemplateDir()
|
void NewProjectDialog::readTemplateDir()
|
||||||
{
|
{
|
||||||
|
addTemplate(":/templates/empty.template");
|
||||||
QString templateExt(".");
|
QString templateExt(".");
|
||||||
templateExt += TEMPLATE_EXT;
|
templateExt += TEMPLATE_EXT;
|
||||||
QDir dir(pSettings->dirs().templateDir());
|
QDir dir(pSettings->dirs().templateDir());
|
||||||
|
@ -165,7 +167,7 @@ void NewProjectDialog::updateView()
|
||||||
QString tabText = mTemplatesTabBar->tabText(index);
|
QString tabText = mTemplatesTabBar->tabText(index);
|
||||||
if (category == tabText) {
|
if (category == tabText) {
|
||||||
QListWidgetItem * item;
|
QListWidgetItem * item;
|
||||||
QString iconFilename = QDir(pSettings->dirs().templateDir()).absoluteFilePath(t->icon());
|
QString iconFilename = QFileInfo(t->fileName()).absoluteDir().absoluteFilePath(t->icon());
|
||||||
QIcon icon=QIcon(iconFilename);
|
QIcon icon=QIcon(iconFilename);
|
||||||
if (icon.isNull()) {
|
if (icon.isNull()) {
|
||||||
//todo : use an default icon
|
//todo : use an default icon
|
||||||
|
@ -257,3 +259,15 @@ void NewProjectDialog::updateIcons()
|
||||||
pIconsManager->setIcon(ui->btnBrowse, IconsManager::ACTION_FILE_OPEN_FOLDER);
|
pIconsManager->setIcon(ui->btnBrowse, IconsManager::ACTION_FILE_OPEN_FOLDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void NewProjectDialog::on_btnOk_clicked()
|
||||||
|
{
|
||||||
|
accept();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void NewProjectDialog::on_btnCancel_clicked()
|
||||||
|
{
|
||||||
|
reject();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,10 @@ private slots:
|
||||||
void on_btnBrowse_clicked();
|
void on_btnBrowse_clicked();
|
||||||
void updateIcons();
|
void updateIcons();
|
||||||
|
|
||||||
|
void on_btnOk_clicked();
|
||||||
|
|
||||||
|
void on_btnCancel_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addTemplate(const QString& filename);
|
void addTemplate(const QString& filename);
|
||||||
void readTemplateDir();
|
void readTemplateDir();
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.2 KiB |
|
@ -1,17 +0,0 @@
|
||||||
[Template]
|
|
||||||
ver=2
|
|
||||||
Name=Empty Project
|
|
||||||
Name[zh_CN]=空项目
|
|
||||||
Icon=empty.ico
|
|
||||||
Description=An empty project
|
|
||||||
Description[zh_CN]=空项目
|
|
||||||
Category=Basic
|
|
||||||
Category[zh_CN]=基础
|
|
||||||
|
|
||||||
[Unit0]
|
|
||||||
CName=
|
|
||||||
CppName=
|
|
||||||
|
|
||||||
[Project]
|
|
||||||
UnitCount=1
|
|
||||||
Type=1
|
|
Loading…
Reference in New Issue