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
|
} // namespace
|
||||||
|
|
||||||
ConsoleStatCalc::ConsoleStatCalc(time_t summaryInterval, bool humanReadable):
|
ConsoleStatCalc::ConsoleStatCalc(time_t summaryInterval, bool humanReadable):
|
||||||
summaryInterval_(summaryInterval)
|
summaryInterval_(summaryInterval),
|
||||||
|
readoutVisibility_(true)
|
||||||
{
|
{
|
||||||
if(humanReadable) {
|
if(humanReadable) {
|
||||||
sizeFormatter_.reset(new AbbrevSizeFormatter());
|
sizeFormatter_.reset(new AbbrevSizeFormatter());
|
||||||
|
@ -276,7 +277,11 @@ ConsoleStatCalc::calculateStat(const DownloadEngine* e)
|
||||||
sizeFormatter);
|
sizeFormatter);
|
||||||
std::cout << "\n";
|
std::cout << "\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(!readoutVisibility_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(e->getRequestGroupMan()->countRequestGroup() > 0) {
|
||||||
SharedHandle<RequestGroup> firstRequestGroup =
|
SharedHandle<RequestGroup> firstRequestGroup =
|
||||||
e->getRequestGroupMan()->getRequestGroup(0);
|
e->getRequestGroupMan()->getRequestGroup(0);
|
||||||
|
|
||||||
|
|
|
@ -62,12 +62,18 @@ private:
|
||||||
time_t summaryInterval_;
|
time_t summaryInterval_;
|
||||||
|
|
||||||
SharedHandle<SizeFormatter> sizeFormatter_;
|
SharedHandle<SizeFormatter> sizeFormatter_;
|
||||||
|
bool readoutVisibility_;
|
||||||
public:
|
public:
|
||||||
ConsoleStatCalc(time_t summaryInterval, bool humanReadable = true);
|
ConsoleStatCalc(time_t summaryInterval, bool humanReadable = true);
|
||||||
|
|
||||||
virtual ~ConsoleStatCalc() {}
|
virtual ~ConsoleStatCalc() {}
|
||||||
|
|
||||||
virtual void calculateStat(const DownloadEngine* e);
|
virtual void calculateStat(const DownloadEngine* e);
|
||||||
|
|
||||||
|
void setReadoutVisibility(bool visibility)
|
||||||
|
{
|
||||||
|
readoutVisibility_ = visibility;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef SharedHandle<ConsoleStatCalc> ConsoleStatCalcHandle;
|
typedef SharedHandle<ConsoleStatCalc> ConsoleStatCalcHandle;
|
||||||
|
|
|
@ -561,6 +561,14 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
|
||||||
op->hide();
|
op->hide();
|
||||||
handlers.push_back(op);
|
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
|
SharedHandle<OptionHandler> op(new NumberOptionHandler
|
||||||
(PREF_STOP,
|
(PREF_STOP,
|
||||||
|
|
|
@ -94,8 +94,11 @@ SharedHandle<StatCalc> getStatCalc(const SharedHandle<Option>& op)
|
||||||
if(op->getAsBool(PREF_QUIET)) {
|
if(op->getAsBool(PREF_QUIET)) {
|
||||||
statCalc.reset(new NullStatCalc());
|
statCalc.reset(new NullStatCalc());
|
||||||
} else {
|
} else {
|
||||||
statCalc.reset(new ConsoleStatCalc(op->getAsInt(PREF_SUMMARY_INTERVAL),
|
SharedHandle<ConsoleStatCalc> impl
|
||||||
op->getAsBool(PREF_HUMAN_READABLE)));
|
(new ConsoleStatCalc(op->getAsInt(PREF_SUMMARY_INTERVAL),
|
||||||
|
op->getAsBool(PREF_HUMAN_READABLE)));
|
||||||
|
impl->setReadoutVisibility(op->getAsBool(PREF_SHOW_CONSOLE_READOUT));
|
||||||
|
statCalc = impl;
|
||||||
}
|
}
|
||||||
return statCalc;
|
return statCalc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,6 +218,8 @@ const std::string PREF_MAX_DOWNLOAD_RESULT("max-download-result");
|
||||||
const std::string PREF_RETRY_WAIT("retry-wait");
|
const std::string PREF_RETRY_WAIT("retry-wait");
|
||||||
// value: string
|
// value: string
|
||||||
const std::string PREF_ASYNC_DNS_SERVER("async-dns-server");
|
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
|
* FTP related preferences
|
||||||
|
|
|
@ -222,6 +222,8 @@ extern const std::string PREF_MAX_DOWNLOAD_RESULT;
|
||||||
extern const std::string PREF_RETRY_WAIT;
|
extern const std::string PREF_RETRY_WAIT;
|
||||||
// value: string
|
// value: string
|
||||||
extern const std::string PREF_ASYNC_DNS_SERVER;
|
extern const std::string PREF_ASYNC_DNS_SERVER;
|
||||||
|
// value: true | false
|
||||||
|
extern const std::string PREF_SHOW_CONSOLE_READOUT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FTP related preferences
|
* FTP related preferences
|
||||||
|
|
|
@ -780,3 +780,5 @@
|
||||||
_(" --xml-rpc-listen-all[=true|false] Deprecated. Use --rpc-listen-all instead.")
|
_(" --xml-rpc-listen-all[=true|false] Deprecated. Use --rpc-listen-all instead.")
|
||||||
#define TEXT_XML_RPC_LISTEN_PORT \
|
#define TEXT_XML_RPC_LISTEN_PORT \
|
||||||
_(" --xml-rpc-listen-port=PORT Deprecated. Use --rpc-listen-port instead.")
|
_(" --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