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? - - - - + + + + Error 错误 @@ -1048,55 +1048,55 @@ Are you really want to continue? 另存为 - + The text to be copied exceeds count limit! 要复制的内容超过了行数限制! - + The text to be copied exceeds character limit! 要复制的内容超过了字符数限制! - + The text to be cut exceeds count limit! 要剪切的内容超过了行数限制! - + The text to be cut exceeds character limit! 要剪切的内容超过了字符数限制! - + Print Document 打印文档 - - - + + + Ctrl+click for more info Ctrl+单击以获取更多信息 - - + + Symbol '%1' not found! 未找到符号'%1'! - + Break point condition 断点条件 - + Enter the condition of the breakpoint: 输入当前断点的生效条件: - + Readonly 只读 @@ -2861,7 +2861,7 @@ Are you really want to continue? - + Issues 编译器 @@ -3072,8 +3072,6 @@ Are you really want to continue? - - Compile 编译 @@ -3269,7 +3267,7 @@ Are you really want to continue? - + New Problem Set 新建试题集 @@ -3288,14 +3286,14 @@ Are you really want to continue? - + Save Problem Set 保存试题集 - + Load Problem Set 载入试题集 @@ -3731,7 +3729,7 @@ Are you really want to continue? - + Rename Symbol 重命名符号 @@ -3752,13 +3750,13 @@ Are you really want to continue? - + Export As RTF 导出为RTF - + Export As HTML 导出为HTML @@ -3824,7 +3822,7 @@ Are you really want to continue? - + Open Folder 打开文件夹 @@ -4055,7 +4053,7 @@ Are you really want to continue? - + Problem Set %1 试题集%1 @@ -4122,15 +4120,15 @@ Are you really want to continue? - - + + Bookmark Description 书签描述 - - + + Description: 描述: @@ -4294,10 +4292,16 @@ Are you really want to continue? - + Do you want to save it? 需要保存吗? + + + + File Changed + 文件已发生变化 + New Project File? @@ -4312,7 +4316,7 @@ Are you really want to continue? - + Save Error 保存失败 @@ -4337,160 +4341,160 @@ Are you really want to continue? 您真的要清除该文件的所有断点吗? - + New project 新建项目 - + Close %1 and start new project? 关闭'%1'以打开新项目? - + Folder not exist 文件夹不存在 - + Folder '%1' doesn't exist. Create it now? 文件夹'%1'不存在。是否创建? - + Can't create folder 无法创建文件夹 - + Failed to create folder '%1'. 创建文件夹'%1'失败。 - + Save new project as - + Red panda Dev-C++ project file (*.dev) 小熊猫Dev-C++项目文件 (*.dev) - + New project fail 新建项目失败 - + Can't assign project template 无法使用模板创建项目 - + Remove file 删除文件 - + Remove the file from disk? 同时从硬盘上删除文件? - + untitled 无标题 - + New Project File Name 新的项目文件名 - + File Name: 文件名: - + File Already Exists! 文件已存在! - + File '%1' already exists! 文件'%1'已经存在! - + Add to project 添加到项目 - + Rename Error 重命名出错 - + Symbol '%1' is defined in system header. 符号'%1'在系统头文件中定义,无法修改。 - + New Name 新名称 - - + + Replace Error 替换出错 - + Can't open file '%1' for replace! 无法打开文件'%1'进行替换! - + Contents has changed since last search! 内容和上次查找时不一致。 - + Rich Text Format Files (*.rtf) RTF格式文件 (*.rtf) - + HTML Files (*.html) HTML文件 (*.html) - + The current problem set is not empty. 当前的试题集不是空的。 - + Problem %1 试题%1 - - + + Problem Set Files (*.pbs) 试题集文件 (*.pbs) - + Load Error 载入失败 - + Problem Case %1 试题案例%1 @@ -4615,28 +4619,37 @@ Are you really want to continue? C++语言项目 - + Name: 项目名称: - - Location: - 文件夹: + + Create in + 创建在 - + + Use as the default project location + 设为缺省项目位置 + + + Location: + 文件夹: + + + ... ... - + Project%1 项目%1 - - + + Default 缺省 @@ -5176,24 +5189,24 @@ Are you really want to continue? ProjectModel - + File exists 文件已存在 - + File '%1' already exists. Delete it now? 文件'%1'已存在。是否删除? - - + + Remove failed 删除失败 - - + + Failed to remove file '%1' 无法删除文件'%1' @@ -5412,7 +5425,7 @@ Are you really want to continue? QApplication - + Error 错误 @@ -5482,180 +5495,180 @@ Are you really want to continue? 无法写入配置文件夹"%1" - + Can't load autolink settings 无法载入自动链接设置 - - - - + + + + The following %1 directories don't exist: 下列%1文件夹不存在: - - + + binary 二进制 - + No %1 directories have been specified. 未指定%1文件夹 - + C include C包含 - - + + C++ include C++包含 - - - - + + + + Cannot find the %1 "%2" 无法找到%1程序"%2" - + C options C语言选项 - + Support all ANSI standard C programs (-ansi) 支持所有ANSI标准C程序(-ansi) - + Do not recognize asm,inline or typeof as a keyword (-fno-asm) 不支持将asm、inline和typeof作为关键字(-fno-asm) - + Imitate traditional C preprocessors (-traditional-cpp) 模仿传统C预处理器行为(-traditional-cpp) - + Code Generation 代码生成 - + Optimize for the following machine (-march) 生成特定机器的专用指令(-march) - + Optimize less, while maintaining full compatibility (-tune) 完整兼容特定机器,较少优化(-tune) - + Enable use of specific instructions (-mx) 启用特定指令集(-mx) - + Optimization level (-Ox) 优化级别(-Ox) - + Compile with the following pointer size (-mx) 使用下列指针大小编译(-mx) - + Language standard (-std) 语言标准(-std) - + Profile 性能分析 - + Generate debugging information (-g3) 生成调试信息(-g3) - + Generate profiling info for analysis (-pg) 生成性能分析信息(-pg) - + Warnings 代码警告 - + Inhibit all warning messages (-w) 忽略所有警告信息(-w) - + Show most warnings (-Wall) 启用常见问题警告(-Wall) - + Show some more warnings (-Wextra) 启用更多问题警告(-Wextra) - + Check ISO C/C++/C++0x conformance (-pedantic) 检查ISO C/C++/C++0x语法一致性(-pedantic) - + Only check the code for syntax errors (-fsyntax-only) 只进行语法检查(不编译)(-fsyntax-only) - + Make all warnings into errors (-Werror) 将警告作为错误处理(-Werror) - + Abort compilation on first error (-Wfatal-errors) 遇到第一个错误后立即中止编译(-Wfatal-errors) - + Linker 链接器 - + Link an Objective C program (-lobjc) 链接Objective-C程序 (-lobjc) - + Do not use standard system libraries (-nostdlib) 不使用标准库和系统启动文件(-nostdlib) - + Do not create a console window (-mwindows) 不产生控制台窗口(-mwindows) - + Strip executable (-s) 剥除附加信息(-s) @@ -5664,53 +5677,53 @@ Are you really want to continue? 链接Ojbective C程序(-lobjc) - + Output 输出 - + Put comments in generated assembly code (-fverbose-asm) 在生成的汇编代码中加入注释(-fverbose-asm) - + Use pipes instead of temporary files during compilation (-pipe) 编译时使用管道而不是临时文件(-pipe) - + Do not assemble, compile and generate the assemble code (-S) 只生成汇编代码(-S) - - + + Confirm 确认 - + The following problems were found during validation of compiler set "%1": 在验证编译器设置"%1"时遇到了下列问题: - + Would you like Red Panda C++ to remove them for you and add the default paths to the valid paths? 是否让小熊猫C++删除这些配置,并尝试重新建立配置? - + Leaving those directories will lead to problems during compilation.<br /><br />Unless you know exactly what you're doing, it is recommended that you click Yes. 如果仍然保留这些设置,可能会导致编译错误。<br /><br />请选择“是”,除非您清楚的知道选择“否”的后果, - + Compiler set not configuared. 未配置编译器设置。 - + Would you like Red Panda C++ to search for compilers in the following locations: <BR />'%1'<BR />'%2'? 您需要小熊猫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? 杂项 - + Program Runner @@ -7087,51 +7100,66 @@ Are you really want to continue? + Highlight + 高亮显示 + + + + Highlight matching braces + 高亮显示与光标处相匹配的括号 + + + + Highlight current word + 高亮显示光标所在的单词 + + + Scroll 滚动条 - + Auto hide scroll bars 自动隐藏滚动条 - + Can scroll the last char to the left edge of the editor 可以将每行末尾字符滚动到编辑器最左侧 - + Can scroll the last line to the top edge of the editor 可以将最后一行滚动到编辑器最上方 - + Page Up/Down scrolls half a page 翻页键只滚动半页 - + Forces page scroll to be one line less 在滚动页时少滚动一行 - + Mouse Wheel Scroll Speed 鼠标滚轮卷轴速度(行) - + Show right edge line 显示右边缘线 - + Right egde width 右边缘宽度 - + Right edge line color 右边缘颜色 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 + +