fix: error in icons

fix: icons in files view not changed, when icon set is changed
 work save: git merge and branch
This commit is contained in:
royqh1979@gmail.com 2022-02-21 09:48:04 +08:00
parent 63b277d843
commit 56d8616a5f
9 changed files with 197 additions and 68 deletions

View File

@ -667,6 +667,7 @@ void MainWindow::applySettings()
//icon sets for files view
pIconsManager->updateFileSystemIcons(pSettings->environment().iconSet(),pointToPixel(pSettings->environment().interfaceFontSize()));
setFilesViewRoot(mFileSystemModel.rootPath());
// for (int i=0;i<ui->cbFilesPath->count();i++) {
// ui->cbFilesPath->setItemIcon(i,pIconsManager->getIcon(IconsManager::FILESYSTEM_GIT));
// }
@ -764,10 +765,10 @@ void MainWindow::onFileSaved(const QString &path, bool inProject)
if (!inProject) {
if ( (isCFile(path) || isHFile(path))
&& !mFileSystemModelIconProvider.VCSRepository()->isFileInRepository(path)) {
mFileSystemModelIconProvider.VCSRepository()->add(extractRelativePath(mFileSystemModelIconProvider.VCSRepository()->folder(),path));
}
}
// qDebug()<<"update icon provider";
mFileSystemModelIconProvider.update();
mFileSystemModel.setIconProvider(&mFileSystemModelIconProvider);
ui->treeFiles->update(index);
@ -3091,7 +3092,7 @@ void MainWindow::onProjectViewContextMenu(const QPoint &pos)
vcsMenu.addAction(ui->actionGit_Restore);
bool canBranch = !mProject->model()->iconProvider()->VCSRepository()->hasChangedFiles()
&& !mProject->model()->iconProvider()->VCSRepository()->hasChangedFiles();
&& !mProject->model()->iconProvider()->VCSRepository()->hasStagedFiles();
ui->actionGit_Merge->setEnabled(canBranch);
ui->actionGit_Commit->setEnabled(canBranch);
ui->actionGit_Branch->setEnabled(true);
@ -3206,7 +3207,7 @@ void MainWindow::onFilesViewContextMenu(const QPoint &pos)
vcsMenu.addAction(ui->actionGit_Restore);
bool canBranch = !mFileSystemModelIconProvider.VCSRepository()->hasChangedFiles()
&& !mFileSystemModelIconProvider.VCSRepository()->hasChangedFiles();
&& !mFileSystemModelIconProvider.VCSRepository()->hasStagedFiles();
ui->actionGit_Branch->setEnabled(canBranch);
ui->actionGit_Merge->setEnabled(canBranch);
ui->actionGit_Commit->setEnabled(true);
@ -5714,14 +5715,14 @@ void MainWindow::updateVCSActions()
hasRepository = vcsManager.hasRepository(mProject->folder(),branch);
shouldEnable = true;
canBranch = !mProject->model()->iconProvider()->VCSRepository()->hasChangedFiles()
&& !mProject->model()->iconProvider()->VCSRepository()->hasChangedFiles();
&& !mProject->model()->iconProvider()->VCSRepository()->hasStagedFiles();
} else if (ui->treeFiles->isVisible()) {
GitManager vcsManager;
QString branch;
hasRepository = vcsManager.hasRepository(pSettings->environment().currentFolder(),branch);
shouldEnable = true;
canBranch =!mFileSystemModelIconProvider.VCSRepository()->hasChangedFiles()
&& !mFileSystemModelIconProvider.VCSRepository()->hasChangedFiles();
&& !mFileSystemModelIconProvider.VCSRepository()->hasStagedFiles();
}
ui->actionGit_Create_Repository->setEnabled(!hasRepository && shouldEnable);
ui->actionGit_Commit->setEnabled(hasRepository && shouldEnable);

View File

