Esempio n. 1
0
        public void Show()
        {
            CqaLabel.Heading1("Install & Uninstall");

            if (_jqaManager.CheckIfJqaIsInstalling())
            {
                CqaLabel.Bold("Status: Installing ...");
            }
            else if (JqaManager.CheckIfJqaIsInstalled())
            {
                CqaLabel.Success("Status: Installed");
            }
            else
            {
                CqaLabel.Error("Status: Not Installed");
            }

            if (!JqaManager.CheckIfJqaIsInstalled())
            {
                GUILayout.Label("CQA is not installed yet.");
                GUILayout.Label("To install it we need to download files from jqassistant.org and github.com.");
                GUILayout.Label("If you agree click the button below.");

                EditorGUILayout.Space();

                if (CqaButton.NormalButton("Install"))
                {
                    _jqaManager.InstallJqa();
                    Thread.Sleep(10);
                }

                return;
            }

            if (_jqaManager.CheckIfJqaIsInstalling())
            {
                GUILayout.Label("For more information have a look at the Unity console.");
                EditorGUILayout.Space();

                if (CqaButton.NormalButton("Abort Installation"))
                {
                    _jqaManager.AbortInstallation();

                    while (_jqaManager.CheckIfJqaIsInstalling())
                    {
                        Thread.Sleep(0);
                    }

                    JqaManager.UninstallJqa();
                }

                return;
            }

            EditorGUILayout.Space();
            if (CqaButton.NormalButton("Uninstall"))
            {
                JqaManager.UninstallJqa();
            }
        }
Esempio n. 2
0
        public void Show()
        {
            CqaLabel.Heading1("Manage Custom Rules");

            ShowGlobalRuleEditor();
            ShowLocalRuleEditor();

            GUILayout.Space(10);

            if (CqaButton.NormalButton("Create Group"))
            {
                CqaGroupEditWindow.Open(DataScope.Local);
            }

            if ((_localRuleManager.DoGroupsExist() || _globalRuleManager.DoGroupsExist()) &&
                CqaButton.NormalButton("Create Rule"))
            {
                CqaRuleEditWindow.Open(DataScope.Local);
            }

            GUILayout.Space(10);
        }
Esempio n. 3
0
        private void ShowReportButtons()
        {
            EditorGUI.BeginDisabledGroup(_jqaExecutor.IsAnyProcessRunning());
            GUILayout.Space(15);

            if (CqaButton.NormalButton("Create Report"))
            {
                _jqaExecutor.CheckAndReport();
            }

            FileInfo reportFileInfo = new FileInfo(JqaPaths.Instance.BuildJqaHtmlReportPath());

            EditorGUI.BeginDisabledGroup(!reportFileInfo.Exists);
            if (CqaButton.NormalButton("Open Report in Browser"))
            {
                Application.OpenURL(reportFileInfo.FullName);
            }

            EditorGUI.EndDisabledGroup();
            EditorGUI.EndDisabledGroup();

            GUILayout.Space(10);
        }
Esempio n. 4
0
        public void Show()
        {
            CqaLabel.Heading1("Scan");

            if (!JqaManager.CheckIfJqaIsInstalled())
            {
                CqaLabel.Error("CQA is currently not installed.");
                return;
            }

            CqaLabel.Normal("CQA scans all scripts inside your Assets folder.");

            History.History history = _historyManager.LoadHistory();

            if (history != null)
            {
                CqaLabel.Normal("The last scan was at " + history.GetLastScan() + ".");
            }

            EditorGUI.BeginDisabledGroup(_jqaExecutor.IsAnyProcessRunning());
            if (CqaButton.NormalButton("Scan Assets"))
            {
                _jqaExecutor.ScanAssets();
            }

            if (Directory.Exists(JqaPaths.Instance.BuildJqaStorePath()) && CqaButton.NormalButton("Start Server"))
            {
                _jqaExecutor.StartServer();
            }

            EditorGUI.EndDisabledGroup();

            if (_jqaExecutor.IsScanProcessRunning())
            {
                CqaLabel.Bold("Status: Running ...");

                // FIXME: Stopping the process does currently not work.
                //
                // if (CqaButton.NormalButton("Stop Process"))
                // {
                //     _jqaExecutor.StopProcess();
                // }
            }

            GUILayout.Space(30);
            CqaLine.DrawHorizontalLine();

            CqaLabel.Heading1("Report");

            if (!JqaExecutor.DidFinishSuccessfullyOnce())
            {
                CqaLabel.Error("You must scan your project before you can create a report.");
                return;
            }

            CqaLabel.Normal("Select rules that you want to be checked in the report.");

            if (_jqaExecutor.IsReportProcessRunning())
            {
                CqaLabel.Bold("Status: Running ...");

                // FIXME: Stopping the process does currently not work.
                //
                // if (CqaButton.NormalButton("Stop Process"))
                // {
                //     _jqaExecutor.StopProcess();
                // }
            }

            _ruleSelector.OnGUI();

            ShowReportButtons();
        }