- enhancement: If there is "cppreference.chm" or "cppreference-%locale_name%.chm"(like cppreference-zh_CN.chm) in the redpanda C++'s app folder, open it instead of the cppreference website.

This commit is contained in:
Roy Qu 2023-01-20 12:17:04 +08:00
parent 22e1339b1a
commit c5331f0597
2 changed files with 27 additions and 7 deletions

View File

@ -9,6 +9,8 @@ Red Panda C++ Version 2.10
- enhancement: Save project files' real encoding;
- enhancement: Use project files' real encoding information when generating the makefile.
- fix: If buttons in the options dialog / compiler / compiler set page is pressed, they won't release.
- enhancement: Confirm before remove a compiler set.
- enhancement: If there is "cppreference.chm" or "cppreference-%locale_name%.chm"(like cppreference-zh_CN.chm) in the redpanda C++'s app folder, open it instead of the cppreference website.
Red Panda C++ Version 2.9

View File

@ -7921,14 +7921,20 @@ void MainWindow::on_actionMove_To_Other_View_triggered()
void MainWindow::on_actionC_C_Reference_triggered()
{
QFileInfo fileInfo(includeTrailingPathDelimiter(pSettings->dirs().appDir())+
QString("cppreference-%1.chm").arg(pSettings->environment().language()));
if (fileInfo.exists()) {
QDesktopServices::openUrl(QUrl::fromLocalFile(fileInfo.absoluteFilePath()));
return;
}
fileInfo=QFileInfo(includeTrailingPathDelimiter(pSettings->dirs().appDir())+
QString("cppreference.chm"));
if (fileInfo.exists()) {
QDesktopServices::openUrl(QUrl::fromLocalFile(fileInfo.absoluteFilePath()));
return;
}
if (pSettings->environment().language()=="zh_CN") {
QFileInfo fileInfo(includeTrailingPathDelimiter(pSettings->dirs().appDir())+"cppreference-zh.chm");
if (fileInfo.exists()) {
QDesktopServices::openUrl(QUrl::fromLocalFile(fileInfo.absoluteFilePath()));
} else {
QDesktopServices::openUrl(QUrl("https://zh.cppreference.com/w/cpp"));
}
QDesktopServices::openUrl(QUrl("https://zh.cppreference.com/w/cpp"));
} else {
QDesktopServices::openUrl(QUrl("https://en.cppreference.com/w/cpp"));
}
@ -8250,6 +8256,18 @@ void MainWindow::onProblemRunAllCases()
void MainWindow::on_actionC_Reference_triggered()
{
QFileInfo fileInfo(includeTrailingPathDelimiter(pSettings->dirs().appDir())+
QString("cppreference-%1.chm").arg(pSettings->environment().language()));
if (fileInfo.exists()) {
QDesktopServices::openUrl(QUrl::fromLocalFile(fileInfo.absoluteFilePath()));
return;
}
fileInfo=QFileInfo(includeTrailingPathDelimiter(pSettings->dirs().appDir())+
QString("cppreference.chm"));
if (fileInfo.exists()) {
QDesktopServices::openUrl(QUrl::fromLocalFile(fileInfo.absoluteFilePath()));
return;
}
if (pSettings->environment().language()=="zh_CN") {
QDesktopServices::openUrl(QUrl("https://zh.cppreference.com/w/c"));
} else {