#include "config.h"
#include <stdarg.h>
#include <stdbool.h>
#include <string.h>
#include "mutt/lib.h"
#include "gui/lib.h"
#include "progress.h"
#include "mutt_globals.h"
#include "mutt_logging.h"
#include "muttlib.h"
#include "options.h"
Go to the source code of this file.
Functions | |
static void | message_bar (int percent, const char *fmt,...) |
Draw a colourful progress bar. More... | |
static size_t | progress_choose_increment (enum ProgressType type) |
Choose the right increment given a ProgressType. More... | |
static bool | progress_pos_needs_update (const struct Progress *progress, long pos) |
Do we need to update, given the current pos? More... | |
static bool | progress_time_needs_update (const struct Progress *progress, size_t now) |
Do we need to update, given the current time? More... | |
void | mutt_progress_init (struct Progress *progress, const char *msg, enum ProgressType type, size_t size) |
Set up a progress bar. More... | |
void | mutt_progress_update (struct Progress *progress, size_t pos, int percent) |
Update the state of the progress bar. More... | |
Variables | |
short | C_TimeInc |
Config: Frequency of progress bar updates (milliseconds) More... | |
short | C_ReadInc |
Config: Update the progress bar after this many records read (0 to disable) More... | |
short | C_WriteInc |
Config: Update the progress bar after this many records written (0 to disable) More... | |
short | C_NetInc |
Config: (socket) Update the progress bar after this many KB sent/received (0 to disable) More... | |
Progress bar.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file progress.c.
|
static |
Draw a colourful progress bar.
percent | age complete |
fmt | printf(1)-like formatting string |
... | Arguments to formatting string |
Definition at line 54 of file progress.c.
|
static |
Choose the right increment given a ProgressType.
type | ProgressType |
Increment | value |
Definition at line 116 of file progress.c.
|
static |
Do we need to update, given the current pos?
progress | Progress |
pos | Current pos |
bool | Progress needs an update. |
Definition at line 128 of file progress.c.
|
static |
Do we need to update, given the current time?
progress | Progress |
now | Current time |
bool | Progress needs an update. |
Definition at line 140 of file progress.c.
void mutt_progress_init | ( | struct Progress * | progress, |
const char * | msg, | ||
enum ProgressType | type, | ||
size_t | size | ||
) |
Set up a progress bar.
progress | Progress bar |
msg | Message to display; this is copied into the Progress object |
type | Type, e.g. MUTT_PROGRESS_READ |
size | Total size of expected file / traffic |
Definition at line 153 of file progress.c.
void mutt_progress_update | ( | struct Progress * | progress, |
size_t | pos, | ||
int | percent | ||
) |
Update the state of the progress bar.
progress | Progress bar |
pos | Position, or count |
percent | Percentage complete |
If percent is -1, then the percentage will be calculated using pos and the size in progress.
If percent is positive, it is displayed as percentage, otherwise percentage is calculated from progress->size and pos if progress was initialized with positive size, otherwise no percentage is shown
Definition at line 212 of file progress.c.
short C_TimeInc |
Config: Frequency of progress bar updates (milliseconds)
Definition at line 43 of file progress.c.
short C_ReadInc |
Config: Update the progress bar after this many records read (0 to disable)
Definition at line 44 of file progress.c.
short C_WriteInc |
Config: Update the progress bar after this many records written (0 to disable)
Definition at line 45 of file progress.c.
short C_NetInc |
Config: (socket) Update the progress bar after this many KB sent/received (0 to disable)
Definition at line 46 of file progress.c.