about summary refs log tree commit diff stats
path: root/src/main.cpp
blob: abe662664b373529931069f764f2ab48f368b980 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* G
#include <wx/wxprec.h>

#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif

#include <fstream>

#include "global.h"
#include "tracker_config.h"
#include "tracker_frame.h"

static std::ofstream* logfile;

class TrackerApp : public wxApp {
 public:
  virtual bool OnInit() {
    logfile = new std::ofstream(GetAbsolutePath("debug.log"));
    wxLog::SetActiveTarget(new wxLogStream(logfile));

#ifndef NDEBUG
    wxLog::SetVerbose(true);
    wxLog::SetActiveTarget(new wxLogWindow(nullptr, "Debug Log"));
#endif

    GetTrackerConfig().Load();

    TrackerFrame *frame = new TrackerFrame();
    frame->Show(true);
    return true;
  }

  bool OnExceptionInMainLoop() override {
    try {
      throw;
    } catch (const std::exception& ex) {
      wxLogError(ex.what());
    }

    return false;
  }
};

wxIMPLEMENT_APP(TrackerApp);