- enhancement: refresh project view for git status won't redraw project structure

- enhancement: auto save project options after the compilerset option for project resetted
  - enhancement: "." and ".." in paths of issues not correctly handled
  - enhancement: auto locate the last opened file in the project view after project creation
  - enhancement: separate compiler's language standard option for C / C++
  - fix: compiler settings not correctly handled when create makefile
This commit is contained in:
Roy Qu 2022-10-24 19:23:43 +08:00
parent 6d2ce9035d
commit 55b63a4f95
8 changed files with 259 additions and 22 deletions

View File

@ -17,6 +17,9 @@ Red Panda C++ Version 2.0
- enhancement: refresh project view for git status won't redraw project structure
- enhancement: auto save project options after the compilerset option for project resetted
- enhancement: "." and ".." in paths of issues not correctly handled
- enhancement: auto locate the last opened file in the project view after project creation
- enhancement: separate compiler's language standard option for C / C++
- fix: compiler settings not correctly handled when create makefile
Red Panda C++ Version 1.5

View File

@ -113,8 +113,7 @@ QString Compiler::getFileNameFromOutputLine(QString &line) {
break;
}
}
QFileInfo info(temp);
return info.isAbsolute()?cleanPath(temp):absolutePath(mDirectory,temp);
return temp;
}
int Compiler::getLineNumberFromOutputLine(QString &line)
@ -389,8 +388,9 @@ QString Compiler::getCCompileArguments(bool checkSyntax)
if (pOption && pOption->isC && !pOption->isLinker) {
if (pOption->choices.isEmpty())
result += " " + pOption->setting;
else
result += " " + pOption->setting + compilerSet()->getCompileOptionValue(key);
else {
result += " " + pOption->setting + compileOptions[key];
}
}
}
@ -432,7 +432,7 @@ QString Compiler::getCppCompileArguments(bool checkSyntax)
if (pOption->choices.isEmpty())
result += " " + pOption->setting;
else
result += " " + pOption->setting + compilerSet()->getCompileOptionValue(key);
result += " " + pOption->setting + compileOptions[key];
}
}
if (compilerSet()->useCustomCompileParams() && !compilerSet()->customCompileParams().isEmpty()) {
@ -544,11 +544,10 @@ QString Compiler::getLibraryArguments(FileType fileType)
if (pOption->choices.isEmpty())
result += " " + pOption->setting;
else
result += " " + pOption->setting + compilerSet()->getCompileOptionValue(key);
result += " " + pOption->setting + compileOptions[key];
}
}
// Add global compiler linker extras
if (compilerSet()->useCustomLinkParams() && !compilerSet()->customLinkParams().isEmpty()) {
QStringList params = textToLines(compilerSet()->customLinkParams());

View File

@ -68,27 +68,30 @@ void CompilerInfo::prepareCompilerOptions()
sl.append(QPair<QString,QString>("Debug (g)","g"));
addOption(CC_CMD_OPT_OPTIMIZE, QObject::tr("Optimization level (-Ox)"), groupName, true, true, false, "-O", sl);
// Language Standards
// C++ Language Standards
sl.clear();
sl.append(QPair<QString,QString>("ISO C90","c90"));
sl.append(QPair<QString,QString>("ISO C99","c99"));
sl.append(QPair<QString,QString>("ISO C11","c11"));
sl.append(QPair<QString,QString>("ISO C17","c17"));
sl.append(QPair<QString,QString>("ISO C++","c++98"));
sl.append(QPair<QString,QString>("ISO C++11","c++11"));
sl.append(QPair<QString,QString>("ISO C++14","c++14"));
sl.append(QPair<QString,QString>("ISO C++17","c++17"));
sl.append(QPair<QString,QString>("ISO C++20","c++2a"));
sl.append(QPair<QString,QString>("GNU C90","gnu90"));
sl.append(QPair<QString,QString>("GNU C99","gnu99"));
sl.append(QPair<QString,QString>("GNU C11","gnu11"));
sl.append(QPair<QString,QString>("GNU C17","gnu17"));
sl.append(QPair<QString,QString>("GNU C++","gnu++98"));
sl.append(QPair<QString,QString>("GNU C++11","gnu++11"));
sl.append(QPair<QString,QString>("GNU C++14","gnu++14"));
sl.append(QPair<QString,QString>("GNU C++17","gnu++17"));
sl.append(QPair<QString,QString>("GNU C++20","gnu++2a"));
addOption(CC_CMD_OPT_STD, QObject::tr("Language standard (-std)"), groupName, true, true, false, "-std=", sl);
addOption(CC_CMD_OPT_STD, QObject::tr("C++ Language standard (-std)"), groupName, false, true, false, "-std=", sl);
sl.clear();
sl.append(QPair<QString,QString>("ISO C90","c90"));
sl.append(QPair<QString,QString>("ISO C99","c99"));
sl.append(QPair<QString,QString>("ISO C11","c11"));
sl.append(QPair<QString,QString>("ISO C17","c17"));
sl.append(QPair<QString,QString>("GNU C90","gnu90"));
sl.append(QPair<QString,QString>("GNU C99","gnu99"));
sl.append(QPair<QString,QString>("GNU C11","gnu11"));
sl.append(QPair<QString,QString>("GNU C17","gnu17"));
addOption(C_CMD_OPT_STD, QObject::tr("C Language standard (-std)"), groupName, true, false, false, "-std=", sl);
// Optimization for cpu type
sl.clear();

View File

@ -9,6 +9,8 @@
#define COMPILER_GCC "GCC"
#define COMPILER_GCC_UTF8 "GCC_UTF8"
#define C_CMD_OPT_STD "c_cmd_opt_std"
#define CC_CMD_OPT_ANSI "cc_cmd_opt_ansi"
#define CC_CMD_OPT_NO_ASM "cc_cmd_opt_no_asm"
#define CC_CMD_OPT_TRADITIONAL_CPP "cc_cmd_opt_traditional_cpp"

View File

@ -1383,11 +1383,6 @@ void MainWindow::openProject(const QString &filename, bool openFiles)
//stretchExplorerPanel(true);
if (openFiles)
ui->tabExplorer->setCurrentWidget(ui->tabProject);
// {
// LeftPageControl.ActivePage := LeftProjectSheet;
// fLeftPageControlChanged := False;
// ClassBrowser.TabVisible:= False;
// }
// Only update class browser once
mClassBrowserModel.beginUpdate();
@ -6239,6 +6234,17 @@ void MainWindow::on_actionNew_Project_triggered()
scanActiveProject(true);
Editor* editor = mEditorList->getEditor();
updateClassBrowserForEditor(editor);
if (editor) {
PProjectUnit unit=mProject->findUnit(editor);
if (unit) {
QModelIndex index=mProject->model()->getNodeIndex(unit->node().get());
index = mProjectProxyModel->mapFromSource(index);
ui->projectView->expand(index);
ui->projectView->setCurrentIndex(index);
}
}
if (pSettings->ui().showProject())
ui->tabExplorer->setCurrentWidget(ui->tabProject);
}
pSettings->ui().setNewProjectDialogWidth(dialog.width());
pSettings->ui().setNewProjectDialogHeight(dialog.height());
@ -6513,6 +6519,16 @@ void MainWindow::showHideMessagesTab(QWidget *widget, bool show)
void MainWindow::prepareTabInfosData()
{
// QHash<int,QWidget*> tabOrders;
// tabOrders.insert(pSettings->ui().projectOrder(), ui->tabProject);
// tabOrders.insert(pSettings->ui().watchOrder(), ui->tabWatch);
// tabOrders.insert(pSettings->ui().structureOrder(), ui->tabStructure);
// tabOrders.insert(pSettings->ui().filesOrder(), ui->tabFiles);
// tabOrders.insert(pSettings->ui().problemSetOrder(), ui->tabProblemSet);
// for (int i=1;i<tabOrders.count();i++) {
// }
for (int i=0;i<ui->tabExplorer->count();i++) {
QWidget* widget = ui->tabExplorer->widget(i);
PTabWidgetInfo info = std::make_shared<TabWidgetInfo>();
@ -6525,6 +6541,14 @@ void MainWindow::prepareTabInfosData()
void MainWindow::prepareTabMessagesData()
{
// QHash<int,QWidget*> tabOrders;
// tabOrders.insert(pSettings->ui().issuesOrder(), ui->tabIssues);
// tabOrders.insert(pSettings->ui().compileLogOrder(), ui->tabToolsOutput);
// tabOrders.insert(pSettings->ui().debugOrder(), ui->tabDebug);
// tabOrders.insert(pSettings->ui().searchOrder(), ui->tabSearch);
// tabOrders.insert(pSettings->ui().TODOOrder(), ui->tabTODO);
// tabOrders.insert(pSettings->ui().bookmarkOrder(), ui->tabBookmark);
for (int i=0;i<ui->tabMessages->count();i++) {
QWidget* widget = ui->tabMessages->widget(i);
PTabWidgetInfo info = std::make_shared<TabWidgetInfo>();

View File

@ -478,6 +478,9 @@
<property name="usesScrollButtons">
<bool>true</bool>
</property>
<property name="movable">
<bool>true</bool>
</property>
<widget class="QWidget" name="tabFiles">
<property name="autoFillBackground">
<bool>true</bool>

View File

@ -4893,6 +4893,126 @@ void Settings::UI::setDebugPanelIndex(int newDebugPanelIndex)
mDebugPanelIndex = newDebugPanelIndex;
}
int Settings::UI::problemOrder() const
{
return mProblemOrder;
}
void Settings::UI::setProblemOrder(int newProblemOrder)
{
mProblemOrder = newProblemOrder;
}
int Settings::UI::bookmarkOrder() const
{
return mBookmarkOrder;
}
void Settings::UI::setBookmarkOrder(int newBookmarkOrder)
{
mBookmarkOrder = newBookmarkOrder;
}
int Settings::UI::TODOOrder() const
{
return mTODOOrder;
}
void Settings::UI::setTODOOrder(int newTODOOrder)
{
mTODOOrder = newTODOOrder;
}
int Settings::UI::searchOrder() const
{
return mSearchOrder;
}
void Settings::UI::setSearchOrder(int newSearchOrder)
{
mSearchOrder = newSearchOrder;
}
int Settings::UI::debugOrder() const
{
return mDebugOrder;
}
void Settings::UI::setDebugOrder(int newDebugOrder)
{
mDebugOrder = newDebugOrder;
}
int Settings::UI::compileLogOrder() const
{
return mCompileLogOrder;
}
void Settings::UI::setCompileLogOrder(int newCompileLogOrder)
{
mCompileLogOrder = newCompileLogOrder;
}
int Settings::UI::issuesOrder() const
{
return mIssuesOrder;
}
void Settings::UI::setIssuesOrder(int newIssuesOrder)
{
mIssuesOrder = newIssuesOrder;
}
int Settings::UI::problemSetOrder() const
{
return mProblemSetOrder;
}
void Settings::UI::setProblemSetOrder(int newProblemSetOrder)
{
mProblemSetOrder = newProblemSetOrder;
}
int Settings::UI::filesOrder() const
{
return mFilesOrder;
}
void Settings::UI::setFilesOrder(int newFilesOrder)
{
mFilesOrder = newFilesOrder;
}
int Settings::UI::structureOrder() const
{
return mStructureOrder;
}
void Settings::UI::setStructureOrder(int newStructureOrder)
{
mStructureOrder = newStructureOrder;
}
int Settings::UI::watchOrder() const
{
return mWatchOrder;
}
void Settings::UI::setWatchOrder(int newWatchOrder)
{
mWatchOrder = newWatchOrder;
}
int Settings::UI::projectOrder() const
{
return mProjectOrder;
}
void Settings::UI::setProjectOrder(int newProjectOrder)
{
mProjectOrder = newProjectOrder;
}
const QSize &Settings::UI::explorerTabsSize() const
{
return mExplorerTabsSize;
@ -5188,6 +5308,27 @@ void Settings::UI::doSave()
saveValue("show_bookmark", mShowBookmark);
saveValue("show_problem", mShowProblem);
saveValue("show_issues", mIssuesOrder);
saveValue("show_compile_log", mShowCompileLog);
saveValue("show_debug", mShowDebug);
saveValue("show_search", mShowSearch);
saveValue("show_todo", mShowTODO);
saveValue("show_bookmark", mShowBookmark);
saveValue("show_problem", mShowProblem);
saveValue("project_order", mProjectOrder);
saveValue("watch_order", mWatchOrder);
saveValue("structure_order", mStructureOrder);
saveValue("files_order", mFilesOrder);
saveValue("problemset_order", mProblemSetOrder);
saveValue("issues_order", mIssuesOrder);
saveValue("compilelog_order", mCompileLogOrder);
saveValue("debug_order", mDebugOrder);
saveValue("search_order", mSearchOrder);
saveValue("todo_order", mTODOOrder);
saveValue("bookmark_order", mBookmarkOrder);
saveValue("problem_order", mProblemOrder);
//dialogs
saveValue("cpu_dialog_width", mCPUDialogWidth);
saveValue("cpu_dialog_height", mCPUDialogHeight);
@ -5239,6 +5380,20 @@ void Settings::UI::doLoad()
mShowBookmark = boolValue("show_bookmark",true);
mShowProblem = boolValue("show_problem",true);
mProjectOrder = intValue("project_order",1);
mWatchOrder = intValue("watch_order",2);
mStructureOrder = intValue("structure_order",3);
mFilesOrder = intValue("files_order",0);
mProblemSetOrder = intValue("problemset_order",4);
mIssuesOrder = intValue("issues_order",0);
mCompileLogOrder = intValue("compilelog_order",1);
mDebugOrder = intValue("debug_order",2);
mSearchOrder = intValue("search_order",3);
mTODOOrder = intValue("todo_order",4);
mBookmarkOrder = intValue("bookmark_order",5);
mProblemOrder = intValue("problem_order",6);
//dialogs
mCPUDialogWidth = intValue("cpu_dialog_width",977*qApp->desktop()->width()/1920);
mCPUDialogHeight = intValue("cpu_dialog_height",622*qApp->desktop()->height()/1080);

View File

@ -1025,6 +1025,42 @@ public:
int debugPanelIndex() const;
void setDebugPanelIndex(int newDebugPanelIndex);
int projectOrder() const;
void setProjectOrder(int newProjectOrder);
int watchOrder() const;
void setWatchOrder(int newWatchOrder);
int structureOrder() const;
void setStructureOrder(int newStructureOrder);
int filesOrder() const;
void setFilesOrder(int newFilesOrder);
int problemSetOrder() const;
void setProblemSetOrder(int newProblemSetOrder);
int issuesOrder() const;
void setIssuesOrder(int newIssuesOrder);
int compileLogOrder() const;
void setCompileLogOrder(int newCompileLogOrder);
int debugOrder() const;
void setDebugOrder(int newDebugOrder);
int searchOrder() const;
void setSearchOrder(int newSearchOrder);
int TODOOrder() const;
void setTODOOrder(int newTODOOrder);
int bookmarkOrder() const;
void setBookmarkOrder(int newBookmarkOrder);
int problemOrder() const;
void setProblemOrder(int newProblemOrder);
private:
QByteArray mMainWindowState;
QByteArray mMainWindowGeometry;
@ -1049,6 +1085,11 @@ public:
bool mShowStructure;
bool mShowFiles;
bool mShowProblemSet;
int mProjectOrder;
int mWatchOrder;
int mStructureOrder;
int mFilesOrder;
int mProblemSetOrder;
bool mShowIssues;
bool mShowCompileLog;
@ -1057,6 +1098,13 @@ public:
bool mShowTODO;
bool mShowBookmark;
bool mShowProblem;
int mIssuesOrder;
int mCompileLogOrder;
int mDebugOrder;
int mSearchOrder;
int mTODOOrder;
int mBookmarkOrder;
int mProblemOrder;
//dialogs
int mCPUDialogWidth;