From b664094efc2bdf7bcc44214ba962b351c60ab560 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Tue, 22 Feb 2022 09:16:20 +0800 Subject: [PATCH] - fix: error in templates - enhancement: git - reset --- NEWS.md | 2 + RedPandaIDE/RedPandaIDE.pro | 3 + RedPandaIDE/vcs/gitresetdialog.cpp | 39 ++++++ RedPandaIDE/vcs/gitresetdialog.h | 29 +++++ RedPandaIDE/vcs/gitresetdialog.ui | 197 +++++++++++++++++++++++++++++ windows/templates/Jackpot.template | 1 + 6 files changed, 271 insertions(+) create mode 100644 RedPandaIDE/vcs/gitresetdialog.cpp create mode 100644 RedPandaIDE/vcs/gitresetdialog.h create mode 100644 RedPandaIDE/vcs/gitresetdialog.ui diff --git a/NEWS.md b/NEWS.md index f98671f1..04927179 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ Red Panda C++ Version 0.14.4 - enhancement: git - log + - fix: error in templates + - enhancement: git - reset Red Panda C++ Version 0.14.3 - fix: wrong code completion font size, when screen dpi changed diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro index 48928ba0..155b41ab 100644 --- a/RedPandaIDE/RedPandaIDE.pro +++ b/RedPandaIDE/RedPandaIDE.pro @@ -96,6 +96,7 @@ SOURCES += \ vcs/gitmanager.cpp \ vcs/gitmergedialog.cpp \ vcs/gitrepository.cpp \ + vcs/gitresetdialog.cpp \ vcs/gitutils.cpp \ widgets/aboutdialog.cpp \ widgets/bookmarkmodel.cpp \ @@ -232,6 +233,7 @@ HEADERS += \ vcs/gitmanager.h \ vcs/gitmergedialog.h \ vcs/gitrepository.h \ + vcs/gitresetdialog.h \ vcs/gitutils.h \ widgets/aboutdialog.h \ widgets/bookmarkmodel.h \ @@ -330,6 +332,7 @@ FORMS += \ vcs/gitbranchdialog.ui \ vcs/gitlogdialog.ui \ vcs/gitmergedialog.ui \ + vcs/gitresetdialog.ui \ widgets/aboutdialog.ui \ widgets/cpudialog.ui \ mainwindow.ui \ diff --git a/RedPandaIDE/vcs/gitresetdialog.cpp b/RedPandaIDE/vcs/gitresetdialog.cpp new file mode 100644 index 00000000..dd4e5d0f --- /dev/null +++ b/RedPandaIDE/vcs/gitresetdialog.cpp @@ -0,0 +1,39 @@ +#include "gitresetdialog.h" +#include "ui_gitresetdialog.h" + +GitResetDialog::GitResetDialog(const QString& folder, QWidget *parent) : + QDialog(parent), + ui(new Ui::GitResetDialog), + mFolder(folder) +{ + ui->setupUi(this); +} + +GitResetDialog::~GitResetDialog() +{ + delete ui; +} + +int GitResetDialog::resetToCommit(const QString &commit) +{ + ui->rbBranch->setEnabled(false); + ui->cbBranches->setEnabled(false); + ui->rbTag->setEnabled(false); + ui->cbTags->setEnabled(false); + ui->rbCommit->setChecked(true); + ui->cbCommits->addItem(commit); + ui->rbMixed->setChecked(true); + return exec(); +} + +void GitResetDialog::on_btnOk_clicked() +{ + accept(); +} + + +void GitResetDialog::on_btnCancel_clicked() +{ + reject(); +} + diff --git a/RedPandaIDE/vcs/gitresetdialog.h b/RedPandaIDE/vcs/gitresetdialog.h new file mode 100644 index 00000000..2c29d04d --- /dev/null +++ b/RedPandaIDE/vcs/gitresetdialog.h @@ -0,0 +1,29 @@ +#ifndef GITRESETDIALOG_H +#define GITRESETDIALOG_H + +#include + +namespace Ui { +class GitResetDialog; +} + +class GitResetDialog : public QDialog +{ + Q_OBJECT + +public: + explicit GitResetDialog(const QString& folder, QWidget *parent = nullptr); + ~GitResetDialog(); + int resetToCommit(const QString& commit); + +private slots: + void on_btnOk_clicked(); + + void on_btnCancel_clicked(); + +private: + Ui::GitResetDialog *ui; + QString mFolder; +}; + +#endif // GITRESETDIALOG_H diff --git a/RedPandaIDE/vcs/gitresetdialog.ui b/RedPandaIDE/vcs/gitresetdialog.ui new file mode 100644 index 00000000..18083100 --- /dev/null +++ b/RedPandaIDE/vcs/gitresetdialog.ui @@ -0,0 +1,197 @@ + + + GitResetDialog + + + + 0 + 0 + 812 + 581 + + + + Reset + + + + + + Reset current branch "%1" to + + + + + + Branch + + + + + + + + 0 + 0 + + + + + + + + Tag + + + + + + + + + + Commit + + + + + + + + + + + + + Reset Type + + + + + + + 0 + 0 + + + + <html><head/><body><p>Leave working tree and index untouched</p></body></html> + + + true + + + + + + + <html><head/><body><p>Reset working tree and index (discarding local changes)</p></body></html> + + + true + + + + + + + Soft + + + + + + + Hard + + + + + + + Leave working tree untouched, reset index + + + true + + + + + + + Mixed + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Horizontal + + + + 585 + 20 + + + + + + + + Ok + + + + + + + Cancel + + + + + + + + + + + diff --git a/windows/templates/Jackpot.template b/windows/templates/Jackpot.template index cbf73766..27956791 100644 --- a/windows/templates/Jackpot.template +++ b/windows/templates/Jackpot.template @@ -15,5 +15,6 @@ Cpp=Jackpot_cpp.txt [Project] UnitCount=1 +IsCpp=1 Type=1 Icon=Games.ico