Delete the unfinished crash reporter
This commit is contained in:
parent
21cc91cd16
commit
39823b5d89
34 changed files with 0 additions and 2728 deletions
4
Makefile
4
Makefile
|
@ -10,10 +10,6 @@ SUBDIRS += \
|
|||
desktop \
|
||||
po
|
||||
|
||||
ifeq (yes, $(ENABLE_REPORTER))
|
||||
SUBDIRS += reporter
|
||||
endif
|
||||
|
||||
all: ;
|
||||
|
||||
ifeq (yes, $(BUILD_DARWIN))
|
||||
|
|
13
configure.ac
13
configure.ac
|
@ -488,19 +488,6 @@ AC_MSG_RESULT(${with_update_url:=/trunk})
|
|||
AC_DEFINE_UNQUOTED([UPDATE_CHECKER_BASE_URL], ["$with_update_url"],
|
||||
[Base path for the update checker])
|
||||
|
||||
################
|
||||
# Crash reporter
|
||||
################
|
||||
AC_MSG_CHECKING([whether to enable the crash reporter])
|
||||
AC_ARG_ENABLE(crash-reporter,
|
||||
AS_HELP_STRING([--enable-crash-reporter], [enable the crash reporter [no]]))
|
||||
AC_MSG_RESULT(${enable_crash_reporter:=no})
|
||||
AS_IF([test "x$enable_crash_reporter" = "xyes"],
|
||||
[PKG_CHECK_MODULES(LIBCURL, libcurl >= curl_required_version,,
|
||||
[AC_MSG_FAILURE([the crash repoter requires >= cURL curl_required_version])])])
|
||||
ENABLE_REPORTER="$enable_crash_reporter"
|
||||
AC_SUBST(ENABLE_REPORTER)
|
||||
|
||||
####################################################################
|
||||
# Default settings for Providers/Players
|
||||
# * This is done at the end to preserve sanity rather than littering
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
include ../Makefile.inc
|
||||
|
||||
PROGRAM = reporter-3.0
|
||||
PROGRAM_INSTALL = yes
|
||||
PRECOMPILED_HEADER_NAME=r_pre.h
|
||||
|
||||
CXXFLAGS += -Iinclude $(CFLAGS_WX) -I../libaegisub/include
|
||||
LIBS += $(LIBS_WX) $(LIBS_LIBCURL) -L../libaegisub -laegisub $(LIBS_UCHARDET) $(LIBS_GL)
|
||||
|
||||
# File-specific flags
|
||||
upload.o: CXXFLAGS += $(CFLAGS_CURL)
|
||||
|
||||
SRC = \
|
||||
aegisub.cpp \
|
||||
main.cpp \
|
||||
platform.cpp \
|
||||
platform_unix.cpp \
|
||||
progress.cpp \
|
||||
report.cpp \
|
||||
upload.cpp \
|
||||
util.cpp \
|
||||
view.cpp
|
||||
|
||||
|
||||
ifeq (yes, $(BUILD_BSD))
|
||||
SRC += platform_unix_bsd.cpp
|
||||
else
|
||||
EXTRA_DIST += platform_unix_bsd.cpp
|
||||
endif
|
||||
|
||||
ifeq (yes, $(BUILD_LINUX))
|
||||
SRC += platform_unix_linux.cpp
|
||||
else
|
||||
EXTRA_DIST += platform_unix_linux.cpp
|
||||
endif
|
||||
|
||||
ifeq (yes, $(BUILD_DARWIN))
|
||||
SRC += platform_unix_osx.cpp
|
||||
else
|
||||
EXTRA_DIST += platform_unix_osx.cpp
|
||||
endif
|
||||
|
||||
HEADER = \
|
||||
*.h \
|
||||
include/*.h
|
||||
|
||||
include ../Makefile.target
|
||||
-include *.d
|
|
@ -1,58 +0,0 @@
|
|||
// Copyright (c) 2009, Amar Takhar <verm@aegisub.org>
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/// @file aegisub.cpp
|
||||
/// @brief Aegisub specific configuration options and properties.
|
||||
/// @ingroup base
|
||||
|
||||
#ifndef R_PRECOMP
|
||||
#endif
|
||||
|
||||
#include "aegisub.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <libaegisub/option_value.h>
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#include "../src/config.h"
|
||||
#else
|
||||
#include "../acconf.h"
|
||||
#endif
|
||||
|
||||
Aegisub::Aegisub() {
|
||||
std::string default_config("{}");
|
||||
opt = new agi::Options(util::config_path() + "config.json", default_config, agi::Options::FLUSH_SKIP);
|
||||
}
|
||||
|
||||
|
||||
Aegisub::~Aegisub() {
|
||||
delete opt;
|
||||
}
|
||||
|
||||
|
||||
const std::string Aegisub::GetString(std::string key) {
|
||||
return opt->Get(key)->GetString();
|
||||
}
|
||||
|
||||
|
||||
int64_t Aegisub::GetInt(std::string key) {
|
||||
return opt->Get(key)->GetInt();
|
||||
}
|
||||
|
||||
|
||||
bool Aegisub::GetBool(std::string key) {
|
||||
return opt->Get(key)->GetBool();
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
// Copyright (c) 2009, Amar Takhar <verm@aegisub.org>
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/// @file aegisub.h
|
||||
/// @see aegisub.cpp
|
||||
/// @ingroup base
|
||||
|
||||
#ifndef R_PRECOMP
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#include <libaegisub/option.h>
|
||||
|
||||
/// @class Aegisub
|
||||
/// @brief Gather Aegisub information from the config file or otherwise.
|
||||
class Aegisub {
|
||||
private:
|
||||
agi::Options *opt;
|
||||
public:
|
||||
Aegisub();
|
||||
~Aegisub();
|
||||
const agi::OptionValue* Read(std::string key);
|
||||
const std::string GetString(std::string key);
|
||||
int64_t GetInt(std::string key);
|
||||
bool GetBool(std::string key);
|
||||
};
|
|
@ -1,305 +0,0 @@
|
|||
// Copyright (c) 2009, Amar Takhar <verm@aegisub.org>
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/// @file platform.h
|
||||
/// @brief API for gathering platform information.
|
||||
/// @see platform.cpp
|
||||
/// @ingroup base
|
||||
|
||||
#ifndef R_PRECOMP
|
||||
#include <wx/intl.h>
|
||||
#include <wx/glcanvas.h>
|
||||
#include <wx/platinfo.h>
|
||||
#include <wx/string.h>
|
||||
#endif
|
||||
|
||||
/// @class Platform
|
||||
/// @brief Grab platform-specific information.
|
||||
class Platform {
|
||||
public:
|
||||
|
||||
/// Constructor
|
||||
Platform() {};
|
||||
|
||||
/// Destructor
|
||||
~Platform();
|
||||
|
||||
/// Get platform instance.
|
||||
static Platform* GetPlatform();
|
||||
|
||||
/// @name Platform Agonstic
|
||||
/// These are platform agnostic mostly from wx functions.
|
||||
//@{
|
||||
|
||||
// From wxPlatformInfo
|
||||
|
||||
/// Architecture
|
||||
/// @return Architecture name.
|
||||
/// @retval 32 bit, 64 bit
|
||||
std::string ArchName();
|
||||
|
||||
/// OS Family
|
||||
/// @return OS Family
|
||||
/// @retval Unix, Windows, Mac
|
||||
std::string OSFamily();
|
||||
|
||||
/// OS Name
|
||||
/// @return OS Name
|
||||
/// @retval FreeBSD, Windows, Mac
|
||||
std::string OSName();
|
||||
|
||||
/// Endian
|
||||
/// @return Endian
|
||||
/// @retval Little endian, Big endian
|
||||
std::string Endian();
|
||||
|
||||
// From <wx/gdicmn.h>
|
||||
|
||||
/// Display depth
|
||||
/// @return Depth
|
||||
/// @return Integer
|
||||
int DisplayDepth();
|
||||
|
||||
/// Display size
|
||||
/// @return Size delimited by a space.
|
||||
/// @retval "w h"
|
||||
std::string DisplaySize();
|
||||
|
||||
/// Pixels per inch
|
||||
/// @return PPI
|
||||
/// @retval Integer
|
||||
std::string DisplayPPI();
|
||||
|
||||
// Misc
|
||||
|
||||
/// Report signature
|
||||
/// @return Signature
|
||||
/// @retval SHA256 hash
|
||||
std::string Signature();
|
||||
|
||||
/// wxWidgets version
|
||||
/// @return Version
|
||||
/// @retval Major.Minor.Micro.Patch: 2.9.0.0
|
||||
std::string wxVersion();
|
||||
|
||||
/// Locale
|
||||
/// @return Locale name
|
||||
/// @retval C,POSIX,<code>
|
||||
std::string Locale();
|
||||
|
||||
/// Language currently in use
|
||||
/// @return Language reporter is currently running in
|
||||
/// @retval Language code: en_US, en_CA...
|
||||
const char* Language();
|
||||
|
||||
/// System language
|
||||
/// @return Language operating system is currently running in
|
||||
/// @retval Language code: en_US, en_CA...
|
||||
const char* SystemLanguage();
|
||||
|
||||
/// Date
|
||||
/// @return Date
|
||||
/// @retval Date in YYYY-MM-DD
|
||||
std::string Date();
|
||||
|
||||
/// Time
|
||||
/// @return Time
|
||||
/// @retval Time in HH:MM:SS
|
||||
std::string Time();
|
||||
|
||||
/// TimeZone
|
||||
/// @return TimeZone
|
||||
/// @retval EST,EDT,JST...
|
||||
std::string TimeZone();
|
||||
//@}
|
||||
|
||||
/// @name Platform Specific
|
||||
/// The following are all platform-specific.
|
||||
//@{
|
||||
// Misc
|
||||
|
||||
/// Operating System version
|
||||
/// @return OS Version
|
||||
/// @retval Any
|
||||
virtual const std::string OSVersion()=0;
|
||||
|
||||
// Hardware
|
||||
|
||||
/// CPU ID string
|
||||
/// @return CPU ID
|
||||
/// @retval Any, ex: Intel(R) Pentium(R) M processor 1600MHz
|
||||
virtual std::string CPUId()=0;
|
||||
|
||||
/// CPU Speed
|
||||
/// @return Speed
|
||||
/// @retval Integer
|
||||
virtual std::string CPUSpeed()=0;
|
||||
|
||||
/// CPU Count
|
||||
/// @return Count
|
||||
/// @retval Integer
|
||||
virtual int CPUCount()=0;
|
||||
|
||||
/// CPU Cores
|
||||
/// @return Cores
|
||||
/// @retval Integer
|
||||
virtual int CPUCores()=0;
|
||||
|
||||
/// CPU Features
|
||||
/// @return Features set 1
|
||||
/// @retval FPU,VME,DE,PSE,TSC,MSR...
|
||||
virtual std::string CPUFeatures()=0;
|
||||
|
||||
/// CPU Features2
|
||||
/// @return Features set 2
|
||||
/// @retval CPU-specific features
|
||||
/// @note "EST,TM2" on my P-M, or "SYSCALL,NX,MMX+,LM,3DNow!+,3DNow!" on an Opteron
|
||||
virtual std::string CPUFeatures2()=0;
|
||||
|
||||
/// System memory
|
||||
/// @return Memory
|
||||
/// @retval Integer in bytes
|
||||
virtual uint64_t Memory()=0;
|
||||
|
||||
/// OpenGL vendor
|
||||
/// @return Vendor
|
||||
/// @retval Any
|
||||
virtual std::string OpenGLVendor();
|
||||
|
||||
/// OpenGL renderer
|
||||
/// @return Renderer
|
||||
/// @retval Any
|
||||
virtual std::string OpenGLRenderer();
|
||||
|
||||
/// OpenGL version
|
||||
/// @return Renderer version
|
||||
/// @retval Any
|
||||
virtual std::string OpenGLVersion();
|
||||
|
||||
/// OpenGL extensions
|
||||
/// @return OpenGL extensions
|
||||
/// @retval Space delimited list of extensions
|
||||
virtual std::string OpenGLExt();
|
||||
//@}
|
||||
|
||||
/// @name Windows
|
||||
//@{
|
||||
#ifdef __WINDOWS__
|
||||
|
||||
/// Service pack
|
||||
/// @return Service pack
|
||||
/// @retval Any
|
||||
virtual std::string ServicePack()=0;
|
||||
|
||||
/// Graphics driver version
|
||||
/// @return Driver version
|
||||
/// @retval Any
|
||||
virtual std::string DriverGraphicsVersion()=0;
|
||||
|
||||
/// Directshow filters installed
|
||||
/// @return json::Object of filters installed
|
||||
/// @retval A json::Object format of:
|
||||
/// \verbatim
|
||||
/// <filter>
|
||||
/// <name version="[version]">[name]</name>
|
||||
/// </filter>
|
||||
/// \endverbatim
|
||||
virtual std::string DirectShowFilters()=0;
|
||||
|
||||
/// AntiVirus installed
|
||||
/// @return true/false
|
||||
/// @retval 1,0
|
||||
virtual std::string AntiVirus()=0;
|
||||
|
||||
/// Firewall installed
|
||||
/// @return true/false
|
||||
/// @retval 1,0
|
||||
virtual std::string Firewall()=0;
|
||||
|
||||
/// DLL versions used
|
||||
/// @return json::Array of DLLs used
|
||||
/// @retval A json::Array in the format of:
|
||||
/// \verbatim
|
||||
/// { "version", "name" }
|
||||
/// \endverbatim
|
||||
virtual std::string DLLVersions()=0;
|
||||
#endif
|
||||
//@}
|
||||
|
||||
/// @name Unix
|
||||
//@{
|
||||
#ifdef __UNIX__
|
||||
|
||||
/// Library versions used
|
||||
/// @return json::Array of DLLs used
|
||||
/// @retval A json::Array in the format of:
|
||||
/// \verbatim
|
||||
/// { "version", "name" }
|
||||
/// \endverbatim
|
||||
virtual std::string UnixLibraries()=0;
|
||||
|
||||
/// Desktop environment
|
||||
/// @return Environment
|
||||
/// @retval Gnome, KDE, WindowMaker...
|
||||
virtual const char* DesktopEnvironment()=0;
|
||||
#endif
|
||||
//@}
|
||||
|
||||
/// @name OS X
|
||||
//@{
|
||||
#ifdef __APPLE__
|
||||
|
||||
/// OS patch level
|
||||
/// @return Patch level
|
||||
/// @retval Any
|
||||
virtual std::string PatchLevel()=0;
|
||||
|
||||
/// Hardware model
|
||||
/// @return Model
|
||||
/// @retval Any
|
||||
virtual std::string HardwareModel()=0;
|
||||
#endif
|
||||
//@}
|
||||
|
||||
private:
|
||||
void Init();
|
||||
|
||||
/// wxPlatformInfo struct.
|
||||
const wxPlatformInfo plat;
|
||||
|
||||
/// wxLocale instance.
|
||||
wxLocale *locale;
|
||||
|
||||
/// wxGLCanvas.
|
||||
wxGLCanvas *glc;
|
||||
|
||||
/// wxGLContext.
|
||||
wxGLContext *ctx;
|
||||
|
||||
/// Available video information.
|
||||
enum VideoInfo {
|
||||
VIDEO_RENDERER, ///< Renderer
|
||||
VIDEO_VENDOR, ///< Vendor
|
||||
VIDEO_VERSION, ///< Version
|
||||
VIDEO_EXT ///< Extensions
|
||||
};
|
||||
|
||||
/// Retrieve OpenGL video information.
|
||||
/// @param which Requested information
|
||||
/// @return Video info.
|
||||
std::string GetVideoInfo(enum Platform::VideoInfo which);
|
||||
|
||||
};
|
|
@ -1,66 +0,0 @@
|
|||
// Copyright (c) 2009, Amar Takhar <verm@aegisub.org>
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
//
|
||||
// $Id: libraries.cpp 3601 2009-09-28 08:08:16Z verm $
|
||||
|
||||
/// @file libraries.cpp
|
||||
/// @brief Pragmas for automatically linking in required libraries during Windows build
|
||||
/// @ingroup base
|
||||
|
||||
#if __VISUALC__ >= 1200
|
||||
// wxWidgets
|
||||
#if wxCHECK_VERSION(2, 9, 0)
|
||||
#ifdef __WXDEBUG__
|
||||
#pragma comment(lib, "wxzlibd.lib")
|
||||
#pragma comment(lib, "wxpngd.lib")
|
||||
#pragma comment(lib, "wxregexud.lib")
|
||||
#pragma comment(lib, "wxbase29ud.lib")
|
||||
#pragma comment(lib, "wxbase29ud_net.lib")
|
||||
#pragma comment(lib, "wxmsw29ud_media.lib")
|
||||
#pragma comment(lib, "wxmsw29ud_core.lib")
|
||||
#pragma comment(lib, "wxmsw29ud_adv.lib")
|
||||
#pragma comment(lib, "wxmsw29ud_gl.lib")
|
||||
#pragma comment(lib, "wxmsw29ud_stc.lib")
|
||||
#pragma comment(lib, "wxscintillad.lib")
|
||||
#pragma comment(lib, "wxexpatd.lib")
|
||||
#else
|
||||
#pragma comment(lib, "wxzlib.lib")
|
||||
#pragma comment(lib, "wxpng.lib")
|
||||
#pragma comment(lib, "wxregexu.lib")
|
||||
#pragma comment(lib, "wxbase29u.lib")
|
||||
#pragma comment(lib, "wxbase29u_net.lib")
|
||||
#pragma comment(lib, "wxmsw29u_media.lib")
|
||||
#pragma comment(lib, "wxmsw29u_core.lib")
|
||||
#pragma comment(lib, "wxmsw29u_adv.lib")
|
||||
#pragma comment(lib, "wxmsw29u_gl.lib")
|
||||
#pragma comment(lib, "wxmsw29u_stc.lib")
|
||||
#pragma comment(lib, "wxscintilla.lib")
|
||||
#pragma comment(lib, "wxexpat.lib")
|
||||
#endif
|
||||
|
||||
#else
|
||||
#error "wxWidgets 2.9 is required"
|
||||
#endif // wxWidgets
|
||||
|
||||
// Standard Win32 Libraries
|
||||
#pragma comment(lib, "comctl32.lib")
|
||||
#pragma comment(lib, "rpcrt4.lib")
|
||||
#pragma comment(lib, "ws2_32.lib")
|
||||
#pragma comment(lib, "winmm.lib")
|
||||
#pragma comment(lib, "wldap32.lib")
|
||||
|
||||
#pragma comment(lib, "libcurl.lib")
|
||||
|
||||
#endif // VisualC
|
||||
|
|
@ -1,168 +0,0 @@
|
|||
// Copyright (c) 2009, Amar Takhar <verm@aegisub.org>
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/// @file main.cpp
|
||||
/// @brief Main loop
|
||||
/// @ingroup base
|
||||
|
||||
#ifndef R_PRECOMP
|
||||
#include <locale.h>
|
||||
|
||||
#include <wx/app.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/cmdline.h>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/window.h>
|
||||
#endif
|
||||
|
||||
#include <libaegisub/log.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "upload.h"
|
||||
#include "util.h"
|
||||
|
||||
/// @brief Init the reporter.
|
||||
bool Reporter::OnInit() {
|
||||
|
||||
const std::string path_log(util::config_path() + "log/");
|
||||
wxFileName::Mkdir(path_log, 0777, wxPATH_MKDIR_FULL);
|
||||
agi::log::log = new agi::log::LogSink;
|
||||
// if ( !wxApp::OnInit() )
|
||||
// return false;
|
||||
|
||||
wxApp::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, _("Reporter").c_str());
|
||||
|
||||
|
||||
static const wxCmdLineEntryDesc cmdLineDesc[] = {
|
||||
{ wxCMD_LINE_SWITCH, "c", "crash", "Launch in crash mode.", wxCMD_LINE_VAL_NONE, 0 },
|
||||
{ wxCMD_LINE_SWITCH, "r", "report", "Launch in Report mode.", wxCMD_LINE_VAL_NONE, 0 },
|
||||
{ wxCMD_LINE_SWITCH, "j", "json", "Dump JSON file", wxCMD_LINE_VAL_NONE, 0 },
|
||||
{ wxCMD_LINE_SWITCH, "h", "help", "This help message", wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
|
||||
{ wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, 0 }
|
||||
};
|
||||
|
||||
|
||||
wxCmdLineParser parser(cmdLineDesc, argc, argv);
|
||||
|
||||
parser.SetLogo("Aegisub Reporter version x.x");
|
||||
parser.SetCmdLine(argc, argv);
|
||||
switch ( parser.Parse() ) {
|
||||
case -1:
|
||||
return false;
|
||||
break; // Help
|
||||
case 0:
|
||||
break; // OK
|
||||
default:
|
||||
wxLogMessage(_T("Syntax error."));
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
setlocale(LC_CTYPE, "C");
|
||||
wxLocale *locale = new wxLocale();
|
||||
locale->Init(wxLANGUAGE_ENGLISH);
|
||||
#ifdef __WINDOWS__
|
||||
wxStandardPathsBase &paths = wxStandardPaths::Get();
|
||||
locale->AddCatalogLookupPathPrefix(wxString::Format("%s/locale", paths.GetDataDir()));
|
||||
locale->AddCatalog(_T("reporter"));
|
||||
#else
|
||||
locale->AddCatalog("reporter");
|
||||
#endif
|
||||
locale->AddCatalog(_T("wxstd"));
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
setlocale(LC_CTYPE, "C");
|
||||
|
||||
|
||||
mFrame *frame = new mFrame(_("Aegisub Reporter"));
|
||||
|
||||
if (parser.Found("j")) {
|
||||
r->Save("report.json");
|
||||
std::cout << "Report saved to report.json" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
SetTopWindow(frame);
|
||||
|
||||
r = new Report;
|
||||
frame->SetReport(r);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Main frame.
|
||||
/// @param window_title Window title.
|
||||
mFrame::mFrame(const wxString &window_title)
|
||||
: wxFrame(NULL, wxID_ANY, window_title, wxDefaultPosition, wxSize(300,-1)) {
|
||||
|
||||
wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
wxBoxSizer *msgSizer = new wxBoxSizer(wxVERTICAL);
|
||||
topSizer->Add(msgSizer, 0, wxALL, 5);
|
||||
|
||||
wxStaticText *title = new wxStaticText(this, -1, _("Welcome to the Aegisub reporter!"));
|
||||
msgSizer->Add(title, 0, wxALL, 5);
|
||||
title->SetFont(wxFont(11, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD));
|
||||
|
||||
wxStaticText *msg = new wxStaticText(this, -1, _("In order to better help us target development, and improve Aegisub we would like you to submit some information about your system and setup."));
|
||||
msg->Wrap(325);
|
||||
msgSizer->Add(msg, 1, wxALL, 5);
|
||||
|
||||
wxStaticText *notice = new wxStaticText(this, -1, _("This information is completely anonymous, no personal information is sent along it is strictly used for targeting new features and the future direction of Aegisub."));
|
||||
msgSizer->Add(notice, 1, wxALL, 5);
|
||||
notice->SetFont(wxFont(11, wxFONTFAMILY_SWISS, wxFONTSTYLE_ITALIC, wxFONTWEIGHT_NORMAL));
|
||||
notice->Wrap(325);
|
||||
msgSizer->Add(new wxButton(this, 42, "View Report"), 0, wxTOP, 5);
|
||||
|
||||
wxStdDialogButtonSizer *stdButton = new wxStdDialogButtonSizer();
|
||||
stdButton->AddButton(new wxButton(this, wxID_OK, _("Submit")));
|
||||
stdButton->AddButton(new wxButton(this, wxID_CANCEL, _("Cancel")));
|
||||
stdButton->Realize();
|
||||
topSizer->Add(stdButton, 0, wxALL, 5);
|
||||
|
||||
this->SetSizerAndFit(topSizer);
|
||||
msgSizer->Layout();
|
||||
|
||||
// Is there a better way to do this?
|
||||
this->SetMaxSize(this->GetEffectiveMinSize());
|
||||
this->SetMinSize(this->GetEffectiveMinSize());
|
||||
|
||||
this->Show(true);
|
||||
|
||||
}
|
||||
|
||||
/// @brief View report.
|
||||
void mFrame::ReportView(wxCommandEvent& WXUNUSED(event)) {
|
||||
View View(this, r);
|
||||
View.ShowModal();
|
||||
}
|
||||
|
||||
/// @brief Cancel reporter.
|
||||
void mFrame::Cancel(wxCommandEvent& WXUNUSED(event)) {
|
||||
Close(true);
|
||||
}
|
||||
|
||||
/// @brief Submit report
|
||||
void mFrame::Submit(wxCommandEvent& WXUNUSED(event)) {
|
||||
Progress *progress = new Progress(this);
|
||||
Upload *upload = new Upload(progress);
|
||||
upload->Report("./test.json");
|
||||
}
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
// Copyright (c) 2009, Amar Takhar <verm@aegisub.org>
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/// @file main.h
|
||||
/// @see main.cpp
|
||||
/// @ingroup base
|
||||
|
||||
#ifndef R_PRECOMP
|
||||
#include <wx/frame.h>
|
||||
#include <wx/event.h>
|
||||
#include <wx/window.h>
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/progdlg.h>
|
||||
#endif
|
||||
|
||||
#include "view.h"
|
||||
|
||||
/// @brief Reporter
|
||||
class Reporter : public wxApp {
|
||||
public:
|
||||
virtual bool OnInit();
|
||||
|
||||
private:
|
||||
Report *r;
|
||||
};
|
||||
|
||||
IMPLEMENT_APP(Reporter)
|
||||
|
||||
/// @brief Main frame.
|
||||
class mFrame : public wxFrame {
|
||||
public:
|
||||
mFrame(const wxString& window_title);
|
||||
void Submit(wxCommandEvent& event);
|
||||
void Cancel(wxCommandEvent& event);
|
||||
void ReportView(wxCommandEvent& event);
|
||||
void SetReport(Report *report) { r = report; }
|
||||
|
||||
private:
|
||||
Report *r;
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE(mFrame, wxFrame)
|
||||
EVT_BUTTON(wxID_OK, mFrame::Submit)
|
||||
EVT_BUTTON(wxID_CANCEL, mFrame::Cancel)
|
||||
EVT_BUTTON(42, mFrame::ReportView)
|
||||
END_EVENT_TABLE()
|
||||
|
|
@ -1,209 +0,0 @@
|
|||
// Copyright (c) 2009, Amar Takhar <verm@aegisub.org>
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/// @file platform.cpp
|
||||
/// @brief Base functions for the Platform class.
|
||||
/// @ingroup base
|
||||
|
||||
#ifndef R_PRECOMP
|
||||
#include <sstream>
|
||||
#include <wx/string.h>
|
||||
#include <wx/app.h>
|
||||
#include <wx/gdicmn.h> // Display* functions.
|
||||
#include <wx/version.h> // Version info.
|
||||
#include <wx/intl.h> // Locale info.
|
||||
#include <wx/glcanvas.h>
|
||||
#endif
|
||||
|
||||
#include "include/platform.h"
|
||||
#include "platform_windows.h"
|
||||
#include "platform_unix.h"
|
||||
#include "platform_unix_bsd.h"
|
||||
#include "platform_unix_linux.h"
|
||||
#include "platform_unix_osx.h"
|
||||
|
||||
extern "C" {
|
||||
#ifdef __WXMAC__
|
||||
#include "OpenGL/glu.h"
|
||||
#include "OpenGL/gl.h"
|
||||
#else
|
||||
#include <GL/glu.h>
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
}
|
||||
|
||||
/// @brief Constructor.
|
||||
Platform* Platform::GetPlatform() {
|
||||
#if defined(__WINDOWS__)
|
||||
Platform *p = new PlatformWindows;
|
||||
#elif defined(__UNIX__)
|
||||
# if defined(__FREEBSD__)
|
||||
Platform *p = new PlatformUnixBSD;
|
||||
# elif defined(__LINUX__)
|
||||
Platform *p = new PlatformUnixLinux;
|
||||
# elif defined(__APPLE__)
|
||||
Platform *p = new PlatformUnixOSX;
|
||||
# else
|
||||
Platform *p = new PlatformUnix;
|
||||
# endif
|
||||
#else
|
||||
Platform *p = NULL;
|
||||
#endif // __UNIX__
|
||||
p->Init();
|
||||
return p;
|
||||
}
|
||||
|
||||
/// @brief Init variables to avoid duplicate instantiations.
|
||||
void Platform::Init() {
|
||||
locale = new wxLocale();
|
||||
locale->Init();
|
||||
|
||||
int attList[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 };
|
||||
glc = new wxGLCanvas(wxTheApp->GetTopWindow(), wxID_ANY, attList, wxDefaultPosition, wxSize(0,0));
|
||||
ctx = new wxGLContext(glc, 0);
|
||||
wxGLCanvas &cr = *glc;
|
||||
ctx->SetCurrent(cr);
|
||||
|
||||
}
|
||||
|
||||
Platform::~Platform() {
|
||||
delete ctx;
|
||||
delete glc;
|
||||
delete locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gather video adapter information via OpenGL
|
||||
*
|
||||
*/
|
||||
std::string Platform::GetVideoInfo(enum Platform::VideoInfo which) {
|
||||
|
||||
std::string value;
|
||||
|
||||
switch (which) {
|
||||
case VIDEO_EXT:
|
||||
return reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS));
|
||||
break;
|
||||
case VIDEO_RENDERER:
|
||||
return reinterpret_cast<const char*>(glGetString(GL_RENDERER));
|
||||
break;
|
||||
case VIDEO_VENDOR:
|
||||
return reinterpret_cast<const char*>(glGetString(GL_VENDOR));
|
||||
break;
|
||||
case VIDEO_VERSION:
|
||||
return reinterpret_cast<const char*>(glGetString(GL_VERSION));
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Platform::ArchName() {
|
||||
return std::string(plat.GetArchName());
|
||||
}
|
||||
|
||||
std::string Platform::OSFamily() {
|
||||
return std::string(plat.GetOperatingSystemFamilyName());
|
||||
}
|
||||
|
||||
std::string Platform::OSName() {
|
||||
return std::string(plat.GetOperatingSystemIdName());
|
||||
}
|
||||
|
||||
std::string Platform::Endian() {
|
||||
return std::string(plat.GetEndiannessName());
|
||||
}
|
||||
|
||||
|
||||
int Platform::DisplayDepth() {
|
||||
return wxDisplayDepth();
|
||||
}
|
||||
|
||||
std::string Platform::DisplaySize() {
|
||||
int x, y;
|
||||
wxDisplaySize(&x, &y);
|
||||
std::stringstream ss;
|
||||
ss << x << " " << y;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
std::string Platform::DisplayPPI() {
|
||||
std::stringstream ss;
|
||||
ss << wxGetDisplayPPI().GetWidth() << " " << wxGetDisplayPPI().GetHeight();
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
std::string Platform::wxVersion() {
|
||||
std::stringstream ss;
|
||||
ss << wxMAJOR_VERSION << "." << wxMINOR_VERSION << "." << wxRELEASE_NUMBER << "." << wxSUBRELEASE_NUMBER;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
std::string Platform::Locale() {
|
||||
return std::string(wxLocale().GetSysName());
|
||||
}
|
||||
|
||||
const char* Platform::Language() {
|
||||
const wxLanguageInfo *info = locale->GetLanguageInfo(locale->GetLanguage());
|
||||
return info->CanonicalName.c_str();
|
||||
}
|
||||
|
||||
const char* Platform::SystemLanguage() {
|
||||
const wxLanguageInfo *info = locale->GetLanguageInfo(locale->GetSystemLanguage());
|
||||
return info->CanonicalName.c_str();
|
||||
}
|
||||
|
||||
std::string Platform::Date() {
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Platform::Signature() {
|
||||
return "";
|
||||
}
|
||||
|
||||
#ifdef __UNIX__
|
||||
const char* Platform::DesktopEnvironment() {
|
||||
return "";
|
||||
}
|
||||
#endif
|
||||
|
||||
std::string Platform::OpenGLVendor() {
|
||||
return GetVideoInfo(VIDEO_VENDOR);
|
||||
}
|
||||
|
||||
std::string Platform::OpenGLRenderer() {
|
||||
return GetVideoInfo(VIDEO_RENDERER);
|
||||
}
|
||||
|
||||
std::string Platform::OpenGLVersion() {
|
||||
return GetVideoInfo(VIDEO_VERSION);
|
||||
}
|
||||
|
||||
std::string Platform::OpenGLExt() {
|
||||
return GetVideoInfo(VIDEO_EXT);
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
std::string Platform::PatchLevel() {
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Platform::HardwareModel() {
|
||||
return "";
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,47 +0,0 @@
|
|||
// Copyright (c) 2009, Amar Takhar <verm@aegisub.org>
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/// @file platform_unix.cpp
|
||||
/// @brief Unix Platform extension.
|
||||
/// @ingroup unix
|
||||
|
||||
#ifndef R_PRECOMP
|
||||
#include <wx/string.h>
|
||||
#include <wx/app.h>
|
||||
#include <wx/apptrait.h>
|
||||
#endif
|
||||
|
||||
#include "include/platform.h"
|
||||
#include "platform_unix.h"
|
||||
|
||||
extern "C" {
|
||||
#include <sys/utsname.h>
|
||||
}
|
||||
|
||||
|
||||
const std::string PlatformUnix::OSVersion() {
|
||||
struct utsname name;
|
||||
if (uname(&name) != -1) {
|
||||
return name.release;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
const char* PlatformUnix::DesktopEnvironment() {
|
||||
return wxTheApp->GetTraits()->GetDesktopEnvironment().c_str();
|
||||
}
|
||||
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
// Copyright (c) 2009, Amar Takhar <verm@aegisub.org>
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/// @file platform_unix.h
|
||||
/// @see platform_unix.cpp
|
||||
/// @ingroup unix
|
||||
|
||||
class Platform;
|
||||
|
||||
/// @brief General Unix functions.
|
||||
class PlatformUnix : public Platform {
|
||||
public:
|
||||
PlatformUnix() {};
|
||||
virtual ~PlatformUnix() {};
|
||||
const std::string OSVersion();
|
||||
const char* DesktopEnvironment();
|
||||
|
||||
// Hardware
|
||||
virtual std::string CPUId() { return ""; }
|
||||
virtual std::string CPUSpeed() { return ""; }
|
||||
virtual int CPUCores() { return 0; }
|
||||
virtual int CPUCount() { return 0; }
|
||||
virtual std::string CPUFeatures() { return ""; }
|
||||
virtual std::string CPUFeatures2() { return ""; }
|
||||
virtual uint64_t Memory() { return 0; }
|
||||
|
||||
// Unix Specific
|
||||
virtual std::string UnixLibraries() { return ""; };
|
||||
};
|
|
@ -1,74 +0,0 @@
|
|||
// Copyright (c) 2009, Amar Takhar <verm@aegisub.org>
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/// @file platform_unix_bsd.cpp
|
||||
/// @brief BSD Platform extensions.
|
||||
/// @ingroup unix
|
||||
|
||||
#ifndef R_PRECOMP
|
||||
#include <wx/string.h>
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
}
|
||||
|
||||
#include "include/platform.h"
|
||||
#include "platform_unix.h"
|
||||
#include "platform_unix_bsd.h"
|
||||
|
||||
|
||||
std::string PlatformUnixBSD::CPUId() {
|
||||
char id[300];
|
||||
size_t len = sizeof(id);
|
||||
sysctlbyname("hw.model", &id, &len, NULL, 0);
|
||||
return id;
|
||||
}
|
||||
|
||||
std::string PlatformUnixBSD::CPUSpeed() {
|
||||
return "";
|
||||
}
|
||||
|
||||
int PlatformUnixBSD::CPUCores() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int PlatformUnixBSD::CPUCount() {
|
||||
int proc;
|
||||
size_t len = sizeof(proc);
|
||||
sysctlbyname("hw.ncpu", &proc, &len, NULL, 0);
|
||||
return proc;
|
||||
}
|
||||
|
||||
std::string PlatformUnixBSD::CPUFeatures() {
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string PlatformUnixBSD::CPUFeatures2() {
|
||||
return "";
|
||||
}
|
||||
|
||||
uint64_t PlatformUnixBSD::Memory() {
|
||||
uint64_t memory;
|
||||
size_t len = sizeof(memory);
|
||||
sysctlbyname("hw.physmem", &memory, &len, NULL, 0);
|
||||
return memory;
|
||||
}
|
||||
|
||||
std::string PlatformUnixBSD::UnixLibraries() {
|
||||
return "";
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
// Copyright (c) 2009, Amar Takhar <verm@aegisub.org>
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/// @file platform_unix_bsd.h
|
||||
/// @see platform_unix_bsd.cpp
|
||||
/// @ingroup unix
|
||||
|
||||
class Platform;
|
||||
|
||||
/// @brief BSD values.
|
||||
class PlatformUnixBSD : public PlatformUnix {
|
||||
public:
|
||||
PlatformUnixBSD() {};
|
||||
virtual ~PlatformUnixBSD() {};
|
||||
|
||||
// Hardware
|
||||
virtual std::string CPUId();
|
||||
virtual std::string CPUSpeed();
|
||||
virtual int CPUCores();
|
||||
virtual int CPUCount();
|
||||
virtual std::string CPUFeatures();
|
||||
virtual std::string CPUFeatures2();
|
||||
virtual uint64_t Memory();
|
||||
|
||||
// Unix Specific
|
||||
virtual std::string UnixLibraries();
|
||||
};
|
|
@ -1,109 +0,0 @@
|
|||
// Copyright (c) 2009, Grigori Goronzy <greg@geekmind.org>
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/// @file platform_unix_linux.cpp
|
||||
/// @brief Linux Platform extensions.
|
||||
/// @ingroup unix
|
||||
|
||||
#ifndef R_PRECOMP
|
||||
#include <wx/string.h>
|
||||
#include <wx/textfile.h>
|
||||
#include <wx/log.h>
|
||||
#endif
|
||||
|
||||
#include "include/platform.h"
|
||||
#include "platform_unix.h"
|
||||
#include "platform_unix_linux.h"
|
||||
|
||||
|
||||
std::string PlatformUnixLinux::CPUId() {
|
||||
return getProcValue("/proc/cpuinfo", "model name\t");
|
||||
};
|
||||
|
||||
std::string PlatformUnixLinux::CPUSpeed() {
|
||||
return getProcValue("/proc/cpuinfo", "cpu MHz\t\t");
|
||||
};
|
||||
|
||||
// Linux doesn't report the number of real CPUs or physical CPU cores,
|
||||
// but instead the number of "logical" CPUs; this also includes logical cores
|
||||
// due to SMT/HyperThreading.
|
||||
// For now report the logical CPU count and no number of cores; this seems
|
||||
// to make the most sense.
|
||||
int PlatformUnixLinux::CPUCores() {
|
||||
return -1;
|
||||
};
|
||||
|
||||
int PlatformUnixLinux::CPUCount() {
|
||||
// This returns the index of the last processor.
|
||||
// Increment and return as string.
|
||||
wxString procIndex = getProcValue("/proc/cpuinfo", "processor\t");
|
||||
if (procIndex.IsNumber()) {
|
||||
long val = 0;
|
||||
procIndex.ToLong(&val);
|
||||
return val + 1;
|
||||
}
|
||||
|
||||
// Fallback
|
||||
return 1;
|
||||
};
|
||||
|
||||
std::string PlatformUnixLinux::CPUFeatures() {
|
||||
return getProcValue("/proc/cpuinfo", "flags\t\t");
|
||||
};
|
||||
|
||||
std::string PlatformUnixLinux::CPUFeatures2() {
|
||||
return "";
|
||||
};
|
||||
|
||||
uint64_t PlatformUnixLinux::Memory() {
|
||||
wxString memKb = getProcValue("/proc/meminfo", "MemTotal");
|
||||
memKb = memKb.BeforeFirst(' ');
|
||||
if (memKb.IsNumber()) {
|
||||
long val = 0;
|
||||
memKb.ToLong(&val);
|
||||
return val * 1024;
|
||||
}
|
||||
|
||||
return -1;
|
||||
};
|
||||
|
||||
std::string PlatformUnixLinux::UnixLibraries() {
|
||||
return "";
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Parse a /proc "key: value" style text file and extract a value.
|
||||
* @return The last valid value
|
||||
*/
|
||||
std::string PlatformUnixLinux::getProcValue(const wxString path, const wxString key) {
|
||||
const wxString prefix = wxString(key) + ":";
|
||||
wxTextFile *file = new wxTextFile(path);
|
||||
wxString val = std::string();
|
||||
|
||||
file->Open();
|
||||
for (wxString str = file->GetFirstLine(); !file->Eof(); str = file->GetNextLine()) {
|
||||
str.Trim(false);
|
||||
if (str.StartsWith(prefix)) {
|
||||
val = wxString(str.Mid(key.Len() + 1));
|
||||
val.Trim(false);
|
||||
}
|
||||
}
|
||||
|
||||
file->Close();
|
||||
delete file;
|
||||
return std::string(val);
|
||||
};
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
// Copyright (c) 2009, Grigori Goronzy <greg@geekmind.org>
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/// @file platform_unix_linux.h
|
||||
/// @see platform_unix_linux.cpp
|
||||
/// @ingroup unix
|
||||
|
||||
class Platform;
|
||||
|
||||
/// @brief Linux values.
|
||||
class PlatformUnixLinux : public PlatformUnix {
|
||||
public:
|
||||
PlatformUnixLinux() {};
|
||||
virtual ~PlatformUnixLinux() {};
|
||||
|
||||
// Hardware
|
||||
virtual std::string CPUId();
|
||||
virtual std::string CPUSpeed();
|
||||
virtual int CPUCores();
|
||||
virtual int CPUCount();
|
||||
virtual std::string CPUFeatures();
|
||||
virtual std::string CPUFeatures2();
|
||||
virtual uint64_t Memory();
|
||||
|
||||
// Unix Specific
|
||||
virtual std::string UnixLibraries();
|
||||
private:
|
||||
virtual std::string getProcValue(const wxString path, const wxString key);
|
||||
};
|
|
@ -1,95 +0,0 @@
|
|||
// Copyright (c) 2009, Amar Takhar <verm@aegisub.org>
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/// @file platform_unix_bsd.cpp
|
||||
/// @brief BSD Platform extensions.
|
||||
/// @ingroup unix
|
||||
|
||||
#ifndef R_PRECOMP
|
||||
#include <wx/string.h>
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
}
|
||||
|
||||
#include "include/platform.h"
|
||||
#include "platform_unix.h"
|
||||
#include "platform_unix_osx.h"
|
||||
|
||||
|
||||
std::string PlatformUnixOSX::CPUId() {
|
||||
char id[300];
|
||||
size_t len = sizeof(id);
|
||||
sysctlbyname("machdep.cpu.brand_string", &id, &len, NULL, 0);
|
||||
return wxString::Format("%s", id).ToStdString();
|
||||
};
|
||||
|
||||
std::string PlatformUnixOSX::CPUSpeed() {
|
||||
uint64_t speed;
|
||||
size_t len = sizeof(speed);
|
||||
sysctlbyname("hw.cpufrequency_max", &speed, &len, NULL, 0);
|
||||
return wxString::Format("%d", speed / (1000*1000)).ToStdString();
|
||||
};
|
||||
|
||||
int PlatformUnixOSX::CPUCores() {
|
||||
return 0;
|
||||
};
|
||||
|
||||
int PlatformUnixOSX::CPUCount() {
|
||||
int proc;
|
||||
size_t len = sizeof(proc);
|
||||
sysctlbyname("hw.ncpu", &proc, &len, NULL, 0);
|
||||
return proc;
|
||||
};
|
||||
|
||||
std::string PlatformUnixOSX::CPUFeatures() {
|
||||
char feat[300];
|
||||
size_t len = sizeof(feat);
|
||||
sysctlbyname("machdep.cpu.features", &feat, &len, NULL, 0);
|
||||
return wxString::Format("%s", feat).ToStdString();
|
||||
};
|
||||
|
||||
std::string PlatformUnixOSX::CPUFeatures2() {
|
||||
char feat[128];
|
||||
size_t len = sizeof(feat);
|
||||
sysctlbyname("machdep.cpu.extfeatures", &feat, &len, NULL, 0);
|
||||
return wxString::Format("%s", feat).ToStdString();
|
||||
};
|
||||
|
||||
uint64_t PlatformUnixOSX::Memory() {
|
||||
uint64_t memory;
|
||||
size_t len = sizeof(memory);
|
||||
sysctlbyname("hw.memsize", &memory, &len, NULL, 0);
|
||||
return memory;
|
||||
};
|
||||
|
||||
std::string PlatformUnixOSX::UnixLibraries() {
|
||||
return "";
|
||||
};
|
||||
|
||||
std::string PlatformUnixOSX::PatchLevel() {
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string PlatformUnixOSX::HardwareModel() {
|
||||
char model[300];
|
||||
size_t len = sizeof(model);
|
||||
sysctlbyname("hw.model", &model, &len, NULL, 0);
|
||||
return wxString::Format("%s", model).ToStdString();
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
// Copyright (c) 2009, Amar Takhar <verm@aegisub.org>
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
/// @file platform_unix_bsd.h
|
||||
/// @see platform_unix_bsd.cpp
|
||||
/// @ingroup unix
|
||||
|
||||
class Platform;
|
||||
|
||||
/// @brief BSD values.
|
||||
class PlatformUnixOSX : public PlatformUnix {
|
||||
public:
|
||||
PlatformUnixOSX() {};
|
||||
virtual ~PlatformUnixOSX() {};
|
||||
|
||||
// Hardware
|
||||
virtual std::string CPUId();
|
||||
virtual std::string CPUSpeed();
|
||||
virtual int CPUCores();
|
||||
virtual int CPUCount();
|
||||
virtual std::string CPUFeatures();
|
||||
virtual std::string CPUFeatures2();
|
||||
virtual uint64_t Memory();
|
||||
|
||||
virtual std::string PatchLevel();
|
||||
virtual std::string HardwareModel();
|
||||
|
||||
// Unix Specific
|
||||
virtual std::string UnixLibraries();
|
||||
};
|
|
@ -1,104 +0,0 @@
|
|||
// Copyright (c) 2009, Amar Takhar <verm@aegisub.org>
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
//
|
||||
// $Id: platform_unix.cpp 3592 2009-09-27 04:15:41Z greg $
|
||||
|
||||
/// @file platform_unix.cpp
|
||||
/// @brief Unix Platform extension.
|
||||
/// @ingroup unix
|
||||
|
||||
#ifndef R_PRECOMP
|
||||
#include <wx/string.h>
|
||||
# |