//-------------------------------------------------------------------------------------------------- static parseTree::TokenList_t* ParseApi ( Lexer_t& lexer, parseTree::Content_t::Type_t type ///< Either EXPORTED_API or IMPORTED_API. ) //-------------------------------------------------------------------------------------------------- { // Must be of the form "alias = exe.component.interface" // or "exe.component.interface" (without the alias). auto firstTokenPtr = lexer.Pull(parseTree::Token_t::NAME); auto apiPtr = parseTree::CreateTokenList(type, firstTokenPtr); apiPtr->AddContent(firstTokenPtr); if (lexer.IsMatch(parseTree::Token_t::EQUALS) || lexer.IsMatch(parseTree::Token_t::WHITESPACE)) { // The first token is an alias. Pull out the '=' and any whitespace and get the exe name. SkipWhitespaceAndComments(lexer); (void)lexer.Pull(parseTree::Token_t::EQUALS); SkipWhitespaceAndComments(lexer); apiPtr->AddContent(lexer.Pull(parseTree::Token_t::NAME)); } // Rest is ".component.interface". (void)lexer.Pull(parseTree::Token_t::DOT); apiPtr->AddContent(lexer.Pull(parseTree::Token_t::NAME)); (void)lexer.Pull(parseTree::Token_t::DOT); apiPtr->AddContent(lexer.Pull(parseTree::Token_t::NAME)); return apiPtr; }
void CTaskDialog::LayoutControls(void) { // layout controls int cx_buttons = 0; int cx_width = CalculateDialogWidth(cx_buttons); int cy_height = 0; int x = cx_margin; int y = cy_margin; // add content area { if (config_.pszMainInstruction != 0 || config_.pszMainIcon != 0) y += cy_spacing + AddMainInstruction(x, y, cx_width - cx_margin - cx_margin); if (config_.pszContent != 0) y += cy_spacing + AddContent(x, y, cx_width - cx_margin - cx_margin); if (config_.cRadioButtons != 0) y += cy_spacing + AddRadioButtons(x, y, cx_width - cx_margin - cx_margin); if (HasFlag(TDF_SHOW_PROGRESS_BAR)) y += cy_spacing + AddProgressBar(x, y, cx_width - cx_margin - cx_margin); cy_height = y; } { y = AddFrame(0, 0, cx_width, cy_height); y += AddDividingLine(0, y, cx_width); y += cy_spacing; } // add row of buttons { y += cy_spacing + AddButtons(cx_margin + cx_width - cx_buttons, y, cx_width); } // add verification text if (config_.pszVerificationText != 0) { y += cy_spacing + AddVerificationCheckBox(cx_margin, y, cx_width - cx_margin - cx_margin); } // add footer area if (config_.pszFooter != 0 || config_.pszFooterIcon != 0) { y += cy_spacing + AddFooterDividingLine(0, y, cx_width); y += cy_spacing + AddFooter(cx_margin, y, cx_width - cx_margin - cy_margin); } y += cy_margin - cy_spacing; y += ::GetSystemMetrics(SM_CYCAPTION); // update dialog dimension RECT rect = { 0, 0, cx_width, y }; SetWindowPos(0, &rect, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER); }
void CEpgDBUtil::AddBasicInfo(EVENT_INFO* eventInfo, const vector<AribDescriptor::CDescriptor>* descriptorList, WORD onid, WORD tsid) { BOOL foundShort = FALSE; BOOL foundContent = FALSE; BOOL foundComponent = FALSE; BOOL foundGroup = FALSE; BOOL foundRelay = FALSE; for( size_t i=0; i<descriptorList->size(); i++ ){ switch( (*descriptorList)[i].GetNumber(AribDescriptor::descriptor_tag) ){ case AribDescriptor::short_event_descriptor: AddShortEvent(eventInfo, &(*descriptorList)[i]); foundShort = TRUE; break; case AribDescriptor::content_descriptor: AddContent(eventInfo, &(*descriptorList)[i]); foundContent = TRUE; break; case AribDescriptor::component_descriptor: AddComponent(eventInfo, &(*descriptorList)[i]); foundComponent = TRUE; break; case AribDescriptor::event_group_descriptor: if( (*descriptorList)[i].GetNumber(AribDescriptor::group_type) == 1 ){ AddEventGroup(eventInfo, &(*descriptorList)[i], onid, tsid); foundGroup = TRUE; }else if( (*descriptorList)[i].GetNumber(AribDescriptor::group_type) == 2 || (*descriptorList)[i].GetNumber(AribDescriptor::group_type) == 4 ){ AddEventRelay(eventInfo, &(*descriptorList)[i], onid, tsid); foundRelay = TRUE; } break; } } if( AddAudioComponent(eventInfo, descriptorList) == FALSE ){ SAFE_DELETE(eventInfo->audioInfo); } if( foundShort == FALSE ){ SAFE_DELETE(eventInfo->shortInfo); } if( foundContent == FALSE ){ SAFE_DELETE(eventInfo->contentInfo); } if( foundComponent == FALSE ){ SAFE_DELETE(eventInfo->componentInfo); } if( foundGroup == FALSE ){ SAFE_DELETE(eventInfo->eventGroupInfo); } if( foundRelay == FALSE ){ SAFE_DELETE(eventInfo->eventRelayInfo); } }
void BWindow_DollCommand::MySetup(Scene_Battle* _pScene){ /* WINDOWAREA frameArea( BWND_DOLLCOMMAND_X, BWND_DOLLCOMMAND_Y, BWND_DOLLCOMMAND_W, BWND_DOLLCOMMAND_H); WINDOWFONT font( g_font.hInfo, FONTSIZE_INFO, FONTSIZE_INFO+4, ALIGN_CENTER); Window_Selectable_Content content; SetContent(_T("攻撃"), 0, true); SetContent(_T("特技"), 1, true); SetContent(_T("防御"), 2, true); SetRowByContentSize(1); Window_Selectable::Setup_FixContentWidth( &g_wndSkins.skin[WNDSKIN_SIMPLE], frameArea, BWND_DOLLCOMMAND_W-32, 16, font); */ TCHAR commandStr[3][32] = { _T("攻撃"), _T("特技"), _T("防御") }; // 内容のセット SetColumnSize(1); SetPresetFont(PRESETFONT_INFO); SetPresetColor(PRESETCOLORSET_WHITE); align = ALIGN_CENTER; ClearContent(); for(int n=0; n<3; n++){ AddContent(commandStr[n], n); } // タイトルの指定(人形の名前で差し替えられる) SetTitle(_T("ダミー"), PRESETFONT_INFO); // 内容の適用 ApplyContent(); // 大きさの指定 SetWindowSizeByCentering( &g_wndSkins.skin[WNDSKIN_INVISIBLE], BWND_DOLLCOMMAND_X, BWND_DOLLCOMMAND_Y, BWND_DOLLCOMMAND_W, BWND_DOLLCOMMAND_H); // 情報を渡す SetVisible(true); pScene = _pScene; Refresh(); }
AddContentWindow::AddContentWindow(const ScenePtr &dest, QWidget *parent) : QWidget(parent), framework(dest->GetFramework()), scene(dest), position(float3::zero), uploadProgressStep(0), numFailedUploads(0), numSuccessfulUploads(0), numTotalUploads(0) { setWindowModality(Qt::ApplicationModal/*Qt::WindowModal*/); setAttribute(Qt::WA_DeleteOnClose); setWindowTitle(tr("Entity And Asset Import")); QPixmap nullIcon(16,16); // do a null icon to hide the default ugly one nullIcon.fill(Qt::transparent); setWindowIcon(nullIcon); setStyleSheet( "QProgressBar {" "border: 1px solid grey; border-radius: 0px; text-align: center; background-color: rgb(244, 244, 244);" "}" "QProgressBar::chunk {" "background-color: qlineargradient(spread:pad, x1:0.028, y1:1, x2:0.972, y2:1, stop:0 rgba(194, 194, 194, 100), stop:1 rgba(115, 115, 115, 100));" "}" ); QFont titleFont("Arial", 11); titleFont.setBold(true); QVBoxLayout *layout = new QVBoxLayout(); layout->setContentsMargins(5, 5, 5, 5); setLayout(layout); // Entities ui entityView = new QWidget(this); QVBoxLayout *entitiesLayout = new QVBoxLayout(); entitiesLayout->setContentsMargins(0, 0, 0, 0); entityView->setLayout(entitiesLayout); QLabel *entityLabel = new QLabel(tr("Entities"), this); entityLabel->setFont(titleFont); entityLabel->setStyleSheet("color: rgb(63, 63, 63);"); entityTreeWidget = new EntityAndAssetTreeWidget(this); entityTreeWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum); entityTreeWidget->setColumnCount(3); entityTreeWidget->setHeaderLabels(QStringList(QStringList() << tr("Create") << tr("ID") << tr("Name"))); entityTreeWidget->header()->setResizeMode(QHeaderView::ResizeToContents); QPushButton *selectAllEntitiesButton = new QPushButton(tr("Select All")); QPushButton *deselectAllEntitiesButton = new QPushButton(tr("Deselect All")); QHBoxLayout *entityButtonsLayout = new QHBoxLayout; QSpacerItem *entityButtonSpacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); QSpacerItem *middleSpacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Fixed); QVBoxLayout *entitiesProgressLayout = new QVBoxLayout(); entityStatusLabel = new QLabel(this); entityProgressBar = new QProgressBar(this); entityProgressBar->setFixedHeight(20); entitiesLayout->addWidget(entityLabel); entitiesLayout->addLayout(entitiesProgressLayout); entitiesLayout->addWidget(entityTreeWidget); entitiesProgressLayout->addWidget(entityStatusLabel); entitiesProgressLayout->addWidget(entityProgressBar); entityButtonsLayout->addWidget(selectAllEntitiesButton); entityButtonsLayout->addWidget(deselectAllEntitiesButton); entityButtonsLayout->addSpacerItem(entityButtonSpacer); //entitiesLayout->insertLayout(-1, entitiesProgressLayout); entitiesLayout->insertLayout(-1, entityButtonsLayout); entitiesLayout->insertSpacerItem(-1, middleSpacer); layout->addWidget(entityView); // Assets ui assetView = new QWidget(this); QVBoxLayout *assetsLayout = new QVBoxLayout(); assetsLayout->setContentsMargins(0, 0, 0, 0); assetView->setLayout(assetsLayout); QLabel *assetLabel = new QLabel(tr("Assets"), this); assetLabel->setFont(titleFont); assetLabel->setStyleSheet("color: rgb(63, 63, 63);"); assetTreeWidget = new EntityAndAssetTreeWidget(this); assetTreeWidget->setColumnCount(5); QStringList labels; labels << tr("Upload") << tr("Type") << tr("Source name") << tr("Source subname") << tr("Destination name"); assetTreeWidget->setHeaderLabels(labels); QPushButton *selectAllAssetsButton = new QPushButton(tr("Select All"), this); QPushButton *deselectAllAssetsButton = new QPushButton(tr("Deselect All"), this); QHBoxLayout *assetButtonsLayout = new QHBoxLayout(this); QSpacerItem *assetButtonSpacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); QLabel *storageLabel = new QLabel(tr("Asset storage:"), this); storageComboBox = new QComboBox(this); QVBoxLayout *uploadLayout = new QVBoxLayout(); uploadStatusLabel = new QLabel(this); uploadProgressBar = new QProgressBar(this); uploadProgressBar->setFixedHeight(20); GenerateStorageComboBoxContents(); uploadLayout->addWidget(uploadStatusLabel); uploadLayout->addWidget(uploadProgressBar); assetsLayout->addWidget(assetLabel); assetsLayout->addLayout(uploadLayout); assetsLayout->addWidget(assetTreeWidget); assetButtonsLayout->addWidget(selectAllAssetsButton); assetButtonsLayout->addWidget(deselectAllAssetsButton); assetButtonsLayout->addSpacerItem(assetButtonSpacer); assetButtonsLayout->addWidget(storageLabel); assetButtonsLayout->addWidget(storageComboBox); assetsLayout->insertLayout(-1, assetButtonsLayout); layout->addWidget(assetView); uploadStatusLabel->hide(); uploadProgressBar->hide(); entityStatusLabel->hide(); entityProgressBar->hide(); // General controls addContentButton = new QPushButton(tr("Add content"), this); cancelButton = new QPushButton(tr("Cancel"), this); QHBoxLayout *buttonsLayout = new QHBoxLayout(); QSpacerItem *buttonSpacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); buttonsLayout->addSpacerItem(buttonSpacer); buttonsLayout->addWidget(addContentButton); buttonsLayout->addWidget(cancelButton); layout->insertLayout(-1, buttonsLayout); resize(800, 400); connect(addContentButton, SIGNAL(clicked()), SLOT(AddContent())); connect(cancelButton, SIGNAL(clicked()), SLOT(close())); connect(selectAllEntitiesButton, SIGNAL(clicked()), SLOT(SelectAllEntities())); connect(deselectAllEntitiesButton, SIGNAL(clicked()), SLOT(DeselectAllEntities())); connect(selectAllAssetsButton, SIGNAL(clicked()), SLOT(SelectAllAssets())); connect(deselectAllAssetsButton, SIGNAL(clicked()), SLOT(DeselectAllAssets())); connect(assetTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), SLOT(CheckIfColumnIsEditable(QTreeWidgetItem *, int))); connect(storageComboBox, SIGNAL(currentIndexChanged(int)), SLOT(RewriteDestinationNames())); // If we saved recently used storage, and the storage exists in the current combo box, set it as current index. ConfigData configData(ConfigAPI::FILE_FRAMEWORK, cAddContentDialogSetting, cRecentStorageSetting, "", ""); QString storageName = framework->Config()->Get(configData).toString(); if (!storageName.isEmpty()) for(int i = 0; i < storageComboBox->count(); ++i) if (storageComboBox->itemData(i) == storageName) { storageComboBox->setCurrentIndex(i); break; } connect(this, SIGNAL(AssetUploadCompleted(const AssetStoragePtr &, int, int)), SLOT(CreateEntities())); }
BOOL CMyHttp::UploadFile() { //指定ファイルをアップロード // CString path = m_sUploadPath; m_sending = TRUE; CString domain = "sharestyle.com"; int port = 80; CString arg = "/~rakusai/buco/buco.php"; CString url = "http://" + domain + arg ; HINTERNET hInternet; HINTERNET hHttpSession; HINTERNET hHttpRequest; char line[1000]; char szHeader[1000]; char boundary[] = "---------------------------7d533c243505c0"; DWORD ReadSize; R_S_CONTENT content; /* WININET初期化 */ hInternet = InternetOpen( "Mozilla/4.76 [en_jp] (X11; U; SunOS 5.8 sun4u)", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); if (!hInternet){ m_strErr = "Can not init internet."; m_sending = FALSE; return FALSE; } /* サーバへ接続 */ hHttpSession = InternetConnect( hInternet, domain, port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); /* char cookie[3000]; DWORD clen = 3000; InternetGetCookie("http://127.0.0.1:10000/test/index.cgi","current_page2",cookie,&clen); SetDlgItemText(IDC_EDIT2,cookie); */ if (!hHttpSession){ InternetCloseHandle(hInternet); m_strErr = "Can not open the server."; m_sending = FALSE; return FALSE; } /* HTTP要求の作成 */ hHttpRequest = HttpOpenRequest( hHttpSession, "POST", arg, NULL, url, NULL, 0, 0); if (!hHttpRequest){ InternetCloseHandle(hHttpSession); InternetCloseHandle(hInternet); m_strErr = "Can not init request."; m_sending = FALSE; return FALSE; } /* HTTP要求のヘッダー作成 */ sprintf(szHeader, "Content-Type: multipart/form-data; boundary=%s\r\n",boundary); HttpAddRequestHeaders(hHttpRequest,szHeader,lstrlen(szHeader),HTTP_ADDREQ_FLAG_REPLACE |HTTP_ADDREQ_FLAG_ADD); /* HTTP要求のコンテンツ作成 */ InitContent(&content); sprintf(line,"--%s\r\n",boundary); AddContent(&content,line,strlen(line)); sprintf(line,"Content-Disposition: form-data; name=\"%s\"\r\n\r\n%s\r\n","action","regist"); AddContent(&content,line,strlen(line)); //現在のユーザー名 sprintf(line,"--%s\r\n",boundary); AddContent(&content,line,strlen(line)); sprintf(line,"Content-Disposition: form-data; name=\"%s\"\r\n\r\n%s\r\n","name",m_strName); AddContent(&content,line,strlen(line)); //ファイル sprintf(line,"--%s\r\n",boundary); AddContent(&content,line,strlen(line)); sprintf(line,"Content-Disposition: form-data; name=\"data\"; filename=\"%s\"\r\n",m_strPath); AddContent(&content,line,strlen(line)); strcpy(line,"Content-Type: application/octet-stream\r\n"); AddContent(&content,line,strlen(line)); strcpy(line,"Content-Transfer-Encoding: binary\r\n\r\n"); AddContent(&content,line,strlen(line)); //ファイルを開く HANDLE hFile = CreateFile(m_strPath,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0); if (hFile != INVALID_HANDLE_VALUE){ DWORD size = GetFileSize(hFile,NULL); char * buf = new char[size+1]; ReadFile(hFile,buf,size,&ReadSize,NULL); buf[ReadSize] = '\0'; CloseHandle(hFile); AddContent(&content,buf,ReadSize); delete[] buf; } strcpy(line,"\r\n"); AddContent(&content,line,strlen(line)); sprintf(line,"--%s--\r\n",boundary); AddContent(&content,line,strlen(line)); /* 作成したHTTP要求の発行 */ BOOL bReq = HttpSendRequest( hHttpRequest, NULL, 0, content.Data, content.Size); if (!bReq){ FreeContent(&content); InternetCloseHandle(hHttpRequest); InternetCloseHandle(hHttpSession); InternetCloseHandle(hInternet); m_strErr = "Can not post data."; m_sending = FALSE; return FALSE; } /* コンテンツバッファを初期化 */ FreeContent(&content); InitContent(&content); /* コンテンツの内容を取得・表示 */ while (1){ if (InternetReadFile(hHttpRequest, line, sizeof(line), &ReadSize) && ReadSize > 0) { AddContent(&content,line,ReadSize); }else{ break; } } //Keep-Aliveかどうか? /* char url[1000]; char *re1, *re2; if (re1 = _tcsstr(content.Data,"FlashVars=\"")){ if (re2 = _tcsstr(re1+11,"\"")){ *re2 = '\0'; strcpy(url,m_CurUrl); strcat(url,"link.cgi?"); strcat(url,re1+11); // AfxMessageBox(url); if (!m_wndBrowser.WriteFrame(url)){ AfxMessageBox("ファイルを貼り付けられませんでした。"); } } }else if (re1 = _tcsstr(content.Data,"link.swf")){ if (re2 = _tcsstr(re1,"\"")){ strncpy(re1,"link.cgi",8); //link.swfをlink.cgiに変更 *re2 = '\0'; strcpy(url,m_CurUrl); strcat(url,re1); // AfxMessageBox(re1); if (!m_wndBrowser.WriteFrame(url)){ AfxMessageBox("ファイルを貼り付けられませんでした。"); } } }else{ AfxMessageBox("サーバーからエラー返答です。ファイルを貼り付けられませんでした。"); if (re1 = _tcsstr(content.Data,"エラー")){ if (re2 = _tcsstr(re1,"<")){ *re2 = '\0'; AfxMessageBox(re1); } } } */ /* 後処理 */ FreeContent(&content); InternetCloseHandle(hHttpRequest); InternetCloseHandle(hHttpSession); InternetCloseHandle(hInternet); m_strErr = ""; m_sending = FALSE; return TRUE; }