mirror of https://github.com/aria2/aria2
Added --show-console-readout option.
This option toggles appearance of console readout.pull/1/head
parent
3d87e4e43a
commit
6e3f512c61
|
@ -229,7 +229,8 @@ void printProgressSummary
|
|||
} // namespace
|
||||
|
||||
ConsoleStatCalc::ConsoleStatCalc(time_t summaryInterval, bool humanReadable):
|
||||
summaryInterval_(summaryInterval)
|
||||
summaryInterval_(summaryInterval),
|
||||
readoutVisibility_(true)
|
||||
{
|
||||
if(humanReadable) {
|
||||
sizeFormatter_.reset(new AbbrevSizeFormatter());
|
||||
|
@ -276,7 +277,11 @@ ConsoleStatCalc::calculateStat(const DownloadEngine* e)
|
|||
sizeFormatter);
|
||||
std::cout << "\n";
|
||||
}
|
||||
|
||||
}
|
||||
if(!readoutVisibility_) {
|
||||
return;
|
||||
}
|
||||
if(e->getRequestGroupMan()->countRequestGroup() > 0) {
|
||||
SharedHandle<RequestGroup> firstRequestGroup =
|
||||
e->getRequestGroupMan()->getRequestGroup(0);
|
||||
|
||||
|
|
|
@ -62,12 +62,18 @@ private:
|
|||
time_t summaryInterval_;
|
||||
|
||||
SharedHandle<SizeFormatter> sizeFormatter_;
|
||||
bool readoutVisibility_;
|
||||
public:
|
||||
ConsoleStatCalc(time_t summaryInterval, bool humanReadable = true);
|
||||
|
||||
virtual ~ConsoleStatCalc() {}
|
||||
|
||||
virtual void calculateStat(const DownloadEngine* e);
|
||||
|
||||
void setReadoutVisibility(bool visibility)
|
||||
{
|
||||
readoutVisibility_ = visibility;
|
||||
}
|
||||
};
|
||||
|
||||
typedef SharedHandle<ConsoleStatCalc> ConsoleStatCalcHandle;
|
||||
|
|
|
@ -561,6 +561,14 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
|
|||
op->hide();
|
||||
handlers.push_back(op);
|
||||
}
|
||||
{
|
||||
SharedHandle<OptionHandler> op(new BooleanOptionHandler
|
||||
(PREF_SHOW_CONSOLE_READOUT,
|
||||
TEXT_SHOW_CONSOLE_READOUT,
|
||||
A2_V_TRUE));
|
||||
op->addTag(TAG_ADVANCED);
|
||||
handlers.push_back(op);
|
||||
}
|
||||
{
|
||||
SharedHandle<OptionHandler> op(new NumberOptionHandler
|
||||
(PREF_STOP,
|
||||
|
|
|
@ -94,8 +94,11 @@ SharedHandle<StatCalc> getStatCalc(const SharedHandle<Option>& op)
|
|||
if(op->getAsBool(PREF_QUIET)) {
|
||||
statCalc.reset(new NullStatCalc());
|
||||
} else {
|
||||
statCalc.reset(new ConsoleStatCalc(op->getAsInt(PREF_SUMMARY_INTERVAL),
|
||||
op->getAsBool(PREF_HUMAN_READABLE)));
|
||||
SharedHandle<ConsoleStatCalc> impl
|
||||
(new ConsoleStatCalc(op->getAsInt(PREF_SUMMARY_INTERVAL),
|
||||
op->getAsBool(PREF_HUMAN_READABLE)));
|
||||
impl->setReadoutVisibility(op->getAsBool(PREF_SHOW_CONSOLE_READOUT));
|
||||
statCalc = impl;
|
||||
}
|
||||
return statCalc;
|
||||
}
|
||||
|
|
|
@ -218,6 +218,8 @@ const std::string PREF_MAX_DOWNLOAD_RESULT("max-download-result");
|
|||
const std::string PREF_RETRY_WAIT("retry-wait");
|
||||
// value: string
|
||||
const std::string PREF_ASYNC_DNS_SERVER("async-dns-server");
|
||||
// value: true | false
|
||||
const std::string PREF_SHOW_CONSOLE_READOUT("show-console-readout");
|
||||
|
||||
/**
|
||||
* FTP related preferences
|
||||
|
|
|
@ -222,6 +222,8 @@ extern const std::string PREF_MAX_DOWNLOAD_RESULT;
|
|||
extern const std::string PREF_RETRY_WAIT;
|
||||
// value: string
|
||||
extern const std::string PREF_ASYNC_DNS_SERVER;
|
||||
// value: true | false
|
||||
extern const std::string PREF_SHOW_CONSOLE_READOUT;
|
||||
|
||||
/**
|
||||
* FTP related preferences
|
||||
|
|
|
@ -780,3 +780,5 @@
|
|||
_(" --xml-rpc-listen-all[=true|false] Deprecated. Use --rpc-listen-all instead.")
|
||||
#define TEXT_XML_RPC_LISTEN_PORT \
|
||||
_(" --xml-rpc-listen-port=PORT Deprecated. Use --rpc-listen-port instead.")
|
||||
#define TEXT_SHOW_CONSOLE_READOUT \
|
||||
_(" --show-console-readout[=true|false] Show console readout.")
|
||||
|
|
Loading…
Reference in New Issue