Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
U
Unity
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Shane Veasy
Unity
Commits
bf0574c0
Commit
bf0574c0
authored
8 years ago
by
Emil "AngryAnt" Johansen
Browse files
Options
Downloads
Patches
Plain Diff
Settings tab and initial state - for when no repository has been set up.
parent
bad5a306
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/GitHub.Unity/Assets/Plugins/GitHub/Editor/Window.cs
+113
-1
113 additions, 1 deletion
src/GitHub.Unity/Assets/Plugins/GitHub/Editor/Window.cs
with
113 additions
and
1 deletion
src/GitHub.Unity/Assets/Plugins/GitHub/Editor/Window.cs
+
113
−
1
View file @
bf0574c0
...
...
@@ -39,7 +39,8 @@ namespace GitHub.Unity
enum
ViewMode
{
History
,
Changes
Changes
,
Settings
}
...
...
@@ -111,8 +112,17 @@ namespace GitHub.Unity
const
string
Title
=
"GitHub"
,
LaunchMenu
=
"Window/GitHub"
,
NoActiveRepositoryTitle
=
"No repository found"
,
NoActiveRepositoryMessage
=
"Your current project is not currently in an active git repository:"
,
GitInitBrowseButton
=
"..."
,
GitInitBrowseTitle
=
"Pick desired repository root"
,
GitInitButton
=
"Set up git"
,
InvalidInitDirectoryTitle
=
"Invalid repository root"
,
InvalidInitDirectoryMessage
=
"Your selected folder '{0}' is not a valid repository root for your current project."
,
InvalidInitDirectoryOK
=
"OK"
,
ViewModeHistoryTab
=
"History"
,
ViewModeChangesTab
=
"Changes"
,
ViewModeSettingsTab
=
"Settings"
,
RefreshButton
=
"Refresh"
,
UnknownViewModeError
=
"Unsupported view mode: {0}"
,
HistoryFocusAll
=
"(All)"
,
...
...
@@ -140,6 +150,8 @@ namespace GitHub.Unity
BasePathLabel
=
"{0}"
,
NoChangesLabel
=
"No changes found"
;
const
float
NoActiveRepositoryWidth
=
200f
,
BrowseFolderButtonHorizontalPadding
=
-
4f
,
HistoryEntryHeight
=
30f
,
HistorySummaryHeight
=
16f
,
HistoryDetailsHeight
=
16f
,
...
...
@@ -158,6 +170,7 @@ namespace GitHub.Unity
static
GUIStyle
longMessageStyle
,
historyToolbarButtonStyle
,
historyLockStyle
,
historyEntryDetailsStyle
,
...
...
@@ -170,6 +183,23 @@ namespace GitHub.Unity
folderIcon
;
static
GUIStyle
LongMessageStyle
{
get
{
if
(
longMessageStyle
==
null
)
{
longMessageStyle
=
new
GUIStyle
(
EditorStyles
.
miniLabel
);
longMessageStyle
.
name
=
"LongMessageStyle"
;
longMessageStyle
.
richText
=
true
;
longMessageStyle
.
wordWrap
=
true
;
}
return
longMessageStyle
;
}
}
static
GUIStyle
HistoryToolbarButtonStyle
{
get
...
...
@@ -347,6 +377,7 @@ namespace GitHub.Unity
historyStopIndex
,
statusAhead
,
statusBehind
;
string
initDirectory
;
void
OnEnable
()
...
...
@@ -490,11 +521,19 @@ namespace GitHub.Unity
// Set window title
titleContent
=
new
GUIContent
(
Title
);
// Initial state
if
(!
Utility
.
ActiveRepository
)
{
OnSettingsGUI
();
return
;
}
// Subtabs & toolbar
GUILayout
.
BeginHorizontal
(
EditorStyles
.
toolbar
);
EditorGUI
.
BeginChangeCheck
();
viewMode
=
GUILayout
.
Toggle
(
viewMode
==
ViewMode
.
History
,
ViewModeHistoryTab
,
EditorStyles
.
toolbarButton
)
?
ViewMode
.
History
:
viewMode
;
viewMode
=
GUILayout
.
Toggle
(
viewMode
==
ViewMode
.
Changes
,
ViewModeChangesTab
,
EditorStyles
.
toolbarButton
)
?
ViewMode
.
Changes
:
viewMode
;
viewMode
=
GUILayout
.
Toggle
(
viewMode
==
ViewMode
.
Settings
,
ViewModeSettingsTab
,
EditorStyles
.
toolbarButton
)
?
ViewMode
.
Settings
:
viewMode
;
if
(
EditorGUI
.
EndChangeCheck
())
{
Refresh
();
...
...
@@ -517,6 +556,9 @@ namespace GitHub.Unity
case
ViewMode
.
Changes
:
OnCommitGUI
();
break
;
case
ViewMode
.
Settings
:
OnSettingsGUI
();
break
;
default
:
GUILayout
.
Label
(
string
.
Format
(
UnknownViewModeError
,
viewMode
));
break
;
...
...
@@ -547,6 +589,70 @@ namespace GitHub.Unity
}
void
ResetInitDirectory
()
{
initDirectory
=
Utility
.
UnityDataPath
.
Substring
(
0
,
Utility
.
UnityDataPath
.
Length
-
"Assets"
.
Length
);
GUIUtility
.
keyboardControl
=
GUIUtility
.
hotControl
=
0
;
}
void
OnSettingsGUI
()
{
if
(!
Utility
.
ActiveRepository
)
{
// If we do run init, make sure that we return to the settings tab for further setup
viewMode
=
ViewMode
.
Settings
;
GUILayout
.
BeginVertical
();
GUILayout
.
FlexibleSpace
();
GUILayout
.
BeginHorizontal
();
GUILayout
.
FlexibleSpace
();
// Initial state message
GUILayout
.
BeginVertical
(
GUILayout
.
MaxWidth
(
NoActiveRepositoryWidth
));
GUILayout
.
Label
(
NoActiveRepositoryTitle
,
EditorStyles
.
boldLabel
);
GUILayout
.
Label
(
NoActiveRepositoryMessage
,
LongMessageStyle
);
GUILayout
.
BeginHorizontal
();
if
(
string
.
IsNullOrEmpty
(
initDirectory
))
{
ResetInitDirectory
();
}
initDirectory
=
EditorGUILayout
.
TextField
(
initDirectory
);
GUILayout
.
Space
(
BrowseFolderButtonHorizontalPadding
);
if
(
GUILayout
.
Button
(
GitInitBrowseButton
,
EditorStyles
.
miniButtonRight
))
{
initDirectory
=
EditorUtility
.
OpenFolderPanel
(
GitInitBrowseTitle
,
initDirectory
,
""
);
if
(
Utility
.
UnityDataPath
.
IndexOf
(
initDirectory
)
!=
0
)
{
EditorUtility
.
DisplayDialog
(
InvalidInitDirectoryTitle
,
string
.
Format
(
InvalidInitDirectoryMessage
,
initDirectory
),
InvalidInitDirectoryOK
);
ResetInitDirectory
();
}
GUIUtility
.
keyboardControl
=
GUIUtility
.
hotControl
=
0
;
}
GUILayout
.
EndHorizontal
();
GUILayout
.
EndVertical
();
GUILayout
.
FlexibleSpace
();
GUILayout
.
EndHorizontal
();
GUILayout
.
BeginHorizontal
();
GUILayout
.
FlexibleSpace
();
// Git init, which starts the config flow
if
(
GUILayout
.
Button
(
GitInitButton
,
EditorStyles
.
miniButton
,
GUILayout
.
ExpandWidth
(
false
)))
{
Init
();
}
GUILayout
.
FlexibleSpace
();
GUILayout
.
EndHorizontal
();
GUILayout
.
FlexibleSpace
();
GUILayout
.
EndVertical
();
return
;
}
}
void
OnHistoryGUI
()
{
// History toolbar
...
...
@@ -860,6 +966,12 @@ namespace GitHub.Unity
}
void
Init
()
{
Debug
.
LogFormat
(
"TODO: Init '{0}'"
,
initDirectory
);
}
void
CommitSelectAll
()
{
for
(
int
index
=
0
;
index
<
entryCommitTargets
.
Count
;
++
index
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment