Author: jkupec
Date: Tue Feb 19 13:56:20 2008
New Revision: 8809
URL: http://svn.opensuse.org/viewcvs/zypp?rev=8809&view=rev
Log:
- can't use <progress><tick/></progress> for progress becase multiple
progress meters can be in place simultaneously. Also we can have
multiple operations running in parallel in the future
(e.g. commit/download). Thus, using <progress/> all the time, no
starting and ending tags.
- backup
Modified:
trunk/zypper/src/output/Out.cc
trunk/zypper/src/output/Out.h
trunk/zypper/src/output/OutNormal.cc
trunk/zypper/src/output/OutNormal.h
trunk/zypper/src/output/OutXML.cc
trunk/zypper/src/output/OutXML.h
trunk/zypper/src/zypper-repos.cc
trunk/zypper/src/zypper.cc
Modified: trunk/zypper/src/output/Out.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/output/Out.cc?rev=8809&r1=8808&r2=8809&view=diff
==============================================================================
--- trunk/zypper/src/output/Out.cc (original)
+++ trunk/zypper/src/output/Out.cc Tue Feb 19 13:56:20 2008
@@ -1,3 +1,5 @@
+#include <sstream>
+
#include "Out.h"
Out::~Out()
@@ -11,3 +13,25 @@
return true;
return false;
}
+
+std::string Out::zyppExceptionReport(const zypp::Exception & e)
+{
+ std::ostringstream s;
+ if (e.historySize())
+ {
+ if (this->verbosity() > Out::NORMAL)
+ {
+ // print the whole history
+ s << e.historyAsString();
+ // this exception
+ s << " - " << e.asUserString();
+ }
+ else
+ // print the root cause only
+ s << *(--e.historyEnd());
+ }
+ else
+ s << e.asUserString();
+
+ return s.str();
+}
Modified: trunk/zypper/src/output/Out.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/output/Out.h?rev=8809&r1=8808&r2=8809&view=diff
==============================================================================
--- trunk/zypper/src/output/Out.h (original)
+++ trunk/zypper/src/output/Out.h Tue Feb 19 13:56:20 2008
@@ -98,10 +98,16 @@
const std::string & label) = 0;
// progress with download rate
- virtual void dwnldProgressStart() = 0;
- virtual void dwnldProgress() = 0;
- virtual void dwnldProgressEnd() = 0;
+ virtual void dwnldProgressStart(const std::string & id,
+ const std::string & label) = 0;
+ virtual void dwnldProgress(const std::string & id,
+ const std::string & label,
+ int value = -1,
+ int rate = -1) = 0;
+ virtual void dwnldProgressEnd(const std::string & id,
+ const std::string & label) = 0;
+ //virtual void Prompt() = 0;
public:
/** Get current verbosity. */
Verbosity verbosity() { return _verbosity; }
@@ -126,6 +132,11 @@
*/
virtual bool progressFilter();
+ /**
+ * Return a zypp::Exception as a string suitable for output.
+ */
+ virtual std::string zyppExceptionReport(const zypp::Exception & e);
+
private:
Verbosity _verbosity;
Type _type;
Modified: trunk/zypper/src/output/OutNormal.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/output/OutNormal.cc?rev=8809&r1=8808&r2=8809&view=diff
==============================================================================
--- trunk/zypper/src/output/OutNormal.cc (original)
+++ trunk/zypper/src/output/OutNormal.cc Tue Feb 19 13:56:20 2008
@@ -56,40 +56,14 @@
// ----------------------------------------------------------------------------
-string OutNormal::reportZyppException(const zypp::Exception & e)
-{
- ostringstream s;
- if (e.historySize())
- {
- if (this->verbosity() > Out::NORMAL)
- {
- // print the whole history
- s << e.historyAsString();
- // this exception
- s << " - " << e.asUserString();
- }
- else
- // print the root cause only
- s << *(--e.historyEnd());
- }
- else
- s << e.asUserString();
-
- return s.str();
-}
-
-// ----------------------------------------------------------------------------
-
void OutNormal::error(const zypp::Exception & e,
const string & problem_desc,
const string & hint)
{
// problem
cerr << problem_desc << endl;
-
// cause
- cerr << reportZyppException(e) << endl;
-
+ cerr << zyppExceptionReport(e) << endl;
// hint
if (!hint.empty())
cerr << hint << endl;
@@ -158,6 +132,23 @@
cout << CLEARLN << cursor.done() << " " << label << std::flush << endl;
}
-void OutNormal::dwnldProgressStart(){}
-void OutNormal::dwnldProgress(){}
-void OutNormal::dwnldProgressEnd(){}
+// progress with download rate
+void OutNormal::dwnldProgressStart(const std::string & id,
+ const std::string & label)
+{
+
+}
+
+void OutNormal::dwnldProgress(const std::string & id,
+ const std::string & label,
+ int value,
+ int rate)
+{
+
+}
+
+void OutNormal::dwnldProgressEnd(const std::string & id,
+ const std::string & label)
+{
+
+}
\ No newline at end of file
Modified: trunk/zypper/src/output/OutNormal.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/output/OutNormal.h?rev=8809&r1=8808&r2=8809&view=diff
==============================================================================
--- trunk/zypper/src/output/OutNormal.h (original)
+++ trunk/zypper/src/output/OutNormal.h Tue Feb 19 13:56:20 2008
@@ -27,16 +27,20 @@
virtual void progressEnd(const std::string & id, const std::string & label);
// progress with download rate
- void dwnldProgressStart();
- void dwnldProgress();
- void dwnldProgressEnd();
+ virtual void dwnldProgressStart(const std::string & id,
+ const std::string & label);
+ virtual void dwnldProgress(const std::string & id,
+ const std::string & label,
+ int value = -1,
+ int rate = -1);
+ virtual void dwnldProgressEnd(const std::string & id,
+ const std::string & label);
protected:
virtual bool mine(Type type);
private:
bool infoWarningFilter(Verbosity verbosity, Type mask);
- std::string reportZyppException(const zypp::Exception & e);
};
#endif /*OUTNORMAL_H_*/
Modified: trunk/zypper/src/output/OutXML.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/output/OutXML.cc?rev=8809&r1=8808&r2=8809&view=diff
==============================================================================
--- trunk/zypper/src/output/OutXML.cc (original)
+++ trunk/zypper/src/output/OutXML.cc Tue Feb 19 13:56:20 2008
@@ -57,29 +57,6 @@
//! \todo hint
}
-string OutXML::reportZyppException(const zypp::Exception & e)
-{
- ostringstream s;
- if (e.historySize())
- {
- if (this->verbosity() > Out::NORMAL)
- {
- // print the whole history
- s << e.historyAsString();
- // this exception
- s << " - " << e.asUserString();
- }
- else
- // print the root cause only
- s << *(--e.historyEnd());
- }
- else
- s << e.asUserString();
-
- return s.str();
-}
-
-
void OutXML::error(const zypp::Exception & e,
const string & problem_desc,
const string & hint)
@@ -89,7 +66,7 @@
// problem
s << problem_desc << endl;
// cause
- s << reportZyppException(e) << endl;
+ s << zyppExceptionReport(e) << endl;
// hint
if (!hint.empty())
s << hint << endl;
@@ -97,17 +74,26 @@
cout << "