diff --git a/NEWS.md b/NEWS.md
index d73b17e5..1b7010cc 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -3,6 +3,8 @@ Version 0.9.1 For Dev-C++ 7 Beta
- fix: ide failed to start, if there are errors in the compiler set settings
- fix: numpad's enter key doesn't work
- enhancement: code completion suggestion for phrase after long/short/signed/unsigned
+ - enhancement: save/load default projects folder
+ - enhancement: add editor general options "highlight current word" and "highlight matching braces"
Version 0.9.0 For Dev-C++ 7 Beta
- fix: control keys in the numpad doesn't work in the editor
diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.qm b/RedPandaIDE/RedPandaIDE_zh_CN.qm
index a8bb9e70..5b733830 100644
Binary files a/RedPandaIDE/RedPandaIDE_zh_CN.qm and b/RedPandaIDE/RedPandaIDE_zh_CN.qm differ
diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.ts b/RedPandaIDE/RedPandaIDE_zh_CN.ts
index 0103efed..a500b37c 100644
--- a/RedPandaIDE/RedPandaIDE_zh_CN.ts
+++ b/RedPandaIDE/RedPandaIDE_zh_CN.ts
@@ -1031,10 +1031,10 @@ Are you really want to continue?
-
-
-
-
+
+
+
+
错误
@@ -1048,55 +1048,55 @@ Are you really want to continue?
另存为
-
+
要复制的内容超过了行数限制!
-
+
要复制的内容超过了字符数限制!
-
+
要剪切的内容超过了行数限制!
-
+
要剪切的内容超过了字符数限制!
-
+
打印文档
-
-
-
+
+
+
Ctrl+单击以获取更多信息
-
-
+
+
未找到符号'%1'!
-
+
断点条件
-
+
输入当前断点的生效条件:
-
+
只读
@@ -2861,7 +2861,7 @@ Are you really want to continue?
-
+
编译器
@@ -3072,8 +3072,6 @@ Are you really want to continue?
-
-
编译
@@ -3269,7 +3267,7 @@ Are you really want to continue?
-
+
新建试题集
@@ -3288,14 +3286,14 @@ Are you really want to continue?
-
+
保存试题集
-
+
载入试题集
@@ -3731,7 +3729,7 @@ Are you really want to continue?
-
+
重命名符号
@@ -3752,13 +3750,13 @@ Are you really want to continue?
-
+
导出为RTF
-
+
导出为HTML
@@ -3824,7 +3822,7 @@ Are you really want to continue?
-
+
打开文件夹
@@ -4055,7 +4053,7 @@ Are you really want to continue?
-
+
试题集%1
@@ -4122,15 +4120,15 @@ Are you really want to continue?
-
-
+
+
书签描述
-
-
+
+
描述:
@@ -4294,10 +4292,16 @@ Are you really want to continue?
-
+
需要保存吗?
+
+
+
+
+ 文件已发生变化
+
@@ -4312,7 +4316,7 @@ Are you really want to continue?
-
+
保存失败
@@ -4337,160 +4341,160 @@ Are you really want to continue?
您真的要清除该文件的所有断点吗?
-
+
新建项目
-
+
关闭'%1'以打开新项目?
-
+
文件夹不存在
-
+
文件夹'%1'不存在。是否创建?
-
+
无法创建文件夹
-
+
创建文件夹'%1'失败。
-
+
-
+
小熊猫Dev-C++项目文件 (*.dev)
-
+
新建项目失败
-
+
无法使用模板创建项目
-
+
删除文件
-
+
同时从硬盘上删除文件?
-
+
无标题
-
+
新的项目文件名
-
+
文件名:
-
+
文件已存在!
-
+
文件'%1'已经存在!
-
+
添加到项目
-
+
重命名出错
-
+
符号'%1'在系统头文件中定义,无法修改。
-
+
新名称
-
-
+
+
替换出错
-
+
无法打开文件'%1'进行替换!
-
+
内容和上次查找时不一致。
-
+
RTF格式文件 (*.rtf)
-
+
HTML文件 (*.html)
-
+
当前的试题集不是空的。
-
+
试题%1
-
-
+
+
试题集文件 (*.pbs)
-
+
载入失败
-
+
试题案例%1
@@ -4615,28 +4619,37 @@ Are you really want to continue?
C++语言项目
-
+
项目名称:
-
-
- 文件夹:
+
+
+ 创建在
-
+
+
+ 设为缺省项目位置
+
+
+
+ 文件夹:
+
+
+
...
-
+
项目%1
-
-
+
+
缺省
@@ -5176,24 +5189,24 @@ Are you really want to continue?
ProjectModel
-
+
文件已存在
-
+
文件'%1'已存在。是否删除?
-
-
+
+
删除失败
-
-
+
+
无法删除文件'%1'
@@ -5412,7 +5425,7 @@ Are you really want to continue?
QApplication
-
+
错误
@@ -5482,180 +5495,180 @@ Are you really want to continue?
无法写入配置文件夹"%1"
-
+
无法载入自动链接设置
-
-
-
-
+
+
+
+
下列%1文件夹不存在:
-
-
+
+
二进制
-
+
未指定%1文件夹
-
+
C包含
-
-
+
+
C++包含
-
-
-
-
+
+
+
+
无法找到%1程序"%2"
-
+
C语言选项
-
+
支持所有ANSI标准C程序(-ansi)
-
+
不支持将asm、inline和typeof作为关键字(-fno-asm)
-
+
模仿传统C预处理器行为(-traditional-cpp)
-
+
代码生成
-
+
生成特定机器的专用指令(-march)
-
+
完整兼容特定机器,较少优化(-tune)
-
+
启用特定指令集(-mx)
-
+
优化级别(-Ox)
-
+
使用下列指针大小编译(-mx)
-
+
语言标准(-std)
-
+
性能分析
-
+
生成调试信息(-g3)
-
+
生成性能分析信息(-pg)
-
+
代码警告
-
+
忽略所有警告信息(-w)
-
+
启用常见问题警告(-Wall)
-
+
启用更多问题警告(-Wextra)
-
+
检查ISO C/C++/C++0x语法一致性(-pedantic)
-
+
只进行语法检查(不编译)(-fsyntax-only)
-
+
将警告作为错误处理(-Werror)
-
+
遇到第一个错误后立即中止编译(-Wfatal-errors)
-
+
链接器
-
+
链接Objective-C程序 (-lobjc)
-
+
不使用标准库和系统启动文件(-nostdlib)
-
+
不产生控制台窗口(-mwindows)
-
+
剥除附加信息(-s)
@@ -5664,53 +5677,53 @@ Are you really want to continue?
链接Ojbective C程序(-lobjc)
-
+
输出
-
+
在生成的汇编代码中加入注释(-fverbose-asm)
-
+
编译时使用管道而不是临时文件(-pipe)
-
+
只生成汇编代码(-S)
-
-
+
+
确认
-
+
在验证编译器设置"%1"时遇到了下列问题:
-
+
是否让小熊猫C++删除这些配置,并尝试重新建立配置?
-
+
如果仍然保留这些设置,可能会导致编译错误。<br /><br />请选择“是”,除非您清楚的知道选择“否”的后果,
-
+
未配置编译器设置。
-
+
您需要小熊猫C++在下列位置搜索编译器吗:<br />%1<br />%2
@@ -6503,7 +6516,7 @@ Are you really want to continue?
自动链接
-
+
@@ -6579,7 +6592,7 @@ Are you really want to continue?
杂项
-
+
@@ -7087,51 +7100,66 @@ Are you really want to continue?
+
+ 高亮显示
+
+
+
+
+ 高亮显示与光标处相匹配的括号
+
+
+
+
+ 高亮显示光标所在的单词
+
+
+
滚动条
-
+
自动隐藏滚动条
-
+
可以将每行末尾字符滚动到编辑器最左侧
-
+
可以将最后一行滚动到编辑器最上方
-
+
翻页键只滚动半页
-
+
在滚动页时少滚动一行
-
+
鼠标滚轮卷轴速度(行)
-
+
显示右边缘线
-
+
右边缘宽度
-
+
右边缘颜色
diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp
index 43287c3c..2996326d 100644
--- a/RedPandaIDE/editor.cpp
+++ b/RedPandaIDE/editor.cpp
@@ -920,7 +920,8 @@ void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &to
foreground = mCurrentHighlighWordForeground;
if (mCurrentHighlighWordBackground.isValid())
background = mCurrentHighlighWordBackground;
- } else if (!selAvail() && attr->name() == SYNS_AttrSymbol) {
+ } else if (!selAvail() && attr->name() == SYNS_AttrSymbol
+ && pSettings->editor().highlightMathingBraces()) {
// qDebug()<=0) {
if (mTabStopY==caretY()) {
if (mLineAfterTabStop.isEmpty()) {
@@ -1437,7 +1434,11 @@ void Editor::onStatusChanged(SynStatusChanges changes)
clearUserCodeInTabStops();
}
}
- } else if (!selAvail() && highlighter()){
+ } else if (!selAvail() && highlighter() && pSettings->editor().highlightMathingBraces()){
+ invalidateLine(mHighlightCharPos1.Line);
+ invalidateLine(mHighlightCharPos2.Line);
+ mHighlightCharPos1 = BufferCoord{0,0};
+ mHighlightCharPos2 = BufferCoord{0,0};
// Is there a bracket char before us?
int lineLength = lineText().length();
int ch = caretX() - 2;
@@ -1471,8 +1472,11 @@ void Editor::onStatusChanged(SynStatusChanges changes)
// scSelection includes anything caret related
if (changes.testFlag(SynStatusChange::scSelection)) {
- if (!selAvail()) {
+ if (!selAvail() && pSettings->editor().highlightCurrentWord()) {
mCurrentHighlightedWord = wordAtCursor();
+ } else if (selAvail() && blockBegin() == wordStart()
+ && blockEnd() == wordEnd()){
+ mCurrentHighlightedWord = selText();
} else {
mCurrentHighlightedWord = "";
}
diff --git a/RedPandaIDE/main.cpp b/RedPandaIDE/main.cpp
index c28f41ab..c3709e8a 100644
--- a/RedPandaIDE/main.cpp
+++ b/RedPandaIDE/main.cpp
@@ -80,7 +80,7 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
//Translation must be loaded first
- QTranslator trans;
+ QTranslator trans,transQt;
QString settingFilename = getSettingFilename();
if (!isGreenEdition()) {
QDir::setCurrent(QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation)[0]);
@@ -91,8 +91,13 @@ int main(int argc, char *argv[])
QSettings languageSetting(settingFilename,QSettings::IniFormat);
languageSetting.beginGroup(SETTING_ENVIRONMENT);
QString language = languageSetting.value("language",QLocale::system().name()).toString();
- if (trans.load("RedPandaIDE_"+language,":/translations"))
+
+ if (trans.load("RedPandaIDE_"+language,":/translations")) {
app.installTranslator(&trans);
+ }
+ if (transQt.load("qt_"+language,":/translations")) {
+ app.installTranslator(&transQt);
+ }
}
qRegisterMetaType("PCompileIssue");
diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp
index 0133fb38..1afc24fa 100644
--- a/RedPandaIDE/mainwindow.cpp
+++ b/RedPandaIDE/mainwindow.cpp
@@ -4567,6 +4567,10 @@ void MainWindow::on_actionNew_Project_triggered()
{
NewProjectDialog dialog;
if (dialog.exec() == QDialog::Accepted) {
+ if (dialog.useAsDefaultProjectDir()) {
+ pSettings->dirs().setProjectDir(dialog.getLocation());
+ pSettings->dirs().save();
+ }
// Take care of the currently opened project
QString s;
if (mProject) {
@@ -4587,19 +4591,20 @@ void MainWindow::on_actionNew_Project_triggered()
}
//Create the project folder
- QDir dir(dialog.getLocation());
+ QString location = includeTrailingPathDelimiter(dialog.getLocation())+dialog.getProjectName();
+ QDir dir(location);
if (!dir.exists()) {
if (QMessageBox::question(this,
tr("Folder not exist"),
- tr("Folder '%1' doesn't exist. Create it now?").arg(dialog.getLocation()),
+ tr("Folder '%1' doesn't exist. Create it now?").arg(location),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::Yes) != QMessageBox::Yes) {
return;
}
- if (!dir.mkpath(dialog.getLocation())) {
+ if (!dir.mkpath(location)) {
QMessageBox::critical(this,
tr("Can't create folder"),
- tr("Failed to create folder '%1'.").arg(dialog.getLocation()),
+ tr("Failed to create folder '%1'.").arg(location),
QMessageBox::Yes);
return;
}
@@ -4608,14 +4613,14 @@ void MainWindow::on_actionNew_Project_triggered()
// if cbDefault.Checked then
// devData.DefCpp := rbCpp.Checked;
- s = includeTrailingPathDelimiter(dialog.getLocation())
+ s = includeTrailingPathDelimiter(location)
+ dialog.getProjectName() + "." + DEV_PROJECT_EXT;
if (fileExists(s)) {
QString saveName = QFileDialog::getSaveFileName(
this,
tr("Save new project as"),
- dialog.getLocation(),
+ location,
tr("Red panda Dev-C++ project file (*.dev)"));
if (!saveName.isEmpty()) {
s = saveName;
diff --git a/RedPandaIDE/qsynedit/Types.cpp b/RedPandaIDE/qsynedit/Types.cpp
index 19d93538..e4e985eb 100644
--- a/RedPandaIDE/qsynedit/Types.cpp
+++ b/RedPandaIDE/qsynedit/Types.cpp
@@ -234,3 +234,8 @@ void ContentsCoord::setCh(int newChar)
{
mChar = newChar;
}
+
+bool BufferCoord::operator==(const BufferCoord &coord)
+{
+ return coord.Char == Char && coord.Line == Line;
+}
diff --git a/RedPandaIDE/qsynedit/Types.h b/RedPandaIDE/qsynedit/Types.h
index 09b11c88..ce7fe313 100644
--- a/RedPandaIDE/qsynedit/Types.h
+++ b/RedPandaIDE/qsynedit/Types.h
@@ -10,6 +10,7 @@ enum class SynSelectionMode {smNormal, smLine, smColumn};
struct BufferCoord {
int Char;
int Line;
+ bool operator==(const BufferCoord& coord);
};
class SynEdit;
diff --git a/RedPandaIDE/qt_zh_CN.qm b/RedPandaIDE/qt_zh_CN.qm
new file mode 100644
index 00000000..77ff1441
Binary files /dev/null and b/RedPandaIDE/qt_zh_CN.qm differ
diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp
index e8a2c1c4..ff5522d7 100644
--- a/RedPandaIDE/settings.cpp
+++ b/RedPandaIDE/settings.cpp
@@ -87,6 +87,7 @@ void Settings::load()
mCodeCompletion.load();
mCodeFormatter.load();
mUI.load();
+ mDirs.load();
}
Settings::Dirs &Settings::dirs()
@@ -161,12 +162,7 @@ QString Settings::Dirs::templateDir() const
QString Settings::Dirs::projectDir() const
{
- if (isGreenEdition()) {
- return includeTrailingPathDelimiter(app()) + "projects";
- } else {
- return includeTrailingPathDelimiter(QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation)[0])
- + "projects";
- }
+ return mProjectDir;
}
QString Settings::Dirs::data(Settings::Dirs::DataType dataType) const
@@ -205,12 +201,24 @@ QString Settings::Dirs::executable() const
void Settings::Dirs::doSave()
{
-
+ saveValue("projectDir",mProjectDir);
}
void Settings::Dirs::doLoad()
{
+ QString defaultProjectDir;
+ if (isGreenEdition()) {
+ defaultProjectDir = includeTrailingPathDelimiter(app()) + "projects";
+ } else {
+ defaultProjectDir = includeTrailingPathDelimiter(QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation)[0])
+ + "projects";
+ }
+ mProjectDir = stringValue("projectDir",defaultProjectDir);
+}
+void Settings::Dirs::setProjectDir(const QString &newProjectDir)
+{
+ mProjectDir = newProjectDir;
}
Settings::_Base::_Base(Settings *settings, const QString &groupName):
@@ -524,6 +532,26 @@ void Settings::Editor::setUseUTF8ByDefault(bool newUseUTF8ByDefault)
mUseUTF8ByDefault = newUseUTF8ByDefault;
}
+bool Settings::Editor::highlightMathingBraces() const
+{
+ return mHighlightMathingBraces;
+}
+
+void Settings::Editor::setHighlightMathingBraces(bool newHighlightMathingBraces)
+{
+ mHighlightMathingBraces = newHighlightMathingBraces;
+}
+
+bool Settings::Editor::highlightCurrentWord() const
+{
+ return mHighlightCurrentWord;
+}
+
+void Settings::Editor::setHighlightCurrentWord(bool newHighlightCurrentWord)
+{
+ mHighlightCurrentWord = newHighlightCurrentWord;
+}
+
bool Settings::Editor::enableTooltips() const
{
return mEnableTooltips;
@@ -994,6 +1022,7 @@ void Settings::Editor::doSave()
saveValue("show_indent_lines", mShowIndentLines);
saveValue("indent_line_color",mIndentLineColor);
saveValue("fill_indents",mfillIndents);
+
// caret
saveValue("enhance_home_key",mEnhanceHomeKey);
saveValue("enhance_end_key",mEnhanceEndKey);
@@ -1003,6 +1032,10 @@ void Settings::Editor::doSave()
saveValue("caret_use_text_color",mCaretUseTextColor);
saveValue("caret_color",mCaretColor);
+ //highlight
+ saveValue("highlight_matching_braces",mHighlightMathingBraces);
+ saveValue("highlight_current_word",mHighlightCurrentWord);
+
//scroll
saveValue("auto_hide_scroll_bar", mAutoHideScrollbar);
saveValue("scroll_past_eof", mScrollPastEof);
@@ -1112,6 +1145,10 @@ void Settings::Editor::doLoad()
mCaretUseTextColor = boolValue("caret_use_text_color",true);
mCaretColor = colorValue("caret_color",QColorConstants::Svg::yellow);
+ //highlight
+ mHighlightMathingBraces = boolValue("highlight_matching_braces",true);
+ mHighlightCurrentWord = boolValue("highlight_current_word",true);
+
//scroll
mAutoHideScrollbar = boolValue("auto_hide_scroll_bar", false);
mScrollPastEof = boolValue("scroll_past_eof", true);
diff --git a/RedPandaIDE/settings.h b/RedPandaIDE/settings.h
index d6d6f0a4..23bfb885 100644
--- a/RedPandaIDE/settings.h
+++ b/RedPandaIDE/settings.h
@@ -96,10 +96,13 @@ public:
QString config(DataType dataType = DataType::None) const;
QString executable() const;
- // _Base interface
+ void setProjectDir(const QString &newProjectDir);
+
protected:
void doSave() override;
void doLoad() override;
+ private:
+ QString mProjectDir;
};
class Editor: public _Base {
@@ -336,6 +339,12 @@ public:
bool useUTF8ByDefault() const;
void setUseUTF8ByDefault(bool newUseUTF8ByDefault);
+ bool highlightCurrentWord() const;
+ void setHighlightCurrentWord(bool newHighlightCurrentWord);
+
+ bool highlightMathingBraces() const;
+ void setHighlightMathingBraces(bool newHighlightMathingBraces);
+
private:
//General
// indents
@@ -354,6 +363,10 @@ public:
bool mCaretUseTextColor;
QColor mCaretColor;
+ //highlights
+ bool mHighlightCurrentWord;
+ bool mHighlightMathingBraces;
+
//scroll
bool mAutoHideScrollbar;
bool mScrollPastEof;
diff --git a/RedPandaIDE/settingsdialog/editorgeneralwidget.cpp b/RedPandaIDE/settingsdialog/editorgeneralwidget.cpp
index c31c91c8..acd839a3 100644
--- a/RedPandaIDE/settingsdialog/editorgeneralwidget.cpp
+++ b/RedPandaIDE/settingsdialog/editorgeneralwidget.cpp
@@ -52,6 +52,9 @@ void EditorGeneralWidget::doLoad()
setCaretTypeIndex(ui->cbCaretForOverwrite,pSettings->editor().caretForOverwrite());
ui->chkCaretUseTextColor->setChecked(pSettings->editor().caretUseTextColor());
ui->colorCaret->setColor(pSettings->editor().caretColor());
+ //highlight
+ ui->chkHighlightCurrentWord->setChecked(pSettings->editor().highlightCurrentWord());
+ ui->chkHighlightMatchingBraces->setChecked(pSettings->editor().highlightMathingBraces());
//scrolls;
ui->chkAutoHideScrollBars->setChecked(pSettings->editor().autoHideScrollbar());
ui->chkScrollPastEOF->setChecked(pSettings->editor().scrollPastEof());
@@ -84,6 +87,10 @@ void EditorGeneralWidget::doSave()
pSettings->editor().setCaretForOverwrite(getCaretTypeIndex(ui->cbCaretForOverwrite));
pSettings->editor().setCaretUseTextColor(ui->chkCaretUseTextColor->isChecked());
pSettings->editor().setCaretColor(ui->colorCaret->color());
+ //highlight
+ pSettings->editor().setHighlightCurrentWord(ui->chkHighlightCurrentWord->isChecked());
+ pSettings->editor().setHighlightMathingBraces(ui->chkHighlightMatchingBraces->isChecked());
+
//scrolls;
pSettings->editor().setAutoHideScrollbar(ui->chkAutoHideScrollBars->isChecked());
pSettings->editor().setScrollPastEof(ui->chkScrollPastEOF->isChecked());
diff --git a/RedPandaIDE/settingsdialog/editorgeneralwidget.ui b/RedPandaIDE/settingsdialog/editorgeneralwidget.ui
index 488070f8..760f4900 100644
--- a/RedPandaIDE/settingsdialog/editorgeneralwidget.ui
+++ b/RedPandaIDE/settingsdialog/editorgeneralwidget.ui
@@ -228,6 +228,29 @@
+ -
+
+
+ Highlight
+
+
+
-
+
+
+ Highlight matching braces
+
+
+
+ -
+
+
+ Highlight current word
+
+
+
+
+
+
-
diff --git a/RedPandaIDE/translations.qrc b/RedPandaIDE/translations.qrc
index e8eb9d01..6d8b6359 100644
--- a/RedPandaIDE/translations.qrc
+++ b/RedPandaIDE/translations.qrc
@@ -1,5 +1,6 @@
RedPandaIDE_zh_CN.qm
+ qt_zh_CN.qm
diff --git a/RedPandaIDE/widgets/darkfusionstyle.cpp b/RedPandaIDE/widgets/darkfusionstyle.cpp
index b5cc66c9..ad65c51e 100644
--- a/RedPandaIDE/widgets/darkfusionstyle.cpp
+++ b/RedPandaIDE/widgets/darkfusionstyle.cpp
@@ -794,6 +794,11 @@ QIcon DarkFusionStyle::standardIcon(StandardPixmap standardIcon, const QStyleOpt
return QProxyStyle::standardIcon(standardIcon, option, widget);
}
+void DarkFusionStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
+{
+ QProxyStyle::drawComplexControl(control,option,painter,widget);
+}
+
void DarkFusionStyle::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter,
const QWidget *widget) const
{
diff --git a/RedPandaIDE/widgets/darkfusionstyle.h b/RedPandaIDE/widgets/darkfusionstyle.h
index d31c1627..2aa6694d 100644
--- a/RedPandaIDE/widgets/darkfusionstyle.h
+++ b/RedPandaIDE/widgets/darkfusionstyle.h
@@ -16,6 +16,11 @@ public:
const QWidget *widget) const override;
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr,
const QWidget *widget = nullptr) const override;
+
+ // QStyle interface
+public:
+ void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
+ QPainter *painter, const QWidget *widget) const override;
};
#endif // DARKFUSIONSTYLE_H
diff --git a/RedPandaIDE/widgets/newprojectdialog.cpp b/RedPandaIDE/widgets/newprojectdialog.cpp
index fc212347..076fa4d2 100644
--- a/RedPandaIDE/widgets/newprojectdialog.cpp
+++ b/RedPandaIDE/widgets/newprojectdialog.cpp
@@ -20,11 +20,12 @@ NewProjectDialog::NewProjectDialog(QWidget *parent) :
int i=0;
QString projectName;
QString location;
+ location = excludeTrailingPathDelimiter(pSettings->dirs().projectDir());
while (true) {
i++;
projectName = tr("Project%1").arg(i);
- location = includeTrailingPathDelimiter(pSettings->dirs().projectDir()) + projectName;
- if (!QDir(location).exists())
+ QString tempLocation = includeTrailingPathDelimiter(location)+projectName;
+ if (!QDir(tempLocation).exists())
break;
}
ui->txtProjectName->setText(projectName);
@@ -65,6 +66,11 @@ QString NewProjectDialog::getProjectName()
return ui->txtProjectName->text();
}
+bool NewProjectDialog::useAsDefaultProjectDir()
+{
+ return ui->chkAsDefaultLocation->isChecked();
+}
+
bool NewProjectDialog::isCProject()
{
return ui->rdCProject->isChecked();
@@ -159,12 +165,7 @@ void NewProjectDialog::updateView()
void NewProjectDialog::updateProjectLocation()
{
- ui->txtLocation->setText(
- includeTrailingPathDelimiter(
- extractFilePath(
- ui->txtLocation->text()))
- + ui->txtProjectName->text()
- );
+ QString newLocation = ui->txtLocation->text();
QListWidgetItem * current = ui->lstTemplates->currentItem();
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(
@@ -210,7 +211,7 @@ void NewProjectDialog::on_btnBrowse_clicked()
}
QString dir = QFileDialog::getExistingDirectory(
this,
- "Project directory",
+ "Choose directory",
dirPath
);
if (!dir.isEmpty()) {
diff --git a/RedPandaIDE/widgets/newprojectdialog.h b/RedPandaIDE/widgets/newprojectdialog.h
index 1c8b20b0..95690fd0 100644
--- a/RedPandaIDE/widgets/newprojectdialog.h
+++ b/RedPandaIDE/widgets/newprojectdialog.h
@@ -20,6 +20,7 @@ public:
PProjectTemplate getTemplate();
QString getLocation();
QString getProjectName();
+ bool useAsDefaultProjectDir();
bool isCProject();
bool isCppProject();
bool makeProjectDefault();
diff --git a/RedPandaIDE/widgets/newprojectdialog.ui b/RedPandaIDE/widgets/newprojectdialog.ui
index 533bad7e..414d8186 100644
--- a/RedPandaIDE/widgets/newprojectdialog.ui
+++ b/RedPandaIDE/widgets/newprojectdialog.ui
@@ -7,7 +7,7 @@
0
0
670
- 528
+ 546
@@ -85,6 +85,12 @@
-
+
-
+
+
+ -
+
+
-
@@ -92,16 +98,6 @@
- -
-
-
- Location:
-
-
-
- -
-
-
-
@@ -114,8 +110,19 @@
- -
-
+
-
+
+
+ Create in
+
+
+
+ -
+
+
+ Use as the default project location
+
+