mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2024-11-20 11:49:17 +01:00
Add option to set interval for progress bar update
This commit is contained in:
parent
4f8843312c
commit
8a71c63b20
@ -278,6 +278,7 @@ class Config
|
|||||||
unsigned int iThreads;
|
unsigned int iThreads;
|
||||||
int iWait;
|
int iWait;
|
||||||
size_t iChunkSize;
|
size_t iChunkSize;
|
||||||
|
int iProgressInterval;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CONFIG_H__
|
#endif // CONFIG_H__
|
||||||
|
6
main.cpp
6
main.cpp
@ -218,6 +218,7 @@ int main(int argc, char *argv[])
|
|||||||
("save-changelogs", bpo::value<bool>(&Globals::globalConfig.dlConf.bSaveChangelogs)->zero_tokens()->default_value(false), "Save changelogs when downloading")
|
("save-changelogs", bpo::value<bool>(&Globals::globalConfig.dlConf.bSaveChangelogs)->zero_tokens()->default_value(false), "Save changelogs when downloading")
|
||||||
("threads", bpo::value<unsigned int>(&Globals::globalConfig.iThreads)->default_value(4), "Number of download threads")
|
("threads", bpo::value<unsigned int>(&Globals::globalConfig.iThreads)->default_value(4), "Number of download threads")
|
||||||
("dlc-list", bpo::value<std::string>(&Globals::globalConfig.sGameHasDLCList)->default_value("https://raw.githubusercontent.com/Sude-/lgogdownloader-lists/master/game_has_dlc.txt"), "Set URL for list of games that have DLC")
|
("dlc-list", bpo::value<std::string>(&Globals::globalConfig.sGameHasDLCList)->default_value("https://raw.githubusercontent.com/Sude-/lgogdownloader-lists/master/game_has_dlc.txt"), "Set URL for list of games that have DLC")
|
||||||
|
("progress-interval", bpo::value<int>(&Globals::globalConfig.iProgressInterval)->default_value(100), "Set interval for progress bar update (milliseconds)\nValue must be between 1 and 10000")
|
||||||
;
|
;
|
||||||
// Options read from config file
|
// Options read from config file
|
||||||
options_cfg_only.add_options()
|
options_cfg_only.add_options()
|
||||||
@ -416,6 +417,11 @@ int main(int argc, char *argv[])
|
|||||||
if (Globals::globalConfig.iWait > 0)
|
if (Globals::globalConfig.iWait > 0)
|
||||||
Globals::globalConfig.iWait *= 1000;
|
Globals::globalConfig.iWait *= 1000;
|
||||||
|
|
||||||
|
if (Globals::globalConfig.iProgressInterval < 1)
|
||||||
|
Globals::globalConfig.iProgressInterval = 1;
|
||||||
|
else if (Globals::globalConfig.iProgressInterval > 10000)
|
||||||
|
Globals::globalConfig.iProgressInterval = 10000;
|
||||||
|
|
||||||
if (Globals::globalConfig.iThreads < 1)
|
if (Globals::globalConfig.iThreads < 1)
|
||||||
{
|
{
|
||||||
Globals::globalConfig.iThreads = 1;
|
Globals::globalConfig.iThreads = 1;
|
||||||
|
@ -3133,7 +3133,7 @@ void Downloader::printProgress()
|
|||||||
dl_status = DLSTATUS_NOTSTARTED;
|
dl_status = DLSTATUS_NOTSTARTED;
|
||||||
|
|
||||||
// Print progress information once per 100ms
|
// Print progress information once per 100ms
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
std::this_thread::sleep_for(std::chrono::milliseconds(Globals::globalConfig.iProgressInterval));
|
||||||
std::cout << "\033[J\r" << std::flush; // Clear screen from the current line down to the bottom of the screen
|
std::cout << "\033[J\r" << std::flush; // Clear screen from the current line down to the bottom of the screen
|
||||||
|
|
||||||
// Print messages from message queue first
|
// Print messages from message queue first
|
||||||
|
Loading…
Reference in New Issue
Block a user