Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added a bunch of new options:

 --highlight-colour (change text colour for highlighted objects).
 --hash-seed (change string hash seed - changes colours).
 --output-custom-log (write out a log file in custom log format).
  • Loading branch information...
commit 7046c497deb3aefbf6c175abf0d3bda85b075e54 1 parent 4bd8ed8
@acaudwell authored
View
3  ChangeLog
@@ -1,6 +1,9 @@
0.29:
* Fix handling of avatars for UTF-8 usernames on MACOSX (Christian Köstlin).
* Exposed --time-scale option (previously only available interactively).
+ * Added --highlight-colour option.
+ * Added --hash-seed option.
+ * Added --output-custom-log option.
0.28:
* Bazaar support for merged commits (Nick Moffit).
View
9 README
@@ -133,6 +133,9 @@ options:
--highlight-dirs
Highlight the names of all directories.
+ --highlight-colour FFFFFF
+ Highlighted text colour in hex.
+
--file-filter REGEX
Filter out any files matching a specified regular expression.
@@ -204,6 +207,9 @@ options:
Separate multiple elements with commas (eg 'mouse,progress')
+ --hash-seed SEED
+ Change the seed of hash function.
+
-o, --output-ppm-stream FILE
Output a PPM image stream to a file ('-' for STDOUT).
@@ -213,6 +219,9 @@ options:
-r, --output-framerate FPS
Framerate of output (25,30,60). Used with --output-ppm-stream.
+ --output-custom-log FILE
+ Output a custom format log file ('-' for STDOUT).
+
--load-config CONFIG_FILE
Load a gource conf file.
View
9 data/gource.1
@@ -106,6 +106,9 @@ Highlight the names of all users.
\fB\-\-highlight\-dirs\fR
Highlight the names of all directories.
.TP
+\fB\-\-highlight\-colour FFFFFF\fR
+Highlighted text colour in hex.
+.TP
\fB\-\-file\-extensions\fR
Show filename extensions only.
.TP
@@ -177,6 +180,9 @@ Hide one or more display elements from the list below:
Separate multiple elements with commas (eg 'mouse,progress')
.TP
+\fB\-\-hash\-seed SEED\fR
+Change the seed of hash function.
+.TP
\fB\-o, \-\-output\-ppm\-stream FILE\fR
Output a PPM image stream to a file ('\-' for STDOUT).
@@ -186,6 +192,9 @@ This will automatically hide the progress bar initially and enable 'stop\-at\-en
\fB\-r, \-\-output\-framerate FPS\fR
Framerate of output (25,30,60). Used with \-\-output\-ppm\-stream.
.TP
+\fB\-\-output\-custom\-log FILE\fR
+Output a custom format log file ('\-' for STDOUT).
+.TP
\fB\-\-load\-config CONFIG_FILE\fR
Load a config file.
.TP
2  src/core
@@ -1 +1 @@
-Subproject commit 87d3ffc897386786ba81754a60396c571608f28d
+Subproject commit b5294f9cf1d957a167c6fefce5d6b9333fe547b7
View
27 src/gource.cpp
@@ -122,6 +122,33 @@ Gource::Gource(FrameExporter* exporter) {
if(exporter==0 && gGourceSettings.repo_count==1) slider.show();
}
+void Gource::writeCustomLog(const std::string& logfile, const std::string& output_file) {
+ RCommitLog* commitlog = determineFormat(logfile);
+
+ if(!commitlog) return;
+
+ RCommit commit;
+
+ FILE* fh = stdout;
+
+ if(output_file != "-") {
+ fh = fopen(output_file.c_str(), "w");
+
+ if(!fh) return;
+ }
+
+ while(commitlog->nextCommit(commit)) {
+ for(std::list<RCommitFile>::iterator it = commit.files.begin(); it != commit.files.end(); it++) {
+ RCommitFile& cf = *it;
+ fprintf(fh, "%d|%s|%s|%s\n", commit.timestamp, commit.username.c_str(), cf.action.c_str(), cf.filename.c_str());
+ }
+ commit.files.clear();
+ }
+
+ if(output_file != "-") fclose(fh);
+
+}
+
RCommitLog* Gource::determineFormat(const std::string& logfile) {
debugLog("determineFormat(%s)\n", logfile.c_str());
View
4 src/gource.h
@@ -171,7 +171,7 @@ class Gource : public SDLApp {
void toggleCameraMode();
- RCommitLog* determineFormat(const std::string& logfile);
+ static RCommitLog* determineFormat(const std::string& logfile);
void updateCamera(float dt);
@@ -203,6 +203,8 @@ class Gource : public SDLApp {
Gource(FrameExporter* frameExporter = 0);
~Gource();
+ static void writeCustomLog(const std::string& logfile, const std::string& output_file);
+
void setCameraMode(const std::string& mode);
void setCameraMode(bool track_users);
void setFrameExporter(FrameExporter* exporter, int video_framerate);
View
44 src/gource_settings.cpp
@@ -76,6 +76,8 @@ void GourceSettings::help(bool extended_help) {
if(extended_help) {
printf("Extended Options:\n\n");
+ printf(" --output-custom-log FILE Output a custom format log file ('-' for STDOUT).\n\n");
+
printf(" -b, --background-colour FFFFFF Background colour in hex\n");
printf(" --background-image IMAGE Set a background image\n\n");
@@ -113,8 +115,11 @@ if(extended_help) {
printf(" --follow-user USER Camera will automatically follow this user\n");
printf(" --highlight-user USER Highlight the names of a particular user\n");
printf(" --highlight-users Highlight the names of all users\n\n");
- printf(" --highlight-dirs Highlight the names of all directories\n\n");
+ printf(" --highlight-dirs Highlight the names of all directories\n");
+ printf(" --highlight-colour Font colour for highlighted text\n\n");
+ printf(" --hash-seed SEED Change the seed of hash function.\n\n");
+
printf(" --path PATH\n\n");
}
@@ -169,6 +174,7 @@ GourceSettings::GourceSettings() {
conf_sections["bzr-log-command"] = "command-line";
conf_sections["load-config"] = "command-line";
conf_sections["save-config"] = "command-line";
+ conf_sections["output-custom-log"] = "command-line";
//boolean args
arg_types["help"] = "bool";
@@ -214,6 +220,7 @@ GourceSettings::GourceSettings() {
arg_types["max-files"] = "int";
arg_types["font-size"] = "int";
+ arg_types["hash-seed"] = "int";
arg_types["user-filter"] = "multi-value";
arg_types["file-filter"] = "multi-value";
@@ -226,6 +233,7 @@ GourceSettings::GourceSettings() {
arg_types["log-command"] = "string";
arg_types["load-config"] = "string";
arg_types["save-config"] = "string";
+ arg_types["output-custom-log"] = "string";
arg_types["path"] = "string";
arg_types["log-command"] = "string";
arg_types["background-colour"] = "string";
@@ -244,6 +252,7 @@ GourceSettings::GourceSettings() {
arg_types["camera-mode"] = "string";
arg_types["title"] = "string";
arg_types["font-colour"] = "string";
+ arg_types["highlight-colour"] = "string";
}
void GourceSettings::setGourceDefaults() {
@@ -301,6 +310,7 @@ void GourceSettings::setGourceDefaults() {
font_size = 16;
font_colour = vec3f(1.0f, 1.0f, 1.0f);
+ highlight_colour = vec3f(1.0f, 1.0f, 0.3f);
elasticity = 0.0f;
@@ -322,6 +332,8 @@ void GourceSettings::setGourceDefaults() {
highlight_all_users = false;
highlight_dirs = false;
+ gStringHashSeed = 31;
+
//delete file filters
for(std::vector<Regex*>::iterator it = file_filters.begin(); it != file_filters.end(); it++) {
delete (*it);
@@ -380,6 +392,11 @@ void GourceSettings::commandLineOption(const std::string& name, const std::strin
SDLAppInfo(command);
}
+ if(name == "output-custom-log" && value.size() > 0) {
+ output_custom_filename = value;
+ return;
+ }
+
std::string invalid_error = std::string("invalid ") + name + std::string(" value");
throw ConfFileException(invalid_error, "", 0);
}
@@ -645,6 +662,13 @@ void GourceSettings::importGourceSettings(ConfFile& conffile, ConfSection* gourc
conffile.invalidValueException(entry);
}
}
+
+ if((entry = gource_settings->getEntry("hash-seed")) != 0) {
+
+ if(!entry->hasValue()) conffile.entryException(entry, "specify hash seed (integer)");
+
+ gStringHashSeed = entry->getInt();
+ }
if((entry = gource_settings->getEntry("font-colour")) != 0) {
@@ -681,6 +705,24 @@ void GourceSettings::importGourceSettings(ConfFile& conffile, ConfSection* gourc
conffile.invalidValueException(entry);
}
}
+
+ if((entry = gource_settings->getEntry("highlight-colour")) != 0) {
+
+ if(!entry->hasValue()) conffile.entryException(entry, "specify highlight colour (FFFFFF)");
+
+ int r,g,b;
+
+ std::string colstring = entry->getString();
+
+ if(entry->isVec3()) {
+ highlight_colour = entry->getVec3();
+ } else if(colstring.size()==6 && sscanf(colstring.c_str(), "%02x%02x%02x", &r, &g, &b) == 3) {
+ highlight_colour = vec3f(r,g,b);
+ highlight_colour /= 255.0f;
+ } else {
+ conffile.invalidValueException(entry);
+ }
+ }
if((entry = gource_settings->getEntry("background-image")) != 0) {
View
4 src/gource_settings.h
@@ -110,11 +110,15 @@ class GourceSettings : public SDLAppSettings {
bool highlight_dirs;
bool highlight_all_users;
+ vec3f highlight_colour;
+
std::vector<std::string> highlight_users;
std::vector<std::string> follow_users;
std::vector<Regex*> file_filters;
std::vector<Regex*> user_filters;
bool file_extensions;
+
+ std::string output_custom_filename;
TextureResource* file_graphic;
View
7 src/main.cpp
@@ -91,6 +91,13 @@ int main(int argc, char *argv[]) {
conf.save(gGourceSettings.save_config);
exit(0);
}
+
+ //write custom log file
+ if(gGourceSettings.output_custom_filename.size() > 0 && gGourceSettings.path.size() > 0) {
+
+ Gource::writeCustomLog(gGourceSettings.path, gGourceSettings.output_custom_filename);
+ exit(0);
+ }
} catch(ConfFileException& exception) {
View
3  src/pawn.cpp
@@ -39,7 +39,8 @@ Pawn::Pawn(const std::string& name, vec2f pos, int tagid) {
this->nametime = 5.0;
this->name_interval = 0.0;
this->namecol = vec3f(1.0, 1.0, 1.0);
- this->selectedcol = vec3f(1.0, 1.0, 0.3);
+
+ this->selectedcol = gGourceSettings.highlight_colour;
this->graphic = 0;
this->graphic_ratio = 1.0;
View
2  src/pawn.h
@@ -20,6 +20,8 @@
#include <string>
+#include "gource_settings.h"
+
#include "core/display.h"
#include "core/fxfont.h"
#include "core/vectors.h"
Please sign in to comment.
Something went wrong with that request. Please try again.