summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-05-17 17:26:59 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-05-17 17:26:59 +0200
commit2b82aa5553eef0cd16b5803047a6b60450bee92f (patch)
tree1c82ccc9c9ab5d5f0ec892af1193f5d69f8e61ec /apt-pkg/contrib
parent470a5c38519989313514ebaec6920aafee53d798 (diff)
parent27c69dd0b36e3da7b6061e597d755f5a60a0d31b (diff)
* Implement EDSP in libapt-pkg so that all front-ends which
use the internal resolver can now be used also with external ones as the usage is hidden in between the old API * provide two edsp solvers in apt-utils: - 'dump' to quickly output a complete scenario and - 'apt' to use the internal as an external resolver
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r--apt-pkg/contrib/progress.cc27
-rw-r--r--apt-pkg/contrib/progress.h3
2 files changed, 10 insertions, 20 deletions
diff --git a/apt-pkg/contrib/progress.cc b/apt-pkg/contrib/progress.cc
index 45e81edcb..84ee4c124 100644
--- a/apt-pkg/contrib/progress.cc
+++ b/apt-pkg/contrib/progress.cc
@@ -65,27 +65,18 @@ void OpProgress::OverallProgress(unsigned long Current, unsigned long Total,
// OpProgress::SubProgress - Set the sub progress state /*{{{*/
// ---------------------------------------------------------------------
/* */
-void OpProgress::SubProgress(unsigned long SubTotal,const string &Op)
+void OpProgress::SubProgress(unsigned long SubTotal,const string &Op,
+ float const Percent)
{
this->SubTotal = SubTotal;
- SubOp = Op;
- if (Total == 0)
- Percent = 0;
+ if (Op.empty() == false)
+ SubOp = Op;
+ if (Total == 0 || Percent == 0)
+ this->Percent = 0;
+ else if (Percent != -1)
+ this->Percent = this->Current += (Size*Percent)/SubTotal;
else
- Percent = Current*100.0/Total;
- Update();
-}
- /*}}}*/
-// OpProgress::SubProgress - Set the sub progress state /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-void OpProgress::SubProgress(unsigned long SubTotal)
-{
- this->SubTotal = SubTotal;
- if (Total == 0)
- Percent = 0;
- else
- Percent = Current*100.0/Total;
+ this->Percent = Current*100.0/Total;
Update();
}
/*}}}*/
diff --git a/apt-pkg/contrib/progress.h b/apt-pkg/contrib/progress.h
index 7dd004f7e..3a914d17f 100644
--- a/apt-pkg/contrib/progress.h
+++ b/apt-pkg/contrib/progress.h
@@ -55,8 +55,7 @@ class OpProgress
public:
void Progress(unsigned long Current);
- void SubProgress(unsigned long SubTotal);
- void SubProgress(unsigned long SubTotal,const string &Op);
+ void SubProgress(unsigned long SubTotal, const string &Op = "", float const Percent = -1);
void OverallProgress(unsigned long Current,unsigned long Total,
unsigned long Size,const string &Op);
virtual void Done() {};