work save: icons for files tracked by git

This commit is contained in:
Roy Qu 2022-02-14 00:13:00 +08:00
parent 76ea34709d
commit 0d71282a1a
20 changed files with 993 additions and 50 deletions

View File

@ -139,6 +139,7 @@ SOURCES += \
widgets/coloredit.cpp \ widgets/coloredit.cpp \
widgets/consolewidget.cpp \ widgets/consolewidget.cpp \
widgets/customdisablediconengine.cpp \ widgets/customdisablediconengine.cpp \
widgets/customfilesystemmodel.cpp \
widgets/custommakefileinfodialog.cpp \ widgets/custommakefileinfodialog.cpp \
widgets/darkfusionstyle.cpp \ widgets/darkfusionstyle.cpp \
widgets/editorstabwidget.cpp \ widgets/editorstabwidget.cpp \
@ -270,6 +271,7 @@ HEADERS += \
widgets/coloredit.h \ widgets/coloredit.h \
widgets/consolewidget.h \ widgets/consolewidget.h \
widgets/customdisablediconengine.h \ widgets/customdisablediconengine.h \
widgets/customfilesystemmodel.h \
widgets/custommakefileinfodialog.h \ widgets/custommakefileinfodialog.h \
widgets/darkfusionstyle.h \ widgets/darkfusionstyle.h \
widgets/editorstabwidget.h \ widgets/editorstabwidget.h \

View File

@ -1,9 +1,15 @@
#include "customfileiconprovider.h" #include "customfileiconprovider.h"
#include "iconsmanager.h" #include "iconsmanager.h"
#include "vcs/gitmanager.h"
CustomFileIconProvider::CustomFileIconProvider() CustomFileIconProvider::CustomFileIconProvider()
{ {
mVCSManager = new GitManager();
}
CustomFileIconProvider::~CustomFileIconProvider()
{
delete mVCSManager;
} }
QIcon CustomFileIconProvider::icon(IconType type) const QIcon CustomFileIconProvider::icon(IconType type) const
@ -20,13 +26,55 @@ QIcon CustomFileIconProvider::icon(IconType type) const
QIcon CustomFileIconProvider::icon(const QFileInfo &info) const QIcon CustomFileIconProvider::icon(const QFileInfo &info) const
{ {
QIcon icon; QIcon icon;
if (isHFile(info.fileName())) if (info.isDir()) {
if (mVCSManager && mVCSManager->isFileInRepository(info)) {
if (mVCSManager->isFileInStaged(info))
icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FOLDER_VCS_STAGED);
else if (mVCSManager->isFileChanged(info))
icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FOLDER_VCS_CHANGED);
else
icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FOLDER_VCS_NOCHANGE);
} else
icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FOLDER);
} if (isHFile(info.fileName())) {
if (mVCSManager && mVCSManager->isFileInRepository(info)) {
if (mVCSManager->isFileInStaged(info))
icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_HFILE_VCS_STAGED);
else if (mVCSManager->isFileChanged(info))
icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_HFILE_VCS_CHANGED);
else
icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_HFILE_VCS_NOCHANGE);
} else
icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_HFILE); icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_HFILE);
else if (isCppFile(info.fileName())) { } else if (isCppFile(info.fileName())) {
if (mVCSManager && mVCSManager->isFileInRepository(info)) {
if (mVCSManager->isFileInStaged(info))
icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CPPFILE_VCS_STAGED);
else if (mVCSManager->isFileChanged(info))
icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CPPFILE_VCS_CHANGED);
else
icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CPPFILE_VCS_NOCHANGE);
} else
icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CPPFILE); icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CPPFILE);
} else if (isCFile(info.fileName())) { } else if (isCFile(info.fileName())) {
if (mVCSManager && mVCSManager->isFileInRepository(info)) {
if (mVCSManager->isFileInStaged(info))
icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CFILE_VCS_STAGED);
else if (mVCSManager->isFileChanged(info))
icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CFILE_VCS_CHANGED);
else
icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CFILE_VCS_NOCHANGE);
} else
icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CFILE); icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CFILE);
} else if (info.suffix()=="dev") { } else if (info.suffix()=="dev") {
if (mVCSManager && mVCSManager->isFileInRepository(info)) {
if (mVCSManager->isFileInStaged(info))
icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_PROJECTFILE_VCS_STAGED);
else if (mVCSManager->isFileChanged(info))
icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_PROJECTFILE_VCS_CHANGED);
else
icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_PROJECTFILE_VCS_NOCHANGE);
} else
icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_PROJECTFILE); icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_PROJECTFILE);
} }
if (!icon.isNull()) if (!icon.isNull())

View File

