Make titlebar and about dialog fancy for cmake build.

Windows needs fixing.
This commit is contained in:
Jordan Woyak 2011-08-21 16:30:19 -05:00
parent 95fd6e925c
commit e8fe15c3f7
13 changed files with 54 additions and 24 deletions

View File

@ -49,10 +49,18 @@ endfunction(enable_precompiled_headers)
# for revision info
include(FindGit OPTIONAL)
if(GIT_FOUND AND NOT DOLPHIN_WC_REVISION)
# defines DOLPHIN_WC_REVISION
# defines DOLPHIN_WC_REVISION
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
OUTPUT_VARIABLE DOLPHIN_WC_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE)
# defines DOLPHIN_WC_DESCRIBE
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} describe --always
OUTPUT_VARIABLE DOLPHIN_WC_DESCRIBE
OUTPUT_STRIP_TRAILING_WHITESPACE)
# defines DOLPHIN_WC_BRANCH
EXECUTE_PROCESS(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
OUTPUT_VARIABLE DOLPHIN_WC_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
# Various compile flags
@ -409,8 +417,19 @@ endif(NOT DISABLE_WX)
########################################
# Pre-build events: Define configuration variables and write svnrev header
#
file(WRITE ${PROJECT_BINARY_DIR}/Source/Core/Common/Src/svnrev.h
"#define SVN_REV_STR \"" ${DOLPHIN_WC_REVISION} "-" ${CMAKE_BUILD_TYPE} "\"\n")
if(SCM_BRANCH_STR EQUAL "master")
set(DOLPHIN_WC_IS_MASTER "1")
else()
set(DOLPHIN_WC_IS_MASTER "0")
endif()
file(WRITE ${PROJECT_BINARY_DIR}/Source/Core/Common/Src/scmrev.h
"#define SCM_REV_STR \"" ${DOLPHIN_WC_REVISION} "\"\n"
"#define SCM_DESC_STR \"" ${DOLPHIN_WC_DESCRIBE} "\"\n"
"#define SCM_BRANCH_STR \"" ${DOLPHIN_WC_BRANCH} "\"\n"
"#define SCM_IS_MASTER " ${DOLPHIN_WC_IS_MASTER} "\n"
# "#define BUILD_TYPE_STR \"" ${CMAKE_BUILD_TYPE} "\"\n"
)
include_directories("${PROJECT_BINARY_DIR}/Source/Core/Common/Src")

View File

@ -26,7 +26,7 @@
#include <string.h>
// SVN version number
extern const char *svn_rev_str;
extern const char *scm_rev_str;
extern const char *netplay_dolphin_ver;
// Force enable logging in the right modes. For some reason, something had changed

View File

@ -16,16 +16,22 @@
// http://code.google.com/p/dolphin-emu/
#include "Common.h"
#include "svnrev.h"
#include "scmrev.h"
#ifdef _DEBUG
const char *svn_rev_str = "Dolphin Debug r" SVN_REV_STR;
#define BUILD_TYPE_STR "Debug "
#elif defined DEBUGFAST
const char *svn_rev_str = "Dolphin Debugfast r" SVN_REV_STR;
#define BUILD_TYPE_STR "DebugFast "
#else
const char *svn_rev_str = "Dolphin r" SVN_REV_STR;
#define BUILD_TYPE_STR ""
#endif
const char *scm_rev_str = "Dolphin "
#if !SCM_IS_MASTER
"[" SCM_BRANCH_STR "] "
#endif
BUILD_TYPE_STR SCM_DESC_STR;
#ifdef _M_X64
#define NP_ARCH "x64"
#else
@ -33,9 +39,9 @@ const char *svn_rev_str = "Dolphin r" SVN_REV_STR;
#endif
#ifdef _WIN32
const char *netplay_dolphin_ver = SVN_REV_STR " W" NP_ARCH;
const char *netplay_dolphin_ver = SCM_DESC_STR " W" NP_ARCH;
#elif __APPLE__
const char *netplay_dolphin_ver = SVN_REV_STR " M" NP_ARCH;
const char *netplay_dolphin_ver = SCM_DESC_STR " M" NP_ARCH;
#else
const char *netplay_dolphin_ver = SVN_REV_STR " L" NP_ARCH;
const char *netplay_dolphin_ver = SCM_DESC_STR " L" NP_ARCH;
#endif

View File

@ -608,7 +608,7 @@ void VideoThrottle()
// This is our final "frame counter" string
std::string SMessage = StringFromFormat("%s | %s",
SSettings.c_str(), SFPS.c_str());
std::string TMessage = StringFromFormat("%s | ", svn_rev_str) +
std::string TMessage = StringFromFormat("%s | ", scm_rev_str) +
SMessage;
// Show message
@ -617,7 +617,7 @@ void VideoThrottle()
if (_CoreParameter.bRenderToMain &&
SConfig::GetInstance().m_InterfaceStatusbar) {
Host_UpdateStatusBar(SMessage.c_str());
Host_UpdateTitle(svn_rev_str);
Host_UpdateTitle(scm_rev_str);
} else
Host_UpdateTitle(TMessage.c_str());

View File

@ -18,6 +18,7 @@
#include "Common.h"
#include "AboutDolphin.h"
#include "../resources/dolphin_logo.cpp"
#include "scmrev.h"
AboutDolphin::AboutDolphin(wxWindow *parent, wxWindowID id,
const wxString &title, const wxPoint &position,
@ -29,9 +30,13 @@ AboutDolphin::AboutDolphin(wxWindow *parent, wxWindowID id,
wxStaticBitmap* const sbDolphinLogo = new wxStaticBitmap(this, wxID_ANY,
wxBitmap(iDolphinLogo));
std::string Text = std::string(svn_rev_str) + "\n"
std::string Text = "Dolphin " SCM_DESC_STR "\n"
"Copyright (c) 2003-2011+ Dolphin Team\n"
"\n"
"Branch: " SCM_BRANCH_STR "\n"
"Revision: " SCM_REV_STR "\n"
"Date: " __DATE__ " @ " __TIME__ "\n"
"\n"
"Dolphin is a Gamecube/Wii emulator, which was\n"
"originally written by F|RES and ector.\n"
"Today Dolphin is an open source project with many\n"

View File

@ -1073,7 +1073,7 @@ void CFrame::DoStop()
X11Utils::InhibitScreensaver(X11Utils::XDisplayFromHandle(GetHandle()),
X11Utils::XWindowFromHandle(GetHandle()), false);
#endif
m_RenderFrame->SetTitle(wxString::FromAscii(svn_rev_str));
m_RenderFrame->SetTitle(wxString::FromAscii(scm_rev_str));
// Destroy the renderer frame when not rendering to main
m_RenderParent->Disconnect(wxID_ANY, wxEVT_SIZE,

View File

@ -274,7 +274,7 @@ bool DolphinApp::OnInit()
#endif
main_frame = new CFrame((wxFrame*)NULL, wxID_ANY,
wxString::FromAscii(svn_rev_str),
wxString::FromAscii(scm_rev_str),
wxPoint(x, y), wxSize(w, h),
UseDebugger, BatchMode, UseLogger);
SetTopWindow(main_frame);

View File

@ -294,13 +294,13 @@ int main(int argc, char* argv[])
help = 1;
break;
case 'v':
fprintf(stderr, "%s\n", svn_rev_str);
fprintf(stderr, "%s\n", scm_rev_str);
return 1;
}
}
if (help == 1 || argc == optind) {
fprintf(stderr, "%s\n\n", svn_rev_str);
fprintf(stderr, "%s\n\n", scm_rev_str);
fprintf(stderr, "A multi-platform Gamecube/Wii emulator\n\n");
fprintf(stderr, "Usage: %s [-e <file>] [-h] [-v]\n", argv[0]);
fprintf(stderr, " -e, --exec Load the specified file\n");

View File

@ -103,7 +103,7 @@ void TexDecoder_OpenCL_Initialize()
char dolphin_rev[HEADER_SIZE];
filename = File::GetUserPath(D_OPENCL_IDX) + "kernel.bin";
snprintf(dolphin_rev, HEADER_SIZE, "%-31s", svn_rev_str);
snprintf(dolphin_rev, HEADER_SIZE, "%-31s", scm_rev_str);
{
File::IOFile input(filename, "rb");

View File

@ -69,7 +69,7 @@ unsigned int VideoBackend::PeekMessages()
void VideoBackend::UpdateFPSDisplay(const char *text)
{
char temp[512];
sprintf_s(temp, sizeof temp, "%s | DX11 | %s", svn_rev_str, text);
sprintf_s(temp, sizeof temp, "%s | DX11 | %s", scm_rev_str, text);
SetWindowTextA(EmuWindow::GetWnd(), temp);
}

View File

@ -77,7 +77,7 @@ unsigned int VideoBackend::PeekMessages()
void VideoBackend::UpdateFPSDisplay(const char *text)
{
TCHAR temp[512];
swprintf_s(temp, sizeof(temp)/sizeof(TCHAR), _T("%hs | DX9 | %hs"), svn_rev_str, text);
swprintf_s(temp, sizeof(temp)/sizeof(TCHAR), _T("%hs | DX9 | %hs"), scm_rev_str, text);
SetWindowText(EmuWindow::GetWnd(), temp);
}

View File

@ -108,7 +108,7 @@ unsigned int VideoBackend::PeekMessages()
void VideoBackend::UpdateFPSDisplay(const char *text)
{
char temp[100];
snprintf(temp, sizeof temp, "%s | OpenGL | %s", svn_rev_str, text);
snprintf(temp, sizeof temp, "%s | OpenGL | %s", scm_rev_str, text);
OpenGL_SetWindowText(temp);
}

View File

@ -265,7 +265,7 @@ unsigned int VideoSoftware::PeekMessages()
void VideoSoftware::UpdateFPSDisplay(const char *text)
{
char temp[100];
snprintf(temp, sizeof temp, "%s | Software | %s", svn_rev_str, text);
snprintf(temp, sizeof temp, "%s | Software | %s", scm_rev_str, text);
OpenGL_SetWindowText(temp);
}