@ -24,7 +24,7 @@
inkscape:pagecheckerboard="false"
showgrid="false"
inkscape:zoom="8.2024385"
inkscape:cx="-4.7546836"
inkscape:cx="-4.6327687"
inkscape:cy="17.616712"
inkscape:window-width="1920"
inkscape:window-height="1001"
@ -71,15 +71,15 @@
<text
xml:space="preserve"
style="font-size:20.813px;line-height:1.25;font-family:sans-serif;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.650406"
x="5.3978534"
y="45.614185"
x="8.2130604"
y="45.971664"
id="text7085"
transform="scale(1.0690363,0.93542194)"><tspan
sodipodi:role="line"
id="tspan7083"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Fira Code';-inkscape-font-specification:'Fira Code Bold';fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.650406;stroke-opacity:1"
x="5.3978534"
y="45.614185">!</tspan></text>
x="8.2130604"
y="45.971664">!</tspan></text>
<ellipse
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:2.46857;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path17711"

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -67,15 +67,15 @@
<text
xml:space="preserve"
style="font-size:20.813px;line-height:1.25;font-family:sans-serif;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.650406"
x="5.3978534"
y="45.614185"
x="8.3694601"
y="45.792927"
id="text7085"
transform="scale(1.0690363,0.93542194)"><tspan
sodipodi:role="line"
id="tspan7083"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Fira Code';-inkscape-font-specification:'Fira Code Bold';fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.650406;stroke-opacity:1"
x="5.3978534"
y="45.614185">!</tspan></text>
x="8.3694601"
y="45.792927">!</tspan></text>
<ellipse
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:2.46857;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path17711"

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -24,7 +24,7 @@
inkscape:pagecheckerboard="false"
showgrid="false"
inkscape:zoom="11.6"
inkscape:cx="29.310345"
inkscape:cx="29.396552"
inkscape:cy="22.887931"
inkscape:window-width="1920"
inkscape:window-height="1001"
@ -64,19 +64,17 @@
style="stroke-width:1.37143"
x="15.724138"
y="20.571428">!</tspan></text>
<g
id="g831">
<text
xml:space="preserve"
style="font-size:20.813px;line-height:1.25;font-family:sans-serif;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.650406"
x="5.3978534"
x="8.1626472"
y="45.614185"
id="text7085"
transform="scale(1.0690363,0.93542194)"><tspan
sodipodi:role="line"
id="tspan7083"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Fira Code';-inkscape-font-specification:'Fira Code Bold';fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.650406;stroke-opacity:1"
x="5.3978534"
x="8.1626472"
y="45.614185">!</tspan></text>
<ellipse
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:2.46857;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
@ -85,5 +83,4 @@
cy="35.586208"
rx="10.758621"
ry="10.604926" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -40,27 +40,23 @@
stroke-linejoin="round"
id="path2"
sodipodi:nodetypes="cssccssssc" />
<g
id="g831"
transform="translate(-0.23645471,-1.4187207)">
<text
xml:space="preserve"
style="font-size:20.813px;line-height:1.25;font-family:sans-serif;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.650406"
x="5.3978534"
y="45.614185"
x="7.9414625"
y="44.603077"
id="text7085"
transform="scale(1.0690363,0.93542194)"><tspan
sodipodi:role="line"
id="tspan7083"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Fira Code';-inkscape-font-specification:'Fira Code Bold';fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.650406;stroke-opacity:1"
x="5.3978534"
y="45.614185">!</tspan></text>
x="7.9414625"
y="44.603077">!</tspan></text>
<ellipse
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:2.46857;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path17711"
cx="12.650248"
cy="35.586208"
cx="12.413793"
cy="34.167488"
rx="10.758621"
ry="10.604926" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -67,15 +67,15 @@
<text
xml:space="preserve"
style="font-size:20.813px;line-height:1.25;font-family:sans-serif;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.650406"
x="5.3978534"
y="45.614185"
x="8.2732391"
y="46.372517"
id="text7085"
transform="scale(1.0690363,0.93542194)"><tspan
sodipodi:role="line"
id="tspan7083"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Fira Code';-inkscape-font-specification:'Fira Code Bold';fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.650406;stroke-opacity:1"
x="5.3978534"
y="45.614185">!</tspan></text>
x="8.2732391"
y="46.372517">!</tspan></text>
<ellipse
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:2.46857;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path17711"

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -78,13 +78,13 @@
<text
xml:space="preserve"
style="font-size:19.7724px;line-height:1.25;font-family:sans-serif;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.617886"
x="6.9660273"
y="40.094597"
x="9.7308216"
y="40.600151"
id="text7085"
transform="scale(1.0690363,0.93542194)"><tspan
sodipodi:role="line"
id="tspan7083"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'Fira Code';-inkscape-font-specification:'Fira Code Bold';fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.617886;stroke-opacity:1"
x="6.9660273"
y="40.094597">!</tspan></text>
x="9.7308216"
y="40.600151">!</tspan></text>
</svg>

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -0,0 +1,131 @@
<?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-conflict.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.8934905"
inkscape:cx="160.70556"
inkscape:cy="10.886505"
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>
<ellipse
style="fill:#e6b700;fill-opacity:0.72529602;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 4.5275489,14.976951 -1.7122358,1.712236 2.239077,2.239077 -2.239077,2.239077 1.8439458,1.843945 2.239077,-2.239077 2.1073666,2.107367 1.7122355,-1.712236 -2.1073664,-2.107366 2.2390774,-2.239077 -1.8439462,-1.843946 -2.239077,2.239077 z"
id="path1359"
sodipodi:nodetypes="ccccccccccccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -97,6 +97,10 @@ void GitRepository::update()
convertFilesListToSet(mManager->listFiles(mRealFolder),mFilesInRepositories);
convertFilesListToSet(mManager->listChangedFiles(mRealFolder),mChangedFiles);
convertFilesListToSet(mManager->listStagedFiles(mRealFolder),mStagedFiles);
// qDebug()<<"update"<<mRealFolder<<mBranch;
// qDebug()<<mFilesInRepositories;
// qDebug()<<mChangedFiles;
// qDebug()<<mStagedFiles;
}
}