- enhancement: when add files to project, auto add it to git (if the project has a git repository)
This commit is contained in:
parent
a2289463f9
commit
79edb0829a
2
NEWS.md
2
NEWS.md
|
@ -13,6 +13,8 @@ Red Panda C++ Version 0.14.3
|
|||
- enhancement: git - commit
|
||||
- enhancement: git - restore
|
||||
- fix: compiler set index not correctly saved, when remove compiler sets in options dialog
|
||||
- enhancement: when add files to project, auto add it to git (if the project has a git repository)
|
||||
|
||||
|
||||
Red Panda C++ Version 0.14.2
|
||||
- enhancement: file system view mode for project
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -748,12 +748,20 @@ void MainWindow::updateDPI()
|
|||
void MainWindow::onFileSaved(const QString &path, bool inProject)
|
||||
{
|
||||
if (pSettings->vcs().gitOk()) {
|
||||
if (inProject && mProject) {
|
||||
QString branch;
|
||||
if (inProject && mProject && mProject->model()->iconProvider()->VCSRepository()->hasRepository(branch)) {
|
||||
mProject->model()->beginUpdate();
|
||||
mProject->model()->endUpdate();
|
||||
}
|
||||
QModelIndex index = mFileSystemModel.index(path);
|
||||
if (index.isValid()) {
|
||||
if (!inProject) {
|
||||
if ( (isCFile(path) || isHFile(path))
|
||||
&& !mFileSystemModelIconProvider.VCSRepository()->isFileInRepository(path)) {
|
||||
|
||||
mFileSystemModelIconProvider.VCSRepository()->add(extractRelativePath(mFileSystemModelIconProvider.VCSRepository()->folder(),path));
|
||||
}
|
||||
}
|
||||
mFileSystemModelIconProvider.update();
|
||||
mFileSystemModel.setIconProvider(&mFileSystemModelIconProvider);
|
||||
ui->treeFiles->update(index);
|
||||
|
@ -5375,6 +5383,12 @@ void MainWindow::on_actionAdd_to_project_triggered()
|
|||
foreach (const QString& filename, dialog.selectedFiles()) {
|
||||
mProject->addUnit(filename,folderNode,false);
|
||||
mProject->cppParser()->addFileToScan(filename);
|
||||
QString branch;
|
||||
if (pSettings->vcs().gitOk() && mProject->model()->iconProvider()->VCSRepository()->hasRepository(branch)) {
|
||||
mProject->model()->iconProvider()->VCSRepository()->add(
|
||||
extractRelativePath(mProject->folder(),filename)
|
||||
);
|
||||
}
|
||||
}
|
||||
mProject->rebuildNodes();
|
||||
mProject->saveUnits();
|
||||
|
@ -5616,14 +5630,21 @@ void MainWindow::newProjectUnitFile()
|
|||
}
|
||||
PProjectUnit newUnit = mProject->newUnit(
|
||||
mProject->pointerToNode(node),newFileName);
|
||||
idx = mProject->units().count()-1;
|
||||
mProject->rebuildNodes();
|
||||
mProject->saveUnits();
|
||||
updateProjectView();
|
||||
mProject->saveAll();
|
||||
updateProjectView();
|
||||
idx = mProject->units().count()-1;
|
||||
Editor * editor = mProject->openUnit(idx);
|
||||
//editor->setUseCppSyntax(mProject->options().useGPP);
|
||||
//editor->setModified(true);
|
||||
editor->activate();
|
||||
QString branch;
|
||||
if (pSettings->vcs().gitOk() && mProject->model()->iconProvider()->VCSRepository()->hasRepository(branch)) {
|
||||
mProject->model()->iconProvider()->VCSRepository()->add(newFileName);
|
||||
mProject->model()->beginUpdate();
|
||||
mProject->model()->endUpdate();
|
||||
}
|
||||
updateProjectView();
|
||||
}
|
||||
|
||||
void MainWindow::doFilesViewRemoveFile(const QModelIndex &index)
|
||||
|
@ -5802,6 +5823,7 @@ void MainWindow::showSearchReplacePanel(bool show)
|
|||
void MainWindow::setFilesViewRoot(const QString &path)
|
||||
{
|
||||
mFileSystemModelIconProvider.setRootFolder(path);
|
||||
mFileSystemModel.setIconProvider(&mFileSystemModelIconProvider);
|
||||
mFileSystemModel.setRootPath(path);
|
||||
ui->treeFiles->setRootIndex(mFileSystemModel.index(path));
|
||||
pSettings->environment().setCurrentFolder(path);
|
||||
|
@ -6004,7 +6026,8 @@ void MainWindow::on_actionC_C_Reference_triggered()
|
|||
if (fileInfo.exists()) {
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(fileInfo.absoluteFilePath()));
|
||||
} else {
|
||||
QDesktopServices::openUrl(QUrl("https://zh.cppreference.com/w/cpp"));
|
||||
|
||||
QDesktopServices::openUrl(QUrl("https://qingcms.gitee.io/cppreference/20210212/zh/cpp.html"));
|
||||
}
|
||||
} else {
|
||||
QDesktopServices::openUrl(QUrl("https://en.cppreference.com/w/cpp"));
|
||||
|
@ -6244,7 +6267,7 @@ void MainWindow::on_btnRunAllProblemCases_clicked()
|
|||
void MainWindow::on_actionC_Reference_triggered()
|
||||
{
|
||||
if (pSettings->environment().language()=="zh_CN") {
|
||||
QDesktopServices::openUrl(QUrl("https://zh.cppreference.com/w/c"));
|
||||
QDesktopServices::openUrl(QUrl("https://qingcms.gitee.io/cppreference/20210212/zh/c.html"));
|
||||
} else {
|
||||
QDesktopServices::openUrl(QUrl("https://en.cppreference.com/w/c"));
|
||||
}
|
||||
|
@ -6614,6 +6637,7 @@ void MainWindow::on_actionGit_Create_Repository_triggered()
|
|||
GitManager vcsManager;
|
||||
vcsManager.createRepository(mProject->folder());
|
||||
vcsManager.add(mProject->folder(), extractFileName(mProject->filename()));
|
||||
vcsManager.add(mProject->folder(), extractFileName(mProject->options().icon));
|
||||
//update project view
|
||||
mProject->addUnit(includeTrailingPathDelimiter(mProject->folder())+".gitignore", mProject->rootNode(), true);
|
||||
mProject->saveAll();
|
||||
|
@ -6726,3 +6750,13 @@ void MainWindow::on_actionGit_Restore_triggered()
|
|||
mFileSystemModel.setIconProvider(&mFileSystemModelIconProvider);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionWebsite_triggered()
|
||||
{
|
||||
if (pSettings->environment().language()=="zh_CN") {
|
||||
QDesktopServices::openUrl(QUrl("https://royqh1979.gitee.io/redpandacpp/"));
|
||||
} else {
|
||||
QDesktopServices::openUrl(QUrl("https://sourceforge.net/projects/redpanda-cpp/"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -586,6 +586,8 @@ private slots:
|
|||
|
||||
void on_actionGit_Restore_triggered();
|
||||
|
||||
void on_actionWebsite_triggered();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
EditorList *mEditorList;
|
||||
|
|
|
@ -576,7 +576,6 @@
|
|||
<widget class="IssuesTable" name="tableIssues">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
|
@ -1422,7 +1421,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1114</width>
|
||||
<height>26</height>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
@ -1559,6 +1558,7 @@
|
|||
<property name="title">
|
||||
<string>Help</string>
|
||||
</property>
|
||||
<addaction name="actionWebsite"/>
|
||||
<addaction name="actionC_Reference"/>
|
||||
<addaction name="actionC_C_Reference"/>
|
||||
<addaction name="actionEGE_Manual"/>
|
||||
|
@ -2783,6 +2783,11 @@
|
|||
<string>Restore</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionWebsite">
|
||||
<property name="text">
|
||||
<string>Website</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
|
|
@ -218,11 +218,14 @@ QString GitManager::runGit(const QString& workingFolder, const QStringList &args
|
|||
.arg(workingFolder,
|
||||
pSettings->vcs().gitPath(),
|
||||
args.join("\" \"")));
|
||||
// qDebug()<<"---------";
|
||||
// qDebug()<<args;
|
||||
QString output = runAndGetOutput(
|
||||
fileInfo.absoluteFilePath(),
|
||||
workingFolder,
|
||||
args);
|
||||
output = escapeUTF8String(output.toUtf8());
|
||||
// qDebug()<<output;
|
||||
emit gitCmdFinished(output);
|
||||
// if (output.startsWith("fatal:"))
|
||||
// throw GitError(output);
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "ui_aboutdialog.h"
|
||||
#include "../systemconsts.h"
|
||||
#include "../utils.h"
|
||||
#include "../settings.h"
|
||||
#include <QDebug>
|
||||
|
||||
AboutDialog::AboutDialog(QWidget *parent) :
|
||||
|
@ -41,6 +42,12 @@ AboutDialog::AboutDialog(QWidget *parent) :
|
|||
#endif
|
||||
ui->lblCompileTime->setText(ui->lblCompileTime->text()
|
||||
.arg(__DATE__, __TIME__));
|
||||
|
||||
QString website="https://sourceforge.net/projects/redpanda-cpp/";
|
||||
if (pSettings->environment().language()=="zh_CN") {
|
||||
website = "https://royqh1979.gitee.io/redpandacpp/";
|
||||
}
|
||||
ui->lblHomepage->setText(tr("Website: <a href=\"%1\">%1</a>").arg(website));
|
||||
}
|
||||
|
||||
AboutDialog::~AboutDialog()
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
<widget class="QLabel" name="lblQt">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
|
@ -41,7 +40,6 @@
|
|||
<widget class="QLabel" name="lblCompileTime">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
|
@ -54,7 +52,6 @@
|
|||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
|
@ -64,15 +61,17 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<widget class="QLabel" name="lblHomepage">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Homepage: <a href="Homepage: https://sourceforge.net/projects/dev-cpp-2020/"><span style=" text-decoration: underline; color:#0000ff;">https://sourceforge.net/projects/dev-cpp-2020/</span></a></p></body></html></string>
|
||||
<string><html><head/><body><p>Homepage: <a href="Homepage: https://sourceforge.net/projects/dev-cpp-2020/">https://sourceforge.net/projects/dev-cpp-2020/</a></p></body></html></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Loading…
Reference in New Issue