- fix: error in templates

- enhancement: git - reset
This commit is contained in:
Roy Qu 2022-02-22 09:16:20 +08:00
parent 13993bbc3c
commit b664094efc
6 changed files with 271 additions and 0 deletions

View File

@ -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

View File

@ -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 \

View File

@ -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();
}

View File

@ -0,0 +1,29 @@
#ifndef GITRESETDIALOG_H
#define GITRESETDIALOG_H
#include <QDialog>
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

View File

@ -0,0 +1,197 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GitResetDialog</class>
<widget class="QDialog" name="GitResetDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>812</width>
<height>581</height>
</rect>
</property>
<property name="windowTitle">
<string>Reset</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="grpTarget">
<property name="title">
<string>Reset current branch &quot;%1&quot; to</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QRadioButton" name="rbBranch">
<property name="text">
<string>Branch</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="cbBranches">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="rbTag">
<property name="text">
<string>Tag</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="cbTags"/>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="rbCommit">
<property name="text">
<string>Commit</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="cbCommits"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="grpOptions">
<property name="title">
<string>Reset Type</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="2">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Leave working tree and index untouched&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Reset working tree and index (discarding local changes)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QRadioButton" name="rbSoft">
<property name="text">
<string>Soft</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="rbHard">
<property name="text">
<string>Hard</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Leave working tree untouched, reset index</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="rbMixed">
<property name="text">
<string>Mixed</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>585</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnOk">
<property name="text">
<string>Ok</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnCancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -15,5 +15,6 @@ Cpp=Jackpot_cpp.txt
[Project]
UnitCount=1
IsCpp=1
Type=1
Icon=Games.ico