@ -3,11 +3,14 @@
#include <QFileIconProvider> #include <QFileIconProvider>
class GitManager;
class CustomFileIconProvider : public QFileIconProvider class CustomFileIconProvider : public QFileIconProvider
{ {
public: public:
CustomFileIconProvider(); CustomFileIconProvider();
~CustomFileIconProvider();
private:
GitManager* mVCSManager;
// QFileIconProvider interface // QFileIconProvider interface
public: public:
QIcon icon(IconType type) const override; QIcon icon(IconType type) const override;

View File

@ -181,11 +181,29 @@ void IconsManager::updateFileSystemIcons(const QString &iconSet, int size)
updateMakeDisabledIconDarker(iconSet); updateMakeDisabledIconDarker(iconSet);
mIconPixmaps.insert(FILESYSTEM_GIT, createSVGIcon(iconFolder+"git.svg",size,size)); mIconPixmaps.insert(FILESYSTEM_GIT, createSVGIcon(iconFolder+"git.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_FOLDER, createSVGIcon(iconFolder+"folder.svg",size,size)); mIconPixmaps.insert(FILESYSTEM_FOLDER, createSVGIcon(iconFolder+"folder.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_FOLDER_VCS_CHANGED, createSVGIcon(iconFolder+"folder-vcs-changed.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_FOLDER_VCS_NOCHANGE, createSVGIcon(iconFolder+"folder-vcs-nochange.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_FOLDER_VCS_STAGED, createSVGIcon(iconFolder+"folder-vcs-staged.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_FILE, createSVGIcon(iconFolder+"file.svg",size,size)); mIconPixmaps.insert(FILESYSTEM_FILE, createSVGIcon(iconFolder+"file.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_FILE_VCS_CHANGED, createSVGIcon(iconFolder+"file-vcs-changed.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_FILE_VCS_NOCHANGE, createSVGIcon(iconFolder+"file-vcs-nochange.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_FILE_VCS_STAGED, createSVGIcon(iconFolder+"file-vcs-staged.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_CFILE, createSVGIcon(iconFolder+"cfile.svg",size,size)); mIconPixmaps.insert(FILESYSTEM_CFILE, createSVGIcon(iconFolder+"cfile.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_CFILE_VCS_CHANGED, createSVGIcon(iconFolder+"cfile-vcs-changed.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_CFILE_VCS_NOCHANGE, createSVGIcon(iconFolder+"cfile-vcs-nochange.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_CFILE_VCS_STAGED, createSVGIcon(iconFolder+"cfile-vcs-staged.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_HFILE, createSVGIcon(iconFolder+"hfile.svg",size,size)); mIconPixmaps.insert(FILESYSTEM_HFILE, createSVGIcon(iconFolder+"hfile.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_HFILE_VCS_CHANGED, createSVGIcon(iconFolder+"hfile-vcs-changed.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_HFILE_VCS_NOCHANGE, createSVGIcon(iconFolder+"hfile-vcs-nochange.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_HFILE_VCS_STAGED, createSVGIcon(iconFolder+"hfile-vcs-staged.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_CPPFILE, createSVGIcon(iconFolder+"cppfile.svg",size,size)); mIconPixmaps.insert(FILESYSTEM_CPPFILE, createSVGIcon(iconFolder+"cppfile.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_CPPFILE_VCS_CHANGED, createSVGIcon(iconFolder+"cppfile-vcs-changed.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_CPPFILE_VCS_NOCHANGE, createSVGIcon(iconFolder+"cppfile-vcs-nochange.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_CPPFILE_VCS_STAGED, createSVGIcon(iconFolder+"cppfile-vcs-staged.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_PROJECTFILE, createSVGIcon(iconFolder+"projectfile.svg",size,size)); mIconPixmaps.insert(FILESYSTEM_PROJECTFILE, createSVGIcon(iconFolder+"projectfile.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_PROJECTFILE_VCS_CHANGED, createSVGIcon(iconFolder+"projectfile-vcs-changed.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_PROJECTFILE_VCS_NOCHANGE, createSVGIcon(iconFolder+"projectfile-vcs-nochange.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_PROJECTFILE_VCS_STAGED, createSVGIcon(iconFolder+"projectfile-vcs-staged.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_HEADERS_FOLDER, createSVGIcon(iconFolder+"headerfolder.svg",size,size)); mIconPixmaps.insert(FILESYSTEM_HEADERS_FOLDER, createSVGIcon(iconFolder+"headerfolder.svg",size,size));
mIconPixmaps.insert(FILESYSTEM_SOURCES_FOLDER, createSVGIcon(iconFolder+"sourcefolder.svg",size,size)); mIconPixmaps.insert(FILESYSTEM_SOURCES_FOLDER, createSVGIcon(iconFolder+"sourcefolder.svg",size,size));
} }

View File

@ -72,6 +72,24 @@ public:
FILESYSTEM_HFILE, FILESYSTEM_HFILE,
FILESYSTEM_PROJECTFILE, FILESYSTEM_PROJECTFILE,
FILESYSTEM_CPPFILE, FILESYSTEM_CPPFILE,
FILESYSTEM_FOLDER_VCS_CHANGED,
FILESYSTEM_FILE_VCS_CHANGED,
FILESYSTEM_CFILE_VCS_CHANGED,
FILESYSTEM_HFILE_VCS_CHANGED,
FILESYSTEM_PROJECTFILE_VCS_CHANGED,
FILESYSTEM_CPPFILE_VCS_CHANGED,
FILESYSTEM_FOLDER_VCS_NOCHANGE,
FILESYSTEM_FILE_VCS_NOCHANGE,
FILESYSTEM_CFILE_VCS_NOCHANGE,
FILESYSTEM_HFILE_VCS_NOCHANGE,
FILESYSTEM_PROJECTFILE_VCS_NOCHANGE,
FILESYSTEM_CPPFILE_VCS_NOCHANGE,
FILESYSTEM_FOLDER_VCS_STAGED,
FILESYSTEM_FILE_VCS_STAGED,
FILESYSTEM_CFILE_VCS_STAGED,
FILESYSTEM_HFILE_VCS_STAGED,
FILESYSTEM_PROJECTFILE_VCS_STAGED,
FILESYSTEM_CPPFILE_VCS_STAGED,
FILESYSTEM_HEADERS_FOLDER, FILESYSTEM_HEADERS_FOLDER,
FILESYSTEM_SOURCES_FOLDER, FILESYSTEM_SOURCES_FOLDER,

View File

@ -291,6 +291,9 @@
<property name="selectionMode"> <property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum> <enum>QAbstractItemView::ExtendedSelection</enum>
</property> </property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -573,6 +576,7 @@
<widget class="IssuesTable" name="tableIssues"> <widget class="IssuesTable" name="tableIssues">
<property name="font"> <property name="font">
<font> <font>
<weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
</property> </property>
@ -1418,7 +1422,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1114</width> <width>1114</width>
<height>25</height> <height>26</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="menuFile">

View File

@ -36,6 +36,7 @@
#include "customfileiconprovider.h" #include "customfileiconprovider.h"
#include <QMimeData> #include <QMimeData>
#include "settings.h" #include "settings.h"
#include "vcs/gitmanager.h"
Project::Project(const QString &filename, const QString &name, QObject *parent) : Project::Project(const QString &filename, const QString &name, QObject *parent) :
QObject(parent), QObject(parent),
@ -1909,6 +1910,12 @@ ProjectModel::ProjectModel(Project *project, QObject *parent):
mProject(project) mProject(project)
{ {
mUpdateCount = 0; mUpdateCount = 0;
mVCSManager = new GitManager();
}
ProjectModel::~ProjectModel()
{
delete mVCSManager;
} }
void ProjectModel::beginUpdate() void ProjectModel::beginUpdate()
@ -1980,13 +1987,25 @@ QVariant ProjectModel::data(const QModelIndex &index, int role) const
ProjectModelNode* p = static_cast<ProjectModelNode*>(index.internalPointer()); ProjectModelNode* p = static_cast<ProjectModelNode*>(index.internalPointer());
if (!p) if (!p)
return QVariant(); return QVariant();
if (role == Qt::DisplayRole || role==Qt::EditRole) { if (role == Qt::DisplayRole) {
if (p == mProject->rootNode().get()) {
QString branch;
if (mVCSManager->hasRepository(mProject->folder(),branch))
return QString("%1 [%2]").arg(p->text,branch);
}
return p->text;
} else if (role==Qt::EditRole) {
return p->text; return p->text;
} else if (role == Qt::DecorationRole) { } else if (role == Qt::DecorationRole) {
CustomFileIconProvider provider; CustomFileIconProvider provider;
QIcon icon; QIcon icon;
if (p->unitIndex>=0) { if (p->unitIndex>=0) {
icon = provider.icon(mProject->units()[p->unitIndex]->fileName()); icon = provider.icon(mProject->units()[p->unitIndex]->fileName());
} else {
if (p == mProject->rootNode().get()) {
QString branch;
if (mVCSManager->hasRepository(mProject->folder(),branch))
icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_GIT);
} else { } else {
switch(p->folderNodeType) { switch(p->folderNodeType) {
case ProjectSpecialFolderNode::HEADERS: case ProjectSpecialFolderNode::HEADERS:
@ -1998,6 +2017,7 @@ QVariant ProjectModel::data(const QModelIndex &index, int role) const
default: default:
icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FOLDER); icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FOLDER);
} }
}
if (icon.isNull()) if (icon.isNull())
icon = provider.icon(QFileIconProvider::Folder); icon = provider.icon(QFileIconProvider::Folder);
} }

View File

@ -101,16 +101,20 @@ private:
using PProjectUnit = std::shared_ptr<ProjectUnit>; using PProjectUnit = std::shared_ptr<ProjectUnit>;
class GitManager;
class ProjectModel : public QAbstractItemModel { class ProjectModel : public QAbstractItemModel {
Q_OBJECT Q_OBJECT
public: public:
explicit ProjectModel(Project* project, QObject* parent=nullptr); explicit ProjectModel(Project* project, QObject* parent=nullptr);
~ProjectModel();
void beginUpdate(); void beginUpdate();
void endUpdate(); void endUpdate();
private: private:
Project* mProject; Project* mProject;
GitManager *mVCSManager;
int mUpdateCount; int mUpdateCount;
// QAbstractItemModel interface // QAbstractItemModel interface
public: public:
QModelIndex index(int row, int column, const QModelIndex &parent) const override; QModelIndex index(int row, int column, const QModelIndex &parent) const override;
@ -143,7 +147,6 @@ protected:
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override; bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
}; };
class ProjectTemplate; class ProjectTemplate;
class Project : public QObject class Project : public QObject
{ {

View File

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="100"
height="100"
viewBox="0 0 26.458333 26.458333"
version="1.1"
id="svg5"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
sodipodi:docname="cfile-vcs-staged.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="px"
showgrid="false"
inkscape:zoom="5.786981"
inkscape:cx="90.375275"
inkscape:cy="91.325684"
inkscape:window-width="1920"
inkscape:window-height="1001"
inkscape:window-x="-9"
inkscape:window-y="-9"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
units="px"
width="100px" />
<defs
id="defs2">
<linearGradient
inkscape:collect="always"
id="linearGradient1420">
<stop
style="stop-color:#e0e0e0;stop-opacity:1;"
offset="0"
id="stop1416" />
<stop
style="stop-color:#ffffff;stop-opacity:1"
offset="1"
id="stop1418" />
</linearGradient>
<linearGradient
id="linearGradient3056"
inkscape:swatch="gradient">
<stop
style="stop-color:#45c200;stop-opacity:1"
offset="0"
id="stop826" />
<stop
style="stop-color:#53e900;stop-opacity:1"
offset="1"
id="stop828" />
</linearGradient>
<linearGradient
id="linearGradient3056-2">
<stop
style="stop-color:#45c200;stop-opacity:1"
offset="0"
id="stop3052" />
<stop
style="stop-color:#5fff07;stop-opacity:1"
offset="1"
id="stop3054" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient1420"
id="linearGradient1422"
x1="7.8442378"
y1="11.269956"
x2="1.9260681"
y2="11.269956"
gradientUnits="userSpaceOnUse" />
</defs>
<g
inkscape:label="图层 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g1755"
transform="matrix(1.1063575,0,0,1.1063575,-1.4148159,-1.417466)">
<path
id="rect848-1"
style="fill:url(#linearGradient1422);stroke:#000000;stroke-width:0.721591"
transform="matrix(1.1,0,0,1.1,2.6932117,0.93042432)"
d="M 1.8840514,1.3039001 H 12.125786 l 5.237068,5.830555 0.04157,14.1015569 H 1.8840514 Z"
sodipodi:nodetypes="cccccc" />
<path
style="fill:none;stroke:#000000;stroke-width:0.79375;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 16.031576,2.3647144 -0.02942,6.3678902 5.790196,0.04572"
id="path1641" />
</g>
<path
id="text2970"
style="font-size:11.2889px;line-height:1.25;font-family:sans-serif;fill:#2c4dff;fill-opacity:1;stroke-width:0.264583"
d="m 17.871271,15.28627 c -1.887338,0.06652 -3.603074,1.494063 -3.936045,3.365551 -0.463087,2.059085 0.04847,4.673412 2.097612,5.688699 1.792494,0.883972 3.920067,0.474864 5.615777,-0.439016 0,-0.716797 0,-1.433594 0,-2.150391 -0.618766,-0.132261 -1.068817,0.159596 -1.511718,0.554688 -1.184225,0.780728 -3.207312,0.799329 -3.851563,-0.685547 -0.52169,-1.285789 -0.483042,-3.088664 0.697266,-4.001953 1.247706,-0.776543 2.871086,-0.204218 3.873047,0.726562 0.794598,0.220511 0.900162,-0.248015 0.792968,-0.929297 -0.07567,-0.539614 0.278173,-1.350029 -0.481253,-1.457679 -1.015934,-0.506562 -2.16004,-0.763802 -3.296091,-0.671617 z" />
<text
xml:space="preserve"
style="font-size:28.2223px;line-height:1.25;font-family:sans-serif;stroke-width:0.264583"
x="-8.4125614"
y="18.471058"
id="text2432"><tspan
sodipodi:role="line"
id="tspan2430"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.264583"
x="-8.4125614"
y="18.471058" /></text>
<g
id="g11820">
<ellipse
style="fill:#0064ce;fill-opacity:0.725296;stroke-width:0.291041;stroke-linecap:round"
id="path857"
cx="6.7928686"
cy="19.202585"
rx="6.638608"
ry="7.0409479" />
<path
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.2794;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 2.3893594,17.71753 v 2.421467 h 3.166533 V 23.30553 H 8.1636255 V 20.138997 H 11.143892 V 17.71753 H 8.1636255 V 14.550997 H 5.5558924 v 3.166533 z"
id="path1359"
sodipodi:nodetypes="ccccccccccccc" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="100"
height="100"
viewBox="0 0 26.458333 26.458333"
version="1.1"
id="svg5"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
sodipodi:docname="cppfile-vcs-staged.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="px"
showgrid="false"
inkscape:zoom="0.36168631"
inkscape:cx="-464.4909"
inkscape:cy="192.15546"
inkscape:window-width="1920"
inkscape:window-height="1001"
inkscape:window-x="-9"
inkscape:window-y="-9"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
units="px"
width="100px" />
<defs
id="defs2">
<linearGradient
inkscape:collect="always"
id="linearGradient1420">
<stop
style="stop-color:#e0e0e0;stop-opacity:1;"
offset="0"
id="stop1416" />
<stop
style="stop-color:#ffffff;stop-opacity:1"
offset="1"
id="stop1418" />
</linearGradient>
<linearGradient
id="linearGradient3056"
inkscape:swatch="gradient">
<stop
style="stop-color:#45c200;stop-opacity:1"
offset="0"
id="stop826" />
<stop
style="stop-color:#53e900;stop-opacity:1"
offset="1"
id="stop828" />
</linearGradient>
<linearGradient
id="linearGradient3056-2">
<stop
style="stop-color:#45c200;stop-opacity:1"
offset="0"
id="stop3052" />
<stop
style="stop-color:#5fff07;stop-opacity:1"
offset="1"
id="stop3054" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient1420"
id="linearGradient1422"
x1="7.8442378"
y1="11.269956"
x2="1.9260681"
y2="11.269956"
gradientUnits="userSpaceOnUse" />
</defs>
<g
inkscape:label="图层 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g1755"
transform="matrix(1.1063575,0,0,1.1063575,-1.4148159,-1.417466)">
<path
id="rect848-1"
style="fill:url(#linearGradient1422);stroke:#000000;stroke-width:0.721591"
transform="matrix(1.1,0,0,1.1,2.6932117,0.93042432)"
d="M 1.8840514,1.3039001 H 12.125786 l 5.237068,5.830555 0.04157,14.1015569 H 1.8840514 Z"
sodipodi:nodetypes="cccccc" />
<path
style="fill:none;stroke:#000000;stroke-width:0.79375;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 16.031576,2.3647144 -0.02942,6.3678902 5.790196,0.04572"
id="path1641" />
</g>
<path
id="text2970"
style="font-size:11.2889px;line-height:1.25;font-family:sans-serif;fill:#2c4dff;fill-opacity:1;stroke-width:0.264583"
d="m 14.167102,15.28627 c -1.887338,0.06652 -3.603074,1.494063 -3.936045,3.365551 -0.4630867,2.059085 0.04847,4.673412 2.097612,5.688699 1.792494,0.883972 3.920067,0.474864 5.615777,-0.439016 0,-0.716797 0,-1.433594 0,-2.150391 -0.618766,-0.132261 -1.068817,0.159596 -1.511718,0.554688 -1.184225,0.780728 -3.207312,0.799329 -3.851563,-0.685547 -0.52169,-1.285789 -0.483042,-3.088664 0.697266,-4.001953 1.247706,-0.776543 2.871086,-0.204218 3.873047,0.726562 0.794598,0.220511 0.900162,-0.248015 0.792968,-0.929297 -0.07567,-0.539614 0.278173,-1.350029 -0.481253,-1.457679 -1.015934,-0.506562 -2.16004,-0.763802 -3.296091,-0.671617 z" />
<text
xml:space="preserve"
style="font-size:10.0971px;line-height:1.25;font-family:sans-serif;stroke-width:0.23665"
x="18.716648"
y="21.428247"
id="text11617"
transform="scale(0.89442719,1.118034)"><tspan
sodipodi:role="line"
id="tspan11615"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:10.0971px;font-family:'Fira Code';-inkscape-font-specification:'Fira Code Bold';fill:#3f53ff;fill-opacity:1;stroke-width:0.23665"
x="18.716648"
y="21.428247">+</tspan></text>
<text
xml:space="preserve"
style="font-size:10.0971px;line-height:1.25;font-family:sans-serif;stroke-width:0.23665"
x="24.291918"
y="21.393011"
id="text11617-3"
transform="scale(0.89442719,1.118034)"><tspan
sodipodi:role="line"
id="tspan11615-1"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:10.0971px;font-family:'Fira Code';-inkscape-font-specification:'Fira Code Bold';fill:#3f53ff;fill-opacity:1;stroke-width:0.23665"
x="24.291918"
y="21.393011">+</tspan></text>
<g
id="g11820"
transform="translate(-0.11768368)">
<ellipse
style="fill:#0064ce;fill-opacity:0.725296;stroke-width:0.291041;stroke-linecap:round"
id="path857"
cx="6.7928686"
cy="19.202585"
rx="6.638608"
ry="7.0409479" />
<path
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.2794;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 2.3893594,17.71753 v 2.421467 h 3.166533 V 23.30553 H 8.1636255 V 20.138997 H 11.143892 V 17.71753 H 8.1636255 V 14.550997 H 5.5558924 v 3.166533 z"
id="path1359"
sodipodi:nodetypes="ccccccccccccc" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="100"
height="100"
viewBox="0 0 26.458333 26.458333"
version="1.1"
id="svg5"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
sodipodi:docname="file-vcs-staged.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="px"
showgrid="false"
inkscape:zoom="5.786981"
inkscape:cx="23.846631"
inkscape:cy="58.147763"
inkscape:window-width="1920"
inkscape:window-height="1001"
inkscape:window-x="-9"
inkscape:window-y="-9"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
units="px"
width="100px" />
<defs
id="defs2">
<linearGradient
inkscape:collect="always"
id="linearGradient1420">
<stop
style="stop-color:#e0e0e0;stop-opacity:1;"
offset="0"
id="stop1416" />
<stop
style="stop-color:#ffffff;stop-opacity:1"
offset="1"
id="stop1418" />
</linearGradient>
<linearGradient
id="linearGradient3056"
inkscape:swatch="gradient">
<stop
style="stop-color:#45c200;stop-opacity:1"
offset="0"
id="stop826" />
<stop
style="stop-color:#53e900;stop-opacity:1"
offset="1"
id="stop828" />
</linearGradient>
<linearGradient
id="linearGradient3056-2">
<stop
style="stop-color:#45c200;stop-opacity:1"
offset="0"
id="stop3052" />
<stop
style="stop-color:#5fff07;stop-opacity:1"
offset="1"
id="stop3054" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient1420"
id="linearGradient1422"
x1="7.8442378"
y1="11.269956"
x2="1.9260681"
y2="11.269956"
gradientUnits="userSpaceOnUse" />
</defs>
<g
inkscape:label="图层 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g1755"
transform="matrix(1.1063575,0,0,1.1063575,-1.4148159,-1.417466)">
<path
id="rect848-1"
style="fill:url(#linearGradient1422);stroke:#000000;stroke-width:0.721591"
transform="matrix(1.1,0,0,1.1,2.6932117,0.93042432)"
d="M 1.8840514,1.3039001 H 12.125786 l 5.237068,5.830555 0.04157,14.1015569 H 1.8840514 Z"
sodipodi:nodetypes="cccccc" />
<path
style="fill:none;stroke:#000000;stroke-width:0.79375;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 16.031576,2.3647144 -0.02942,6.3678902 5.790196,0.04572"
id="path1641" />
</g>
<g
id="g11820"
transform="translate(0.20235885,-0.04572)">
<ellipse
style="fill:#0064ce;fill-opacity:0.725296;stroke-width:0.291041;stroke-linecap:round"
id="path857"
cx="6.7928686"
cy="19.202585"
rx="6.638608"
ry="7.0409479" />
<path
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.2794;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 2.3893594,17.71753 v 2.421467 h 3.166533 V 23.30553 H 8.1636255 V 20.138997 H 11.143892 V 17.71753 H 8.1636255 V 14.550997 H 5.5558924 v 3.166533 z"
id="path1359"
sodipodi:nodetypes="ccccccccccccc" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="100"
height="100"
viewBox="0 0 26.458333 26.458333"
version="1.1"
id="svg5"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
sodipodi:docname="folder-vcs-staged.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="px"
showgrid="false"
inkscape:zoom="2.8934905"
inkscape:cx="137.20453"
inkscape:cy="3.6288351"
inkscape:window-width="1920"
inkscape:window-height="1001"
inkscape:window-x="-9"
inkscape:window-y="-9"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
units="px"
width="100px" />
<defs
id="defs2">
<linearGradient
id="linearGradient3056"
inkscape:swatch="gradient">
<stop
style="stop-color:#45c200;stop-opacity:1"
offset="0"
id="stop826" />
<stop
style="stop-color:#53e900;stop-opacity:1"
offset="1"
id="stop828" />
</linearGradient>
<linearGradient
id="linearGradient3056-2">
<stop
style="stop-color:#45c200;stop-opacity:1"
offset="0"
id="stop3052" />
<stop
style="stop-color:#5fff07;stop-opacity:1"
offset="1"
id="stop3054" />
</linearGradient>
</defs>
<g
inkscape:label="图层 1"
inkscape:groupmode="layer"
id="layer1">
<path
id="rect934"
style="fill:#fcbc4c;fill-opacity:1;stroke:#000000;stroke-width:0.264583;stroke-miterlimit:4;stroke-dasharray:none"
d="m 21.841622,20.018092 0.02129,-5.348279 c -0.02157,-1.176532 -1.20298,-1.844222 -2.462226,-1.92922 l -0.0078,-10.881251 c 0.06287,-0.93528202 0.02037,-0.88955502 -0.860969,-0.88955502 H 5.0236538 V 21.743666 L 19.214695,21.70355 c 1.6677,-0.09916 2.57977,-0.603319 2.626927,-1.685458 z"
sodipodi:nodetypes="ccccccccc" />
<path
style="fill:#fdd99b;fill-opacity:1;stroke:#000000;stroke-width:0.200279;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 5.0150948,0.97094743 V 21.744888 l 6.1295632,3.630798 c 0.501856,0.355154 0.457316,0.283463 0.458431,-0.602532 l 0.02342,-18.6159782 c 0.04803,-0.8264309 -0.02852,-0.8256775 -0.44161,-1.0993086 z"
id="path6014"
sodipodi:nodetypes="ccccccc" />
<g
id="g11820"
transform="translate(0.26755821,-0.34628438)">
<ellipse
style="fill:#0064ce;fill-opacity:0.725296;stroke-width:0.291041;stroke-linecap:round"
id="path857"
cx="6.7928686"
cy="19.202585"
rx="6.638608"
ry="7.0409479" />
<path
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.2794;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 2.3893594,17.71753 v 2.421467 h 3.166533 V 23.30553 H 8.1636255 V 20.138997 H 11.143892 V 17.71753 H 8.1636255 V 14.550997 H 5.5558924 v 3.166533 z"
id="path1359"
sodipodi:nodetypes="ccccccccccccc" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="100"
height="100"
viewBox="0 0 26.458333 26.458333"
version="1.1"
id="svg5"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
sodipodi:docname="hfile-vcs-staged.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="px"
showgrid="false"
inkscape:zoom="2"
inkscape:cx="136"
inkscape:cy="90.75"
inkscape:window-width="1920"
inkscape:window-height="1001"
inkscape:window-x="-9"
inkscape:window-y="-9"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
units="px"
width="100px" />
<defs
id="defs2">
<linearGradient
inkscape:collect="always"
id="linearGradient1420">
<stop
style="stop-color:#e0e0e0;stop-opacity:1;"
offset="0"
id="stop1416" />
<stop
style="stop-color:#ffffff;stop-opacity:1"
offset="1"
id="stop1418" />
</linearGradient>
<linearGradient
id="linearGradient3056"
inkscape:swatch="gradient">
<stop
style="stop-color:#45c200;stop-opacity:1"
offset="0"
id="stop826" />
<stop
style="stop-color:#53e900;stop-opacity:1"
offset="1"
id="stop828" />
</linearGradient>
<linearGradient
id="linearGradient3056-2">
<stop
style="stop-color:#45c200;stop-opacity:1"
offset="0"
id="stop3052" />
<stop
style="stop-color:#5fff07;stop-opacity:1"
offset="1"
id="stop3054" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient1420"
id="linearGradient1422"
x1="7.8442378"
y1="11.269956"
x2="1.9260681"
y2="11.269956"
gradientUnits="userSpaceOnUse" />
</defs>
<g
inkscape:label="图层 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g1755"
transform="matrix(1.1063575,0,0,1.1063575,-1.4148159,-1.417466)">
<path
id="rect848-1"
style="fill:url(#linearGradient1422);stroke:#000000;stroke-width:0.721591"
transform="matrix(1.1,0,0,1.1,2.6932117,0.93042432)"
d="M 1.8840514,1.3039001 H 12.125786 l 5.237068,5.830555 0.04157,14.1015569 H 1.8840514 Z"
sodipodi:nodetypes="cccccc" />
<path
style="fill:none;stroke:#000000;stroke-width:0.79375;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 16.031576,2.3647144 -0.02942,6.3678902 5.790196,0.04572"
id="path1641" />
</g>
<path
id="text18521"
style="font-size:11.2889px;line-height:1.25;font-family:sans-serif;fill:#ff2c2c;fill-opacity:1;stroke-width:0.327221"
d="m 13.621094,12.693359 c 0,3.692058 0,7.384115 0,11.076172 0.863932,0 1.727864,0 2.591797,0 0.0028,-1.897806 -0.01063,-3.795701 0.01953,-5.693359 0.718798,-0.392097 1.983401,-0.700116 2.361328,0.289062 0.177294,1.785387 0.06063,3.605548 0.08984,5.404297 0.867187,0 1.734375,0 2.601562,0 -0.06524,-2.23573 0.202906,-4.506102 -0.186247,-6.716994 -0.48144,-1.572364 -2.494337,-2.11523 -3.859818,-1.360524 -0.550612,0.282215 -1.280247,0.861239 -1.0262,-0.173263 0,-0.990625 0,-1.98125 0,-2.971875 -0.863933,0 -1.727865,0 -2.591797,0 v 0.1 z" />
<g
id="g11820"
transform="translate(-0.04599342,-0.15258501)">
<ellipse
style="fill:#0064ce;fill-opacity:0.725296;stroke-width:0.291041;stroke-linecap:round"
id="path857"
cx="6.7928686"
cy="19.202585"
rx="6.638608"
ry="7.0409479" />
<path
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.2794;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 2.3893594,17.71753 v 2.421467 h 3.166533 V 23.30553 H 8.1636255 V 20.138997 H 11.143892 V 17.71753 H 8.1636255 V 14.550997 H 5.5558924 v 3.166533 z"
id="path1359"
sodipodi:nodetypes="ccccccccccccc" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -0,0 +1,166 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="100"
height="100"
viewBox="0 0 26.458333 26.458333"
version="1.1"
id="svg5"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
sodipodi:docname="projectfile-vcs-staged.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="px"
showgrid="false"
inkscape:zoom="5.786981"
inkscape:cx="21.427407"
inkscape:cy="58.147763"
inkscape:window-width="1920"
inkscape:window-height="1001"
inkscape:window-x="-9"
inkscape:window-y="-9"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
units="px"
width="100px" />
<defs
id="defs2">
<linearGradient
inkscape:collect="always"
id="linearGradient1420">
<stop
style="stop-color:#e0e0e0;stop-opacity:1;"
offset="0"
id="stop1416" />
<stop
style="stop-color:#ffffff;stop-opacity:1"
offset="1"
id="stop1418" />
</linearGradient>
<linearGradient
id="linearGradient3056"
inkscape:swatch="gradient">
<stop
style="stop-color:#45c200;stop-opacity:1"
offset="0"
id="stop826" />
<stop
style="stop-color:#53e900;stop-opacity:1"
offset="1"
id="stop828" />
</linearGradient>
<linearGradient
id="linearGradient3056-2">
<stop
style="stop-color:#45c200;stop-opacity:1"
offset="0"
id="stop3052" />
<stop
style="stop-color:#5fff07;stop-opacity:1"
offset="1"
id="stop3054" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient1420"
id="linearGradient1422"
x1="7.8442378"
y1="11.269956"
x2="1.9260681"
y2="11.269956"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient1420"
id="linearGradient1422-8"
x1="7.8442378"
y1="11.269956"
x2="1.9260681"
y2="11.269956"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient1420"
id="linearGradient1422-6"
x1="7.8442378"
y1="11.269956"
x2="1.9260681"
y2="11.269956"
gradientUnits="userSpaceOnUse" />
</defs>
<g
inkscape:label="图层 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g1755"
transform="matrix(0.89614957,0,0,0.89614957,5.9992311,-0.90196801)">
<path
id="rect848-1"
style="fill:url(#linearGradient1422);stroke:#000000;stroke-width:0.721591"
transform="matrix(1.1,0,0,1.1,2.6932117,0.93042432)"
d="M 1.8840514,1.3039001 H 12.125786 l 5.237068,5.830555 0.04157,14.1015569 H 1.8840514 Z"
sodipodi:nodetypes="cccccc" />
<path
style="fill:none;stroke:#000000;stroke-width:0.79375;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 16.031576,2.3647144 -0.02942,6.3678902 5.790196,0.04572"
id="path1641" />
</g>
<g
id="g1755-7"
transform="matrix(0.89614957,0,0,0.89614957,1.8865805,1.8185308)">
<path
id="rect848-1-2"
style="fill:url(#linearGradient1422-8);stroke:#000000;stroke-width:0.721591"
transform="matrix(1.1,0,0,1.1,2.6932117,0.93042432)"
d="M 1.8840514,1.3039001 H 12.125786 l 5.237068,5.830555 0.04157,14.1015569 H 1.8840514 Z"
sodipodi:nodetypes="cccccc" />
<path
style="fill:none;stroke:#000000;stroke-width:0.79375;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 16.031576,2.3647144 -0.02942,6.3678902 5.790196,0.04572"
id="path1641-1" />
</g>
<g
id="g1755-2"
transform="matrix(0.89614957,0,0,0.89614957,-2.9140658,3.9216711)">
<path
id="rect848-1-28"
style="fill:url(#linearGradient1422-6);stroke:#000000;stroke-width:0.721591"
transform="matrix(1.1,0,0,1.1,2.6932117,0.93042432)"
d="M 1.8840514,1.3039001 H 12.125786 l 5.237068,5.830555 0.04157,14.1015569 H 1.8840514 Z"
sodipodi:nodetypes="cccccc" />
<path
style="fill:none;stroke:#000000;stroke-width:0.79375;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 16.031576,2.3647144 -0.02942,6.3678902 5.790196,0.04572"
id="path1641-9" />
</g>
<g
id="g11820"
transform="translate(-0.02624322,0.07196269)">
<ellipse
style="fill:#0064ce;fill-opacity:0.725296;stroke-width:0.291041;stroke-linecap:round"
id="path857"
cx="6.7928686"
cy="19.202585"
rx="6.638608"
ry="7.0409479" />
<path
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.2794;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 2.3893594,17.71753 v 2.421467 h 3.166533 V 23.30553 H 8.1636255 V 20.138997 H 11.143892 V 17.71753 H 8.1636255 V 14.550997 H 5.5558924 v 3.166533 z"
id="path1359"
sodipodi:nodetypes="ccccccccccccc" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -28,6 +28,7 @@ void ToolsGitWidget::doLoad()
void ToolsGitWidget::doSave() void ToolsGitWidget::doSave()
{ {
pSettings->vcs().setGitPath(ui->txtGitPath->text()); pSettings->vcs().setGitPath(ui->txtGitPath->text());
pSettings->vcs().save();
} }
void ToolsGitWidget::updateIcons(const QSize &size) void ToolsGitWidget::updateIcons(const QSize &size)

View File

@ -1,34 +1,74 @@
#include "gitmanager.h" #include "gitmanager.h"
#include "../utils.h" #include "../utils.h"
#include "../settings.h"
#include <QFileInfo> #include <QFileInfo>
GitManager::GitManager(QObject *parent) : QObject(parent), GitManager::GitManager(QObject *parent) : QObject(parent)
mGitPathValid(false)
{ {
} }
bool GitManager::gitPathValid() const
{
return mGitPathValid;
}
void GitManager::createRepository(const QString &folder) void GitManager::createRepository(const QString &folder)
{ {
if (hasRepository(folder)) QString currentBranch;
if (hasRepository(folder,currentBranch))
throw GitError(tr("Folder \"%1\" already has a repository!")); throw GitError(tr("Folder \"%1\" already has a repository!"));
QStringList args; QStringList args;
args.append("init"); args.append("init");
runGit(folder,args); runGit(folder,args);
} }
bool GitManager::hasRepository(const QString &folder) bool GitManager::hasRepository(const QString &folder, QString& currentBranch)
{ {
QStringList args; QStringList args;
args.append("status"); args.append("status");
args.append("-b");
args.append("-u");
args.append("no");
args.append("--ignored=no");
QString output = runGit(folder,args); QString output = runGit(folder,args);
return !output.startsWith("fatal:"); bool result = output.startsWith("On branch");
if (result) {
int pos = QString("On branch").length();
while (pos<output.length() && output[pos].isSpace())
pos++;
int endPos = pos;
while (endPos<output.length() && !output[endPos].isSpace())
endPos++;
currentBranch = output.mid(pos,endPos-pos);
}
return result;
}
bool GitManager::isFileInRepository(const QFileInfo& fileInfo)
{
QStringList args;
args.append("ls-files");
args.append(fileInfo.fileName());
QString output = runGit(fileInfo.absolutePath(),args);
return output.trimmed() == fileInfo.fileName();
}
bool GitManager::isFileInStaged(const QFileInfo &fileInfo)
{
QStringList args;
args.append("diff");
args.append("--staged");
args.append("--name-only");
args.append(fileInfo.fileName());
QString output = runGit(fileInfo.absolutePath(),args);
return output.trimmed() == fileInfo.fileName();
}
bool GitManager::isFileChanged(const QFileInfo &fileInfo)
{
QStringList args;
args.append("diff");
args.append("--name-only");
args.append(fileInfo.fileName());
QString output = runGit(fileInfo.absolutePath(),args);
return output.trimmed() == fileInfo.fileName();
} }
void GitManager::add(const QString &folder, const QString &path) void GitManager::add(const QString &folder, const QString &path)
@ -121,30 +161,22 @@ void GitManager::reset(const QString &folder, const QString &commit, GitResetStr
runGit(folder,args); runGit(folder,args);
} }
void GitManager::validate()
{
QStringList args;
args.append("--version");
QString output = runGit("",args);
mGitPathValid = output.startsWith("git version");
}
QString GitManager::runGit(const QString& workingFolder, const QStringList &args) QString GitManager::runGit(const QString& workingFolder, const QStringList &args)
{ {
QFileInfo fileInfo(mGitPath); QFileInfo fileInfo(pSettings->vcs().gitPath());
if (!fileInfo.exists()) if (!fileInfo.exists())
throw GitError("fatal: git doesn't exist"); return "fatal: git doesn't exist";
emit gitCmdRunning(QString("Running in \"%1\": \n \"%2\" \"%3\"") emit gitCmdRunning(QString("Running in \"%1\": \n \"%2\" \"%3\"")
.arg(workingFolder, .arg(workingFolder,
mGitPath, pSettings->vcs().gitPath(),
args.join("\" \""))); args.join("\" \"")));
QString output = runAndGetOutput( QString output = runAndGetOutput(
fileInfo.absoluteFilePath(), fileInfo.absoluteFilePath(),
workingFolder, workingFolder,
args); args);
emit gitCmdFinished(output); emit gitCmdFinished(output);
if (output.startsWith("fatal:")) // if (output.startsWith("fatal:"))
throw GitError(output); // throw GitError(output);
return output; return output;
} }

View File

@ -2,6 +2,7 @@
#define GITMANAGER_H #define GITMANAGER_H
#include <QObject> #include <QObject>
#include <QFileInfo>
#include "utils.h" #include "utils.h"
#include "gitrepository.h" #include "gitrepository.h"
@ -17,9 +18,12 @@ public:
explicit GitManager(QObject *parent = nullptr); explicit GitManager(QObject *parent = nullptr);
bool gitPathValid() const;
void createRepository(const QString& folder); void createRepository(const QString& folder);
bool hasRepository(const QString& folder); bool hasRepository(const QString& folder, QString& currentBranch);
bool isFileInRepository(const QFileInfo& fileInfo);
bool isFileInStaged(const QFileInfo& fileInfo);
bool isFileChanged(const QFileInfo& fileInfo);
void add(const QString& folder, const QString& path); void add(const QString& folder, const QString& path);
void remove(const QString& folder, const QString& path); void remove(const QString& folder, const QString& path);
@ -36,11 +40,8 @@ signals:
void gitCmdRunning(const QString& gitCmd); void gitCmdRunning(const QString& gitCmd);
void gitCmdFinished(const QString& message); void gitCmdFinished(const QString& message);
private: private:
void validate();
QString runGit(const QString& workingFolder, const QStringList& args); QString runGit(const QString& workingFolder, const QStringList& args);
private: private:
QString mGitPath;
bool mGitPathValid;
}; };
#endif // GITMANAGER_H #endif // GITMANAGER_H

View File

@ -19,9 +19,9 @@ void GitRepository::createRepository()
mManager->createRepository(mFolder); mManager->createRepository(mFolder);
} }
bool GitRepository::hasRepository() bool GitRepository::hasRepository(QString& currentBranch)
{ {
return mManager->hasRepository(mFolder); return mManager->hasRepository(mFolder, currentBranch);
} }
void GitRepository::add(const QString &path) void GitRepository::add(const QString &path)
@ -82,3 +82,8 @@ void GitRepository::setManager(GitManager *newManager)
Q_ASSERT(newManager!=nullptr); Q_ASSERT(newManager!=nullptr);
mManager = newManager; mManager = newManager;
} }
void GitRepository::setFolder(const QString &newFolder)
{
mFolder = newFolder;
}

View File

@ -22,7 +22,7 @@ public:
const QString &folder() const; const QString &folder() const;
void createRepository(); void createRepository();
bool hasRepository(); bool hasRepository(QString& currentBranch);
void add(const QString& path); void add(const QString& path);
void remove(const QString& path); void remove(const QString& path);
@ -38,6 +38,8 @@ public:
GitManager *manager() const; GitManager *manager() const;
void setManager(GitManager *newManager); void setManager(GitManager *newManager);
void setFolder(const QString &newFolder);
signals: signals:
private: private:
QString mFolder; QString mFolder;