summaryrefslogblamecommitdiffstats
path: root/src/main.cpp
blob: d598271bba88314d8b3a8c6bedb30a84ad39978d (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                       
                   

                     
                  




                                                                       
                       

 
                                  
 


                                                         
 

                                     




                                                             
                     








                                                                      
 


                               

                   
              
 
#include <QApplication>
#include <getopt.h>
#include "fbsplash.h"

void printHelp() {
   QTextStream qout(stdout);
   qout << "Usage: ./fbsplash [OPTIONS]\n";
   qout << "Options:\n";
   qout << "-h,         --help              " << "Prints this help.\n";
   qout.flush();
   exit( EXIT_SUCCESS);
}

int main(int argc, char *argv[]) {

   QApplication app(argc, argv, QApplication::GuiServer);
   app.setOrganizationName("OpenSLX");
   app.setApplicationName("fbsplash");

   // Command line arguements parsing
   QMap<QString, QString> clOpts;

   static const char *optString = "h";
   static const struct option
         longOpts[] = { { "help", no_argument, NULL, 'h' } };

   int longIndex = 0;
   int opt = getopt_long(argc, argv, optString, longOpts, &longIndex);
   while (opt != -1) {
      switch (opt) {
      case 'h':
         clOpts.insert("help", "help");
         break;
      }
      opt = getopt_long(argc, argv, optString, longOpts, &longIndex);
   }

   if (clOpts.contains("help"))
      printHelp();

   // fbsplash init
   fbsplash bs;
   app.exec();
}