Exemplo n.º 1
0
void CInstallPage::OnTimer(UINT nIDEvent)
{
    KillTimer(1);

    CNewWizPage::OnTimer(nIDEvent);

    CCHM2Dlg* m_pParentDlg = ((CCHM2Dlg*)GetParent());
    CWizardData* pWizardData = m_pParentDlg->m_pWizardData;

    // Construct the path to the log file
    CString strLogFile = pWizardData->m_strPath;
    strLogFile += CRString(IDS_FILE_LOG);

    CWizardToolz toolz;
    CStringArray arrLog;

    // The installation ...
    if (StartInstallation(strLogFile))
    {
        CString strBuffer;
        strBuffer.Format(CRString(IDS_LABEL_END_INSTALL),
                         pWizardData->m_strHostIPAddress,
                         pWizardData->m_nZopeHTTPPort
                        );
        m_InstallInfoText.SetWindowText(CRString(IDS_INSTALLATION_COMPLETE));
        m_InstallationText.SetWindowText(strBuffer);
    }
    else
    {
        // Failed to copy the files. Set a message and clean up
        m_InstallationText.SetWindowText(CRString(IDS_REMOVING_FILES));
        m_InstallInfoText.SetWindowText(CRString(IDS_DELETE_INSTALLATION_FILES));

        // try to delete everything from the installation folder
        // however, leave the log file - for traceback
        toolz.RecDeleteFolder(pWizardData->m_strPath + CRString(IDS_FOLDER_ZOPE));
        toolz.RecDeleteFolder(pWizardData->m_strPath + CRString(IDS_FOLDER_INSTANCE));
        toolz.RecDeleteFolder(pWizardData->m_strPath + CRString(IDS_FOLDER_BIN));
        arrLog.Add(CRString(IDS_FAIL_INSTALL));
        arrLog.Add(CRString(IDS_DELETE_INSTALLATION_FILES));

        // update labels
        m_InstallationText.SetWindowText(CRString(IDS_FAIL_INSTALL));
        m_InstallInfoText.SetWindowText("");
    }

    // Write to log
    toolz.InternalWriteToFile(strLogFile, arrLog);

    // enable buttons
    m_chkStart.EnableWindow(TRUE);
    m_chkStart.SetCheck(TRUE);
    m_pParentDlg->EnableFinish(TRUE);
}
Exemplo n.º 2
0
eOSState cSkindesignerSkinPreview::ProcessKey(eKeys Key) {
    eOSState state = ProcessInstallationStatus();
    if (state == osEnd)
        return osEnd;
    state = cOsdMenu::ProcessKey(Key);
    switch (Key) {
        case kOk:
        case kBack:
            state = osBack;
            break;
        case kLeft: {
            TextKeyLeft();
            state = osContinue;
            break;
        } case kRight: {
            TextKeyRight();
            state = osContinue;            
            break;
        } case kUp: {
            TextKeyUp();
            state = osContinue;            
            break;
        } case kDown: {
            TextKeyDown();
            state = osContinue;
            break;
        } case kRed: {
            string versionNeeded = "";
            bool versionOk = config.CheckVersion(currentSkin, versionNeeded);
            if (!versionOk) {
                cString error = cString::sprintf("%s %s %s %s %s", 
                                                 tr("Skin Designer"),
                                                 tr("version"), 
                                                 versionNeeded.c_str(),
                                                 tr("or higher"),
                                                 tr("needed"));
                Skins.Message(mtError, *error);
            } else {
                StartInstallation(currentSkin);
            }
            state = osContinue;
            break;
        } default:
            break;
    }
    return state;
}
Exemplo n.º 3
0
eOSState cSkinDesignerSetup::ProcessKey(eKeys Key) {
    eOSState state = ProcessInstallationStatus();
    if (state == osEnd)
        return osEnd;

    bool hadSubMenu = HasSubMenu();
    state = cMenuSetupPage::ProcessKey(Key);
    if (hadSubMenu && Key == kOk) {
        Store();
    }

    if (!hadSubMenu && (Key == kOk || Key == kUp || Key == kDown || Key == kLeft || Key == kRight || Key == kRed || Key == kYellow)) {
        SetHelp(NULL, NULL, NULL, NULL);
        cOsdItem *current = Get(Current());
        cSkinMenuItem *skinMenuItem = dynamic_cast<cSkinMenuItem*>(current);
        if (!skinMenuItem)
            return state;
        eItemType type = skinMenuItem->Type();
        currentSkin = skinMenuItem->GetSkinName();
        // KEY OK
        if ((Key == kOk)) {
            if (type == itSkinSetup) {
                state = AddSubMenu(new cSkindesignerSkinSetup(currentSkin, "", ""));
            } else if (type == itNoSkinSetup) {
                state = osContinue;
            } else if (type == itSkinRepo) {
                Skins.Message(mtStatus, tr("Downloading Skin Screenshots..."));
                cSkindesignerSkinPreview *prev = new cSkindesignerSkinPreview(currentSkin);
                Skins.Message(mtStatus, NULL);
                state = AddSubMenu(prev);
            }
        }
        // Menu Moves
        if (Key == kUp || Key == kDown || Key == kLeft || Key == kRight) {
            if (type == itSkinRepo) {
                SetHelp(tr("Install Skin"), NULL, NULL, NULL);
            } else if (type == itSkinSetup || type == itNoSkinSetup) {
                cSkinRepo *repo = config.GetSkinRepo(currentSkin);
                if (repo) {
                    if (repo->Type() == rtGit)
                        SetHelp(tr("Update"), NULL, tr("Delete Skin"), NULL);
                    else
                        SetHelp(NULL, NULL, tr("Delete Skin"), NULL);
                }
            }
        }
        // KEY RED
        if (Key == kRed) {
            string versionNeeded = "";
            bool versionOk = config.CheckVersion(currentSkin, versionNeeded);
            if (!versionOk) {
                cString error = cString::sprintf("%s %s %s %s %s", 
                                                 tr("Skin Designer"),
                                                 tr("version"), 
                                                 versionNeeded.c_str(),
                                                 tr("or higher"),
                                                 tr("needed"));
                Skins.Message(mtError, *error);
                return state;
            }
            if (type == itSkinRepo) {
                Skins.Message(mtStatus, *cString::sprintf("%s ...", tr("Installing Skin")));
                StartInstallation(currentSkin);
            } else if (type == itSkinSetup || type == itNoSkinSetup) {
                bool gitAvailable = StartUpdate(currentSkin);
                if (gitAvailable) {
                    Skins.Message(mtStatus, *cString::sprintf("%s ...", tr("Updating Skin from Git")));
                } else {
                    Skins.Message(mtStatus, tr("No Git Repsoitory available"));
                }
            }
        }
        // KEY YELLOW
        if (Key == kYellow) {
            if (type == itSkinSetup || type == itNoSkinSetup) {
                if (config.SkinActive(currentSkin)) {
                    Skins.Message(mtError, tr("Skin is running and can't be deleted"));
                } else if (Interface->Confirm(*cString::sprintf("%s?", tr("Really delete skin")))) {
                    config.DeleteSkin(currentSkin);
                    Skins.Message(mtStatus, tr("Skin deleted"));
                    cCondWait::SleepMs(1000);
                    return osEnd;
                }
                state = osContinue;
            }
        }
    }
    return state;
}