mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-21 21:55:07 +00:00
State filesizes in proper SI-notation.
This commit is contained in:
parent
3e6863c2ad
commit
3df044e3ff
@ -56,10 +56,10 @@ files.each { | file|
|
|||||||
totalSavedBytes = totalSavedBytes + savedBytes
|
totalSavedBytes = totalSavedBytes + savedBytes
|
||||||
totalSavedFiles = totalSavedFiles.succ
|
totalSavedFiles = totalSavedFiles.succ
|
||||||
output = `mv "#{file}.new.png" -v "#{file}"`
|
output = `mv "#{file}.new.png" -v "#{file}"`
|
||||||
puts ",\nsaved: #{savedBytes} bytes, total saved: #{totalSavedBytes/1024} KB"
|
puts ",\nsaved: #{savedBytes} bytes, total saved: #{totalSavedBytes/1024} KiB"
|
||||||
else
|
else
|
||||||
File.unlink("#{file}.new.png");
|
File.unlink("#{file}.new.png");
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
puts "\ntotal saved: #{totalSavedBytes/1024} KB, #{totalSavedFiles} files\n";
|
puts "\ntotal saved: #{totalSavedBytes/1024} KiB, #{totalSavedFiles} files\n";
|
||||||
|
@ -90,8 +90,8 @@ Select the add-on you want to install from the list and click "OK". The download
|
|||||||
w("<td><b>%s</b><br/>" % name)
|
w("<td><b>%s</b><br/>" % name)
|
||||||
w("Version: %s<br/>" % v("version", "unknown"))
|
w("Version: %s<br/>" % v("version", "unknown"))
|
||||||
w("Author: %s</td>" % v("author", "unknown"))
|
w("Author: %s</td>" % v("author", "unknown"))
|
||||||
MB = 1024 * 1024
|
MiB = 1024 * 1024
|
||||||
w("<td>%.2fMB" % (float(v("size", "unknown")) / MB))
|
w("<td>%.2fMiB" % (float(v("size", "unknown")) / MiB))
|
||||||
if url:
|
if url:
|
||||||
link = url.rstrip("/") + "/" + v("name") + ".tar.bz2"
|
link = url.rstrip("/") + "/" + v("name") + ".tar.bz2"
|
||||||
w("<br/><a href=\"%s\">download</a></td>" % link)
|
w("<br/><a href=\"%s\">download</a></td>" % link)
|
||||||
|
@ -898,7 +898,7 @@ void execute_command(display& disp, HOTKEY_COMMAND command, command_executor* ex
|
|||||||
int size = disp.screenshot(filename, map_screenshot);
|
int size = disp.screenshot(filename, map_screenshot);
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
std::stringstream res;
|
std::stringstream res;
|
||||||
res << filename << " ( " << size/1000000 <<" "<< (size/1000)%1000 << " KB )";
|
res << filename << " ( " << size/1000000 <<" "<< (size/1000)%1000 << " kB )";
|
||||||
gui::dialog(disp,_("Screenshot done"),res.str(),gui::MESSAGE).show();
|
gui::dialog(disp,_("Screenshot done"),res.str(),gui::MESSAGE).show();
|
||||||
} else
|
} else
|
||||||
gui::dialog(disp,_("Screenshot failed"),"",gui::MESSAGE).show();
|
gui::dialog(disp,_("Screenshot failed"),"",gui::MESSAGE).show();
|
||||||
|
@ -974,7 +974,7 @@ std::string get_bandwidth_stats(int hour)
|
|||||||
|
|
||||||
ss << "Hour stat starting from " << hour << "\n " << std::left << std::setw(bandwidth_stats::type_width) << "Type of packet" << "| "
|
ss << "Hour stat starting from " << hour << "\n " << std::left << std::setw(bandwidth_stats::type_width) << "Type of packet" << "| "
|
||||||
<< std::setw(bandwidth_stats::packet_width)<< "out #" << "| "
|
<< std::setw(bandwidth_stats::packet_width)<< "out #" << "| "
|
||||||
<< std::setw(bandwidth_stats::bytes_width) << "out kb" << "| "
|
<< std::setw(bandwidth_stats::bytes_width) << "out kb" << "| " /* Are these bytes or bits? base10 or base2? */
|
||||||
<< std::setw(bandwidth_stats::packet_width)<< "in #" << "| "
|
<< std::setw(bandwidth_stats::packet_width)<< "in #" << "| "
|
||||||
<< std::setw(bandwidth_stats::bytes_width) << "in kb" << "\n";
|
<< std::setw(bandwidth_stats::bytes_width) << "in kb" << "\n";
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ foreach my $campaign (@sorted) {
|
|||||||
$size += 512;
|
$size += 512;
|
||||||
$size -= $size % 1024;
|
$size -= $size % 1024;
|
||||||
$size /= 1024;
|
$size /= 1024;
|
||||||
push @row, escapeHTML("$size KB");
|
push @row, escapeHTML("$size KiB");
|
||||||
push @row, escapeHTML($campaign->{'attr'}->{'downloads'});
|
push @row, escapeHTML($campaign->{'attr'}->{'downloads'});
|
||||||
push @rows, td(\@row);
|
push @rows, td(\@row);
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ optimize_imgfile()
|
|||||||
total_savings_size=$((${total_savings_size}+${png_savings_size}))
|
total_savings_size=$((${total_savings_size}+${png_savings_size}))
|
||||||
total_savings_filecount=$((1+${total_savings_filecount}))
|
total_savings_filecount=$((1+${total_savings_filecount}))
|
||||||
mv -f ${1}.new ${1}
|
mv -f ${1}.new ${1}
|
||||||
echo " saved: ${png_savings_size} bytes, total saved: $((${total_savings_size}/1024)) KB"
|
echo " saved: ${png_savings_size} bytes, total saved: $((${total_savings_size}/1024)) KiB"
|
||||||
else
|
else
|
||||||
rm -f ${1}.new
|
rm -f ${1}.new
|
||||||
echo " already optimized"
|
echo " already optimized"
|
||||||
@ -106,9 +106,9 @@ print_statistics()
|
|||||||
# Print overall statistics
|
# Print overall statistics
|
||||||
if [ "$total_savings_filecount" -gt 0 ]; then
|
if [ "$total_savings_filecount" -gt 0 ]; then
|
||||||
echo "Overall statistics (only for files with a smaller recompressed size):"
|
echo "Overall statistics (only for files with a smaller recompressed size):"
|
||||||
echo " Original size: $((${total_original_size}/1024)) KB on ${total_savings_filecount} files"
|
echo " Original size: $((${total_original_size}/1024)) KiB on ${total_savings_filecount} files"
|
||||||
echo " Optimized size: $(((${total_original_size}-${total_savings_size})/1024)) KB"
|
echo " Optimized size: $(((${total_original_size}-${total_savings_size})/1024)) KiB"
|
||||||
echo " Total saving: $((${total_savings_size}/1024)) KB = $((${total_savings_size}*100/${total_original_size}))% decrease"
|
echo " Total saving: $((${total_savings_size}/1024)) KiB = $((${total_savings_size}*100/${total_original_size}))% decrease"
|
||||||
else
|
else
|
||||||
echo "No files were recompressed."
|
echo "No files were recompressed."
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user