forked from mia/Aegisub
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>
|
||||
#include <wx/app.h>
|
||||
#include <wx/apptrait.h>
|
||||
#endif
|
||||
|
||||
#include "include/platform.h"
|
||||
#include "platform_windows.h"
|
||||
|
||||
std::string PlatformWindows::OSVersion() {
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string PlatformWindows::DesktopEnvironment() {
|
||||
return wxTheApp->GetTraits()->GetDesktopEnvironment();
|
||||
}
|
||||
|
||||
std::string PlatformWindows::CPUId() {
|
||||
return "";
|
||||
};
|
||||
|
||||
std::string PlatformWindows::CPUSpeed() {
|
||||
return "";
|
||||
};
|
||||
|
||||
std::string PlatformWindows::CPUCores() {
|
||||
return "";
|
||||
};
|
||||
|
||||
std::string PlatformWindows::CPUCount() {
|
||||
return "";
|
||||
};
|
||||
|
||||
std::string PlatformWindows::CPUFeatures() {
|
||||
return "";
|
||||
};
|
||||
|
||||
std::string PlatformWindows::CPUFeatures2() {
|
||||
return "";
|
||||
};
|
||||
|
||||
std::string PlatformWindows::Memory() {
|
||||
return "";
|
||||
};
|
||||
|
||||
std::string PlatformWindows::ServicePack() {
|
||||
return "";
|
||||
};
|
||||
|
||||
std::string PlatformWindows::DriverGraphicsVersion() {
|
||||
return "";
|
||||
};
|
||||
|
||||
std::string PlatformWindows::DirectShowFilters() {
|
||||
return "";
|
||||
};
|
||||
|
||||
std::string PlatformWindows::AntiVirus() {
|
||||
return "";
|
||||
};
|
||||
|
||||
std::string PlatformWindows::Firewall() {
|
||||
return "";
|
||||
};
|
||||
|
||||
std::string PlatformWindows::DLLVersions() {
|
||||
return "";
|
||||
};
|
||||
|
||||
std::string PlatformWindows::OpenGLVendor() {
|
||||
return "";
|
||||
};
|
||||
|
||||
std::string PlatformWindows::OpenGLRenderer() {
|
||||
return "";
|
||||
};
|
||||
|
||||
std::string PlatformWindows::OpenGLVersion() {
|
||||
return "";
|
||||
};
|
||||
|
||||
std::string PlatformWindows::OpenGLExt() {
|
||||
return "";
|
||||
};
|
|
@ -1,53 +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.h 3592 2009-09-27 04:15:41Z greg $
|
||||
|
||||
/// @file platform_unix.h
|
||||
/// @see platform_unix.cpp
|
||||
/// @ingroup unix
|
||||
|
||||
class Platform;
|
||||
|
||||
/// @brief General Windows functions.
|
||||
class PlatformWindows : public Platform {
|
||||
public:
|
||||
PlatformWindows() {};
|
||||
virtual ~PlatformWindows() {};
|
||||
const std::string OSVersion();
|
||||
const char* DesktopEnvironment();
|
||||
|
||||
// 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();
|
||||
|
||||
// OpenGL
|
||||
virtual std::string OpenGLVendor();
|
||||
virtual std::string OpenGLRenderer();
|
||||
virtual std::string OpenGLVersion();
|
||||
virtual std::string OpenGLExt();
|
||||
|
||||
// Windows Specific
|
||||
virtual std::string ServicePack();
|
||||
virtual std::string DriverGraphicsVersion();
|
||||
virtual std::string DirectShowFilters();
|
||||
virtual std::string AntiVirus();
|
||||
virtual std::string Firewall();
|
||||
virtual std::string DLLVersions();
|
||||
};
|
|
@ -1,41 +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 progress.cpp
|
||||
/// @brief Progress bar when uploading data.
|
||||
/// @ingroup base
|
||||
|
||||
#include "progress.h"
|
||||
|
||||
/// @brief Constructor
|
||||
/// @param frame Main frame.
|
||||
Progress::Progress(wxWindow *frame)
|
||||
: wxProgressDialog(_("Progress"), _("Sending data, please wait."), 100, frame, wxPD_CAN_ABORT|wxPD_ELAPSED_TIME|wxPD_ESTIMATED_TIME|wxPD_REMAINING_TIME|wxPD_AUTO_HIDE) {
|
||||
}
|
||||
|
||||
/// @brief Cancel the transfer.
|
||||
/// This closes the dialog.
|
||||
void Progress::Cancel(wxCommandEvent& WXUNUSED(event)) {
|
||||
printf("close");
|
||||
Destroy();
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(Progress, wxProgressDialog)
|
||||
EVT_BUTTON(wxID_CLOSE, Progress::Cancel)
|
||||
EVT_BUTTON(wxID_CANCEL, Progress::Cancel)
|
||||
EVT_CLOSE(Progress::Close)
|
||||
END_EVENT_TABLE()
|
||||
|
|
@ -1,36 +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 progress.h
|
||||
/// @see progress.cpp
|
||||
/// @ingroup base io
|
||||
|
||||
#ifndef R_PRECOMP
|
||||
#include <wx/progdlg.h>
|
||||
#endif
|
||||
|
||||
/// @class Progress
|
||||
/// @brief Progress bar.
|
||||
/// @note The Constructor decleration is in main.cpp
|
||||
class Progress: public wxProgressDialog {
|
||||
public:
|
||||
Progress(wxWindow *frame);
|
||||
private:
|
||||
/// @brief No-op incase the user hits the window manager close button.
|
||||
void Close(wxCloseEvent &event) {};
|
||||
void Cancel(wxCommandEvent& event);
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
|
@ -1,23 +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: r_pre.h 3591 2009-09-27 03:12:17Z greg $
|
||||
|
||||
/// @file wx_pre.h
|
||||
/// @brief Precompiled header.
|
||||
/// @ingroup base
|
||||
|
||||
#ifndef R_PRE
|
||||
#include "r_pre.h"
|
||||
#endif
|
|
@ -1,70 +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 wx_pre.h
|
||||
/// @brief Precompiled header.
|
||||
/// @ingroup base
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#define R_PRECOMP
|
||||
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
// C + System.
|
||||
#include <locale.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// C++ std
|
||||
#include <sstream>
|
||||
|
||||
// 3rd party packages.
|
||||
#include <curl/curl.h>
|
||||
|
||||
|
||||
// WX headers
|
||||
#include <wx/wxprec.h>
|
||||
#include <wx/app.h>
|
||||
#include <wx/apptrait.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/clipbrd.h>
|
||||
#include <wx/cmdline.h>
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/event.h>
|
||||
#include <wx/file.h>
|
||||
#include <wx/fileconf.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/frame.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/glcanvas.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/progdlg.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/stdpaths.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/version.h>
|
||||
#include <wx/wfstream.h>
|
||||
#include <wx/window.h>
|
||||
#include <wx/wx.h>
|
||||
#include <wx/wxchar.h>
|
||||
#include <wx/wxprec.h>
|
||||
|
||||
#endif
|
|
@ -1,130 +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 report.cpp
|
||||
/// @brief Generation and manipulation of reports.
|
||||
/// @ingroup base
|
||||
|
||||
#ifndef R_PRECOMP
|
||||
#include <wx/intl.h>
|
||||
#include <wx/log.h>
|
||||
#endif
|
||||
|
||||
#include <libaegisub/io.h>
|
||||
#include <libaegisub/cajun/elements.h>
|
||||
#include <libaegisub/cajun/writer.h>
|
||||
|
||||
|
||||
#include "report.h"
|
||||
#include "include/platform.h"
|
||||
#include "aegisub.h"
|
||||
|
||||
/// @brief Contstructor
|
||||
Report::Report() {
|
||||
|
||||
json::Object root;
|
||||
|
||||
Platform *p = Platform::GetPlatform();
|
||||
Aegisub a;
|
||||
|
||||
json::Object& general = root["General"];
|
||||
general["Signature"] = p->Signature();
|
||||
general["Date"] = p->Date();
|
||||
general["Architecture"] = p->ArchName();
|
||||
general["OS Family"] = p->OSFamily();
|
||||
general["OS Name"] = p->OSName();
|
||||
general["Endian"] = p->Endian();
|
||||
general["OS Version"] = p->OSVersion();
|
||||
general["wx Version"] = p->wxVersion();
|
||||
general["Locale"] = p->Locale();
|
||||
general["Language"] = p->Language();
|
||||
general["System Language"] = p->SystemLanguage();
|
||||
|
||||
try {
|
||||
json::Object& aegisub = root["Aegisub"];
|
||||
aegisub["Last Version"] = a.GetString("Version/Last Version");
|
||||
aegisub["Spelling Language"] = a.GetString("Tool/Spell Checker/Language");
|
||||
aegisub["Thesaurus Language"] = a.GetString("Tool/Thesaurus/Language");
|
||||
aegisub["Audio Player"] = a.GetString("Audio/Player");
|
||||
aegisub["Audio Provider"] = a.GetString("Audio/Provider");
|
||||
aegisub["Video Provider"] = a.GetString("Video/Provider");
|
||||
aegisub["Subtitles Provider"] = a.GetString("Subtitle/Provider");
|
||||
aegisub["Save Charset"] = a.GetString("App/Save Charset");
|
||||
aegisub["Grid Font Size"] = a.GetInt("Grid/Font Size");
|
||||
aegisub["Edit Font Size"] = a.GetInt("Subtitle/Edit Box/Font Size");
|
||||
aegisub["Spectrum Enabled"] = a.GetBool("Audio/Spectrum");
|
||||
aegisub["Spectrum Quality"] = a.GetInt("Audio/Renderer/Spectrum/Quality");
|
||||
aegisub["Call Tips Enabled"] = a.GetBool("App/Call Tips");
|
||||
aegisub["Medusa Hotkeys Enabled"] = a.GetBool("Audio/Medusa Timing Hotkeys");
|
||||
} catch(...) {
|
||||
root["Aegisub"]["Error"] = json::String("Config file is corrupted");
|
||||
}
|
||||
|
||||
json::Object& hardware = root["Hardware"];
|
||||
hardware["Memory Size"] = 0;
|
||||
|
||||
json::Object& cpu = root["CPU"];
|
||||
cpu["Id"] = p->CPUId();
|
||||
cpu["Speed"] = p->CPUSpeed();
|
||||
cpu["Count"] = p->CPUCount();
|
||||
cpu["Cores"] = p->CPUCores();
|
||||
cpu["Features"] = p->CPUFeatures();
|
||||
cpu["Features2"] = p->CPUFeatures2();
|
||||
|
||||
json::Object& display = root["Display"];
|
||||
display["Depth"] = p->DisplayDepth();
|
||||
display["Size"] = p->DisplaySize();
|
||||
display["Pixels Per Inch"] = p->DisplayPPI();
|
||||
|
||||
json::Object& gl = display["OpenGL"];
|
||||
gl["Vendor"] = p->OpenGLVendor();
|
||||
gl["Renderer"] = p->OpenGLRenderer();
|
||||
gl["Version"] = p->OpenGLVersion();
|
||||
gl["Extensions"] = p->OpenGLExt();
|
||||
display["OpenGL"] = gl;
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
json::Object& windows = root["Windows"];
|
||||
windows["Service Pack"] = json::String();
|
||||
windows["Graphics Driver Version"] = json::String();
|
||||
windows["DirectShow Filters"] = json::String();
|
||||
windows["AntiVirus Installed"] = json::Boolean();
|
||||
windows["Firewall Installed"] = json::Boolean();
|
||||
windows["DLL"] = json::String();
|
||||
#endif
|
||||
|
||||
#ifdef __UNIX__
|
||||
json::Object& u_nix = root["Unix"];
|
||||
u_nix["Desktop Environment"] = p->DesktopEnvironment();
|
||||
u_nix["Libraries"] = p->UnixLibraries();
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
json::Object& osx = root["OS X"];
|
||||
osx["Patch"] = p->PatchLevel();
|
||||
osx["Model"] = p->HardwareModel();
|
||||
#endif
|
||||
|
||||
agi::io::Save file("./t.json");
|
||||
json::Writer::Write(root, file.Get());
|
||||
|
||||
}
|
||||
|
||||
/// @brief Return Report as Text for the Clipboard.
|
||||
void Report::Save(std::string filename) {
|
||||
// agi::io::Save file(filename);
|
||||
// json::Writer::Write(root, file.Get());
|
||||
}
|
|
@ -1,37 +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 report.h
|
||||
/// @see report.cpp
|
||||
/// @ingroup base
|
||||
|
||||
#ifndef R_PRECOMP
|
||||
#endif
|
||||
|
||||
/// @class Report
|
||||
/// @brief Report generator.
|
||||
class Report {
|
||||
|
||||
public:
|
||||
Report();
|
||||
~Report() {};
|
||||
|
||||
/// Save JSON report to a file.
|
||||
void Save(std::string filename);
|
||||
|
||||
private:
|
||||
wxLocale *locale;
|
||||
};
|
|
@ -1,324 +0,0 @@
|
|||
/*-
|
||||
* Copyright 2005 Colin Percival
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/lib/libmd/sha256c.c,v 1.1 2005/03/09 19:23:04 cperciva Exp $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/** @file sha256.c
|
||||
* @brief Generate SHA256 hashes.
|
||||
* @ingroup base
|
||||
*/
|
||||
|
||||
/** @class SHA256Context
|
||||
* @brief Generate SHA256 hashes.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "sha256.h"
|
||||
|
||||
static __inline uint32_t
|
||||
be32dec(const void *pp)
|
||||
{
|
||||
unsigned char const *p = (unsigned char const *)pp;
|
||||
|
||||
return ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
|
||||
}
|
||||
|
||||
static __inline void
|
||||
be32enc(void *pp, uint32_t u)
|
||||
{
|
||||
unsigned char *p = (unsigned char *)pp;
|
||||
|
||||
p[0] = (u >> 24) & 0xff;
|
||||
p[1] = (u >> 16) & 0xff;
|
||||
p[2] = (u >> 8) & 0xff;
|
||||
p[3] = u & 0xff;
|
||||
}
|
||||
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
|
||||
/* Copy a vector of big-endian uint32_t into a vector of bytes */
|
||||
#define be32enc_vect(dst, src, len) \
|
||||
memcpy((void *)dst, (const void *)src, (size_t)len)
|
||||
|
||||
/* Copy a vector of bytes into a vector of big-endian uint32_t */
|
||||
#define be32dec_vect(dst, src, len) \
|
||||
memcpy((void *)dst, (const void *)src, (size_t)len)
|
||||
|
||||
#else /* BYTE_ORDER != BIG_ENDIAN */
|
||||
|
||||
/*
|
||||
* Encode a length len/4 vector of (uint32_t) into a length len vector of
|
||||
* (unsigned char) in big-endian form. Assumes len is a multiple of 4.
|
||||
*/
|
||||
static void
|
||||
be32enc_vect(unsigned char *dst, const uint32_t *src, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < len / 4; i++)
|
||||
be32enc(dst + i * 4, src[i]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Decode a big-endian length len vector of (unsigned char) into a length
|
||||
* len/4 vector of (uint32_t). Assumes len is a multiple of 4.
|
||||
*/
|
||||
static void
|
||||
be32dec_vect(uint32_t *dst, const unsigned char *src, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < len / 4; i++)
|
||||
dst[i] = be32dec(src + i * 4);
|
||||
}
|
||||
|
||||
#endif /* BYTE_ORDER != BIG_ENDIAN */
|
||||
|
||||
/* Elementary functions used by SHA256 */
|
||||
#define Ch(x, y, z) ((x & (y ^ z)) ^ z)
|
||||
#define Maj(x, y, z) ((x & (y | z)) | (y & z))
|
||||
#define SHR(x, n) (x >> n)
|
||||
#define ROTR(x, n) ((x >> n) | (x << (32 - n)))
|
||||
#define S0(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
|
||||
#define S1(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
|
||||
#define s0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ SHR(x, 3))
|
||||
#define s1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ SHR(x, 10))
|
||||
|
||||
/* SHA256 round function */
|
||||
#define RND(a, b, c, d, e, f, g, h, k) \
|
||||
t0 = h + S1(e) + Ch(e, f, g) + k; \
|
||||
t1 = S0(a) + Maj(a, b, c); \
|
||||
d += t0; \
|
||||
h = t0 + t1;
|
||||
|
||||
/* Adjusted round function for rotating state */
|
||||
#define RNDr(S, W, i, k) \
|
||||
RND(S[(64 - i) % 8], S[(65 - i) % 8], \
|
||||
S[(66 - i) % 8], S[(67 - i) % 8], \
|
||||
S[(68 - i) % 8], S[(69 - i) % 8], \
|
||||
S[(70 - i) % 8], S[(71 - i) % 8], \
|
||||
W[i] + k)
|
||||
|
||||
/*
|
||||
* SHA256 block compression function. The 256-bit state is transformed via
|
||||
* the 512-bit input block to produce a new state.
|
||||
*/
|
||||
static void
|
||||
SHA256_Transform(uint32_t * state, const unsigned char block[64])
|
||||
{
|
||||
uint32_t W[64];
|
||||
uint32_t S[8];
|
||||
uint32_t t0, t1;
|
||||
int i;
|
||||
|
||||
/* 1. Prepare message schedule W. */
|
||||
be32dec_vect(W, block, 64);
|
||||
for (i = 16; i < 64; i++)
|
||||
W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16];
|
||||
|
||||
/* 2. Initialize working variables. */
|
||||
memcpy(S, state, 32);
|
||||
|
||||
/* 3. Mix. */
|
||||
RNDr(S, W, 0, 0x428a2f98);
|
||||
RNDr(S, W, 1, 0x71374491);
|
||||
RNDr(S, W, 2, 0xb5c0fbcf);
|
||||
RNDr(S, W, 3, 0xe9b5dba5);
|
||||
RNDr(S, W, 4, 0x3956c25b);
|
||||
RNDr(S, W, 5, 0x59f111f1);
|
||||
RNDr(S, W, 6, 0x923f82a4);
|
||||
RNDr(S, W, 7, 0xab1c5ed5);
|
||||
RNDr(S, W, 8, 0xd807aa98);
|
||||
RNDr(S, W, 9, 0x12835b01);
|
||||
RNDr(S, W, 10, 0x243185be);
|
||||
RNDr(S, W, 11, 0x550c7dc3);
|
||||
RNDr(S, W, 12, 0x72be5d74);
|
||||
RNDr(S, W, 13, 0x80deb1fe);
|
||||
RNDr(S, W, 14, 0x9bdc06a7);
|
||||
RNDr(S, W, 15, 0xc19bf174);
|
||||
RNDr(S, W, 16, 0xe49b69c1);
|
||||
RNDr(S, W, 17, 0xefbe4786);
|
||||
RNDr(S, W, 18, 0x0fc19dc6);
|
||||
RNDr(S, W, 19, 0x240ca1cc);
|
||||
RNDr(S, W, 20, 0x2de92c6f);
|
||||
RNDr(S, W, 21, 0x4a7484aa);
|
||||
RNDr(S, W, 22, 0x5cb0a9dc);
|
||||
RNDr(S, W, 23, 0x76f988da);
|
||||
RNDr(S, W, 24, 0x983e5152);
|
||||
RNDr(S, W, 25, 0xa831c66d);
|
||||
RNDr(S, W, 26, 0xb00327c8);
|
||||
RNDr(S, W, 27, 0xbf597fc7);
|
||||
RNDr(S, W, 28, 0xc6e00bf3);
|
||||
RNDr(S, W, 29, 0xd5a79147);
|
||||
RNDr(S, W, 30, 0x06ca6351);
|
||||
RNDr(S, W, 31, 0x14292967);
|
||||
RNDr(S, W, 32, 0x27b70a85);
|
||||
RNDr(S, W, 33, 0x2e1b2138);
|
||||
RNDr(S, W, 34, 0x4d2c6dfc);
|
||||
RNDr(S, W, 35, 0x53380d13);
|
||||
RNDr(S, W, 36, 0x650a7354);
|
||||
RNDr(S, W, 37, 0x766a0abb);
|
||||
RNDr(S, W, 38, 0x81c2c92e);
|
||||
RNDr(S, W, 39, 0x92722c85);
|
||||
RNDr(S, W, 40, 0xa2bfe8a1);
|
||||
RNDr(S, W, 41, 0xa81a664b);
|
||||
RNDr(S, W, 42, 0xc24b8b70);
|
||||
RNDr(S, W, 43, 0xc76c51a3);
|
||||
RNDr(S, W, 44, 0xd192e819);
|
||||
RNDr(S, W, 45, 0xd6990624);
|
||||
RNDr(S, W, 46, 0xf40e3585);
|
||||
RNDr(S, W, 47, 0x106aa070);
|
||||
RNDr(S, W, 48, 0x19a4c116);
|
||||
RNDr(S, W, 49, 0x1e376c08);
|
||||
RNDr(S, W, 50, 0x2748774c);
|
||||
RNDr(S, W, 51, 0x34b0bcb5);
|
||||
RNDr(S, W, 52, 0x391c0cb3);
|
||||
RNDr(S, W, 53, 0x4ed8aa4a);
|
||||
RNDr(S, W, 54, 0x5b9cca4f);
|
||||
RNDr(S, W, 55, 0x682e6ff3);
|
||||
RNDr(S, W, 56, 0x748f82ee);
|
||||
RNDr(S, W, 57, 0x78a5636f);
|
||||
RNDr(S, W, 58, 0x84c87814);
|
||||
RNDr(S, W, 59, 0x8cc70208);
|
||||
RNDr(S, W, 60, 0x90befffa);
|
||||
RNDr(S, W, 61, 0xa4506ceb);
|
||||
RNDr(S, W, 62, 0xbef9a3f7);
|
||||
RNDr(S, W, 63, 0xc67178f2);
|
||||
|
||||
/* 4. Mix local working variables into global state */
|
||||
for (i = 0; i < 8; i++)
|
||||
state[i] += S[i];
|
||||
}
|
||||
|
||||
static unsigned char PAD[64] = {
|
||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
/* Add padding and terminating bit-count. */
|
||||
static void
|
||||
SHA256_Pad(SHA256_CTX * ctx)
|
||||
{
|
||||
unsigned char len[8];
|
||||
uint32_t r, plen;
|
||||
|
||||
/*
|
||||
* Convert length to a vector of bytes -- we do this now rather
|
||||
* than later because the length will change after we pad.
|
||||
*/
|
||||
be32enc_vect(len, ctx->count, 8);
|
||||
|
||||
/* Add 1--64 bytes so that the resulting length is 56 mod 64 */
|
||||
r = (ctx->count[1] >> 3) & 0x3f;
|
||||
plen = (r < 56) ? (56 - r) : (120 - r);
|
||||
SHA256_Update(ctx, PAD, (size_t)plen);
|
||||
|
||||
/* Add the terminating bit-count */
|
||||
SHA256_Update(ctx, len, 8);
|
||||
}
|
||||
|
||||
/* SHA-256 initialization. Begins a SHA-256 operation. */
|
||||
void
|
||||
SHA256_Init(SHA256_CTX * ctx)
|
||||
{
|
||||
|
||||
/* Zero bits processed so far */
|
||||
ctx->count[0] = ctx->count[1] = 0;
|
||||
|
||||
/* Magic initialization constants */
|
||||
ctx->state[0] = 0x6A09E667;
|
||||
ctx->state[1] = 0xBB67AE85;
|
||||
ctx->state[2] = 0x3C6EF372;
|
||||
ctx->state[3] = 0xA54FF53A;
|
||||
ctx->state[4] = 0x510E527F;
|
||||
ctx->state[5] = 0x9B05688C;
|
||||
ctx->state[6] = 0x1F83D9AB;
|
||||
ctx->state[7] = 0x5BE0CD19;
|
||||
}
|
||||
|
||||
/* Add bytes into the hash */
|
||||
void
|
||||
SHA256_Update(SHA256_CTX * ctx, const unsigned char *src, size_t len)
|
||||
{
|
||||
uint32_t bitlen[2];
|
||||
uint32_t r;
|
||||
|
||||
/* Number of bytes left in the buffer from previous updates */
|
||||
r = (ctx->count[1] >> 3) & 0x3f;
|
||||
|
||||
/* Convert the length into a number of bits */
|
||||
bitlen[1] = ((uint32_t)len) << 3;
|
||||
bitlen[0] = (uint32_t)(len >> 29);
|
||||
|
||||
/* Update number of bits */
|
||||
if ((ctx->count[1] += bitlen[1]) < bitlen[1])
|
||||
ctx->count[0]++;
|
||||
ctx->count[0] += bitlen[0];
|
||||
|
||||
/* Handle the case where we don't need to perform any transforms */
|
||||
if (len < 64 - r) {
|
||||
memcpy(&ctx->buf[r], src, len);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Finish the current block */
|
||||
memcpy(&ctx->buf[r], src, 64 - r);
|
||||
SHA256_Transform(ctx->state, ctx->buf);
|
||||
src += 64 - r;
|
||||
len -= 64 - r;
|
||||
|
||||
/* Perform complete blocks */
|
||||
while (len >= 64) {
|
||||
SHA256_Transform(ctx->state, src);
|
||||
src += 64;
|
||||
len -= 64;
|
||||
}
|
||||
|
||||
/* Copy left over data into buffer */
|
||||
memcpy(ctx->buf, src, len);
|
||||
}
|
||||
|
||||
/*
|
||||
* SHA-256 finalization. Pads the input data, exports the hash value,
|
||||
* and clears the context state.
|
||||
*/
|
||||
void
|
||||
SHA256_Final(unsigned char digest[32], SHA256_CTX * ctx)
|
||||
{
|
||||
|
||||
/* Add padding */
|
||||
SHA256_Pad(ctx);
|
||||
|
||||
/* Write the hash */
|
||||
be32enc_vect(digest, ctx->state, 32);
|
||||
|
||||
/* Clear the context state */
|
||||
memset((void *)ctx, 0, sizeof(*ctx));
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
/*-
|
||||
* Copyright 2005 Colin Percival
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/lib/libmd/sha256.h,v 1.1 2005/03/09 19:23:04 cperciva Exp $
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/** @file sha256.h
|
||||
* @see sha256.c
|
||||
* @ingroup base
|
||||
*/
|
||||
|
||||
#ifndef _SHA256_H_
|
||||
#define _SHA256_H_
|
||||
|
||||
#ifndef R_PRECOMP
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
typedef struct SHA256Context {
|
||||
uint32_t state[8];
|
||||
uint32_t count[2];
|
||||
unsigned char buf[64];
|
||||
} SHA256_CTX;
|
||||
|
||||
void SHA256_Init(SHA256_CTX *);
|
||||
void SHA256_Update(SHA256_CTX *, const unsigned char *, size_t);
|
||||
void SHA256_Final(unsigned char [32], SHA256_CTX *);
|
||||
|
||||
#endif /* !_SHA256_H_ */
|
|
@ -1,149 +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 upload.cpp
|
||||
/// @brief Handle uploading of data.
|
||||
/// @ingroup base io
|
||||
|
||||
#ifndef R_PRECOMP
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <wx/file.h>
|
||||
#endif
|
||||
|
||||
#include "upload.h"
|
||||
|
||||
/// @brief Constructor.
|
||||
Upload::Upload(Progress *prog) {
|
||||
/// XXX: error checking.
|
||||
progress = prog;
|
||||
handle = curl_easy_init();
|
||||
// curl_easy_setopt(handle, CURLOPT_VERBOSE, 1L);
|
||||
curl_easy_setopt(handle, CURLOPT_USERAGENT, "Reporter v1.0");
|
||||
curl_easy_setopt(handle, CURLOPT_READFUNCTION, CBRead);
|
||||
curl_easy_setopt(handle, CURLOPT_PROGRESSFUNCTION, CBProgress);
|
||||
curl_easy_setopt(handle, CURLOPT_NOPROGRESS, 0L);
|
||||
curl_easy_setopt(handle, CURLOPT_PROGRESSDATA, progress);
|
||||
}
|
||||
|
||||
|
||||
/// @brief Destructor.
|
||||
Upload::~Upload() {
|
||||
curl_free(handle);
|
||||
}
|
||||
|
||||
|
||||
/// @brief Submit a JSON report.
|
||||
/// @param report filename of the report.
|
||||
void Upload::Report(std::string report) {
|
||||
wxFile file(report, wxFile::read);
|
||||
SendFile("http://reporter.darkbeer.org/PUT/", file);
|
||||
}
|
||||
|
||||
|
||||
/// @brief Progress callback.
|
||||
/// @param p pointer to progress info.
|
||||
/// @param dlt download size.
|
||||
/// @param dln downloaded.
|
||||
/// @param ult upload size.
|
||||
/// @param uln uploaded.
|
||||
int Upload::CBProgress(void *p, double dlt, double dln, double ult, double uln) {
|
||||
|
||||
if (uln > 0) {
|
||||
Progress *progress = (Progress*) p;
|
||||
// Update returns false if the user has hit abort.
|
||||
if (!progress->Update(floor(ult / uln + 0.5) * 100))
|
||||
// Returning non-zero will cause curl to abort the transfer.
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/// @brief Callback to read data from a FD.
|
||||
/// @param p buffer to fill.
|
||||
/// @param size byte length.
|
||||
/// @param nmemb object size.
|
||||
/// @param filep FP to read from.
|
||||
size_t Upload::CBRead(char *p, size_t size, size_t nmemb, void *filep) {
|
||||
// This is on purpose to wx doesn't close the fp, curl does that for us.
|
||||
wxFile *file = new wxFile((uintptr_t)filep);
|
||||
|
||||
if (file->Eof())
|
||||
return 0;
|
||||
|
||||
int ret = file->Read(p, file->Length());
|
||||
if (ret == wxInvalidOffset)
|
||||
return CURL_READFUNC_ABORT;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/// @brief Send a file to the server
|
||||
/// @param file file to send.
|
||||
/// @return 1/0 for success/failure.
|
||||
bool Upload::SendFile(const char *url, wxFile &file) {
|
||||
progress->Update(0, _("Connecting..."));
|
||||
curl_easy_setopt(handle, CURLOPT_URL, url);
|
||||
Error(curl_easy_perform(handle));
|
||||
|
||||
curl_easy_setopt(handle, CURLOPT_UPLOAD, 1L);
|
||||
curl_easy_setopt(handle, CURLOPT_PUT, 1L);
|
||||
curl_easy_setopt(handle, CURLOPT_READDATA, file.fd());
|
||||
curl_easy_setopt(handle, CURLOPT_INFILESIZE_LARGE, (curl_off_t)file.Length());
|
||||
CURLcode res = curl_easy_perform(handle);
|
||||
Error(res);
|
||||
|
||||
curl_easy_setopt(handle, CURLOPT_HTTPGET, 1L); // Reset to HTTP GET
|
||||
curl_easy_cleanup(handle);
|
||||
if (res == CURLE_OK)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/// @brief Handle error codes
|
||||
/// @param error CURLcode.
|
||||
void Upload::Error(CURLcode error) {
|
||||
switch (error) {
|
||||
case CURLE_OK:
|
||||
progress->Update(0, _("Sending data..."));
|
||||
break;
|
||||
case CURLE_COULDNT_RESOLVE_HOST:
|
||||
progress->Update(0, _("Couldn't resolve host."));
|
||||
break;
|
||||
case CURLE_COULDNT_CONNECT:
|
||||
progress->Update(0, _("Couldn't connect to server."));
|
||||
break;
|
||||
|
||||
case CURLE_SEND_ERROR: // socket error
|
||||
case CURLE_RECV_ERROR: // socket error
|
||||
progress->Update(0, _("Connection error."));
|
||||
break;
|
||||
case CURLE_GOT_NOTHING: // no response from server
|
||||
case CURLE_HTTP_RETURNED_ERROR: // HTTP error >= 400
|
||||
progress->Update(0, _("Server error."));
|
||||
break;
|
||||
case CURLE_OPERATION_TIMEDOUT:
|
||||
progress->Update(0, _("Operation timeout."));
|
||||
break;
|
||||
default:
|
||||
progress->Update(0, wxString::Format("Transfer error. (%d)\n", error));
|
||||
}
|
||||
}
|
|
@ -1,46 +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 upload.h
|
||||
/// @see upload.cpp
|
||||
/// @ingroup base io
|
||||
|
||||
#ifndef R_PRECMP
|
||||
#include <curl/curl.h>
|
||||
|
||||
#include <wx/file.h>
|
||||
#endif
|
||||
|
||||
#include "progress.h"
|
||||
|
||||
/// @class Upload
|
||||
/// @brief Upload files to the server.
|
||||
class Upload {
|
||||
private:
|
||||
/// Curl handle.
|
||||
CURL *handle;
|
||||
|
||||
/// Progress instance.
|
||||
Progress *progress;
|
||||
static int CBProgress(void *p, double dt, double dc, double ut, double uc);
|
||||
static size_t CBRead(char *p, size_t size, size_t nmemb, void *filep);
|
||||
void Error(CURLcode error);
|
||||
public:
|
||||
Upload(Progress *prog);
|
||||
~Upload();
|
||||
void Report(std::string report);
|
||||
bool SendFile(const char *url, wxFile &file);
|
||||
};
|
|
@ -1,46 +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 util.cpp
|
||||
/// @brief General utilities
|
||||
/// @ingroup base
|
||||
|
||||
#ifndef R_PRE
|
||||
#include <string>
|
||||
|
||||
#include <wx/stdpaths.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "../acconf.h"
|
||||
|
||||
|
||||
namespace util {
|
||||
|
||||
std::string config_path() {
|
||||
wxStandardPathsBase &paths = wxStandardPaths::Get();
|
||||
|
||||
#if defined(__APPLE__)
|
||||
return paths.GetUserDataDir().utf8_str().data();
|
||||
#elif defined(__UNIX__)
|
||||
return std::string(wxString::Format("%s/.aegisub/", paths.GetUserConfigDir()));
|
||||
#else
|
||||
return std::string(wxString::Format("%s/Aegisub/", paths.GetUserConfigDir()));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
} // namespace util
|
|
@ -1,30 +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 util.h
|
||||
/// @brief General utilities
|
||||
/// @ingroup base
|
||||
|
||||
|
||||
/// Utilities.
|
||||
namespace util {
|
||||
|
||||
/// Return config path.
|
||||
/// @return Config path.
|
||||
std::string config_path();
|
||||
|
||||
|
||||
} // namespace util
|
|
@ -1,80 +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 view.cpp
|
||||
/// @brief View report in a human readable way.
|
||||
/// @ingroup base
|
||||
|
||||
#ifndef R_PRECOMP
|
||||
#include <wx/button.h>
|
||||
#include <wx/clipbrd.h>
|
||||
#include <wx/dataobj.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/window.h>
|
||||
#endif
|
||||
|
||||
#include "view.h"
|
||||
|
||||
/// @brief View report dialog.
|
||||
/// @param frame Parent frame.
|
||||
/// @param r Report instance.
|
||||
View::View(wxWindow *frame, Report *r)
|
||||
: wxDialog (frame, wxID_ANY, _("View Report"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER, _("View Report"))
|
||||
{
|
||||
wxSizer *topSizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
wxSizer *listSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxListView *listView = new wxListView(this,wxID_ANY,wxDefaultPosition,wxDefaultSize);
|
||||
|
||||
// Fill the list with the actual report.
|
||||
text = new std::string();
|
||||
// r->Fill(text, listView);
|
||||
|
||||
listSizer->Add(listView, 1, wxEXPAND);
|
||||
topSizer->Add(listSizer, 1, wxEXPAND | wxALL, 0);
|
||||
|
||||
wxStdDialogButtonSizer *stdButton = new wxStdDialogButtonSizer();
|
||||
stdButton->AddButton(new wxButton(this, wxID_CLOSE, _("Close")));
|
||||
stdButton->AddButton(new wxButton(this, wxID_SAVE, _("Copy to clipboard")));
|
||||
stdButton->Realize();
|
||||
topSizer->Add(stdButton, 0, wxALL | wxCENTRE | wxSHRINK, 5);
|
||||
|
||||
this->SetSizerAndFit(topSizer);
|
||||
this->SetSize(wxSize(500,550));
|
||||
}
|
||||
|
||||
/// @brief Close dialog
|
||||
void View::CloseDialog(wxCommandEvent& WXUNUSED(event)) {
|
||||
Close(true);
|
||||
}
|
||||
|
||||
/// @brief Copy report to clipboard
|
||||
void View::Clipboard(wxCommandEvent& WXUNUSED(event)) {
|
||||
if (wxTheClipboard->Open()) {
|
||||
#ifdef __UNIX__
|
||||
wxTheClipboard->UsePrimarySelection(true);
|
||||
#endif
|
||||
wxTheClipboard->SetData( new wxTextDataObject(*text));
|
||||
wxTheClipboard->Flush();
|
||||
wxTheClipboard->Close();
|
||||
}
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(View, wxDialog)
|
||||
EVT_BUTTON(wxID_CLOSE, View::CloseDialog)
|
||||
EVT_BUTTON(wxID_SAVE, View::Clipboard)
|
||||
END_EVENT_TABLE()
|
|
@ -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 view.h
|
||||
/// @see view.cpp
|
||||
/// @ingroup base
|
||||
|
||||
#ifndef R_PRECOMP
|
||||
#include <wx/frame.h>
|
||||
#include <wx/event.h>
|
||||
#include <wx/window.h>
|
||||
#include <wx/dialog.h>
|
||||
#endif
|
||||
|
||||
#include "report.h"
|
||||
|
||||
/// @class View
|
||||
/// @brief View the stored report.
|
||||
class View: public wxDialog {
|
||||
public:
|
||||
View(wxWindow *frame, Report *r);
|
||||
~View() {};
|
||||
|
||||
private:
|
||||
Report *r;
|
||||
std::string *text;
|
||||
void CloseDialog(wxCommandEvent& event);
|
||||
void Clipboard(wxCommandEvent& event);
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
Loading…
Reference in a new issue