guck

Vim-like QtWebEngine-powered browser, written in C++
git clone git://git.deurzen.net/guck
Log | Files | Refs | LICENSE

guck.hh (908B)


      1 #ifndef __GUCK__GUCK__GUARD__
      2 #define __GUCK__GUCK__GUARD__
      3 
      4 #include "common.hh"
      5 #include "parse.hh"
      6 
      7 #include "ui/window.hh"
      8 
      9 #include <QApplication>
     10 
     11 #include <memory>
     12 #include <string>
     13 #include <vector>
     14 
     15 
     16 class guck_t
     17 {
     18 public:
     19     guck_t(int argc, char** argv)
     20         : m_parser(argc, argv)
     21     {
     22         m_parser.parse();
     23         auto&&[m_argc, m_args] = m_parser.getargs();
     24         m_app = new QApplication(m_argc, m_args.data());
     25         m_instances.push_back(new window_t());
     26     }
     27 
     28     ~guck_t()
     29     {
     30         for (size_t i = 0; i < m_instances.size(); ++i)
     31             delete m_instances[i];
     32 
     33         delete m_app;
     34     }
     35 
     36     void setup();
     37     void run();
     38 
     39     static std::unique_ptr<guck_t> init(int, char**);
     40 
     41 private:
     42     QApplication* m_app;
     43     parser_t m_parser;
     44 
     45     int m_argc;
     46     std::vector<char*> m_args;
     47 
     48     std::vector<window_ptr_t> m_instances;
     49 
     50 };
     51 
     52 #endif//__GUCK__GUCK__GUARD__