Skip to content

Commit

Permalink
Merge pull request sakura-editor#158 from m-tmatma/feature/show-remot…
Browse files Browse the repository at this point in the history
…e-URL

Git remote URL をバージョン情報に含める
  • Loading branch information
m-tmatma authored Jun 23, 2018
2 parents 201a3a3 + 0500280 commit a21815c
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 3 deletions.
10 changes: 10 additions & 0 deletions sakura/preBuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,17 @@ if "%GIT_ENABLED%" == "1" (
for /f "usebackq" %%s in (`git show -s --format^=%%h`) do (
set SHORT_COMMITID=%%s
)
for /f "usebackq" %%s in (`git config --get remote.origin.url`) do (
set GIT_URL=%%s
)
) else (
set SHORT_COMMITID=
set COMMITID=
set GIT_URL=
)
@echo SHORT_COMMITID: %SHORT_COMMITID%
@echo COMMITID: %COMMITID%
@echo GIT_URL: %GIT_URL%

: Output gitrev.h
set GITREV_H=..\sakura_core\gitrev.h
Expand All @@ -55,6 +60,11 @@ if "%SHORT_COMMITID%" == "" (
) else (
echo #define GIT_SHORT_COMMIT_HASH "%SHORT_COMMITID%" >> %GITREV_H%
)
if "%GIT_URL%" == "" (
type nul >> %GITREV_H%
) else (
echo #define GIT_URL "%GIT_URL%" >> %GITREV_H%
)

ENDLOCAL
rem exit 0
11 changes: 11 additions & 0 deletions sakura_core/dlg/CDlgAbout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ BOOL CDlgAbout::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam )
cmemMsg.AppendString(szMsg);
#if defined(GIT_COMMIT_HASH)
cmemMsg.AppendString(_T("(GitHash " GIT_COMMIT_HASH ")\r\n"));
#endif
#if defined(GIT_URL)
cmemMsg.AppendString(_T("(GitURL " GIT_URL ")\r\n"));
#endif
cmemMsg.AppendString( _T("\r\n") );

Expand Down Expand Up @@ -241,6 +244,13 @@ BOOL CDlgAbout::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam )

// URLウィンドウをサブクラス化する
m_UrlUrWnd.SetSubclassWindow( GetDlgItem( GetHwnd(), IDC_STATIC_URL_UR ) );
m_UrlGitWnd.SetSubclassWindow(GetDlgItem( GetHwnd(), IDC_STATIC_URL_GIT));
#ifdef GIT_URL
::SetWindowText(::GetDlgItem(GetHwnd(), IDC_STATIC_URL_GIT), _T(GIT_URL));
#else
ShowWindow(::GetDlgItem(GetHwnd(), IDC_STATIC_GIT_CAPTION), SW_HIDE);
ShowWindow(::GetDlgItem(GetHwnd(), IDC_STATIC_URL_GIT), SW_HIDE);
#endif

// Oct. 22, 2005 genta 原作者ホームページが無くなったので削除
//m_UrlOrgWnd.SubclassWindow( GetDlgItem( GetHwnd(), IDC_STATIC_URL_ORG ) );
Expand Down Expand Up @@ -270,6 +280,7 @@ BOOL CDlgAbout::OnStnClicked( int wID )
switch( wID ){
// 2006.07.27 genta 原作者連絡先のボタンを削除 (ヘルプから削除されているため)
case IDC_STATIC_URL_UR:
case IDC_STATIC_URL_GIT:
// case IDC_STATIC_URL_ORG: del 2008/7/4 Uchi
// Web Browserの起動
{
Expand Down
1 change: 1 addition & 0 deletions sakura_core/dlg/CDlgAbout.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class CDlgAbout : public CDialog
LPVOID GetHelpIdTable(void); //@@@ 2002.01.18 add
private:
CUrlWnd m_UrlUrWnd;
CUrlWnd m_UrlGitWnd;
CUrlWnd m_UrlOrgWnd;
};

Expand Down
4 changes: 3 additions & 1 deletion sakura_core/sakura_rc.h
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,8 @@
#define IDC_LIST_WINDOW 1724
#define IDC_BUTTON_SAVE 1725
#define IDC_BUTTON_CLOSE 1726
#define IDC_STATIC_URL_GIT 1727
#define IDC_STATIC_GIT_CAPTION 1728
#define IDS_AUTHOR_PAGE 4054
#define IDS_ABOUT_DESCRIPTION 4056
#define IDD_TYPELIST 5000
Expand Down Expand Up @@ -836,7 +838,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 230
#define _APS_NEXT_COMMAND_VALUE 4057
#define _APS_NEXT_CONTROL_VALUE 1727
#define _APS_NEXT_CONTROL_VALUE 1729
#define _APS_NEXT_SYMED_VALUE 104
#endif
#endif
6 changes: 5 additions & 1 deletion sakura_core/sakura_rc.rc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ BEGIN
LTEXT "https://sakura-editor.github.io/",
IDC_STATIC_URL_UR,101,88,120,8,SS_NOTIFY | NOT WS_GROUP |
WS_TABSTOP
EDITTEXT IDC_EDIT_ABOUT,5,107,233,67,ES_MULTILINE | ES_READONLY |
LTEXT "Source URL:", IDC_STATIC_GIT_CAPTION,33,98,71,8,NOT WS_GROUP
LTEXT "https://sakura-editor.github.io/",
IDC_STATIC_URL_GIT,101,98,120,8,SS_NOTIFY | NOT WS_GROUP |
WS_TABSTOP
EDITTEXT IDC_EDIT_ABOUT,5,111,233,63,ES_MULTILINE | ES_READONLY |
WS_VSCROLL | NOT WS_TABSTOP
END

Expand Down
6 changes: 5 additions & 1 deletion sakura_lang_en_US/sakura_lang_rc.rc
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ BEGIN
LTEXT "https://sakura-editor.github.io/",
IDC_STATIC_URL_UR,101,88,120,8,SS_NOTIFY | NOT WS_GROUP |
WS_TABSTOP
EDITTEXT IDC_EDIT_ABOUT,5,107,233,67,ES_MULTILINE | ES_READONLY |
LTEXT "Source URL:", IDC_STATIC_GIT_CAPTION,33,98,71,8,NOT WS_GROUP
LTEXT "https://sakura-editor.github.io/",
IDC_STATIC_URL_GIT,101,98,120,8,SS_NOTIFY | NOT WS_GROUP |
WS_TABSTOP
EDITTEXT IDC_EDIT_ABOUT,5,111,233,63,ES_MULTILINE | ES_READONLY |
WS_VSCROLL | NOT WS_TABSTOP
END

Expand Down

0 comments on commit a21815c

Please sign in to comment.