]> git.sesse.net Git - nageru/commitdiff
Add a command-line option to change themes.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 4 Apr 2016 19:27:26 +0000 (21:27 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 4 Apr 2016 19:27:26 +0000 (21:27 +0200)
flags.cpp
flags.h
mixer.cpp

index c06be70e4aed1b47cd28d46aedc0dccd0a18ad7c..f8fea018ea89add3c754a604cfea5973eff1cc63 100644 (file)
--- a/flags.cpp
+++ b/flags.cpp
@@ -10,13 +10,14 @@ void parse_flags(int argc, char * const argv[])
 {
        static const option long_options[] = {
                { "num-cards", required_argument, 0, 'c' },
+               { "theme", required_argument, 0, 't' },
                { "va-display", required_argument, 0, 1000 },
                { "http-uncompressed-video", no_argument, 0, 1001 },
                { 0, 0, 0, 0 }
        };
        for ( ;; ) {
                int option_index = 0;
-               int c = getopt_long(argc, argv, "c:", long_options, &option_index);
+               int c = getopt_long(argc, argv, "c:t:", long_options, &option_index);
 
                if (c == -1) {
                        break;
@@ -25,6 +26,9 @@ void parse_flags(int argc, char * const argv[])
                case 'c':
                        global_flags.num_cards = atoi(optarg);
                        break;
+               case 't':
+                       global_flags.theme_filename = optarg;
+                       break;
                case 1000:
                        global_flags.va_display = optarg;
                        break;
diff --git a/flags.h b/flags.h
index 2a65c2490889b81a1fab89f4ec7d75aeb61f3a3e..f1755918c14209622abaf3cfe4bcbd50630bcdc2 100644 (file)
--- a/flags.h
+++ b/flags.h
@@ -7,6 +7,7 @@ struct Flags {
        int num_cards = 2;
        std::string va_display;
        bool uncompressed_video_to_http = false;
+       std::string theme_filename = "theme.lua";
 };
 extern Flags global_flags;
 
index 0817ff9a15b49829c27bb7e80346d25faf52256f..9565894d420722e802d59aa4692373ff819a02b3 100644 (file)
--- a/mixer.cpp
+++ b/mixer.cpp
@@ -159,7 +159,7 @@ Mixer::Mixer(const QSurfaceFormat &format, unsigned num_cards)
        movit_texel_subpixel_precision /= 2.0;
 
        resource_pool.reset(new ResourcePool);
-       theme.reset(new Theme("theme.lua", resource_pool.get(), num_cards));
+       theme.reset(new Theme(global_flags.theme_filename.c_str(), resource_pool.get(), num_cards));
        for (unsigned i = 0; i < NUM_OUTPUTS; ++i) {
                output_channel[i].parent = this;
        }