Restore repair repository function
This commit is contained in:
+2
-1
@@ -150,7 +150,6 @@ Page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MenuItem {
|
MenuItem {
|
||||||
enabled: addon.status == Addon.Status.Ready
|
|
||||||
id: repairButton
|
id: repairButton
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
state: addon.gitStatus === Addon.Error ? "reclone" : "reset"
|
state: addon.gitStatus === Addon.Error ? "reclone" : "reset"
|
||||||
@@ -158,6 +157,7 @@ Page {
|
|||||||
State {
|
State {
|
||||||
name: "reset"
|
name: "reset"
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
|
enabled: addon.status == Addon.Status.Ready
|
||||||
target: repairButton
|
target: repairButton
|
||||||
text: qsTr("repair")
|
text: qsTr("repair")
|
||||||
icon.name: "document-edit-decrypt"
|
icon.name: "document-edit-decrypt"
|
||||||
@@ -169,6 +169,7 @@ Page {
|
|||||||
State {
|
State {
|
||||||
name: "reclone"
|
name: "reclone"
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
|
enabled: true
|
||||||
target: repairButton
|
target: repairButton
|
||||||
text: qsTr("repair repository")
|
text: qsTr("repair repository")
|
||||||
icon.name: "view-refresh"
|
icon.name: "view-refresh"
|
||||||
|
|||||||
@@ -536,7 +536,7 @@ void Addon::reclone()
|
|||||||
update();
|
update();
|
||||||
scanBranches();
|
scanBranches();
|
||||||
}
|
}
|
||||||
});
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Addon::loadReadme()
|
void Addon::loadReadme()
|
||||||
@@ -665,10 +665,10 @@ AutoPtr<git_reference> Addon::branchRef(QString name)
|
|||||||
return lbr;
|
return lbr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Addon::delegate(QString taskname, auto work, auto callback)
|
void Addon::delegate(QString taskname, auto work, auto callback, bool force)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(QThread::currentThread() == thread(), "delegate", "Attempt to delegate from another thread.");
|
Q_ASSERT_X(QThread::currentThread() == thread(), "delegate", "Attempt to delegate from another thread.");
|
||||||
if (status() != Status::Ready) {
|
if (status() != Status::Ready && !force) {
|
||||||
qInfo() << name() << "Enqueueing" << taskname;
|
qInfo() << name() << "Enqueueing" << taskname;
|
||||||
m_tasks.enqueue({taskname, [this, taskname, work, callback](){delegate(taskname, work,callback);}});
|
m_tasks.enqueue({taskname, [this, taskname, work, callback](){delegate(taskname, work,callback);}});
|
||||||
return;
|
return;
|
||||||
@@ -709,11 +709,21 @@ void Addon::delegate(QString taskname, auto work, auto callback)
|
|||||||
fw->setFuture(fut);
|
fw->setFuture(fut);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Addon::delegate(QString taskname, auto work)
|
void Addon::delegate(QString taskname, auto work, bool force)
|
||||||
{
|
{
|
||||||
using ret_t = typename std::invoke_result<decltype(work)>::type;
|
using ret_t = typename std::invoke_result<decltype(work)>::type;
|
||||||
if constexpr (std::is_same<ret_t, void>::value)
|
if constexpr (std::is_same<ret_t, void>::value)
|
||||||
delegate(taskname, work, [](){});
|
delegate(taskname, work, [](){}, force);
|
||||||
else
|
else
|
||||||
delegate(taskname, work, [](ret_t){});
|
delegate(taskname, work, [](ret_t){}, force);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Addon::delegate(QString taskname, auto work)
|
||||||
|
{
|
||||||
|
delegate(taskname, work, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Addon::delegate(QString taskname, auto work, auto callback)
|
||||||
|
{
|
||||||
|
delegate(taskname, work, callback, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,6 +138,9 @@ private:
|
|||||||
AutoPtr<git_reference> remoteRefForBranch(QString name);
|
AutoPtr<git_reference> remoteRefForBranch(QString name);
|
||||||
AutoPtr<git_reference> branchRef(QString name);
|
AutoPtr<git_reference> branchRef(QString name);
|
||||||
|
|
||||||
|
void delegate(QString taskname, auto work, auto callback, bool force);
|
||||||
|
void delegate(QString taskname, auto work, bool force);
|
||||||
|
|
||||||
void delegate(QString taskname, auto work, auto callback);
|
void delegate(QString taskname, auto work, auto callback);
|
||||||
void delegate(QString taskname, auto work);
|
void delegate(QString taskname, auto work);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user