~ubuntu-branches/ubuntu/wily/aegisub/wily-proposed

« back to all changes in this revision

Viewing changes to reporter/report.cpp

  • Committer: Package Import Robot
  • Author(s): Sebastian Reichel, Pascal De Vuyst, Juan Picca, Sebastian Reichel
  • Date: 2015-08-04 21:40:50 UTC
  • mfrom: (5.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20150804214050-y2aghm9vdksoc8t7
Tags: 3.2.2+dfsg-1
[ Pascal De Vuyst ]
* Fix Typo in package description (Closes: #739219)

[ Juan Picca ]
* Add patch to fix reproducible build (Closes: #789728)

[ Sebastian Reichel ]
* New upstream release
 - remove vendor directory from orig tarball
* Update Debian Standards Version to 3.9.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright (c) 2009, Amar Takhar <verm@aegisub.org>
2
 
//
3
 
// Permission to use, copy, modify, and distribute this software for any
4
 
// purpose with or without fee is hereby granted, provided that the above
5
 
// copyright notice and this permission notice appear in all copies.
6
 
//
7
 
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
 
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
 
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10
 
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
 
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12
 
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13
 
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
 
//
15
 
// $Id$
16
 
 
17
 
/// @file report.cpp
18
 
/// @brief Generation and manipulation of reports.
19
 
/// @ingroup base
20
 
 
21
 
#ifndef R_PRECOMP
22
 
#include <wx/intl.h>
23
 
#include <wx/log.h>
24
 
#endif
25
 
 
26
 
#include <libaegisub/io.h>
27
 
#include <libaegisub/cajun/elements.h>
28
 
#include <libaegisub/cajun/writer.h>
29
 
 
30
 
 
31
 
#include "report.h"
32
 
#include "include/platform.h"
33
 
#include "aegisub.h"
34
 
 
35
 
/// @brief Contstructor
36
 
Report::Report() {
37
 
 
38
 
        json::Object root;
39
 
 
40
 
        Platform *p = Platform::GetPlatform();
41
 
        Aegisub a;
42
 
 
43
 
        json::Object& general = root["General"];
44
 
        general["Signature"] = p->Signature();
45
 
        general["Date"] = p->Date();
46
 
        general["Architecture"] = p->ArchName();
47
 
        general["OS Family"] = p->OSFamily();
48
 
        general["OS Name"] = p->OSName();
49
 
        general["Endian"] = p->Endian();
50
 
        general["OS Version"] = p->OSVersion();
51
 
        general["wx Version"] = p->wxVersion();
52
 
        general["Locale"] = p->Locale();
53
 
        general["Language"] = p->Language();
54
 
        general["System Language"] = p->SystemLanguage();
55
 
 
56
 
        try {
57
 
                json::Object& aegisub = root["Aegisub"];
58
 
                aegisub["Last Version"] = a.GetString("Version/Last Version");
59
 
                aegisub["Spelling Language"] = a.GetString("Tool/Spell Checker/Language");
60
 
                aegisub["Thesaurus Language"] = a.GetString("Tool/Thesaurus/Language");
61
 
                aegisub["Audio Player"] = a.GetString("Audio/Player");
62
 
                aegisub["Audio Provider"] = a.GetString("Audio/Provider");
63
 
                aegisub["Video Provider"] = a.GetString("Video/Provider");
64
 
                aegisub["Subtitles Provider"] = a.GetString("Subtitle/Provider");
65
 
                aegisub["Save Charset"] = a.GetString("App/Save Charset");
66
 
                aegisub["Grid Font Size"] = a.GetInt("Grid/Font Size");
67
 
                aegisub["Edit Font Size"] = a.GetInt("Subtitle/Edit Box/Font Size");
68
 
                aegisub["Spectrum Enabled"] = a.GetBool("Audio/Spectrum");
69
 
                aegisub["Spectrum Quality"] = a.GetInt("Audio/Renderer/Spectrum/Quality");
70
 
                aegisub["Call Tips Enabled"] = a.GetBool("App/Call Tips");
71
 
                aegisub["Medusa Hotkeys Enabled"] = a.GetBool("Audio/Medusa Timing Hotkeys");
72
 
        } catch(...) {
73
 
                root["Aegisub"]["Error"] = json::String("Config file is corrupted");
74
 
        }
75
 
 
76
 
        json::Object& hardware = root["Hardware"];
77
 
        hardware["Memory Size"] = 0;
78
 
 
79
 
        json::Object& cpu = root["CPU"];
80
 
        cpu["Id"] = p->CPUId();
81
 
        cpu["Speed"] = p->CPUSpeed();
82
 
        cpu["Count"] = p->CPUCount();
83
 
        cpu["Cores"] = p->CPUCores();
84
 
        cpu["Features"] = p->CPUFeatures();
85
 
        cpu["Features2"] = p->CPUFeatures2();
86
 
 
87
 
        json::Object& display = root["Display"];
88
 
        display["Depth"] = p->DisplayDepth();
89
 
        display["Size"] = p->DisplaySize();
90
 
        display["Pixels Per Inch"] = p->DisplayPPI();
91
 
 
92
 
        json::Object& gl = display["OpenGL"];
93
 
        gl["Vendor"] = p->OpenGLVendor();
94
 
        gl["Renderer"] = p->OpenGLRenderer();
95
 
        gl["Version"] = p->OpenGLVersion();
96
 
        gl["Extensions"] = p->OpenGLExt();
97
 
        display["OpenGL"] = gl;
98
 
 
99
 
#ifdef __WINDOWS__
100
 
        json::Object& windows = root["Windows"];
101
 
        windows["Service Pack"] = json::String();
102
 
        windows["Graphics Driver Version"] = json::String();
103
 
        windows["DirectShow Filters"] = json::String();
104
 
        windows["AntiVirus Installed"] = json::Boolean();
105
 
        windows["Firewall Installed"] = json::Boolean();
106
 
        windows["DLL"] = json::String();
107
 
#endif
108
 
 
109
 
#ifdef __UNIX__
110
 
        json::Object& u_nix = root["Unix"];
111
 
        u_nix["Desktop Environment"] = p->DesktopEnvironment();
112
 
        u_nix["Libraries"] = p->UnixLibraries();
113
 
#endif
114
 
 
115
 
#ifdef __APPLE__
116
 
        json::Object& osx = root["OS X"];
117
 
        osx["Patch"] = p->PatchLevel();
118
 
        osx["Model"] = p->HardwareModel();
119
 
#endif
120
 
 
121
 
        agi::io::Save file("./t.json");
122
 
        json::Writer::Write(root, file.Get());
123
 
 
124
 
}
125
 
 
126
 
/// @brief Return Report as Text for the Clipboard.
127
 
void Report::Save(std::string filename) {
128
 
//      agi::io::Save file(filename);
129
 
//      json::Writer::Write(root, file.Get());
130
 
}